Commit b63df60b authored by 陈立彬's avatar 陈立彬

接口&文档

parent 074189bd
...@@ -70,11 +70,11 @@ ...@@ -70,11 +70,11 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.8.20</version> <version>5.8.20</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>org.springdoc</groupId> <!-- <groupId>org.springdoc</groupId>-->
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <!-- <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>-->
<version>2.6.0</version> <!-- <version>2.6.0</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
...@@ -92,6 +92,28 @@ ...@@ -92,6 +92,28 @@
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!-- 接口API文档 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package cn.breeze.elleai; package cn.breeze.elleai;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
@EnableKnife4j
public class ElleaiApplication { public class ElleaiApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
package cn.breeze.elleai;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
@EnableKnife4j
public class Knife4jConfiguration {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.apiInfo(apiInfo())
.select().apis(RequestHandlerSelectors.basePackage("cn.breeze.elleai.controller"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.description("Kinfe4j 集成测试文档")
.version("v1.1.0")
.title("API测试文档")
.build();
}
}
...@@ -19,10 +19,8 @@ public class Swagger2Config { ...@@ -19,10 +19,8 @@ public class Swagger2Config {
addList("Bearer Authentication")) addList("Bearer Authentication"))
.components(new Components().addSecuritySchemes .components(new Components().addSecuritySchemes
("Bearer Authentication", createAPIKeyScheme())) ("Bearer Authentication", createAPIKeyScheme()))
.info(new Info().title("Scaffold API") .info(new Info().title("伊丽汇 API")
.description("description of Scaffold API.") .version("1.0").contact(new Contact().name("chain"))
.version("1.0").contact(new Contact().name("yunzhiliu")
.email("1360194505@qq.com").url("salloszraj@gmail.com"))
.license(new License().name("License of API") .license(new License().name("License of API")
.url("API license URL"))); .url("API license URL")));
} }
......
package cn.breeze.elleai.application.dto; package cn.breeze.elleai.application.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
...@@ -16,12 +17,15 @@ public class PageResult<T> implements Serializable { ...@@ -16,12 +17,15 @@ public class PageResult<T> implements Serializable {
private Integer total; private Integer total;
@Schema(description = "总页数") @Schema(description = "总页数")
@JsonProperty("total_page")
private Integer totalPage; private Integer totalPage;
@Schema(description = "页码") @Schema(description = "页码")
@JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页大小") @Schema(description = "分页大小")
@JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
/** /**
......
...@@ -9,12 +9,15 @@ import java.io.Serializable; ...@@ -9,12 +9,15 @@ import java.io.Serializable;
@Data @Data
public class ExamineRecordRequestDto implements Serializable { public class ExamineRecordRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no") @JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size") @JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "用户ID")
@JsonProperty("user_id") @JsonProperty("user_id")
private String userId; private String userId;
......
...@@ -9,16 +9,17 @@ import java.io.Serializable; ...@@ -9,16 +9,17 @@ import java.io.Serializable;
@Data @Data
public class ExamineRequestDto implements Serializable { public class ExamineRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no") @JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size") @JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "对练名称")
private String name; private String name;
private Integer status;
@Schema(description = "场景分类ID") @Schema(description = "场景分类ID")
@JsonProperty("category_id") @JsonProperty("category_id")
private Integer categoryId; private Integer categoryId;
......
...@@ -10,16 +10,17 @@ import java.io.Serializable; ...@@ -10,16 +10,17 @@ import java.io.Serializable;
public class ExamineSceneCategoryRequestDto implements Serializable { public class ExamineSceneCategoryRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no") @JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size") @JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "场景分类名称")
private String name; private String name;
private Integer status;
@Schema(description = "场景ID") @Schema(description = "场景ID")
@JsonProperty("scene_id") @JsonProperty("scene_id")
private Integer sceneId; private Integer sceneId;
......
package cn.breeze.elleai.application.dto.request; package cn.breeze.elleai.application.dto.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -7,11 +10,14 @@ import java.io.Serializable; ...@@ -7,11 +10,14 @@ import java.io.Serializable;
@Data @Data
public class ExamineSceneRequestDto implements Serializable { public class ExamineSceneRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "场景名称")
private String name; private String name;
private Integer status;
} }
package cn.breeze.elleai.application.dto.request; package cn.breeze.elleai.application.dto.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -7,11 +9,15 @@ import java.io.Serializable; ...@@ -7,11 +9,15 @@ import java.io.Serializable;
@Data @Data
public class QaAssistantRequestDto implements Serializable { public class QaAssistantRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "助手名称")
private String name; private String name;
} }
package cn.breeze.elleai.application.dto.request; package cn.breeze.elleai.application.dto.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -7,17 +9,26 @@ import java.io.Serializable; ...@@ -7,17 +9,26 @@ import java.io.Serializable;
@Data @Data
public class UserQaHistoryRequestDto implements Serializable { public class UserQaHistoryRequestDto implements Serializable {
@Schema(description = "页码")
@JsonProperty("page_no")
private Integer pageNo; private Integer pageNo;
@Schema(description = "分页数量")
@JsonProperty("page_size")
private Integer pageSize; private Integer pageSize;
@Schema(description = "用户ID")
@JsonProperty("user_id")
private String userId; private String userId;
private Integer type; @Schema(description = "会话ID")
@JsonProperty("session_id")
private String sessionId; private String sessionId;
@Schema(description = "内容")
private String content; private String content;
@Schema(description = "会话记录ID")
@JsonProperty("chat_completion_id")
private Integer chatCompletionId; private Integer chatCompletionId;
} }
package cn.breeze.elleai.application.dto.response; package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -8,50 +10,65 @@ import java.time.LocalDateTime; ...@@ -8,50 +10,65 @@ import java.time.LocalDateTime;
@Data @Data
public class ExamineDetailRecordMobileDto implements Serializable { public class ExamineDetailRecordMobileDto implements Serializable {
@Schema(description = "对练记录明细ID")
private Integer id; private Integer id;
/** /**
* 对练记录ID * 对练记录ID
*/ */
@Schema(description = "对练记录ID")
@JsonProperty("record_id")
private Integer recordId; private Integer recordId;
/** /**
* 题目ID * 题目ID
*/ */
@Schema(description = "题目ID")
@JsonProperty("qa_id")
private Integer qaId; private Integer qaId;
/** /**
* 题目 * 题目
*/ */
@Schema(description = "题目")
private String question; private String question;
/** /**
* 标准答案 * 标准答案
*/ */
@Schema(description = "标准答案")
private String answer; private String answer;
/** /**
* 员工答案 * 员工答案
*/ */
@Schema(description = "用户答案")
@JsonProperty("user_answer")
private String userAnswer; private String userAnswer;
/** /**
* 评分 * 评分
*/ */
@Schema(description = "评分")
private Float score; private Float score;
/** /**
* 评价 * 评价
*/ */
@Schema(description = "评价")
private String evaluation; private String evaluation;
/** /**
* 创建时间 * 创建时间
*/ */
@Schema(description = "创建时间")
@JsonProperty("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@Schema(description = "更新时间")
@JsonProperty("update_time")
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }
package cn.breeze.elleai.application.dto.response; package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -8,57 +9,73 @@ import java.io.Serializable; ...@@ -8,57 +9,73 @@ import java.io.Serializable;
@Data @Data
public class ExamineMobileDto implements Serializable { public class ExamineMobileDto implements Serializable {
@Schema(description = "对练ID")
private Integer id; private Integer id;
/** /**
* 对练名称 * 对练名称
*/ */
@Schema(description = "对练名称")
private String name; private String name;
/** /**
* 对练描述 * 对练描述
*/ */
@Schema(description = "对练描述")
private String description; private String description;
/** /**
* 海报图 * 海报图
*/ */
@Schema(description = "海报图")
private String poster; private String poster;
/** /**
* 对练场景ID * 对练场景ID
*/ */
@Schema(description = "对练场景ID")
@JsonProperty("scene_id")
private Integer sceneId; private Integer sceneId;
/** /**
* 对练分类ID * 对练分类ID
*/ */
@Schema(description = "对练分类ID")
@JsonProperty("category_id")
private Integer categoryId; private Integer categoryId;
/** /**
* 开始时间 * 开始时间
*/ */
@Schema(description = "对练开始时间")
@JsonProperty("start_time")
private Long startTime; private Long startTime;
/** /**
* 结束时间 * 结束时间
*/ */
@Schema(description = "对练结束时间")
@JsonProperty("end_time")
private Long endTime; private Long endTime;
/** /**
* 题目数量 * 题目数量
*/ */
@Schema(description = "题目数量")
@JsonProperty("qa_num")
private Integer qaNum; private Integer qaNum;
/** /**
* 已考试次数 * 已考试次数
*/ */
@Schema(description = "已考试次数")
@JsonProperty("exam_total_count") @JsonProperty("exam_total_count")
private long examTotalCount; private long examTotalCount;
/** /**
* 是否参与考试 * 是否参与考试
*/ */
@Schema(description = "是否参加考试")
@JsonProperty("exam_flag") @JsonProperty("exam_flag")
private boolean examFlag; private boolean examFlag;
...@@ -66,18 +83,21 @@ public class ExamineMobileDto implements Serializable { ...@@ -66,18 +83,21 @@ public class ExamineMobileDto implements Serializable {
/** /**
* 练习次数 * 练习次数
*/ */
@Schema(description = "练习次数")
@JsonProperty("practice_count") @JsonProperty("practice_count")
private long practiceCount; private long practiceCount;
/** /**
* 对练次数 * 对练次数
*/ */
@Schema(description = "对练次数")
@JsonProperty("exam_count") @JsonProperty("exam_count")
private long examCount; private long examCount;
/** /**
* 最高综合评分 * 最高综合评分
*/ */
@Schema(description = "最高综合评分")
@JsonProperty("max_overall_score") @JsonProperty("max_overall_score")
private double maxOverallScore; private double maxOverallScore;
} }
package cn.breeze.elleai.application.dto.response; package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -9,43 +10,51 @@ import java.time.LocalDateTime; ...@@ -9,43 +10,51 @@ import java.time.LocalDateTime;
@Data @Data
public class ExamineQaDifyDto implements Serializable { public class ExamineQaDifyDto implements Serializable {
@Schema(description = "题目ID")
@JsonProperty("question_id") @JsonProperty("question_id")
private Integer questionId; private Integer questionId;
/** /**
* 问题 * 问题
*/ */
@Schema(description = "问题")
private String question; private String question;
/** /**
* 答案 * 答案
*/ */
@Schema(description = "标准答案")
private String answer; private String answer;
/** /**
* 对练分类ID * 对练分类ID
*/ */
@Schema(description = "对练分类ID")
@JsonProperty("category_id") @JsonProperty("category_id")
private Integer categoryId; private Integer categoryId;
/** /**
* 对练分类ID * 对练分类ID
*/ */
@Schema(description = "对练分类名称")
@JsonProperty("category_name") @JsonProperty("category_name")
private String categoryName; private String categoryName;
/** /**
* 对练分类ID * 对练分类ID
*/ */
@Schema(description = "DIFY字段")
private String project; private String project;
/** /**
* 对练分类ID * 对练分类ID
*/ */
@Schema(description = "DIFY字段")
private String code; private String code;
/** /**
* dify 节点字段 * dify 节点字段
*/ */
@Schema(description = "DIFY字段")
private boolean next; private boolean next;
} }
package cn.breeze.elleai.application.dto.response; package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -9,59 +11,84 @@ import java.util.List; ...@@ -9,59 +11,84 @@ import java.util.List;
@Data @Data
public class ExamineRecordMobileDto implements Serializable { public class ExamineRecordMobileDto implements Serializable {
@Schema(description = "对练记录ID")
private Integer id; private Integer id;
/** /**
* 用户ID * 用户ID
*/ */
@Schema(description = "用户ID")
@JsonProperty("user_id")
private String userId; private String userId;
/** /**
* 会话ID * 会话ID
*/ */
@Schema(description = "会话ID")
@JsonProperty("session_id")
private String sessionId; private String sessionId;
/** /**
* 对练ID * 对练ID
*/ */
@Schema(description = "对练ID")
@JsonProperty("examine_id")
private Integer examineId; private Integer examineId;
@Schema(description = "对练名称")
@JsonProperty("examine_name")
private String examineName; private String examineName;
@Schema(description = "对练描述")
@JsonProperty("examine_description")
private String examineDescription; private String examineDescription;
/** /**
* 对练模式(0练习 1对练) * 对练模式(0练习 1对练)
*/ */
@Schema(description = "对练模式(0练习 1对练)")
@JsonProperty("examine_mode")
private Integer examineMode; private Integer examineMode;
/** /**
* 已答题数量 * 已答题数量
*/ */
@Schema(description = "已答题数量")
@JsonProperty("answered_num")
private Integer answeredNum; private Integer answeredNum;
/** /**
* 综合评分 * 综合评分
*/ */
@Schema(description = "用户ID")
@JsonProperty("overall_score")
private Float overallScore; private Float overallScore;
/** /**
* 综合评价 * 综合评价
*/ */
@Schema(description = "综合评价")
@JsonProperty("overall_evaluation")
private String overallEvaluation; private String overallEvaluation;
/** /**
* 创建时间 * 创建时间
*/ */
@Schema(description = "创建时间")
@JsonProperty("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@Schema(description = "更新时间")
@JsonProperty("update_time")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
* 答题明细 * 答题明细
*/ */
@Schema(description = "答题明细列表")
@JsonProperty("details")
private List<ExamineDetailRecordMobileDto> details; private List<ExamineDetailRecordMobileDto> details;
} }
...@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.response; ...@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -10,40 +11,47 @@ import java.time.LocalDateTime; ...@@ -10,40 +11,47 @@ import java.time.LocalDateTime;
@Data @Data
public class ExamineSceneCategoryDto implements Serializable { public class ExamineSceneCategoryDto implements Serializable {
@Schema(description = "场景分类ID")
private Integer id; private Integer id;
/** /**
* 分类名称 * 分类名称
*/ */
@Schema(description = "场景分类名称")
private String name; private String name;
/** /**
* 场景ID描述 * 场景ID
*/ */
@Schema(description = "场景ID")
@JsonProperty("scene_id") @JsonProperty("scene_id")
private Integer sceneId; private Integer sceneId;
/** /**
* 场景ID描述 * 场景名称
*/ */
@Schema(description = "场景名称")
@JsonProperty("scene_name") @JsonProperty("scene_name")
private String sceneName; private String sceneName;
/** /**
* 可见角色IDS * 可见角色IDS
*/ */
@Schema(description = "可见角色IDS,逗号分隔")
@JsonProperty("visible_role_ids") @JsonProperty("visible_role_ids")
private String visibleRoleIds; private String visibleRoleIds;
/** /**
* 可见角色名称S * 可见角色名称S
*/ */
@Schema(description = "可见角色名称S,逗号分隔")
@JsonProperty("visible_role_names") @JsonProperty("visible_role_names")
private String visibleRoleNames; private String visibleRoleNames;
/** /**
* 分类描述 * 分类描述
*/ */
@Schema(description = "场景分类描述")
private String description; private String description;
/** /**
...@@ -51,14 +59,10 @@ public class ExamineSceneCategoryDto implements Serializable { ...@@ -51,14 +59,10 @@ public class ExamineSceneCategoryDto implements Serializable {
*/ */
private Integer status; private Integer status;
/**
* 是否删除(0否 1是)
*/
private Integer deleted;
/** /**
* 创建时间 * 创建时间
*/ */
@Schema(description = "创建时间")
@JsonProperty("create_time") @JsonProperty("create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private LocalDateTime createTime; private LocalDateTime createTime;
...@@ -66,6 +70,7 @@ public class ExamineSceneCategoryDto implements Serializable { ...@@ -66,6 +70,7 @@ public class ExamineSceneCategoryDto implements Serializable {
/** /**
* 更新时间 * 更新时间
*/ */
@Schema(description = "更新时间")
@JsonProperty("update_time") @JsonProperty("update_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private LocalDateTime updateTime; private LocalDateTime updateTime;
...@@ -73,6 +78,7 @@ public class ExamineSceneCategoryDto implements Serializable { ...@@ -73,6 +78,7 @@ public class ExamineSceneCategoryDto implements Serializable {
/** /**
* 父级分类ID * 父级分类ID
*/ */
@Schema(description = "父级ID")
@JsonProperty("parent_id") @JsonProperty("parent_id")
private Integer parentId; private Integer parentId;
} }
...@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.response; ...@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -10,36 +11,37 @@ import java.time.LocalDateTime; ...@@ -10,36 +11,37 @@ import java.time.LocalDateTime;
@Data @Data
public class ExamineSceneDto implements Serializable { public class ExamineSceneDto implements Serializable {
@Schema(description = "场景ID")
private Integer id; private Integer id;
/** /**
* 场景名称 * 场景名称
*/ */
@Schema(description = "场景名称")
private String name; private String name;
/** /**
* 场景描述 * 场景描述
*/ */
@Schema(description = "场景描述")
private String description; private String description;
/** /**
* 场景海报图 * 场景海报图
*/ */
@Schema(description = "海报图")
private String poster; private String poster;
/** /**
* 状态(0禁用 1启用) * 状态(0禁用 1启用)
*/ */
@Schema(description = "状态(0禁用 1启用)")
private Integer status; private Integer status;
/**
* 是否删除(0否 1是)
*/
private Integer deleted;
/** /**
* 创建时间 * 创建时间
*/ */
@Schema(description = "创建时间")
@JsonProperty("create_time") @JsonProperty("create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private LocalDateTime createTime; private LocalDateTime createTime;
...@@ -47,6 +49,7 @@ public class ExamineSceneDto implements Serializable { ...@@ -47,6 +49,7 @@ public class ExamineSceneDto implements Serializable {
/** /**
* 更新时间 * 更新时间
*/ */
@Schema(description = "update_time")
@JsonProperty("update_time") @JsonProperty("update_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
private LocalDateTime updateTime; private LocalDateTime updateTime;
......
package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class HotQaMobileDto implements Serializable {
@Schema(description = "问题")
private String question;
}
package cn.breeze.elleai.application.dto.response; package cn.breeze.elleai.application.dto.response;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
...@@ -9,55 +10,59 @@ import java.time.LocalDateTime; ...@@ -9,55 +10,59 @@ import java.time.LocalDateTime;
@Data @Data
public class QaAssistantDto implements Serializable { public class QaAssistantDto implements Serializable {
@Schema(description = "助手ID")
private Integer id; private Integer id;
/** /**
* 助手名称 * 助手名称
*/ */
@Schema(description = "助手名称")
private String name; private String name;
/** /**
* 助手描述 * 助手描述
*/ */
@Schema(description = "助手描述")
private String description; private String description;
/** /**
* 助手图标 * 助手图标
*/ */
@Schema(description = "助手图标")
@JsonProperty("icon_url") @JsonProperty("icon_url")
private String iconUrl; private String iconUrl;
/** /**
* 知识库分类IDS,以逗号分隔 * 知识库分类IDS,以逗号分隔
*/ */
@Schema(description = "知识库分类IDS,逗号分隔")
@JsonProperty("category_ids") @JsonProperty("category_ids")
private String categoryIds; private String categoryIds;
/** /**
* 可见角色IDS,以逗号分隔 * 可见角色IDS,以逗号分隔
*/ */
@Schema(description = "可见角色IDS,逗号分隔")
@JsonProperty("visible_role_ids") @JsonProperty("visible_role_ids")
private String visibleRoleIds; private String visibleRoleIds;
/** /**
* 状态(0禁用 1启用) * 状态(0禁用 1启用)
*/ */
@Schema(description = "状态(0禁用 1启用)")
private Integer status; private Integer status;
/**
* 是否删除(0否 1是)
*/
private Integer deleted;
/** /**
* 创建时间 * 创建时间
*/ */
@Schema(description = "创建时间")
@JsonProperty("create_time") @JsonProperty("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@Schema(description = "更新时间")
@JsonProperty("update_time") @JsonProperty("update_time")
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }
...@@ -142,9 +142,8 @@ public class AppExamineService { ...@@ -142,9 +142,8 @@ public class AppExamineService {
*/ */
public PageResult<ExamineSceneCategoryDto> examineSceneCategoryMobilePaginQuery(ExamineSceneCategoryRequestDto request) { public PageResult<ExamineSceneCategoryDto> examineSceneCategoryMobilePaginQuery(ExamineSceneCategoryRequestDto request) {
request.setStatus(1);
ExamineSceneCategoryRequestModel requestModel = BeanUtil.copyProperties(request, ExamineSceneCategoryRequestModel.class); ExamineSceneCategoryRequestModel requestModel = BeanUtil.copyProperties(request, ExamineSceneCategoryRequestModel.class);
requestModel.setStatus(1);
Page<ExamineSceneCategoryResponseModel> page = examineService.sceneCategoryPaginQuery(requestModel); Page<ExamineSceneCategoryResponseModel> page = examineService.sceneCategoryPaginQuery(requestModel);
...@@ -269,10 +268,9 @@ public class AppExamineService { ...@@ -269,10 +268,9 @@ public class AppExamineService {
*/ */
public PageResult<ExamineSceneDto> examineMobileScenePaginQuery(ExamineSceneRequestDto request) { public PageResult<ExamineSceneDto> examineMobileScenePaginQuery(ExamineSceneRequestDto request) {
// 移动端默认查询启用状态
request.setStatus(1);
ExamineSceneRequestModel requestModel = BeanUtil.copyProperties(request, ExamineSceneRequestModel.class); ExamineSceneRequestModel requestModel = BeanUtil.copyProperties(request, ExamineSceneRequestModel.class);
// 移动端默认查询启用状态
requestModel.setStatus(1);
Page<ExamineSceneResponseModel> page = examineService.scenePaginQuery(requestModel); Page<ExamineSceneResponseModel> page = examineService.scenePaginQuery(requestModel);
...@@ -589,9 +587,8 @@ public class AppExamineService { ...@@ -589,9 +587,8 @@ public class AppExamineService {
*/ */
public PageResult<ExamineMobileDto> examineMobilePaginQuery(ExamineRequestDto request) { public PageResult<ExamineMobileDto> examineMobilePaginQuery(ExamineRequestDto request) {
request.setStatus(1);
ExamineRequestModel requestModel = BeanUtil.copyProperties(request, ExamineRequestModel.class); ExamineRequestModel requestModel = BeanUtil.copyProperties(request, ExamineRequestModel.class);
requestModel.setStatus(1);
Page<ExamineResponseModel> page = examineService.examinePaginQuery(requestModel); Page<ExamineResponseModel> page = examineService.examinePaginQuery(requestModel);
......
...@@ -5,6 +5,7 @@ import cn.breeze.elleai.application.dto.ApiResponse; ...@@ -5,6 +5,7 @@ import cn.breeze.elleai.application.dto.ApiResponse;
import cn.breeze.elleai.application.dto.PageResult; import cn.breeze.elleai.application.dto.PageResult;
import cn.breeze.elleai.application.dto.request.QaAssistantRequestDto; import cn.breeze.elleai.application.dto.request.QaAssistantRequestDto;
import cn.breeze.elleai.application.dto.request.UserQaHistoryRequestDto; import cn.breeze.elleai.application.dto.request.UserQaHistoryRequestDto;
import cn.breeze.elleai.application.dto.response.HotQaMobileDto;
import cn.breeze.elleai.application.dto.response.QaAssistantDto; import cn.breeze.elleai.application.dto.response.QaAssistantDto;
import cn.breeze.elleai.application.dto.response.UserChatCompletionHistoryDto; import cn.breeze.elleai.application.dto.response.UserChatCompletionHistoryDto;
import cn.breeze.elleai.application.service.AppChatCompletionService; import cn.breeze.elleai.application.service.AppChatCompletionService;
...@@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -15,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping(value = "/front/chat") @RequestMapping(value = "/front/chat")
@Tag(name = "对练移动端", description = "对练") @Tag(name = "AI问答移动端")
@RequiredArgsConstructor @RequiredArgsConstructor
public class ChatCompletionMobileController { public class ChatCompletionMobileController {
...@@ -30,8 +31,8 @@ public class ChatCompletionMobileController { ...@@ -30,8 +31,8 @@ public class ChatCompletionMobileController {
@Operation(summary = "热门提问") @Operation(summary = "热门提问")
@PostMapping("/hot/list") @PostMapping("/hot/list")
public ApiResponse<PageResult<QaAssistantDto>> hotList(@RequestBody QaAssistantRequestDto request) { public ApiResponse<PageResult<HotQaMobileDto>> hotList(@RequestBody QaAssistantRequestDto request) {
PageResult<QaAssistantDto> pageResult = chatCompletionService.qaAssistantPaginQuery(request); PageResult<HotQaMobileDto> pageResult = new PageResult<>();
return ApiResponse.ok(pageResult); return ApiResponse.ok(pageResult);
} }
......
...@@ -13,6 +13,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -13,6 +13,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.micrometer.common.util.StringUtils; import io.micrometer.common.util.StringUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -28,7 +29,7 @@ import java.util.stream.Collectors; ...@@ -28,7 +29,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping(value = "/front/examine") @RequestMapping(value = "/front/examine")
@Tag(name = "对练移动端", description = "对练") @Tag(name = "AI对练移动端")
@RequiredArgsConstructor @RequiredArgsConstructor
public class ExamineMobileController { public class ExamineMobileController {
...@@ -42,7 +43,7 @@ public class ExamineMobileController { ...@@ -42,7 +43,7 @@ public class ExamineMobileController {
} }
@Operation(summary = "对练场景分类列表") @Operation(summary = "对练场景分类列表")
@RequestMapping("/scene_category/list") @PostMapping("/scene_category/list")
public ApiResponse<PageResult<ExamineSceneCategoryDto>> list(@RequestBody ExamineSceneCategoryRequestDto request) { public ApiResponse<PageResult<ExamineSceneCategoryDto>> list(@RequestBody ExamineSceneCategoryRequestDto request) {
PageResult<ExamineSceneCategoryDto> pageResult = examineService.examineSceneCategoryMobilePaginQuery(request); PageResult<ExamineSceneCategoryDto> pageResult = examineService.examineSceneCategoryMobilePaginQuery(request);
return ApiResponse.ok(pageResult); return ApiResponse.ok(pageResult);
...@@ -57,7 +58,7 @@ public class ExamineMobileController { ...@@ -57,7 +58,7 @@ public class ExamineMobileController {
@Operation(summary = "对练详情") @Operation(summary = "对练详情")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public ApiResponse<ExamineMobileDto> detail(@PathVariable("id") Integer id) { public ApiResponse<ExamineMobileDto> detail(@Schema(description = "对练ID") @PathVariable("id") Integer id) {
ExamineMobileDto detail = examineService.examineMobileDetail(id); ExamineMobileDto detail = examineService.examineMobileDetail(id);
return ApiResponse.ok(detail); return ApiResponse.ok(detail);
} }
...@@ -74,12 +75,12 @@ public class ExamineMobileController { ...@@ -74,12 +75,12 @@ public class ExamineMobileController {
@Operation(summary = "用户对练记录详情") @Operation(summary = "用户对练记录详情")
@GetMapping("/record/detail/{id}") @GetMapping("/record/detail/{id}")
public ApiResponse<ExamineRecordMobileDto> recordDetail(@PathVariable("id") Integer id) { public ApiResponse<ExamineRecordMobileDto> recordDetail(@Schema(description = "对练记录ID") @PathVariable("id") Integer id) {
ExamineRecordMobileDto detail = examineService.examineRecordMobileDetail(id); ExamineRecordMobileDto detail = examineService.examineRecordMobileDetail(id);
return ApiResponse.ok(detail); return ApiResponse.ok(detail);
} }
@Operation(summary = "对练列表") @Operation(summary = "获取题目列表")
@PostMapping("/get_examine_qa") @PostMapping("/get_examine_qa")
public ApiResponse<PageResult<ExamineMobileDto>> getExamineQa(@RequestBody ExamineRequestDto request) { public ApiResponse<PageResult<ExamineMobileDto>> getExamineQa(@RequestBody ExamineRequestDto request) {
PageResult<ExamineMobileDto> pageResult = examineService.examineMobilePaginQuery(request); PageResult<ExamineMobileDto> pageResult = examineService.examineMobilePaginQuery(request);
...@@ -87,20 +88,21 @@ public class ExamineMobileController { ...@@ -87,20 +88,21 @@ public class ExamineMobileController {
} }
@Operation(summary = "获取当前题目")
@GetMapping(value = "/get_current_question") @GetMapping(value = "/get_current_question")
public ApiResponse<ExamineQaDifyDto> getCurrentQuestion(@RequestParam("tenant") Integer examineId, public ApiResponse<ExamineQaDifyDto> getCurrentQuestion(@Schema(description = "对练ID") @RequestParam("examine_id") Integer examineId,
@RequestParam("session_id") String sessionId, @Schema(description = "会话ID") @RequestParam("session_id") String sessionId,
@RequestParam("user_id") String userId) { @Schema(description = "用户ID") @RequestParam("user_id") String userId) {
ExamineQaDifyDto result = examineService.getCurrentQuestion(examineId, sessionId, userId); ExamineQaDifyDto result = examineService.getCurrentQuestion(examineId, sessionId, userId);
return ApiResponse.ok(result); return ApiResponse.ok(result);
} }
@Operation(summary = "开始考试,获取出题")
@GetMapping(value = "/get_question") @GetMapping(value = "/get_question")
public ApiResponse<ExamineQaDifyDto> getQuestion(@RequestParam("tenant") Integer tenant, public ApiResponse<ExamineQaDifyDto> getQuestion(@Schema(description = "对练ID") @RequestParam("examine_id") Integer examineId,
@RequestParam("examine_id") Integer examineId, @Schema(description = "会话ID") @RequestParam("session_id") String sessionId,
@RequestParam("session_id") String sessionId, @Schema(description = "用户ID") @RequestParam("user_id") String userId) {
@RequestParam("user_id") String userId) {
ExamineQaDifyDto result = new ExamineQaDifyDto(); ExamineQaDifyDto result = new ExamineQaDifyDto();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment