From b1e3614c5a0135be195135302ef77c018a8364f7 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 31 Aug 2021 14:00:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eenProjectCategoryOrgDailyServiceImpl.java | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index eaabf75cc0..cd771a5a9f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.dynamic.datasource.annotation.DataSource; @@ -365,7 +366,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); - log.info("分类标签:"+categoryProjectResultDTOS); + log.info("分类标签:{}"+JSON.toJSONString(categoryProjectResultDTOS)); List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); if (!CollectionUtils.isEmpty(belongGridInfos)){ // 存在直属网格 @@ -405,29 +406,38 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); + // 子客户单独存一份【三个街道的】 + List sonCustomerList = new ArrayList<>(); // 父客户存在的分类 List categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); - log.info("父客户存在的分类"+categoryProjectExists); - // 这时的result集合要清空,因为被上边使用 【result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class);】 - result.clear(); -/* List finalResult = result; - groupByCategoryCode.forEach((code, list) -> { - ScreenProjectCategoryOrgDailyEntity e = new ScreenProjectCategoryOrgDailyEntity(); - e.setCustomerId(customerId); - e.setCategoryOriginCustomerId(customerId); - e.setCategoryCode(code); - e.setOrgId(entity.getAgencyId()); - 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); - });*/ + log.info("父客户存在的分类{}"+ JSON.toJSONString(categoryProjectExists)); + // 父客户不存在的分类 + List categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); + log.info("父客户不存在的分类{}"+ JSON.toJSONString(categoryProjectNotExists)); + if (!CollectionUtils.isEmpty(categoryProjectExists)){ + sonCustomerList.addAll(categoryProjectExists); + } + if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ + sonCustomerList.addAll(categoryProjectNotExists); + } + if (!CollectionUtils.isEmpty(sonCustomerList)){ + List finalSonResult = result; + sonCustomerList.forEach(s -> { + ScreenProjectCategoryOrgDailyEntity e = ConvertUtils.sourceToTarget(s, ScreenProjectCategoryOrgDailyEntity.class); + e.setOrgType(ScreenConstant.STREET); + e.setDateId(dateId); + e.setPid(entity.getPid()); + e.setCustomerId(customerId); + finalSonResult.add(e); + }); + result.addAll(finalSonResult); + } // 内部客户与外部客户 相同的分类累加 if (!CollectionUtils.isEmpty(categoryProjectExists)){ categoryProjectResultDTOS.forEach(f -> { @@ -449,22 +459,23 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); if (!CollectionUtils.isEmpty(groupByStatus.get(false))){ List entities = ConvertUtils.sourceToTarget(groupByStatus.get(false), ScreenProjectCategoryOrgDailyEntity.class); + entities.forEach(e -> { + e.setOrgId(entity.getAgencyId()); + }); result.addAll(entities); } - log.info("父客户存在的分类,但是未使用的分类:"+groupByStatus.get(false)); - log.info("父客户存在的分类,但是未使用的分类,组合后:"+result); - // 父客户不存在的分类 - List categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ List entities = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); + entities.forEach(e -> { + e.setOrgId(entity.getAgencyId()); + }); result.addAll(entities); } - log.info("父客户不存在的分类:"+categoryProjectNotExists); } } // 目前不考虑计算子客户组织直接创建的项目,只算内部客户 @@ -509,7 +520,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl Date: Tue, 31 Aug 2021 14:03:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=95=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/ScreenProjectCategoryOrgDailyDao.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml index 40b9b158af..e6293d01f2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -47,7 +47,7 @@