|
@@ -14,9 +14,11 @@ import com.qmth.teachcloud.common.bean.result.ClazzDatasourceResult;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
-import com.qmth.teachcloud.common.enums.OrgTypeEnum;
|
|
|
import com.qmth.teachcloud.common.mapper.BasicCourseMapper;
|
|
|
-import com.qmth.teachcloud.common.service.*;
|
|
|
+import com.qmth.teachcloud.common.service.BasicClazzService;
|
|
|
+import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
+import com.qmth.teachcloud.common.service.BasicUserCourseService;
|
|
|
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -39,17 +41,21 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Resource
|
|
|
private BasicCourseMapper basicCourseMapper;
|
|
|
+
|
|
|
@Resource
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
- @Resource
|
|
|
- private SysOrgService sysOrgService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicUserCourseService basicUserCourseService;
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicClazzService basicClazzService;
|
|
|
- @Resource
|
|
|
- private SysUserService sysUserService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<BasicCourse> listCoursesByUserId(Long userId) {
|
|
@@ -81,8 +87,8 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Override
|
|
|
public BasicCourse findByCourseCode(String courseCode, Long schoolId) {
|
|
|
- BasicCourse basicCourse = this.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getSchoolId,schoolId));
|
|
|
- if (Objects.isNull(basicCourse)){
|
|
|
+ BasicCourse basicCourse = this.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getCode, courseCode).eq(BasicCourse::getSchoolId, schoolId));
|
|
|
+ if (Objects.isNull(basicCourse)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到课程编号为【" + courseCode + "】的基础课程");
|
|
|
}
|
|
|
return basicCourse;
|
|
@@ -190,25 +196,25 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
@Override
|
|
|
public Boolean removeBasicCourseBatchByQuery(Long belongOrgId, String courseName, Long startCreateTime, Long endCreateTime, Boolean enable, Boolean enableOperate) {
|
|
|
QueryWrapper<BasicCourse> basicCourseQueryWrapper = new QueryWrapper<>();
|
|
|
- if (SystemConstant.longNotNull(belongOrgId)){
|
|
|
- basicCourseQueryWrapper.lambda().eq(BasicCourse::getTeachingRoomId,belongOrgId);
|
|
|
+ if (SystemConstant.longNotNull(belongOrgId)) {
|
|
|
+ basicCourseQueryWrapper.lambda().eq(BasicCourse::getTeachingRoomId, belongOrgId);
|
|
|
}
|
|
|
- if (SystemConstant.strNotNull(courseName)){
|
|
|
- basicCourseQueryWrapper.lambda().like(BasicCourse::getName,SystemConstant.translateSpecificSign(courseName));
|
|
|
+ if (SystemConstant.strNotNull(courseName)) {
|
|
|
+ basicCourseQueryWrapper.lambda().like(BasicCourse::getName, SystemConstant.translateSpecificSign(courseName));
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(startCreateTime)){
|
|
|
- basicCourseQueryWrapper.lambda().ge(BasicCourse::getCreateTime,startCreateTime);
|
|
|
+ if (SystemConstant.longNotNull(startCreateTime)) {
|
|
|
+ basicCourseQueryWrapper.lambda().ge(BasicCourse::getCreateTime, startCreateTime);
|
|
|
}
|
|
|
- if (SystemConstant.longNotNull(endCreateTime)){
|
|
|
- basicCourseQueryWrapper.lambda().le(BasicCourse::getCreateTime,endCreateTime);
|
|
|
+ if (SystemConstant.longNotNull(endCreateTime)) {
|
|
|
+ basicCourseQueryWrapper.lambda().le(BasicCourse::getCreateTime, endCreateTime);
|
|
|
}
|
|
|
- if (Objects.nonNull(enable)){
|
|
|
- basicCourseQueryWrapper.lambda().eq(BasicCourse::getEnable,enable);
|
|
|
+ if (Objects.nonNull(enable)) {
|
|
|
+ basicCourseQueryWrapper.lambda().eq(BasicCourse::getEnable, enable);
|
|
|
}
|
|
|
List<BasicCourse> basicCourseList = this.list(basicCourseQueryWrapper);
|
|
|
List<Long> idList = basicCourseList.stream().map(BaseEntity::getId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
- return idList.size() > 0 ? this.removeBasicCourseBatch(idList, enableOperate): true;
|
|
|
+ return idList.size() > 0 ? this.removeBasicCourseBatch(idList, enableOperate) : true;
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -231,17 +237,18 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
String teachingRoomName = basicCourseImportDto.getTeachingRoomName();
|
|
|
String clazz = basicCourseImportDto.getClazz();
|
|
|
|
|
|
- SysOrg sysOrg = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
|
|
|
- .eq(SysOrg::getSchoolId, schoolId)
|
|
|
- .eq(SysOrg::getEnable, true)
|
|
|
- .eq(SysOrg::getType, OrgTypeEnum.TEACHING_ROOM)
|
|
|
- .eq(SysOrg::getName, teachingRoomName));
|
|
|
+ SysOrg sysOrg = null;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (Objects.isNull(sysOrg)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("输入的教研室【" + teachingRoomName + "】不存在");
|
|
|
}
|
|
|
Long teachingRoomId = sysOrg.getId();
|
|
|
LinkedHashSet<Long> clazzIdSet = new LinkedHashSet<>();
|
|
|
- if (SystemConstant.strNotNull(clazz)){
|
|
|
+ if (SystemConstant.strNotNull(clazz)) {
|
|
|
String[] clazzList = clazz.split(SystemConstant.COMMA);
|
|
|
for (String clzName : clazzList) {
|
|
|
BasicClazz basicClazz = basicClazzService.getOne(new QueryWrapper<BasicClazz>().lambda()
|
|
@@ -316,12 +323,12 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
}
|
|
|
|
|
|
Long teachingRoomId = basicCourseParams.getTeachingRoomId();
|
|
|
- if (Objects.isNull(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda()
|
|
|
- .eq(SysOrg::getId, teachingRoomId)
|
|
|
- .eq(SysOrg::getEnable, true)
|
|
|
- .eq(SysOrg::getType, OrgTypeEnum.TEACHING_ROOM)))) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("所选教研室不存在");
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
Set<Long> clazzIdSet = basicCourseParams.getClazzIdSet();
|
|
|
|