|
@@ -1,27 +1,24 @@
|
|
|
package cn.cslg.pas.service;
|
|
|
|
|
|
+import cn.cslg.pas.common.dto.PatentColumnDTO;
|
|
|
+import cn.cslg.pas.common.dto.PatentDTO;
|
|
|
import cn.cslg.pas.common.dto.PatentDetailDTO;
|
|
|
import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
|
|
|
import cn.cslg.pas.common.dto.es.EsCustomFieldValueDTO;
|
|
|
import cn.cslg.pas.common.model.SystemMO;
|
|
|
+import cn.cslg.pas.common.model.request.StringRequest;
|
|
|
import cn.cslg.pas.common.utils.DateUtils;
|
|
|
import cn.cslg.pas.common.utils.FileUtils;
|
|
|
import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
import cn.cslg.pas.common.utils.PatentRightUtils;
|
|
|
-import cn.cslg.pas.common.vo.AvoidFeaturesVO;
|
|
|
-import cn.cslg.pas.common.vo.FieldValueVO;
|
|
|
-import cn.cslg.pas.common.vo.PatentRightParams;
|
|
|
-import cn.cslg.pas.common.vo.RePatentClaim;
|
|
|
+import cn.cslg.pas.common.vo.*;
|
|
|
import cn.cslg.pas.common.vo.business.AllCustomFieldVO;
|
|
|
import cn.cslg.pas.common.vo.business.PatentNoVO;
|
|
|
import cn.cslg.pas.domain.business.*;
|
|
|
import cn.cslg.pas.domain.es.Text;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.AvoidDesignMapper;
|
|
|
-import cn.cslg.pas.service.business.CustomFieldService;
|
|
|
-import cn.cslg.pas.service.business.ReportProjectService;
|
|
|
-import cn.cslg.pas.service.business.TemplateConfigService;
|
|
|
-import cn.cslg.pas.service.business.TempleService;
|
|
|
+import cn.cslg.pas.service.business.*;
|
|
|
import cn.cslg.pas.service.business.es.EsPatentService;
|
|
|
import cn.cslg.pas.service.business.es.EsService;
|
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
@@ -36,6 +33,7 @@ import com.deepoove.poi.data.PictureType;
|
|
|
import com.deepoove.poi.data.Pictures;
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.ss.usermodel.PictureData;
|
|
|
import org.ddr.poi.html.HtmlRenderPolicy;
|
|
|
import org.joda.time.format.FormatUtils;
|
|
@@ -70,6 +68,8 @@ public class ReportExportService {
|
|
|
private CustomFieldService customFieldService;
|
|
|
@Autowired
|
|
|
private EsService esService;
|
|
|
+ @Autowired
|
|
|
+ private FTOCompareRecordService ftoCompareRecordService;
|
|
|
|
|
|
/**
|
|
|
* @param projectId
|
|
@@ -360,126 +360,119 @@ public class ReportExportService {
|
|
|
* @description 装载FTO模板
|
|
|
*/
|
|
|
private XWPFTemplate FTOTemplate(Integer projectId, String filePath, Integer templateId) throws IOException {
|
|
|
- //根据报告ID获得自定义字段值的信息
|
|
|
-
|
|
|
//获得模板的配置信息
|
|
|
LambdaQueryWrapper<TemplateConfig> templateConfigWrapper = new LambdaQueryWrapper<TemplateConfig>();
|
|
|
templateConfigWrapper.eq(TemplateConfig::getTemplateId, templateId);
|
|
|
List<TemplateConfig> templateConfigs = templateConfigService.list(templateConfigWrapper);
|
|
|
-
|
|
|
+ List<Map<String, Object>> classifyMaps = new ArrayList<>();
|
|
|
for (TemplateConfig templateConfig : templateConfigs) {
|
|
|
+ Map<String, Object> classifyMap = new HashMap<>();
|
|
|
+
|
|
|
String value = templateConfig.getValueName();
|
|
|
//根据value 查询专利
|
|
|
- List<EsCustomFieldDTO> esCustomFieldDTOS = customFieldService.getCustomFieldByValueName(value,projectId);
|
|
|
- if(esCustomFieldDTOS.size()!=0){
|
|
|
-
|
|
|
-
|
|
|
+ List<EsCustomFieldValueDTO> esCustomFieldDTOS = customFieldService.getCustomFieldByValueName(value, projectId);
|
|
|
+ if (esCustomFieldDTOS.size() != 0) {
|
|
|
+ classifyMap.put("classify", templateConfig.getMapName());
|
|
|
+ StringRequest stringRequest = new StringRequest();
|
|
|
+ stringRequest.setCustomFields(esCustomFieldDTOS);
|
|
|
+ stringRequest.setProjectId(projectId);
|
|
|
+ List<PatentColumnDTO> patentColumnDTOS = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ PatentDTO patentDTO = esService.esSearch(stringRequest);
|
|
|
+ patentColumnDTOS = patentDTO.getPatents();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //存放公告专利
|
|
|
+ List<Map<String, Object>> announcePatents = new ArrayList<>();
|
|
|
+ //存放公开专利
|
|
|
+ List<Map<String, Object>> publicPatents = new ArrayList<>();
|
|
|
+ //存放失效专利信息
|
|
|
+ List<Map<String, Object>> lapsePatents = new ArrayList<>();
|
|
|
+ for (PatentColumnDTO patent : patentColumnDTOS) {
|
|
|
+// 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.getAppDate());
|
|
|
+ //公开日
|
|
|
+ patentMap.put("publicDate", patent.getPublicDate());
|
|
|
+ //专利号
|
|
|
+ patentMap.put("publicNo", patent.getPatentNo());
|
|
|
+ patentMap.put("firstPublicDate", patent.getPublicDate());
|
|
|
+// patentMap.put("applicant", applicants);
|
|
|
+// patentMap.put("rightPerson", rightPerson);
|
|
|
+// patentMap.put("affair", affair);
|
|
|
+ //优先权日
|
|
|
+ patentMap.put("priorityDate", patent.getPriorities());
|
|
|
+ //图示
|
|
|
+// patentMap.put("abstractPath", "http://139.224.24.90:8081" + patent.get("abstractPath"));
|
|
|
+ //获得专利对比记录的信息
|
|
|
+ Map<String, Object> temMap = ftoCompareRecordService.LoadCompareMessageForExport(projectId, patent.getPatentNo());
|
|
|
+ List<CompareMessageVO> compareMessageVOS = (List<CompareMessageVO>) temMap.get("compareMessageVOs");
|
|
|
+ //装载对比记录的信息
|
|
|
+ patentMap.put("cM", compareMessageVOS);
|
|
|
+ patentMap.put("rightNum", temMap.get("right"));
|
|
|
+ patentMap.put("mainRightNum", temMap.get("mainRight"));
|
|
|
+ Integer status = Integer.parseInt(patent.getSimpleStatus());
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //
|
|
|
- List<Map<String, Object>> classifyMaps = new ArrayList<>();
|
|
|
- //装载信息
|
|
|
-// for (TemplateConfig templateConfig : templateConfigs) {
|
|
|
-// Map<String, Object> classifyMap = new HashMap<>();
|
|
|
-// 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();
|
|
|
-// patentVO.setPatentNos(patentNos);
|
|
|
-// //根据专利号查询专利详细信息
|
|
|
-// 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("priorityDate", patent.get("priorityDate"));
|
|
|
-// //图示
|
|
|
-// 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"));
|
|
|
-// 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);
|
|
|
-// }
|
|
|
-// 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("cM", policy).bind("targetDescription", htmlRenderPolicy).build();
|
|
|
-// XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
-// return template;
|
|
|
- return null;
|
|
|
- }
|
|
|
+ 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("cM", policy).bind("targetDescription", htmlRenderPolicy).build();
|
|
|
+ XWPFTemplate template = XWPFTemplate.compile(filePath, configure).render(map);
|
|
|
+ return template;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|