|
|
|
@ -840,22 +840,12 @@ public class CaseEvidenceServiceImpl extends ServiceImpl<CaseEvidenceMapper, Cas
|
|
|
|
|
List<EvidenceDirectoryDTO> evidenceDirectoryDTOS = listFileTree(caseId, batchNo, evidenceId, null);
|
|
|
|
|
|
|
|
|
|
List<CaseEvidence> caseEvidenceList = this.lambdaQuery().eq(CaseEvidence::getCaseId, caseId).list();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 强行翻译
|
|
|
|
|
Map<String, String> dictionaryMap = comDictionaryService.getDictionaryMapReverse("prompt_attribute_valuetype");
|
|
|
|
|
for (CaseEvidence caseEvidence : caseEvidenceList) {
|
|
|
|
|
List<NotePromptExtractAttributesDto> property = caseEvidence.getProperty();
|
|
|
|
|
if (CollUtil.isNotEmpty(property)) {
|
|
|
|
|
for (NotePromptExtractAttributesDto notePromptExtractAttributesDto : property) {
|
|
|
|
|
String attrValueType = notePromptExtractAttributesDto.getAttrValueType();
|
|
|
|
|
if (StrUtil.isNotEmpty(attrValueType) && dictionaryMap.containsKey(attrValueType)) {
|
|
|
|
|
notePromptExtractAttributesDto.setAttrValueType(dictionaryMap.get(attrValueType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rebuildEvidenceProperties(new EvidenceDirectoryDTO(evidenceDirectoryDTOS), caseEvidenceList);
|
|
|
|
|
|
|
|
|
|
List<CategoryPromptDTO> categoryPromptDTOS = evidenceDirectoryService.listCategoryPrompt(caseId);
|
|
|
|
|
|
|
|
|
|
Map<String, CaseEvidence> caseEvidenceMap = caseEvidenceList.stream().collect(Collectors.toMap(CaseEvidence::getId, Function.identity()));
|
|
|
|
|
Map<String, CategoryPromptDTO> categoryPromptMap = categoryPromptDTOS.stream().collect(Collectors.toMap(CategoryPromptDTO::getDirectoryId, k -> k, (v1, v2) -> v1));
|
|
|
|
|
|
|
|
|
@ -873,6 +863,61 @@ public class CaseEvidenceServiceImpl extends ServiceImpl<CaseEvidenceMapper, Cas
|
|
|
|
|
return evidenceDirectoryDTOS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 重新构建证据属性数据
|
|
|
|
|
* @param rootDirectory 根目录
|
|
|
|
|
* @param caseEvidenceList 案件证据列表
|
|
|
|
|
*/
|
|
|
|
|
private void rebuildEvidenceProperties(EvidenceDirectoryDTO rootDirectory, List<CaseEvidence> caseEvidenceList) {
|
|
|
|
|
|
|
|
|
|
List<String> categoryIds = caseEvidenceList.stream().map(e -> {
|
|
|
|
|
EvidenceDirectoryDTO directory = rootDirectory.findDirectory(e.getDirectoryId());
|
|
|
|
|
if (null == directory) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return directory.getCategoryId();
|
|
|
|
|
}).filter(StrUtil::isNotEmpty).distinct().toList();
|
|
|
|
|
|
|
|
|
|
Map<String, String> directoryIdMapCategoryId = caseEvidenceList.stream()
|
|
|
|
|
.filter(e -> StrUtil.isNotEmpty(e.getDirectoryId()) && null != rootDirectory.findDirectory(e.getDirectoryId()))
|
|
|
|
|
.map(CaseEvidence::getDirectoryId).distinct().collect(
|
|
|
|
|
Collectors.toMap(directoryId -> directoryId,di-> rootDirectory.findDirectory(di).getCategoryId()));
|
|
|
|
|
|
|
|
|
|
List<NotePrompt> notePromptList = CollUtil.isEmpty(directoryIdMapCategoryId.values()) ? new ArrayList<>() : notePromptService.lambdaQuery().in(NotePrompt::getEvidenceCategoryId, categoryIds).list();
|
|
|
|
|
Map<String, List<NotePromptExtractAttributesDto>> categoryIdMapExtractAttributes = notePromptList.stream().collect(Collectors.toMap(NotePrompt::getEvidenceCategoryId, NotePrompt::getExtractAttributes, (v1, v2) -> v1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (CaseEvidence caseEvidence : caseEvidenceList) {
|
|
|
|
|
if (StrUtil.isEmpty(caseEvidence.getDirectoryId())){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
String categoryId = directoryIdMapCategoryId.get(caseEvidence.getDirectoryId());
|
|
|
|
|
if (StrUtil.isEmpty(categoryId)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<NotePromptExtractAttributesDto> merged = mergeExtractAttributes(caseEvidence.getProperty(), categoryIdMapExtractAttributes.get(categoryId));
|
|
|
|
|
caseEvidence.setProperty(merged);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<NotePromptExtractAttributesDto> mergeExtractAttributes(List<NotePromptExtractAttributesDto> property, List<NotePromptExtractAttributesDto> attributesTemplates) {
|
|
|
|
|
if (CollUtil.isEmpty(attributesTemplates)){
|
|
|
|
|
return attributesTemplates;
|
|
|
|
|
}
|
|
|
|
|
for (NotePromptExtractAttributesDto attributesTemplate : attributesTemplates) {
|
|
|
|
|
String attrName = attributesTemplate.getAttrName();
|
|
|
|
|
for (NotePromptExtractAttributesDto attributesDto : property) {
|
|
|
|
|
if (StrUtil.equals(attributesDto.getAttrName(), attrName)){
|
|
|
|
|
attributesTemplate.setAttrValue(attributesDto.getAttrValue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return attributesTemplates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String generateDirectoryName(String caseId, String categoryId, String provider) {
|
|
|
|
|