Browse Source

测试网格相关

dev_shibei_match
yinzuomei 5 years ago
parent
commit
9059e8f518
  1. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java
  2. 318
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  3. 59
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcal/impl/GridCorreLationServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java

@ -34,4 +34,23 @@ public interface IndexCalConstant {
String COMMUNITY_PARTY_AVG = "xiazhusuoyouwgddjnlpjz";
String COMMUNITY_RELATE = "shequxiangguan";
// 测试插入数据用
String customerId="b09527201c4409e19d1dbc5e3c3429a1";
//社区S1-C1
String SHE_QU_S1_C1="S1-C1";
//社区S1-C2
String SHE_QU_S1_C2="S1-C2";
//网格S1-C1-G1
String S1_C1_G1="S1-C1-G1";
//网格S1-C1-G2
String S1_C1_G2="S1-C1-G2";
//网格S1-C2-G1
String S1_C2_G1="S1-C2-G1";
String monthId="202008";
String insertUser="yinzuomei";
}

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

@ -1,22 +1,35 @@
package com.epmet.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexPartyAblityGridMonthlyDao;
import com.epmet.dao.indexcoll.FactIndexServiceAblityGridMonthlyDao;
import com.epmet.dao.indexscore.GridScoreDao;
import com.epmet.dao.screen.ScreenCustomerGridDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.indexcoll.FactIndexGovrnAblityGridMonthlyEntity;
import com.epmet.entity.indexcoll.FactIndexPartyAblityGridMonthlyEntity;
import com.epmet.entity.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import com.epmet.entity.screen.ScreenCustomerGridEntity;
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;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.ExecutionException;
@ -27,7 +40,6 @@ import java.util.concurrent.Future;
@RestController
@Slf4j
public class DemoController {
@Autowired
private StatsDemoService demoService;
@ -149,4 +161,306 @@ public class DemoController {
return new Result();
}
@Autowired
private GridScoreDao gridScoreDao;
@Autowired
private FactIndexPartyAblityGridMonthlyDao factIndexPartyAblityGridMonthlyDao;
@Autowired
private FactIndexGovrnAblityGridMonthlyDao factIndexGovrnAblityGridMonthlyDao;
@Autowired
private FactIndexServiceAblityGridMonthlyDao factIndexServiceAblityGridMonthlyDao;
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
// private static Integer testcal=100;
@PostMapping("testcal")
public Result testCal(){
CalculateCommonFormDTO formDTO=new CalculateCommonFormDTO("b09527201c4409e19d1dbc5e3c3429a1","202008");
// //查询总记录数
// List<GridScoreDTO> gridScoreDTOList=gridScoreDao.selectList(formDTO);
// return new Result<List<GridScoreDTO>>().ok(gridScoreDTOList);
gridCorreLationService.calculateGridCorreLation(formDTO);
return new Result();
}
@PostMapping("insertgridinfo")
public Result insertScreenCustomerGrid(){
ScreenCustomerGridEntity entity1=new ScreenCustomerGridEntity();
entity1.setCustomerId(IndexCalConstant.customerId);
entity1.setGridId(IndexCalConstant.S1_C1_G1);
entity1.setGridName("网格S1-C1-G1");
entity1.setParentAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity1.setAllParentIds("S1,C1");
entity1.setCreatedBy(IndexCalConstant.insertUser);
entity1.setUpdatedBy(IndexCalConstant.insertUser);
entity1.setDataEndTime("20200901");
screenCustomerGridDao.insert(entity1);
ScreenCustomerGridEntity entity2=new ScreenCustomerGridEntity();
entity2.setCustomerId(IndexCalConstant.customerId);
entity2.setGridId(IndexCalConstant.S1_C1_G2);
entity2.setGridName("网格S1-C1-G2");
entity2.setParentAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity2.setAllParentIds("S1,C1");
entity2.setCreatedBy(IndexCalConstant.insertUser);
entity2.setUpdatedBy(IndexCalConstant.insertUser);
entity2.setDataEndTime("20200901");
screenCustomerGridDao.insert(entity2);
ScreenCustomerGridEntity entity3=new ScreenCustomerGridEntity();
entity3.setCustomerId(IndexCalConstant.customerId);
entity3.setGridId(IndexCalConstant.S1_C2_G1);
entity3.setGridName("网格S1-C2-G1");
entity3.setParentAgencyId(IndexCalConstant.SHE_QU_S1_C2);
entity3.setAllParentIds("S1,C2");
entity3.setCreatedBy(IndexCalConstant.insertUser);
entity3.setUpdatedBy(IndexCalConstant.insertUser);
entity3.setDataEndTime("20200901");
screenCustomerGridDao.insert(entity3);
return new Result();
}
@PostMapping("inserttestdata")
public Result test(){
//网格相关-党建能力
FactIndexPartyAblityGridMonthlyEntity entity1=this.getPartyAblityGridMonthlyEntity1();
factIndexPartyAblityGridMonthlyDao.insert(entity1);
FactIndexPartyAblityGridMonthlyEntity entity2=this.getPartyAblityGridMonthlyEntity2();
factIndexPartyAblityGridMonthlyDao.insert(entity2);
FactIndexPartyAblityGridMonthlyEntity entity3=this.getPartyAblityGridMonthlyEntity3();
factIndexPartyAblityGridMonthlyDao.insert(entity3);
//网格相关-治理能力
FactIndexGovrnAblityGridMonthlyEntity zhiliEntity1=this.getGovrnAblityGridMonthlyEntity1();
factIndexGovrnAblityGridMonthlyDao.insert(zhiliEntity1);
FactIndexGovrnAblityGridMonthlyEntity zhiliEntity2=this.getGovrnAblityGridMonthlyEntity2();
factIndexGovrnAblityGridMonthlyDao.insert(zhiliEntity2);
FactIndexGovrnAblityGridMonthlyEntity zhiliEntity3=this.getGovrnAblityGridMonthlyEntity3();
factIndexGovrnAblityGridMonthlyDao.insert(zhiliEntity3);
//网格相关-服务能力
FactIndexServiceAblityGridMonthlyEntity fuwuEntity1=this.getServiceAblityGridMonthlyEntity1();
factIndexServiceAblityGridMonthlyDao.insert(fuwuEntity1);
FactIndexServiceAblityGridMonthlyEntity fuwuEntity2=this.getServiceAblityGridMonthlyEntity2();
factIndexServiceAblityGridMonthlyDao.insert(fuwuEntity2);
FactIndexServiceAblityGridMonthlyEntity fuwuEntity3=this.getServiceAblityGridMonthlyEntity3();
factIndexServiceAblityGridMonthlyDao.insert(fuwuEntity3);
return new Result();
}
//网格相关-党建能力-网格1
private FactIndexPartyAblityGridMonthlyEntity getPartyAblityGridMonthlyEntity1() {
FactIndexPartyAblityGridMonthlyEntity entity1=new FactIndexPartyAblityGridMonthlyEntity();
entity1.setCustomerId(IndexCalConstant.customerId);
entity1.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity1.setGridId(IndexCalConstant.S1_C1_G1);
entity1.setMonthId(IndexCalConstant.monthId);
entity1.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity1.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity1.setUserCount(10); // 网格群众用户数
entity1.setPartyCount(50); // 网格党员用户数
entity1.setActiveUserCount(100); // 网格活跃群众用户数
entity1.setActivePartyCount(80); //网格活跃党员用户数
entity1.setPartyAvgTopicCount(30); //网格党员人均提出话题数
entity1.setUserAvgTopicCount(10); //网格群众人均提出话题数
entity1.setPartyAvgShiftProjectCount(50); //网格党员人均提出的议题转项目数
entity1.setUserAvgShiftProjectCount(50); //网格群众人均提出的议题转项目数
entity1.setCreateGroupPartyCount(35); //建群党员数(累计值) 去重
entity1.setPublishArticleCount(35); //网格发文数
entity1.setIssueToProjectRatio(new BigDecimal("50")); //网格议题转项目率
entity1.setCreateThreeMeetsCount(10); //组织三会一课次数
entity1.setJoinThreeMeetsCount(30); //党员参加三会一课人次
entity1.setCreatedBy(IndexCalConstant.insertUser);
entity1.setUpdatedBy(IndexCalConstant.insertUser);
return entity1;
}
//网格相关-党建能力-网格2
private FactIndexPartyAblityGridMonthlyEntity getPartyAblityGridMonthlyEntity2() {
FactIndexPartyAblityGridMonthlyEntity entity2=new FactIndexPartyAblityGridMonthlyEntity();
entity2.setCustomerId(IndexCalConstant.customerId);
entity2.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity2.setGridId(IndexCalConstant.S1_C1_G2);
entity2.setMonthId(IndexCalConstant.monthId);
entity2.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity2.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity2.setUserCount(20); // 网格群众用户数
entity2.setPartyCount(30); // 网格党员用户数
entity2.setActiveUserCount(20); // 网格活跃群众用户数
entity2.setActivePartyCount(20); //网格活跃党员用户数
entity2.setPartyAvgTopicCount(10); //网格党员人均提出话题数
entity2.setUserAvgTopicCount(50); //网格群众人均提出话题数
entity2.setPartyAvgShiftProjectCount(35); //网格党员人均提出的议题转项目数
entity2.setUserAvgShiftProjectCount(55); //网格群众人均提出的议题转项目数
entity2.setCreateGroupPartyCount(30); //建群党员数(累计值) 去重
entity2.setPublishArticleCount(30); //网格发文数
entity2.setIssueToProjectRatio(new BigDecimal("30")); //网格议题转项目率
entity2.setCreateThreeMeetsCount(25); //组织三会一课次数
entity2.setJoinThreeMeetsCount(20); //党员参加三会一课人次
entity2.setCreatedBy(IndexCalConstant.insertUser);
entity2.setUpdatedBy(IndexCalConstant.insertUser);
return entity2;
}
//网格相关-党建能力-网格3
private FactIndexPartyAblityGridMonthlyEntity getPartyAblityGridMonthlyEntity3() {
FactIndexPartyAblityGridMonthlyEntity entity3=new FactIndexPartyAblityGridMonthlyEntity();
entity3.setCustomerId(IndexCalConstant.customerId);
entity3.setAgencyId(IndexCalConstant.SHE_QU_S1_C2);
entity3.setGridId(IndexCalConstant.S1_C2_G1);
entity3.setMonthId(IndexCalConstant.monthId);
entity3.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity3.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity3.setUserCount(60); // 网格群众用户数
entity3.setPartyCount(80); // 网格党员用户数
entity3.setActiveUserCount(70); // 网格活跃群众用户数
entity3.setActivePartyCount(70); //网格活跃党员用户数
entity3.setPartyAvgTopicCount(40); //网格党员人均提出话题数
entity3.setUserAvgTopicCount(20); //网格群众人均提出话题数
entity3.setPartyAvgShiftProjectCount(30); //网格党员人均提出的议题转项目数
entity3.setUserAvgShiftProjectCount(30); //网格群众人均提出的议题转项目数
entity3.setCreateGroupPartyCount(20); //建群党员数(累计值) 去重
entity3.setPublishArticleCount(80); //网格发文数
entity3.setIssueToProjectRatio(new BigDecimal("80")); //网格议题转项目率
entity3.setCreateThreeMeetsCount(100); //组织三会一课次数
entity3.setJoinThreeMeetsCount(100); //党员参加三会一课人次
entity3.setCreatedBy(IndexCalConstant.insertUser);
entity3.setUpdatedBy(IndexCalConstant.insertUser);
return entity3;
}
//网格相关-治理能力-网格1
private FactIndexGovrnAblityGridMonthlyEntity getGovrnAblityGridMonthlyEntity1() {
FactIndexGovrnAblityGridMonthlyEntity entity=new FactIndexGovrnAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity.setGridId(IndexCalConstant.S1_C1_G1);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setIssueTotal(100); //网格总议题数
entity.setAvgIssueCount(100); //网格人均议题数目
entity.setAvgShiftProjectRatio(new BigDecimal("20")); //网格议题转项目率
entity.setProjectTotal(20);// 网格总项目数
entity.setSelfSolveProjectCount(10); // 网格自治项目数 统计期网格自身内办结的项目数目
entity.setResolveProjectCount(100);//网格办结项目数 统计期内办结的项目数目
entity.setTransferRightRatio(new BigDecimal("100"));//网格吹哨部门准确率
entity.setSatisfactionRatio(new BigDecimal("100"));//网格内解决的项目的满意度
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
//网格相关-治理能力-网格2
private FactIndexGovrnAblityGridMonthlyEntity getGovrnAblityGridMonthlyEntity2() {
FactIndexGovrnAblityGridMonthlyEntity entity=new FactIndexGovrnAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity.setGridId(IndexCalConstant.S1_C1_G2);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setIssueTotal(70); //网格总议题数
entity.setAvgIssueCount(10); //网格人均议题数目
entity.setAvgShiftProjectRatio(new BigDecimal("20")); //网格议题转项目率
entity.setProjectTotal(40);// 网格总项目数
entity.setSelfSolveProjectCount(15); // 网格自治项目数 统计期网格自身内办结的项目数目
entity.setResolveProjectCount(20);//网格办结项目数 统计期内办结的项目数目
entity.setTransferRightRatio(new BigDecimal("10"));//网格吹哨部门准确率
entity.setSatisfactionRatio(new BigDecimal("70"));//网格内解决的项目的满意度
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
//网格相关-治理能力-网格3
private FactIndexGovrnAblityGridMonthlyEntity getGovrnAblityGridMonthlyEntity3() {
FactIndexGovrnAblityGridMonthlyEntity entity=new FactIndexGovrnAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C2);
entity.setGridId(IndexCalConstant.S1_C2_G1);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setIssueTotal(80); //网格总议题数
entity.setAvgIssueCount(70); //网格人均议题数目
entity.setAvgShiftProjectRatio(new BigDecimal("100")); //网格议题转项目率
entity.setProjectTotal(100);// 网格总项目数
entity.setSelfSolveProjectCount(20); // 网格自治项目数 统计期网格自身内办结的项目数目
entity.setResolveProjectCount(20);//网格办结项目数 统计期内办结的项目数目
entity.setTransferRightRatio(new BigDecimal("70"));//网格吹哨部门准确率
entity.setSatisfactionRatio(new BigDecimal("10"));//网格内解决的项目的满意度
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
//网格相关-服务能力-网格1
private FactIndexServiceAblityGridMonthlyEntity getServiceAblityGridMonthlyEntity1() {
FactIndexServiceAblityGridMonthlyEntity entity=new FactIndexServiceAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity.setGridId(IndexCalConstant.S1_C1_G1);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setActivityCount(80);//网格活动组织次数 爱心活动
entity.setVolunteerRatio(new BigDecimal("70"));//网格志愿者占比
entity.setPartyVolunteerRatio(new BigDecimal("60"));// 网格党员志愿者率
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
//网格相关-服务能力-网格2
private FactIndexServiceAblityGridMonthlyEntity getServiceAblityGridMonthlyEntity2() {
FactIndexServiceAblityGridMonthlyEntity entity=new FactIndexServiceAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C1);
entity.setGridId(IndexCalConstant.S1_C1_G2);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setActivityCount(40);//网格活动组织次数 爱心活动
entity.setVolunteerRatio(new BigDecimal("30"));//网格志愿者占比
entity.setPartyVolunteerRatio(new BigDecimal("80"));// 网格党员志愿者率
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
//网格相关-服务能力-网格3
private FactIndexServiceAblityGridMonthlyEntity getServiceAblityGridMonthlyEntity3() {
FactIndexServiceAblityGridMonthlyEntity entity=new FactIndexServiceAblityGridMonthlyEntity();
entity.setCustomerId(IndexCalConstant.customerId);
entity.setAgencyId(IndexCalConstant.SHE_QU_S1_C2);
entity.setGridId(IndexCalConstant.S1_C2_G1);
entity.setMonthId(IndexCalConstant.monthId);
entity.setQuarterId(DateUtils.getQuarterId(IndexCalConstant.monthId));
entity.setYearId(DateUtils.getYearId(IndexCalConstant.monthId));
entity.setActivityCount(20);//网格活动组织次数 爱心活动
entity.setVolunteerRatio(new BigDecimal("80"));//网格志愿者占比
entity.setPartyVolunteerRatio(new BigDecimal("20"));// 网格党员志愿者率
entity.setCreatedBy(IndexCalConstant.insertUser);
entity.setUpdatedBy(IndexCalConstant.insertUser);
return entity;
}
}

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

@ -1,5 +1,6 @@
package com.epmet.service.indexcal.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@ -83,8 +84,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
logger.warn("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:党建能力】指标权重信息不存在");
}
logger.info("=================================计算网格相关-党建能力 start===================================================================================");
calculateGridDangJian(formDTO, dangJianNengLiList);
logger.info("=================================计算网格相关-党建能力 end===================================================================================");
//2、计算网格相关-治理能力
List<IndexGroupDetailEntity> zhiLiNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
@ -93,8 +95,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
logger.warn("calculateGridZhiLi customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:治理能力】指标权重信息不存在");
}
logger.info("=================================计算网格相关-治理能力 start===================================================================================");
calculateGridZhiLi(formDTO, zhiLiNengLiList);
logger.info("=================================计算网格相关-治理能力 end===================================================================================");
//3、计算网格相关-服务能力
List<IndexGroupDetailEntity> fuWuNengLiList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(),
@ -103,8 +106,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
logger.warn("calculateGridFuWu customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关:服务能力】指标权重信息不存在");
}
logger.info("=================================计算网格相关-服务能力 start===================================================================================");
calculateGridFuWu(formDTO, fuWuNengLiList);
logger.info("=================================计算网格相关-服务能力 end===================================================================================");
//4、计算网格相关总分
List<IndexGroupDetailEntity> wgxgList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode());
@ -172,7 +176,6 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
}else if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) {
//对应的数值
String sampleValueStr = String.valueOf(recordMap.get(indexCodeFieldReService.getFieldNameByIndexCode(key)));
logger.info("===================="+sampleValueStr);
//构造样本值对象
SampleValue<BigDecimal> currentGridIndexValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), new BigDecimal(sampleValueStr));
value.getIndexValueVOs().add(currentGridIndexValue);
@ -195,7 +198,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
**/
private Map<String, BigDecimal> getContactMassesAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>();
List<BigDecimal> list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO);
//TODO
/*List<BigDecimal> list = cpcScoreDao.selectListGridContactMassesAvgValue(calculateCommonFormDTO);
if (!CollectionUtils.isEmpty(list)) {
BigDecimal minValue = Collections.min(list);
BigDecimal maxValue = Collections.max(list);
@ -204,7 +208,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
return map;
}
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));*/
map.put(StrConstant.MIN, new BigDecimal("24.35"));
map.put(StrConstant.MAX, new BigDecimal("46.13"));
return map;
}
@ -217,9 +223,18 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @Date 2020/8/31 9:50
**/
private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) {
BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId);
//TODO
/*BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId);
if (null == result) {
return new BigDecimal(NumConstant.ZERO_STR);
}*/
BigDecimal result=null;
if(IndexCalConstant.S1_C1_G1.equals(gridId)){
result= new BigDecimal("24.43");
}else if(IndexCalConstant.S1_C1_G2.equals(gridId)){
result=new BigDecimal("46.13");
}else if(IndexCalConstant.S1_C2_G1.equals(gridId)){
result=new BigDecimal("24.35");
}
return result;
}
@ -233,9 +248,18 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @Date 2020/8/31 15:51
**/
private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) {
BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId);
// TODO
/*BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId);
if (null == result) {
return new BigDecimal(NumConstant.ZERO_STR);
}*/
BigDecimal result=null;
if(IndexCalConstant.S1_C1_G1.equals(gridId)){
result= new BigDecimal("29.40");
}else if(IndexCalConstant.S1_C1_G2.equals(gridId)){
result=new BigDecimal("18.30");
}else if(IndexCalConstant.S1_C2_G1.equals(gridId)){
result=new BigDecimal("9.15");
}
return result;
}
@ -249,7 +273,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
**/
private Map<String, BigDecimal> getJoinIssueAblityMap(CalculateCommonFormDTO calculateCommonFormDTO) {
Map<String, BigDecimal> map = new HashMap<>();
List<BigDecimal> list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO);
//TODO
/* List<BigDecimal> list = cpcScoreDao.selectListJoinIssueAvgValue(calculateCommonFormDTO);
if (!CollectionUtils.isEmpty(list)) {
BigDecimal minValue = Collections.min(list);
BigDecimal maxValue = Collections.max(list);
@ -258,7 +283,9 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
return map;
}
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));*/
map.put(StrConstant.MIN, new BigDecimal("9.15"));
map.put(StrConstant.MAX, new BigDecimal("29.4"));
return map;
}
@ -319,10 +346,15 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
private HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) {
//构造入参
List<IndexInputVO> indexInputVOS = this.getIndexInputVOList(indexMap);
logger.info("计算的参数:{}", indexInputVOS);
// logger.info("计算的参数:{}", indexInputVOS);
logger.info("..........计算的参数(List)"+JSON.toJSONString(indexInputVOS));
BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator();
List<IndexOutputVO> listTemp=batchScoreCalculator.getScoreDetailOfIndexId(indexInputVOS);
logger.info("..........计算的结果(List)"+JSON.toJSONString(listTemp));
HashMap<String, BigDecimal> resultMap = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS);
logger.info("计算的结果:{}", resultMap);
logger.info("计算的结果(HashMap):{}", resultMap);
return resultMap;
}
@ -399,7 +431,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
// indexInputVO.setIndexValueVOs(sampleValueList);
IndexInputVO indexInputVO1 = new IndexInputVO(index.getIndexCode(),
sampleValueList,
index.getThreshold(),
// index.getThreshold(), TODO
new BigDecimal("-1"),
index.getWeight(),
scoreCalculator);
map.put(index.getIndexCode(), indexInputVO1);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/ScoreConstants.java

@ -7,7 +7,7 @@ import java.math.BigDecimal;
*/
public class ScoreConstants {
public static final BigDecimal MIN_SCORE = new BigDecimal(0);
public static final BigDecimal MIN_SCORE = new BigDecimal(1);
public static final BigDecimal MAX_SCORE = new BigDecimal(100);
}

Loading…
Cancel
Save