|
@@ -3,7 +3,7 @@ package com.syjy.calculate.service;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.googlecode.aviator.AviatorEvaluator;
|
|
import com.googlecode.aviator.AviatorEvaluator;
|
|
-import com.syjy.calculate.entity.CalculationFormula;
|
|
|
|
|
|
+import com.syjy.calculate.entity.tCalculationFormula;
|
|
import com.syjy.calculate.repository.CalculationFormulaRepository;
|
|
import com.syjy.calculate.repository.CalculationFormulaRepository;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -43,7 +43,7 @@ public class AccuracyPassRateCalculateService {
|
|
JSONObject jsonResult = new JSONObject();
|
|
JSONObject jsonResult = new JSONObject();
|
|
jsonResult.put("result", false);
|
|
jsonResult.put("result", false);
|
|
// 获取公式
|
|
// 获取公式
|
|
- List<CalculationFormula> calculationFormulaList = getCalculationFormulaData(type, provinceEnum);
|
|
|
|
|
|
+ List<tCalculationFormula> calculationFormulaList = getCalculationFormulaData(type, provinceEnum);
|
|
if (calculationFormulaList == null || calculationFormulaList.size() == 0) {
|
|
if (calculationFormulaList == null || calculationFormulaList.size() == 0) {
|
|
jsonResult.put("msg", "计算失败,未匹配到公式");
|
|
jsonResult.put("msg", "计算失败,未匹配到公式");
|
|
return jsonResult;
|
|
return jsonResult;
|
|
@@ -55,7 +55,7 @@ public class AccuracyPassRateCalculateService {
|
|
// 公式
|
|
// 公式
|
|
String formula;
|
|
String formula;
|
|
// 循环公式,依次执行公式
|
|
// 循环公式,依次执行公式
|
|
- for (CalculationFormula calculationFormula : calculationFormulaList) {
|
|
|
|
|
|
+ for (tCalculationFormula calculationFormula : calculationFormulaList) {
|
|
BigDecimal formulaResult = ZERO;
|
|
BigDecimal formulaResult = ZERO;
|
|
// 获取公式
|
|
// 获取公式
|
|
formula = calculationFormula.getFormula();
|
|
formula = calculationFormula.getFormula();
|
|
@@ -116,8 +116,8 @@ public class AccuracyPassRateCalculateService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 记录本次公式的计算结果
|
|
// 记录本次公式的计算结果
|
|
- resultMap.put("result" + calculationFormula.getOrder(), formulaResult);
|
|
|
|
- log.info("result" + calculationFormula.getOrder() + ":" + formulaResult);
|
|
|
|
|
|
+ resultMap.put("result" + calculationFormula.getOrder2(), formulaResult);
|
|
|
|
+ log.info("result" + calculationFormula.getOrder2() + ":" + formulaResult);
|
|
}
|
|
}
|
|
// 获取最后一个公式计算的结果
|
|
// 获取最后一个公式计算的结果
|
|
String lastResult = String.valueOf(resultMap.get("result" + calculationFormulaList.size()));
|
|
String lastResult = String.valueOf(resultMap.get("result" + calculationFormulaList.size()));
|
|
@@ -144,8 +144,8 @@ public class AccuracyPassRateCalculateService {
|
|
* @param provinceEnum 省调(在数据库中省调存储必须带分号,例如:E12;)
|
|
* @param provinceEnum 省调(在数据库中省调存储必须带分号,例如:E12;)
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public List<CalculationFormula> getCalculationFormulaData(String type, String provinceEnum) {
|
|
|
|
- List<CalculationFormula> calculationFormulaList = new ArrayList<>();
|
|
|
|
|
|
+ public List<tCalculationFormula> getCalculationFormulaData(String type, String provinceEnum) {
|
|
|
|
+ List<tCalculationFormula> calculationFormulaList = new ArrayList<>();
|
|
// 根据类型从数据库中查出公式列表
|
|
// 根据类型从数据库中查出公式列表
|
|
calculationFormulaList = calculationFormulaRepository.findByTypeAndProvince(type, provinceEnum);
|
|
calculationFormulaList = calculationFormulaRepository.findByTypeAndProvince(type, provinceEnum);
|
|
return calculationFormulaList;
|
|
return calculationFormulaList;
|