Browse Source

难点堵点代码暂存-基本没问题了;还需要调整项目分类

dev_shibei_match
jianjun 5 years ago
parent
commit
2f5efbca71
  1. 83
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  3. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

83
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -78,10 +78,11 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
private ProjectService projectService; private ProjectService projectService;
@Autowired @Autowired
private IssueProjectCategoryDictService issueProjectCategoryDictService; private IssueProjectCategoryDictService issueProjectCategoryDictService;
/** /**
* @Description 用户积分党员分值数据中转站
* @param param * @param param
* @return * @return
* @Description 用户积分党员分值数据中转站
* @author wangc * @author wangc
* @date 2020.09.25 09:53 * @date 2020.09.25 09:53
**/ **/
@ -141,9 +142,9 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
} }
/** /**
* @Description 难点赌点数据中转站
* @param param * @param param
* @return * @return
* @Description 难点赌点数据中转站
* @author wangc * @author wangc
* @date 2020.09.25 10:00 * @date 2020.09.25 10:00
**/ **/
@ -248,39 +249,69 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
//2.获取项目的所有节点耗时数据 //2.获取项目的所有节点耗时数据
List<FactOriginProjectOrgPeriodDailyEntity> projectPeriodList = factOriginProjectMainDailyService.getProjectPeriod(param); 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<>(); Map<String, Integer> handleCountMap = new HashMap<>();
//已经结案的项目的结案时间
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());
Map<String, Date> informDate = new HashMap<>();
projectPeriodList.forEach(period -> { projectPeriodList.forEach(period -> {
Integer orgCount = orgCountMap.get(period.getProjectId()); Set<String> orgCount = orgCountMap.get(period.getProjectId());
if (orgCount == null) { if (orgCount == null) {
orgCount = 0; orgCount = new HashSet<>();
}else{
++orgCount;
} }
orgCount.add(period.getOrgId());
orgCountMap.put(period.getProjectId(), orgCount); orgCountMap.put(period.getProjectId(), orgCount);
Integer handleCount = handleCountMap.get(period.getProjectId()); if (ProjectConstant.RESOLVED.equals(period.getIsResolved())) {
if (handleCount == null){ Integer handleCount = handleCountMap.getOrDefault(period.getProjectId(), 0);
handleCount = 0; handleCountMap.put(period.getProjectId(), ++handleCount);
}
if ("82ac5292612538eaf5c598005b7910ba".equals(period.getProjectId())) {
System.out.println("项目结案时间" + closeProjectDateMap.get(period.getProjectId()));
}
//筛选出 项目的结案时间 未结案的为当前时间(结案只有一条记录)
if (period.getHandledDate() != null) {
if (period.getHandledDate().getTime() - period.getInformedDate().getTime() > overtimeConfig * 1000 * 60 * 60 * 24) {
valideProjectIdSet.add(period.getProjectId());
}
} else { } else {
++handleCount; Date finishDate = closeProjectDateMap.getOrDefault(period.getProjectId(), new Date());
if (finishDate.getTime() - period.getInformedDate().getTime() > overtimeConfig * 1000 * 60 * 60 * 24) {
valideProjectIdSet.add(period.getProjectId());
} }
handleCountMap.put(period.getProjectId(),handleCount); }
}); });
List<ScreenDifficultyDataEntity> diffList = new ArrayList<>(); List<ScreenDifficultyDataEntity> diffList = new ArrayList<>();
List<ScreenDifficultyImgDataEntity> imgDataEntities = new ArrayList<>();
for (FactOriginProjectMainDailyEntity project : difficultyBaseList) { for (FactOriginProjectMainDailyEntity project : difficultyBaseList) {
if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) { if (agencyMap.get(project.getAgencyId()) == null || bizProjectInfoMap.get(project.getId()) == null) {
log.error("未获取到相关的项目信息或者项目的所属组织信息"); log.error("未获取到相关的项目信息或者项目的所属组织信息");
continue; continue;
} }
//判断是否符合难点堵点条件
if (!valideProjectIdSet.contains(project.getId())) {
continue;
}
ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap); ScreenDifficultyDataEntity diffEntity = buildBaseDiffEntity(project, agencyMap, gridMap, bizProjectInfoMap);
Integer regCount = orgCountMap.get(project.getId()); Set<String> regCount = orgCountMap.get(project.getId());
if (regCount != null) { if (regCount != null) {
diffEntity.setEventReOrg(regCount); diffEntity.setEventReOrg(regCount.size());
} else {
diffEntity.setEventReOrg(0);
} }
Integer handleOrgCount = handleCountMap.get(project.getId()); Integer handleOrgCount = handleCountMap.get(project.getId());
if (handleOrgCount != null) { if (handleOrgCount != null) {
diffEntity.setEventHandledCount(handleOrgCount); diffEntity.setEventHandledCount(handleOrgCount);
} else {
diffEntity.setEventHandledCount(0);
} }
@ -294,16 +325,29 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
if (topicInfo != null) { if (topicInfo != null) {
diffEntity.setEventImgUrl(topicInfo.getTopicImgList().get(NumConstant.ZERO).getAttachmentUrl()); diffEntity.setEventImgUrl(topicInfo.getTopicImgList().get(NumConstant.ZERO).getAttachmentUrl());
diffEntity.setEventContent(topicInfo.getTopicContent()); 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); diffList.add(diffEntity);
log.info("========:"+JSON.toJSONString(diffList));
} }
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.获取项目的最后操作记录 //3.获取项目的最后操作记录
return false; return true;
} }
private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, Set<String>> projectCategoryMap) { private void setCategoryInfo(ScreenDifficultyDataEntity diffEntity, String projectId, List<IssueProjectCategoryDictEntity> categoryList, Map<String, Set<String>> projectCategoryMap) {
@ -330,6 +374,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
//大屏的是逗号隔开的 //大屏的是逗号隔开的
String allPIds = project.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA); String allPIds = project.getPids().replaceAll(StrConstant.COLON, StrConstant.COMMA);
DimAgencyEntity agencyInfoDTO = agencyMap.get(project.getAgencyId()); DimAgencyEntity agencyInfoDTO = agencyMap.get(project.getAgencyId());
diff.setEventTitle(projectDTO.getTitle());
if (StringUtils.isBlank(project.getGridId())) { if (StringUtils.isBlank(project.getGridId())) {
diff.setOrgType("agency"); diff.setOrgType("agency");
diff.setOrgId(project.getAgencyId()); diff.setOrgId(project.getAgencyId());
@ -365,6 +410,9 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
diff.setEventId(project.getId()); diff.setEventId(project.getId());
String projectStatus = project.getProjectStatus(); String projectStatus = project.getProjectStatus();
diff.setEventStatusCode(projectStatus); diff.setEventStatusCode(projectStatus);
if ("82ac5292612538eaf5c598005b7910ba".equals(project.getId())) {
System.out.println(JSON.toJSONString(projectDTO));
}
if (ProjectConstant.PENDING.equals(projectStatus)) { if (ProjectConstant.PENDING.equals(projectStatus)) {
diff.setEventStatusDesc("处理中"); diff.setEventStatusDesc("处理中");
//项目耗时 当前时间-项目创建时间 //项目耗时 当前时间-项目创建时间
@ -382,6 +430,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr
/** /**
* 递归查询父节点 * 递归查询父节点
*
* @param childCategory * @param childCategory
* @param categoryList * @param categoryList
* @param categoryCode * @param categoryCode

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -602,7 +602,7 @@
</select> </select>
<select id="getProjectPeriodForDiff" resultType="com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity"> <select id="getProjectPeriodForDiff" resultType="com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity">
SELECT SELECT
t.ID, t.CUSTOMER_ID, t.PROJECT_ID, t.ORG_ID, t.ORG_TYPE, t.PID,t. PIDS, t.INFORMED_DATE, t.HANDLED_DATE, t.TOTAL_PERIOD, t.PERIOD_TILL_REPLY_FIRSTLY, t.OPERATION t.ID, t.CUSTOMER_ID, t.PROJECT_ID, t.ORG_ID, t.ORG_TYPE, t.PID,t. PIDS, t.INFORMED_DATE, t.HANDLED_DATE, t.TOTAL_PERIOD, t.PERIOD_TILL_REPLY_FIRSTLY, t.OPERATION, t.IS_RESOLVED
FROM fact_origin_project_org_period_daily t FROM fact_origin_project_org_period_daily t
WHERE CUSTOMER_ID = #{customerId} WHERE CUSTOMER_ID = #{customerId}
</select> </select>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml

@ -129,7 +129,8 @@
CUSTOMER_ID, CUSTOMER_ID,
PID, PID,
AGENCY_NAME, AGENCY_NAME,
LEVEL LEVEL,
ALL_PARENT_NAME
FROM FROM
dim_agency dim_agency
WHERE WHERE

Loading…
Cancel
Save