|
@@ -1,6 +1,8 @@
|
|
|
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.PatentRightVo;
|
|
|
import cn.cslg.report.common.model.vo.PatentVO;
|
|
|
import cn.cslg.report.common.model.vo.PersonnelVO;
|
|
|
import cn.cslg.report.common.utils.*;
|
|
@@ -20,6 +22,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.config.Configure;
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
|
+import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.poi.poifs.filesystem.DirectoryEntry;
|
|
@@ -57,6 +60,7 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
private final ReportFieldService reportFieldService;
|
|
|
private final TemplateConfigService templateConfigService;
|
|
|
private final ReportFieldPatentLinkService reportFieldPatentLinkService;
|
|
|
+ private final CompareMessageService compareMessageService;
|
|
|
|
|
|
public String reportDocument(ReportDocument reportDocument) {
|
|
|
|
|
@@ -99,12 +103,11 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
String directoryName = fileUtils.createDirectory();
|
|
|
String outPath = fileUtils.getSavePath(directoryName) + fileName;
|
|
|
Report report = reportService.getById(reportId);
|
|
|
- XWPFTemplate template =null;
|
|
|
- if(report.getType()==0||report.getType()==2) {
|
|
|
- template = this.getstabilityMaps(report, filePath);
|
|
|
- }
|
|
|
- else if(report.getType()==3){
|
|
|
- template= this.FTOtemplate(reportId, filePath,templeId);
|
|
|
+ XWPFTemplate template = null;
|
|
|
+ if (report.getType() == 0 || report.getType() == 2) {
|
|
|
+ template = this.getstabilityTemplate(report, filePath);
|
|
|
+ } else if (report.getType() == 3) {
|
|
|
+ template = this.FTOtemplate(reportId, filePath, templeId);
|
|
|
}
|
|
|
// 读取模板、数据并渲染
|
|
|
// 文件是否已存在,则删除
|
|
@@ -133,10 +136,10 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
|
|
|
/**
|
|
|
* @return
|
|
|
- * @autor
|
|
|
+ * @autor lrj
|
|
|
* @description 装载稳定和无效模板信息
|
|
|
*/
|
|
|
- private XWPFTemplate getstabilityMaps(Report report, String filePath) throws IOException {
|
|
|
+ private XWPFTemplate getstabilityTemplate(Report report, String filePath) throws IOException {
|
|
|
//根据报告Id获得报告信息
|
|
|
// 根据拆分人(报告的创建人)Id和报告ID获得所有特征
|
|
|
LambdaQueryWrapper<Features> allFeaturesWrapper = new LambdaQueryWrapper<>();
|
|
@@ -433,11 +436,12 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- List<Map<String, Object>> classifyMaps = new ArrayList<>();
|
|
|
+ //
|
|
|
+ List<Map<String,Object>> classifyMaps=new ArrayList<>();
|
|
|
//装载信息
|
|
|
for (Map<String, Object> map : loadMaps) {
|
|
|
Map<String, Object> classifyMap = new HashMap<>();
|
|
|
- classifyMap.put("classify" + map.get("order"), map.get("CName"));
|
|
|
+ classifyMap.put("classify", map.get("CName"));
|
|
|
//根据自定义字段ID和值Id查询专利号
|
|
|
List<String> patentNos = reportFieldPatentLinkService.getPatentNos(Integer.parseInt(map.get("FId").toString()), Integer.parseInt(map.get("CId").toString()));
|
|
|
PatentVO patentVO = new PatentVO();
|
|
@@ -446,9 +450,92 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
String resBody = outInterfaceService.getPatentDTOListForRMS(patentVO);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(resBody);
|
|
|
List<JSONObject> patentDTOS = JSON.parseArray(jsonObject.get("data").toString(), JSONObject.class);
|
|
|
+ //根据专利号和报告Id获得对比记录
|
|
|
+ //存放公告专利
|
|
|
+ List<Map<String, Object>> announcePatents = new ArrayList<>();
|
|
|
+ //存放公开专利
|
|
|
+ List<Map<String, Object>> publicPatents = new ArrayList<>();
|
|
|
+ //存放失效专利信息
|
|
|
+ List<Map<String, Object>> lapsePatents = new ArrayList<>();
|
|
|
+ for (JSONObject patent : patentDTOS) {
|
|
|
+ List<JSONObject> applicantJSONs = JSON.parseArray(patent.get("applicant").toString(), JSONObject.class);
|
|
|
+ StringBuilder applicants = new StringBuilder();
|
|
|
+ StringBuilder rightPerson = new StringBuilder();
|
|
|
+ applicantJSONs.forEach(tem -> {
|
|
|
+ if(Integer.parseInt(tem.get("dataType").toString())==1) {
|
|
|
+ applicants.append(tem.get("name") + "\r");
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ rightPerson.append(tem.get("name") + "\r");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //装载同族信息
|
|
|
+ JSONObject familys =JSONObject.parseObject(patent.get("family").toString());
|
|
|
+ List<String> patSnaps = JSON.parseArray(familys.get("patSnap").toString(), String.class);
|
|
|
+ List<String> simples = JSON.parseArray(familys.get("simple").toString(), String.class);
|
|
|
+ List<String> inpadocs =JSON.parseArray(familys.get("inpadoc").toString(), String.class);
|
|
|
+ patSnaps.addAll(simples);
|
|
|
+ patSnaps.addAll(inpadocs);
|
|
|
+ String familyStr=StringUtils.join(patSnaps,",");
|
|
|
+ //装载法律状态
|
|
|
+ StringBuilder affair = new StringBuilder();
|
|
|
+ List<JSONObject> affaires =JSON.parseArray(patent.get("affair").toString(), JSONObject.class);
|
|
|
+ affaires.forEach(item->{
|
|
|
+ affair.append(item.get("status")+ "\r");}
|
|
|
+
|
|
|
+ );
|
|
|
+ //装载单个专利的信息
|
|
|
+ Map<String, Object> patentMap = new HashMap<>();
|
|
|
+ //同族专利
|
|
|
+ patentMap.put("simpleFamilys",familyStr);
|
|
|
+ //引用专利
|
|
|
+ patentMap.put("quotePatents",patent.get("quote"));
|
|
|
+ //申请日
|
|
|
+ patentMap.put("applicationDate",patent.get("applicationDate"));
|
|
|
+ //公开日
|
|
|
+ patentMap.put("publicDate",patent.get("publicDate"));
|
|
|
+ //专利号
|
|
|
+ patentMap.put("publicNo", patent.get("publicNo"));
|
|
|
+ patentMap.put("firstPublicDate",patent.get("firstPublicDate"));
|
|
|
+ patentMap.put("applicant", applicants);
|
|
|
+ patentMap.put("rightPerson", rightPerson);
|
|
|
+ patentMap.put("affair",affair);
|
|
|
+ //图示
|
|
|
+ patentMap.put("abstractPath", "http://139.224.24.90:8081" + patent.get("abstractPath"));
|
|
|
+ //获得专利对比记录的信息
|
|
|
+ Map<String, Object> temMap = compareMessageService.queryforTemplate(patent.get("patentNo").toString(), reportId);
|
|
|
+ List<CompareMessageVO> compareMessageVOS = (List<CompareMessageVO>) temMap.get("compareMessageVOs");
|
|
|
+ //装载对比记录的信息
|
|
|
+ patentMap.put("compareMessage",compareMessageVOS);
|
|
|
+ patentMap.put("rightNum",temMap.get("right"));
|
|
|
+ patentMap.put("mainRightNum",temMap.get("mainRight"));
|
|
|
+ Integer status = Integer.parseInt(patent.get("simpleStatusInt").toString());
|
|
|
+ if(status==1||status==5||status==6){
|
|
|
+ announcePatents.add(patentMap);
|
|
|
+ }
|
|
|
+ else if(status==2){
|
|
|
+ lapsePatents.add(patentMap);
|
|
|
+ }
|
|
|
+ else if(status==3){
|
|
|
+ publicPatents.add(patentMap);
|
|
|
+ }
|
|
|
+ classifyMap.put("publicPatents",publicPatents);
|
|
|
+ classifyMap.put("lapsePatents",lapsePatents);
|
|
|
+ classifyMap.put("announcePatents",announcePatents);
|
|
|
+ }
|
|
|
+ classifyMaps.add(classifyMap);
|
|
|
}
|
|
|
- XWPFTemplate template = null;
|
|
|
-// XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ String date = DateUtils.formatDate(new Date(), DateUtils.YYYY_MM_DD);
|
|
|
+ String[] ds = date.split("-");
|
|
|
+ map.put("sys", new SystemMO(ds[0], ds[1], ds[2], "", "reportName"));
|
|
|
+ map.put("classifys", classifyMaps);
|
|
|
+ // 为表格的显示绑定行循环
|
|
|
+ LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
+ HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
|
|
+ // 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
|
|
|
+ Configure configure = Configure.builder().bind("compareMessage", policy).bind("compareMessageVOS", policy).build();
|
|
|
+ XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
return template;
|
|
|
}
|
|
|
|