Commit 27880130 authored by root's avatar root

修改接口、添加新接口

parent 03acb059
......@@ -166,21 +166,22 @@ public class BChapterServiceImpl implements BChapterService {
line = bChapterRepository.updateByPrimaryKeySelective(model);
}
//插入资料表
BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setChapterId(model.getBusinessId());
bMaterial.setFileName(dto.getFileName());
if(Integer.parseInt(model.getIsTest())<4){
bMaterial.setFileUrl(model.getVideoUrl());
}else if(Integer.parseInt(model.getIsTest())>= 4){
bMaterial.setFileUrl(model.getFileUrl());
//不是为添加章时插入资料表
if(StringUtils.isNotEmpty(model.getIsTest())){
BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setChapterId(model.getBusinessId());
bMaterial.setFileName(dto.getFileName());
if(Integer.parseInt(model.getIsTest())<4){
bMaterial.setFileUrl(model.getVideoUrl());
}else if(Integer.parseInt(model.getIsTest())>= 4){
bMaterial.setFileUrl(model.getFileUrl());
}
bMaterial.setType(model.getIsTest());
bMaterial.setUploadType("1");
bMaterial.setFileSize(dto.getFileSize());
bMaterialRepository.insertMaterial(bMaterial);
}
bMaterial.setType(model.getIsTest());
bMaterial.setUploadType("1");
bMaterial.setFileSize(dto.getFileSize());
bMaterialRepository.insertMaterial(bMaterial);
return new PersistModel(line);
}
......
......@@ -65,7 +65,7 @@ public class BLessonController extends PaginationController<BLesson> {
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
addLessonDTO);
data.getResult());
}
/**
......@@ -433,4 +433,24 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.queryRecommendByLessonId(param));
}
// @ApiOperation(value="624 指派课程", notes="根据ID指派课程")
// @PostMapping(value = "/appointLessonToPerson")
// public Result appointLessonToPerson(CurUser curUser,@Valid AppointLessonDTO appointLessonDTO,BindingResult bindingResult) {
// PersistModel data = bLessonService.appointLessonToPerson(appointLessonDTO);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// appointLessonDTO);
// }
// @ApiOperation(value="625 添加我学习的课程", notes="添加我学习的课程")
// @PostMapping(value = "/addMyLearnLesson")
// public Result addMyLearnLesson(CurUser curUser,@Valid AddMyLearnLessonDTO addMyLearnLessonDTO,BindingResult bindingResult) {
// PersistModel data = bLessonPersonService.addMyLearnLesson(addMyLearnLessonDTO);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// addMyLearnLessonDTO);
// }
}
package org.rcisoft.business.blesson.dao;
import org.rcisoft.business.blesson.dto.AppointLessonDTO;
import org.rcisoft.business.blesson.dto.CancelAppointDTO;
import org.rcisoft.business.blesson.entity.BAppoint;
import org.rcisoft.business.blesson.entity.BLessonPerson;
......@@ -19,7 +20,7 @@ public interface BAppointRepository extends BaseMapper<BAppoint> {
/**
* 按课程Id 查询 bAppoint
* Id 查询 bAppoint
*
*/
@Select("<script>select * from b_appoint where 1=1 "
......@@ -29,5 +30,17 @@ public interface BAppointRepository extends BaseMapper<BAppoint> {
+ "</script>")
@ResultMap(value = "BaseResultMap" )
BAppoint selectById(String bAppointId);
/**
* 按课程Id 查询 bAppoint
*
*/
@Select("<script>select * from b_appoint where 1=1 "
+ "and del_flag != 1 "
+ "and flag = 1 "
+ "and lesson_id = #{lessonId} "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BAppoint> selectByLessonId(AppointLessonDTO param);
}
......@@ -120,10 +120,116 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
/**
* 根据课程id查询学生id
* @param LessonId
* @param param
* @return
*/
@Select("<script>select business_id,person_id from b_lesson_person where 1=1 " +
"and del_flag = 0 and flag = 1 " +
"AND person_id IN" +
"<foreach item='item' index='index' collection='appointPersonList' open='(' close=')' separator=','> " +
"#{item} " +
"</foreach>" +
"and lesson_id = #{lessonId}</script>")
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectPersonIdByLessonId(AppointLessonDTO param);
/**
* 按课程id删除指派未开始
* @param param
* @return
*/
@Update("<script> update b_lesson_person blp left join b_appoint ba" +
" on blp.appoint_id = ba.business_id " +
" and ba.del_flag != 1 and ba.flag = 1 " +
" set blp.flag = '0' " +
" where 1=1 " +
" and blp.is_finish = '0' " +
" and ba.lesson_id = #{lessonId} " +
"</script>")
int deleteNotStartByLessonId(AppointLessonDTO param);
/**
* 已学习的取消指派
* @param param
* @return
*/
@Select("<script>select business_id,person_id from b_lesson_person where lesson_id = #{LessonId}</script>")
@Update("<script> update b_lesson_person blp left join b_appoint ba" +
" on blp.appoint_id = ba.business_id " +
" and ba.del_flag != 1 and ba.flag = 1 " +
" set blp.flag = '0' " +
" <set>"+
" <if test=\"updateBy != null and updateBy != ''\">update_by=#{updateBy},</if>"+
" <if test=\"updateDate != null and updateDate != ''\">update_date=#{updateDate},</if>"+
" <if test=\"delFlag != null and delFlag != ''\">del_flag=#{delFlag},</if>"+
" <if test=\"flag != null and flag != ''\">flag=#{flag},</if>"+
" <if test=\"remarks != null and remarks != ''\">remarks=#{remarks},</if>"+
" <if test=\"isAppoint != null and isAppoint != ''\">is_appoint=#{isAppoint},</if>"+
" appoint_id=#{appointId},"+
" </set>"+
" where 1=1 " +
" and blp.is_finish != '0' " +
" and ba.lesson_id = #{lessonId} " +
"</script>")
int cancelAppointByPersons(BLessonPerson param);
/**
* 按Id批量更新
* @param param
* @return
*/
@Update("<script>" +
" <foreach collection='param' item='item' index='index' separator=';'> " +
" update b_lesson_person " +
" <set> " +
" <if test=\"item.updateBy != null and item.updateBy != ''\">update_by=#{item.updateBy},</if>"+
" <if test=\"item.updateDate != null and item.updateDate != ''\">update_date=#{item.updateDate},</if>"+
" appoint_id=#{item.appointId}, " +
" is_appoint=#{item.isAppoint}, " +
" </set> " +
" where business_id=#{item.businessId} " +
" </foreach>"+
"</script>")
int updateList(@Param("param") List<BLessonPerson> param);
@Insert("<script>" +
" insert into b_lesson_person(" +
" business_id,create_by,create_date,update_by,update_date, " +
" del_flag,flag,remarks,person_id,lesson_id " +
" learn_progress,is_finish,finish_date,is_collect,appoint_id, " +
" is_appoint) " +
" values " +
" <foreach collection='list' index='index' item='item' separator=','> " +
" #{item.businessId}, #{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate}, " +
" #{item.delFlag}, #{item.flag},#{item.remarks},#{item.personId},#{item.lessonId}, " +
" #{item.learnProgress}, #{item.isFinish},#{item.finishDate},#{item.isCollect},#{item.appointId}, " +
" #{item.isAppoint}) " +
" </foreach>" +
"</script>")
int insertList(@Param("param") List<BLessonPerson> param);
/**
* 根据课程id PersonId查询
*/
@Select("<script>select * from b_lesson_person where 1=1 " +
"and del_flag = 0 and flag = 1 " +
"AND person_id = #{userId} " +
"and lesson_id = #{lessonId}</script>")
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectPersonIdByLessonId(String LessonId);
List<BLessonPerson> selectByPersonAndLesson(AddMyLearnLessonDTO param);
@Insert("<script>" +
" insert into b_lesson_person(" +
" business_id,create_by,create_date,update_by,update_date, " +
" del_flag,flag,remarks,person_id,lesson_id " +
" learn_progress,is_finish,is_collect, " +
" is_appoint) " +
" values " +
" (#{param.businessId}, #{param.createBy},#{param.createDate},#{param.updateBy},#{param.updateDate}, " +
" #{param.delFlag}, #{param.flag},#{param.remarks},#{param.personId},#{param.lessonId}, " +
" #{param.learnProgress}, #{param.isFinish},#{param.isCollect}," +
" #{param.isAppoint}) " +
"</script>")
int insertBlessonPerson(@Param("param") BLessonPerson param);
}
......@@ -141,11 +141,13 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') " + //ZXRS 在学人数
" and bl.corp_id = #{curUser.corpId} "+
......@@ -214,11 +216,13 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and suc.del_flag != 1 and suc.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') " + //ZXRS 关注人数
" and bl.corp_id = #{curUser.corpId} "+
......@@ -280,11 +284,13 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and blp.person_id = #{curUser.userId} ) " +
" and b.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{curUser.userId}) " +
" <if test=\"departs != null and departs.size() > 0 \"> " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (b.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" order by T.bsum , b.collect_number desc" +
"</script>")
@ResultMap(value = "BaseResultMap")
......@@ -327,11 +333,13 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bv.corp_id = #{param.corpId} "+
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{param.userId}) " +
" <if test=\"param.departs != null and param.departs.size() > 0 \"> " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='param.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if>) " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" <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_id in " +
......@@ -495,29 +503,33 @@ 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 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_label bla on bla.business_id = bll.label_id " +
" 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 bv.del_flag != 1 and bv.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
" and bv.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if>) " +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
......@@ -541,27 +553,29 @@ 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 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+
" left join b_recommend br on bl.business_id = br.lesson_id " +
" left join b_recommend_son brs on br.business_id = brs.recommend_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_label bla on bla.business_id = bll.label_id " +
" 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 br.del_flag != 1 and br.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
" and br.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " +
" and ((brs.type = 0 and brs.target_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (brs.type = 1 and brs.target_id in " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if>) " +
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
......@@ -590,26 +604,31 @@ 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 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_course bc on bc.business_id = bl.course_id " +
" 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 bv.del_flag != 1 and bv.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
" and bv.corp_id = #{model.corpId} "+
" and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') " + //ZXRS 在学人数
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
......@@ -632,37 +651,37 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Select(" <script> select distinct bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" from b_lesson_person blp " +
" left join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 " +
" and suc.del_flag != 1 and suc.flag = 1 " +
" and suc.corp_id = #{model.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" left join b_lesson_label bll on bl.business_id = bll.lesson_id " +
// " left join b_label bla on bla.business_id = bll.label_id " +
" 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 blp.del_flag != 1 and blp.flag = 1 " +
" and bv.del_flag != 1 and bv.flag = 1 " +
// " and bla.del_flag != 1 and bla.flag = 1 " +
" and bl.corp_id = #{model.corpId} "+
" and su.corp_id = #{model.corpId} "+
" and suc.corp_id = #{model.corpId} "+
" and bv.corp_id = #{model.corpId} "+
" <if test=\"model.labelId !=null and model.labelId != ''\">and bll.label_id = #{model.labelId}</if>" +
" <if test=\"model.lessonType !=null and model.lessonType != ''\">and bl.lesson_type = #{model.lessonType}</if>" +
" and bl.release_state = 2 " +
" and blp.is_collect = 1 " +
" and blp.person_id = #{model.userId} " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (bl.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if>) " +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') " + //ZXRS 关注人数
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
......@@ -723,10 +742,12 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and blp.person_id = #{model.userId} ) " +
" and b.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{model.userId}) " +
" or (b.lecturer_id = #{model.userId}) " +
" <if test=\"model.departs != null and model.departs.size() > 0 \"> " +
" or (bvs.type = 1 and bvs.target_id in " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>) " +
" </if>) " +
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 ))) " +
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AddMyLearnLessonDTO {
@ApiModelProperty(value = "课程Id",required = true)
private String lessonId;
private String corpId;
private String userId;
}
......@@ -3,15 +3,20 @@ package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class AppointLessonDTO {
@ApiModelProperty(value = "课程Id",required = true)
private String lessonId;
@ApiModelProperty(value = "推荐范围(人)多人之间用','隔开" ,required = true)
@ApiModelProperty(value = "指派范围(人id)多人之间用','隔开" ,required = true)
private String appointPerson;
//指派人id集合
private List<String> appointPersonList;
private String userId;
private String corpId;
......
......@@ -100,6 +100,9 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Transient
private String lessonType;
@Transient
private String corpId;
//初始化
public void initModel(){
UserUtil.setCurrentPersistOperation(this);
......
......@@ -47,4 +47,13 @@ public interface BLessonPersonService {
* @return
*/
PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO);
/**
* 添加我学习课程
* @author: zhangqingle
* @param addMyLearnLessonDTO
* @return
*/
PersistModel addMyLearnLesson(AddMyLearnLessonDTO addMyLearnLessonDTO);
}
......@@ -6,7 +6,6 @@ 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 org.rcisoft.sys.user.entity.SysUser;
import java.util.List;
......@@ -141,6 +140,12 @@ public interface BLessonService{
*/
List<FindLessonRecommendRspDTO> queryRecommendByLessonId(FindLessonRecommendDTO param);
/**
* 指派课程
* @param appointLessonDTO
* @return
*/
PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO);
/**
* 课程培训条件查询
......
......@@ -115,4 +115,22 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
return new PersistModel(1,result);
}
@Override
public PersistModel addMyLearnLesson(AddMyLearnLessonDTO addMyLearnLessonDTO) {
List<BLessonPerson> bLessonPersons = bLessonPersonRepository.selectByPersonAndLesson(addMyLearnLessonDTO);
BLessonPerson bLessonPerson;
if (bLessonPersons != null && bLessonPersons.size()>0 ){
bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsFinish("1");
bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
}else {
bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId());
bLessonPersonRepository.insertBlessonPerson(bLessonPerson);
}
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
return null;
}
}
package org.rcisoft.business.blesson.service.impl;
import com.alibaba.fastjson.JSON;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bcourse.dao.BCourseRepository;
......@@ -20,13 +18,10 @@ import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
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.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -35,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.lang.reflect.Array;
import java.util.*;
import static java.util.Arrays.asList;
......@@ -232,7 +226,7 @@ public class BLessonServiceImpl implements BLessonService {
bLessonRepository.insertLessonLabel(bLessonLabels);
}
}
return new PersistModel(line);
return new PersistModel(line,model);
}
......@@ -383,6 +377,73 @@ public class BLessonServiceImpl implements BLessonService {
return findLessonPersonRecommend;
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) {
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())){
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE);
}
//按课程查询指派表是否为空
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO);
//将指派人截取翻入List中
List<String> userIds = asList(StringUtils.split(appointLessonDTO.getAppointPerson(), ","));
BAppoint bAppoint;
if (bAppoints == null || bAppoints.size() == 0){
//插入指派表
bAppoint = new BAppoint();
bAppoint.setLessonId(appointLessonDTO.getLessonId());
bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson());
UserUtil.setCurrentPersistOperation(bAppoint);
bAppointRepository.insertSelective(bAppoint);
}else {
bAppoint = bAppoints.get(0);
bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson());
UserUtil.setCurrentMergeOperation(bAppoint);
bAppointRepository.updateByPrimaryKeySelective(bAppoint);
//删除指派未开始
bLessonPersonRepository.deleteNotStartByLessonId(appointLessonDTO);
//指派已开始更新为不指派
BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.setIsAppoint("0");
bLessonPerson.setAppointId("");
bLessonPerson.setLessonId(appointLessonDTO.getLessonId());
UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPersonRepository.cancelAppointByPersons(bLessonPerson);
}
//插入b_lesson_person表
appointLessonDTO.setAppointPersonList(userIds);
//查询已学该课程的学习business_id
List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO);
List<String> inLessonIds = new ArrayList<>();
for (BLessonPerson inLessonPerson : inLessonPersons) {
UserUtil.setCurrentMergeOperation(inLessonPerson);
inLessonPerson.setIsAppoint("1");
inLessonPerson.setAppointId(bAppoint.getBusinessId());
inLessonIds.add(inLessonPerson.getPersonId());
}
//更新b_lesson_person表
bLessonPersonRepository.updateList(inLessonPersons);
//从学生Id中删除已更新的学生id
userIds.removeAll(inLessonIds);
//剩余学生添加至b_lesson_person表
List<BLessonPerson> bLessonPersonOthers = new ArrayList<>();
userIds.forEach(userId->{
BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setAppointId(bAppoint.getBusinessId());
bLessonPerson.setIsAppoint("1");
bLessonPerson.setIsFinish("0");
bLessonPerson.setLessonId(appointLessonDTO.getLessonId());
bLessonPerson.setPersonId(userId);
bLessonPersonOthers.add(bLessonPerson);
});
int line = bLessonPersonRepository.insertList(bLessonPersonOthers);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
......@@ -434,6 +495,31 @@ public class BLessonServiceImpl implements BLessonService {
return ListAllLesson;
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) {
//查询当前登录人所在的企业
String corpId = curUser.getCorpId();
String userId = curUser.getUserId();
//查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>();
for (String role : roleList) {
if ("1".equals(role)) {
isAdmin = true;
break;
} else if ("2".equals(role)) {
// 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
//自己
uids.add(curUser);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId);
return bLessons;
}
//遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model){
......@@ -493,30 +579,6 @@ public class BLessonServiceImpl implements BLessonService {
return bViewrange;
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) {
//查询当前登录人所在的企业
String corpId = curUser.getCorpId();
String userId = curUser.getUserId();
//查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>();
for (String role : roleList) {
if ("1".equals(role)) {
isAdmin = true;
break;
} else if ("2".equals(role)) {
// 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
//自己
uids.add(curUser);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId);
return bLessons;
}
}
......@@ -35,7 +35,7 @@ public class BMaterialController extends PaginationController<BMaterial> {
private BMaterialService bMaterialServiceImpl;
@ApiOperation(value="1301 添加", notes="添加")
@ApiOperation(value="1301 添加保存资料", notes="保存资料")
@PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid BMaterial bMaterial, BindingResult bindingResult) {
PersistModel data = bMaterialServiceImpl.save(bMaterial);
......
server:
port: 8081
tomcat:
max-threads: 300
servlet:
context-path: /
#uri-encoding: UTF-8
type: dev1
maxHttpHeaderSize: 102400
#logging:
# level:
# root: INFO
# org.springframework.web: DEBUG
druid:
url: jdbc:mysql://mt_mysql:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: 91isoft
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
initial-size: 1
min-idle: 1
max-active: 20
test-on-borrow: true
mybatis:
mapper-locations: classpath:mapper/**/**/*.xml
mapper:
mappers:
- org.rcisoft.core.base.BaseMapper
not-empty: false
identity: MYSQL
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
spring:
jackson:
default-property-inclusion: non_null
date-format: yyyy-MM-dd
time-zone: GMT+8
mvc:
throw-exception-if-no-handler-found: true
resources:
add-mappings: false
freemarker:
charset: UTF-8
suffix: .ftl
template-loader-path: classpath:/templates/
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
global:
lk:
publicalias: publiccert
storePwd: rcrtcyedu2
subject: edu2
licPath: /lk/license.lic
pubPath: /lk/publicCerts.store
path:
base_upload_server_location: /working/resource/eduServer/
course_location: course
lesson_location: lesson
sl_location: sl
image_location: /upload
video_location: video
audio_location: audio
temp_location: temp
file_location: file
ppt_location: ppt
pdf_location: pdf
cut_pdf_location: cutPdf
cource_logo_location: /course/logo
other:
is_server_linux: 5
cut_pdf_num: 30
libreoffice:
ip: 192.168.1.125
port: 10188
mt:
api: http://221.239.114.20:6789/api/
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false
fetch-registry: false
\ No newline at end of file
......@@ -72,4 +72,12 @@
</root>
</springProfile>
<springProfile name="mt">
<root level="info">
<appender-ref ref="consoleLog" />
<appender-ref ref="fileInfoLog" />
<appender-ref ref="fileErrorLog" />
</root>
</springProfile>
</configuration>
\ No newline at end of file
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