|
@@ -98,15 +98,14 @@ public class ReportExportService {
|
|
|
throw new XiaoShiException("报告不存在");
|
|
|
}
|
|
|
XWPFTemplate template = null;
|
|
|
- template = this.avoidDesignTemplate(projectId);
|
|
|
if (report.getReportType() == 0 || report.getReportType() == 2) {
|
|
|
// template = this.getstabilityTemplate(report, filePath);
|
|
|
} else if (report.getReportType() == 3) {
|
|
|
template = this.FTOTemplate(projectId, templateFilePath, templeId);
|
|
|
} else if (report.getReportType() == 4) {
|
|
|
-// template = this.Torttemplate(reportId, filePath, templeId);
|
|
|
+ template = this.Torttemplate(projectId, templateFilePath);
|
|
|
} else if (report.getReportType() == 5) {
|
|
|
-// template = this.avoidDesignTemplate(reportId, filePath);
|
|
|
+ template = this.avoidDesignTemplate(projectId, templateFilePath);
|
|
|
} else if (report.getReportType() == 1) {
|
|
|
// template = this.getThirdTemplate(report, filePath);
|
|
|
}
|
|
@@ -137,89 +136,89 @@ public class ReportExportService {
|
|
|
if (file.exists()) {
|
|
|
file.delete();
|
|
|
}
|
|
|
- return "";
|
|
|
+ return ids.get(0);
|
|
|
}
|
|
|
|
|
|
|
|
|
-// private XWPFTemplate Torttemplate(Integer reportId, String filePath, Integer templateId) throws IOException {
|
|
|
-// //根据报告Id查询标的专利号
|
|
|
-// ReportProject report = reportProjectService.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<>();
|
|
|
-//// JSONObject patent = patentDTOS.get(0);
|
|
|
-//// 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("name", patent.get("name"));
|
|
|
-// //图示
|
|
|
-// patentMap.put("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);
|
|
|
-// map.put("", patentNo);
|
|
|
-// // 为表格的显示绑定行循环
|
|
|
-// 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;
|
|
|
-// }
|
|
|
-
|
|
|
- private XWPFTemplate avoidDesignTemplate(Integer projectId) throws IOException {
|
|
|
- String filePath = fileUtils.getPath("/11.docx");
|
|
|
+ private XWPFTemplate Torttemplate(Integer reportId, String filePath) throws IOException {
|
|
|
+ //根据报告Id查询标的专利号
|
|
|
+ ReportProject report = reportProjectService.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<>();
|
|
|
+// JSONObject patent = patentDTOS.get(0);
|
|
|
+// 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("name", patent.get("name"));
|
|
|
+ //图示
|
|
|
+ patentMap.put("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);
|
|
|
+ map.put("", patentNo);
|
|
|
+ // 为表格的显示绑定行循环
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+
|
|
|
+ private XWPFTemplate avoidDesignTemplate(Integer projectId,String path) throws IOException {
|
|
|
+ String filePath = fileUtils.getPath(path);
|
|
|
|
|
|
log.info("开始处理导出规避设计报告,参数为:{}, {}", projectId, filePath);
|
|
|
LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
|