Commit b2895e00 authored by root's avatar root

添加课程查询

parent ba4be424
...@@ -41,6 +41,10 @@ public interface BCourseRepository extends BaseMapper<BCourse> { ...@@ -41,6 +41,10 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@ResultMap(value = "BaseResultMapDTO") @ResultMap(value = "BaseResultMapDTO")
List<QueryCourseResDTO> queryFirstLevel(); List<QueryCourseResDTO> queryFirstLevel();
/**
* 查询所有分类存到List中
* @return
*/
@Select("select * from b_course where del_flag != '1' and flag ='1'") @Select("select * from b_course where del_flag != '1' and flag ='1'")
@ResultMap(value = "AllCourseResultMap") @ResultMap(value = "AllCourseResultMap")
List<AllCourseDTO> findAllCourse(); List<AllCourseDTO> findAllCourse();
......
...@@ -10,6 +10,7 @@ import org.rcisoft.business.bcourse.service.BCourseService; ...@@ -10,6 +10,7 @@ import org.rcisoft.business.bcourse.service.BCourseService;
import org.rcisoft.business.blesson.dto.AddLessonDTO; import org.rcisoft.business.blesson.dto.AddLessonDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO; import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO; import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.dto.LessonTrainDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
...@@ -112,11 +113,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -112,11 +113,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学") @ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学")
@GetMapping(value = "/queryPersonMoreByPagination") @GetMapping(value = "/queryPersonMoreByPagination")
public Result queryPersonMoreByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) { public Result queryPersonMoreByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null; bLessonService.queryPersonMoreByPagination(getPaginationUtility());
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse();
}
bLessonService.queryPersonMoreByPagination(getPaginationUtility(),firstPageQueryDTO,allCourse);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -127,12 +124,8 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -127,12 +124,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="607 分页查询推荐", notes="分页查询推荐") @ApiOperation(value="607 分页查询推荐", notes="分页查询推荐")
@GetMapping(value = "/queryRecommendByPagination") @GetMapping(value = "/queryRecommendByPagination")
public Result queryRecommendByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) { public Result queryRecommendByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse();
}
String userId = curUser.getUserId(); String userId = curUser.getUserId();
bLessonService.queryRecommendByPagination(getPaginationUtility(),userId, firstPageQueryDTO,allCourse); bLessonService.queryRecommendByPagination(getPaginationUtility(),userId);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -142,12 +135,8 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -142,12 +135,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注") @ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注")
@GetMapping(value = "/queryConcernByPagination") @GetMapping(value = "/queryConcernByPagination")
public Result queryConcernByPagination(CurUser curUser,@Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) { public Result queryConcernByPagination(CurUser curUser) {
List<AllCourseDTO> allCourse = null; bLessonService.queryConcernByPagination(getPaginationUtility());
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse();
}
bLessonService.queryConcernByPagination(getPaginationUtility(), firstPageQueryDTO,allCourse);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -158,12 +147,46 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -158,12 +147,46 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣") @ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣")
@GetMapping(value = "/queryInterestedByPagination") @GetMapping(value = "/queryInterestedByPagination")
public Result queryInterestedByPagination(CurUser curUser, @Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) { public Result queryInterestedByPagination(CurUser curUser) {
bLessonService.queryInterestedByPagination(getPaginationUtility());
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="610 首页分页查询全部课程", notes="根据条件分页查询全部课程")
@GetMapping(value = "/queryHomeBLessonsByPagination")
public Result queryHomeBLessonsByPagination(CurUser curUser, @Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null; List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){ if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse(); allCourse = bCourseService.findAllCourse();
} }
bLessonService.queryInterestedByPagination(getPaginationUtility(), firstPageQueryDTO,allCourse); bLessonService.queryHomeBLessonsByPagination(getPaginationUtility(),firstPageQueryDTO,allCourse);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="611 关闭课程", notes="根据ID关闭一个课程")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/close")
public Result close(CurUser curUser,String businessId,BindingResult bindingResult) {
PersistModel data = bLessonService.closeBLesson(businessId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
@ApiOperation(value="612 课程培训条件查询", notes="课程培训条件查询(工作台)")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
@PostMapping(value = "/findLessonTrain")
public Result findLessonTrain(CurUser curUser, @Valid LessonTrainDTO lessonTrainDTO, BindingResult bindingResult) {
bLessonService.findLessonTrain(getPaginationUtility(),lessonTrainDTO);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
......
...@@ -70,11 +70,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -70,11 +70,24 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Delete("<script>delete from b_lesson_label where lesson_id = #{businessId}</script>") @Delete("<script>delete from b_lesson_label where lesson_id = #{businessId}</script>")
int removeLabelByLessonId(BLesson model); int removeLabelByLessonId(BLesson model);
@Select("<script>select * from b_lesson " + /**
"" + * 单一查询课程信息
"where del_flag != 1 and flag = 1 and lecturer_id = #{lecturerId}" + * @param businessId
"<if test=\"param.releaseState!=null and param.releaseState != ''\">and release_state = #{param.releaseState} </if>" + * @return
"order by update_date desc</script>") */
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" ,bc.c_name courseName " +
" 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 " +
" left join b_course bc on bc.business_id = bl.course_type " +
" 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 bl.business_id = #{businessId} " +
"</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
BLesson selectInfoById(String businessId); BLesson selectInfoById(String businessId);
...@@ -91,7 +104,6 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -91,7 +104,6 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" from b_lesson bl " + " from b_lesson bl " +
" left join s_user su on su.business_id = bl.lecturer_id " + " left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " + " left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
...@@ -125,15 +137,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -125,15 +137,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" <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_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.person_number desc " + " order by bl.person_number desc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryPersonMore(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds); List<BLesson> queryPersonMore();
/** /**
* 按学习人数降序查询推荐 * 按学习人数降序查询推荐
...@@ -147,20 +154,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -147,20 +154,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join b_lesson bl on br.lesson_id = bl.business_id " + " left join b_lesson bl on br.lesson_id = bl.business_id " +
" left join s_user su on su.business_id = bl.lecturer_id " + " left join s_user su on su.business_id = bl.lecturer_id " +
" left join s_user suc on suc.business_id = bl.create_by " + " left join s_user suc on suc.business_id = bl.create_by " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and br.person_id = #{userId} " + " and br.person_id = #{userId} " +
" <if test= \" param.viewParam !=null and param.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{param.viewParam},'%') " + " order by bl.person_number desc " +
" or su.name like CONCAT('%',#{param.viewParam},'%'))</if> " +
" <if test= \" courseIds !=null and courseIds.size() > 0 \">and course_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryRecommend(@Param("userId") String userId, @Param("param") FirstPageQueryDTO param,@Param("courseIds") List<String> sonCourseIds); List<BLesson> queryRecommend(String userId);
/** /**
* 按学习人数降序查询 * 按学习人数降序查询
...@@ -178,15 +180,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -178,15 +180,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" <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_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.collect_number desc " + " order by bl.collect_number desc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryConcern(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds); List<BLesson> queryConcern();
@Select(" <script> select bl.* " + @Select(" <script> select bl.* " +
" ,su.name lecturerName " + " ,su.name lecturerName " +
...@@ -199,15 +196,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -199,15 +196,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and suc.del_flag != 1 and suc.flag = 1 " + " and suc.del_flag != 1 and suc.flag = 1 " +
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" <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_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.hot_number desc " + " order by bl.hot_number desc " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> queryInterested(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds); List<BLesson> queryInterested();
//查询课程中的标签 //查询课程中的标签
@Select(" <script> select blb.business_id businessId,blb.l_name lName" + @Select(" <script> select blb.business_id businessId,blb.l_name lName" +
...@@ -219,5 +211,43 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -219,5 +211,43 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and bls.business_id = #{lessonId} " + " and bls.business_id = #{lessonId} " +
"</script>") "</script>")
List<QueryLabelResDTO> queryLabelByLessonId(String lessonId); List<QueryLabelResDTO> queryLabelByLessonId(String lessonId);
@Select(" <script> select bl.* " +
" ,su.name lecturerName " +
" ,suc.name createByName " +
" 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 " +
// " left join b_course bc on bc.business_id = bl.course_type " +
" 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 bl.release_state = 2 " +
" <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_type in " +
" <foreach item='item' index='index' collection='courseIds' open='(' separator=',' close=')'> #{item} </foreach> " +
" </if> " +
" order by bl.person_number desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryHomeBLesson(@Param("param") FirstPageQueryDTO firstPageQueryDTO,@Param("courseIds") List<String> sonCourseIds);
/**
* 根据课程id关闭课程
* @param model
* @return
*/
@Update({"<script>",
"update b_lesson",
" <set>",
" <if test='updateBy != null'>update_by=#{updateBy},</if>",
" <if test='updateDate != null'>update_date=#{updateDate},</if>",
" release_state = '4'",
" </set>",
"where business_id=#{businessId}",
"</script>"})
int closeLesson(BLesson model);
} }
...@@ -13,20 +13,19 @@ public class AddLessonDTO { ...@@ -13,20 +13,19 @@ public class AddLessonDTO {
@ApiModelProperty(value = "课程id") @ApiModelProperty(value = "课程id")
private String businessId; private String businessId;
@NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程编号") @ApiModelProperty(value = "课程编号")
private String code; private String code;
@NotBlank @NotBlank
@ApiModelProperty(value = "课程名称") @ApiModelProperty(value = "课程名称",required = true)
@Length(min = 1,max = 200,message = "长度最小为1,最大为150") @Length(min = 1,max = 200,message = "长度最小为1,最大为150")
private String lessonName; private String lessonName;
@ApiModelProperty(value = "默认封面图片url") @ApiModelProperty(value = "默认封面图片url")
private String defaultUrl; private String defaultUrl;
@ApiModelProperty(value = "课程分类") @ApiModelProperty(value = "课程分类",required = true)
@NotBlank @NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseType; private String courseType;
...@@ -41,7 +40,7 @@ public class AddLessonDTO { ...@@ -41,7 +40,7 @@ public class AddLessonDTO {
private String viewRange; private String viewRange;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)") @ApiModelProperty(value = "课程类型(0:课程 1:培训)",required = true)
@NotBlank @NotBlank
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonType; private String lessonType;
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.persistence.Transient;
@Data
public class LessonTrainDTO {
@ApiModelProperty(value = "课程名称",required = false)
@Length(min = 1,max = 200,message = "长度最小为1,最大为150")
private String lessonName;
@ApiModelProperty(value = "发布状态(0:待发布 1:审核中 2:已发布 3:已驳回 4:已关闭)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String releaseState;
@ApiModelProperty(value = "创建人姓名")
@Transient
private String createByName;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String lessonType;
}
...@@ -75,7 +75,7 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -75,7 +75,7 @@ public class BLesson extends IdEntity<BLesson> {
private Date releaseDate; private Date releaseDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)") @ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String lessonType; private String lessonType;
@ApiModelProperty(value = "评论数") @ApiModelProperty(value = "评论数")
...@@ -106,11 +106,7 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -106,11 +106,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String lecturerName; private String lecturerName;
@ApiModelProperty(value = "是否学完") @ApiModelProperty(value = "接收标签集合 用‘,’分隔")
@Transient
private String isLearnOver;
@ApiModelProperty(value = "标签集合")
@Transient @Transient
private String labels; private String labels;
...@@ -118,8 +114,12 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -118,8 +114,12 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String createByName; private String createByName;
@ApiModelProperty(value = "标签集合") @ApiModelProperty(value = "返回标签集合")
@Transient @Transient
private List<QueryLabelResDTO> labelList; private List<QueryLabelResDTO> labelList;
@ApiModelProperty(value = "分类名")
@Transient
private String courseName;
} }
package org.rcisoft.business.blesson.service; package org.rcisoft.business.blesson.service;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.bcourse.dto.AllCourseDTO; import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.blesson.dto.AddLessonDTO; import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import java.io.IOException;
import java.util.List; import java.util.List;
/** /**
...@@ -56,7 +50,7 @@ public interface BLessonService{ ...@@ -56,7 +50,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse); List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil);
/** /**
* 分页查找推荐 * 分页查找推荐
...@@ -64,7 +58,7 @@ public interface BLessonService{ ...@@ -64,7 +58,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse); List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId);
/** /**
* 分页查找最受关注 * 分页查找最受关注
...@@ -72,7 +66,7 @@ public interface BLessonService{ ...@@ -72,7 +66,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryConcernByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse); List<BLesson> queryConcernByPagination(PageUtil pageUtil);
/** /**
* 分页查找可能感兴趣的 * 分页查找可能感兴趣的
...@@ -80,7 +74,7 @@ public interface BLessonService{ ...@@ -80,7 +74,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryInterestedByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse); List<BLesson> queryInterestedByPagination(PageUtil pageUtil);
/** /**
* 插入 * 插入
...@@ -90,16 +84,31 @@ public interface BLessonService{ ...@@ -90,16 +84,31 @@ public interface BLessonService{
PersistModel persist(AddLessonDTO model); PersistModel persist(AddLessonDTO model);
/** /**
* 课程信息excel导入 * 逻辑删除
* @param hwb * @param id
* @return * @return
*/ */
PersistModel importExcel(HSSFWorkbook hwb) throws IOException; PersistModel removeBLesson(String id);
/** /**
* 逻辑删除 * 首页条件查询全部课程
* @return
*/
List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse);
/**
* 关闭课程
* @param id * @param id
* @return * @return
*/ */
PersistModel removeBLesson(String id); PersistModel closeBLesson(String id);
/**
* 课程培训条件查询
* @param pageUtil
* @param lessonTrainDTO
* @return
*/
List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO);
} }
...@@ -7,10 +7,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook; ...@@ -7,10 +7,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.bcourse.dao.BCourseRepository; import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO; import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.AddLessonDTO; import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.dto.BLessonIPublishDTO;
import org.rcisoft.business.blesson.dto.FindAllLessonDTO;
import org.rcisoft.business.blesson.dto.FirstPageQueryDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.blesson.entity.BLessonLabel; import org.rcisoft.business.blesson.entity.BLessonLabel;
...@@ -18,10 +15,7 @@ import org.rcisoft.business.blesson.util.recursion; ...@@ -18,10 +15,7 @@ import org.rcisoft.business.blesson.util.recursion;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,7 +23,6 @@ import org.springframework.stereotype.Service; ...@@ -29,7 +23,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -80,38 +73,21 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -80,38 +73,21 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
public List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil) {
List<String> sonCourseIds = null; return bLessonRepository.queryPersonMore();
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryPersonMore(firstPageQueryDTO,sonCourseIds);
} }
@Override @Override
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId) {
List<String> sonCourseIds = null; return bLessonRepository.queryRecommend(userId);
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryRecommend(userId,firstPageQueryDTO,sonCourseIds);
} }
@Override @Override
public List<BLesson> queryConcernByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryConcernByPagination(PageUtil pageUtil) {
List<String> sonCourseIds = null; return bLessonRepository.queryConcern();
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryConcern(firstPageQueryDTO,sonCourseIds);
} }
@Override @Override
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil,FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryInterestedByPagination(PageUtil pageUtil) {
List<String> sonCourseIds = null; return bLessonRepository.queryInterested();
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryInterested(firstPageQueryDTO,sonCourseIds);
} }
...@@ -176,118 +152,6 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -176,118 +152,6 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override
public PersistModel importExcel(HSSFWorkbook hwb) throws IOException {
ArrayList<BLesson> lessons = new ArrayList<BLesson>();
ArrayList<String> repeatCode = new ArrayList<String>();
List<String> errorCode = new ArrayList<>();
ArrayList<String> direction = new ArrayList<String>();
List<String> isChinese = new ArrayList<>();
List<String> isNegative = new ArrayList<>();
List<String> currentlyCode = new ArrayList<>();
String innerRepeatResult = "";
String[] headers = {"课程编号","课程名称","课程方向编号","学时","学分"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
if (values.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
}
// for(String[] value:values){ //将数据封装到entity
// BLesson bLesson = null;
// String classCode = value[0];
//
// //判断编号是否含有中文
// if(TestChinese.isChinese(classCode)){
// isChinese.add(value[0]);
// continue;
// };
//
// //判断1:班级编号是否满足<15位;
// if(classCode.length()>15){
// //该用户不满足要求,记入valuesShort中
// errorCode.add(value[0]);
// continue;
// }
//
// if(Integer.parseInt(value[4])<0||Integer.parseInt(value[3])<0){
// //该用户不满足要求,记入valuesShort中
// isNegative.add(value[0]);
// continue;
// }
// if((bLesson=bLessonRepository.queryBLessonByCode(value[0]))!=null) {
// repeatCode.add(value[0]);
// continue;
// }
// BDirection b_direction = bDirectionRepository.selectOne(new BDirection(value[2]));
// if (b_direction == null) {
// if (!direction.contains(value[2]))
// direction.add(value[2]);
// continue;
// }
// bLesson= new BLesson(value[0],value[1],value[3],value[4]);
// bLesson.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
// UserUtil.setCurrentPersistOperation(bLesson);
// //表中去重
// if(currentlyCode.contains(bLesson.getCode())){
// innerRepeatResult += "编号 " + value[1] + " 在Excel中重复出现,除第一条以外的数据插入失败 \n";
// continue;
// }
// if(!lessons.contains(bLesson)){
// currentlyCode.add(bLesson.getCode());
// lessons.add(bLesson);
//
// BLessonDirection bDirection = new BLessonDirection();
// bDirection.setDirectionId(b_direction.getBusinessId());
// bDirection.setBusinessId(IdGen.uuid());
// bDirection.setLessionId(bLesson.getBusinessId());
// bDirectionRepository.insertBLessonDirection(bDirection);
// }
// }
String result ="";
if(lessons.size()>0){
int line = bLessonRepository.insertList(lessons);
if (line>0) {
result+="成功导入"+lessons.size()+"门课程。";
}else{
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR);
}
}
if(isNegative.size()>0){
result+="以下课程的学时或学分不能为负数:"+ JSON.toJSONString(isNegative)+"。";
}
if(isChinese.size()>0){
result+="以下编号格式不正确:"+ JSON.toJSONString(isChinese)+"。";
}
if(repeatCode.size()>0){
result+="以下课程编号存在重复:"+ JSON.toJSONString(repeatCode)+"。";
}
if(errorCode.size()>0){
result+="以下课程编号超过15位:"+ JSON.toJSONString(errorCode)+"。";
}
if(direction.size()>0){
result+="以下课程方向编号不存在:"+ JSON.toJSONString(direction)+"。";
}
if (lessons.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST.getCode(),result);
}
return new PersistModel(1,result + innerRepeatResult);
}
public PersistModel importPic(HSSFWorkbook hwb) throws IOException
{
return null;
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Override @Override
public PersistModel removeBLesson(String id) { public PersistModel removeBLesson(String id) {
...@@ -307,6 +171,30 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -307,6 +171,30 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) {
List<String> sonCourseIds = null;
if (allCourse != null){
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
}
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO,sonCourseIds);
}
@Override
public PersistModel closeBLesson(String id) {
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.closeLesson(bLesson);
//int line = bLessonRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
public List<BLesson> findLessonTrain(PageUtil pageUtil, LessonTrainDTO lessonTrainDTO) {
return null;
}
private Map<String,Object> queryParamHandler(BLesson model){ private Map<String,Object> queryParamHandler(BLesson model){
Map param = new HashMap<String, Object>(); Map param = new HashMap<String, Object>();
if(model.getLessonName()!=null) if(model.getLessonName()!=null)
......
package org.rcisoft.business.blessonperson.controller; package org.rcisoft.business.blessonperson.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid; import javax.validation.Valid;
@Api(tags = "9 学生-课程")
@RestController @RestController
@RequestMapping("/BLessonPerson") @RequestMapping("/BLessonPerson")
@Slf4j @Slf4j
...@@ -32,7 +34,7 @@ public class BLessonPersonController extends PaginationController<BLesson> { ...@@ -32,7 +34,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
@Autowired @Autowired
private BLessonPersonService bLessonPersonService; private BLessonPersonService bLessonPersonService;
@ApiOperation(value="退出课程", notes="根据ID停用一条记录") @ApiOperation(value="901 退出课程", notes="根据ID停用一条记录")
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar") @ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit") @PostMapping(value = "/quit")
public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) { public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) {
...@@ -43,7 +45,7 @@ public class BLessonPersonController extends PaginationController<BLesson> { ...@@ -43,7 +45,7 @@ public class BLessonPersonController extends PaginationController<BLesson> {
businessId); businessId);
} }
@ApiOperation(value="分页查询我学习", notes="分页查询我学习") @ApiOperation(value="902 分页查询我学习", notes="分页查询我学习")
@GetMapping(value = "/queryLearnBLessonsByPagination") @GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) { public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId(); String userId = curUser.getUserId();
......
...@@ -25,7 +25,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> { ...@@ -25,7 +25,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
" where blp.del_flag != 1 and blp.flag = 1 " + " where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " + " and bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " + " and su.del_flag != 1 and su.flag = 1 " +
" and bl.release_state = '2' and blp.person_id = #{userId} " + // " and bl.release_state = '2' " +
" and blp.person_id = #{userId} " +
" <if test= \" param.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> " + " <if test= \" param.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> " +
" <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " + " <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
" order by blp.update_date desc</script>") " order by blp.update_date desc</script>")
......
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