Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
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
李丛阳
education
Commits
b2895e00
Commit
b2895e00
authored
Sep 26, 2019
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加课程查询
parent
ba4be424
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
209 additions
and
224 deletions
+209
-224
BCourseRepository.java
...a/org/rcisoft/business/bcourse/dao/BCourseRepository.java
+4
-0
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+41
-18
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+61
-31
AddLessonDTO.java
...n/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
+3
-4
LessonTrainDTO.java
...java/org/rcisoft/business/blesson/dto/LessonTrainDTO.java
+29
-0
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+7
-7
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+25
-16
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+33
-145
BLessonPersonController.java
...ess/blessonperson/controller/BLessonPersonController.java
+4
-2
BLessonPersonRepository.java
...t/business/blessonperson/dao/BLessonPersonRepository.java
+2
-1
No files found.
src/main/java/org/rcisoft/business/bcourse/dao/BCourseRepository.java
View file @
b2895e00
...
...
@@ -41,6 +41,10 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@ResultMap
(
value
=
"BaseResultMapDTO"
)
List
<
QueryCourseResDTO
>
queryFirstLevel
();
/**
* 查询所有分类存到List中
* @return
*/
@Select
(
"select * from b_course where del_flag != '1' and flag ='1'"
)
@ResultMap
(
value
=
"AllCourseResultMap"
)
List
<
AllCourseDTO
>
findAllCourse
();
...
...
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
b2895e00
...
...
@@ -10,6 +10,7 @@ import org.rcisoft.business.bcourse.service.BCourseService;
import
org.rcisoft.business.blesson.dto.AddLessonDTO
;
import
org.rcisoft.business.blesson.dto.FindAllLessonDTO
;
import
org.rcisoft.business.blesson.dto.FirstPageQueryDTO
;
import
org.rcisoft.business.blesson.dto.LessonTrainDTO
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.common.component.Global
;
...
...
@@ -112,11 +113,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation
(
value
=
"606 分页查询大家都在学"
,
notes
=
"分页查询大家都在学"
)
@GetMapping
(
value
=
"/queryPersonMoreByPagination"
)
public
Result
queryPersonMoreByPagination
(
CurUser
curUser
,
@Valid
FirstPageQueryDTO
firstPageQueryDTO
,
BindingResult
bindingResult
)
{
List
<
AllCourseDTO
>
allCourse
=
null
;
if
(
StringUtils
.
isNotEmpty
(
firstPageQueryDTO
.
getCourseLevelOne
())){
allCourse
=
bCourseService
.
findAllCourse
();
}
bLessonService
.
queryPersonMoreByPagination
(
getPaginationUtility
(),
firstPageQueryDTO
,
allCourse
);
bLessonService
.
queryPersonMoreByPagination
(
getPaginationUtility
());
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -127,12 +124,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation
(
value
=
"607 分页查询推荐"
,
notes
=
"分页查询推荐"
)
@GetMapping
(
value
=
"/queryRecommendByPagination"
)
public
Result
queryRecommendByPagination
(
CurUser
curUser
,
@Valid
FirstPageQueryDTO
firstPageQueryDTO
,
BindingResult
bindingResult
)
{
List
<
AllCourseDTO
>
allCourse
=
null
;
if
(
StringUtils
.
isNotEmpty
(
firstPageQueryDTO
.
getCourseLevelOne
())){
allCourse
=
bCourseService
.
findAllCourse
();
}
String
userId
=
curUser
.
getUserId
();
bLessonService
.
queryRecommendByPagination
(
getPaginationUtility
(),
userId
,
firstPageQueryDTO
,
allCourse
);
bLessonService
.
queryRecommendByPagination
(
getPaginationUtility
(),
userId
);
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -142,12 +135,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation
(
value
=
"608 分页查询最受关注"
,
notes
=
"分页查询最受关注"
)
@GetMapping
(
value
=
"/queryConcernByPagination"
)
public
Result
queryConcernByPagination
(
CurUser
curUser
,
@Valid
FirstPageQueryDTO
firstPageQueryDTO
,
BindingResult
bindingResult
)
{
List
<
AllCourseDTO
>
allCourse
=
null
;
if
(
StringUtils
.
isNotEmpty
(
firstPageQueryDTO
.
getCourseLevelOne
())){
allCourse
=
bCourseService
.
findAllCourse
();
}
bLessonService
.
queryConcernByPagination
(
getPaginationUtility
(),
firstPageQueryDTO
,
allCourse
);
public
Result
queryConcernByPagination
(
CurUser
curUser
)
{
bLessonService
.
queryConcernByPagination
(
getPaginationUtility
());
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -158,12 +147,46 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation
(
value
=
"609 分页查询可能感兴趣"
,
notes
=
"分页查询可能感兴趣"
)
@GetMapping
(
value
=
"/queryInterestedByPagination"
)
public
Result
queryInterestedByPagination
(
CurUser
curUser
,
@Valid
FirstPageQueryDTO
firstPageQueryDTO
,
BindingResult
bindingResult
)
{
public
Result
queryInterestedByPagination
(
CurUser
curUser
)
{
bLessonService
.
queryInterestedByPagination
(
getPaginationUtility
());
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
gridModel
);
}
@ApiOperation
(
value
=
"610 首页分页查询全部课程"
,
notes
=
"根据条件分页查询全部课程"
)
@GetMapping
(
value
=
"/queryHomeBLessonsByPagination"
)
public
Result
queryHomeBLessonsByPagination
(
CurUser
curUser
,
@Valid
FirstPageQueryDTO
firstPageQueryDTO
,
BindingResult
bindingResult
)
{
List
<
AllCourseDTO
>
allCourse
=
null
;
if
(
StringUtils
.
isNotEmpty
(
firstPageQueryDTO
.
getCourseLevelOne
())){
allCourse
=
bCourseService
.
findAllCourse
();
}
bLessonService
.
queryInterestedByPagination
(
getPaginationUtility
(),
firstPageQueryDTO
,
allCourse
);
bLessonService
.
queryHomeBLessonsByPagination
(
getPaginationUtility
(),
firstPageQueryDTO
,
allCourse
);
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
gridModel
);
}
@ApiOperation
(
value
=
"611 关闭课程"
,
notes
=
"根据ID关闭一个课程"
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/close"
)
public
Result
close
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bLessonService
.
closeBLesson
(
businessId
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
businessId
);
}
@ApiOperation
(
value
=
"612 课程培训条件查询"
,
notes
=
"课程培训条件查询(工作台)"
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/findLessonTrain"
)
public
Result
findLessonTrain
(
CurUser
curUser
,
@Valid
LessonTrainDTO
lessonTrainDTO
,
BindingResult
bindingResult
)
{
bLessonService
.
findLessonTrain
(
getPaginationUtility
(),
lessonTrainDTO
);
GridModel
gridModel
=
getGridModelResponse
();
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
b2895e00
...
...
@@ -70,11 +70,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Delete
(
"<script>delete from b_lesson_label where lesson_id = #{businessId}</script>"
)
int
removeLabelByLessonId
(
BLesson
model
);
@Select
(
"<script>select * from b_lesson "
+
""
+
"where del_flag != 1 and flag = 1 and lecturer_id = #{lecturerId}"
+
"<if test=\"param.releaseState!=null and param.releaseState != ''\">and release_state = #{param.releaseState} </if>"
+
"order by update_date desc</script>"
)
/**
* 单一查询课程信息
* @param businessId
* @return
*/
@Select
(
" <script> select bl.* "
+
" ,su.name lecturerName "
+
" ,suc.name createByName "
+
" ,bc.c_name courseName "
+
" from b_lesson bl "
+
" left join s_user su on su.business_id = bl.lecturer_id "
+
" left join s_user suc on suc.business_id = bl.create_by "
+
" left join b_course bc on bc.business_id = bl.course_type "
+
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.business_id = #{businessId} "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
BLesson
selectInfoById
(
String
businessId
);
...
...
@@ -91,7 +104,6 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl "
+
" left join s_user su on su.business_id = bl.lecturer_id "
+
" left join s_user suc on suc.business_id = bl.create_by "
+
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
...
...
@@ -125,15 +137,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.release_state = 2 "
+
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') "
+
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> "
+
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in "
+
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> "
+
" </if> "
+
" order by bl.person_number desc "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryPersonMore
(
@Param
(
"param"
)
FirstPageQueryDTO
firstPageQueryDTO
,
@Param
(
"courseIds"
)
List
<
String
>
sonCourseIds
);
List
<
BLesson
>
queryPersonMore
();
/**
* 按学习人数降序查询推荐
...
...
@@ -147,20 +154,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_lesson bl on br.lesson_id = bl.business_id "
+
" left join s_user su on su.business_id = bl.lecturer_id "
+
" left join s_user suc on suc.business_id = bl.create_by "
+
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.release_state = 2 "
+
" and br.person_id = #{userId} "
+
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') "
+
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> "
+
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in "
+
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> "
+
" </if> "
+
" order by bl.person_number desc "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryRecommend
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"param"
)
FirstPageQueryDTO
param
,
@Param
(
"courseIds"
)
List
<
String
>
sonCourseIds
);
List
<
BLesson
>
queryRecommend
(
String
userId
);
/**
* 按学习人数降序查询
...
...
@@ -178,15 +180,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.release_state = 2 "
+
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') "
+
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> "
+
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in "
+
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> "
+
" </if> "
+
" order by bl.collect_number desc "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryConcern
(
@Param
(
"param"
)
FirstPageQueryDTO
firstPageQueryDTO
,
@Param
(
"courseIds"
)
List
<
String
>
sonCourseIds
);
List
<
BLesson
>
queryConcern
();
@Select
(
" <script> select bl.* "
+
" ,su.name lecturerName "
+
...
...
@@ -199,15 +196,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.release_state = 2 "
+
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') "
+
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> "
+
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in "
+
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> "
+
" </if> "
+
" order by bl.hot_number desc "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryInterested
(
@Param
(
"param"
)
FirstPageQueryDTO
firstPageQueryDTO
,
@Param
(
"courseIds"
)
List
<
String
>
sonCourseIds
);
List
<
BLesson
>
queryInterested
();
//查询课程中的标签
@Select
(
" <script> select blb.business_id businessId,blb.l_name lName"
+
...
...
@@ -219,5 +211,43 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bls.business_id = #{lessonId} "
+
"</script>"
)
List
<
QueryLabelResDTO
>
queryLabelByLessonId
(
String
lessonId
);
@Select
(
" <script> select bl.* "
+
" ,su.name lecturerName "
+
" ,suc.name createByName "
+
" from b_lesson bl "
+
" left join s_user su on su.business_id = bl.lecturer_id "
+
" left join s_user suc on suc.business_id = bl.create_by "
+
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and suc.del_flag != 1 and suc.flag = 1 "
+
" and bl.release_state = 2 "
+
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') "
+
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> "
+
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in "
+
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> "
+
" </if> "
+
" order by bl.person_number desc "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BLesson
>
queryHomeBLesson
(
@Param
(
"param"
)
FirstPageQueryDTO
firstPageQueryDTO
,
@Param
(
"courseIds"
)
List
<
String
>
sonCourseIds
);
/**
* 根据课程id关闭课程
* @param model
* @return
*/
@Update
({
"<script>"
,
"update b_lesson"
,
" <set>"
,
" <if test='updateBy != null'>update_by=#{updateBy},</if>"
,
" <if test='updateDate != null'>update_date=#{updateDate},</if>"
,
" release_state = '4'"
,
" </set>"
,
"where business_id=#{businessId}"
,
"</script>"
})
int
closeLesson
(
BLesson
model
);
}
src/main/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
View file @
b2895e00
...
...
@@ -13,20 +13,19 @@ public class AddLessonDTO {
@ApiModelProperty
(
value
=
"课程id"
)
private
String
businessId
;
@NotBlank
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
@ApiModelProperty
(
value
=
"课程编号"
)
private
String
code
;
@NotBlank
@ApiModelProperty
(
value
=
"课程名称"
)
@ApiModelProperty
(
value
=
"课程名称"
,
required
=
true
)
@Length
(
min
=
1
,
max
=
200
,
message
=
"长度最小为1,最大为150"
)
private
String
lessonName
;
@ApiModelProperty
(
value
=
"默认封面图片url"
)
private
String
defaultUrl
;
@ApiModelProperty
(
value
=
"课程分类"
)
@ApiModelProperty
(
value
=
"课程分类"
,
required
=
true
)
@NotBlank
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
courseType
;
...
...
@@ -41,7 +40,7 @@ public class AddLessonDTO {
private
String
viewRange
;
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
)
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
,
required
=
true
)
@NotBlank
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
lessonType
;
...
...
src/main/java/org/rcisoft/business/blesson/dto/LessonTrainDTO.java
0 → 100644
View file @
b2895e00
package
org
.
rcisoft
.
business
.
blesson
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
javax.persistence.Transient
;
@Data
public
class
LessonTrainDTO
{
@ApiModelProperty
(
value
=
"课程名称"
,
required
=
false
)
@Length
(
min
=
1
,
max
=
200
,
message
=
"长度最小为1,最大为150"
)
private
String
lessonName
;
@ApiModelProperty
(
value
=
"发布状态(0:待发布 1:审核中 2:已发布 3:已驳回 4:已关闭)"
)
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
private
String
releaseState
;
@ApiModelProperty
(
value
=
"创建人姓名"
)
@Transient
private
String
createByName
;
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
)
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1"
)
private
String
lessonType
;
}
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
b2895e00
...
...
@@ -75,7 +75,7 @@ public class BLesson extends IdEntity<BLesson> {
private
Date
releaseDate
;
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50
"
)
@Length
(
min
=
1
,
max
=
1
,
message
=
"长度最小为1,最大为1
"
)
private
String
lessonType
;
@ApiModelProperty
(
value
=
"评论数"
)
...
...
@@ -106,11 +106,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private
String
lecturerName
;
@ApiModelProperty
(
value
=
"是否学完"
)
@Transient
private
String
isLearnOver
;
@ApiModelProperty
(
value
=
"标签集合"
)
@ApiModelProperty
(
value
=
"接收标签集合 用‘,’分隔"
)
@Transient
private
String
labels
;
...
...
@@ -118,8 +114,12 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private
String
createByName
;
@ApiModelProperty
(
value
=
"标签集合"
)
@ApiModelProperty
(
value
=
"
返回
标签集合"
)
@Transient
private
List
<
QueryLabelResDTO
>
labelList
;
@ApiModelProperty
(
value
=
"分类名"
)
@Transient
private
String
courseName
;
}
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
b2895e00
package
org
.
rcisoft
.
business
.
blesson
.
service
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.rcisoft.business.bcourse.dto.AllCourseDTO
;
import
org.rcisoft.business.blesson.dto.AddLessonDTO
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.dto.FindAllLessonDTO
;
import
org.rcisoft.business.blesson.dto.FirstPageQueryDTO
;
import
org.rcisoft.business.blesson.dto.*
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -56,7 +50,7 @@ public interface BLessonService{
* @param
* @return
*/
List
<
BLesson
>
queryPersonMoreByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
);
List
<
BLesson
>
queryPersonMoreByPagination
(
PageUtil
pageUtil
);
/**
* 分页查找推荐
...
...
@@ -64,7 +58,7 @@ public interface BLessonService{
* @param
* @return
*/
List
<
BLesson
>
queryRecommendByPagination
(
PageUtil
pageUtil
,
String
userId
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
);
List
<
BLesson
>
queryRecommendByPagination
(
PageUtil
pageUtil
,
String
userId
);
/**
* 分页查找最受关注
...
...
@@ -72,7 +66,7 @@ public interface BLessonService{
* @param
* @return
*/
List
<
BLesson
>
queryConcernByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
);
List
<
BLesson
>
queryConcernByPagination
(
PageUtil
pageUtil
);
/**
* 分页查找可能感兴趣的
...
...
@@ -80,7 +74,7 @@ public interface BLessonService{
* @param
* @return
*/
List
<
BLesson
>
queryInterestedByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
);
List
<
BLesson
>
queryInterestedByPagination
(
PageUtil
pageUtil
);
/**
* 插入
...
...
@@ -90,16 +84,31 @@ public interface BLessonService{
PersistModel
persist
(
AddLessonDTO
model
);
/**
*
课程信息excel导入
* @param
hwb
*
逻辑删除
* @param
id
* @return
*/
PersistModel
importExcel
(
HSSFWorkbook
hwb
)
throws
IOException
;
PersistModel
removeBLesson
(
String
id
)
;
/**
* 逻辑删除
* 首页条件查询全部课程
* @return
*/
List
<
BLesson
>
queryHomeBLessonsByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
);
/**
* 关闭课程
* @param id
* @return
*/
PersistModel
removeBLesson
(
String
id
);
PersistModel
closeBLesson
(
String
id
);
/**
* 课程培训条件查询
* @param pageUtil
* @param lessonTrainDTO
* @return
*/
List
<
BLesson
>
findLessonTrain
(
PageUtil
pageUtil
,
LessonTrainDTO
lessonTrainDTO
);
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
b2895e00
...
...
@@ -7,10 +7,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import
org.rcisoft.business.bcourse.dao.BCourseRepository
;
import
org.rcisoft.business.bcourse.dto.AllCourseDTO
;
import
org.rcisoft.business.blesson.dao.BLessonRepository
;
import
org.rcisoft.business.blesson.dto.AddLessonDTO
;
import
org.rcisoft.business.blesson.dto.BLessonIPublishDTO
;
import
org.rcisoft.business.blesson.dto.FindAllLessonDTO
;
import
org.rcisoft.business.blesson.dto.FirstPageQueryDTO
;
import
org.rcisoft.business.blesson.dto.*
;
import
org.rcisoft.business.blesson.entity.BLesson
;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.business.blesson.entity.BLessonLabel
;
...
...
@@ -18,10 +15,7 @@ import org.rcisoft.business.blesson.util.recursion;
import
org.rcisoft.common.component.Global
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.exception.ServiceException
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.ExcelUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -29,7 +23,6 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -80,38 +73,21 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public
List
<
BLesson
>
queryPersonMoreByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
)
{
List
<
String
>
sonCourseIds
=
null
;
if
(
allCourse
!=
null
){
sonCourseIds
=
recursion
.
FindSons
(
firstPageQueryDTO
.
getCourseLevelOne
(),
allCourse
);
}
return
bLessonRepository
.
queryPersonMore
(
firstPageQueryDTO
,
sonCourseIds
);
public
List
<
BLesson
>
queryPersonMoreByPagination
(
PageUtil
pageUtil
)
{
return
bLessonRepository
.
queryPersonMore
();
}
@Override
public
List
<
BLesson
>
queryRecommendByPagination
(
PageUtil
pageUtil
,
String
userId
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
)
{
List
<
String
>
sonCourseIds
=
null
;
if
(
allCourse
!=
null
){
sonCourseIds
=
recursion
.
FindSons
(
firstPageQueryDTO
.
getCourseLevelOne
(),
allCourse
);
}
return
bLessonRepository
.
queryRecommend
(
userId
,
firstPageQueryDTO
,
sonCourseIds
);
public
List
<
BLesson
>
queryRecommendByPagination
(
PageUtil
pageUtil
,
String
userId
)
{
return
bLessonRepository
.
queryRecommend
(
userId
);
}
@Override
public
List
<
BLesson
>
queryConcernByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
)
{
List
<
String
>
sonCourseIds
=
null
;
if
(
allCourse
!=
null
){
sonCourseIds
=
recursion
.
FindSons
(
firstPageQueryDTO
.
getCourseLevelOne
(),
allCourse
);
}
return
bLessonRepository
.
queryConcern
(
firstPageQueryDTO
,
sonCourseIds
);
public
List
<
BLesson
>
queryConcernByPagination
(
PageUtil
pageUtil
)
{
return
bLessonRepository
.
queryConcern
();
}
@Override
public
List
<
BLesson
>
queryInterestedByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
)
{
List
<
String
>
sonCourseIds
=
null
;
if
(
allCourse
!=
null
){
sonCourseIds
=
recursion
.
FindSons
(
firstPageQueryDTO
.
getCourseLevelOne
(),
allCourse
);
}
return
bLessonRepository
.
queryInterested
(
firstPageQueryDTO
,
sonCourseIds
);
public
List
<
BLesson
>
queryInterestedByPagination
(
PageUtil
pageUtil
)
{
return
bLessonRepository
.
queryInterested
();
}
...
...
@@ -176,118 +152,6 @@ public class BLessonServiceImpl implements BLessonService {
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
PersistModel
importExcel
(
HSSFWorkbook
hwb
)
throws
IOException
{
ArrayList
<
BLesson
>
lessons
=
new
ArrayList
<
BLesson
>();
ArrayList
<
String
>
repeatCode
=
new
ArrayList
<
String
>();
List
<
String
>
errorCode
=
new
ArrayList
<>();
ArrayList
<
String
>
direction
=
new
ArrayList
<
String
>();
List
<
String
>
isChinese
=
new
ArrayList
<>();
List
<
String
>
isNegative
=
new
ArrayList
<>();
List
<
String
>
currentlyCode
=
new
ArrayList
<>();
String
innerRepeatResult
=
""
;
String
[]
headers
=
{
"课程编号"
,
"课程名称"
,
"课程方向编号"
,
"学时"
,
"学分"
};
ArrayList
<
String
[]>
values
=
ExcelUtil
.
importExcel
(
hwb
,
headers
,
false
,
1
);
//获取excel数据
if
(
values
.
size
()<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
);
}
// for(String[] value:values){ //将数据封装到entity
// BLesson bLesson = null;
// String classCode = value[0];
//
// //判断编号是否含有中文
// if(TestChinese.isChinese(classCode)){
// isChinese.add(value[0]);
// continue;
// };
//
// //判断1:班级编号是否满足<15位;
// if(classCode.length()>15){
// //该用户不满足要求,记入valuesShort中
// errorCode.add(value[0]);
// continue;
// }
//
// if(Integer.parseInt(value[4])<0||Integer.parseInt(value[3])<0){
// //该用户不满足要求,记入valuesShort中
// isNegative.add(value[0]);
// continue;
// }
// if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) {
// repeatCode.add(value[0]);
// continue;
// }
// BDirection b_direction = bDirectionRepository.selectOne(new BDirection(value[2]));
// if (b_direction == null) {
// if (!direction.contains(value[2]))
// direction.add(value[2]);
// continue;
// }
// bLesson= new BLesson(value[0],value[1],value[3],value[4]);
// bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
// UserUtil.setCurrentPersistOperation(bLesson);
// //表中去重
// if(currentlyCode.contains(bLesson.getCode())){
// innerRepeatResult += "编号 " + value[1] + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
// continue;
// }
// if(!lessons.contains(bLesson)){
// currentlyCode.add(bLesson.getCode());
// lessons.add(bLesson);
//
// BLessonDirection bDirection = new BLessonDirection();
// bDirection.setDirectionId(b_direction.getBusinessId());
// bDirection.setBusinessId(IdGen.uuid());
// bDirection.setLessionId(bLesson.getBusinessId());
// bDirectionRepository.insertBLessonDirection(bDirection);
// }
// }
String
result
=
""
;
if
(
lessons
.
size
()>
0
){
int
line
=
bLessonRepository
.
insertList
(
lessons
);
if
(
line
>
0
)
{
result
+=
"成功导入"
+
lessons
.
size
()+
"门课程。"
;
}
else
{
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DB_INSERT_ERROR
);
}
}
if
(
isNegative
.
size
()>
0
){
result
+=
"以下课程的学时或学分不能为负数:"
+
JSON
.
toJSONString
(
isNegative
)+
"。"
;
}
if
(
isChinese
.
size
()>
0
){
result
+=
"以下编号格式不正确:"
+
JSON
.
toJSONString
(
isChinese
)+
"。"
;
}
if
(
repeatCode
.
size
()>
0
){
result
+=
"以下课程编号存在重复:"
+
JSON
.
toJSONString
(
repeatCode
)+
"。"
;
}
if
(
errorCode
.
size
()>
0
){
result
+=
"以下课程编号超过15位:"
+
JSON
.
toJSONString
(
errorCode
)+
"。"
;
}
if
(
direction
.
size
()>
0
){
result
+=
"以下课程方向编号不存在:"
+
JSON
.
toJSONString
(
direction
)+
"。"
;
}
if
(
lessons
.
size
()<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
EXCEL_IMPORT_DATA_NOT_EXIST
.
getCode
(),
result
);
}
return
new
PersistModel
(
1
,
result
+
innerRepeatResult
);
}
public
PersistModel
importPic
(
HSSFWorkbook
hwb
)
throws
IOException
{
return
null
;
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
public
PersistModel
removeBLesson
(
String
id
)
{
...
...
@@ -307,6 +171,30 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public
List
<
BLesson
>
queryHomeBLessonsByPagination
(
PageUtil
pageUtil
,
FirstPageQueryDTO
firstPageQueryDTO
,
List
<
AllCourseDTO
>
allCourse
)
{
List
<
String
>
sonCourseIds
=
null
;
if
(
allCourse
!=
null
){
sonCourseIds
=
recursion
.
FindSons
(
firstPageQueryDTO
.
getCourseLevelOne
(),
allCourse
);
}
return
bLessonRepository
.
queryHomeBLesson
(
firstPageQueryDTO
,
sonCourseIds
);
}
@Override
public
PersistModel
closeBLesson
(
String
id
)
{
BLesson
bLesson
=
new
BLesson
();
bLesson
.
setBusinessId
(
id
);
UserUtil
.
setCurrentMergeOperation
(
bLesson
);
int
line
=
bLessonRepository
.
closeLesson
(
bLesson
);
//int line = bLessonRepository.deleteByPrimaryKey(id);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
@Override
public
List
<
BLesson
>
findLessonTrain
(
PageUtil
pageUtil
,
LessonTrainDTO
lessonTrainDTO
)
{
return
null
;
}
private
Map
<
String
,
Object
>
queryParamHandler
(
BLesson
model
){
Map
param
=
new
HashMap
<
String
,
Object
>();
if
(
model
.
getLessonName
()!=
null
)
...
...
src/main/java/org/rcisoft/business/blessonperson/controller/BLessonPersonController.java
View file @
b2895e00
package
org
.
rcisoft
.
business
.
blessonperson
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.validation.Valid
;
@Api
(
tags
=
"9 学生-课程"
)
@RestController
@RequestMapping
(
"/BLessonPerson"
)
@Slf4j
...
...
@@ -32,7 +34,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
@Autowired
private
BLessonPersonService
bLessonPersonService
;
@ApiOperation
(
value
=
"退出课程"
,
notes
=
"根据ID停用一条记录"
)
@ApiOperation
(
value
=
"
901
退出课程"
,
notes
=
"根据ID停用一条记录"
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"退出课程的选课id"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/quit"
)
public
Result
remove
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
...
...
@@ -43,7 +45,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
businessId
);
}
@ApiOperation
(
value
=
"分页查询我学习"
,
notes
=
"分页查询我学习"
)
@ApiOperation
(
value
=
"
902
分页查询我学习"
,
notes
=
"分页查询我学习"
)
@GetMapping
(
value
=
"/queryLearnBLessonsByPagination"
)
public
Result
queryLearnBLessonsByPagination
(
CurUser
curUser
,
@Valid
ILearnLessonDTO
param
,
BindingResult
bindingResult
)
{
String
userId
=
curUser
.
getUserId
();
...
...
src/main/java/org/rcisoft/business/blessonperson/dao/BLessonPersonRepository.java
View file @
b2895e00
...
...
@@ -25,7 +25,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
" where blp.del_flag != 1 and blp.flag = 1 "
+
" and bl.del_flag != 1 and bl.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and bl.release_state = '2' and blp.person_id = #{userId} "
+
// " and bl.release_state = '2' " +
" and blp.person_id = #{userId} "
+
" <if test= \" param.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> "
+
" <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> "
+
" order by blp.update_date desc</script>"
)
...
...
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