master
董哲奇 1 month ago
parent 7a32ec21d8
commit fe30b2562e

@ -1,6 +1,7 @@
package cn.xluobo.business.sc.course.domain.req;
import cn.xluobo.core.page.ReqPageBase;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data;
import java.io.Serializable;
@ -44,4 +45,10 @@ public class ReqSearchScCourse extends ReqPageBase implements Serializable {
*
*/
private Long studentId;
private String tenantId;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
}

@ -11,8 +11,8 @@ import java.io.Serializable;
*/
@Data
public class ReqSearchScCourseCla extends ReqPageBase implements Serializable {
private Long courseId;
private Long staffId;
private String courseId;
private String staffId;
private String claName;
private String courseTime;
private Long departId;
@ -20,4 +20,6 @@ public class ReqSearchScCourseCla extends ReqPageBase implements Serializable {
*
*/
private String chargeType;
private String tenantId;
}

@ -12,7 +12,7 @@ import java.math.BigDecimal;
@Data
public class ReqAddScCourseChargeItem {
private Long chargeId;
private String chargeId;
/**
* id

@ -10,7 +10,7 @@ import lombok.Data;
@Data
public class RespCourseClaInfo {
private Long claId;
private String claId;
private String claName;
@ -24,13 +24,13 @@ public class RespCourseClaInfo {
private String openDate;
private Long courseId;
private String courseId;
private String courseName;
private Long staffId;
private String staffName;
private String teacherName;
private String deptName;

@ -3,6 +3,8 @@ package cn.xluobo.business.sc.course.domain.resp.cla;
import cn.xluobo.business.sc.course.domain.resp.RespBusinessChooseCourseCharge;
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.ScCourseClaVo;
import cn.xluobo.business.sc.course.repo.model.ScCourseVo;
import lombok.Builder;
import lombok.Data;
@ -18,10 +20,10 @@ import java.util.List;
public class RespClaAllDetailInfo {
// 班级信息
private ScCourseCla courseCla;
private ScCourseClaVo courseCla;
// 课程信息
private ScCourse course;
private ScCourseVo course;
// 收费方式
private List<RespBusinessChooseCourseCharge> courseChargeList;

@ -12,7 +12,7 @@ import lombok.Data;
@Data
public class RespScCourseDetail extends ReqAddScCourse {
private Long courseId;
private String courseId;
private String courseTypeName;

@ -4,9 +4,9 @@
<select id="selectByCondition" resultType="cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeRule">
select b.*,fcn_dict_name_list(b.week_day,'week_day') as week_day_name,
a.cla_name,c.course_name,d.staff_name
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_staff d
where a.cla_id = b.cla_id and a.course_id=c.course_id and b.teacher_id=d.staff_id
a.cla_name,c.course_name,d.nick_name
from sc_course_cla a, sc_cla_time_rule b, sc_course c, sys_user d
where a.cla_id = b.cla_id and a.course_id=c.course_id and b.teacher_id=d.user_id
<if test="reqSearchScClaTimeRule.deptId != null">
and a.depart_id=#{reqSearchScClaTimeRule.deptId}
</if>

@ -8,7 +8,7 @@
(select count(1) from sc_student_course sc where sc.cla_id=a.cla_id and sc.status='1') as student_cnt,
a.capacity,a.recruit_status,a.open_date,
b.course_id,b.course_name,
c.staff_id,c.staff_name,
a.staff_id,a.teacher_name,
sd.dept_name,
(select group_concat(fcn_dict_name_list(r.week_day,'week_day'),' ',substr(r.start_time,1,5),'~',substr(r.end_time,1,5),' (',r.begin_date,'~',r.end_date,')' SEPARATOR ';')
from sc_cla_time_rule r
@ -18,9 +18,8 @@
and (date_format(now(),'%Y-%m-%d') between r.begin_date and r.end_date or date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> r.begin_date)) as week_day
from sc_course_cla a
left join sc_course b on a.course_id=b.course_id
left join sys_staff c on a.staff_id=c.staff_id
left join sys_dept sd on a.depart_id=sd.dept_id
where a.delete_flag='0'
where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourseCla.tenantId}
<if test="reqSearchScCourseCla.courseId != null">
and a.course_id=#{reqSearchScCourseCla.courseId}
</if>
@ -44,6 +43,7 @@
and a.delete_flag='0'
order by a.create_time desc
</select>
<select id="selectForSelect" resultType="cn.xluobo.business.sc.course.domain.resp.RespCourseClaSelectInfo">
select a.cla_id,a.cla_name,b.course_id,b.course_name,c.staff_name,
dept.dept_id,

@ -14,7 +14,7 @@
a.course_intro
from sc_course a
left join sc_course_type b on a.course_type_id = b.course_type_id and b.in_use='1'
where a.delete_flag='0'
where a.delete_flag='0' and a.tenant_id=#{reqSearchScCourse.tenantId}
<if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''">
and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%')
</if>

@ -175,15 +175,10 @@ public class ScClaTimeRule implements Serializable {
}
if (ClaTimeRepeatTypeEnums.EVERY_WEEK.getRepeatType().equals(repeatType)
|| ClaTimeRepeatTypeEnums.EVERY_SECOND_WEEK.getRepeatType().equals(repeatType)) {
if (StringUtils.isAnyEmpty(weekDay, startTime, endTime, beginDate, endDate)) {
return false;
}
return !StringUtils.isAnyEmpty(startTime, endTime, beginDate, endDate);
} else {
if (StringUtils.isAnyEmpty(startTime, endTime)) {
return false;
}
return !StringUtils.isAnyEmpty(startTime, endTime);
}
return true;
}

@ -4,6 +4,7 @@ import cn.xluobo.core.api.APIBaseResponse;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@ -146,13 +147,16 @@ public class ScCourseCla implements Serializable {
@TableField(exist = false)
private String deptName;
@TableField(exist = false)
private String teacherName;
// 当前班级人数
@TableField(exist = false)
private Integer studentCnt;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
/**
*
* @return

@ -0,0 +1,175 @@
package cn.xluobo.business.sc.course.repo.model;
import cn.xluobo.core.api.APIBaseResponse;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-08-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sc_course_cla")
public class ScCourseClaVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "cla_id")
private String claId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
/**
* id
*/
@TableField("course_id")
private String courseId;
/**
*
*/
@TableField("depart_id")
private Long departId;
/**
* id
*/
@TableField("staff_id")
private Long staffId;
/**
*
*/
@TableField("cla_name")
private String claName;
/**
*
*/
@TableField("cla_color")
private String claColor;
/**
*
*/
@TableField("capacity")
private Integer capacity;
/**
* 1 2 0
*/
@TableField("recruit_status")
private String recruitStatus;
/**
*
*/
@TableField("every_stu_lose_hour")
private BigDecimal everyStuLoseHour;
/**
*
*/
@TableField("every_tea_get_hour")
private BigDecimal everyTeaGetHour;
/**
*
*/
@TableField("open_date")
private String openDate;
/**
*
*/
@TableField("close_date")
private String closeDate;
/**
*
*/
@TableField("memo")
private String memo;
/**
* 1 0
*/
@TableField("delete_flag")
private String deleteFlag;
/**
*
*/
@TableField("create_user")
private Long createUser;
/**
*
*/
@TableField("create_time")
private Date createTime;
/**
*
*/
@TableField("last_update_user")
private Long lastUpdateUser;
/**
*
*/
@TableField("last_update_time")
private Date lastUpdateTime;
@TableField(exist = false)
private String deptName;
@TableField(exist = false)
private String teacherName;
// 当前班级人数
@TableField(exist = false)
private Integer studentCnt;
public String getTenantId(){
return SecurityUtils.getLoginUser().getNowTenantId();
}
/**
*
* @return
*/
public APIBaseResponse checkParam(){
if(StringUtils.isAnyEmpty(claName,claColor,recruitStatus,openDate)){
return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
}
if(null == courseId || null == departId || null == staffId || null == capacity || null == everyStuLoseHour || null == everyTeaGetHour){
return APIBaseResponse.fail("请求参数错误,请全部填写后,重新提交");
}
return APIBaseResponse.success();
}
}

@ -0,0 +1,111 @@
package cn.xluobo.business.sc.course.repo.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author zhangby
* @since 2020-03-17 11:25:55
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sc_course")
public class ScCourseVo implements Serializable {
/**
* id
*/
@TableId(value = "course_id")
private String courseId;
/**
*
*/
@TableField("tenant_id")
private String tenantId;
/**
*
*/
@TableField("course_name")
private String courseName;
/**
*
*/
@TableField("course_type_id")
private String courseTypeId;
/**
* 1 2
*/
@TableField("teaching_mode")
private String teachingMode;
/**
*
*/
@TableField("course_intro")
private String courseIntro;
/**
* 1 0
*/
@TableField("sale")
private String sale;
/**
* 1 0
*/
@TableField("delete_flag")
@TableLogic
private String deleteFlag;
/**
*
*/
@TableField("create_user")
private Long createUser;
/**
*
*/
@TableField("create_time")
private Date createTime;
/**
*
*/
@TableField("last_update_user")
@JsonIgnore
private Long lastUpdateUser;
/**
*
*/
@TableField("last_update_time")
@JsonIgnore
private Date lastUpdateTime;
/**
* id
*/
@TableField(value = "import_id")
@JsonIgnore
private Long importId;
}

@ -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);

@ -133,7 +133,7 @@ public class BusinessScCourseService {
RespScCourseDetail respScCourseDetail = new RespScCourseDetail();
respScCourseDetail.setCourseId(detailInfo.getCourseId());
respScCourseDetail.setCourseId(detailInfo.getCourseId()+"");
respScCourseDetail.setCourseName(detailInfo.getCourseName());
respScCourseDetail.setCourseTypeId(detailInfo.getCourseTypeId());
respScCourseDetail.setTeachingMode(detailInfo.getTeachingMode());
@ -174,7 +174,7 @@ public class BusinessScCourseService {
partCampusList.add(departId.toString());
}
String chargeType = courseCharge.getChargeType();
chargeItem.setChargeId(courseCharge.getChargeId());
chargeItem.setChargeId(courseCharge.getChargeId()+"");
chargeItem.setCampusId(courseCharge.getDepartId());
chargeItem.setCampusName(campusMap.get(courseCharge.getDepartId()));
if ("hour".equals(chargeType)) {
@ -238,6 +238,7 @@ public class BusinessScCourseService {
scCourse.setCourseIntro(reqAddScCourse.getCourseIntro());
scCourse.setCreateUser(loginUser.getUserId());
scCourse.setLastUpdateUser(loginUser.getUserId());
scCourse.setTenantId(loginUser.getNowTenantId());
boolean addScCourse = scCourseService.save(scCourse);
// course_charge保存
@ -310,6 +311,9 @@ public class BusinessScCourseService {
updateCourse.setCourseIntro(reqChangeScCourse.getCourseIntro());
updateCourse.setLastUpdateUser(loginUser.getUserId());
updateCourse.setLastUpdateTime(new Date());
updateCourse.setTenantId(loginUser.getNowTenantId());
updateCourse.setSale("1");
updateCourse.setImportId(-1L);
boolean updateScCourse = scCourseService.updateById(updateCourse);
// course_charge 删除

@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -85,7 +86,7 @@ public class ScClaTimeRuleServiceImpl extends ServiceImpl<ScClaTimeRuleMapper, S
// 节假日缓存
if (null == holidayMap) {
holidayMap = holidayService.getHolidayMap();
holidayMap = new HashMap<>();
}
@ -239,18 +240,6 @@ public class ScClaTimeRuleServiceImpl extends ServiceImpl<ScClaTimeRuleMapper, S
return resultClaTimeList;
}
@Override
public List<RespClaTimeRule> getClaTimeListByRule(ScClaTimeRule claTimeRule, Map<String, String> holidayMap) {
RespClaTimeRule respClaTime = RespClaTimeRule.builder()
.claTimeBegin(claTimeRule.getStartTime())
.claTimeEnd(claTimeRule.getEndTime())
.build();
BeanUtils.copyProperties(claTimeRule, respClaTime);
return this.getClaTimeListByRule(respClaTime, holidayMap);
}
@Override
public List<String> checkDayRepeat(Long claId, String[] day, Long notEqRuleId) {
if (null == claId || null == day || day.length == 0) {
@ -269,6 +258,18 @@ public class ScClaTimeRuleServiceImpl extends ServiceImpl<ScClaTimeRuleMapper, S
return list.stream().map(ScClaTime::getClaDate).collect(Collectors.toList());
}
@Override
public List<RespClaTimeRule> getClaTimeListByRule(ScClaTimeRule claTimeRule, Map<String, String> holidayMap) {
RespClaTimeRule respClaTime = RespClaTimeRule.builder()
.claTimeBegin(claTimeRule.getStartTime())
.claTimeEnd(claTimeRule.getEndTime())
.build();
BeanUtils.copyProperties(claTimeRule, respClaTime);
return this.getClaTimeListByRule(respClaTime, holidayMap);
}
@Override
public List<String> checkDayRepeat(ScClaTimeRule claTimeRule) {
Long claId = claTimeRule.getClaId();

@ -24,14 +24,12 @@ import java.util.List;
@Service
public class ScCourseServiceImpl extends ServiceImpl<ScCourseMapper, ScCourse> implements IScCourseService {
@Autowired
private ScCourseMapper courseMapper;
@Autowired
private ScCourseChargeMapper courseChargeMapper;
@Override
public RespPage<RespSearchCourse> searchCourse(ReqSearchScCourse reqSearchScCourse) {
RespPage respPage = new RespPage(reqSearchScCourse.getPageNum(),reqSearchScCourse.getPageSize());
RespPage<RespSearchCourse> respPage = new RespPage<>(reqSearchScCourse.getPageNum(),reqSearchScCourse.getPageSize());
List<RespSearchCourse> courseList = baseMapper.selectCourseList(reqSearchScCourse, respPage);
respPage.setRows(courseList);
return respPage;

@ -5,6 +5,9 @@ import cn.xluobo.business.sys.staff.domain.req.ReqBusinessAddStaff;
import cn.xluobo.business.sys.staff.domain.req.ReqSearchStaff;
import cn.xluobo.business.sys.staff.service.BusinessSysStaffService;
import cn.xluobo.core.api.APIResponse;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -24,6 +27,9 @@ public class SysStaffController {
@Autowired
private BusinessSysStaffService sysStaffService;
@Autowired
private ISysUserService userService;
/**
*
*
@ -41,8 +47,11 @@ public class SysStaffController {
* @return
*/
@GetMapping("/list/teacherSelect")
public APIResponse teacherSelect(ReqSelect reqSelect) {
return sysStaffService.teacherSelect(reqSelect);
public AjaxResult teacherSelect(ReqSelect reqSelect) {
SysUser sysUser = new SysUser();
sysUser.setTeacher(1);
List<SysUser> sysUsers = userService.selectUserList(sysUser);
return AjaxResult.success(sysUsers);
}
/**

Loading…
Cancel
Save