|
|
@ -26,6 +26,7 @@ import com.epmet.entity.evaluationindex.indexcal.GridSelfSubScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.indexcal.GridSubScoreEntity; |
|
|
|
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; |
|
|
|
import com.epmet.eum.IndexCodeEnum; |
|
|
|
import com.epmet.model.AvgOperationResultVO; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.GridCorreLationService; |
|
|
|
import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; |
|
|
|
import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; |
|
|
@ -185,6 +186,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
**/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void calculateGridDangJian(CalculateCommonFormDTO formDTO) { |
|
|
|
// 该客户下的指标列表及权重
|
|
|
|
List<IndexGroupDetailEntity> indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(), |
|
|
|
IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode(), |
|
|
|
IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); |
|
|
@ -192,7 +194,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
log.error("calculateGridDangJian customerId:{} have not any indexGroupDetail", formDTO.getCustomerId()); |
|
|
|
throw new RenException("客户【网格相关:党建能力】指标权重信息不存在"); |
|
|
|
} |
|
|
|
//查询总记录数
|
|
|
|
//查询总记录数(该客户下,该月份,每个网格一条,有多少条)
|
|
|
|
int total = factIndexPartyAblityGridMonthlyDao.selectCount(formDTO); |
|
|
|
if (NumConstant.ZERO == total) { |
|
|
|
log.warn(String.format("customerId=%s,monthId=%s,没有上传网格相关-党建能力-五级指标数据", formDTO.getCustomerId(), formDTO.getMonthId())); |
|
|
@ -210,10 +212,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
//指标集合
|
|
|
|
Map<String, IndexInputVO<BigDecimal>> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); |
|
|
|
List<HashMap<String, CalculateResult>> resultMapList = new ArrayList<>(); |
|
|
|
// 平均值计算结果,内含平均值,样本总量
|
|
|
|
HashMap<String, AvgOperationResultVO> gridAvgOpeResultMap = new HashMap<>(); |
|
|
|
//分页查询采集记录
|
|
|
|
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { |
|
|
|
int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; |
|
|
|
//前10条
|
|
|
|
//前10条。每个网格的党建能力的数据
|
|
|
|
List<Map<String, Object>> recordList = queryListPartyAblityGrid(new PageQueryGridFormDTO(formDTO.getCustomerId(), |
|
|
|
formDTO.getMonthId(), |
|
|
|
pageIndex, |
|
|
@ -231,8 +235,10 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
// log.info("组织内党员的联系群众能力考评分(平均值) 单独处理");
|
|
|
|
//网格内党员的联系群众能力考评分(平均值)
|
|
|
|
String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); |
|
|
|
BigDecimal contactMassesAvgValue = getGridContactMassesAvgValue(formDTO, gridId); |
|
|
|
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgValue); |
|
|
|
String monthId = (String) recordMap.get(IndexCalConstant.MONTH_ID); |
|
|
|
AvgOperationResultVO contactMassesAvgVo = getGridContactMassesAvgValue(formDTO, gridId); |
|
|
|
gridAvgOpeResultMap.put(gridId.concat(":").concat(monthId), contactMassesAvgVo); |
|
|
|
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), contactMassesAvgVo.getAvgValue()); |
|
|
|
value.getIndexValueVOs().add(contactMassesAblityValue); |
|
|
|
}else if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { |
|
|
|
//对应的数值
|
|
|
@ -251,7 +257,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
saveGridCorreLationResult(formDTO, |
|
|
|
resultMapList, |
|
|
|
IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), |
|
|
|
NumConstant.ZERO_STR); |
|
|
|
NumConstant.ZERO_STR, |
|
|
|
gridAvgOpeResultMap); |
|
|
|
|
|
|
|
// 清理map
|
|
|
|
gridAvgOpeResultMap.clear(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -312,10 +322,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
* @description 获取网格(组织)内党员的联系群众能力考评分(平均值) |
|
|
|
* @Date 2020/8/31 9:50 |
|
|
|
**/ |
|
|
|
private BigDecimal getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { |
|
|
|
BigDecimal result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); |
|
|
|
private AvgOperationResultVO getGridContactMassesAvgValue(CalculateCommonFormDTO calculateCommonFormDTO, String gridId) { |
|
|
|
AvgOperationResultVO result = cpcScoreDao.selectGridContactMassesAvgValue(calculateCommonFormDTO.getCustomerId(), calculateCommonFormDTO.getMonthId(), gridId); |
|
|
|
if (null == result) { |
|
|
|
return new BigDecimal(NumConstant.ZERO_STR); |
|
|
|
result.setAvgValue(new BigDecimal(0)); |
|
|
|
result.setSampleCount(0); |
|
|
|
} |
|
|
|
//FOR TEST
|
|
|
|
/*BigDecimal result=null; |
|
|
@ -337,10 +348,12 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
* @description 组织内党员的参与议事能力考评分(平均值) |
|
|
|
* @Date 2020/8/31 15:51 |
|
|
|
**/ |
|
|
|
private BigDecimal getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { |
|
|
|
BigDecimal result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); |
|
|
|
private AvgOperationResultVO getGridJoinIssueAvgValue(CalculateCommonFormDTO formDTO, String gridId) { |
|
|
|
AvgOperationResultVO result = cpcScoreDao.selectGridJoinIssueAvgValue(formDTO.getCustomerId(), formDTO.getMonthId(), gridId); |
|
|
|
if (null == result) { |
|
|
|
return new BigDecimal(NumConstant.ZERO_STR); |
|
|
|
//return new BigDecimal(NumConstant.ZERO_STR);
|
|
|
|
result.setSampleCount(0); |
|
|
|
result.setAvgValue(new BigDecimal(0)); |
|
|
|
} |
|
|
|
//FOR TEST
|
|
|
|
/*BigDecimal result=null; |
|
|
@ -411,7 +424,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO 客户id 月份id: yyyyMM |
|
|
|
* @param resultMapList |
|
|
|
* @param resultMapList key:网格id,value:该网格各项指标的计算结果 |
|
|
|
* @param indexCode 指标编码: 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli; |
|
|
|
* @param isTotal 1:总分;0不是 |
|
|
|
* @return void |
|
|
@ -422,7 +435,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
private void saveGridCorreLationResult(CalculateCommonFormDTO formDTO, |
|
|
|
List<HashMap<String, CalculateResult>> resultMapList, |
|
|
|
String indexCode, |
|
|
|
String isTotal) { |
|
|
|
String isTotal, |
|
|
|
HashMap<String, AvgOperationResultVO> avgOpeResultVo) { |
|
|
|
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); |
|
|
|
String yearId = DateUtils.getYearId(formDTO.getMonthId()); |
|
|
|
//三大能力结果表
|
|
|
@ -463,6 +477,14 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
gridSubScoreEntity.setScore(detail.getScore()); |
|
|
|
gridSubScoreEntity.setWeight(detail.getWeight()); |
|
|
|
gridSubScoreEntity.setOriginValue(detail.getOriginValue()); |
|
|
|
|
|
|
|
// 为平均值类型的指标赋值样本总量
|
|
|
|
AvgOperationResultVO avgOperationResultVO = avgOpeResultVo.get(gridSubScoreEntity.getGridId().concat(":").concat(gridSubScoreEntity.getMonthId())); |
|
|
|
if (avgOperationResultVO != null) { |
|
|
|
gridSubScoreEntity.setSampleCount(avgOperationResultVO.getSampleCount()); |
|
|
|
} else { |
|
|
|
gridSubScoreEntity.setSampleCount(0); |
|
|
|
} |
|
|
|
gridSubScoreList.add(gridSubScoreEntity); |
|
|
|
} |
|
|
|
}); |
|
|
@ -621,6 +643,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
//指标集合
|
|
|
|
Map<String, IndexInputVO<BigDecimal>> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); |
|
|
|
List<HashMap<String, CalculateResult>> resultMapList = new ArrayList<>(); |
|
|
|
HashMap<String, AvgOperationResultVO> avgOperationResultVo = new HashMap<>(); |
|
|
|
//分页查询采集记录
|
|
|
|
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { |
|
|
|
int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; |
|
|
@ -639,8 +662,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
if (IndexCodeEnum.ZUZHINEIDANGYDSYYSNLKPFPJZ.getCode().equals(key)) { |
|
|
|
// log.info("组织内党员的参与议事能力考评分(平均值) 单独处理");
|
|
|
|
String gridId = (String) recordMap.get(IndexCalConstant.GRID_ID); |
|
|
|
BigDecimal joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId); |
|
|
|
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue); |
|
|
|
String monthId = (String) recordMap.get(IndexCalConstant.MONTH_ID); |
|
|
|
AvgOperationResultVO joinAvgValue = getGridJoinIssueAvgValue(formDTO, gridId); |
|
|
|
avgOperationResultVo.put(gridId.concat(":").concat(monthId), joinAvgValue); |
|
|
|
|
|
|
|
SampleValue<BigDecimal> contactMassesAblityValue = new SampleValue((String) recordMap.get(IndexCalConstant.GRID_ID), joinAvgValue.getAvgValue()); |
|
|
|
value.getIndexValueVOs().add(contactMassesAblityValue); |
|
|
|
}else if (StringUtils.isNotBlank(indexCodeFieldReService.getFieldNameByIndexCode(key))) { |
|
|
|
//对应的数值
|
|
|
@ -659,7 +685,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
saveGridCorreLationResult(formDTO, |
|
|
|
resultMapList, |
|
|
|
IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), |
|
|
|
NumConstant.ZERO_STR); |
|
|
|
NumConstant.ZERO_STR, |
|
|
|
avgOperationResultVo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -696,6 +723,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
//指标集合
|
|
|
|
Map<String, IndexInputVO<BigDecimal>> indexMap = buildGridCorrelationIndexInputVO(formDTO, indexList, minAndMaxMap); |
|
|
|
List<HashMap<String, CalculateResult>> resultMapList = new ArrayList<>(); |
|
|
|
HashMap<String, AvgOperationResultVO> avgOperationResultVO = new HashMap<>(); |
|
|
|
//分页查询采集记录
|
|
|
|
for (int pageNo = 1; pageNo <= totalPage; pageNo++) { |
|
|
|
int pageIndex = (pageNo - NumConstant.ONE) * IndexCalConstant.PAGE_SIZE; |
|
|
@ -730,7 +758,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService { |
|
|
|
saveGridCorreLationResult(formDTO, |
|
|
|
resultMapList, |
|
|
|
IndexCodeEnum.FU_WU_NENG_LI.getCode(), |
|
|
|
NumConstant.ZERO_STR); |
|
|
|
NumConstant.ZERO_STR, |
|
|
|
avgOperationResultVO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|