ConfessionSessionController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package cn.cslg.pas.controller.common;
  2. import cn.cslg.pas.common.core.base.Constants;
  3. import cn.cslg.pas.common.model.dify.ChatMessageDTO;
  4. import cn.cslg.pas.common.model.dify.DifyHistoryMessageDTO;
  5. import cn.cslg.pas.common.model.dify.confessionSession.*;
  6. import cn.cslg.pas.common.utils.CacheUtils;
  7. import cn.cslg.pas.common.utils.LoginUtils;
  8. import cn.cslg.pas.common.utils.Response;
  9. import cn.cslg.pas.service.common.DifyService;
  10. import cn.cslg.pas.service.dify.ConfessionSessionService;
  11. import cn.cslg.pas.service.dify.DifySessionService;
  12. import com.alibaba.fastjson2.JSONObject;
  13. import io.swagger.v3.oas.annotations.Operation;
  14. import io.swagger.v3.oas.annotations.tags.Tag;
  15. import lombok.RequiredArgsConstructor;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.context.annotation.Lazy;
  18. import org.springframework.http.MediaType;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestMethod;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import reactor.core.publisher.Flux;
  24. import java.io.IOException;
  25. import java.util.List;
  26. @SuppressWarnings({"all"})
  27. @Tag(name = "外部人员调用接口")
  28. @RestController
  29. @RequestMapping(Constants.API_XiaoSHI + "/confessionSession")
  30. @RequiredArgsConstructor(onConstructor_ = {@Lazy})
  31. public class ConfessionSessionController {
  32. private final DifyService difyService;
  33. private final ConfessionSessionService confessionSessionService;
  34. @Autowired
  35. private CacheUtils cacheUtils;
  36. @Autowired
  37. private LoginUtils loginUtils;
  38. //
  39. @RequestMapping(value = "/addConfessionSession", method = RequestMethod.POST)
  40. @Operation(summary = "生成交底书会话记录")
  41. public Response addConfessionSession(@RequestBody AddConfessionSessionDTO addConfessionSessionDTO) throws IOException {
  42. Integer id = confessionSessionService.addConfessionSession(addConfessionSessionDTO);
  43. return Response.success(id);
  44. }
  45. @RequestMapping(value = "/updateConfessionSession", method = RequestMethod.POST)
  46. @Operation(summary = "更新技术交底书会话记录")
  47. public Response updateConfessionSession(@RequestBody UpdateConfessionSessionDTO updateConfessionSessionDTO) throws IOException {
  48. Integer id = confessionSessionService.updateConfessionSession(updateConfessionSessionDTO);
  49. return Response.success(id);
  50. }
  51. @RequestMapping(value = "/queryConfessionSession", method = RequestMethod.POST)
  52. @Operation(summary = "查询技术交底书会话记录")
  53. public Response queryConfessionSession(@RequestBody QueryConfessionSessionDTO queryConfessionSessionDTO) throws IOException {
  54. List<QueryConfessionSessionVO> queryConfessionSessions=confessionSessionService.queryConfessionSession(queryConfessionSessionDTO);
  55. return Response.success(queryConfessionSessions);
  56. }
  57. @RequestMapping(value = "/deleteConfessionSessions", method = RequestMethod.POST)
  58. @Operation(summary = "删除技术交底书会话记录")
  59. public Response deleteConfessionSessions(@RequestBody DeleteConfessionSessionDTO deleteConfessionSessionDTO) throws IOException {
  60. List<Integer> ids =confessionSessionService.deleteConfessionSessions(deleteConfessionSessionDTO);
  61. return Response.success(ids);
  62. }
  63. @RequestMapping(value = "/addSession", method = RequestMethod.POST)
  64. @Operation(summary = "添加会话记录")
  65. public Response addSession(@RequestBody AddConfessionSessionDTO addConfessionSessionDTO) throws IOException {
  66. Integer id = confessionSessionService.addSession(addConfessionSessionDTO);
  67. return Response.success(id);
  68. }
  69. }