Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elleai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
E
ellehuis-group
backend
elleai
Commits
ce2d8a20
Commit
ce2d8a20
authored
Oct 15, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jwt & 接口请求方式fix
parent
a95bbc57
Changes
42
Show whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
919 additions
and
244 deletions
+919
-244
ExamineQaRequestDto.java
...e/elleai/application/dto/request/ExamineQaRequestDto.java
+7
-2
ExamineQaSaveDto.java
...eeze/elleai/application/dto/request/ExamineQaSaveDto.java
+6
-0
ExamineSaveDto.java
...breeze/elleai/application/dto/request/ExamineSaveDto.java
+12
-5
ExamineSceneCategorySaveDto.java
.../application/dto/request/ExamineSceneCategorySaveDto.java
+9
-6
ExamineSceneSaveDto.java
...e/elleai/application/dto/request/ExamineSceneSaveDto.java
+6
-5
ExamineUpdateResultDto.java
...lleai/application/dto/request/ExamineUpdateResultDto.java
+26
-0
ProperNounRequestDto.java
.../elleai/application/dto/request/ProperNounRequestDto.java
+7
-1
ProperNounSaveDto.java
...eze/elleai/application/dto/request/ProperNounSaveDto.java
+5
-0
QaAssistantSaveDto.java
...ze/elleai/application/dto/request/QaAssistantSaveDto.java
+7
-0
UserQaRequestDto.java
...eeze/elleai/application/dto/request/UserQaRequestDto.java
+8
-2
WikiCategorySaveDto.java
...e/elleai/application/dto/request/WikiCategorySaveDto.java
+0
-5
WikiRequestDto.java
...breeze/elleai/application/dto/request/WikiRequestDto.java
+7
-1
ExamineDto.java
...cn/breeze/elleai/application/dto/response/ExamineDto.java
+17
-0
ExamineFinalResultDto.java
...lleai/application/dto/response/ExamineFinalResultDto.java
+29
-0
ExamineQaDto.java
.../breeze/elleai/application/dto/response/ExamineQaDto.java
+14
-0
ExamineResultDto.java
...eze/elleai/application/dto/response/ExamineResultDto.java
+34
-0
UserChatCompletionDto.java
...lleai/application/dto/response/UserChatCompletionDto.java
+6
-0
UserChatCompletionHistoryDto.java
...pplication/dto/response/UserChatCompletionHistoryDto.java
+6
-0
WikiCategoryDto.java
...eeze/elleai/application/dto/response/WikiCategoryDto.java
+11
-5
WikiDto.java
...va/cn/breeze/elleai/application/dto/response/WikiDto.java
+17
-5
AppChatCompletionService.java
.../elleai/application/service/AppChatCompletionService.java
+1
-0
ExceptionConfig.java
src/main/java/cn/breeze/elleai/config/ExceptionConfig.java
+17
-0
GlobalExceptionHandler.java
.../java/cn/breeze/elleai/config/GlobalExceptionHandler.java
+44
-0
UserPrincipalConfig.java
...ain/java/cn/breeze/elleai/config/UserPrincipalConfig.java
+19
-0
UserPrincipalHandlerMethodArgumentResolver.java
...ai/config/UserPrincipalHandlerMethodArgumentResolver.java
+43
-0
ChatCompletionController.java
...cn/breeze/elleai/controller/ChatCompletionController.java
+6
-6
CommonController.java
...in/java/cn/breeze/elleai/controller/CommonController.java
+8
-7
ExamineController.java
...n/java/cn/breeze/elleai/controller/ExamineController.java
+8
-7
ExamineMobileController.java
.../cn/breeze/elleai/controller/ExamineMobileController.java
+59
-150
ExamineQaController.java
...java/cn/breeze/elleai/controller/ExamineQaController.java
+8
-7
ExamineSceneCategoryController.java
...eze/elleai/controller/ExamineSceneCategoryController.java
+8
-7
ExamineSceneController.java
...a/cn/breeze/elleai/controller/ExamineSceneController.java
+8
-7
WikiController.java
...main/java/cn/breeze/elleai/controller/WikiController.java
+15
-14
ExamineQaResponseModel.java
...omain/sparring/model/response/ExamineQaResponseModel.java
+16
-1
Codes.java
src/main/java/cn/breeze/elleai/util/Codes.java
+80
-0
JwtProperties.java
src/main/java/cn/breeze/elleai/util/JwtProperties.java
+32
-0
JwtUtil.java
src/main/java/cn/breeze/elleai/util/JwtUtil.java
+114
-0
JwtUtils.java
src/main/java/cn/breeze/elleai/util/JwtUtils.java
+57
-0
LoginFilter.java
src/main/java/cn/breeze/elleai/util/LoginFilter.java
+84
-0
PrincipalEnum.java
src/main/java/cn/breeze/elleai/util/PrincipalEnum.java
+30
-0
UserPrincipal.java
src/main/java/cn/breeze/elleai/util/UserPrincipal.java
+20
-0
application.yml
src/main/resources/application.yml
+8
-1
No files found.
src/main/java/cn/breeze/elleai/application/dto/request/ExamineQaRequestDto.java
View file @
ce2d8a20
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,14 @@ import java.io.Serializable;
...
@@ -7,11 +9,14 @@ import java.io.Serializable;
@Data
@Data
public
class
ExamineQaRequestDto
implements
Serializable
{
public
class
ExamineQaRequestDto
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
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/ExamineQaSaveDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
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,27 +10,32 @@ import java.time.LocalDateTime;
...
@@ -9,27 +10,32 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ExamineQaSaveDto
implements
Serializable
{
public
class
ExamineQaSaveDto
implements
Serializable
{
@Schema
(
description
=
"题目ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 问题
* 问题
*/
*/
@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
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/ExamineSaveDto.java
View file @
ce2d8a20
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
...
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.mybatisflex.annotation.Id
;
import
com.mybatisflex.annotation.Id
;
import
com.mybatisflex.annotation.KeyType
;
import
com.mybatisflex.annotation.KeyType
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -13,38 +14,45 @@ import java.util.List;
...
@@ -13,38 +14,45 @@ import java.util.List;
@Data
@Data
public
class
ExamineSaveDto
implements
Serializable
{
public
class
ExamineSaveDto
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"
)
@JsonProperty
(
"scene_id"
)
private
Integer
sceneId
;
private
Integer
sceneId
;
/**
/**
* 对练分类ID
* 对练分类ID
*/
*/
@Schema
(
description
=
"对练分类ID"
)
@JsonProperty
(
"category_id"
)
@JsonProperty
(
"category_id"
)
private
Integer
categoryId
;
private
Integer
categoryId
;
/**
/**
* 开始时间
* 开始时间
*/
*/
@Schema
(
description
=
"开始时间"
)
@JsonProperty
(
"start_time"
)
@JsonProperty
(
"start_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
startTime
;
private
LocalDateTime
startTime
;
...
@@ -52,6 +60,7 @@ public class ExamineSaveDto implements Serializable {
...
@@ -52,6 +60,7 @@ public class ExamineSaveDto implements Serializable {
/**
/**
* 结束时间
* 结束时间
*/
*/
@Schema
(
description
=
"结束时间"
)
@JsonProperty
(
"end_time"
)
@JsonProperty
(
"end_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
endTime
;
private
LocalDateTime
endTime
;
...
@@ -59,22 +68,20 @@ public class ExamineSaveDto implements Serializable {
...
@@ -59,22 +68,20 @@ public class ExamineSaveDto implements Serializable {
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
/**
/**
* 题目数量
* 题目数量
*/
*/
@Schema
(
description
=
"题目数量"
)
@JsonProperty
(
"qa_num"
)
@JsonProperty
(
"qa_num"
)
private
Integer
qaNum
;
private
Integer
qaNum
;
/**
* 是否删除(0否 1是)
*/
private
Integer
deleted
;
/**
/**
* 关联题目ID列表
* 关联题目ID列表
*/
*/
@Schema
(
description
=
"关联题目ID列表"
)
@JsonProperty
(
"qa_id_list"
)
@JsonProperty
(
"qa_id_list"
)
private
List
<
Integer
>
qaIdList
;
private
List
<
Integer
>
qaIdList
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/ExamineSceneCategorySaveDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
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,45 @@ import java.time.LocalDateTime;
...
@@ -9,43 +10,45 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ExamineSceneCategorySaveDto
implements
Serializable
{
public
class
ExamineSceneCategorySaveDto
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
;
/**
/**
* 可见角色IDS
* 可见角色IDS
*/
*/
@Schema
(
description
=
"可见角色IDS,逗号分隔"
)
@JsonProperty
(
"visible_role_ids"
)
@JsonProperty
(
"visible_role_ids"
)
private
String
visibleRoleIds
;
private
String
visibleRoleIds
;
/**
/**
* 分类描述
* 分类描述
*/
*/
@Schema
(
description
=
"场景分类描述"
)
private
String
description
;
private
String
description
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
/**
* 是否删除(0否 1是)
*/
private
Integer
deleted
;
/**
/**
* 父级分类ID
* 父级分类ID
*/
*/
@Schema
(
description
=
"父级分类ID"
)
@JsonProperty
(
"parent_id"
)
@JsonProperty
(
"parent_id"
)
private
Integer
parentId
;
private
Integer
parentId
;
...
...
src/main/java/cn/breeze/elleai/application/dto/request/ExamineSceneSaveDto.java
View file @
ce2d8a20
...
@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.request;
...
@@ -2,6 +2,7 @@ package cn.breeze.elleai.application.dto.request;
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,31 +11,31 @@ import java.time.LocalDateTime;
...
@@ -10,31 +11,31 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ExamineSceneSaveDto
implements
Serializable
{
public
class
ExamineSceneSaveDto
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
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/ExamineUpdateResultDto.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
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
;
import
java.util.List
;
@Data
public
class
ExamineUpdateResultDto
implements
Serializable
{
@Schema
(
description
=
"对练ID"
)
@JsonProperty
(
"examine_id"
)
private
Integer
examineId
;
@Schema
(
description
=
"用户ID"
)
@JsonProperty
(
"user_id"
)
private
String
userId
;
@Schema
(
description
=
"考试总点评"
)
@JsonProperty
(
"exam_criteria"
)
private
String
examCriteria
;
}
src/main/java/cn/breeze/elleai/application/dto/request/ProperNounRequestDto.java
View file @
ce2d8a20
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
ProperNounRequestDto
implements
Serializable
{
public
class
ProperNounRequestDto
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
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/ProperNounSaveDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
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,22 +10,26 @@ import java.time.LocalDateTime;
...
@@ -9,22 +10,26 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ProperNounSaveDto
implements
Serializable
{
public
class
ProperNounSaveDto
implements
Serializable
{
@Schema
(
description
=
"专有名词ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 专有名词名称
* 专有名词名称
*/
*/
@Schema
(
description
=
"专有名词名称"
)
private
String
name
;
private
String
name
;
/**
/**
* 相似词,以逗号分隔
* 相似词,以逗号分隔
*/
*/
@Schema
(
description
=
"相似词,逗号分隔"
)
@JsonProperty
(
"similar_words"
)
@JsonProperty
(
"similar_words"
)
private
String
similarWords
;
private
String
similarWords
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/QaAssistantSaveDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
request
;
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,33 +9,39 @@ import java.io.Serializable;
...
@@ -8,33 +9,39 @@ import java.io.Serializable;
@Data
@Data
public
class
QaAssistantSaveDto
implements
Serializable
{
public
class
QaAssistantSaveDto
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
;
...
...
src/main/java/cn/breeze/elleai/application/dto/request/UserQaRequestDto.java
View file @
ce2d8a20
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
UserQaRequestDto
implements
Serializable
{
public
class
UserQaRequestDto
implements
Serializable
{
@Schema
(
description
=
"页码"
)
@JsonProperty
(
"page_no"
)
private
Integer
pageNo
;
private
Integer
pageNo
;
@Schema
(
description
=
"分页数量"
)
@JsonProperty
(
"page_size"
)
private
Integer
pageSize
;
private
Integer
pageSize
;
private
String
name
;
@Schema
(
description
=
"用户ID"
)
@JsonProperty
(
"user_id"
)
private
String
userId
;
private
String
userId
;
}
}
src/main/java/cn/breeze/elleai/application/dto/request/WikiCategorySaveDto.java
View file @
ce2d8a20
...
@@ -28,11 +28,6 @@ public class WikiCategorySaveDto implements Serializable {
...
@@ -28,11 +28,6 @@ public class WikiCategorySaveDto implements Serializable {
*/
*/
private
Integer
status
;
private
Integer
status
;
/**
* 是否删除(0否 1是)
*/
private
Integer
deleted
;
/**
/**
* 父级分类ID
* 父级分类ID
*/
*/
...
...
src/main/java/cn/breeze/elleai/application/dto/request/WikiRequestDto.java
View file @
ce2d8a20
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
WikiRequestDto
implements
Serializable
{
public
class
WikiRequestDto
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
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/ExamineDto.java
View file @
ce2d8a20
...
@@ -3,6 +3,7 @@ package cn.breeze.elleai.application.dto.response;
...
@@ -3,6 +3,7 @@ package cn.breeze.elleai.application.dto.response;
import
cn.breeze.elleai.domain.sparring.model.response.ExamineQaResponseModel
;
import
cn.breeze.elleai.domain.sparring.model.response.ExamineQaResponseModel
;
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
;
...
@@ -12,55 +13,71 @@ import java.util.List;
...
@@ -12,55 +13,71 @@ import java.util.List;
@Data
@Data
public
class
ExamineDto
implements
Serializable
{
public
class
ExamineDto
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
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
/**
/**
* 题目数量
* 题目数量
*/
*/
@Schema
(
description
=
"题目数量"
)
@JsonProperty
(
"qa_num"
)
private
Integer
qaNum
;
private
Integer
qaNum
;
/**
/**
* 关联题目列表
* 关联题目列表
*/
*/
@Schema
(
description
=
"关联题目列表"
)
private
List
<
ExamineQaResponseModel
>
qaList
;
private
List
<
ExamineQaResponseModel
>
qaList
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/ExamineFinalResultDto.java
0 → 100644
View file @
ce2d8a20
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.util.List
;
@Data
public
class
ExamineFinalResultDto
implements
Serializable
{
@Schema
(
description
=
"平均分"
)
@JsonProperty
(
"avg_score"
)
private
Double
avgScore
;
@Schema
(
description
=
"总分"
)
@JsonProperty
(
"total_score"
)
private
Double
totalScore
;
@Schema
(
description
=
"答题数量"
)
@JsonProperty
(
"answered_num"
)
private
Integer
answeredNum
;
@Schema
(
description
=
"答题明细列表"
)
@JsonProperty
(
"exam_detail_list"
)
private
List
<
ExamineDetailRecordMobileDto
>
examDetailList
;
}
src/main/java/cn/breeze/elleai/application/dto/response/ExamineQaDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.mybatisflex.annotation.Id
;
import
com.mybatisflex.annotation.Id
;
import
com.mybatisflex.annotation.KeyType
;
import
com.mybatisflex.annotation.KeyType
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -11,27 +13,32 @@ import java.time.LocalDateTime;
...
@@ -11,27 +13,32 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ExamineQaDto
implements
Serializable
{
public
class
ExamineQaDto
implements
Serializable
{
@Schema
(
description
=
"题目ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 问题
* 问题
*/
*/
@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
;
...
@@ -39,15 +46,22 @@ public class ExamineQaDto implements Serializable {
...
@@ -39,15 +46,22 @@ public class ExamineQaDto implements Serializable {
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@Schema
(
description
=
"创建时间"
)
@JsonProperty
(
"create_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@Schema
(
description
=
"更新时间"
)
@JsonProperty
(
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/ExamineResultDto.java
0 → 100644
View file @
ce2d8a20
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
;
@Data
public
class
ExamineResultDto
implements
Serializable
{
@Schema
(
description
=
"问题"
)
private
String
question
;
@Schema
(
description
=
"标准答案"
)
private
String
answer
;
@Schema
(
description
=
"用户答案"
)
@JsonProperty
(
"user_answer"
)
private
String
userAnswer
;
@Schema
(
description
=
"评分"
)
@JsonProperty
(
"score"
)
private
Double
score
;
@Schema
(
description
=
"得分点评"
)
@JsonProperty
(
"score_criteria"
)
private
String
scoreCriteria
;
@Schema
(
description
=
"题目ID"
)
@JsonProperty
(
"question_id"
)
private
Integer
questionId
;
}
src/main/java/cn/breeze/elleai/application/dto/response/UserChatCompletionDto.java
View file @
ce2d8a20
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,29 +10,34 @@ import java.time.LocalDateTime;
...
@@ -9,29 +10,34 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
UserChatCompletionDto
implements
Serializable
{
public
class
UserChatCompletionDto
implements
Serializable
{
@Schema
(
description
=
"会话记录ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 用户ID
* 用户ID
*/
*/
@Schema
(
description
=
"用户ID"
)
@JsonProperty
(
"user_id"
)
@JsonProperty
(
"user_id"
)
private
String
userId
;
private
String
userId
;
/**
/**
* 会话ID
* 会话ID
*/
*/
@Schema
(
description
=
"DIFY会话ID"
)
@JsonProperty
(
"session_id"
)
@JsonProperty
(
"session_id"
)
private
String
sessionId
;
private
String
sessionId
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@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
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/UserChatCompletionHistoryDto.java
View file @
ce2d8a20
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,27 +10,32 @@ import java.time.LocalDateTime;
...
@@ -9,27 +10,32 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
UserChatCompletionHistoryDto
implements
Serializable
{
public
class
UserChatCompletionHistoryDto
implements
Serializable
{
@Schema
(
description
=
"会话历史ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 会话ID
* 会话ID
*/
*/
@Schema
(
description
=
"会话记录ID"
)
@JsonProperty
(
"chat_completion_id"
)
@JsonProperty
(
"chat_completion_id"
)
private
Integer
chatCompletionId
;
private
Integer
chatCompletionId
;
/**
/**
* 类型(0用户提问 1AI回答)
* 类型(0用户提问 1AI回答)
*/
*/
@Schema
(
description
=
"类型(0用户提问 1AI回答)"
)
private
Integer
type
;
private
Integer
type
;
/**
/**
* 内容
* 内容
*/
*/
@Schema
(
description
=
"内容"
)
private
String
content
;
private
String
content
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@Schema
(
description
=
"创建时间"
)
@JsonProperty
(
"create_time"
)
@JsonProperty
(
"create_time"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/WikiCategoryDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
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
;
...
@@ -9,43 +11,47 @@ import java.time.LocalDateTime;
...
@@ -9,43 +11,47 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
WikiCategoryDto
implements
Serializable
{
public
class
WikiCategoryDto
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
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态"
)
private
Integer
status
;
private
Integer
status
;
/**
* 是否删除(0否 1是)
*/
private
Integer
deleted
;
/**
/**
* 父级分类ID
* 父级分类ID
*/
*/
@Schema
(
description
=
"父级ID"
)
@JsonProperty
(
"parent_id"
)
@JsonProperty
(
"parent_id"
)
private
Integer
parentId
;
private
Integer
parentId
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@Schema
(
description
=
"创建时间"
)
@JsonProperty
(
"create_time"
)
@JsonProperty
(
"create_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@Schema
(
description
=
"update_time"
)
@JsonProperty
(
"update_time"
)
@JsonProperty
(
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
}
}
src/main/java/cn/breeze/elleai/application/dto/response/WikiDto.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
package
cn
.
breeze
.
elleai
.
application
.
dto
.
response
;
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
;
...
@@ -9,77 +11,87 @@ import java.time.LocalDateTime;
...
@@ -9,77 +11,87 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
WikiDto
implements
Serializable
{
public
class
WikiDto
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
;
/**
/**
* 资料文件URL
* 资料文件URL
*/
*/
@Schema
(
description
=
"资料文件URL"
)
@JsonProperty
(
"file_url"
)
@JsonProperty
(
"file_url"
)
private
String
fileUrl
;
private
String
fileUrl
;
/**
/**
* 资料分类ID
* 资料分类ID
*/
*/
@Schema
(
description
=
"资料分类ID"
)
@JsonProperty
(
"wiki_category_id"
)
@JsonProperty
(
"wiki_category_id"
)
private
Integer
wikiCategoryId
;
private
Integer
wikiCategoryId
;
/**
/**
* 资料分类名称
* 资料分类名称
*/
*/
@Schema
(
description
=
"资料分类名称"
)
@JsonProperty
(
"wiki_category_name"
)
@JsonProperty
(
"wiki_category_name"
)
private
String
wikiCategoryName
;
private
String
wikiCategoryName
;
/**
/**
* 场景分类ID
* 场景分类ID
*/
*/
@Schema
(
description
=
"场景分类ID"
)
@JsonProperty
(
"scene_category_id"
)
@JsonProperty
(
"scene_category_id"
)
private
Integer
sceneCategoryId
;
private
Integer
sceneCategoryId
;
/**
/**
* 场景分类名称
* 场景分类名称
*/
*/
@Schema
(
description
=
"场景分类名称"
)
@JsonProperty
(
"scene_category_name"
)
@JsonProperty
(
"scene_category_name"
)
private
String
sceneCategoryName
;
private
String
sceneCategoryName
;
/**
/**
* 富文本详情
* 富文本详情
*/
*/
@Schema
(
description
=
"富文本详情"
)
private
String
detail
;
private
String
detail
;
/**
/**
* 状态(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"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@Schema
(
description
=
"update_time"
)
@JsonProperty
(
"update_time"
)
@JsonProperty
(
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
}
}
src/main/java/cn/breeze/elleai/application/service/AppChatCompletionService.java
View file @
ce2d8a20
...
@@ -257,6 +257,7 @@ public class AppChatCompletionService {
...
@@ -257,6 +257,7 @@ public class AppChatCompletionService {
* @return
* @return
*/
*/
public
String
userAsk
(
UserQaHistoryRequestDto
request
)
{
public
String
userAsk
(
UserQaHistoryRequestDto
request
)
{
//TODO 生成sessionId
// 更新问答记录
// 更新问答记录
Integer
recordId
=
chatCompletionService
.
saveUserQaSession
(
request
.
getUserId
(),
request
.
getSessionId
());
Integer
recordId
=
chatCompletionService
.
saveUserQaSession
(
request
.
getUserId
(),
request
.
getSessionId
());
...
...
src/main/java/cn/breeze/elleai/config/ExceptionConfig.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author Administrator
*/
@Configuration
public
class
ExceptionConfig
{
@Bean
public
GlobalExceptionHandler
globalExceptionHandler
()
{
return
new
GlobalExceptionHandler
();
}
}
src/main/java/cn/breeze/elleai/config/GlobalExceptionHandler.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
config
;
import
cn.breeze.elleai.application.dto.ApiResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
* 请求接口处理
* @author Administrator
*/
@RestControllerAdvice
@Slf4j
public
class
GlobalExceptionHandler
{
@Value
(
"${spring.application.name:}"
)
private
String
applicationName
;
// @ExceptionHandler(InternalException.class)
// public ResponseEntity<ApiResponse> handleException(InternalException e) {
// e.printStackTrace();
// log.error("出错啦:ex = {}, message = {}", e.getDescription(), e.getStackTrace());
// ApiResponse error = ApiResponse.fail(e.getCode(), e.getDescription(), e.getDescription());
// error.setModule(applicationName);
// return new ResponseEntity<>(error, HttpStatus.OK);
// }
@ExceptionHandler
(
Exception
.
class
)
public
ResponseEntity
<
ApiResponse
>
handleException
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"出错啦:ex = {}, message = {}"
,
e
.
getMessage
(),
e
.
getStackTrace
());
ApiResponse
error
=
ApiResponse
.
fail
(-
1
,
e
.
getMessage
());
return
new
ResponseEntity
<>(
error
,
HttpStatus
.
OK
);
}
}
src/main/java/cn/breeze/elleai/config/UserPrincipalConfig.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.List
;
/**
* 用户令牌自定义解析器配置
* @author Administrator
*/
@Configuration
public
class
UserPrincipalConfig
implements
WebMvcConfigurer
{
@Override
public
void
addArgumentResolvers
(
List
<
HandlerMethodArgumentResolver
>
resolvers
)
{
// resolvers.add(new UserPrincipalHandlerMethodArgumentResolver());
}
}
src/main/java/cn/breeze/elleai/config/UserPrincipalHandlerMethodArgumentResolver.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
config
;
import
cn.breeze.elleai.util.Codes
;
import
cn.breeze.elleai.util.PrincipalEnum
;
import
cn.breeze.elleai.util.UserPrincipal
;
import
cn.hutool.core.util.StrUtil
;
import
org.springframework.core.MethodParameter
;
import
org.springframework.web.bind.support.WebDataBinderFactory
;
import
org.springframework.web.context.request.NativeWebRequest
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.method.support.ModelAndViewContainer
;
/**
*
* 用户身份解析请求参数的自定义解析器
* @author Administrator
*/
public
class
UserPrincipalHandlerMethodArgumentResolver
implements
HandlerMethodArgumentResolver
{
@Override
public
boolean
supportsParameter
(
MethodParameter
parameter
)
{
return
parameter
.
getParameterType
().
equals
(
UserPrincipal
.
class
);
}
@Override
public
Object
resolveArgument
(
MethodParameter
parameter
,
ModelAndViewContainer
mavContainer
,
NativeWebRequest
webRequest
,
WebDataBinderFactory
binderFactory
)
throws
Exception
{
UserPrincipal
userPrincipal
=
null
;
String
username
=
webRequest
.
getHeader
(
Codes
.
X_JWT_UN
);
String
uid
=
webRequest
.
getHeader
(
Codes
.
X_JWT_UID
);
String
type
=
webRequest
.
getHeader
(
Codes
.
X_JWT_TYPE
);
String
jti
=
webRequest
.
getHeader
(
Codes
.
X_JWT_JTI
);
if
(
StrUtil
.
isAllNotBlank
(
uid
,
username
,
type
))
{
userPrincipal
=
new
UserPrincipal
();
//最少要有用户ID、用户名和用户类型(mobile, openapi, admin)其中一种
userPrincipal
.
setUserId
(
Long
.
valueOf
(
uid
));
userPrincipal
.
setType
(
PrincipalEnum
.
valueOf
(
type
));
userPrincipal
.
setUsername
(
username
);
userPrincipal
.
setJti
(
jti
);
}
return
userPrincipal
;
}
}
src/main/java/cn/breeze/elleai/controller/ChatCompletionController.java
View file @
ce2d8a20
...
@@ -11,6 +11,7 @@ import cn.breeze.elleai.application.dto.response.UserChatCompletionDto;
...
@@ -11,6 +11,7 @@ import cn.breeze.elleai.application.dto.response.UserChatCompletionDto;
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
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -28,25 +29,24 @@ public class ChatCompletionController {
...
@@ -28,25 +29,24 @@ public class ChatCompletionController {
private
final
AppChatCompletionService
chatCompletionService
;
private
final
AppChatCompletionService
chatCompletionService
;
@Operation
(
summary
=
"助手详情"
)
@Operation
(
summary
=
"助手详情"
)
@GetMapping
(
"/assistant/detail/{id}"
)
@GetMapping
(
"/assistant/detail/{id}"
)
public
ApiResponse
<
QaAssistantDto
>
qaAssistantDetail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
QaAssistantDto
>
qaAssistantDetail
(
@
Schema
(
description
=
"助手ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
QaAssistantDto
detail
=
chatCompletionService
.
qaAssistantDetail
(
id
);
QaAssistantDto
detail
=
chatCompletionService
.
qaAssistantDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用助手"
)
@Operation
(
summary
=
"启用/禁用助手"
)
@PostMapping
(
"/assistant/update_status/{id}/{status}"
)
@PostMapping
(
"/assistant/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateQaAssistantStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateQaAssistantStatus
(
@
Schema
(
description
=
"助手ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@Schema
(
description
=
"状态(0禁用 1启用)"
)
@PathVariable
(
"status"
)
Integer
status
)
{
chatCompletionService
.
updateQaAssistantStatus
(
id
,
status
);
chatCompletionService
.
updateQaAssistantStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除助手"
)
@Operation
(
summary
=
"删除助手"
)
@PostMapping
(
"/assistant/delete/{id}"
)
@PostMapping
(
"/assistant/delete/{id}"
)
public
ApiResponse
<
String
>
deleteQaAssistant
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
deleteQaAssistant
(
@
Schema
(
description
=
"助手ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
chatCompletionService
.
deleteQaAssistant
(
id
);
chatCompletionService
.
deleteQaAssistant
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -68,7 +68,7 @@ public class ChatCompletionController {
...
@@ -68,7 +68,7 @@ public class ChatCompletionController {
@Operation
(
summary
=
"AI问答会话详情"
)
@Operation
(
summary
=
"AI问答会话详情"
)
@GetMapping
(
"/user/detail/{session_id}"
)
@GetMapping
(
"/user/detail/{session_id}"
)
public
ApiResponse
<
List
<
UserChatCompletionHistoryDto
>>
userQaDetail
(
@PathVariable
(
"session_id"
)
Integer
sessionId
)
{
public
ApiResponse
<
List
<
UserChatCompletionHistoryDto
>>
userQaDetail
(
@
Schema
(
description
=
"会话记录ID"
)
@
PathVariable
(
"session_id"
)
Integer
sessionId
)
{
List
<
UserChatCompletionHistoryDto
>
detail
=
chatCompletionService
.
userQaDetail
(
sessionId
);
List
<
UserChatCompletionHistoryDto
>
detail
=
chatCompletionService
.
userQaDetail
(
sessionId
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
...
...
src/main/java/cn/breeze/elleai/controller/CommonController.java
View file @
ce2d8a20
...
@@ -10,6 +10,7 @@ import cn.breeze.elleai.application.dto.response.WikiDto;
...
@@ -10,6 +10,7 @@ import cn.breeze.elleai.application.dto.response.WikiDto;
import
cn.breeze.elleai.application.service.AppCommonService
;
import
cn.breeze.elleai.application.service.AppCommonService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -25,22 +26,22 @@ public class CommonController {
...
@@ -25,22 +26,22 @@ public class CommonController {
@Operation
(
summary
=
"专有名词详情"
)
@Operation
(
summary
=
"专有名词详情"
)
@GetMapping
(
"/proper_noun/detail/{id}"
)
@GetMapping
(
"/proper_noun/detail/{id}"
)
public
ApiResponse
<
ProperNounDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
ProperNounDto
>
detail
(
@
Schema
(
description
=
"专有名词ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
ProperNounDto
detail
=
commonService
.
properNounDetail
(
id
);
ProperNounDto
detail
=
commonService
.
properNounDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用专有名词"
)
@Operation
(
summary
=
"启用/禁用专有名词"
)
@
Ge
tMapping
(
"/proper_noun/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/proper_noun/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"专有名词ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
commonService
.
updateProperNounStatus
(
id
,
status
);
commonService
.
updateProperNounStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除专有名词"
)
@Operation
(
summary
=
"删除专有名词"
)
@
Ge
tMapping
(
"/proper_noun/delete/{id}"
)
@
Pos
tMapping
(
"/proper_noun/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"专有名词ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
commonService
.
deleteProperNoun
(
id
);
commonService
.
deleteProperNoun
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -53,7 +54,7 @@ public class CommonController {
...
@@ -53,7 +54,7 @@ public class CommonController {
}
}
@Operation
(
summary
=
"专有名词列表"
)
@Operation
(
summary
=
"专有名词列表"
)
@
Pos
tMapping
(
"/proper_noun/list"
)
@
Ge
tMapping
(
"/proper_noun/list"
)
public
ApiResponse
<
PageResult
<
ProperNounDto
>>
list
(
@RequestBody
ProperNounRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
ProperNounDto
>>
list
(
@RequestBody
ProperNounRequestDto
request
)
{
PageResult
<
ProperNounDto
>
pageResult
=
commonService
.
properNounPaginQuery
(
request
);
PageResult
<
ProperNounDto
>
pageResult
=
commonService
.
properNounPaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/controller/ExamineController.java
View file @
ce2d8a20
...
@@ -11,6 +11,7 @@ import cn.breeze.elleai.application.dto.response.ExamineDto;
...
@@ -11,6 +11,7 @@ import cn.breeze.elleai.application.dto.response.ExamineDto;
import
cn.breeze.elleai.application.dto.response.ExamineQaDto
;
import
cn.breeze.elleai.application.dto.response.ExamineQaDto
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -26,22 +27,22 @@ public class ExamineController {
...
@@ -26,22 +27,22 @@ public class ExamineController {
@Operation
(
summary
=
"对练详情"
)
@Operation
(
summary
=
"对练详情"
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
ExamineDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
ExamineDto
>
detail
(
@
Schema
(
description
=
"对练ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
ExamineDto
detail
=
examineService
.
examineDetail
(
id
);
ExamineDto
detail
=
examineService
.
examineDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用对练"
)
@Operation
(
summary
=
"启用/禁用对练"
)
@
Ge
tMapping
(
"/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"对练ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateExamineStatus
(
id
,
status
);
examineService
.
updateExamineStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除对练"
)
@Operation
(
summary
=
"删除对练"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"对练ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteExamine
(
id
);
examineService
.
deleteExamine
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -54,7 +55,7 @@ public class ExamineController {
...
@@ -54,7 +55,7 @@ public class ExamineController {
}
}
@Operation
(
summary
=
"对练列表"
)
@Operation
(
summary
=
"对练列表"
)
@
Pos
tMapping
(
"/list"
)
@
Ge
tMapping
(
"/list"
)
public
ApiResponse
<
PageResult
<
ExamineDto
>>
list
(
@RequestBody
ExamineRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
ExamineDto
>>
list
(
@RequestBody
ExamineRequestDto
request
)
{
PageResult
<
ExamineDto
>
pageResult
=
examineService
.
examinePaginQuery
(
request
);
PageResult
<
ExamineDto
>
pageResult
=
examineService
.
examinePaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/controller/ExamineMobileController.java
View file @
ce2d8a20
...
@@ -3,10 +3,7 @@ package cn.breeze.elleai.controller;
...
@@ -3,10 +3,7 @@ package cn.breeze.elleai.controller;
import
cn.breeze.elleai.application.dto.ApiResponse
;
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.ExamineRecordRequestDto
;
import
cn.breeze.elleai.application.dto.request.*
;
import
cn.breeze.elleai.application.dto.request.ExamineRequestDto
;
import
cn.breeze.elleai.application.dto.request.ExamineSceneCategoryRequestDto
;
import
cn.breeze.elleai.application.dto.request.ExamineSceneRequestDto
;
import
cn.breeze.elleai.application.dto.response.*
;
import
cn.breeze.elleai.application.dto.response.*
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
...
@@ -118,99 +115,40 @@ public class ExamineMobileController {
...
@@ -118,99 +115,40 @@ public class ExamineMobileController {
return
ApiResponse
.
ok
(
result
);
return
ApiResponse
.
ok
(
result
);
}
}
//
// @PostMapping(value = "update_question")
@Operation
(
summary
=
"更新题目"
)
// public ApiResponse<String> updateQuestion(@RequestParam("tenant") Integer tenant,
@PostMapping
(
value
=
"update_question"
)
// @RequestParam("session_id") String sessionId,
public
ApiResponse
<
String
>
updateQuestion
(
@Schema
(
description
=
"考试记录ID"
)
@RequestParam
(
"record_id"
)
Integer
recordId
,
// @RequestParam("user_id") String userId,
@Schema
(
description
=
"题目ID"
)
@RequestParam
(
"question_id"
)
Long
questionId
,
// @RequestParam("question_id") Long questionId,
@Schema
(
description
=
"用户答案"
)
@RequestParam
(
value
=
"answer"
,
required
=
false
)
String
answer
,
// @RequestParam(value = "answer", required = false) String answer,
@Schema
(
description
=
"评分"
)
@RequestParam
(
value
=
"score"
,
required
=
false
)
Double
score
,
// @RequestParam(value = "score", required = false) Double score,
@Schema
(
description
=
"得分点评"
)
@RequestParam
(
value
=
"score_criteria"
,
required
=
false
)
String
scoreCriteria
)
{
// @RequestParam(value = "score_criteria", required = false) String scoreCriteria) {
//
return
ApiResponse
.
ok
(
"SUCCESS"
);
// ElehSessionQaRecordDo recordDo = qaRecordMapper.selectQaRecord(tenant, sessionId, userId, questionId);
}
// if(Objects.isNull(recordDo)) {
// recordDo = new ElehSessionQaRecordDo();
@Operation
(
summary
=
"获取最终考试结果"
)
// recordDo.setQuestionId(questionId);
@GetMapping
(
value
=
"/get_final_result"
)
// recordDo.setAnswer(answer);
public
ApiResponse
<
ExamineFinalResultDto
>
getFinalResult
(
@Schema
(
description
=
"考试记录ID"
)
@RequestParam
(
"record_id"
)
Integer
recordId
)
{
// recordDo.setTenant(tenant);
// recordDo.setSessionId(sessionId);
ExamineFinalResultDto
result
=
new
ExamineFinalResultDto
();
// recordDo.setUserId(userId);
return
ApiResponse
.
ok
(
result
);
// recordDo.setType(ExamConstants.QA_RESULT_TYPE_SINGLE_QUESTION);
}
// recordDo.setScoreCriteria(scoreCriteria);
// recordDo.setScore(score);
// recordDo.setCreatedAt(new Date());
// qaRecordMapper.insert(recordDo);
@Operation
(
summary
=
"评分"
)
// } else {
@PostMapping
(
value
=
"/run4score"
)
// ElehSessionQaRecordDo update = new ElehSessionQaRecordDo();
public
ApiResponse
<
String
>
run4Score
(
@RequestParam
(
value
=
"examine_id"
)
Integer
examineId
,
// update.setAnswer(answer);
@RequestParam
(
value
=
"scene"
)
String
scene
,
// update.setScoreCriteria(scoreCriteria);
@RequestParam
(
value
=
"session_id"
)
String
sessionId
,
// update.setScore(score);
@RequestParam
(
value
=
"user_id"
)
String
userId
,
// update.setId(recordDo.getId());
@RequestParam
(
value
=
"question"
)
String
question
,
// qaRecordMapper.updateById(update);
@RequestParam
(
value
=
"answer"
)
String
answer
,
// }
@RequestParam
(
value
=
"question_id"
)
Long
questionId
,
//
@RequestParam
(
value
=
"user_answer"
)
String
userAnswer
)
{
// return ApiResponse.ok("SUCCESS");
// }
//
// @GetMapping(value = "/get_final_result")
// public ApiResponse<SessionExamResult> getFinalResult(@RequestParam("tenant") Integer tenant,
// @RequestParam("session_id") String sessionId,
// @RequestParam("user_id") String userId) {
//
// String avgScore = "";
// Double totalScore = 0D;
// long examNum = 0;
// List<SingleQaResult> qaResultList = Lists.newArrayList();
//
// LambdaQueryWrapper<ElehSessionQaRecordDo> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(ElehSessionQaRecordDo::getTenant, tenant);
// queryWrapper.eq(ElehSessionQaRecordDo::getSessionId, sessionId);
// queryWrapper.eq(ElehSessionQaRecordDo::getUserId, userId);
// queryWrapper.eq(ElehSessionQaRecordDo::getType, ExamConstants.QA_RESULT_TYPE_SINGLE_QUESTION);
// List<ElehSessionQaRecordDo> qaRecordDos = qaRecordMapper.selectList(queryWrapper);
// if(!CollectionUtils.isEmpty(qaRecordDos)) {
// totalScore = qaRecordDos.stream().filter(v -> Objects.nonNull(v.getScore())).mapToDouble(ElehSessionQaRecordDo::getScore).sum();
// examNum = qaRecordDos.stream().filter(v -> Objects.nonNull(v.getScore())).count();
//
// DecimalFormat df = new DecimalFormat("#.##");
// avgScore = df.format(totalScore / examNum);
//
// // 数据转换
// qaResultList = qaRecordDos.stream().map(v -> {
//
// ElehKnowledgeDo knowledgeDo = knowledgeMapper.selectById(v.getTenant(), v.getQuestionId());
//
// SingleQaResult qa = new SingleQaResult();
// qa.setQuestion(knowledgeDo.getQuestion());
// qa.setAnswer(knowledgeDo.getAnswer());
// qa.setUserAnswer(v.getAnswer());
// qa.setScore(v.getScore());
// qa.setScoreCriteria(v.getScoreCriteria());
// return qa;
// }).collect(Collectors.toList());
// }
// SessionExamResult result = new SessionExamResult();
// result.setAvgScore(avgScore);
// result.setTotalScore(totalScore);
// result.setExamNum(examNum);
// result.setQaResultList(qaResultList);
// return ApiResponse.ok(result);
// }
//
//
//
// @PostMapping(value = "/run4score")
// public ApiResponse<String> run4Score(@RequestParam(value = "tenant") Integer tenant,
// @RequestParam(value = "scene") String scene,
// @RequestParam(value = "session_id") String sessionId,
// @RequestParam(value = "user_id") String userId,
// @RequestParam(value = "question") String question,
// @RequestParam(value = "answer") String answer,
// @RequestParam(value = "question_id") Long questionId,
// @RequestParam(value = "user_answer") String userAnswer) {
//
//
// String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, userId);
// String redisKey = String.format(EXAM_REDIS_SESSION_KEY, tenant, userId);
//
//
// SingleQaResult qa = new SingleQaResult();
// SingleQaResult qa = new SingleQaResult();
...
@@ -233,9 +171,9 @@ public class ExamineMobileController {
...
@@ -233,9 +171,9 @@ public class ExamineMobileController {
// redisTemplate.opsForValue().set(redisKey, JSONObject.toJSONString(qa), 30, TimeUnit.MINUTES);
// redisTemplate.opsForValue().set(redisKey, JSONObject.toJSONString(qa), 30, TimeUnit.MINUTES);
//
//
// examAppFacade.run4Score(scene, sessionId, userId, question, answer, userAnswer);
// examAppFacade.run4Score(scene, sessionId, userId, question, answer, userAnswer);
//
//
return ApiResponse.ok("ok");
return
ApiResponse
.
ok
(
"ok"
);
//
}
}
//
//
// @GetMapping(value = "/get_run4score_info")
// @GetMapping(value = "/get_run4score_info")
// public ApiResponse<SingleQaResult> getRun4ScoreInfo(@RequestParam(value = "tenant") Integer tenant,
// public ApiResponse<SingleQaResult> getRun4ScoreInfo(@RequestParam(value = "tenant") Integer tenant,
...
@@ -297,54 +235,25 @@ public class ExamineMobileController {
...
@@ -297,54 +235,25 @@ public class ExamineMobileController {
// return ApiResponse.ok(JSONObject.toJSONString(contextList));
// return ApiResponse.ok(JSONObject.toJSONString(contextList));
// }
// }
//
//
// /**
/**
// * 更新最终考试结果
* 更新最终考试结果
// * @param request
* @param request
// * @return
* @return
// */
*/
// @PostMapping(value = "/update_exam_result")
@Operation
(
summary
=
"更新最终考试结果"
)
// public ApiResponse<String> updateExamResult(@RequestBody UpdateExamResultRequestDto request) {
@PostMapping
(
value
=
"/update_exam_result"
)
//
public
ApiResponse
<
String
>
updateExamResult
(
@RequestBody
ExamineUpdateResultDto
request
)
{
// Integer tenant = request.getTenant();
// String sessionId = request.getSessionId();
return
ApiResponse
.
ok
(
"SUCCESS"
);
// String userId = request.getUserId();
}
// String examCriteria = request.getExamCriteria();
//
@GetMapping
(
value
=
"/get_current_ai_score_info"
)
// ElehSessionQaRecordDo recordDo = qaRecordMapper.selectExamResult(tenant, sessionId, userId);
public
ApiResponse
<
ExamineResultDto
>
getCurrentAiScoreInfo
(
@Schema
(
description
=
"对练ID"
)
@RequestParam
(
"examine_id"
)
Integer
examineId
,
// if(Objects.isNull(recordDo)) {
@Schema
(
description
=
"用户ID"
)
@RequestParam
(
"user_id"
)
String
userId
,
// recordDo = new ElehSessionQaRecordDo();
@Schema
(
description
=
"题目ID"
)
@RequestParam
(
"question_id"
)
Long
questionId
)
{
// recordDo.setTenant(tenant);
// recordDo.setSessionId(sessionId);
ExamineResultDto
result
=
new
ExamineResultDto
();
// recordDo.setUserId(userId);
// recordDo.setType(ExamConstants.QA_RESULT_TYPE_SINGLE_EXAM);
return
ApiResponse
.
ok
(
result
);
// recordDo.setExamCriteria(examCriteria);
}
// recordDo.setCreatedAt(new Date());
// qaRecordMapper.insert(recordDo);
// } else {
// ElehSessionQaRecordDo update = new ElehSessionQaRecordDo();
// update.setExamCriteria(examCriteria);
// update.setId(recordDo.getId());
// qaRecordMapper.updateById(update);
// }
//
// return ApiResponse.ok("SUCCESS");
// }
//
//
// @GetMapping(value = "/get_current_ai_score_info")
// public ApiResponse<SingleQaResult> getCurrentAiScoreInfo(@RequestParam("tenant") Integer tenant,
// @RequestParam("session_id") String sessionId,
// @RequestParam("user_id") String userId,
// @RequestParam("question_id") Long questionId) {
//
// SingleQaResult singleQaResult = new SingleQaResult();
//
// ElehSessionQaRecordDo recordDo = qaRecordMapper.selectQaRecord(tenant, sessionId, userId, questionId);
//
// if(Objects.nonNull(recordDo)) {
// singleQaResult = BeanUtil.copyProperties(recordDo, SingleQaResult.class);
// }
//
// return ApiResponse.ok(singleQaResult);
// }
}
}
src/main/java/cn/breeze/elleai/controller/ExamineQaController.java
View file @
ce2d8a20
...
@@ -8,6 +8,7 @@ import cn.breeze.elleai.application.dto.request.ExamineQaSaveDto;
...
@@ -8,6 +8,7 @@ import cn.breeze.elleai.application.dto.request.ExamineQaSaveDto;
import
cn.breeze.elleai.application.dto.response.ExamineQaDto
;
import
cn.breeze.elleai.application.dto.response.ExamineQaDto
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -26,22 +27,22 @@ public class ExamineQaController {
...
@@ -26,22 +27,22 @@ public class ExamineQaController {
@Operation
(
summary
=
"对练题目详情"
)
@Operation
(
summary
=
"对练题目详情"
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
ExamineQaDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
ExamineQaDto
>
detail
(
@
Schema
(
description
=
"题目ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
ExamineQaDto
detail
=
examineService
.
qaDetail
(
id
);
ExamineQaDto
detail
=
examineService
.
qaDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用对练题目"
)
@Operation
(
summary
=
"启用/禁用对练题目"
)
@
Ge
tMapping
(
"/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"题目ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateQaStatus
(
id
,
status
);
examineService
.
updateQaStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除对练题目"
)
@Operation
(
summary
=
"删除对练题目"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"题目ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteQa
(
id
);
examineService
.
deleteQa
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -54,7 +55,7 @@ public class ExamineQaController {
...
@@ -54,7 +55,7 @@ public class ExamineQaController {
}
}
@Operation
(
summary
=
"对练题目列表"
)
@Operation
(
summary
=
"对练题目列表"
)
@
Pos
tMapping
(
"/list"
)
@
Ge
tMapping
(
"/list"
)
public
ApiResponse
<
PageResult
<
ExamineQaDto
>>
list
(
@RequestBody
ExamineQaRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
ExamineQaDto
>>
list
(
@RequestBody
ExamineQaRequestDto
request
)
{
PageResult
<
ExamineQaDto
>
pageResult
=
examineService
.
examineQaPaginQuery
(
request
);
PageResult
<
ExamineQaDto
>
pageResult
=
examineService
.
examineQaPaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/controller/ExamineSceneCategoryController.java
View file @
ce2d8a20
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.ExamineSceneCategoryDto;
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.ExamineSceneCategoryDto;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.domain.sparring.model.request.ExamineSceneCategoryRequestModel
;
import
cn.breeze.elleai.domain.sparring.model.request.ExamineSceneCategoryRequestModel
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -27,22 +28,22 @@ public class ExamineSceneCategoryController {
...
@@ -27,22 +28,22 @@ public class ExamineSceneCategoryController {
@Operation
(
summary
=
"对练场景分类详情"
)
@Operation
(
summary
=
"对练场景分类详情"
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
ExamineSceneCategoryDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
ExamineSceneCategoryDto
>
detail
(
@
Schema
(
description
=
"场景分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
ExamineSceneCategoryDto
detail
=
examineService
.
sceneCategoryDetail
(
id
);
ExamineSceneCategoryDto
detail
=
examineService
.
sceneCategoryDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用对练场景分类"
)
@Operation
(
summary
=
"启用/禁用对练场景分类"
)
@
Ge
tMapping
(
"/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"场景分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateSceneCategoryStatus
(
id
,
status
);
examineService
.
updateSceneCategoryStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除对练场景分类"
)
@Operation
(
summary
=
"删除对练场景分类"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"场景分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteSceneCategory
(
id
);
examineService
.
deleteSceneCategory
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -55,7 +56,7 @@ public class ExamineSceneCategoryController {
...
@@ -55,7 +56,7 @@ public class ExamineSceneCategoryController {
}
}
@Operation
(
summary
=
"对练场景分类列表"
)
@Operation
(
summary
=
"对练场景分类列表"
)
@
Reques
tMapping
(
"/list"
)
@
Ge
tMapping
(
"/list"
)
public
ApiResponse
<
PageResult
<
ExamineSceneCategoryDto
>>
list
(
@RequestBody
ExamineSceneCategoryRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
ExamineSceneCategoryDto
>>
list
(
@RequestBody
ExamineSceneCategoryRequestDto
request
)
{
PageResult
<
ExamineSceneCategoryDto
>
pageResult
=
examineService
.
examineSceneCategoryPaginQuery
(
request
);
PageResult
<
ExamineSceneCategoryDto
>
pageResult
=
examineService
.
examineSceneCategoryPaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/controller/ExamineSceneController.java
View file @
ce2d8a20
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.ExamineSceneDto;
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.ExamineSceneDto;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.domain.sparring.model.request.ExamineSceneRequestModel
;
import
cn.breeze.elleai.domain.sparring.model.request.ExamineSceneRequestModel
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -27,22 +28,22 @@ public class ExamineSceneController {
...
@@ -27,22 +28,22 @@ public class ExamineSceneController {
@Operation
(
summary
=
"对练场景详情"
)
@Operation
(
summary
=
"对练场景详情"
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
ExamineSceneDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
ExamineSceneDto
>
detail
(
@
Schema
(
description
=
"场景ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
ExamineSceneDto
detail
=
examineService
.
sceneDetail
(
id
);
ExamineSceneDto
detail
=
examineService
.
sceneDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用对练场景"
)
@Operation
(
summary
=
"启用/禁用对练场景"
)
@
Ge
tMapping
(
"/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"场景ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateSceneStatus
(
id
,
status
);
examineService
.
updateSceneStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除对练场景"
)
@Operation
(
summary
=
"删除对练场景"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"场景ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteScene
(
id
);
examineService
.
deleteScene
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -55,7 +56,7 @@ public class ExamineSceneController {
...
@@ -55,7 +56,7 @@ public class ExamineSceneController {
}
}
@Operation
(
summary
=
"对练场景列表"
)
@Operation
(
summary
=
"对练场景列表"
)
@
Pos
tMapping
(
"/list"
)
@
Ge
tMapping
(
"/list"
)
public
ApiResponse
<
PageResult
<
ExamineSceneDto
>>
list
(
@RequestBody
ExamineSceneRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
ExamineSceneDto
>>
list
(
@RequestBody
ExamineSceneRequestDto
request
)
{
PageResult
<
ExamineSceneDto
>
pageResult
=
examineService
.
examineScenePaginQuery
(
request
);
PageResult
<
ExamineSceneDto
>
pageResult
=
examineService
.
examineScenePaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/controller/WikiController.java
View file @
ce2d8a20
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.WikiCategoryDto;
...
@@ -9,6 +9,7 @@ import cn.breeze.elleai.application.dto.response.WikiCategoryDto;
import
cn.breeze.elleai.application.dto.response.WikiDto
;
import
cn.breeze.elleai.application.dto.response.WikiDto
;
import
cn.breeze.elleai.application.service.AppExamineService
;
import
cn.breeze.elleai.application.service.AppExamineService
;
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.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -24,22 +25,22 @@ public class WikiController {
...
@@ -24,22 +25,22 @@ public class WikiController {
@Operation
(
summary
=
"资料库详情"
)
@Operation
(
summary
=
"资料库详情"
)
@GetMapping
(
"/detail/{id}"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
WikiDto
>
detail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
WikiDto
>
detail
(
@
Schema
(
description
=
"资料ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
WikiDto
detail
=
examineService
.
wikiDetail
(
id
);
WikiDto
detail
=
examineService
.
wikiDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用资料库"
)
@Operation
(
summary
=
"启用/禁用资料库"
)
@
Ge
tMapping
(
"/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateStatus
(
@
Schema
(
description
=
"资料ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@
Schema
(
description
=
"状态(0禁用 1启用)"
)
@
PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateWikiStatus
(
id
,
status
);
examineService
.
updateWikiStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除资料库"
)
@Operation
(
summary
=
"删除资料库"
)
@
Ge
tMapping
(
"/delete/{id}"
)
@
Pos
tMapping
(
"/delete/{id}"
)
public
ApiResponse
<
String
>
delete
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
delete
(
@
Schema
(
description
=
"资料ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteWiki
(
id
);
examineService
.
deleteWiki
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -52,7 +53,7 @@ public class WikiController {
...
@@ -52,7 +53,7 @@ public class WikiController {
}
}
@Operation
(
summary
=
"资料库列表"
)
@Operation
(
summary
=
"资料库列表"
)
@
Pos
tMapping
(
"/list"
)
@
Ge
tMapping
(
"/list"
)
public
ApiResponse
<
PageResult
<
WikiDto
>>
list
(
@RequestBody
WikiRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
WikiDto
>>
list
(
@RequestBody
WikiRequestDto
request
)
{
PageResult
<
WikiDto
>
pageResult
=
examineService
.
wikiPaginQuery
(
request
);
PageResult
<
WikiDto
>
pageResult
=
examineService
.
wikiPaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
@@ -60,22 +61,22 @@ public class WikiController {
...
@@ -60,22 +61,22 @@ public class WikiController {
@Operation
(
summary
=
"资料库分类详情"
)
@Operation
(
summary
=
"资料库分类详情"
)
@GetMapping
(
"/category/detail/{id}"
)
@GetMapping
(
"/category/detail/{id}"
)
public
ApiResponse
<
WikiCategoryDto
>
categoryDetail
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
WikiCategoryDto
>
categoryDetail
(
@
Schema
(
description
=
"资料分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
WikiCategoryDto
detail
=
examineService
.
wikiCategoryDetail
(
id
);
WikiCategoryDto
detail
=
examineService
.
wikiCategoryDetail
(
id
);
return
ApiResponse
.
ok
(
detail
);
return
ApiResponse
.
ok
(
detail
);
}
}
@Operation
(
summary
=
"启用/禁用资料库分类"
)
@Operation
(
summary
=
"启用/禁用资料库分类"
)
@
Ge
tMapping
(
"/category/update_status/{id}/{status}"
)
@
Pos
tMapping
(
"/category/update_status/{id}/{status}"
)
public
ApiResponse
<
String
>
updateCategoryStatus
(
@PathVariable
(
"id"
)
Integer
id
,
public
ApiResponse
<
String
>
updateCategoryStatus
(
@
Schema
(
description
=
"资料分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
,
@PathVariable
(
"status"
)
Integer
status
)
{
@Schema
(
description
=
"状态(0禁用 1启用)"
)
@PathVariable
(
"status"
)
Integer
status
)
{
examineService
.
updateWikiCategoryStatus
(
id
,
status
);
examineService
.
updateWikiCategoryStatus
(
id
,
status
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
@Operation
(
summary
=
"删除资料库分类"
)
@Operation
(
summary
=
"删除资料库分类"
)
@
Ge
tMapping
(
"/category/delete/{id}"
)
@
Pos
tMapping
(
"/category/delete/{id}"
)
public
ApiResponse
<
String
>
deleteCategory
(
@PathVariable
(
"id"
)
Integer
id
)
{
public
ApiResponse
<
String
>
deleteCategory
(
@
Schema
(
description
=
"资料分类ID"
)
@
PathVariable
(
"id"
)
Integer
id
)
{
examineService
.
deleteWikiCategory
(
id
);
examineService
.
deleteWikiCategory
(
id
);
return
ApiResponse
.
ok
(
"ok"
);
return
ApiResponse
.
ok
(
"ok"
);
}
}
...
@@ -88,7 +89,7 @@ public class WikiController {
...
@@ -88,7 +89,7 @@ public class WikiController {
}
}
@Operation
(
summary
=
"资料库分类列表"
)
@Operation
(
summary
=
"资料库分类列表"
)
@
Pos
tMapping
(
"/category/list"
)
@
Ge
tMapping
(
"/category/list"
)
public
ApiResponse
<
PageResult
<
WikiCategoryDto
>>
categoryList
(
@RequestBody
WikiCategoryRequestDto
request
)
{
public
ApiResponse
<
PageResult
<
WikiCategoryDto
>>
categoryList
(
@RequestBody
WikiCategoryRequestDto
request
)
{
PageResult
<
WikiCategoryDto
>
pageResult
=
examineService
.
wikiCategoryPaginQuery
(
request
);
PageResult
<
WikiCategoryDto
>
pageResult
=
examineService
.
wikiCategoryPaginQuery
(
request
);
return
ApiResponse
.
ok
(
pageResult
);
return
ApiResponse
.
ok
(
pageResult
);
...
...
src/main/java/cn/breeze/elleai/domain/sparring/model/response/ExamineQaResponseModel.java
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
domain
.
sparring
.
model
.
response
;
package
cn
.
breeze
.
elleai
.
domain
.
sparring
.
model
.
response
;
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
;
...
@@ -9,40 +11,53 @@ import java.time.LocalDateTime;
...
@@ -9,40 +11,53 @@ import java.time.LocalDateTime;
@Data
@Data
public
class
ExamineQaResponseModel
implements
Serializable
{
public
class
ExamineQaResponseModel
implements
Serializable
{
@Schema
(
description
=
"题目ID"
)
private
Integer
id
;
private
Integer
id
;
/**
/**
* 问题
* 问题
*/
*/
@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
;
@Schema
(
description
=
"对练分类名称"
)
@JsonProperty
(
"category_name"
)
private
String
categoryName
;
private
String
categoryName
;
/**
/**
* 状态(0禁用 1启用)
* 状态(0禁用 1启用)
*/
*/
@Schema
(
description
=
"状态(0禁用 1启用)"
)
private
Integer
status
;
private
Integer
status
;
/**
/**
* 创建时间
* 创建时间
*/
*/
@Schema
(
description
=
"创建时间"
)
@JsonProperty
(
"create_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
private
LocalDateTime
createTime
;
/**
/**
* 更新时间
* 更新时间
*/
*/
@Schema
(
description
=
"更新时间"
)
@JsonProperty
(
"update_time"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
updateTime
;
private
LocalDateTime
updateTime
;
}
}
src/main/java/cn/breeze/elleai/util/Codes.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
/**
* @author Administrator
*/
public
abstract
class
Codes
{
/**
* 启用的状态
*/
public
static
final
Byte
ENABLED_BYTE
=
Byte
.
valueOf
(
"1"
);
/**
* 停用的状态
*/
public
static
final
Byte
DISABLED_BYTE
=
Byte
.
valueOf
(
"0"
);
/**
* 启用的状态
*/
public
static
final
Integer
ENABLED_INT
=
Integer
.
valueOf
(
"1"
);
/**
* 停用的状态
*/
public
static
final
Integer
DISABLED_INT
=
Integer
.
valueOf
(
"0"
);
/**
* jwt签名
*/
public
static
final
String
JWT_SIGN_KEY
=
"ZDQ0MjhlODYyNzE4MzJhZWUyN2U1MTQ5Yzk2NTA5MGU="
;
/**
* aes签名key
*/
public
static
final
String
JWT_AES_KEY
=
"fys3xpev0bupb7u1wah3zg7tr3syumzr"
;
/**
* jwt令牌中的用户名
*/
public
static
final
String
X_JWT_UN
=
"X-Jwt-Un"
;
/**
* jwt令牌中的uid
*/
public
static
final
String
X_JWT_UID
=
"X-Jwt-Uid"
;
/**
* jwt令牌中的唯一识别码
*/
public
static
final
String
X_JWT_JTI
=
"X-Jwt-Jti"
;
/**
* jwt令牌中的类型分三种, mobile, openapi,admin
*/
public
static
final
String
X_JWT_TYPE
=
"X-Jwt-type"
;
/**
* jwt令牌中的类型 mobile
*/
public
static
final
String
X_JWT_TYP_M
=
"mobile"
;
/**
* jwt令牌中的类型 admin
*/
public
static
final
String
X_JWT_TYP_O
=
"openapi"
;
/**
* jwt令牌中的类型 admin
*/
public
static
final
String
X_JWT_TYP_A
=
"admin"
;
}
src/main/java/cn/breeze/elleai/util/JwtProperties.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
/**
* @author qx
* @date 2023/7/4
* @des Jwt配置类
*/
@Component
@ConfigurationProperties
(
prefix
=
"jwt"
)
@Data
public
class
JwtProperties
{
/**
* 过期时间-分钟
*/
private
Integer
expireTime
;
/**
* refreshToken时间
*/
private
Integer
refreshTime
;
/**
* 密钥
*/
private
String
secret
;
}
src/main/java/cn/breeze/elleai/util/JwtUtil.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
import
com.auth0.jwt.JWT
;
import
com.auth0.jwt.JWTVerifier
;
import
com.auth0.jwt.algorithms.Algorithm
;
import
com.auth0.jwt.interfaces.Claim
;
import
com.auth0.jwt.interfaces.DecodedJWT
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author qx
* @date 2023/7/4
* @des JWT工具类
*/
@Component
@RequiredArgsConstructor
public
class
JwtUtil
{
private
final
JwtProperties
jwtProperties
;
/**
* 生成一个jwt字符串
*
* @param username 用户名
* @return jwt字符串
*/
public
String
sign
(
String
username
)
{
Algorithm
algorithm
=
Algorithm
.
HMAC256
(
jwtProperties
.
getSecret
());
return
JWT
.
create
()
// 设置过期时间1个小时
.
withExpiresAt
(
new
Date
(
System
.
currentTimeMillis
()
+
jwtProperties
.
getExpireTime
()
*
60
*
1000
))
// 设置负载
.
withClaim
(
"username"
,
username
).
sign
(
algorithm
);
}
/**
* 生成refreshToken
*
* @param username 用户名
* @return
*/
public
String
refreshToken
(
String
username
)
{
Algorithm
algorithm
=
Algorithm
.
HMAC256
(
jwtProperties
.
getSecret
());
return
JWT
.
create
()
// 设置更新时间2个小时
.
withExpiresAt
(
new
Date
(
System
.
currentTimeMillis
()
+
jwtProperties
.
getRefreshTime
()
*
60
*
1000
))
// 设置负载
.
withClaim
(
"username"
,
username
).
sign
(
algorithm
);
}
public
static
void
main
(
String
[]
args
)
{
Algorithm
algorithm
=
Algorithm
.
HMAC256
(
"KU5TjMO6zmh03bU3"
);
String
username
=
"admin"
;
String
token
=
JWT
.
create
()
// 设置过期时间1个小时
.
withExpiresAt
(
new
Date
(
System
.
currentTimeMillis
()
+
60
*
60
*
1000
))
// 设置负载
.
withClaim
(
"username"
,
username
).
sign
(
algorithm
);
System
.
out
.
println
(
token
);
}
/**
* 校验token是否正确
*
* @param token token值
*/
public
boolean
verify
(
String
token
)
{
if
(
token
==
null
||
token
.
length
()
==
0
)
{
throw
new
RuntimeException
(
"token为空"
);
}
try
{
Algorithm
algorithm
=
Algorithm
.
HMAC256
(
jwtProperties
.
getSecret
());
JWTVerifier
jwtVerifier
=
JWT
.
require
(
algorithm
).
build
();
DecodedJWT
decodedJWT
=
jwtVerifier
.
verify
(
token
);
Map
<
String
,
Claim
>
map
=
decodedJWT
.
getClaims
();
System
.
out
.
println
(
"claims:"
+
map
.
get
(
"username"
).
asString
());
return
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
/**
* 重新生成token和refreshToken
*
* @param refreshToken refreshToken
* @return 返回token和refreshToken
*/
public
Map
<
String
,
String
>
refreshJwt
(
String
refreshToken
)
{
if
(
refreshToken
==
null
||
refreshToken
.
length
()
==
0
)
{
throw
new
RuntimeException
(
"refreshToken为空"
);
}
Algorithm
algorithm
=
Algorithm
.
HMAC256
(
jwtProperties
.
getSecret
());
JWTVerifier
jwtVerifier
=
JWT
.
require
(
algorithm
).
build
();
DecodedJWT
decodedJWT
=
jwtVerifier
.
verify
(
refreshToken
);
Map
<
String
,
Claim
>
map
=
decodedJWT
.
getClaims
();
// 获取用户名
String
username
=
map
.
get
(
"username"
).
asString
();
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
// 重新生成token和refreshToken
resultMap
.
put
(
"token"
,
sign
(
username
));
resultMap
.
put
(
"refreshToken"
,
refreshToken
(
username
));
return
resultMap
;
}
}
src/main/java/cn/breeze/elleai/util/JwtUtils.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
@Data
@Component
@ConfigurationProperties
(
prefix
=
"token"
)
public
class
JwtUtils
{
private
long
expireTime
;
private
String
secret
;
private
String
header
;
protected
static
final
long
MILLIS_SECOND
=
1000
;
protected
static
final
long
MILLIS_MINUTE
=
60
*
MILLIS_SECOND
;
private
static
final
Long
MILLIS_MINUTE_TEN
=
20
*
60
*
1000L
;
// 生成JWT
// public String generateToken(String account) {
//
// Date nowDate = new Date();
// Date expireDate = new Date(nowDate.getTime() + MILLIS_SECOND * expireTime);
//
// return Jwts.builder()
// .setHeaderParam("typ", "JWT")
// .setSubject(account)
// .setIssuedAt(nowDate)
// .setExpiration(expireDate)
// .signWith(SignatureAlgorithm.HS512, secret)
// .compact();
// }
// // 解析JWT
// public Claims getClaimsByToken(String jwt) {
// try {
// return Jwts.parser()
// .setSigningKey(secret)
// .parseClaimsJws(jwt)
// .getBody();
// } catch (Exception e) {
// return null;
// }
// }
//
// // 判断JWT是否过期
// public boolean isTokenExpired(Claims claims) {
// return claims.getExpiration().before(new Date());
// }
}
src/main/java/cn/breeze/elleai/util/LoginFilter.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.*
;
import
javax.servlet.annotation.WebFilter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author qx
* @date 2023/7/4
* @des 登录过滤器
*/
//@Component
//@WebFilter(urlPatterns = "/**")
public
class
LoginFilter
implements
Filter
{
// @Value("${sso_server}")
private
String
serverHost
;
@Override
public
void
doFilter
(
ServletRequest
servletRequest
,
ServletResponse
servletResponse
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
HttpServletRequest
httpServletRequest
=
(
HttpServletRequest
)
servletRequest
;
String
token
=
httpServletRequest
.
getParameter
(
"token"
);
if
(
this
.
check
(
token
))
{
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
}
else
{
// token过期后再使用refreshToken处理
String
refreshToken
=
httpServletRequest
.
getHeader
(
"refreshToken"
);
if
(
check
(
refreshToken
))
{
// 重新生成token和refreshtoken给客户端保存 下次传递token参数的时候使用这个重新生成的
System
.
out
.
println
(
"更新后的token和refreshToken:"
+
refreshToken
(
refreshToken
));
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
}
// 如果refreshToken也过期 那么需要重新登录
HttpServletResponse
response
=
(
HttpServletResponse
)
servletResponse
;
String
redirect
=
serverHost
+
"/login"
;
response
.
sendRedirect
(
redirect
);
}
}
/**
* 验证token
*
* @param token
* @return
* @throws IOException
*/
private
boolean
check
(
String
token
)
throws
IOException
{
if
(
token
==
null
||
token
.
trim
().
length
()
==
0
)
{
return
false
;
}
// OkHttpClient client = new OkHttpClient();
// // 请求验证token的合法性
// String url = serverHost + "/checkJwt?token=" + token;
// Request request = new Request.Builder().url(url).build();
// Response response = client.newCall(request).execute();
// return Boolean.parseBoolean(response.body().string());
return
true
;
}
/**
* 重新获取token和refreshToken
*
* @param refreshToken
* @return
* @throws IOException
*/
private
String
refreshToken
(
String
refreshToken
)
throws
IOException
{
if
(
refreshToken
==
null
||
refreshToken
.
trim
().
length
()
==
0
)
{
return
null
;
}
// OkHttpClient client = new OkHttpClient();
// // 请求重新获取token和refreshToken
// String url = serverHost + "/refreshJwt?refreshToken=" + refreshToken;
// Request request = new Request.Builder().url(url).build();
// Response response = client.newCall(request).execute();
// return response.body().string();
return
null
;
}
}
src/main/java/cn/breeze/elleai/util/PrincipalEnum.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
/**
* @author Administrator
*/
public
enum
PrincipalEnum
{
/**
* 移动端,用于客户或者导购的权限
*/
Mobile
(
"mobile"
),
/**
* 开放接口授权,授权读取的是开发接口权限
*/
OpenApi
(
"openapi"
),
/**
* 管理后台授权,读取系统的管理后台权限进行判断
*/
Admin
(
"admin"
);
private
final
String
type
;
PrincipalEnum
(
String
type
)
{
this
.
type
=
type
;
}
}
src/main/java/cn/breeze/elleai/util/UserPrincipal.java
0 → 100644
View file @
ce2d8a20
package
cn
.
breeze
.
elleai
.
util
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author Administrator
*/
@Data
public
class
UserPrincipal
implements
Serializable
{
private
String
jti
;
private
String
username
;
private
Long
userId
;
private
PrincipalEnum
type
;
}
src/main/resources/application.yml
View file @
ce2d8a20
...
@@ -23,7 +23,14 @@ springdoc:
...
@@ -23,7 +23,14 @@ springdoc:
dify
:
dify
:
api_base
:
http://dify-api:5001/v1
api_base
:
http://dify-api:5001/v1
api_key
:
app-ilgoEphXjLw0I7x7fGeCyKYk
api_key
:
app-ilgoEphXjLw0I7x7fGeCyKYk
# token配置
token
:
# 令牌自定义标识
header
:
Authorization
# 令牌密钥
secret
:
fhgaf%^$#%cHDFDhUHLKnhkhj
# 令牌有效期(默认30分钟)
expireTime
:
2628000
---
---
spring
:
spring
:
config
:
config
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment