|
@@ -9,9 +9,15 @@ import com.qmth.teachcloud.common.bean.params.BasicCourseParams;
|
|
|
import com.qmth.teachcloud.common.bean.result.BasicCourseResult;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
+import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
+import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.OrgCenterTypeEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.OrgTypeEnum;
|
|
|
import com.qmth.teachcloud.common.mapper.BasicCourseMapper;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
+import com.qmth.teachcloud.common.service.SysOrgService;
|
|
|
+import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -35,6 +42,10 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
|
|
|
@Resource
|
|
|
private BasicCourseMapper basicCourseMapper;
|
|
|
+ @Resource
|
|
|
+ private TeachcloudCommonService teachcloudCommonService;
|
|
|
+ @Resource
|
|
|
+ private SysOrgService sysOrgService;
|
|
|
|
|
|
|
|
|
|
|
@@ -87,7 +98,7 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void createCourse(Long schoolId, String courseCode, String courseName) {
|
|
|
- // 向'basic_course'表新增数据
|
|
|
+ // 向'basic_course'表新增数据 - 教研分析用
|
|
|
List<BasicCourse> basicCourseList = this.list(new QueryWrapper<BasicCourse>().lambda()
|
|
|
.eq(BasicCourse::getSchoolId,schoolId).eq(BasicCourse::getCode,courseCode));
|
|
|
if (basicCourseList.size() > 0){
|
|
@@ -102,15 +113,55 @@ public class BasicCourseServiceImpl extends ServiceImpl<BasicCourseMapper, Basic
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BasicCourseResult basicStudentPage(String courseName, Long startCreateTime, Long endCreateTime, int pageNumber, int pageSize) {
|
|
|
- return null;
|
|
|
+ public IPage<BasicCourseResult> basicStudentPage(String courseName, Long startCreateTime, Long endCreateTime, int pageNumber, int pageSize) {
|
|
|
+ Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
+ Set<Long> orgIds = teachcloudCommonService.listSubOrgIds(null);
|
|
|
+ courseName = SystemConstant.translateSpecificSign(courseName);
|
|
|
+ return basicCourseMapper.findBasicCoursePage(new Page<>(pageNumber,pageSize),courseName,startCreateTime,endCreateTime,schoolId,orgIds);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public Long saveBasicCourse(BasicCourseParams basicCourseParams) {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ Long schoolId = sysUser.getSchoolId();
|
|
|
+ Long id = basicCourseParams.getId();
|
|
|
+ String courseName = basicCourseParams.getCourseName();
|
|
|
+ // 校验课程编号
|
|
|
+ String courseCode = basicCourseParams.getCourseCode();
|
|
|
+ BasicCourse checkCode = this.getOne(new QueryWrapper<BasicCourse>().lambda()
|
|
|
+ .eq(BasicCourse::getCode,courseCode)
|
|
|
+ .eq(BasicCourse::getSchoolId,schoolId)
|
|
|
+ .eq(BasicCourse::getEnable,true));
|
|
|
+ if (Objects.nonNull(checkCode)){
|
|
|
+ if (!checkCode.getId().equals(id)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程编号【" + courseCode +"】重复");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 校验教研室id
|
|
|
+ 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("所选教研室不存在");
|
|
|
+ }
|
|
|
+ List<String> clazzList = basicCourseParams.getClazzList();
|
|
|
+
|
|
|
+ //基础数据组装
|
|
|
+ BasicCourse basicCourse = new BasicCourse();
|
|
|
+
|
|
|
+
|
|
|
+ if (!SystemConstant.longNotNull(id)){
|
|
|
+ // 没有id -》新增
|
|
|
+ }else {
|
|
|
+ // 有id -》 更新
|
|
|
+ }
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public Boolean removeBasicCourseBatch(List<Long> idList) {
|
|
|
return null;
|