Commit b4b3e9a7 authored by root's avatar root

修改接口、添加新接口

parent 52441469
......@@ -28,14 +28,14 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
* @param param
* @return
*/
@Select("<script>select bb.* , bl.lesson_name lessonName from b_banner bb " +
@Select("<script>select bb.* , bl.lesson_name lessonName,bl.default_url lessonDefaultUrl from b_banner bb " +
" left join b_lesson bl on bb.course_id = bl.business_id " +
" and bl.corp_id = #{corpId} "+
" and bl.del_flag='0' and bl.flag = '1'" +
" where bb.del_flag='0' and bb.flag = '1' " +
" <if test=\"businessId!=null and businessId != ''\">and bb.business_id = #{businessId})</if>" +
" <if test=\"businessId!=null and businessId != ''\">and bb.business_id = #{businessId}</if>" +
" <if test=\"title!=null and title != ''\">and bb.title like CONCAT('%',#{title},'%')</if>" +
" <if test=\"isExternalLink!=null and isExternalLink != ''\">and bb.is_external_link=#{isExternalLink}</if>" +
" <if test=\"lineType!=null and lineType != ''\">and bb.line_type=#{lineType}</if>" +
......@@ -47,6 +47,21 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
@ResultMap(value = "BaseResultMap" )
List<BBanner> queryBanners(FindBannerPaginDTO param);
@Select("<script>select bb.* , bl.lesson_name lessonName ,bl.default_url from b_banner bb " +
" left join b_lesson bl on bb.course_id = bl.business_id " +
// " and bl.corp_id = #{corpId} "+
" and bl.del_flag='0' and bl.flag = '1'" +
" where bb.del_flag='0' and bb.flag = '1' " +
" and bb.business_id = #{businessId}" +
// " and bb.corp_id = #{corpId} "+
"</script>")
@ResultMap(value = "BaseResultMap" )
BBanner queryOne(String businessId);
/**
* 按id查询个数
* @param id
......
......@@ -11,6 +11,7 @@ import org.rcisoft.sys.dept.entity.SysDept;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
......@@ -23,7 +24,7 @@ import javax.validation.constraints.NotBlank;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BBanner extends IdEntity<SysDept> {
public class BBanner extends IdEntity<BBanner> {
private static final long serialVersionUID = 8683139175568024924L;
......@@ -58,5 +59,10 @@ public class BBanner extends IdEntity<SysDept> {
private Integer bannerSort;
@ApiModelProperty(value = "课程名")
// @Transient
private String lessonName;
@ApiModelProperty(value = "课程名")
// @Transient
private String lessonDefaultUrl;
}
\ No newline at end of file
......@@ -38,7 +38,7 @@ public interface BBannerService {
* @param businessId
* @return
*/
BannerInfoRspDTO selectOne(String businessId);
BBanner selectOne(String businessId);
/**
* 获取Banner分页
......
......@@ -84,11 +84,9 @@ public class BBannerServiceImpl implements BBannerService {
}
@Override
public BannerInfoRspDTO selectOne(String id) {
BBanner banner = bBannerRepository.selectByPrimaryKey(id);
BannerInfoRspDTO bannerInfoRspDTO = new BannerInfoRspDTO();
BeanUtils.copyProperties(banner, bannerInfoRspDTO);
return bannerInfoRspDTO;
public BBanner selectOne(String id) {
BBanner banner = bBannerRepository.queryOne(id);
return banner;
}
@Override
......
......@@ -289,16 +289,6 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
" and del_flag = 0 and flag = 1 ")
String querySortByPidAndId(@Param("pid") String pid, @Param("businessId") String businessId);
@Select("<script>select *,#{userId} AS stuId from b_chapter " +
"where del_flag = 0 and flag = 1 and pid = -1 " +
"<if test=\"slId!=null and slId != ''\">\n" +
" and sl_id = #{slId}\n" +
"</if>" +
"and lesson_or_sl = #{lessonOrSl} " +
"order by sort asc</script>")
@ResultMap(value = "SupperStudentChildListResultMap")
List<BChapter> queryBChaptersByStudent(BChapter param);
@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" +
......@@ -328,14 +318,6 @@ 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 * from b_chapter " +
"where del_flag = 0 and flag = 1 and pid = -1 " +
"and sl_id = #{slId} " +
"order by sort asc</script>")
@ResultMap(value = "ScoreReportResultMap")
List<ScoreReportDto> queryBChaptersBySlId(String slId);
@Select("<script>SELECT bc.business_id as businessId,\n" +
"(SELECT CONCAT((SELECT sort from b_chapter where business_id = bc.pid),\n" +
"'.',\n" +
......@@ -392,5 +374,39 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"(select count(*) from b_chapter where lesson_id = #{lessonId} and chapter_level = 2 and del_flag != 1 and flag =1) " +
"where business_id = #{lessonId}")
int updateClassHourInLesson(@Param("lessonId") String lessonId);
// @Insert("<script>insert into b_chapter " +
// "<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\"> " +
// "<if test=\"businessId !=null and businessId != ''\"> business_id, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> create_by, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> create_date, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> update_by, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> update_date, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> del_flag, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> flag, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> remarks, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_name, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_level, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> pid, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_url, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> md_file, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> lesson_id, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> class_hour, </if> " +
// "<if test=\"state !=null and state != ''\"> state, </if> " +
// "<if test=\"sort !=null and sort != ''\"> sort, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
//
// "</trim>"+
// "<trim prefix=\"values (\" suffix=\")\" suffixOverrides=\",\">"+
// "<if test=\"businessId !=null and businessId != ''\"> #{businessId}, </if> " +
//
// "</trim>"+
// "</script>")
//
//
// int insertBChapter(BChapter model);
}
......@@ -21,7 +21,7 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "课程地址")
private String chapterUrl;
@ApiModelProperty(value = "课件类型 1视频 2音频 3PDF 4PPT 5文件包")
@ApiModelProperty(value = "课件类型 0视频 1音频 2PPT 3PDF 4文件包")
private String isTest;
@ApiModelProperty(value = "课程ID")
......@@ -40,12 +40,6 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "文件地址")
private String fileUrl;
@ApiModelProperty(value = "ppt地址")
private String pptUrl;
@ApiModelProperty(value = "pdf地址")
private String pdfUrl;
@ApiModelProperty(value = "章节是否完成 0未完成 1完成")
private String isComplete;
......@@ -60,4 +54,7 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "id")
private String corpId;
@ApiModelProperty(value = "课程时间")
private String courseTime;
}
......@@ -89,12 +89,6 @@ public class BChapter extends IdEntity<BChapter> {
@Transient
private String fileUrl;
@Transient
private String pptUrl;
@Transient
private String pdfUrl;
/**
* 课程的父ID(当作map的key存放开课的父ID用)
*/
......
......@@ -114,11 +114,8 @@ public interface BChapterService{
String queryMdFileByChapterId(String businessId);
List<BChapter> queryBChaptersByStudent(BChapter param);
int Mark(String chapterId, String slId, String studentCode, String score);
List<ScoreReportDto> scoreReport(String slId);
List<ChapterSelectDto> chapterListBySlId(String slId);
......
......@@ -2,6 +2,7 @@ package org.rcisoft.business.bchapter.service.impl;
import cn.hutool.core.bean.BeanUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.dto.*;
import org.rcisoft.business.bchapter.entity.BChapter;
......@@ -17,6 +18,8 @@ import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.bfile.dao.BFileRepository;
import org.rcisoft.business.bfile.entity.BFile;
import org.rcisoft.business.bmaterial.dao.BMaterialRepository;
import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.rcisoft.business.brstudentchapter.dao.BRStudentChapterRepository;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.common.component.Global;
......@@ -59,6 +62,8 @@ public class BChapterServiceImpl implements BChapterService {
@Autowired
private BFileRepository bFileRepository;
@Autowired
private BMaterialRepository bMaterialRepository;
@Autowired
private Global global;
@Autowired
BRStudentChapterRepository brStudentChapterRepository;
......@@ -145,7 +150,7 @@ public class BChapterServiceImpl implements BChapterService {
}
int sort = bChapterRepository.selectMaxSort(model.getPid(), model.getLessonId());
model.setSort(sort);
model.setCorpId(corpId);
// model.setCorpId(corpId);
bFile.setChapterId(model.getBusinessId());
bFile.setLessonId(model.getLessonId());
UserUtil.setCurrentPersistOperation(bFile);
......@@ -156,6 +161,23 @@ public class BChapterServiceImpl implements BChapterService {
UserUtil.setCurrentMergeOperation(model);
line = bChapterRepository.updateByPrimaryKeySelective(model);
}
//插入资料表
BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setChapterId(model.getBusinessId());
bMaterial.setFileName(dto.getFileName());
if(Integer.parseInt(model.getIsTest())<4){
bMaterial.setFileUrl(model.getVideoUrl());
}else if(Integer.parseInt(model.getIsTest())>= 4){
bMaterial.setFileUrl(model.getFileUrl());
}
bMaterial.setType(model.getIsTest());
bMaterial.setUploadType("1");
bMaterial.setFileSize(dto.getFileSize());
bMaterialRepository.insertMaterial(bMaterial);
return new PersistModel(line);
}
......@@ -352,11 +374,6 @@ public class BChapterServiceImpl implements BChapterService {
return bChapterRepository.queryMdFileByChapterId(businessId);
}
@Override
public List<BChapter> queryBChaptersByStudent(BChapter param) {
return bChapterRepository.queryBChaptersByStudent(param);
}
@Override
public int Mark(String chapterId, String slId, String studentCode, String score) {
// int line;
......@@ -373,10 +390,6 @@ public class BChapterServiceImpl implements BChapterService {
return 0;
}
@Override
public List<ScoreReportDto> scoreReport(String slId) {
return bChapterRepository.queryBChaptersBySlId(slId);
}
@Override
public List<ChapterSelectDto> chapterListBySlId(String slId) {
......
......@@ -17,4 +17,7 @@ public class uploadDTO {
@ApiModelProperty(value = "0视频 1音频 2ppt 3pdf 4附件")
private String type;
@ApiModelProperty(value = "文件大小")
private String fileSize;
}
......@@ -419,4 +419,18 @@ public class BLessonController extends PaginationController<BLesson> {
recommendLessonDTO);
}
/**
* @author: zhangqingle
* @param
* @return
*/
@ApiOperation(value="623 根据课程Id 查询该课程推荐范围", notes="根据课程id 查询课程推荐范围(人和部门)", response = BLesson.class)
@GetMapping(value = "/queryRecommendByLessonId")
public Result queryRecommendByLessonId(CurUser curUser, @Valid FindLessonRecommendDTO param, BindingResult bindingResult) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.queryRecommendByLessonId(param));
}
}
package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blesson.dto.FindLessonRecommendDTO;
import org.rcisoft.business.blesson.dto.FindLessonRecommendRspDTO;
import org.rcisoft.business.blesson.entity.BRecommend;
import org.rcisoft.business.blesson.entity.BRecommendSon;
import org.rcisoft.core.base.BaseMapper;
......@@ -46,7 +48,9 @@ public interface BRecommendRepository extends BaseMapper<BRecommend> {
@Delete("<script>DELETE from b_recommend_son where recommend_id=#{businessId}</script>")
int deleteRecommendSon(BRecommend bRecommend);
@Select("<script>select business_id from b_recommend where lesson_id = #{lessonId}</script>")
@Select("<script>select business_id from b_recommend where " +
"del_flag != 1 and flag = 1 " +
"and lesson_id = #{lessonId}</script>")
List<String> selectIdByLessonId(String lessonId);
@Insert("<script>INSERT INTO b_recommend_son" +
......@@ -55,5 +59,40 @@ public interface BRecommendRepository extends BaseMapper<BRecommend> {
"(#{item.businessId},#{item.recommendId},#{item.type},#{item.targetId})" +
"</foreach></script>")
int insertBRecommendSons(List<BRecommendSon> bRecommendSons);
@Select("<script>select brs.business_id businessId, brs.type type, brs.target_id targetId, su.name targetName " +
" from b_recommend_son brs left join b_recommend br on brs.recommend_id = br.business_id " +
" left join b_lesson bl on br.lesson_id = bl.business_id " +
" left join s_user su on brs.target_id = su.business_id " +
" where 1=1 " +
" and br.del_flag != 1 and br.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and su.del_flag != 1 and su.flag = 1 " +
// " and bl.corp_id = #{corpId} "+
" and su.corp_id = #{corpId} "+
" <if test=\"viewParam!=null and viewParam != ''\">and su.name like CONCAT('%',#{viewParam},'%')</if>" +
" and br.lesson_id = #{lessonId}</script>")
List<FindLessonRecommendRspDTO> queryRecommendPersonByLessonId(FindLessonRecommendDTO param);
@Select("<script>select brs.business_id businessId, brs.type type, brs.target_id targetId " +
" from b_recommend_son brs left join b_recommend br on brs.recommend_id = br.business_id " +
" left join b_lesson bl on br.lesson_id = bl.business_id " +
" where 1=1 " +
" and br.del_flag != 1 and br.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
// " and bl.corp_id = #{corpId} "+
" <if test=\"departs != null and departs.size() > 0 \"> " +
" and brs.target_id in " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item.departId} </foreach> " +
" </if> " +
" and br.lesson_id = #{lessonId}</script>")
List<FindLessonRecommendRspDTO> queryRecommendDepartByLessonId(FindLessonRecommendDTO param);
}
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FindLessonRecommendDTO {
@ApiModelProperty(value = "查询参数",required = false)
private String viewParam;
@ApiModelProperty(value = "课程Id",required = true)
private String lessonId;
private List<LessonRecommendDepartDTO> departs;
private String userId;
private String corpId;
}
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class FindLessonRecommendRspDTO {
@ApiModelProperty(value = "主键")
private String businessId;
@ApiModelProperty(value = "被推荐对象类型(0:人 1:部门)")
private String type;
@ApiModelProperty(value = "被推荐 人/部门id")
private String targetId;
@ApiModelProperty(value = "被推荐 人/部门名")
private String targetName;
}
package org.rcisoft.business.blesson.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class LessonRecommendDepartDTO {
private String departId;
private String departName;
}
package org.rcisoft.business.blesson.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import javax.persistence.*;
......@@ -14,14 +15,16 @@ import javax.persistence.*;
@Table(name = "b_recommend_son")
public class BRecommendSon {
@ApiModelProperty(value = "主键")
private String businessId;
@ApiModelProperty(value = "推荐表id")
private String recommendId;
@ApiModelProperty(value = "被推荐对象类型(0:人 1:部门)")
private String type;
@ApiModelProperty(value = "被推荐 人/部门id")
private String targetId;
}
......@@ -131,6 +131,14 @@ public interface BLessonService{
*/
PersistModel recommendBLesson(RecommendLessonDTO recommendLessonDTO);
/**
* 根据课程Id 查询该课程推荐范围
* @author: zhangqingle
* @param param
* @return
*/
List<FindLessonRecommendRspDTO> queryRecommendByLessonId(FindLessonRecommendDTO param);
/**
* 课程培训条件查询
......
......@@ -296,8 +296,11 @@ public class BLessonServiceImpl implements BLessonService {
//查询是否存在该课程推荐
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(bRecommend.getLessonId());
if (recommendIds == null || recommendIds.size()<1){
//更新课程表recommend字段
BLesson bLesson =new BLesson();
UserUtil.setCurrentMergeOperation(bLesson);
bLesson.setRecommend("1");
bLessonRepository.updateByPrimaryKeySelective(bLesson);
//插入推荐表
UserUtil.setCurrentPersistOperation(bRecommend);
bRecommendRepository.insertSelective(bRecommend);
......@@ -328,6 +331,36 @@ public class BLessonServiceImpl implements BLessonService {
}
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<FindLessonRecommendRspDTO> queryRecommendByLessonId(FindLessonRecommendDTO param) {
//按部门名查询部门id(list)------
List<LessonRecommendDepartDTO> departs = new ArrayList<>();
departs.add(new LessonRecommendDepartDTO("1","111"));
departs.add(new LessonRecommendDepartDTO("2","222"));
departs.add(new LessonRecommendDepartDTO("3","333"));
//-------------------------------
//查询结果放入DTO中
param.setDeparts(departs);
//查询该课程推荐的所有人
List<FindLessonRecommendRspDTO> findLessonPersonRecommend = bRecommendRepository.queryRecommendPersonByLessonId(param);
List<FindLessonRecommendRspDTO> findLessonDepartRecommend = bRecommendRepository.queryRecommendDepartByLessonId(param);
for (LessonRecommendDepartDTO depart : departs) {
for (FindLessonRecommendRspDTO findLessonRecommendRspDTO : findLessonDepartRecommend) {
if ( depart.equals(findLessonRecommendRspDTO.getTargetId())){
findLessonRecommendRspDTO.setTargetName(depart.getDepartName());
}
}
}
findLessonPersonRecommend.addAll(findLessonDepartRecommend);
return findLessonPersonRecommend;
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
......
package org.rcisoft.business.bmaterial.controller;
/*固定导入*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import javax.validation.Valid;
import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.rcisoft.business.bmaterial.service.BMaterialService;
/**
* Created by on 2019-10-12 10:38:31.
*/
@Api(tags = "13 资料")
@RestController
@RequestMapping("bmaterial")
public class BMaterialController extends PaginationController<BMaterial> {
@Autowired
private BMaterialService bMaterialServiceImpl;
@ApiOperation(value="1301 添加", notes="添加")
@PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid BMaterial bMaterial, BindingResult bindingResult) {
PersistModel data = bMaterialServiceImpl.save(bMaterial);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bMaterial);
}
@ApiOperation(value="1302查看我的资料集合", notes="查看我的资料集合")
@GetMapping(value = "/queryMyBMaterialByPagination")
public Result queryMyBMaterialByPagination(CurUser curUser,BindingResult bindingResult) {
bMaterialServiceImpl.queryMyBMaterialByPagination(getPaginationUtility(), curUser);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
@ApiOperation(value="1303逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete")
public Result delete(CurUser curUser,@Valid String businessId, BindingResult bindingResult) {
BMaterial bMaterial = new BMaterial();
bMaterial.setBusinessId(businessId);
PersistModel data = bMaterialServiceImpl.remove(bMaterial);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
// @ApiOperation(value="修改", notes="修改")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
// @PutMapping("/update/{id:\\w+}")
// public Result update(@Valid BMaterial bMaterial, BindingResult bindingResult) {
// PersistModel data = bMaterialServiceImpl.merge(bMaterial);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// bMaterial);
// }
//
// @ApiOperation(value="查看单 ", notes="查看单 ")
// @GetMapping("/detail/{id:\\w+}")
// public Result detail(@PathVariable String id) {
// return Result.builder(new PersistModel(1),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// bMaterialServiceImpl.findById(id));
// }
//
// @ApiOperation(value="查看 集合", notes="查看 集合")
// @GetMapping(value = "/queryBMaterialByPagination")
// public GridModel listByPagination(BMaterial bMaterial) {
// bMaterialServiceImpl.findAllByPagination(getPaginationUtility(), bMaterial);
// return getGridModelResponse();
// }
}
package org.rcisoft.business.bmaterial.dao;
import org.apache.ibatis.annotations.Insert;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-10-12 10:38:31.
*/
@Repository
public interface BMaterialRepository extends BaseMapper<BMaterial> {
/**
* 分页查询 bMaterial
*
*/
@Select("<script>select * from b_material where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BMaterial> queryBMaterials(BMaterial bMaterial);
@Insert("<script>insert into b_material " +
" (business_id,chapter_id,file_name,file_url, " +
" type,upload_type,file_size,flag,del_flag, " +
" remarks,create_by,update_by,update_date,create_date) " +
" values(#{businessId},#{chapterId},#{fileName},#{fileUrl}, " +
" #{type},#{uploadType},#{fileSize},#{flag},#{delFlag}, " +
" #{remarks},#{createBy},#{updateBy},#{updateDate},#{createDate}) " +
"</script>")
int insertMaterial(BMaterial bMaterial);
@Select("<script>select bm.*,bl.lesson_name lessonName from b_material bm " +
" left join b_chapter bc on bm.chapter_id = bc.business_id " +
" left join b_lesson bl on bc.lesson_id = bl.business_id " +
" where 1=1 " +
" and bm.del_flag != 1 and bm.flag = 1 " +
" and bc.del_flag != 1 and bc.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and bm.create_by = #{userId} "+
"</script>")
@ResultMap(value = "BaseResultMap" )
List<BMaterial> queryMyBMaterialByPagination(CurUser curUser);
}
package org.rcisoft.business.bmaterial.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
/**
* Created with on 2019-10-12 10:38:31.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_material")
public class BMaterial extends IdEntity<BMaterial> {
@ApiModelProperty(value = "章节ID")
private String chapterId;
@ApiModelProperty(value = "文件名称",required = true)
private String fileName;
@ApiModelProperty(value = "文件地址",required = true)
private String fileUrl;
@ApiModelProperty(value = "文件类型 0视频 1音频 2PPT 3PDF 4资料包(单选)",required = true)
private String type;
@ApiModelProperty(value = "上传类型 0 保存 1 上传")
private String uploadType;
@ApiModelProperty(value = "文件大小",required = true)
private String fileSize;
@Transient
private String lessonName;
}
package org.rcisoft.business.bmaterial.service;
import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List;
/**
* Created by on 2019-10-12 10:38:31.
*/
public interface BMaterialService {
/**
* 保存
* @param bMaterial
* @return
*/
PersistModel save(BMaterial bMaterial);
/**
* 逻辑删除
* @param bMaterial
* @return
*/
PersistModel remove(BMaterial bMaterial);
/**
* 修改
* @param bMaterial
* @return
*/
PersistModel merge(BMaterial bMaterial);
/**
* 根据id查询
* @param id
* @return
*/
BMaterial findById(String id);
/**
* 分页查询
* @param bMaterial
* @return
*/
List<BMaterial> findAllByPagination(PageUtil<BMaterial> paginationUtility,
BMaterial bMaterial);
/**
* 分页查询 (我的资料)
* @param curUser
* @return
*/
List<BMaterial> queryMyBMaterialByPagination(PageUtil<BMaterial> paginationUtility,
CurUser curUser);
}
package org.rcisoft.business.bmaterial.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bmaterial.dao.BMaterialRepository;
import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.rcisoft.business.bmaterial.service.BMaterialService;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2019-10-12 10:38:31.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BMaterialServiceImpl implements BMaterialService {
@Autowired
private BMaterialRepository bMaterialRepository;
/**
* 保存 bMaterial
* @param bMaterial
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BMaterial bMaterial){
//增加操作
UserUtil.setCurrentPersistOperation(bMaterial);
//设置上传类型为 保存
bMaterial.setUploadType("0");
int line = bMaterialRepository.insertSelective(bMaterial);
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bMaterial
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BMaterial bMaterial){
UserUtil.setCurrentMergeOperation(bMaterial);
bMaterial.setDeleted();
int line = bMaterialRepository.logicalDelete(bMaterial);
return new PersistModel(line);
}
/**
* 修改 bMaterial
* @param bMaterial
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BMaterial bMaterial){
UserUtil.setCurrentMergeOperation(bMaterial);
int line = bMaterialRepository.updateByPrimaryKeySelective(bMaterial);
return new PersistModel(line);
}
/**
* 根据id查询 bMaterial
* @param id
* @return
*/
public BMaterial findById(String id){
return bMaterialRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bMaterial
* @param bMaterial
* @return
*/
public List<BMaterial> findAllByPagination(PageUtil<BMaterial> paginationUtility,
BMaterial bMaterial){
bMaterial.setStart();
bMaterial.setNotDeleted();
return bMaterialRepository.queryBMaterials(bMaterial);
}
/**
* 分页查询 bMaterial(我的资料)
* @param curUser
* @return
*/
public List<BMaterial> queryMyBMaterialByPagination(PageUtil<BMaterial> paginationUtility,
CurUser curUser){
return bMaterialRepository.queryMyBMaterialByPagination(curUser);
}
}
......@@ -2,9 +2,8 @@ package org.rcisoft.business.synchronizationtime.service;
import org.rcisoft.business.synchronizationtime.entity.SynchronizationTime;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.MyInfoDTO;
/**
* Created by on 2019-10-10 20:04:19.
......
......@@ -89,7 +89,7 @@ public class CurUserAspect {
RoleMenuDTO roleMenuDTO = new RoleMenuDTO();
roleMenuDTO.setBusinessId(IdGen.uuid());
roleMenuDTO.setRoleId(rId);
roleMenuDTO.setMenuId(IdGen.uuid());
roleMenuDTO.setMenuId(menuId);
roleMenuDTOs.add(roleMenuDTO);
});
//设置s_r_user_role表插入参数值
......
......@@ -164,4 +164,13 @@ public class SysUserController extends PaginationController<SysUser> {
userServiceImpl.queryAllDepart());
}
@ApiOperation(value = "708 我的智学 个人信息",notes = "我的智学 个人信息及课程、培训、考试数量")
@GetMapping("/queryMyInfo")
public Result queryMyInfo(CurUser curUser) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
userServiceImpl.queryMyInfo(curUser));
}
}
......@@ -3,6 +3,8 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.MyInfoDTO;
import org.rcisoft.sys.user.dto.QueryMenuResDTO;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.entity.SysUser;
......@@ -196,4 +198,41 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"ORDER BY sm.SORT ")
@ResultMap(value = "DtoResultMap")
List<QueryMenuResDTO> queryMenus(@Param("corpId") String corpId, @Param("businessId") String businessId, @Param("modelId") String modelId );
@Select("<script>select `name` name ,head_pic headPic, `value` value from s_user where business_id = #{userId}" +
"</script>")
MyInfoDTO queryMyInfo(CurUser curUser);
@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 blp.is_finish = 2 " +
" and bl.release_state = 2 " +
" and bl.lesson_type = '0' " +
// " and bl.corp_id = #{corpId} "+
" and blp.person_id = #{userId}) lessonCount, " +
" (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.release_state = 2 " +
" and blp.person_id = #{userId}) trainCount, " +
" (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 bl.corp_id = #{corpId} "+
" and blp.person_id = #{userId}) notFinishedExam " +
"</script>")
MyInfoDTO queryMyLessonCount(CurUser curUser);
}
package org.rcisoft.sys.user.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class MyInfoDTO {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "头像")
private String headPic;
@ApiModelProperty(value = "积分")
private String value;
@ApiModelProperty(value = "课程数")
private String lessonCount;
@ApiModelProperty(value = "培训数")
private String trainCount;
@ApiModelProperty(value = "未完成考试数")
private String notFinishedExam;
}
......@@ -6,6 +6,7 @@ import org.rcisoft.sys.user.dto.QueryMenuResDTO;
import org.rcisoft.sys.menu.entity.SysMenu;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.dto.MyInfoDTO;
import org.rcisoft.sys.user.entity.SysUser;
import java.util.List;
......@@ -40,4 +41,12 @@ public interface SysUserService {
int insertOrUpdateList(List<SysUser> sysUserList);
int synchronizedUsers(String corpId);
/**
* zhangqingle
* 我的智学也查询个人信息及课程、培训、考试数量
* @param curUser
* @return
*/
MyInfoDTO queryMyInfo(CurUser curUser);
}
......@@ -8,10 +8,7 @@ import org.rcisoft.common.component.Global;
import org.rcisoft.common.util.feignDto.GetAllRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.menu.dao.SysMenuRepository;
......@@ -20,9 +17,11 @@ import org.rcisoft.sys.menu.entity.SysMenu;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.dto.QuerySysUserDTO;
import org.rcisoft.sys.user.dto.MyInfoDTO;
import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.entity.UserRole;
import org.rcisoft.sys.user.service.SysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -262,4 +261,14 @@ public class SysUserServiceImpl implements SysUserService {
}
return line;
}
@Override
public MyInfoDTO queryMyInfo(CurUser curUser) {
MyInfoDTO myInfoDTOCount = sysUserMapper.queryMyLessonCount(curUser);
MyInfoDTO myInfoDTO = sysUserMapper.queryMyInfo(curUser);
myInfoDTO.setLessonCount(myInfoDTOCount.getLessonCount());
myInfoDTO.setTrainCount(myInfoDTOCount.getTrainCount());
myInfoDTO.setNotFinishedExam(myInfoDTOCount.getNotFinishedExam());
return myInfoDTO;
}
}
......@@ -36,8 +36,6 @@
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="video_url" jdbcType="VARCHAR" property="videoUrl"/>
<result column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
<result column="ppt_url" jdbcType="VARCHAR" property="pptUrl"/>
<result column="pdf_url" jdbcType="VARCHAR" property="pdfUrl"/>
<result column="is_complete" jdbcType="VARCHAR" property="isComplete"/>
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
<result column="course_time" jdbcType="VARCHAR" property="courseTime"/>
......@@ -54,72 +52,6 @@
<result column="chapter_name" property="chapterName"></result>
</resultMap>
<!--学生单独使用这个-->
<resultMap id="SupperStudentChildListResultMap" type="org.rcisoft.business.bchapter.entity.BChapter" extends="BaseResultMap">
<association column="{studentId=stuId,paId=business_id}" property="childList" select="queryBChaptersByPidAndUserId">
</association>
</resultMap>
<select id="queryBChaptersByPidAndUserId" parameterType="java.util.Map" resultMap="SupperStudentChildListResultMap">
SELECT bc.*,
#{studentId} AS stuId,
bf.video_url AS videoUrl,
bf.file_url AS fileUrl,
bf.ppt_url AS pptUrl,
bf.pdf_url AS pdfUrl,
pc.business_id AS paperUrl,
IFNULL(t1.is_complete,0) AS isComplete,
IFNULL(t1.paper_finish,0) as paperFinish,
IFNULL(t1.pdf_finish,0) as pdfFinish,
IFNULL(t1.ppt_finish,0) as pptFinish,
IFNULL(t1.video_finish,0) as videoFinish,
(SELECT count(*) FROM b_r_student_chapter brs WHERE brs.chapter_id = bc.business_id AND brs.score = - 1) AS studentNum,
IFNULL(t1.score ,-1) as stuScore
FROM
b_chapter bc
LEFT JOIN b_file bf ON bf.chapter_id = bc.business_id
LEFT JOIN t_paper_chapter pc on pc.chap_id = bc.business_id
LEFT JOIN (SELECT is_complete,ppt_finish,pdf_finish,video_finish,paper_finish,chapter_id,score from b_r_student_chapter brs
LEFT JOIN b_student bs on brs.student_id = bs.business_id
LEFT JOIN s_user su on bs.`code` = su.login_name
LEFT JOIN b_chapter bc on bc.business_id = brs.chapter_id
WHERE su.business_id = #{studentId})
t1 ON t1.chapter_id=bc.business_id
WHERE
bc.del_flag = 0
AND bc.pid = #{paId}
ORDER BY
bc.sort asc
</select>
<!--成绩评定时使用这个-->
<resultMap id="ScoreReportResultMap" type="org.rcisoft.business.bchapter.dto.ScoreReportDto" extends="BaseResultMap">
<association column="{pid=business_id,slId=sl_id}" property="childList" select="scoreReportChildList"></association>
</resultMap>
<select id="scoreReportChildList" parameterType="java.util.Map" resultMap="ScoreReportResultMap">
SELECT DISTINCT bc.business_id,bc.is_test,bc.class_hour,
bc.chapter_name, bc.automatic,bc.sl_id,bc.experiment_type,
ROUND((SELECT AVG(bsc.score) from b_r_student_chapter bsc
where bsc.chapter_id = bc.business_id and score != '-1' and score != '999'),2) as average,
(SELECT MAX(bsc.score) from b_r_student_chapter bsc
where bsc.chapter_id = bc.business_id and score != '-1' and score != '999') as maxScore,
(SELECT MIN(bsc.score) from b_r_student_chapter bsc
where bsc.chapter_id = bc.business_id and score != '-1' and score != '999') as minScore,
(SELECT COUNT(*) from b_r_student_chapter where (score = '-1' or score = '999')
AND sl_id = #{slId} AND chapter_id = bc.business_id AND is_complete = '1') as waitingMark,
(SELECT COUNT(*) from b_r_student_chapter where sl_id = #{slId}
AND chapter_id = bc.business_id AND is_complete = '1') as submit,
(SELECT COUNT(*) from b_r_sl_student brss where brss.sl_code =
(SELECT `code` from b_sl where business_id = #{slId})) as allStudent
from b_chapter bc
where bc.pid = #{pid} order by bc.sort
</select>
<update id="updateToFinish" parameterType="org.rcisoft.business.bchapter.dto.ScoreInfoDTO">
update b_r_student_chapter
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.bmaterial.dao.BMaterialRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bmaterial.entity.BMaterial">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/>
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
<result column="file_url" jdbcType="VARCHAR" property="fileUrl"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="upload_type" jdbcType="VARCHAR" property="uploadType"/>
<result column="file_size" jdbcType="VARCHAR" property="fileSize"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment