|
@@ -1,14 +1,18 @@
|
|
|
package cn.cslg.report.service.business;
|
|
|
|
|
|
+import cn.cslg.report.common.model.dto.PatentQueryFieldSourceDTO;
|
|
|
import cn.cslg.report.common.model.vo.PatentField;
|
|
|
+import cn.cslg.report.common.model.vo.PatentQueryFieldSourceVO;
|
|
|
import cn.cslg.report.common.model.vo.ReportFieldVO;
|
|
|
import cn.cslg.report.common.utils.DataUtils;
|
|
|
import cn.cslg.report.common.utils.PatentUtils;
|
|
|
import cn.cslg.report.common.utils.Response;
|
|
|
import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
+
|
|
|
import cn.cslg.report.entity.*;
|
|
|
import cn.cslg.report.mapper.ReportFieldMapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -205,14 +209,174 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 统计(自定义字段的id和报告id)查询哪些专利号与之对应
|
|
|
- * 返回相关的专利的数量
|
|
|
- */
|
|
|
+ public List<PatentQueryFieldSourceVO> getPatentQuerySourcePageList(PatentQueryFieldSourceVO params) {
|
|
|
+ List<PatentQueryFieldSourceVO> list =new ArrayList<>();
|
|
|
+ //根据fieldId 从patent_field中获得 自定义字段对象
|
|
|
+ LambdaQueryWrapper<ReportField> wrapper =new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ReportField::getId,params.getFieldId());
|
|
|
+ ReportField reportField =this.list(wrapper).get(0);
|
|
|
+ //根据自定义字段的类型,从三张值表中查询该自定义字段所有值的id
|
|
|
+ Integer type1 =reportField.getType();
|
|
|
+ switch (type1){
|
|
|
+ //数字
|
|
|
+ case 0:
|
|
|
+ //日期
|
|
|
+ case 1:
|
|
|
+ //文本
|
|
|
+ case 2:
|
|
|
+ LambdaQueryWrapper<ReportFieldText> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ReportFieldText::getFieldId,params.getFieldId());
|
|
|
+ List<ReportFieldText> reportFieldTexts =reportFieldTextService.list(queryWrapper);
|
|
|
+ reportFieldTexts.forEach(item->{
|
|
|
+ PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
|
|
|
+ patentQueryFieldSourceVO.setFieldId(params.getFieldId());
|
|
|
+ patentQueryFieldSourceVO.setKey(item.getId());
|
|
|
+ patentQueryFieldSourceVO.setLabel(item.getText());
|
|
|
+ list.add(patentQueryFieldSourceVO);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+
|
|
|
+ //单选
|
|
|
+ case 4:
|
|
|
+
|
|
|
+ //多选
|
|
|
+ case 5:
|
|
|
+ LambdaQueryWrapper<ReportFieldOption> queryWrapper5 =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper5.eq(ReportFieldOption::getFieldId,params.getFieldId());
|
|
|
+ List<ReportFieldOption> reportFieldOption =reportFieldOptionService.list(queryWrapper5);
|
|
|
+ reportFieldOption.forEach(item->{
|
|
|
+ PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
|
|
|
+ patentQueryFieldSourceVO.setFieldId(params.getFieldId());
|
|
|
+ patentQueryFieldSourceVO.setKey(item.getId());
|
|
|
+ patentQueryFieldSourceVO.setLabel(item.getName());
|
|
|
+ list.add(patentQueryFieldSourceVO);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+
|
|
|
+ //树
|
|
|
+ case 6:
|
|
|
+ LambdaQueryWrapper<ReportFieldTree> queryWrapper6 =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper6.eq(ReportFieldTree::getFieldId,params.getFieldId());
|
|
|
+ List<ReportFieldTree> reportFieldTrees =reportFieldTreeService.list(queryWrapper6);
|
|
|
+ reportFieldTrees.forEach(item->{
|
|
|
+ PatentQueryFieldSourceVO patentQueryFieldSourceVO=new PatentQueryFieldSourceVO();
|
|
|
+ patentQueryFieldSourceVO.setFieldId(params.getFieldId());
|
|
|
+ patentQueryFieldSourceVO.setKey(item.getId());
|
|
|
+ patentQueryFieldSourceVO.setLabel(item.getName());
|
|
|
+ list.add(patentQueryFieldSourceVO);
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<Integer> valueIds =list.stream().map(PatentQueryFieldSourceVO::getKey).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<ReportFieldPatentLink> lambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId,params.getFieldId())
|
|
|
+ .in(ReportFieldPatentLink::getOptionId,valueIds);
|
|
|
+ List<ReportFieldPatentLink> reportFieldPatentLinks =reportFieldPatentLinkService.list(lambdaQueryWrapper);
|
|
|
+ list.forEach(tem->{
|
|
|
+ List<ReportFieldPatentLink> part =reportFieldPatentLinks.stream().filter(tm->tm.getFieldId().equals(params.getFieldId())&&tm.getOptionId().equals(tem.getKey()
|
|
|
+ )).collect(Collectors.toList());
|
|
|
+ tem.setCount(part.size());
|
|
|
+ tem.setType(type1);
|
|
|
+ });
|
|
|
+ //根据值id从ReportFieldPatentLink表中获得信息
|
|
|
+ return list;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+// public IPage<PatentQueryFieldSourceDTO> getPatentAttributeSourcePageList(PatentQueryFieldSourceVO params) {
|
|
|
+// this.setPatentQuerySourceParams(params);
|
|
|
+// if (params.getKey().equals("40-0")) {
|
|
|
+// Integer projectId = params.getProjectId();
|
|
|
+// List<PatentQueryFieldSourceDTO> dataList = baseMapper.getCountStatus(projectId);
|
|
|
+// List<PatentQueryFieldSourceDTO> lstA = new ArrayList<>();
|
|
|
+// List<PatentQueryFieldSourceDTO> lstB = new ArrayList<>();
|
|
|
+// dataList.forEach(item -> {
|
|
|
+// if (StringUtils.changeStringToString(item.getLabel(), "\\|").size() > 1) {
|
|
|
+// lstA.add(item);
|
|
|
+// } else {
|
|
|
+// lstB.add(item);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// lstA.forEach(item -> {
|
|
|
+// List<String> stringList = StringUtils.changeStringToString(item.getLabel(), "\\|");
|
|
|
+//
|
|
|
+// stringList.forEach(x -> {
|
|
|
+// List<PatentQueryFieldSourceDTO> lstC = new ArrayList<>();
|
|
|
+// for (PatentQueryFieldSourceDTO patentQueryFieldSourceDTO : lstB) {
|
|
|
+// if (!lstB.stream().map(PatentQueryFieldSourceDTO::getLabel).collect(Collectors.toList()).contains(x)) {
|
|
|
+// PatentQueryFieldSourceDTO a = new PatentQueryFieldSourceDTO();
|
|
|
+// a.setCount(item.getCount());
|
|
|
+// a.setLabel(x);
|
|
|
+// lstC.add(a);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// if (patentQueryFieldSourceDTO.getLabel().equals(x)) {
|
|
|
+// patentQueryFieldSourceDTO.setCount(patentQueryFieldSourceDTO.getCount() + item.getCount());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// lstB.addAll(lstC);
|
|
|
+// });
|
|
|
+// });
|
|
|
+// List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_STATUS));
|
|
|
+// lstB.forEach(b -> {
|
|
|
+// Integer status = Integer.parseInt(systemDictList.stream()
|
|
|
+// .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_STATUS) && systemDict.getLabel().equals(b.getLabel()))
|
|
|
+// .findFirst()
|
|
|
+// .orElse(new SystemDict()).getValue());
|
|
|
+// b.setValue(String.valueOf(status));
|
|
|
+// });
|
|
|
+// IPage<PatentQueryFieldSourceDTO> pageList = baseMapper.getPatentQuerySourcePageList(new Page<>(params.getCurrent(), params.getSize()), params, new ArrayList<>());
|
|
|
+// pageList.setRecords(lstB);
|
|
|
+// return pageList;
|
|
|
+// }
|
|
|
+// IPage<PatentQueryFieldSourceDTO> pageList = baseMapper.getPatentQuerySourcePageList(new Page<>(params.getCurrent(), params.getSize()), params, new ArrayList<>());
|
|
|
+// pageList.getRecords().forEach(item -> item.setIds(null));
|
|
|
+// return pageList;
|
|
|
+// }
|
|
|
+
|
|
|
+// private void setPatentQuerySourceParams(PatentQueryFieldSourceVO params) {
|
|
|
+// List<Integer> field = StringUtils.changeStringToInteger(params.getKey(), "-");
|
|
|
+// Integer type = 0;
|
|
|
+// Integer level = 0;
|
|
|
+// Integer status = 0;
|
|
|
+// switch (params.getKey()) {
|
|
|
+// case "18-6":
|
|
|
+// case "18-7":
|
|
|
+// case "18-8":
|
|
|
+// case "23-6":
|
|
|
+// case "23-7":
|
|
|
+// case "23-8":
|
|
|
+// params.setApplicantType(2);
|
|
|
+// break;
|
|
|
+// case "19-6":
|
|
|
+// case "19-7":
|
|
|
+// case "19-8":
|
|
|
+// case "24-6":
|
|
|
+// case "24-7":
|
|
|
+// case "24-8":
|
|
|
+// params.setApplicantType(1);
|
|
|
+// break;
|
|
|
+// case "29-17":
|
|
|
+// case "30-17":
|
|
|
+// case "29-18":
|
|
|
+// case "29-19":
|
|
|
+// case "29-20":
|
|
|
+// case "30-18":
|
|
|
+// case "30-19":
|
|
|
+// case "30-20":
|
|
|
+// params.setApplicantType(field.get(0) == 29 ? 2 : 1);
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// params.setCustomFieldId(field.get(0));
|
|
|
+// if (params.getType().equals("6") && field.get(1).equals(0)) {
|
|
|
+// params.setCustomFieldTreeType(0);
|
|
|
+// } else {
|
|
|
+// params.setCustomFieldTreeType(null);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
|
|
|
}
|
|
|
|