Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
zxc 4 years ago
parent
commit
b4f99390c5
  1. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java

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

@ -65,6 +65,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/
@Override
public void extractCategoryProjectGridData(String customerId, String dateId) {
log.info("开始执行网格项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>();
customerIds.add(customerId);
@ -81,10 +83,15 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
allList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.TWO);
closedList = screenProjectDataDao.selectGridCategoryProjectCount(customerIds, dateId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.TWO);
}
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);
gridInsert(allList);
long end = System.currentTimeMillis();
log.info("网格项目分类统计结束,耗时:"+ (end-start/1000) + "s");
}
/**
@ -128,6 +135,8 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
*/
@Override
public void extractCategoryProjectOrgData(String customerId, String dateId) {
log.info("开始执行组织项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>();
customerIds.add(customerId);
@ -136,16 +145,22 @@ 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> 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);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
log.info("组织-2级已结案所有项目{}",oneLevelClosedList);
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
}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)){
@ -154,21 +169,30 @@ public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenPr
}
}
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> 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())));
allOrgList.addAll(oneLevelList);
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())));
allOrgCategoryList.addAll(allOrgList);
});
}
orgDel(customerId,dateId);
log.info("组织-即将插入的项目分类{}",result);
orgInsert(result);
long end = System.currentTimeMillis();
log.info("组织项目分类统计结束,耗时:"+ (end-start/1000) + "s");
}
/**

Loading…
Cancel
Save