|
|
@ -1,15 +1,11 @@
|
|
|
|
package com.supervision.police.service.impl;
|
|
|
|
package com.supervision.police.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
import com.supervision.chat.UploadParamEnum;
|
|
|
|
|
|
|
|
import com.supervision.chat.client.CustomMultipartFile;
|
|
|
|
|
|
|
|
import com.supervision.chat.client.LangChainChatService;
|
|
|
|
import com.supervision.chat.client.LangChainChatService;
|
|
|
|
import com.supervision.chat.client.dto.DeleteFileDTO;
|
|
|
|
|
|
|
|
import com.supervision.chat.client.dto.LangChainChatRes;
|
|
|
|
|
|
|
|
import com.supervision.common.utils.IPages;
|
|
|
|
import com.supervision.common.utils.IPages;
|
|
|
|
import com.supervision.common.utils.ListUtils;
|
|
|
|
import com.supervision.common.utils.ListUtils;
|
|
|
|
import com.supervision.common.utils.StringUtils;
|
|
|
|
import com.supervision.common.utils.StringUtils;
|
|
|
@ -333,4 +329,71 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
modelAtomicResultService.lambdaUpdate().eq(ModelAtomicResult::getRecordId, id).remove();
|
|
|
|
modelAtomicResultService.lambdaUpdate().eq(ModelAtomicResult::getRecordId, id).remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Map<String, Object> queryRecordList(NoteRecord noteRecord, Integer page, Integer size) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<NoteRecordDTO> noteRecordDTOList = noteRecordService.selectNoteRecordDTOList(noteRecord);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询关联文件数据
|
|
|
|
|
|
|
|
List<String> fileIdList = noteRecordDTOList.stream().map(NoteRecordDTO::getFileIds).filter(StringUtils::isNotEmpty)
|
|
|
|
|
|
|
|
.flatMap(s -> Arrays.stream(s.split(","))).distinct().toList();
|
|
|
|
|
|
|
|
Map<String, MinioFile> fileMap = minioService.listMinioFile(fileIdList).stream().collect(Collectors.toMap(MinioFile::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询关联角色字典
|
|
|
|
|
|
|
|
Map<String, String> caseRoleDicMap = comDictionaryService.getDictionaryMap("case_role");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<NoteRecordDetailDTO> noteRecordDetailDTOList = noteRecordDTOList.stream().filter(item -> StringUtils.isNotBlank(item.getName())).map(item -> {
|
|
|
|
|
|
|
|
NoteRecordDetailDTO noteRecordDetailDTO = new NoteRecordDetailDTO(item, fileMap);
|
|
|
|
|
|
|
|
noteRecordDetailDTO.setRoleName(caseRoleDicMap.get(item.getRole()));
|
|
|
|
|
|
|
|
return noteRecordDetailDTO;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取所有的task任务
|
|
|
|
|
|
|
|
List<CaseTaskRecord> taskList = caseTaskRecordService.lambdaQuery().eq(CaseTaskRecord::getCaseId, noteRecord.getCaseId()).list();
|
|
|
|
|
|
|
|
Map<String, CaseTaskRecord> taskRecordMap = taskList.stream().collect(Collectors.toMap(CaseTaskRecord::getRecordId, Function.identity(), (k1, k2) -> k1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setRecordDetailSerialNumber(noteRecordDetailDTOList);
|
|
|
|
|
|
|
|
for (NoteRecordDetailDTO recordDetailDTO : noteRecordDetailDTOList) {
|
|
|
|
|
|
|
|
// 获取文件的文件名称
|
|
|
|
|
|
|
|
Set<String> fileNameSet = recordDetailDTO.getFileList().stream().map(NoteRecordFileDTO::getFileName).collect(Collectors.toSet());
|
|
|
|
|
|
|
|
recordDetailDTO.setConfessionMaterial(CollUtil.join(fileNameSet, ";"));
|
|
|
|
|
|
|
|
recordDetailDTO.setPercentageValue(taskRecordMap.get(recordDetailDTO.getId()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
noteRecordDetailDTOList.sort(Comparator.comparing(NoteRecordDetailDTO::getSerialNumber));
|
|
|
|
|
|
|
|
List<NoteRecordDetailDTO> pager = ListUtils.Pager(size, page, noteRecordDetailDTOList);
|
|
|
|
|
|
|
|
return IPages.buildDataMap(pager, noteRecordDetailDTOList.size());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setRecordDetailSerialNumber(List<NoteRecordDetailDTO> noteRecordDetailDTOList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Pair<String, Integer>> pairs = new ArrayList<>();
|
|
|
|
|
|
|
|
for (NoteRecordDetailDTO noteRecordDetailDTO : noteRecordDetailDTOList) {
|
|
|
|
|
|
|
|
String personId = noteRecordDetailDTO.getPersonId();
|
|
|
|
|
|
|
|
int index = findPair(pairs, personId);
|
|
|
|
|
|
|
|
if (index == -1){
|
|
|
|
|
|
|
|
pairs.add(Pair.of(personId, 1));
|
|
|
|
|
|
|
|
index = findPair(pairs, personId);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
pairs.set(index, Pair.of(personId, pairs.get(index).getValue() + 1));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
noteRecordDetailDTO.setSerialNumber(index+1 + "." + pairs.get(index).getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int findPair(List<Pair<String, Integer>> pairs, String personId) {
|
|
|
|
|
|
|
|
for (int i = 0; i < pairs.size(); i++) {
|
|
|
|
|
|
|
|
Pair<String, Integer> pair = pairs.get(i);
|
|
|
|
|
|
|
|
if (StrUtil.equals(personId, pair.getKey())) {
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|