chenyi 2 年 前
コミット
2151b1cdec

+ 13 - 4
RMS/src/main/java/cn/cslg/report/controller/ReportController.java

@@ -95,10 +95,10 @@ public class ReportController {
     }
     @RequestMapping(value = "/addFile", method = RequestMethod.POST)
     @Operation(summary = "文件上传")
-    public  String addFile(String jsons, List<MultipartFile> file) throws IOException{
+    public  String addFile(String jsons, List<MultipartFile> files) throws IOException{
         ReportReferences reportReferences = JSONObject.parseObject(jsons, ReportReferences.class);
 
-        return reportReferencesService.add(reportReferences,file);
+        return reportReferencesService.add(reportReferences,files);
     }
     @PostMapping(value = "selectfile")
     @Operation(summary = "文件查询")
@@ -113,8 +113,17 @@ public class ReportController {
         return reportReferencesService.delete(id);
     }
 
-
-
+    @PostMapping(value = "updatefiles")
+    @Operation(summary = "文件修改")
+    @Transactional(rollbackFor = Exception.class)
+   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){
+            return Response.success();
+        }
+        return Response.error();
+    }
 
 
 }

+ 5 - 0
RMS/src/main/java/cn/cslg/report/entity/ReportReferences.java

@@ -73,6 +73,11 @@ public class ReportReferences extends BaseEntity<ReportReferences> {
      */
     @TableField(exist = false)
     private List<ReportFiles> reportFiles;
+    @TableField(exist = false)
+    private String personName;
+    @TableField(exist = false)
+    private String reportName;
+
 
 
 }

+ 24 - 0
RMS/src/main/java/cn/cslg/report/entity/asso/AssoReportReferences.java

@@ -0,0 +1,24 @@
+package cn.cslg.report.entity.asso;
+
+import cn.cslg.report.common.model.BaseEntity;
+import cn.cslg.report.entity.ReportReferences;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "ASSO_REPORT_REFERENCES")
+public class AssoReportReferences extends BaseEntity<AssoReportReferences> {
+    @Schema(description = "文件id")
+    @TableField(value = " FILE_ID")
+    private Integer fileID;
+
+    @Schema(description = "ReportReferences的id")
+    @TableField(value = " REPORT_REFERENCES_ID")
+    private  Integer ReportReferencesID;
+}

+ 9 - 0
RMS/src/main/java/cn/cslg/report/mapper/AssoReportReferencesMapper.java

@@ -0,0 +1,9 @@
+package cn.cslg.report.mapper;
+
+import cn.cslg.report.entity.asso.AssoReportReferences;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AssoReportReferencesMapper  extends BaseMapper<AssoReportReferences> {
+}

+ 2 - 2
RMS/src/main/java/cn/cslg/report/service/business/AssoReportFileService.java

@@ -44,8 +44,7 @@ public class AssoReportFileService extends ServiceImpl<AssoReportFileMapper, Ass
             AssoReportFile assoReportFile = new AssoReportFile();
             assoReportFile.setReportId(reportId);
             assoReportFile.setFileId(item);
-
-            assoReportFile.setFileType(0);
+            assoReportFile.setFileType(1);
             assoReportFiles.add(assoReportFile);
         });
         this.saveBatch(assoReportFiles);
@@ -64,6 +63,7 @@ public class AssoReportFileService extends ServiceImpl<AssoReportFileMapper, Ass
         List<AssoReportFile> assoReportFiles =this.list(wrapper);
         return assoReportFiles;
     }
