Commit 709c712b authored by zhangqingle's avatar zhangqingle

修改接口

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