Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/main/resources/application.yml
main
xueqingkun 1 year ago
commit d05091eaaf

3
.gitignore vendored

@ -43,3 +43,6 @@ buildNumber.properties
# JDT-specific (Eclipse Java Development Tools)
.classpath
.idea
.idea/*

@ -16,5 +16,10 @@
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
</component>
</project>

@ -1,2 +0,0 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar

@ -1,9 +1,11 @@
package com.supervision;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = {"com.supervision.**.mapper"})
public class InterroRobotApplication {
public static void main(String[] args) {

@ -1,6 +1,9 @@
package com.supervision.config;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.supervision.config.domain.UserInfo;
import com.supervision.util.UserUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
@ -16,11 +19,21 @@ public class MybatisMetaHandler implements MetaObjectHandler {
// 填充
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
this.strictInsertFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
UserInfo user = UserUtil.getUser();
if (ObjectUtil.isNotEmpty(user)) {
this.strictInsertFill(metaObject, "createUserId", String.class, user.getId());
this.strictInsertFill(metaObject, "updateUserId", String.class, user.getId());
}
}
@Override
public void updateFill(MetaObject metaObject) {
log.info("填充修改时间以及修改用户");
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
UserInfo user = UserUtil.getUser();
if (ObjectUtil.isNotEmpty(user)) {
this.strictInsertFill(metaObject, "updateUserId", String.class, user.getId());
}
}
}

@ -0,0 +1,119 @@
package com.supervision.config;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.supervision.config.domain.GlobalResult;
import com.supervision.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.lang.Nullable;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import java.util.Objects;
import java.util.stream.Collectors;
/**
*
*
* @author wb
* @date 2022/3/10 13:24
*/
@Slf4j
@RestControllerAdvice(annotations = RestController.class, basePackages = {"com.**.controller"})
public class ResponseConfig implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(@Nullable MethodParameter methodParameter,
@Nullable Class<? extends HttpMessageConverter<?>> aClass) {
assert methodParameter != null;
return !methodParameter.getDeclaringClass().getName().contains("swagger");
}
@Override
@SuppressWarnings("all")
public Object beforeBodyWrite(Object o, @Nullable MethodParameter methodParameter, @Nullable MediaType mediaType,
@Nullable Class<? extends HttpMessageConverter<?>> aClass, @Nullable ServerHttpRequest serverHttpRequest,
@Nullable ServerHttpResponse serverHttpResponse) {
serverHttpResponse.getHeaders().set("Content-Type", "application/json");
if (Objects.isNull(o)) {
return GlobalResult.ok(null, "success");
}
if (o instanceof GlobalResult) {
return o;
}
// 对于String类型的返回值需要进行特殊处理
if (o instanceof String) {
return JSONUtil.toJsonStr(GlobalResult.ok(o, "success"));
}
return GlobalResult.ok(o, "success");
}
/**
*
*
* @param exception
* @return
*/
@ExceptionHandler(BusinessException.class)
public GlobalResult<?> businessExceptionResponse(BusinessException exception) {
log.error(exception.getMessage(), exception);
Integer code = null == exception.getCode() ? HttpStatus.INTERNAL_SERVER_ERROR.value(): exception.getCode();
String message = StrUtil.isNotEmpty(exception.getMessage()) ? exception.getMessage() : "业务异常";
return GlobalResult.error( code, exception.getMessage(), message);
}
/**
*
*
* @param exception
* @return
*/
@ExceptionHandler({MethodArgumentNotValidException.class, BindException.class})
public GlobalResult<?> validationExceptionResponse(MethodArgumentNotValidException exception) {
log.error(exception.getMessage(), exception);
// 格式化错误信息
String errorMsg = exception.getBindingResult().getFieldErrors().stream()
.map(e -> e.getField() + ":" + e.getDefaultMessage()).collect(Collectors.joining("、"));
return GlobalResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), errorMsg, "参数验证异常");
}
/**
*
* @param exception
* @return
*/
@ExceptionHandler(IllegalArgumentException.class)
public GlobalResult<?> manualValidationExceptionResponse(IllegalArgumentException exception) {
log.error(exception.getMessage(), exception);
return GlobalResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), exception.getMessage(), "参数验证异常");
}
/**
*
*
* @param exception
* @return
*/
@ExceptionHandler(Exception.class)
public GlobalResult<?> validationExceptionResponse(Exception exception) {
log.error(exception.getMessage(), exception);
return GlobalResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), "未知错误", "未知错误");
}
}

