From 93fdcc50e97815fb9af9e516569884133d7d765d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 31 Aug 2020 18:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E7=9B=B8=E5=85=B3-=E6=9A=82?= =?UTF-8?q?=E5=AD=98V3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/GridCorreLationServiceImpl.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 74afb589f3..7897c2560b 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 @@ -123,7 +123,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //每一组指标的最大值,key:code_MIN/MAX Map minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); //指标集合 - Map> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); + Map> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList=new ArrayList<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { @@ -318,10 +318,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { * @param minAndMaxMap 最大值最小值集合 * @return java.util.Map * @author yinzuomei - * @description + * @description 构造网格相关 指标计算参数 * @Date 2020/8/30 15:56 **/ - private Map> getIndexInputVO(CalculateCommonFormDTO formDTO, List indexList, Map minAndMaxMap) { + private Map> getGridCorrelationIndexInputVO(CalculateCommonFormDTO formDTO, List indexList, Map minAndMaxMap) { Map> map = new HashMap<>(); for (int indexNum = 0; indexNum < indexList.size(); indexNum++) { IndexGroupDetailEntity index = indexList.get(indexNum); @@ -347,7 +347,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //获取指标对应的列名 String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode()); if(StringUtils.isBlank(fieldName)){ - logger.error("index_code:"+index.getIndexCode()+"not find field_name"); + logger.error("index_code:"+index.getIndexCode()+" not find field_name"); continue; } logger.info("INDEX_CODE=" + index.getIndexCode()+";FIELD_ID=" + fieldName ); @@ -393,7 +393,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //每一组指标的最大值,key:code_MIN/MAX Map minAndMaxMap = queryGovrnAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); //指标集合 - Map> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); + Map> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList=new ArrayList<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { @@ -453,7 +453,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { //每一组指标的最大值,key:code_MIN/MAX Map minAndMaxMap = queryServiceAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); //指标集合 - Map> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); + Map> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); List> resultMapList=new ArrayList<>(); //分页查询采集记录 for (int pageNo = 1; pageNo <= totalPage; pageNo++) { @@ -500,7 +500,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { List gridScoreDTOList = gridScoreDao.selectList(formDTO); Map indexMap = indexList.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, Function.identity())); List gridScoreEntityList = new ArrayList<>(); - gridScoreDTOList.forEach(gridScoreDTO -> { + for(GridScoreDTO gridScoreDTO:gridScoreDTOList){ GridScoreEntity gridScoreEntity = new GridScoreEntity(); gridScoreEntity.setCustomerId(gridScoreDTO.getCustomerId()); gridScoreEntity.setGridId(gridScoreDTO.getGridId()); @@ -512,12 +512,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { gridScoreEntity.setYearId(gridScoreDTO.getYearId()); gridScoreEntity.setMonthId(gridScoreDTO.getMonthId()); gridScoreEntity.setScore(BigDecimal.ZERO); + if(!CollectionUtils.isEmpty(gridScoreDTO.getDetailList())&&gridScoreDTO.getDetailList().size()!=3){ + logger.error("customerId:"+gridScoreDTO.getCustomerId()+";gridId:"+gridScoreDTO.getGridId()+";monthId:"+gridScoreDTO.getMonthId()+"能力值缺失,无法计算总值"); + continue; + } for(GridScoreDetailDTO gridScoreDetailDTO:gridScoreDTO.getDetailList()){ BigDecimal indexScore=gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight()); gridScoreEntity.setScore(gridScoreEntity.getScore().add(indexScore)); } gridScoreEntityList.add(gridScoreEntity); - }); + } if (!CollectionUtils.isEmpty(gridScoreEntityList)) { gridScoreDao.deleteByCusAndMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, NumConstant.ONE_STR); gridScoreDao.insertBatches(gridScoreEntityList);