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
033259bb
Commit
033259bb
authored
Dec 17, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.移动端对练增加题序 2.移动端对练详情增加资料列表返回 3.移动端资料库根据分类id下钻获取资料 4.管理端资料详情增加分类id列表返回
parent
ece79536
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
118 additions
and
4 deletions
+118
-4
ExamineBusinessCacheDto.java
...elleai/application/dto/inner/ExamineBusinessCacheDto.java
+6
-0
ExamineMobileDto.java
...eze/elleai/application/dto/response/ExamineMobileDto.java
+8
-0
ExamineStartResultDto.java
...lleai/application/dto/response/ExamineStartResultDto.java
+8
-0
WikiDto.java
...va/cn/breeze/elleai/application/dto/response/WikiDto.java
+7
-0
AppExamineService.java
.../breeze/elleai/application/service/AppExamineService.java
+69
-2
ExamineMobileController.java
...eeze/elleai/controller/front/ExamineMobileController.java
+3
-2
WikiCategoryRequestModel.java
...main/sparring/model/request/WikiCategoryRequestModel.java
+2
-0
WikiRequestModel.java
...lleai/domain/sparring/model/request/WikiRequestModel.java
+3
-0
ExamineServiceImpl.java
...ze/elleai/domain/sparring/service/ExamineServiceImpl.java
+12
-0
No files found.
src/main/java/cn/breeze/elleai/application/dto/inner/ExamineBusinessCacheDto.java
View file @
033259bb
...
...
@@ -41,6 +41,12 @@ public class ExamineBusinessCacheDto implements Serializable {
@Schema
(
description
=
"当前题目ID"
)
private
Integer
currentQuestionId
;
/**
* 题目总数量
*/
@Schema
(
description
=
"题目总数量"
)
private
Integer
totalQaNum
;
/**
* 是否有下一题
*/
...
...
src/main/java/cn/breeze/elleai/application/dto/response/ExamineMobileDto.java
View file @
033259bb
...
...
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
ExamineMobileDto
implements
Serializable
{
...
...
@@ -72,4 +73,11 @@ public class ExamineMobileDto implements Serializable {
@Schema
(
description
=
"最高综合评分"
)
@JsonProperty
(
"max_overall_score"
)
private
int
maxOverallScore
;
/**
* 资料列表
*/
@Schema
(
description
=
"资料列表"
)
@JsonProperty
(
"wiki_list"
)
private
List
<
WikiListMobileDto
>
wikiList
;
}
src/main/java/cn/breeze/elleai/application/dto/response/ExamineStartResultDto.java
View file @
033259bb
...
...
@@ -25,4 +25,12 @@ public class ExamineStartResultDto implements Serializable {
@Schema
(
description
=
"是否有下一题"
)
private
boolean
next
;
@Schema
(
description
=
"当前题序"
)
@JsonProperty
(
"current_index"
)
private
Integer
currentIndex
;
@Schema
(
description
=
"题目总数量"
)
@JsonProperty
(
"total_qa_num"
)
private
Integer
totalQaNum
;
}
src/main/java/cn/breeze/elleai/application/dto/response/WikiDto.java
View file @
033259bb
...
...
@@ -7,6 +7,7 @@ import lombok.Data;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
WikiDto
implements
Serializable
{
...
...
@@ -46,6 +47,12 @@ public class WikiDto implements Serializable {
@JsonProperty
(
"wiki_category_id"
)
private
Integer
wikiCategoryId
;
/**
* 资料分类ID
*/
@Schema
(
description
=
"资料分类ID列表([1级父级ID,2级父级ID,当前分类ID]或者[1级父级ID,当前分类ID])"
)
@JsonProperty
(
"wiki_category_id_list"
)
private
List
<
Integer
>
wikiCategoryIdList
;
/**
* 资料分类名称
*/
...
...
src/main/java/cn/breeze/elleai/application/service/AppExamineService.java
View file @
033259bb
...
...
@@ -480,7 +480,7 @@ public class AppExamineService {
* @param id
* @return
*/
public
ExamineMobileDto
examineMobileDetail
(
Integer
id
)
{
public
ExamineMobileDto
examineMobileDetail
(
Integer
id
,
UserPrincipal
userPrincipal
)
{
ExamineMobileDto
result
=
null
;
ExamineResponseModel
model
=
examineService
.
examineDetail
(
id
);
if
(
Objects
.
nonNull
(
model
))
{
...
...
@@ -505,6 +505,18 @@ public class AppExamineService {
result
.
setPracticeCount
(
practiceCount
);
result
.
setExamTotalCount
(
examTotalCount
);
result
.
setMaxOverallScore
(
maxOverallScore
.
intValue
());
// 对练场景关联资料
WikiRequestModel
requestModel
=
new
WikiRequestModel
();
requestModel
.
setSceneCategoryId
(
model
.
getSceneId
());
List
<
WikiResponseModel
>
wikiResponseModels
=
examineService
.
wikiList
(
requestModel
);
if
(
CollectionUtil
.
isNotEmpty
(
wikiResponseModels
))
{
List
<
WikiListMobileDto
>
wikiList
=
wikiResponseModels
.
stream
().
map
(
v
->
{
WikiListMobileDto
dto
=
BeanUtil
.
copyProperties
(
v
,
WikiListMobileDto
.
class
);
return
dto
;
}).
collect
(
Collectors
.
toList
());
result
.
setWikiList
(
wikiList
);
}
}
return
result
;
}
...
...
@@ -957,7 +969,29 @@ public class AppExamineService {
*/
public
WikiDto
wikiDetail
(
Integer
id
)
{
WikiResponseModel
model
=
examineService
.
wikiDetail
(
id
);
return
BeanUtil
.
copyProperties
(
model
,
WikiDto
.
class
);
WikiDto
wikiDto
=
BeanUtil
.
copyProperties
(
model
,
WikiDto
.
class
);
// 获取资料分类信息
if
(
Objects
.
nonNull
(
wikiDto
.
getWikiCategoryId
()))
{
List
<
Integer
>
wikiCategoryIdList
=
Lists
.
newArrayList
();
wikiCategoryIdList
.
add
(
wikiDto
.
getWikiCategoryId
());
WikiCategoryResponseModel
category
=
examineService
.
wikiCategoryDetail
(
wikiDto
.
getWikiCategoryId
());
// 非根分类,继续获取分类信息
if
(
Objects
.
nonNull
(
category
)
&&
!
Objects
.
equals
(
category
.
getParentId
(),
0
))
{
WikiCategoryResponseModel
parentCategory
=
examineService
.
wikiCategoryDetail
(
category
.
getParentId
());
if
(
Objects
.
nonNull
(
parentCategory
))
{
wikiCategoryIdList
.
add
(
parentCategory
.
getId
());
if
(!
Objects
.
equals
(
parentCategory
.
getParentId
(),
0
))
{
WikiCategoryResponseModel
rootCategory
=
examineService
.
wikiCategoryDetail
(
parentCategory
.
getParentId
());
if
(
Objects
.
nonNull
(
rootCategory
))
{
wikiCategoryIdList
.
add
(
rootCategory
.
getId
());
}
}
}
}
CollectionUtil
.
reverse
(
wikiCategoryIdList
);
wikiDto
.
setWikiCategoryIdList
(
wikiCategoryIdList
);
}
return
wikiDto
;
}
public
WikiMobileDto
wikiMobileDetail
(
UserPrincipal
userPrincipal
,
Integer
id
)
{
...
...
@@ -1036,6 +1070,30 @@ public class AppExamineService {
WikiRequestModel
requestModel
=
BeanUtil
.
copyProperties
(
request
,
WikiRequestModel
.
class
);
requestModel
.
setStatus
(
1
);
List
<
Integer
>
categoryIdList
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
request
.
getCategoryId
()))
{
// 是否有二级子分类
WikiCategoryRequestModel
wcRequest
=
new
WikiCategoryRequestModel
();
wcRequest
.
setParentId
(
request
.
getCategoryId
());
List
<
WikiCategoryResponseModel
>
wikiCategoryList
=
examineService
.
wikiCategoryList
(
wcRequest
);
if
(
CollectionUtil
.
isNotEmpty
(
wikiCategoryList
))
{
List
<
Integer
>
childIdList
=
wikiCategoryList
.
stream
().
mapToInt
(
WikiCategoryResponseModel:
:
getId
).
boxed
().
collect
(
Collectors
.
toList
());
categoryIdList
.
add
(
request
.
getCategoryId
());
categoryIdList
.
addAll
(
childIdList
);
// 是否有三级子分类
WikiCategoryRequestModel
childRequest
=
new
WikiCategoryRequestModel
();
childRequest
.
setParentIdList
(
childIdList
);
List
<
WikiCategoryResponseModel
>
thirdChildList
=
examineService
.
wikiCategoryList
(
childRequest
);
if
(
CollectionUtil
.
isNotEmpty
(
thirdChildList
))
{
List
<
Integer
>
thirdChildIdList
=
thirdChildList
.
stream
().
mapToInt
(
WikiCategoryResponseModel:
:
getId
).
boxed
().
collect
(
Collectors
.
toList
());
categoryIdList
.
addAll
(
thirdChildIdList
);
}
requestModel
.
setCategoryId
(
null
);
requestModel
.
setWikiCategoryIdList
(
categoryIdList
);
}
}
Page
<
WikiResponseModel
>
page
=
examineService
.
wikiPaginQuery
(
requestModel
);
PageResult
<
WikiListMobileDto
>
pageResult
=
PageResult
.
of
(
request
.
getPageNo
(),
request
.
getPageSize
(),
(
int
)
page
.
getTotalRow
(),
null
);
...
...
@@ -1114,6 +1172,9 @@ public class AppExamineService {
businessCache
.
setExamineId
(
examineId
);
businessCache
.
setExamineMode
(
examineMode
);
businessCache
.
setUserId
(
userId
);
ExamineResponseModel
model
=
examineService
.
examineDetailIgnoreDeleted
(
examineId
);
businessCache
.
setTotalQaNum
(
model
.
getQaNum
());
}
// 当前出题
...
...
@@ -1128,6 +1189,8 @@ public class AppExamineService {
result
.
setQuestion
(
model
.
getQuestion
());
result
.
setAnswer
(
model
.
getAnswer
());
result
.
setNext
(
examineQaList
.
size
()
>
1
?
true
:
false
);
result
.
setCurrentIndex
(
1
);
result
.
setTotalQaNum
(
businessCache
.
getTotalQaNum
());
businessCache
.
setCurrentQuestionId
(
currentQuestionId
);
businessCache
.
setHasNext
(
result
.
isNext
());
...
...
@@ -1170,6 +1233,7 @@ public class AppExamineService {
// 获取下一题
ExamineQaResponseModel
nextQa
=
null
;
boolean
hasNext
=
false
;
Integer
qaIndex
=
null
;
List
<
ExamineQaResponseModel
>
examineQaList
=
examineService
.
examineQaList
(
examineId
);
if
(
CollectionUtil
.
isNotEmpty
(
examineQaList
))
{
OptionalInt
indexOpt
=
IntStream
.
range
(
0
,
examineQaList
.
size
())
...
...
@@ -1180,6 +1244,7 @@ public class AppExamineService {
nextQa
=
index
+
1
<
examineQaList
.
size
()
?
examineQaList
.
get
(
index
+
1
)
:
null
;
int
remainingNum
=
examineQaList
.
size
()
-
index
-
1
;
hasNext
=
remainingNum
>
1
?
true
:
false
;
qaIndex
=
index
+
2
;
}
}
if
(
Objects
.
nonNull
(
nextQa
))
{
...
...
@@ -1188,6 +1253,8 @@ public class AppExamineService {
result
.
setQuestion
(
nextQa
.
getQuestion
());
result
.
setAnswer
(
nextQa
.
getAnswer
());
result
.
setQuestionId
(
nextQa
.
getId
());
result
.
setCurrentIndex
(
qaIndex
);
result
.
setTotalQaNum
(
businessCache
.
getTotalQaNum
());
// 缓存
businessCache
.
setCurrentQuestionId
(
nextQa
.
getId
());
...
...
src/main/java/cn/breeze/elleai/controller/front/ExamineMobileController.java
View file @
033259bb
...
...
@@ -50,8 +50,9 @@ public class ExamineMobileController {
@Operation
(
summary
=
"获取对练详情(根据对练ID)"
)
@GetMapping
(
"/detail/{id}"
)
public
ApiResponse
<
ExamineMobileDto
>
detail
(
@Schema
(
description
=
"对练ID"
)
@PathVariable
(
"id"
)
Integer
id
)
{
ExamineMobileDto
detail
=
examineService
.
examineMobileDetail
(
id
);
public
ApiResponse
<
ExamineMobileDto
>
detail
(
@Schema
(
description
=
"对练ID"
)
@PathVariable
(
"id"
)
Integer
id
,
@Parameter
(
hidden
=
true
)
UserPrincipal
userPrincipal
)
{
ExamineMobileDto
detail
=
examineService
.
examineMobileDetail
(
id
,
userPrincipal
);
return
ApiResponse
.
ok
(
detail
);
}
...
...
src/main/java/cn/breeze/elleai/domain/sparring/model/request/WikiCategoryRequestModel.java
View file @
033259bb
...
...
@@ -20,5 +20,7 @@ public class WikiCategoryRequestModel implements Serializable {
private
List
<
Integer
>
idList
;
private
List
<
Integer
>
parentIdList
;
private
Integer
level
;
}
src/main/java/cn/breeze/elleai/domain/sparring/model/request/WikiRequestModel.java
View file @
033259bb
...
...
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
WikiRequestModel
implements
Serializable
{
...
...
@@ -21,5 +22,7 @@ public class WikiRequestModel implements Serializable {
private
Integer
sceneCategoryId
;
private
List
<
Integer
>
wikiCategoryIdList
;
private
Integer
status
;
}
src/main/java/cn/breeze/elleai/domain/sparring/service/ExamineServiceImpl.java
View file @
033259bb
...
...
@@ -585,6 +585,9 @@ public class ExamineServiceImpl implements ExamineService {
if
(
Objects
.
nonNull
(
request
.
getParentId
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
PARENT_ID
.
eq
(
request
.
getParentId
()));
}
if
(
CollectionUtil
.
isNotEmpty
(
request
.
getParentIdList
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
PARENT_ID
.
in
(
request
.
getParentIdList
()));
}
if
(
Objects
.
nonNull
(
request
.
getLevel
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
LEVEL
.
eq
(
request
.
getLevel
()));
}
...
...
@@ -622,6 +625,9 @@ public class ExamineServiceImpl implements ExamineService {
if
(
Objects
.
nonNull
(
request
.
getParentId
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
PARENT_ID
.
eq
(
request
.
getParentId
()));
}
if
(
CollectionUtil
.
isNotEmpty
(
request
.
getParentIdList
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
PARENT_ID
.
in
(
request
.
getParentIdList
()));
}
if
(
Objects
.
nonNull
(
request
.
getLevel
()))
{
queryWrapper
.
and
(
WIKI_CATEGORY_ENTITY
.
LEVEL
.
eq
(
request
.
getLevel
()));
}
...
...
@@ -688,6 +694,9 @@ public class ExamineServiceImpl implements ExamineService {
if
(
Objects
.
nonNull
(
request
.
getStatus
()))
{
queryWrapper
.
and
(
WIKI_ENTITY
.
STATUS
.
eq
(
request
.
getStatus
()));
}
if
(
CollectionUtil
.
isNotEmpty
(
request
.
getWikiCategoryIdList
()))
{
queryWrapper
.
and
(
WIKI_ENTITY
.
WIKI_CATEGORY_ID
.
in
(
request
.
getWikiCategoryIdList
()));
}
Page
<
WikiResponseModel
>
page
=
wikiMapper
.
paginateAs
(
pageNo
,
pageSize
,
queryWrapper
,
WikiResponseModel
.
class
);
...
...
@@ -701,6 +710,9 @@ public class ExamineServiceImpl implements ExamineService {
if
(
StrUtil
.
isNotEmpty
(
request
.
getName
()))
{
queryWrapper
.
where
(
WIKI_ENTITY
.
NAME
.
like
(
"%"
+
request
.
getName
()+
"%"
));
}
if
(
Objects
.
nonNull
(
request
.
getSceneCategoryId
()))
{
queryWrapper
.
and
(
WIKI_ENTITY
.
SCENE_CATEGORY_ID
.
eq
(
request
.
getSceneCategoryId
()));
}
return
wikiMapper
.
selectListByQueryAs
(
queryWrapper
,
WikiResponseModel
.
class
);
}
...
...
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