|
@@ -86,7 +86,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
public BasicCourse findByCourseCode(String courseCode, Long schoolId) {
|
|
public BasicCourse findByCourseCode(String courseCode, Long schoolId) {
|
|
BasicCourse basicCourse = this.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getSchoolId, schoolId));
|
|
BasicCourse basicCourse = this.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getSchoolId, schoolId));
|
|
if (Objects.isNull(basicCourse)) {
|
|
if (Objects.isNull(basicCourse)) {
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到课程编号为【" + courseCode + "】的基础课程");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到课程编号为[" + courseCode + "]的基础课程");
|
|
}
|
|
}
|
|
return basicCourse;
|
|
return basicCourse;
|
|
}
|
|
}
|
|
@@ -153,6 +153,8 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
try {
|
|
try {
|
|
this.saveOrUpdate(editBasicCourse);
|
|
this.saveOrUpdate(editBasicCourse);
|
|
|
|
|
|
|
|
+ basicTeachCourseService.updateByCourseIdAndTeacherList(basicCourseParams.getId(), basicCourseParams.getTeachIdSet());
|
|
|
|
+
|
|
// 同步更新命题任务中的课程名称
|
|
// 同步更新命题任务中的课程名称
|
|
this.baseMapper.updateCourseNameFormExamTask(sysUser.getSchoolId(), editBasicCourse.getCode(), editBasicCourse.getName());
|
|
this.baseMapper.updateCourseNameFormExamTask(sysUser.getSchoolId(), editBasicCourse.getCode(), editBasicCourse.getName());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -206,7 +208,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
for (Map<String, Object> map : mapList) {
|
|
for (Map<String, Object> map : mapList) {
|
|
courseNames.append(map.get("courseName")).append(",");
|
|
courseNames.append(map.get("courseName")).append(",");
|
|
}
|
|
}
|
|
- throw ExceptionResultEnum.ERROR.exception("课程 : 【" + courseNames.substring(0, courseNames.length() - 1) + "】 已经生成了命题任务,不允许删除");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程[" + courseNames.substring(0, courseNames.length() - 1) + "]已经生成了命题任务,不允许删除");
|
|
}
|
|
}
|
|
// 课程批量删除
|
|
// 课程批量删除
|
|
basicUserCourseService.remove(new QueryWrapper<BasicUserCourse>().lambda()
|
|
basicUserCourseService.remove(new QueryWrapper<BasicUserCourse>().lambda()
|
|
@@ -244,7 +246,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<BasicCourseParams> executeImportBasicCourseLogic(MultipartFile file) throws IOException, NoSuchFieldException {
|
|
public List<BasicCourseParams> executeImportBasicCourseLogic(MultipartFile file) throws IOException, NoSuchFieldException {
|
|
- Map<Integer,List<String>> errorMap = new HashMap<>();
|
|
|
|
|
|
+ Map<Integer, List<String>> errorMap = new HashMap<>();
|
|
InputStream inputStream = file.getInputStream();
|
|
InputStream inputStream = file.getInputStream();
|
|
List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicCourseImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicCourseImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
Map<String, BasicCourseImportDto> courseDtoMap = new HashMap<>();
|
|
Map<String, BasicCourseImportDto> courseDtoMap = new HashMap<>();
|
|
@@ -276,11 +278,11 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
String primaryName = primaryCell.getCourseName();
|
|
String primaryName = primaryCell.getCourseName();
|
|
String primaryTeachingRoomName = primaryCell.getTeachingRoomName();
|
|
String primaryTeachingRoomName = primaryCell.getTeachingRoomName();
|
|
if (!Objects.equals(primaryName, courseName)) {
|
|
if (!Objects.equals(primaryName, courseName)) {
|
|
- String cellException = "【课程编号】 : " + courseCode + ",存在不同的【课程名称】";
|
|
|
|
|
|
+ String cellException = "课程编码[" + courseCode + "],存在不同的课程名称";
|
|
this.updateErrorInfoMap(errorMap, y + 1, cellException);
|
|
this.updateErrorInfoMap(errorMap, y + 1, cellException);
|
|
}
|
|
}
|
|
if (!Objects.equals(primaryTeachingRoomName, teachingRoomName)) {
|
|
if (!Objects.equals(primaryTeachingRoomName, teachingRoomName)) {
|
|
- String cellException = "【课程编号】 : " + courseCode + ",存在不同的【所属教研室】";
|
|
|
|
|
|
+ String cellException = "课程编码[" + courseCode + "],存在不同的开课学院";
|
|
this.updateErrorInfoMap(errorMap, y + 1, cellException);
|
|
this.updateErrorInfoMap(errorMap, y + 1, cellException);
|
|
}
|
|
}
|
|
String primaryClazz = primaryCell.getClazz();
|
|
String primaryClazz = primaryCell.getClazz();
|
|
@@ -293,19 +295,19 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
courseDtoMap.put(courseCode, basicCourseImportDto);
|
|
courseDtoMap.put(courseCode, basicCourseImportDto);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (Objects.nonNull(courseCode) && !courseCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE)) {
|
|
|
|
- this.updateErrorInfoMap(errorMap, y + 1, "[课程编号]不符合输入规范");
|
|
|
|
|
|
+ if (Objects.nonNull(courseCode) && (!courseCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE) || courseCode.length() < 3 || courseCode.length() > 30)) {
|
|
|
|
+ this.updateErrorInfoMap(errorMap, y + 1, "课程编码[" + courseCode + "]不符合输入规范");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 删除重复的(需要累加的)excel数据
|
|
// 删除重复的(需要累加的)excel数据
|
|
basicCourseImportDtoList.removeAll(duplicateData);
|
|
basicCourseImportDtoList.removeAll(duplicateData);
|
|
}
|
|
}
|
|
return finalExcelList;
|
|
return finalExcelList;
|
|
- },2);
|
|
|
|
- return this.executeBasicCourseImportLogic(finalList,errorMap);
|
|
|
|
|
|
+ }, 2);
|
|
|
|
+ return this.executeBasicCourseImportLogic(finalList, errorMap);
|
|
}
|
|
}
|
|
|
|
|
|
- private void updateErrorInfoMap(Map<Integer,List<String>> errorMap,Integer key,String exception) {
|
|
|
|
|
|
+ private void updateErrorInfoMap(Map<Integer, List<String>> errorMap, Integer key, String exception) {
|
|
if (errorMap.containsKey(key)) {
|
|
if (errorMap.containsKey(key)) {
|
|
errorMap.get(key).add(exception);
|
|
errorMap.get(key).add(exception);
|
|
} else {
|
|
} else {
|
|
@@ -326,7 +328,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
for (Integer rowIndex : exceptionMap.keySet()) {
|
|
for (Integer rowIndex : exceptionMap.keySet()) {
|
|
String rowInfo;
|
|
String rowInfo;
|
|
if (rowIndex > 0) {
|
|
if (rowIndex > 0) {
|
|
- rowInfo = "excel中第【" + rowIndex + "】行 : ";
|
|
|
|
|
|
+ rowInfo = "excel中第[" + rowIndex + "]行 : ";
|
|
} else {
|
|
} else {
|
|
rowInfo = "excel中存在异常:";
|
|
rowInfo = "excel中存在异常:";
|
|
}
|
|
}
|
|
@@ -346,7 +348,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
- public List<BasicCourseParams> executeBasicCourseImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList,Map<Integer,List<String>> errorMap) {
|
|
|
|
|
|
+ public List<BasicCourseParams> executeBasicCourseImportLogic(List<LinkedMultiValueMap<Integer, Object>> finalList, Map<Integer, List<String>> errorMap) {
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
Long schoolId = sysUser.getSchoolId();
|
|
Long schoolId = sysUser.getSchoolId();
|
|
List<BasicCourseParams> addBasicCourseParamsList = new ArrayList<>();
|
|
List<BasicCourseParams> addBasicCourseParamsList = new ArrayList<>();
|
|
@@ -367,7 +369,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
.eq(SysOrg::getEnable, true)
|
|
.eq(SysOrg::getEnable, true)
|
|
.eq(SysOrg::getName, teachingRoomName));
|
|
.eq(SysOrg::getName, teachingRoomName));
|
|
if (Objects.isNull(sysOrg)) {
|
|
if (Objects.isNull(sysOrg)) {
|
|
- this.updateErrorInfoMap(errorMap,rowIndex,"输入的开课学院【" + teachingRoomName + "】不存在");
|
|
|
|
|
|
+ this.updateErrorInfoMap(errorMap, rowIndex, "输入的开课学院[" + teachingRoomName + "]不存在");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long teachingRoomId = sysOrg.getId();
|
|
Long teachingRoomId = sysOrg.getId();
|
|
@@ -380,7 +382,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
.eq(BasicClazz::getSchoolId, schoolId)
|
|
.eq(BasicClazz::getSchoolId, schoolId)
|
|
.eq(BasicClazz::getClazzName, clzName));
|
|
.eq(BasicClazz::getClazzName, clzName));
|
|
if (Objects.isNull(basicClazz)) {
|
|
if (Objects.isNull(basicClazz)) {
|
|
- this.updateErrorInfoMap(errorMap,rowIndex,"所选择【班级】" + clzName + "不存在");
|
|
|
|
|
|
+ this.updateErrorInfoMap(errorMap, rowIndex, "所选择班级[" + clzName + "]不存在");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
clazzIdSet.add(basicClazz.getId());
|
|
clazzIdSet.add(basicClazz.getId());
|
|
@@ -405,14 +407,14 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
.eq(SysUser::getRealName, name)
|
|
.eq(SysUser::getRealName, name)
|
|
.eq(SysUser::getCode, code));
|
|
.eq(SysUser::getCode, code));
|
|
if (Objects.isNull(sysUserDb)) {
|
|
if (Objects.isNull(sysUserDb)) {
|
|
- this.updateErrorInfoMap(errorMap, rowIndex, "【姓名】" + name + ",【工号】" + code + "不存在");
|
|
|
|
|
|
+ this.updateErrorInfoMap(errorMap, rowIndex, "姓名[" + name + "],工号[" + code + "]不存在");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUserDb.getId());
|
|
List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUserDb.getId());
|
|
sysRoleList = sysRoleList.stream().filter(s -> s.getType() == RoleTypeEnum.SCHOOL_TEACHER).collect(Collectors.toList());
|
|
sysRoleList = sysRoleList.stream().filter(s -> s.getType() == RoleTypeEnum.SCHOOL_TEACHER).collect(Collectors.toList());
|
|
if (CollectionUtils.isEmpty(sysRoleList)) {
|
|
if (CollectionUtils.isEmpty(sysRoleList)) {
|
|
- this.updateErrorInfoMap(errorMap, rowIndex, "【姓名】" + name + ",【工号】" + code + "没有老师角色");
|
|
|
|
|
|
+ this.updateErrorInfoMap(errorMap, rowIndex, "姓名[" + name + "],工号[" + code + "]没有老师角色");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
teachIdSet.add(sysUserDb.getId());
|
|
teachIdSet.add(sysUserDb.getId());
|
|
@@ -575,7 +577,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
.eq(BasicCourse::getEnable, true));
|
|
.eq(BasicCourse::getEnable, true));
|
|
if (Objects.nonNull(checkCode)) {
|
|
if (Objects.nonNull(checkCode)) {
|
|
if (!checkCode.getId().equals(id)) {
|
|
if (!checkCode.getId().equals(id)) {
|
|
- throw ExceptionResultEnum.ERROR.exception("课程编号【" + courseCode + "】重复");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程编码[" + courseCode + "]重复");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 校验教研室id
|
|
// 校验教研室id
|