Browse Source

7/3 无效应对报告增删改(即处理报告表的关联表)

chendayu 2 years ago
parent
commit
11a0999568

+ 27 - 35
RMS/src/main/java/cn/cslg/report/common/model/dto/ReportDTO.java

@@ -18,8 +18,8 @@ import java.util.List;
 @NoArgsConstructor
 @AllArgsConstructor
 @Builder(toBuilder = true)
-public class ReportDTO  {
-    private  Integer id;
+public class ReportDTO {
+    private Integer id;
     /**
      * 标的专利/产品号
      */
@@ -36,9 +36,9 @@ public class ReportDTO  {
     @Schema(description = "产品/技术")
     private String proTec;
     /**
-     * 报告类别
+     * 报告类别(0无效分析1第三方意见2稳定性分析3FTO调查4侵权分析5回避设计6图表分析7无效应对报告)
      */
-    @Schema(description = "报告类别(0无效分析1第三方意见2稳定性分析3FTO调查4侵权分析5回避设计6图表分析)")
+    @Schema(description = "报告类别(0无效分析1第三方意见2稳定性分析3FTO调查4侵权分析5回避设计6图表分析7无效应对报告)")
     private Integer type;
     /**
      * 报告状态
@@ -166,45 +166,14 @@ public class ReportDTO  {
      */
     @Schema(description = "核心结论")
     private String cronConclusion;
-    /*
-    无效应对报告字段
-     */
-    /**
-     * 案件编号
-     */
-    @Schema(description = "案件编号")
-    private String caseNumber;
-    /**
-     * 发文序号
-     */
-    @Schema(description = "发文序号")
-    private String issueNumber;
-
-    /**
-     * 发明创造名称
-     */
-    @Schema(description = "发明创造名称")
-    private String   inventionName;
 
     /**
-     * 专利权人
-     */
-    @Schema(description = "专利权人")
-    private String   currentApplication;
-    /**
-     * 专利权人
-     */
-    @Schema(description = "无效宣告请求人")
-    private String   invalidApplication;
-    /**
      * 文件
      */
-
     private List<ReportFiles> reportFiles;
     /**
      * 场景列表
      */
-
     private List<String> scenarioList;
     private List<String> scenarioNames;
     private List<Integer> conclusionIds;
@@ -220,4 +189,27 @@ public class ReportDTO  {
      */
     private List<FollowUpDTO> followUps;
     private Boolean track;
+
+    //以下是无效应对报告使用的字段 ↓
+    /**
+     * 案件编号
+     */
+    private String caseNumber;
+    /**
+     * 发文序号
+     */
+    private String issueNumber;
+    /**
+     * 发明创造名称
+     */
+    private String inventionName;
+    /**
+     * 专利权人
+     */
+    private String currentApplication;
+    /**
+     * 无效宣告请求人
+     */
+    private String invalidApplication;
+
 }

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

@@ -47,8 +47,8 @@ public class ReportController {
     @Transactional(rollbackFor = Exception.class)
     public String addReport(String report, List<MultipartFile> files) throws IOException {
         if (report != null) {
-            //新建报告并返回报告Id
             ReportDTO report1 = JSONObject.parseObject(report, ReportDTO.class);
+            //新建报告并返回报告Id
             Integer reportId = reportService.addReport(report1, files);
             return Response.success("添加成功");
         } else {
@@ -64,9 +64,9 @@ public class ReportController {
             report1.setScenarioId(StringUtils.join(report1.getScenarioList(), ","));
             Boolean flag = reportService.updateReport(report1, files);
             if (flag) {
-                return Response.success("添加成功");
+                return Response.success("修改成功");
             } else {
-                return Response.error("添加失败");
+                return Response.error("修改失败");
             }
 
         } else {
@@ -157,8 +157,8 @@ public class ReportController {
     @Operation(summary = "返回报告详情")
     @Transactional(rollbackFor = Exception.class)
     public String addConclusions(int reportId) throws IOException {
-       ReportDeDTO reportDeDTO = reportService.reReportDetail(reportId);
-        if (reportDeDTO ==null) {
+        ReportDeDTO reportDeDTO = reportService.reReportDetail(reportId);
+        if (reportDeDTO == null) {
             return Response.error("报告不存在");
 
         }

+ 0 - 7
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/InvalidReReport.java

@@ -21,43 +21,36 @@ public class InvalidReReport extends BaseEntity<InvalidReReport> {
      */
     @TableField("REPORT_ID")
     private Integer reportId;
-
     /**
      * 案件编号
      */
     @TableField("CASE_NUMBER")
     private String caseNumber;
-
     /**
      * 发文序号
      */
     @TableField("ISSUE_NUMBER")
     private String issueNumber;
-
     /**
      * 发明创造名称
      */
     @TableField("INVENTION_NAME")
     private String inventionName;
-
     /**
      * 专利权人
      */
     @TableField("CURRENT_APPLICATION")
     private String currentApplication;
-
     /**
      * 无效宣告请求人
      */
     @TableField("INVALID_APPLICATION")
     private String invalidApplication;
-
     /**
      * 创建人
      */
     @TableField("CREATE_ID")
     private Integer createId;
-
     /**
      * 创建时间
      */

+ 13 - 0
RMS/src/main/java/cn/cslg/report/mapper/InvalidReReport/InvalidReReportMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.report.mapper.InvalidReReport;
+
+import cn.cslg.report.entity.invalidReReport.InvalidReReport;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 无效应对报告的Mapper层接口
+ *
+ * @Author chenyu
+ * @Date 2023/7/3
+ */
+public interface InvalidReReportMapper extends BaseMapper<InvalidReReport> {
+}

+ 10 - 0
RMS/src/main/java/cn/cslg/report/service/IInvalidReReportService.java

@@ -0,0 +1,10 @@
+package cn.cslg.report.service;
+
+/**
+ * 无效应对报告的Service层接口
+ *
+ * @Author chenyu
+ * @Date 2023/7/3
+ */
+public interface IInvalidReReportService {
+}

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

@@ -10,9 +10,11 @@ import cn.cslg.report.entity.*;
 
 import cn.cslg.report.entity.asso.AssoReportFile;
 import cn.cslg.report.entity.asso.AssoReportPerson;
+import cn.cslg.report.entity.invalidReReport.InvalidReReport;
 import cn.cslg.report.mapper.ReportMapper;
 import cn.cslg.report.service.*;
 import cn.cslg.report.service.business.asso.AssoReportPersonService;
+import cn.cslg.report.service.impl.InvalidReReportServiceImpl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -22,6 +24,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 
+import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -61,6 +64,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final AssoReportPersonService assoReportPersonService;
     private final IAssoEventReportService assoEventReportService;
     private final IFollowUpService followUpService;
+    private final InvalidReReportServiceImpl invalidReReportService;
 
     private Report loadReport(ReportDTO reportDto) {
         Report report = new Report();
@@ -135,7 +139,19 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             report.setConclusionId(null);
         }
         report.insert();
-        //TODO 当是无效应对报告时,在无效应对报告里插入信息
+
+        //TODO 当是无效应对报告时,在无效应对报告表里插入信息
+        if (reportDto.getType().equals(7)) {
+            PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            InvalidReReport invalidReReport = new InvalidReReport();
+            BeanUtils.copyProperties(reportDto, invalidReReport);
+            invalidReReport.setReportId(report.getId());
+            invalidReReport.setCreateId(personnelVO.getId());
+            //无效应对报告数据入库
+            log.info("无效应对报告表新增数据");
+            invalidReReportService.save(invalidReReport);
+        }
+
         if (files != null && files.size() != 0) {
             //当
             if (report.getStatus() != 3) {
@@ -429,7 +445,22 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             List<Integer> fileIdList = reportFileService.uploadFiles(files);
             assoReportFileService.addAsso(reportDto.getId(), fileIdList);
         }
-        //TODO 如果是无效应对报告,更新无效应对报告表
+        report.updateById();
+
+        //TODO 当是无效应对报告,修改无效应对报告表数据
+        if (reportDto.getType().equals(7)) {
+            List<InvalidReReport> invalidReReports = invalidReReportService.list(new LambdaQueryWrapper<InvalidReReport>().eq(InvalidReReport::getReportId, report.getId()));
+            if (invalidReReports != null && invalidReReports.size() > 0) {
+                InvalidReReport invalidReReport = invalidReReports.get(0);
+                InvalidReReport updateInvalidReReport = new InvalidReReport();
+                BeanUtils.copyProperties(reportDto, updateInvalidReReport);
+                updateInvalidReReport.setId(invalidReReport.getId());
+                //无效应对报告表修改数据
+                log.info("无效应对报告表修改数据");
+                invalidReReportService.updateById(updateInvalidReReport);
+            }
+        }
+
         return report.updateById();
 
     }
@@ -467,8 +498,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         reportReferencesService.deleteByReportId(id);
         //删除对比信息
         compareMessageService.deleteByreportID(id);
-        //TODO 当时无效应对报告时,删除无效应对报告内容
-
+        //TODO 当是无效应对报告,删除无效应对报告表数据
+        invalidReReportService.remove(new LambdaQueryWrapper<InvalidReReport>().eq(InvalidReReport::getReportId, id));
 
         Boolean dele = this.removeById(id);
         if (dele == true) {
@@ -703,16 +734,16 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     }
 
     /**
-     * @autor 谢翔
      * @param ReportId
      * @return
+     * @autor 谢翔
      */
     public ReportDeDTO reReportDetail(int ReportId) {
-        ReportDeDTO reportDeDTO =null;
-      //根据报告id获得报告
+        ReportDeDTO reportDeDTO = null;
+        //根据报告id获得报告
         //若根据报告id未获取到报告返回空
         //若报告为无效应对报告则从无效应对报告表中获得无效对应报告拓展信息
         //装载报告信息,无效对应报告拓展信息到ReportDeDTO并返回
-        return  reportDeDTO;
+        return reportDeDTO;
     }
 }

+ 15 - 0
RMS/src/main/java/cn/cslg/report/service/impl/InvalidReReportServiceImpl.java

@@ -0,0 +1,15 @@
+package cn.cslg.report.service.impl;
+
+import cn.cslg.report.entity.invalidReReport.InvalidReReport;
+import cn.cslg.report.mapper.InvalidReReport.InvalidReReportMapper;
+import cn.cslg.report.service.IInvalidReReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * 无效应对报告的Service层接口实现类
+ *
+ * @Author chenyu
+ * @Date 2023/7/3
+ */
+public class InvalidReReportServiceImpl extends ServiceImpl<InvalidReReportMapper, InvalidReReport> implements IInvalidReReportService {
+}