Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea_resource_api
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
高宇
tea_resource_api
Commits
524b7876
Commit
524b7876
authored
Oct 10, 2024
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了导入的bug,删掉了权重重复的判断,并且修改了权重的逻辑
parent
461cf89d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
12 deletions
+29
-12
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+6
-3
TeaExamQuestionsServiceImpl.java
...amquestions/service/impl/TeaExamQuestionsServiceImpl.java
+21
-7
TeaExamQuestionsMapper.xml
...siness/teaexamquestions.mapper/TeaExamQuestionsMapper.xml
+2
-2
No files found.
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
524b7876
...
@@ -221,9 +221,9 @@ public class BChapterServiceImpl extends ServiceImpl<BChapterRepository, BChapte
...
@@ -221,9 +221,9 @@ public class BChapterServiceImpl extends ServiceImpl<BChapterRepository, BChapte
//查询出当前用户拥有的不同角色下的这门课程
//查询出当前用户拥有的不同角色下的这门课程
List
<
BLesson
>
list
=
bChapterRepository
.
selectLessonsByLessonIdAndUserId
(
bChapter
.
getLessonId
(),
sysUser
.
getBusinessId
());
List
<
BLesson
>
list
=
bChapterRepository
.
selectLessonsByLessonIdAndUserId
(
bChapter
.
getLessonId
(),
sysUser
.
getBusinessId
());
//找出当前课程的最小开始时间和最大结束时间
//找出当前课程的最小开始时间和最大结束时间
if
(
list
.
size
()
>
0
)
{
BLesson
one
=
new
BLesson
();
BLesson
one
=
new
BLesson
();
BeanUtils
.
copyProperties
(
list
.
get
(
0
),
one
);
BeanUtils
.
copyProperties
(
list
.
get
(
0
),
one
);
if
(!
list
.
isEmpty
())
{
// 找出具有最小startTime的BLesson
// 找出具有最小startTime的BLesson
Optional
<
BLesson
>
minStartTime
=
list
.
stream
()
Optional
<
BLesson
>
minStartTime
=
list
.
stream
()
.
min
(
Comparator
.
comparing
(
BLesson:
:
getStartTime
));
.
min
(
Comparator
.
comparing
(
BLesson:
:
getStartTime
));
...
@@ -255,6 +255,9 @@ public class BChapterServiceImpl extends ServiceImpl<BChapterRepository, BChapte
...
@@ -255,6 +255,9 @@ public class BChapterServiceImpl extends ServiceImpl<BChapterRepository, BChapte
//过期
//过期
i1
=
0
;
i1
=
0
;
}
}
}
else
{
//该用户没有该课程
i1
=
0
;
}
}
//因为 上边查询课程返回的是全部的 章节+视频id 所以当 试看时需要将 非试看的 视频id 置空
//因为 上边查询课程返回的是全部的 章节+视频id 所以当 试看时需要将 非试看的 视频id 置空
if
(
i
==
null
||
i
==
0
||
i1
==
0
)
{
if
(
i
==
null
||
i
==
0
||
i1
==
0
)
{
...
...
src/main/java/org/rcisoft/business/teaexamquestions/service/impl/TeaExamQuestionsServiceImpl.java
View file @
524b7876
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -80,8 +81,8 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
...
@@ -80,8 +81,8 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
if
(
baseMapper
.
queryNumbeSomeCourse
(
teaExamQuestions
)
>
0
)
if
(
baseMapper
.
queryNumbeSomeCourse
(
teaExamQuestions
)
>
0
)
throw
new
CyServiceException
(
1001
,
"同一课程下,该题目编号已存在"
);
throw
new
CyServiceException
(
1001
,
"同一课程下,该题目编号已存在"
);
if
(
baseMapper
.
queryNumberSomeWeiht
(
teaExamQuestions
)
>
0
)
//
if (baseMapper.queryNumberSomeWeiht(teaExamQuestions) > 0)
throw
new
CyServiceException
(
1001
,
"同一课程下,该权重已存在"
);
//
throw new CyServiceException(1001, "同一课程下,该权重已存在");
teaExamQuestions
.
setCreateBy
(
"1"
);
teaExamQuestions
.
setCreateBy
(
"1"
);
int
line
=
baseMapper
.
insert
(
teaExamQuestions
);
int
line
=
baseMapper
.
insert
(
teaExamQuestions
);
if
(
CollectionUtils
.
isNotEmpty
(
examQuestionDto
.
getOptionsList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
examQuestionDto
.
getOptionsList
()))
{
...
@@ -136,8 +137,8 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
...
@@ -136,8 +137,8 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
BeanUtils
.
copyProperties
(
examQuestionDto
,
teaExamQuestions
);
BeanUtils
.
copyProperties
(
examQuestionDto
,
teaExamQuestions
);
if
(
baseMapper
.
queryNumbeSomeCourse
(
teaExamQuestions
)
>
0
)
if
(
baseMapper
.
queryNumbeSomeCourse
(
teaExamQuestions
)
>
0
)
throw
new
CyServiceException
(
1001
,
"同一课程下,该题目编号已存在"
);
throw
new
CyServiceException
(
1001
,
"同一课程下,该题目编号已存在"
);
if
(
baseMapper
.
queryNumberSomeWeiht
(
teaExamQuestions
)
>
0
)
//
if (baseMapper.queryNumberSomeWeiht(teaExamQuestions) > 0)
throw
new
CyServiceException
(
1001
,
"同一课程下,该权重已存在"
);
//
throw new CyServiceException(1001, "同一课程下,该权重已存在");
int
line
=
baseMapper
.
updateById
(
teaExamQuestions
);
int
line
=
baseMapper
.
updateById
(
teaExamQuestions
);
teaExamOptionsRepository
.
deleteByQuestionsId
(
examQuestionDto
.
getBusinessId
());
teaExamOptionsRepository
.
deleteByQuestionsId
(
examQuestionDto
.
getBusinessId
());
if
(!
examQuestionDto
.
getOptionsList
().
isEmpty
())
{
if
(!
examQuestionDto
.
getOptionsList
().
isEmpty
())
{
...
@@ -218,7 +219,6 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
...
@@ -218,7 +219,6 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
public
IPage
<
TeaExamQuestions
>
findAllByPagination
(
CyPageInfo
<
TeaExamQuestions
>
paginationUtility
,
public
IPage
<
TeaExamQuestions
>
findAllByPagination
(
CyPageInfo
<
TeaExamQuestions
>
paginationUtility
,
TeaExamQuestions
teaExamQuestions
)
{
TeaExamQuestions
teaExamQuestions
)
{
return
baseMapper
.
queryTeaExamQuestionssPaged
(
paginationUtility
,
teaExamQuestions
);
return
baseMapper
.
queryTeaExamQuestionssPaged
(
paginationUtility
,
teaExamQuestions
);
}
}
/**
/**
...
@@ -261,7 +261,6 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
...
@@ -261,7 +261,6 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
Set
<
String
>
examCourseSet
=
allTeaExamQuestionsList
.
stream
()
Set
<
String
>
examCourseSet
=
allTeaExamQuestionsList
.
stream
()
.
map
(
course
->
course
.
getNumber
()
+
"_"
+
course
.
getCourseId
())
.
map
(
course
->
course
.
getNumber
()
+
"_"
+
course
.
getCourseId
())
.
collect
(
Collectors
.
toCollection
(
HashSet:
:
new
));
.
collect
(
Collectors
.
toCollection
(
HashSet:
:
new
));
// 待保存的数据
// 待保存的数据
List
<
ExamQuestionDto
>
savedList
=
new
ArrayList
<>();
List
<
ExamQuestionDto
>
savedList
=
new
ArrayList
<>();
// 带保存的唯一key
// 带保存的唯一key
...
@@ -424,9 +423,24 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
...
@@ -424,9 +423,24 @@ public class TeaExamQuestionsServiceImpl extends ServiceImpl<TeaExamQuestionsRep
//让examDTOList通过题目编号和题型进行排序
//让examDTOList通过题目编号和题型进行排序
savedList
.
sort
(
Comparator
.
comparing
(
TeaExamQuestions:
:
getNumber
)
savedList
.
sort
(
Comparator
.
comparing
(
TeaExamQuestions:
:
getNumber
)
.
thenComparing
(
TeaExamQuestions:
:
getQuestionType
));
.
thenComparing
(
TeaExamQuestions:
:
getQuestionType
));
//查询该课程下的试题中权重最大的权重
TeaExamQuestions
question
=
new
TeaExamQuestions
();
question
.
setCourseId
(
courseId
);
List
<
TeaExamQuestions
>
teaExamQuestions
=
baseMapper
.
queryTeaExamQuestionss
(
question
);
//找出teaExamQuestionss中的最大权重
Integer
maxWeight
=
0
;
if
(
teaExamQuestions
.
size
()
==
0
)
{
maxWeight
=
0
;
}
else
{
TeaExamQuestions
maxWeightObj
=
teaExamQuestions
.
stream
()
.
max
(
Comparator
.
comparing
(
TeaExamQuestions:
:
getWeight
))
.
orElse
(
null
);
maxWeight
=
maxWeightObj
.
getWeight
();
}
//排序完将权重赋予
//排序完将权重赋予
for
(
int
i
=
0
;
i
<
savedList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
savedList
.
size
();
i
++)
{
savedList
.
get
(
i
).
setWeight
(
i
+
1
);
savedList
.
get
(
i
).
setWeight
(
i
+
maxWeight
+
1
);
}
}
...
...
src/main/resources/mapper/business/teaexamquestions.mapper/TeaExamQuestionsMapper.xml
View file @
524b7876
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
</update>
</update>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select
id=
"queryTeaExamQuestionss"
result
Map=
"BaseResultMap
"
>
<select
id=
"queryTeaExamQuestionss"
result
Type=
"org.rcisoft.business.teaexamquestions.entity.TeaExamQuestions
"
>
select * from tea_exam_questions
select * from tea_exam_questions
where 1=1
where 1=1
and del_flag = '0'
and del_flag = '0'
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
and flag = #{entity.flag}
and flag = #{entity.flag}
</if>
</if>
<if
test=
"entity.number !=null and entity.number != '' "
>
<if
test=
"entity.number !=null and entity.number != '' "
>
and number
like concat('%',#{entity.number},'%')
and number
= #{entity.number}
</if>
</if>
<if
test=
"entity.questionType !=null and entity.questionType != '' "
>
<if
test=
"entity.questionType !=null and entity.questionType != '' "
>
and question_type = #{entity.questionType}
and question_type = #{entity.questionType}
...
...
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