|
@@ -34,6 +34,8 @@ import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.regex.Matcher;
|
|
|
|
+import java.util.regex.Pattern;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.ims.eval.util.ExcelUtil.readExcel;
|
|
import static com.ims.eval.util.ExcelUtil.readExcel;
|
|
@@ -230,22 +232,32 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
List<OrganizationEvaluationInfoResDTO> indicator = ruleIdGropListEntry.getValue();
|
|
List<OrganizationEvaluationInfoResDTO> indicator = ruleIdGropListEntry.getValue();
|
|
Map<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropList = indicator.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getChildCode));
|
|
Map<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropList = indicator.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getChildCode));
|
|
|
|
|
|
- double totalScore = 0.00;
|
|
|
|
|
|
+// double totalScore = 0.00;
|
|
for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropListEntry : childCodeGropList.entrySet()) {
|
|
for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropListEntry : childCodeGropList.entrySet()) {
|
|
for (OrganizationEvaluationInfoResDTO dto : childCodeGropListEntry.getValue()) {
|
|
for (OrganizationEvaluationInfoResDTO dto : childCodeGropListEntry.getValue()) {
|
|
|
|
|
|
- if ((!dto.getOptionCode().equals("CZ") && !dto.getOptionCode().equals("LRGXL") && !dto.getOptionCode().equals("DWQWLR")) || StringUtils.isEmpty(dto.getFormula())) {
|
|
|
|
|
|
+ if (!(dto.getOptionCode().equals("LRZE") || dto.getOptionCode().equals("CZ") || dto.getOptionCode().equals("LRGXKH")|| dto.getOptionCode().equals("LRGXL") || dto.getOptionCode().equals("DWQWLR")) || StringUtils.isEmpty(dto.getFormula())) {
|
|
|
|
+ System.out.println("前置跳过--|"+dto.getOptionCode());
|
|
continue;//当前属性没有配置公式跳过
|
|
continue;//当前属性没有配置公式跳过
|
|
}
|
|
}
|
|
|
|
|
|
- for (OrganizationEvaluationInfoResDTO f : childCodeGropListEntry.getValue()) {
|
|
|
|
|
|
+ //获取去参与计算的属性
|
|
|
|
+ List<String> optionCodes = getOptionCode(dto.getFormula());
|
|
|
|
+
|
|
|
|
+ List<OrganizationEvaluationInfoResDTO> newInfoResInfo = childCodeGropListEntry.getValue().stream()
|
|
|
|
+ .filter(item -> optionCodes.contains(item.getOptionCode()))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //循环替换属性
|
|
|
|
+ for (OrganizationEvaluationInfoResDTO f : newInfoResInfo) {
|
|
dto.setFormula(dto.getFormula().replace("[" + f.getOptionCode() + "]", f.getQuantifiedValue() + ""));
|
|
dto.setFormula(dto.getFormula().replace("[" + f.getOptionCode() + "]", f.getQuantifiedValue() + ""));
|
|
}
|
|
}
|
|
|
|
+
|
|
double score = FormulaUtils.calculateFormula(dto.getFormula());
|
|
double score = FormulaUtils.calculateFormula(dto.getFormula());
|
|
- if (StringUtils.inStringIgnoreCase("DF", dto.getOptionCode())) {
|
|
|
|
- totalScore = totalScore + score;
|
|
|
|
- }
|
|
|
|
- log.info(dto.getOrganizationShortName() + "|" + dto.getChildName() + "|" + dto.getOptionCode() + "----------" + dto.getFormula() + "=" + score);
|
|
|
|
|
|
+// if (StringUtils.inStringIgnoreCase("DF", dto.getOptionCode())) {
|
|
|
|
+// totalScore = totalScore + score;
|
|
|
|
+// }
|
|
|
|
+ log.info(dto.getOrganizationShortName() + "|" + dto.getChildName() + "|" + dto.getOptionCode() + "|" + dto.getFormula() + "=" + score);
|
|
OrganizationEvaluationInfo info = baseMapper.selectById(dto.getId());
|
|
OrganizationEvaluationInfo info = baseMapper.selectById(dto.getId());
|
|
//将计算结果保存
|
|
//将计算结果保存
|
|
info.setQuantifiedValue(score);
|
|
info.setQuantifiedValue(score);
|
|
@@ -310,7 +322,15 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
scoreCount.setBinStage(dto.getBinStage());
|
|
scoreCount.setBinStage(dto.getBinStage());
|
|
scoreCount.setBinSection(dto.getBinSection());
|
|
scoreCount.setBinSection(dto.getBinSection());
|
|
|
|
|
|
- for (OrganizationEvaluationInfoResDTO f : childCodeGropListEntry.getValue()){
|
|
|
|
|
|
+ //获取去参与计算的属性
|
|
|
|
+ List<String> optionCodes = getOptionCode(dto.getFormula());
|
|
|
|
+ List<OrganizationEvaluationInfoResDTO> newInfoResInfo = childCodeGropListEntry.getValue().stream()
|
|
|
|
+ .filter(item -> optionCodes.contains(item.getOptionCode()))
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //替换属性值
|
|
|
|
+ for (OrganizationEvaluationInfoResDTO f : newInfoResInfo){
|
|
if(f.getOptionCode().endsWith("MIN") || f.getOptionCode().endsWith("MAX")){
|
|
if(f.getOptionCode().endsWith("MIN") || f.getOptionCode().endsWith("MAX")){
|
|
System.out.println("-------"+f.getOptionCode());
|
|
System.out.println("-------"+f.getOptionCode());
|
|
f.setQuantifiedValue(map.get(f.getOptionCode()));
|
|
f.setQuantifiedValue(map.get(f.getOptionCode()));
|
|
@@ -1133,4 +1153,20 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private List<String> getOptionCode(String formula){
|
|
|
|
+ List<String> optionCode = new ArrayList<>();
|
|
|
|
+ String pattern = "\\[(.*?)\\]";
|
|
|
|
+ Pattern regex = Pattern.compile(pattern);
|
|
|
|
+ Matcher matcher = regex.matcher(formula);
|
|
|
|
+ while (matcher.find()) {
|
|
|
|
+ String match = matcher.group(1);
|
|
|
|
+ optionCode.add(match);
|
|
|
|
+ }
|
|
|
|
+ Set<String> uniqueOptionCode = new HashSet<>(optionCode);
|
|
|
|
+ List<String> setOptionCode = new ArrayList<>(uniqueOptionCode);
|
|
|
|
+ return setOptionCode;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|