Pārlūkot izejas kodu

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

# Conflicts:
#	RMS/src/main/java/cn/cslg/report/service/business/ReportService.java
lwhhszx 2 gadi atpakaļ
vecāks
revīzija
d97485cafa

+ 6 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/RegisterDTO.java

@@ -1,5 +1,6 @@
 package cn.cslg.report.common.model.dto;
 
+import cn.cslg.report.common.model.vo.FilesVO;
 import lombok.Data;
 
 import java.util.List;
@@ -28,6 +29,11 @@ public class RegisterDTO {
     private String conclusion;
 
     /**
+     * 文件信息
+     */
+    private List<FilesVO> filesVOs;
+
+    /**
      * 批量新增后续事项
      *
      * @param followUpDTOList

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

@@ -181,4 +181,10 @@ public class ReportDTO  {
     private List<Integer> conclusionIds;
     private List<Integer> copyIds;
     private List<String> types;
+
+    /**
+     * 事件
+     */
+    private List<EventAddNewDTO> eventAddNewDTOs;
+
 }

+ 19 - 15
RMS/src/main/java/cn/cslg/report/controller/ReportController.java

@@ -33,6 +33,7 @@ import java.util.List;
 public class ReportController {
     private final ReportService reportService;
     private final ReportReferencesService reportReferencesService;
+
     /**
      * @param report 报告类
      * @author 沈永艺
@@ -43,11 +44,11 @@ public class ReportController {
     @Operation(summary = "新增报告")
     @checkAuth(FunId = "/pcs/report/add")
     @Transactional(rollbackFor = Exception.class)
-    public String addReport(String report, List<MultipartFile> files) {
+    public String addReport(String report, List<MultipartFile> files) throws IOException {
         if (report != null) {
             //新建报告并返回报告Id
-            ReportDTO report1 =JSONObject.parseObject(report,ReportDTO.class);
-            Integer reportId = reportService.addReport(report1,files);
+            ReportDTO report1 = JSONObject.parseObject(report, ReportDTO.class);
+            Integer reportId = reportService.addReport(report1, files);
             return Response.success("添加成功");
         } else {
             return Response.error("网络异常");
@@ -56,11 +57,11 @@ public class ReportController {
 
     @RequestMapping(value = "/updateReport", method = RequestMethod.POST)
     @Operation(summary = "修改报告")
-    public String updateReport( String report, List<MultipartFile> files) throws IOException {
+    public String updateReport(String report, List<MultipartFile> files) throws IOException {
         if (report != null) {
-            ReportDTO report1 =JSONObject.parseObject(report,ReportDTO.class);
+            ReportDTO report1 = JSONObject.parseObject(report, ReportDTO.class);
             report1.setScenarioId(StringUtils.join(report1.getScenarioList(), ","));
-            Boolean flag = reportService.updateReport(report1,files);
+            Boolean flag = reportService.updateReport(report1, files);
             if (flag) {
                 return Response.success("添加成功");
             } else {
@@ -83,31 +84,34 @@ public class ReportController {
     public String deleReport(Integer id) throws IOException {
         return reportService.reportDele(id);
     }
+
     @RequestMapping(value = "/addFile", method = RequestMethod.POST)
     @Operation(summary = "文件上传")
-    public  String addFile(String jsons, List<MultipartFile> files) throws IOException{
+    public String addFile(String jsons, List<MultipartFile> files) throws IOException {
         ReportReferences reportReferences = JSONObject.parseObject(jsons, ReportReferences.class);
 
-        return reportReferencesService.add(reportReferences,files);
+        return reportReferencesService.add(reportReferences, files);
     }
+
     @PostMapping(value = "selectfile")
     @Operation(summary = "文件查询")
-    public String queryLitigationHistory(@RequestBody ReportReferences reportReferences)throws IOException{
-            return reportReferencesService.queryReportReferences(reportReferences);
+    public String queryLitigationHistory(@RequestBody ReportReferences reportReferences) throws IOException {
+        return reportReferencesService.queryReportReferences(reportReferences);
     }
+
     @GetMapping("/deletefile")
     @Operation(summary = "删除文件")
-    public String deleFile(int id)throws IOException{
+    public String deleFile(int id) throws IOException {
         return reportReferencesService.delete(id);
     }
 
     @PostMapping(value = "updatefiles")
     @Operation(summary = "文件修改")
     @Transactional(rollbackFor = Exception.class)
-   public  String updatefiles(String jsons, List<MultipartFile> files) throws IOException {
+    public String updatefiles(String jsons, List<MultipartFile> files) throws IOException {
         ReportReferences reportReferences = JSONObject.parseObject(jsons, ReportReferences.class);
         Boolean ja = reportReferencesService.updateReportReferences(reportReferences, files);
-        if(ja){
+        if (ja) {
             return Response.success();
         }
         return Response.error();
@@ -116,8 +120,8 @@ public class ReportController {
     @GetMapping(value = "updateStatus")
     @Operation(summary = "修改报告状态")
     @Transactional(rollbackFor = Exception.class)
-    public String updateStatus(Integer reportId,Integer status){
-        reportService.updateStatus(reportId,status);
+    public String updateStatus(Integer reportId, Integer status) {
+        reportService.updateStatus(reportId, status);
         return Response.success();
     }
 

+ 17 - 0
RMS/src/main/java/cn/cslg/report/mapper/FollowUpMapper.java

@@ -59,6 +59,23 @@ public interface FollowUpMapper {
     int delete(List<Integer> ids);
 
     /**
+     * 根据后续事项id和文件id删除关联数据
+     *
+     * @param followUpId 后续事项id
+     * @param fileIds 文件ids
+     * @return 返回受影响的行数
+     */
+    int deleteAssoId(Integer followUpId, List<Integer> fileIds);
+
+    /**
+     * 根据传入后续事项id查询关联表中有的全部fileId
+     *
+     * @param followUpId
+     * @return
+     */
+    List<Integer> queryFileIdByFollowUpId(Integer followUpId);
+
+    /**
      * 插入后续事项id和附件id关联表
      *
      * @param assoFollowUpFile

+ 9 - 0
RMS/src/main/java/cn/cslg/report/service/IFollowUpService.java

@@ -55,6 +55,15 @@ public interface IFollowUpService {
     void delete(List<Integer> ids);
 
     /**
+     * 根据后续事项id和文件id删除许可记录数据
+     *
+     * @param followUpId 后续事项id
+     * @param fileIds 文件id
+     */
+    @Transactional
+    void deleteAssoId(Integer followUpId,List<Integer> fileIds);
+
+    /**
      * 登记结果
      *
      * @param register

+ 69 - 40
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -3,6 +3,7 @@ package cn.cslg.report.service;
 import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.PASPatentVO;
 import cn.cslg.report.common.model.ProjectSourceVO;
+import cn.cslg.report.common.model.dto.EventAddNewDTO;
 import cn.cslg.report.common.model.dto.PasUserDTO;
 import cn.cslg.report.common.model.vo.*;
 import cn.cslg.report.common.utils.CacheUtils;
@@ -192,6 +193,7 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     /**
      * @title 分页查询人员
      * @description 接口来源:PCS
@@ -205,7 +207,7 @@ public class OutInterfaceService {
         map.put("tenant", personnelVO.getTenant());
         map.put("size", personnelVO.getSize());
         map.put("current", personnelVO.getCurrent());
-        map.put("notInPersonIds",personnelVO.getNotInPersonIds());
+        map.put("notInPersonIds", personnelVO.getNotInPersonIds());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
         OkHttpClient okHttpClient = new OkHttpClient();
@@ -226,7 +228,7 @@ public class OutInterfaceService {
 
         String param = new Gson().toJson(ids);
         RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
-        OkHttpClient okHttpClient =new OkHttpClient.Builder()
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                 .connectTimeout(60, TimeUnit.SECONDS)
                 .writeTimeout(60, TimeUnit.SECONDS)
                 .readTimeout(60, TimeUnit.SECONDS)
@@ -321,6 +323,7 @@ public class OutInterfaceService {
 
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     public String getPatentNos(Integer projectId) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
@@ -355,7 +358,7 @@ public class OutInterfaceService {
         Report report = reportService.getById(patentVO.getReportId());
         if (type == 0) {
             patentVO.setProjectId(report.getProjectId());
-             patentVO.setImportTaskId(taskIds);
+            patentVO.setImportTaskId(taskIds);
 
         }
         String param = new Gson().toJson(patentVO);
@@ -372,6 +375,27 @@ public class OutInterfaceService {
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
+    /**
+     * 调用分析系统新增事件接口
+     *
+     * @param eventAddNewDTOs
+     * @return
+     */
+    public String getEventIdsFromPAS(List<EventAddNewDTO> eventAddNewDTOs) throws IOException {
+        String param = new Gson().toJson(eventAddNewDTOs);
+        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
+        OkHttpClient okHttpClient = new OkHttpClient.Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .build();
+        Request request = new Request.Builder()
+                .url(PASUrl + "/api/v2/event/addNew")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+    }
+
     public String getConPantentNos(PatentVO patentVO, int type) throws IOException {
         LambdaQueryWrapper<ImportTask> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ImportTask::getReportId, patentVO.getReportId());
@@ -386,25 +410,25 @@ public class OutInterfaceService {
             map.put("endNumber", patentVO.getEndNumber());
         }
         //专利名称
-        map.put("patentName",patentVO.getPatentName());
+        map.put("patentName", patentVO.getPatentName());
         //专利摘要
-        map.put("abstractStr",patentVO.getAbstractStr());
+        map.put("abstractStr", patentVO.getAbstractStr());
         map.put("size", patentVO.getSize());
         map.put("current", patentVO.getCurrent());
         map.put("patentNos", patentVO.getPatentNos());
         //申请人名字
-        map.put("applicationName",patentVO.getApplicationName());
+        map.put("applicationName", patentVO.getApplicationName());
         //申请号
-        map.put("applicationNo",patentVO.getApplicationNo());
+        map.put("applicationNo", patentVO.getApplicationNo());
         //专利号
-        map.put("patentNo",patentVO.getPatentNo());
+        map.put("patentNo", patentVO.getPatentNo());
         //权利人名字
-        map.put("obligeeName" ,patentVO.getObligeeName());
+        map.put("obligeeName", patentVO.getObligeeName());
         map.put("notInPatentNos", patentVO.getNotInPatentNos());
         //分类号(IPC,UPC,CPC)
-        map.put("numberCpc",patentVO.getNumberCpc());
-        map.put("numberIpc",patentVO.getNumberIpc());
-        map.put("numberUpc",patentVO.getNumberUpc());
+        map.put("numberCpc", patentVO.getNumberCpc());
+        map.put("numberIpc", patentVO.getNumberIpc());
+        map.put("numberUpc", patentVO.getNumberUpc());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
         OkHttpClient okHttpClient = new OkHttpClient.Builder()
@@ -418,29 +442,32 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     //根据专利号列表获得专利详情
-  public String  getPatentDTOListForRMS(PatentVO patentVO) throws  IOException{
-      Map<String, Object> map = new HashMap<>();
-      map.put("patentNos", patentVO.getPatentNos());
-      JSONObject json = new JSONObject(map);
-      RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
-      OkHttpClient okHttpClient = new OkHttpClient
-              .Builder()
-              .connectTimeout(60, TimeUnit.SECONDS)
-              .writeTimeout(60, TimeUnit.SECONDS)
-              .readTimeout(60, TimeUnit.SECONDS)
-              .build();;;
-      Request request = new Request.Builder()
-              .url(PASUrl + "/api/v2/system/getPatentDTOListForRMS")
-              .post(requestBody)
-              .build();
-      return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
-
-
-  }
+    public String getPatentDTOListForRMS(PatentVO patentVO) throws IOException {
+        Map<String, Object> map = new HashMap<>();
+        map.put("patentNos", patentVO.getPatentNos());
+        JSONObject json = new JSONObject(map);
+        RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
+        OkHttpClient okHttpClient = new OkHttpClient
+                .Builder()
+                .connectTimeout(60, TimeUnit.SECONDS)
+                .writeTimeout(60, TimeUnit.SECONDS)
+                .readTimeout(60, TimeUnit.SECONDS)
+                .build();
+        ;
+        ;
+        Request request = new Request.Builder()
+                .url(PASUrl + "/api/v2/system/getPatentDTOListForRMS")
+                .post(requestBody)
+                .build();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+
+
+    }
 
     public String getComPatentNos(PatentVO patentVO) throws IOException {
-        if(patentVO.getReportId()!=null) {
+        if (patentVO.getReportId() != null) {
             LambdaQueryWrapper<ImportTask> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(ImportTask::getReportId, patentVO.getReportId());
             Report report = reportService.getById(patentVO.getReportId());
@@ -471,7 +498,7 @@ public class OutInterfaceService {
                 .connectTimeout(300, TimeUnit.SECONDS)//设置连接超时时间
                 .readTimeout(300, TimeUnit.SECONDS)//设置读取超时时间
                 .build();
-            String param = new Gson().toJson(taskParams);
+        String param = new Gson().toJson(taskParams);
         RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
         Request request = new Request.Builder()
                 .url(PASUrl + "/api/v2/project/import/sysPatent")
@@ -511,6 +538,7 @@ public class OutInterfaceService {
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     /**
      * @title 获得分析系统自定义字段选项
      * @description 获得分析系统自定义字段选项
@@ -519,7 +547,7 @@ public class OutInterfaceService {
     public String getPatentQueryTree(Integer projectId) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
-                .url(PASUrl + "/api/v2/project/field/tree?projectId="+projectId)
+                .url(PASUrl + "/api/v2/project/field/tree?projectId=" + projectId)
                 .get()
                 .build();
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
@@ -550,22 +578,23 @@ public class OutInterfaceService {
     public String getPersonIdByNamePCS(String personName) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
-                .url(PCSUrl + "/permission/api/system/getPersonIdByName?personName="+personName)
+                .url(PCSUrl + "/permission/api/system/getPersonIdByName?personName=" + personName)
                 .get()
                 .build();
 
-        return  Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
+        return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
+
     public List<Integer> getDutyDepartsFromPCS(Integer personId) throws IOException {
         OkHttpClient okHttpClient = new OkHttpClient();
         Request request = new Request.Builder()
-                .url(PCSUrl + "/permission/api/system/getDutyDeparts?personId="+personId)
+                .url(PCSUrl + "/permission/api/system/getDutyDeparts?personId=" + personId)
                 .get()
                 .build();
-String resBody =okHttpClient.newCall(request).execute().body().string();
+        String resBody = okHttpClient.newCall(request).execute().body().string();
 
-        List<Integer> ids = JSONArray.parseArray(resBody,Integer.class);
-        return  ids;
+        List<Integer> ids = JSONArray.parseArray(resBody, Integer.class);
+        return ids;
 
     }
 

+ 75 - 75
RMS/src/main/java/cn/cslg/report/service/business/AssoTaskPersonelService.java

@@ -35,8 +35,8 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 @SuppressWarnings({"all"})
 public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper, AssoTaskPersonel> {
-   private final  AssoTaskPersonelMapper assoTaskPersonelMapper ;
-   private final OutInterfaceService outInterfaceService;
+    private final AssoTaskPersonelMapper assoTaskPersonelMapper;
+    private final OutInterfaceService outInterfaceService;
     public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
     @Value("${PCSUrl}")
     private String PCSUrl;
@@ -44,32 +44,32 @@ public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper,
     private String PASUrl;
 
 
-
-    public  void test(){}
+    public void test() {
+    }
 
     /**
-     * @function 根据报告id 删除任务人员关联表对应实体assoTaskPersonel
      * @param reportId
      * @return
      * @throws IOException
+     * @function 根据报告id 删除任务人员关联表对应实体assoTaskPersonel
      */
     @Transactional(rollbackFor = Exception.class)
-    public String deleAssoTaskPersonel(Integer reportId) throws IOException{
-        LambdaQueryWrapper<AssoTaskPersonel> wrappers =new LambdaQueryWrapper();
-        wrappers.eq(AssoTaskPersonel::getReportId,reportId);
-         this.remove(wrappers);
+    public String deleAssoTaskPersonel(Integer reportId) throws IOException {
+        LambdaQueryWrapper<AssoTaskPersonel> wrappers = new LambdaQueryWrapper();
+        wrappers.eq(AssoTaskPersonel::getReportId, reportId);
+        this.remove(wrappers);
         return Response.success();
     }
 
     /**
-     * @function:当前登陆人的id状态 任务id 状态 该条专利位置分页处理拿到专利号
      * @param personelId当前登录人的id
-     * @param state 状态 1已读 0 未读 3 全部
-     * @param taskId 任务id
-     * @param location 该条专利位置
+     * @param state              状态 1已读 0 未读 3 全部
+     * @param taskId             任务id
+     * @param location           该条专利位置
      * @throws IOException
+     * @function:当前登陆人的id状态 任务id 状态 该条专利位置分页处理拿到专利号
      */
-    public String pagination(PatentVO patentVO)throws IOException {
+    public String pagination(PatentVO patentVO) throws IOException {
         Map<String, Object> map = new HashMap<>();
         List<String> patentNumber = new ArrayList<>();
         if (patentVO.getTaskStatus().equals(3)) {
@@ -100,44 +100,44 @@ public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper,
             JSONObject jsonObject = JSONObject.parseObject(res);
             JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
             List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
-           List<Patents> list= new ArrayList<>();
+            List<Patents> list = new ArrayList<>();
 
-           for(JSONObject obj:jsonObjects){
+            for (JSONObject obj : jsonObjects) {
 
-               Patents patent = obj.toJavaObject(obj, Patents.class);
-               list.add(patent);
+                Patents patent = obj.toJavaObject(obj, Patents.class);
+                list.add(patent);
 
-           }
-            if(list.size()==0){
+            }
+            if (list.size() == 0) {
 
                 return Response.success();
             }
 
-           if(list.size()==1){
-               map.put("currentID", list.get(0).getId());
-               map.put("behindID",null);
-               map.put("frontID", null);
-               map.put("totalNumber" , list.size());
-               map.put("frontPatentNo",null);
-               map.put("currentPatentNo",list.get(0).getPatentNo());
-               map.put("behindPatentNo",null);
-               map.put("frontNumber",0);
-               map.put("behindNumber",0);
-            return Response.success(map);
+            if (list.size() == 1) {
+                map.put("currentID", list.get(0).getId());
+                map.put("behindID", null);
+                map.put("frontID", null);
+                map.put("totalNumber", list.size());
+                map.put("frontPatentNo", null);
+                map.put("currentPatentNo", list.get(0).getPatentNo());
+                map.put("behindPatentNo", null);
+                map.put("frontNumber", 0);
+                map.put("behindNumber", 0);
+                return Response.success(map);
 
-           }
+            }
             jsonObject1.put("type", "first");
             map.put("currentID", list.get(0).getId());
-            map.put("behindID",list.get(1).getId());
+            map.put("behindID", list.get(1).getId());
             map.put("frontID", null);
-            map.put("totalNumber" , list.size());
-            map.put("frontNumber",0);
-            map.put("behindNumber",list.size()-1);
-            map.put("location",1);
-            map.put("frontPatentNo",null);
-            map.put("currentPatentNo",list.get(0).getPatentNo());
-            map.put("behindPatentNo",list.get(1).getPatentNo());
-            return  Response.success(map);
+            map.put("totalNumber", list.size());
+            map.put("frontNumber", 0);
+            map.put("behindNumber", list.size() - 1);
+            map.put("location", 1);
+            map.put("frontPatentNo", null);
+            map.put("currentPatentNo", list.get(0).getPatentNo());
+            map.put("behindPatentNo", list.get(1).getPatentNo());
+            return Response.success(map);
         } else {
             patentVO.setStartNumber(patentVO.getLocPosition() - 2);
             patentVO.setEndNumber(patentVO.getLocPosition());
@@ -145,50 +145,50 @@ public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper,
             JSONObject jsonObject = JSONObject.parseObject(res);
             JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
             List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
-            List<Patents> list= new ArrayList<>();
-            for(JSONObject obj:jsonObjects){
+            List<Patents> list = new ArrayList<>();
+            for (JSONObject obj : jsonObjects) {
                 Patents patent = obj.toJavaObject(obj, Patents.class);
                 list.add(patent);
 
             }
 
-            if(list.size()==1){
+            if (list.size() == 1) {
                 map.put("currentID", list.get(0).getId());
-                map.put("behindID",null);
+                map.put("behindID", null);
                 map.put("frontID", null);
-                map.put("totalNumber" , list.size());
-                map.put("frontPatentNo",null);
-                map.put("currentPatentNo",list.get(0).getPatentNo());
-                map.put("behindPatentNo",null);
-                map.put("frontNumber",0);
-                map.put("behindNumber",0);
-                return  Response.success(map);
+                map.put("totalNumber", list.size());
+                map.put("frontPatentNo", null);
+                map.put("currentPatentNo", list.get(0).getPatentNo());
+                map.put("behindPatentNo", null);
+                map.put("frontNumber", 0);
+                map.put("behindNumber", 0);
+                return Response.success(map);
 
             }
-            if(patentVO.getLocPosition()>=list.size()) {
-                map.put("currentID", list.get(list.size()-1).getId());
-                map.put("behindID",null);
-                map.put("frontID",list.get(list.size()-2).getId());
-                map.put("totalNumber" , list.size());
-                map.put("frontNumber",list.size()-1);
-                map.put("behindNumber",0);
-                map.put("location",list.size());
-                map.put("frontPatentNo",list.get(list.size()-2).getPatentNo());
-                map.put("currentPatentNo",list.get(list.size()-1).getPatentNo());
-                map.put("behindPatentNo",null);
-                return  Response.success(map);
+            if (patentVO.getLocPosition() >= list.size()) {
+                map.put("currentID", list.get(list.size() - 1).getId());
+                map.put("behindID", null);
+                map.put("frontID", list.get(list.size() - 2).getId());
+                map.put("totalNumber", list.size());
+                map.put("frontNumber", list.size() - 1);
+                map.put("behindNumber", 0);
+                map.put("location", list.size());
+                map.put("frontPatentNo", list.get(list.size() - 2).getPatentNo());
+                map.put("currentPatentNo", list.get(list.size() - 1).getPatentNo());
+                map.put("behindPatentNo", null);
+                return Response.success(map);
             }
-            map.put("currentID", list.get(patentVO.getLocPosition()-1).getId());
-            map.put("behindID",list.get(patentVO.getLocPosition()).getId());
-            map.put("frontID",list.get(patentVO.getLocPosition()-2).getId());
-            map.put("totalNumber" , list.size());
-            map.put("frontNumber",patentVO.getLocPosition()-1);
-            map.put("behindNumber", list.size()-patentVO.getLocPosition());
-            map.put("location",patentVO.getLocPosition());
-            map.put("frontPatentNo",list.get(patentVO.getLocPosition()-2).getPatentNo());
-            map.put("currentPatentNo",list.get(patentVO.getLocPosition()-1).getPatentNo());
-            map.put("behindPatentNo",list.get(patentVO.getLocPosition()).getPatentNo());
-            return  Response.success(map);
+            map.put("currentID", list.get(patentVO.getLocPosition() - 1).getId());
+            map.put("behindID", list.get(patentVO.getLocPosition()).getId());
+            map.put("frontID", list.get(patentVO.getLocPosition() - 2).getId());
+            map.put("totalNumber", list.size());
+            map.put("frontNumber", patentVO.getLocPosition() - 1);
+            map.put("behindNumber", list.size() - patentVO.getLocPosition());
+            map.put("location", patentVO.getLocPosition());
+            map.put("frontPatentNo", list.get(patentVO.getLocPosition() - 2).getPatentNo());
+            map.put("currentPatentNo", list.get(patentVO.getLocPosition() - 1).getPatentNo());
+            map.put("behindPatentNo", list.get(patentVO.getLocPosition()).getPatentNo());
+            return Response.success(map);
 
 
         }

+ 5 - 7
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -1,9 +1,11 @@
 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.ReportDTO;
-import cn.cslg.report.common.model.vo.*;
+import cn.cslg.report.common.model.vo.ClientVO;
+import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.model.vo.ReportVO;
+import cn.cslg.report.common.model.vo.SystemDictVO;
 import cn.cslg.report.common.utils.*;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.report.common.utils.SecurityUtils.SecurityUtils;
@@ -22,7 +24,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.swagger.v3.oas.annotations.Operation;
@@ -36,7 +37,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.awt.geom.IllegalPathStateException;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -70,7 +70,6 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final CopyService copyService;
     private final SystemDictItemService systemDictItemService;
     private final AssoReportPersonService assoReportPersonService;
-
     private Report loadReport(ReportDTO reportDto) {
         Report report = new Report();
         //装载基本信息
@@ -206,8 +205,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         //分页
         if (reportVO.getSize() != null && reportVO.getCurrent() != null) {
             SecurityUtils.startDataScope("/pcs/report/query");
-            IPage<Report> records = this.page(new Page<>(reportVO.getCurrent(), reportVO.getSize()), queryWrapper);
-            List<Report> reports = records.getRecords();
+            List<Report> reports = this.page(new Page<>(reportVO.getCurrent(), reportVO.getSize()), queryWrapper).getRecords();
             reports = this.reportData(reports);
             SecurityUtils.startDataScope("/pcs/report/query");
             Long count = this.count(queryWrapper);

+ 45 - 0
RMS/src/main/java/cn/cslg/report/service/impl/FollowUpServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -150,6 +151,7 @@ public class FollowUpServiceImpl implements IFollowUpService {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date finishTime = simpleDateFormat.parse(date);//转换为Date类型
         System.out.println("等级结果当前完成时间"+ finishTime);
+
         FollowUp followUp = new FollowUp();
         //从registerDTO中取出后续事项id进行对应的操作
         followUp.setId(register.getFollowUpId());
@@ -169,6 +171,32 @@ public class FollowUpServiceImpl implements IFollowUpService {
             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();
+            //遍历前端传入数据,取得fileId的集合ids
+            List<Integer> ids = new ArrayList<>();
+            for(FilesVO filesVO:filesVOs){
+                int id = filesVO.getFileId();
+                ids.add(id);
+            }
+            //定义一个list存放需要删除的fileId
+            List<Integer> deleteIds = new ArrayList<>();
+            //遍历数据库中存在的fileId
+            for(Integer fileId : fileIdS){
+                if(ids.contains(fileId) != true){//不为true,就是没有,需要删除
+                    deleteIds.add(fileId);
+                }
+            }
+            followUpMapper.deleteAssoId(followUpId,deleteIds);
+            log.info("多余关联附件删除完成");
+        }else{//传入为空数组 等于附件需要全部删除
+            followUpMapper.deleteAssoId(followUpId,fileIdS);
+        }
         //批量新增后续事项
         this.add(register.getFollowUps());
     }
@@ -194,4 +222,21 @@ public class FollowUpServiceImpl implements IFollowUpService {
         }log.info("新增后续事项和附件id关联表完成");
         return Response.success();
     }
+
+    /**
+     * 第二次登记结果,根据传入的register中的followUpId和filesVOs中的fileId删除关联表中的多出的数据
+     *
+     * @param followUpId 后续事项id
+     * @param fileIds 附件id
+     */
+    @Override
+    public void deleteAssoId(Integer followUpId,List<Integer> fileIds){
+        log.info("开始处理【删除多余关联附件】的业务,参数为:{}", followUpId,fileIds);
+        if (followUpId != null && fileIds !=null) {
+            followUpMapper.deleteAssoId(followUpId,fileIds);
+            log.info("多余关联附件删除完成");
+        } else {
+            log.info("删除多余关联附件失败,多余关联附件不存在");
+        }
+    }
 }

+ 20 - 0
RMS/src/main/resources/mapper/FollowUpMapper.xml

@@ -125,6 +125,26 @@
         </foreach>
     </delete>
 
+    <!--根据后续事项id和文件id删除数据-->
+    <!--int deleteAssoId(Integer followUpId, Integer fileId);-->
+    <delete id="deleteAssoId">
+        delete
+        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>
+    </delete>
+
+
+    <!--根据报告id统计后续事项数量-->
+    <!--List<Integer> queryFileIdByFollowUpId(Integer followUpId);-->
+    <select id="queryFileIdByFollowUpId" resultType="Integer">
+        SELECT FILE_ID FROM asso_follow_up_file WHERE FOLLOW_UP_ID = #{followUpId};
+    </select>
+
+
     <!--插入数据-->
     <!--int addAssoIds(List<AssoFollowUpFile> assoFollowUpFiles);-->
     <insert id="addAssoIds" useGeneratedKeys="true" keyProperty="id">