|
@@ -139,20 +139,32 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
return resultList.stream().sorted(Comparator.comparing(AnalysisItemResultDTO::getCount).reversed()).limit(end).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description 图标分析模块 数据获取方法(一维数据,二位数据的下拉选项)
|
|
|
+ */
|
|
|
public String getSourceData2(SearchSourceDataVO searchSourceDataVO) {
|
|
|
+ //从Redis中获取选中ID的缓存
|
|
|
String id = cacheUtils.getSelectPatentIds(searchSourceDataVO.getPatentKey());
|
|
|
+ //为空报错
|
|
|
if (StringUtils.isEmpty(id)) {
|
|
|
return Response.error(ResponseEnum.QUERY_CACHE_ERROR);
|
|
|
}
|
|
|
+ //获取前端选择的条数范围(10,20,30,40,50,全部)
|
|
|
long end = searchSourceDataVO.getNum();
|
|
|
List<CustomAnalysisItemSource> list = new ArrayList<>();
|
|
|
+ //拆分出选中的IDList
|
|
|
List<Integer> patentIds = StringUtils.changeStringToInteger(id, ",");
|
|
|
+ //如果选中的数据类型是 树(6) 执行分支
|
|
|
if (searchSourceDataVO.getType().equals(6)) {
|
|
|
+ // TODO: 2022/9/26 树型数据 未解析逻辑 沈永艺
|
|
|
this.setTreeNodeCountDataForRedis(patentIds, searchSourceDataVO);
|
|
|
return Response.success(projectFieldTreeService.getProjectFieldTreeNodeByFieldId(searchSourceDataVO.getFieldId()));
|
|
|
}
|
|
|
+ //非树型
|
|
|
switch (searchSourceDataVO.getPtype()) {
|
|
|
+ //(部,大类,小类,大组,小组) (当前,标准,合并后) (国家,省,市)
|
|
|
case 1:
|
|
|
+ // TODO: 2022/9/26 处理条件 未解析逻辑 沈永艺
|
|
|
List<AnalysisItemResultDTO> resultList = this.setCommonDataCountDataForRedis(patentIds, searchSourceDataVO);
|
|
|
for (AnalysisItemResultDTO item : resultList) {
|
|
|
CustomAnalysisItemSource customAnalysisItemSource = new CustomAnalysisItemSource();
|
|
@@ -163,27 +175,45 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
list.add(customAnalysisItemSource);
|
|
|
}
|
|
|
break;
|
|
|
+ //年份(月,季度,半年,1年,2年,3年,5年)
|
|
|
case 2:
|
|
|
+ //获取PType为2的数据
|
|
|
List<ProjectFieldExpand> expandList = projectFieldService.getProjectFieldExpand().stream().filter(item -> item.getPtype().equals(searchSourceDataVO.getPtype())).collect(Collectors.toList());
|
|
|
+ //获取属性的名称
|
|
|
String dateType = expandList.stream().filter(item -> item.getId().equals(searchSourceDataVO.getExpandId())).findFirst().orElse(new ProjectFieldExpand()).getName();
|
|
|
+ //用名称获取偏移的数字 (注:这里的偏移均是指减去多少个月 例:2022-01-01 偏移-12 为 2021-01-01)
|
|
|
Integer offset = Constants.DATE_OFFSET.get(dateType);
|
|
|
+ //根据FieldId的不同获取选中IDList中的对应日期 fieldId说明: 25申请日 26公开日 27公开授权日
|
|
|
+ //1.获取最小的日期
|
|
|
Date endDate = patentService.getDateTime(id, searchSourceDataVO.getFieldId(), "min");
|
|
|
+ //2.获取最大的日期
|
|
|
Date startTime = patentService.getDateTime(id, searchSourceDataVO.getFieldId(), "max");
|
|
|
+ //创建偏移数据
|
|
|
Date endTime = DateUtil.offsetMonth(startTime, offset);
|
|
|
- Integer index = 0;
|
|
|
+ int index = 0;
|
|
|
+ /*
|
|
|
+ do while的判断规则: 1.当最大日期比最小日期小 && 2.循环次数超出所传入范围
|
|
|
+ */
|
|
|
do {
|
|
|
+ //装填数据
|
|
|
CustomAnalysisItemSource customAnalysisItemSource = new CustomAnalysisItemSource();
|
|
|
+ //依据偏移月数的不同 获取不同的对应数据
|
|
|
customAnalysisItemSource.setName(DateUtils.getDateSourceName(startTime, endTime, offset, index++));
|
|
|
customAnalysisItemSource.setStatus(null);
|
|
|
customAnalysisItemSource.setCreateTime(null);
|
|
|
customAnalysisItemSource.setUpdateTime(null);
|
|
|
+ //重设最大日期
|
|
|
startTime = DateUtil.offsetMonth(startTime, offset);
|
|
|
+ //重设偏移数据
|
|
|
endTime = DateUtil.offsetMonth(endTime, offset);
|
|
|
+ //向List中加入所需数据 用于返回前台展示
|
|
|
list.add(customAnalysisItemSource);
|
|
|
- } while (DateUtil.compare(startTime, endDate) > 0 && index < end);
|
|
|
+ } while (DateUtil.compare(DateUtil.offsetMonth(startTime, offset * -1), endDate) > 0 && index < end);
|
|
|
break;
|
|
|
+ //自定义
|
|
|
case 3:
|
|
|
case 4:
|
|
|
+ // TODO: 2022/9/26 自定义字段 未解析逻辑 沈永艺
|
|
|
list = this.getItemSourceList(searchSourceDataVO.getUid(), searchSourceDataVO.getDimension(), searchSourceDataVO.getFieldId(), searchSourceDataVO.getExpandId());
|
|
|
break;
|
|
|
}
|