diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 655635e6d7..03233b7c47 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -77,4 +77,8 @@ public interface StrConstant { String NULL_STR="null"; String NOT_FILLED = "无"; + + String MIN="MIN"; + + String MAX="MAX"; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java new file mode 100644 index 0000000000..0cfcdcc2a7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java @@ -0,0 +1,18 @@ +package com.epmet.constant; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/8/27 15:20 + */ +public interface IndexCalConstant { + + Integer PAGE_SIZE = 10; + + String GRID_ID="GRID_ID"; + + String CUSTOMER_ID="CUSTOMER_ID"; + + String MONTH_ID="MONTH_ID"; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java index 51f5244294..3db0986065 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/PageQueryGridFormDTO.java @@ -18,6 +18,11 @@ public class PageQueryGridFormDTO implements Serializable { */ private String customerId; + /** + * yyyyMM + */ + private String monthId; + /** * 页码 * */ @@ -27,7 +32,17 @@ public class PageQueryGridFormDTO implements Serializable { /** * 每页多少条 * */ - private Integer pageSize = 10; + private Integer pageSize; private Integer pageIndex; + + + public PageQueryGridFormDTO(String customerId,String monthId,int pageIndex,int pageNo,int pageSize){ + this.customerId=customerId; + this.monthId=monthId; + this.pageIndex=pageIndex; + this.pageNo=pageNo; + this.pageSize=pageSize; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 4932fb509e..5f18b920f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -1,10 +1,13 @@ package com.epmet.controller; +import com.baomidou.mybatisplus.extension.api.R; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.AgencySubTreeDto; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.service.StatsDemoService; +import com.epmet.service.indexcal.GridCorreLationService; import com.epmet.service.screen.IndexCalculateCommunityService; import com.epmet.service.stats.DimAgencyService; import lombok.extern.slf4j.Slf4j; @@ -35,6 +38,8 @@ public class DemoController { private DimAgencyService dimAgencyService; @Autowired private IndexCalculateCommunityService indexCalculateCommunityService; + @Autowired + private GridCorreLationService gridCorreLationService; @GetMapping("testAlarm") public void testAlarm() { @@ -118,4 +123,12 @@ public class DemoController { indexCalculateCommunityService.communityPublishArticleCountCalculate("","202008"); return new Result(); } + + @PostMapping("testcalculategridcorrelation") + public Result testcalculateGridCorreLation(){ + CalculateCommonFormDTO formDTO=new CalculateCommonFormDTO("b09527201c4409e19d1dbc5e3c3429a1","202008"); + gridCorreLationService.calculateGridCorreLation(formDTO); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java index 11cb3fbe03..90c9a3ea6e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityGridMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcollect.form.GridGovrnAbilityFormDTO; import com.epmet.entity.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; import org.apache.ibatis.annotations.Mapper; @@ -67,14 +68,13 @@ public interface FactIndexGovrnAblityGridMonthlyDao extends BaseDao list, @Param("customerId")String customerId); /** - * @param customerId 客户id - * @param monthId yyyyMM + * @param formDTO * @return java.util.List * @author yinzuomei * @description 当前客户下,所有网格的治理能力相关五级指标 * @Date 2020/8/26 15:58 **/ - List> selectListGovrnAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId); + List> selectListGovrnAblityGrid(PageQueryGridFormDTO formDTO); /** * @return java.util.Map diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java index 0aff70aece..a2fe8dc821 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java @@ -18,6 +18,8 @@ package com.epmet.dao.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcollect.FactIndexPartyAblityGridMonthlyDTO; import com.epmet.dto.indexcollect.form.GridPartyAbilityFormDTO; import com.epmet.entity.indexcoll.FactIndexPartyAblityGridMonthlyEntity; @@ -68,14 +70,13 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao list, @Param("customerId")String customerId); /** - * @param customerId 客户id - * @param monthId yyyyMM + * @param formDTO * @return java.util.List * @author yinzuomei * @description 当前客户下,所有网格的党建能力相关五级指标 * @Date 2020/8/26 15:57 **/ - List> selectListPartyAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId); + List> selectListPartyAblityGrid(PageQueryGridFormDTO formDTO); /** * @return java.util.Map @@ -86,4 +87,6 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao selectPartyAblityGridMinAndMax(@Param("customerId") String customerId, @Param("monthId") String monthId); + + Integer selectCount(CalculateCommonFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java index a2b2eb78f8..7357c0cedc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexServiceAblityGridMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcollect.FactIndexServiceAblityGridMonthlyDTO; import com.epmet.dto.indexcollect.form.GridServiceAbilityFormDTO; import com.epmet.entity.indexcoll.FactIndexServiceAblityGridMonthlyEntity; @@ -68,13 +69,12 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao - * @param customerId - * @param monthId + * @param formDTO * @author yinzuomei * @description 当前客户下,所有网格的治理能力相关五级指标 * @Date 2020/8/26 15:59 **/ - List> selectListServiceAblityGrid(@Param("customerId") String customerId, @Param("monthId") String monthId); + List> selectListServiceAblityGrid(PageQueryGridFormDTO formDTO); /** * @return java.util.Map diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java index 29766018d8..71ef0303d4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java @@ -1,5 +1,7 @@ package com.epmet.eum; +import com.epmet.dto.indexcal.CalculateCommonFormDTO; + /** * 需要计算指标code枚举类 * @@ -8,7 +10,7 @@ package com.epmet.eum; **/ public enum IndexCodeEnum { DANG_YUAN_XIANG_GUAN("dangyuanxiangguan", "党员相关", 1), - WANG_GE_XIANG_GUAN("wangggexiangguan", "网格相关", 1), + WANG_GE_XIANG_GUAN("wanggexiangguan", "网格相关", 1), SHE_QU_XIANG_GUAN("shequxiangguan", "社区相关", 1), JIE_DAO_XIANG_GUAN("jiedaoxiangguan", "街道相关", 1), QU_ZHI_BU_MEN("quzhibumen", "区直部门", 1), @@ -21,7 +23,7 @@ public enum IndexCodeEnum { CAN_YU_YI_SHI("canyuyishi", "参与议事", 4), DANG_WU_HUO_DONG("dangwuhuodong", "党务活动", 4), LIAN_XI_QUN_ZHONG("lianxiqunzhong", "联系群众", 4), - + ZUZHINEIDANGYDLXQZNLKPFPJZ("zuzhineidangydlxqznlkpfpjz","组织内党员的联系群众能力考评分(平均值)",5), ; private String code; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java index 225ae2bb80..6648205d5c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/GridCorreLationService.java @@ -27,13 +27,12 @@ public interface GridCorreLationService { /** * @return java.util.List> - * @param customerId - * @param monthId + * @param formDTO * @author yinzuomei * @description 党建能力-网格相关事实表 当前客户下,所有网格的党建能力相关五级指标 * @Date 2020/8/27 14:48 **/ - List> queryListPartyAblityGrid(String customerId, String monthId); + List> queryListPartyAblityGrid(PageQueryGridFormDTO formDTO); /** * @return java.util.List diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java index 8a922020fa..8b052d2638 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java @@ -1,6 +1,8 @@ package com.epmet.service.indexcal.impl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.constant.IndexCalConstant; import com.epmet.dao.indexcoll.FactIndexGovrnAblityGridMonthlyDao; import com.epmet.dao.indexcoll.FactIndexPartyAblityGridMonthlyDao; import com.epmet.dao.indexcoll.FactIndexServiceAblityGridMonthlyDao; @@ -12,15 +14,21 @@ import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.entity.screen.IndexGroupDetailEntity; import com.epmet.eum.IndexCodeEnum; import com.epmet.service.indexcal.GridCorreLationService; +import com.epmet.service.indexcal.IndexCodeFieldReService; import com.epmet.service.screen.IndexGroupDetailService; +import com.epmet.support.normalizing.*; +import com.epmet.support.normalizing.batch.*; +import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.List; -import java.util.Map; +import java.math.BigDecimal; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 网格相关service @@ -41,6 +49,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { private ScreenCustomerGridDao screenCustomerGridDao; @Autowired private IndexGroupDetailService indexGroupDetailService; + @Autowired + private IndexCodeFieldReService indexCodeFieldReService; /** * @param formDTO @@ -55,86 +65,242 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { List dangJianNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); - if(!CollectionUtils.isEmpty(dangJianNengLiList)){ + if (!CollectionUtils.isEmpty(dangJianNengLiList)) { //1、计算网格相关-党建能力 - calculateGridCorreLationDangJian(formDTO,dangJianNengLiList); + calculateGridCorreLationDangJian(formDTO, dangJianNengLiList); } - List zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), + /* List zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); - if(!CollectionUtils.isEmpty(zhiLiNengLiList)){ + if (!CollectionUtils.isEmpty(zhiLiNengLiList)) { //2、计算网格相关-治理能力 - calculateGridCorreLationZhiLi(formDTO,zhiLiNengLiList); + calculateGridCorreLationZhiLi(formDTO, zhiLiNengLiList); } List fuWuNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); - if(!CollectionUtils.isEmpty(fuWuNengLiList)){ + if (!CollectionUtils.isEmpty(fuWuNengLiList)) { //3、计算网格相关-服务能力 - calculateGridCorreLationFuWu(formDTO,fuWuNengLiList); + calculateGridCorreLationFuWu(formDTO, fuWuNengLiList); } //计算网格相关总分 List wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); - if(!CollectionUtils.isEmpty(wgxgList)){ - calculateGridCorreLationTotal(formDTO,wgxgList); - } + if (!CollectionUtils.isEmpty(wgxgList)) { + calculateGridCorreLationTotal(formDTO, wgxgList); + }*/ resultFlag = true; return resultFlag; } /** - * @return void * @param formDTO * @param indexList + * @return void * @author yinzuomei * @description 计算网格相关-党建能力 - * @Date 2020/8/26 16:47 + * @Date 2020/8/26 16:47 **/ - private void calculateGridCorreLationDangJian(CalculateCommonFormDTO formDTO,List indexList){ - //分页查询网格列表 - //查询五级指标 + private void calculateGridCorreLationDangJian(CalculateCommonFormDTO formDTO, List indexList) { + //查询总记录数 + int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO); + if (NumConstant.ZERO == total) { + logger.info(String.format("customerId:%s,monthId:%s,没有上传网格相关-党建能力-五级指标数据"), formDTO.getCustomerId(), formDTO.getMonthId()); + return; + } + //总页数,进行批量查询,批量计算 + int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); + logger.info(String.format("共%s条数据,分%s次计算", total, totalPage)); + //每一组指标的最大值,key:code_MIN/MAX + Map minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); + //指标集合 + Map> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); + //分页查询采集记录 + for (int pageNo = 1; pageNo <= totalPage; pageNo++) { + int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; + //前10条 + List> recordList = queryListPartyAblityGrid(new PageQueryGridFormDTO(formDTO.getCustomerId(), + formDTO.getMonthId(), + pageIndex, + pageNo, + IndexCalConstant.PAGE_SIZE)); + //遍历每一个网格的记录 + recordList.forEach(recordMap -> { + //遍历所有的指标 + indexMap.forEach((key, value) -> { + //列名不为空 + if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { + //对应的数值 + String sampleValueStr = String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key))); + //构造样本值对象 + SampleValue currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr)); + value.getIndexValueVOs().add(currentGridIndexValue); + } else if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) { + //组织内党员的联系群众能力考评分(平均值) TODO + logger.info("组织内党员的联系群众能力考评分(平均值) TODO"); + //网格内党员的联系群众能力考评分(平均值) + /* BigDecimal contactResiAblity = null; + SampleValue contactResiAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactResiAblity); + value.getIndexValueVOs().add(contactResiAblityValue);*/ + } + }); + }); + List result = calculate(indexMap); + // TODO 处理结果 + saveGridCorreLationDangJian(formDTO, indexList, result); + + try { + for (IndexOutputVO m : result) { + logger.info("indexId=" + m.getIndexId()); + for (SampleScore sampleScore : m.getIndexScoreVOs()) { + logger.info(String.format("网格id:%s,得分:%s", sampleScore.getSampleId(), sampleScore.getSampleScore())); + } + } + } catch (Exception e) { + } + } } /** + * @param formDTO 客户id 月份id: yyyyMM + * @param indexList 指标集合 + * @param indexOutputVOList * @return void + * @author yinzuomei + * @description 保存网格相关五级指标分值 + * @Date 2020/8/30 22:50 + **/ + private void saveGridCorreLationDangJian(CalculateCommonFormDTO formDTO, + List indexList, + List indexOutputVOList) { + Map indexMap = indexList.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, Function.identity())); + + + } + + /** + * @param indexMap + * @return java.util.List + * @author yinzuomei + * @description + * @Date 2020/8/30 21:40 + **/ + private List calculate(Map> indexMap) { + //构造入参 + List indexInputVOS = this.getIndexInputVOList(indexMap); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + return batchScoreCalculator.exec(indexInputVOS); + } + + /** + * @param indexMap + * @return java.util.List + * @author yinzuomei + * @description + * @Date 2020/8/30 18:34 + **/ + private List getIndexInputVOList(Map> indexMap) { + List list = new ArrayList<>(); + //遍历所有的指标 + indexMap.forEach((key, indexInputVO) -> { + list.add(indexInputVO); + }); + return list; + } + + + /** + * @param indexList 指标集合 + * @param minAndMaxMap 最大值最小值集合 + * @return java.util.Map + * @author yinzuomei + * @description + * @Date 2020/8/30 15:56 + **/ + private Map> getIndexInputVO(CalculateCommonFormDTO formDTO, List indexList, Map minAndMaxMap) { + Map> map = new HashMap<>(); + for (int indexNum = 0; indexNum < indexList.size(); indexNum++) { + IndexGroupDetailEntity index = indexList.get(indexNum); + IndexInputVO indexInputVO = new IndexInputVO(); + // 指标code + indexInputVO.setIndexId(index.getIndexCode()); + //权重 + indexInputVO.setWeight(index.getWeight()); + BigDecimal minValue = null; + BigDecimal maxValue = null; + if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(index.getIndexCode())) { + //组织内党员的联系群众能力考评分(平均值) TODO 获取最大值,最小值 + logger.info("组织内党员的联系群众能力考评分(平均值) TODO"); + /*Map contactResiAblityMap=; + minValue=contactResiAblityMap.get(StrConstant.MIN); + maxValue=contactResiAblityMap.get(StrConstant.MAX);*/ + continue; + } else { + //获取指标对应的列名 + String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode()); +// logger.info("fieldName=" + fieldName + ";index.getIndexCode()=" + index.getIndexCode()); + //最小值key + String minValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MIN); + //最大值key + String maxValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MAX); + minValue = new BigDecimal(String.valueOf(minAndMaxMap.get(minValueKey))); + maxValue = new BigDecimal(String.valueOf(minAndMaxMap.get(maxValueKey))); + } +// logger.info("minValue="+minValue+";maxValue="+maxValue); + //分值计算器 + ScoreCalculator scoreCalculator = new BigDecimalScoreCalculator(minValue, + maxValue, + ScoreConstants.MIN_SCORE, + ScoreConstants.MAX_SCORE, + Correlation.getCorrelation(index.getCorrelation()) + ); + indexInputVO.setScoreCalculator(scoreCalculator); + List> sampleValueList = new ArrayList<>(); + indexInputVO.setIndexValueVOs(sampleValueList); + + map.put(index.getIndexCode(), indexInputVO); + } + return map; + } + + /** * @param formDTO * @param indexList + * @return void * @author yinzuomei * @description 计算网格相关-治理能力 - * @Date 2020/8/26 16:47 + * @Date 2020/8/26 16:47 **/ - private void calculateGridCorreLationZhiLi(CalculateCommonFormDTO formDTO,List indexList){ + private void calculateGridCorreLationZhiLi(CalculateCommonFormDTO formDTO, List indexList) { } /** - * @return void * @param formDTO * @param indexList + * @return void * @author yinzuomei - * @description 计算网格相关-服务能力 - * @Date 2020/8/26 16:48 + * @description 计算网格相关-服务能力 + * @Date 2020/8/26 16:48 **/ - private void calculateGridCorreLationFuWu(CalculateCommonFormDTO formDTO,List indexList){ + private void calculateGridCorreLationFuWu(CalculateCommonFormDTO formDTO, List indexList) { } /** - * @return void * @param formDTO * @param indexList + * @return void * @author yinzuomei * @description 计算网格相关总分 * @Date 2020/8/26 16:50 **/ - private void calculateGridCorreLationTotal(CalculateCommonFormDTO formDTO,List indexList){ + private void calculateGridCorreLationTotal(CalculateCommonFormDTO formDTO, List indexList) { } - /** * @param customerId * @return com.epmet.dto.indexcal.CustomerGridInfoDTO @@ -150,14 +316,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { } /** - * @return * @param formDTO + * @return * @author yinzuomei * @description 分页查询网格列表 * @Date 2020/8/27 14:42 **/ @Override - public List pageGridList(PageQueryGridFormDTO formDTO){ + public List pageGridList(PageQueryGridFormDTO formDTO) { int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); formDTO.setPageIndex(pageIndex); return screenCustomerGridDao.pageListByCustomerId(formDTO); @@ -165,16 +331,15 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { /** - * @param customerId - * @param monthId + * @param formDTO * @return java.util.List * @author yinzuomei * @description 党建能力-网格相关事实表 当前客户下,所有网格的党建能力相关五级指标 * @Date 2020/8/26 15:52 **/ @Override - public List> queryListPartyAblityGrid(String customerId, String monthId) { - return factIndexPartyAblityGridMonthlyDao.selectListPartyAblityGrid(customerId, monthId); + public List> queryListPartyAblityGrid(PageQueryGridFormDTO formDTO) { + return factIndexPartyAblityGridMonthlyDao.selectListPartyAblityGrid(formDTO); } /*网格群众用户数 @@ -191,29 +356,29 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { 网格议题转项目率 组织“三会一课”次数 党员参加“三会一课”人次*/ + /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei * @description 查询党建能力,网格相关,各五级指标最大值,最小值 - * @Date 2020/8/27 12:47 + * @Date 2020/8/27 12:47 **/ - public Map queryPartyAblityGridMinAndMax(String customerId, String monthId){ - return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(customerId,monthId); + public Map queryPartyAblityGridMinAndMax(String customerId, String monthId) { + return factIndexPartyAblityGridMonthlyDao.selectPartyAblityGridMinAndMax(customerId, monthId); } - - + + /** - * @param customerId - * @param monthId + * @param formDTO * @return java.util.List * @author yinzuomei * @description 当前客户下,所有网格的治理能力相关五级指标 * @Date 2020/8/26 15:55 **/ - public List> queryListGovrnAblityGrid(String customerId, String monthId) { - return factIndexGovrnAblityGridMonthlyDao.selectListGovrnAblityGrid(customerId, monthId); + public List> queryListGovrnAblityGrid(PageQueryGridFormDTO formDTO) { + return factIndexGovrnAblityGridMonthlyDao.selectListGovrnAblityGrid(formDTO); } @@ -230,23 +395,22 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { } /** - * @param customerId - * @param monthId + * @param formDTO * @return java.util.List * @author yinzuomei * @description 当前客户下,所有网格的服务能力相关五级指标 * @Date 2020/8/26 15:55 **/ - public List> queryListServiceAblityGrid(String customerId, String monthId) { - return factIndexServiceAblityGridMonthlyDao.selectListServiceAblityGrid(customerId, monthId); + public List> queryListServiceAblityGrid(PageQueryGridFormDTO formDTO) { + return factIndexServiceAblityGridMonthlyDao.selectListServiceAblityGrid(formDTO); } /** - * @return java.util.Map * @param customerId * @param monthId + * @return java.util.Map * @author yinzuomei - * @description 查询 服务能力,网格相关,各五级指标最大值,最小值 + * @description 查询 服务能力,网格相关,各五级指标最大值,最小值 * @Date 2020/8/27 12:50 **/ public Map queryServiceAblityGridMinAndMax(String customerId, String monthId) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java index f7a31b1436..acacce6f1a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/Correlation.java @@ -14,4 +14,33 @@ public enum Correlation { this.code = code; this.desc = desc; } + + public static Correlation getCorrelation(String code){ + if (code == null) { + return Correlation.POSITIVE; + } + Correlation[] values = Correlation.values(); + for (Correlation correlation : values) { + if (code.equals(correlation.getCode())) { + return correlation; + } + } + return Correlation.POSITIVE; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java index df84c2196c..0eab3dcf4b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreCalculator.java @@ -173,7 +173,7 @@ public abstract class ScoreCalculator { */ protected BigDecimal calcuteCoefficient(BigDecimal min, BigDecimal max) { BigDecimal fenmu = max.subtract(min); - if (fenmu.toString().equals("0"))return new BigDecimal(0); + if (fenmu.compareTo(BigDecimal.ZERO)==0)return new BigDecimal(0); BigDecimal fenzi = maxScore.subtract(minScore); BigDecimal divide = fenzi.divide(fenmu, MathContext.DECIMAL32); System.out.println("分子:"+fenzi+"分母:"+fenmu+"系数:"+divide.toString()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml index 504ed412e1..e5780e24fa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml @@ -86,7 +86,7 @@ - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -105,6 +105,8 @@ m.DEL_FLAG = '0' and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + order by m.GRID_ID asc + LIMIT #{pageIndex}, #{pageSize} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml index e0ca717e07..f0d83bf06c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityGridMonthlyDao.xml @@ -102,7 +102,7 @@ - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -126,6 +126,8 @@ m.DEL_FLAG = '0' AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + order by m.GRID_ID asc + LIMIT #{pageIndex}, #{pageSize} @@ -167,4 +169,15 @@ AND m.CUSTOMER_ID =#{customerId} AND m.MONTH_ID =#{monthId} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml index fb3c488e9e..1ab7d916d0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml @@ -71,7 +71,7 @@ - SELECT m.CUSTOMER_ID, m.GRID_ID, @@ -85,6 +85,8 @@ m.DEL_FLAG = '0' and m.CUSTOMER_ID=#{customerId} and m.MONTH_ID=#{monthId} + order by m.GRID_ID asc + LIMIT #{pageIndex}, #{pageSize}