|
|
|
@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.date.TimeInterval;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
|
|
|
@ -13,6 +14,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.supervision.common.constant.EvidenceConstants;
|
|
|
|
|
import com.supervision.common.constant.IndexRuleConstants;
|
|
|
|
|
import com.supervision.minio.domain.MinioFile;
|
|
|
|
|
import com.supervision.minio.service.MinioService;
|
|
|
|
|
import com.supervision.police.domain.*;
|
|
|
|
@ -31,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
@ -325,7 +328,13 @@ public class CaseEvidenceServiceImpl extends ServiceImpl<CaseEvidenceMapper, Cas
|
|
|
|
|
llmExtractDto.setExtractAttributes(notePrompt.getExtractAttributes());
|
|
|
|
|
List<LLMExtractDto> llmExtractDtos = llmExtractService.extractAttribute(Collections.singletonList(llmExtractDto));
|
|
|
|
|
if (!llmExtractDtos.isEmpty()) {
|
|
|
|
|
caseEvidence.setProperty(llmExtractDtos.get(0).getExtractAttributes());
|
|
|
|
|
List<NotePromptExtractAttributesDto> extractAttributes = llmExtractDtos.get(0).getExtractAttributes()
|
|
|
|
|
.stream().filter(Objects::nonNull).peek(extractAttribute -> {
|
|
|
|
|
if (!checkExtractAttributes(extractAttribute)) {
|
|
|
|
|
extractAttribute.setAttrValue(null);
|
|
|
|
|
}
|
|
|
|
|
}).toList();
|
|
|
|
|
caseEvidence.setProperty(extractAttributes);
|
|
|
|
|
}
|
|
|
|
|
log.info("属性提取完成。更新证据处理状态为【属性提取完成】。属性:【{}】。耗时:【{}】", caseEvidence.getProperty(), System.currentTimeMillis() - attrStart);
|
|
|
|
|
caseEvidence.setProcessStatus(EvidenceConstants.PROCESS_STATUS_ATTR_EXTRACT_OK);
|
|
|
|
@ -345,6 +354,31 @@ public class CaseEvidenceServiceImpl extends ServiceImpl<CaseEvidenceMapper, Cas
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 校验属性值格式是否正确
|
|
|
|
|
* @param extract 属性信息
|
|
|
|
|
* @return 校验结果
|
|
|
|
|
*/
|
|
|
|
|
private boolean checkExtractAttributes(NotePromptExtractAttributesDto extract){
|
|
|
|
|
if (null == extract){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
String attrValueType = extract.getAttrValueType();
|
|
|
|
|
if (StrUtil.equals(attrValueType, IndexRuleConstants.VALUE_TYPE_DATE)){ // 日期
|
|
|
|
|
try {
|
|
|
|
|
new SimpleDateFormat("yyyy-MM-dd").parse(extract.getAttrValue());
|
|
|
|
|
return true;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("属性:{},日期:{}格式错误", extract.getAttrName(),extract.getAttrValue(),e);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.equals(attrValueType, IndexRuleConstants.VALUE_TYPE_NUMBER)) { // 数字
|
|
|
|
|
return NumberUtil.isLong(extract.getAttrValue()) || NumberUtil.isDouble(extract.getAttrValue());
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void callEvidenceAnalysis(String evidenceId) {
|
|
|
|
|
Assert.notEmpty(evidenceId, "证据ID不能为空");
|
|
|
|
@ -890,6 +924,15 @@ public class CaseEvidenceServiceImpl extends ServiceImpl<CaseEvidenceMapper, Cas
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<NotePromptExtractAttributesDto> merged = mergeExtractAttributes(caseEvidence.getProperty(), categoryIdMapExtractAttributes.get(categoryId));
|
|
|
|
|
|
|
|
|
|
if (null != merged){
|
|
|
|
|
merged = merged.stream().filter(Objects::nonNull).peek(e -> {
|
|
|
|
|
if (!checkExtractAttributes(e)) {
|
|
|
|
|
e.setAttrValue(null);
|
|
|
|
|
}
|
|
|
|
|
}).toList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
caseEvidence.setProperty(merged);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|