diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java index 3088f29531..25e10869ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java @@ -4,10 +4,10 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.screen.IndexCodeFieldReEntity; import org.apache.ibatis.annotations.Mapper; -import java.util.Map; +import java.util.List; @Mapper public interface IndexCodeFieldReDao extends BaseDao { - Map getAllData(); + List getAllData(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java index b03b0f948d..0367e90137 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/CpcIndexCalculateServiceImpl.java @@ -48,9 +48,13 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { log.warn("cpcIndexCalculate have any indexcodefieldre"); return false; } - indexDetails.forEach(indexDetail->{ + String indexCode = null; + String fieldName = null; + for (IndexGroupDetailEntity indexDetail : indexDetails) { + indexCode = indexDetail.getIndexCode(); + fieldName = indexCodeFieldReService.getFieldNameByIndexCode(indexCode); - }); + } log.info(JSON.toJSONString(minAndMaxList)); Map list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java index 46ecffbcae..94189a9c77 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCodeFieldReServiceImpl.java @@ -1,13 +1,17 @@ package com.epmet.service.indexcal.impl; import com.epmet.dao.screen.IndexCodeFieldReDao; +import com.epmet.entity.screen.IndexCodeFieldReEntity; import com.epmet.redis.IndexCodeFieldReRedis; import com.epmet.service.indexcal.IndexCodeFieldReService; import org.springframework.beans.factory.annotation.Autowired; 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; @Service public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService { @@ -21,7 +25,11 @@ public class IndexCodeFieldReServiceImpl implements IndexCodeFieldReService { public Map getIndexCodeFieldReMap() { Map indexCodeFiledReMap = indexCodeFieldReRedis.getIndexCodeFiledReMap(); if (CollectionUtils.isEmpty(indexCodeFiledReMap)) { - indexCodeFiledReMap = indexCodeFieldReDao.getAllData(); + List allData = indexCodeFieldReDao.getAllData(); + if (CollectionUtils.isEmpty(allData)){ + return new HashMap<>(); + } + indexCodeFiledReMap = allData.stream().collect(Collectors.toMap(IndexCodeFieldReEntity::getIndexCode, o -> o.getFieldId())); indexCodeFieldReRedis.setIndexCodeFiledReMap(indexCodeFiledReMap); } return indexCodeFiledReMap; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml index 769689fa7f..41946192dd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml @@ -96,6 +96,10 @@ - SELECT INDEX_CODE,FIELD_ID FROM index_code_field_re WHERE DEL_FLAG = '0'; + + \ No newline at end of file