parent
1d913c9a4f
commit
13c4681610
@ -1,93 +0,0 @@
|
||||
package cn.xluobo.business.sc.course.controller;
|
||||
|
||||
import cn.xluobo.business.sc.course.domain.req.ReqSearchScCourseType;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScCourseType;
|
||||
import cn.xluobo.business.sc.course.service.BusinessScCourseTypeService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 课程类型 Controller
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-07-09 08:10:25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/sc/course/type")
|
||||
public class ScCourseTypeController {
|
||||
@Autowired
|
||||
private BusinessScCourseTypeService scCourseTypeService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param reqSearchScCourseType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/searchList")
|
||||
public APIResponse searchList(ReqSearchScCourseType reqSearchScCourseType) {
|
||||
return scCourseTypeService.searchList(reqSearchScCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* select
|
||||
*
|
||||
* @param reqSearchScCourseType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/select")
|
||||
public APIResponse select(ReqSearchScCourseType reqSearchScCourseType) {
|
||||
return scCourseTypeService.select(reqSearchScCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param courseTypeId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info/detailById/{courseTypeId}")
|
||||
public APIResponse detailById(@PathVariable("courseTypeId") Long courseTypeId) {
|
||||
return scCourseTypeService.detailById(courseTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param scCourseType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add/addScCourseType")
|
||||
public APIResponse addScCourseType(@RequestBody ScCourseType scCourseType) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
scCourseType.setTenantId(loginUser.getNowTenantId());
|
||||
return scCourseTypeService.addScCourseType(scCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param scCourseType
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update/updateScCourseType")
|
||||
public APIResponse updateScCourseType(@RequestBody ScCourseType scCourseType) {
|
||||
return scCourseTypeService.updateScCourseType(scCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param courseTypeIds
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete/deleteById/{courseTypeIds}")
|
||||
public APIResponse deleteById(@PathVariable("courseTypeIds") Long[] courseTypeIds) {
|
||||
return scCourseTypeService.deleteById(courseTypeIds);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package cn.xluobo.business.sc.course.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class ReqAddMemberChargeItem{
|
||||
private Long courseTypeId;//课程类型
|
||||
private BigDecimal cnt;//扣课时次数
|
||||
private BigDecimal totalFee;//扣费金额
|
||||
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.xluobo.business.sc.course.repo.mapper;
|
||||
|
||||
import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 课程收费模式 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-07-08
|
||||
*/
|
||||
public interface ScCourseChargeMapper extends BaseMapper<ScCourseCharge> {
|
||||
|
||||
}
|
||||
@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xluobo.business.sc.course.repo.mapper.ScCourseMapper">
|
||||
|
||||
<select id="selectCourseList" resultType="cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse">
|
||||
select a.course_id,a.course_name,
|
||||
a.course_type_id,
|
||||
b.course_type as course_type_name,a.teaching_mode,
|
||||
(select count(1) from sc_course_cla cc where a.course_id=cc.course_id) as cla_count,
|
||||
(select group_concat(distinct charge.charge_type) from sc_course_charge charge where a.course_id=charge.course_id) as charge_names,
|
||||
(select group_concat(distinct charge.depart_id) from sc_course_charge charge where a.course_id=charge.course_id) as campus_ids,
|
||||
a.create_time,
|
||||
a.sale,
|
||||
a.course_intro,
|
||||
a.cla_fee
|
||||
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' and a.tenant_id=#{reqSearchScCourse.tenantId}
|
||||
<if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''">
|
||||
and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%')
|
||||
</if>
|
||||
<if test="reqSearchScCourse.sale != null and reqSearchScCourse.sale != ''">
|
||||
and a.sale = #{reqSearchScCourse.sale}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.courseTypeId != null and reqSearchScCourse.courseTypeId != ''">
|
||||
and a.course_type_id = #{reqSearchScCourse.courseTypeId}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.teachingMode != null and reqSearchScCourse.teachingMode != ''">
|
||||
and a.teaching_mode = #{reqSearchScCourse.teachingMode}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.departId != null">
|
||||
and exists(select 1 from sc_course_charge c where a.course_id=c.course_id and (c.depart_id=#{reqSearchScCourse.departId} or c.depart_id=-1))
|
||||
</if>
|
||||
<if test="reqSearchScCourse.chargeType != null and reqSearchScCourse.chargeType != ''">
|
||||
and exists(select 1 from sc_course_charge c where a.course_id=c.course_id and c.charge_type=#{reqSearchScCourse.chargeType} )
|
||||
</if>
|
||||
order by a.sale desc,a.create_time desc
|
||||
</select>
|
||||
<select id="selectCourseListWithStudentCourse" resultType="cn.xluobo.business.sc.course.domain.resp.course.RespSearchCourse">
|
||||
select a.course_id,a.course_name,b.course_type as course_type_name,a.teaching_mode,
|
||||
(select count(1) from sc_course_cla cc where a.course_id=cc.course_id) as cla_count,
|
||||
(select group_concat(distinct charge.charge_type) from sc_course_charge charge where a.course_id=charge.course_id) as charge_names,
|
||||
(select group_concat(distinct charge.depart_id) from sc_course_charge charge where a.course_id=charge.course_id) as campus_ids,
|
||||
a.create_time,
|
||||
a.sale,
|
||||
a.course_intro,
|
||||
c.student_course_id
|
||||
from sc_course a
|
||||
left join sc_course_type b on a.course_type_id = b.course_type_id and b.in_use='1'
|
||||
left join sc_student_course c on a.course_id=c.course_id and c.student_id = #{reqSearchScCourse.studentId}
|
||||
where a.delete_flag='0' and a.tenant_id=#{tenantId}
|
||||
<if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''">
|
||||
and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%')
|
||||
</if>
|
||||
<if test="reqSearchScCourse.sale != null and reqSearchScCourse.sale != ''">
|
||||
and a.sale = #{reqSearchScCourse.sale}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.courseTypeId != null and reqSearchScCourse.courseTypeId != ''">
|
||||
and a.course_type_id = #{reqSearchScCourse.courseTypeId}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.teachingMode != null and reqSearchScCourse.teachingMode != ''">
|
||||
and a.teaching_mode = #{reqSearchScCourse.teachingMode}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.departId != null">
|
||||
and exists(select 1 from sc_course_charge c where a.course_id=c.course_id and (c.depart_id=#{reqSearchScCourse.departId} or c.depart_id=-1))
|
||||
</if>
|
||||
<if test="reqSearchScCourse.chargeType != null and reqSearchScCourse.chargeType != ''">
|
||||
and exists(select 1 from sc_course_charge c where a.course_id=c.course_id and c.charge_type=#{reqSearchScCourse.chargeType} )
|
||||
</if>
|
||||
order by a.sale desc,a.create_time desc
|
||||
</select>
|
||||
<select id="selectCourseForExport" resultType="cn.xluobo.business.sc.course.domain.export.ExpCourse">
|
||||
select a.course_id,
|
||||
b.charge_id,
|
||||
a.course_name,
|
||||
(select t.course_type from sc_course_type t where t.course_type_id=a.course_type_id) course_type_name,
|
||||
fcn_dict_name(a.teaching_mode,'teaching_mode') as teaching_mode,
|
||||
a.create_time,
|
||||
fcn_dict_name(a.sale,'sale') as sale,
|
||||
a.course_intro,
|
||||
case b.depart_id when -1 then '全部校区' else (select t.dept_name from sys_dept t where t.dept_id=b.depart_id) end depart_name,
|
||||
b.charge_type,fcn_dict_name(b.charge_type,'charge_type') as charge_type_name,
|
||||
b.date_unit,
|
||||
fcn_dict_name(b.date_unit,'date_unit') as date_unit_name,
|
||||
b.count,b.total_fee
|
||||
from sc_course a,sc_course_charge b
|
||||
where a.course_id=b.course_id and a.delete_flag='0'
|
||||
<if test="reqSearchScCourse.courseName != null and reqSearchScCourse.courseName != ''">
|
||||
and a.course_name like concat('%',#{reqSearchScCourse.courseName} ,'%')
|
||||
</if>
|
||||
<if test="reqSearchScCourse.sale != null and reqSearchScCourse.sale != ''">
|
||||
and a.sale = #{reqSearchScCourse.sale}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.courseTypeId != null and reqSearchScCourse.courseTypeId != ''">
|
||||
and a.course_type_id = #{reqSearchScCourse.courseTypeId}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.teachingMode != null and reqSearchScCourse.teachingMode != ''">
|
||||
and a.teaching_mode = #{reqSearchScCourse.teachingMode}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.departId != null">
|
||||
and b.depart_id=#{reqSearchScCourse.departId}
|
||||
</if>
|
||||
<if test="reqSearchScCourse.chargeType != null and reqSearchScCourse.chargeType != ''">
|
||||
and b.charge_type=#{reqSearchScCourse.chargeType}
|
||||
</if>
|
||||
order by a.sale desc,a.create_time desc limit 2000
|
||||
</select>
|
||||
<select id="selectCourseCount" resultType="java.lang.Integer">
|
||||
select count(1) from sc_course a
|
||||
where 1=1
|
||||
<if test="deptId != null">
|
||||
and exists(select 1 from sc_course_charge b where a.course_id=b.course_id and (b.depart_id=#{deptId} or b.depart_id=-1))
|
||||
</if>
|
||||
<if test="deptId == null and userId != null and userId != ''">
|
||||
and (
|
||||
exists(select 1 from sc_course_charge b,sys_user_dept ud
|
||||
where ud.user_id=#{userId}
|
||||
and (ud.dept_id=b.depart_id or ud.dept_id=-1)
|
||||
and a.course_id=b.course_id)
|
||||
or exists(select 1 from sc_course_charge b where a.course_id=b.course_id and b.depart_id=-1)
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectTenantCourseCount" resultType="java.lang.Integer">
|
||||
select count(1) from sc_course where tenant_id=#{tenantId}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,56 +0,0 @@
|
||||
package cn.xluobo.business.sc.course.service.impl;
|
||||
|
||||
import cn.xluobo.business.sc.course.repo.enums.ClaTimeStatusEnums;
|
||||
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.ScCourseCla;
|
||||
import cn.xluobo.business.sc.course.service.IScClaTimeService;
|
||||
import cn.xluobo.business.sc.course.service.IScCourseClaService;
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
|
||||
import cn.xluobo.business.sc.student.service.IScStudentCourseService;
|
||||
import cn.xluobo.core.api.APIBaseResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 课程班级信息 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-03-17 01:11:06
|
||||
*/
|
||||
@Service
|
||||
public class ScCourseClaServiceImpl extends ServiceImpl<ScCourseClaMapper, ScCourseCla> implements IScCourseClaService {
|
||||
|
||||
@Autowired
|
||||
private IScStudentCourseService studentCourseService;
|
||||
@Autowired
|
||||
private IScClaTimeService claTimeService;
|
||||
|
||||
@Override
|
||||
public Integer selectStudentCnt(Long claId) {
|
||||
return baseMapper.selectStudentCnt(claId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public APIBaseResponse canChangeCourse(Long claId) {
|
||||
QueryWrapper<ScStudentCourse> qw = new QueryWrapper<>();
|
||||
qw.eq("cla_id", claId);
|
||||
int count = studentCourseService.count(qw);
|
||||
if (count != 0) {
|
||||
return APIBaseResponse.fail("当前班级有报读学员,无法变更所属课程.");
|
||||
}
|
||||
|
||||
QueryWrapper<ScClaTime> qwClaTime = new QueryWrapper<>();
|
||||
qwClaTime.eq("cla_id", claId);
|
||||
qwClaTime.eq("status", ClaTimeStatusEnums.HAD_CLASS.getStatus());
|
||||
int hadClaTimeCount = claTimeService.count(qwClaTime);
|
||||
if (hadClaTimeCount != 0) {
|
||||
return APIBaseResponse.fail("当前班级已有上课记录,无法变更所属课程.");
|
||||
}
|
||||
return APIBaseResponse.success();
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package cn.xluobo.business.sc.order.repo.mapper;
|
||||
|
||||
import cn.xluobo.business.sc.order.domain.req.ReqSearchScOrder;
|
||||
import cn.xluobo.business.sc.order.domain.resp.RespOrder;
|
||||
import cn.xluobo.business.sc.order.repo.model.ScOrder;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 订单 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-08-24 10:22:19
|
||||
*/
|
||||
public interface ScOrderMapper extends com.baomidou.mybatisplus.core.mapper.BaseMapper<ScOrder> {
|
||||
|
||||
List<RespOrder> selectFroSearchTable(@Param("reqSearchScOrder")ReqSearchScOrder reqSearchScOrder, @Param("page")Page page);
|
||||
|
||||
/**
|
||||
* 获取欠费学员数量
|
||||
* @return
|
||||
*/
|
||||
Integer selectArrearsStudentCount(@Param("tenantId") String tenantId);
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xluobo.business.sc.order.repo.mapper.ScOrderMapper">
|
||||
|
||||
<select id="selectFroSearchTable" resultType="cn.xluobo.business.sc.order.domain.resp.RespOrder">
|
||||
select
|
||||
a.order_id,a.order_type,a.actual_total_fee,a.receipt_fee,a.balance_fee,
|
||||
(select s.nick_name from sys_user s where s.user_id=a.sale_staff_id) sale_staff_name,
|
||||
a.order_tag,a.handle_dept_name,a.handle_date,
|
||||
(select u.nick_name from sys_user u where user_id=a.create_user) as create_user_name,
|
||||
a.memo,
|
||||
b.student_name,b.phone,
|
||||
(select group_concat(od.course_name,'(',d.dept_name,')',',',od.charge_name,' 数量:',od.buy_count separator ';') from sc_order_detail od left join sys_dept d on od.dept_id=d.dept_id where a.order_id=od.order_id) as order_detail,
|
||||
a.order_status
|
||||
from sc_order a
|
||||
left join sc_student b on a.student_id=b.student_id
|
||||
where 1=1
|
||||
<if test="reqSearchScOrder.studentId != null">
|
||||
and a.student_id = #{reqSearchScOrder.studentId}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.handleDateBegin != null and reqSearchScOrder.handleDateBegin != ''">
|
||||
and a.handle_date between #{reqSearchScOrder.handleDateBegin} and #{reqSearchScOrder.handleDateEnd}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.arrears">
|
||||
and actual_total_fee <![CDATA[ > ]]> balance_fee + receipt_fee
|
||||
</if>
|
||||
<if test="reqSearchScOrder.arrears != null and reqSearchScOrder.arrears == true">
|
||||
and actual_total_fee <![CDATA[ > ]]> balance_fee + receipt_fee
|
||||
</if>
|
||||
<if test="reqSearchScOrder.arrears != null and reqSearchScOrder.arrears == false">
|
||||
and actual_total_fee <![CDATA[ = ]]> balance_fee + receipt_fee
|
||||
</if>
|
||||
<if test="reqSearchScOrder.deptId != null">
|
||||
and exists(select 1 from sc_order_detail d where a.order_id=d.order_id and d.dept_id=#{reqSearchScOrder.deptId} )
|
||||
</if>
|
||||
<if test="reqSearchScOrder.courseId != null">
|
||||
and exists(select 1 from sc_order_detail d where a.order_id=d.order_id and d.course_id=#{reqSearchScOrder.courseId} )
|
||||
</if>
|
||||
<if test="reqSearchScOrder.saleStaffId != null">
|
||||
and a.sale_staff_id = #{reqSearchScOrder.saleStaffId}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.orderType != null and reqSearchScOrder.orderType != ''">
|
||||
and a.order_type = #{reqSearchScOrder.orderType}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.orderStatus != null and reqSearchScOrder.orderStatus != ''">
|
||||
and a.order_status = #{reqSearchScOrder.orderStatus}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.createUser != null">
|
||||
and a.create_user = #{reqSearchScOrder.createUser}
|
||||
</if>
|
||||
<if test="reqSearchScOrder.saleSourceTag != null and reqSearchScOrder.saleSourceTag != ''">
|
||||
and a.sale_source_tag = #{reqSearchScOrder.saleSourceTag}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
<select id="selectArrearsStudentCount" resultType="java.lang.Integer">
|
||||
select count(distinct o.student_id) from sc_order o
|
||||
where o.order_status='2'
|
||||
and o.tenant_id=#{tenantId}
|
||||
and o.receipt_fee+o.balance_fee <![CDATA[ < ]]> o.actual_total_fee
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,16 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.repo.mapper;
|
||||
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentContact;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 联系人 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-09-27
|
||||
*/
|
||||
public interface ScStudentContactMapper extends BaseMapper<ScStudentContact> {
|
||||
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xluobo.business.sc.student.repo.mapper.ScStudentAccountLogMapper">
|
||||
|
||||
</mapper>
|
||||
@ -1,196 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xluobo.business.sc.student.repo.mapper.ScStudentCourseMapper">
|
||||
|
||||
<select id="selectStudentCourseNameList" resultType="java.lang.String">
|
||||
select distinct b.course_name
|
||||
from sc_student_course a
|
||||
left join sc_course b on a.course_id=b.course_id
|
||||
where a.student_id = #{studentId} and a.status = '1'
|
||||
</select>
|
||||
<select id="selectStudentDeptNameList" resultType="java.lang.String">
|
||||
select distinct c.dept_name
|
||||
from sc_student_course a
|
||||
left join sc_course_cla b on a.cla_id=b.cla_id
|
||||
left join sys_dept c on b.depart_id=c.dept_id
|
||||
where a.student_id = #{studentId} and a.status = '1' and a.cla_id is not null
|
||||
</select>
|
||||
<select id="selectStudentList" resultType="cn.xluobo.business.sc.student.domain.resp.RespCourseClaStudent">
|
||||
select a.student_course_id,a.cla_id,a.course_id,
|
||||
d.dept_name,
|
||||
a.charge_type,a.total_day,a.total_hour,
|
||||
a.balance_hour,
|
||||
case a.charge_type when 'date' then null else (select ifnull(sum(co.balance_hour),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> co.expire_date) end as expire_hour,
|
||||
case a.charge_type when 'date' then (select ifnull(sum(co.total_day),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> co.begin_date) end as coming_effect_day,
|
||||
case a.charge_type when 'date' then (select co.end_date from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') between co.begin_date and co.end_date limit 1) end as end_date,
|
||||
a.status,
|
||||
a.create_time as first_sign_time,
|
||||
(select co.create_time from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 order by co.create_time desc limit 1) as last_sign_time,
|
||||
b.student_id,b.student_name,b.sex,b.phone,
|
||||
(select group_concat(sc.contact_nick,'(',fcn_dict_name(sc.contact_relation,'contact_relation'),') ',sc.contact_phone separator ';') from sc_student_contact sc where sc.student_id=b.student_id) as contact_info
|
||||
from sc_student_course a left join sys_dept d on a.dept_id=d.dept_id
|
||||
,sc_student b
|
||||
where a.student_id=b.student_id
|
||||
<if test="reqSearchStudentCourseCla.claId != null">
|
||||
and a.cla_id=#{reqSearchStudentCourseCla.claId}
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.departId != null">
|
||||
and a.dept_id=#{reqSearchStudentCourseCla.departId}
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.deptId == null and reqSearchStudentCourseCla.userId != null and reqSearchStudentCourseCla.userId != ''">
|
||||
and exists(select 1 from sys_user_dept ud
|
||||
where ud.user_id=#{reqSearchStudentCourseCla.userId}
|
||||
and (ud.dept_id=a.dept_id or ud.dept_id=-1))
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.courseId != null">
|
||||
and a.course_id=#{reqSearchStudentCourseCla.courseId}
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.unChooseCla != null and reqSearchStudentCourseCla.unChooseCla == true">
|
||||
and a.cla_id is null
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.unChooseCla != null and reqSearchStudentCourseCla.unChooseCla == false">
|
||||
and a.cla_id is not null
|
||||
</if>
|
||||
<if test="reqSearchStudentCourseCla.effect != null and reqSearchStudentCourseCla.effect == true">
|
||||
and a.status='1'
|
||||
and (charge_type in ('hour','cycle')
|
||||
or (charge_type='date' and exists(
|
||||
select 1 from sc_student_course_order sco
|
||||
where a.student_course_id=sco.student_course_id
|
||||
and sco.valid=1
|
||||
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date)))
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
<select id="selectClaNeedAttendCnt" resultType="int">
|
||||
select count(1) from sc_student_course sc
|
||||
where sc.cla_id=#{claId}
|
||||
and sc.status='1'
|
||||
and (charge_type in ('hour','cycle')
|
||||
or (charge_type='date' and exists(
|
||||
select 1 from sc_student_course_order sco
|
||||
where sc.student_course_id=sco.student_course_id
|
||||
and sco.valid=1
|
||||
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date)))
|
||||
</select>
|
||||
<select id="selectStudentCourseList" resultType="cn.xluobo.business.sc.student.domain.resp.RespStudentCourse">
|
||||
select a.student_course_id,a.course_name,a.charge_type,a.total_day,a.total_hour,
|
||||
a.balance_hour,
|
||||
case a.charge_type when 'date' then null else (select ifnull(sum(co.balance_hour),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> co.expire_date) end as expire_hour,
|
||||
a.total_fee,a.status,
|
||||
b.student_id,b.student_name,c.dept_name,d.cla_name,
|
||||
(select case a.charge_type
|
||||
when 'date' then group_concat(sco.total_day, ',', sco.begin_date, '~', sco.end_date separator ';')
|
||||
else group_concat(sco.total_hour, ',', date_format(sco.create_time, '%Y%m%d') separator ';')
|
||||
end
|
||||
from sc_student_course_order sco
|
||||
where a.student_course_id = sco.student_course_id and sco.valid=1) as order_detail,
|
||||
case a.charge_type when 'date' then (select ifnull(sum(co.total_day),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> co.begin_date) end as coming_effect_day,
|
||||
case a.charge_type when 'date' then (select co.end_date from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') between co.begin_date and co.end_date limit 1) end as end_date
|
||||
from sc_student_course a
|
||||
left join sc_student b on a.student_id=b.student_id
|
||||
left join sys_dept c on a.dept_id=c.dept_id
|
||||
left join sc_course_cla d on a.cla_id=d.cla_id
|
||||
where 1=1
|
||||
<if test="studentId != null">
|
||||
and a.student_id=#{studentId}
|
||||
</if>
|
||||
<if test="deptId != null">
|
||||
and a.dept_id=#{deptId}
|
||||
</if>
|
||||
<if test="deptId == null and userId != null and userId != ''">
|
||||
and exists(select 1 from sys_user_dept ud
|
||||
where ud.user_id=#{userId}
|
||||
and (ud.dept_id=a.dept_id or ud.dept_id=-1))
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
<delete id="deleteWhenTotalHourZeroForInvalid">
|
||||
delete from sc_student_course where student_course_id=#{studentCourseId} and charge_type <![CDATA[ <> ]]> 'date' and total_hour=0 and total_fee=0
|
||||
</delete>
|
||||
<delete id="deleteWhenTotalDayZeroForInvalid">
|
||||
delete from sc_student_course where student_course_id=#{studentCourseId} and charge_type = 'date' and total_day=0 and total_fee=0
|
||||
</delete>
|
||||
<select id="selectWillExpireDateCount" resultType="java.lang.Integer">
|
||||
select count(1) from sc_student_course sc
|
||||
where sc.charge_type='date' and sc.status='1'
|
||||
and exists(select 1 from sc_student_course_order sco
|
||||
where sc.student_course_id=sc.student_course_id
|
||||
and sco.valid=1
|
||||
and sc.tenant_id=#{tenantId}
|
||||
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date
|
||||
and (datediff(sco.end_date,now())+1+((select ifnull(sum(sco.total_day),0) from sc_student_course_order sco_will_effect
|
||||
where sco_will_effect.student_course_id=sc.student_course_id
|
||||
and sco_will_effect.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> sco_will_effect.begin_date))
|
||||
) <![CDATA[ <= ]]> #{minBalanceDay})
|
||||
</select>
|
||||
<select id="selectWillExpireHourCount" resultType="java.lang.Integer">
|
||||
select count(1) from sc_student_course sc
|
||||
where sc.charge_type <![CDATA[ <> ]]> 'date'
|
||||
and sc.status='1'
|
||||
and sc.tenant_id=#{tenantId}
|
||||
and (sc.balance_hour - (select ifnull(sum(sco.balance_hour),0)
|
||||
from sc_student_course_order sco
|
||||
where sc.student_course_id=sco.student_course_id
|
||||
and sco.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> sco.expire_date)
|
||||
) <![CDATA[ <= ]]> #{minBalanceHour}
|
||||
</select>
|
||||
<select id="selectStudentSignUpList" resultType="cn.xluobo.business.sc.student.domain.resp.RespStuCourseSignUpStudent">
|
||||
select a.student_course_id,
|
||||
a.cla_id,a.cla_name,
|
||||
a.course_id,a.course_name,
|
||||
d.dept_name,
|
||||
a.charge_type,a.total_day,a.total_hour,
|
||||
a.balance_hour,
|
||||
(select case a.charge_type
|
||||
when 'date' then group_concat(sco.total_day, ',', sco.begin_date, '~', sco.end_date separator ';')
|
||||
else group_concat(sco.total_hour, ',', date_format(sco.create_time, '%Y%m%d') separator ';')
|
||||
end
|
||||
from sc_student_course_order sco
|
||||
where a.student_course_id = sco.student_course_id and sco.valid=1) as order_detail,
|
||||
(select sum(co.total_fee) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1) as total_fee,
|
||||
(select sum(co.balance_hour * co.unit_fee) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1) as balance_fee,
|
||||
case a.charge_type when 'date' then null else (select ifnull(sum(co.balance_hour),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> co.expire_date) end as expire_hour,
|
||||
case a.charge_type when 'date' then null else (select ifnull(sum(co.balance_hour * co.unit_fee),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> co.expire_date) end as expire_fee,
|
||||
case a.charge_type when 'date' then (select ifnull(sum(co.total_day),0) from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> co.begin_date) end as coming_effect_day,
|
||||
case a.charge_type when 'date' then (select co.end_date from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 and date_format(now(),'%Y-%m-%d') between co.begin_date and co.end_date limit 1) end as end_date,
|
||||
a.status,
|
||||
a.create_time as first_sign_time,
|
||||
(select co.create_time from sc_student_course_order co where a.student_course_id=co.student_course_id and co.valid=1 order by co.create_time desc limit 1) as last_sign_time,
|
||||
b.student_id,b.student_name,b.sex,b.phone,
|
||||
(select group_concat(sc.contact_nick,'(',fcn_dict_name(sc.contact_relation,'contact_relation'),') ',sc.contact_phone separator ';') from sc_student_contact sc where sc.student_id=b.student_id) as contact_info
|
||||
from sc_student_course a
|
||||
left join sys_dept d on a.dept_id=d.dept_id
|
||||
,sc_student b
|
||||
where a.student_id=b.student_id and d.tenant_id=#{reqSearchStuCourseSignUp.tenantId}
|
||||
<if test="reqSearchStuCourseSignUp.claId != null">
|
||||
and a.cla_id=#{reqSearchStuCourseSignUp.claId}
|
||||
</if>
|
||||
<if test="reqSearchStuCourseSignUp.departId != null">
|
||||
and a.dept_id=#{reqSearchStuCourseSignUp.departId}
|
||||
</if>
|
||||
<if test="reqSearchStuCourseSignUp.courseId != null">
|
||||
and a.course_id=#{reqSearchStuCourseSignUp.courseId}
|
||||
</if>
|
||||
<if test="reqSearchStuCourseSignUp.minBalanceDay != null">
|
||||
and a.charge_type='date' and a.status='1'
|
||||
and exists(select 1 from sc_student_course_order sco
|
||||
where sco.student_course_id=a.student_course_id
|
||||
and sco.valid=1
|
||||
and date_format(now(),'%Y-%m-%d') between sco.begin_date and sco.end_date
|
||||
and (datediff(sco.end_date,now())+1+((select ifnull(sum(sco.total_day),0) from sc_student_course_order sco_will_effect
|
||||
where sco_will_effect.student_course_id=a.student_course_id
|
||||
and sco_will_effect.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ < ]]> sco_will_effect.begin_date))
|
||||
) <![CDATA[ <= ]]> #{reqSearchStuCourseSignUp.minBalanceDay})
|
||||
</if>
|
||||
<if test="reqSearchStuCourseSignUp.minBalanceHour != null">
|
||||
and a.charge_type <![CDATA[ <> ]]> 'date' and a.status='1'
|
||||
and (a.balance_hour - (select ifnull(sum(sco.balance_hour),0)
|
||||
from sc_student_course_order sco
|
||||
where a.student_course_id=sco.student_course_id
|
||||
and sco.valid=1 and date_format(now(),'%Y-%m-%d') <![CDATA[ > ]]> sco.expire_date)
|
||||
) <![CDATA[ <= ]]> #{reqSearchStuCourseSignUp.minBalanceHour}
|
||||
</if>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.xluobo.business.sc.student.repo.mapper.ScStudentCourseOrderMapper">
|
||||
|
||||
<select id="checkDateCover" resultType="int">
|
||||
select count(1) from sc_student_course a,sc_student_course_order b
|
||||
where a.student_course_id=b.student_course_id
|
||||
and a.student_id=#{studentId}
|
||||
and a.course_id=#{courseId}
|
||||
and b.valid=1
|
||||
and exists(select 1 from sc_order_detail c where b.order_detail_id=c.order_detail_id and c.charge_type='date')
|
||||
and (#{beginDate} between b.begin_date and b.end_date or #{endDate} between b.begin_date and b.end_date)
|
||||
</select>
|
||||
<select id="selectSubtractHourOrder" resultType="cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder">
|
||||
select * from sc_student_course_order a
|
||||
where a.student_course_id=#{studentCourseId}
|
||||
and ((a.expire_date is not null and date_format(now(),'%Y-%m-%d') <![CDATA[ <= ]]> a.expire_date)
|
||||
or (a.expire_date is null))
|
||||
and a.valid=1
|
||||
and exists(select 1 from sc_order_detail b where a.order_detail_id=b.order_detail_id and b.charge_type <![CDATA[ <> ]]> 'date')
|
||||
order by create_time limit 1
|
||||
</select>
|
||||
<select id="selectNowValidDateOrder" resultType="cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder">
|
||||
select * from sc_student_course_order a
|
||||
where a.student_course_id=#{studentCourseId}
|
||||
and a.total_day <![CDATA[ > ]]> 0
|
||||
and date_format(now(),'%Y-%m-%d') between a.begin_date and a.end_date
|
||||
and a.valid=1
|
||||
and exists(select 1 from sc_order_detail b where a.order_detail_id=b.order_detail_id and b.charge_type = 'date')
|
||||
order by create_time limit 1
|
||||
</select>
|
||||
<select id="selectSubtractHourOrderList" resultType="cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder">
|
||||
select * from sc_student_course_order a
|
||||
where a.student_course_id=#{studentCourseId}
|
||||
and a.balance_hour <![CDATA[ > ]]> 0
|
||||
and ((a.expire_date is not null and date_format(now(),'%Y-%m-%d') <![CDATA[ <= ]]> a.expire_date)
|
||||
or (a.expire_date is null))
|
||||
and a.valid=1
|
||||
and exists(select 1 from sc_order_detail b where a.order_detail_id=b.order_detail_id and b.charge_type <![CDATA[ <> ]]> 'date')
|
||||
order by create_time
|
||||
</select>
|
||||
<select id="selectRecoverHourOrderList" resultType="cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder">
|
||||
select * from sc_student_course_order a
|
||||
where a.student_course_id=#{studentCourseId}
|
||||
and a.valid=1
|
||||
and exists(select 1 from sc_order_detail b where a.order_detail_id=b.order_detail_id and b.charge_type <![CDATA[ <> ]]> 'date')
|
||||
order by create_time desc
|
||||
</select>
|
||||
<update id="updateSubtractHour">
|
||||
update sc_student_course_order set balance_hour = #{newHour} where course_order_id=#{courseOrderId} and balance_hour = #{oldHour}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -1,71 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.repo.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 联系人
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-09-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sc_student_contact")
|
||||
public class ScStudentContact implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 联系人编号
|
||||
*/
|
||||
@TableId(value = "contact_id", type = IdType.ASSIGN_ID)
|
||||
private Long contactId;
|
||||
|
||||
/**
|
||||
* 学生
|
||||
*/
|
||||
@TableField("student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 联系人称呼
|
||||
*/
|
||||
@TableField("contact_nick")
|
||||
private String contactNick;
|
||||
|
||||
/**
|
||||
* 与学生关系
|
||||
*/
|
||||
@TableField("contact_relation")
|
||||
private String contactRelation;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@TableField("contact_phone")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@TableField("create_user")
|
||||
private Long createUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
}
|
||||
@ -1,134 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.repo.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 学生课程
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-08-21
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sc_student_course")
|
||||
public class ScStudentCourse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "student_course_id", type = IdType.ASSIGN_ID)
|
||||
private Long studentCourseId;
|
||||
|
||||
/**
|
||||
* 学生
|
||||
*/
|
||||
@TableField("student_id")
|
||||
private Long studentId;
|
||||
|
||||
/**
|
||||
* 课程
|
||||
*/
|
||||
@TableField("course_id")
|
||||
private Long courseId;
|
||||
|
||||
/**
|
||||
* 课程
|
||||
*/
|
||||
@TableField("course_name")
|
||||
private String courseName;
|
||||
|
||||
/**
|
||||
* 报读校区
|
||||
*/
|
||||
@TableField("dept_id")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 班级
|
||||
*/
|
||||
@TableField("cla_id")
|
||||
private Long claId;
|
||||
|
||||
/**
|
||||
* 班级
|
||||
*/
|
||||
@TableField("cla_name")
|
||||
private String claName;
|
||||
|
||||
/**
|
||||
* 收费模式 hour:课时 date:时间 cycle:期
|
||||
*/
|
||||
@TableField("charge_type")
|
||||
private String chargeType;
|
||||
|
||||
/**
|
||||
* 总天数
|
||||
*/
|
||||
@TableField("total_day")
|
||||
private BigDecimal totalDay;
|
||||
|
||||
/**
|
||||
* 总课时
|
||||
*/
|
||||
@TableField("total_hour")
|
||||
private BigDecimal totalHour;
|
||||
|
||||
/**
|
||||
* 剩余课时
|
||||
*/
|
||||
@TableField("balance_hour")
|
||||
private BigDecimal balanceHour;
|
||||
|
||||
/**
|
||||
* 总学费
|
||||
*/
|
||||
@TableField("total_fee")
|
||||
private BigDecimal totalFee;
|
||||
|
||||
/**
|
||||
* 状态 1在读 2停课
|
||||
*/
|
||||
@TableField("status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@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;
|
||||
|
||||
private String tenantId;
|
||||
}
|
||||
@ -1,133 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.repo.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 学生课程关联订单
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-08-21
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sc_student_course_order")
|
||||
public class ScStudentCourseOrder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "course_order_id", type = IdType.ASSIGN_ID)
|
||||
private Long courseOrderId;
|
||||
|
||||
@TableField("student_course_id")
|
||||
private Long studentCourseId;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@TableField("order_id")
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 购买课程订单
|
||||
*/
|
||||
@TableField("order_detail_id")
|
||||
private Long orderDetailId;
|
||||
|
||||
/**
|
||||
* 购买课时数量
|
||||
*/
|
||||
@TableField("total_hour")
|
||||
private BigDecimal totalHour;
|
||||
|
||||
/**
|
||||
* 剩余课时数量
|
||||
*/
|
||||
@TableField("balance_hour")
|
||||
private BigDecimal balanceHour;
|
||||
|
||||
/**
|
||||
* 购买天数
|
||||
*/
|
||||
@TableField("total_day")
|
||||
private BigDecimal totalDay;
|
||||
|
||||
/**
|
||||
* 开始时间 按时间收费
|
||||
*/
|
||||
@TableField("begin_date")
|
||||
private String beginDate;
|
||||
|
||||
/**
|
||||
* 结束时间 按时间收费
|
||||
*/
|
||||
@TableField("end_date")
|
||||
private String endDate;
|
||||
|
||||
/**
|
||||
* 失效时间
|
||||
*/
|
||||
@TableField("expire_date")
|
||||
private String expireDate;
|
||||
|
||||
/**
|
||||
* 总金额
|
||||
*/
|
||||
@TableField("total_fee")
|
||||
private BigDecimal totalFee;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
@TableField("unit_fee")
|
||||
private BigDecimal unitFee;
|
||||
|
||||
/**
|
||||
* 是否有效 1有效 0失效
|
||||
*/
|
||||
@TableField("valid")
|
||||
private Boolean valid;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@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;
|
||||
|
||||
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.service;
|
||||
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentContact;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 联系人 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-09-27
|
||||
*/
|
||||
public interface IScStudentContactService extends IService<ScStudentContact> {
|
||||
|
||||
/**
|
||||
* 获取学生练习方式
|
||||
* @param studentId
|
||||
* @return
|
||||
*/
|
||||
List<ScStudentContact> getStudentContactList(Long studentId);
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.service;
|
||||
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentCourseOrder;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 学生课程关联订单 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-08-21
|
||||
*/
|
||||
public interface IScStudentCourseOrderService extends IService<ScStudentCourseOrder> {
|
||||
|
||||
/**
|
||||
* 校验按时间收费 收费日期是否存在覆盖
|
||||
*
|
||||
* @param studentId
|
||||
* @param courseId
|
||||
* @param beginDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
boolean checkDateCover(Long studentId, Long courseId,
|
||||
String beginDate, String endDate);
|
||||
|
||||
/**
|
||||
* 获取应扣课时订单信息
|
||||
* @param studentCourseId
|
||||
* @return
|
||||
*/
|
||||
ScStudentCourseOrder getSubtractHourOrder(Long studentCourseId);
|
||||
|
||||
/**
|
||||
* 当前生效 按时间 缴费订单
|
||||
* @param studentCourseId
|
||||
* @return
|
||||
*/
|
||||
ScStudentCourseOrder getNowValidDateOrder(Long studentCourseId);
|
||||
|
||||
|
||||
/**
|
||||
* 课程订单扣减课时
|
||||
* @param studentCourseId
|
||||
* @param loseHour
|
||||
* @return 扣减总课时费用
|
||||
*/
|
||||
BigDecimal subtractCourseOrderBalanceHour(Long studentCourseId, BigDecimal loseHour);
|
||||
|
||||
/**
|
||||
* 课程订单 恢复课时
|
||||
* 当删除上课记录时调用
|
||||
* @param studentCourseId
|
||||
* @param recoverHour 恢复课时数量
|
||||
* @return
|
||||
*/
|
||||
void recoverOrderLoseHour(Long studentCourseId, BigDecimal recoverHour);
|
||||
|
||||
/**
|
||||
* 更新订单 剩余课时
|
||||
* @param courseOrderId
|
||||
* @param newBalanceHour
|
||||
* @param oldBalanceHour
|
||||
*/
|
||||
void updateBalanceHour(Long courseOrderId, BigDecimal newBalanceHour, BigDecimal oldBalanceHour);
|
||||
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.service.impl;
|
||||
|
||||
import cn.xluobo.business.sc.student.repo.mapper.ScStudentContactMapper;
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentContact;
|
||||
import cn.xluobo.business.sc.student.service.IScStudentContactService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 联系人 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-09-27
|
||||
*/
|
||||
@Service
|
||||
public class ScStudentContactServiceImpl extends ServiceImpl<ScStudentContactMapper, ScStudentContact> implements IScStudentContactService {
|
||||
|
||||
@Override
|
||||
public List<ScStudentContact> getStudentContactList(Long studentId) {
|
||||
QueryWrapper<ScStudentContact> qw = new QueryWrapper<>();
|
||||
qw.eq("student_id", studentId);
|
||||
qw.orderByAsc("create_time");
|
||||
List<ScStudentContact> contacts = this.list(qw);
|
||||
return contacts;
|
||||
}
|
||||
}
|
||||
@ -1,209 +0,0 @@
|
||||
package cn.xluobo.business.sc.student.service.impl;
|
||||
|
||||
import cn.xluobo.business.sc.course.enums.CourseChargeTypeEnum;
|
||||
import cn.xluobo.business.sc.course.repo.mapper.ScCourseChargeMapper;
|
||||
import cn.xluobo.business.sc.course.repo.mapper.ScCourseMapper;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScClaTime;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScCourse;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScCourseCharge;
|
||||
import cn.xluobo.business.sc.log.enums.LogTypeEnum;
|
||||
import cn.xluobo.business.sc.log.repo.model.ScStudentCourseLog;
|
||||
import cn.xluobo.business.sc.log.service.IScStudentCourseLogService;
|
||||
import cn.xluobo.business.sc.student.repo.mapper.ScStudentCourseMapper;
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudentCourse;
|
||||
import cn.xluobo.business.sc.student.service.IScStudentCourseOrderService;
|
||||
import cn.xluobo.business.sc.student.service.IScStudentCourseService;
|
||||
import cn.xluobo.business.sys.admin.repo.mapper.ISysDeptMapper;
|
||||
import cn.xluobo.config.exception.BusinessException;
|
||||
import cn.xluobo.core.api.APIBaseResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 学生课程 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-08-21
|
||||
*/
|
||||
@Service
|
||||
public class ScStudentCourseServiceImpl extends ServiceImpl<ScStudentCourseMapper, ScStudentCourse> implements IScStudentCourseService {
|
||||
|
||||
@Autowired
|
||||
private ScCourseChargeMapper courseChargeMapper;
|
||||
@Autowired
|
||||
private ScCourseMapper courseMapper;
|
||||
@Autowired
|
||||
private ISysDeptMapper deptMapper;
|
||||
@Autowired
|
||||
private IScStudentCourseOrderService courseOrderService;
|
||||
@Autowired
|
||||
private IScStudentCourseLogService scStudentCourseLogService;
|
||||
|
||||
@Override
|
||||
public APIBaseResponse checkStudentCanSignUpCourse(Long studentId, Long[] courseIds, Long deptId) {
|
||||
// 学生已报名课程收费模式
|
||||
QueryWrapper<ScStudentCourse> qw = new QueryWrapper<>();
|
||||
qw.select("course_id", "charge_type");
|
||||
qw.eq("student_id", studentId);
|
||||
List<ScStudentCourse> studentCourseList = this.list(qw);
|
||||
Map<Long, String> studentCourseChargeTypeMap = studentCourseList.stream().collect(Collectors.toMap(ScStudentCourse::getCourseId, ScStudentCourse::getChargeType));
|
||||
for (Long courseId : courseIds) {
|
||||
APIBaseResponse response = this.checkStudentCanSignUpCourse(studentId, courseId, deptId, studentCourseChargeTypeMap);
|
||||
if(!response.isSuccess()) {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
return APIBaseResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public APIBaseResponse checkStudentCanSignUpCourse(Long studentId, Long courseId, Long deptId,Map<Long, String> studentCourseChargeTypeMap) {
|
||||
if (null == studentCourseChargeTypeMap) {
|
||||
QueryWrapper<ScStudentCourse> qw = new QueryWrapper<>();
|
||||
qw.select("course_id", "charge_type");
|
||||
qw.eq("student_id", studentId);
|
||||
List<ScStudentCourse> studentCourseList = this.list(qw);
|
||||
studentCourseChargeTypeMap = studentCourseList.stream().collect(Collectors.toMap(ScStudentCourse::getCourseId, ScStudentCourse::getChargeType));
|
||||
}
|
||||
ScCourse scCourse = courseMapper.selectById(courseId);
|
||||
if( null == scCourse) {
|
||||
return APIBaseResponse.fail("无法获取课程信息,请重试");
|
||||
}
|
||||
// 已报读的 收费方式
|
||||
String studentCourseChargeType = studentCourseChargeTypeMap.get(courseId);
|
||||
if("cycle".equals(studentCourseChargeType)) {
|
||||
return APIBaseResponse.fail("该学生 已" + CourseChargeTypeEnum.getChargeType(studentCourseChargeType) + "报读'" + scCourse.getCourseName() + "',无法重复报读!");
|
||||
}
|
||||
// 课程收费配置信息
|
||||
QueryWrapper<ScCourseCharge> qw = new QueryWrapper<>();
|
||||
qw.eq("course_id", courseId);
|
||||
if (StringUtils.isNotEmpty(studentCourseChargeType)) {
|
||||
qw.eq("charge_type", studentCourseChargeType);
|
||||
}
|
||||
List<ScCourseCharge> courseChargeList = courseChargeMapper.selectList(qw);
|
||||
|
||||
// 校验学生是否可选择课程 (是否含 已报读的 收费方式)
|
||||
if (studentCourseChargeTypeMap.containsKey(courseId)) {
|
||||
// 是否包含
|
||||
boolean checkHasStudentCourseChargeType = courseChargeList.stream().anyMatch(item -> item.getChargeType().equals(studentCourseChargeType));
|
||||
if (!checkHasStudentCourseChargeType) {
|
||||
return APIBaseResponse.fail("该学生 已" + CourseChargeTypeEnum.getChargeType(studentCourseChargeType) + "报读'" + scCourse.getCourseName() + "',目前该课程暂无此收费模式,请核查!");
|
||||
}
|
||||
}
|
||||
|
||||
if (null != deptId) {
|
||||
// 校验是否配置了本校区
|
||||
boolean checkChargeDept = courseChargeList.stream().anyMatch(item -> item.getDepartId().compareTo(deptId) == 0 || item.getDepartId().compareTo(-1L) == 0);
|
||||
if (!checkChargeDept) {
|
||||
SysDept sysDept = deptMapper.selectById(deptId);
|
||||
return APIBaseResponse.fail(scCourse.getCourseName() + "(" + CourseChargeTypeEnum.getChargeType(studentCourseChargeType) + ")未在'" + sysDept.getDeptName() + "'开课");
|
||||
}
|
||||
}
|
||||
return APIBaseResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScStudentCourse selectByStudentIdCourseId(Long studentId, Long courseId) {
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("student_id",studentId);
|
||||
qw.eq("course_id",courseId);
|
||||
return this.getOne(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteWhenTotalHourZeroForInvalid(Long studentCourseId) {
|
||||
return baseMapper.deleteWhenTotalHourZeroForInvalid(studentCourseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteWhenTotalDayZeroForInvalid(Long studentCourseId) {
|
||||
return baseMapper.deleteWhenTotalDayZeroForInvalid(studentCourseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getWillExpireDateCount(Integer minBalanceDay) {
|
||||
return baseMapper.selectWillExpireDateCount(minBalanceDay, SecurityUtils.getLoginUser().getNowTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getWillExpireHourCount(Integer minBalanceHour) {
|
||||
return baseMapper.selectWillExpireHourCount(minBalanceHour, SecurityUtils.getLoginUser().getNowTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverStudentCourseHour(ScClaTimeAttend claTimeAttend, ScClaTime claTime, LoginUser loginUser) {
|
||||
Long studentCourseId = claTimeAttend.getStudentCourseId();
|
||||
String chargeType = claTimeAttend.getChargeType();
|
||||
BigDecimal payHour = claTimeAttend.getPayHour();
|
||||
|
||||
// 学员日志
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
sb.append("恢复课时[编辑/删除上课记录],").append("上课时间").append(claTime.getRealClaDate()).append(" ")
|
||||
.append(claTime.getRealStartTime()).append("~").append(claTime.getRealEndTime()).append(",");
|
||||
ScStudentCourseLog studentCourseLog = ScStudentCourseLog.builder()
|
||||
.studentId(claTimeAttend.getStudentId())
|
||||
.logType(LogTypeEnum.DELETE_ATTEND_CLA.getLogType())
|
||||
.courseId(claTimeAttend.getCourseId())
|
||||
.courseName(claTime.getCourseName())
|
||||
.claId(claTimeAttend.getClaId())
|
||||
.claName(claTime.getClaName())
|
||||
.deptName(claTime.getDeptName())
|
||||
.changeHour(claTimeAttend.getPayHour())
|
||||
.changeFee(claTimeAttend.getPayFee())
|
||||
.createUser(loginUser.getUserId())
|
||||
.createUserName(loginUser.getUsername())
|
||||
.createTime(new Date())
|
||||
.build();
|
||||
|
||||
if (!CourseChargeTypeEnum.DATE.getChargeType().equals(chargeType)) {
|
||||
ScStudentCourse studentCourse = this.getById(studentCourseId);
|
||||
if (null == studentCourse) {
|
||||
throw new BusinessException("恢复学生课时失败,无法获取学生课时信息!");
|
||||
}
|
||||
// 消耗课时> 0 , 恢复课时
|
||||
if (payHour.compareTo(BigDecimal.ZERO) > 0) {
|
||||
UpdateWrapper<ScStudentCourse> uwStudentCourse = new UpdateWrapper<>();
|
||||
uwStudentCourse
|
||||
.eq("student_course_id", studentCourseId)
|
||||
.eq("balance_hour", studentCourse.getBalanceHour())
|
||||
.set("balance_hour", studentCourse.getBalanceHour().add(payHour))
|
||||
.set("last_update_user", loginUser.getUserId())
|
||||
.set("last_update_time", new Date());
|
||||
boolean update = this.update(uwStudentCourse);
|
||||
if (!update) {
|
||||
throw new BusinessException("学员剩余课时恢复失败,请重试!");
|
||||
}
|
||||
|
||||
studentCourseLog.setAfterBalanceHour(studentCourse.getBalanceHour().add(payHour));
|
||||
} else {
|
||||
studentCourseLog.setAfterBalanceHour(studentCourse.getBalanceHour().add(payHour));
|
||||
}
|
||||
|
||||
sb.append("恢复").append(payHour.toString()).append("课时");
|
||||
|
||||
// 恢复订单课时
|
||||
courseOrderService.recoverOrderLoseHour(studentCourse.getStudentCourseId(), payHour);
|
||||
}
|
||||
|
||||
studentCourseLog.setMemo(sb.toString());
|
||||
scStudentCourseLogService.save(studentCourseLog);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,11 +1,11 @@
|
||||
package cn.xluobo.business.sc.course.controller;
|
||||
package com.ruoyi.web.controller.school.course;
|
||||
|
||||
import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeAttend;
|
||||
import cn.xluobo.business.sc.course.domain.resp.time.RespClaTimeAttend;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScClaTimeAttend;
|
||||
import cn.xluobo.business.sc.course.service.BusinessScClaTimeAttendService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import cn.xluobo.core.page.RespPage;
|
||||
import com.ruoyi.common.page.RespPage;
|
||||
import com.ruoyi.school.course.domain.req.time.ReqSearchScClaTimeAttend;
|
||||
import com.ruoyi.school.course.domain.resp.time.RespClaTimeAttend;
|
||||
import com.ruoyi.school.course.domain.ScClaTimeAttend;
|
||||
import com.ruoyi.school.course.service.BusinessScClaTimeAttendService;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package cn.xluobo.business.sc.course.controller;
|
||||
package com.ruoyi.web.controller.school.course;
|
||||
|
||||
import cn.xluobo.business.sc.course.domain.req.time.ReqSearchScClaTimeRule;
|
||||
import cn.xluobo.business.sc.course.repo.model.ScClaTimeRule;
|
||||
import cn.xluobo.business.sc.course.service.BusinessClaTimeRuleService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import com.ruoyi.school.course.domain.req.time.ReqSearchScClaTimeRule;
|
||||
import com.ruoyi.school.course.domain.ScClaTimeRule;
|
||||
import com.ruoyi.school.course.service.BusinessClaTimeRuleService;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -0,0 +1,152 @@
|
||||
package com.ruoyi.web.controller.school.course;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import com.ruoyi.school.course.domain.req.course.ReqSearchScCourseType;
|
||||
import com.ruoyi.school.course.domain.resp.course.RespCourseSelect;
|
||||
import com.ruoyi.school.course.domain.resp.course.RespCourseTypeSelect;
|
||||
import com.ruoyi.school.course.domain.ScCourse;
|
||||
import com.ruoyi.school.course.domain.ScCourseType;
|
||||
import com.ruoyi.school.course.service.BusinessScCourseTypeService;
|
||||
import com.ruoyi.school.course.service.impl.ScCourseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 课程类型 Controller
|
||||
* </p>
|
||||
*
|
||||
* @author zhangby
|
||||
* @since 2020-07-09 08:10:25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/sc/course/type")
|
||||
public class ScCourseTypeController {
|
||||
@Autowired
|
||||
private BusinessScCourseTypeService scCourseTypeService;
|
||||
|
||||
@Autowired
|
||||
private ScCourseServiceImpl scCourseService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param reqSearchScCourseType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/searchList")
|
||||
public APIResponse searchList(ReqSearchScCourseType reqSearchScCourseType) {
|
||||
return scCourseTypeService.searchList(reqSearchScCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* select
|
||||
*
|
||||
* @param reqSearchScCourseType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/select")
|
||||
public APIResponse select(ReqSearchScCourseType reqSearchScCourseType) {
|
||||
List<ScCourseType> list = scCourseTypeService.select(reqSearchScCourseType);
|
||||
|
||||
return APIResponse.toAPIResponse(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* select
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/selectForCheckbox")
|
||||
public APIResponse selectForCheckbox() {
|
||||
List<ScCourseType> list = scCourseTypeService.select(new ReqSearchScCourseType());
|
||||
List<RespCourseTypeSelect> typeList= list.stream().map(RespCourseTypeSelect::new).collect(Collectors.toList());
|
||||
return APIResponse.toAPIResponse(typeList);
|
||||
}
|
||||
/**
|
||||
* select
|
||||
*
|
||||
* @param reqSearchScCourseType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/selectByTypeIds")
|
||||
public APIResponse selectByTypeIds(ReqSearchScCourseType reqSearchScCourseType) {
|
||||
List<ScCourseType> list = scCourseTypeService.select(reqSearchScCourseType);
|
||||
List<RespCourseTypeSelect> typeList= list.stream().map(RespCourseTypeSelect::new).collect(Collectors.toList());
|
||||
|
||||
typeList.forEach(l->{
|
||||
List<ScCourse> list1= scCourseService.list(new QueryWrapper<ScCourse>()
|
||||
.eq("course_type_id",l.getId())
|
||||
.eq("delete_flag",'0')
|
||||
);
|
||||
List<RespCourseSelect> list2= list1.stream().map(RespCourseSelect::new).collect(Collectors.toList());
|
||||
l.setCourseList(list2);
|
||||
});
|
||||
return APIResponse.toAPIResponse(typeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param courseTypeId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info/detailById/{courseTypeId}")
|
||||
public APIResponse detailById(@PathVariable("courseTypeId") Long courseTypeId) {
|
||||
return scCourseTypeService.detailById(courseTypeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param scCourseType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add/addScCourseType")
|
||||
public APIResponse addScCourseType(@RequestBody ScCourseType scCourseType) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
scCourseType.setTenantId(loginUser.getNowTenantId());
|
||||
return scCourseTypeService.addScCourseType(scCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param scCourseType
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update/updateScCourseType")
|
||||
public APIResponse updateScCourseType(@RequestBody ScCourseType scCourseType) {
|
||||
return scCourseTypeService.updateScCourseType(scCourseType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param courseTypeIds
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete/deleteById/{courseTypeIds}")
|
||||
public APIResponse deleteById(@PathVariable("courseTypeIds") Long[] courseTypeIds) {
|
||||
return scCourseTypeService.deleteById(courseTypeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更是否开售
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/changeCourseTypeSale")
|
||||
public APIResponse changeCourseTypeSale(@RequestBody ScCourseType scCourseType) {
|
||||
return scCourseTypeService.changeCourseTypeSale(scCourseType);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
package cn.xluobo.business.sc.base.controller;
|
||||
package com.ruoyi.web.controller.school.course;
|
||||
|
||||
import cn.xluobo.business.sc.base.domain.req.ReqRoomSelect;
|
||||
import cn.xluobo.business.sc.base.domain.req.ReqSearchScRoom;
|
||||
import cn.xluobo.business.sc.base.repo.model.ScRoom;
|
||||
import cn.xluobo.business.sc.base.service.BusinessScRoomService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import com.ruoyi.school.room.domain.req.ReqRoomSelect;
|
||||
import com.ruoyi.school.room.domain.req.ReqSearchScRoom;
|
||||
import com.ruoyi.school.room.domain.ScRoom;
|
||||
import com.ruoyi.school.room.service.BusinessScRoomService;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -0,0 +1,154 @@
|
||||
package com.ruoyi.web.controller.school.member;
|
||||
|
||||
import com.ruoyi.common.page.RespPage;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import com.ruoyi.school.member.domain.req.CreateMemberCardDTO;
|
||||
import com.ruoyi.school.member.domain.resp.MemberCardDTO;
|
||||
import com.ruoyi.school.member.domain.resp.MemberCardVO;
|
||||
import com.ruoyi.school.member.service.IScMemberCardService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会员卡类型信息 Controller
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/sc/memberCard")
|
||||
public class ScMemberCardController {
|
||||
|
||||
@Autowired
|
||||
private IScMemberCardService memberCardService;
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("分页查询会员卡列表")
|
||||
public APIResponse getCardList(
|
||||
@Valid @RequestBody MemberCardDTO queryDTO) {
|
||||
RespPage<MemberCardVO> result = memberCardService.getCardList(queryDTO);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建会员卡")
|
||||
public APIResponse createMemberCard(@Valid @RequestBody CreateMemberCardDTO dto) {
|
||||
MemberCardDTO result = memberCardService.createMemberCard(dto);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
@PostMapping("/checkIn")
|
||||
@ApiOperation("批量签到")
|
||||
public APIResponse checkIn( @Valid @RequestBody Map<String , List<Long> > map
|
||||
) {
|
||||
List<Long> bookIds=map.get("bookIds");
|
||||
return memberCardService.checkInByIds(bookIds);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{cardNo}")
|
||||
@ApiOperation("根据卡号查询会员卡")
|
||||
public APIResponse getByCardNo(@PathVariable String cardNo) {
|
||||
MemberCardVO result = memberCardService.getByCardNo(cardNo);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/{cardId}/activate")
|
||||
@ApiOperation("激活会员卡")
|
||||
public APIResponse activateCard(@PathVariable Long cardId) {
|
||||
boolean result = memberCardService.activateCard(cardId);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
@GetMapping("/member/{memberId}")
|
||||
@ApiOperation("查询会员的会员卡列表")
|
||||
public APIResponse getMemberCards(@PathVariable Long memberId) {
|
||||
List<MemberCardVO> result = memberCardService.getMemberCards(memberId);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
@PostMapping("/member/{cardId}")
|
||||
@ApiOperation("暂停会员卡")
|
||||
public APIResponse suspendCard(
|
||||
@ApiParam(value = "会员卡ID", required = true)
|
||||
@PathVariable Long cardId) {
|
||||
boolean result = memberCardService.suspendCard(cardId);
|
||||
return APIResponse.toAPIResponse(result ? "暂停成功" : "暂停失败");
|
||||
}
|
||||
|
||||
// @PostMapping("/renew")
|
||||
// @ApiOperation("续费会员卡")
|
||||
// public APIResponse renewCard(
|
||||
// @Valid @RequestBody RenewCardDTO dto) {
|
||||
// boolean result = memberCardService.renewCard(dto.getCardId(), dto.getDays());
|
||||
// return APIResponse.toAPIResponse(result ? "续费成功" : "续费失败");
|
||||
// }
|
||||
@PostMapping("/add-count")
|
||||
@ApiOperation("增加次数")
|
||||
public APIResponse addCardCount(
|
||||
@ApiParam(value = "会员卡ID", required = true)
|
||||
@RequestParam Long cardId,
|
||||
@ApiParam(value = "增加次数", required = true)
|
||||
@RequestParam Integer count) {
|
||||
boolean result = memberCardService.addCardCount(cardId, count);
|
||||
return APIResponse.toAPIResponse(result ? "增加成功" : "增加失败");
|
||||
}
|
||||
|
||||
@PostMapping("/deduct-count")
|
||||
@ApiOperation("扣减次数")
|
||||
public APIResponse deductCardCount(
|
||||
@ApiParam(value = "会员卡ID", required = true)
|
||||
@RequestParam Long cardId,
|
||||
@ApiParam(value = "扣减次数", required = true)
|
||||
@RequestParam Integer count) {
|
||||
boolean result = memberCardService.deductCardCount(cardId, count);
|
||||
return APIResponse.toAPIResponse(result ? "扣减成功" : "扣减失败");
|
||||
}
|
||||
|
||||
@GetMapping("/valid/{memberId}")
|
||||
@ApiOperation("查询会员有效的会员卡")
|
||||
public APIResponse getValidMemberCards(
|
||||
@ApiParam(value = "会员ID", required = true)
|
||||
@PathVariable Long memberId) {
|
||||
List<MemberCardVO> result = memberCardService.getValidMemberCards(memberId);
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
|
||||
@PostMapping("/check-status/{cardId}")
|
||||
@ApiOperation("检查会员卡状态")
|
||||
public APIResponse checkCardStatus(
|
||||
@ApiParam(value = "会员卡ID", required = true)
|
||||
@PathVariable Long cardId) {
|
||||
boolean result = memberCardService.checkCardStatus(cardId);
|
||||
return APIResponse.toAPIResponse(result ? "卡状态正常" : "卡状态异常");
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("删除会员卡(逻辑删除)")
|
||||
public APIResponse deleteCard(
|
||||
@ApiParam(value = "会员卡ID", required = true)
|
||||
@PathVariable Long id) {
|
||||
boolean result = memberCardService.removeById(id);
|
||||
return APIResponse.toAPIResponse(result ? "删除成功" : "删除失败");
|
||||
}
|
||||
|
||||
@GetMapping("/todayCardCount")
|
||||
@ApiOperation("查询今日办卡数量")
|
||||
public APIResponse getTodayCardCount() {
|
||||
Integer result = memberCardService.getTodayCardCount();
|
||||
return APIResponse.toAPIResponse(result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,295 @@
|
||||
package com.ruoyi.web.controller.school.member;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.xluobo.core.page.RespPage;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import com.ruoyi.school.course.domain.req.course.ReqBusinessOrderCourseDetail;
|
||||
import com.ruoyi.school.course.domain.resp.course.RespCourseTypeSelect;
|
||||
import com.ruoyi.school.course.domain.ScCourseType;
|
||||
import com.ruoyi.school.course.service.IScCourseTypeService;
|
||||
import com.ruoyi.school.member.domain.ScMemberCard;
|
||||
import com.ruoyi.school.member.domain.ScMemberCardCharge;
|
||||
import com.ruoyi.school.member.domain.ScMemberCardCourses;
|
||||
import com.ruoyi.school.member.domain.ScMemberCardTypes;
|
||||
import com.ruoyi.school.member.domain.req.ReqAddMemberChargeItem;
|
||||
import com.ruoyi.school.member.service.IScMemberCardService;
|
||||
import com.ruoyi.school.member.service.ScMemberCardChargeService;
|
||||
import com.ruoyi.school.member.service.ScMemberCardCourseService;
|
||||
import com.ruoyi.school.member.service.ScMemberCardTypesService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会员卡类型信息 Controller
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/sc/memberCardTypes")
|
||||
public class ScMemberCardTypesController {
|
||||
|
||||
@Autowired
|
||||
private ScMemberCardTypesService typesService;
|
||||
|
||||
@Autowired
|
||||
private IScCourseTypeService courseTypeService;
|
||||
|
||||
@Autowired
|
||||
private ScMemberCardChargeService cardChargeService;
|
||||
@Autowired
|
||||
private ScMemberCardCourseService cardCoursesService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private IScMemberCardService memberCardService;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/searchList")
|
||||
public APIResponse searchList(ScMemberCardTypes types) {
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
|
||||
// qw.eq("delete_flag", "0");
|
||||
if (StringUtils.isNotEmpty(types.getCardName())) {
|
||||
qw.eq("card_name", types.getCardName());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(types.getSale())) {
|
||||
qw.eq("sale", types.getSale());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(types.getCardType()) && !types.getCardType().equals("total_fee")){// count 按课时 date_unit 按时间
|
||||
qw.isNotNull(types.getCardType());
|
||||
qw.ne(types.getCardType(),"");
|
||||
}
|
||||
qw.last(ObjectUtil.isNotEmpty(types.getCourseTypeId())," and JSON_CONTAINS(course_types, CAST("+types.getCourseTypeId()+" AS JSON)) ");
|
||||
RespPage<ScMemberCardTypes> respPage = new RespPage<>(types.getPageNum(),types.getPageSize());
|
||||
RespPage<ScMemberCardTypes> listPage =typesService.page(respPage, qw);
|
||||
listPage.getRows().forEach(l->{
|
||||
//获取课程分类 名
|
||||
if (ObjectUtil.isNotEmpty(l.getCourseTypes())||l.getCourseTypes().length>0){
|
||||
List<Long> courseTypeIds = Arrays.asList(l.getCourseTypes());
|
||||
List<ScCourseType> courseTypeList=courseTypeService.listByIds(courseTypeIds);
|
||||
String typesName= courseTypeList.stream().map(ScCourseType::getCourseType)
|
||||
.collect(Collectors.joining(","));
|
||||
l.setCourseTypesName(typesName);
|
||||
}
|
||||
//付费模式 default customize自定义
|
||||
if (l.getChargeType().equals("customize")){
|
||||
List<ReqAddMemberChargeItem> list=cardChargeService.getByMemberId(l.getCardTypeId());
|
||||
l.setFeeModeHourList(list);
|
||||
}
|
||||
//限制教师
|
||||
if (l.getRestrictedTeacher().equals("2") ){
|
||||
List<SysUser> users= userService.selectUserByIds(l.getTeacherList());
|
||||
String userNames= users.stream().map(SysUser::getNickName).collect(Collectors.joining(","));
|
||||
l.setTeachersName(userNames);
|
||||
}
|
||||
//限制课程
|
||||
if (l.getRestrictedCourses().equals("2")){
|
||||
//课程类别名称 课程名称
|
||||
List<ScMemberCardCourses> cardCoursesList=cardCoursesService.getByCardId(l.getCardTypeId());
|
||||
l.setCourses(cardCoursesList);
|
||||
}
|
||||
|
||||
});
|
||||
return APIResponse.toAPIResponse(listPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 前端select
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/select")
|
||||
public APIResponse select(ScMemberCardTypes types) {
|
||||
QueryWrapper<ScMemberCardTypes> qw = new QueryWrapper();
|
||||
qw.eq("tenant_id", SecurityUtils.getLoginUser().getNowTenantId());
|
||||
qw.eq("delete_flag", "0");
|
||||
qw.eq("sale", "1");
|
||||
if (StringUtils.isNotEmpty(types.getCardName())) {
|
||||
qw.eq("card_name", types.getCardName());
|
||||
}
|
||||
return APIResponse.toAPIResponse(typesService.list(qw));
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info/detailById/{cardId}")
|
||||
public APIResponse detailById(@PathVariable("cardId") Long cardId) {
|
||||
ScMemberCardTypes types=typesService.getById(cardId);
|
||||
//限制课程
|
||||
if (types.getRestrictedCourses().equals("2") ){
|
||||
List<ScMemberCardCourses> cardCoursesList= cardCoursesService.list(new QueryWrapper<ScMemberCardCourses>()
|
||||
.eq("card_type_id",types.getCardTypeId()));
|
||||
List<RespCourseTypeSelect> typeList= cardCoursesList.stream().map(RespCourseTypeSelect::new).collect(Collectors.toList());
|
||||
types.setCourseListInType(typeList);
|
||||
}
|
||||
|
||||
//付费模式 自定义
|
||||
if (types.getChargeType().equals("customize") ){
|
||||
List<ScMemberCardCharge> cardChargeList= cardChargeService.list(new QueryWrapper<ScMemberCardCharge>()
|
||||
.eq("card_type_id",types.getCardTypeId()));
|
||||
List<ReqAddMemberChargeItem> chargeItems= BeanUtil.copyToList(cardChargeList,ReqAddMemberChargeItem.class);
|
||||
types.setFeeModeHourList(chargeItems);
|
||||
}
|
||||
return APIResponse.toAPIResponse(types);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add/memberCardTypes")
|
||||
@Transactional
|
||||
public APIResponse addScCourse(@RequestBody ScMemberCardTypes types) {
|
||||
//todo 会员卡项修改记录
|
||||
types.checkParam();
|
||||
types.setTenantId(SecurityUtils.getLoginUser().getNowTenantId());
|
||||
types.setCreateUser(SecurityUtils.getUserId());
|
||||
typesService.save(types);
|
||||
Long cardTypeId=types.getCardTypeId();
|
||||
|
||||
//限制课程 会员卡项 课程类型 课程id[]
|
||||
List<RespCourseTypeSelect> list=types.getCourseListInType();
|
||||
if (types.getRestrictedCourses().equals("2") && list.size()>0){
|
||||
List<ScMemberCardCourses> cardCoursesList= new ArrayList<>();
|
||||
|
||||
for (RespCourseTypeSelect type : list) {
|
||||
Long[] courses= type.getSelectedCourses();
|
||||
if (ObjectUtil.isEmpty(courses) || courses.length<1) continue;
|
||||
ScMemberCardCourses cardCourse=new ScMemberCardCourses();
|
||||
cardCourse.setCardTypeId(cardTypeId);
|
||||
cardCourse.setCourseTypeId(type.getId());
|
||||
cardCourse.setCourses(courses);
|
||||
cardCoursesList.add(cardCourse);
|
||||
}
|
||||
cardCoursesService.saveBatch(cardCoursesList);
|
||||
}
|
||||
|
||||
//付费模式: 会员卡项 课程类型 扣卡次数 扣卡金额
|
||||
List<ReqAddMemberChargeItem> feeList= types.getFeeModeHourList();
|
||||
if (types.getChargeType().equals("customize") && feeList.size()>0){
|
||||
List<ScMemberCardCharge> cardChargeList= BeanUtil.copyToList(feeList,ScMemberCardCharge.class);
|
||||
cardChargeList.forEach(l->{
|
||||
l.setCardTypeId(cardTypeId);
|
||||
});
|
||||
cardChargeService.saveBatch(cardChargeList);
|
||||
}
|
||||
|
||||
return APIResponse.toOkResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update/updateMemberCardTypes")
|
||||
@Transactional
|
||||
public APIResponse updateScCourse(@RequestBody ScMemberCardTypes types) {
|
||||
types.setLastUpdateUser(SecurityUtils.getUserId());
|
||||
|
||||
typesService.updateById(types);
|
||||
cardChargeService.remove(new QueryWrapper<ScMemberCardCharge>()
|
||||
.eq("card_type_id",types.getCardTypeId()));
|
||||
|
||||
cardCoursesService.remove(new QueryWrapper<ScMemberCardCourses>()
|
||||
.eq("card_type_id",types.getCardTypeId()));
|
||||
|
||||
//限制课程 会员卡项 课程类型 课程id[]
|
||||
List<RespCourseTypeSelect> list=types.getCourseListInType();
|
||||
if (types.getRestrictedCourses().equals("2") && list.size()>0){
|
||||
List<ScMemberCardCourses> cardCoursesList= new ArrayList<>();
|
||||
|
||||
for (RespCourseTypeSelect type : list) {
|
||||
Long[] courses= type.getSelectedCourses();
|
||||
if (ObjectUtil.isEmpty(courses) || courses.length<1) continue;
|
||||
ScMemberCardCourses cardCourse=new ScMemberCardCourses();
|
||||
cardCourse.setCardTypeId(types.getCardTypeId());
|
||||
cardCourse.setCourseTypeId(type.getId());
|
||||
cardCourse.setCourses(courses);
|
||||
cardCoursesList.add(cardCourse);
|
||||
}
|
||||
cardCoursesService.saveBatch(cardCoursesList);
|
||||
}
|
||||
|
||||
//付费模式: 会员卡项 课程类型 扣卡次数 扣卡金额
|
||||
List<ReqAddMemberChargeItem> feeList= types.getFeeModeHourList();
|
||||
if (types.getChargeType().equals("customize") && feeList.size()>0){
|
||||
List<ScMemberCardCharge> cardChargeList= BeanUtil.copyToList(feeList,ScMemberCardCharge.class);
|
||||
cardChargeList.forEach(l->{
|
||||
l.setCardTypeId(types.getCardTypeId());
|
||||
});
|
||||
|
||||
cardChargeService.saveBatch(cardChargeList);
|
||||
}
|
||||
|
||||
return APIResponse.toOkResponse();
|
||||
}
|
||||
|
||||
@PutMapping("/update/editSale")
|
||||
@Transactional
|
||||
public APIResponse editSale(@RequestBody ScMemberCardTypes types) {
|
||||
types.setLastUpdateUser(SecurityUtils.getUserId());
|
||||
typesService.updateById(types);
|
||||
return APIResponse.toOkResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/delete/deleteById/{cardIds}")
|
||||
@Transactional
|
||||
public APIResponse deleteById(@PathVariable("cardIds") List<Long> cardIds) {
|
||||
//判断 卡类下是否有会员
|
||||
int count=memberCardService.count(new QueryWrapper<ScMemberCard>().in("card_type_id",cardIds));
|
||||
if (count>0){
|
||||
return APIResponse.toExceptionResponse("当前卡类已办理会员,无法删除!");
|
||||
}
|
||||
typesService.removeByIds(cardIds);
|
||||
cardChargeService.remove(new QueryWrapper<ScMemberCardCharge>()
|
||||
.in("card_type_id",cardIds));
|
||||
|
||||
cardCoursesService.remove(new QueryWrapper<ScMemberCardCourses>()
|
||||
.in("card_type_id",cardIds));
|
||||
|
||||
return APIResponse.toOkResponse();
|
||||
}
|
||||
|
||||
@GetMapping("/info/orderCardTypeDetail")
|
||||
public APIResponse orderCardTypeDetail(ReqBusinessOrderCourseDetail orderCourseDetail) {
|
||||
return typesService.orderCardTypeDetail(orderCourseDetail);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
package cn.xluobo.business.sc.student.controller;
|
||||
package com.ruoyi.web.controller.school.member;
|
||||
|
||||
import cn.xluobo.business.sc.student.domain.req.ReqSearchScStudent;
|
||||
import cn.xluobo.business.sc.student.domain.req.ReqStudentSelect;
|
||||
import cn.xluobo.business.sc.student.repo.model.ScStudent;
|
||||
import cn.xluobo.business.sc.student.service.BusinessScStudentService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import com.ruoyi.school.member.domain.req.ReqSearchScStudent;
|
||||
import com.ruoyi.school.member.domain.req.ReqStudentSelect;
|
||||
import com.ruoyi.school.member.domain.ScStudent;
|
||||
import com.ruoyi.school.student.service.BusinessScStudentService;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package cn.xluobo.business.report.dashboard.controller;
|
||||
package com.ruoyi.web.controller.school.order;
|
||||
|
||||
import cn.xluobo.business.report.dashboard.domain.resp.DashboardData;
|
||||
import cn.xluobo.business.report.dashboard.service.DashboardService;
|
||||
import cn.xluobo.core.api.APIResponse;
|
||||
import com.ruoyi.core.api.APIResponse;
|
||||
import com.ruoyi.school.dashboard.domain.resp.DashboardData;
|
||||
import com.ruoyi.school.dashboard.service.DashboardService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -1,9 +1,9 @@
|
||||
package cn.xluobo.business.sc.salary.controller;
|
||||
package com.ruoyi.web.controller.school.salary;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.xluobo.business.sc.salary.repo.model.ScCommissionPlans;
|
||||
import cn.xluobo.business.sc.salary.service.ScCommissionPlansService;
|
||||
import com.ruoyi.school.salary.domain.ScCommissionPlans;
|
||||
import com.ruoyi.school.salary.service.ScCommissionPlansService;
|
||||
import cn.xluobo.core.page.RespPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue