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
042c6abf
Commit
042c6abf
authored
Nov 12, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
7b1cc9a2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
19 deletions
+67
-19
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+11
-1
BLessonPersonRepository.java
...rcisoft/business/blesson/dao/BLessonPersonRepository.java
+5
-3
BLessonPersonService.java
...cisoft/business/blesson/service/BLessonPersonService.java
+2
-1
BLessonPersonServiceImpl.java
...siness/blesson/service/impl/BLessonPersonServiceImpl.java
+10
-1
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+34
-12
QueryDepart.java
...n/java/org/rcisoft/business/blesson/util/QueryDepart.java
+3
-0
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+2
-1
No files found.
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
042c6abf
...
...
@@ -437,6 +437,11 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService
.
queryRecommendByLessonId
(
param
));
}
/**
* @param
* @return
* @author: zhangqingle
*/
@ApiOperation
(
value
=
"624 指派课程"
,
notes
=
"根据ID指派课程"
)
@PostMapping
(
value
=
"/appointLessonToPerson"
)
public
Result
appointLessonToPerson
(
CurUser
curUser
,
@Valid
AppointLessonDTO
appointLessonDTO
,
BindingResult
bindingResult
)
{
...
...
@@ -447,10 +452,15 @@ public class BLessonController extends PaginationController<BLesson> {
appointLessonDTO
);
}
/**
* @param
* @return
* @author: zhangqingle
*/
@ApiOperation
(
value
=
"625 添加我学习的课程"
,
notes
=
"添加我学习的课程"
)
@PostMapping
(
value
=
"/addMyLearnLesson"
)
public
Result
addMyLearnLesson
(
CurUser
curUser
,
@Valid
AddMyLearnLessonDTO
addMyLearnLessonDTO
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bLessonPersonService
.
addMyLearnLesson
(
addMyLearnLessonDTO
);
PersistModel
data
=
bLessonPersonService
.
addMyLearnLesson
(
addMyLearnLessonDTO
,
curUser
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/business/blesson/dao/BLessonPersonRepository.java
View file @
042c6abf
...
...
@@ -9,6 +9,7 @@ import org.rcisoft.core.base.BaseMapper;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.stereotype.Repository
;
import
javax.xml.crypto.Data
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -97,7 +98,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" bl.lesson_name LessonTitle , su.name personName, "
+
" blp.is_appoint isAppoint , blp.is_finish isFinish ,"
+
" blp.learn_progress learnProgress ,"
+
" if(blp.is_appoint = 0, blp.apply_date, ba.
cre
ate_date) appointDate, "
+
" if(blp.is_appoint = 0, blp.apply_date, ba.
upd
ate_date) appointDate, "
+
// " ba.create_date appointDate ," +
" blp.finish_date finishDate , "
+
" blp.apply_date applyDate , "
+
...
...
@@ -218,7 +219,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" <if test=\"param.updateBy != null and param.updateBy != ''\">update_by=#{param.updateBy},</if>"
+
" <if test=\"param.updateDate != null \">update_date=#{param.updateDate},</if>"
+
" <if test=\"param.delFlag != null and param.delFlag != '' \">del_flag=#{param.delFlag},</if>"
+
" <if test=\"param.flag != null and param.flag != '' \">flag=#{param.flag},</if>"
+
" <if test=\"param.flag != null and param.flag != '' \">flag=#{param.flag},</if> "
+
" apply_date = ifnull(apply_date, #{nowDate}) "
+
" appoint_id=#{param.appointId}, "
+
" is_appoint=#{param.isAppoint} "
+
" </set> "
+
...
...
@@ -227,7 +229,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" and person_id in "
+
" <foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'> #{item} </foreach>"
+
"</script>"
)
int
updateList
(
@Param
(
"param"
)
BLessonPerson
param
,
@Param
(
"ids"
)
List
<
String
>
ids
);
int
updateList
(
@Param
(
"param"
)
BLessonPerson
param
,
@Param
(
"ids"
)
List
<
String
>
ids
,
@Param
(
"nowDate"
)
Date
nowDate
);
@Insert
(
"<script>"
+
" insert into b_lesson_person("
+
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonPersonService.java
View file @
042c6abf
...
...
@@ -4,6 +4,7 @@ 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
org.rcisoft.sys.user.bean.CurUser
;
import
java.util.List
;
...
...
@@ -55,5 +56,5 @@ public interface BLessonPersonService {
* @param addMyLearnLessonDTO
* @return
*/
PersistModel
addMyLearnLesson
(
AddMyLearnLessonDTO
addMyLearnLessonDTO
);
PersistModel
addMyLearnLesson
(
AddMyLearnLessonDTO
addMyLearnLessonDTO
,
CurUser
curUser
);
}
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonPersonServiceImpl.java
View file @
042c6abf
...
...
@@ -21,6 +21,7 @@ import org.rcisoft.core.result.ResultExceptionEnum;
import
org.rcisoft.core.result.ResultServiceEnums
;
import
org.rcisoft.core.util.IdGen
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -64,6 +65,9 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
throw
new
ServiceException
(
ResultServiceEnums
.
APPOINT_NOT_CLOSE
);
}
bLessonPerson
.
setDelFlag
(
"1"
);
//将加入学习时间置空
bLessonPerson
.
setApplyDate
(
null
);
UserUtil
.
setCurrentMergeOperation
(
bLessonPerson
);
// int line = bLessonPersonRepository.quit(quitLessonDTO.getBusinessId());
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPerson
);
...
...
@@ -187,7 +191,12 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
}
@Override
public
PersistModel
addMyLearnLesson
(
AddMyLearnLessonDTO
addMyLearnLessonDTO
)
{
public
PersistModel
addMyLearnLesson
(
AddMyLearnLessonDTO
addMyLearnLessonDTO
,
CurUser
curUser
)
{
BLesson
bLesson
=
bLessonRepository
.
selectInfoById
(
addMyLearnLessonDTO
.
getLessonId
(),
curUser
);
if
(!
"0"
.
equals
(
bLesson
.
getLessonType
())){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_TRAIN_TYPE
);
}
List
<
BLessonPerson
>
bLessonPersons
=
bLessonPersonRepository
.
selectByPersonAndLesson
(
addMyLearnLessonDTO
);
BLessonPerson
bLessonPerson
;
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
042c6abf
...
...
@@ -534,6 +534,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
recommendBLesson
(
RecommendLessonDTO
recommendLessonDTO
)
{
BLesson
bLessonExi
=
new
BLesson
();
//按id查询存在的课程
bLessonExi
.
setBusinessId
(
recommendLessonDTO
.
getLessonId
());
bLessonExi
=
bLessonRepository
.
selectByPrimaryKey
(
bLessonExi
);
//判断课程是否存在
...
...
@@ -545,9 +546,9 @@ public class BLessonServiceImpl implements BLessonService {
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_CLOSED
);
}
BRecommend
bRecommend
=
new
BRecommend
();
bRecommend
.
setLessonId
(
recommendLessonDTO
.
getLessonId
());
if
(
StringUtils
.
isNotEmpty
(
recommendLessonDTO
.
getRecommendPerson
())
||
StringUtils
.
isNotEmpty
(
recommendLessonDTO
.
getRecommendDepart
()))
{
BRecommend
bRecommend
=
new
BRecommend
();
bRecommend
.
setLessonId
(
recommendLessonDTO
.
getLessonId
());
bRecommend
.
setRecommendPerson
(
recommendLessonDTO
.
getUserId
());
//设置推荐类型(0仅人 1仅部门 2人和部门)
if
(
StringUtils
.
isNotEmpty
(
recommendLessonDTO
.
getRecommendPerson
())
&&
StringUtils
.
isEmpty
(
recommendLessonDTO
.
getRecommendDepart
()))
{
...
...
@@ -591,9 +592,19 @@ public class BLessonServiceImpl implements BLessonService {
//插入子表
int
line
=
bRecommendRepository
.
insertBRecommendSons
(
bRecommendSons
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
else
{
throw
new
ServiceException
(
ResultServiceEnums
.
INVALID_PARAMETER_VALUE
);
}
//若推荐为空,删除推荐表和推荐子表内容
List
<
String
>
recommendIds
=
bRecommendRepository
.
selectIdByLessonId
(
recommendLessonDTO
.
getLessonId
());
// throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
//若原本未推荐且本次推荐为空直接返回
if
(
recommendIds
==
null
||
recommendIds
.
size
()
<
1
){
return
new
PersistModel
(
1
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
//若原本推荐,本次推荐删除推荐表和推荐子表
bRecommend
.
setBusinessId
(
recommendIds
.
get
(
0
));
int
line
=
bRecommendRepository
.
deleteByPrimaryKey
(
bRecommend
);
bRecommendRepository
.
deleteRecommendSon
(
bRecommend
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
@Override
...
...
@@ -693,7 +704,7 @@ public class BLessonServiceImpl implements BLessonService {
bAppointRepository
.
updateByPrimaryKeySelective
(
bAppoint
);
// //删除指派未开始
// bLessonPersonRepository.deleteNotStartByLessonId(appointLessonDTO);
//指派
已开始
更新为不指派
//指派更新为不指派
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
bLessonPerson
.
setIsAppoint
(
"0"
);
bLessonPerson
.
setAppointId
(
""
);
...
...
@@ -729,9 +740,9 @@ public class BLessonServiceImpl implements BLessonService {
updateBLessonPerson
.
setLessonId
(
appointLessonDTO
.
getLessonId
());
updateBLessonPerson
.
setAppointId
(
bAppoint
.
getBusinessId
());
UserUtil
.
setCurrentMergeOperation
(
updateBLessonPerson
);
//更新b_lesson_person表
bLessonPersonRepository
.
updateList
(
updateBLessonPerson
,
inLessonIds
);
Date
nowDate
=
new
Date
();
//更新b_lesson_person表
,报名时间为空将当前时间给其赋值
bLessonPersonRepository
.
updateList
(
updateBLessonPerson
,
inLessonIds
,
nowDate
);
//从学生Id中删除已更新的学生id
userIds
.
removeAll
(
inLessonIds
);
}
...
...
@@ -771,6 +782,7 @@ public class BLessonServiceImpl implements BLessonService {
if
(
"1"
.
equals
(
bLesson
.
getLessonType
())){
//指派培训
line
=
trainInsert
(
"1"
,
bLesson
,
bLessonPersonOthers
);
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
//指派课程
...
...
@@ -1028,6 +1040,10 @@ public class BLessonServiceImpl implements BLessonService {
BLessonPerson
bLessonPerson
=
new
BLessonPerson
();
//判断当前时间是否在报名范围内
BLesson
bLesson
=
bLessonRepository
.
selectInfoById
(
lessonId
,
curUser
);
if
(!
"1"
.
equals
(
bLesson
.
getLessonType
())){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_TRAIN_TYPE
);
}
Date
newDate
=
new
Date
();
if
(
newDate
.
before
(
bLesson
.
getApplyStartDate
())||
bLesson
.
getTrainOverDate
().
before
(
newDate
)){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_APPLY_DATE
);
...
...
@@ -1045,14 +1061,18 @@ public class BLessonServiceImpl implements BLessonService {
person
.
setTrainIsSign
(
"0"
);
person
.
setApplyDate
(
new
Date
());
person
.
setIsApply
(
"1"
);
return
bLessonPersonRepository
.
updateLessonPersonByUserId
(
person
);
int
line
=
bLessonPersonRepository
.
updateLessonPersonByUserId
(
person
);
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
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
);
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
person
);
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
return
line
;
}
List
<
BLessonPerson
>
bLessonPersons
=
new
ArrayList
<>();
UserUtil
.
setCurrentPersistOperation
(
bLessonPerson
);
...
...
@@ -1067,6 +1087,7 @@ public class BLessonServiceImpl implements BLessonService {
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
// int line = bLessonPersonRepository.insert(bLessonPerson);
int
line
=
this
.
trainInsert
(
"0"
,
bLesson
,
bLessonPersons
);
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
return
line
;
}
...
...
@@ -1341,6 +1362,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
//type: 0报名 1指派
synchronized
int
trainInsert
(
String
type
,
BLesson
bLesson
,
List
<
BLessonPerson
>
bLessonPersons
){
int
line
=
0
;
if
(
"0"
.
equals
(
type
)){
...
...
@@ -1352,7 +1374,7 @@ public class BLessonServiceImpl implements BLessonService {
throw
new
ServiceException
(
ResultServiceEnums
.
PERSON_MAX
);
}
line
=
bLessonPersonRepository
.
insert
(
bLessonPersons
.
get
(
0
));
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
//
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),"1");
return
line
;
}
if
(
"1"
.
equals
(
type
)){
...
...
@@ -1364,7 +1386,7 @@ public class BLessonServiceImpl implements BLessonService {
throw
new
ServiceException
(
400
,
"培训人数上限"
+
bLesson
.
getMaxApplyPerson
()+
",现已超出"
+
String
.
valueOf
(
personNumber
+
bLessonPersons
.
size
()-
Integer
.
parseInt
(
bLesson
.
getMaxApplyPerson
())+
"人,请重新选择"
));
}
line
=
bLessonPersonRepository
.
insertList
(
bLessonPersons
);
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
//
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),"1");
return
line
;
}
}
...
...
src/main/java/org/rcisoft/business/blesson/util/QueryDepart.java
View file @
042c6abf
...
...
@@ -17,6 +17,9 @@ public class QueryDepart {
List
<
String
>
departs
=
new
ArrayList
<>();
mtUserInfoRspDTOList
.
forEach
(
mtUserInfoRspDTO
->
{
List
<
MTUserInfoRspDTO
.
DeptsBean
>
deptsBeans
=
mtUserInfoRspDTO
.
getDepts
();
if
(
deptsBeans
==
null
||
deptsBeans
.
size
()
<
1
){
return
;
}
deptsBeans
.
forEach
(
deptsBean
->
{
departs
.
addAll
(
Arrays
.
asList
(
deptsBean
.
getPids
().
split
(
","
)));
departs
.
add
(
deptsBean
.
getId
());
...
...
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
042c6abf
...
...
@@ -231,12 +231,13 @@ public enum ResultServiceEnums {
LESSON_CLOSED
(
131
,
"该课程已关闭"
),
NO_ACCESS
(
132
,
"您对该课程无可见权限"
),
LABEL_MORE_NUM
(
133
,
"标签超过规定个数"
),
SAVED_THIS_FILE
(
134
,
"已保存过
改
资料"
),
SAVED_THIS_FILE
(
134
,
"已保存过
该
资料"
),
CHAPTER_ONLY_ONE
(
135
,
"当前课程仅有一节,不能被删除"
),
LESSON_NO_CHAPTER
(
136
,
"当前课程暂无章节,不能被发布"
),
ROLE_IS_NULL
(
137
,
"当前未勾选角色,请勾选角色"
),
ILLEGAL_URL
(
138
,
"网址不合法(http(s)://xxxx.xx)"
),
PARAM_NOT_NULL
(
139
,
"参数不能为空"
),
NOT_TRAIN_TYPE
(
140
,
"课程类型不正确"
),
;
private
Integer
code
;
...
...
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