Commit 67a16a3f authored by 王淑君's avatar 王淑君

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

# Conflicts:
#	src/main/java/org/rcisoft/business/bchapter/service/impl/BChapterServiceImpl.java
parents 112a92d4 2cbf362f
......@@ -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"),
......
......@@ -22,4 +22,6 @@ public class ChapterDTO {
@ApiModelProperty(value = "等级,1:章 2:节")
private Byte chapterLevel;
private String isTest;
}
......@@ -83,6 +83,13 @@ public interface BChapterService{
*/
String changeFileToPdf(String chapterId);
/**
* 文件转换
* @param bFile
* @return
*/
String changeFileToPdfAtView(BFile bFile);
/**
* 打分
* @param scoreInfoDTOS
......
......@@ -123,7 +123,7 @@ public class BChapterServiceImpl implements BChapterService {
// 遍历学生章节中间表 查询学生观看章节进度
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress()*100 + "%");
childList.setProgress(brStudentChapterList.get(0).getProgress() * 100 + "%");
childList.setCurrentLocation(brStudentChapterList.get(0).getCurrentLocation());
percent += brStudentChapterList.get(0).getProgress();
}
......@@ -131,18 +131,18 @@ public class BChapterServiceImpl implements BChapterService {
}
}
Map map = new HashMap();
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
DecimalFormat df = new DecimalFormat("0.00");//设置保留位数
map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", i==0? "0%" : df.format((float)percent/i) + "%");
map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(lessonId)); // 课程信息
QueryChapterListResDTO queryChapterListResDTO = bChapterRepository.getWithCurrentChapterBylessonId(lessonId, curUser.getUserId());
if (null != queryChapterListResDTO && StringUtils.isNotBlank(queryChapterListResDTO.getPid())){
BChapter bChapter = bChapterRepository.selectByPrimaryKey(queryChapterListResDTO.getPid());
if (null!=bChapter){
if (null != bChapter) {
queryChapterListResDTO.setPSort(bChapter.getSort());
}
map.put("currentChapter", queryChapterListResDTO);
}else {
} else {
map.put("currentChapter", "");
}
......@@ -181,7 +181,7 @@ public class BChapterServiceImpl implements BChapterService {
model.setChapterName(chapterDTO.getChapterName());
model.setPid(chapterDTO.getPid());
model.setChapterLevel(chapterDTO.getChapterLevel());
model.setIsTest(chapterDTO.getIsTest());
// if ("2".equals(dto.getType())||"4".equals(dto.getType())){
// mtCotactApiRequestClient.fileChange(dto);
......@@ -197,33 +197,41 @@ public class BChapterServiceImpl implements BChapterService {
if (model.getClassHour() == null || model.getClassHour().equals("")) {
model.setClassHour("");
}
if (model.getChapterLevel() == 2) {
model.setClassHour("1");
} else {
if(StringUtils.isEmpty(model.getPid())){
model.setPid("-1");
}
if (model.getIsTest() == null || model.getIsTest().equals("")) {
model.setIsTest("");
}
int sort = bChapterRepository.selectMaxSort(model.getPid(), model.getLessonId());
model.setSort(sort);
if (model.getChapterLevel() == 1) {
chapterDTO.setBusinessId(model.getBusinessId());
chapterDTO.setPid(model.getPid());
//添加章
line = bChapterRepository.insertSelective(model);
} else {
model.setClassHour("1");
model.setCourseTime(dto.getFileTime());
// model.setCorpId(corpId);
bFile.setChapterId(model.getBusinessId());
bFile.setLessonId(model.getLessonId());
UserUtil.setCurrentPersistOperation(bFile);
//新建章节数据插入到chapter表
//新建节数据插入到chapter表
chapterDTO.setIsTest(dto.getType());
line = bChapterRepository.insertSelective(model);
//先判断该课程的第一章的第一节是否是本节 更新blesson表中course_time字段
String cid = bChapterRepository.getFirstChapter(model.getLessonId());
if(cid.equals(model.getBusinessId()) ){
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(),model.getLessonId());
if (cid.equals(model.getBusinessId())) {
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(), model.getLessonId());
}
//上传文件数据插入到bfile表中
int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
}
} else {
UserUtil.setCurrentMergeOperation(model);
......@@ -232,8 +240,8 @@ public class BChapterServiceImpl implements BChapterService {
model.setCourseTime(dto.getFileTime());
//先判断该课程的第一章的第一节是否是本节 更新blesson表中course_time字段
String cid = bChapterRepository.getFirstChapter(model.getLessonId());
if(cid.equals(model.getBusinessId()) ){
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(),model.getLessonId());
if (cid.equals(model.getBusinessId())) {
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(), model.getLessonId());
}
line = bChapterRepository.updateByPrimaryKeySelective(model);
......@@ -242,15 +250,15 @@ public class BChapterServiceImpl implements BChapterService {
}
//不是为添加章时插入资料表
if(StringUtils.isNotEmpty(model.getIsTest())){
if (StringUtils.isNotEmpty(model.getIsTest())) {
BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setLessonId(model.getLessonId());
bMaterial.setChapterId(model.getBusinessId());
bMaterial.setFileName(dto.getFileName());
if(Integer.parseInt(model.getIsTest())<4){
if (Integer.parseInt(model.getIsTest()) < 4) {
bMaterial.setFileUrl(model.getVideoUrl());
}else if(Integer.parseInt(model.getIsTest())>= 4){
} else if (Integer.parseInt(model.getIsTest()) >= 4) {
bMaterial.setFileUrl(model.getFileUrl());
}
bMaterial.setType(model.getIsTest());
......@@ -289,94 +297,140 @@ public class BChapterServiceImpl implements BChapterService {
public String changeFileToPdf(String chapterId) {
//1. 获取文件信息
BFile bFile = bFileRepository.selectInfoByChapterId(chapterId);
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+"/"+bFile.getLessonId();
String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+bFile.getLessonId();
return changeFile(bFile);
}
@Override
public String changeFileToPdfAtView(BFile bFile) {
return changeFile(bFile);
}
public String changeFile(BFile bFile){
String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/")+1);
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION() +global.getCOURSE_LOCATION()+File.separator+bFile.getLessonId();
String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION()+global.getCOURSE_LOCATION()+ File.separator + bFile.getLessonId();
File file=new File(filePath);
//2. pdf 本地是否存在, word ppt 转换后的pdf是否存在
File fileOld = new File(filePath+"/"+bFile.getFileName());
String newName = bFile.getFileName().substring(0, bFile.getFileName().indexOf("."))+"-pdf.pdf";
log.debug("------------------z1-----------------------------"+filePath);
File fileOld = new File(filePath + File.separator + name);
log.debug("------------------z2-----------------------------"+fileOld);
String newName = name.substring(0, name.indexOf(".")) + "-pdf.pdf";
log.debug("------------------z3-----------------------------"+newName);
//转换后的路径
File fileNew = new File(filePath+"/"+newName);
if ("3".equals(bFile.getType())){
if (fileOld.exists()){
return returnBasePath+"/"+bFile.getFileName();
}else {
String downLoadName = downLoadFile(bFile,file,filePath);
return returnBasePath +"/"+ downLoadName;
File fileNew = new File(filePath + File.separator + newName);
log.debug("------------------z4-----------------------------"+fileNew.getPath());
if ("3".equals(bFile.getType())) {
log.debug("------------------z5-----------------------------");
if (fileOld.exists()) {
log.debug("------------------z6-----------------------------"+fileOld);
return returnBasePath + File.separator + name;
} else {
String downLoadName = downLoadFile(bFile, file, filePath);
log.debug("------------------z7-----------------------------"+downLoadName);
return returnBasePath + File.separator + downLoadName;
}
}
//3. pdf不存在,下载 , 删除word ppt,重新下载,转换
if ("2".equals(bFile.getType()) || "4".equals(bFile.getType())){
if (fileNew.exists()){
return returnBasePath+"/"+newName;
}else {
if ("2".equals(bFile.getType()) || "4".equals(bFile.getType())) {
log.debug("------------------z8-----------------------------");
if (fileNew.exists()) {
log.debug("------------------z9-----------------------------");
return returnBasePath + File.separator + newName;
} else {
log.debug("------------------z10-----------------------------");
fileOld.delete();
String downLoadFileUrl = downLoadFile(bFile,file,filePath);
int result = officeToPdf.transformToPdf(downLoadFileUrl,filePath+"/"+newName);
if (result<1){
log.debug("------------------z11-----------------------------");
String downLoadFileUrl = downLoadFile(bFile, file, filePath);
log.debug("------------------z12-----------------------------downLoadFileUrl:"+filePath+ File.separator + downLoadFileUrl);
log.debug("------------------z12-----------------------------filePath:"+filePath + File.separator + newName);
int result = officeToPdf.transformToPdf(filePath+ File.separator + downLoadFileUrl, filePath + File.separator + newName);
log.debug("------------------z13-----------------------------");
if (result < 1) {
log.error("文件转换异常");
throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR);
}
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
bFile.setFileUrl(filePath+"/"+newName);
if (StringUtils.isNotEmpty(bFile.getChapterId())){
log.debug("------------------z14-----------------------------");
bFile.setFileUrl(filePath+File.separator+newName);
log.debug("------------------z15-----------------------------");
bFileRepository.updateByPrimaryKeySelective(bFile);
return returnBasePath+"/"+newName;
}
}else{
log.debug("------------------z16-----------------------------");
return returnBasePath+File.separator+newName;
}
} else {
return null;
}
}
//下载
public String downLoadFile(BFile bFile,File file,String filePath){
public String downLoadFile(BFile bFile, File file, String filePath) {
String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/")+1);
log.debug("------------------D1-----------------------------"+filePath);
//判断文件夹是否存在
if (!file.exists()) {
log.debug("------------------D2-----------------------------");
//如果文件夹不存在,则创建新的的文件夹
file.mkdirs();
}
FileOutputStream fileOut = null;
HttpURLConnection conn = null;
InputStream inputStream = null;
try
{
try {
// 建立链接
URL httpUrl=new URL(bFile.getVideoUrl());
conn=(HttpURLConnection) httpUrl.openConnection();
URL httpUrl = new URL(bFile.getVideoUrl());
log.debug("------------------D3-----------------------------");
conn = (HttpURLConnection) httpUrl.openConnection();
log.debug("------------------D4-----------------------------");
//以Post方式提交表单,默认get方式
conn.setRequestMethod("GET");
conn.setDoInput(true);
conn.setDoOutput(true);
log.debug("------------------D5-----------------------------");
// post方式不能使用缓存
conn.setUseCaches(false);
log.debug("------------------D6-----------------------------");
//连接指定的资源
conn.connect();
//获取网络输入流
inputStream=conn.getInputStream();
inputStream = conn.getInputStream();
log.debug("------------------D7-----------------------------");
BufferedInputStream bis = new BufferedInputStream(inputStream);
log.debug("------------------D8-----------------------------");
//判断文件的保存路径后面是否以/结尾
if (!filePath.endsWith("/")) {
filePath += "/";
if (!filePath.endsWith(File.separator)) {
log.debug("------------------D9-----------------------------",filePath);
filePath += File.separator;
}
//写入到文件(注意文件保存路径的后面一定要加上文件的名称)
fileOut = new FileOutputStream(filePath+bFile.getFileName());
fileOut = new FileOutputStream(filePath + name);
log.debug("------------------D10-----------------------------");
BufferedOutputStream bos = new BufferedOutputStream(fileOut);
log.debug("------------------D11-----------------------------");
byte[] buf = new byte[4096];
int length = bis.read(buf);
//保存文件
while(length != -1)
{
while (length != -1) {
bos.write(buf, 0, length);
length = bis.read(buf);
}
bos.close();
bis.close();
conn.disconnect();
} catch (Exception e)
{
log.debug("------------------D12-----------------------------");
} catch (Exception e) {
log.error(e.getMessage() + "下载文件异常");
throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
}
return bFile.getFileName();
log.debug("------------------D13-----------------------------"+name);
return name;
}
@Override
......
......@@ -17,28 +17,28 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@Select("<script>SELECT * FROM b_course where del_flag != 1 and flag = 1 and course_level = 1 " +
"and corp_id = #{corpId}" +
" and corp_id = #{corpId} " +
"<if test=\"cName!=null and cName != ''\"> and c_name like CONCAT('%',#{cName},'%') </if>" +
"ORDER BY sort</script>")
@ResultMap(value = "ChildListResultMap")
List<QueryCourseResDTO> queryCourses(Map<String, Object> param);
@Select("select *from b_course where del_flag != 1 and pid = #{pid} ORDER BY sort")
@Select("select *from b_course where del_flag != 1 and pid = #{pid} ORDER BY sort ")
@ResultMap(value = "ChildListResultMap")
List<QueryCourseResDTO> queryCoursesByPid(String parentId);
@Select("SELECT * from b_course WHERE del_flag='0' AND flag='1'" +
@Select("SELECT * from b_course WHERE del_flag != 1 AND flag = 1 " +
"and corp_id = #{corpId}" +
" and corp_id = #{corpId} " +
"AND c_name=#{cName}")
" AND c_name=#{cName} ")
List<BCourse> selectOneByName(@Param("cName") String id, @Param("corpId") String corpId);
// @Update("UPDATE b_course SET del_flag='1' WHERE business_id = #{businessId}")
@Update("<script>" +
"<foreach collection=\"courseIds\" item=\"item\" separator=\";\">" +
"UPDATE b_course SET del_flag='1' WHERE business_id = #{item}" +
"UPDATE b_course SET del_flag = '1' WHERE business_id = #{item}" +
"</foreach>" +
"</script>")
int removeCourse(@Param("courseIds") List<String> courseIds);
......@@ -48,22 +48,22 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@Select("select DISTINCT course_level from b_course where business_id = #{pid} " +
"and corp_id = #{corpId}"
"and corp_id = #{corpId} "
)
int queryParentLevel(@Param("pid") String pid, @Param("corpId") String corpId);
@Select("select * from b_course where course_level = 1 and del_flag != '1' and flag ='1' " +
"and corp_id = #{corpId}" +
" and corp_id = #{corpId} " +
"ORDER BY sort limit #{num}")
" ORDER BY sort limit #{num}")
@ResultMap(value = "BaseResultMapDTO")
List<QueryCourseResDTO> queryFirstLevel(@Param("corpId") String corpId,@Param("num") int num);
@Select("select DISTINCT IFNULL((" +
"select max(sort) from b_course where pid = #{pid} " +
"and corp_id = #{corpId}" +
" and corp_id = #{corpId} " +
"and del_flag = 0 and flag = 1),0)+1 as sort")
int getSort(@Param("pid") String pid,@Param("corpId") String corpId);
......@@ -77,7 +77,7 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
"and corp_id = #{corpId} " +
"and flag ='1'")
"and flag ='1' ")
@ResultMap(value = "AllCourseResultMap")
List<AllCourseDTO> findAllCourse(@Param("corpId") String corpId);
......
......@@ -92,7 +92,7 @@ public class BCourseServiceImpl implements BCourseService {
List<AllCourseDTO> allCourse = null;
if (org.apache.commons.lang3.StringUtils.isNotEmpty(id)) {
if (StringUtils.isNotEmpty(id)) {
allCourse = this.findAllCourse(corpId);
}
List<String> courseIds = null;
......@@ -113,7 +113,7 @@ public class BCourseServiceImpl implements BCourseService {
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
}
UserUtil.setCurrentMergeOperation(bCourse);
return new PersistModel(bCourseRepository.updateByPrimaryKeySelective(bCourse), MessageConstant.MESSAGE_ALERT_SUCCESS);
return new PersistModel(bCourseRepository.updateCourse(bCourse), MessageConstant.MESSAGE_ALERT_SUCCESS);
}
@Override
......
......@@ -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
......@@ -519,4 +536,15 @@ public class BLessonController extends PaginationController<BLesson> {
// lessonId);
// }
@ApiOperation(value="631 报名培训", notes="报名培训")
@ApiImplicitParam(name = "lessonId", value = "培训课id", required = true, dataType = "varchar")
@GetMapping(value = "/toTraining")
public Result toTraining(CurUser curUser,String lessonId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.toTraining(curUser,lessonId));
}
}
......@@ -245,4 +245,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
"and business_id = #{businessId}</script>")
@ResultMap(value = "BaseResultMap")
BLessonPerson selectById(String businessId);
@Select("select * from b_lesson_person where lesson_id = #{lessonId} and person_id = #{personId}")
BLessonPerson getAppointInTraining(@Param("lessonId")String lessonId ,@Param("personId")String personId );
}
......@@ -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>")
......
......@@ -90,7 +90,7 @@ public interface BRecommendRepository extends BaseMapper<BRecommend> {
" and brs.type = '1' "+
" <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> " +
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item.id} </foreach> " +
" </if> " +
" and br.lesson_id = #{lessonId}</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;
......@@ -34,7 +35,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
" <if test='delFlag != null'>del_flag=#{delFlag},</if> ",
" <if test='flag != null'>flag=#{flag},</if> ",
" <if test='remarks != null'>remarks=#{remarks},</if> ",
" <if test='lesson_id != null'>lesson_id=#{lessonId},</if> ",
" <if test='lessonId != null'>lesson_id=#{lessonId},</if> ",
" <if test='type != null'>type=#{type},</if> ",
" <if test='corp_id != null'>corp_id=#{corp_id},</if> ",
" </set>",
......@@ -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
......@@ -212,4 +220,10 @@ public interface BLessonService{
*/
PersistModel addCollect(CurUser curUser,String lessonId);
/**
* 报名培训
* @return
*/
int toTraining(CurUser curUser,String lessonId);
}
......@@ -43,7 +43,7 @@ import static java.util.Arrays.asList;
*/
@Slf4j
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BLessonServiceImpl implements BLessonService {
@Autowired
private BLessonRepository bLessonRepository;
......@@ -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 (bLesson == null ){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
}
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;
}
......@@ -141,12 +150,12 @@ public class BLessonServiceImpl implements BLessonService {
});
});
//------------------------------
return bLessonRepository.queryPersonMore(curUser,departs);
return bLessonRepository.queryPersonMore(curUser, departs);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,CurUser curUser) {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil, CurUser curUser) {
// List<String> departs = getDeparts();
List<String> departs = new ArrayList<>();
List<String> ids = Arrays.asList(new String[]{curUser.getUserId()});
......@@ -160,12 +169,12 @@ public class BLessonServiceImpl implements BLessonService {
departs.addAll(Arrays.asList(deptsBean.getPid().split(",")));
});
});
return bLessonRepository.queryRecommend(curUser,departs);
return bLessonRepository.queryRecommend(curUser, departs);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryConcernByPagination(PageUtil pageUtil,CurUser curUser) {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryConcernByPagination(PageUtil pageUtil, CurUser curUser) {
//---------获取部门id------------
// List<String> departs = getDeparts();
List<String> departs = new ArrayList<>();
......@@ -181,12 +190,12 @@ public class BLessonServiceImpl implements BLessonService {
});
});
//------------------------------
return bLessonRepository.queryConcern(curUser,departs);
return bLessonRepository.queryConcern(curUser, departs);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil,CurUser curUser) {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil, CurUser curUser) {
//---------获取部门id------------
// List<String> departs = getDeparts();
List<String> departs = new ArrayList<>();
......@@ -202,64 +211,64 @@ public class BLessonServiceImpl implements BLessonService {
});
});
//------------------------------
return bLessonRepository.queryInterested(curUser,departs);
return bLessonRepository.queryInterested(curUser, departs);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO){
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO) {
BLesson model = new BLesson();
BeanUtils.copyProperties(addLessonDTO,model);
BeanUtils.copyProperties(addLessonDTO, model);
int line = 0;
if(model.getBusinessId()==null) {
if(StringUtils.isEmpty(model.getLessonType())){
if (model.getBusinessId() == null) {
if (StringUtils.isEmpty(model.getLessonType())) {
throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
}
//初始化
if ("0".equals(model.getLessonType())){
if ("0".equals(model.getLessonType())) {
model.initModel();
}else if ("1".equals(model.getLessonType())){
} else if ("1".equals(model.getLessonType())) {
model.initTrainModel();
if (StringUtils.isEmpty(model.getLecturerId())){
if (StringUtils.isEmpty(model.getLecturerId())) {
model.setLecturerId(model.getCreateBy());
}
}
//添加课程表
line = bLessonRepository.insertSelective(model);
//添加可见范围
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())){
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = setBViewrangeInfo(model);
//插入可见范围表
bViewrangeRepository.insertSelective(bViewrange);
//插入可见范围子表
List<BViewrangeSon> bViewrangeSons = new ArrayList<>();
//model.getViewRangePerson()不为空 新建bViewrangeSon对象放入bViewrangeSons中
if (StringUtils.isNotEmpty(model.getViewRangePerson())){
if (StringUtils.isNotEmpty(model.getViewRangePerson())) {
String[] viewRangePerson = model.getViewRangePerson().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons,viewRangePerson,"0",bViewrange.getBusinessId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
}
if (StringUtils.isNotEmpty(model.getViewRangeDepart())){
if (StringUtils.isNotEmpty(model.getViewRangeDepart())) {
String[] viewRangeDepart = model.getViewRangeDepart().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons,viewRangeDepart,"1",bViewrange.getBusinessId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
}
//插入子表
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
//添加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){
if (StringUtils.isNotEmpty(model.getLabels())) {
//标签集合
List<BLessonLabel> bLessonLabels = addLabel(model);
bLessonRepository.insertLessonLabel(bLessonLabels);
}
}else {
} else {
UserUtil.setCurrentMergeOperation(model);
line = bLessonRepository.updateByPrimaryKeySelective(model);
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())){
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = setBViewrangeInfo(model);
//更新可见范围表
......@@ -271,13 +280,13 @@ public class BLessonServiceImpl implements BLessonService {
List<BViewrangeSon> bViewrangeSons = new ArrayList<>();
//model.getViewRangePerson()不为空 新建bViewrangeSon对象放入bViewrangeSons中 type:0人员 1部门
if (StringUtils.isNotEmpty(model.getViewRangePerson())){
if (StringUtils.isNotEmpty(model.getViewRangePerson())) {
String[] viewRangePerson = model.getViewRangePerson().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons,viewRangePerson,"0",bViewrange.getBusinessId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
}
if (StringUtils.isNotEmpty(model.getViewRangePerson())){
if (StringUtils.isNotEmpty(model.getViewRangePerson())) {
String[] viewRangeDepart = model.getViewRangeDepart().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons,viewRangeDepart,"1",bViewrange.getBusinessId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
}
//插入子表
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
......@@ -286,7 +295,7 @@ public class BLessonServiceImpl implements BLessonService {
bLessonRepository.removeLabelByLessonId(model);
//删除原标签添,加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){
if (StringUtils.isNotEmpty(model.getLabels())) {
//标签集合
List<BLessonLabel> bLessonLabels = addLabel(model);
bLessonRepository.insertLessonLabel(bLessonLabels);
......@@ -299,7 +308,7 @@ public class BLessonServiceImpl implements BLessonService {
List<BMaterial> bMaterialList = new ArrayList<>();
//插入b_train_file表
if (addLessonDTO.getTrainFileList() != null && addLessonDTO.getTrainFileList().size()>0){
if (addLessonDTO.getTrainFileList() != null && addLessonDTO.getTrainFileList().size() > 0) {
List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList();
for (BTrainFile bTrainFile : trainFileList) {
bTrainFile.setLessonId(model.getBusinessId());
......@@ -321,11 +330,11 @@ public class BLessonServiceImpl implements BLessonService {
}
return new PersistModel(line,model);
return new PersistModel(line, model);
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public PersistModel removeBLesson(String id) {
// if(bSlRepository.selectslNumByLesson(id)>0) {
......@@ -345,8 +354,8 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO, List<AllCourseDTO> allCourse) {
// List<String> departs = getDeparts();
List<String> departs = new ArrayList<>();
List<String> ids = Arrays.asList(new String[]{firstPageQueryDTO.getUserId()});
......@@ -362,17 +371,17 @@ public class BLessonServiceImpl implements BLessonService {
});
firstPageQueryDTO.setDeparts(departs);
List<String> courseIds = null;
if (allCourse != null){
if (allCourse != null) {
//查询出所有子分类
courseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse);
courseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(), allCourse);
//将一级分类放入分类集合中
courseIds.add(firstPageQueryDTO.getCourseLevelOne());
}
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO,courseIds);
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel closeBLesson(String id) {
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
......@@ -383,11 +392,11 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel releaseBLesson(String id) {
int state = bLessonRepository.findLessonReleaseState(id);
if (state != 0){
if (state != 0) {
throw new ServiceException(ResultServiceEnums.STATE_NOT_RELEASE);
}
......@@ -401,26 +410,26 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel recommendBLesson(RecommendLessonDTO recommendLessonDTO) {
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) || StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())){
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) || StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())) {
BRecommend bRecommend = new BRecommend();
bRecommend.setLessonId(recommendLessonDTO.getLessonId());
bRecommend.setRecommendPerson(recommendLessonDTO.getUserId());
//设置推荐类型(0仅人 1仅部门 2人和部门)
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isEmpty(recommendLessonDTO.getRecommendDepart())){
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isEmpty(recommendLessonDTO.getRecommendDepart())) {
bRecommend.setType("0");
}else if (StringUtils.isEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())){
} else if (StringUtils.isEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())) {
bRecommend.setType("1");
}else if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())){
} else if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson()) && StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())) {
bRecommend.setType("2");
}
//查询是否存在该课程推荐
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(bRecommend.getLessonId());
if (recommendIds == null || recommendIds.size()<1){
if (recommendIds == null || recommendIds.size() < 1) {
//更新课程表recommend字段
BLesson bLesson =new BLesson();
BLesson bLesson = new BLesson();
UserUtil.setCurrentMergeOperation(bLesson);
bLesson.setBusinessId(recommendLessonDTO.getLessonId());
bLesson.setRecommend("1");
......@@ -428,7 +437,7 @@ public class BLessonServiceImpl implements BLessonService {
//插入推荐表
UserUtil.setCurrentPersistOperation(bRecommend);
bRecommendRepository.insertSelective(bRecommend);
}else {
} else {
//修改推荐表
UserUtil.setCurrentMergeOperation(bRecommend);
bRecommend.setBusinessId(recommendIds.get(0));
......@@ -439,55 +448,60 @@ public class BLessonServiceImpl implements BLessonService {
//插入推荐子表
List<BRecommendSon> bRecommendSons = new ArrayList<>();
//model.getViewRangePerson()不为空 新建bViewrangeSon对象放入bViewrangeSons中
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson())){
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendPerson())) {
String[] recommendPerson = recommendLessonDTO.getRecommendPerson().split(",");
bRecommendSons = addBRecommendSon(bRecommendSons,recommendPerson,"0",bRecommend.getBusinessId());
bRecommendSons = addBRecommendSon(bRecommendSons, recommendPerson, "0", bRecommend.getBusinessId());
}
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())){
if (StringUtils.isNotEmpty(recommendLessonDTO.getRecommendDepart())) {
String[] recommendDepart = recommendLessonDTO.getRecommendDepart().split(",");
bRecommendSons = addBRecommendSon(bRecommendSons,recommendDepart,"1",bRecommend.getBusinessId());
bRecommendSons = addBRecommendSon(bRecommendSons, recommendDepart, "1", bRecommend.getBusinessId());
}
//插入子表
int line = bRecommendRepository.insertBRecommendSons(bRecommendSons);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}else {
} else {
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<FindLessonRecommendRspDTO> queryRecommendByLessonId(FindLessonRecommendDTO param) {
//按部门名模糊查询部门id(list)------
// if (StringUtils.isEmpty(param.getViewParam())){
// param.setViewParam("");
// }
List<FindDepartByNameDTO> departs = cotactApiRequestClient.deptListDeptInfoByName(param.getCorpId(),param.getViewParam());
String viewParam = param.getViewParam();
if (StringUtils.isEmpty(viewParam)){
viewParam = "";
}
List<FindDepartByNameDTO> departs = cotactApiRequestClient.deptListDeptInfoByName(param.getCorpId(), viewParam);
//查询结果放入DTO中
param.setDeparts(departs);
//查询该课程推荐的所有人
List<FindLessonRecommendRspDTO> findLessonPersonRecommend = bRecommendRepository.queryRecommendPersonByLessonId(param);
List<FindLessonRecommendRspDTO> findLessonPersonRecommend = new ArrayList<>();
findLessonPersonRecommend = bRecommendRepository.queryRecommendPersonByLessonId(param);
//查询该课程推荐的所有部门
List<FindLessonRecommendRspDTO> findLessonDepartRecommend = bRecommendRepository.queryRecommendDepartByLessonId(param);
List<FindLessonRecommendRspDTO> findLessonDepartRecommend = new ArrayList<>();
findLessonDepartRecommend = bRecommendRepository.queryRecommendDepartByLessonId(param);
if (departs != null && departs.size() > 0 && findLessonDepartRecommend != null && findLessonDepartRecommend.size() > 0){
if (departs != null && departs.size() > 0 && findLessonDepartRecommend != null && findLessonDepartRecommend.size() > 0) {
for (FindDepartByNameDTO depart : departs) {
for (FindLessonRecommendRspDTO findLessonRecommendRspDTO : findLessonDepartRecommend) {
if ( depart.getId().equals(findLessonRecommendRspDTO.getTargetId())){
if (depart.getId().equals(findLessonRecommendRspDTO.getTargetId())) {
findLessonRecommendRspDTO.setTargetName(depart.getName());
}
}
}
findLessonPersonRecommend.addAll(findLessonDepartRecommend);
}
return findLessonPersonRecommend;
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) {
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())){
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())) {
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
//按课程查询指派表是否为空
......@@ -497,7 +511,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> userIdList = asList(StringUtils.split(appointLessonDTO.getAppointPerson(), ","));
userIds.addAll(userIdList);
BAppoint bAppoint;
if (bAppoints == null || bAppoints.size() == 0){
if (bAppoints == null || bAppoints.size() == 0) {
//插入指派表
bAppoint = new BAppoint();
bAppoint.setLessonId(appointLessonDTO.getLessonId());
......@@ -505,7 +519,7 @@ public class BLessonServiceImpl implements BLessonService {
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson());
UserUtil.setCurrentPersistOperation(bAppoint);
bAppointRepository.insertAppoint(bAppoint);
}else {
} else {
bAppoint = bAppoints.get(0);
bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson());
......@@ -525,7 +539,7 @@ public class BLessonServiceImpl implements BLessonService {
appointLessonDTO.setAppointPersonList(userIds);
//查询已学该课程的学习business_id
List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO);
if (inLessonPersons != null && inLessonPersons.size() > 0){
if (inLessonPersons != null && inLessonPersons.size() > 0) {
List<String> inLessonIds = new ArrayList<>();
for (BLessonPerson inLessonPerson : inLessonPersons) {
inLessonIds.add(inLessonPerson.getPersonId());
......@@ -537,13 +551,13 @@ public class BLessonServiceImpl implements BLessonService {
UserUtil.setCurrentMergeOperation(updateBLessonPerson);
//更新b_lesson_person表
bLessonPersonRepository.updateList(updateBLessonPerson,inLessonIds);
bLessonPersonRepository.updateList(updateBLessonPerson, inLessonIds);
//从学生Id中删除已更新的学生id
userIds.removeAll(inLessonIds);
}
//剩余学生添加至b_lesson_person表
List<BLessonPerson> bLessonPersonOthers = new ArrayList<>();
userIds.forEach(userId->{
userIds.forEach(userId -> {
BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setAppointId(bAppoint.getBusinessId());
......@@ -559,25 +573,30 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> findLessonAtBanner(LessonTrainAtBannerDTO lessonTrainDTO) {
return bLessonRepository.findLessonAtBanner(lessonTrainDTO);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO iLessonCount(String userId) {
return bLessonRepository.iLessonCount(userId);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO iTrainCount(String userId) {
return bLessonRepository.iTrainCount(userId);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
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) {
//---------获取部门------------
// List<String> departs = getDeparts();
......@@ -593,24 +612,27 @@ public class BLessonServiceImpl implements BLessonService {
departs.addAll(Arrays.asList(deptsBean.getPid().split(",")));
});
});
departs.forEach(depart->{
if(StringUtils.isEmpty(depart)){
departs.forEach(depart -> {
if (StringUtils.isEmpty(depart)) {
departs.remove(depart);
}
});
//----------------------------
model.setDeparts(departs);
List<String> courseIds;
if (allCourse != null){
if (allCourse != null) {
//查询出所有子分类
courseIds = recursion.FindSons(model.getCourse(),allCourse);
courseIds = recursion.FindSons(model.getCourse(), allCourse);
//将一级分类放入分类集合中
if (StringUtils.isNotEmpty(model.getCourse())) {
courseIds.add(model.getCourse());
model.setCourseIds(courseIds);
}
}
List<BLesson> ListAllLesson = null;
//根据不同传值 查询列表页内容 searchType:查询类型 0 全部 1 推荐 2在学 3收藏"
switch (model.getSearchType()){
switch (model.getSearchType()) {
case "0":
ListAllLesson = bLessonRepository.queryListAllLessonByPagination(model);
break;
......@@ -634,14 +656,14 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson,List<RoleTypeDepartDTO> roleList) {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson, List<RoleTypeDepartDTO> roleList) {
//查询当前登录人所在的企业
String corpId = curUser.getCorpId();
String userId = curUser.getUserId();
//查询当前登录人有什么角色
// List<RoleTypeDepartDTO> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
if (roleList == null || roleList.size()<1){
if (roleList == null || roleList.size() < 1) {
return new ArrayList<>();
}
boolean isAdmin = false;
......@@ -658,17 +680,18 @@ public class BLessonServiceImpl implements BLessonService {
// uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
if (!isAdmin){
List<GetAllRspDTO> GetAllRspDTOList = cotactApiRequestClient.getUserByDeptIdSet(corpId,departIds);
if (GetAllRspDTOList != null && GetAllRspDTOList.size()>0){
for (GetAllRspDTO getAllRspDTO : GetAllRspDTOList) {
uids.add(getAllRspDTO.getId());
}
}
}
//自己
uids.add(userId);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId);
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids, bLesson, isAdmin, corpId);
return bLessons;
}
......@@ -676,7 +699,7 @@ public class BLessonServiceImpl implements BLessonService {
public PersistModel deleteRecommend(String lessonId) {
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId);
if (recommendIds == null || recommendIds.size()<1){
if (recommendIds == null || recommendIds.size() < 1) {
throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND);
}
//修改推荐表
......@@ -701,8 +724,8 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public PersistModel addCollect(CurUser curUser,String lessonId) {
AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId,curUser.getCorpId(),curUser.getUserId());
public PersistModel addCollect(CurUser curUser, String lessonId) {
AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId, curUser.getCorpId(), curUser.getUserId());
List<BCollect> bLessonPersons = bCollectRepository.selectByPersonAndLesson(param);
// if (bLessonPersons != null && bLessonPersons.size()>0){
// BLessonPerson bLessonPerson = bLessonPersons.get(0);
......@@ -720,12 +743,36 @@ public class BLessonServiceImpl implements BLessonService {
return new PersistModel(line);
}
@Override
public int toTraining(CurUser curUser, String lessonId) {
BLessonPerson person = new BLessonPerson();
BLessonPerson bLessonPerson = new BLessonPerson();
//tep1 判断该用户是否被指派该培训或已经报名
person = bLessonPersonRepository.getAppointInTraining(lessonId, curUser.getUserId());
if (person != null) {
if (person.getIsApply().equals("1")) {
log.info("-----------该培训已报名-------------");
return 1;
}
UserUtil.setCurrentMergeOperation(person);
person.setIsApply("1");
return bLessonPersonRepository.updateByPrimaryKey(person);
} else {
UserUtil.setCurrentPersistOperation(bLessonPerson);
bLessonPerson.setPersonId(curUser.getUserId());
bLessonPerson.setIsApply("1");
return bLessonPersonRepository.insertSelective(bLessonPerson);
}
}
//遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model){
List<BLessonLabel> addLabel(BLesson model) {
//标签集合
List<BLessonLabel> bLessonLabels = new ArrayList<>();
String[] labels = model.getLabels().split(",");
for (int index = 0 ; index<labels.length;index++){
for (int index = 0; index < labels.length; index++) {
BLessonLabel bLessonLabel = new BLessonLabel();
UserUtil.setCurrentPersistOperation(bLessonLabel);
bLessonLabel.setLabelId(labels[index]);
......@@ -736,8 +783,8 @@ public class BLessonServiceImpl implements BLessonService {
}
//遍历 将可见范围添加值可见范围子表集合中
List<BViewrangeSon> addBViewrangeSon(List<BViewrangeSon> bViewrangeSons, String[] viewRanges,String type,String viewRangeId){
for (int index = 0 ; index<viewRanges.length;index++){
List<BViewrangeSon> addBViewrangeSon(List<BViewrangeSon> bViewrangeSons, String[] viewRanges, String type, String viewRangeId) {
for (int index = 0; index < viewRanges.length; index++) {
BViewrangeSon bViewrangeSon = new BViewrangeSon();
bViewrangeSon.setBusinessId(IdGen.uuid());
bViewrangeSon.setTargetId(viewRanges[index]);
......@@ -747,9 +794,10 @@ public class BLessonServiceImpl implements BLessonService {
}
return bViewrangeSons;
}
//遍历 将推荐添加值推荐子表集合中
List<BRecommendSon> addBRecommendSon(List<BRecommendSon> bRecommendSons, String[] recommends,String type,String recommendId){
for (int index = 0 ; index<recommends.length;index++){
List<BRecommendSon> addBRecommendSon(List<BRecommendSon> bRecommendSons, String[] recommends, String type, String recommendId) {
for (int index = 0; index < recommends.length; index++) {
BRecommendSon bRecommendSon = new BRecommendSon();
bRecommendSon.setBusinessId(IdGen.uuid());
bRecommendSon.setTargetId(recommends[index]);
......@@ -761,23 +809,22 @@ public class BLessonServiceImpl implements BLessonService {
}
//设置BViewrange信息
BViewrange setBViewrangeInfo(BLesson model){
BViewrange setBViewrangeInfo(BLesson model) {
BViewrange bViewrange = new BViewrange();
UserUtil.setCurrentPersistOperation(bViewrange);
//设置课程id
bViewrange.setLessonId(model.getBusinessId());
//设置可见范围类型(0仅人 1仅部门 2人和部门)
if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isEmpty(model.getViewRangeDepart())){
if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isEmpty(model.getViewRangeDepart())) {
bViewrange.setType("0");
}else if (StringUtils.isEmpty(model.getViewRangePerson()) && StringUtils.isNotEmpty(model.getViewRangeDepart())){
} else if (StringUtils.isEmpty(model.getViewRangePerson()) && StringUtils.isNotEmpty(model.getViewRangeDepart())) {
bViewrange.setType("1");
}else if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isNotEmpty(model.getViewRangeDepart())){
} else if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isNotEmpty(model.getViewRangeDepart())) {
bViewrange.setType("2");
}
return bViewrange;
}
}
......@@ -14,6 +14,7 @@ import org.rcisoft.common.util.feignDto.*;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.result.Ret;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......
......@@ -7,6 +7,7 @@ import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.common.model.MenuMap;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultExceptionEnum;
......@@ -102,6 +103,31 @@ public class CurUserAspect {
int line = userServiceImpl.synchronizedUsers(curUser.getCorpId());
//插入tm_admin_role、s_role_menu、s_r_user_role表
int userRoleResult = sysRoleService.addAdminRoleMenuUser(initAddAdminDTO,roleMenuDTOs,userRoleDTO);
// 初始化数据字典表
List<BDictionary> dictionaryList = new ArrayList<>();
BDictionary bDictionary1 = new BDictionary();
bDictionary1.setName("关注人数");
bDictionary1.setType("GZRS");
bDictionary1.setValue("5");
UserUtil.setCurrentPersistOperation(bDictionary1);
BDictionary bDictionary2 = new BDictionary();
bDictionary2.setName("在学人数");
bDictionary2.setType("ZXRS");
bDictionary2.setValue("7");
UserUtil.setCurrentPersistOperation(bDictionary2);
BDictionary bDictionary3 = new BDictionary();
bDictionary3.setName("总裁读书会");
bDictionary3.setType("DSH");
bDictionary3.setValue("www.baidu.com");
UserUtil.setCurrentPersistOperation(bDictionary3);
dictionaryList.add(bDictionary1);
dictionaryList.add(bDictionary2);
dictionaryList.add(bDictionary3);
sysRoleService.initDictionary(dictionaryList);
log.info("--------------------初始化完成--------------------");
}
}
......
......@@ -220,6 +220,7 @@ public enum ResultServiceEnums {
NOT_RECOMMEND(118,"该课程未推荐"),
NO_DATA(119,"该数据不存在"),
CHANGE_FILE_ERROR(120,"文件转换失败"),
NOT_LESSON_ERROR(121,"该课程不存在"),
;
......
......@@ -90,19 +90,23 @@ public class OfficeToPdf {
if (!inputFile.exists()) {
return -1;// 找不到源文件, 则返回-1
}
log.debug("----------ZH------------");
// 如果目标路径不存在, 则新建该路径
File outputFile = new File(destFile);
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
log.debug("----------ZH------------");
// connect to an OpenOffice.org instance running on port 8100
connection = new SocketOpenOfficeConnection(
global.getLibreofficeIp(), global.getLibreofficePort());
connection.connect();
// convert
log.debug("----------ZH------------");
DocumentConverter converter = new OpenOfficeDocumentConverter(
connection);
DocumentFormatRegistry factory = new BasicDocumentFormatRegistry();
log.debug("----------ZH------------");
DocumentFormat inputDocumentFormat = factory
.getFormatByFileExtension(FileUtil.getFilePostfix(sourceFile));
DocumentFormat outputDocumentFormat = factory
......@@ -120,7 +124,7 @@ public class OfficeToPdf {
if(connection!=null) {
connection.disconnect();
}else{
throw new ServiceException(ResultServiceEnums.UPLOAD_ERROR);
throw new ServiceException(ResultServiceEnums.CHANGE_FILE_ERROR);
}
}
return 1;
......
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
......@@ -85,4 +86,6 @@ public interface SysRoleService {
List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser);
int initDictionary(List<BDictionary> list);
}
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException;
......@@ -187,4 +188,9 @@ public class SysRoleServiceImpl implements SysRoleService {
public List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser) {
return sysUserMapper.queryRoleTypeByUserId(curUser.getUserId());
}
@Override
public int initDictionary(List<BDictionary> list) {
return sysUserMapper.initDictionary(list);
}
}
......@@ -2,6 +2,7 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bdictionary.entity.BDictionary;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
......@@ -24,7 +25,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN tm_admin_role AS sr ON sr.r_id = ru.role_id " +
"WHERE su.del_flag = 0 " +
"and sr.r_status != 0 " +
"and su.corp_id = #{corpId} " +
......@@ -237,4 +237,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"</script>")
MyInfoDTO queryMyLessonCount(CurUser curUser);
/**
* 初始化多条数据到Bdictionary表
* @param list
* @return
*/
@Insert("<script> INSERT INTO b_dictionary " +
"(BUSINESS_ID,PID,TYPE,NAME,VALUE,CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE,DEL_FLAG,FLAG,REMARKS,corp_id) VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"(#{item.businessId},#{item.pid},#{item.type},#{item.name},#{item.value},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.remarks},#{item.corpId})"+
"</foreach> </script>")
int initDictionary(List<BDictionary> list);
}
......@@ -89,7 +89,7 @@ public class SysUserServiceImpl implements SysUserService {
}
}
//部门不为空时 部门条件过滤
if (dto.getDept() != null || !"".equals(dto.getDept())) {
if (dto.getDept() != null ) {
List<SysUser> usersForDept = new ArrayList<>();
for (SysUser user : users) {
if (user.getDepart().equals(dto.getDept())) {
......
......@@ -74,7 +74,7 @@ global:
licPath: /lk/license.lic
pubPath: /lk/publicCerts.store
path:
base_upload_server_location: /working/resource/eduServer/
base_upload_server_location: /working/eduServer/
return_upload_server_location: http://192.168.5.201:18080/eduServer/
course_location: course
lesson_location: lesson
......@@ -93,7 +93,7 @@ global:
cut_pdf_num: 30
libreoffice:
ip: mt_office
ip: mt_libre
port: 8997
mt:
api: http://192.168.5.201/api/
......
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