|
@@ -113,6 +113,9 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
} else if (report.getType() == 3) {
|
|
|
template = this.FTOtemplate(reportId, filePath, templeId);
|
|
|
}
|
|
|
+ else if(report.getType()==4){
|
|
|
+ template = this.Torttemplate(reportId, filePath, templeId);
|
|
|
+ }
|
|
|
// 读取模板、数据并渲染
|
|
|
// 文件是否已存在,则删除
|
|
|
File file = new File(outPath);
|
|
@@ -551,6 +554,88 @@ public class ReportDocumentService extends ServiceImpl<ReportDocumentMapper, Rep
|
|
|
XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
return template;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param reportId
|
|
|
+ * @param filePath
|
|
|
+ * @return
|
|
|
+ * @description 装载侵权分析模板
|
|
|
+ */
|
|
|
+ private XWPFTemplate Torttemplate(Integer reportId, String filePath, Integer templateId) throws IOException {
|
|
|
+ //根据报告Id查询标的专利号
|
|
|
+ Report report =reportService.getById(reportId);
|
|
|
+ String patentNo =report.getSignPatentNo();
|
|
|
+ PatentVO patentVO = new PatentVO();
|
|
|
+ patentVO.setPatentNos(Arrays.asList(patentNo));
|
|
|
+ //根据专利号查询专利详细信息
|
|
|
+ String resBody = outInterfaceService.getPatentDTOListForRMS(patentVO);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(resBody);
|
|
|
+ List<JSONObject> patentDTOS = JSON.parseArray(jsonObject.get("data").toString(), JSONObject.class);
|
|
|
+ //装载单个专利的信息
|
|
|
+ Map<String, Object> patentMap = new HashMap<>();
|
|
|
+ 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");
|
|
|
+ }
|
|
|
+ );
|
|
|
+ //同族专利
|
|
|
+ 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("cM", compareMessageVOS);
|
|
|
+ patentMap.put("rightNum", temMap.get("right"));
|
|
|
+ patentMap.put("mainRightNum", temMap.get("mainRight"));
|
|
|
+ }
|
|
|
+ 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("patentMap", patentMap);
|
|
|
+ // 为表格的显示绑定行循环
|
|
|
+ LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
+ HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
|
|
|
+ // 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
|
|
|
+ Configure configure = Configure.builder().bind("cM", policy).bind("targetDescription",htmlRenderPolicy).build();
|
|
|
+ XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
+ return template;
|
|
|
+ }
|
|
|
/**
|
|
|
* function:删除报告时删除
|
|
|
*/
|