|
@@ -1,9 +1,7 @@
|
|
|
package com.sundata.internalevaluation.calc.calcUnit;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.sundata.common.util.DBExecutor;
|
|
|
-import com.sundata.internalevaluation.calc.model.CalcException;
|
|
|
import com.sundata.internalevaluation.calc.model.CalcResult;
|
|
|
import com.sundata.internalevaluation.calc.model.CalcUnit;
|
|
|
import com.sundata.internalevaluation.calc.model.finals.CalcType;
|
|
@@ -26,7 +24,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
public class IndexCalcUnit extends CalcUnit {
|
|
|
|
|
|
- private IndexConfigModel indexConfigModel;
|
|
|
+ private final IndexConfigModel indexConfigModel;
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(IndexCalcUnit.class);
|
|
|
/**
|
|
@@ -63,13 +61,13 @@ public class IndexCalcUnit extends CalcUnit {
|
|
|
@Override
|
|
|
public void initResultContext(String calculateInstanceNumber) {
|
|
|
// TODO 初始化
|
|
|
- List<IndexCalcUnit> indexCalcUnits = new ArrayList<>();
|
|
|
-// List<IndexCalcUnit> indexCalcUnits = DataImages.indexCalcUnitHashMap.get(calculateInstanceNumber);
|
|
|
- // 筛选并查找对象,如果找不到则报错
|
|
|
- if (indexCalcUnits.stream().noneMatch(a -> a.getCalcCode().equals(this.getCalcCode()))) {
|
|
|
- throw new CalcException(calculateInstanceNumber, StrUtil.format("无法找到已计算完成的结果,计算单元编号:{},计算流水号为:{}。", this.getCalcCode(), calculateInstanceNumber));
|
|
|
- }
|
|
|
- this.setResultContext(indexCalcUnits.stream().filter(a -> a.getCalcCode().equals(this.getCalcCode())).findFirst().get().getResultContext());
|
|
|
+// List<IndexCalcUnit> indexCalcUnits = new ArrayList<>();
|
|
|
+//// List<IndexCalcUnit> indexCalcUnits = DataImages.indexCalcUnitHashMap.get(calculateInstanceNumber);
|
|
|
+// // 筛选并查找对象,如果找不到则报错
|
|
|
+// if (indexCalcUnits.stream().noneMatch(a -> a.getCalcCode().equals(this.getCalcCode()))) {
|
|
|
+// throw new CalcException(calculateInstanceNumber, StrUtil.format("无法找到已计算完成的结果,计算单元编号:{},计算流水号为:{}。", this.getCalcCode(), calculateInstanceNumber));
|
|
|
+// }
|
|
|
+// this.setResultContext(indexCalcUnits.stream().filter(a -> a.getCalcCode().equals(this.getCalcCode())).findFirst().get().getResultContext());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -88,12 +86,12 @@ public class IndexCalcUnit extends CalcUnit {
|
|
|
List<DataSetConfigModel> dataSetList = new ArrayList<>();
|
|
|
// 查询个指标编号和数据集对应的数据
|
|
|
for ( IndexSourceModel m : selectList) {
|
|
|
- if (m.getDataSourceType().equals("DATASET")) {
|
|
|
+ if ("DATASET".equals(m.getDataSourceType())) {
|
|
|
DataSetConfigModel conditionModel = new DataSetConfigModel();
|
|
|
conditionModel.setDataSetNo(m.getDataSetNo());
|
|
|
DataSetConfigModel datasetModel = dataSetService.selectDetailData(conditionModel);
|
|
|
dataSetList.add(datasetModel);
|
|
|
- } else if (m.getDataSourceType().equals("INDEX")) {
|
|
|
+ } else if ("INDEX".equals(m.getDataSourceType())) {
|
|
|
IndexConfigModel conditionModel = new IndexConfigModel();
|
|
|
conditionModel.setIndexNo(m.getOtherIndexNo());
|
|
|
IndexConfigModel indexConfigModel = indexConfigService.selectDetailData(conditionModel);
|
|
@@ -105,11 +103,11 @@ public class IndexCalcUnit extends CalcUnit {
|
|
|
List<CalcUnit> dataSetCalcList = null;
|
|
|
List<CalcUnit> resultCalcMap = new ArrayList<>();
|
|
|
// 数据源头节点生成
|
|
|
- if (indexList.size() > 0) {
|
|
|
+ if (!indexList.isEmpty()) {
|
|
|
indexCalcList = indexList.stream().map(indexConfigModel -> new IndexCalcUnit
|
|
|
(indexConfigModel.getIndexNo(),indexConfigModel.getIndexName(),Map.of(),indexConfigModel)).collect(Collectors.toList());
|
|
|
}
|
|
|
- if (dataSetList.size() > 0) {
|
|
|
+ if (!dataSetList.isEmpty()) {
|
|
|
dataSetCalcList = dataSetList.stream().map(dataSetModel -> new DataSetCalcUnit
|
|
|
(dataSetModel.getDataSetNo(),dataSetModel.getDataSetName(),Map.of(),dataSetModel)).collect(Collectors.toList());
|
|
|
}
|