Explorar el Código

计算方法调整

wangchangsheng hace 1 año
padre
commit
929b977a12

+ 16 - 5
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -259,8 +259,9 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 //												totalScore = totalScore + score;
 //											}
 											log.info(dto.getOrganizationShortName() + "|" + dto.getChildName() + "|" + dto.getOptionCode() + "|" + dto.getFormula() + "=" + score);
-											OrganizationEvaluationInfo info = baseMapper.selectById(dto.getId());
+											OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
 											//将计算结果保存
+											info.setId(dto.getId());
 											info.setQuantifiedValue(score);
 											info.setNonQuantifiedValue(score + "");
 											dto.setQuantifiedValue(score);
@@ -281,6 +282,10 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 				}
 			}
 
+			//获取计算的差值最大最小值
+			List<CalculateIndicatorItemInfo> calculateIndicatorItemInfos = calculateIndicatorItemInfoMapper.selectList("","","","","",organizationEvaluationId,"");
+			Map<String, List<CalculateIndicatorItemInfo>> groupedItemInfoMap = calculateIndicatorItemInfos.stream()
+				.collect(Collectors.groupingBy(item -> item.getIndicatorId() + "_" + item.getChildCode()));
 
 			//计算得分
 			for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> binSectionGropEntry : binSectionGropList.entrySet()){
@@ -311,11 +316,16 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 									double standardScore = 0;
 									for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropListEntry : childCodeGropList.entrySet()){
 
-										List<CalculateIndicatorItemInfo> calculateIndicatorItemInfo = calculateIndicatorItemInfoMapper.selectList("","","","",childCodeGropListEntry.getValue().get(0).getIndicatorId(),childCodeGropListEntry.getValue().get(0).getOrganizationEvaluationId(),childCodeGropListEntry.getValue().get(0).getChildCode());
+//										List<CalculateIndicatorItemInfo> calculateIndicatorItemInfo = calculateIndicatorItemInfoMapper.selectList("","","","",childCodeGropListEntry.getValue().get(0).getIndicatorId(),childCodeGropListEntry.getValue().get(0).getOrganizationEvaluationId(),childCodeGropListEntry.getValue().get(0).getChildCode());
+										List<CalculateIndicatorItemInfo> calculateIndicatorItemInfo = groupedItemInfoMap.get(childCodeGropListEntry.getValue().get(0).getIndicatorId()+"_"+childCodeGropListEntry.getValue().get(0).getChildCode());
+
 										Map<String ,Double>  map = new HashMap<>();
-										for (CalculateIndicatorItemInfo itemInfo :calculateIndicatorItemInfo){
-											map.put(itemInfo.getOptionCode(),itemInfo.getQuantifiedValue());
+										if (null != calculateIndicatorItemInfo && calculateIndicatorItemInfo.size() > 0) {
+											for (CalculateIndicatorItemInfo itemInfo : calculateIndicatorItemInfo) {
+												map.put(itemInfo.getOptionCode(), itemInfo.getQuantifiedValue());
+											}
 										}
+
 										for (OrganizationEvaluationInfoResDTO dto: childCodeGropListEntry.getValue()){
 											if ((dto.getOptionCode().endsWith("MAX") ||dto.getOptionCode().endsWith("MIN")
 												||dto.getOptionCode().equals("CZ") || dto.getOptionCode().equals("LRGXL")
@@ -357,8 +367,9 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 												}
 											}
 											log.info(dto.getOrganizationShortName()+"|"+dto.getIndicatorName()+"|"+dto.getOptionCode()+"----------"+dto.getFormula()+"="+score);
-											OrganizationEvaluationInfo info  = baseMapper.selectById(dto.getId());
+											OrganizationEvaluationInfo info  = new OrganizationEvaluationInfo();
 											//将计算结果保存
+											info.setId(dto.getId());
 											info.setQuantifiedValue(score);
 											info.setNonQuantifiedValue(score+"");
 											dto.setQuantifiedValue(score);