图谱查询规则判断加入数量过滤

topo_dev
DESKTOP-DDTUS3E\yaxin 6 months ago
parent 5498fd9ad2
commit 70775cca50

@ -22,6 +22,7 @@ import com.supervision.police.dto.caseScore.CaseScoreDetailDTO;
import com.supervision.police.dto.indexRule.IndexRule;
import com.supervision.police.dto.indexRule.Operand;
import com.supervision.police.dto.indexRule.OperandUnit;
import com.supervision.police.dto.indexRule.RuleCondition;
import com.supervision.police.mapper.*;
import com.supervision.police.mybatis.RowSqlMapper;
import com.supervision.police.service.*;
@ -234,7 +235,7 @@ public class ModelServiceImpl implements ModelService {
operandUnitResultSet.add(relationSymbol == dbIndexAnalysis(caseId, modelAtomicIndex.getQueryLang(), result));
break;
case OPERAND_TYPE_GRAPH:
operandUnitResultSet.add(relationSymbol == graphIndexAnalysis(casePerson.getName(), modelAtomicIndex, analyseCaseDTO, result));
operandUnitResultSet.add(relationSymbol == graphIndexAnalysis(casePerson.getName(), modelAtomicIndex.getQueryLang(), analyseCaseDTO.getCaseId(), ruleCondition, result));
break;
case OPERAND_TYPE_STRUCTURE:
ruleCondition.getOperandUnitList().forEach(operandUnit -> operandUnitResultSet.add(structureIndexAnalysis(operandUnit, ruleCondition.getAtomicIndexId(), atomicIndices, notePrompts, evidenceDirectories, caseEvidences, result)));
@ -327,12 +328,14 @@ public class ModelServiceImpl implements ModelService {
/**
*
*
* @param casePersonName
* @param modelAtomicIndex
* @param analyseCaseDTO
* @param casePersonName
* @param queryLang
* @param caseId ID
* @param ruleCondition
* @param atomicResult
* @return
*/
private boolean graphIndexAnalysis(String casePersonName, ModelAtomicIndex modelAtomicIndex, AnalyseCaseDTO analyseCaseDTO, ModelAtomicResult atomicResult) {
private boolean graphIndexAnalysis(String casePersonName, String queryLang, String caseId, RuleCondition ruleCondition, ModelAtomicResult atomicResult) {
boolean flag = false;
Session session = driver.session();
//图谱
@ -340,21 +343,22 @@ public class ModelServiceImpl implements ModelService {
// 行为人
params.put("lawActor", casePersonName);
// 案号
params.put("caseId", analyseCaseDTO.getCaseId());
params.put("caseId", caseId);
Result run;
try {
run = session.run(modelAtomicIndex.getQueryLang(), params);
run = session.run(queryLang, params);
} catch (Exception e) {
log.error("图数据库查询出现错误,查询语句{},参数{}", modelAtomicIndex.getQueryLang(), JSONUtil.toJsonStr(params), e);
log.error("图数据库查询出现错误,查询语句{},参数{}", queryLang, JSONUtil.toJsonStr(params), e);
return flag;
}
List<ResultDTO> res = Neo4jUtils.getResultDTOList(run);
int count = 0;
if (!res.isEmpty()) {
// 进行遍历,如果有存在的,就设置为有
for (ResultDTO resultDTO : res) {
if (StringUtils.isNotEmpty(resultDTO.getRelId())) {
//存在关系
flag = true;
count++;
atomicResult.setAtomicResult(JudgeResultEnum.EXIST.getCode());
atomicResult.setRecordId(resultDTO.getRecordId());
// 在退出循环之前先合并相关文本分片id
@ -366,6 +370,9 @@ public class ModelServiceImpl implements ModelService {
}
}
}
if (CalculationUtil.evaluateExpression(String.valueOf(count), ruleCondition.getOperator(), ruleCondition.getValue())) {
flag = true;
}
modelAtomicResultService.saveOrUpdate(atomicResult);
return flag;
}

Loading…
Cancel
Save