Commit d1a129e9 authored by zhangqingle's avatar zhangqingle

修改退出课程,640增加课时排序

parent 1eb628f0
...@@ -280,7 +280,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -280,7 +280,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar") @ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit") @PostMapping(value = "/quit")
public Result quit(CurUser curUser, @Valid QuitLessonDTO quitLessonDTO, BindingResult bindingResult) { public Result quit(CurUser curUser, @Valid QuitLessonDTO quitLessonDTO, BindingResult bindingResult) {
PersistModel data = bLessonPersonService.quit(quitLessonDTO); PersistModel data = bLessonPersonService.quit(quitLessonDTO, curUser);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
......
...@@ -404,6 +404,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -404,6 +404,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
"<if test= \" param.signDateSort !=null and param.signDateSort !='' and param.signDateSort =='1'.toString()\"> ORDER BY blp.sign_date ASC </if> "+ "<if test= \" param.signDateSort !=null and param.signDateSort !='' and param.signDateSort =='1'.toString()\"> ORDER BY blp.sign_date ASC </if> "+
"<if test= \" param.learnProgressSort !=null and param.learnProgressSort !='' and param.learnProgressSort =='0'.toString()\"> ORDER BY CAST(learnProgress AS UNSIGNED) DESC </if> "+ "<if test= \" param.learnProgressSort !=null and param.learnProgressSort !='' and param.learnProgressSort =='0'.toString()\"> ORDER BY CAST(learnProgress AS UNSIGNED) DESC </if> "+
"<if test= \" param.learnProgressSort !=null and param.learnProgressSort !='' and param.learnProgressSort =='1'.toString()\"> ORDER BY CAST(learnProgress AS UNSIGNED) ASC </if> "+ "<if test= \" param.learnProgressSort !=null and param.learnProgressSort !='' and param.learnProgressSort =='1'.toString()\"> ORDER BY CAST(learnProgress AS UNSIGNED) ASC </if> "+
"<if test= \" param.classHourSort !=null and param.classHourSort !='' and param.classHourSort =='0'.toString()\"> ORDER BY CAST(classHour AS UNSIGNED) DESC </if> "+
"<if test= \" param.classHourSort !=null and param.classHourSort !='' and param.classHourSort =='1'.toString()\"> ORDER BY CAST(classHour AS UNSIGNED) ASC </if> "+
"</script>") "</script>")
List<StudentTrackingRspDTO> userManageLesson(@Param("param") UserLessonDTO userLessonDTO, @Param("trainTypeSelStr")String trainTypeSelStr); List<StudentTrackingRspDTO> userManageLesson(@Param("param") UserLessonDTO userLessonDTO, @Param("trainTypeSelStr")String trainTypeSelStr);
......
...@@ -1033,7 +1033,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1033,7 +1033,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Select("<script>select distinct bl.*, " + @Select("<script>select distinct bl.*, " +
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate ," + " blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate,blp.business_id lessonPersonId, " +
"CONCAT( " + "CONCAT( " +
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " +
"IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " +
......
...@@ -81,6 +81,9 @@ public class UserLessonDTO { ...@@ -81,6 +81,9 @@ public class UserLessonDTO {
@ApiModelProperty(value = "学习进度时间排序(0降序 1升序)",required = false) @ApiModelProperty(value = "学习进度时间排序(0降序 1升序)",required = false)
private String learnProgressSort; private String learnProgressSort;
@ApiModelProperty(value = "课时排序(0降序 1升序)",required = false)
private String classHourSort;
private String corpId; private String corpId;
private String userId; private String userId;
......
...@@ -258,6 +258,10 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -258,6 +258,10 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String userIsLecturer; private String userIsLecturer;
@ApiModelProperty(value = "选课主键businessId")
@Transient
private String lessonPersonId;
public void initModel(){ public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); // this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......
...@@ -16,7 +16,7 @@ public interface BLessonPersonService { ...@@ -16,7 +16,7 @@ public interface BLessonPersonService {
* @param quitLessonDTO * @param quitLessonDTO
* @return * @return
*/ */
PersistModel quit(QuitLessonDTO quitLessonDTO); PersistModel quit(QuitLessonDTO quitLessonDTO,CurUser curUser);
/** /**
......
...@@ -70,14 +70,35 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -70,14 +70,35 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel quit(QuitLessonDTO quitLessonDTO) { public PersistModel quit(QuitLessonDTO quitLessonDTO,CurUser curUser) {
BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(quitLessonDTO.getBusinessId()); BLessonPerson bLessonPerson = new BLessonPerson();
if (StringUtils.isNotEmpty(quitLessonDTO.getBusinessId())){
bLessonPerson = bLessonPersonRepository.selectById(quitLessonDTO.getBusinessId());
}else {
AddMyLearnLessonDTO addMyLearnLessonDTO = new AddMyLearnLessonDTO(quitLessonDTO.getLessonId(),curUser.getCorpId(),curUser.getUserId());
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByPersonAndLesson(addMyLearnLessonDTO);
if (bLessonPersonList != null && bLessonPersonList.get(0) != null){
bLessonPerson = bLessonPersonList.get(0);
}
}
BLesson bLesson = new BLesson(); BLesson bLesson = new BLesson();
bLesson.setBusinessId(quitLessonDTO.getLessonId()); bLesson.setBusinessId(quitLessonDTO.getLessonId());
bLesson = bLessonRepository.selectByPrimaryKey(bLesson); bLesson = bLessonRepository.selectByPrimaryKey(bLesson);
if ("1".equals(bLessonPerson.getIsAppoint())){ if (bLesson == null){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
}
if (bLessonPerson == null && "0".equals(bLesson.getLessonType())){
throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE); throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE);
} }
if (bLessonPerson == null && "1".equals(bLesson.getLessonType())){
throw new ServiceException(ResultServiceEnums.LEARN_LESSON_NOT_EXISTS);
}
if ("1".equals(bLessonPerson.getIsAppoint())){
throw new ServiceException(ResultServiceEnums.APPLY_TRAIN_NOT_EXISTS);
}
bLessonPerson.setDelFlag("1"); bLessonPerson.setDelFlag("1");
//将加入学习时间置空 //将加入学习时间置空
bLessonPerson.setApplyDate(null); bLessonPerson.setApplyDate(null);
......
...@@ -245,6 +245,8 @@ public enum ResultServiceEnums { ...@@ -245,6 +245,8 @@ public enum ResultServiceEnums {
VALUE_NOT_ENOUGH(145,"积分输入格式错误"), VALUE_NOT_ENOUGH(145,"积分输入格式错误"),
CHANGE_HAVE_MEDIA(146,"该资源可能包含视频、音频,不能转换,请自行转换"), CHANGE_HAVE_MEDIA(146,"该资源可能包含视频、音频,不能转换,请自行转换"),
MANAGE_NOT_STOP(147,"不能停用主管理员"), MANAGE_NOT_STOP(147,"不能停用主管理员"),
APPLY_TRAIN_NOT_EXISTS(148,"未报名该培训"),
LEARN_LESSON_NOT_EXISTS(149,"未学习该课程"),
; ;
private Integer code; private Integer code;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment