Commit 709c712b authored by zhangqingle's avatar zhangqingle

修改接口

parent 70ce3c9a
...@@ -160,6 +160,18 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -160,6 +160,18 @@ public class BChapterController extends PaginationController<BChapter> {
newFileUrl); newFileUrl);
} }
@ApiOperation(value = "207 预览文件", notes = "(预览时传)", response = QueryChapterListResDTO.class)
@GetMapping("/getFileAtView")
public Result getFileAtView(CurUser curUser, @RequestParam BFile file, BindingResult br,HttpServletRequest request , HttpServletResponse response) throws IOException {
String newFileUrl = bChapterService.changeFileToPdfAtView(file);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
newFileUrl);
}
// //
// @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态") // @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"), // @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
......
...@@ -83,6 +83,13 @@ public interface BChapterService{ ...@@ -83,6 +83,13 @@ public interface BChapterService{
*/ */
String changeFileToPdf(String chapterId); String changeFileToPdf(String chapterId);
/**
* 文件转换
* @param bFile
* @return
*/
String changeFileToPdfAtView(BFile bFile);
/** /**
* 打分 * 打分
* @param scoreInfoDTOS * @param scoreInfoDTOS
......
...@@ -289,6 +289,16 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -289,6 +289,16 @@ public class BChapterServiceImpl implements BChapterService {
public String changeFileToPdf(String chapterId) { public String changeFileToPdf(String chapterId) {
//1. 获取文件信息 //1. 获取文件信息
BFile bFile = bFileRepository.selectInfoByChapterId(chapterId); BFile bFile = bFileRepository.selectInfoByChapterId(chapterId);
return changeFile(bFile);
}
@Override
public String changeFileToPdfAtView(BFile bFile) {
return changeFile(bFile);
}
public String changeFile(BFile bFile){
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+"/"+bFile.getLessonId(); String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+"/"+bFile.getLessonId();
String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+bFile.getLessonId(); String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+bFile.getLessonId();
File file=new File(filePath); File file=new File(filePath);
...@@ -318,15 +328,18 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -318,15 +328,18 @@ public class BChapterServiceImpl implements BChapterService {
throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR); throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR);
} }
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath //4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
if (StringUtils.isNotEmpty(bFile.getChapterId())){
bFile.setFileUrl(filePath+"/"+newName); bFile.setFileUrl(filePath+"/"+newName);
bFileRepository.updateByPrimaryKeySelective(bFile); bFileRepository.updateByPrimaryKeySelective(bFile);
}
return returnBasePath+"/"+newName; return returnBasePath+"/"+newName;
} }
}else{ }else{
return null; return null;
} }
} }
//下载 //下载
public String downLoadFile(BFile bFile,File file,String filePath){ public String downLoadFile(BFile bFile,File file,String filePath){
//判断文件夹是否存在 //判断文件夹是否存在
......
...@@ -32,10 +32,10 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> { ...@@ -32,10 +32,10 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
@Select("<script>select * from b_train_file where 1=1 " @Select("<script>select * from b_train_file where 1=1 "
+ "and del_flag != 1 " + "and del_flag != 1 "
+ "and flag = 1 " + "and flag = 1 "
+ "and lessonId = #{lessonId} " + "and lesson_id = #{lessonId} "
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BTrainFile> queryByLessonId(String lessonId); List<BTrainFile> queryByLessonId(@Param("lessonId") String lessonId);
@Insert("<script>INSERT INTO b_train_file " + @Insert("<script>INSERT INTO b_train_file " +
......
package org.rcisoft.business.bfile.entity; package org.rcisoft.business.bfile.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -23,32 +24,38 @@ public class BFile extends IdEntity<BFile> { ...@@ -23,32 +24,38 @@ public class BFile extends IdEntity<BFile> {
private static final long serialVersionUID = 5501554322621964535L; private static final long serialVersionUID = 5501554322621964535L;
/*视频名称*/ /*视频名称*/
@Length(min = 1,max = 256,message = "长度最小为1,最大为200") // @Length(min = 1,max = 256,message = "长度最小为1,最大为200")
@NotBlank // @NotBlank
@ApiModelProperty(value = "文件名(预览时传)")
private String fileName; private String fileName;
/*视频地址*/ /*视频地址*/
@Length(min = 1,max = 256,message = "长度最小为1,最大为200") // @Length(min = 1,max = 256,message = "长度最小为1,最大为200")
@NotBlank // @NotBlank
@ApiModelProperty(value = "地址(预览时传)")
private String videoUrl; private String videoUrl;
/*0视频 1音频 2ppt 3pdf 4附件*/ /*0视频 1音频 2ppt 3pdf 4附件*/
@ApiModelProperty(value = "类型(预览时传)")
private String type; private String type;
@Length(min = 1,max = 256,message = "长度最小为1,最大为200") // @Length(min = 1,max = 256,message = "长度最小为1,最大为200")
@NotBlank // @NotBlank
private String fileUrl; private String fileUrl;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") // @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank // @NotBlank
@ApiModelProperty(value = "课程ID(预览时传)")
private String lessonId;//课程ID private String lessonId;//课程ID
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") // @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank // @NotBlank
@ApiModelProperty(value = "节ID")
private String chapterId;//节ID private String chapterId;//节ID
//文件大小 //文件大小
@Length(min = 1,max = 15,message = "长度最小为1,最大为15") // @Length(min = 1,max = 15,message = "长度最小为1,最大为15")
@ApiModelProperty(value = "文件大小")
private String fileSize; private String fileSize;
} }
......
...@@ -100,7 +100,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -100,7 +100,7 @@ public class BLessonController extends PaginationController<BLesson> {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.selectOne(businessId)); bLessonService.selectOne(curUser,businessId));
} }
/** /**
...@@ -503,6 +503,23 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -503,6 +503,23 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.iTrainCount(userId)); bLessonService.iTrainCount(userId));
} }
/**
* @author: zhangqingle
* @param
* @return
*/
@ApiOperation(value="629 培训学员总数(已报名 已到场 未到场)", notes="培训学员总数(已报名 已到场 未到场)")
@GetMapping(value = "/trainPersonCount")
public Result trainPersonCount(CurUser curUser,String lessonId ,BindingResult bindingResult ) {
String userId = curUser.getUserId();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.trainPersonCount(lessonId));
}
// /** // /**
// * @author: zhangqingle // * @author: zhangqingle
// * @param // * @param
......
...@@ -494,28 +494,28 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -494,28 +494,28 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" 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 bl.lesson_type = 0 " + " and bl.lesson_type = 0 " +
" and blp.person_id = #{userId} and is_finish is not null ) learnAllCount, " + " and blp.person_id = #{userId} and blp.is_finish is not null ) learnAllCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 0 " + " and bl.lesson_type = 0 " +
" and blp.person_id = #{userId} and is_finish = '2') finishCount, " + " and blp.person_id = #{userId} and blp.is_finish = '2') finishCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 0 " + " and bl.lesson_type = 0 " +
" and blp.person_id = #{userId} and is_finish = '1') notFinishCount, " + " and blp.person_id = #{userId} and blp.is_finish = '1') notFinishCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 0 " + " and bl.lesson_type = 0 " +
" and blp.person_id = #{userId} and is_finish = '0') notStartCount " + " and blp.person_id = #{userId} and blp.is_finish = '0') notStartCount " +
"</script>"}) "</script>"})
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
...@@ -543,31 +543,68 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -543,31 +543,68 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" 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 bl.lesson_type = 1 " + " and bl.lesson_type = 1 " +
" and blp.person_id = #{userId} and train_is_sign is not null ) learnAllCount, " + " and blp.person_id = #{userId} and blp.train_is_sign is not null ) learnAllCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 1 " + " and bl.lesson_type = 1 " +
" and blp.person_id = #{userId} and train_is_sign = '2') finishCount, " + " and blp.person_id = #{userId} and blp.train_is_sign = '2') finishCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 1 " + " and bl.lesson_type = 1 " +
" and blp.person_id = #{userId} and train_is_sign = '1') notFinishCount, " + " and blp.person_id = #{userId} and blp.train_is_sign = '1') notFinishCount, " +
"(select COUNT(1) from b_lesson_person blp " + "(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " + " LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" 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 bl.lesson_type = 1 " + " and bl.lesson_type = 1 " +
" and blp.person_id = #{userId} and train_is_sign = '0') notStartCount " + " and blp.person_id = #{userId} and blp.train_is_sign = '0') notStartCount " +
"</script>"}) "</script>"})
ILessonCountDTO iTrainCount(String userId); ILessonCountDTO iTrainCount(String userId);
/**
* 查询我教学和我学习培训数量
* @param lessonId
* @return
*/
@Select({"<script>",
" select "+
"(select COUNT(1) from b_lesson_person blp " +
" LEFT join b_lesson bl on blp.lesson_id = bl.business_id " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.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 " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.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 " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.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 " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and bl.lesson_type = 1 " +
" and blp.lesson_id = #{lessonId} and blp.train_is_sign = '0') notStartCount " +
"</script>"})
ILessonCountDTO trainPersonCount(String lessonId);
/** /**
* 重新统计在学人数 * 重新统计在学人数
* @param lessonId * @param lessonId
...@@ -902,6 +939,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -902,6 +939,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</foreach>" + "</foreach>" +
"</if> " + "</if> " +
"<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" + "<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" +
"<if test=\"bLesson.lessonType!=null and bLesson.lessonType!=''\">AND les.lesson_type = #{bLesson.lessonType} </if>" +
"<if test=\"bLesson.lecturerId!=null and bLesson.lecturerId!=''\">AND u1.name like '%${bLesson.lecturerId}%' </if>" + "<if test=\"bLesson.lecturerId!=null and bLesson.lecturerId!=''\">AND u1.name like '%${bLesson.lecturerId}%' </if>" +
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" + "<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" +
" order by les.release_date desc </script>") " order by les.release_date desc </script>")
......
package org.rcisoft.business.blesson.dao; package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blesson.dto.BViewRangeSonDTO;
import org.rcisoft.business.blesson.entity.BViewrangeSon; import org.rcisoft.business.blesson.entity.BViewrangeSon;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.blesson.entity.BViewrange; import org.rcisoft.business.blesson.entity.BViewrange;
...@@ -51,5 +52,35 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> { ...@@ -51,5 +52,35 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
"(#{item.businessId},#{item.viewrangeId},#{item.type},#{item.targetId})" + "(#{item.businessId},#{item.viewrangeId},#{item.type},#{item.targetId})" +
"</foreach></script>") "</foreach></script>")
int insertBViewrangeSons(List<BViewrangeSon> bViewrangeSons); int insertBViewrangeSons(List<BViewrangeSon> bViewrangeSons);
@Select("<script>select bvs.viewrange_id viewrangeId,bvs.type type,bvs.target_id targetId from b_viewrange_son bvs left join b_viewrange bv on bvs.viewrange_id = bv.business_id " +
" where 1=1 "+
" and bv.del_flag != 1 and bv.flag = 1 "+
" and bv.lesson_id = #{lessonId} "+
" and bvs.type = 1 "+
" and bv.corp_id = #{corpId} "+
"</script>")
List<BViewRangeSonDTO> selectDepartByLessonId(@Param("corpId") String corpId,@Param("lessonId")String lessonId);
@Select("<script>select bvs.viewrange_id viewrangeId,bvs.type type,bvs.target_id targetId,su.name targetName from b_viewrange_son bvs " +
" left join b_viewrange bv on bvs.viewrange_id = bv.business_id " +
" left join s_user su on bvs.target_id = su.business_id " +
" and su.del_flag != 1 and su.flag = 1 "+
" and su.corp_id = #{corpId} "+
" where 1=1 "+
" and bv.del_flag != 1 and bv.flag = 1 "+
" and bv.lesson_id = #{lessonId} "+
" and bvs.type = 0 "+
" and bv.corp_id = #{corpId} "+
"</script>")
List<BViewRangeSonDTO> selectPersonByLessonId(@Param("corpId") String corpId,@Param("lessonId")String lessonId);
} }
...@@ -7,21 +7,20 @@ import org.hibernate.validator.constraints.Length; ...@@ -7,21 +7,20 @@ import org.hibernate.validator.constraints.Length;
@Data @Data
public class BViewRangeSonDTO { public class BViewRangeSonDTO {
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String value; private String value;
@ApiModelProperty(value = "可见范围id") @ApiModelProperty(value = "可见范围id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String viewrangeId; private String viewrangeId;
@ApiModelProperty(value = "可见类型(0:人 1:部门)") @ApiModelProperty(value = "可见类型(0:人 1:部门)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String type; private String type;
@ApiModelProperty(value = "人/部门id") @ApiModelProperty(value = "人/部门id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String targetId; private String targetId;
@ApiModelProperty(value = "人/部门名")
private String targetName;
} }
...@@ -18,16 +18,16 @@ public class ILessonCountDTO { ...@@ -18,16 +18,16 @@ public class ILessonCountDTO {
@ApiModelProperty(value = "我发布已关闭课程(我教学已关闭培训)数量") @ApiModelProperty(value = "我发布已关闭课程(我教学已关闭培训)数量")
private String closedCount; private String closedCount;
@ApiModelProperty(value = "我学习全部课程数量(我报名全部培训数量)") @ApiModelProperty(value = "我学习全部课程数量(我报名全部培训数量)(该培训已报名数量)")
private String learnAllCount; private String learnAllCount;
@ApiModelProperty(value = "我学完课程数量(我报名已参加培训数量)") @ApiModelProperty(value = "我学完课程数量(我报名已参加培训数量)(该培训已参加数量)")
private String finishCount; private String finishCount;
@ApiModelProperty(value = "我未学完课程数量(我报名缺勤培训数量)") @ApiModelProperty(value = "我未学完课程数量(我报名缺勤培训数量)(该培训缺勤数量)")
private String notFinishCount; private String notFinishCount;
@ApiModelProperty(value = "我未开始课程数量(我报名待参加培训数量") @ApiModelProperty(value = "我未开始课程数量(我报名待参加培训数量) (该培训待参加数量)")
private String notStartCount; private String notStartCount;
} }
...@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor; ...@@ -7,6 +7,7 @@ import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.rcisoft.business.bfile.entity.BTrainFile; import org.rcisoft.business.bfile.entity.BTrainFile;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO; import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blesson.dto.BViewRangeSonDTO;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
...@@ -170,10 +171,18 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -170,10 +171,18 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String viewRangePerson; private String viewRangePerson;
@ApiModelProperty(value = "可见范围(人)返回集合")
@Transient
private List<BViewRangeSonDTO> viewRangePersonList;
@ApiModelProperty(value = "可见范围(部门)多人之间用','隔开") @ApiModelProperty(value = "可见范围(部门)多人之间用','隔开")
@Transient @Transient
private String viewRangeDepart; private String viewRangeDepart;
@ApiModelProperty(value = "可见范围(部门)返回集合")
@Transient
private List<BViewRangeSonDTO> viewRangeDepartList;
public void initModel(){ public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); // this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......
...@@ -20,7 +20,7 @@ public interface BLessonService{ ...@@ -20,7 +20,7 @@ public interface BLessonService{
* @param businessId * @param businessId
* @return * @return
*/ */
BLesson selectOne(String businessId); BLesson selectOne(CurUser curUser,String businessId);
/** /**
* 根据bLesson对象查询 * 根据bLesson对象查询
...@@ -170,6 +170,14 @@ public interface BLessonService{ ...@@ -170,6 +170,14 @@ public interface BLessonService{
*/ */
ILessonCountDTO iTrainCount(String userId); ILessonCountDTO iTrainCount(String userId);
/**
* 课程学员总数
* @author: zhangqingle
* @param lessonId
* @return
*/
ILessonCountDTO trainPersonCount(String lessonId);
/** /**
* 分页查询列表页全部 * 分页查询列表页全部
* @author: zhangqingle * @author: zhangqingle
......
...@@ -75,27 +75,36 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -75,27 +75,36 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
MTCotactApiRequestClient cotactApiRequestClient; MTCotactApiRequestClient cotactApiRequestClient;
// //获取部门(目前写死)
// private List<String> getDeparts(){
// List<String> departs = new ArrayList<>();
// departs.add("1");
// departs.add("2");
// departs.add("3");
// return departs;
// }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public BLesson selectOne(String businessId) { public BLesson selectOne(CurUser curUser,String lessonId) {
BLesson bLesson = bLessonRepository.selectInfoById(businessId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId);
if ("1".equals(bLesson.getLessonType())){ if ("1".equals(bLesson.getLessonType())){
List<BTrainFile> bTrainFileList = bTrainFileRepository.queryByLessonId(bLesson.getBusinessId()); List<BTrainFile> bTrainFileList = bTrainFileRepository.queryByLessonId(bLesson.getBusinessId());
bLesson.setBTrainFileList(bTrainFileList); bLesson.setBTrainFileList(bTrainFileList);
} }
List<FindDepartByNameDTO> departs = cotactApiRequestClient.deptListDeptInfoByName(curUser.getCorpId(),"");
//查询该课程推荐的所有人
List<BViewRangeSonDTO> selectPersonByLessonIds = bViewrangeRepository.selectPersonByLessonId(curUser.getCorpId(),lessonId);
bLesson.setViewRangePersonList(selectPersonByLessonIds);
//查询该课程推荐的所有部门
List<BViewRangeSonDTO> selectDepartByLessonIds = bViewrangeRepository.selectDepartByLessonId(curUser.getCorpId(),lessonId);
if ( selectDepartByLessonIds != null && selectDepartByLessonIds.size() > 0){
for (FindDepartByNameDTO depart : departs) {
for (BViewRangeSonDTO selectDepartByLessonId : selectDepartByLessonIds) {
if ( depart.getId().equals(selectDepartByLessonId.getTargetId())){
selectDepartByLessonId.setTargetName(depart.getName());
}
}
}
bLesson.setViewRangeDepartList(selectDepartByLessonIds);
}
return bLesson; return bLesson;
} }
...@@ -576,6 +585,11 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -576,6 +585,11 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.iTrainCount(userId); return bLessonRepository.iTrainCount(userId);
} }
@Override
public ILessonCountDTO trainPersonCount(String lessonId) {
return bLessonRepository.trainPersonCount(lessonId);
}
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryListAllLessonByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse) { public List<BLesson> queryListAllLessonByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse) {
...@@ -658,13 +672,14 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -658,13 +672,14 @@ public class BLessonServiceImpl implements BLessonService {
// uids.addAll(Arrays.asList(new CurUser(), new CurUser())); // uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
} }
} }
if (!isAdmin){
List<GetAllRspDTO> GetAllRspDTOList = cotactApiRequestClient.getUserByDeptIdSet(corpId,departIds); List<GetAllRspDTO> GetAllRspDTOList = cotactApiRequestClient.getUserByDeptIdSet(corpId,departIds);
if (GetAllRspDTOList != null && GetAllRspDTOList.size()>0){ if (GetAllRspDTOList != null && GetAllRspDTOList.size()>0){
for (GetAllRspDTO getAllRspDTO : GetAllRspDTOList) { for (GetAllRspDTO getAllRspDTO : GetAllRspDTOList) {
uids.add(getAllRspDTO.getId()); uids.add(getAllRspDTO.getId());
} }
} }
}
//自己 //自己
uids.add(userId); uids.add(userId);
//查讯课程的语句 //查讯课程的语句
......
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