Browse Source

增加 购买陪练课回调成功

hgw 3 years ago
parent
commit
c9e0674ddc

+ 7 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseGroupDao.java

@@ -65,6 +65,13 @@ public interface CourseGroupDao extends BaseMapper<CourseGroup> {
     List<LiveCourseGroupPlanVo> selectAdminLivePlan(@Param("courseGroupId") Long courseGroupId);
 
     /**
+     * 课程组人数增加或减少
+     *
+     * @param id 课程组id
+     */
+    int opsPreStudentNum(@Param("id") Long id,@Param("num") Integer num);
+
+    /**
      * 查询课程组详情
      *
      * @param courseGroupId 课程组id

+ 38 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleTeacherSalary.java

@@ -25,9 +25,13 @@ public class CourseScheduleTeacherSalary implements Serializable {
     private Long id;
 
     @TableField("teacher_id_")
-    @ApiModelProperty(value = "老师编号;")
+    @ApiModelProperty(value = "老师编号")
     private Long teacherId;
 
+    @TableField("student_id_")
+    @ApiModelProperty(value = "学生编号")
+    private Long studentId;
+
     @TableField("course_schedule_id_")
     @ApiModelProperty(value = "课程编号")
     private Long courseScheduleId;
@@ -38,7 +42,11 @@ public class CourseScheduleTeacherSalary implements Serializable {
 
     @TableField("course_group_id_")
     @ApiModelProperty(value = "课程组编号")
-    private String courseGroupId;
+    private Long courseGroupId;
+
+    @TableField("class_num_")
+    @ApiModelProperty(value = "课堂数")
+    private Integer classNum;
 
     @TableField("expect_salary_")
     @ApiModelProperty(value = "预计薪水")
@@ -68,6 +76,9 @@ public class CourseScheduleTeacherSalary implements Serializable {
     @ApiModelProperty(value = "修改时间")
     private Date updateTime;
 
+    @TableField("status_")
+    @ApiModelProperty(value = "TeacherSalaryEnum 未上课、待结算、已结算、已取消 ")
+    private String status;
 
     public Long getId() {
         return id;
@@ -85,6 +96,14 @@ public class CourseScheduleTeacherSalary implements Serializable {
         this.teacherId = teacherId;
     }
 
+    public Long getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Long studentId) {
+        this.studentId = studentId;
+    }
+
     public Long getCourseScheduleId() {
         return courseScheduleId;
     }
@@ -101,14 +120,22 @@ public class CourseScheduleTeacherSalary implements Serializable {
         this.courseGroupType = courseGroupType;
     }
 
-    public String getCourseGroupId() {
+    public Long getCourseGroupId() {
         return courseGroupId;
     }
 
-    public void setCourseGroupId(String courseGroupId) {
+    public void setCourseGroupId(Long courseGroupId) {
         this.courseGroupId = courseGroupId;
     }
 
+    public Integer getClassNum() {
+        return classNum;
+    }
+
+    public void setClassNum(Integer classNum) {
+        this.classNum = classNum;
+    }
+
     public BigDecimal getExpectSalary() {
         return expectSalary;
     }
@@ -165,5 +192,12 @@ public class CourseScheduleTeacherSalary implements Serializable {
         this.updateTime = updateTime;
     }
 
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
 }
 

+ 45 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/TeacherSalaryEnum.java

@@ -0,0 +1,45 @@
+package com.yonge.cooleshow.biz.dal.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.yonge.cooleshow.common.enums.BaseEnum;
+
+/**
+ * 课酬结算状态枚举
+ */
+public enum TeacherSalaryEnum implements BaseEnum<String, TeacherSalaryEnum> {
+    //未上课-还未开始上课等待上课结束后结算
+    NOT_START("NOT_START", "未上课"),
+    //待结算-老师上完课等待结算
+    WAIT("WAIT", "待结算"),
+    //已结算-已经结算完成
+    COMPLETE("COMPLETE", "已结算"),
+    //已取消-学生发起退款等等其他操作
+    CANCEL("CANCEL", "已取消");
+
+    @EnumValue
+    private String code;
+
+    private String msg;
+
+    TeacherSalaryEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+}

+ 125 - 27
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -1,6 +1,4 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
-import java.math.BigDecimal;
-import java.util.Date;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -19,12 +17,11 @@ import com.yonge.cooleshow.biz.dal.dto.search.LiveCourseGroupStudentSearch;
 import com.yonge.cooleshow.biz.dal.entity.*;
 import com.yonge.cooleshow.biz.dal.enums.CourseGroupEnum;
 import com.yonge.cooleshow.biz.dal.enums.CourseScheduleEnum;
+import com.yonge.cooleshow.biz.dal.enums.TeacherSalaryEnum;
 import com.yonge.cooleshow.biz.dal.service.*;
 import com.yonge.cooleshow.biz.dal.support.PageUtil;
-import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
-import com.yonge.cooleshow.biz.dal.vo.CourseGroupVo;
-import com.yonge.cooleshow.biz.dal.vo.LiveCourseInfoVo;
+import com.yonge.cooleshow.biz.dal.vo.*;
 import com.yonge.cooleshow.common.constant.SysConfigConstant;
 import com.yonge.cooleshow.common.exception.BizException;
 import com.yonge.cooleshow.common.page.PageInfo;
@@ -38,13 +35,15 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import rx.subjects.Subject;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.BiFunction;
 import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -76,6 +75,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
     @Autowired
     private TeacherFreeTimeService teacherFreeTimeService;
+    @Autowired
+    private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
 
     @Override
     public CourseGroupDao getDao() {
@@ -453,8 +454,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
             return liveCourseGroupVoIPage;
         }
         List<Long> courseGroupIdList = records.stream()
-                                              .map(LiveCourseGroupVo::getCourseGroupId)
-                                              .collect(Collectors.toList());
+                .map(LiveCourseGroupVo::getCourseGroupId)
+                .collect(Collectors.toList());
 
         // 获取课程组声部
         List<LiveCourseGroupVo> subjectList = baseMapper.selectCourseGroupSubject(courseGroupIdList);
@@ -473,7 +474,6 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
 
     @Override
     public List<LiveCourseGroupPlanVo> selectAdminLivePlan(Long courseGroupId) {
-
         return baseMapper.selectAdminLivePlan(courseGroupId);
     }
 
@@ -489,20 +489,28 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
      * @param param 传入参数
      *              <p> - groupId    直播课程组id
      *              <p> - studentId    学员id
+     *              <p> - price    购买金额
      */
     public void buyLiveCourse(Map<String, Object> param) {
         Long studentId = WrapperUtil.toLong(param, "studentId", "学员id不能为空!");
         Long groupId = WrapperUtil.toLong(param, "groupId", "课程组id不能为空!");
-        //学生信息
+        String priceStr = WrapperUtil.toStr(param, "price", "购买金额不能为空!");
+        //获取传入金额
+        BigDecimal buyPrice = new BigDecimal(priceStr).setScale(2, RoundingMode.HALF_UP);
+        //校验学生信息
         getSysUser(studentId);
         //课程组信息
-        CourseGroup liveCourseGroup = this.getOne(Wrappers.<CourseGroup>lambdaQuery()
+        CourseGroup courseGroup = this.getOne(Wrappers.<CourseGroup>lambdaQuery()
                 .eq(CourseGroup::getId, groupId)
                 .eq(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode())
         );
-        if (Objects.isNull(liveCourseGroup)) {
+        if (Objects.isNull(courseGroup)) {
             throw new BizException("课程组不存在!");
         }
+        //校验购买金额是否正确 - 如后期加入优惠券之类的要先判断优惠券是否正确,并减去优惠券金额再比较
+        if (buyPrice.compareTo(courseGroup.getCoursePrice()) != 0) {
+            throw new BizException("购买金额不正确!");
+        }
         //课程信息
         List<CourseSchedule> courseList = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
                 .eq(CourseSchedule::getCourseGroupId, groupId)
@@ -512,43 +520,133 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         }
         //校验购买的课程组每节课时间是否和自己的课时冲突
         batchCheckStudentCourseTime(studentId, courseList, CourseSchedule::getStartTime, CourseSchedule::getEndTime);
-        //todo 写订单 返回订单号数据(订单号 金额 等等)
-        String orderNo = "";
-        Date now = new Date();
+        //返回的数据 有用后面aftet的方法使用
+        Map<String, Object> result = new HashMap<>();
+        result.put("courseGroup", courseGroup);
+        result.put("courseList", courseList);
+        result.put("studentId", studentId);
+
+    }
+
+    /**
+     * 待订单创建完毕后继续后续操作
+     *
+     * @param param 传入参数
+     *              <p> - courseList    课程列表
+     *              <p> - studentId    学员id
+     *              <p> - courseGroup   直播课程组信息
+     *              <p> - orderNo   订单号
+     */
+    public void buyLiveCourseAfter(Map<String, Object> param) {
+        String orderNo = WrapperUtil.toStr(param, "orderNo", "订单号不能为空!");
+        Long studentId = (Long) param.get("studentId");
+        List<CourseSchedule> courseList = (List<CourseSchedule>) param.get("courseList");
+        CourseGroup courseGroup = (CourseGroup) param.get("courseGroup");
+
         //写course_schedule_student_payment表 作为记录锁定时间用,防止重复购买,如果支付失败则删除该数据
         List<CourseScheduleStudentPayment> studentPaymentList = new ArrayList<>();
+        Date now = new Date();
         courseList.forEach(course -> {
             CourseScheduleStudentPayment studentPayment = new CourseScheduleStudentPayment();
             studentPayment.setUserId(studentId);
-            studentPayment.setCourseGroupId(groupId);
+            studentPayment.setCourseGroupId(courseGroup.getId());
             studentPayment.setCourseId(course.getId());
             studentPayment.setOrderNo(orderNo);
-            studentPayment.setOriginalPrice(liveCourseGroup.getCoursePrice());
-            studentPayment.setExpectPrice(liveCourseGroup.getCoursePrice());
-            studentPayment.setActualPrice(liveCourseGroup.getCoursePrice());
+            studentPayment.setOriginalPrice(courseGroup.getCoursePrice());
+            studentPayment.setExpectPrice(courseGroup.getCoursePrice());
+            studentPayment.setActualPrice(courseGroup.getCoursePrice());
             studentPayment.setCreatedTime(now);
             studentPayment.setUpdatedTime(now);
-            studentPayment.setCourseType(liveCourseGroup.getType());
+            studentPayment.setCourseType(courseGroup.getType());
             studentPaymentList.add(studentPayment);
         });
         courseScheduleStudentPaymentService.getDao().insertBatch(studentPaymentList);
     }
 
     /**
-     * 学生购买直播课程成功-回调成功
+     * 学生购买直播课程-成功-回调
      */
-    public void buyLiveCourseSuccess() {
-        //写course_group表 pre_student_num_(预计上课人数) +1
+    @Transactional(rollbackFor = Exception.class)
+    public void buyLiveCourseSuccess(String orderNo) {
+        //更新课程组的购买人数+1
+        CourseScheduleStudentPayment studentPayment = courseScheduleStudentPaymentService.getOne(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                .eq(CourseScheduleStudentPayment::getOrderNo, orderNo)
+        );
+        if (Objects.isNull(studentPayment)) {
+            throw new BizException("订单不存在!");
+        }
+        //更新课程组的购买人数+1
+        this.baseMapper.opsPreStudentNum(studentPayment.getCourseGroupId(), 1);
+        //课程组信息
+        CourseGroup courseGroup = this.getOne(Wrappers.<CourseGroup>lambdaQuery()
+                .eq(CourseGroup::getId, studentPayment.getCourseGroupId()));
+        //课程信息
+        List<CourseSchedule> courseList = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
+                .eq(CourseSchedule::getCourseGroupId, studentPayment.getCourseGroupId()));
+        //计算课程组单节课价格 取CourseScheduleStudentPayment expectPrice
+        BigDecimal expectPrice = studentPayment.getExpectPrice();
+        //查询直播课服务费
+        String liveServiceRateStr = sysConfigService.findConfigValue(SysConfigConstant.LIVE_SERVICE_RATE);
+        BigDecimal liveServiceRate = new BigDecimal(liveServiceRateStr).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
+        //获取每节课的课酬 key 课堂数  value 课酬
+        Map<Integer, BigDecimal> singerCourseSalary = getSingerCourseSalary(expectPrice, courseGroup.getCourseNum(), liveServiceRate);
         //写入课酬表计算-根据课程组总金额计算分配到每节课的金额
-        //修改订单为成功
+        Date now = new Date();
+        List<CourseScheduleTeacherSalary> teacherSalaryList = new ArrayList<>();
+        courseList.forEach(course -> {
+            CourseScheduleTeacherSalary teacherSalary = new CourseScheduleTeacherSalary();
+            teacherSalary.setTeacherId(course.getTeacherId());
+            teacherSalary.setStudentId(course.getTeacherId());
+            teacherSalary.setCourseScheduleId(course.getId());
+            teacherSalary.setCourseGroupType(course.getType());
+            teacherSalary.setCourseGroupId(course.getCourseGroupId());
+            teacherSalary.setClassNum(course.getClassNum());
+            teacherSalary.setExpectSalary(singerCourseSalary.get(course.getClassNum()));
+            teacherSalary.setReduceSalary(BigDecimal.ZERO);
+            teacherSalary.setCreateTime(now);
+            teacherSalary.setStatus(TeacherSalaryEnum.NOT_START.getCode());
+            teacherSalaryList.add(teacherSalary);
+        });
+        courseScheduleTeacherSalaryService.getDao().insertBatch(teacherSalaryList);
     }
 
     /**
-     * 学生购买直播课失败-回调
+     * 学生购买直播课程,计算每节课课酬
+     *
+     * @param totalPrice     课酬总金额
+     * @param totalCourseNum 课程总数
+     * @param rate           课酬费率
+     * @return key 课堂数  value 课酬
      */
-    public void buyLiveCourseFailed() {
-        //修改 course_group表 pre_student_num_(预计上课人数) - 1
+    private Map<Integer, BigDecimal> getSingerCourseSalary(BigDecimal totalPrice, Integer totalCourseNum, BigDecimal rate) {
+        //1 - (1 * 手续费率)
+        BiFunction<BigDecimal, BigDecimal, BigDecimal> getPrice = (p, r) -> p.subtract(p.multiply(r)).setScale(2, RoundingMode.HALF_UP);
+        //总课酬
+        BigDecimal totalRatePrice = getPrice.apply(totalPrice, rate);
+        //每节课累计总额
+        BigDecimal cumulativeAmount = BigDecimal.ZERO;
+        //每节课的课酬
+        BigDecimal singerSalary = totalRatePrice.divide(BigDecimal.valueOf(totalCourseNum), 2, RoundingMode.HALF_UP);
+        Map<Integer, BigDecimal> map = new HashMap<>();
+        for (int i = 1; i <= totalCourseNum; i++) {
+            //最后一节课,直接用总课酬减去累计课酬
+            if (i == totalCourseNum) {
+                singerSalary = totalRatePrice.subtract(cumulativeAmount);
+            }
+            cumulativeAmount = cumulativeAmount.add(singerSalary);
+            map.put(i, singerSalary);
+        }
+        return map;
+    }
+
+    /**
+     * 学生购买直播课-失败-回调
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void buyLiveCourseFailed(String orderNo) {
         //删除 course_schedule_student_payment表 数据
+
+
         //修改订单为失败
     }
 

+ 5 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -249,7 +249,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      *              <p> - teacherId 老师id
      *              <p> - year 年
      *              <p> - month 月
-     *              <p> - day 日
      *              <p> - singleCourseMinutes 单课时时长(包含休息时间)
      * @return 返回传入时间当月每日的剩余时间段
      */
@@ -258,13 +257,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
         Integer year = WrapperUtil.toInt(param, "year", "日历的时间年份不能为空!");
         Integer month = WrapperUtil.toInt(param, "month", "日历的时间月份不能为空!");
-        Integer day = WrapperUtil.toInt(param, "month", "日历的时间日期不能为空!");
         Integer singleCourseMinutes = WrapperUtil.toInt(param, "singleCourseMinutes", "单课时时长不能为空!");
         if (singleCourseMinutes < 25) {
             throw new BizException("单课时时长不能小于25分钟!");
         }
-        //传入的日期+1天开始
-        LocalDate firstDay = LocalDate.of(year, month, day).plusDays(1L);
+        //获取每月1号
+        LocalDate firstDay = LocalDate.of(year, month, 1);
         //根据firstDay计算出该月的最后一天
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
         //获取老师的课程  key:日期-年月日 value:课程时间-开始时间,结束时间
@@ -437,19 +435,17 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
      *              <p> - studentId 学生id
      *              <p> - year 年
      *              <p> - month 月
-     *              <p> - day 日
      * @return 返回传入时间当月每日的剩余时间段
      */
     public List<CourseCalendarEntity> createPracticeCourseCalender(Map<String, Object> param) {
         //校验数据
         Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
-        Long studentId = WrapperUtil.toLong(param, "teacherId", "学生id不能为空!");
+        Long studentId = WrapperUtil.toLong(param, "studentId", "学生id不能为空!");
         Integer year = WrapperUtil.toInt(param, "year", "日历的时间年份不能为空!");
         Integer month = WrapperUtil.toInt(param, "month", "日历的时间月份不能为空!");
-        Integer day = WrapperUtil.toInt(param, "month", "日历的时间日期不能为空!");
 
-        //传入的日期+1天开始
-        LocalDate firstDay = LocalDate.of(year, month, day).plusDays(1L);
+        //获取开始日期
+        LocalDate firstDay = LocalDate.of(year, month, 1);
         //根据firstDay计算出该月的最后一天
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
         //查询老师陪练课设置

+ 1 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -4,12 +4,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 import com.yonge.cooleshow.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.yonge.cooleshow.biz.dal.service.CourseScheduleTeacherSalaryService;
-import org.springframework.stereotype.Service;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import java.util.List;
+import org.springframework.stereotype.Service;
 
 /**
  * 老师课酬表(CourseScheduleTeacherSalary)表服务实现类

+ 8 - 21
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/LiveRoomServiceImpl.java

@@ -477,27 +477,14 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
     public Map<String, Object> test(String roomUid) {
         //result
         Map<String, Object> result = new HashMap<>();
-        //模拟排课数据 测试用
-        CheckCourseTimeDto dto = new CheckCourseTimeDto();
-        dto.setTeacherId(99L);
-        dto.setCourseNum(6);
-        dto.setLoop(1);
-
-        List<CourseTimeEntity> timeList = new ArrayList<>();
-        CourseTimeEntity c1 = new CourseTimeEntity();
-        c1.setStartTime(DateUtil.stringToDate("2022-04-01 09:00:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        c1.setEndTime(DateUtil.stringToDate("2022-04-01 09:30:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        CourseTimeEntity c2 = new CourseTimeEntity();
-        c2.setStartTime(DateUtil.stringToDate("2022-04-08 09:00:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        c2.setEndTime(DateUtil.stringToDate("2022-04-08 09:30:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        CourseTimeEntity c3 = new CourseTimeEntity();
-        c3.setStartTime(DateUtil.stringToDate("2022-04-02 09:00:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        c3.setEndTime(DateUtil.stringToDate("2022-04-02 09:30:00", DateUtil.EXPANDED_DATE_TIME_FORMAT));
-        timeList.add(c3);
-        timeList.add(c1);
-        timeList.add(c2);
-        dto.setTimeList(timeList);
-        List<CourseTimeEntity> courseTimeEntities = courseGroupService.lockCourseToCache(dto);
+        //{"day":"01","month":"05","year":"2022","singleCourseMinutes":60,"teacherId":4}
+        Map<String, Object> param = new HashMap<>();
+        param.put("day", "01");
+        param.put("month", "05");
+        param.put("year", "2022");
+        param.put("singleCourseMinutes", 60);
+        param.put("teacherId", 4);
+        List<CourseCalendarEntity> courseTimeEntities =  courseScheduleService.createLiveCourseCalendar(param);
         result.put("自动生成课时", courseTimeEntities);
 
         //获取房间信息

+ 8 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseGroupMapper.xml

@@ -239,4 +239,12 @@
             </if>
         </where>
     </select>
+
+    <update id="opsPreStudentNum">
+        update course_group
+        set
+            pre_student_num_ = pre_student_num_ + #{num}
+        where id_ = #{id}
+    </update>
+
 </mapper>

+ 13 - 10
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -4,9 +4,11 @@
     <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.CourseScheduleTeacherSalary">
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <result column="teacher_id_" jdbcType="INTEGER" property="teacherId"/>
+        <result column="student_id_" jdbcType="INTEGER" property="studentId"/>
         <result column="course_schedule_id_" jdbcType="INTEGER" property="courseScheduleId"/>
         <result column="course_group_type_" jdbcType="VARCHAR" property="courseGroupType"/>
-        <result column="course_group_id_" jdbcType="VARCHAR" property="courseGroupId"/>
+        <result column="course_group_id_" jdbcType="INTEGER" property="courseGroupId"/>
+        <result column="class_num_" jdbcType="INTEGER" property="classNum"/>
         <result column="expect_salary_" jdbcType="VARCHAR" property="expectSalary"/>
         <result column="actual_salary_" jdbcType="VARCHAR" property="actualSalary"/>
         <result column="reduce_salary_" jdbcType="VARCHAR" property="reduceSalary"/>
@@ -14,24 +16,25 @@
         <result column="settlement_time_" jdbcType="TIMESTAMP" property="settlementTime"/>
         <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
         <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="status_" jdbcType="VARCHAR" property="status"/>
     </resultMap>
 
     <sql id="Base_Column_List">
         id_
-        , teacher_id_, course_schedule_id_, course_group_type_, course_group_id_, expect_salary_,
-    actual_salary_, reduce_salary_, reduce_salary_remark_, settlement_time_, create_time_, update_time_
+        , teacher_id_, student_id_, course_schedule_id_, course_group_type_, course_group_id_, class_num_, expect_salary_, actual_salary_, reduce_salary_, reduce_salary_remark_, settlement_time_, create_time_, update_time_, status_
     </sql>
 
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.yonge.cooleshow.biz.dal.entity.CourseScheduleTeacherSalary">
-        INSERT INTO course_schedule_teacher_salary(teacher_id_, course_schedule_id_, course_group_type_,
-        course_group_id_, expect_salary_, actual_salary_, reduce_salary_, reduce_salary_remark_, settlement_time_,
-        create_time_, update_time_)
-        VALUES
+        insert into course_schedule_teacher_salary(teacher_id_, student_id_, course_schedule_id_, course_group_type_,
+        course_group_id_, class_num_, expect_salary_, actual_salary_, reduce_salary_, reduce_salary_remark_,
+        settlement_time_, create_time_, update_time_, status_)
+        values
         <foreach collection="entities" item="entity" separator=",">
-            (#{entity.teacherId}, #{entity.courseScheduleId}, #{entity.courseGroupType}, #{entity.courseGroupId},
-            #{entity.expectSalary}, #{entity.actualSalary}, #{entity.reduceSalary}, #{entity.reduceSalaryRemark},
-            #{entity.settlementTime}, NOW(), NOW())
+            (#{entity.teacherId}, #{entity.studentId}, #{entity.courseScheduleId}, #{entity.courseGroupType},
+            #{entity.courseGroupId},#{entity.classNum} ,#{entity.expectSalary}, #{entity.actualSalary},
+            #{entity.reduceSalary}, #{entity.reduceSalaryRemark}, #{entity.settlementTime}, #{entity.createTime},
+            #{entity.updateTime}, #{entity.status})
         </foreach>
     </insert>