From 00cf9003c1db2f7ed97dd6dffd5d1111ba7ba79e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 21 Jan 2021 12:47:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=8C=87=E6=A0=87=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=EF=BC=9AIndexCalculateService.indexCalculate=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9;2=E3=80=81=E6=89=80=E6=9C=89=E6=8C=87?= =?UTF-8?q?=E6=95=B0=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?@RequestHeader=E4=B8=AD=E7=9A=84customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/dto/form/MonthBarchartFormDTO.java | 5 + .../screen/dto/form/MonthPieChartFormDTO.java | 5 + .../dto/form/SubAgencyIndexRankFormDTO.java | 5 + .../dto/form/SubAgencyIndexRankYMFormDTO.java | 5 + .../dto/form/YearAverageIndexFormDTO.java | 5 + .../controller/screen/IndexController.java | 26 +++-- .../dto/indexcal/CustomerSubInfoDTO.java | 1 + .../screen/ScreenCustomerAgencyDao.java | 12 ++- .../screen/ScreenCustomerDeptDao.java | 11 ++- .../screen/ScreenCustomerGridDao.java | 8 +- .../epmet/dao/stats/CustomerRelationDao.java | 6 ++ .../indexcal/impl/DeptScoreServiceImpl.java | 2 +- .../impl/IndexCalculateServiceImpl.java | 11 ++- .../indexcoll/FactIndexCollectService.java | 7 +- .../impl/FactIndexCollectServiceImpl.java | 96 ++++++++++--------- .../impl/ShiBeiScreenCollServiceImpl.java | 2 +- .../impl/CustomerRelationServiceImpl.java | 5 + .../screen/ScreenCustomerAgencyDao.xml | 27 +++++- .../screen/ScreenCustomerDeptDao.xml | 19 +++- .../screen/ScreenCustomerGridDao.xml | 18 +++- .../mapper/stats/CustomerRelationDao.xml | 15 ++- 21 files changed, 211 insertions(+), 80 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java index 224ab623db..f028fffeff 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java @@ -26,4 +26,9 @@ public class MonthBarchartFormDTO implements Serializable { * 月份ID,如果此列有值,查询截止到当前monthId的近12个月数据 */ private String monthId; + + /** + * area_code升级,新增此参数,来源于当前token + */ + private String customerId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java index a5e9c53f26..8b3a973153 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java @@ -21,4 +21,9 @@ public class MonthPieChartFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {MonthPieChart.class}) private String agencyId; + + /** + * area_code升级,新增此参数,来源于当前token + */ + private String customerId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java index 608c6b0492..b1ffd9243d 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java @@ -30,4 +30,9 @@ public class SubAgencyIndexRankFormDTO implements Serializable { private Integer topNum; private String yearId; + + /** + * area_code升级,新增此参数,来源于当前token + */ + private String customerId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java index e973fefa50..ebfea119a4 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java @@ -53,4 +53,9 @@ public class SubAgencyIndexRankYMFormDTO implements Serializable { * 组织类型 组织:agency 网格:grid */ private String orgType; + + /** + * area_code升级,新增此参数,来源于当前token + */ + private String customerId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java index e53a94cfa9..a9da3253cf 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java @@ -21,4 +21,9 @@ public class YearAverageIndexFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {YearAverageIndex.class}) private String agencyId; + + /** + * area_code升级,新增此参数,来源于当前token + */ + private String customerId; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index 00fc8046a5..5ebeef980d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java @@ -6,6 +6,7 @@ import com.epmet.datareport.eum.OrgTypeEnum; import com.epmet.datareport.service.evaluationindex.screen.IndexService; import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -17,6 +18,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/8/18 10:13 */ +@Slf4j @RestController @RequestMapping("/screen/index") public class IndexController { @@ -31,7 +33,9 @@ public class IndexController { * @date 2020/8/19 2:53 下午 */ @PostMapping("yearaverageindex") - public Result yearAverageIndex(@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){ + public Result yearAverageIndex(@RequestHeader("CustomerId") String customerId,@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){ + //area_code升级,新增此参数 + yearAverageIndexFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class); return new Result().ok(indexService.yearAverageIndex(yearAverageIndexFormDTO)); } @@ -43,7 +47,9 @@ public class IndexController { * @date 2020/8/19 3:17 下午 */ @PostMapping("monthindexanalysis/piechart") - public Result monthPieChart(@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){ + public Result monthPieChart(@RequestHeader("CustomerId") String customerId,@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){ + //area_code升级,新增此参数 + monthPieChartFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(monthPieChartFormDTO, MonthPieChartFormDTO.MonthPieChart.class); return new Result().ok(indexService.monthPieChart(monthPieChartFormDTO)); } @@ -55,7 +61,9 @@ public class IndexController { * @date 2020/8/19 5:27 下午 */ @PostMapping("monthindexanalysis/barchart") - public Result monthBarchart(@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){ + public Result monthBarchart(@RequestHeader("CustomerId") String customerId,@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){ + //area_code升级,新增此参数 + monthBarchartFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(monthBarchartFormDTO, MonthBarchartFormDTO.MonthBarchart.class); return new Result().ok(indexService.monthBarchart(monthBarchartFormDTO)); } @@ -67,7 +75,9 @@ public class IndexController { * @date 2020/8/20 10:02 上午 */ @PostMapping("subagencyindexrank") - public Result> subAgencyIndexRank(@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){ + public Result> subAgencyIndexRank(@RequestHeader("CustomerId") String customerId,@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){ + //area_code升级,新增此参数 + subAgencyIndexRankFormDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(subAgencyIndexRankFormDTO, SubAgencyIndexRankFormDTO.SubAgencyIndexRank.class); return new Result>().ok(indexService.subAgencyIndexRank(subAgencyIndexRankFormDTO)); } @@ -81,7 +91,9 @@ public class IndexController { * @Date 13:39 2020-09-11 **/ @PostMapping("dataclient/subagencyindexrank") - public Result> getSubAgencyIndexRank(@RequestBody SubAgencyIndexRankYMFormDTO formDTO) { + public Result> getSubAgencyIndexRank(@RequestHeader("CustomerId") String customerId,@RequestBody SubAgencyIndexRankYMFormDTO formDTO) { + //area_code升级,新增此参数 + formDTO.setCustomerId(customerId); ValidatorUtils.validateEntity(formDTO, SubAgencyIndexRankYMFormDTO.SubAgencyIndexRank.class); return new Result>().ok(indexService.getSubAgencyIndexRank(formDTO)); } @@ -118,7 +130,7 @@ public class IndexController { /** * @param formDTO - * @Description 组织月度指数得分 + * @Description 数据改版:组织月度指数得分 * @author sun */ @PostMapping("month/indexscore") @@ -129,7 +141,7 @@ public class IndexController { /** * @param formDTO - * @Description 先进排行-先进支部排行 + * @Description 数据改版:先进排行-先进支部排行 * @author sun */ @PostMapping("advancedbranchrank") diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java index 57f401c301..95d7189f6d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java @@ -15,6 +15,7 @@ import java.util.List; public class CustomerSubInfoDTO implements Serializable { private String customerId; + private String customerName; /** * 当前客户所属的地区编码 add 01.14 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 3b43d23c4d..c37d2abace 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -71,7 +71,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds); + List selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * 根据客户id,查询区/街道 组织名称、id @@ -81,7 +83,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListAgencyInfo(@Param("customerId") String customerId); + List selectListAgencyInfo(@Param("customerId") String customerId, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * @param agencyId @@ -100,7 +104,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds); + List selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * desc:获取客户的组织条数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java index 3a992c7ca6..5f8e0555c1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java @@ -57,14 +57,13 @@ public interface ScreenCustomerDeptDao extends BaseDao void batchInsertCustomerDept(@Param("list") List list, @Param("customerId")String customerId); /** - * @param customerId * @param deptId * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity * @author yinzuomei * @description 查询部门所属组织id * @Date 2020/9/3 16:32 **/ - ScreenCustomerDeptEntity selectParentAgencyId(@Param("customerId") String customerId, @Param("deptId") String deptId); + ScreenCustomerDeptEntity selectParentAgencyId(@Param("deptId") String deptId); /** * 返回当前客户下,未匹配到的区直部门信息 @@ -76,7 +75,9 @@ public interface ScreenCustomerDeptDao extends BaseDao * @Date 10:45 2020-09-04 **/ List selectListMismatchDeptInfo(@Param("customerId") String customerId, - @Param("deptIds") String[] deptIds); + @Param("deptIds") String[] deptIds, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * 根据客户id 查询部门 信息 @@ -85,7 +86,9 @@ public interface ScreenCustomerDeptDao extends BaseDao * @Author zhangyong * @Date 16:57 2020-09-03 **/ - List selectListDeptInfo(@Param("customerId")String customerId); + List selectListDeptInfo(@Param("customerId")String customerId, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * 查询最后一次添加的部门 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index ab0bc1e653..f6d064a62b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -106,7 +106,9 @@ public interface ScreenCustomerGridDao extends BaseDao * @Date 10:45 2020-09-04 **/ List selectListMismatchGridInfo(@Param("customerId") String customerId, - @Param("gridIds") String[] gridIds); + @Param("gridIds") String[] gridIds, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * 根据客户id 查询网格(党支部)详细信息 @@ -115,7 +117,9 @@ public interface ScreenCustomerGridDao extends BaseDao * @Author zhangyong * @Date 16:57 2020-09-03 **/ - List selectListGridInfo(@Param("customerId")String customerId); + List selectListGridInfo(@Param("customerId")String customerId, + @Param("customerAreaCode") String customerAreaCode, + @Param("subCustomerIds")List subCustomerIds); /** * @Description 根据agencyId查询网格ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java index a5c15ff8cc..c5c3e3c927 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java @@ -34,5 +34,11 @@ import java.util.List; @Mapper public interface CustomerRelationDao extends BaseDao { + /** + * @param customerIds + * @author yinzuomei + * @description 查询当前客户的area_code信息、以及子客户列表 + * @Date 2021/1/21 11:27 + **/ List selectCustomerSubInfo(@Param("list") List customerIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index 9224a2679d..dd4219e170 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -380,7 +380,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl getCustomerInfoMap(List customerIds) { return customerRelationService.getCustomerInfoMap(customerIds); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java index 98d0fc95af..158ced77de 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java @@ -1,9 +1,8 @@ package com.epmet.service.evaluationindex.indexcoll; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcollect.form.*; -import java.util.List; - /** * 大屏数据采集api * @@ -110,11 +109,9 @@ public interface FactIndexCollectService { /** * 将网格、社区、区直部门、区/街道分支记录表中的数据,抽取到 指数-指数数据(每月数值) 指数-指数数据(按年统计) - * @param monthId 2020-8 - * @param customerId * @return void * @Author zhangyong * @Date 10:29 2020-09-03 **/ - void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId); + void insertScreenIndexDataMonthlyAndYearly(CalculateCommonFormDTO calculateCommonFormDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 2ea0aa08d0..a117021b91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -18,6 +18,7 @@ import com.epmet.dao.evaluationindex.indexcoll.*; import com.epmet.dao.evaluationindex.screen.*; import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.DeptScoreDTO; import com.epmet.dto.indexcollect.form.*; import com.epmet.dto.screen.FactIndexCommunityScoreDTO; @@ -44,7 +45,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -225,9 +225,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @date 2020/10/20 2:59 下午 */ @Override - public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) { - if (NumConstant.SIX != monthId.length()) { - throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId); + public void insertScreenIndexDataMonthlyAndYearly(CalculateCommonFormDTO formDTO) { + if (NumConstant.SIX != formDTO.getMonthId().length()) { + throw new RuntimeException("入参monthId格式不正确:monthId =" + formDTO.getMonthId()); } RLock lock = distributedLock.getLock(LockConstants.STATS_LOCK_NAME); try { @@ -236,26 +236,27 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } allParentIds.cleanUp(); // 根据网格类型,删除 指数-指数数据(每月数值)表中 匹配的数据 - this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.GRID); + this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.GRID); // 开始处理 网格相关分值表 - this.startHandleIndexGridScore(monthId, customerId); + this.startHandleIndexGridScore(formDTO); // 根据组织类型,删除 指数-指数数据(每月数值)表中 匹配的数据 - this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.AGENCY); + this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.AGENCY); // 开始处理 社区相关分值表 - this.startHandleIndexCommunityScore(monthId, customerId); + this.startHandleIndexCommunityScore(formDTO); // 根据部门类型,删除 指数-指数数据(每月数值)表中 匹配的数据 - this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.DEPARTMENT); + this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DEPARTMENT); // 开始处理 区直部门分值表 - this.startHandleIndexDeptScore(monthId, customerId); + this.startHandleIndexDeptScore(formDTO); // 同样是 组织类型,所以不再重复删除了 // 开始处理 区/街道相关分数表 - this.startHandleIndexAgencyScore(monthId, customerId); + //todo + this.startHandleIndexAgencyScore(formDTO); // 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly - this.insertIndexDataYear(monthId, customerId); + this.insertIndexDataYear(formDTO.getMonthId(), formDTO.getCustomerId()); allParentIds.invalidateAll(); } finally { distributedLock.unLock(lock); @@ -266,13 +267,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * 目标:将网格的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表) * 如果网格相关分值表 中的网格数量不全,需要从 网格(党支部)信息表 中,先查询到缺少的网格信息,赋上默认值后,插入 指数-指数数据(月表) * - * @param monthId - * @param customerId * @return void * @Author zhangyong * @Date 13:44 2020-09-04 **/ - private void startHandleIndexGridScore(String monthId, String customerId){ + private void startHandleIndexGridScore(CalculateCommonFormDTO formDTO){ + String customerId=formDTO.getCustomerId(); + String monthId=formDTO.getMonthId(); List mismatchGridList = new ArrayList<>(); // 查询网格相关分值记录 表已经存在的网格id List indexGridIds = factIndexGridScoreDao.selectListGridId(customerId, monthId); @@ -283,9 +284,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { gridIds[i] = indexGridIds.get(i); } // 进行不匹配查询(即返回网格相关分值表 中不存在的网格信息)。 - mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds); + mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } else { - mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null); + mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } if (!CollectionUtils.isEmpty(mismatchGridList)){ @@ -295,7 +296,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // fact_index_grid_score 网格相关分值记录表 grid List gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId); // 开始处理实际分数 - this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS); + this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } /** @@ -340,12 +341,12 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List gridScoreDTOS) { + private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List gridScoreDTOS,String customerAreaCode,List subCustomerIds) { List monthlyFormDTOList = new ArrayList<>(); // 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据 Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId)); // 查询网格的 上级组织id 和 组织名称 - List parentGridList = screenCustomerGridDao.selectListGridInfo(customerId); + List parentGridList = screenCustomerGridDao.selectListGridInfo(customerId,customerAreaCode,subCustomerIds); if (!CollectionUtils.isEmpty(parentGridList)) { parentGridList.forEach(o -> { allParentIds.put(o.getGridId(), o.getAllParentIds()); @@ -399,13 +400,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * 目标:将社区的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表) * 如果社区相关分值表 中的社区数量不全,需要从 组织机构信息 中,先查询到缺少的社区信息,赋上默认值后,在插入 指数-指数数据(月表) * - * @param monthId - * @param customerId * @return void * @Author zhangyong * @Date 13:44 2020-09-04 **/ - private void startHandleIndexCommunityScore(String monthId, String customerId){ + private void startHandleIndexCommunityScore(CalculateCommonFormDTO formDTO){ + String customerId=formDTO.getCustomerId(); + String monthId=formDTO.getMonthId(); List mismatchAgencyList = new ArrayList<>(); // 查询社区相关分值记录id List indexCommunityIds = factIndexCommunityScoreDao.selectListCommunityId(customerId, monthId); @@ -416,9 +417,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { communityIds[i] = indexCommunityIds.get(i); } // 进行不匹配查询(即返回社区相关分值表 中不存在的【社区级】 组织信息)。 - mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, communityIds); + mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, communityIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } else { - mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, null); + mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } if (!CollectionUtils.isEmpty(mismatchAgencyList)){ @@ -429,7 +430,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 查询社区相关分值记录 List communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId); // 开始处理实际分数 - this.insertIndexDataMonthlyByCommunityScore(monthId, customerId, communityScoreDTOS); + this.insertIndexDataMonthlyByCommunityScore(monthId, customerId, communityScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } /** @@ -474,12 +475,14 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List communityScoreDTOS) { + private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List communityScoreDTOS, + String customerAreaCode, + List subCustomerIds) { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); // 根据客户id,查询区/街道 组织名称、id - List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); + List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId,customerAreaCode,subCustomerIds); if (!CollectionUtils.isEmpty(parentAgencyList)) { parentAgencyList.forEach(o -> { allParentIds.put(o.getAgencyId(), o.getPids()); @@ -534,13 +537,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * 目标:将区直部门的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表) * 如果 区直部门分值表 中的部门数量不全,需要从 部门信息表 中,先查询到缺少的部门信息,赋上默认值后,在插入 指数-指数数据(月表) * - * @param monthId - * @param customerId * @return void * @Author zhangyong * @Date 13:44 2020-09-04 **/ - private void startHandleIndexDeptScore(String monthId, String customerId){ + private void startHandleIndexDeptScore(CalculateCommonFormDTO formDTO){ + String customerId=formDTO.getCustomerId(); + String monthId=formDTO.getMonthId(); List mismatchDeptList = new ArrayList<>(); // 查询社 区直部门分值表 List indexDeptIds = deptScoreDao.selectListDeptId(customerId, monthId); @@ -549,9 +552,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { for (int i = NumConstant.ZERO; i < indexDeptIds.size(); i++){ depeIds[i] = indexDeptIds.get(i); } - mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds); + mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } else { - mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null); + mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } if (!CollectionUtils.isEmpty(mismatchDeptList)) { @@ -568,7 +571,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // 查询社 区直部门分值表 List deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId); // 开始处理实际分数 - this.insertIndexDataMonthlyByDeptScore(monthId, customerId, deptScoreDTOS); + this.insertIndexDataMonthlyByDeptScore(monthId, customerId, deptScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } /** @@ -613,11 +616,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByDeptScore(String monthId, String customerId, List deptScoreDTOS){ + private void insertIndexDataMonthlyByDeptScore(String monthId, String customerId, List deptScoreDTOS, + String customerAreaCode, + List subCustomerIds){ List monthlyFormDTOList = new ArrayList<>(); // 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据 Map> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId)); - List parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId); + List parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId,customerAreaCode,subCustomerIds); for(Map.Entry> deptScore : collect.entrySet()){ IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); // 给4个指数 赋默认值 @@ -666,13 +671,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * 目标:将 区/街道的 党建能力、治理能力、服务能力、总指数 得分。 整理后(4条合1条) 插入 指数-指数数据(月表) * 如果 区/街道相关分数表 中的组织数量不全,需要从 组织机构信息 中,先查询到缺少的组织信息,赋上默认值后,在插入 区/街道相关分数表。 一对四 * - * @param monthId - * @param customerId * @return void * @Author zhangyong * @Date 13:44 2020-09-04 **/ - private void startHandleIndexAgencyScore(String monthId, String customerId){ + private void startHandleIndexAgencyScore(CalculateCommonFormDTO formDTO){ + String customerId=formDTO.getCustomerId(); + String monthId=formDTO.getMonthId(); List mismatchAgencyList = new ArrayList<>(); List indexAgencyIds = agencyScoreDaol.selectListAgencyId(customerId, monthId); if (indexAgencyIds.size() > NumConstant.ZERO){ @@ -680,9 +685,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { for (int i = NumConstant.ZERO; i < indexAgencyIds.size(); i++){ agencyIds[i] = indexAgencyIds.get(i); } - mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, agencyIds); + //todo 平阴县areaCode重复 + mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, agencyIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } else { - mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, null); + mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } if (!CollectionUtils.isEmpty(mismatchAgencyList)){ @@ -691,7 +697,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { // fact_index_agency_score 区/街道相关分数表 agency List agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId); // 开始处理实际分数 - this.insertIndexDataMonthlyByAgencyScore(monthId, customerId, agencyScoreDTOS); + this.insertIndexDataMonthlyByAgencyScore(monthId, customerId, agencyScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds()); } /** @@ -704,11 +710,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { * @Author zhangyong * @Date 14:17 2020-09-03 **/ - private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List agencyScoreDTOS) { + private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List agencyScoreDTOS, + String customerAreaCode, + List subCustomerIds) { List monthlyFormDTOList = new ArrayList<>(); // 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据 Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); - List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId); + List parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId,customerAreaCode,subCustomerIds); int j = 0; if (!CollectionUtils.isEmpty(parentAgencyList)) { parentAgencyList.forEach(o -> { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index cd26e20bd2..774fde473b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -405,7 +405,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { @Transactional(rollbackFor = Exception.class) public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - List entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId()); + List entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(),null,null); List list = new ArrayList<>(); if (CollectionUtils.isEmpty(entityList)) { return 0; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java index bbdbb9f386..7a39515309 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java @@ -25,7 +25,9 @@ import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.entity.stats.CustomerRelationEntity; import com.epmet.service.stats.CustomerRelationService; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -51,6 +53,9 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl getCustomerInfoMap(List customerIds) { List list = baseDao.selectCustomerSubInfo(customerIds); + if(CollectionUtils.isEmpty(list)){ + return new HashMap<>(); + } return list.stream().collect(Collectors.toMap(CustomerSubInfoDTO::getCustomerId, customer -> customer)); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 97eea5c398..cbb54e049f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -70,8 +70,15 @@ screen_customer_agency WHERE DEL_FLAG = '0' - AND CUSTOMER_ID =#{customerId} AND `LEVEL` = 'community' + + + and AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND CUSTOMER_ID =#{customerId} + + AND AGENCY_ID NOT IN @@ -90,7 +97,14 @@ screen_customer_agency WHERE DEL_FLAG = '0' - AND CUSTOMER_ID =#{customerId} + + + and AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND CUSTOMER_ID =#{customerId} + + @@ -122,8 +136,15 @@ screen_customer_agency WHERE DEL_FLAG = '0' - AND CUSTOMER_ID = #{customerId} AND (`LEVEL` = 'street' OR `LEVEL` = 'district') + + + and AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND CUSTOMER_ID = #{customerId} + + ) agency WHERE agencyId NOT IN diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml index 7dd6ba62a4..0f5499d456 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml @@ -60,7 +60,6 @@ screen_customer_dept m WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID =#{customerId} AND m.DEPT_ID =#{deptId} @@ -73,7 +72,14 @@ screen_customer_dept WHERE DEL_FLAG = '0' - AND CUSTOMER_ID =#{customerId} + + + and AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND CUSTOMER_ID =#{customerId} + + AND DEPT_ID NOT IN @@ -91,7 +97,14 @@ screen_customer_dept WHERE DEL_FLAG = '0' - AND CUSTOMER_ID =#{customerId} + + + and AREA_CODE LIKE concat( #{customerAreaCode}, '%') + + + AND CUSTOMER_ID =#{customerId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml index e959443001..11d7c9f637 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml @@ -2,15 +2,24 @@ - SELECT CR.PARENT_CUSTOMER_ID AS customerId, dc.CUSTOMER_NAME AS customerName, - dc.AREA_CODE AS areaCode, + dc.AREA_CODE AS customerAreaCode, CR.CUSTOMER_ID AS subCustomerId FROM customer_relation cr - LEFT JOIN dim_customer dc ON ( cr.PARENT_CUSTOMER_ID = DC.ID ) + LEFT JOIN dim_customer dc ON ( cr.PARENT_CUSTOMER_ID = DC.ID and dc.del_flag='0') WHERE cr.DEL_FLAG = '0' AND cr.`STATUS` = 'open'