|
@ -8,12 +8,10 @@ import com.epmet.constant.ProjectConstant; |
|
|
import com.epmet.dto.ProjectCategoryDTO; |
|
|
import com.epmet.dto.ProjectCategoryDTO; |
|
|
import com.epmet.dto.ProjectDTO; |
|
|
import com.epmet.dto.ProjectDTO; |
|
|
import com.epmet.dto.org.GridInfoDTO; |
|
|
import com.epmet.dto.org.GridInfoDTO; |
|
|
import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; |
|
|
|
|
|
import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; |
|
|
|
|
|
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; |
|
|
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; |
|
|
import com.epmet.dto.topic.TopicAttachmentDTO; |
|
|
import com.epmet.dto.topic.TopicAttachmentDTO; |
|
|
import com.epmet.dto.topic.result.ResiTopicAndImgResultDTO; |
|
|
import com.epmet.dto.topic.result.ResiTopicAndImgResultDTO; |
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; |
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainAndPeriodDTO; |
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; |
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; |
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; |
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; |
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; |
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; |
|
@ -155,101 +153,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); |
|
|
screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param param |
|
|
|
|
|
* @return |
|
|
|
|
|
* @Description 难点赌点数据中转站 |
|
|
|
|
|
* @author wangc |
|
|
|
|
|
* @date 2020.09.25 10:00 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { |
|
|
|
|
|
//查询数据
|
|
|
|
|
|
List<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(), projectService.getOvertimeProjectByParameter(param.getCustomerId())); |
|
|
|
|
|
if (CollectionUtils.isEmpty(difficulties)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//2.查询出客户下网格的相关信息
|
|
|
|
|
|
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId()); |
|
|
|
|
|
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); |
|
|
|
|
|
|
|
|
|
|
|
//剔除垃圾数据(本次需要更新的数据集)
|
|
|
|
|
|
//for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){
|
|
|
|
|
|
// ScreenDifficultyDataEntity pointer = iter.next();
|
|
|
|
|
|
// if(null == gridMap.get(pointer.getOrgId())){
|
|
|
|
|
|
// iter.remove();
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
difficulties.removeIf(diff -> null == gridMap.get(diff.getOrgId())); |
|
|
|
|
|
|
|
|
|
|
|
List<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
//最近一次操作
|
|
|
|
|
|
Map<String, ProjectLatestOperationResultDTO> latestOperationMap = projectProcessService.getLatestOperation(projectIds, param.getCustomerId()); |
|
|
|
|
|
//图片
|
|
|
|
|
|
List<ProjectSourceMapFormDTO> projectSourceMap = difficulties.stream().map(diff -> { |
|
|
|
|
|
ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO(); |
|
|
|
|
|
map.setProjectId(diff.getEventId()); |
|
|
|
|
|
map.setSourceId(diff.getEventImgUrl()); |
|
|
|
|
|
return map; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
//factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<ScreenDifficultyImgDataEntity>> imgMap = topicService.getTopicImgs(projectSourceMap); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> contentMap = topicService.getTopicContent(projectSourceMap); |
|
|
|
|
|
|
|
|
|
|
|
difficulties.forEach(diff -> { |
|
|
|
|
|
|
|
|
|
|
|
List<ScreenDifficultyImgDataEntity> figureList = CollectionUtils.isEmpty(imgMap) ? null : imgMap.get(diff.getEventId()); |
|
|
|
|
|
diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(contentMap)) { |
|
|
|
|
|
diff.setEventContent(contentMap.get(diff.getEventId())); |
|
|
|
|
|
} |
|
|
|
|
|
if (!CollectionUtils.isEmpty(latestOperationMap)) { |
|
|
|
|
|
ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); |
|
|
|
|
|
if (null != oper) { |
|
|
|
|
|
diff.setLatestOperateDesc(oper.getOperationName()); |
|
|
|
|
|
diff.setEventTitle(oper.getTitle()); |
|
|
|
|
|
diff.setEventCostTime(oper.getCostTime()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); |
|
|
|
|
|
}); |
|
|
|
|
|
List<ScreenDifficultyImgDataEntity> imgList = new LinkedList<>(); |
|
|
|
|
|
imgMap.values().forEach(imgList::addAll); |
|
|
|
|
|
|
|
|
|
|
|
//立案后会有 一个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()); |
|
|
|
|
|
}); |
|
|
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); |
|
|
|
|
|
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { |
|
|
public boolean difficultyDataExtract(ScreenCentralZoneDataFormDTO param) { |
|
|
//1.根据客户Id 获取所有项目数据
|
|
|
|
|
|
List<FactOriginProjectMainDailyEntity> difficultyBaseList = factOriginProjectMainDailyService.getProjectForDiff(param); |
|
|
|
|
|
if (CollectionUtils.isEmpty(difficultyBaseList)) { |
|
|
|
|
|
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
//获取业务库项目标题
|
|
|
|
|
|
List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); |
|
|
|
|
|
if (CollectionUtils.isEmpty(bizProjectInfoList)) { |
|
|
|
|
|
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
//获取agency维度
|
|
|
//获取agency维度
|
|
|
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); |
|
|
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); |
|
|
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); |
|
@ -266,74 +171,97 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream() |
|
|
Map<String, Set<String>> projectCategoryMap = projectCategoryData.stream() |
|
|
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); |
|
|
.collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId, Collectors.mapping(ProjectCategoryDTO::getCategoryCode, Collectors.toSet()))); |
|
|
|
|
|
|
|
|
//2.获取项目的所有节点耗时数据
|
|
|
//获取业务库项目标题
|
|
|
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); |
|
|
List<ProjectDTO> bizProjectInfoList = projectService.getProjectInfo(param.getCustomerId(), null, null); |
|
|
//处理部门数去重(只要流转到就算)
|
|
|
if (CollectionUtils.isEmpty(bizProjectInfoList)) { |
|
|
Map<String, Set<String>> orgCountMap = new HashMap<>(); |
|
|
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); |
|
|
//被处理次数
|
|
|
return false; |
|
|
Map<String, Integer> handleCountMap = new HashMap<>(); |
|
|
} |
|
|
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); |
|
|
Map<String, ProjectDTO> bizProjectInfoMap = bizProjectInfoList.stream().collect(Collectors.toMap(ProjectDTO::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
|
|
|
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); |
|
|
int pageNo = NumConstant.ONE; |
|
|
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>(); |
|
|
int pageSize = NumConstant.FIVE_HUNDRED; |
|
|
for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { |
|
|
List<FactOriginProjectMainAndPeriodDTO> difficultyBaseList; |
|
|
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { |
|
|
do { |
|
|
log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); |
|
|
//1.根据客户Id 获取所有项目数据
|
|
|
continue; |
|
|
int offset = (pageNo++ - NumConstant.ONE) * pageSize; |
|
|
} |
|
|
difficultyBaseList = factOriginProjectMainDailyService.getProjectAndPeriodForDiff(param, offset,pageSize); |
|
|
//判断是否符合难点堵点条件
|
|
|
if (CollectionUtils.isEmpty(difficultyBaseList)) { |
|
|
if (!valideProjectIdSet.contains(project.getId())) { |
|
|
log.warn("difficultyDataExtract customerId:{} have any project", param.getCustomerId()); |
|
|
continue; |
|
|
return false; |
|
|
} |
|
|
|
|
|
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); |
|
|
|
|
|
Set<String> regCount = orgCountMap.get(project.getId()); |
|
|
|
|
|
if (regCount != null) { |
|
|
|
|
|
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(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); |
|
|
//2.获取项目的所有节点耗时数据
|
|
|
setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); |
|
|
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = difficultyBaseList.stream() |
|
|
|
|
|
.filter(o->o.getPeriodList() != null) |
|
|
|
|
|
.flatMap(o->o.getPeriodList().stream()) |
|
|
if (StringUtils.isNotBlank(project.getTopicId())) { |
|
|
.collect(Collectors.toList()); |
|
|
//获取图片及话题内容
|
|
|
//处理部门数去重(只要流转到就算)
|
|
|
ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); |
|
|
Map<String, Set<String>> orgCountMap = new HashMap<>(); |
|
|
if (topicInfo != null) { |
|
|
//被处理次数
|
|
|
List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList(); |
|
|
Map<String, Integer> handleCountMap = new HashMap<>(); |
|
|
if (!CollectionUtils.isEmpty(topicImgList)){ |
|
|
Set<String> valideProjectIdSet = fillAnyCountAndValidProject(param, projectPeriodList, orgCountMap, handleCountMap); |
|
|
diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); |
|
|
|
|
|
topicImgList.forEach(img -> { |
|
|
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); |
|
|
ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); |
|
|
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>(); |
|
|
imgData.setEventId(project.getId()); |
|
|
for (FactOriginProjectMainAndPeriodDTO project : difficultyBaseList) { |
|
|
imgData.setEventImgUrl(img.getAttachmentUrl()); |
|
|
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { |
|
|
imgData.setSort(img.getSort()); |
|
|
log.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); |
|
|
imgDataEntities.add(imgData); |
|
|
continue; |
|
|
imgData.setCustomerId(param.getCustomerId()); |
|
|
} |
|
|
}); |
|
|
//判断是否符合难点堵点条件
|
|
|
|
|
|
if (!valideProjectIdSet.contains(project.getId())) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); |
|
|
|
|
|
Set<String> regCount = orgCountMap.get(project.getId()); |
|
|
|
|
|
if (regCount != null) { |
|
|
|
|
|
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(StringUtils.isBlank(param.getDateId())?DateUtils.getBeforeNDay(NumConstant.ONE):param.getDateId()); |
|
|
|
|
|
setCategoryInfo(diffEntity, project.getId(), categoryList, projectCategoryMap); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(project.getTopicId())) { |
|
|
|
|
|
//获取图片及话题内容
|
|
|
|
|
|
ResiTopicAndImgResultDTO topicInfo = topicService.getTopicAndImgs(project.getTopicId(), "image"); |
|
|
|
|
|
if (topicInfo != null) { |
|
|
|
|
|
List<TopicAttachmentDTO> topicImgList = topicInfo.getTopicImgList(); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(topicImgList)){ |
|
|
|
|
|
diffEntity.setEventImgUrl(topicImgList.get(NumConstant.ZERO).getAttachmentUrl()); |
|
|
|
|
|
topicImgList.forEach(img -> { |
|
|
|
|
|
ScreenDifficultyImgDataEntity imgData = new ScreenDifficultyImgDataEntity(); |
|
|
|
|
|
imgData.setEventId(project.getId()); |
|
|
|
|
|
imgData.setEventImgUrl(img.getAttachmentUrl()); |
|
|
|
|
|
imgData.setSort(img.getSort()); |
|
|
|
|
|
imgDataEntities.add(imgData); |
|
|
|
|
|
imgData.setCustomerId(param.getCustomerId()); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
diffEntity.setEventContent(topicInfo.getTopicContent()); |
|
|
|
|
|
|
|
|
|
|
|
log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); |
|
|
} |
|
|
} |
|
|
diffEntity.setEventContent(topicInfo.getTopicContent()); |
|
|
|
|
|
|
|
|
|
|
|
log.info("projectId:{} imgs:{}", project.getId(), imgDataEntities.stream().filter(o -> o.getEventId().equals(project.getId())).count()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
diffList.add(diffEntity); |
|
|
} |
|
|
} |
|
|
diffList.add(diffEntity); |
|
|
log.info("========:" + JSON.toJSONString(diffList)); |
|
|
} |
|
|
log.info("========:" + JSON.toJSONString(imgDataEntities)); |
|
|
List<ScreenDifficultyDataEntity> collect = diffList.stream().filter(o -> o.getEventCostTime() < 5 * 24 * 60).collect(Collectors.toList()); |
|
|
|
|
|
log.info("========:" + JSON.toJSONString(collect)); |
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); |
|
|
log.info("========:" + JSON.toJSONString(diffList)); |
|
|
} while (!CollectionUtils.isEmpty(difficultyBaseList)&&difficultyBaseList.size()==pageSize); |
|
|
log.info("========:" + JSON.toJSONString(imgDataEntities)); |
|
|
|
|
|
|
|
|
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),diffList,imgDataEntities); |
|
|
//log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList));
|
|
|
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}", param.getCustomerId(), JSON.toJSONString(diffList)); |
|
|
|
|
|
//3.获取项目的最后操作记录
|
|
|
//3.获取项目的最后操作记录
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
@ -422,7 +350,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
* @param bizProjectInfoMap |
|
|
* @param bizProjectInfoMap |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainDailyEntity project, Map<String, DimAgencyEntity> agencyMap, |
|
|
private ScreenDifficultyDataEntity buildBaseDiffEntity(FactOriginProjectMainAndPeriodDTO project, Map<String, DimAgencyEntity> agencyMap, |
|
|
Map<String, GridInfoDTO> gridMap, Map<String, ProjectDTO> bizProjectInfoMap) { |
|
|
Map<String, GridInfoDTO> gridMap, Map<String, ProjectDTO> bizProjectInfoMap) { |
|
|
ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); |
|
|
ProjectDTO projectDTO = bizProjectInfoMap.get(project.getId()); |
|
|
ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); |
|
|
ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); |
|
|