优化类名

topo_dev
liu 11 months ago
parent 0aa3a06879
commit f10f1843fc

@ -3,16 +3,14 @@ package com.supervision.police.controller;
import com.supervision.common.domain.R; import com.supervision.common.domain.R;
import com.supervision.police.domain.ModelRecordType; import com.supervision.police.domain.ModelRecordType;
import com.supervision.police.domain.NotePrompt; import com.supervision.police.domain.NotePrompt;
import com.supervision.police.domain.NoteRecords; import com.supervision.police.domain.NoteRecord;
import com.supervision.police.domain.TripleInfo; import com.supervision.police.domain.TripleInfo;
import com.supervision.police.dto.ListDTO; import com.supervision.police.dto.ListDTO;
import com.supervision.police.service.ModelRecordTypeService; import com.supervision.police.service.ModelRecordTypeService;
import com.supervision.police.service.RecordService; import com.supervision.police.service.RecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -102,7 +100,7 @@ public class RecordController {
* @return * @return
*/ */
@PostMapping("/addOrUpdRecords") @PostMapping("/addOrUpdRecords")
public R<String> uploadRecords(NoteRecords records, public R<String> uploadRecords(NoteRecord records,
@RequestPart("file") List<MultipartFile> fileList) throws IOException { @RequestPart("file") List<MultipartFile> fileList) throws IOException {
return R.ok(recordService.uploadRecords(records, fileList)); return R.ok(recordService.uploadRecords(records, fileList));
} }
@ -110,16 +108,16 @@ public class RecordController {
/** /**
* *
* *
* @param noteRecords * @param noteRecord
* @param page * @param page
* @param size * @param size
* @return * @return
*/ */
@PostMapping("/queryRecords") @PostMapping("/queryRecords")
public R<Map<String, Object>> queryRecords(@RequestBody NoteRecords noteRecords, public R<Map<String, Object>> queryRecords(@RequestBody NoteRecord noteRecord,
@RequestParam(required = false, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "1") Integer page,
@RequestParam(required = false, defaultValue = "20") Integer size) { @RequestParam(required = false, defaultValue = "20") Integer size) {
return R.ok(recordService.queryRecords(noteRecords, page, size)); return R.ok(recordService.queryRecords(noteRecord, page, size));
} }
/** /**

@ -37,7 +37,7 @@ public class ModelRecordType implements Serializable {
* *
*/ */
@TableField(exist = false) @TableField(exist = false)
private List<NoteRecord> records; private List<NoteRecordSplit> records;
/** /**
* ID * ID

@ -1,5 +1,7 @@
package com.supervision.police.domain; package com.supervision.police.domain;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -8,16 +10,18 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.util.List;
import java.util.Date;
@TableName(value = "note_record") /**
* (NoteRecord)
*
* @author qmy
* @since 2024-07-05 08:53:20
*/
@Data @Data
@TableName("note_records")
public class NoteRecord implements Serializable { public class NoteRecord implements Serializable {
/**
* ID
*/
@TableId @TableId
private String id; private String id;
@ -27,40 +31,60 @@ public class NoteRecord implements Serializable {
private String caseId; private String caseId;
/** /**
* *
*/ */
private String personName; private String recordName;
/** /**
* * id
*/ */
private String noteName; private String fileIds;
/** /**
* *
*/ */
private String question; private String name;
/** /**
* *
*/ */
private String answer; private String role;
/** /**
* () *
*/ */
private String recordType; private Integer confessionMaterial;
/** /**
* id *
*/ */
@TableField(exist = false) private String lawAsker;
private String recordTypeId;
/**
*
*/
// @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8")
private String confessionStartTime;
/** /**
* id *
*/ */
private String noteRecordsId; // @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8")
private String confessionEndTime;
/**
*
*/
private Integer indexNum;
/**
*
*/
private String dataStatus;
@TableField(exist = false)
private List<NoteRecord> children;
/** /**
* ID * ID
@ -89,4 +113,6 @@ public class NoteRecord implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -1,29 +1,25 @@
package com.supervision.police.domain; package com.supervision.police.domain;
import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.time.LocalDateTime;
/** /**
* (NoteRecords) *
*
* @author qmy
* @since 2024-07-05 08:53:20
*/ */
@TableName(value = "note_record_split")
@Data @Data
@TableName("note_records") public class NoteRecordSplit implements Serializable {
public class NoteRecords implements Serializable {
/**
* ID
*/
@TableId @TableId
private String id; private String id;
@ -33,60 +29,40 @@ public class NoteRecords implements Serializable {
private String caseId; private String caseId;
/** /**
* *
*/
private String recordName;
/**
* id
*/
private String fileIds;
/**
*
*/
private String name;
/**
*
*/ */
private String role; private String personName;
/** /**
* *
*/ */
private Integer confessionMaterial; private String noteName;
/** /**
* *
*/ */
private String lawAsker; private String question;
/** /**
* *
*/ */
// @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8") private String answer;
private String confessionStartTime;
/** /**
* * ()
*/ */
// @JsonFormat(pattern="yyyy-MM-dd HH:mm",timezone = "GMT+8") private String recordType;
private String confessionEndTime;
/** /**
* * id
*/ */
private Integer indexNum; @TableField(exist = false)
private String recordTypeId;
/** /**
* * id
*/ */
private String dataStatus; private String noteRecordsId;
@TableField(exist = false)
private List<NoteRecords> children;
/** /**
* ID * ID
@ -115,6 +91,4 @@ public class NoteRecords implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

@ -2,16 +2,14 @@ package com.supervision.police.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.supervision.police.domain.NoteRecord; import com.supervision.police.domain.NoteRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (NoteRecord)访
*
* @author qmy
* @since 2024-07-05 08:53:20
*/
public interface NoteRecordMapper extends BaseMapper<NoteRecord> { public interface NoteRecordMapper extends BaseMapper<NoteRecord> {
List<NoteRecord> selectByRecordType(@Param("recordType") String recordType);
List<NoteRecord> selectRecord(@Param("caseId") String caseId,
@Param("name") String name,
@Param("recordId") String recordId);
} }

@ -0,0 +1,17 @@
package com.supervision.police.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.supervision.police.domain.NoteRecordSplit;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface NoteRecordSplitMapper extends BaseMapper<NoteRecordSplit> {
List<NoteRecordSplit> selectByRecordType(@Param("recordType") String recordType);
List<NoteRecordSplit> selectRecord(@Param("caseId") String caseId,
@Param("name") String name,
@Param("recordId") String recordId);
}

@ -1,15 +0,0 @@
package com.supervision.police.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.supervision.police.domain.NoteRecords;
/**
* (NoteRecords)访
*
* @author qmy
* @since 2024-07-05 08:53:20
*/
public interface NoteRecordsMapper extends BaseMapper<NoteRecords> {
}

@ -1,20 +1,19 @@
package com.supervision.police.service; package com.supervision.police.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.supervision.common.domain.R;
import com.supervision.police.domain.NoteRecord; import com.supervision.police.domain.NoteRecord;
import com.supervision.police.domain.NoteRecords; import com.supervision.police.domain.NoteRecordSplit;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public interface RecordService extends IService<NoteRecord> { public interface RecordService extends IService<NoteRecordSplit> {
String uploadRecords(NoteRecords records, List<MultipartFile> fileList) throws IOException; String uploadRecords(NoteRecord records, List<MultipartFile> fileList) throws IOException;
Map<String, Object> queryRecords(NoteRecords noteRecords, Integer page, Integer size); Map<String, Object> queryRecords(NoteRecord noteRecord, Integer page, Integer size);
void delRecords(String id); void delRecords(String id);

@ -10,11 +10,11 @@ import com.supervision.neo4j.domain.CaseNode;
import com.supervision.neo4j.domain.Rel; import com.supervision.neo4j.domain.Rel;
import com.supervision.neo4j.service.Neo4jService; import com.supervision.neo4j.service.Neo4jService;
import com.supervision.police.domain.ModelRecordType; import com.supervision.police.domain.ModelRecordType;
import com.supervision.police.domain.NoteRecord; import com.supervision.police.domain.NoteRecordSplit;
import com.supervision.police.domain.NotePrompt; import com.supervision.police.domain.NotePrompt;
import com.supervision.police.domain.TripleInfo; import com.supervision.police.domain.TripleInfo;
import com.supervision.police.mapper.ModelRecordTypeMapper; import com.supervision.police.mapper.ModelRecordTypeMapper;
import com.supervision.police.mapper.NoteRecordMapper; import com.supervision.police.mapper.NoteRecordSplitMapper;
import com.supervision.police.mapper.NotePromptMapper; import com.supervision.police.mapper.NotePromptMapper;
import com.supervision.police.mapper.TripleInfoMapper; import com.supervision.police.mapper.TripleInfoMapper;
import com.supervision.police.service.ModelRecordTypeService; import com.supervision.police.service.ModelRecordTypeService;
@ -23,19 +23,14 @@ import lombok.extern.slf4j.Slf4j;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.ai.chat.ChatResponse; import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.Generation;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage; import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt; import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatClient; import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -45,7 +40,7 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
private final ModelRecordTypeMapper modelRecordTypeMapper; private final ModelRecordTypeMapper modelRecordTypeMapper;
private final NoteRecordMapper noteRecordMapper; private final NoteRecordSplitMapper noteRecordSplitMapper;
private final NotePromptMapper notePromptMapper; private final NotePromptMapper notePromptMapper;
@ -64,7 +59,7 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
for (ModelRecordType modelRecordType : list) { for (ModelRecordType modelRecordType : list) {
//笔录内容 //笔录内容
List<NoteRecord> noteRecords = noteRecordMapper.selectByRecordType(modelRecordType.getRecordType()); List<NoteRecordSplit> noteRecords = noteRecordSplitMapper.selectByRecordType(modelRecordType.getRecordType());
modelRecordType.setRecords(noteRecords); modelRecordType.setRecords(noteRecords);
//提示词 //提示词
List<NotePrompt> prompts = notePromptMapper.queryPrompt(modelRecordType.getId()); List<NotePrompt> prompts = notePromptMapper.queryPrompt(modelRecordType.getId());
@ -124,9 +119,9 @@ public class ModelRecordTypeServiceImpl extends ServiceImpl<ModelRecordTypeMappe
} }
private List<TripleInfo> extractTripleInfo(String caseId, String name, String recordId) { private List<TripleInfo> extractTripleInfo(String caseId, String name, String recordId) {
List<NoteRecord> records = noteRecordMapper.selectRecord(caseId, name, recordId); List<NoteRecordSplit> records = noteRecordSplitMapper.selectRecord(caseId, name, recordId);
List<TripleInfo> tripleInfos = new ArrayList<>(); List<TripleInfo> tripleInfos = new ArrayList<>();
for (NoteRecord record : records) { for (NoteRecordSplit record : records) {
List<NotePrompt> prompts = notePromptMapper.queryPrompt(record.getRecordTypeId()); List<NotePrompt> prompts = notePromptMapper.queryPrompt(record.getRecordTypeId());
for (NotePrompt prompt : prompts) { for (NotePrompt prompt : prompts) {
if (StringUtils.isEmpty(prompt.getPrompt())) { if (StringUtils.isEmpty(prompt.getPrompt())) {

@ -2,10 +2,8 @@ package com.supervision.police.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.common.domain.R;
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;
@ -13,13 +11,12 @@ import com.supervision.minio.domain.MinioFile;
import com.supervision.minio.mapper.MinioFileMapper; import com.supervision.minio.mapper.MinioFileMapper;
import com.supervision.minio.service.MinioService; import com.supervision.minio.service.MinioService;
import com.supervision.police.domain.ModelCase; import com.supervision.police.domain.ModelCase;
import com.supervision.police.domain.ModelRecordType; import com.supervision.police.domain.NoteRecordSplit;
import com.supervision.police.domain.NoteRecord; import com.supervision.police.domain.NoteRecord;
import com.supervision.police.domain.NoteRecords;
import com.supervision.police.mapper.ModelCaseMapper; import com.supervision.police.mapper.ModelCaseMapper;
import com.supervision.police.mapper.ModelRecordTypeMapper; import com.supervision.police.mapper.ModelRecordTypeMapper;
import com.supervision.police.mapper.NoteRecordSplitMapper;
import com.supervision.police.mapper.NoteRecordMapper; import com.supervision.police.mapper.NoteRecordMapper;
import com.supervision.police.mapper.NoteRecordsMapper;
import com.supervision.police.service.RecordService; import com.supervision.police.service.RecordService;
import com.supervision.springaidemo.dto.QARecordNodeDTO; import com.supervision.springaidemo.dto.QARecordNodeDTO;
import com.supervision.springaidemo.util.RecordRegexUtil; import com.supervision.springaidemo.util.RecordRegexUtil;
@ -28,15 +25,10 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.ai.chat.ChatResponse; import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.Generation;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.SystemMessage;
import org.springframework.ai.chat.messages.UserMessage; import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.prompt.Prompt; import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatClient; import org.springframework.ai.ollama.OllamaChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -48,11 +40,11 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord> implements RecordService { public class RecordServiceImpl extends ServiceImpl<NoteRecordSplitMapper, NoteRecordSplit> implements RecordService {
private final NoteRecordMapper noteRecordMapper; private final NoteRecordSplitMapper noteRecordSplitMapper;
private final NoteRecordsMapper noteRecordsMapper; private final NoteRecordMapper noteRecordMapper;
private final MinioService minioService; private final MinioService minioService;
@ -65,7 +57,7 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
@Override @Override
// @Transactional(rollbackFor = Exception.class) // @Transactional(rollbackFor = Exception.class)
public String uploadRecords(NoteRecords records, List<MultipartFile> fileList) throws IOException { public String uploadRecords(NoteRecord records, List<MultipartFile> fileList) throws IOException {
//上传文件获取文件ids //上传文件获取文件ids
List<String> fileIds = new ArrayList<>(); List<String> fileIds = new ArrayList<>();
for (MultipartFile file : fileList) { for (MultipartFile file : fileList) {
@ -98,9 +90,9 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
} }
int i = 0; int i = 0;
if (StringUtils.isEmpty(records.getId())) { if (StringUtils.isEmpty(records.getId())) {
i = noteRecordsMapper.insert(records); i = noteRecordMapper.insert(records);
} else { } else {
i = noteRecordsMapper.updateById(records); i = noteRecordMapper.updateById(records);
} }
//所有对话类型 //所有对话类型
List<String> allTypes = modelRecordTypeMapper.getAllType(); List<String> allTypes = modelRecordTypeMapper.getAllType();
@ -112,7 +104,7 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
List<QARecordNodeDTO> qaList = RecordRegexUtil.recordRegex(context, records.getName()); List<QARecordNodeDTO> qaList = RecordRegexUtil.recordRegex(context, records.getName());
for (QARecordNodeDTO qa : qaList) { for (QARecordNodeDTO qa : qaList) {
try { try {
NoteRecord noteRecord = new NoteRecord(); NoteRecordSplit noteRecord = new NoteRecordSplit();
noteRecord.setCaseId(records.getCaseId()); noteRecord.setCaseId(records.getCaseId());
noteRecord.setNoteRecordsId(records.getId()); noteRecord.setNoteRecordsId(records.getId());
noteRecord.setNoteName(file.getName()); noteRecord.setNoteName(file.getName());
@ -159,7 +151,7 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
}*/ }*/
//保存笔录 //保存笔录
noteRecord.setRecordType(type); noteRecord.setRecordType(type);
noteRecordMapper.insert(noteRecord); noteRecordSplitMapper.insert(noteRecord);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -178,25 +170,25 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
} }
@Override @Override
public Map<String, Object> queryRecords(NoteRecords noteRecords, Integer page, Integer size) { public Map<String, Object> queryRecords(NoteRecord noteRecords, Integer page, Integer size) {
LambdaQueryWrapper<NoteRecords> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<NoteRecord> wrapper = Wrappers.lambdaQuery();
wrapper.like(StringUtils.isNotEmpty(noteRecords.getName()), NoteRecords::getName, noteRecords.getName()) wrapper.like(StringUtils.isNotEmpty(noteRecords.getName()), NoteRecord::getName, noteRecords.getName())
.eq(NoteRecords::getCaseId, noteRecords.getCaseId()) .eq(NoteRecord::getCaseId, noteRecords.getCaseId())
.eq(NoteRecords::getDataStatus, "1"); .eq(NoteRecord::getDataStatus, "1");
List<NoteRecords> list = noteRecordsMapper.selectList(wrapper); List<NoteRecord> list = noteRecordMapper.selectList(wrapper);
// LinkedHashMap 保障顺序 // LinkedHashMap 保障顺序
Map<String, List<NoteRecords>> nameMap = list.stream().filter(item -> StringUtils.isNotBlank(item.getName())) Map<String, List<NoteRecord>> nameMap = list.stream().filter(item -> StringUtils.isNotBlank(item.getName()))
.collect(Collectors.groupingBy(NoteRecords::getName, LinkedHashMap::new, Collectors.toList())); .collect(Collectors.groupingBy(NoteRecord::getName, LinkedHashMap::new, Collectors.toList()));
List<NoteRecords> res = new ArrayList<>(); List<NoteRecord> res = new ArrayList<>();
for (String name : nameMap.keySet()) { for (String name : nameMap.keySet()) {
NoteRecords noteRecord = new NoteRecords(); NoteRecord noteRecord = new NoteRecord();
noteRecord.setName(name); noteRecord.setName(name);
noteRecord.setChildren(nameMap.get(name)); noteRecord.setChildren(nameMap.get(name));
res.add(noteRecord); res.add(noteRecord);
} }
List<NoteRecords> pager = ListUtils.Pager(size, page, res); List<NoteRecord> pager = ListUtils.Pager(size, page, res);
for (NoteRecords person : pager) { for (NoteRecord person : pager) {
for (NoteRecords noteRecord : person.getChildren()) { for (NoteRecord noteRecord : person.getChildren()) {
String fileIds = noteRecord.getFileIds(); String fileIds = noteRecord.getFileIds();
if (StringUtils.isNotEmpty(fileIds)) { if (StringUtils.isNotEmpty(fileIds)) {
noteRecord.setConfessionMaterial(fileIds.split(",").length); noteRecord.setConfessionMaterial(fileIds.split(",").length);
@ -208,10 +200,10 @@ public class RecordServiceImpl extends ServiceImpl<NoteRecordMapper, NoteRecord>
@Override @Override
public void delRecords(String id) { public void delRecords(String id) {
NoteRecords noteRecords = noteRecordsMapper.selectById(id); NoteRecord noteRecord = noteRecordMapper.selectById(id);
noteRecords.setDataStatus(StringUtils.getUUID()); noteRecord.setDataStatus(StringUtils.getUUID());
noteRecordsMapper.updateById(noteRecords); noteRecordMapper.updateById(noteRecord);
String fileIds = noteRecords.getFileIds(); String fileIds = noteRecord.getFileIds();
if (StringUtils.isNotEmpty(fileIds)) { if (StringUtils.isNotEmpty(fileIds)) {
//删除文件 //删除文件
for (String fileId : fileIds.split(",")) { for (String fileId : fileIds.split(",")) {

@ -2,10 +2,10 @@ package com.supervision.springaidemo.controller;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.supervision.police.domain.ModelRecordType; import com.supervision.police.domain.ModelRecordType;
import com.supervision.police.domain.NoteRecord; import com.supervision.police.domain.NoteRecordSplit;
import com.supervision.springaidemo.dto.QARecordNodeDTO; import com.supervision.springaidemo.dto.QARecordNodeDTO;
import com.supervision.police.mapper.ModelRecordTypeMapper; import com.supervision.police.mapper.ModelRecordTypeMapper;
import com.supervision.police.mapper.NoteRecordMapper; import com.supervision.police.mapper.NoteRecordSplitMapper;
import com.supervision.police.service.ModelRecordTypeService; import com.supervision.police.service.ModelRecordTypeService;
import com.supervision.springaidemo.service.ModelMetricService; import com.supervision.springaidemo.service.ModelMetricService;
import com.supervision.police.service.RecordService; import com.supervision.police.service.RecordService;
@ -50,7 +50,7 @@ public class ExampleChatController {
@Autowired @Autowired
private ModelRecordTypeMapper modelRecordTypeMapper; private ModelRecordTypeMapper modelRecordTypeMapper;
@Autowired @Autowired
private NoteRecordMapper noteRecordMapper; private NoteRecordSplitMapper noteRecordSplitMapper;
@Autowired @Autowired
public ExampleChatController(OllamaChatClient chatClient) { public ExampleChatController(OllamaChatClient chatClient) {
@ -97,7 +97,7 @@ public class ExampleChatController {
String context = WordReadUtil.readWord(file.getPath()); String context = WordReadUtil.readWord(file.getPath());
List<QARecordNodeDTO> qaList = RecordRegexUtil.recordRegex(context, "裴金禄"); List<QARecordNodeDTO> qaList = RecordRegexUtil.recordRegex(context, "裴金禄");
for (QARecordNodeDTO qa : qaList) { for (QARecordNodeDTO qa : qaList) {
NoteRecord noteRecord = new NoteRecord(); NoteRecordSplit noteRecord = new NoteRecordSplit();
noteRecord.setNoteName(file.getName()); noteRecord.setNoteName(file.getName());
noteRecord.setPersonName("裴金禄"); noteRecord.setPersonName("裴金禄");
noteRecord.setQuestion(qa.getQuestion()); noteRecord.setQuestion(qa.getQuestion());
@ -200,11 +200,11 @@ public class ExampleChatController {
} }
@GetMapping("queryRecordType") @GetMapping("queryRecordType")
public List<NoteRecord> queryRecordType() { public List<NoteRecordSplit> queryRecordType() {
List<ModelRecordType> types = modelRecordTypeMapper.selectList(null); List<ModelRecordType> types = modelRecordTypeMapper.selectList(null);
String allType = types.stream().map(ModelRecordType::getRecordType).collect(Collectors.joining(".")); String allType = types.stream().map(ModelRecordType::getRecordType).collect(Collectors.joining("."));
List<NoteRecord> list = noteRecordMapper.selectList(null); List<NoteRecordSplit> list = noteRecordSplitMapper.selectList(null);
for (NoteRecord record : list) { for (NoteRecordSplit record : list) {
record.setRecordType(""); record.setRecordType("");
String test = "你是一个善于总结问讯内容的大模型,请判断以下对话属于【" + allType + "】哪个分类?对话内容为:"; String test = "你是一个善于总结问讯内容的大模型,请判断以下对话属于【" + allType + "】哪个分类?对话内容为:";
@ -231,7 +231,7 @@ public class ExampleChatController {
@GetMapping("test1") @GetMapping("test1")
public void test2(@Param("id") String id) { public void test2(@Param("id") String id) {
NoteRecord noteRecord = recordService.getById(id); NoteRecordSplit noteRecord = recordService.getById(id);
String question = noteRecord.getQuestion(); String question = noteRecord.getQuestion();
String answer = noteRecord.getAnswer(); String answer = noteRecord.getAnswer();
String test = "请从以下对话中提取所有关于" + noteRecord.getRecordType() + "的所有三元组"; String test = "请从以下对话中提取所有关于" + noteRecord.getRecordType() + "的所有三元组";

@ -1,20 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.supervision.police.mapper.NoteRecordMapper"> <mapper namespace="com.supervision.police.mapper.NoteRecordMapper">
<select id="selectByRecordType" resultType="com.supervision.police.domain.NoteRecord">
select * from note_record nr
where record_type = #{recordType}
</select>
<select id="selectRecord" resultType="com.supervision.police.domain.NoteRecord">
select nr.*, mrt.id as recordTypeId
from note_record nr
left join model_record_type mrt on nr.record_type = mrt.record_type
where nr.case_id = #{caseId} and nr.person_name = #{name}
<if test="recordId != null and recordId != ''">
and nr.note_records_id = #{recordId}
</if>
</select>
</mapper> </mapper>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.supervision.police.mapper.NoteRecordSplitMapper">
<select id="selectByRecordType" resultType="com.supervision.police.domain.NoteRecordSplit">
select * from note_record_split nr
where record_type = #{recordType}
</select>
<select id="selectRecord" resultType="com.supervision.police.domain.NoteRecordSplit">
select nr.*, mrt.id as recordTypeId
from note_record_split nr
left join model_record_type mrt on nr.record_type = mrt.record_type
where nr.case_id = #{caseId} and nr.person_name = #{name}
<if test="recordId != null and recordId != ''">
and nr.note_records_id = #{recordId}
</if>
</select>
</mapper>

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.supervision.police.mapper.NoteRecordsMapper">
</mapper>
Loading…
Cancel
Save