|
@@ -1,5 +1,6 @@
|
|
|
package com.ims.eval.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ims.common.utils.FormulaUtils;
|
|
|
import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.config.CustomException;
|
|
@@ -347,24 +348,13 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
Map indicatormap = new HashMap();
|
|
|
List<OrganizationEvaluationInfoResDTO> dtoList = entry.getValue();
|
|
|
|
|
|
-
|
|
|
-// Map<String, OrganizationEvaluationInfoResDTO> resultMap = dtoList.stream()
|
|
|
-// .collect(Collectors.toMap(
|
|
|
-// dto -> dto.getChildCode() + "_" + dto.getOptionCode(),
|
|
|
-// dto -> dto));
|
|
|
-
|
|
|
Map<String, OrganizationEvaluationInfoResDTO> resultMap = dtoList.stream()
|
|
|
.collect(Collectors.toMap(
|
|
|
dto -> dto.getChildCode() + "_" + dto.getOptionCode(),
|
|
|
dto -> dto,
|
|
|
(oldValue, newValue) -> oldValue)); // 解决键重复的情况
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
boolean mark = true;//标记给公司名赋值
|
|
|
|
|
|
-
|
|
|
//将子指标分组
|
|
|
Map<String, List<IndicatorDictionary>> groupedChildCode = dictionaryList.stream()
|
|
|
.collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
@@ -381,7 +371,8 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
if (!d.getIsShow()) {
|
|
|
continue;
|
|
|
}
|
|
|
- titlemap.put(d.getChildCode()+"_"+d.getOptionCode(), d.getOptionName());//名称
|
|
|
+ titlemap.put("key", d.getOptionName());//名称
|
|
|
+ titlemap.put("code",d.getChildCode()+"_"+d.getOptionCode());//名称
|
|
|
titleArray.add(titlemap);
|
|
|
|
|
|
}
|
|
@@ -392,7 +383,6 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
data.put("title", title);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (IndicatorDictionary d : dictionaryList) {
|
|
|
if (!d.getIsShow()) {
|
|
|
continue;
|
|
@@ -409,6 +399,8 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
indicatormap.put(d.getChildCode() + "_" + d.getOptionCode(), null == resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue() ? "" : resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue());
|
|
|
//指标id
|
|
|
indicatormap.put("ID_" + d.getChildCode() + "_" + d.getOptionCode(), resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getId());
|
|
|
+
|
|
|
+ indicatormap.put("IS_LH_" +d.getChildCode() + "_" + d.getOptionCode(),resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getIsQuantified2());
|
|
|
}
|
|
|
mapList.add(indicatormap);
|
|
|
}
|
|
@@ -417,6 +409,40 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean updateEvaluationInfo(List<JSONObject> jsonObjects) {
|
|
|
+ for (JSONObject json :jsonObjects){
|
|
|
+
|
|
|
+ Map<String,Object > idMap = new HashMap();
|
|
|
+ Map valueMap = new HashMap();
|
|
|
+ for (String key : json.keySet()) {
|
|
|
+ Object value = json.get(key);
|
|
|
+ if(key.startsWith("ID_")){
|
|
|
+ idMap.put(key,value);
|
|
|
+ }else {
|
|
|
+ valueMap.put(key,value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<OrganizationEvaluationInfo> evaluationInfos =new ArrayList<>();
|
|
|
+ for (Map.Entry<String,Object > entry : idMap.entrySet()) {
|
|
|
+ OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
+ info.setId(entry.getValue().toString());
|
|
|
+ boolean quantified = Boolean.valueOf(valueMap.get(entry.getKey().replace("ID_","IS_LH_")).toString());
|
|
|
+ if(quantified){
|
|
|
+ info.setQuantifiedValue(Double.valueOf(valueMap.get(entry.getKey().replace("ID_","")).toString()));
|
|
|
+ }
|
|
|
+ info.setNonQuantifiedValue(valueMap.get(entry.getKey().replace("ID_","")).toString());
|
|
|
+ evaluationInfos.add(info);
|
|
|
+ }
|
|
|
+ this.saveOrUpdateBatch(evaluationInfos);
|
|
|
+
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
//todo 后续添加需要计算的指标项
|
|
|
public boolean calculateIdicatorItem(List<OrganizationEvaluationInfo> organizationEvaluationInfos){
|
|
|
|