From 1427c2cbbc9f827625e8cc7263affb23577d3df8 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 3 Sep 2020 16:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E7=9B=B4=E9=83=A8=E9=97=A8=E6=9A=82?= =?UTF-8?q?=E5=AD=98v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactIndexGovrnAblityDeptMonthlyDao.java | 10 ++++ .../screen/ScreenCustomerDeptDao.java | 11 ++++ .../indexcal/DeptScoreEntity.java | 8 +-- .../indexcal/GridCorreLationService.java | 12 ++++ .../indexcal/impl/DeptScoreServiceImpl.java | 58 +++++++++++++++++-- .../impl/GridCorreLationServiceImpl.java | 3 +- .../FactIndexGovrnAblityDeptMonthlyDao.xml | 12 ++++ .../screen/ScreenCustomerDeptDao.xml | 12 ++++ 8 files changed, 115 insertions(+), 11 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java index 20abf945b7..abdabd7465 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java @@ -98,4 +98,14 @@ public interface FactIndexGovrnAblityDeptMonthlyDao extends BaseDao * @Date 10:52 2020-08-18 **/ 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); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java index 8517c59ff1..29857fdc2c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java @@ -47,10 +47,10 @@ public class DeptScoreEntity extends BaseEpmetEntity { */ private String deptId; - /** - * 所有上级ID,用英文逗号分开 - */ - private String allParentIds; + /** + * 部门所属的组织id + */ + private String agencyId; /** * 季度id: yyyyQ1、yyyyQ2、yyyyQ3、yyyyQ4 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java index 14d2ac604c..a93697ce12 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java @@ -3,7 +3,10 @@ package com.epmet.service.evaluationindex.indexcal; import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO; +import com.epmet.support.normalizing.batch.IndexInputVO; +import java.math.BigDecimal; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,4 +44,13 @@ public interface GridCorreLationService { * @Date 2020/8/27 14:48 **/ List pageGridList(PageQueryGridFormDTO formDTO); + + /** + * @return java.util.HashMap + * @param indexMap + * @author yinzuomei + * @description 通用计算方法 + * @Date 2020/9/3 16:07 + **/ + HashMap calculate(Map> indexMap); } 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 20360baa29..59b6127b77 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 @@ -22,14 +22,19 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao; +import com.epmet.dao.evaluationindex.screen.ScreenCustomerDeptDao; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; import com.epmet.eum.IndexCodeEnum; import com.epmet.service.evaluationindex.indexcal.DeptScoreService; +import com.epmet.service.evaluationindex.indexcal.GridCorreLationService; import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; import com.epmet.support.normalizing.BigDecimalScoreCalculator; @@ -42,6 +47,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.math.BigDecimal; @@ -49,7 +55,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** @@ -67,6 +72,12 @@ public class DeptScoreServiceImpl extends BaseServiceImpl resultMap = gridCorreLationService.calculate(indexMap); + //保存中间表记录 + this.saveDeptScoreEntity(formDTO,resultMap); + } + /** + * @return void + * @param formDTO + * @param resultMap + * @author yinzuomei + * @description fact_index_dept_score + * @Date 2020/9/3 16:11 + **/ + @Transactional(rollbackFor = Exception.class) + public void saveDeptScoreEntity(CalculateCommonFormDTO formDTO, HashMap resultMap) { + String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); + String yearId = DateUtils.getYearId(formDTO.getMonthId()); + resultMap.forEach((deptId, governAblityScore) -> { + DeptScoreEntity deptScoreEntity = new DeptScoreEntity(); + deptScoreEntity.setCustomerId(formDTO.getCustomerId()); + deptScoreEntity.setDeptId(deptId); + deptScoreEntity.setIsTotal(NumConstant.ZERO_STR); + deptScoreEntity.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + ScreenCustomerDeptEntity deptEntity = screenCustomerDeptDao.selectParentAgencyId(formDTO.getCustomerId(), deptId); + if (null != deptEntity) { + if(StringUtils.isNotBlank(deptEntity.getParentAgencyId())){ + deptScoreEntity.setAgencyId(deptEntity.getParentAgencyId()); + } + } + deptScoreEntity.setQuarterId(quarterId); + deptScoreEntity.setYearId(yearId); + deptScoreEntity.setMonthId(formDTO.getMonthId()); + deptScoreEntity.setScore(governAblityScore); + deptScoreDao.insert(deptScoreEntity); + }); } /** * @param formDTO * @return void * @author yinzuomei - * @description TODO + * @description * @Date 2020/9/3 9:35 **/ private void handleOneGridScene(CalculateCommonFormDTO formDTO) { - + FactIndexGovrnAblityDeptMonthlyEntity entity = factIndexGovrnAblityDeptMonthlyDao.selectOneRecord(formDTO.getCustomerId(), formDTO.getMonthId()); + HashMap resultMap = new HashMap<>(); + resultMap.put(entity.getDeptId(), new BigDecimal(NumConstant.FIFTY_STR)); + this.saveDeptScoreEntity(formDTO, resultMap); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java index 306c3c7713..abbe326a81 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java @@ -370,7 +370,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @description 调用计算器计算每个指标下,各个网格的总分 * @Date 2020/8/30 21:40 **/ - private HashMap calculate(Map> indexMap) { + @Override + public HashMap calculate(Map> indexMap) { //构造入参 List indexInputVOS = this.getIndexInputVOList(indexMap); log.info("计算的参数"+JSON.toJSONString(indexInputVOS)); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml index bf9647c67f..3039ac9eed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml @@ -140,4 +140,16 @@ m.DEPT_ID ASC LIMIT #{offset},#{pageSize} + + + 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 8f1ef7eaf4..d014071995 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 @@ -52,4 +52,16 @@ + + +