@ -0,0 +1,49 @@
package com.supervision.config.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.http.HttpStatus;
@Data
@ApiModel
public class GlobalResult<T> {
private int code = 200;
private String msg = "success";
@ApiModelProperty
private T data;
public static <T> GlobalResult<T> ok() {
return ok(null);
}
public static <T> GlobalResult<T> ok(T data) {
GlobalResult<T> globalResult = new GlobalResult<>();
globalResult.setData(data);
return globalResult;
}
public static <T> GlobalResult<T> ok(T data, String message) {
GlobalResult<T> globalResult = new GlobalResult<>();
globalResult.setMsg(message);
globalResult.setData(data);
return globalResult;
}
public static <T> GlobalResult<T> error(String msg) {
return error(HttpStatus.INTERNAL_SERVER_ERROR.value(), null, msg);
}
public static <T> GlobalResult<T> error(int code, T data, String msg) {
GlobalResult<T> globalResult = new GlobalResult<>();
globalResult.setCode(code);
globalResult.setData(data);
globalResult.setMsg(msg);
return globalResult;
}
}

@ -0,0 +1,11 @@
package com.supervision.config.domain;
import lombok.Data;
@Data
public class UserInfo {
private String id;
private String name;
}

@ -0,0 +1,35 @@
package com.supervision.controller;
import com.supervision.dto.MatchQuestionAnswerDTO;
import com.supervision.service.MatchToolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Slf4j
@Api(tags = "相似度匹配工具")
@RestController
@RequestMapping("matchTool")
@RequiredArgsConstructor
public class MatchToolController {
private final MatchToolService matchToolService;
@ApiOperation("刷新匹配工具知识库")
@GetMapping("refreshMatchToolLibrary")
public void refreshMatchToolLibrary() {
matchToolService.refreshMatchToolLibrary();
}
@ApiOperation("进行问答")
@GetMapping("execMatch")
public List<MatchQuestionAnswerDTO> execMatch(String question) {
return matchToolService.execMatch(question);
}
}

@ -0,0 +1,70 @@
package com.supervision.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.supervision.domain.IrSession;
import com.supervision.domain.IrSessionHistory;
import com.supervision.service.IrSessionService;
import com.supervision.vo.session.FinishSessionVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;
@Slf4j
@Api(tags = "会话管理")
@RestController
@RequestMapping("session")
@RequiredArgsConstructor
public class SessionController {
private final IrSessionService irSessionService;
@ApiOperation("创建新的会话")
@GetMapping("createNewSession")
@ApiImplicitParams({
@ApiImplicitParam(name = "caseNumber", value = "案件编号", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "type", value = "播报方式(1语音 2文字)", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "speed", value = "播放速度(2位,小数后1位,例如:1.0,0.5,1.5,2.0)", required = true, dataType = "String", paramType = "query")
})
public IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed) {
return irSessionService.createNewSession(caseNumber, type, speed);
}
@ApiOperation("分页获取会话列表")
@GetMapping("querySessionPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "sessionName", value = "模糊搜索", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "pageNum", value = "pageNum", required = true, dataType = "Integer", paramType = "query")
})
public IPage<IrSession> querySessionPage(String sessionName, Integer pageSize, Integer pageNum) {
return irSessionService.querySessionPage(sessionName, pageSize, pageNum);
}
@ApiOperation("结束会话")
@PostMapping("finishSession")
public void finishSession(@RequestBody FinishSessionVO finishSessionVO) {
irSessionService.finishSession(finishSessionVO);
}
@ApiOperation("查询会话历史记录列表")
@GetMapping("querySessionHistory")
public List<IrSessionHistory> querySessionHistory(@NotBlank(message = "会话ID不能为空") String sessionId) {
return irSessionService.querySessionHistory(sessionId);
}
@ApiOperation("删除会话记录")
@DeleteMapping("deleteSession")
public void deleteSession(@NotBlank(message = "会话ID不能为空") String sessionId) {
irSessionService.deleteSession(sessionId);
}
}

