lwhhszx 2 år sedan
förälder
incheckning
2832b10170

+ 1 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/invalidReReport/QueryInvalidReasonVO.java

@@ -93,6 +93,7 @@ public class QueryInvalidReasonVO {
         private Integer fileType;
         private String patentNo;
         private Integer fileId;
+        private String fileName;
     }
 
     @Data

+ 5 - 4
RMS/src/main/java/cn/cslg/report/common/utils/WordUtil.java

@@ -80,7 +80,7 @@ public class WordUtil {
         run.setText(text);
         CTTc cttc = cell.getCTTc();
         CTTcPr cellPr = cttc.addNewTcPr();
-//        cellPr.addNewTcW().setW(BigInteger.valueOf(width));
+        cellPr.addNewTcW().setW(BigInteger.valueOf(width));
         cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
         CTTcPr ctPr = cttc.addNewTcPr();
         ctPr.addNewVAlign().setVal(STVerticalJc.CENTER);
@@ -144,11 +144,14 @@ public class WordUtil {
      * @param bold
      * @return
      */
-    public static XWPFRun setTableCellStyle(XWPFTableCell cell, ParagraphAlignment paragraphAlignment, String fontFamily, int fontSize, boolean bold) {
+    public static XWPFRun setTableCellStyle(XWPFTableCell cell,String width, ParagraphAlignment paragraphAlignment, String fontFamily, int fontSize, boolean bold) {
         XWPFParagraph paragraph = cell.getParagraphs().get(0);
         paragraph.setAlignment(paragraphAlignment);
         XWPFRun run = paragraph.createRun();
         run.setFontFamily(fontFamily);
+        if(width!=null){
+        cell.setWidth(width);}
+        cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); //垂直居中
         run.setFontSize(fontSize);
         run.setStyle("1");
         run.setBold(bold);
@@ -218,8 +221,6 @@ public class WordUtil {
      * word单元格行合并
      * @param table 表格
      * @param col 合并行所在列
-     * @param fromRow 开始行
-     * @param toRow 结束行
      * @date 2020年4月8日 下午4:46:18
      */
     public static void mergeCellsVertically(XWPFTable table, int col, int startRow, int endRow) {

+ 1 - 1
RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/InvalidReasonController.java

@@ -101,6 +101,6 @@ public class InvalidReasonController {
     @GetMapping("/exportInvalid")
     public String exportInvalid(Integer reportId) throws IOException {
        String url =  exportArgumentsScenariosService.ExportToWord(reportId);
-        return Response.success(url);
+        return url;
     }
 }

+ 0 - 28
RMS/src/main/java/cn/cslg/report/entity/invalidReReport/AssoScratchPatent.java

@@ -1,28 +0,0 @@
-package cn.cslg.report.entity.invalidReReport;
-
-import cn.cslg.report.common.model.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * @Author xiexiang
- * @Date 2023/6/28
- */
-@Data
-@TableName(value = "ASSO_SCRATCH_PATENT")
-public class AssoScratchPatent extends BaseEntity<AssoScratchArguments> {
-    /**
-     * 划词id
-     */
-    @TableField("SCRATCH_ID")
-    private Integer scratchId;
-
-    /**
-     * 专利号
-     */
-    @TableField("PATENT_NO")
-    private String patentNo;
-}

+ 64 - 38
RMS/src/main/java/cn/cslg/report/service/business/ExportArgumentsScenariosService.java

@@ -1,20 +1,16 @@
 package cn.cslg.report.service.business;
 
-import cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonDTO;
 import cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonFieldValueDTO;
 import cn.cslg.report.common.model.vo.PersonnelVO;
-import cn.cslg.report.common.model.vo.invalidReReport.ExportInvalidReasonVO;
+
 import cn.cslg.report.common.model.vo.invalidReReport.QueryInvalidReasonVO;
-import cn.cslg.report.common.utils.CacheUtils;
-import cn.cslg.report.common.utils.FileUtils;
-import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.common.utils.*;
 import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
-import cn.cslg.report.common.utils.WordUtil;
+import cn.cslg.report.entity.Report;
 import cn.cslg.report.entity.ReportDocument;
 import cn.cslg.report.entity.invalidReReport.InvalidReasonField;
 import cn.cslg.report.service.business.InvalidReReport.InvalidReasonFieldService;
 import cn.cslg.report.service.business.InvalidReReport.InvalidReasonService;
-import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.deepoove.poi.XWPFTemplate;
@@ -22,9 +18,6 @@ import com.deepoove.poi.config.Configure;
 import com.deepoove.poi.config.ConfigureBuilder;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xwpf.usermodel.*;
 import org.ddr.poi.html.HtmlRenderPolicy;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
@@ -39,6 +32,8 @@ import java.math.BigInteger;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static cn.cslg.report.common.utils.StringUtils.join;
+
 /**
  * 导出无效理由实现类
  *
@@ -54,11 +49,15 @@ public class ExportArgumentsScenariosService {
     private final FileUtils fileUtils;
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
+    private final ReportService reportService;
     public String ExportToWord(Integer reportId) throws IOException {
+
+        //根据报告id查询报告
+        Report report =reportService.getById(reportId);
         String templeName = IdUtil.simpleUUID() + ".docx";
         String directoryName = fileUtils.createDirectory();
         //富文本栏位计数器
-        int nameCount=0;
+        int nameCount = 0;
         Map<String, Object> map1 = new HashMap<>();
         XWPFDocument doc = new XWPFDocument();
         doc.createStyles();
@@ -91,20 +90,24 @@ public class ExportArgumentsScenariosService {
         //根据无效类型排序,方便合并单元格
         queryInvalidReasonVOS.sort(Comparator.comparing(QueryInvalidReasonVO::getInvalidName));
         //设置标题
-        WordUtil.setParagraph(doc, "标题", "宋体", 16, 10, true, ParagraphAlignment.CENTER);
+        WordUtil.setParagraph(doc, report.getName()+"无效理由", "宋体", 16, 10, true, ParagraphAlignment.CENTER);
         //设置副标题
-        WordUtil.setParagraph(doc,"生成时间:"+new Date().toString() , "宋体", 10, 10, true, ParagraphAlignment.RIGHT);
+        WordUtil.setParagraph(doc, "生成时间:" + new Date().toString(), "宋体", 10, 10, true, ParagraphAlignment.RIGHT);
         int colTotalCount = fields.size() + 5;
         //总条数
         int dataCount = queryInvalidReasonVOS.size();
         //创建表格
         XWPFTable xTable = doc.createTable(1, colTotalCount);
+        CTTblPr tblPr =xTable.getCTTbl().addNewTblPr();
+        tblPr.addNewJc().setVal(STJc.CENTER);
         //设置边框
         WordUtil.setTableBolder(xTable, 10, "000000");
         // 创建表头数据
         for (int j = 0; j < colTotalCount; j++) {
-            WordUtil.setCellText(xTable.getRow(0).getCell(j), nameList.get(j), 200, "宋体", 10, true);
+            WordUtil.setCellText(xTable.getRow(0).getCell(j), nameList.get(j), 1200, "宋体", 10, true);
         }
+        //记录对比文件文件内容map
+        Map<Integer,String> fileMap = new TreeMap<>();
         //记录合并数据map
         Map<Integer, Integer> map = new HashMap<>();
         // 创建表格内容
@@ -119,15 +122,12 @@ public class ExportArgumentsScenariosService {
             }
             List<InvalidReasonFieldValueDTO> fieldValueDTOS = queryInvalidReasonVO.getFields();
             XWPFTableRow row = xTable.insertNewTableRow(i2 + 1);
-            row.setHeight(300);
             for (int j = 0; j < colTotalCount; j++) {
                 XWPFTableCell cell = row.createCell();
                 XWPFRun run;
-                run = WordUtil.setTableCellStyle(cell, ParagraphAlignment.CENTER, "微软雅黑", 9, false);
-           String aa=run.getStyle();
-           System.out.println(aa);
+                run = WordUtil.setTableCellStyle(cell, "1200", ParagraphAlignment.CENTER, "微软雅黑", 9, false);
                 if (j == 0) {
-                    run.setText(String.valueOf(i2));
+                    run.setText(String.valueOf(i2 + 1));
                 } else if (j == 1) {
                     if (name == 0) {
                         run.setText("权利要求不清楚");
@@ -143,9 +143,11 @@ public class ExportArgumentsScenariosService {
                     if (content == -1) {
                         run.setText("说明书");
                     } else {
-                        run.setText("权要" + content);
+                        run.setText("权要" + (content + 1));
                     }
-                } else if (j == 3) {
+                }
+                //
+                else if (j == 3) {
                     if (name == 0 || name == 1) {
                         run.setText(queryInvalidReasonVO.getProofStr());
                     } else {
@@ -153,33 +155,58 @@ public class ExportArgumentsScenariosService {
                         List<QueryInvalidReasonVO.proofGroupIn> proofGroupIns = queryInvalidReasonVO.getProofGroups();
                         for (int t = 0; t < proofGroupIns.size(); t++) {
                             List<QueryInvalidReasonVO.proofIn> proofIns = proofGroupIns.get(t).getProofs();
-                            List<Integer> strs = proofIns.stream().map(QueryInvalidReasonVO.proofIn::getSort).collect(Collectors.toList());
-                            for (int i = 0; i < strs.size(); i++) {
+                            for (int i = 0; i < proofIns.size(); i++) {
+                                QueryInvalidReasonVO.proofIn proofIn =proofIns.get(i);
+                                //生成对比文件组合名称
                                 if (t == 0 && i == 0) {
-                                    stringBuilder.append("D" + strs.get(i));
+                                    stringBuilder.append("D" +proofIn.getSort());
 
                                 } else if (t != 0 && i == 0) {
-                                    stringBuilder.append(" D" + strs.get(i));
+                                    stringBuilder.append(" D" + proofIn.getSort());
                                 } else {
-                                    stringBuilder.append("+D" + strs.get(i));
+                                    stringBuilder.append("+D" + proofIn.getSort());
+                                }
+                                //记录对比文件名称字典
+                                if(fileMap.get(proofIn.getSort())==null){
+                                    fileMap.put(proofIn.getSort(),proofIn.getFileName());
                                 }
                             }
+
+
                         }
                         run.setText(stringBuilder.toString());
                     }
                 } else if (j == 4) {
-                    map1.put("argument"+nameCount,queryInvalidReasonVO.getArgumentStr());
-                    run.setText("{{argument"+nameCount+"}}");
-                    nameCount=nameCount+1;
+                    map1.put("argument" + nameCount, queryInvalidReasonVO.getArgumentStr());
+                    run.setText("{{argument" + nameCount + "}}");
+                    nameCount = nameCount + 1;
                 } else {
                     InvalidReasonField field = fields.get(j - 5);
                     InvalidReasonFieldValueDTO valueDTO = fieldValueDTOS.stream().filter(item -> item.getFieldId().equals(field.getId())).findFirst().orElse(new InvalidReasonFieldValueDTO());
-                    map1.put(valueDTO.getFieldKey()+nameCount,valueDTO.getFieldValue());
-                    run.setText("{{"+valueDTO.getFieldKey()+nameCount+"}}");
-                    nameCount=nameCount+1;
+                    map1.put(valueDTO.getFieldKey() + nameCount, valueDTO.getFieldValue());
+                    run.setText("{{" + valueDTO.getFieldKey() + nameCount + "}}");
+                    nameCount = nameCount + 1;
                 }
             }
         }
+
+        //添加文件说明行
+        XWPFTableRow row = xTable.insertNewTableRow(dataCount + 1);
+        XWPFTableCell cell = row.createCell();
+        XWPFRun run;
+        run = WordUtil.setTableCellStyle(cell, "1200", ParagraphAlignment.CENTER, "微软雅黑", 9, false);
+         List<String> fileNames =new ArrayList<>();
+        for(Integer key:fileMap.keySet()){
+           fileNames.add("D"+key+"是"+ fileMap.get(key));
+         }
+    String  fileText =   StringUtils.join(fileNames, ",");
+        run.setText(fileText);
+        for(Integer p=0;p<colTotalCount-1;p++){
+            XWPFTableCell cellTem = row.createCell();
+            XWPFRun runTem;
+            runTem = WordUtil.setTableCellStyle(cellTem, "1200", ParagraphAlignment.CENTER, "微软雅黑", 9, false);
+        }
+        WordUtil.mergeCellsHorizontal(xTable,dataCount + 1,0,colTotalCount-1);
         //记录合并起始位置
         Integer t = 1;
         for (int i : map.keySet()) {
@@ -194,13 +221,12 @@ public class ExportArgumentsScenariosService {
         doc.close();
         HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
         // 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
-        ConfigureBuilder configureBuilder=  Configure.builder();
-        for (String key:map1.keySet())
-        {
-            configureBuilder=configureBuilder.bind(key,htmlRenderPolicy);
+        ConfigureBuilder configureBuilder = Configure.builder();
+        for (String key : map1.keySet()) {
+            configureBuilder = configureBuilder.bind(key, htmlRenderPolicy);
         }
-        Configure configure=configureBuilder.build();
-        XWPFTemplate template = XWPFTemplate.compile("D:\\RMS\\output.docx", configure).render(map1);
+        Configure configure = configureBuilder.build();
+        XWPFTemplate template = XWPFTemplate.compile(templePath, configure).render(map1);
         String fileName = IdUtil.simpleUUID() + ".docx";
         String outPath = fileUtils.getSavePath(directoryName) + fileName;
         template.writeToFile(outPath);

+ 1 - 0
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/InvalidReasonService.java

@@ -481,6 +481,7 @@ public class InvalidReasonService extends ServiceImpl<InvalidReasonMapper, Inval
                 proof.setPatentNo(item.getPatentNo());
                 proof.setFileId(item.getFileId());
                 proof.setFileType(item.getFileType());
+                proof.setFileName(item.getFileName());
                 proofIns.add(proof);
             });
             proofGroupIn.setProofIds(proofIds);

+ 0 - 1
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ProofGroupService.java

@@ -88,7 +88,6 @@ public class ProofGroupService extends ServiceImpl<ProofGroupMapper, ProofGroup>
         }
     }
 
-
     /**
      * 批量删除证据组合
      *

+ 11 - 3
RMS/src/main/java/cn/cslg/report/service/business/ReportService.java

@@ -16,6 +16,7 @@ import cn.cslg.report.exception.XiaoShiException;
 import cn.cslg.report.mapper.ReportMapper;
 import cn.cslg.report.service.*;
 import cn.cslg.report.service.business.InvalidReReport.InvalidReReportService;
+import cn.cslg.report.service.business.InvalidReReport.InvalidReasonFieldService;
 import cn.cslg.report.service.business.InvalidReReport.InvalidReasonService;
 import cn.cslg.report.service.business.asso.AssoReportPersonService;
 import com.alibaba.fastjson.JSON;
@@ -68,8 +69,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final IAssoEventReportService assoEventReportService;
     private final IFollowUpService followUpService;
     private final InvalidReReportService invalidReReportService;
+    private final InvalidReasonFieldService invalidReasonFieldService;
     private final InvalidReasonService invalidReasonService;
-
     private Report loadReport(ReportDTO reportDto) {
         Report report = new Report();
         //装载基本信息
@@ -131,7 +132,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     @Transactional(rollbackFor = Exception.class)
     public Integer addReport(ReportDTO reportDto, List<MultipartFile> files) throws IOException {
         //侵权/回避报告,若状态不是审核/完成,则直接将报告状态置为2(处理中)
-        if (reportDto.getType().equals(4) || reportDto.getType().equals(5) || reportDto.getType().equals(7)) {
+        if (reportDto.getType().equals(4) || reportDto.getType().equals(5)||reportDto.getType().equals(7)) {
             if (reportDto.getStatus() != null && reportDto.getStatus() != 0 && reportDto.getStatus() != 3) {
                 reportDto.setStatus(2);
             }
@@ -184,7 +185,13 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 }
             }
         } else {
-            reportFieldService.addDefaultField(report.getId(), report.getType());
+            if(report.getType()!=7) {
+                reportFieldService.addDefaultField(report.getId(), report.getType());
+            }
+            else {
+                invalidReasonFieldService.addDefault(report.getId());
+
+            }
         }
 
         Integer reportId = report.getId();
@@ -477,6 +484,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         //TODO 当时无效应对报告时
 
         //删除与报告关联的表数据
+        invalidReReportService.remove(new LambdaQueryWrapper<InvalidReReport>().eq(InvalidReReport::getReportId, id));
         //删除无效理由表数据
         invalidReasonService.remove(new LambdaQueryWrapper<InvalidReason>().eq(InvalidReason::getReportId, id));
 

BIN
RMS/target/classes/cn/cslg/report/controller/DownloadController.class


BIN
RMS/target/classes/cn/cslg/report/service/business/FeatureService.class


BIN
RMS/target/classes/cn/cslg/report/service/business/ReportService.class