Compare commits
13 Commits
Author | SHA1 | Date |
---|---|---|
|
923063dcf2 | 4 months ago |
|
53efc04e71 | 4 months ago |
|
a8c9e84cbd | 4 months ago |
|
b759955f5b | 4 months ago |
|
c19fc37e35 | 4 months ago |
|
37ed83a12a | 4 months ago |
|
a5611ec313 | 4 months ago |
|
55076f376b | 4 months ago |
|
90b4e1f792 | 4 months ago |
|
0e7c6e6b4d | 4 months ago |
|
95b5736221 | 4 months ago |
|
00f85c8dc9 | 4 months ago |
|
51dc2cb9d7 | 4 months ago |
@ -0,0 +1,27 @@
|
|||||||
|
package com.supervision.handler;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class StringListTypeHandler extends JacksonTypeHandler {
|
||||||
|
|
||||||
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
|
||||||
|
public StringListTypeHandler(Class<Object> type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object parse(String json) {
|
||||||
|
try {
|
||||||
|
return objectMapper.readValue(json, new TypeReference<List<String>>() {});
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录同语义类型表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/model-piece-record-type")
|
||||||
|
public class ModelPieceRecordTypeController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/note-piece-prompt")
|
||||||
|
public class NotePiecePromptController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 句子三元组提示词和分类关系表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/note-piece-prompt-type-rel")
|
||||||
|
public class NotePiecePromptTypeRelController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录相同语义片段表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/note-record-split-piece-sentence")
|
||||||
|
public class NoteRecordSplitPieceSentenceController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本单句表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-10
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/note-record-split-sentence")
|
||||||
|
public class NoteRecordSplitSentenceController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本三元组信息表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/police/piece-triple-info")
|
||||||
|
public class PieceTripleInfoController {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录同语义类型表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("model_piece_record_type")
|
||||||
|
@ApiModel(value = "ModelPieceRecordType对象", description = "笔录同语义类型表")
|
||||||
|
public class ModelPieceRecordType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("笔录语句段类型(总结)")
|
||||||
|
@TableField("record_type")
|
||||||
|
private String recordType;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人ID")
|
||||||
|
@TableField("create_user_id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
@TableField("update_user_id")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("note_piece_prompt")
|
||||||
|
@ApiModel(value = "NotePiecePrompt对象", description = "长文本提示词表")
|
||||||
|
public class NotePiecePrompt implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键id")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("提示词")
|
||||||
|
@TableField("prompt")
|
||||||
|
private String prompt;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始节点类型")
|
||||||
|
@TableField("start_entity_type")
|
||||||
|
private String startEntityType;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始节点占位符")
|
||||||
|
@TableField("start_entity_template")
|
||||||
|
private String startEntityTemplate;
|
||||||
|
|
||||||
|
@ApiModelProperty("关系类型")
|
||||||
|
@TableField("rel_type")
|
||||||
|
private String relType;
|
||||||
|
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
@TableField("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("关系占位符")
|
||||||
|
@TableField("rel_template")
|
||||||
|
private String relTemplate;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束节点类型")
|
||||||
|
@TableField("end_entity_type")
|
||||||
|
private String endEntityType;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束节点占位符")
|
||||||
|
@TableField("end_entity_template")
|
||||||
|
private String endEntityTemplate;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人ID")
|
||||||
|
@TableField("create_user_id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
@TableField("update_user_id")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 句子三元组提示词和分类关系表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("note_piece_prompt_type_rel")
|
||||||
|
@ApiModel(value = "NotePiecePromptTypeRel对象", description = "句子三元组提示词和分类关系表")
|
||||||
|
public class NotePiecePromptTypeRel implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键id")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("note_piece_prompt表ID")
|
||||||
|
@TableField("prompt_id")
|
||||||
|
private String promptId;
|
||||||
|
|
||||||
|
@ApiModelProperty("id(model_piece_record_type)")
|
||||||
|
@TableField("type_id")
|
||||||
|
private String typeId;
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.supervision.handler.StringListTypeHandler;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录相同语义片段表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("note_record_split_piece_sentence")
|
||||||
|
@ApiModel(value = "NoteRecordSplitPieceSentence对象", description = "笔录相同语义片段表")
|
||||||
|
public class NoteRecordSplitPieceSentence implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键id")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("笔录片段表id")
|
||||||
|
@TableField("record_split_id")
|
||||||
|
private String recordSplitId;
|
||||||
|
|
||||||
|
// @ApiModelProperty("同语义片段")
|
||||||
|
// @TableField(value = "content_chuck", typeHandler = StringListTypeHandler.class)
|
||||||
|
// private List<String> contentChuck;
|
||||||
|
|
||||||
|
@ApiModelProperty("同语义片段")
|
||||||
|
@TableField(value = "content_chuck")
|
||||||
|
private String contentChuck;
|
||||||
|
|
||||||
|
@ApiModelProperty("片段内容总结")
|
||||||
|
@TableField("content_chuck_summary")
|
||||||
|
private String contentChuckSummary;
|
||||||
|
|
||||||
|
@ApiModelProperty("备用字段")
|
||||||
|
@TableField("extend")
|
||||||
|
private String extend;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人ID")
|
||||||
|
@TableField("create_user_id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
@TableField("update_user_id")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本单句表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-10
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("note_record_split_sentence")
|
||||||
|
@ApiModel(value = "NoteRecordSplitSentence对象", description = "长文本单句表")
|
||||||
|
public class NoteRecordSplitSentence implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键id")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("笔录片段表id")
|
||||||
|
@TableField("record_split_id")
|
||||||
|
private String recordSplitId;
|
||||||
|
|
||||||
|
@ApiModelProperty("笔录相同语义片段表id")
|
||||||
|
@TableField("piece_record_split_id")
|
||||||
|
private String pieceRecordSplitId;
|
||||||
|
|
||||||
|
@ApiModelProperty("回答")
|
||||||
|
@TableField("answer")
|
||||||
|
private String answer;
|
||||||
|
|
||||||
|
@ApiModelProperty("句子模型总结内容")
|
||||||
|
@TableField("llm_gen_a")
|
||||||
|
private String llmGenA;
|
||||||
|
|
||||||
|
@ApiModelProperty("备用字段")
|
||||||
|
@TableField("extend_one")
|
||||||
|
private String extendOne;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人ID")
|
||||||
|
@TableField("create_user_id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
@TableField("update_user_id")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.supervision.police.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本三元组信息表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("piece_triple_info")
|
||||||
|
@ApiModel(value = "PieceTripleInfo对象", description = "长文本三元组信息表")
|
||||||
|
public class PieceTripleInfo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("主键id")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始节点")
|
||||||
|
@TableField("start_node")
|
||||||
|
private String startNode;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束节点")
|
||||||
|
@TableField("end_node")
|
||||||
|
private String endNode;
|
||||||
|
|
||||||
|
@ApiModelProperty("关系")
|
||||||
|
@TableField("relation")
|
||||||
|
private String relation;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("笔录片段id")
|
||||||
|
@TableField("record_split_id")
|
||||||
|
private String recordSplitId;
|
||||||
|
|
||||||
|
@ApiModelProperty("同语义片段id")
|
||||||
|
@TableField("piece_record_split_id")
|
||||||
|
private String pieceRecordSplitId;
|
||||||
|
|
||||||
|
@ApiModelProperty("实际提交给大模型的提示词")
|
||||||
|
@TableField("submit_prompt")
|
||||||
|
private String submitPrompt;
|
||||||
|
|
||||||
|
@ApiModelProperty("是否生成图谱")
|
||||||
|
@TableField("add_neo4j")
|
||||||
|
private String addNeo4j;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("起始节点图ID")
|
||||||
|
@TableField("start_node_graph_id")
|
||||||
|
private Long startNodeGraphId;
|
||||||
|
|
||||||
|
@ApiModelProperty("关系ID(neo4j关系id)")
|
||||||
|
@TableField("rel_graph_id")
|
||||||
|
private Long relGraphId;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束节点图ID")
|
||||||
|
@TableField("end_node_graph_id")
|
||||||
|
private Long endNodeGraphId;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始节点类型(neo4j节点类型)")
|
||||||
|
@TableField("start_node_type")
|
||||||
|
private String startNodeType;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束节点类型(neo4j节点类型)")
|
||||||
|
@TableField("end_node_type")
|
||||||
|
private String endNodeType;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建人ID")
|
||||||
|
@TableField("create_user_id")
|
||||||
|
private String createUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新人")
|
||||||
|
@TableField("update_user_id")
|
||||||
|
private String updateUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.ModelPieceRecordType;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录同语义类型表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ModelPieceRecordTypeMapper extends BaseMapper<ModelPieceRecordType> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NotePiecePrompt;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NotePiecePromptMapper extends BaseMapper<NotePiecePrompt> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NotePiecePromptTypeRel;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 句子三元组提示词和分类关系表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NotePiecePromptTypeRelMapper extends BaseMapper<NotePiecePromptTypeRel> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitPieceSentence;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录相同语义片段表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NoteRecordSplitPieceSentenceMapper extends BaseMapper<NoteRecordSplitPieceSentence> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitSentence;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本单句表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-10
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NoteRecordSplitSentenceMapper extends BaseMapper<NoteRecordSplitSentence> {
|
||||||
|
|
||||||
|
|
||||||
|
void saveBatchList(List<NoteRecordSplitSentence> noteRecordSplitList);
|
||||||
|
|
||||||
|
|
||||||
|
void updateBatchList(@Param("ids") List<Long> ids, @Param("noteRecordSplitPieceSentences") Long noteRecordSplitPieceSentences);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.supervision.police.mapper;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.PieceTripleInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本三元组信息表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface PieceTripleInfoMapper extends BaseMapper<PieceTripleInfo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.ModelPieceRecordType;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录同语义类型表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
public interface ModelPieceRecordTypeService extends IService<ModelPieceRecordType> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NotePiecePrompt;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.supervision.police.domain.NotePrompt;
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitPieceSentence;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
public interface NotePiecePromptService extends IService<NotePiecePrompt> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询长文本对应的类型的提示词
|
||||||
|
* @param recordSplitId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<NotePiecePrompt> listPiecePromptBySplitId(NoteRecordSplitPieceSentence recordSplitId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NotePiecePromptTypeRel;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 句子三元组提示词和分类关系表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
public interface NotePiecePromptTypeRelService extends IService<NotePiecePromptTypeRel> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitPieceSentence;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录相同语义片段表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
public interface NoteRecordSplitPieceSentenceService extends IService<NoteRecordSplitPieceSentence> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitSentence;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本单句表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-10
|
||||||
|
*/
|
||||||
|
public interface NoteRecordSplitSentenceService extends IService<NoteRecordSplitSentence> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量保存长文本单句
|
||||||
|
* @param noteRecordSplitList
|
||||||
|
*/
|
||||||
|
public void saveBatchList(List<NoteRecordSplitSentence> noteRecordSplitList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新 长文本但语句 的llmGenA字段
|
||||||
|
* @param ids 单句id集合
|
||||||
|
* @param noteRecordSplitPieceSentences 同语句id
|
||||||
|
*/
|
||||||
|
void updateBatchList(List<Long> ids,Long noteRecordSplitPieceSentences);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.supervision.police.service;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.PieceTripleInfo;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本三元组信息表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
public interface PieceTripleInfoService extends IService<PieceTripleInfo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.ModelPieceRecordType;
|
||||||
|
import com.supervision.police.mapper.ModelPieceRecordTypeMapper;
|
||||||
|
import com.supervision.police.service.ModelPieceRecordTypeService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录同语义类型表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ModelPieceRecordTypeServiceImpl extends ServiceImpl<ModelPieceRecordTypeMapper, ModelPieceRecordType> implements ModelPieceRecordTypeService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NotePiecePromptTypeRel;
|
||||||
|
import com.supervision.police.mapper.NotePiecePromptTypeRelMapper;
|
||||||
|
import com.supervision.police.service.NotePiecePromptTypeRelService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 句子三元组提示词和分类关系表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class NotePiecePromptTypeRelServiceImpl extends ServiceImpl<NotePiecePromptTypeRelMapper, NotePiecePromptTypeRel> implements NotePiecePromptTypeRelService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitPieceSentence;
|
||||||
|
import com.supervision.police.mapper.NoteRecordSplitPieceSentenceMapper;
|
||||||
|
import com.supervision.police.service.NoteRecordSplitPieceSentenceService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 笔录相同语义片段表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class NoteRecordSplitPieceSentenceServiceImpl extends ServiceImpl<NoteRecordSplitPieceSentenceMapper, NoteRecordSplitPieceSentence> implements NoteRecordSplitPieceSentenceService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.NoteRecordSplitSentence;
|
||||||
|
import com.supervision.police.mapper.NoteRecordSplitSentenceMapper;
|
||||||
|
import com.supervision.police.service.NoteRecordSplitSentenceService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本单句表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-10
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class NoteRecordSplitSentenceServiceImpl extends ServiceImpl<NoteRecordSplitSentenceMapper, NoteRecordSplitSentence> implements NoteRecordSplitSentenceService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量保存长文本单句
|
||||||
|
* @param noteRecordSplitList
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void saveBatchList(List<NoteRecordSplitSentence> noteRecordSplitList) {
|
||||||
|
this.baseMapper.saveBatchList(noteRecordSplitList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量更新 长文本但语句 的llmGenA字段
|
||||||
|
* @param ids 单句id集合
|
||||||
|
* @param noteRecordSplitPieceSentences 同语句id
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateBatchList(List<Long> ids,Long noteRecordSplitPieceSentences){
|
||||||
|
this.baseMapper.updateBatchList(ids,noteRecordSplitPieceSentences);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.supervision.police.service.impl;
|
||||||
|
|
||||||
|
import com.supervision.police.domain.PieceTripleInfo;
|
||||||
|
import com.supervision.police.mapper.PieceTripleInfoMapper;
|
||||||
|
import com.supervision.police.service.PieceTripleInfoService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本三元组信息表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PieceTripleInfoServiceImpl extends ServiceImpl<PieceTripleInfoMapper, PieceTripleInfo> implements PieceTripleInfoService {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,178 @@
|
|||||||
|
package com.supervision.thread;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
||||||
|
import com.supervision.constant.PromptsEnum;
|
||||||
|
import com.supervision.police.domain.*;
|
||||||
|
import com.supervision.police.dto.LongTextSingleSentenceSummaryDto;
|
||||||
|
import com.supervision.police.dto.PieceSentenceIdDto;
|
||||||
|
import com.supervision.utils.UserUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.ai.chat.ChatResponse;
|
||||||
|
import org.springframework.ai.chat.messages.UserMessage;
|
||||||
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
|
import org.springframework.ai.ollama.OllamaChatClient;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class LongTextTask implements Callable<Map<String, Object>> {
|
||||||
|
|
||||||
|
private final LongTextSingleSentenceSummaryDto longTextSingleSentenceSummaryDto;
|
||||||
|
private final OllamaChatClient chatClient;
|
||||||
|
private final Consumer<Map<String, Object>> consumer;
|
||||||
|
|
||||||
|
public LongTextTask(OllamaChatClient chatClient, LongTextSingleSentenceSummaryDto longTextSingleSentenceSummaryDto, Consumer<Map<String, Object>> consumer) {
|
||||||
|
this.longTextSingleSentenceSummaryDto = longTextSingleSentenceSummaryDto;
|
||||||
|
this.chatClient = chatClient;
|
||||||
|
this.consumer = consumer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> call() throws Exception {
|
||||||
|
return pieceSentenceNormal(longTextSingleSentenceSummaryDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同语义归纳 匹配
|
||||||
|
*
|
||||||
|
* @param longTextSingleSentenceSummaryDto 但语句集合
|
||||||
|
*/
|
||||||
|
private Map<String, Object> pieceSentenceNormal(LongTextSingleSentenceSummaryDto longTextSingleSentenceSummaryDto) throws Exception {
|
||||||
|
log.info("[QaAnswerLongTextTripletExtraction-Pool-PieceSentenceNormal]开始同语义归纳方法,当前线程是:{}", Thread.currentThread().getName());
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
// 同语义集合
|
||||||
|
List<NoteRecordSplitPieceSentence> recordSplitPieceSentences = new ArrayList<>();
|
||||||
|
|
||||||
|
// 同语义使用单句id集合
|
||||||
|
List<PieceSentenceIdDto> noteRecordSplitPieceSentenceBySingle = new ArrayList<>();
|
||||||
|
|
||||||
|
// 笔录片段id
|
||||||
|
String noteRecordSplitId = longTextSingleSentenceSummaryDto.getNoteRecordSplitId();
|
||||||
|
// 单语句集合
|
||||||
|
List<NoteRecordSplitSentence> noteRecordSplitSentences = longTextSingleSentenceSummaryDto.getNoteRecordSplitSentences();
|
||||||
|
int noteRecordSplitSentencesSize = noteRecordSplitSentences.size();
|
||||||
|
|
||||||
|
// 获取末尾单句 N+1
|
||||||
|
NoteRecordSplitSentence endCombinedSentence = noteRecordSplitSentences.get(noteRecordSplitSentencesSize - 1);
|
||||||
|
|
||||||
|
Long endCombinedSentenceId = endCombinedSentence.getId();
|
||||||
|
ConcurrentLinkedDeque<Long> noteRecordSplitPieceSentenceDeque = new ConcurrentLinkedDeque<>();
|
||||||
|
noteRecordSplitPieceSentenceDeque.add(endCombinedSentenceId);
|
||||||
|
|
||||||
|
ConcurrentLinkedDeque<String> endCombinedSentenceDeque = new ConcurrentLinkedDeque<>();
|
||||||
|
endCombinedSentenceDeque.addLast(endCombinedSentence.getAnswer());
|
||||||
|
|
||||||
|
|
||||||
|
// 遍历单句集合
|
||||||
|
for (int i = noteRecordSplitSentencesSize - 2; i >= 0; i--) {
|
||||||
|
PieceSentenceIdDto pieceSentenceIdDto = new PieceSentenceIdDto();
|
||||||
|
// 获取第N句
|
||||||
|
NoteRecordSplitSentence currentSentence = noteRecordSplitSentences.get(i);
|
||||||
|
Long currentSentenceId = currentSentence.getId();
|
||||||
|
String currentSentenceAnswer = currentSentence.getAnswer();
|
||||||
|
// 对比句子语义
|
||||||
|
boolean inductionFlag = chatAiLongTextHomoSemanticInduction(String.valueOf(endCombinedSentenceDeque), currentSentenceAnswer);
|
||||||
|
if (inductionFlag) {
|
||||||
|
endCombinedSentenceDeque.addFirst(currentSentenceAnswer);
|
||||||
|
noteRecordSplitPieceSentenceDeque.addFirst(currentSentenceId);
|
||||||
|
} else {
|
||||||
|
NoteRecordSplitPieceSentence pieceSentence = setNotePieceRecordSentence(noteRecordSplitId, endCombinedSentenceDeque);
|
||||||
|
endCombinedSentenceDeque.remove();
|
||||||
|
endCombinedSentenceDeque.addLast(currentSentenceAnswer);
|
||||||
|
|
||||||
|
List<Long> longList = noteRecordSplitPieceSentenceDeque.stream().toList();
|
||||||
|
noteRecordSplitPieceSentenceDeque.remove();
|
||||||
|
noteRecordSplitPieceSentenceDeque.addLast(currentSentenceId);
|
||||||
|
|
||||||
|
pieceSentenceIdDto.setNoteRecordSplitPieceSentenceId(pieceSentence.getId());
|
||||||
|
pieceSentenceIdDto.setNoteRecordSplitSentenceId(longList);
|
||||||
|
|
||||||
|
recordSplitPieceSentences.add(pieceSentence);
|
||||||
|
noteRecordSplitPieceSentenceBySingle.add(pieceSentenceIdDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NoteRecordSplitPieceSentence pieceSentence = setNotePieceRecordSentence(noteRecordSplitId, endCombinedSentenceDeque);
|
||||||
|
recordSplitPieceSentences.add(pieceSentence);
|
||||||
|
noteRecordSplitPieceSentenceBySingle.add(new PieceSentenceIdDto(pieceSentence.getId(), noteRecordSplitPieceSentenceDeque.stream().toList()));
|
||||||
|
map.put("recordSplitPieceSentences", recordSplitPieceSentences);
|
||||||
|
map.put("noteRecordSplitPieceSentenceBySingle", noteRecordSplitPieceSentenceBySingle);
|
||||||
|
consumer.accept(map);
|
||||||
|
log.info("[QaAnswerLongTextTripletExtraction-Pool-PieceSentenceNormal]同语义归纳结束,当前线程是:{}", Thread.currentThread().getName());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param encCombinedSentence N+1 句
|
||||||
|
* @param currentSentence N句
|
||||||
|
* @return 长文本单句总结集合
|
||||||
|
*/
|
||||||
|
private boolean chatAiLongTextHomoSemanticInduction(String encCombinedSentence, String currentSentence) {
|
||||||
|
|
||||||
|
StopWatch stopWatch = new StopWatch();
|
||||||
|
// 分析同语义集合
|
||||||
|
stopWatch.start();
|
||||||
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("encCombinedSentence", encCombinedSentence);
|
||||||
|
paramMap.put("currentSentence", currentSentence);
|
||||||
|
String format = StrUtil.format(PromptsEnum.LONG_TEXT_SINGLE_STATEMENT_WITH_SEMANTIC_JUDGMENT_PROMPT_WORD.getContent(), paramMap);
|
||||||
|
|
||||||
|
ChatResponse call = chatClient.call(new Prompt(new UserMessage(format)));
|
||||||
|
stopWatch.stop();
|
||||||
|
String content = call.getResult().getOutput().getContent();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSON.parseObject(content);
|
||||||
|
boolean result = (boolean) jsonObject.get("result");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置同语义片段集合
|
||||||
|
*
|
||||||
|
* @param noteRecordSplitId 笔录片段id
|
||||||
|
* @param endSentenceDequeStringDeque 同语义单句队列
|
||||||
|
* @return 同语义对象
|
||||||
|
*/
|
||||||
|
public NoteRecordSplitPieceSentence setNotePieceRecordSentence(String noteRecordSplitId, ConcurrentLinkedDeque<String> endSentenceDequeStringDeque) {
|
||||||
|
|
||||||
|
StringBuilder endSentenceDequeStringBuilder = new StringBuilder();
|
||||||
|
for (String endSentenceDeque : endSentenceDequeStringDeque) {
|
||||||
|
endSentenceDequeStringBuilder.append(endSentenceDeque);
|
||||||
|
}
|
||||||
|
|
||||||
|
String endSentenceDequeStringBuilderString = String.valueOf(endSentenceDequeStringBuilder);
|
||||||
|
|
||||||
|
String noteRecordSplitPieceSentenceId = DefaultIdentifierGenerator.getInstance().nextId(null).toString();
|
||||||
|
NoteRecordSplitPieceSentence noteRecordSplitPieceSentence = new NoteRecordSplitPieceSentence();
|
||||||
|
noteRecordSplitPieceSentence.setId(noteRecordSplitPieceSentenceId);
|
||||||
|
noteRecordSplitPieceSentence.setCreateUserId(UserUtil.getUser().getId());
|
||||||
|
noteRecordSplitPieceSentence.setUpdateUserId(UserUtil.getUser().getId());
|
||||||
|
noteRecordSplitPieceSentence.setRecordSplitId(noteRecordSplitId);
|
||||||
|
noteRecordSplitPieceSentence.setContentChuck(endSentenceDequeStringBuilderString);
|
||||||
|
return noteRecordSplitPieceSentence;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.supervision.thread;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
|
||||||
|
import com.supervision.police.domain.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.ai.chat.ChatResponse;
|
||||||
|
import org.springframework.ai.chat.messages.UserMessage;
|
||||||
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
|
import org.springframework.ai.ollama.OllamaChatClient;
|
||||||
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 长文本提示词表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author longbao
|
||||||
|
* @since 2024-12-12
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class PieceTripleExtractTask implements Callable<PieceTripleInfo> {
|
||||||
|
private static final String HEAD_ENTITY_TYPE_ACTOR = "行为人";
|
||||||
|
|
||||||
|
private final NotePiecePrompt notePiecePrompt;
|
||||||
|
private final NoteRecordSplitPieceSentence noteRecordSplitPieceSentence;
|
||||||
|
private final CasePerson mainActor;
|
||||||
|
private final OllamaChatClient chatClient;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public PieceTripleExtractTask(OllamaChatClient chatClient,
|
||||||
|
CasePerson mainActor,
|
||||||
|
NotePiecePrompt notePiecePrompt,
|
||||||
|
NoteRecordSplitPieceSentence noteRecordSplitPieceSentence) {
|
||||||
|
this.chatClient = chatClient;
|
||||||
|
this.mainActor = mainActor;
|
||||||
|
this.notePiecePrompt = notePiecePrompt;
|
||||||
|
this.noteRecordSplitPieceSentence = noteRecordSplitPieceSentence;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提取三元组
|
||||||
|
*
|
||||||
|
* @return 三元组信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PieceTripleInfo call() throws Exception {
|
||||||
|
TripleRecord tripleRecord = chat4Triple(mainActor, notePiecePrompt, noteRecordSplitPieceSentence);
|
||||||
|
// 获取从提示词中提取到的三元组信息
|
||||||
|
TripleExtractResult extractResult = JSONUtil.toBean(tripleRecord.answer, TripleExtractResult.class);
|
||||||
|
if (ObjectUtil.isEmpty(extractResult) || CollUtil.isEmpty(extractResult.getResult())) {
|
||||||
|
log.warn("[QaAnswerLongTextTripletExtraction-call]提取三元组信息为空,忽略.提取的内容为:{}", tripleRecord.answer);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TripleExtractNode tripleExtractNode : extractResult.getResult()) {
|
||||||
|
TripleEntity headEntity = tripleExtractNode.getHeadEntity();
|
||||||
|
TripleEntity tailEntity = tripleExtractNode.getTailEntity();
|
||||||
|
String relation = tripleExtractNode.getRelation();
|
||||||
|
if (StrUtil.hasEmpty(headEntity.getName(), relation, tailEntity.getName())) {
|
||||||
|
log.warn("[QaAnswerLongTextTripletExtraction-call]提取三元组信息出现空值,忽略,主体:{},关系:{},客体:{}", headEntity.getName(), relation, tailEntity.getName());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 构建三元组信息
|
||||||
|
PieceTripleInfo tripleInfo = new PieceTripleInfo();
|
||||||
|
tripleInfo.setId(DefaultIdentifierGenerator.getInstance().nextId(null).toString());
|
||||||
|
tripleInfo.setStartNode(headEntity.getName());
|
||||||
|
tripleInfo.setEndNode(tailEntity.getName());
|
||||||
|
tripleInfo.setRelation(relation);
|
||||||
|
tripleInfo.setPieceRecordSplitId(noteRecordSplitPieceSentence.getId());
|
||||||
|
tripleInfo.setRecordSplitId(noteRecordSplitPieceSentence.getRecordSplitId());
|
||||||
|
tripleInfo.setSubmitPrompt(tripleRecord.question);
|
||||||
|
tripleInfo.setStartNodeType(notePiecePrompt.getStartEntityType());
|
||||||
|
tripleInfo.setEndNodeType(notePiecePrompt.getEndEntityType());
|
||||||
|
return tripleInfo;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用ollama提取三元组
|
||||||
|
*
|
||||||
|
* @param mainActor 案件人
|
||||||
|
* @param prompt 三元组提示词
|
||||||
|
* @param noteRecordSplitPieceSentence 同语义对象
|
||||||
|
* @return 三元组信息
|
||||||
|
*/
|
||||||
|
private TripleRecord chat4Triple(CasePerson mainActor, NotePiecePrompt prompt, NoteRecordSplitPieceSentence noteRecordSplitPieceSentence) {
|
||||||
|
|
||||||
|
String pieceSentenceContentChuck = noteRecordSplitPieceSentence.getContentChuck();
|
||||||
|
|
||||||
|
StopWatch stopWatch = new StopWatch();
|
||||||
|
// 分析三元组
|
||||||
|
stopWatch.start();
|
||||||
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("headEntityType", prompt.getStartEntityType());
|
||||||
|
paramMap.put("relation", prompt.getRelType());
|
||||||
|
paramMap.put("tailEntityType", prompt.getEndEntityType());
|
||||||
|
paramMap.put("contentChuckSummary", pieceSentenceContentChuck);
|
||||||
|
log.info("[QaAnswerLongTextTripletExtraction-call-chat4Triple]开始尝试提取三元组:{}-{}-{},mainActor:{}", prompt.getStartEntityType(), prompt.getRelType(), prompt.getEndEntityType(), mainActor == null ? "" : mainActor.getName());
|
||||||
|
if (mainActor != null && HEAD_ENTITY_TYPE_ACTOR.equals(prompt.getStartEntityType())) {
|
||||||
|
paramMap.put("requirement", "当前案件的行为人是" + mainActor.getName() + ",只尝试提取" + mainActor.getName() + "为头结点的三元组。");
|
||||||
|
} else {
|
||||||
|
paramMap.put("requirement", "");
|
||||||
|
}
|
||||||
|
String format = StrUtil.format(prompt.getPrompt(), paramMap);
|
||||||
|
|
||||||
|
log.info("[QaAnswerLongTextTripletExtraction-call-chat4Triple]三元组提取提示词:{}", format);
|
||||||
|
|
||||||
|
ChatResponse call = chatClient.call(new Prompt(new UserMessage(format)));
|
||||||
|
stopWatch.stop();
|
||||||
|
String content = call.getResult().getOutput().getContent();
|
||||||
|
log.info("问题:{}耗时:{},三元组提取结果是:{}", pieceSentenceContentChuck, stopWatch.getTotalTimeSeconds(), content);
|
||||||
|
return new TripleRecord(format, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
record TripleRecord(String question, String answer) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class TripleExtractResult {
|
||||||
|
private List<TripleExtractNode> result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class TripleExtractNode {
|
||||||
|
private TripleEntity headEntity;
|
||||||
|
private String relation;
|
||||||
|
private TripleEntity tailEntity;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class TripleEntity {
|
||||||
|
private String name;
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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.ModelPieceRecordTypeMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.ModelPieceRecordType">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="record_type" property="recordType" />
|
||||||
|
<result column="create_user_id" property="createUserId" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="update_user_id" property="updateUserId" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, record_type, create_user_id, create_time, update_user_id, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?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.NotePiecePromptMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.NotePiecePrompt">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="prompt" property="prompt"/>
|
||||||
|
<result column="start_entity_type" property="startEntityType"/>
|
||||||
|
<result column="start_entity_template" property="startEntityTemplate"/>
|
||||||
|
<result column="rel_type" property="relType"/>
|
||||||
|
<result column="rel_template" property="relTemplate"/>
|
||||||
|
<result column="name" property="name"/>
|
||||||
|
<result column="end_entity_type" property="endEntityType"/>
|
||||||
|
<result column="end_entity_template" property="endEntityTemplate"/>
|
||||||
|
<result column="create_user_id" property="createUserId"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_user_id" property="updateUserId"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id
|
||||||
|
, prompt, start_entity_type, start_entity_template, rel_type, rel_template,name, end_entity_type, end_entity_template, create_user_id, create_time, update_user_id, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,17 @@
|
|||||||
|
<?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.NotePiecePromptTypeRelMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.NotePiecePromptTypeRel">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="prompt_id" property="promptId" />
|
||||||
|
<result column="type_id" property="typeId" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, prompt_id, type_id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,25 @@
|
|||||||
|
<?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.NoteRecordSplitPieceSentenceMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.NoteRecordSplitPieceSentence">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="record_split_id" property="recordSplitId" />
|
||||||
|
<!-- <result column="content_chuck" property="contentChuck" jdbcType="ARRAY"-->
|
||||||
|
<!-- typeHandler="com.supervision.handler.StringListTypeHandler"/>-->
|
||||||
|
<result column="content_chuck" property="contentChuck" />
|
||||||
|
<result column="content_chuck_summary" property="contentChuckSummary" />
|
||||||
|
<result column="extend" property="extend" />
|
||||||
|
<result column="create_user_id" property="createUserId" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="update_user_id" property="updateUserId" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, record_split_id, content_chuck, content_chuck_summary, extend, create_user_id, create_time, update_user_id, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,46 @@
|
|||||||
|
<?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.NoteRecordSplitSentenceMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.NoteRecordSplitSentence">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="record_split_id" property="recordSplitId"/>
|
||||||
|
<result column="piece_record_split_id" property="pieceRecordSplitId"/>
|
||||||
|
<result column="answer" property="answer"/>
|
||||||
|
<result column="llm_gen_a" property="llmGenA"/>
|
||||||
|
<result column="extend_one" property="extendOne"/>
|
||||||
|
<result column="create_user_id" property="createUserId"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_user_id" property="updateUserId"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id
|
||||||
|
, record_split_id, piece_record_split_id, answer, llm_gen_a, extend_one, create_user_id, create_time, update_user_id, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<insert id="saveBatchList" parameterType="java.util.List">
|
||||||
|
|
||||||
|
insert into note_record_split_sentence (record_split_id, answer,create_user_id,update_user_id)
|
||||||
|
values
|
||||||
|
<foreach collection="noteRecordSplitList" item="entity" index="index" separator=",">
|
||||||
|
(
|
||||||
|
#{entity.recordSplitId}, #{entity.answer},#{entity.createUserId},#{entity.updateUserId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBatchList" parameterType="map">
|
||||||
|
UPDATE note_record_split_sentence
|
||||||
|
SET piece_record_split_id = #{noteRecordSplitPieceSentences}
|
||||||
|
WHERE id IN
|
||||||
|
<foreach item="id" index="index" collection="ids" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,31 @@
|
|||||||
|
<?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.PieceTripleInfoMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.supervision.police.domain.PieceTripleInfo">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="start_node" property="startNode" />
|
||||||
|
<result column="end_node" property="endNode" />
|
||||||
|
<result column="relation" property="relation" />
|
||||||
|
<result column="record_split_id" property="recordSplitId" />
|
||||||
|
<result column="piece_record_split_id" property="pieceRecordSplitId" />
|
||||||
|
<result column="submit_prompt" property="submitPrompt" />
|
||||||
|
<result column="add_neo4j" property="addNeo4j" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
<result column="start_node_graph_id" property="startNodeGraphId" />
|
||||||
|
<result column="rel_graph_id" property="relGraphId" />
|
||||||
|
<result column="end_node_graph_id" property="endNodeGraphId" />
|
||||||
|
<result column="start_node_type" property="startNodeType" />
|
||||||
|
<result column="end_node_type" property="endNodeType" />
|
||||||
|
<result column="create_user_id" property="createUserId" />
|
||||||
|
<result column="update_user_id" property="updateUserId" />
|
||||||
|
<result column="update_time" property="updateTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, start_node, end_node, relation, record_split_id, piece_record_split_id, submit_prompt, add_neo4j, create_time, start_node_graph_id, rel_graph_id, end_node_graph_id, start_node_type, end_node_type, create_user_id, update_user_id, update_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,85 @@
|
|||||||
|
package ${package.Controller};
|
||||||
|
|
||||||
|
import ${package.Entity}.${entity};
|
||||||
|
import ${package.Service}.${table.serviceName};
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
<#--import org.apache.shiro.authz.annotation.Logical;-->
|
||||||
|
<#--import org.apache.shiro.authz.annotation.RequiresPermissions;-->
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
<#--import com.common.res.DataResult;-->
|
||||||
|
<#if restControllerStyle>
|
||||||
|
<#else>
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
</#if>
|
||||||
|
<#if superControllerClassPackage??>
|
||||||
|
import ${superControllerClassPackage};
|
||||||
|
</#if>
|
||||||
|
/**
|
||||||
|
* @author ${author}
|
||||||
|
* @since ${date}
|
||||||
|
*/
|
||||||
|
<#if restControllerStyle>
|
||||||
|
@RestController
|
||||||
|
<#else>
|
||||||
|
@Controller
|
||||||
|
</#if>
|
||||||
|
@RequestMapping("/<#if controllerMappingHyphenStyle>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
|
||||||
|
<#if kotlin>
|
||||||
|
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
|
||||||
|
<#else>
|
||||||
|
<#if superControllerClass??>
|
||||||
|
public class ${table.controllerName} extends ${superControllerClass} {
|
||||||
|
<#else>
|
||||||
|
public class ${table.controllerName} {
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ${table.serviceName} ${table.serviceName?uncap_first};
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/selectOne")
|
||||||
|
<#-- @RequiresPermissions("sys:${table.entityName?uncap_first}:list")-->
|
||||||
|
@ApiOperation("${table.entityName}查询单个")
|
||||||
|
public ${table.entityName} get${table.entityName}(@RequestParam("id") Integer id){
|
||||||
|
${table.entityName} ${table.entityName?uncap_first}One = ${table.entityName?uncap_first}Service.get${table.entityName}( id);
|
||||||
|
return ${table.entityName?uncap_first}One;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listAll")
|
||||||
|
<#-- @RequiresPermissions("sys:${table.entityName?uncap_first}:list")-->
|
||||||
|
@ApiOperation("${table.entityName}查询全部")
|
||||||
|
public List<${table.entityName}> getAll${table.entityName}(){
|
||||||
|
List<${table.entityName}> ${table.entityName?uncap_first}List = ${table.entityName?uncap_first}Service.getAll${table.entityName}();
|
||||||
|
return ${table.entityName?uncap_first}List;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
<#-- @RequiresPermissions("sys:${table.entityName?uncap_first}:add")-->
|
||||||
|
@ApiOperation("${table.entityName}新增")
|
||||||
|
public Object add(@Valid @RequestBody ${table.entityName} ${table.entityName?uncap_first}) {
|
||||||
|
${table.entityName?uncap_first}Service.add( ${table.entityName?uncap_first});
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
<#-- @RequiresPermissions("sys:${table.entityName?uncap_first}:update")-->
|
||||||
|
@ApiOperation("${table.entityName}修改")
|
||||||
|
public int update(@Valid @RequestBody ${table.entityName} ${table.entityName?uncap_first}) {
|
||||||
|
int num = ${table.entityName?uncap_first}Service.modify( ${table.entityName?uncap_first});
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping(value = "/delete/{ids}")
|
||||||
|
<#-- @RequiresPermissions("sys:${table.entityName?uncap_first}:delete")-->
|
||||||
|
@ApiOperation("${table.entityName}删除(单个条目)")
|
||||||
|
public Object remove(@NotBlank(message = "{required}") @PathVariable String ids) {
|
||||||
|
${table.entityName?uncap_first}Service.remove(ids);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</#if>
|
@ -0,0 +1,53 @@
|
|||||||
|
package ${package.Service};
|
||||||
|
|
||||||
|
import ${package.Entity}.${entity};
|
||||||
|
import ${superServiceClassPackage};
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ${author}
|
||||||
|
* @since ${date}
|
||||||
|
*/
|
||||||
|
<#if kotlin>
|
||||||
|
interface ${table.serviceName} : ${superServiceClass}<${entity}>
|
||||||
|
<#else>
|
||||||
|
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${table.entityName!}详情
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
${table.entityName} get${table.entityName}( Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${table.entityName!}详情
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<${table.entityName}> getAll${table.entityName}();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${table.entityName!}新增
|
||||||
|
* @param ${table.entityName?uncap_first} 根据需要进行传值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void add(${entity} ${table.entityName?uncap_first});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${table.entityName!}修改
|
||||||
|
* @param ${table.entityName?uncap_first} 根据需要进行传值
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int modify(${entity} ${table.entityName?uncap_first});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${table.entityName!}删除
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void remove(String ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
|
@ -0,0 +1,69 @@
|
|||||||
|
package ${package.ServiceImpl};
|
||||||
|
|
||||||
|
import ${package.Entity}.${entity};
|
||||||
|
import ${package.Mapper}.${table.mapperName};
|
||||||
|
import ${package.Service}.${table.serviceName};
|
||||||
|
import ${superServiceImplClassPackage};
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
|
/**
|
||||||
|
* ${table.comment!} 服务实现类
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @since ${date}
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
<#if kotlin>
|
||||||
|
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
|
||||||
|
|
||||||
|
}
|
||||||
|
<#else>
|
||||||
|
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
${table.entityName}Mapper ${table.entityName?uncap_first}Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ${table.entityName} get${table.entityName}(Integer id){
|
||||||
|
|
||||||
|
return ${table.entityName?uncap_first}Mapper.selectById(id);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public List<${table.entityName}> getAll${table.entityName}(){
|
||||||
|
return ${table.entityName?uncap_first}Mapper.selectList(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add( ${table.entityName} ${table.entityName?uncap_first}) {
|
||||||
|
${table.entityName?uncap_first}Mapper.insert(${table.entityName?uncap_first});
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int modify( ${table.entityName} ${table.entityName?uncap_first}) {
|
||||||
|
//乐观锁更新
|
||||||
|
${table.entityName} current${table.entityName}= ${table.entityName?uncap_first}Mapper.selectById(${table.entityName?uncap_first}.getId());
|
||||||
|
${table.entityName?uncap_first}.setVersion(current${table.entityName}.getVersion());
|
||||||
|
return ${table.entityName?uncap_first}Mapper.updateById(${table.entityName?uncap_first});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove( String ids) {
|
||||||
|
|
||||||
|
if(StringUtils.isNotEmpty(ids)){
|
||||||
|
String[] array = ids.split(",");
|
||||||
|
if (!CollectionUtils.isEmpty(Arrays.asList(array))) {
|
||||||
|
${table.entityName?uncap_first}Mapper.deleteBatchIds(Arrays.asList(array));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</#if>
|
Loading…
Reference in New Issue