|
|
|
@ -46,11 +46,10 @@ import org.neo4j.driver.internal.InternalNode;
|
|
|
|
|
import org.neo4j.driver.internal.InternalRelationship;
|
|
|
|
|
import org.neo4j.driver.types.Node;
|
|
|
|
|
import org.neo4j.driver.types.Relationship;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -92,6 +91,9 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
|
|
|
|
|
private final Neo4jService neo4jService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ScoringModelInfoService scoringModelInfoService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public R<?> selectAll(ModelIndexReqVO modelIndex, Integer page, Integer size) {
|
|
|
|
@ -123,11 +125,12 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
// 分页查询
|
|
|
|
|
List<ModelIndex> records = iPage.getRecords();
|
|
|
|
|
List<ComDictionary> dicts = comDictionaryService.list();
|
|
|
|
|
List<ScoringModelInfo> scoringModelInfoList = scoringModelInfoService.list();
|
|
|
|
|
|
|
|
|
|
// 查询结果拼装
|
|
|
|
|
for (ModelIndex index : records) {
|
|
|
|
|
index.setIndexTypeName(comDictionaryService.getName(dicts, "index_type", index.getIndexType()));
|
|
|
|
|
index.setCaseTypeName(comDictionaryService.getName(dicts, "case_type", index.getCaseType()));
|
|
|
|
|
index.setCaseTypeName(scoringModelInfoService.getScoringModelNameById(index.getCaseType(), scoringModelInfoList));
|
|
|
|
|
//原子指标
|
|
|
|
|
String judgeLogic = index.getJudgeLogic();
|
|
|
|
|
Set<String> ids = new HashSet<>();
|
|
|
|
@ -193,6 +196,20 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public void deleteModelIndexByCaseType(String caseType) {
|
|
|
|
|
Assert.notEmpty(caseType, "模型类型不能为空");
|
|
|
|
|
List<ModelIndex> modelIndexList = super.lambdaQuery().eq(ModelIndex::getCaseType, caseType).list();
|
|
|
|
|
if (CollUtil.isEmpty(modelIndexList)) {
|
|
|
|
|
log.info("deleteModelIndexByCaseType:未查询到模型类型:{}的指标", caseType);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
super.lambdaUpdate().eq(ModelIndex::getCaseType, caseType).remove();
|
|
|
|
|
modelIndexAtomicRelationService.deleteByIndexIds(modelIndexList.stream().map(ModelIndex::getId).toList());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public R<?> selectAllAtomic(ModelAtomicIndex modelAtomicIndex, Integer page, Integer size) {
|
|
|
|
@ -202,8 +219,9 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
List<ComDictionary> dicts = comDictionaryService.list();
|
|
|
|
|
String caseType = StrUtil.isNotEmpty(modelAtomicIndex.getCaseType()) ? modelAtomicIndex.getCaseType() : NotePromptConstants.CASE_TYPE_ENGINEERING_CONTRACT_FRAUD;
|
|
|
|
|
EvidenceCategoryDTO rootCategory = new EvidenceCategoryDTO(evidenceCategoryService.listCategoryTree(caseType));
|
|
|
|
|
List<ScoringModelInfo> scoringModelInfoList = scoringModelInfoService.list();
|
|
|
|
|
for (ModelAtomicIndex index : records) {
|
|
|
|
|
index.setCaseTypeName(comDictionaryService.getName(dicts, "case_type", index.getCaseType()));
|
|
|
|
|
index.setCaseTypeName(scoringModelInfoService.getScoringModelNameById(index.getCaseType(), scoringModelInfoList));
|
|
|
|
|
index.setIndexSourceName(comDictionaryService.getName(dicts, "index_source", index.getIndexSource()));
|
|
|
|
|
index.setRecordTypeName(comDictionaryService.getName(dicts, "record_type", index.getRecordType()));
|
|
|
|
|
index.setCategoryIdPath(rootCategory.listCategoryIdPath(index.getCategoryId()));
|
|
|
|
@ -480,6 +498,56 @@ public class ModelIndexServiceImpl extends ServiceImpl<ModelIndexMapper, ModelIn
|
|
|
|
|
return graphDebugResVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public void copyIndex(String oldModelId, String newModelId) {
|
|
|
|
|
Assert.notEmpty(oldModelId, "原模型id不能为空");
|
|
|
|
|
Assert.notEmpty(newModelId, "新模型id不能为空");
|
|
|
|
|
|
|
|
|
|
List<ModelIndex> modelIndexList = super.lambdaQuery().eq(ModelIndex::getCaseType, oldModelId).eq(ModelIndex::getDataStatus, "1").list();
|
|
|
|
|
if (CollUtil.isEmpty(modelIndexList)){
|
|
|
|
|
log.info("copyIndex:未查询到原模型id:{}的指标", oldModelId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (ModelIndex modelIndex : modelIndexList) {
|
|
|
|
|
ModelIndex newIndex = modelIndexCopy(modelIndex,newModelId);
|
|
|
|
|
modelIndexMapper.insert(newIndex);
|
|
|
|
|
modelIndexAtomicRelationService.saveByModelIndex(newIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<AtomicIndexUsedDTO> atomicUsed(String atomicIndexId) {
|
|
|
|
|
|
|
|
|
|
Assert.notEmpty(atomicIndexId, "原子指标id不能为空");
|
|
|
|
|
List<AtomicIndexUsedDTO> atomicUsed = modelAtomicIndexService.atomicUsed(atomicIndexId);
|
|
|
|
|
// 根据指标id和案件类型id进行去重
|
|
|
|
|
return atomicUsed.stream().filter(dto -> StrUtil.isNotEmpty(dto.getIndexId()))
|
|
|
|
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
|
|
|
|
|
new TreeSet<>(Comparator.comparing(o -> o.getIndexId() + "-" + o.getModelId()))), ArrayList::new));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 复制指标
|
|
|
|
|
* @param modelIndex 指标
|
|
|
|
|
* @param caseType 案件类型
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private ModelIndex modelIndexCopy(ModelIndex modelIndex,String caseType) {
|
|
|
|
|
ModelIndex newIndex = new ModelIndex();
|
|
|
|
|
newIndex.setName(modelIndex.getName());
|
|
|
|
|
newIndex.setShortName(modelIndex.getShortName());
|
|
|
|
|
newIndex.setRemark(modelIndex.getRemark());
|
|
|
|
|
newIndex.setIndexType(modelIndex.getIndexType());
|
|
|
|
|
newIndex.setIndexScore(modelIndex.getIndexScore());
|
|
|
|
|
newIndex.setAtomicIndexNum(modelIndex.getAtomicIndexNum());
|
|
|
|
|
newIndex.setCaseType(caseType);
|
|
|
|
|
newIndex.setJudgeLogic(modelIndex.getJudgeLogic());
|
|
|
|
|
newIndex.setIndexRule(modelIndex.getIndexRule());
|
|
|
|
|
newIndex.setDataStatus(modelIndex.getDataStatus());
|
|
|
|
|
return newIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<WebRelDTO> generateRelations(List<Record> records) {
|
|
|
|
|
|
|
|
|
|