Browse Source

备注

dev_shibei_match
zxc 4 years ago
parent
commit
9d28dbf039
  1. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java

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

@ -359,15 +359,18 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
result = ConvertUtils.sourceToTarget(categoryInfos, ScreenProjectCategoryOrgDailyEntity.class);
}
}else {
// 根据客户ID,时间,组织级别查询 分类标签
List<CategoryProjectResultDTO> categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level);
List<ScreenCustomerGridDTO> belongGridInfos = gridService.selectBelongGridInfo(customerId, level);
if (!CollectionUtils.isEmpty(belongGridInfos)){
// 存在直属网格
List<String> gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList());
// 根据网格ID查询分类标签
List<CategoryProjectResultDTO> categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds);
if (!CollectionUtils.isEmpty(categoryProjectGrid)){
categoryProjectResultDTOS.forEach(agency -> {
categoryProjectGrid.forEach(grid -> {
// 组织ID 和 分类标签code一样时,项目数累加
if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){
agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal());
grid.setStatus(true);
@ -375,6 +378,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
});
});
Map<Boolean, List<CategoryProjectResultDTO>> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus));
// 取出分类标签code不一样的数据
List<CategoryProjectResultDTO> categoryProjectResultDTOS1 = groupByStatus.get(false);
categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1);
}
@ -385,6 +389,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
* 在保存一份子客户自己agencyId的
*/
if (ScreenConstant.DISTRICT.equals(level)){
// 查询 平阴的agencyId
ScreenCustomerAgencyEntity entity = agencyService.selectTopAgency(customerId);
// 子级客户ID
List<String> customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList());
@ -392,6 +397,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true);
// 父客户不存在的分类
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false);
// 子级客户的分类标签数据
List<CategoryProjectResultDTO> sonResult = new ArrayList<>();
if (!CollectionUtils.isEmpty(categoryProjectExists)){
categoryProjectResultDTOS.addAll(categoryProjectExists);
@ -412,6 +418,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
e.setProjectTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal)));
e.setPid(entity.getPid());
e.setPids(StringUtils.isEmpty(entity.getPids()) ? NumConstant.ZERO_STR : entity.getPids());
// 因为根据categoryCode分组,所以level都一样,取第一条的
e.setLevel(list.get(NumConstant.ZERO).getLevel());
finalResult.add(e);
});

Loading…
Cancel
Save