|
@@ -5,6 +5,7 @@ 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.model.vo.SourceVO;
|
|
|
import cn.cslg.report.common.utils.DataUtils;
|
|
|
import cn.cslg.report.common.utils.PatentUtils;
|
|
|
import cn.cslg.report.common.utils.Response;
|
|
@@ -16,6 +17,7 @@ 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 com.sun.xml.internal.ws.policy.privateutil.PolicyUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -214,6 +216,7 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
|
|
|
|
|
|
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());
|
|
@@ -250,6 +253,7 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
|
|
|
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();
|
|
@@ -292,88 +296,22 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
- public List<PatentQueryFieldSourceVO> getPatentQuerySourcePageList2(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());
|
|
|
+ public List<String> getString(SourceVO params)throws IOException{
|
|
|
+ List<String> list =new ArrayList<>();
|
|
|
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());
|
|
|
- for(ReportFieldPatentLink reportFieldPatentLink : part){
|
|
|
- PatentQueryFieldSourceVO patentQueryFieldSourceVO = new PatentQueryFieldSourceVO();
|
|
|
- patentQueryFieldSourceVO.setPatentNo(reportFieldPatentLink.getPatentNo());
|
|
|
- list.add(patentQueryFieldSourceVO);
|
|
|
+ lambdaQueryWrapper.eq(ReportFieldPatentLink::getFieldId,params.getFieldId()).eq(ReportFieldPatentLink::getOptionId,params.getKey());
|
|
|
+ List<ReportFieldPatentLink> reportFieldPatentLinks = reportFieldPatentLinkService.list(lambdaQueryWrapper);
|
|
|
+ for(ReportFieldPatentLink reportFieldPatentLink : reportFieldPatentLinks){
|
|
|
+ PatentQueryFieldSourceVO patentQueryFieldSourceVO = new PatentQueryFieldSourceVO();
|
|
|
|
|
|
- }
|
|
|
+ list.add(patentQueryFieldSourceVO.getPatentNo());
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
return list;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 模糊查询自定义字段(参数:自定义字段的id,和模糊查询的字段文本类型)
|
|
|
* 文本类型,单选,数字类型不用查
|
|
@@ -416,62 +354,76 @@ public class ReportFieldService extends ServiceImpl<ReportFieldMapper, ReportFie
|
|
|
* @return PatentQueryFieldSourceVO
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public String getPatent(List<PatentQueryFieldSourceVO> params)throws IOException{
|
|
|
- //为一的时候只取一个
|
|
|
- if(params.size()==1){
|
|
|
- return Response.success(this.getPatentQuerySourcePageList2(params.get(0)));
|
|
|
- }
|
|
|
- //为0的时候错误
|
|
|
+
|
|
|
+ public List<String> getPatentNo(List<SourceVO> params)throws IOException{
|
|
|
+
|
|
|
if(params.size()==0){
|
|
|
- return Response.error();
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
+ return list;
|
|
|
}
|
|
|
else {
|
|
|
- return Response.success (this.gather(params));
|
|
|
+ return this.getPatentNos(params);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- public List<PatentQueryFieldSourceVO> gather(List<PatentQueryFieldSourceVO> params) throws IOException{
|
|
|
- List<List<PatentQueryFieldSourceVO>> VO=new ArrayList<>();
|
|
|
- List<PatentQueryFieldSourceVO> list=new ArrayList<>(params);
|
|
|
- List<PatentQueryFieldSourceVO> list1=new ArrayList<>();
|
|
|
- Map<Integer, List<PatentQueryFieldSourceVO>> map=new HashMap<>();
|
|
|
+ }
|
|
|
+ public List<String> getPatentNos(List<SourceVO> params)throws IOException{
|
|
|
+ if(params.size()==1){
|
|
|
+ return this.getString(params.get(0));
|
|
|
+ }
|
|
|
+ return this.gather1(params);
|
|
|
+ }
|
|
|
+ public List<String> gather1 (List<SourceVO> params) throws IOException {
|
|
|
+ //为了求并集
|
|
|
+ List<List<String>> str=new ArrayList<>();
|
|
|
+ //定义新集合保留老集合
|
|
|
+ List<SourceVO> list=new ArrayList<>(params);
|
|
|
+ Map<Integer,List<SourceVO>> map=new HashMap<>();
|
|
|
for(int i=0;i<list.size()-1;i++){
|
|
|
- for (int j=i+1;j<list.size();j++){
|
|
|
- if(list.get(i).getFieldId().equals(list.get(j).getFieldId())){
|
|
|
+ List<SourceVO> sourceVO=new ArrayList<>();
|
|
|
+ for(int j=0;j<list.size();j++){
|
|
|
+ if(params.get(i).getFieldId().equals(list.get(j).getFieldId())){
|
|
|
+ sourceVO.add(list.get(j));
|
|
|
list.remove(list.get(j));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ if(sourceVO.size()!=0){
|
|
|
+ map.put(i,sourceVO);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- for(int i=0;i<list.size();i++){
|
|
|
- List<PatentQueryFieldSourceVO> list2=new ArrayList<>();
|
|
|
- list2.add(list.get(i));
|
|
|
- for(int j=0;j<params.size();j++){
|
|
|
- if(list.get(i).getFieldId().equals(params.get(j).getFieldId())){
|
|
|
- list2.add(params.get(j));
|
|
|
+ if(map.size()!=0){
|
|
|
+ for(List<SourceVO> sourceVOS :map.values()){
|
|
|
+ List<String> str1=new ArrayList<>();
|
|
|
+ for(SourceVO sourceVO :sourceVOS){
|
|
|
+ List<String> string = this.getString(sourceVO);
|
|
|
+ str1.addAll(string);
|
|
|
}
|
|
|
+ str1.stream().distinct().collect(Collectors.toList());
|
|
|
+ str.add(str1);
|
|
|
}
|
|
|
- map.put(list.get(i).getFieldId(),list2);
|
|
|
- }
|
|
|
- for( List<PatentQueryFieldSourceVO> a:map.values()){
|
|
|
- List<PatentQueryFieldSourceVO> param=new ArrayList<>();
|
|
|
- for(PatentQueryFieldSourceVO patentQueryFieldSourceVO :a){
|
|
|
- List<PatentQueryFieldSourceVO> patentQuerySourcePageList2 = this.getPatentQuerySourcePageList2(patentQueryFieldSourceVO);
|
|
|
- param.addAll(patentQuerySourcePageList2);
|
|
|
-
|
|
|
- }
|
|
|
- param.stream().distinct().collect(Collectors.toList());
|
|
|
- VO.add(param);
|
|
|
+ for(SourceVO sourceVO: list){
|
|
|
+ List<String> string = this.getString(sourceVO);
|
|
|
+ str.add(string);
|
|
|
}
|
|
|
- List<PatentQueryFieldSourceVO> list2 = VO.get(0);
|
|
|
- VO.forEach(item -> {
|
|
|
- list2.retainAll((Collection<?>) item);
|
|
|
|
|
|
- });
|
|
|
+ }else {
|
|
|
+ for(SourceVO sourceVO: list){
|
|
|
+ List<String> string = this.getString(sourceVO);
|
|
|
+ str.add(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> list1 = str.get(0);
|
|
|
+ str.forEach(item -> {
|
|
|
+ list1.retainAll((Collection<?>) item);
|
|
|
|
|
|
- return list2;
|
|
|
+ });
|
|
|
+ return list1;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|