|
|
@ -4,13 +4,22 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.dto.ProjectCategoryDTO; |
|
|
|
import com.epmet.dto.ProjectDTO; |
|
|
|
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.topic.result.ResiTopicAndImgResultDTO; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyImgDataEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; |
|
|
|
import com.epmet.entity.issue.IssueProjectCategoryDictEntity; |
|
|
|
import com.epmet.entity.stats.DimAgencyEntity; |
|
|
|
import com.epmet.service.Issue.IssueProjectCategoryDictService; |
|
|
|
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; |
|
|
|
import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService; |
|
|
@ -20,6 +29,7 @@ import com.epmet.service.org.CustomerGridService; |
|
|
|
import com.epmet.service.point.UserPointService; |
|
|
|
import com.epmet.service.project.ProjectProcessService; |
|
|
|
import com.epmet.service.project.ProjectService; |
|
|
|
import com.epmet.service.stats.DimAgencyService; |
|
|
|
import com.epmet.service.topic.TopicService; |
|
|
|
import com.epmet.service.user.UserService; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -49,6 +59,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
@Autowired |
|
|
|
private CustomerGridService customerGridService; |
|
|
|
@Autowired |
|
|
|
private DimAgencyService dimAgencyService; |
|
|
|
@Autowired |
|
|
|
private UserPointService userPointService; |
|
|
|
@Autowired |
|
|
|
private CpcIndexCalculateService cpcIndexCalculateService; |
|
|
@ -64,10 +76,13 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
private TopicService topicService; |
|
|
|
@Autowired |
|
|
|
private ProjectService projectService; |
|
|
|
@Autowired |
|
|
|
private IssueProjectCategoryDictService issueProjectCategoryDictService; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 用户积分、党员分值数据中转站 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
* @Description 用户积分、党员分值数据中转站 |
|
|
|
* @author wangc |
|
|
|
* @date 2020.09.25 09:53 |
|
|
|
**/ |
|
|
@ -79,16 +94,16 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
//2.查询出客户下网格的相关信息
|
|
|
|
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId()); |
|
|
|
// list 转 map,以gridId为key,a = gridList,作为value,(o,n)->o 是遇到相同的gridId舍弃,(o,n)->n 是覆盖原来的gridId
|
|
|
|
Map<String,GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO :: getGridId,a -> a,(o, n) -> o)); |
|
|
|
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); |
|
|
|
|
|
|
|
//3.查询出客户下用户的累计积分(累计值,没有时间概念,否则需要查询积分明细计算出评价周期末的得分)
|
|
|
|
Map<String,Integer> pointMap = userPointService.getUserPointMap(param.getCustomerId()); |
|
|
|
Map<String, Integer> pointMap = userPointService.getUserPointMap(param.getCustomerId()); |
|
|
|
//4.查询出客户下党员的分值
|
|
|
|
String dateId = param.getDateId(); |
|
|
|
if(StringUtils.isEmpty(dateId)){ |
|
|
|
if (StringUtils.isEmpty(dateId)) { |
|
|
|
//如果没有传月份,则使用当前时间的上一个月
|
|
|
|
dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
String dateType = DateUtils.identifyTimeDimension(dateId); |
|
|
|
if (StringUtils.isEmpty(dateType) || !StringUtils.equalsAny(dateType, "date", "month")) { |
|
|
|
dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); |
|
|
@ -98,21 +113,21 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
} |
|
|
|
final String finalDateId = dateId; |
|
|
|
// 查询党员积分
|
|
|
|
Map<String, BigDecimal> scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); |
|
|
|
Map<String, BigDecimal> scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(), dateId); |
|
|
|
|
|
|
|
//剔除垃圾数据
|
|
|
|
registeredUsers.removeIf(user -> null == gridMap.get(user.getGridId())); |
|
|
|
|
|
|
|
//5.整合数据
|
|
|
|
if(!CollectionUtils.isEmpty(registeredUsers)){ |
|
|
|
if (!CollectionUtils.isEmpty(registeredUsers)) { |
|
|
|
registeredUsers.forEach(user -> { |
|
|
|
GridInfoDTO gridInfo = gridMap.get(user.getGridId()); |
|
|
|
if(null != gridInfo){ |
|
|
|
if (null != gridInfo) { |
|
|
|
user.setGridName(gridInfo.getGridName()); |
|
|
|
user.setOrgId(gridInfo.getAgencyId()); |
|
|
|
user.setOrgName(gridInfo.getOrgName()); |
|
|
|
//原始数据Pid使用英文:隔开,大屏数据要求按照英文,隔开
|
|
|
|
user.setAllParentIds(gridInfo.getPids().replaceAll(StrConstant.COLON,StrConstant.COMMA)); |
|
|
|
user.setAllParentIds(gridInfo.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA)); |
|
|
|
} |
|
|
|
Integer point = pointMap.get(user.getUserId()); |
|
|
|
BigDecimal score = scoreMap.get(user.getUserId()); |
|
|
@ -127,21 +142,23 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 难点赌点数据中转站 |
|
|
|
* @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; |
|
|
|
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)); |
|
|
|
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, a -> a, (o, n) -> o)); |
|
|
|
|
|
|
|
//剔除垃圾数据(本次需要更新的数据集)
|
|
|
|
//for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){
|
|
|
@ -150,33 +167,36 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
// iter.remove();
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
difficulties.removeIf( diff -> null == gridMap.get(diff.getOrgId())); |
|
|
|
difficulties.removeIf(diff -> null == gridMap.get(diff.getOrgId())); |
|
|
|
|
|
|
|
List<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity :: getEventId).distinct().collect(Collectors.toList()); |
|
|
|
List<String> projectIds = difficulties.stream().map(ScreenDifficultyDataEntity::getEventId).distinct().collect(Collectors.toList()); |
|
|
|
//最近一次操作
|
|
|
|
Map<String, ProjectLatestOperationResultDTO> latestOperationMap = projectProcessService.getLatestOperation(projectIds,param.getCustomerId()); |
|
|
|
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; |
|
|
|
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, List<ScreenDifficultyImgDataEntity>> imgMap = topicService.getTopicImgs(projectSourceMap); |
|
|
|
|
|
|
|
Map<String,String> contentMap = topicService.getTopicContent(projectSourceMap); |
|
|
|
Map<String, String> contentMap = topicService.getTopicContent(projectSourceMap); |
|
|
|
|
|
|
|
difficulties.forEach( diff -> { |
|
|
|
difficulties.forEach(diff -> { |
|
|
|
|
|
|
|
List<ScreenDifficultyImgDataEntity> figureList = CollectionUtils.isEmpty(imgMap) ? null : imgMap.get(diff.getEventId()); |
|
|
|
diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); |
|
|
|
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)) { |
|
|
|
if (!CollectionUtils.isEmpty(contentMap)) { |
|
|
|
diff.setEventContent(contentMap.get(diff.getEventId())); |
|
|
|
} |
|
|
|
if(! CollectionUtils.isEmpty(latestOperationMap)){ |
|
|
|
if (!CollectionUtils.isEmpty(latestOperationMap)) { |
|
|
|
ProjectLatestOperationResultDTO oper = latestOperationMap.get(diff.getEventId()); |
|
|
|
if(null != oper){ |
|
|
|
if (null != oper) { |
|
|
|
diff.setLatestOperateDesc(oper.getOperationName()); |
|
|
|
diff.setEventTitle(oper.getTitle()); |
|
|
|
diff.setEventCostTime(oper.getCostTime()); |
|
|
@ -196,4 +216,261 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); |
|
|
|
log.info("【大屏数据抽取-难点赌点执行完毕】 客户Id{} 难点赌点数据{}",param.getCustomerId(),JSON.toJSONString(difficulties)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
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); |
|
|
|
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维度
|
|
|
|
List<DimAgencyEntity> agencyList = dimAgencyService.getAgencyListByCustomerId(param.getCustomerId()); |
|
|
|
Map<String, DimAgencyEntity> agencyMap = agencyList.stream().collect(Collectors.toMap(DimAgencyEntity::getId, o -> o, (o1, o2) -> o1)); |
|
|
|
//获取grid维度
|
|
|
|
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId()); |
|
|
|
Map<String, GridInfoDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO::getGridId, o -> o, (o1, o2) -> o1)); |
|
|
|
|
|
|
|
//获取客户下所有项目分类
|
|
|
|
List<IssueProjectCategoryDictEntity> categoryList = issueProjectCategoryDictService.getAllByCId(param.getCustomerId()); |
|
|
|
|
|
|
|
//项目分类数据 todo 暂时查询所有
|
|
|
|
List<ProjectCategoryDTO> projectCategoryData = projectService.getProjectCategoryData(param.getCustomerId(), null); |
|
|
|
//key projectId:categoryCode Set
|
|
|
|
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, Set<String>> orgCountMap = new HashMap<>(); |
|
|
|
//被处理次数
|
|
|
|
Map<String, Integer> handleCountMap = new HashMap<>(); |
|
|
|
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.warn("未获取到相关的项目信息或者项目的所属组织信息,agencyId:{},projectId:{}",project.getAgencyId(),project.getId()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
//判断是否符合难点堵点条件
|
|
|
|
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) { |
|
|
|
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); |
|
|
|
imgData.setCustomerId(param.getCustomerId()); |
|
|
|
}); |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
return valideProjectIdSet; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 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<>(); |
|
|
|
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()); |
|
|
|
ScreenDifficultyDataEntity diff = new ScreenDifficultyDataEntity(); |
|
|
|
diff.setCustomerId(project.getCustomerId()); |
|
|
|
//大屏的是逗号隔开的
|
|
|
|
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()); |
|
|
|
diff.setParentId(project.getPid()); |
|
|
|
diff.setAllParentIds(allPIds.replace(StrConstant.COMMA + project.getAgencyId(), StrConstant.EPMETY_STR)); |
|
|
|
diff.setOrgName(agencyInfoDTO.getAgencyName()); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(agencyInfoDTO.getAllParentName())) { |
|
|
|
diff.setEventSource(agencyInfoDTO.getAllParentName().concat(StrConstant.HYPHEN.concat(diff.getOrgName()))); |
|
|
|
} else { |
|
|
|
diff.setEventSource(agencyInfoDTO.getAgencyName()); |
|
|
|
} |
|
|
|
//如果是组织的则 设置背景为内容
|
|
|
|
diff.setEventContent(projectDTO.getBackGround()); |
|
|
|
} else { |
|
|
|
diff.setOrgType("grid"); |
|
|
|
diff.setOrgId(project.getGridId()); |
|
|
|
diff.setParentId(project.getAgencyId()); |
|
|
|
//所有上级id 即包含agencyId在内的所有pids
|
|
|
|
diff.setAllParentIds(allPIds); |
|
|
|
GridInfoDTO gridInfoDTO = gridMap.get(project.getGridId()); |
|
|
|
diff.setOrgName(gridInfoDTO.getGridName()); |
|
|
|
String agencyAndGridName = agencyInfoDTO.getAgencyName().concat(StrConstant.HYPHEN.concat(diff.getOrgName())); |
|
|
|
if (StringUtils.isNotBlank(agencyInfoDTO.getAllParentName())) { |
|
|
|
diff.setEventSource(agencyInfoDTO.getAllParentName().concat(StrConstant.HYPHEN).concat(agencyAndGridName)); |
|
|
|
} else { |
|
|
|
diff.setEventSource(agencyAndGridName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
diff.setEventId(project.getId()); |
|
|
|
String projectStatus = project.getProjectStatus(); |
|
|
|
diff.setEventStatusCode(projectStatus); |
|
|
|
|
|
|
|
if (ProjectConstant.PENDING.equals(projectStatus)) { |
|
|
|
diff.setEventStatusDesc("处理中"); |
|
|
|
//项目耗时 当前时间-项目创建时间
|
|
|
|
diff.setEventCostTime((int) ((System.currentTimeMillis() - projectDTO.getCreatedTime().getTime()) / 1000 / 60)); |
|
|
|
} else { |
|
|
|
diff.setEventStatusDesc("已结案"); |
|
|
|
//项目耗时 更新时间-项目创建时间
|
|
|
|
diff.setEventCostTime((int) ((projectDTO.getUpdatedTime().getTime() - projectDTO.getCreatedTime().getTime()) / 1000 / 60)); |
|
|
|
} |
|
|
|
//暂时不放内容 用不到
|
|
|
|
diff.setLatestOperateDesc(""); |
|
|
|
return diff; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 递归查询父节点 |
|
|
|
* |
|
|
|
* @param childCategory |
|
|
|
* @param categoryList |
|
|
|
* @param categoryCode |
|
|
|
*/ |
|
|
|
private void getParentNode(List<IssueProjectCategoryDictEntity> childCategory, List<IssueProjectCategoryDictEntity> categoryList, String categoryCode) { |
|
|
|
categoryList.stream() |
|
|
|
.filter(item -> Objects.nonNull(categoryCode) && Objects.equals(categoryCode, item.getCategoryCode())) |
|
|
|
.forEach(menu -> { |
|
|
|
getParentNode(childCategory, categoryList, menu.getParentCategoryCode()); |
|
|
|
childCategory.add(menu); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|