@ -1,11 +1,15 @@
package com.supervision.controller;
import com.supervision.domain.IrRobotConfig;
import com.supervision.service.IrRobotConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("test")
@ -13,13 +17,13 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
public class TestController {
private final IrRobotConfigService irRobotConfigService;
@GetMapping("hello")
public String hello() {
System.out.println("hello");
log.info("ddddd");
return "OK";
public List<IrRobotConfig> hello() {
return irRobotConfigService.list();
}

@ -0,0 +1,69 @@
package com.supervision.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 java.time.LocalDateTime;
import lombok.Data;
/**
*
*
* @TableName ir_knowledge
*/
@TableName(value = "ir_knowledge", schema = "interro_robot")
@Data
public class IrKnowledge implements Serializable {
/**
*
*/
@TableId
private String id;
/**
*
*/
private String standardQuestion;
/**
* (1 2 3)
*/
private Integer state;
/**
* SQL(使)
*/
private String sqlTemplate;
/**
* (使)
*/
private String resultTemplate;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,61 @@
package com.supervision.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 java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_knowledge_similar
*/
@TableName(value ="ir_knowledge_similar")
@Data
public class IrKnowledgeSimilar implements Serializable {
/**
*
*/
@TableId
private String id;
/**
* ID
*/
private String knowledgeId;
/**
*
*/
private String similarQuestion;
/**
* (1 2 3)
*/
private Integer state;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,107 @@
package com.supervision.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 java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_robot_config
*/
@TableName(value ="ir_robot_config", schema = "interro_robot")
@Data
public class IrRobotConfig implements Serializable {
/**
*
*/
@TableId
private String id;
/**
*
*/
private String deviceName;
/**
*
*/
private String deptName;
/**
*
*/
private String deviceCode;
/**
* (1 2)
*/
private Integer state;
/**
*
*/
private BigDecimal talkSpeed;
/**
*
*/
private String iconBase64;
/**
*
*/
private String activeLanguage;
/**
*
*/
private String errorLanguage;
/**
* 1
*/
private String unrecognizedOne;
/**
* 2
*/
private String unrecognizedTwo;
/**
* 3
*/
private String unrecognizedThree;
/**
* 5
*/
private String unrecognizedFour;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,77 @@
package com.supervision.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 java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_session
*/
@TableName(value ="ir_session", schema = "interro_robot")
@Data
public class IrSession implements Serializable {
/**
*
*/
@TableId
private String id;
/**
* ,
*/
private String sessionName;
/**
* (1,2)
*/
private Integer sessionState;
/**
* ID
*/
private String userId;
/**
* (2,1,:1.5)
*/
private BigDecimal videoSpeed;
/**
* (1 2)
*/
private Integer broadcastType;
/**
* (1 2,3)
*/
private Integer sessionScore;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,92 @@
package com.supervision.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 java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_session_history
*/
@TableName(value ="ir_session_history", schema = "interro_robot")
@Data
public class IrSessionHistory implements Serializable {
/**
*
*/
@TableId
private String id;
/**
* ID
*/
private String sessionId;
/**
*
*/
private String userQuestion;
/**
* ID(ID)
*/
private String userQuestionVideoId;
/**
* ID
*/
private String matchKnowledgeId;
/**
* ID
*/
private String userId;
/**
*
*/
private BigDecimal threshold;
/**
* ( 1 2 3),
*/
private Integer scoreCause;
/**
*
*/
private LocalDateTime answerTime;
/**
* (1 2)
*/
private Integer dealState;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,66 @@
package com.supervision.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 java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_session_param
*/
@TableName(value ="ir_session_param", schema = "interro_robot")
@Data
public class IrSessionParam implements Serializable {
/**
*
*/
@TableId
private String id;
/**
* ID
*/
private String sessionId;
/**
*
*/
private String paramName;
/**
*
*/
private String paramValue;
/**
*
*/
private String paramType;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,71 @@
package com.supervision.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 java.time.LocalDateTime;
import lombok.Data;
/**
*
* @TableName ir_sql_param
*/
@TableName(value ="ir_sql_param", schema = "interro_robot")
@Data
public class IrSqlParam implements Serializable {
/**
*
*/
@TableId
private String id;
/**
* ID
*/
private Integer knowledgeId;
/**
*
*/
private String paramName;
/**
*
*/
private String paramType;
/**
* (1,2)
*/
private Integer paramRequire;
/**
*
*/
private String paramDesc;
/**
*
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
*
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,76 @@
package com.supervision.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 java.time.LocalDateTime;
import lombok.Data;
/**
*
*
* @TableName ir_user
*/
@TableName(value = "ir_user", schema = "interro_robot")
@Data
public class IrUser implements Serializable {
/**
*
*/
@TableId
private String id;
/**
*
*/
private String userAccount;
/**
*
*/
private String realName;
/**
*
*/
private String ps;
/**
* (1 2)
*/
private Integer state;
/**
* (1 2)
*/
private Integer roleType;
/**
* ID
*/
private String createUserId;
/**
*
*/
private LocalDateTime createTime;
/**
* ID
*/
private String updateUserId;
/**
*
*/
private LocalDateTime updateTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

@ -0,0 +1,13 @@
package com.supervision.dto;
import lombok.Data;
@Data
public class MatchQuestionAnswerDTO {
private String matchQuestion;
private String matchQuestionCode;
private Double matchScore;
}

@ -0,0 +1,13 @@
package com.supervision.dto;
import lombok.Data;
import java.util.List;
@Data
public class MatchToolQuestionDTO {
private String questionId;
private List<String> questionList;
}

@ -0,0 +1,11 @@
package com.supervision.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class QuestionReqDTO {
private String question;
}

@ -0,0 +1,24 @@
package com.supervision.enums;
public enum SessionParamEnum {
CASE_NUMBER("CASE_NUMBER", String.class);
private final String paramName;
private final Class<?> paramType;
SessionParamEnum(String paramName, Class<?> paramType) {
this.paramName = paramName;
this.paramType = paramType;
}
public String getParamName() {
return paramName;
}
public Class<?> getParamType() {
return paramType;
}
}

@ -0,0 +1,76 @@
/*
* : CustomException
* :
* : <>
* : RedName
* : 2022/8/5
* : <>
* : <>
* : <>
*/
package com.supervision.exception;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
/**
* <>
*
*
* @author ljt
* @version [, 2022/8/5]
* @see [/]
* @since [/]
*/
@Slf4j
public class BusinessException extends RuntimeException {
/**
*
*/
private final Integer code;
/**
*
*/
private final String message;
public BusinessException(Throwable cause) {
super(cause);
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
this.message = null;
}
public BusinessException(Throwable cause, String message) {
super(cause);
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
this.message = message;
}
public BusinessException(String message) {
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
this.message = message;
}
public BusinessException(String message, Integer code) {
this.message = message;
this.code = code;
}
public BusinessException(String message, Throwable e) {
super(message, e);
log.error(message, e);
this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
this.message = message;
}
@Override
public String getMessage() {
return message;
}
public Integer getCode() {
return code;
}
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrKnowledge;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_knowledge()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrKnowledge
*/
public interface IrKnowledgeMapper extends BaseMapper<IrKnowledge> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrKnowledgeSimilar;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_knowledge_similar()Mapper
* @createDate 2024-03-21 15:27:37
* @Entity com.supervision.domain.IrKnowledgeSimilar
*/
public interface IrKnowledgeSimilarMapper extends BaseMapper<IrKnowledgeSimilar> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrRobotConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_robot_config()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrRobotConfig
*/
public interface IrRobotConfigMapper extends BaseMapper<IrRobotConfig> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrSessionHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_session_history()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrSessionHistory
*/
public interface IrSessionHistoryMapper extends BaseMapper<IrSessionHistory> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrSession;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_session()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrSession
*/
public interface IrSessionMapper extends BaseMapper<IrSession> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrSessionParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_session_param()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrSessionParam
*/
public interface IrSessionParamMapper extends BaseMapper<IrSessionParam> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrSqlParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_sql_param()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrSqlParam
*/
public interface IrSqlParamMapper extends BaseMapper<IrSqlParam> {
}

@ -0,0 +1,18 @@
package com.supervision.mapper;
import com.supervision.domain.IrUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author flevance
* @description ir_user()Mapper
* @createDate 2024-03-21 13:14:43
* @Entity com.supervision.domain.IrUser
*/
public interface IrUserMapper extends BaseMapper<IrUser> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrKnowledge;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_knowledge()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrKnowledgeService extends IService<IrKnowledge> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrKnowledgeSimilar;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_knowledge_similar()Service
* @createDate 2024-03-21 15:27:37
*/
public interface IrKnowledgeSimilarService extends IService<IrKnowledgeSimilar> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrRobotConfig;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_robot_config()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrRobotConfigService extends IService<IrRobotConfig> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrSessionHistory;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_session_history()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrSessionHistoryService extends IService<IrSessionHistory> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrSessionParam;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_session_param()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrSessionParamService extends IService<IrSessionParam> {
}

@ -0,0 +1,30 @@
package com.supervision.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.supervision.domain.IrSession;
import com.baomidou.mybatisplus.extension.service.IService;
import com.supervision.domain.IrSessionHistory;
import com.supervision.vo.session.FinishSessionVO;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.List;
/**
* @author flevance
* @description ir_session()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrSessionService extends IService<IrSession> {
IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed);
IPage<IrSession> querySessionPage(String sessionName,Integer pageSize, Integer pageNum);
void finishSession(FinishSessionVO finishSessionVO);
List<IrSessionHistory> querySessionHistory(String sessionId);
void deleteSession(String sessionId);
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrSqlParam;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_sql_param()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrSqlParamService extends IService<IrSqlParam> {
}

@ -0,0 +1,13 @@
package com.supervision.service;
import com.supervision.domain.IrUser;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author flevance
* @description ir_user()Service
* @createDate 2024-03-21 13:14:43
*/
public interface IrUserService extends IService<IrUser> {
}

@ -0,0 +1,12 @@
package com.supervision.service;
import com.supervision.dto.MatchQuestionAnswerDTO;
import java.util.List;
public interface MatchToolService {
void refreshMatchToolLibrary();
List<MatchQuestionAnswerDTO> execMatch(String question);
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrKnowledge;
import com.supervision.service.IrKnowledgeService;
import com.supervision.mapper.IrKnowledgeMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_knowledge()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrKnowledgeServiceImpl extends ServiceImpl<IrKnowledgeMapper, IrKnowledge>
implements IrKnowledgeService{
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrKnowledgeSimilar;
import com.supervision.service.IrKnowledgeSimilarService;
import com.supervision.mapper.IrKnowledgeSimilarMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_knowledge_similar()Service
* @createDate 2024-03-21 15:27:37
*/
@Service
public class IrKnowledgeSimilarServiceImpl extends ServiceImpl<IrKnowledgeSimilarMapper, IrKnowledgeSimilar>
implements IrKnowledgeSimilarService{
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrRobotConfig;
import com.supervision.service.IrRobotConfigService;
import com.supervision.mapper.IrRobotConfigMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_robot_config()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrRobotConfigServiceImpl extends ServiceImpl<IrRobotConfigMapper, IrRobotConfig>
implements IrRobotConfigService{
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrSessionHistory;
import com.supervision.service.IrSessionHistoryService;
import com.supervision.mapper.IrSessionHistoryMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_session_history()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrSessionHistoryServiceImpl extends ServiceImpl<IrSessionHistoryMapper, IrSessionHistory>
implements IrSessionHistoryService{
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrSessionParam;
import com.supervision.service.IrSessionParamService;
import com.supervision.mapper.IrSessionParamMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_session_param()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrSessionParamServiceImpl extends ServiceImpl<IrSessionParamMapper, IrSessionParam>
implements IrSessionParamService{
}

@ -0,0 +1,99 @@
package com.supervision.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.config.domain.UserInfo;
import com.supervision.domain.IrSession;
import com.supervision.exception.BusinessException;
import com.supervision.service.IrSessionHistoryService;
import com.supervision.service.IrSessionService;
import com.supervision.mapper.IrSessionMapper;
import com.supervision.util.UserUtil;
import com.supervision.vo.session.FinishSessionVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.supervision.domain.IrSessionHistory;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
/**
* @author flevance
* @description ir_session()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
@RequiredArgsConstructor
public class IrSessionServiceImpl extends ServiceImpl<IrSessionMapper, IrSession>
implements IrSessionService {
private final IrSessionHistoryService irSessionHistoryService;
@Override
public IrSession createNewSession(String caseNumber, Integer type, BigDecimal speed) {
UserInfo user = UserUtil.getUser();
IrSession irSession = new IrSession();
irSession.setSessionName("案件编号:" + caseNumber);
irSession.setSessionState(1);
irSession.setUserId(user.getId());
irSession.setVideoSpeed(speed);
irSession.setBroadcastType(type);
this.save(irSession);
return irSession;
}
@Override
public IPage<IrSession> querySessionPage(String sessionName, Integer pageSize, Integer pageNum) {
UserInfo user = UserUtil.getUser();
return this.lambdaQuery().like(StrUtil.isNotBlank(sessionName), IrSession::getSessionName, sessionName).eq(IrSession::getUserId, user.getId()).page(new Page<>(pageNum, pageSize));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void finishSession(FinishSessionVO finishSessionVO) {
IrSession irSession = Optional.ofNullable(this.getById(finishSessionVO.getSessionId())).orElseThrow(() -> new BusinessException("未找到的会话"));
if (irSession.getSessionState() == 2) {
throw new BusinessException("会话已结束");
}
// 更新会话
irSession.setSessionState(2);
if (ObjUtil.isNotEmpty(finishSessionVO.getSessionScore())) {
irSession.setSessionScore(finishSessionVO.getSessionScore());
}
this.updateById(irSession);
// 更新会话历史
if (CollUtil.isNotEmpty(finishSessionVO.getIrrelevantAnswerHistoryId())) {
irSessionHistoryService.lambdaUpdate().set(IrSessionHistory::getScoreCause, 2).set(IrSessionHistory::getDealState, 1)
.in(IrSessionHistory::getId, finishSessionVO.getIrrelevantAnswerHistoryId()).update();
}
if (CollUtil.isNotEmpty(finishSessionVO.getErrorAnswerHistoryId())) {
irSessionHistoryService.lambdaUpdate().set(IrSessionHistory::getScoreCause, 1).set(IrSessionHistory::getDealState, 1)
.in(IrSessionHistory::getId, finishSessionVO.getErrorAnswerHistoryId()).update();
}
if (CollUtil.isNotEmpty(finishSessionVO.getOtherAnswerHistoryId())) {
irSessionHistoryService.lambdaUpdate().set(IrSessionHistory::getScoreCause, 2).set(IrSessionHistory::getDealState, 1)
.in(IrSessionHistory::getId, finishSessionVO.getOtherAnswerHistoryId()).update();
}
}
@Override
public List<IrSessionHistory> querySessionHistory(String sessionId) {
return irSessionHistoryService.lambdaQuery().eq(IrSessionHistory::getSessionId, sessionId).list();
}
@Override
public void deleteSession(String sessionId) {
this.removeById(sessionId);
}
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrSqlParam;
import com.supervision.service.IrSqlParamService;
import com.supervision.mapper.IrSqlParamMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_sql_param()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrSqlParamServiceImpl extends ServiceImpl<IrSqlParamMapper, IrSqlParam>
implements IrSqlParamService{
}

@ -0,0 +1,22 @@
package com.supervision.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.supervision.domain.IrUser;
import com.supervision.service.IrUserService;
import com.supervision.mapper.IrUserMapper;
import org.springframework.stereotype.Service;
/**
* @author flevance
* @description ir_user()Service
* @createDate 2024-03-21 13:14:43
*/
@Service
public class IrUserServiceImpl extends ServiceImpl<IrUserMapper, IrUser>
implements IrUserService{
}

@ -0,0 +1,103 @@
package com.supervision.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.supervision.config.domain.GlobalResult;
import com.supervision.domain.IrKnowledge;
import com.supervision.domain.IrKnowledgeSimilar;
import com.supervision.dto.MatchQuestionAnswerDTO;
import com.supervision.dto.MatchToolQuestionDTO;
import com.supervision.dto.QuestionReqDTO;
import com.supervision.exception.BusinessException;
import com.supervision.service.IrKnowledgeService;
import com.supervision.service.IrKnowledgeSimilarService;
import com.supervision.service.MatchToolService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.net.HttpURLConnection;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class MatchToolServiceImpl implements MatchToolService {
private final IrKnowledgeService irKnowledgeService;
private final IrKnowledgeSimilarService irKnowledgeSimilarService;
@Value("${matchTool.url}")
private String matchToolUrl;
@Override
public void refreshMatchToolLibrary() {
// 获取所有的问题
List<IrKnowledge> knowledgeList = irKnowledgeService.list();
// 获取相似问题
List<IrKnowledgeSimilar> similarList = irKnowledgeSimilarService.list();
Map<String, List<IrKnowledgeSimilar>> similarKnowledgeMap = similarList.stream().collect(Collectors.groupingBy(IrKnowledgeSimilar::getKnowledgeId));
Map<String, List<String>> questionLibrary = knowledgeList.stream().collect(Collectors.toMap(IrKnowledge::getId, e -> CollUtil.newArrayList(e.getStandardQuestion())));
List<MatchToolQuestionDTO> matchToolQuestionDTOList = new ArrayList<>();
for (Map.Entry<String, List<String>> entry : questionLibrary.entrySet()) {
String questionId = entry.getKey();
List<IrKnowledgeSimilar> similarKnowledgeList = similarKnowledgeMap.get(questionId);
if (CollUtil.isNotEmpty(similarKnowledgeList)) {
Set<String> similarQuestionSet = similarKnowledgeList.stream().map(IrKnowledgeSimilar::getSimilarQuestion).collect(Collectors.toSet());
entry.getValue().addAll(similarQuestionSet);
}
MatchToolQuestionDTO matchToolQuestionDTO = new MatchToolQuestionDTO();
matchToolQuestionDTO.setQuestionId(questionId);
matchToolQuestionDTO.setQuestionList(entry.getValue());
matchToolQuestionDTOList.add(matchToolQuestionDTO);
}
// 调用tool服务进行更新操作
submitRefresh(matchToolQuestionDTOList);
}
@Override
public List<MatchQuestionAnswerDTO> execMatch(String question) {
log.info("开始调用talkQaSimilarity,问题:{}", question);
try {
String post = HttpUtil.post(matchToolUrl + "/matchQuestion", JSONUtil.toJsonStr(new QuestionReqDTO(question)));
log.info("相似度匹配答案:{}", post);
TypeReference<GlobalResult<List<MatchQuestionAnswerDTO>>> globalResultTypeReference = new TypeReference<GlobalResult<List<MatchQuestionAnswerDTO>>>() {
};
GlobalResult<List<MatchQuestionAnswerDTO>> result = JSONUtil.toBean(post, globalResultTypeReference.getType(), true);
if (result.getCode() != 200) {
throw new BusinessException("匹配失败");
}
return result.getData();
} catch (Exception e) {
log.error("调用talkQaSimilarity error ", e);
return null;
}
}
private void submitRefresh(List<MatchToolQuestionDTO> matchToolQuestionDTOList) {
log.info("开始调用matchTool服务进行更新操作");
try {
String post = HttpUtil.post(matchToolUrl + "/updateDatabase", JSONUtil.toJsonStr(matchToolQuestionDTOList));
log.info(post);
if (!JSONUtil.isTypeJSON(post)) {
throw new BusinessException("更新失败");
}
} catch (Exception e) {
log.error("调用matchTool服务更新失败", e);
throw new BusinessException("更新失败");
}
log.info("成功调用matchTool服务更新数据库");
}
}

@ -0,0 +1,127 @@
package com.supervision.util;
import cn.hutool.core.util.ArrayUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Map;
/***
* @author ljt
* @since 2020/8/4 17:37
*
*/
@Component
@Lazy(false)
public class SpringBeanUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
/**
* applicationContext
*
* @return ApplicationContext
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringBeanUtil.applicationContext = applicationContext;
}
//通过name获取 Bean.
/**
* name Bean
*
* @param <T> Bean
* @param name Bean
* @return Bean
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
/**
* classBean
*
* @param <T> Bean
* @param clazz Bean
* @return Bean
*/
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
/**
* name,ClazzBean
*
* @param <T> bean
* @param name Bean
* @param clazz bean
* @return Bean
*/
public static <T> T getBean(String name, Class<T> clazz) {
return applicationContext.getBean(name, clazz);
}
/**
* Bean
*
* @param <T> Bean
* @param type nullbean
* @return beankeybeannamevalueBean
* @since 5.3.3
*/
public static <T> Map<String, T> getBeansOfType(Class<T> type) {
return applicationContext.getBeansOfType(type);
}
/**
* Bean
*
* @param type nullbean
* @return bean
* @since 5.3.3
*/
public static String[] getBeanNamesForType(Class<?> type) {
return applicationContext.getBeanNamesForType(type);
}
/**
*
*
* @param key key
* @return
* @since 5.3.3
*/
public static String getProperty(String key) {
return applicationContext.getEnvironment().getProperty(key);
}
/**
* null
*
* @return
* @since 5.3.3
*/
public static String[] getActiveProfiles() {
return applicationContext.getEnvironment().getActiveProfiles();
}
/**
*
*
* @return
* @since 5.3.3
*/
public static String getActiveProfile() {
final String[] activeProfiles = getActiveProfiles();
return ArrayUtil.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
}
}

@ -0,0 +1,20 @@
package com.supervision.util;
import com.supervision.config.domain.UserInfo;
public class UserUtil {
public static UserInfo getUser(){
// String userStr = ThreadCache.USER.get();
// User bean = JSONUtil.toBean(userStr, User.class);
// if (ObjectUtil.isEmpty(bean)){
// throw new BusinessException("未获取到用户信息");
// }
// return bean;
UserInfo userInfo = new UserInfo();
userInfo.setId("1");
userInfo.setName("张警官");
return userInfo;
}
}

@ -0,0 +1,27 @@
package com.supervision.vo.session;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FinishSessionVO {
@ApiModelProperty("会话ID")
private String sessionId;
@ApiModelProperty("会话评分(1满意 2不满意,3未评估)")
private Integer sessionScore;
@ApiModelProperty("答非所问historyId")
private List<String> irrelevantAnswerHistoryId;
@ApiModelProperty("信息错误historyId")
private List<String> errorAnswerHistoryId;
@ApiModelProperty("其他historyId")
private List<String> otherAnswerHistoryId;
}

@ -0,0 +1,15 @@
package com.supervision.vo.session;
import io.swagger.annotations.ApiModel;
import lombok.Data;
@Data
@ApiModel
public class talkHistoryVO {
private String historyId;
private String question;
private String answer;
}

@ -41,6 +41,8 @@ spring:
log-slow-sql: true
slow-sql-millis: 5000
merge-sql: false
matchTool:
url: http://192.168.10.137:8080
mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
configuration:

@ -0,0 +1,26 @@
<?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.mapper.IrKnowledgeMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrKnowledge">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="questionCode" column="question_code" jdbcType="INTEGER"/>
<result property="standardQuestion" column="standard_question" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="sqlTemplate" column="sql_template" jdbcType="VARCHAR"/>
<result property="resultTemplate" column="result_template" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,question_code,standard_question,
state,sql_template,result_template,
create_user_id,create_time,update_user_id,
update_time
</sql>
</mapper>

@ -0,0 +1,23 @@
<?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.mapper.IrKnowledgeSimilarMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrKnowledgeSimilar">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="knowledgeId" column="knowledge_id" jdbcType="VARCHAR"/>
<result property="similarQuestion" column="similar_question" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,knowledge_id,similar_question,
state,create_user_id,create_time,
update_user_id,update_time
</sql>
</mapper>

@ -0,0 +1,35 @@
<?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.mapper.IrRobotConfigMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrRobotConfig">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="deviceName" column="device_name" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="talkSpeed" column="talk_speed" jdbcType="NUMERIC"/>
<result property="iconBase64" column="icon_base64" jdbcType="VARCHAR"/>
<result property="activeLanguage" column="active_language" jdbcType="VARCHAR"/>
<result property="errorLanguage" column="error_language" jdbcType="VARCHAR"/>
<result property="unrecognizedOne" column="unrecognized_one" jdbcType="VARCHAR"/>
<result property="unrecognizedTwo" column="unrecognized_two" jdbcType="VARCHAR"/>
<result property="unrecognizedThree" column="unrecognized_three" jdbcType="VARCHAR"/>
<result property="unrecognizedFour" column="unrecognized_four" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,device_name,dept_name,
device_code,state,talk_speed,
icon_base64,active_language,error_language,
unrecognized_one,unrecognized_two,unrecognized_three,
unrecognized_four,create_user_id,create_time,
update_user_id,update_time
</sql>
</mapper>

@ -0,0 +1,32 @@
<?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.mapper.IrSessionHistoryMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrSessionHistory">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="sessionId" column="session_id" jdbcType="VARCHAR"/>
<result property="userQuestion" column="user_question" jdbcType="VARCHAR"/>
<result property="userQuestionVideoId" column="user_question_video_id" jdbcType="VARCHAR"/>
<result property="matchKnowledgeId" column="match_knowledge_id" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="threshold" column="threshold" jdbcType="NUMERIC"/>
<result property="score" column="score" jdbcType="INTEGER"/>
<result property="scoreCause" column="score_cause" jdbcType="INTEGER"/>
<result property="answerTime" column="answer_time" jdbcType="TIMESTAMP"/>
<result property="dealState" column="deal_state" jdbcType="INTEGER"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,session_id,user_question,
user_question_video_id,match_knowledge_id,user_id,
threshold,score,score_cause,
answer_time,deal_state,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.mapper.IrSessionMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrSession">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="sessionState" column="session_state" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="videoSpeed" column="video_speed" jdbcType="NUMERIC"/>
<result property="broadcastType" column="broadcast_type" jdbcType="INTEGER"/>
<result property="sessionScore" column="session_score" jdbcType="INTEGER"/>
<result property="scoreCause" column="score_cause" jdbcType="INTEGER"/>
<result property="scoreExplain" column="score_explain" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,session_state,user_id,
video_speed,broadcast_type,session_score,
score_cause,score_explain,create_user_id,
create_time,update_user_id,update_time
</sql>
</mapper>

@ -0,0 +1,24 @@
<?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.mapper.IrSessionParamMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrSessionParam">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="sessionId" column="session_id" jdbcType="VARCHAR"/>
<result property="paramName" column="param_name" jdbcType="VARCHAR"/>
<result property="paramValue" column="param_value" jdbcType="VARCHAR"/>
<result property="paramType" column="param_type" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,session_id,param_name,
param_value,param_type,create_user_id,
create_time,update_user_id,update_time
</sql>
</mapper>

@ -0,0 +1,26 @@
<?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.mapper.IrSqlParamMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrSqlParam">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="knowledgeId" column="knowledge_id" jdbcType="INTEGER"/>
<result property="paramName" column="param_name" jdbcType="VARCHAR"/>
<result property="paramType" column="param_type" jdbcType="VARCHAR"/>
<result property="paramRequire" column="param_require" jdbcType="INTEGER"/>
<result property="paramDesc" column="param_desc" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,knowledge_id,param_name,
param_type,param_require,param_desc,
create_user_id,create_time,update_user_id,
update_time
</sql>
</mapper>

@ -0,0 +1,26 @@
<?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.mapper.IrUserMapper">
<resultMap id="BaseResultMap" type="com.supervision.domain.IrUser">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="userAccount" column="user_account" jdbcType="VARCHAR"/>
<result property="realName" column="real_name" jdbcType="VARCHAR"/>
<result property="ps" column="ps" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUserId" column="update_user_id" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="roleType" column="role_type" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id,user_account,real_name,
ps,create_user_id,create_time,
update_user_id,update_time,state,
role_type
</sql>
</mapper>

@ -1,15 +1,26 @@
package com.supervision;
import com.supervision.domain.IrKnowledge;
import com.supervision.domain.IrKnowledgeSimilar;
import com.supervision.service.IrKnowledgeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@MapperScan(basePackages = {"com.supervision.**.mapper"})
@SpringBootTest
@Slf4j
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringJUnit4ClassRunner.class)
@RequiredArgsConstructor
class AskApplicationTests {
@Test
void contextLoads() {
}
@Autowired
private IrKnowledgeService irKnowledgeService;
}

Loading…
Cancel
Save