Commit b83cc998 authored by 王淑君's avatar 王淑君

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

parents e86f6716 2ac1ecb0
...@@ -55,7 +55,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -55,7 +55,7 @@ public class BBannerServiceImpl implements BBannerService {
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
if (!pattern.matcher(model.getExternalUrl()).matches()) { if (!pattern.matcher(model.getExternalUrl()).matches()) {
throw new ServiceException("网址不合法(http(s)://xxxx.xx)"); throw new ServiceException(ResultServiceEnums.ILLEGAL_URL);
} }
} }
//内部链接但类型或课程ID为空或长度为0 抛异常 //内部链接但类型或课程ID为空或长度为0 抛异常
......
...@@ -138,6 +138,16 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -138,6 +138,16 @@ public class BChapterController extends PaginationController<BChapter> {
newFileUrl); newFileUrl);
} }
@ApiOperation(value = "208 下载文件 返回服务器地址", notes = "下载文件 返回服务器地址")
@GetMapping("/getDownLoadUrl")
public Result getDownLoadUrl(CurUser curUser, @Valid BFile file, BindingResult br) throws IOException {
String newFileUrl = bChapterService.getDownLoadUrl(file);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
newFileUrl);
}
// //
// @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态") // @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态")
......
...@@ -97,6 +97,13 @@ public interface BChapterService{ ...@@ -97,6 +97,13 @@ public interface BChapterService{
*/ */
String changeFileToPdfAtView(BFile bFile); String changeFileToPdfAtView(BFile bFile);
/**
* 下载文件
* @param bFile
* @return
*/
String getDownLoadUrl(BFile bFile);
/** /**
* 打分 * 打分
* @param scoreInfoDTOS * @param scoreInfoDTOS
......
...@@ -146,15 +146,15 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -146,15 +146,15 @@ public class BChapterServiceImpl implements BChapterService {
}else { }else {
map.put("totalProgress", "0%"); map.put("totalProgress", "0%");
} }
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId,curUser);
//判断课程是否存在 //判断课程是否存在
if (bLesson == null){ if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA); throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
} }
//判断课程是否被关闭 // //判断课程是否被关闭
if ("4".equals(bLesson.getReleaseState())){ // if ("4".equals(bLesson.getReleaseState())){
throw new ServiceException(ResultServiceEnums.LESSON_CLOSED); // throw new ServiceException(ResultServiceEnums.LESSON_CLOSED);
} // }
//判断该登录人是否可见该课程 //判断该登录人是否可见该课程
List<String> ids = Arrays.asList(new String[]{curUser.getUserId()}); List<String> ids = Arrays.asList(new String[]{curUser.getUserId()});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO(); MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
...@@ -167,6 +167,22 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -167,6 +167,22 @@ public class BChapterServiceImpl implements BChapterService {
throw new ServiceException(ResultServiceEnums.NO_ACCESS); throw new ServiceException(ResultServiceEnums.NO_ACCESS);
} }
//设置讲师部门
List<String> lecturerIds = new ArrayList<>();
lecturerIds.add(bLesson.getLecturerId());
MTUserGetsReqDTO mtUserGetsReqDTOlecDept = new MTUserGetsReqDTO();
mtUserGetsReqDTOlecDept.setCorpId(curUser.getCorpId());
mtUserGetsReqDTOlecDept.setIds(lecturerIds);
List<MTUserInfoRspDTO> mtUserInfoRspDTOLecDeptList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTOlecDept);
if (mtUserInfoRspDTOLecDeptList != null && mtUserInfoRspDTOList.size() > 0){
mtUserInfoRspDTOLecDeptList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0 && mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())){
//设置部门名
bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName());
}
});
}
//查询该课程是否收藏 //查询该课程是否收藏
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId()); int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){ if (collectCount>0){
...@@ -413,6 +429,9 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -413,6 +429,9 @@ public class BChapterServiceImpl implements BChapterService {
BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonId); BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonId);
for (BLessonPerson lessonPerson: bLessonPersonList){ for (BLessonPerson lessonPerson: bLessonPersonList){
String newLearnProgress ; String newLearnProgress ;
if(lessonPerson.getLearnProgress() == null){
break;
}
double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ; double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ;
if (add){ if (add){
newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) ); newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) );
...@@ -447,15 +466,21 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -447,15 +466,21 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel removeBChapter(String id,String userId) { public PersistModel removeBChapter(String id,String userId) {
BChapter bChapter = bChapterRepository.selectByPrimaryKey(id); BChapter bChapter = bChapterRepository.selectByPrimaryKey(id);
String lessonId = bChapterRepository.getLessonIdBychaperId(id);
if (bChapter == null) if (bChapter == null)
throw new ServiceException(ResultServiceEnums.CHAPTER_NOT_EXISTS); throw new ServiceException(ResultServiceEnums.CHAPTER_NOT_EXISTS);
int chapterCount =bChapterRepository.getlessonHours(lessonId);
BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonId);
if("2".equals(bLesson.getReleaseState()) && chapterCount == 1 && bChapter.getChapterLevel() != 1){
throw new ServiceException(ResultServiceEnums.CHAPTER_ONLY_ONE);
}
List<QueryChapterListResDTO> childList = bChapterRepository.queryBChaptersByPid(id); List<QueryChapterListResDTO> childList = bChapterRepository.queryBChaptersByPid(id);
boolean hasChild = childList != null && childList.size() > 0; boolean hasChild = childList != null && childList.size() > 0;
boolean isChapter = bChapter.getChapterLevel() == ChapterLevelEnum.CHAPTER.getCode(); boolean isChapter = bChapter.getChapterLevel() == ChapterLevelEnum.CHAPTER.getCode();
if (isChapter && hasChild) { if (isChapter && hasChild) {
throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD); throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD);
} }
String lessonId = bChapterRepository.getLessonIdBychaperId(id);
//获取第一节课的id 与当前id对比 //获取第一节课的id 与当前id对比
String firstId = bChapterRepository.getFirstChapter(lessonId); String firstId = bChapterRepository.getFirstChapter(lessonId);
int line = bChapterRepository.removeByPrimaryKey(id); int line = bChapterRepository.removeByPrimaryKey(id);
...@@ -468,8 +493,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -468,8 +493,6 @@ public class BChapterServiceImpl implements BChapterService {
bChapterRepository.updateCourseTimeForLesson(time,lessonId); bChapterRepository.updateCourseTimeForLesson(time,lessonId);
// 更新学生 对应章节总进度 // 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false); this.updateLessonProgress(lessonId, false);
//删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId);
} }
//更新表中sort //更新表中sort
List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId()); List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId());
...@@ -484,7 +507,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -484,7 +507,8 @@ public class BChapterServiceImpl implements BChapterService {
//更新表中sort //更新表中sort
bChapterRepository.updateSort(params); bChapterRepository.updateSort(params);
} }
//删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId);
return new PersistModel(line); return new PersistModel(line);
} }
...@@ -500,6 +524,21 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -500,6 +524,21 @@ public class BChapterServiceImpl implements BChapterService {
return changeFile(bFile); return changeFile(bFile);
} }
@Override
public String getDownLoadUrl(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);
File fileOld = new File(filePath + File.separator + name);
if (fileOld.exists()) {
return returnBasePath + File.separator + name;
} else {
String downLoadName = downLoadFile(bFile, file, filePath);
return returnBasePath + File.separator + downLoadName;
}
}
public String changeFile(BFile bFile) { public String changeFile(BFile bFile) {
log.debug("****************request + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss")); log.debug("****************request + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
......
...@@ -268,7 +268,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -268,7 +268,7 @@ public class BLessonController extends PaginationController<BLesson> {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.iLessonCount(userId)); bLessonService.iLessonCount(curUser));
} }
/** /**
...@@ -500,7 +500,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -500,7 +500,7 @@ public class BLessonController extends PaginationController<BLesson> {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.iTrainCount(userId)); bLessonService.iTrainCount(curUser));
} }
...@@ -516,7 +516,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -516,7 +516,7 @@ public class BLessonController extends PaginationController<BLesson> {
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.trainPersonCount(lessonId)); bLessonService.trainPersonCount(lessonId,curUser));
} }
/** /**
......
...@@ -209,7 +209,7 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -209,7 +209,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private String isApply; private String isApply;
@ApiModelProperty(value = "知否必修") @ApiModelProperty(value = "知否必修 0 选修 1必修")
@Transient @Transient
private String isAppoint; private String isAppoint;
......
...@@ -139,11 +139,15 @@ public class BLessonPerson extends IdEntity<BLessonPerson> { ...@@ -139,11 +139,15 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Transient @Transient
private String departName; private String departName;
@ApiModelProperty(value = "详细部门")
@Transient
private String fullDept;
//初始化 //初始化
public void initModel(){ public void initModel(){
UserUtil.setCurrentPersistOperation(this); UserUtil.setCurrentPersistOperation(this);
//学习进度为0 //学习进度为0
this.setLearnProgress("0.00%"); this.setLearnProgress("0%");
//设置正在学 //设置正在学
this.setIsFinish("1"); this.setIsFinish("1");
//设置不收藏 //设置不收藏
......
...@@ -161,17 +161,17 @@ public interface BLessonService{ ...@@ -161,17 +161,17 @@ public interface BLessonService{
/** /**
* 我发布的总数 * 我发布的总数
* @author: zhangqingle * @author: zhangqingle
* @param userId * @param curUser
* @return * @return
*/ */
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(CurUser curUser);
/** /**
* 我发布的总数 * 我发布的总数
* @author: zhangqingle * @author: zhangqingle
* @param userId * @param curUser
* @return * @return
*/ */
ILessonCountDTO iTrainCount(String userId); ILessonCountDTO iTrainCount(CurUser curUser);
/** /**
* 课程学员总数 * 课程学员总数
...@@ -179,7 +179,7 @@ public interface BLessonService{ ...@@ -179,7 +179,7 @@ public interface BLessonService{
* @param lessonId * @param lessonId
* @return * @return
*/ */
ILessonCountDTO trainPersonCount(String lessonId); ILessonCountDTO trainPersonCount(String lessonId, CurUser curUser);
/** /**
* 培训学员查询 * 培训学员查询
......
...@@ -27,7 +27,9 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -27,7 +27,9 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
...@@ -87,12 +89,17 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -87,12 +89,17 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public List<StudentTrackingRspDTO> studentTrackingByPagination(PageUtil pageUtil, StudentTrackingDTO studentTrackingDTO) { public List<StudentTrackingRspDTO> studentTrackingByPagination(PageUtil pageUtil, StudentTrackingDTO studentTrackingDTO) {
// List<Long> deptIds = new ArrayList<>(); // List<Long> deptIds = new ArrayList<>();
if(StringUtils.isNotEmpty(studentTrackingDTO.getDepartId())){ if(StringUtils.isNotEmpty(studentTrackingDTO.getDepartId())){
List<UserGetStudentTrackingRspDTO> datas = mtCotactApiRequestClient.allUserListByDeptAtStuTrack(studentTrackingDTO.getCorpId(),studentTrackingDTO.getDepartId());
Set<String> deptIds = new HashSet<>();
deptIds.add(studentTrackingDTO.getDepartId());
Set<String> deptSets = new HashSet<String>(deptIds);
List<String> datas = mtCotactApiRequestClient.getSubUserIdsByDeptIds(studentTrackingDTO.getCorpId(), deptSets);
// List<UserGetStudentTrackingRspDTO> datas = mtCotactApiRequestClient.allUserListByDeptAtStuTrack(studentTrackingDTO.getCorpId(),studentTrackingDTO.getDepartId());
if (datas != null && datas.size()>0){ if (datas != null && datas.size()>0){
List<String> userIdsInDepart = new ArrayList<>(); List<String> userIdsInDepart = new ArrayList<>(datas);
datas.forEach(data->{ // datas.forEach(data->{
userIdsInDepart.add(data.getId()); // userIdsInDepart.addAll(data);
}); // });
studentTrackingDTO.setUserIdsInDepart(userIdsInDepart); studentTrackingDTO.setUserIdsInDepart(userIdsInDepart);
} }
if (studentTrackingDTO.getUserIdsInDepart() == null || studentTrackingDTO.getUserIdsInDepart().size() < 1){ if (studentTrackingDTO.getUserIdsInDepart() == null || studentTrackingDTO.getUserIdsInDepart().size() < 1){
...@@ -172,6 +179,11 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -172,6 +179,11 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
//没有指派人员 删除指派表 //没有指派人员 删除指派表
if (StringUtils.isEmpty(designatedIdRes)){ if (StringUtils.isEmpty(designatedIdRes)){
bAppointRepository.deleteByPrimaryKey(bAppoint); bAppointRepository.deleteByPrimaryKey(bAppoint);
}else {
//更新b_appoint表
UserUtil.setCurrentMergeOperation(bAppoint);
bAppoint.setDesignatedId(designatedIdRes);
bAppointRepository.updateByPrimaryKeySelective(bAppoint);
} }
return new PersistModel(1,result); return new PersistModel(1,result);
......
...@@ -93,7 +93,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -93,7 +93,7 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public BLesson selectOne(CurUser curUser,String lessonId) { public BLesson selectOne(CurUser curUser,String lessonId) {
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId,curUser);
if (bLesson == null ){ if (bLesson == null ){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR); throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
} }
...@@ -106,7 +106,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -106,7 +106,7 @@ public class BLessonServiceImpl implements BLessonService {
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){ if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> { mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())){ if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0 && mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())){
//设置部门名 //设置部门名
bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName()); bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName());
} }
...@@ -702,7 +702,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -702,7 +702,9 @@ public class BLessonServiceImpl implements BLessonService {
bLessonPersonRepository.cancelAppointByPersons(bLessonPerson); bLessonPersonRepository.cancelAppointByPersons(bLessonPerson);
} }
if (userIds == null || userIds.size() < 1){ if (userIds == null || userIds.size() < 1){
return new PersistModel(bAppointRepository.deleteByPrimaryKey(bAppoint), MessageConstant.MESSAGE_ALERT_SUCCESS); int line = bAppointRepository.deleteByPrimaryKey(bAppoint);
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),bLesson.getLessonType());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
//插入b_lesson_person表 //插入b_lesson_person表
appointLessonDTO.setAppointPersonList(userIdSet); appointLessonDTO.setAppointPersonList(userIdSet);
...@@ -774,10 +776,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -774,10 +776,12 @@ public class BLessonServiceImpl implements BLessonService {
} }
//指派课程 //指派课程
line = bLessonPersonRepository.insertList(bLessonPersonOthers); line = bLessonPersonRepository.insertList(bLessonPersonOthers);
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),"0"); // bLessonRepository.personNumberReCount(bLesson.getBusinessId(),"0");
}else { }else {
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),bLesson.getLessonType());
line = 1; line = 1;
} }
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),bLesson.getLessonType());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
...@@ -789,21 +793,21 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -789,21 +793,21 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO iLessonCount(String userId) { public ILessonCountDTO iLessonCount(CurUser curUser) {
return bLessonRepository.iLessonCount(userId); return bLessonRepository.iLessonCount(curUser);
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO iTrainCount(String userId) { public ILessonCountDTO iTrainCount(CurUser curUser) {
return bLessonRepository.iTrainCount(userId); return bLessonRepository.iTrainCount(curUser);
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO trainPersonCount(String lessonId) { public ILessonCountDTO trainPersonCount(String lessonId, CurUser curUser) {
ILessonCountDTO iLessonCountDTO = bLessonRepository.trainPersonCount(lessonId); ILessonCountDTO iLessonCountDTO = bLessonRepository.trainPersonCount(lessonId);
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId,curUser);
if (bLesson != null){ if (bLesson != null){
Date now = new Date(); Date now = new Date();
if (now.before( bLesson.getTrainStartDate())){ if (now.before( bLesson.getTrainStartDate())){
...@@ -843,6 +847,22 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -843,6 +847,22 @@ public class BLessonServiceImpl implements BLessonService {
if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0){ if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0){
bLessonPerson.setDepartName(mtUserInfoRspDTO.getDepts().get(0).getName()); bLessonPerson.setDepartName(mtUserInfoRspDTO.getDepts().get(0).getName());
} }
StringBuffer sb = new StringBuffer();
if (mtUserInfoRspDTO.getDepts() != null) {
for (MTUserInfoRspDTO.DeptsBean deptsBean : mtUserInfoRspDTO.getDepts()) {
for (MTUserInfoRspDTO.DeptsBean.PathBean pathBean : deptsBean.getPath()) {
if (null != pathBean)
sb.append(pathBean.getName() + "-");
}
}
}
if (!sb.toString().equals("")) {
String string = sb.toString().substring(0, sb.toString().length() - 1);
if(string.indexOf("-") != -1){
string = string.substring(string.indexOf("-")+1);
}
bLessonPerson.setFullDept(string);
}
} }
}); });
}); });
...@@ -1008,7 +1028,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1008,7 +1028,7 @@ public class BLessonServiceImpl implements BLessonService {
BLessonPerson person ; BLessonPerson person ;
BLessonPerson bLessonPerson = new BLessonPerson(); BLessonPerson bLessonPerson = new BLessonPerson();
//判断当前时间是否在报名范围内 //判断当前时间是否在报名范围内
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId,curUser);
Date newDate = new Date(); Date newDate = new Date();
if (newDate.before(bLesson.getApplyStartDate())||bLesson.getTrainOverDate().before(newDate)){ if (newDate.before(bLesson.getApplyStartDate())||bLesson.getTrainOverDate().before(newDate)){
throw new ServiceException(ResultServiceEnums.NOT_APPLY_DATE); throw new ServiceException(ResultServiceEnums.NOT_APPLY_DATE);
...@@ -1120,7 +1140,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1120,7 +1140,7 @@ public class BLessonServiceImpl implements BLessonService {
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){ if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> { mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())){ if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0 && mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())){
//设置部门名 //设置部门名
bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName()); bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName());
} }
...@@ -1191,7 +1211,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1191,7 +1211,7 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
public Map<String,Object> judgeVisibleAuthority(CurUser curUser, String lessonId) { public Map<String,Object> judgeVisibleAuthority(CurUser curUser, String lessonId) {
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId,curUser);
if (bLesson == null){ if (bLesson == null){
Map<String,Object> resMap = new HashMap<>(); Map<String,Object> resMap = new HashMap<>();
resMap.put("code",44); resMap.put("code",44);
......
...@@ -11,6 +11,9 @@ import java.util.List; ...@@ -11,6 +11,9 @@ import java.util.List;
*/ */
public class QueryDepart { public class QueryDepart {
public static List<String> queryDepart(List<MTUserInfoRspDTO> mtUserInfoRspDTOList){ public static List<String> queryDepart(List<MTUserInfoRspDTO> mtUserInfoRspDTOList){
if (mtUserInfoRspDTOList == null || mtUserInfoRspDTOList.size() < 1){
return new ArrayList<>();
}
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> { mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
List<MTUserInfoRspDTO.DeptsBean> deptsBeans = mtUserInfoRspDTO.getDepts(); List<MTUserInfoRspDTO.DeptsBean> deptsBeans = mtUserInfoRspDTO.getDepts();
......
...@@ -118,7 +118,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService { ...@@ -118,7 +118,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
} }
String totalProgress = ""; String totalProgress = "";
if (i == 0){ if (i == 0){
totalProgress = "0.00%"; totalProgress = "0%";
}else { }else {
totalProgress = numberFormat.format((float) percent / (float) i * 100) + "%"; totalProgress = numberFormat.format((float) percent / (float) i * 100) + "%";
// totalProgress = df.format((float) ((percent / i) * 100)) + "%"; // totalProgress = df.format((float) ((percent / i) * 100)) + "%";
......
...@@ -68,24 +68,33 @@ public class CurUserAspect { ...@@ -68,24 +68,33 @@ public class CurUserAspect {
throw new ServiceException(ResultExceptionEnum.USER_NO_AUTHEN); throw new ServiceException(ResultExceptionEnum.USER_NO_AUTHEN);
UserUtil.setCurUser(curUser); UserUtil.setCurUser(curUser);
synchronized (this) { //多线程判断是否有管理员
//查询本部门是否有管理员 log.info("-------------------OUT-countAdminOut-up------------------");
int countAdmin = sysRoleService.queryAdminInCorp(curUser.getCorpId()); int countAdminOut = sysRoleService.queryAdminInCorp(curUser.getCorpId());
if (countAdmin == 0) { log.info("-------------------OUT-countAdminOut-down------------------");
//随机生成角色Id if (countAdminOut < 1){
synchronized (this) {
//查询本部门是否有管理员
log.info("-------------------In-countAdminOut-up------------------");
int countAdmin = sysRoleService.queryAdminInCorp(curUser.getCorpId());
log.info("-------------------In-countAdminOut-down------------------");
if (countAdmin == 0) {
//随机生成角色Id
log.info("--------------------该企业正在初始化--------------------"); log.info("--------------------该企业正在初始化--------------------");
// 同步企业人员 // 同步企业人员
int line = userServiceImpl.synchronizedUsers(curUser.getCorpId()); int line = userServiceImpl.synchronizedUsers(curUser.getCorpId());
//初始化角色 //初始化角色
int userRoleResult = sysRoleService.addAdminRoleMenuUser(curUser); int userRoleResult = sysRoleService.addAdminRoleMenuUser(curUser);
// 初始化数据字典表 // 初始化数据字典表
sysRoleService.initDictionary(); sysRoleService.initDictionary();
log.info("--------------------初始化完成--------------------"); log.info("--------------------初始化完成--------------------");
}
} }
} }
} }
} }
...@@ -235,6 +235,7 @@ public enum ResultServiceEnums { ...@@ -235,6 +235,7 @@ public enum ResultServiceEnums {
CHAPTER_ONLY_ONE(135,"当前课程仅有一节,不能被删除"), CHAPTER_ONLY_ONE(135,"当前课程仅有一节,不能被删除"),
LESSON_NO_CHAPTER(136,"当前课程暂无章节,不能被发布"), LESSON_NO_CHAPTER(136,"当前课程暂无章节,不能被发布"),
ROLE_IS_NULL(137,"当前未勾选角色,请勾选角色"), ROLE_IS_NULL(137,"当前未勾选角色,请勾选角色"),
ILLEGAL_URL(138,"网址不合法(http(s)://xxxx.xx)"),
; ;
private Integer code; private Integer code;
......
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