|
|
|
|
@ -1,14 +1,13 @@
|
|
|
|
|
package cn.xluobo.business.sc.course.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.xluobo.business.sc.course.domain.req.ReqAddScCourseCla;
|
|
|
|
|
import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseCla;
|
|
|
|
|
import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
|
|
|
|
|
import cn.xluobo.business.sc.course.domain.resp.RespCourseClaInfo;
|
|
|
|
|
import cn.xluobo.business.sc.course.domain.resp.cla.RespClaAllDetailInfo;
|
|
|
|
|
import cn.xluobo.business.sc.course.repo.mapper.ScCourseClaMapper;
|
|
|
|
|
import cn.xluobo.business.sc.course.repo.model.ScClaTime;
|
|
|
|
|
import cn.xluobo.business.sc.course.repo.model.ScCourse;
|
|
|
|
|
import cn.xluobo.business.sc.course.repo.model.ScCourseCla;
|
|
|
|
|
import cn.xluobo.business.sc.course.repo.model.*;
|
|
|
|
|
import cn.xluobo.business.sc.student.repo.mapper.ScStudentMapper;
|
|
|
|
|
import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
|
|
|
|
|
import cn.xluobo.business.sc.student.service.IScStudentCourseService;
|
|
|
|
|
@ -23,8 +22,10 @@ import cn.xluobo.core.page.RespPage;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@ -65,6 +66,9 @@ public class BusinessScCourseClaService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IScClaTimeService claTimeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserService userService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询
|
|
|
|
|
*
|
|
|
|
|
@ -73,6 +77,8 @@ public class BusinessScCourseClaService {
|
|
|
|
|
*/
|
|
|
|
|
public APIResponse searchList(ReqSearchScCourseCla reqSearchScCourseCla) {
|
|
|
|
|
RespPage<RespCourseClaInfo> page = new RespPage(reqSearchScCourseCla.getPageNum(), reqSearchScCourseCla.getPageSize());
|
|
|
|
|
String nowTenantId = SecurityUtils.getLoginUser().getNowTenantId();
|
|
|
|
|
reqSearchScCourseCla.setTenantId(nowTenantId);
|
|
|
|
|
List<RespCourseClaInfo> claList = scCourseClaMapper.selectClaList(reqSearchScCourseCla, page);
|
|
|
|
|
page.setRows(claList);
|
|
|
|
|
return APIResponse.toAPIResponse(page);
|
|
|
|
|
@ -91,17 +97,28 @@ public class BusinessScCourseClaService {
|
|
|
|
|
Map<String, Object> resultMap = Maps.newHashMap();
|
|
|
|
|
// 班级信息
|
|
|
|
|
ScCourseCla detailInfo = scCourseClaService.getById(claId);
|
|
|
|
|
|
|
|
|
|
if (null == detailInfo) {
|
|
|
|
|
return APIResponse.toAPIResponse(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScCourseClaVo scCourseCla = new ScCourseClaVo();
|
|
|
|
|
BeanUtil.copyProperties(detailInfo,scCourseCla);
|
|
|
|
|
scCourseCla.setClaId(detailInfo.getClaId().toString());
|
|
|
|
|
scCourseCla.setCourseId(detailInfo.getCourseId().toString());
|
|
|
|
|
// 课程信息
|
|
|
|
|
ScCourse scCourse = courseService.getById(detailInfo.getCourseId());
|
|
|
|
|
|
|
|
|
|
ScCourseVo scCourseVo = new ScCourseVo();
|
|
|
|
|
BeanUtil.copyProperties(scCourse,scCourseVo);
|
|
|
|
|
scCourseVo.setCourseId(scCourse.getCourseId().toString());
|
|
|
|
|
|
|
|
|
|
// 是否允许变更课程,有报名不允许变更课程
|
|
|
|
|
APIBaseResponse canChangeCourse = scCourseClaService.canChangeCourse(claId);
|
|
|
|
|
resultMap.put("canChangeCourse", canChangeCourse.isSuccess());
|
|
|
|
|
|
|
|
|
|
resultMap.put("claInfo", detailInfo);
|
|
|
|
|
resultMap.put("claCourseInfo", scCourse);
|
|
|
|
|
resultMap.put("claInfo", scCourseCla);
|
|
|
|
|
resultMap.put("claCourseInfo", scCourseVo);
|
|
|
|
|
|
|
|
|
|
return APIResponse.toAPIResponse(resultMap);
|
|
|
|
|
}
|
|
|
|
|
@ -118,17 +135,25 @@ public class BusinessScCourseClaService {
|
|
|
|
|
}
|
|
|
|
|
// 班级信息
|
|
|
|
|
ScCourseCla courseCla = scCourseClaService.getById(claId);
|
|
|
|
|
|
|
|
|
|
if (null == courseCla) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScCourseClaVo scCourseClaVo = new ScCourseClaVo();
|
|
|
|
|
BeanUtil.copyProperties(courseCla,scCourseClaVo);
|
|
|
|
|
scCourseClaVo.setClaId(courseCla.getClaId().toString());
|
|
|
|
|
|
|
|
|
|
// 班级当前学员数量
|
|
|
|
|
Integer studentCnt = scCourseClaService.selectStudentCnt(claId);
|
|
|
|
|
courseCla.setStudentCnt(studentCnt);
|
|
|
|
|
scCourseClaVo.setStudentCnt(studentCnt);
|
|
|
|
|
|
|
|
|
|
// 课程信息
|
|
|
|
|
ScCourse scCourse = courseService.getById(courseCla.getCourseId());
|
|
|
|
|
|
|
|
|
|
ScCourseVo scCourseVo = new ScCourseVo();
|
|
|
|
|
BeanUtil.copyProperties(scCourse,scCourseVo);
|
|
|
|
|
scCourseVo.setCourseId(scCourse.getCourseId().toString());
|
|
|
|
|
|
|
|
|
|
// 课程收费信息
|
|
|
|
|
List<RespBusinessChooseCourseCharge> courseChargeList = courseChargeService.courseChargeList(scCourse.getCourseId(), null);
|
|
|
|
|
@ -149,8 +174,8 @@ public class BusinessScCourseClaService {
|
|
|
|
|
List<String> claTimeInfo = claTimeRuleService.selectClaTimeInfo(claId);
|
|
|
|
|
|
|
|
|
|
return RespClaAllDetailInfo.builder()
|
|
|
|
|
.courseCla(courseCla)
|
|
|
|
|
.course(scCourse)
|
|
|
|
|
.courseCla(scCourseClaVo)
|
|
|
|
|
.course(scCourseVo)
|
|
|
|
|
.courseChargeList(courseChargeList)
|
|
|
|
|
.claTimeList(claTimeInfo)
|
|
|
|
|
.build();
|
|
|
|
|
@ -173,13 +198,14 @@ public class BusinessScCourseClaService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 教师是否存在
|
|
|
|
|
SysStaff teacher = teacherService.getById(scCourseCla.getStaffId());
|
|
|
|
|
SysUser teacher = userService.selectUserById(scCourseCla.getStaffId());
|
|
|
|
|
if (null == teacher) {
|
|
|
|
|
return APIResponse.toExceptionResponse("教师不存在,请重新选择后提交。");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新建班级
|
|
|
|
|
ScCourseCla cla = scCourseCla.getScCourseCla(loginUser);
|
|
|
|
|
cla.setTeacherName(teacher.getNickName());
|
|
|
|
|
APIBaseResponse checkParam = cla.checkParam();
|
|
|
|
|
if (!checkParam.isSuccess()) {
|
|
|
|
|
return APIResponse.toExceptionResponse(checkParam.getRespMsg());
|
|
|
|
|
@ -213,7 +239,7 @@ public class BusinessScCourseClaService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 教师是否存在
|
|
|
|
|
SysStaff teacher = teacherService.getById(scCourseCla.getStaffId());
|
|
|
|
|
SysUser teacher = userService.selectUserById(scCourseCla.getStaffId());
|
|
|
|
|
if (null == teacher) {
|
|
|
|
|
return APIResponse.toExceptionResponse("教师不存在,请重新选择后提交。");
|
|
|
|
|
}
|
|
|
|
|
@ -227,6 +253,7 @@ public class BusinessScCourseClaService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
|
scCourseCla.setTeacherName(teacher.getNickName());
|
|
|
|
|
scCourseCla.setLastUpdateUser(loginUser.getUserId());
|
|
|
|
|
scCourseCla.setLastUpdateTime(new Date());
|
|
|
|
|
boolean updateScCourseCla = scCourseClaService.updateById(scCourseCla);
|
|
|
|
|
|