|
|
@ -100,10 +100,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
Map<String, BigDecimal> scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); |
|
|
|
|
|
|
|
//剔除垃圾数据
|
|
|
|
for(Iterator<ScreenPartyUserRankDataEntity> iter = registeredUsers.iterator(); |
|
|
|
iter.hasNext();){ |
|
|
|
if(null == gridMap.get(iter.next().getGridId())) iter.remove(); |
|
|
|
} |
|
|
|
registeredUsers.removeIf(user -> null == gridMap.get(user.getGridId())); |
|
|
|
|
|
|
|
//5.整合数据
|
|
|
|
if(!CollectionUtils.isEmpty(registeredUsers)){ |
|
|
@ -124,24 +121,8 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
|
|
|
|
user.setDataEndTime(finalDateId); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//6.存入数据库
|
|
|
|
//不按照时间删除,每次插入之前将该客户下的所有历史数据清空
|
|
|
|
//过滤 统计维度中没有的数据
|
|
|
|
Set<String> gridIdSet = new HashSet<>(); |
|
|
|
List<ScreenPartyUserRankDataEntity> newInsertList = registeredUsers.stream() |
|
|
|
.filter(o -> { |
|
|
|
if (StringUtils.isBlank(o.getGridName())) { |
|
|
|
gridIdSet.add(o.getGridId()); |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
return true; |
|
|
|
} |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
log.warn("userScoreDataHub grids:{} not in DimGrid", JSON.toJSONString(gridIdSet)); |
|
|
|
screenPartyUserRankDataService.dataClean(newInsertList, param.getCustomerId()); |
|
|
|
screenPartyUserRankDataService.dataClean(registeredUsers, param.getCustomerId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -153,57 +134,49 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { |
|
|
|
|
|
|
|
//查询难点赌点中有无已结案的项目,若有则保留
|
|
|
|
List<String> existed = screenDifficultyDataService.selectExistedInfo(param.getCustomerId()); |
|
|
|
|
|
|
|
//查询数据
|
|
|
|
List<ScreenDifficultyDataEntity> difficulties = factOriginProjectMainDailyService.getDifficultyBaseInfo(param.getCustomerId(),projectService.getOvertimeProjectByParameter(param.getCustomerId(),existed)); |
|
|
|
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)); |
|
|
|
List<String> missing = new LinkedList<>(); |
|
|
|
for(Iterator<ScreenDifficultyDataEntity> iter = difficulties.iterator(); iter.hasNext();){ |
|
|
|
ScreenDifficultyDataEntity pointer = iter.next(); |
|
|
|
if(null == gridMap.get(pointer.getOrgId())){ |
|
|
|
missing.add(pointer.getEventId()); |
|
|
|
iter.remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//剔除垃圾数据(本次需要更新的数据集)
|
|
|
|
//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()); |
|
|
|
|
|
|
|
boolean isOperationNull = CollectionUtils.isEmpty(latestOperationMap) ? true : false; |
|
|
|
|
|
|
|
//图片
|
|
|
|
List<ProjectSourceMapFormDTO> projectSourceMap = factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); |
|
|
|
|
|
|
|
Map<String,List<ScreenDifficultyImgDataEntity>> imgMap = |
|
|
|
topicService.getTopicImgs(projectSourceMap); |
|
|
|
boolean isImgNull = CollectionUtils.isEmpty(imgMap) ? true : false; |
|
|
|
|
|
|
|
Map<String,String> contentMap = topicService.getTopicContent(projectSourceMap); |
|
|
|
boolean isContentNull = CollectionUtils.isEmpty(contentMap) ? true : false; |
|
|
|
|
|
|
|
difficulties.forEach( diff -> { |
|
|
|
if(!isImgNull) { |
|
|
|
if(!CollectionUtils.isEmpty(imgMap)) { |
|
|
|
List<ScreenDifficultyImgDataEntity> figureList = imgMap.get(diff.getEventId()); |
|
|
|
diff.setEventImgUrl(CollectionUtils.isEmpty(figureList) ? "" : figureList.get(NumConstant.ZERO).getEventImgUrl()); |
|
|
|
} |
|
|
|
if(!isContentNull) { |
|
|
|
if(!CollectionUtils.isEmpty(contentMap)) { |
|
|
|
diff.setEventContent(contentMap.get(diff.getEventId())); |
|
|
|
} |
|
|
|
if(!isOperationNull){ |
|
|
|
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)); |
|
|
@ -211,6 +184,6 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr |
|
|
|
List<ScreenDifficultyImgDataEntity> imgList = new LinkedList<>(); |
|
|
|
imgMap.values().forEach(list -> {imgList.addAll(list);}); |
|
|
|
|
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList,missing); |
|
|
|
screenDifficultyDataService.dataClean(param.getCustomerId(),difficulties,imgList); |
|
|
|
} |
|
|
|
} |
|
|
|