|
@@ -9,17 +9,26 @@ import cn.cslg.report.common.model.vo.*;
|
|
|
import cn.cslg.report.common.utils.DataUtils;
|
|
|
import cn.cslg.report.common.utils.DateUtils;
|
|
|
import cn.cslg.report.common.utils.Response;
|
|
|
+import cn.cslg.report.entity.CompareRecords;
|
|
|
+import cn.cslg.report.entity.CompareScenarios;
|
|
|
+import cn.cslg.report.entity.CompareScenariosAndRecords;
|
|
|
import cn.cslg.report.entity.Task;
|
|
|
import cn.cslg.report.service.BaseService;
|
|
|
import cn.cslg.report.service.OutInterfaceService;
|
|
|
+import cn.cslg.report.service.business.CompareRecordsService;
|
|
|
+import cn.cslg.report.service.business.CompareScenariosAndRecordsService;
|
|
|
+import cn.cslg.report.service.business.CompareScenariosService;
|
|
|
import cn.cslg.report.service.business.TaskService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.config.Configure;
|
|
|
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.poi.hssf.record.Record;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -29,10 +38,12 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.lang.reflect.Type;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Tag(name = "任务管理")
|
|
|
@RestController
|
|
@@ -44,6 +55,9 @@ public class TaskController {
|
|
|
private final TaskService taskService;
|
|
|
private final BaseService baseService;
|
|
|
private final OutInterfaceService outInterfaceService;
|
|
|
+ private final CompareScenariosService compareScenariosService;
|
|
|
+ private final CompareScenariosAndRecordsService scenariosRecordsService;
|
|
|
+ private final CompareRecordsService compareRecordsService;
|
|
|
|
|
|
@RequestMapping(value = "/deleteTask", method = RequestMethod.POST)
|
|
|
@Operation(summary = "删除任务")
|
|
@@ -109,10 +123,36 @@ public class TaskController {
|
|
|
|
|
|
@RequestMapping(value = "/temple", method = RequestMethod.GET)
|
|
|
@Operation(summary = "测试")
|
|
|
- public String temple() throws ParseException, IOException {
|
|
|
+ public String temple(Integer reportId) throws ParseException, IOException {
|
|
|
String filePath= "C:\\Users\\admin\\Desktop\\1.docx";
|
|
|
// 读取模板后保存生成word的地址
|
|
|
String outPath = "C:\\Users\\admin\\Desktop\\2.docx";
|
|
|
+ //查询所有的对比方案并获得Id
|
|
|
+ LambdaQueryWrapper<CompareScenarios> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(CompareScenarios::getReportId,reportId);
|
|
|
+ List<CompareScenarios> compareScenarios =compareScenariosService.list(queryWrapper);
|
|
|
+ List<Integer> scenarioIds= compareScenarios.stream().map(CompareScenarios::getId).collect(Collectors.toList());
|
|
|
+ //根据对比方案Id 从关联表里获得对比记录ID
|
|
|
+ LambdaQueryWrapper<CompareScenariosAndRecords> queryRecordsByIDs=new LambdaQueryWrapper<>();
|
|
|
+ queryRecordsByIDs.in(CompareScenariosAndRecords::getScenariosID,scenarioIds);
|
|
|
+ List<CompareScenariosAndRecords> scenariosRecords= scenariosRecordsService.list(queryRecordsByIDs);
|
|
|
+ List<Integer> recordIds = scenariosRecords.stream().map(CompareScenariosAndRecords::getRecordID).collect(Collectors.toList());
|
|
|
+ //根据对比记录ID获得专利号
|
|
|
+ LambdaQueryWrapper<CompareRecords> queryPatentByIDs=new LambdaQueryWrapper<>();
|
|
|
+ queryPatentByIDs.in(CompareRecords::getId,recordIds);
|
|
|
+ List<CompareRecords> compareRecords =compareRecordsService.list(queryPatentByIDs);
|
|
|
+ List<String> PatentNos =compareRecords.stream().map(CompareRecords::getPatentNo).collect(Collectors.toList());
|
|
|
+ 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);
|
|
|
+
|
|
|
+ //获得详情转换为List
|
|
|
+
|
|
|
+ //填充到map
|
|
|
+
|
|
|
// 为表格的显示绑定行循环
|
|
|
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
// 将bz设置为行循环绑定的数据源的key,即key是bz的value会在模板中的{{bz}}处进行解析
|