Browse Source

网格相关-暂存V3.1

dev_shibei_match
yinzuomei 5 years ago
parent
commit
93fdcc50e9
  1. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java

18
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 //每一组指标的最大值,key:code_MIN/MAX
Map<String, Object> minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); Map<String, Object> minAndMaxMap = queryPartyAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId());
//指标集合 //指标集合
Map<String, IndexInputVO<BigDecimal>> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); Map<String, IndexInputVO<BigDecimal>> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap);
List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>(); List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>();
//分页查询采集记录 //分页查询采集记录
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
@ -318,10 +318,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @param minAndMaxMap 最大值最小值集合 * @param minAndMaxMap 最大值最小值集合
* @return java.util.Map<java.lang.String, com.epmet.support.normalizing.batch.IndexInputVO> * @return java.util.Map<java.lang.String, com.epmet.support.normalizing.batch.IndexInputVO>
* @author yinzuomei * @author yinzuomei
* @description * @description 构造网格相关 指标计算参数
* @Date 2020/8/30 15:56 * @Date 2020/8/30 15:56
**/ **/
private Map<String, IndexInputVO<BigDecimal>> getIndexInputVO(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList, Map<String, Object> minAndMaxMap) { private Map<String, IndexInputVO<BigDecimal>> getGridCorrelationIndexInputVO(CalculateCommonFormDTO formDTO, List<IndexGroupDetailEntity> indexList, Map<String, Object> minAndMaxMap) {
Map<String, IndexInputVO<BigDecimal>> map = new HashMap<>(); Map<String, IndexInputVO<BigDecimal>> map = new HashMap<>();
for (int indexNum = 0; indexNum < indexList.size(); indexNum++) { for (int indexNum = 0; indexNum < indexList.size(); indexNum++) {
IndexGroupDetailEntity index = indexList.get(indexNum); IndexGroupDetailEntity index = indexList.get(indexNum);
@ -393,7 +393,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//每一组指标的最大值,key:code_MIN/MAX //每一组指标的最大值,key:code_MIN/MAX
Map<String, Object> minAndMaxMap = queryGovrnAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); Map<String, Object> minAndMaxMap = queryGovrnAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId());
//指标集合 //指标集合
Map<String, IndexInputVO<BigDecimal>> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); Map<String, IndexInputVO<BigDecimal>> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap);
List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>(); List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>();
//分页查询采集记录 //分页查询采集记录
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
@ -453,7 +453,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//每一组指标的最大值,key:code_MIN/MAX //每一组指标的最大值,key:code_MIN/MAX
Map<String, Object> minAndMaxMap = queryServiceAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId()); Map<String, Object> minAndMaxMap = queryServiceAblityGridMinAndMax(formDTO.getCustomerId(), formDTO.getMonthId());
//指标集合 //指标集合
Map<String, IndexInputVO<BigDecimal>> indexMap = getIndexInputVO(formDTO, indexList, minAndMaxMap); Map<String, IndexInputVO<BigDecimal>> indexMap = getGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap);
List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>(); List<HashMap<String, BigDecimal>> resultMapList=new ArrayList<>();
//分页查询采集记录 //分页查询采集记录
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { for (int pageNo = 1; pageNo <= totalPage; pageNo++) {
@ -500,7 +500,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
List<GridScoreDTO> gridScoreDTOList = gridScoreDao.selectList(formDTO); List<GridScoreDTO> gridScoreDTOList = gridScoreDao.selectList(formDTO);
Map<String, IndexGroupDetailEntity> indexMap = indexList.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, Function.identity())); Map<String, IndexGroupDetailEntity> indexMap = indexList.stream().collect(Collectors.toMap(IndexGroupDetailEntity::getIndexCode, Function.identity()));
List<GridScoreEntity> gridScoreEntityList = new ArrayList<>(); List<GridScoreEntity> gridScoreEntityList = new ArrayList<>();
gridScoreDTOList.forEach(gridScoreDTO -> { for(GridScoreDTO gridScoreDTO:gridScoreDTOList){
GridScoreEntity gridScoreEntity = new GridScoreEntity(); GridScoreEntity gridScoreEntity = new GridScoreEntity();
gridScoreEntity.setCustomerId(gridScoreDTO.getCustomerId()); gridScoreEntity.setCustomerId(gridScoreDTO.getCustomerId());
gridScoreEntity.setGridId(gridScoreDTO.getGridId()); gridScoreEntity.setGridId(gridScoreDTO.getGridId());
@ -512,12 +512,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
gridScoreEntity.setYearId(gridScoreDTO.getYearId()); gridScoreEntity.setYearId(gridScoreDTO.getYearId());
gridScoreEntity.setMonthId(gridScoreDTO.getMonthId()); gridScoreEntity.setMonthId(gridScoreDTO.getMonthId());
gridScoreEntity.setScore(BigDecimal.ZERO); 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()){ for(GridScoreDetailDTO gridScoreDetailDTO:gridScoreDTO.getDetailList()){
BigDecimal indexScore=gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight()); BigDecimal indexScore=gridScoreDetailDTO.getScore().multiply(indexMap.get(gridScoreDetailDTO.getIndexCode()).getWeight());
gridScoreEntity.setScore(gridScoreEntity.getScore().add(indexScore)); gridScoreEntity.setScore(gridScoreEntity.getScore().add(indexScore));
} }
gridScoreEntityList.add(gridScoreEntity); gridScoreEntityList.add(gridScoreEntity);
}); }
if (!CollectionUtils.isEmpty(gridScoreEntityList)) { if (!CollectionUtils.isEmpty(gridScoreEntityList)) {
gridScoreDao.deleteByCusAndMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, NumConstant.ONE_STR); gridScoreDao.deleteByCusAndMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, NumConstant.ONE_STR);
gridScoreDao.insertBatches(gridScoreEntityList); gridScoreDao.insertBatches(gridScoreEntityList);

Loading…
Cancel
Save