|
@@ -60,7 +60,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
@Override
|
|
@Override
|
|
public void verifyCourseInfo(Long schoolId, String courseCode, String courseName, Long userId) {
|
|
public void verifyCourseInfo(Long schoolId, String courseCode, String courseName, Long userId) {
|
|
QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<BasicCourse> queryWrapper = new QueryWrapper<>();
|
|
- queryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getEnable,true);
|
|
|
|
|
|
+ queryWrapper.lambda().eq(BasicCourse::getSchoolId, schoolId).eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getEnable, true);
|
|
|
|
|
|
BasicCourse tmp = this.getOne(queryWrapper);
|
|
BasicCourse tmp = this.getOne(queryWrapper);
|
|
if (tmp != null) {
|
|
if (tmp != null) {
|
|
@@ -118,11 +118,11 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public IPage<BasicCourseResult> basicCoursePage(String courseName, Long startCreateTime, Long endCreateTime, int pageNumber, int pageSize) {
|
|
|
|
|
|
+ public IPage<BasicCourseResult> basicCoursePage(String courseName, Long startCreateTime, Long endCreateTime, Boolean enable, int pageNumber, int pageSize) {
|
|
Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
courseName = SystemConstant.translateSpecificSign(courseName);
|
|
courseName = SystemConstant.translateSpecificSign(courseName);
|
|
- IPage<BasicCourseResult> iPage = basicCourseMapper.findBasicCoursePage(new Page<>(pageNumber, pageSize), courseName, startCreateTime, endCreateTime, schoolId, orgIds);
|
|
|
|
|
|
+ IPage<BasicCourseResult> iPage = basicCourseMapper.findBasicCoursePage(new Page<>(pageNumber, pageSize), courseName, startCreateTime, endCreateTime, enable, schoolId, orgIds);
|
|
List<BasicCourseResult> list = iPage.getRecords();
|
|
List<BasicCourseResult> list = iPage.getRecords();
|
|
for (BasicCourseResult basicCourseResult : list) {
|
|
for (BasicCourseResult basicCourseResult : list) {
|
|
String clazzIds = basicCourseResult.getClazzIds();
|
|
String clazzIds = basicCourseResult.getClazzIds();
|
|
@@ -153,36 +153,36 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
- public Boolean removeBasicCourseBatch(List<Long> idList,Boolean enable) {
|
|
|
|
|
|
+ public Boolean removeBasicCourseBatch(List<Long> idList, Boolean enable) {
|
|
Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
if (idList.size() == 0) {
|
|
if (idList.size() == 0) {
|
|
throw ExceptionResultEnum.ERROR.exception("请选择要目标");
|
|
throw ExceptionResultEnum.ERROR.exception("请选择要目标");
|
|
}
|
|
}
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
- if (!enable){
|
|
|
|
|
|
+ if (!enable) {
|
|
// 批量禁用判断
|
|
// 批量禁用判断
|
|
// 业务判断
|
|
// 业务判断
|
|
Set<String> courseCodeSet = idList.stream().map(e -> {
|
|
Set<String> courseCodeSet = idList.stream().map(e -> {
|
|
BasicCourse basicCourse = this.getById(e);
|
|
BasicCourse basicCourse = this.getById(e);
|
|
- if (Objects.isNull(basicCourse)){
|
|
|
|
|
|
+ if (Objects.isNull(basicCourse)) {
|
|
throw ExceptionResultEnum.ERROR.exception("未找到课程");
|
|
throw ExceptionResultEnum.ERROR.exception("未找到课程");
|
|
}
|
|
}
|
|
return basicCourse.getCode();
|
|
return basicCourse.getCode();
|
|
}).collect(Collectors.toSet());
|
|
}).collect(Collectors.toSet());
|
|
- List<Map<String,Object>> mapList = basicCourseMapper.findExamTaskByCourseCode(schoolId,courseCodeSet);
|
|
|
|
- if (mapList.size() > 0){
|
|
|
|
|
|
+ List<Map<String, Object>> mapList = basicCourseMapper.findExamTaskByCourseCode(schoolId, courseCodeSet);
|
|
|
|
+ if (mapList.size() > 0) {
|
|
StringBuilder courseNames = new StringBuilder();
|
|
StringBuilder courseNames = new StringBuilder();
|
|
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.update(new UpdateWrapper<BasicUserCourse>().lambda()
|
|
basicUserCourseService.update(new UpdateWrapper<BasicUserCourse>().lambda()
|
|
.in(BasicUserCourse::getCourseId, idList)
|
|
.in(BasicUserCourse::getCourseId, idList)
|
|
- .eq(BasicUserCourse::getSchoolId,sysUser.getSchoolId())
|
|
|
|
- .set(BasicUserCourse::getEnable,enable)
|
|
|
|
|
|
+ .eq(BasicUserCourse::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .set(BasicUserCourse::getEnable, enable)
|
|
.set(BasicUserCourse::getUpdateId, sysUser.getId()));
|
|
.set(BasicUserCourse::getUpdateId, sysUser.getId()));
|
|
|
|
|
|
UpdateWrapper<BasicCourse> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<BasicCourse> updateWrapper = new UpdateWrapper<>();
|