Browse Source

修改IndexCalculateService包路径

dev_shibei_match
yinzuomei 5 years ago
parent
commit
7e53f5e9d0
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/IndexCalculateService.java
  4. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
  5. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCalculateServiceImpl.java

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -21,8 +21,6 @@ import com.epmet.service.indexcal.GridCorreLationService;
import com.epmet.service.screen.IndexCalculateCommunityService; import com.epmet.service.screen.IndexCalculateCommunityService;
import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimAgencyService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java

@ -5,7 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.IndexCalculateForm; import com.epmet.dto.screen.form.IndexCalculateForm;
import com.epmet.service.indexcal.CpcIndexCalculateService; import com.epmet.service.indexcal.CpcIndexCalculateService;
import com.epmet.service.screen.IndexCalculateService; import com.epmet.service.indexcal.IndexCalculateService;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexCalculateService.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/IndexCalculateService.java

@ -1,4 +1,4 @@
package com.epmet.service.screen; package com.epmet.service.indexcal;
import com.epmet.dto.screen.form.IndexCalculateForm; import com.epmet.dto.screen.form.IndexCalculateForm;
@ -10,7 +10,7 @@ import com.epmet.dto.screen.form.IndexCalculateForm;
*/ */
public interface IndexCalculateService { public interface IndexCalculateService {
/** /**
* desc计算党员相关指标 * desc按照客户计算所有指标(按照月份)
* @param formDTO * @param formDTO
* @return * @return
*/ */

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java

@ -25,9 +25,8 @@ import com.epmet.service.indexcal.IndexCodeFieldReService;
import com.epmet.service.screen.IndexGroupDetailService; import com.epmet.service.screen.IndexGroupDetailService;
import com.epmet.support.normalizing.*; import com.epmet.support.normalizing.*;
import com.epmet.support.normalizing.batch.*; import com.epmet.support.normalizing.batch.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -44,9 +43,9 @@ import java.util.stream.Collectors;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/8/26 10:35 * @date 2020/8/26 10:35
*/ */
@Slf4j
@Service @Service
public class GridCorreLationServiceImpl implements GridCorreLationService { public class GridCorreLationServiceImpl implements GridCorreLationService {
private Logger logger = LogManager.getLogger(GridCorreLationServiceImpl.class);
@Autowired @Autowired
private FactIndexGovrnAblityGridMonthlyDao factIndexGovrnAblityGridMonthlyDao; private FactIndexGovrnAblityGridMonthlyDao factIndexGovrnAblityGridMonthlyDao;
@Autowired @Autowired
@ -81,7 +80,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(dangJianNengLiList)) { if (CollectionUtils.isEmpty(dangJianNengLiList)) {
logger.warn("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.warn("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:党建能力】指标权重信息不存在"); throw new RenException("客户【网格相关:党建能力】指标权重信息不存在");
} }
calculateGridDangJian(formDTO, dangJianNengLiList); calculateGridDangJian(formDTO, dangJianNengLiList);
@ -90,7 +89,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
if (CollectionUtils.isEmpty(zhiLiNengLiList)) { if (CollectionUtils.isEmpty(zhiLiNengLiList)) {
logger.warn("calculateGridZhiLi customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.warn("calculateGridZhiLi customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:治理能力】指标权重信息不存在"); throw new RenException("客户【网格相关:治理能力】指标权重信息不存在");
} }
calculateGridZhiLi(formDTO, zhiLiNengLiList); calculateGridZhiLi(formDTO, zhiLiNengLiList);
@ -99,7 +98,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
IndexCodeEnum.FU_WU_NENG_LI.getCode()); IndexCodeEnum.FU_WU_NENG_LI.getCode());
if (CollectionUtils.isEmpty(fuWuNengLiList)) { if (CollectionUtils.isEmpty(fuWuNengLiList)) {
logger.warn("calculateGridFuWu customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.warn("calculateGridFuWu customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:服务能力】指标权重信息不存在"); throw new RenException("客户【网格相关:服务能力】指标权重信息不存在");
} }
calculateGridFuWu(formDTO, fuWuNengLiList); calculateGridFuWu(formDTO, fuWuNengLiList);
@ -107,7 +106,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
List<IndexGroupDetailEntity> wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), List<IndexGroupDetailEntity> wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
if (CollectionUtils.isEmpty(wgxgList)) { if (CollectionUtils.isEmpty(wgxgList)) {
logger.warn("calculateGridTotal customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); log.warn("calculateGridTotal customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关】指标权重信息不存在"); throw new RenException("客户【网格相关】指标权重信息不存在");
} }
calculateGridTotal(formDTO, wgxgList, IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode()); calculateGridTotal(formDTO, wgxgList, IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
@ -129,16 +128,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//查询总记录数 //查询总记录数
int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO); int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO);
if (NumConstant.ZERO == total) { if (NumConstant.ZERO == total) {
logger.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); log.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId()));
return; return;
} }
//总页数,进行批量查询,批量计算 //总页数,进行批量查询,批量计算
int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE);
logger.info(String.format("共%s条数据,分%s次计算", total, totalPage)); log.info(String.format("共%s条数据,分%s次计算", total, totalPage));
//每一组指标的最大值,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());
if (CollectionUtils.isEmpty(minAndMaxMap)) { if (CollectionUtils.isEmpty(minAndMaxMap)) {
logger.error("calculateGridDangJian queryPartyAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); log.error("calculateGridDangJian queryPartyAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId());
return; return;
} }
//指标集合 //指标集合
@ -157,11 +156,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
recordList.forEach(recordMap -> { recordList.forEach(recordMap -> {
//遍历所有的指标 //遍历所有的指标
indexMap.forEach((key, value) -> { indexMap.forEach((key, value) -> {
logger.info("index_code :{}",key); log.info("index_code :{}",key);
//列名不为空
if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) { if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(key)) {
//组织内党员的联系群众能力考评分(平均值) //组织内党员的联系群众能力考评分(平均值)
// logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理"); // log.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
//网格内党员的联系群众能力考评分(平均值) //网格内党员的联系群众能力考评分(平均值)
String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID);
BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(formDTO, gridId); BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(formDTO, gridId);
@ -192,7 +190,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
**/ **/
private Map<String, BigDecimal> getContactMassesAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) { private Map<String, BigDecimal> getContactMassesAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>(); Map<String, BigDecimal> map = new HashMap<>();
List<BigDecimal> list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO); /*List<BigDecimal> list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
BigDecimal minValue = Collections.min(list); BigDecimal minValue = Collections.min(list);
BigDecimal maxValue = Collections.max(list); BigDecimal maxValue = Collections.max(list);
@ -201,10 +199,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
return map; return map;
} }
map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR)); map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR));
map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR)); map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR));*/
//FOR TEST //FOR TEST
/*map.put(StrConstant.MIN, new BigDecimal("24.35")); map.put(StrConstant.MIN, new BigDecimal("24.35"));
map.put(StrConstant.MAX, new BigDecimal("46.13"));*/ map.put(StrConstant.MAX, new BigDecimal("46.13"));
return map; return map;
} }
@ -217,19 +215,19 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @Date 2020/8/31 9:50 * @Date 2020/8/31 9:50
**/ **/
private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) {
BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); /*BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId);
if (null == result) { if (null == result) {
return new BigDecimal(NumConstant.ZERO_STR); return new BigDecimal(NumConstant.ZERO_STR);
} }*/
//FOR TEST //FOR TEST
/* BigDecimal result=null; BigDecimal result=null;
if(IndexCalConstant.S1_C1_G1.equals(gridId)){ if(IndexCalConstant.S1_C1_G1.equals(gridId)){
result= new BigDecimal("24.43"); result= new BigDecimal("24.43");
}else if(IndexCalConstant.S1_C1_G2.equals(gridId)){ }else if(IndexCalConstant.S1_C1_G2.equals(gridId)){
result=new BigDecimal("46.13"); result=new BigDecimal("46.13");
}else if(IndexCalConstant.S1_C2_G1.equals(gridId)){ }else if(IndexCalConstant.S1_C2_G1.equals(gridId)){
result=new BigDecimal("24.35"); result=new BigDecimal("24.35");
}*/ }
return result; return result;
} }
@ -242,19 +240,19 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @Date 2020/8/31 15:51 * @Date 2020/8/31 15:51
**/ **/
private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) {
BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); /*BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId);
if (null == result) { if (null == result) {
return new BigDecimal(NumConstant.ZERO_STR); return new BigDecimal(NumConstant.ZERO_STR);
} }*/
//FOR TEST //FOR TEST
/*BigDecimal result=null; BigDecimal result=null;
if(IndexCalConstant.S1_C1_G1.equals(gridId)){ if(IndexCalConstant.S1_C1_G1.equals(gridId)){
result= new BigDecimal("29.40"); result= new BigDecimal("29.40");
}else if(IndexCalConstant.S1_C1_G2.equals(gridId)){ }else if(IndexCalConstant.S1_C1_G2.equals(gridId)){
result=new BigDecimal("18.30"); result=new BigDecimal("18.30");
}else if(IndexCalConstant.S1_C2_G1.equals(gridId)){ }else if(IndexCalConstant.S1_C2_G1.equals(gridId)){
result=new BigDecimal("9.15"); result=new BigDecimal("9.15");
}*/ }
return result; return result;
} }
@ -267,7 +265,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
**/ **/
private Map<String, BigDecimal> getJoinIssueAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) { private Map<String, BigDecimal> getJoinIssueAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>(); Map<String, BigDecimal> map = new HashMap<>();
List<BigDecimal> list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO); /*List<BigDecimal> list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
BigDecimal minValue = Collections.min(list); BigDecimal minValue = Collections.min(list);
BigDecimal maxValue = Collections.max(list); BigDecimal maxValue = Collections.max(list);
@ -276,10 +274,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
return map; return map;
} }
map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR)); map.put(StrConstant.MIN, new BigDecimal(NumConstant.ZERO_STR));
map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR)); map.put(StrConstant.MAX, new BigDecimal(NumConstant.ZERO_STR));*/
// FOR TEST // FOR TEST
/*map.put(StrConstant.MIN, new BigDecimal("9.15")); map.put(StrConstant.MIN, new BigDecimal("9.15"));
map.put(StrConstant.MAX, new BigDecimal("29.4"));*/ map.put(StrConstant.MAX, new BigDecimal("29.4"));
return map; return map;
} }
@ -302,7 +300,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
String yearId = DateUtils.getYearId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId());
for (HashMap<String, BigDecimal> resultMap : resultMapList) { for (HashMap<String, BigDecimal> resultMap : resultMapList) {
resultMap.forEach((gridId, partyAblityScore) -> { resultMap.forEach((gridId, partyAblityScore) -> {
logger.info("网格id:" + gridId + ";index_Code:"+indexCode+";分值:" + partyAblityScore); log.info("网格id:" + gridId + ";index_Code:"+indexCode+";分值:" + partyAblityScore);
GridScoreEntity gridScoreEntity = new GridScoreEntity(); GridScoreEntity gridScoreEntity = new GridScoreEntity();
gridScoreEntity.setCustomerId(formDTO.getCustomerId()); gridScoreEntity.setCustomerId(formDTO.getCustomerId());
gridScoreEntity.setGridId(gridId); gridScoreEntity.setGridId(gridId);
@ -340,15 +338,15 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
private HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) { private HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) {
//构造入参 //构造入参
List<IndexInputVO> indexInputVOS = this.getIndexInputVOList(indexMap); List<IndexInputVO> indexInputVOS = this.getIndexInputVOList(indexMap);
logger.info("计算的参数"+JSON.toJSONString(indexInputVOS)); log.info("计算的参数"+JSON.toJSONString(indexInputVOS));
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
//如果想看每一个指标的分值调用下面的方法 //如果想看每一个指标的分值调用下面的方法
/*List<IndexOutputVO> listTemp=batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS); List<IndexOutputVO> listTemp=batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
logger.info("计算的结果(List)"+JSON.toJSONString(listTemp));*/ log.info("计算的结果(List)"+JSON.toJSONString(listTemp));
HashMap<String, BigDecimal> resultMap = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); HashMap<String, BigDecimal> resultMap = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
logger.info("计算的结果{}", resultMap); log.info("计算的结果{}", resultMap);
return resultMap; return resultMap;
} }
@ -384,12 +382,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
BigDecimal maxValue = null; BigDecimal maxValue = null;
if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(index.getIndexCode())) { if (IndexCodeEnum.ZUZHINEIDANGYDLXQZNLKPFPJZ.getCode().equals(index.getIndexCode())) {
//组织内党员的联系群众能力考评分(平均值) 获取最大值,最小值 //组织内党员的联系群众能力考评分(平均值) 获取最大值,最小值
// logger.info("组织内党员的联系群众能力考评分(平均值) 单独处理"); // log.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
Map<String, BigDecimal> contactMassesAblityMap = this.getContactMassesAblityMap(formDTO); Map<String, BigDecimal> contactMassesAblityMap = this.getContactMassesAblityMap(formDTO);
minValue = contactMassesAblityMap.get(StrConstant.MIN); minValue = contactMassesAblityMap.get(StrConstant.MIN);
maxValue = contactMassesAblityMap.get(StrConstant.MAX); maxValue = contactMassesAblityMap.get(StrConstant.MAX);
} else if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(index.getIndexCode())) { } else if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(index.getIndexCode())) {
// logger.info("组织内党员的参与议事能力考评分(平均值) 单独处理"); // log.info("组织内党员的参与议事能力考评分(平均值) 单独处理");
Map<String, BigDecimal> joinIssueAblityMap = this.getJoinIssueAblityMap(formDTO); Map<String, BigDecimal> joinIssueAblityMap = this.getJoinIssueAblityMap(formDTO);
minValue = joinIssueAblityMap.get(StrConstant.MIN); minValue = joinIssueAblityMap.get(StrConstant.MIN);
maxValue = joinIssueAblityMap.get(StrConstant.MAX); maxValue = joinIssueAblityMap.get(StrConstant.MAX);
@ -397,10 +395,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//获取指标对应的列名 //获取指标对应的列名
String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode()); String fieldName = indexCodeFieldReService.getFieldNameByIndexCode(index.getIndexCode());
if (StringUtils.isBlank(fieldName)) { if (StringUtils.isBlank(fieldName)) {
logger.error("index_code:{} not find field_name",index.getIndexCode()); log.error("index_code:{} not find field_name",index.getIndexCode());
continue; continue;
} }
// logger.info("index_code2:{} ,field_name:{}",index.getIndexCode(),fieldName); // log.info("index_code2:{} ,field_name:{}",index.getIndexCode(),fieldName);
String minValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MIN); String minValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MIN);
String maxValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MAX); String maxValueKey = fieldName.concat(StrConstant.UNDER_LINE).concat(StrConstant.MAX);
minValue = new BigDecimal(String.valueOf(minAndMaxMap.get(minValueKey))); minValue = new BigDecimal(String.valueOf(minAndMaxMap.get(minValueKey)));
@ -416,8 +414,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
List<SampleValue<BigDecimal>> sampleValueList = new ArrayList<>(); List<SampleValue<BigDecimal>> sampleValueList = new ArrayList<>();
IndexInputVO indexInputVO1 = new IndexInputVO(index.getIndexCode(), IndexInputVO indexInputVO1 = new IndexInputVO(index.getIndexCode(),
sampleValueList, sampleValueList,
index.getThreshold(), // index.getThreshold(),
// new BigDecimal("-1"),//FOR TEST new BigDecimal("-1"),//FOR TEST
index.getWeight(), index.getWeight(),
scoreCalculator); scoreCalculator);
map.put(index.getIndexCode(), indexInputVO1); map.put(index.getIndexCode(), indexInputVO1);
@ -437,16 +435,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//查询总记录数 //查询总记录数
int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO); int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO);
if (NumConstant.ZERO == total) { if (NumConstant.ZERO == total) {
logger.warn(String.format("customerId%s,monthId%s,没有上传网格相关-治理能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); log.warn(String.format("customerId%s,monthId%s,没有上传网格相关-治理能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId()));
return; return;
} }
//总页数,进行批量查询,批量计算 //总页数,进行批量查询,批量计算
int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE);
logger.info(String.format("共%s条数据,分%s次计算", total, totalPage)); log.info(String.format("共%s条数据,分%s次计算", total, totalPage));
//每一组指标的最大值,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());
if (CollectionUtils.isEmpty(minAndMaxMap)) { if (CollectionUtils.isEmpty(minAndMaxMap)) {
logger.error("calculateGridZhiLi queryGovrnAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); log.error("calculateGridZhiLi queryGovrnAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId());
return; return;
} }
//指标集合 //指标集合
@ -465,9 +463,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
recordList.forEach(recordMap -> { recordList.forEach(recordMap -> {
//遍历所有的指标 //遍历所有的指标
indexMap.forEach((key, value) -> { indexMap.forEach((key, value) -> {
//列名不为空
if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(key)) { if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(key)) {
// logger.info("组织内党员的参与议事能力考评分(平均值) 单独处理"); // log.info("组织内党员的参与议事能力考评分(平均值) 单独处理");
String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID);
BigDecimal joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId); BigDecimal joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId);
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue); SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue);
@ -501,16 +498,16 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//查询总记录数 //查询总记录数
int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO); int total = factIndexGovrnAblityGridMonthlyDao.selectCount(formDTO);
if (NumConstant.ZERO == total) { if (NumConstant.ZERO == total) {
logger.warn(String.format("customerId:%s,monthId:%s,没有上传网格相关-服务能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); log.warn(String.format("customerId:%s,monthId:%s,没有上传网格相关-服务能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId()));
return; return;
} }
//总页数,进行批量查询,批量计算 //总页数,进行批量查询,批量计算
int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE); int totalPage = (int) Math.ceil((double) total / IndexCalConstant.PAGE_SIZE);
logger.info(String.format("共%s条数据,分%s次计算", total, totalPage)); log.info(String.format("共%s条数据,分%s次计算", total, totalPage));
//每一组指标的最大值,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());
if (CollectionUtils.isEmpty(minAndMaxMap)) { if (CollectionUtils.isEmpty(minAndMaxMap)) {
logger.error("calculateGridFuWu queryServiceAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId()); log.error("calculateGridFuWu queryServiceAblityGridMinAndMax customerId:{} monthId:{} have not any fact record", formDTO.getCustomerId(),formDTO.getMonthId());
return; return;
} }
//指标集合 //指标集合
@ -529,7 +526,6 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
recordList.forEach(recordMap -> { recordList.forEach(recordMap -> {
//遍历所有的指标 //遍历所有的指标
indexMap.forEach((key, value) -> { indexMap.forEach((key, value) -> {
//列名不为空
if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) {
//对应的数值 //对应的数值
String sampleValueStr = String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key))); String sampleValueStr = String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key)));
@ -537,7 +533,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
SampleValue<BigDecimal> currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr)); SampleValue<BigDecimal> currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr));
value.getIndexValueVOs().add(currentGridIndexValue); value.getIndexValueVOs().add(currentGridIndexValue);
} else { } else {
logger.error("index_code:" + key + " not find field_name"); log.error("index_code:" + key + " not find field_name");
} }
}); });
}); });
@ -560,7 +556,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//查询总记录数 //查询总记录数
List<GridScoreDTO> gridScoreDTOList = gridScoreDao.selectList(formDTO); List<GridScoreDTO> gridScoreDTOList = gridScoreDao.selectList(formDTO);
if(CollectionUtils.isEmpty(gridScoreDTOList)){ if(CollectionUtils.isEmpty(gridScoreDTOList)){
logger.error("calculateGridTotal gridScoreDao.selectList return empty,customerId:{},monthId:{}", formDTO.getCustomerId(), formDTO.getMonthId()); log.error("calculateGridTotal gridScoreDao.selectList return empty,customerId:{},monthId:{}", formDTO.getCustomerId(), formDTO.getMonthId());
throw new RenException("客户一级指标分值记录不存在"); throw new RenException("客户一级指标分值记录不存在");
} }
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()));
@ -571,7 +567,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
gridScoreEntity.setIndexCode(indexCode); gridScoreEntity.setIndexCode(indexCode);
gridScoreEntity.setScore(BigDecimal.ZERO); gridScoreEntity.setScore(BigDecimal.ZERO);
if (!CollectionUtils.isEmpty(gridScoreDTO.getDetailList()) && gridScoreDTO.getDetailList().size() != 3) { if (!CollectionUtils.isEmpty(gridScoreDTO.getDetailList()) && gridScoreDTO.getDetailList().size() != 3) {
logger.error("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失,无法计算总值"); log.error("customerId:" + gridScoreDTO.getCustomerId() + ";gridId:" + gridScoreDTO.getGridId() + ";monthId:" + gridScoreDTO.getMonthId() + "能力值缺失,无法计算总值");
continue; continue;
} }
for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) { for (GridScoreDetailDTO gridScoreDetailDTO : gridScoreDTO.getDetailList()) {

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexCalculateServiceImpl.java → epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/IndexCalculateServiceImpl.java

@ -1,4 +1,4 @@
package com.epmet.service.screen.impl; package com.epmet.service.indexcal.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
@ -9,8 +9,8 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCodeFieldReRedis; import com.epmet.redis.IndexCodeFieldReRedis;
import com.epmet.service.indexcal.CpcIndexCalculateService; import com.epmet.service.indexcal.CpcIndexCalculateService;
import com.epmet.service.indexcal.GridCorreLationService; import com.epmet.service.indexcal.GridCorreLationService;
import com.epmet.service.indexcal.IndexCalculateService;
import com.epmet.service.screen.IndexCalculateCommunityService; import com.epmet.service.screen.IndexCalculateCommunityService;
import com.epmet.service.screen.IndexCalculateService;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -23,6 +23,7 @@ import java.util.List;
/** /**
* @author liujianjun * @author liujianjun
* 指标计算service
*/ */
@Slf4j @Slf4j
@Service @Service
Loading…
Cancel
Save