Commit 882a7a77 authored by zhangqingle's avatar zhangqingle

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

# Conflicts:
#	src/main/java/org/rcisoft/business/blesson/dao/BLessonRepository.java
parents 1d36b623 8270a635
......@@ -321,14 +321,49 @@ public class BChapterServiceImpl implements BChapterService {
if (model.getBusinessId().equals(cid)) {
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(), model.getLessonId());
}
//判断修改前后pid是否发生改变
BChapter bChapter = bChapterRepository.selectByPrimaryKey(model.getBusinessId());
if(bChapter !=null && !bChapter.getPid().equals(model.getPid())){
line = bChapterRepository.updateByPrimaryKeySelective(model);
//更新修改之前章中节的sort
List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId());
if(chapterIds != null && chapterIds.size() > 0){
List<Map<String,Object>> params = new ArrayList<>();
for(int i = 0 ;i < chapterIds.size(); i++){
Map<String,Object> map = new HashedMap();
map.put("businessId",chapterIds.get(i));
map.put("sort",i+1);
params.add(map);
}
//更新表中sort
bChapterRepository.updateSort(params);
}
int sort = bChapterRepository.selectMaxSort(model.getPid(), model.getLessonId());
model.setSort(sort);
line = bChapterRepository.updateByPrimaryKeySelective(model);
//更新修改之后章中节的sort
List<String> chapterIds2 = bChapterRepository.getChapterIds(model.getPid(),model.getLessonId());
if(chapterIds2 != null && chapterIds2.size() > 0){
List<Map<String,Object>> params = new ArrayList<>();
for(int i = 0 ;i < chapterIds2.size(); i++){
Map<String,Object> map = new HashedMap();
map.put("businessId",chapterIds2.get(i));
map.put("sort",i+1);
params.add(map);
}
//更新表中sort
bChapterRepository.updateSort(params);
}
}else{
line = bChapterRepository.updateByPrimaryKeySelective(model);
}
line = bChapterRepository.updateByPrimaryKeySelective(model);
if(model.getChapterLevel() == 1) {
return new PersistModel(line);
}
int x = bFileRepository.updateUploadFile(bFile);
// 判断 新文件 更新 课程学习进度(总进度 此章节进度)
if (StringUtils.isNotEmpty(bFileOld.getVideoUrl()) && !(bFileOld.getVideoUrl().equals(dto.getVideoUrl())) ) {
if (bFileOld != null && StringUtils.isNotEmpty(bFileOld.getVideoUrl()) && !(bFileOld.getVideoUrl().equals(dto.getVideoUrl())) ) {
// 所有学习过此课程的 学生课程信息
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByLessonId(chapterDTO.getLessonId());
BLesson bLesson = bLessonRepository.selectByPrimaryKey(chapterDTO.getLessonId());
......@@ -394,7 +429,7 @@ public class BChapterServiceImpl implements BChapterService {
String newLearnProgress ;
double learnProgress = Double.parseDouble(lessonPerson.getLearnProgress().split("%")[0]) / 100 ;
if (add){
newLearnProgress = numberFormat.format( Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour()) / (Double.parseDouble(bLesson.getClassHour()) + 1) ));
newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) );
}else {
newLearnProgress = Integer.parseInt(bLesson.getClassHour()) == 0 ? "0" : numberFormat.format( Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour() + 1) / Double.parseDouble(bLesson.getClassHour()) ));
}
......@@ -452,15 +487,18 @@ public class BChapterServiceImpl implements BChapterService {
}
//更新表中sort
List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId());
List<Map<String,Object>> params = new ArrayList<>();
for(int i = 0 ;i < chapterIds.size(); i++){
Map<String,Object> map = new HashedMap();
map.put("businessId",chapterIds.get(i));
map.put("sort",i+1);
params.add(map);
if(chapterIds != null && chapterIds.size() > 0){
List<Map<String,Object>> params = new ArrayList<>();
for(int i = 0 ;i < chapterIds.size(); i++){
Map<String,Object> map = new HashedMap();
map.put("businessId",chapterIds.get(i));
map.put("sort",i+1);
params.add(map);
}
//更新表中sort
bChapterRepository.updateSort(params);
}
//更新表中sort
bChapterRepository.updateSort(params);
return new PersistModel(line);
}
......
......@@ -96,7 +96,8 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" blp.person_id personId, " +
" bl.lesson_name LessonTitle , su.name personName, " +
" blp.is_appoint isAppoint , blp.is_finish isFinish ," +
" blp.learn_progress learnProgress ,ba.create_date appointDate ," +
" blp.learn_progress learnProgress ," +
" ba.create_date appointDate ," +
" blp.finish_date finishDate , " +
" blp.apply_date applyDate , " +
" blp.sign_date signDate , " +
......@@ -165,7 +166,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectPersonIdByLessonId(AppointLessonDTO param);
@Select("<script>select business_id,person_id,lesson_id , learn_progress from b_lesson_person where 1=1 " +
@Select("<script>select business_id,person_id,lesson_id , learn_progress, is_finish, finish_date from b_lesson_person where 1=1 " +
"and lesson_id = #{lessonId}</script>")
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectByLessonId(@Param("lessonId") String lessonId);
......
......@@ -678,10 +678,10 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @param lessonId
* @return
*/
@Update("<script>update b_lesson set collect_number = " +
"(select count(1) from b_collect where 1=1 " +
" and lesson_id = #{lessonId}) where business_id = #{lessonId} " +
" </script>" )
@Update("update b_lesson set collect_number = " +
"(select count(1) from b_collect where 1=1 " +
"and lesson_id = #{lessonId}) " +
"where business_id = #{lessonId}" )
int collectNumberReCount(String lessonId);
/**
* 重新统计热度
......
......@@ -245,7 +245,6 @@ public interface BLessonService{
*/
PersistModel colletLesson(CurUser curUser,String lessonId);
PersistModel notColletLesson(CurUser curUser,String lessonId);
Map<String,Object> getLessonState(String id);
......
......@@ -725,6 +725,7 @@ public class BLessonServiceImpl implements BLessonService {
updateBLessonPerson.setFlag("1");
//设置指派信息
updateBLessonPerson.setIsAppoint("1");
updateBLessonPerson.setApplyDate(new Date());//指派时间同步到lesson_person的报名时间
updateBLessonPerson.setLessonId(appointLessonDTO.getLessonId());
updateBLessonPerson.setAppointId(bAppoint.getBusinessId());
UserUtil.setCurrentMergeOperation(updateBLessonPerson);
......@@ -760,6 +761,7 @@ public class BLessonServiceImpl implements BLessonService {
bLessonPerson.setAppointId(bAppoint.getBusinessId());
bLessonPerson.setIsAppoint("1");
bLessonPerson.setApplyDate(new Date());//指派时间同步到lesson_person的报名时间
bLessonPerson.setLessonId(appointLessonDTO.getLessonId());
bLessonPerson.setPersonId(userId);
bLessonPersonOthers.add(bLessonPerson);
......@@ -1065,7 +1067,7 @@ public class BLessonServiceImpl implements BLessonService {
bLessonPersons.add(bLessonPerson);
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
// int line = bLessonPersonRepository.insert(bLessonPerson);
int line = trainInsert("0",bLesson,bLessonPersons);
int line = this.trainInsert("0",bLesson,bLessonPersons);
return line;
}
......
......@@ -36,7 +36,7 @@ public class MenuMap {
menuMap.put("P-ANA-EXAM", "0042");
menuMap.put("P-ANA-SCORE", "0043");
menuMap.put("F-MAIN-MANAGE", "0051");
menuMap.put("F-USERS", "0052");
menuMap.put("F-USER-MANAGE", "0052");
menuMap.put("F-ROLE-MANAGE", "0053");
}
}
......@@ -234,6 +234,7 @@ public enum ResultServiceEnums {
SAVED_THIS_FILE(134,"已保存过改资料"),
CHAPTER_ONLY_ONE(135,"当前课程仅有一节,不能被删除"),
LESSON_NO_CHAPTER(136,"当前课程暂无章节,不能被发布"),
ROLE_IS_NULL(137,"当前未勾选角色,请勾选角色"),
;
private Integer code;
......
......@@ -137,7 +137,7 @@ public class SysUserController extends PaginationController<SysUser> {
businessId);
}
@ApiOperation(value = "706 根据id 查询菜单", notes = "userId 和 modelId查询 menu")
@ApiOperation(value = "706 根据userId 查询菜单", notes = "userId 和 modelId查询 menu")
@ApiImplicitParam(name = "modelId", value = "前台菜单10 后台菜单20", required = true, dataType = "varchar", paramType = "path")
@GetMapping("/queryMenuById")
public Result queryMenu(CurUser curUser,String modelId) {
......@@ -187,7 +187,7 @@ public class SysUserController extends PaginationController<SysUser> {
MessageConstant.MESSAGE_ALERT_ERROR,
userServiceImpl.queryMyName(curUser));
}
@ApiOperation(value = "710 查询当前登录人菜单和按钮权限",notes = "查询当前登录人菜单和按钮权限")
@ApiOperation(value = "710 查询菜单、按钮权限",notes = "查询当前登录人菜单和按钮权限")
@GetMapping("/getAllRole")
public Result getAllRoleByUserId(CurUser curUser) {
return Result.builder(new PersistModel(1),
......
......@@ -200,7 +200,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"AND su.corp_id = #{corpId} " +
"AND su.business_id = #{businessId} " +
"AND sm.MODEL_ID = #{modelId} " +
"ORDER BY sm.SORT ")
"ORDER BY sm.BUSINESS_ID ")
@ResultMap(value = "DtoResultMap")
List<QueryMenuResDTO> queryMenus(@Param("corpId") String corpId, @Param("businessId") String businessId, @Param("modelId") String modelId );
......@@ -256,9 +256,9 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @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" +
"(BUSINESS_ID,PID,TYPE,NAME,VALUE,CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE,DEL_FLAG,FLAG,REMARKS,corp_id,sort) 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})"+
"(#{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},#{item.sort})"+
"</foreach> </script>")
int initDictionary(List<BDictionary> list);
......
......@@ -146,6 +146,17 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public int AssignRoles(String userId, String roleId) {
if("".equals(roleId)){
//如果没有勾选角色 则清空该用户所有角色
List<String> uid = new ArrayList<>();
String[] ids = userId.split(",");
for(String s : ids){
uid.add(s);
}
sysUserMapper.delUserRoleById(uid);
return 1;
}
//超级管理员只有一个不能被分配
List<String> adminRoleType = asList("0");
//查询超级管理员角色的userid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment