Browse Source

Merge remote-tracking branch 'origin/dev_add_closedCount_category' into dev_add_closedCount_category

master
jianjun 4 years ago
parent
commit
9a1eb91b2e
  1. 47
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  2. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java

47
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -162,28 +162,29 @@
<!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT
ALL_CATEGORY_NAME AS category,
CASE WHEN PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE PROJECT_STATUS_CODE END AS projectStatus,
IFNULL(PROJECT_TITLE,'') AS projectTitle,
DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
ORG_ID,
ORG_TYPE,
PROJECT_ID,
LINK_NAME,
LINK_MOBILE,
PROJECT_ADDRESS
FROM screen_project_data
WHERE DEL_FLAG = '0'
<if test=' status == "closed" '>
AND PROJECT_STATUS_CODE IN ('closed_case','closed')
</if>
AND CONCAT(ALL_PARENT_IDS,':',ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND CATEGORY_CODE LIKE CONCAT('%',#{categoryCode},'%')
AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
<if test="null != startTime and startTime != '' ">
AND DATE_FORMAT(PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime}
</if>
ORDER BY PROJECT_CREATE_TIME DESC
DISTINCT pd.PROJECT_ID AS projectId,
pd.ALL_CATEGORY_NAME AS category,
CASE WHEN pd.PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE pd.PROJECT_STATUS_CODE END AS projectStatus,
IFNULL(pd.PROJECT_TITLE,'') AS projectTitle,
DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
pd.ORG_ID,
pd.ORG_TYPE,
pd.LINK_NAME,
pd.LINK_MOBILE,
pd.PROJECT_ADDRESS
FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed_case','closed')
</if>
AND CONCAT(pd.ALL_PARENT_IDS,':',pd.ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND pc.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
AND pd.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
<if test="null != startTime and startTime != '' ">
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime}
</if>
ORDER BY pd.PROJECT_CREATE_TIME DESC
</select>
</mapper>

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java

@ -89,12 +89,10 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
finalClosedList1.addAll(closed);
});
}
log.info("网格-所有项目分类{}",allList);
log.info("网格-所有已关闭项目分类{}",closedList);
List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList;
allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
gridDel(customerId,dateId);
log.info("网格-所有项目分类即将插入的集合{}",allList);
log.info("网格-所有项目分类即将插入的集合{}",JSON.toJSONString(allList));
gridInsert(allList);
long end = System.currentTimeMillis();
log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
@ -151,26 +149,20 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
// one customer
List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class);
log.info("客户下所有组织{}",allAgencies);
result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
log.info("组织2级项目{}",result);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
log.info("组织-2级已结案所有项目{}",closedList);
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
log.info("1级组织所有项目{}",oneLevelList);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
log.info("组织-1级已结案所有项目{}",oneLevelClosedList);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
result.addAll(oneLevelList);
}else {
// more customers
// 去除孔村的客户ID,孔村镇的单独查😡
log.info("子级客户{}",relationInfo);
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) {
if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){
@ -180,21 +172,15 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
}
subCustomerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID);
log.info("父子关系所有组织{}",allAgencies);
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY);
List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result;
log.info("开始分批查询数据,每次50");
partition.forEach(p -> {
List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
log.info("组织-2级项目分类{}",allOrgList);
List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
log.info("组织-2级已结案项目分类{}",closedOrgList);
allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
log.info("组织-1级所有项目分类{}",oneLevelList);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
log.info("组织-1级所有已结案项目分类{}",oneLevelClosedList);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
allOrgList.addAll(oneLevelList);
@ -202,7 +188,7 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
});
}
orgDel(customerId,dateId);
log.info("组织-即将插入的项目分类{}",result);
log.info("组织-即将插入的项目分类{}",JSON.toJSONString(result));
orgInsert(result);
long end = System.currentTimeMillis();
log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s");

Loading…
Cancel
Save