|
|
|
@ -193,8 +193,7 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
// 获取案件类型对应的指标
|
|
|
|
|
List<ModelIndex> modelIndexList = modelIndexMapper.selectList(
|
|
|
|
|
Wrappers.lambdaQuery(ModelIndex.class)
|
|
|
|
|
.eq(ModelIndex::getCaseType, caseType)
|
|
|
|
|
.eq(ModelIndex::getIndexType, indexSource).eq(ModelIndex::getDataStatus, "1"));
|
|
|
|
|
.eq(ModelIndex::getCaseType, caseType).eq(ModelIndex::getDataStatus, "1"));
|
|
|
|
|
if (CollUtil.isEmpty(modelIndexList)){
|
|
|
|
|
return new ArrayList<>(1);
|
|
|
|
|
}
|
|
|
|
@ -223,13 +222,14 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
|
|
|
|
|
Map<String, ModelAtomicResult> modelAtomicResultMap = modelAtomicResults.stream()
|
|
|
|
|
.filter(modelAtomicResult -> StrUtil.isNotEmpty(modelAtomicResult.getAtomicId())).collect(Collectors.toMap(ModelAtomicResult::getAtomicId, v -> v, (v1, v2) -> v1));
|
|
|
|
|
// 以指标为基础数据,组装原子指标的值。然后把数据进行平铺
|
|
|
|
|
return modelIndexList.stream().flatMap(modelIndex -> {
|
|
|
|
|
String judgeLogic = modelIndex.getJudgeLogic();
|
|
|
|
|
List<String> indexIds = pickAtomicIndexIds(judgeLogic);
|
|
|
|
|
return indexIds.stream().map(indexId ->
|
|
|
|
|
new CaseAtomicIndexDTO(modelAtomicIndexMap.get(indexId), modelIndex, modelAtomicResultMap.get(indexId))).toList().stream();
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
|
|
Map<String, List<ModelIndex>> modelIndexMapAtomic = groupModelIndexByAtomicIndexId(modelIndexList);
|
|
|
|
|
|
|
|
|
|
// 以原子指标为基准,组装数据
|
|
|
|
|
return modelAtomicIndexList.stream().flatMap(atomicIndex ->
|
|
|
|
|
modelIndexMapAtomic.get(atomicIndex.getId()).stream().map(modelIndex ->
|
|
|
|
|
new CaseAtomicIndexDTO(atomicIndex, modelIndex, modelAtomicResultMap.get(atomicIndex.getId())))
|
|
|
|
|
).toList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -328,5 +328,31 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
}
|
|
|
|
|
return ids;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String,List<ModelIndex>> groupModelIndexByAtomicIndexId(List<ModelIndex> modelIndexList) {
|
|
|
|
|
Map<String, List<ModelIndex>> groupMap = new HashMap<>();
|
|
|
|
|
if (CollUtil.isEmpty(modelIndexList)){
|
|
|
|
|
return groupMap;
|
|
|
|
|
}
|
|
|
|
|
for (ModelIndex modelIndex : modelIndexList) {
|
|
|
|
|
if (StrUtil.isEmpty(modelIndex.getJudgeLogic())){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String judgeLogic = modelIndex.getJudgeLogic();
|
|
|
|
|
List<JudgeLogic> judgeLogicList = JSONUtil.toList(judgeLogic, JudgeLogic.class);
|
|
|
|
|
for (JudgeLogic logic : judgeLogicList) {
|
|
|
|
|
List<AtomicData> atomicData = logic.getAtomicData();
|
|
|
|
|
if (CollUtil.isEmpty(atomicData)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (AtomicData atomic : atomicData) {
|
|
|
|
|
List<ModelIndex> modelIndexs = groupMap.getOrDefault(atomic.getAtomicIndex(), new ArrayList<>());
|
|
|
|
|
modelIndexs.add(modelIndex);
|
|
|
|
|
groupMap.put(atomic.getAtomicIndex(),modelIndexs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return groupMap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|