Jelajahi Sumber

Merge remote-tracking branch 'origin/dev2' into dev2

# Conflicts:
#	RMS/src/main/resources/application.yml
lwhhszx 2 tahun lalu
induk
melakukan
57616b2a43

+ 22 - 12
RMS/src/main/java/cn/cslg/report/service/impl/FollowUpServiceImpl.java

@@ -170,19 +170,16 @@ public class FollowUpServiceImpl implements IFollowUpService {
             log.info("登记结果失败,{}", message);
         }
         log.info("登记结果完成");
-        //上传附件 进行关联绑定
-        if (files != null && files.size() != 0) {
-            //将文档上传并返回文件入库的Id
-            List<Integer> fileIds = reportFileService.uploadFiles(files);
-            this.addAsso(register.getFollowUpId(), fileIds);
-        }
+
+        //删除
+
         //简化定义后续事项id
         int followUpId = register.getFollowUpId();
         //根据后续事项id查询关联表找出所有fileId
         List<Integer> fileIdS = followUpMapper.queryFileIdByFollowUpId(followUpId);
         //判断第二次登记结果时候文件数量
-        if(register.getFilesVOs() != null){//传入不为空
-            List<FilesVO> filesVOs= register.getFilesVOs();
+        List<FilesVO> filesVOs= register.getFilesVOs();
+        if(filesVOs != null){//传入不为空
             //遍历前端传入数据,取得fileId的集合ids
             List<Integer> ids = new ArrayList<>();
             for(FilesVO filesVO:filesVOs){
@@ -197,13 +194,25 @@ public class FollowUpServiceImpl implements IFollowUpService {
                     deleteIds.add(fileId);
                 }
             }
-            followUpMapper.deleteAssoId(followUpId,deleteIds);
-            log.info("多余关联附件删除完成");
-        }else{//传入为空数组 等于附件需要全部删除
+            if(deleteIds.size()>0) {
+                followUpMapper.deleteAssoId(followUpId, deleteIds);
+                log.info("多余关联附件删除完成");
+            }
+        }else if(filesVOs != null && filesVOs.size() == 0){//传入为空数组 等于附件需要全部删除
             followUpMapper.deleteAssoId(followUpId,fileIdS);
         }
+        //新增文件
+
+        //上传附件 进行关联绑定
+        if (files != null && files.size() != 0) {
+            //将文档上传并返回文件入库的Id
+            List<Integer> fileIds = reportFileService.uploadFiles(files);
+            this.addAsso(register.getFollowUpId(), fileIds);
+        }
         //批量新增后续事项
-        this.add(register.getFollowUps());
+        if(register.getFollowUps() != null && register.getFollowUps().size()>0) {
+            this.add(register.getFollowUps());
+        }
     }
 
     /**
@@ -220,6 +229,7 @@ public class FollowUpServiceImpl implements IFollowUpService {
             assoFollowUpFile.setFileId(fileId);
             assoFollowUpFile.setFileType(0);
             int rows = followUpMapper.addAssoIds(assoFollowUpFile);
+            System.out.println(rows);
             if(rows != 1){
                 String message = "第" + i + "条失败";
                 log.info("新增后续事项和附件id关联表数据失败,{}", message);

+ 3 - 2
RMS/src/main/resources/application-dev.yml

@@ -30,7 +30,7 @@ spring:
         max-wait: -1ms
     timeout: 2000ms
   datasource:
-    url: jdbc:mysql://192.168.1.24:3306/RMS_TEST?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
+    url: jdbc:mysql://192.168.1.24:3306/rms_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=GMT%2B8
     driver-class-name: com.mysql.cj.jdbc.Driver
     username: root
     password: rrzTwWAYX8Gxh5JH
@@ -60,4 +60,5 @@ PASFile: http://192.168.1.24:8011
 PCSUrl: http://localhost:8871
 PASUrl: http://localhost:8877
 PCS: http://192.168.1.24:81
-PAS: http://192.168.1.24:80
+#PAS: http://192.168.1.24:80
+PAS: http://192.168.1.9:8086

+ 26 - 26
RMS/src/main/resources/mapper/FollowUpMapper.xml

@@ -9,9 +9,9 @@
                               agent, assist_person, finish_time, status, conclusion, create_person_id,
                               create_person_name)
         values
-               (#{reportId}, #{parentId}, #{followUpName}, #{remark},
-                #{timeLimit}, #{agent}, #{assistPerson}, #{finishTime}, #{status},
-                #{conclusion}, #{createPersonId}, #{createPersonName})
+            (#{reportId}, #{parentId}, #{followUpName}, #{remark},
+             #{timeLimit}, #{agent}, #{assistPerson}, #{finishTime}, #{status},
+             #{conclusion}, #{createPersonId}, #{createPersonName})
     </insert>
     <!--根据id修改数据-->
     <!--int update(FollowUp followUp);-->
@@ -78,24 +78,24 @@
         <result column="file_name" property="fileName"/>
     </resultMap>
 
-<!--    <select id="query" resultMap="queryMap">-->
-<!--        select id,-->
-<!--               report_id,-->
-<!--               parent_id,-->
-<!--               follow_up_name,-->
-<!--               remark,-->
-<!--               time_limit,-->
-<!--               agent,-->
-<!--               assist_person,-->
-<!--               finish_time,-->
-<!--               status,-->
-<!--               conclusion,-->
-<!--               create_person_id,-->
-<!--               create_person_name,-->
-<!--               create_time-->
-<!--        from follow_up-->
-<!--        where report_id = #{reportId}-->
-<!--    </select>-->
+    <!--    <select id="query" resultMap="queryMap">-->
+    <!--        select id,-->
+    <!--               report_id,-->
+    <!--               parent_id,-->
+    <!--               follow_up_name,-->
+    <!--               remark,-->
+    <!--               time_limit,-->
+    <!--               agent,-->
+    <!--               assist_person,-->
+    <!--               finish_time,-->
+    <!--               status,-->
+    <!--               conclusion,-->
+    <!--               create_person_id,-->
+    <!--               create_person_name,-->
+    <!--               create_time-->
+    <!--        from follow_up-->
+    <!--        where report_id = #{reportId}-->
+    <!--    </select>-->
 
     <select id="query" resultMap="queryMap">
         select a.id, a.report_id, a.parent_id, a.follow_up_name,a.remark,a.time_limit,a.agent,a.assist_person,a.finish_time,a.status, a.conclusion,
@@ -132,9 +132,9 @@
         from asso_follow_up_file
         where follow_up_id = #{followUpId}
         and FILE_ID in
-            <foreach collection="fileIds" item="fileId" index="index" open="(" close=")" separator=",">
-                #{fileId}
-            </foreach>
+        <foreach collection="fileIds" item="fileId" index="index" open="(" close=")" separator=",">
+            #{fileId}
+        </foreach>
     </delete>
 
 
@@ -146,11 +146,11 @@
 
 
     <!--插入数据-->
-    <!--int addAssoIds(List<AssoFollowUpFile> assoFollowUpFiles);-->
+    <!--int addAssoIds(AssoFollowUpFile assoFollowUpFile);-->
     <insert id="addAssoIds" useGeneratedKeys="true" keyProperty="id">
         insert into asso_follow_up_file(follow_up_id, file_id, file_type)
         values
             (#{followUpId}, #{fileId}, #{fileType})
     </insert>
 
-</mapper>
+</mapper>