Commit bdbc9f4e authored by luzhuang's avatar luzhuang

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

parents c97e8310 c02afc9b
......@@ -11,6 +11,7 @@ import org.rcisoft.core.aop.PageUtil;
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.UserUtil;
import org.rcisoft.business.bbanner.dao.BBannerRepository;
import org.rcisoft.business.bbanner.entity.BBanner;
......@@ -47,14 +48,14 @@ public class BBannerServiceImpl implements BBannerService {
int line = 0;
//外部链接但外部URL为空或长度为0 抛异常
if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl()))
throw new ServiceException(ResultExceptionEnum.MUST_NOT_FILLED);
throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
//内部链接但类型或课程ID为空或长度为0 抛异常
if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId())))
throw new ServiceException(ResultExceptionEnum.MUST_NOT_FILLED);
throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
if (model.getBusinessId() != null) {
//按ID查询Banner个数
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){
throw new ServiceException(ResultExceptionEnum.NO_DATA);
throw new ServiceException(ResultServiceEnums.NO_DATA);
}
UserUtil.setCurrentMergeOperation(model);
line = bBannerRepository.updateById(model);
......@@ -63,7 +64,7 @@ public class BBannerServiceImpl implements BBannerService {
//查询Banner是否大于等于5个,大于等于五个不允许添加
int countBanner = bBannerRepository.selectCountBanner(addOrUpdateDTO);
if(countBanner >= 5){
throw new ServiceException(ResultExceptionEnum.NOT_MORE_COUNT);
throw new ServiceException(ResultServiceEnums.NOT_MORE_COUNT);
}
//查询最大排序值+1后放入Banner中
int sort = bBannerRepository.selectMaxSort();
......@@ -77,7 +78,7 @@ public class BBannerServiceImpl implements BBannerService {
@Override
public PersistModel removeBanner(String id) {
if (bBannerRepository.selectCountById(id) == 0){
throw new ServiceException(ResultExceptionEnum.NO_DATA);
throw new ServiceException(ResultServiceEnums.NO_DATA);
}
return new PersistModel(1, bBannerRepository.deleteBanner(id));
......
......@@ -62,23 +62,23 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @return
*/
@Select("<script>SELECT" +
" bc.business_id,\n" +
" bc.chapter_name,\n" +
" bc.chapter_level,\n" +
" bc.pid,\n" +
" bc.chapter_url,\n" +
" bc.is_test,\n" +
" bc.lesson_id,\n" +
" bc.business_id, " +
" bc.chapter_name, " +
" bc.chapter_level, " +
" bc.pid, " +
" bc.chapter_url, " +
" bc.is_test, " +
" bc.lesson_id, " +
" bc.sort," +
" bf.video_url AS videoUrl,\n" +
" bf.file_name AS fileName\n" +
" FROM\n" +
" b_chapter bc\n" +
" bf.video_url AS videoUrl, " +
" bf.file_name AS fileName " +
" FROM " +
" b_chapter bc " +
" LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id " +
" WHERE\n" +
" bc.del_flag = 0\n" +
" AND bc.pid = #{pid}\n" +
" ORDER BY\n" +
" WHERE " +
" bc.del_flag = 0 " +
" AND bc.pid = #{pid} " +
" ORDER BY " +
" bc.sort asc</script>")
@ResultMap(value = "SupperChildListResultMap")
List<QueryChapterListResDTO> queryBChaptersByPid(String pid);
......@@ -89,21 +89,21 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param
* @return
*/
@Select("<script>SELECT\n" +
"\tt1.chapter_name,t2.automatic,t5.class_name,t3.`code`,t6.`name`,t2.score,t3.business_id as sId,t2.business_id as scoreId\n" +
"FROM\n" +
"\tb_chapter t1\n" +
"\tLEFT JOIN b_r_student_chapter t2 ON t2.chapter_id = t1.`business_id`\n" +
"\tLEFT JOIN b_student t3 ON t2.student_id = t3.`business_id`\n" +
"\tLEFT JOIN b_r_class_student t4 ON t3.`code` = t4.student_code\n" +
"\tLEFT JOIN b_class t5 ON t5.`code` = t4.class_code\n" +
"\tLEFT JOIN s_user t6 ON t6.login_name = t3.`code`\n" +
@Select("<script>SELECT " +
" t1.chapter_name,t2.automatic,t5.class_name,t3.`code`,t6.`name`,t2.score,t3.business_id as sId,t2.business_id as scoreId " +
"FROM " +
" b_chapter t1 " +
" LEFT JOIN b_r_student_chapter t2 ON t2.chapter_id = t1.`business_id` " +
" LEFT JOIN b_student t3 ON t2.student_id = t3.`business_id` " +
" LEFT JOIN b_r_class_student t4 ON t3.`code` = t4.student_code " +
" LEFT JOIN b_class t5 ON t5.`code` = t4.class_code " +
" LEFT JOIN s_user t6 ON t6.login_name = t3.`code` " +
"WHERE t1.del_flag='0' and t1.flag='1' and t2.is_complete='1' " +
"\nand t2.`score` != -1" +
"\tand t1.business_id = #{dto.chapterId}\n" +
"<if test=\"dto.stuInfo !=null and dto.stuInfo !=''\">AND (t3.code like CONCAT('%',#{dto.stuInfo}.'%') or t6.name like CONCAT('%',#{dto.stuInfo}.'%')) </if> \n" +
"<if test=\"dto.automatic !=null and dto.automatic !=''\">AND t2.automatic = #{dto.stuInfo} </if> \n" +
"<if test=\"dto.classInfo !=null and dto.classInfo !=''\">AND t5.code like like CONCAT('%',#{dto.classInfo}.'%') </if> \n" +
" and t2.`score` != -1" +
" and t1.business_id = #{dto.chapterId} " +
"<if test=\"dto.stuInfo !=null and dto.stuInfo !=''\">AND (t3.code like CONCAT('%',#{dto.stuInfo}.'%') or t6.name like CONCAT('%',#{dto.stuInfo}.'%')) </if> " +
"<if test=\"dto.automatic !=null and dto.automatic !=''\">AND t2.automatic = #{dto.stuInfo} </if> " +
"<if test=\"dto.classInfo !=null and dto.classInfo !=''\">AND t5.code like like CONCAT('%',#{dto.classInfo}.'%') </if> " +
"</script>")
@ResultMap("QueryScoreListByChapterIdResultMap")
List<StudentChapterScoreVO> queryScoreListByChapterId(@Param("dto") QueryScoreListDTO dto);
......@@ -113,12 +113,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param
* @return
*/
@Select("<script>SELECT\n" +
"\tt1.is_complete as isComplete\n" +
"FROM\n" +
"\tb_r_student_chapter t1\n" +
"LEFT JOIN b_student t2 ON t1.student_id = t2.business_id\n" +
"LEFT JOIN s_user t3 ON t3.login_name = t2.code\n" +
@Select("<script>SELECT " +
" t1.is_complete as isComplete " +
"FROM " +
" b_r_student_chapter t1 " +
"LEFT JOIN b_student t2 ON t1.student_id = t2.business_id " +
"LEFT JOIN s_user t3 ON t3.login_name = t2.code " +
"WHERE t1.chapter_id = #{chapterId} and t3.business_id = #{studentId}" +
"</script>")
ScoreInfoDTO queryChapInfoById(@Param("chapterId") String chapterId, @Param("studentId") String studentId);
......@@ -130,16 +130,16 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
* @param stuid
* @return
*/
@Select("<script>SELECT\n" +
"\tt2.chapter_id as chapterId,\n" +
"\tt2.score\n" +
"FROM\n" +
"\tb_chapter t1\n" +
"LEFT JOIN b_r_student_chapter t2 ON t1.business_id = t2.chapter_id\n" +
"LEFT JOIN b_student t4 ON t2.student_id = t4.business_id\n" +
"LEFT JOIN s_user t5 ON t5.login_name = t4.code\n" +
"WHERE\n" +
"\tt3.business_id = #{slid}\n" +
@Select("<script>SELECT " +
" t2.chapter_id as chapterId, " +
" t2.score " +
"FROM " +
" b_chapter t1 " +
"LEFT JOIN b_r_student_chapter t2 ON t1.business_id = t2.chapter_id " +
"LEFT JOIN b_student t4 ON t2.student_id = t4.business_id " +
"LEFT JOIN s_user t5 ON t5.login_name = t4.code " +
"WHERE " +
" t3.business_id = #{slid} " +
"AND t5.business_id = #{stuid} " +
"AND t1.del_flag = 0 and t1.flag = 1</script>")
List<StuScoreDTO> selectScoreListBySlIdAndStuId(@Param("slid") String slid, @Param("stuid") String stuid);
......@@ -281,18 +281,18 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"and business_id = #{businessId}</script>")
String queryMdFileByChapterId(String businessId);
@Select("select CONCAT((SELECT sort from b_chapter where business_id = #{pid}),\n" +
@Select("select CONCAT((SELECT sort from b_chapter where business_id = #{pid}), " +
"'.'," +
"(SELECT sort from b_chapter where business_id = #{businessId})) AS sort \n" +
"(SELECT sort from b_chapter where business_id = #{businessId})) AS sort " +
"from b_chapter where business_id = #{businessId} " +
" and del_flag = 0 and flag = 1 ")
String querySortByPidAndId(@Param("pid") String pid, @Param("businessId") String businessId);
@Select("<script>select bc.*,su.business_id as userId,su.`name` as studentName,su.login_name as stuId from b_chapter bc \n" +
"LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id\n" +
"LEFT JOIN b_student bs on bsc.student_id = bs.business_id\n" +
"LEFT JOIN s_user su on su.login_name = bs.`code` \n" +
@Select("<script>select bc.*,su.business_id as userId,su.`name` as studentName,su.login_name as stuId from b_chapter bc " +
"LEFT JOIN b_r_student_chapter bsc on bc.business_id = bsc.chapter_id " +
"LEFT JOIN b_student bs on bsc.student_id = bs.business_id " +
"LEFT JOIN s_user su on su.login_name = bs.`code` " +
"where bc.business_id = #{chapterId} and bsc.score = '-1' and bsc.is_complete = '1'</script>")
@ResultMap(value = "BaseResultMap")
List<BChapter> queryBchapterStudentById(String chapterId);
......@@ -317,12 +317,12 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"#{businessId},#{studentId},#{chapterId},'1',#{slId},#{score},'0')</script>")
int insertStudentScore(String businessId, String chapterId, String slId, String studentId, String score);
@Select("<script>SELECT bc.business_id as businessId,\n" +
"(SELECT CONCAT((SELECT sort from b_chapter where business_id = bc.pid),\n" +
"'.',\n" +
"(SELECT sort from b_chapter where business_id = bc.business_id),\n" +
"' ',\n" +
"(SELECT chapter_name from b_chapter where business_id = bc.business_id))) as chapterName\n" +
@Select("<script>SELECT bc.business_id as businessId, " +
"(SELECT CONCAT((SELECT sort from b_chapter where business_id = bc.pid), " +
"'.', " +
"(SELECT sort from b_chapter where business_id = bc.business_id), " +
"' ', " +
"(SELECT chapter_name from b_chapter where business_id = bc.business_id))) as chapterName " +
" from b_chapter bc where bc.pid !='-1' AND bc.sl_id = #{slId} ORDER BY chapterName </script>")
List<ChapterSelectDto> chapterListBySlId(String slId);
......@@ -341,9 +341,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"</trim> where student_id = #{studentId} and chapter_id = #{chapterId} </script>")*/
int updateToFinish(ScoreInfoDTO scoreInfoDTO);
@Select(" SELECT business_id AS businessId\n" +
" from b_r_student_chapter \n" +
" where student_id = #{stuId} \n" +
@Select(" SELECT business_id AS businessId " +
" from b_r_student_chapter " +
" where student_id = #{stuId} " +
" and chapter_id = #{chapterId} LIMIT 1")
ScoreInfoDTO queryStudentChapter(@Param("chapterId") String chapterId, @Param("stuId") String stuId);
......@@ -356,10 +356,10 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"(#{businessId},#{studentId},#{chapterId},#{isComplete},#{slId},#{score},#{pptFinish},#{pdfFinish},#{videoFinish},#{paperFinish})</script>")
int insertStudentChapter(ScoreInfoDTO scoreInfoDTO);
@Select("SELECT bsc.is_complete FROM b_r_student_chapter bsc \n" +
"LEFT JOIN b_student bs on bs.business_id = bsc.student_id\n" +
"LEFT JOIN s_user su on su.login_name = bs.`code`\n" +
"WHERE su.business_id = #{userId}\n" +
@Select("SELECT bsc.is_complete FROM b_r_student_chapter bsc " +
"LEFT JOIN b_student bs on bs.business_id = bsc.student_id " +
"LEFT JOIN s_user su on su.login_name = bs.`code` " +
"WHERE su.business_id = #{userId} " +
"and bsc.chapter_id = #{chapId}")
String queryIsCompleteByUserIdAndChapId(@Param("userId") String userId, @Param("chapId") String chapId);
......@@ -409,17 +409,18 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
// int insertBChapter(BChapter model);
@Select("<script>" +
"SELECT bc.* \n" +
"FROM\n" +
"\tb_lesson_person bp\n" +
"\tLEFT JOIN b_lesson b ON bp.lesson_id = b.business_id\n" +
"\tLEFT JOIN b_chapter bc ON bc.business_id = bp.chapter_id \n" +
"WHERE\n" +
"\tbp.chapter_id IS NOT NULL \n" +
"\tAND bp.chapter_id != '' \n" +
"\tAND b.business_id = #{lessonId} " +
"SELECT bc.*, brc.current_location as currentLocation " +
"FROM " +
" b_lesson_person bp " +
" LEFT JOIN b_lesson b ON bp.lesson_id = b.business_id " +
" LEFT JOIN b_chapter bc ON bc.business_id = bp.chapter_id " +
"left join b_r_student_chapter brc on brc.chapter_id = bc.business_id " +
"WHERE " +
" bp.chapter_id IS NOT NULL " +
" AND bp.chapter_id != '' " +
" AND b.business_id = #{lessonId} " +
"</script>")
@ResultMap(value = "BaseResultMap")
BChapter getWithCurrentChapterBylessonId(@Param("lessonId")String lessonId);
@ResultMap(value = "SupperChildListResultMap")
QueryChapterListResDTO getWithCurrentChapterBylessonId(@Param("lessonId")String lessonId);
}
......@@ -49,6 +49,9 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "进度")
private String progress;
@ApiModelProperty(value = "最近进度")
private int currentLocation;
@ApiModelProperty(value = "id")
private String businessId;
......
......@@ -111,6 +111,7 @@ public class BChapterServiceImpl implements BChapterService {
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress()*100 + "%");
childList.setCurrentLocation(brStudentChapterList.get(0).getCurrentLocation());
percent += brStudentChapterList.get(0).getProgress();
}
i++;
......@@ -129,9 +130,6 @@ public class BChapterServiceImpl implements BChapterService {
map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", df.format((float)percent/i) + "%");
map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(lessonId)); // 课程信息
BLessonPerson bLessonPerson = bLessonPersonRepository.selectByPrimaryKey(lessonId);
if (null != bLessonPerson){
}
map.put("currentChapter", bChapterRepository.getWithCurrentChapterBylessonId(lessonId));
return map;
......
......@@ -9,6 +9,8 @@ import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "b_label")
......@@ -18,7 +20,7 @@ import javax.persistence.Transient;
public class BLabel extends IdEntity<BLabel> {
/*标签名称*/
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@Length(min = 1,max = 64,message = "标签名称过长")
private String lName;
}
package org.rcisoft.business.blabel.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blabel.dao.BLabelRepository;
import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blabel.service.BLabelService;
......@@ -34,7 +35,9 @@ public class BLabelServiceImpl implements BLabelService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel insertLabel(BLabel bLabel) {
if(StringUtils.isBlank(bLabel.getLName())){
throw new ServiceException("标签名称不能为空");
}
List<BLabel> line = bLabelRepository.checknameByName(bLabel);
if(line.size()>0){
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
......@@ -46,6 +49,9 @@ public class BLabelServiceImpl implements BLabelService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel updateLabel(BLabel bLabel) {
if(StringUtils.isBlank(bLabel.getLName())){
throw new ServiceException("标签名称不能为空");
}
List<BLabel> line = bLabelRepository.checknameByName(bLabel);
if(line.size()>0){
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
......
......@@ -17,6 +17,7 @@ import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
......@@ -46,6 +47,9 @@ public class BLessonController extends PaginationController<BLesson> {
@Autowired
private BLessonPersonService bLessonPersonService;
@Autowired
private SysRoleService sysRoleService;
@Autowired
private Global global;
......@@ -332,7 +336,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value = "617课程管理显示的全部课程", notes="课程管理显示的全部课程", response = BLesson.class)
@GetMapping(value = "theLessonManage")
public Result theLessonManage(CurUser curUser, @Valid BLesson bLesson, BindingResult bindingResult){
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson);
List<RoleTypeDepartDTO> roleList = sysRoleService.queryRoleTypeByUserId(curUser);
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson ,roleList);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -469,4 +474,20 @@ public class BLessonController extends PaginationController<BLesson> {
lessonId);
}
// /**
// * @author: zhangqingle
// * @param
// * @return
// */
// @ApiOperation(value="626 收藏课程", notes="收藏课程")
// @ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
// @PostMapping(value = "/addCollect")
// public Result addCollect(CurUser curUser, @Valid String lessonId, BindingResult bindingResult) {
// PersistModel data = bLessonService.addCollect(curUser,lessonId);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// lessonId);
// }
}
......@@ -509,20 +509,29 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
ILessonCountDTO iLessonCount(String userId);
/**
* 在学人数加一
* @param BusinessId
* 重新统计在学人数
* @param lessonId
* @return
*/
@Update("update b_lesson set person_number = person_number+1 where business_id = #{BusinessId}")
int personNumberPlusOne(String BusinessId);
@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 lesson_id = #{lessonId})" +
" where business_id = #{lessonId} </script>" )
int personNumberReCount(String lessonId);
/**
* 在学人数减一
* @param BusinessId
* 重新统计收藏人数
* @param lessonId
* @return
*/
@Update("update b_lesson set person_number = person_number-1 where business_id = #{BusinessId}")
int personNumberMinusOne(String BusinessId);
@Update("<script>update b_lesson set collect_number = " +
"(select count(1) from b_lesson_person where 1=1 " +
" and del_flag != 1 and flag = 1 " +
" and is_collect = '1' " +
" and lesson_id = #{lessonId})" +
" where business_id = #{lessonId} </script>" )
int collectNumberReCount(String lessonId);
/**
* 列表页分页查询全部课程
......@@ -829,7 +838,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test='!isAdmin'>" +
"AND les.lecturer_id IN" +
"<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " +
"#{item.userId} " +
"#{item} " +
"</foreach>" +
"</if> " +
"<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" +
......@@ -837,8 +846,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" +
" order by les.release_date desc </script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> selectAllManageLesson(@Param("C" +
"urUserSet") Set<CurUser> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin, @Param("corpId") String corpId) ;
List<BLesson> selectAllManageLesson(@Param("CurUserSet") Set<String> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin, @Param("corpId") String corpId) ;
@Select("<script>" +
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AddMyLearnLessonDTO {
@ApiModelProperty(value = "课程Id",required = true)
......
package org.rcisoft.business.blesson.dto;
import lombok.Data;
import java.util.List;
@Data
public class RoleTypeDepartDTO {
private String type;
private String departs;
private List<String> departList;
}
......@@ -179,7 +179,7 @@ public interface BLessonService{
* @param
* @return
*/
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson);
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson,List<RoleTypeDepartDTO> roleList);
/**
* 分页查询列表页全部
......@@ -189,4 +189,13 @@ public interface BLessonService{
*/
PersistModel deleteRecommend(String lessonId);
/**
* 分页查询列表页全部
* @author: zhangqingle
* @param curUser
* @param lessonId
* @return
*/
PersistModel addCollect(CurUser curUser,String lessonId);
}
......@@ -47,10 +47,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public PersistModel quit(QuitLessonDTO quitLessonDTO) {
BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(quitLessonDTO.getBusinessId());
if ("1".equals(bLessonPerson.getIsAppoint())){
throw new ServiceException(ResultExceptionEnum.APPOINT_NOT_CLOSE);
throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE);
}
//课程在学人数-1
bLessonRepository.personNumberMinusOne(quitLessonDTO.getLessonId());
//重新统计在学人数
bLessonRepository.personNumberReCount(quitLessonDTO.getLessonId());
return new PersistModel(1,bLessonPersonRepository.quit(quitLessonDTO.getBusinessId()));
}
......@@ -74,7 +74,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO) {
String bAppointId = bLessonPersonRepository.selectAppointIdById(cancelAppointDTO);
if (StringUtils.isEmpty(bAppointId)){
throw new ServiceException(ResultExceptionEnum.APPOINT_NOT_CANCEL);
throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CANCEL);
}
BAppoint bAppoint = bAppointRepository.selectById(bAppointId);
......@@ -128,15 +128,16 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson.setIsFinish("1");
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
//课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派
bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setIsFinish("1");
bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId());
bLessonPerson.setPersonId(addMyLearnLessonDTO.getUserId());
line = bLessonPersonRepository.insertBLessonPerson(bLessonPerson);
//课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId());
bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons != null && bLessonPersons.size()>0){
line = 1;
}
......
......@@ -11,6 +11,7 @@ import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.blesson.util.recursion;
import org.rcisoft.business.blesson.dao.BViewrangeRepository;
import org.rcisoft.common.util.feignDto.DeptGetRspDTO;
import org.rcisoft.common.util.feignDto.GetAllRspDTO;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
......@@ -19,6 +20,7 @@ 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;
......@@ -336,7 +338,7 @@ public class BLessonServiceImpl implements BLessonService {
int state = bLessonRepository.findLessonReleaseState(id);
if (state != 0){
throw new ServiceException(ResultExceptionEnum.STATE_NOT_RELEASE);
throw new ServiceException(ResultServiceEnums.STATE_NOT_RELEASE);
}
BLesson bLesson = new BLesson();
......@@ -398,7 +400,7 @@ public class BLessonServiceImpl implements BLessonService {
int line = bRecommendRepository.insertBRecommendSons(bRecommendSons);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}else {
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE);
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
}
......@@ -435,7 +437,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) {
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())){
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE);
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
//按课程查询指派表是否为空
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO);
......@@ -563,7 +565,7 @@ public class BLessonServiceImpl implements BLessonService {
ListAllLesson = bLessonRepository.queryInterestedListByPagination(model);
break;
default:
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE);
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
return ListAllLesson;
......@@ -571,25 +573,35 @@ public class BLessonServiceImpl implements BLessonService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) {
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson,List<RoleTypeDepartDTO> roleList) {
//查询当前登录人所在的企业
String corpId = curUser.getCorpId();
String userId = curUser.getUserId();
//查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
// List<RoleTypeDepartDTO> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
if (roleList == null || roleList.size()<1){
return new ArrayList<>();
}
boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>();
for (String role : roleList) {
if ("1".equals(role)) {
Set<String> uids = new HashSet<>();
Set<String> departIds = new HashSet<>();
for (RoleTypeDepartDTO role : roleList) {
if ("1".equals(role.getType())) {
isAdmin = true;
break;
} else if ("2".equals(role)) {
} else if ("2".equals(role.getType())) {
List<String> departs = asList(StringUtils.split(role.getDeparts(), ","));
departIds.addAll(departs);
// 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
// uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
List<GetAllRspDTO> GetAllRspDTOList = cotactApiRequestClient.getUserByDeptIdSet(corpId,departIds);
for (GetAllRspDTO getAllRspDTO : GetAllRspDTOList) {
uids.add(getAllRspDTO.getId());
}
//自己
uids.add(curUser);
uids.add(userId);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId);
return bLessons;
......@@ -600,7 +612,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId);
if (recommendIds == null || recommendIds.size()<1){
throw new ServiceException(ResultExceptionEnum.NOT_RECOMMEND);
throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND);
}
//修改推荐表
BRecommend bRecommend = new BRecommend();
......@@ -613,6 +625,20 @@ public class BLessonServiceImpl implements BLessonService {
return new PersistModel(line);
}
@Override
public PersistModel addCollect(CurUser curUser,String lessonId) {
AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId,curUser.getCorpId(),curUser.getUserId());
List<BLessonPerson> bLessonPersons = bLessonPersonRepository.selectByPersonAndLesson(param);
if (bLessonPersons == null || bLessonPersons.size()<1){
throw new ServiceException(ResultServiceEnums.B_R_SL_STUDENT_NOT_EXISTS);
}
BLessonPerson bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsCollect("1");
int line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
bLessonRepository.collectNumberReCount(lessonId);
return new PersistModel(line);
}
//遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model){
//标签集合
......
......@@ -476,6 +476,25 @@ public class MTCotactApiRequestClient {
return contactFeignClient.getUserByDeptIds(getUserByDeptIdReqDTO,zxClientType,zxAccountId).getData();
}
/**
* 根据多个部门id的Set集合获取部门内人员
* @param corpId
* @param deptIdSet
* @return
*/
public List<GetAllRspDTO> getUserByDeptIdSet(String corpId,Set<String> deptIdSet){
if(deptIdSet == null || deptIdSet.size() < 1){
return new ArrayList<>();
}
GetUserByDeptIdReqDTO getUserByDeptIdReqDTO = new GetUserByDeptIdReqDTO();
List<Long> deptIdList = new ArrayList<>();
for (String deptId : deptIdSet) {
deptIdList.add(Long.parseLong(deptId));
}
getUserByDeptIdReqDTO.setDeptIds(deptIdList);
return contactFeignClient.getUserByDeptIds(getUserByDeptIdReqDTO,zxClientType,zxAccountId).getData();
}
public List<DeptGetRspDTO> deptListDeptInfoByName(String corpId,String name){
return contactFeignClient.deptListDeptInfoByName(corpId,name,zxClientType,zxAccountId).getData();
}
......
......@@ -24,14 +24,8 @@ public enum ResultExceptionEnum {
OS_HAS_SERVER(4008,"操作系统仍有关联服务器,不可删除"),
START_LXC_SERVER(4009,"启动容器失败"),
EXIST_LXC_SERVER(4010,"已开始其他课程实验,请先关闭其他课程实验"),
NO_DATA(4011,"该数据不存在"),
MUST_NOT_FILLED(4012,"必填未填写"),
NOT_MORE_COUNT(4013,"添加超过规定个数"),
APPOINT_NOT_CLOSE(4014,"必修不能退出"),
STATE_NOT_RELEASE(4015,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(4016,"该课程不能取消指派"),
INVALID_PARAMETER_VALUE(4017,"参数值无效"),
NOT_RECOMMEND(4018,"该课程未推荐")
;
private Integer code;
......
......@@ -210,6 +210,15 @@ public enum ResultServiceEnums {
ZX_FAILED(111,"调用智信接口失败"),
MUST_NOT_FILLED(112,"必填未填写"),
NOT_MORE_COUNT(113,"添加超过规定个数"),
APPOINT_NOT_CLOSE(114,"必修不能退出"),
STATE_NOT_RELEASE(115,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(116,"该课程不能取消指派"),
INVALID_PARAMETER_VALUE(117,"参数值无效"),
NOT_RECOMMEND(118,"该课程未推荐"),
NO_DATA(4011,"该数据不存在"),
;
private Integer code;
......
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.dept.entity.DeptRole;
......@@ -82,4 +83,6 @@ public interface SysRoleService {
int addAdminRoleMenuUser(InitAddAdminDTO initAddAdminDTO,List<RoleMenuDTO> roleMenuDTOs,UserRoleDTO userRoleDTO);
List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser);
}
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
......@@ -181,4 +182,9 @@ public class SysRoleServiceImpl implements SysRoleService {
sysRoleRepository.addRoleMenu(roleMenuDTOs);
return sysRoleRepository.addUserRole(userRoleDTO);
}
@Override
public List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser) {
return sysUserMapper.queryRoleTypeByUserId(curUser.getUserId());
}
}
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.MyInfoDTO;
......@@ -169,13 +170,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
int deleteCompanyUserRole(List<SysUser> userCompanyList);
@Select("<script>SELECT sr.type AS roleList " +
@Select("<script>SELECT sr.type AS type,sr.depart_ids departs " +
"FROM s_user AS su " +
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN tm_admin_role AS sr ON ru.role_id = sr.r_id " +
"WHERE su.del_flag = 0 " +
"and sr.r_status !=0 " +
"AND su.business_id = #{userId}</script>")
List<String> queryRoleTypeByUserId(@Param("userId")String userId);
List<RoleTypeDepartDTO> queryRoleTypeByUserId(@Param("userId")String userId);
/**
* 查询用户 menu 19-09-30
......
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