+
     public String upload(Integer reportID,List<MultipartFile> files)throws IOException{
         List<Integer> integers = reportFileService.uploadFiles(files);
         for(Integer integer :integers){

+ 40 - 0
RMS/src/main/java/cn/cslg/report/service/business/AssoReportReferencesService.java

@@ -0,0 +1,40 @@
+package cn.cslg.report.service.business;
+
+import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.entity.asso.AssoReportFile;
+import cn.cslg.report.entity.asso.AssoReportReferences;
+import cn.cslg.report.mapper.AssoReportFileMapper;
+import cn.cslg.report.mapper.AssoReportReferencesMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class AssoReportReferencesService extends ServiceImpl<AssoReportReferencesMapper, AssoReportReferences> {
+    public String add(int ReportReferencesID, List<Integer> fileID){
+        List<AssoReportReferences> list=new ArrayList<>();
+        fileID.forEach(item ->{
+            AssoReportReferences assoReportReferences=new AssoReportReferences();
+            assoReportReferences.setReportReferencesID(ReportReferencesID);
+            assoReportReferences.setFileID(item);
+            list.add(assoReportReferences);
+        });
+        this.saveBatch(list);
+        return Response.success();
+    }
+    public List<AssoReportReferences> select(int ReportReferencesID){
+        LambdaQueryWrapper<AssoReportReferences> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(AssoReportReferences::getReportReferencesID,ReportReferencesID);
+        return this.list(wrapper);
+
+    }
+
+}

+ 2 - 2
RMS/src/main/java/cn/cslg/report/service/business/LitigationHistoryService.java

@@ -57,7 +57,7 @@ public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMappe
         List<AssoLitigationHisFile> assoes= assoLitigationHisFileService.list(wrapper);
         List<Integer> fileIds =assoes.stream().map(AssoLitigationHisFile::getFileId).collect(Collectors.toList());
         // 获得更新后的附件Id
-        List<Integer> updateFileId =new ArrayList<>();
+         List<Integer> updateFileId =new ArrayList<>();
         if(litigationHistory.getReportFiles()!=null){
             updateFileId = litigationHistory.getReportFiles().stream().map(ReportFiles::getId).collect(Collectors.toList());
             fileIds.removeAll(updateFileId);}
@@ -84,7 +84,7 @@ public class LitigationHistoryService extends ServiceImpl<LitigationHistoryMappe
     public String queryLitigationHistory(LitigationHistory litigationHistory){
         LambdaQueryWrapper<LitigationHistory> wrapper =new LambdaQueryWrapper<>();
                wrapper.eq(LitigationHistory::getPatentNo,litigationHistory.getPatentNo());
-        if (litigationHistory.getSize() != null && litigationHistory.getSize() != null) {
+        if (litigationHistory.getSize() != null && litigationHistory.getCurrent() != null) {
             IPage<LitigationHistory> pages = this.page(new Page<>(litigationHistory.getCurrent(), litigationHistory.getSize()), wrapper);
             pages.setRecords(this.LitigationHistory(pages.getRecords()));
             return Response.success(pages);

+ 1 - 1
RMS/src/main/java/cn/cslg/report/service/business/ReportFieldService.java

@@ -17,7 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
+
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;

+ 97 - 10
RMS/src/main/java/cn/cslg/report/service/business/ReportReferencesService.java

@@ -1,12 +1,16 @@
 package cn.cslg.report.service.business;
 
+import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.utils.CacheUtils;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.report.entity.InvalidRecord;
 import cn.cslg.report.entity.LitigationHistory;
 import cn.cslg.report.entity.ReportFiles;
 import cn.cslg.report.entity.ReportReferences;
+import cn.cslg.report.entity.asso.AssoLitigationHisFile;
 import cn.cslg.report.entity.asso.AssoReportFile;
+import cn.cslg.report.entity.asso.AssoReportReferences;
 import cn.cslg.report.mapper.ReportFileMapper;
 import cn.cslg.report.mapper.ReportReferencesMapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -22,8 +26,11 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 @Slf4j
@@ -32,6 +39,9 @@ public class ReportReferencesService extends ServiceImpl<ReportReferencesMapper,
     private final ReportFileService reportFileService;
     private final LoginUtils loginUtils;
     private final AssoReportFileService assoReportFileService;
+    private final CacheUtils cacheUtils;
+    private final ReportService reportService;
+    private final AssoReportReferencesService assoReportReferencesService;
     public String add(ReportReferences reportReferences, List<MultipartFile> files)throws IOException{
         ReportReferences i = new ReportReferences();
         i.setReportID(reportReferences.getReportID());
@@ -44,10 +54,10 @@ public class ReportReferencesService extends ServiceImpl<ReportReferencesMapper,
         i.setType(reportReferences.getType());
         i.setReferName(reportReferences.getReferName());
         i.insert();
-        if (files == null && files.size() != 0) {
+        if (files != null && files.size() != 0) {
             //将文档上传并返回文件入库的Id
             List<Integer> fileIds = reportFileService.uploadFiles(files);
-           assoReportFileService.add(reportReferences.getReportID(),fileIds);
+            assoReportReferencesService.add(i.getId(),fileIds);
             return Response.success();
         }
 
@@ -55,31 +65,108 @@ public class ReportReferencesService extends ServiceImpl<ReportReferencesMapper,
     }
     public String queryReportReferences(ReportReferences reportReferences)throws IOException{
         LambdaQueryWrapper<ReportReferences> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(ReportReferences::getReportID,reportReferences.getReportID())
-                .eq(ReportReferences::getRemark,reportReferences.getRemark());
+        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
+        String name = reportService.getName(reportReferences.getReportID());
+        //根据报告id 查询报告文档上传表
+        wrapper.eq(ReportReferences::getReportID,reportReferences.getReportID());
+
+        wrapper.orderByDesc(ReportReferences::getId);
+
+        List<ReportReferences> list=new ArrayList<>();
 
         if(reportReferences.getSize()!=null&&reportReferences.getCurrent()!=null){
             IPage<ReportReferences> pages = this.page(new Page<>(reportReferences.getCurrent(), reportReferences.getSize()), wrapper);
+            List<ReportReferences> records = pages.getRecords();
+
+            for(ReportReferences references :records) {
+                List<ReportFiles> reportFiles = this.ReportReferences(references.getId(), reportReferences.getFileName());
+                if (reportFiles.size() != 0) {
+
+                    references.setPersonName(personnelVO.getName());
+
+                    references.setReportName(name);
+                    references.setReportFiles(reportFiles);
+                    list.add(references);
+                }
+            }
+
+           pages.setRecords(list);
             return Response.success(pages);
         }
 
 
-        return Response.success(this.list(wrapper));
+        List<ReportReferences> list1 = this.list(wrapper);
+        for(ReportReferences references:list1){
+            List<ReportFiles> reportFiles = this.ReportReferences(references.getId(), reportReferences.getFileName());
+            if (reportFiles.size() != 0) {
+
+                references.setPersonName(personnelVO.getName());
+
+                references.setReportName(name);
+                references.setReportFiles(reportFiles);
+                list.add(references);
+            }
+
+        }
+        List<ReportReferences> l=new ArrayList<>(list);
+
+        return Response.success(list);
 
     }
     public String delete(int id)throws IOException{
-
         this.removeById(id);
-        LambdaQueryWrapper<AssoReportFile> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(AssoReportFile::getFileId,id);
+        LambdaQueryWrapper<AssoReportReferences> wrapper =new LambdaQueryWrapper<>();
+        wrapper.eq(AssoReportReferences::getReportReferencesID,id);
+        List<AssoReportReferences> list = assoReportReferencesService.list(wrapper);
+        reportFileService.removeByIds( list.stream().map(AssoReportReferences::getFileID).collect(Collectors.toList()));
+        assoReportReferencesService.remove(wrapper);
+       return Response.success();
+
+    }
+
+    public List<ReportFiles> ReportReferences(int id ,String str){
+        List<AssoReportReferences> select = assoReportReferencesService.select(id);
+        List<Integer> collect = select.stream().map(AssoReportReferences::getFileID).collect(Collectors.toList());
+        if(collect.size()==0){
+            return null;
+        }
+        LambdaQueryWrapper<ReportFiles> wrapper = new LambdaQueryWrapper<>();
+
+        wrapper.in(ReportFiles::getId, collect);
+        if(str!=null&&str!=""){
+            wrapper.like(ReportFiles::getName,str);
+        }
+        List<ReportFiles> reportFiles = reportFileService.list(wrapper);
+        return reportFiles;
+
+    }
+
+
+
+    public Boolean updateReportReferences(ReportReferences reportReferences,List<MultipartFile> files)throws IOException{
+        if(files!=null && files.size() != 0 ){
 
-        assoReportFileService.remove(wrapper);
-        return Response.success();
+            LambdaQueryWrapper<AssoReportReferences> wrapper =new LambdaQueryWrapper<>();
+            wrapper.eq(AssoReportReferences::getReportReferencesID,reportReferences.getId());
+            List<AssoReportReferences> list = assoReportReferencesService.list(wrapper);
+            List<Integer> collect = list.stream().map(AssoReportReferences::getFileID).collect(Collectors.toList());
+                assoReportReferencesService.remove(wrapper);
+                reportFileService.removeByIds(collect);
+                List<Integer> fileIdList = reportFileService.uploadFiles(files);
+                assoReportReferencesService.add(reportReferences.getId(),fileIdList);
 
 
 
+
+        }
+        return reportReferences.updateById();
     }
 
 
 
+
+
+
+
+
 }

+ 8 - 0
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -199,6 +199,14 @@ if(fileIds.size()!=0){
         return   Response.error("没有数据");
 
     }
+    public String getName(int id) throws IOException{
+        LambdaQueryWrapper<Report> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Report::getId,id);
+        Report report = this.list(wrapper).get(0);
+        return report.getName();
+
+    }
+
 
 
 }

ファイルの差分が大きいため隠しています
+ 0 - 8808
logs/rms/rms-debug.2022-11-29.0.log


ファイルの差分が大きいため隠しています
+ 9329 - 0
logs/rms/rms-debug.2022-12-06.0.log


ファイルの差分が大きいため隠しています
+ 0 - 1581
logs/rms/rms-info.2022-11-29.0.log


ファイルの差分が大きいため隠しています
+ 723 - 0
logs/rms/rms-info.2022-12-06.0.log