|
|
@ -78,10 +78,11 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
private ProjectService projectService; |
|
|
|
@Autowired |
|
|
|
private IssueProjectCategoryDictService issueProjectCategoryDictService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 用户积分、党员分值数据中转站 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @Description 用户积分、党员分值数据中转站 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.09.25 09:53 |
|
|
|
**/ |
|
|
@ -141,9 +142,9 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 难点赌点数据中转站 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @Description 难点赌点数据中转站 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.09.25 10:00 |
|
|
|
**/ |
|
|
@ -209,6 +210,10 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
|
|
|
|
//立案后会有 一个process 如果没有则说明是垃圾数据 如果有其他方式立项的项目则需要考虑下兼容
|
|
|
|
difficulties.removeIf(diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); |
|
|
|
|
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(), difficulties, imgList); |
|
|
|
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(difficulties)); |
|
|
|
difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); |
|
|
|
imgList.forEach(item -> { |
|
|
|
item.setCustomerId(param.getCustomerId()); |
|
|
|
}); |
|
|
@ -218,7 +223,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { |
|
|
|
//TODO
|
|
|
|
//1.根据客户Id 获取所有项目数据
|
|
|
|
List<FactOriginProjectMainDailyEntity> difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param); |
|
|
|
if (CollectionUtils.isEmpty(difficultyBaseList)) { |
|
|
@ -245,48 +249,43 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
//项目分类数据 todo 暂时查询所有
|
|
|
|
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null); |
|
|
|
//key projectId:categoryCode Set
|
|
|
|
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream() |
|
|
|
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); |
|
|
|
Map<String, List<String>> projectCategoryMap = projectCategoryData.stream() |
|
|
|
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toList()))); |
|
|
|
|
|
|
|
//2.获取项目的所有节点耗时数据
|
|
|
|
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); |
|
|
|
Map<String,Integer> orgCountMap = new HashMap<>(); |
|
|
|
//处理部门数去重(只要流转到就算)
|
|
|
|
Map<String, Set<String>> orgCountMap = new HashMap<>(); |
|
|
|
//被处理次数
|
|
|
|
Map<String, Integer> handleCountMap = new HashMap<>(); |
|
|
|
projectPeriodList.forEach(period->{ |
|
|
|
Integer orgCount = orgCountMap.get(period.getProjectId()); |
|
|
|
if (orgCount == null){ |
|
|
|
orgCount = 0; |
|
|
|
}else{ |
|
|
|
++orgCount; |
|
|
|
} |
|
|
|
orgCountMap.put(period.getProjectId(),orgCount); |
|
|
|
Integer handleCount = handleCountMap.get(period.getProjectId()); |
|
|
|
if (handleCount == null){ |
|
|
|
handleCount = 0; |
|
|
|
}else{ |
|
|
|
++handleCount; |
|
|
|
} |
|
|
|
handleCountMap.put(period.getProjectId(),handleCount); |
|
|
|
}); |
|
|
|
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); |
|
|
|
|
|
|
|
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); |
|
|
|
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>(); |
|
|
|
for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { |
|
|
|
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { |
|
|
|
log.error("未获取到相关的项目信息或者项目的所属组织信息"); |
|
|
|
log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
//判断是否符合难点堵点条件
|
|
|
|
if (!valideProjectIdSet.contains(project.getId())) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); |
|
|
|
Integer regCount = orgCountMap.get(project.getId()); |
|
|
|
Set<String> regCount = orgCountMap.get(project.getId()); |
|
|
|
if (regCount != null) { |
|
|
|
diffEntity.setEventReOrg(regCount); |
|
|
|
diffEntity.setEventReOrg(regCount.size()); |
|
|
|
} else { |
|
|
|
diffEntity.setEventReOrg(0); |
|
|
|
} |
|
|
|
Integer handleOrgCount = handleCountMap.get(project.getId()); |
|
|
|
if (handleOrgCount != null) { |
|
|
|
diffEntity.setEventHandledCount(handleOrgCount); |
|
|
|
} else { |
|
|
|
diffEntity.setEventHandledCount(0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
diffEntity.setDataEndTime(param.getDateId()); |
|
|
|
diffEntity.setDataEndTime(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); |
|
|
|
setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); |
|
|
|
|
|
|
|
|
|
|
@ -296,34 +295,115 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
if (topicInfo != null) { |
|
|
|
diffEntity.setEventImgUrl(topicInfo.getTopicImgList().get(NumConstant.ZERO).getAttachmentUrl()); |
|
|
|
diffEntity.setEventContent(topicInfo.getTopicContent()); |
|
|
|
topicInfo.getTopicImgList().forEach(img -> { |
|
|
|
ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); |
|
|
|
imgData.setEventId(project.getId()); |
|
|
|
imgData.setEventImgUrl(img.getAttachmentUrl()); |
|
|
|
imgData.setSort(img.getSort()); |
|
|
|
imgDataEntities.add(imgData); |
|
|
|
}); |
|
|
|
log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
diffList.add(diffEntity); |
|
|
|
} |
|
|
|
List<ScreenDifficultyDataEntity> collect = diffList.stream().filter(o -> o.getEventCostTime() < 5 * 24 * 60).collect(Collectors.toList()); |
|
|
|
log.info("========:" + JSON.toJSONString(collect)); |
|
|
|
log.info("========:" + JSON.toJSONString(diffList)); |
|
|
|
log.info("========:" + JSON.toJSONString(imgDataEntities)); |
|
|
|
|
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); |
|
|
|
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); |
|
|
|
//3.获取项目的最后操作记录
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:筛选出符合条件的的项目(超过超期时间的为超期项目)和处理的部门数及处理次数 |
|
|
|
* @param param |
|
|
|
* @param projectPeriodList |
|
|
|
* @param orgCountMap |
|
|
|
* @param handleCountMap |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private Set<String> fillAnyCountAndValidProject(ScreenCentralZoneDataFormDTO param, List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList, Map<String, Set<String>> orgCountMap, Map<String, Integer> handleCountMap) { |
|
|
|
//已经结案的项目的结案时间
|
|
|
|
Set<String> valideProjectIdSet = new HashSet<>(); |
|
|
|
Map<String, Date> closeProjectDateMap = projectPeriodList.stream().filter(o -> ProjectConstant.CLOSE.equals(o.getOperation())) |
|
|
|
.collect(Collectors.toMap(FactOriginProjectOrgPeriodDailyEntity::getProjectId, FactOriginProjectOrgPeriodDailyEntity::getHandledDate, (o1, o2) -> o1)); |
|
|
|
//超期项目阈值
|
|
|
|
Integer overtimeConfig = projectService.getOvertimeProjectByParameter(param.getCustomerId()); |
|
|
|
projectPeriodList.forEach(period -> { |
|
|
|
Set<String> orgCount = orgCountMap.get(period.getProjectId()); |
|
|
|
if (orgCount == null) { |
|
|
|
orgCount = new HashSet<>(); |
|
|
|
} |
|
|
|
orgCount.add(period.getOrgId()); |
|
|
|
orgCountMap.put(period.getProjectId(), orgCount); |
|
|
|
if (ProjectConstant.RESOLVED.equals(period.getIsResolved())) { |
|
|
|
Integer handleCount = handleCountMap.getOrDefault(period.getProjectId(), 0); |
|
|
|
handleCountMap.put(period.getProjectId(), ++handleCount); |
|
|
|
} |
|
|
|
|
|
|
|
//筛选出 项目的结案时间 未结案的为当前时间(结案只有一条记录)
|
|
|
|
if (period.getHandledDate() != null) { |
|
|
|
if (period.getHandledDate().getTime() - period.getInformedDate().getTime() > overtimeConfig * 1000 * 60 * 60 * 24) { |
|
|
|
valideProjectIdSet.add(period.getProjectId()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
Date finishDate = closeProjectDateMap.getOrDefault(period.getProjectId(), new Date()); |
|
|
|
if (finishDate.getTime() - period.getInformedDate().getTime() > overtimeConfig * 1000 * 60 * 60 * 24) { |
|
|
|
valideProjectIdSet.add(period.getProjectId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//3.获取项目的最后操作记录
|
|
|
|
return false; |
|
|
|
}); |
|
|
|
return valideProjectIdSet; |
|
|
|
} |
|
|
|
|
|
|
|
private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, Set<String>> projectCategoryMap) { |
|
|
|
Set<String> categorySet = projectCategoryMap.get(projectId); |
|
|
|
/** |
|
|
|
* desc:设置项目类别 |
|
|
|
* @param diffEntity |
|
|
|
* @param projectId |
|
|
|
* @param categoryList |
|
|
|
* @param projectCategoryMap |
|
|
|
*/ |
|
|
|
private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, List<String>> projectCategoryMap) { |
|
|
|
List<String> categorySet = projectCategoryMap.get(projectId); |
|
|
|
if (CollectionUtils.isEmpty(categorySet)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
projectCategoryMap.forEach((k, v) -> { |
|
|
|
StringBuilder code = new StringBuilder(); |
|
|
|
StringBuilder name = new StringBuilder(); |
|
|
|
v.forEach(categoryCode -> { |
|
|
|
List<IssueProjectCategoryDictEntity> childCategory = new ArrayList<>(); |
|
|
|
v.forEach(categoryCode-> getParentNode(childCategory,categoryList,categoryCode)); |
|
|
|
String categoryCodes = childCategory.stream().map(IssueProjectCategoryDictEntity::getCategoryCode).sorted(Comparator.reverseOrder()).collect(Collectors.joining(StrConstant.COMMA)); |
|
|
|
String categoryNames = childCategory.stream().map(IssueProjectCategoryDictEntity::getCategoryName).sorted(Comparator.reverseOrder()).collect(Collectors.joining(StrConstant.COMMA)); |
|
|
|
diffEntity.setEventCategoryCode(categoryCodes); |
|
|
|
diffEntity.setEventCategoryName(categoryNames); |
|
|
|
getParentNode(childCategory, categoryList, categoryCode); |
|
|
|
String categoryCodes = childCategory.stream().map(IssueProjectCategoryDictEntity::getCategoryCode).collect(Collectors.joining(StrConstant.HYPHEN)); |
|
|
|
String categoryNames = childCategory.stream().map(IssueProjectCategoryDictEntity::getCategoryName).collect(Collectors.joining(StrConstant.HYPHEN)); |
|
|
|
|
|
|
|
code.append(categoryCodes).append(StrConstant.COMMA_ZH); |
|
|
|
name.append(categoryNames).append(StrConstant.COMMA_ZH); |
|
|
|
}); |
|
|
|
code.deleteCharAt(code.length() - NumConstant.ONE); |
|
|
|
name.deleteCharAt(name.length() - NumConstant.ONE); |
|
|
|
diffEntity.setEventCategoryCode(code.toString()); |
|
|
|
diffEntity.setEventCategoryName(name.toString()); |
|
|
|
log.info("code:{}",code.toString()); |
|
|
|
log.info("name:{}",name.toString()); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* desc:构建难点堵点基础数据 |
|
|
|
* @param project |
|
|
|
* @param agencyMap |
|
|
|
* @param gridMap |
|
|
|
* @param bizProjectInfoMap |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainDailyEntity project, Map<String, DimAgencyEntity> agencyMap, |
|
|
|
Map<String, GridInfoDTO> gridMap, Map<String, ProjectDTO> bizProjectInfoMap) { |
|
|
|
ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); |
|
|
@ -332,6 +412,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
//大屏的是逗号隔开的
|
|
|
|
String allPIds = project.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA); |
|
|
|
DimAgencyEntity agencyInfoDTO = agencyMap.get(project.getAgencyId()); |
|
|
|
diff.setEventTitle(projectDTO.getTitle()); |
|
|
|
if (StringUtils.isBlank(project.getGridId())) { |
|
|
|
diff.setOrgType("agency"); |
|
|
|
diff.setOrgId(project.getAgencyId()); |
|
|
@ -355,8 +436,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
GridInfoDTO gridInfoDTO = gridMap.get(project.getGridId()); |
|
|
|
diff.setOrgName(gridInfoDTO.getGridName()); |
|
|
|
String agencyAndGridName = agencyInfoDTO.getAgencyName().concat(StrConstant.HYPHEN.concat(diff.getOrgName())); |
|
|
|
//todo 市北区的 allParentname 为什么为空
|
|
|
|
//if (!project.getPid().equals(NumConstant.ZERO_STR)){
|
|
|
|
if (StringUtils.isNotBlank(agencyInfoDTO.getAllParentName())) { |
|
|
|
diff.setEventSource(agencyInfoDTO.getAllParentName().concat(StrConstant.HYPHEN).concat(agencyAndGridName)); |
|
|
|
} else { |
|
|
@ -367,6 +446,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
diff.setEventId(project.getId()); |
|
|
|
String projectStatus = project.getProjectStatus(); |
|
|
|
diff.setEventStatusCode(projectStatus); |
|
|
|
|
|
|
|
if (ProjectConstant.PENDING.equals(projectStatus)) { |
|
|
|
diff.setEventStatusDesc("处理中"); |
|
|
|
//项目耗时 当前时间-项目创建时间
|
|
|
@ -378,12 +458,12 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
} |
|
|
|
//暂时不放内容 用不到
|
|
|
|
diff.setLatestOperateDesc(""); |
|
|
|
|
|
|
|
return diff; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 递归查询父节点 |
|
|
|
* |
|
|
|
* @param childCategory |
|
|
|
* @param categoryList |
|
|
|
* @param categoryCode |
|
|
|