Commit bfc6e277 authored by 王淑君's avatar 王淑君

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents 512de1bb 8b029b71
......@@ -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);
}
......@@ -8,7 +8,7 @@ import lombok.Data;
@Data
public class ChapterDTO {
@ApiModelProperty(value = "课程id 修改章节时传入")
@ApiModelProperty(value = "章节id 修改章节时传入")
private String businessId;
@ApiModelProperty(value = "课程ID")
......
......@@ -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.updateCourseTimeForLesson(time,lessonId);
bChapterRepository.updateVideoTimeInLesson(time,lessonId);
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false);
//删除student_chapter表中数据
bChapterRepository.deleteStudentChapter(id,userId);
bChapterRepository.deleteBStudentChapter(id,userId);
}
return new PersistModel(line);
......
......@@ -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);
}
}
......@@ -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);
......
......@@ -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} " +
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -284,4 +284,7 @@ public interface BLessonService{
*/
List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType , CurUser curUser);
PersistModel judgeVisibleAuthority(CurUser curUser, String lessonId);
}
......@@ -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){
......
......@@ -73,7 +73,7 @@ public class BMaterialController extends PaginationController<BMaterial> {
@ApiOperation(value="1303批量删除", notes="批量删除")
@ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "删除business 用逗号隔开", required = false, dataType = "varchar")})
@DeleteMapping("/deleteMore")
@PostMapping("/deleteMore")
public Result deleteMore(CurUser curUser,@Valid String ids, BindingResult bindingResult) {
PersistModel data = bMaterialServiceImpl.removeMore(ids, curUser);
return Result.builder(data,
......
......@@ -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);
}
......@@ -14,6 +14,8 @@ public class DelMoreDTO {
private String delFlag;
private String flag;
private List<String> idList;
}
......@@ -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);
//设置上传类型为 保存
......
......@@ -15,6 +15,6 @@ public class GetSubUserIdsByDeptIdsReqDTO {
@ApiModelProperty(value = "部门id集合(可选)", position = 2)
@Order(3)
private List<Integer> deptIds;
private List<Long> deptIds;
}
......@@ -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();
......
......@@ -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 {
......
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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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 " +
......
......@@ -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());
......
......@@ -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
......@@ -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
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