Переглянути джерело

2/23 修改旧代码 增加新代码

chendayu 2 роки тому
батько
коміт
858813c75e

+ 5 - 4
RMS/src/main/java/cn/cslg/report/common/model/SystemMO.java

@@ -16,15 +16,16 @@ public class SystemMO {
     private String zadm; //专案代码
     private String reportName;
 
+    public SystemMO() {
+    }
 
-
-    public SystemMO(String year, String month, String day, String zadm, String report) {
+    public SystemMO(String year, String month, String day, String zadm, String reportName) {
         this.year = year;
         this.month = month;
         this.day = day;
-        this.date = year+"-"+month+"-"+day;
+        this.date = year + "-" + month + "-" + day;
         this.zadm = zadm;
-        this.reportName=report;
+        this.reportName = reportName;
     }
 
 //    public String getReportName() {

+ 9 - 7
RMS/src/main/java/cn/cslg/report/common/model/vo/AvoidDesignRightVO.java

@@ -20,22 +20,24 @@ public class AvoidDesignRightVO implements Serializable {
      */
     private Integer patentId;
     /**
-     * 内容
+     * 权要原文翻译
      */
     private String contentOut;
-
     /**
-     * 内容
+     * 权要原文
      */
     private String content;
-
     /**
-     * 类型
+     * 权要类型
      */
     private Integer type;
-
+    /**
+     * 权要排序
+     */
     private Integer sort;
-
+    /**
+     * 权要名
+     */
     private String rightName;
     /**
      * 回避设计方案当前权要的所有的特征和特征对应的回避设计方向

+ 9 - 1
RMS/src/main/java/cn/cslg/report/mapper/AvoidDesignLittleDirectionMapper.java

@@ -39,7 +39,15 @@ public interface AvoidDesignLittleDirectionMapper {
     String selectSignPatentNoByReportId(Integer reportId);
 
     /**
-     * 根据权要id和报告id关联查询特征和回避设计方向数据
+     * 根据报告id关联特征表查询特征和回避设计方向数据
+     *
+     * @param reportId 报告id
+     * @return 返回查询到的特征集合
+     */
+    List<AvoidFeaturesVO> selectWholeByReportId(Integer reportId);
+
+    /**
+     * 根据权要id和报告id关联特征表查询特征和回避设计方向数据
      *
      * @param rightId  权要id
      * @param reportId 报告id

+ 41 - 6
RMS/src/main/java/cn/cslg/report/service/business/ReportDocumentService.java

@@ -1,14 +1,15 @@
 package cn.cslg.report.service.business;
 
 import cn.cslg.report.common.model.SystemMO;
-import cn.cslg.report.common.model.vo.CompareMessageVO;
-import cn.cslg.report.common.model.vo.PatentVO;
-import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.model.vo.*;
 import cn.cslg.report.common.utils.*;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.report.entity.*;
 import cn.cslg.report.entity.asso.AssoRecordsFeature;
+import cn.cslg.report.mapper.AvoidDesignLittleDirectionMapper;
+import cn.cslg.report.mapper.AvoidDesignWholeDirectionMapper;
 import cn.cslg.report.mapper.ReportDocumentMapper;
+import cn.cslg.report.service.IAvoidDesignDirectionService;
 import cn.cslg.report.service.OutInterfaceService;
 import cn.hutool.core.util.IdUtil;
 import com.alibaba.fastjson.JSON;
@@ -55,6 +56,8 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
     private final ReportFieldPatentLinkService reportFieldPatentLinkService;
     private final CompareMessageService compareMessageService;
     private final CompareFilesService compareFilesService;
+    private final AvoidDesignLittleDirectionMapper avoidDesignLittleDirectionMapper;
+    private final AvoidDesignWholeDirectionMapper avoidDesignWholeDirectionMapper;
     @Value("${RMSFile}")
     private String rmsFile;
     @Value("${PASFile}")
@@ -109,7 +112,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         } else if (report.getType() == 4) {
             template = this.Torttemplate(reportId, filePath, templeId);
         } else if (report.getType() == 5) {
-            template = this.avoidDesignTemplate(reportId, filePath, templeId);
+            template = this.avoidDesignTemplate(reportId, filePath);
         }
         // 读取模板、数据并渲染
 //         文件是否已存在,则删除
@@ -693,10 +696,42 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
         return template;
     }
 
-    private XWPFTemplate avoidDesignTemplate(Integer reportId, String filePath, Integer templateId) {
+    private XWPFTemplate avoidDesignTemplate(Integer reportId, String filePath) {
+        log.info("开始处理导出规避设计报告,参数为:{}, {}", reportId, filePath);
+        Report report = reportService.getById(reportId);
+        String signPatentNo = report.getSignPatentNo();
 
+        //装载公开/公告号
+        Map<String, Object> map = new HashMap<>();
+        map.put("pantentNo", signPatentNo);
 
-        return null;
+        //装载年月日
+        String date = DateUtils.formatDate(new Date(), DateUtils.YYYY_MM_DD);
+        String[] dates = date.split("-");
+        SystemMO systemMO = new SystemMO()
+                .setYear(dates[0])
+                .setMonth(dates[1])
+                .setDay(dates[2]);
+        map.put("sys", systemMO);
+
+        //装载特征、解释、回避设计方向、回避设计总体方向
+        List<AvoidFeaturesVO> features = avoidDesignLittleDirectionMapper.selectWholeByReportId(reportId);
+        String wholeDirection = avoidDesignWholeDirectionMapper.selectWholeDirectionByReportId(reportId);
+        map.put("features", features);
+        map.put("wholeDirection", wholeDirection);
+
+        //绑定政策(绑定集合和元素循环遍历)
+        LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
+        //把指定元素内容识别传输成html格式
+        HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
+        Configure configure = Configure.builder()
+                .bind("features", policy)
+                .bind("explainText", htmlRenderPolicy)
+                .bind("littleDirection", htmlRenderPolicy)
+                .bind("wholeDirection", htmlRenderPolicy)
+                .build();
+        XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
+        return template;
     }
 
     /**

+ 25 - 0
RMS/src/main/resources/mapper/AvoidDesignLittleDirectionMapper.xml

@@ -29,6 +29,31 @@
         where ID = #{reportId}
     </select>
 
+    <!--根据报告id关联特征表查询特征和回避设计方向数据-->
+    <!--List<AvoidFeaturesVO> selectWholeByReportId(Integer reportId);-->
+    <select id="selectWholeByReportId" resultMap="AllResultMap">
+        select f.ID,
+               SIGN_PATENT_NO,
+               CONTENT_OUT,
+               RIGHT_ID,
+               PARTNER_ID,
+               IS_FINAL,
+               f.REPORT_ID,
+               CONTENT,
+               EXPLAIN_TEXT,
+               SPLIT_BY,
+               RIGHT_NAME,
+               RIGHT_TYPE,
+               FEATURES_ORDER,
+               SPLIT_TYPE,
+               TASK_ID,
+               LITTLE_DIRECTION
+        from features f
+                 left join avoiddesign_little_direction l on f.ID = l.FEATURE_ID
+        where f.REPORT_ID = #{reportId}
+        order by f.ID
+    </select>
+
     <!--根据权要id和报告id关联查询特征和回避设计方向数据-->
     <!--List<AvoidFeaturesVO> selectWholeByRightIdAndReportId(Integer rightId, Integer reportId);-->
     <select id="selectWholeByRightIdAndReportId" resultMap="AllResultMap">