package cn.cslg.pas.controller.common; import cn.cslg.pas.common.core.base.Constants; import cn.cslg.pas.common.model.dify.ChatMessageDTO; import cn.cslg.pas.common.model.dify.DifyHistoryMessageDTO; import cn.cslg.pas.common.model.dify.confessionSession.*; import cn.cslg.pas.common.model.dify.generateDiscoveryResult.UpdateDiscoveryResultDTO; import cn.cslg.pas.common.utils.CacheUtils; import cn.cslg.pas.common.utils.LoginUtils; import cn.cslg.pas.common.utils.Response; import cn.cslg.pas.service.common.DifyService; import cn.cslg.pas.service.dify.ConfessionSessionService; import cn.cslg.pas.service.dify.DifySessionService; import com.alibaba.fastjson2.JSONObject; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import reactor.core.publisher.Flux; import java.io.IOException; import java.util.List; @SuppressWarnings({"all"}) @Tag(name = "外部人员调用接口") @RestController @RequestMapping(Constants.API_XiaoSHI + "/confessionSession") @RequiredArgsConstructor(onConstructor_ = {@Lazy}) public class ConfessionSessionController { private final DifyService difyService; private final ConfessionSessionService confessionSessionService; @Autowired private CacheUtils cacheUtils; @Autowired private LoginUtils loginUtils; // @RequestMapping(value = "/addConfessionSession", method = RequestMethod.POST) @Operation(summary = "生成交底书会话记录") public Response addConfessionSession(@RequestBody AddConfessionSessionDTO addConfessionSessionDTO) throws IOException { Integer id = confessionSessionService.addConfessionSession(addConfessionSessionDTO); return Response.success(id); } @RequestMapping(value = "/updateConfessionSession", method = RequestMethod.POST) @Operation(summary = "更新技术交底书会话记录") public Response updateConfessionSession(@RequestBody UpdateConfessionSessionDTO updateConfessionSessionDTO) throws IOException { Integer id = confessionSessionService.updateConfessionSession(updateConfessionSessionDTO); return Response.success(id); } @RequestMapping(value = "/queryConfessionSession", method = RequestMethod.POST) @Operation(summary = "查询技术交底书会话记录") public Response queryConfessionSession(@RequestBody QueryConfessionSessionDTO queryConfessionSessionDTO) throws IOException { List queryConfessionSessions=confessionSessionService.queryConfessionSession(queryConfessionSessionDTO); return Response.success(queryConfessionSessions); } @RequestMapping(value = "/deleteConfessionSessions", method = RequestMethod.POST) @Operation(summary = "删除技术交底书会话记录") public Response deleteConfessionSessions(@RequestBody DeleteConfessionSessionDTO deleteConfessionSessionDTO) throws IOException { List ids =confessionSessionService.deleteConfessionSessions(deleteConfessionSessionDTO); return Response.success(ids); } @RequestMapping(value = "/addSession", method = RequestMethod.POST) @Operation(summary = "添加会话记录") public Response addSession(@RequestBody AddConfessionSessionDTO addConfessionSessionDTO) throws IOException { Integer id = confessionSessionService.addSession(addConfessionSessionDTO); return Response.success(id); } @RequestMapping(value = "/addConfessionSessionFile", method = RequestMethod.POST) @Operation(summary = "添加会话记录关联文件") public Response addConfessionSessionFile(@RequestBody AddConfessionSessionFileDTO addConfessionSessionDTO) throws IOException { Integer id = confessionSessionService.addConfessionSessionFile(addConfessionSessionDTO); return Response.success(id); } @RequestMapping(value = "/updateDiscoveryResult", method = RequestMethod.POST) @Operation(summary = "更新技术交底书理解结果") public Response updateDiscoryResult(@RequestBody UpdateDiscoveryResultDTO updateDiscoveryResultDTO) throws IOException { Integer id = confessionSessionService.updateDiscoveryResult(updateDiscoveryResultDTO); return Response.success(id); } @RequestMapping(value = "/detail", method = RequestMethod.POST) @Operation(summary = "查询会话记录详情") public Response detail(@RequestBody ConfessionSessionDetailDTO confessionSessionDetailDTO) throws IOException { ConfessionSessionDetailVO confessionSessionDetailVO = confessionSessionService.getConfessionSessionDetail(confessionSessionDetailDTO); return Response.success(confessionSessionDetailVO); } }