瀏覽代碼

4/5 新增报告和新增核心结论中添加新增后续事项的代码

chendayu 2 年之前
父節點
當前提交
f80c9fc0f3

+ 7 - 1
RMS/src/main/java/cn/cslg/report/common/model/dto/ConclusionDTO.java

@@ -20,7 +20,7 @@ import java.util.List;
 @AllArgsConstructor
 @Builder(toBuilder = true)
 public class ConclusionDTO {
-   private Integer reportId;
+    private Integer reportId;
     /**
      * 核心结论
      */
@@ -28,4 +28,10 @@ public class ConclusionDTO {
     private String cronConclusion;
 
     private List<Integer> conclusionIds;
+
+    /**
+     * 后续事项
+     */
+    private List<FollowUpDTO> followUps;
+
 }

+ 4 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/ReportDTO.java

@@ -186,5 +186,9 @@ public class ReportDTO  {
      * 事件
      */
     private List<EventAddNewDTO> eventAddNewDTOs;
+    /**
+     * 后续事项
+     */
+    private List<FollowUpDTO> followUps;
 
 }

+ 18 - 0
RMS/src/main/java/cn/cslg/report/common/utils/ThrowException.java

@@ -0,0 +1,18 @@
+package cn.cslg.report.common.utils;
+
+import cn.cslg.report.exception.XiaoShiException;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * @Author chenyu
+ * @Date 2023/4/2
+ */
+@Slf4j
+public class ThrowException {
+
+    public static void throwXiaoShiException(String message) {
+        log.info("{}", message);
+        throw new XiaoShiException(message);
+    }
+
+}

+ 24 - 6
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -3,6 +3,7 @@ package cn.cslg.report.service.business;
 import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.dto.ConclusionDTO;
 import cn.cslg.report.common.model.dto.EventAddNewDTO;
+import cn.cslg.report.common.model.dto.FollowUpDTO;
 import cn.cslg.report.common.model.dto.ReportDTO;
 import cn.cslg.report.common.model.vo.*;
 import cn.cslg.report.common.utils.*;
@@ -14,10 +15,7 @@ import cn.cslg.report.entity.*;
 import cn.cslg.report.entity.asso.AssoReportFile;
 import cn.cslg.report.entity.asso.AssoReportPerson;
 import cn.cslg.report.mapper.ReportMapper;
-import cn.cslg.report.service.IAssoEventReportService;
-import cn.cslg.report.service.IAvoidDesignDirectionService;
-import cn.cslg.report.service.IProductService;
-import cn.cslg.report.service.OutInterfaceService;
+import cn.cslg.report.service.*;
 import cn.cslg.report.service.business.asso.AssoReportPersonService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -71,6 +69,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final SystemDictItemService systemDictItemService;
     private final AssoReportPersonService assoReportPersonService;
     private final IAssoEventReportService assoEventReportService;
+    private final IFollowUpService followUpService;
 
     private Report loadReport(ReportDTO reportDto) {
         Report report = new Report();
@@ -167,8 +166,9 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             reportFieldService.addDefaultField(report.getId(), report.getType());
         }
 
+        Integer reportId = report.getId();
 
-        //新增事件(若有事件)
+        //新增事件
         List<EventAddNewDTO> eventAddNewDTOs = reportDto.getEventAddNewDTOs();
         if (eventAddNewDTOs != null && eventAddNewDTOs.size() > 0) {
             List<Integer> eventIds = new ArrayList<>();
@@ -186,8 +186,16 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 eventIds.add(oldEventAddNewDTO.getId());
             }
             //新增事件和报告关联
-            assoEventReportService.addNew(eventIds, report.getId());
+            assoEventReportService.addNew(eventIds, reportId);
+        }
 
+        //新增后续事项
+        List<FollowUpDTO> followUps = reportDto.getFollowUps();
+        if (followUps != null && followUps.size() > 0) {
+            for (FollowUpDTO followUp : followUps) {
+                followUp.setReportId(reportId);
+            }
+            followUpService.add(followUps);
         }
 
         return report.getId();
@@ -660,6 +668,16 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         if (report.getConclusionIds() != null) {
             report.setConclusionId(StringUtils.join(conclusionDTO.getConclusionIds(), ","));
         }
+
+        //调新增后续事项业务
+        List<FollowUpDTO> followUps = conclusionDTO.getFollowUps();
+        if (followUps != null && followUps.size() > 0) {
+            for (FollowUpDTO followUp : followUps) {
+                followUp.setReportId(conclusionDTO.getReportId());
+            }
+            followUpService.add(followUps);
+        }
+
         return report.updateById();
 
     }