|
|
|
@ -30,7 +30,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.util.StopWatch;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -63,6 +62,8 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
private RecordSplitProcessService recordSplitProcessService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ModelRecordTypeService modelRecordTypeService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private NoteRecordService noteRecordService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -136,7 +137,7 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public R<?> saveType(ModelRecordType type) {
|
|
|
|
|
String id = type.getId();
|
|
|
|
|
int i = 0;
|
|
|
|
|
int i;
|
|
|
|
|
if (StringUtils.isEmpty(id)) {
|
|
|
|
|
//新增
|
|
|
|
|
i = modelRecordTypeMapper.insert(type);
|
|
|
|
@ -157,7 +158,6 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
if (CollUtil.isEmpty(typeList)) {
|
|
|
|
|
throw new RuntimeException("类型信息不能为空");
|
|
|
|
|
}
|
|
|
|
|
int i = 0;
|
|
|
|
|
boolean save;
|
|
|
|
|
if (StringUtils.isEmpty(prompt.getId())) {
|
|
|
|
|
// 新增的时候,校验是否已经存在相同的三元组关系,如果已经存在了相同的三元组关系,不允许添加
|
|
|
|
@ -222,7 +222,23 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (save) {
|
|
|
|
|
// 获取所有的类型
|
|
|
|
|
List<ModelRecordType> modelRecordTypes = list();
|
|
|
|
|
// 根据提示词id获取类型和提示词的关系表
|
|
|
|
|
List<NotePromptTypeRel> relList = notePromptTypeRelService.list(new QueryWrapper<NotePromptTypeRel>().eq("prompt_id", prompt.getId()));
|
|
|
|
|
//根据typeId集合过滤出对应的modelRecordType的name
|
|
|
|
|
List<String> typeNames = modelRecordTypes.stream().filter(e -> relList.stream().map(NotePromptTypeRel::getTypeId).toList().contains(e.getId())).map(ModelRecordType::getRecordType).toList();
|
|
|
|
|
//根据typeNames模糊匹配查询note_record_split
|
|
|
|
|
List<NoteRecordSplit> noteRecordSplits = noteRecordSplitService.list().stream()
|
|
|
|
|
.filter(record -> record != null && record.getRecordType() != null && typeNames.stream().anyMatch(typeName -> Arrays.asList(record.getRecordType().split(",")).contains(typeName)))
|
|
|
|
|
.toList();
|
|
|
|
|
//过滤并去重涉及到的的note_record_id
|
|
|
|
|
Set<String> recordIds = noteRecordSplits.stream().map(NoteRecordSplit::getNoteRecordId).collect(Collectors.toSet());
|
|
|
|
|
//根据note_record_id更新note_record表的isPromptUpdate字段
|
|
|
|
|
log.info("开始更新笔录表提示词更新状态【is_prompt_update】,涉及到的笔录有:{}", recordIds);
|
|
|
|
|
boolean updated = noteRecordService.update(new UpdateWrapper<NoteRecord>().set("is_prompt_update", true).in("id", recordIds));
|
|
|
|
|
|
|
|
|
|
if (save && updated) {
|
|
|
|
|
return R.ok("保存成功");
|
|
|
|
|
} else {
|
|
|
|
|
return R.fail("保存失败");
|
|
|
|
@ -280,8 +296,8 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
if (caseTaskRecord.getStatus() == 0 || caseTaskRecord.getStatus() == 3) {
|
|
|
|
|
// 重新提交
|
|
|
|
|
caseTaskRecordService.lambdaUpdate().set(CaseTaskRecord::getStatus, 1)
|
|
|
|
|
.set(CaseTaskRecord::getTaskCount,0)
|
|
|
|
|
.set(CaseTaskRecord::getFinishCount,0)
|
|
|
|
|
.set(CaseTaskRecord::getTaskCount, 0)
|
|
|
|
|
.set(CaseTaskRecord::getFinishCount, 0)
|
|
|
|
|
.eq(CaseTaskRecord::getId, caseTaskRecord.getId()).update();
|
|
|
|
|
List<ModelRecordType> allTypeList = modelRecordTypeService.lambdaQuery().list();
|
|
|
|
|
// 根据recordId查询所有的分割后的笔录
|
|
|
|
@ -408,12 +424,11 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String addNeo4j(List<String> ids, String recordId) {
|
|
|
|
|
if (StrUtil.isBlank(recordId)){
|
|
|
|
|
if (StrUtil.isBlank(recordId)) {
|
|
|
|
|
throw new BusinessException("记录ID不能为空");
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(ids)) {
|
|
|
|
|
List<TripleInfo> tripleInfos = tripleInfoService.listByIds(ids);
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (TripleInfo tripleInfo : tripleInfos) {
|
|
|
|
|
try {
|
|
|
|
|
//开始节点
|
|
|
|
@ -445,7 +460,6 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
|
|
|
|
|
tripleInfo.setEndNodeGraphId(endNode.getId());
|
|
|
|
|
boolean updateResult = tripleInfoService.updateById(tripleInfo);
|
|
|
|
|
if (updateResult) {
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage(), e);
|
|
|
|
|