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
bfc6e277
Commit
bfc6e277
authored
Nov 07, 2019
by
王淑君
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/meiteng' into meiteng
parents
512de1bb
8b029b71
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
381 additions
and
141 deletions
+381
-141
BChapterRepository.java
...org/rcisoft/business/bchapter/dao/BChapterRepository.java
+5
-2
ChapterDTO.java
...in/java/org/rcisoft/business/bchapter/dto/ChapterDTO.java
+1
-1
BChapterServiceImpl.java
...t/business/bchapter/service/impl/BChapterServiceImpl.java
+25
-12
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+12
-1
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+44
-23
BLessonRepository.java
...a/org/rcisoft/business/blesson/dao/BLessonRepository.java
+23
-10
FindListLessonDTO.java
...a/org/rcisoft/business/blesson/dto/FindListLessonDTO.java
+1
-1
StudentTrackingChartDTO.java
...rcisoft/business/blesson/dto/StudentTrackingChartDTO.java
+2
-2
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+4
-0
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+3
-0
BLessonPersonServiceImpl.java
...siness/blesson/service/impl/BLessonPersonServiceImpl.java
+22
-15
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+156
-52
BMaterialController.java
...ft/business/bmaterial/controller/BMaterialController.java
+1
-1
BMaterialRepository.java
...g/rcisoft/business/bmaterial/dao/BMaterialRepository.java
+18
-7
DelMoreDTO.java
...n/java/org/rcisoft/business/bmaterial/dto/DelMoreDTO.java
+2
-0
BMaterialServiceImpl.java
...business/bmaterial/service/impl/BMaterialServiceImpl.java
+7
-0
GetSubUserIdsByDeptIdsReqDTO.java
...ft/common/util/feignDto/GetSubUserIdsByDeptIdsReqDTO.java
+1
-1
MTCotactApiRequestClient.java
...isoft/common/util/outClient/MTCotactApiRequestClient.java
+3
-2
MvcConfig.java
src/main/java/org/rcisoft/config/MvcConfig.java
+2
-2
ServiceException.java
...ain/java/org/rcisoft/core/exception/ServiceException.java
+2
-0
Result.java
src/main/java/org/rcisoft/core/result/Result.java
+15
-0
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+3
-0
SysUserMapper.java
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
+1
-1
SysUserServiceImpl.java
...org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
+22
-8
application-mt.yml
src/main/resources/application-mt.yml
+3
-0
application-prod.yml
src/main/resources/application-prod.yml
+3
-0
No files found.
src/main/java/org/rcisoft/business/bchapter/dao/BChapterRepository.java
View file @
bfc6e277
...
...
@@ -404,7 +404,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
@Select
(
"select lesson_id from b_chapter where business_id = #{businessId}"
)
String
getLessonIdBychaperId
(
@Param
(
"businessId"
)
String
businessId
);
@Update
(
"delete from b_r_student_chapter where chapter_id = #{chapterId} and student_id = #{uid} "
)
int
deleteStudentChapter
(
@Param
(
"chapterId"
)
String
chapterId
,
@Param
(
"uid"
)
String
uid
);
@Delete
(
"delete from b_r_student_chapter where chapter_id = #{chapterId} and student_id = #{uid} "
)
int
deleteBStudentChapter
(
@Param
(
"chapterId"
)
String
chapterId
,
@Param
(
"uid"
)
String
uid
);
@Select
(
"select count(0) from b_chapter where lesson_id = #{lessonId} and chapter_level = 2 and del_flag != 1 and flag =1"
)
int
getlessonHours
(
@Param
(
"lessonId"
)
String
lessonId
);
}
src/main/java/org/rcisoft/business/bchapter/dto/ChapterDTO.java
View file @
bfc6e277
...
...
@@ -8,7 +8,7 @@ import lombok.Data;
@Data
public
class
ChapterDTO
{
@ApiModelProperty
(
value
=
"
课程
id 修改章节时传入"
)
@ApiModelProperty
(
value
=
"
章节
id 修改章节时传入"
)
private
String
businessId
;
@ApiModelProperty
(
value
=
"课程ID"
)
...
...
src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
View file @
bfc6e277
...
...
@@ -154,17 +154,22 @@ public class BChapterServiceImpl implements BChapterService {
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
//判断课程是否被关闭
if
(
"4"
.
equals
(
bLesson
.
getReleaseState
())){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_CLOSED
);
}
//
//判断课程是否被关闭
//
if ("4".equals(bLesson.getReleaseState())){
//
throw new ServiceException(ResultServiceEnums.LESSON_CLOSED);
//
}
//判断该登录人是否可见该课程
List
<
String
>
ids
=
Arrays
.
asList
(
new
String
[]{
curUser
.
getUserId
()});
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
mtCotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
int
result
=
bLessonRepository
.
isInViewRange
(
curUser
,
lessonId
,
departs
);
if
(
result
<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
NO_ACCESS
);
...
...
@@ -295,18 +300,19 @@ public class BChapterServiceImpl implements BChapterService {
UserUtil
.
setCurrentMergeOperation
(
model
);
bFile
.
setChapterId
(
model
.
getBusinessId
());
UserUtil
.
setCurrentMergeOperation
(
bFile
);
model
.
setCourseTime
(
dto
.
getFileTime
());
model
.
setIsTest
(
dto
.
getType
());
if
(
StringUtils
.
isNotEmpty
(
dto
.
getFileTime
())
&&
dto
.
getFileTime
().
contains
(
"."
))
{
model
.
setCourseTime
(
dto
.
getFileTime
().
substring
(
0
,
dto
.
getFileTime
().
lastIndexOf
(
"."
)));
bFile
.
setFileTime
(
dto
.
getFileTime
().
substring
(
0
,
dto
.
getFileTime
().
lastIndexOf
(
"."
)));
}
//先判断该课程的第一节是否是本节 更新blesson表中course_time字段
String
cid
=
bChapterRepository
.
getFirstChapter
(
model
.
getLessonId
());
log
.
debug
(
"--------------------------------第一节id--------:"
+
cid
);
log
.
debug
(
"------------------------------当前章节id--------:"
+
model
.
getBusinessId
());
if
(
model
.
getBusinessId
().
equals
(
cid
))
{
bChapterRepository
.
updateVideoTimeInLesson
(
model
.
getCourseTime
(),
model
.
getLessonId
());
int
linex
=
bChapterRepository
.
updateVideoTimeInLesson
(
model
.
getCourseTime
(),
model
.
getLessonId
());
log
.
debug
(
"----------------------更新lesson表中第一节时长--"
+(
linex
==
0
?
"失败"
:
"成功"
)+
"----------"
);
log
.
debug
(
"--------------------------时长-----------:"
+
model
.
getCourseTime
());
}
line
=
bChapterRepository
.
updateByPrimaryKeySelective
(
model
);
...
...
@@ -333,6 +339,7 @@ public class BChapterServiceImpl implements BChapterService {
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
lessonPerson
);
studentChapter
.
setProgress
(
0
);
brStudentChapterRepository
.
updateById
(
studentChapter
);
}
}
}
...
...
@@ -405,15 +412,21 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
removeBChapter
(
String
id
,
String
userId
)
{
BChapter
bChapter
=
bChapterRepository
.
selectByPrimaryKey
(
id
);
String
lessonId
=
bChapterRepository
.
getLessonIdBychaperId
(
id
);
if
(
bChapter
==
null
)
throw
new
ServiceException
(
ResultServiceEnums
.
CHAPTER_NOT_EXISTS
);
int
chapterCount
=
bChapterRepository
.
getlessonHours
(
lessonId
);
BLesson
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
lessonId
);
if
(
"2"
.
equals
(
bLesson
.
getReleaseState
())
&&
chapterCount
==
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
CHAPTER_ONLY_ONE
);
}
List
<
QueryChapterListResDTO
>
childList
=
bChapterRepository
.
queryBChaptersByPid
(
id
);
boolean
hasChild
=
childList
!=
null
&&
childList
.
size
()
>
0
;
boolean
isChapter
=
bChapter
.
getChapterLevel
()
==
ChapterLevelEnum
.
CHAPTER
.
getCode
();
if
(
isChapter
&&
hasChild
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
CHAPTER_HAS_CHILD
);
}
String
lessonId
=
bChapterRepository
.
getLessonIdBychaperId
(
id
);
//获取第一节课的id 与当前id对比
String
firstId
=
bChapterRepository
.
getFirstChapter
(
lessonId
);
int
line
=
bChapterRepository
.
removeByPrimaryKey
(
id
);
...
...
@@ -423,11 +436,11 @@ public class BChapterServiceImpl implements BChapterService {
String
secondId
=
bChapterRepository
.
getFirstChapter
(
lessonId
);
String
time
=
bChapterRepository
.
getTimeByChapterId
(
secondId
);
//更新到b_lesson 表
bChapterRepository
.
update
CourseTimeFor
Lesson
(
time
,
lessonId
);
bChapterRepository
.
update
VideoTimeIn
Lesson
(
time
,
lessonId
);
// 更新学生 对应章节总进度
this
.
updateLessonProgress
(
lessonId
,
false
);
//删除student_chapter表中数据
bChapterRepository
.
deleteStudentChapter
(
id
,
userId
);
bChapterRepository
.
delete
B
StudentChapter
(
id
,
userId
);
}
return
new
PersistModel
(
line
);
...
...
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
bfc6e277
...
...
@@ -565,7 +565,7 @@ public class BLessonController extends PaginationController<BLesson> {
}
@ApiOperation
(
value
=
"634
单一查询指派人员"
,
notes
=
"单一
查询指派人员"
,
response
=
SysUser
.
class
)
@ApiOperation
(
value
=
"634
查询指派人员"
,
notes
=
"
查询指派人员"
,
response
=
SysUser
.
class
)
@ApiImplicitParam
(
name
=
"lessonId"
,
value
=
"培训/课程id"
,
required
=
true
,
dataType
=
"varchar"
)
@GetMapping
(
value
=
"/findAppointPerson"
)
public
Result
findAppointPerson
(
CurUser
curUser
,
String
lessonId
)
{
...
...
@@ -624,4 +624,15 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService
.
getLessonState
(
lessonId
));
}
@ApiOperation
(
value
=
"639 判断可见权限 "
,
notes
=
"判断可见权限 "
)
@PostMapping
(
value
=
"/judgeVisibleAuthority"
)
public
Result
judgeVisibleAuthority
(
CurUser
curUser
,
@Valid
String
lessonId
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bLessonService
.
judgeVisibleAuthority
(
curUser
,
lessonId
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
lessonId
);
}
}
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
bfc6e277
...
...
@@ -54,28 +54,40 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select
(
"<script> select "
+
"(select lesson_name from b_lesson where business_id = #{param.lessonId}) LessonTitle, "
+
"(select count(*) from b_lesson_person where "
+
" del_flag != 1 and flag = 1 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and is_appoint = #{param.isAppoint} </if> "
+
" and lesson_id = #{param.lessonId}) countAll, "
+
"(select count(*) from b_lesson_person where "
+
" del_flag != 1 and flag = 1 "
+
" and is_finish = 0 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and is_appoint = #{param.isAppoint} </if> "
+
" and lesson_id = #{param.lessonId}) countNotStart, "
+
"(select count(*) from b_lesson_person where "
+
" del_flag != 1 and flag = 1 "
+
" and is_finish = 1 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and is_appoint = #{param.isAppoint} </if> "
+
" and lesson_id = #{param.lessonId}) countOngoing, "
+
"(select count(*) from b_lesson_person where "
+
" del_flag != 1 and flag = 1 "
+
" and is_finish = 2 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and is_appoint = #{param.isAppoint} </if> "
+
" and lesson_id = #{param.lessonId}) countFinish"
+
"(select count(*) from b_lesson_person blp "
+
" left join s_user su on blp.person_id = su.business_id "
+
" where "
+
" blp.del_flag != 1 and blp.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> "
+
" and blp.lesson_id = #{param.lessonId}) countAll, "
+
"(select count(*) from b_lesson_person blp "
+
" left join s_user su on blp.person_id = su.business_id "
+
" where "
+
" blp.del_flag != 1 and blp.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and blp.is_finish = 0 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> "
+
" and blp.lesson_id = #{param.lessonId}) countNotStart, "
+
"(select count(*) from b_lesson_person blp "
+
" left join s_user su on blp.person_id = su.business_id "
+
" where "
+
" blp.del_flag != 1 and blp.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and blp.is_finish = 1 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> "
+
" and blp.lesson_id = #{param.lessonId}) countOngoing, "
+
"(select count(*) from b_lesson_person blp "
+
" left join s_user su on blp.person_id = su.business_id "
+
" where "
+
" blp.del_flag != 1 and blp.flag = 1 "
+
" and su.del_flag != 1 and su.flag = 1 "
+
" and blp.is_finish = 2 "
+
" <if test= \" param.isAppoint != null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> "
+
" and blp.lesson_id = #{param.lessonId}) countFinish"
+
" </script>"
)
StudentTrackingChartRspDTO
studentTrackingChart
(
@Param
(
"param"
)
StudentTrackingChartDTO
param
);
...
...
@@ -279,6 +291,15 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId} and del_flag != 1 "
)
@ResultMap
(
value
=
"BaseResultMap"
)
BLessonPerson
getAppointInTraining
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"personId"
)
String
personId
);
/**
* 查询该用户在此培训中包含删除的状态
* @param lessonId
* @param personId
* @return
*/
@Select
(
"select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId} "
)
@ResultMap
(
value
=
"BaseResultMap"
)
BLessonPerson
getRelInBLessonPerson
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"personId"
)
String
personId
);
@Select
(
"<script>select * "
+
...
...
@@ -303,7 +324,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select
(
"select count(0) x ,(select max_apply_person from b_lesson where business_id = #{lessonId} ) y "
+
"from b_lesson_person where lesson_id = #{lessonId} "
)
"from b_lesson_person where
del_flag='0' and flag = '1' and
lesson_id = #{lessonId} "
)
Map
<
String
,
Object
>
selecTraningNum
(
@Param
(
"lessonId"
)
String
lessonId
);
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
View file @
bfc6e277
...
...
@@ -591,29 +591,37 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" select "
+
"(select COUNT(1) from b_lesson_person blp "
+
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id "
+
" left join s_user su on blp.person_id = su.business_id "
+
" 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.lesson_type = 1 "
+
" and blp.lesson_id = #{lessonId} and blp.train_is_sign is not null ) learnAllCount, "
+
"(select COUNT(1) from b_lesson_person blp "
+
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id "
+
" left join s_user su on blp.person_id = su.business_id "
+
" 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.lesson_type = 1 "
+
" and blp.lesson_id = #{lessonId} and blp.train_is_sign = '2') finishCount, "
+
"(select COUNT(1) from b_lesson_person blp "
+
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id "
+
" left join s_user su on blp.person_id = su.business_id "
+
" 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.lesson_type = 1 "
+
" and blp.lesson_id = #{lessonId} and blp.train_is_sign = '1') notFinishCount, "
+
"(select COUNT(1) from b_lesson_person blp "
+
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id "
+
" left join s_user su on blp.person_id = su.business_id "
+
" 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.lesson_type = 1 "
+
" and blp.lesson_id = #{lessonId} and blp.train_is_sign = '0') notStartCount "
+
"</script>"
})
...
...
@@ -624,16 +632,19 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @param lessonId
* @return
*/
@Update
(
"<script>update b_lesson set person_number = "
+
"(select count(1) from b_lesson_person where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" and is_finish != 0 "
+
" and lesson_id = #{lessonId})"
+
@Update
(
"<script>update b_lesson a set a.person_number = ("
+
"select b.bc from (select count(1) bc from b_lesson_person blp "
+
" left join b_lesson bl on blp.lesson_id = bl.business_id "
+
" where 1=1 "
+
" and blp.del_flag != 1 and blp.flag = 1 "
+
" and bl.lesson_type = #{type}"
+
" <if test=\"type!=null and type != '' and type == '0'\">and blp.is_finish != 0 </if>"
+
" and blp.lesson_id = #{lessonId}) as b )"
+
" where business_id = #{lessonId} </script>"
)
int
personNumberReCount
(
String
lessonId
);
int
personNumberReCount
(
@Param
(
"lessonId"
)
String
lessonId
,
@Param
(
"type"
)
String
lessonType
);
/**
*
重新统计
在学人数
* 在学人数
* @param lessonId
* @return
*/
...
...
@@ -991,7 +1002,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
List
<
BRecommend
>
queryRecommendByLessonId
(
@Param
(
"corpId"
)
String
corpId
,
@Param
(
"lessonId"
)
String
lessonId
);
@Select
(
"<script>select
bl.*, blp.business_id lessonPersonId,
"
+
@Select
(
"<script>select
distinct bl.*,
"
+
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate ,"
+
"CONCAT( "
+
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), "
+
...
...
@@ -1015,7 +1026,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap
(
value
=
"TrainBaseResultMap"
)
BLesson
findOneMyTrain
(
@Param
(
"curUser"
)
CurUser
curUser
,
@Param
(
"lessonId"
)
String
lessonId
);
@Select
(
"<script>select bl.*,"
+
@Select
(
"<script>select
distinct
bl.*,"
+
"CONCAT( "
+
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), "
+
"IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), "
+
...
...
@@ -1049,8 +1060,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
/**
* 分页查询我收藏
*/
@Select
(
"<script>select
*
from b_lesson bl "
+
@Select
(
"<script>select
bl.*,su.name lecturerName, suc.name createByName
from b_lesson bl "
+
"left join b_collect bc on bl.business_id = bc.lesson_id "
+
"left join s_user su on bl.lecturer_id = su.business_id "
+
"left join s_user suc on bl.create_by = suc.business_id "
+
"where 1=1 "
+
"and bl.del_flag = 0 and bl.flag = 1 "
+
"and bl.corp_id = #{curUser.corpId} "
+
...
...
src/main/java/org/rcisoft/business/blesson/dto/FindListLessonDTO.java
View file @
bfc6e277
...
...
@@ -21,13 +21,13 @@ public class FindListLessonDTO {
private
String
labelId
;
@ApiModelProperty
(
value
=
"发布时间排序(1升序 0降序)"
,
required
=
true
)
@NotNull
private
String
releaseDateSort
;
@ApiModelProperty
(
value
=
"课程类型 0 课程 1 培训"
)
private
String
lessonType
;
@ApiModelProperty
(
value
=
"查询类型 0 全部 1 推荐 2在学 3收藏 4兴趣"
,
required
=
true
)
@NotNull
private
String
searchType
;
private
List
<
String
>
courseIds
;
...
...
src/main/java/org/rcisoft/business/blesson/dto/StudentTrackingChartDTO.java
View file @
bfc6e277
...
...
@@ -9,8 +9,8 @@ public class StudentTrackingChartDTO {
@ApiModelProperty
(
value
=
"课程Id"
,
required
=
false
)
private
String
lessonId
;
@ApiModelProperty
(
value
=
"课程来源(是否为指派,0自选(选修) 1指派(必修))"
,
required
=
false
)
private
String
isAppoint
;
//
@ApiModelProperty(value = "课程来源(是否为指派,0自选(选修) 1指派(必修))",required = false)
//
private String isAppoint;
private
String
userId
;
...
...
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
bfc6e277
...
...
@@ -241,6 +241,10 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private
Date
applyDate
;
@ApiModelProperty
(
value
=
"讲师部门"
)
@Transient
private
String
lecturerDeptName
;
public
void
initModel
(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil
.
setCurrentPersistOperation
(
this
);
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
bfc6e277
...
...
@@ -284,4 +284,7 @@ public interface BLessonService{
*/
List
<
BLesson
>
queryCollectByPagination
(
PageUtil
pageUtil
,
String
lessonType
,
CurUser
curUser
);
PersistModel
judgeVisibleAuthority
(
CurUser
curUser
,
String
lessonId
);
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonPersonServiceImpl.java
View file @
bfc6e277
...
...
@@ -58,6 +58,9 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Override
public
PersistModel
quit
(
QuitLessonDTO
quitLessonDTO
)
{
BLessonPerson
bLessonPerson
=
bLessonPersonRepository
.
selectById
(
quitLessonDTO
.
getBusinessId
());
BLesson
bLesson
=
new
BLesson
();
bLesson
.
setBusinessId
(
quitLessonDTO
.
getLessonId
());
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
bLesson
);
if
(
"1"
.
equals
(
bLessonPerson
.
getIsAppoint
())){
throw
new
ServiceException
(
ResultServiceEnums
.
APPOINT_NOT_CLOSE
);
}
...
...
@@ -66,7 +69,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// int line = bLessonPersonRepository.quit(quitLessonDTO.getBusinessId());
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
quitLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
quitLessonDTO
.
getLessonId
()
,
bLesson
.
getLessonType
()
);
return
new
PersistModel
(
line
);
}
...
...
@@ -92,27 +95,31 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
});
studentTrackingDTO
.
setUserIdsInDepart
(
userIdsInDepart
);
}
}
if
(
studentTrackingDTO
.
getUserIdsInDepart
()
==
null
||
studentTrackingDTO
.
getUserIdsInDepart
().
size
()
<
1
){
return
new
ArrayList
<>();
if
(
studentTrackingDTO
.
getUserIdsInDepart
()
==
null
||
studentTrackingDTO
.
getUserIdsInDepart
().
size
()
<
1
){
return
new
ArrayList
<>();
}
}
List
<
StudentTrackingRspDTO
>
studentTrackingRspDTOs
=
bLessonPersonRepository
.
studentTrackingByPagination
(
studentTrackingDTO
);
List
<
String
>
uids
=
new
ArrayList
<>();
studentTrackingRspDTOs
.
forEach
(
studentTrackingRspDTO
->{
uids
.
add
(
studentTrackingRspDTO
.
getPersonId
());
});
if
(
studentTrackingRspDTOs
!=
null
&&
studentTrackingRspDTOs
.
size
()
>
0
){
studentTrackingRspDTOs
.
forEach
(
studentTrackingRspDTO
->{
uids
.
add
(
studentTrackingRspDTO
.
getPersonId
());
});
}
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
studentTrackingDTO
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
uids
);
//遍历获取部门名
List
<
MTUserInfoRspDTO
>
departs
=
mtCotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
studentTrackingRspDTOs
.
forEach
(
studentTrackingRspDTO
->
{
departs
.
forEach
(
depart
->{
if
(
studentTrackingRspDTO
.
getPersonId
().
equals
(
depart
.
getId
())){
studentTrackingRspDTO
.
setDepartName
(
depart
.
getDepts
().
get
(
0
).
getName
());
}
if
(
departs
!=
null
&&
departs
.
size
()
>
0
){
studentTrackingRspDTOs
.
forEach
(
studentTrackingRspDTO
->
{
departs
.
forEach
(
depart
->{
if
(
studentTrackingRspDTO
.
getPersonId
().
equals
(
depart
.
getId
())){
studentTrackingRspDTO
.
setDepartName
(
depart
.
getDepts
().
get
(
0
).
getName
());
}
});
});
}
);
}
return
studentTrackingRspDTOs
;
}
...
...
@@ -182,7 +189,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson
.
setIsFinish
(
"1"
);
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
()
,
"0"
);
return
new
PersistModel
(
line
);
}
if
(
bLessonPersons
==
null
||
bLessonPersons
.
size
()
<
1
){
//未指派
...
...
@@ -203,7 +210,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson
.
setPersonId
(
addMyLearnLessonDTO
.
getUserId
());
line
=
bLessonPersonRepository
.
insertBLessonPerson
(
bLessonPerson
);
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
()
,
"0"
);
return
new
PersistModel
(
line
);
}
// if (bLessonPersons != null && bLessonPersons.size()>0){
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
bfc6e277
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.business.bchapter.dao.BChapterRepository
;
import
org.rcisoft.business.bcourse.dao.BCourseRepository
;
import
org.rcisoft.business.bcourse.dto.AllCourseDTO
;
import
org.rcisoft.business.bfile.dao.BTrainFileRepository
;
...
...
@@ -83,6 +84,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
private
BMaterialRepository
bMaterialRepository
;
@Autowired
private
BChapterRepository
bChapterRepository
;
@Autowired
MTCotactApiRequestClient
cotactApiRequestClient
;
...
...
@@ -93,6 +97,21 @@ public class BLessonServiceImpl implements BLessonService {
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_LESSON_ERROR
);
}
//获取讲师部门
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
bLesson
.
getLecturerId
());
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
bLesson
.
getLecturerId
())){
//设置部门名
bLesson
.
setLecturerDeptName
(
mtUserInfoRspDTO
.
getDepts
().
get
(
0
).
getName
());
}
});
}
if
(
"1"
.
equals
(
bLesson
.
getLessonType
())){
List
<
BTrainFile
>
bTrainFileList
=
bTrainFileRepository
.
queryByLessonId
(
bLesson
.
getBusinessId
());
...
...
@@ -164,7 +183,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
//------------------------------
return
bLessonRepository
.
queryPersonMore
(
curUser
,
departs
);
}
...
...
@@ -178,7 +202,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
return
bLessonRepository
.
queryRecommend
(
curUser
,
departs
);
}
...
...
@@ -192,7 +221,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
//------------------------------
return
bLessonRepository
.
queryConcern
(
curUser
,
departs
);
}
...
...
@@ -207,7 +241,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
//------------------------------
return
bLessonRepository
.
queryInterested
(
curUser
,
departs
);
}
...
...
@@ -374,7 +413,7 @@ public class BLessonServiceImpl implements BLessonService {
}
bTrainFileRepository
.
insertTrainFileList
(
trainFileList
);
List
<
BMaterial
>
inBMaterialList
=
bMaterialRepository
.
materialHaveUrl
(
trainFileList
);
List
<
BMaterial
>
inBMaterialList
=
bMaterialRepository
.
materialHaveUrl
(
trainFileList
,
"1"
);
//遍历 移除已存在的文件 将已存在的文件放进List 中
if
(
bMaterialList
!=
null
&&
bMaterialList
.
size
()>
0
&&
inBMaterialList
!=
null
&&
inBMaterialList
.
size
()>
0
){
List
<
BMaterial
>
pubBMaterial
=
new
ArrayList
<>();
...
...
@@ -433,7 +472,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
firstPageQueryDTO
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
firstPageQueryDTO
.
setDeparts
(
departs
);
List
<
String
>
courseIds
=
null
;
if
(
allCourse
!=
null
)
{
...
...
@@ -464,6 +508,13 @@ public class BLessonServiceImpl implements BLessonService {
bLesson
.
setBusinessId
(
id
);
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
bLesson
);
if
(
"0"
.
equals
(
bLesson
.
getLessonType
())
&&
bChapterRepository
.
getlessonHours
(
id
)
==
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NO_CHAPTER
);
}
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_LESSON_ERROR
);
}
if
(!
"0"
.
equals
(
bLesson
.
getReleaseState
()))
{
throw
new
ServiceException
(
ResultServiceEnums
.
STATE_NOT_RELEASE
);
}
...
...
@@ -705,6 +756,7 @@ public class BLessonServiceImpl implements BLessonService {
}
//指派课程
line
=
bLessonPersonRepository
.
insertList
(
bLessonPersonOthers
);
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"0"
);
}
else
{
line
=
1
;
}
...
...
@@ -763,16 +815,18 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
param
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
bLessonPersonList
.
forEach
(
bLessonPerson
->{
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
bLessonPerson
.
getPersonId
())){
//设置部门名
bLessonPerson
.
setPersonName
(
mtUserInfoRspDTO
.
getName
());
bLessonPerson
.
setHeadPic
(
mtUserInfoRspDTO
.
getAvatar
());
bLessonPerson
.
setDepartName
(
mtUserInfoRspDTO
.
getDepts
().
get
(
0
).
getName
());
}
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
bLessonPersonList
.
forEach
(
bLessonPerson
->{
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
bLessonPerson
.
getPersonId
())){
//设置部门名
bLessonPerson
.
setPersonName
(
mtUserInfoRspDTO
.
getName
());
bLessonPerson
.
setHeadPic
(
mtUserInfoRspDTO
.
getAvatar
());
bLessonPerson
.
setDepartName
(
mtUserInfoRspDTO
.
getDepts
().
get
(
0
).
getName
());
}
});
});
}
);
}
}
return
bLessonPersonList
;
...
...
@@ -788,12 +842,17 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO
.
setCorpId
(
model
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
forEach
(
depart
->
{
if
(
StringUtils
.
isEmpty
(
depart
))
{
departs
.
remove
(
depart
);
}
});
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
// departs.forEach(depart -> {
// if (StringUtils.isEmpty(depart)) {
// departs.remove(depart);
// }
// });
//----------------------------
model
.
setDeparts
(
departs
);
List
<
String
>
courseIds
;
...
...
@@ -937,16 +996,9 @@ public class BLessonServiceImpl implements BLessonService {
//step 1 查询数 x 当前报名数 y 总数
synchronized
(
this
)
{
// Map<String, Object> xy = bLessonPersonRepository.selecTraningNum(lessonId);
//
// int x = Integer.parseInt(String.valueOf(xy.get("x")));
// int y = Integer.parseInt(String.valueOf(xy.get("y")));
// if (y > 0 && x >= y) {
// throw new ServiceException(ResultServiceEnums.PERSON_MAX);
// }
//step2 判断该用户是否被指派该培训或已经报名
person
=
bLessonPersonRepository
.
get
AppointInTraining
(
lessonId
,
curUser
.
getUserId
());
if
(
person
!=
null
)
{
person
=
bLessonPersonRepository
.
get
RelInBLessonPerson
(
lessonId
,
curUser
.
getUserId
());
if
(
person
!=
null
&&
!
"1"
.
equals
(
person
.
getDelFlag
())
)
{
if
(
"1"
.
equals
(
person
.
getIsApply
()))
{
log
.
info
(
"-----------该培训已报名-------------"
);
throw
new
ServiceException
(
ResultServiceEnums
.
TRAIN_APPLYED
);
...
...
@@ -955,22 +1007,29 @@ public class BLessonServiceImpl implements BLessonService {
person
.
setApplyDate
(
new
Date
());
person
.
setIsApply
(
"1"
);
return
bLessonPersonRepository
.
updateLessonPersonByUserId
(
person
);
}
else
{
List
<
BLessonPerson
>
bLessonPersons
=
new
ArrayList
<>();
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
bLessonPerson
.
setPersonId
(
curUser
.
getUserId
());
bLessonPerson
.
setLessonId
(
lessonId
);
bLessonPerson
.
setIsAppoint
(
"0"
);
bLessonPerson
.
setIsApply
(
"1"
);
bLessonPerson
.
setTrainIsSign
(
"0"
);
bLessonPerson
.
setApplyDate
(
new
Date
());
bLessonPerson
.
setRemarks
(
""
);
bLessonPersons
.
add
(
bLessonPerson
);
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
// int line = bLessonPersonRepository.insert(bLessonPerson);
int
line
=
trainInsert
(
"0"
,
bLesson
,
bLessonPersons
);
return
line
;
}
if
(
person
!=
null
&&
"1"
.
equals
(
person
.
getDelFlag
())){
UserUtil
.
setCurrentMergeOperation
(
person
);
person
.
setDelFlag
(
"0"
);
person
.
setIsApply
(
"1"
);
person
.
setApplyDate
(
new
Date
());
return
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
person
);
}
List
<
BLessonPerson
>
bLessonPersons
=
new
ArrayList
<>();
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
bLessonPerson
.
setPersonId
(
curUser
.
getUserId
());
bLessonPerson
.
setLessonId
(
lessonId
);
bLessonPerson
.
setIsAppoint
(
"0"
);
bLessonPerson
.
setIsApply
(
"1"
);
bLessonPerson
.
setTrainIsSign
(
"0"
);
bLessonPerson
.
setApplyDate
(
new
Date
());
bLessonPerson
.
setRemarks
(
""
);
bLessonPersons
.
add
(
bLessonPerson
);
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
// int line = bLessonPersonRepository.insert(bLessonPerson);
int
line
=
trainInsert
(
"0"
,
bLesson
,
bLessonPersons
);
return
line
;
}
}
...
...
@@ -1032,9 +1091,25 @@ public class BLessonServiceImpl implements BLessonService {
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
//获取讲师部门
List
<
String
>
ids
=
new
ArrayList
<>();
ids
.
add
(
bLesson
.
getLecturerId
());
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
bLesson
.
getLecturerId
())){
//设置部门名
bLesson
.
setLecturerDeptName
(
mtUserInfoRspDTO
.
getDepts
().
get
(
0
).
getName
());
}
});
}
//查询报名人数是否小于规定人数
int
trainApplyCount
=
bLessonRepository
.
trainApplyCount
(
bLesson
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
){
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
!
"0"
.
equals
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
){
bLesson
.
setApplyIsFull
(
"1"
);
}
else
{
bLesson
.
setApplyIsFull
(
"0"
);
...
...
@@ -1059,7 +1134,7 @@ public class BLessonServiceImpl implements BLessonService {
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
int
trainApplyCount
=
bLessonRepository
.
trainApplyCount
(
bLesson
.
getBusinessId
());
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
){
if
(
StringUtils
.
isNotEmpty
(
bLesson
.
getMaxApplyPerson
())
&&
!
"0"
.
equals
(
bLesson
.
getMaxApplyPerson
())
&&
trainApplyCount
>=
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
){
bLesson
.
setApplyIsFull
(
"1"
);
}
else
{
bLesson
.
setApplyIsFull
(
"0"
);
...
...
@@ -1094,6 +1169,31 @@ public class BLessonServiceImpl implements BLessonService {
return
bLessonRepository
.
selectMyCollect
(
lessonType
,
curUser
);
}
@Override
public
PersistModel
judgeVisibleAuthority
(
CurUser
curUser
,
String
lessonId
)
{
BLesson
bLesson
=
bLessonRepository
.
selectInfoById
(
lessonId
);
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NOT_EXISTA
);
}
List
<
String
>
ids
=
Arrays
.
asList
(
new
String
[]{
curUser
.
getUserId
()});
MTUserGetsReqDTO
mtUserGetsReqDTO
=
new
MTUserGetsReqDTO
();
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
cotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
List
<
String
>
departs
=
new
ArrayList
<>();
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
departs
=
QueryDepart
.
queryDepart
(
mtUserInfoRspDTOList
);
departs
.
removeAll
(
Collections
.
singleton
(
null
));
departs
.
removeAll
(
Collections
.
singleton
(
""
));
}
int
result
=
bLessonRepository
.
isInViewRange
(
curUser
,
lessonId
,
departs
);
if
(
result
<
1
){
throw
new
ServiceException
(
ResultServiceEnums
.
NO_ACCESS
);
}
return
new
PersistModel
(
1
);
}
//遍历标签放入List中
List
<
BLessonLabel
>
addLabel
(
BLesson
model
)
{
//标签集合
...
...
@@ -1197,6 +1297,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
synchronized
int
trainInsert
(
String
type
,
BLesson
bLesson
,
List
<
BLessonPerson
>
bLessonPersons
){
int
line
=
0
;
if
(
"0"
.
equals
(
type
)){
Map
<
String
,
Object
>
xy
=
bLessonPersonRepository
.
selecTraningNum
(
bLesson
.
getBusinessId
());
...
...
@@ -1205,8 +1306,9 @@ public class BLessonServiceImpl implements BLessonService {
if
(
y
>
0
&&
x
>=
y
)
{
throw
new
ServiceException
(
ResultServiceEnums
.
PERSON_MAX
);
}
return
bLessonPersonRepository
.
insert
(
bLessonPersons
.
get
(
0
));
line
=
bLessonPersonRepository
.
insert
(
bLessonPersons
.
get
(
0
));
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
return
line
;
}
if
(
"1"
.
equals
(
type
)){
//如果为培训的话 判断剩余学生加已有学生总数超过最大数 抛异常
...
...
@@ -1214,12 +1316,14 @@ public class BLessonServiceImpl implements BLessonService {
//查找已报名总人数
int
personNumber
=
bLessonRepository
.
personNumberCount
(
bLesson
.
getBusinessId
());
if
(
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())
>
0
&&
personNumber
+
bLessonPersons
.
size
()
>
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())){
throw
new
ServiceException
(
"培训人数上限"
+
bLesson
.
getMaxApplyPerson
()+
",现已超出"
+
String
.
valueOf
(
personNumber
+
bLessonPersons
.
size
()-
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())+
"人,请重新选择"
));
throw
new
ServiceException
(
400
,
"培训人数上限"
+
bLesson
.
getMaxApplyPerson
()+
",现已超出"
+
String
.
valueOf
(
personNumber
+
bLessonPersons
.
size
()-
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())+
"人,请重新选择"
));
}
return
bLessonPersonRepository
.
insertList
(
bLessonPersons
);
line
=
bLessonPersonRepository
.
insertList
(
bLessonPersons
);
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
return
line
;
}
}
return
0
;
return
line
;
}
}
src/main/java/org/rcisoft/business/bmaterial/controller/BMaterialController.java
View file @
bfc6e277
...
...
@@ -73,7 +73,7 @@ public class BMaterialController extends PaginationController<BMaterial> {
@ApiOperation
(
value
=
"1303批量删除"
,
notes
=
"批量删除"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"删除business 用逗号隔开"
,
required
=
false
,
dataType
=
"varchar"
)})
@
Delete
Mapping
(
"/deleteMore"
)
@
Post
Mapping
(
"/deleteMore"
)
public
Result
deleteMore
(
CurUser
curUser
,
@Valid
String
ids
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bMaterialServiceImpl
.
removeMore
(
ids
,
curUser
);
return
Result
.
builder
(
data
,
...
...
src/main/java/org/rcisoft/business/bmaterial/dao/BMaterialRepository.java
View file @
bfc6e277
...
...
@@ -73,11 +73,12 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@Select
(
"<script>select * from b_material "
+
" where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" <if test=\"uploadType!=null and uploadType != ''\">and upload_type = #{uploadType}</if>"
+
" and file_url in "
+
"<foreach item='item' collection='trainFileList' open='(' separator=',' close=')'> #{item.videoUrl} </foreach> "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BMaterial
>
materialHaveUrl
(
@Param
(
"trainFileList"
)
List
<
BTrainFile
>
trainFileList
);
List
<
BMaterial
>
materialHaveUrl
(
@Param
(
"trainFileList"
)
List
<
BTrainFile
>
trainFileList
,
@Param
(
"uploadType"
)
String
uploadType
);
@Insert
(
"<script>insert into b_material "
+
...
...
@@ -100,15 +101,25 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@Update
({
"<script>"
,
"update b_material"
,
" <set>"
,
" <if test='
updateBy != null'>update_by=#{
updateBy},</if>"
,
" <if test='
updateDate != null'>update_date=#{
updateDate},</if>"
,
" <if test='
delFlag != null'>del_flag=#{
delFlag},</if>"
,
" <if test='
flag != null'>flag=#{
flag},</if>"
,
" <if test='
param.updateBy != null'>update_by=#{param.
updateBy},</if>"
,
" <if test='
param.updateDate != null'>update_date=#{param.
updateDate},</if>"
,
" <if test='
param.delFlag != null'>del_flag=#{param.
delFlag},</if>"
,
" <if test='
param.flag != null'>flag=#{param.
flag},</if>"
,
" </set>"
,
"where business_id in "
,
"<foreach item='item' index='index' collection='
delMoreDTO
.idList' open='(' separator=',' close=')'> #{item} </foreach> "
,
"<foreach item='item' index='index' collection='
param
.idList' open='(' separator=',' close=')'> #{item} </foreach> "
,
"</script>"
})
int
deleteMore
(
@Param
(
"delMoreDTO"
)
DelMoreDTO
delMoreDTO
);
int
deleteMore
(
@Param
(
"param"
)
DelMoreDTO
delMoreDTO
);
@Select
(
"<script>select * from b_material "
+
" where 1=1 "
+
" and del_flag != 1 and flag = 1 "
+
" <if test=\"uploadType!=null and uploadType != ''\">and upload_type = #{uploadType}</if>"
+
" and file_url in "
+
"<foreach item='item' collection='urls' open='(' separator=',' close=')'> #{item} </foreach> "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BMaterial
>
selectByUrl
(
@Param
(
"urls"
)
List
<
String
>
urls
,
@Param
(
"uploadType"
)
String
uploadType
);
}
src/main/java/org/rcisoft/business/bmaterial/dto/DelMoreDTO.java
View file @
bfc6e277
...
...
@@ -14,6 +14,8 @@ public class DelMoreDTO {
private
String
delFlag
;
private
String
flag
;
private
List
<
String
>
idList
;
}
src/main/java/org/rcisoft/business/bmaterial/service/impl/BMaterialServiceImpl.java
View file @
bfc6e277
...
...
@@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -47,6 +48,12 @@ public class BMaterialServiceImpl implements BMaterialService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BMaterial
bMaterial
){
List
<
String
>
urls
=
new
ArrayList
<>();
urls
.
add
(
bMaterial
.
getFileUrl
());
List
<
BMaterial
>
bMaterialList
=
bMaterialRepository
.
selectByUrl
(
urls
,
"0"
);
if
(
bMaterialList
!=
null
&&
bMaterialList
.
size
()
>
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
SAVED_THIS_FILE
);
}
//增加操作
UserUtil
.
setCurrentPersistOperation
(
bMaterial
);
//设置上传类型为 保存
...
...
src/main/java/org/rcisoft/common/util/feignDto/GetSubUserIdsByDeptIdsReqDTO.java
View file @
bfc6e277
...
...
@@ -15,6 +15,6 @@ public class GetSubUserIdsByDeptIdsReqDTO {
@ApiModelProperty
(
value
=
"部门id集合(可选)"
,
position
=
2
)
@Order
(
3
)
private
List
<
Integer
>
deptIds
;
private
List
<
Long
>
deptIds
;
}
src/main/java/org/rcisoft/common/util/outClient/MTCotactApiRequestClient.java
View file @
bfc6e277
...
...
@@ -543,9 +543,10 @@ public class MTCotactApiRequestClient {
}
GetSubUserIdsByDeptIdsReqDTO
getSubUserIdsByDeptIdsReqDTO
=
new
GetSubUserIdsByDeptIdsReqDTO
();
getSubUserIdsByDeptIdsReqDTO
.
setCorpId
(
Integer
.
parseInt
(
corpId
));
List
<
Integer
>
deptIdList
=
new
ArrayList
<>();
List
<
Long
>
deptIdList
=
new
ArrayList
<>();
for
(
String
deptId
:
deptIdSet
)
{
deptIdList
.
add
(
Integer
.
parseInt
(
deptId
));
Long
a
=
Long
.
valueOf
(
deptId
);
deptIdList
.
add
(
a
);
}
getSubUserIdsByDeptIdsReqDTO
.
setDeptIds
(
deptIdList
);
return
contactFeignClient
.
getSubUserIdsByDeptIds
(
getSubUserIdsByDeptIdsReqDTO
,
zxClientType
,
zxAccountId
).
getData
();
...
...
src/main/java/org/rcisoft/config/MvcConfig.java
View file @
bfc6e277
...
...
@@ -83,9 +83,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
e
.
getMessage
());
log
.
error
(
message
);
if
(
e
instanceof
ServiceException
)
{
//业务失败的异常,如“账号或密码错误”
result
.
setCode
(
ResultCode
.
FAIL
).
setMessage
(
e
.
getMessage
());
ServiceException
se
=
(
ServiceException
)
e
;
result
.
setCode
(
ResultCode
.
FAIL
).
setMessage
(
e
.
getMessage
()).
setData
(
Result
.
builder
(
se
.
getCode
(),
message
,
null
));
}
else
{
result
.
setCode
(
ResultCode
.
ERROR
).
setMessage
(
message
);
}
}
else
{
...
...
src/main/java/org/rcisoft/core/exception/ServiceException.java
View file @
bfc6e277
package
org
.
rcisoft
.
core
.
exception
;
import
lombok.Data
;
import
org.rcisoft.core.result.ResultExceptionEnum
;
import
org.rcisoft.core.result.ResultServiceEnums
;
/**
* Created by lcy on 17/11/24.
*/
@Data
public
class
ServiceException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
3729706443523052156L
;
...
...
src/main/java/org/rcisoft/core/result/Result.java
View file @
bfc6e277
...
...
@@ -31,6 +31,21 @@ public class Result {
}
/**
*
* @param code
* @param message
* @param data
* @return
*/
public
static
Result
builder
(
Integer
code
,
String
message
,
Object
data
){
Result
result
=
new
Result
();
result
.
setCode
(
code
);
result
.
setMessage
(
message
);
result
.
setData
(
data
);
return
result
;
}
public
void
setErrorMessage
(
String
message
,
Object
data
)
{
this
.
code
=
ResultCode
.
FAIL
.
getCode
();
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
bfc6e277
...
...
@@ -231,6 +231,9 @@ public enum ResultServiceEnums {
LESSON_CLOSED
(
131
,
"该课程已关闭"
),
NO_ACCESS
(
132
,
"您对该课程无可见权限"
),
LABEL_MORE_NUM
(
133
,
"标签超过规定个数"
),
SAVED_THIS_FILE
(
134
,
"已保存过改资料"
),
CHAPTER_ONLY_ONE
(
135
,
"当前课程仅有一节,不能被删除"
),
LESSON_NO_CHAPTER
(
136
,
"当前课程暂无章节,不能被发布"
),
;
private
Integer
code
;
...
...
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
View file @
bfc6e277
...
...
@@ -219,7 +219,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
" and u.del_flag !=1 "
+
" and u.flag = 1 "
+
" and r.r_status = 1 "
)
String
queryAllRoleById
(
@Param
(
"userId"
)
String
userId
);
List
<
String
>
queryAllRoleById
(
@Param
(
"userId"
)
String
userId
);
@Select
(
"<script>select "
+
" (select count(1) from "
+
...
...
src/main/java/org/rcisoft/sys/user/service/impl/SysUserServiceImpl.java
View file @
bfc6e277
...
...
@@ -246,7 +246,19 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public
String
queryAllRoleById
(
String
userId
)
{
return
sysUserMapper
.
queryAllRoleById
(
userId
);
List
<
String
>
roles
=
sysUserMapper
.
queryAllRoleById
(
userId
);
StringBuffer
sb
=
new
StringBuffer
();
for
(
String
role
:
roles
){
sb
.
append
(
role
+
","
);
}
String
str1
=
sb
.
toString
().
substring
(
0
,
sb
.
toString
().
length
()
-
1
);
String
[]
strs
=
str1
.
split
(
","
);
Set
roleSet
=
new
HashSet
();
for
(
String
s
:
strs
){
roleSet
.
add
(
s
);
}
String
allRole
=
StringUtils
.
join
(
roleSet
.
toArray
(),
","
);
return
allRole
;
}
@Override
...
...
@@ -385,13 +397,15 @@ public class SysUserServiceImpl implements SysUserService {
mtUserGetsReqDTO
.
setCorpId
(
curUser
.
getCorpId
());
mtUserGetsReqDTO
.
setIds
(
ids
);
List
<
MTUserInfoRspDTO
>
mtUserInfoRspDTOList
=
mtCotactApiRequestClient
.
userGets
(
mtUserGetsReqDTO
);
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
curUser
.
getUserId
()))
{
//设置部门名
myInfoDTO
.
setName
(
mtUserInfoRspDTO
.
getName
());
myInfoDTO
.
setHeadPic
(
mtUserInfoRspDTO
.
getAvatar
());
}
});
if
(
mtUserInfoRspDTOList
!=
null
&&
mtUserInfoRspDTOList
.
size
()
>
0
){
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
if
(
mtUserInfoRspDTO
.
getId
().
equals
(
curUser
.
getUserId
()))
{
//设置部门名
myInfoDTO
.
setName
(
mtUserInfoRspDTO
.
getName
());
myInfoDTO
.
setHeadPic
(
mtUserInfoRspDTO
.
getAvatar
());
}
});
}
myInfoDTO
.
setLessonCount
(
myInfoDTOCount
.
getLessonCount
());
myInfoDTO
.
setTrainCount
(
myInfoDTOCount
.
getTrainCount
());
myInfoDTO
.
setNotFinishedExam
(
myInfoDTOCount
.
getNotFinishedExam
());
...
...
src/main/resources/application-mt.yml
View file @
bfc6e277
...
...
@@ -113,3 +113,6 @@ eureka:
fetch-registry
:
true
service-url
:
defaultZone
:
http://zx:zgiot@192.168.5.48:7001/eureka
ribbon
:
ReadTimeout
:
10000
ConnectTimeout
:
10000
\ No newline at end of file
src/main/resources/application-prod.yml
View file @
bfc6e277
...
...
@@ -104,3 +104,6 @@ eureka:
fetch-registry
:
true
service-url
:
defaultZone
:
http://zx:zgiot@192.168.5.48:7001/eureka
ribbon
:
ReadTimeout
:
10000
ConnectTimeout
:
10000
\ No newline at end of file
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