|
@@ -1,4 +1,5 @@
|
|
|
package cn.cslg.report.service.business;
|
|
|
+
|
|
|
import cn.cslg.report.common.model.dto.CustomFieldLabelDTO;
|
|
|
|
|
|
import cn.cslg.report.common.model.vo.CompareFilesVO;
|
|
@@ -21,9 +22,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+
|
|
|
@SuppressWarnings({"all"})
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -37,29 +40,29 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
private final ReportFieldOptionService reportFieldOptionService;
|
|
|
private final AssoComapareFielService assoComapareFielService;
|
|
|
private final ReportFieldPatentLinkService reportFieldPatentLinkService;
|
|
|
- private final TaskService taskService;
|
|
|
+ private final TaskService taskService;
|
|
|
private final AssoTaskPersonelService assoTaskPersonelService;
|
|
|
|
|
|
/**
|
|
|
- * @function 添加对比文件
|
|
|
* @param compareFilesVO
|
|
|
* @return 是否添加成功
|
|
|
* @throws IOException
|
|
|
+ * @function 添加对比文件
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String addCompareFile(CompareFilesVO compareFilesVO) throws IOException {
|
|
|
//查询标的专利信息
|
|
|
Report report = reportService.getById(compareFilesVO.getReportId());
|
|
|
//根据标的专利号获得专利信息
|
|
|
- String res1 = outInterfaceService.getPatentFromPAS( report.getSignPatentNo());
|
|
|
+ String res1 = outInterfaceService.getPatentFromPAS(report.getSignPatentNo());
|
|
|
JSONObject res1Object = JSONObject.parseObject(res1);
|
|
|
JSONObject patentNoJSON = JSONObject.parseObject(res1Object.get("data").toString());
|
|
|
- //获得引用专利号
|
|
|
- String quote =patentNoJSON.get("quote").toString().replace(" ","");
|
|
|
- List<String> quotes = Arrays.asList(quote.split("\\|"));
|
|
|
- //获得同族专利号
|
|
|
- List<String> familyPatentNos =new ArrayList<>();
|
|
|
- if(patentNoJSON.containsKey("family")) {
|
|
|
+ //获得引用专利号
|
|
|
+ String quote = patentNoJSON.get("quote").toString().replace(" ", "");
|
|
|
+ List<String> quotes = Arrays.asList(quote.split("\\|"));
|
|
|
+ //获得同族专利号
|
|
|
+ List<String> familyPatentNos = new ArrayList<>();
|
|
|
+ if (patentNoJSON.containsKey("family")) {
|
|
|
String familyJson = patentNoJSON.get("family").toString();
|
|
|
familyPatentNos = JsonUtils.jsonToList(JsonUtils.objectToJson(familyJson), String.class);
|
|
|
}
|
|
@@ -85,16 +88,16 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
patentNos.addAll(compareFilesVO.getIsAdd());
|
|
|
//获取对比文件对比表的专利号
|
|
|
patentNos.removeAll(patentNoList);
|
|
|
- for(int i=0;i<patentNos.size();i++){
|
|
|
+ for (int i = 0; i < patentNos.size(); i++) {
|
|
|
CompareFiles compareFiles1 = new CompareFiles();
|
|
|
//根据专利号和报告id造对象
|
|
|
compareFiles1.setPatentNo(patentNos.get(i));
|
|
|
compareFiles1.setReportId(compareFilesVO.getReportId());
|
|
|
//区分对比文件的类型
|
|
|
- if (familyPatentNos != null&"es.size() != 0 && quotes.contains(patentNos.get(i))) {
|
|
|
+ if (familyPatentNos != null && quotes.size() != 0 && quotes.contains(patentNos.get(i))) {
|
|
|
compareFiles1.setRemark("引");
|
|
|
}
|
|
|
- if (familyPatentNos != null&&familyPatentNos.size() != 0 && familyPatentNos.contains(patentNos.get(i))) {
|
|
|
+ if (familyPatentNos != null && familyPatentNos.size() != 0 && familyPatentNos.contains(patentNos.get(i))) {
|
|
|
compareFiles1.setRemark("同");
|
|
|
}
|
|
|
|
|
@@ -106,7 +109,6 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @param compareFilesVO
|
|
|
* @return
|
|
|
* @throws IOException
|
|
@@ -129,7 +131,7 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
patentNos.removeAll(compareFilesVO.getIsDelete());
|
|
|
//添加新的
|
|
|
patentNos.addAll(compareFilesVO.getIsAdd());
|
|
|
- for(int i=0;i<patentNos.size();i++){
|
|
|
+ for (int i = 0; i < patentNos.size(); i++) {
|
|
|
CompareFiles compareFiles1 = new CompareFiles();
|
|
|
//根据专利号和报告id造对象
|
|
|
compareFiles1.setPatentNo(patentNos.get(i));
|
|
@@ -140,11 +142,12 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
this.saveBatch(compareFiles);
|
|
|
return Response.success();
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * @function 根据PatentVO里的条件(分页)模糊查询标的专利号和数量
|
|
|
* @param patentVO
|
|
|
* @return 标的专利号和数量 map
|
|
|
* @throws IOException
|
|
|
+ * @function 根据PatentVO里的条件(分页)模糊查询标的专利号和数量
|
|
|
*/
|
|
|
public String getCompareFile(PatentVO patentVO) throws IOException {
|
|
|
LambdaQueryWrapper<CompareFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -165,7 +168,7 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
wrapper1.select(Report::getSignPatentNo);
|
|
|
wrapper1.eq(Report::getId, patentVO.getReportId());
|
|
|
//获取标的专利号
|
|
|
- if(reportService.list(wrapper1).size()==0){
|
|
|
+ if (reportService.list(wrapper1).size() == 0) {
|
|
|
return "";
|
|
|
}
|
|
|
patentVO.setNotInPatentNos(patentNos);
|
|
@@ -192,25 +195,25 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 根据PatentVO里的条件模糊查询获得已经确定的对比专利详情
|
|
|
* @param patentVO
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
+ * @function 根据PatentVO里的条件模糊查询获得已经确定的对比专利详情
|
|
|
*/
|
|
|
//
|
|
|
public String getSureCompareFile(PatentVO patentVO) throws IOException {
|
|
|
- List<String> patentNos= new ArrayList<>();
|
|
|
+ List<String> patentNos = new ArrayList<>();
|
|
|
LambdaQueryWrapper<CompareFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(CompareFiles::getReportId, patentVO.getReportId());
|
|
|
List<CompareFiles> compareFiles = this.list(queryWrapper);
|
|
|
- List<String> AllpatentNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
|
|
|
+ List<String> AllpatentNos = compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
|
|
|
//无查询条件
|
|
|
- if (patentVO.getFiledOptions() == null||patentVO.getFiledOptions().size() == 0) {
|
|
|
- patentNos=AllpatentNos;
|
|
|
+ if (patentVO.getFiledOptions() == null || patentVO.getFiledOptions().size() == 0) {
|
|
|
+ patentNos = AllpatentNos;
|
|
|
}
|
|
|
//有查询条件时,自定义字段的专利号和任务的专利号取交集
|
|
|
else {
|
|
|
- patentNos = reportFieldService.getPatentNo1(patentVO.getFiledOptions(),patentVO.getReportId(),patentVO.getTaskId(),patentVO.getTaskStatus());
|
|
|
+ patentNos = reportFieldService.getPatentNo1(patentVO.getFiledOptions(), patentVO.getReportId(), patentVO.getTaskId(), patentVO.getTaskStatus());
|
|
|
patentVO.setPatentNos(patentNos);
|
|
|
}
|
|
|
patentVO.setPatentNos(patentNos);
|
|
@@ -228,10 +231,10 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 删除单个对比专利
|
|
|
* @param compareFilesVO
|
|
|
* @return 是否删除成功
|
|
|
* @throws IOException
|
|
|
+ * @function 删除单个对比专利
|
|
|
*/
|
|
|
|
|
|
public String deletePatentNo(CompareFilesVO compareFilesVO) throws IOException {
|
|
@@ -264,29 +267,29 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 根据id删除对比文件
|
|
|
* @param id
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
+ * @function 根据id删除对比文件
|
|
|
*/
|
|
|
- public String deleByReportId(int id)throws IOException{
|
|
|
+ public String deleByReportId(int id) throws IOException {
|
|
|
CompareFiles compareFiles = new CompareFiles();
|
|
|
compareFiles.deleteById(id);
|
|
|
return Response.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 根据报告id 和专利号查询对比文件
|
|
|
- * @param reportId 报告的id
|
|
|
+ * @param reportId 报告的id
|
|
|
* @param patentNos 专利号
|
|
|
* @return 专利号的集合
|
|
|
* @throws IOException
|
|
|
+ * @function 根据报告id 和专利号查询对比文件
|
|
|
*/
|
|
|
- public List<CustomFieldLabelDTO> setAll(Integer reportId, String patentNos) throws IOException{
|
|
|
+ public List<CustomFieldLabelDTO> setAll(Integer reportId, String patentNos) throws IOException {
|
|
|
List<CustomFieldLabelDTO> dataList = new ArrayList<>();
|
|
|
//根据报告id找到对比文件
|
|
|
List<ReportField> reportFields = reportFieldService.selectAll(reportId);
|
|
|
- for(ReportField reportField:reportFields) {
|
|
|
+ for (ReportField reportField : reportFields) {
|
|
|
PatentIndexSettingVO params = new PatentIndexSettingVO();
|
|
|
CustomFieldLabelDTO data = new CustomFieldLabelDTO();
|
|
|
params.setPatentNo(patentNos);
|
|
@@ -304,18 +307,17 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
return dataList;
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 修改 reportFieldPatentLink
|
|
|
* @param params
|
|
|
* @throws IOException
|
|
|
+ * @function 修改 reportFieldPatentLink
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void getPatentIndexSetting(PatentIndexSettingVO params)throws IOException {
|
|
|
- if(params.getTaskID()!=null) {
|
|
|
- Task task =taskService.getById(params.getTaskID());
|
|
|
+ public void getPatentIndexSetting(PatentIndexSettingVO params) throws IOException {
|
|
|
+ if (params.getTaskID() != null) {
|
|
|
+ Task task = taskService.getById(params.getTaskID());
|
|
|
params.setReportId(task.getReportId());
|
|
|
reportFieldPatentLinkService.updatePatentIndexSetting(params);
|
|
|
LambdaQueryWrapper<AssoTaskPersonel> queryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -324,16 +326,15 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
AssoTaskPersonel assoTaskPersonel = assoTaskPersonelService.list(queryWrapper).get(0);
|
|
|
assoTaskPersonel.setState(1);
|
|
|
assoTaskPersonel.updateById();
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
reportFieldPatentLinkService.updatePatentIndexSetting(params);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 根据报告id查询对比文件
|
|
|
* @param reportId 报告的id
|
|
|
* @return
|
|
|
+ * @function 根据报告id查询对比文件
|
|
|
*/
|
|
|
|
|
|
|
|
@@ -345,7 +346,7 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
List<AssoTaskPersonel> assoTaskPersonels = assoTaskPersonelService.list(queryWrapper);
|
|
|
LambdaQueryWrapper<CompareFiles> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
//根据报告id查询对比文件的详情
|
|
|
- queryWrapper1.eq(CompareFiles::getReportId,reportId);
|
|
|
+ queryWrapper1.eq(CompareFiles::getReportId, reportId);
|
|
|
List<CompareFiles> compareFiles = this.list(queryWrapper1);
|
|
|
Map<String, Object> reMap = new HashMap<>();
|
|
|
reMap.put("all", compareFiles.size());
|
|
@@ -357,22 +358,43 @@ public class CompareFilesService extends ServiceImpl<CompareFilesMapper, Compare
|
|
|
|
|
|
List<AssoTaskPersonel> assoRead = assoTaskPersonels.stream().filter(item -> item.getState().equals(1)).collect(Collectors.toList());
|
|
|
reMap.put("all", compareFiles.size());
|
|
|
- reMap.put("noRead",compareFiles.size()- assoRead.size());
|
|
|
+ reMap.put("noRead", compareFiles.size() - assoRead.size());
|
|
|
reMap.put("read", assoRead.size());
|
|
|
return reMap;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* function : 在删除报告的时候删除对比文件
|
|
|
- *
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String delete(Integer id){
|
|
|
+ public String delete(Integer id) {
|
|
|
LambdaQueryWrapper<CompareFiles> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(CompareFiles::getReportId,id);
|
|
|
+ queryWrapper.eq(CompareFiles::getReportId, id);
|
|
|
remove(queryWrapper);
|
|
|
return Response.success();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ public Integer addOrder(Integer reportId, String pantentNO, Integer order) {
|
|
|
+ //根据报告ID 和专利号 查询对比文件
|
|
|
+ LambdaQueryWrapper<CompareFiles> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(CompareFiles::getPatentNo, pantentNO)
|
|
|
+ .eq(CompareFiles::getReportId, reportId);
|
|
|
+ List<CompareFiles> compareFiles = this.list(wrapper);
|
|
|
+ //如果未查到则返回-1
|
|
|
+ if (compareFiles.size() == 0) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ // 判断该顺序是否被使用过
|
|
|
+ LambdaQueryWrapper<CompareFiles> wrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper1.eq(CompareFiles::getReportId, reportId)
|
|
|
+ .eq(CompareFiles::getSysOrder, order);
|
|
|
+ List<CompareFiles> compareFiles1 = this.list(wrapper1);
|
|
|
+ if (compareFiles1.size() > 0) {
|
|
|
+ return -2;
|
|
|
+ }
|
|
|
+ CompareFiles compareFile = compareFiles.get(0);
|
|
|
+ compareFile.setSysOrder(order);
|
|
|
+ compareFile.updateById();
|
|
|
+ return compareFile.getId();
|
|
|
+ }
|
|
|
}
|