Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 years ago
parent
commit
6f2703aeb0
24 changed files with 813 additions and 36 deletions
  1. 46 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPauseInfoDao.java
  3. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectDao.java
  4. 12 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentAttendanceViewDto.java
  5. 159 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentCourseInfoDto.java
  6. 104 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPauseInfo.java
  7. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java
  8. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentPaymentOrderQueryInfo.java
  9. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java
  10. 12 2
      mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java
  11. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  12. 11 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  13. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  14. 123 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  15. 2 0
      mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml
  16. 70 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  17. 1 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml
  18. 1 0
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  19. 88 0
      mec-biz/src/main/resources/config/mybatis/StudentPauseInfoMapper.xml
  20. 13 0
      mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml
  21. 5 1
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  22. 63 4
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  23. 16 0
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java
  24. 2 2
      pom.xml

+ 46 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -9,7 +9,6 @@ import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.dal.BaseDAO;
-
 import com.ym.mec.common.page.PageInfo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -777,6 +776,41 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     int countVipGroupCourses(@Param("vipGroupId") Integer vipGroupId);
 
     /**
+     * @describe 获取学生剩余课程信息
+     * @author Joburgess
+     * @date 2019/12/19
+     * @param groupType:
+     * @param groupId:
+     * @param userId:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentCourseInfoDto>
+     */
+    List<StudentCourseInfoDto> findUserSurplusCourseInfoByGroup(@Param("groupType") GroupType groupType,
+                                                         @Param("groupId") String groupId,
+                                                         @Param("userId") Integer userId);
+
+    /**
+     * @describe 获取指定乐团下课程开始时间
+     * @author Joburgess
+     * @date 2019/12/19
+     * @param groupType:
+     * @param groupId:
+     * @return java.util.Date
+     */
+    Date getMinCourseTime(@Param("groupType") GroupType groupType,
+                          @Param("groupId") String groupId);
+
+    /**
+     * @describe 获取指定乐团下课程结束时间
+     * @author Joburgess
+     * @date 2019/12/19
+     * @param groupType:
+     * @param groupId:
+     * @return java.util.Date
+     */
+    Date getMaxCourseTime(@Param("groupType") GroupType groupType,
+                          @Param("groupId") String groupId);
+
+    /**
      * 获取vip未上课时数
      * @param vipGroupId
      * @return
@@ -837,4 +871,15 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @return
      */
     List<Map<Integer, Long>> countCurrentNumByClassGroupId(@Param("classGroupIds") List<Integer> classGroupIds, @Param("classDate") Date classDate);
+
+    /**
+     * @describe 获取乐团下剩余课程计划
+     * @author Joburgess
+     * @date 2019/12/22
+     * @param groupType:
+     * @param groupId:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
+     */
+    List<CourseSchedule> findSurplusCourseWithGroup(@Param("groupType") GroupType groupType,
+                                                    @Param("groupId") String groupId);
 }

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPauseInfoDao.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.StudentPauseInfo;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/12/18
+ */
+public interface StudentPauseInfoDao extends BaseDAO<Long, StudentPauseInfo> {
+
+    /**
+     * @describe 获取用户的休学信息
+     * @author Joburgess
+     * @date 2019/12/22
+     * @param groupType:
+     * @param groupId:
+     * @param userId:
+     * @return com.ym.mec.biz.dal.entity.StudentPauseInfo
+     */
+    StudentPauseInfo findByGroupAndUser(@Param("groupType")GroupType groupType,
+                                        @Param("groupId") String groupId,
+                                        @Param("userId") Integer userId);
+
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectDao.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.dto.ConditionDto;
+import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -124,6 +125,15 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
     List<Map<Integer,String>> findSubjectNameCourseMaps(@Param("courseScheduleIds") List<Long> courseScheuleIds);
 
     /**
+     * @describe
+     * @author Joburgess
+     * @date 2019/12/19
+     * @param studentInfos:
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.String>>
+     */
+    List<Map<Integer, String>> findStudentSubjectNameMaps(@Param("studentInfos") List<StudentAttendanceViewDto> studentInfos);
+
+    /**
      * 获取声部名称
      * @param subjectIdList
      * @return

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentAttendanceViewDto.java

@@ -1,8 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 
-import io.swagger.annotations.ApiModelProperty;
-
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
+import io.swagger.annotations.ApiModelProperty;
 
 /**
  * @Author Joburgess
@@ -11,6 +10,9 @@ import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
  */
 public class StudentAttendanceViewDto {
 
+    @ApiModelProperty(value = "乐团类型",required = false)
+    private String groupType;
+
     @ApiModelProperty(value = "乐团ID",required = false)
     private Long musicGroupId;
 
@@ -35,6 +37,14 @@ public class StudentAttendanceViewDto {
     @ApiModelProperty(value = "学生在学状态",required = false)
     private StudentAttendanceStatusEnum status;
 
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String groupType) {
+        this.groupType = groupType;
+    }
+
     public String getAvatar() {
         return avatar;
     }

+ 159 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentCourseInfoDto.java

@@ -0,0 +1,159 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.util.date.DateUtil;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Objects;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/12/19
+ */
+public class StudentCourseInfoDto {
+
+    private Long id;
+
+    private GroupType groupType;
+
+    /**  */
+    @ApiModelProperty(value = "乐团编号")
+    private String musicGroupId;
+
+    /** 班级编号 */
+    @ApiModelProperty(value = "班级编号")
+    private Integer classGroupId;
+
+    /** 课程状态 */
+    @ApiModelProperty(value = "课程状态")
+    private CourseStatusEnum status;
+
+    /** 上课日期 */
+    @ApiModelProperty(value = "上课日期")
+    private java.util.Date classDate;
+
+    /** 上课时间 */
+    @ApiModelProperty(value = "上课时间")
+    private java.util.Date startClassTime;
+
+    /** 结束时间 */
+    @ApiModelProperty(value = "结束时间")
+    private java.util.Date endClassTime;
+
+    /** 实际上课教师 */
+    @ApiModelProperty(value = "实际上课教师")
+    private Integer actualTeacherId;
+
+    private TeachModeEnum teachMode;
+
+    @ApiModelProperty(value = "预计课酬")
+    private BigDecimal expectPrice;
+
+    public StudentCourseInfoDto(String classDate, String startClassTime, String endClassTime) {
+        this.classDate = DateUtil.stringToDate(classDate, DateUtil.DEFAULT_PATTERN);
+        if (Objects.nonNull(this.classDate) && !StringUtils.isBlank(startClassTime)) {
+            startClassTime = classDate + " " + startClassTime;
+            this.startClassTime = DateUtil.stringToDate(startClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+        }
+        if (Objects.nonNull(this.classDate) && !StringUtils.isBlank(endClassTime)) {
+            endClassTime = classDate + " " + endClassTime;
+            this.endClassTime = DateUtil.stringToDate(endClassTime, DateUtil.EXPANDED_DATE_TIME_FORMAT);
+        }
+    }
+
+    public StudentCourseInfoDto() {
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public GroupType getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(GroupType groupType) {
+        this.groupType = groupType;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getClassGroupId() {
+        return classGroupId;
+    }
+
+    public void setClassGroupId(Integer classGroupId) {
+        this.classGroupId = classGroupId;
+    }
+
+    public CourseStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(CourseStatusEnum status) {
+        this.status = status;
+    }
+
+    public Date getClassDate() {
+        return classDate;
+    }
+
+    public void setClassDate(Date classDate) {
+        this.classDate = classDate;
+    }
+
+    public Date getStartClassTime() {
+        return startClassTime;
+    }
+
+    public void setStartClassTime(Date startClassTime) {
+        this.startClassTime = startClassTime;
+    }
+
+    public Date getEndClassTime() {
+        return endClassTime;
+    }
+
+    public void setEndClassTime(Date endClassTime) {
+        this.endClassTime = endClassTime;
+    }
+
+    public Integer getActualTeacherId() {
+        return actualTeacherId;
+    }
+
+    public void setActualTeacherId(Integer actualTeacherId) {
+        this.actualTeacherId = actualTeacherId;
+    }
+
+    public TeachModeEnum getTeachMode() {
+        return teachMode;
+    }
+
+    public void setTeachMode(TeachModeEnum teachMode) {
+        this.teachMode = teachMode;
+    }
+
+    public BigDecimal getExpectPrice() {
+        return expectPrice;
+    }
+
+    public void setExpectPrice(BigDecimal expectPrice) {
+        this.expectPrice = expectPrice;
+    }
+}

+ 104 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPauseInfo.java

@@ -0,0 +1,104 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.GroupType;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/12/18
+ */
+public class StudentPauseInfo {
+
+    private Integer id;
+
+    private GroupType groupType;
+
+    private Integer classGroupId;
+
+    private Integer musicGroupId;
+
+    private Integer userId;
+
+    @ApiModelProperty(value = "学生休学时的剩余课程json")
+    private String coursesJson;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    private int delFlag;
+
+    public int getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(int delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public GroupType getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(GroupType groupType) {
+        this.groupType = groupType;
+    }
+
+    public Integer getClassGroupId() {
+        return classGroupId;
+    }
+
+    public void setClassGroupId(Integer classGroupId) {
+        this.classGroupId = classGroupId;
+    }
+
+    public Integer getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(Integer musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getCoursesJson() {
+        return coursesJson;
+    }
+
+    public void setCoursesJson(String coursesJson) {
+        this.coursesJson = coursesJson;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java

@@ -104,6 +104,9 @@ public class StudentPaymentOrder {
 	private PaymentChannelTypeEnum paymentChannelType;
 	
 	private SysUser user = new SysUser();
+
+
+	private BigDecimal sporadicAmount;
 	
 	public void setId(Long id){
 		this.id = id;
@@ -308,4 +311,12 @@ public class StudentPaymentOrder {
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
+
+	public BigDecimal getSporadicAmount() {
+		return sporadicAmount;
+	}
+
+	public void setSporadicAmount(BigDecimal sporadicAmount) {
+		this.sporadicAmount = sporadicAmount;
+	}
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentPaymentOrderQueryInfo.java

@@ -29,6 +29,9 @@ public class StudentPaymentOrderQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "支付方式",required = false)
     private String paymentChannel;
 
+    @ApiModelProperty(value = "订单类型",required = false)
+    private String orderType;
+
     public String getOrganId() {
         return organId;
     }
@@ -92,4 +95,12 @@ public class StudentPaymentOrderQueryInfo extends QueryInfo {
     public void setPaymentChannel(String paymentChannel) {
         this.paymentChannel = paymentChannel;
     }
+
+    public String getOrderType() {
+        return orderType;
+    }
+
+    public void setOrderType(String orderType) {
+        this.orderType = orderType;
+    }
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java

@@ -4,6 +4,7 @@ import com.ym.mec.biz.dal.dto.TeacherSalaryDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
 import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
 import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
@@ -69,5 +70,5 @@ public interface CourseScheduleTeacherSalaryService extends BaseService<Long, Co
      * @param studentChangeNum: 学员变化数量,增加为正,减少为负
      * @return void
      */
-    void updateVipGroupCourseTeacherSalary(Integer vipGroupId, Integer studentChangeNum);
+    void updateVipGroupCourseTeacherSalary(Integer vipGroupId, Integer studentChangeNum, VipGroupStatusEnum vipGroupStatusEnum);
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -229,14 +229,24 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
 	void applyRefundForStudent(Long vipGroupId, Integer studentId, BigDecimal amount);
 
 	/**
-	 * @describe 对某个学生退
+	 * @describe 对某个学生进行休
 	 * @author Joburgess
 	 * @date 2019/12/18
 	 * @param vipGroupId: vip课编号
 	 * @param studentId: 学生编号
 	 * @return void
 	 */
-	void quitForStudent(Long vipGroupId, Integer studentId);
+	void pauseForStudent(Long vipGroupId, Integer studentId);
+
+	/**
+	 * @describe 恢复休学的学生
+	 * @author Joburgess
+	 * @date 2019/12/18
+	 * @param vipGroupId:
+	 * @param studentId:
+	 * @return void
+	 */
+	void recoverForStudent(Long vipGroupId, Integer studentId);
 
 	/**
 	 * @describe 获取指定学生的剩余课时费用

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -104,6 +104,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private TeacherDao teacherDao;
     @Autowired
     private SysConfigDao sysConfigDao;
+    @Autowired
+    private SubjectDao subjectDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -1032,6 +1034,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 .collect(Collectors.toList());
         truantStudent.addAll(otherStudent);
         truantStudent.addAll(leaveStudent);
+        if(!CollectionUtils.isEmpty(truantStudent)){
+            List<StudentAttendanceViewDto> tempIds = truantStudent.stream()
+                    .filter(studentAttendanceViewDto -> studentAttendanceViewDto.getGroupType().equals("MUSIC"))
+                    .collect(Collectors.toList());
+            if(!CollectionUtils.isEmpty(tempIds)){
+                List<Map<Integer, String>> studentSubjectNameMaps = subjectDao.findStudentSubjectNameMaps(tempIds);
+                Map<Integer, String> studentSubjectNameMap = MapUtil.convertIntegerMap(studentSubjectNameMaps);
+                truantStudent.forEach(studentAttendanceViewDto -> {
+                    studentAttendanceViewDto.setSubjectName(studentSubjectNameMap.get(studentAttendanceViewDto.getStudentId().intValue()));
+                });
+            }
+        }
         return truantStudent;
     }
 
@@ -2143,6 +2157,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroup.setStudentNum(studentNum);
         if(classGroup.getGroupType().equals(GroupType.VIP)){
             VipGroup vipGroup=vipGroupDao.get(Long.parseLong(classGroup.getMusicGroupId()));
+            Date minClassDate = courseScheduleDao.getMinCourseTime(GroupType.VIP, vipGroup.getId().toString());
+            if(Objects.nonNull(minClassDate)){
+                vipGroup.setCourseStartDate(minClassDate);
+            }
+            Date maxClassDate = courseScheduleDao.getMaxCourseTime(GroupType.VIP, vipGroup.getId().toString());
+            if(Objects.nonNull(maxClassDate)){
+                vipGroup.setCoursesExpireDate(maxClassDate);
+            }
             if (currentClassTimes<totalClassTimes
                     &&vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)){
                 vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -447,6 +448,9 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             Integer schoolClassMinutes = schoolClassMinutesMap.get(courseSchedule.getSchoolId());
             //结算方式
             String settlementType = musicGroupSettlementsMap.get(courseScheduleTeacherSalary.getCourseScheduleId());
+            if(StringUtils.isEmpty(settlementType)){
+                LOGGER.error("未指定课酬结算方式[{}]", courseScheduleTeacherSalary.getId());
+            }
             Teacher teacher=teacherMap.get(courseScheduleTeacherSalary.getUserId());
             //如果当前教师是在指定日期之后入职的,则按照3.0的方式结算
             if(teacher.getEntryDate().after(entryDate)||teacher.getEntryDate().getTime()==entryDate.getTime()){
@@ -473,7 +477,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 //根据课程类型获取对应的默认课酬设置列表
                 List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalariesWithCourseType = teacherDefaultMusicGroupSalariesGroupByCourseType.get(courseSchedule.getType());
                 if (CollectionUtils.isEmpty(teacherDefaultMusicGroupSalariesWithCourseType)) {
-                    throw new BizException("存在未指定结算方式的课程类型");
+                    LOGGER.error("存在未指定结算方式的课程类型[{}]", courseScheduleTeacherSalary.getId());
                 }
 
                 //根据教师编号将对应结算方式下的默认课酬设置分组
@@ -565,8 +569,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void updateVipGroupCourseTeacherSalary(Integer vipGroupId, Integer studentChangeNum) {
+    public void updateVipGroupCourseTeacherSalary(Integer vipGroupId, Integer studentChangeNum, VipGroupStatusEnum vipGroupStatusEnum) {
         VipGroup vipGroup = vipGroupService.get(vipGroupId.longValue());
+        if(Objects.isNull(vipGroupStatusEnum)){
+            vipGroupStatusEnum=vipGroup.getStatus();
+        }
         Integer studentNum = classGroupStudentMapperDao.countGroupStudentNum(vipGroupId.toString(), GroupType.VIP.getCode());
         Integer oldStudentNum = studentNum-studentChangeNum;
         if(oldStudentNum<0){
@@ -575,7 +582,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         ClassGroupTeacherSalary classGroupTeacherSalary = classGroupTeacherSalaryDao.findByVipGoupAndTeacher(vipGroupId, vipGroup.getUserId());
         BigDecimal onlineTeacherSalary,
                 offlineTeacherSalary;
-        if(oldStudentNum==0||Objects.isNull(classGroupTeacherSalary)){
+        if((oldStudentNum==0&&!vipGroupStatusEnum.equals(VipGroupStatusEnum.APPLYING))
+                ||Objects.isNull(classGroupTeacherSalary)){
             TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId(),
                     vipGroup.getVipGroupCategoryId());
             VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -789,14 +789,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
 
 //            //生成课程协议
-            contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(),studentRegistration.getMusicGroupId());
+            /*contractService.transferMusicGroupCoursesContract(studentRegistration.getUserId(),studentRegistration.getMusicGroupId());
             //商品协议(租赁时候有)
             if(musicOneSubjectClassPlan.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)){
                 StudentPaymentOrderDetail applyOrderMusical = studentPaymentOrderDetailService.findApplyOrderMusical(studentPaymentOrder.getId());
                 if(applyOrderMusical != null && applyOrderMusical.getGoodsIdList() != null && !applyOrderMusical.getGoodsIdList().equals("")){
                     contractService.transferGoodsContract(studentPaymentOrder.getUserId(),studentPaymentOrder.getMusicGroupId(),applyOrderMusical.getGoodsIdList(),musicOneSubjectClassPlan.getKitGroupPurchaseType());
                 }
-            }
+            }*/
         }
 
 

+ 123 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -109,6 +109,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	private ContractService contractService;
 	@Autowired
     private TeacherService teacherService;
+	@Autowired
+	private StudentPauseInfoDao studentPauseInfoDao;
 
 	private static final Logger LOGGER = LoggerFactory
 			.getLogger(VipGroup.class);
@@ -834,6 +836,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
 		}
 
+		if(Objects.isNull(vipGroupActivity.getType())){
+            throw new BizException("此活动未设置活动类型");
+        }
+
 		if(computeTotalPrice){
 			//课程购买费用计算
 			BigDecimal totalPrice;
@@ -1044,7 +1050,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				throw new BizException("用户账户找不到");
 			}
 			studentPaymentOrder.setPaymentChannel("BALANCE");
-			if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() > 0){
+			if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() >= 0){
 				// 更新订单信息
 				studentPaymentOrder.setActualAmount(new BigDecimal(0));
 				studentPaymentOrder.setBalancePaymentAmount(amount);
@@ -1074,7 +1080,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			try {
 				contractService.register(user.getId(),user.getRealName(),user.getIdCardNo(),user.getPhone());
 			} catch (Exception e) {
-				e.printStackTrace();
+				LOGGER.error("[{}]小课购买协议生成错误:{}", vipGroup.getId(), e.getCause());
 			}
 		}
 
@@ -1142,7 +1148,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		try {
 			updateVipGroupStudentNumAndStatus(vipGroupId, classGroup,0,true);
 		} catch (Exception e) {
-			LOGGER.error("小课[{}]开课失败",vipGroupId);
+			LOGGER.error("小课[{}]开课失败:{}",vipGroupId,e.getCause());
 		}
 
 		SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
@@ -1195,7 +1201,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		try {
 			contractService.transferVipGroupCoursesContract(userId,vipGroupId);
 		} catch (Exception e) {
-			LOGGER.error("小课[{}]开课失败:",vipGroupId,e.getMessage());
+			LOGGER.error("小课[{}]购买协议错误:{}",vipGroupId,e.getMessage(),e.getMessage());
 		}
 	}
 
@@ -1272,6 +1278,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("当前学生已经是退学状态");
 		}
 
+        if(classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)){
+            throw new BizException("当前学生已是休学状态");
+        }
+
 		sysUserCashAccountService.updateBalance(studentId, amount);
 		SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);
 		SysUserCashAccountDetail sysUserCashAccountDetail = new SysUserCashAccountDetail();
@@ -1293,16 +1303,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
         }
 
-        courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1);
+        if(!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
+			courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1, vipGroup.getStatus());
+		}
 
 		//学员退出班级群
 		ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
-		imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, null));
+		imFeignService.groupQuit(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, null));
 	}
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void quitForStudent(Long vipGroupId, Integer studentId) {
+	public void pauseForStudent(Long vipGroupId, Integer studentId) {
 		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
 			throw new BizException("请指定小课与学生");
 		}
@@ -1338,26 +1350,112 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("当前学生已是休学状态");
 		}
 
-//		sysUserCashAccountService.updateBalance(studentId, amount);
+        BigDecimal surplusCourseFee = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
 
+		Map<String, Object> pauseInfos = new HashMap<>();
+		//学生剩余课时
+        List<StudentCourseInfoDto> userSurplusCourseInfoByGroup = courseScheduleDao.findUserSurplusCourseInfoByGroup(GroupType.VIP, vipGroupId.toString(), studentId);
+        int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
+        List<BigDecimal> coursePrices = new ArrayList<>();
+        for (int i=0;i<userSurplusCourseInfoByGroup.size();i++) {
+            teachModeSequence[i] = userSurplusCourseInfoByGroup.get(i).getTeachMode().equals(TeachModeEnum.ONLINE)?1:0;
+			coursePrices.add(userSurplusCourseInfoByGroup.get(i).getExpectPrice());
+        }
+        pauseInfos.put("teaChModeSequence", Arrays.toString(teachModeSequence));
+        pauseInfos.put("coursePriceInfo",coursePrices);
+
+        StudentPauseInfo  studentPauseInfo=new StudentPauseInfo();
+		studentPauseInfo.setUserId(studentId);
+		studentPauseInfo.setGroupType(GroupType.VIP);
+		studentPauseInfo.setMusicGroupId(vipGroup.getId().intValue());
+		studentPauseInfo.setClassGroupId(classGroup.getId());
+        studentPauseInfo.setCoursesJson(JSON.toJSONString(pauseInfos));
+
+        studentPauseInfoDao.insert(studentPauseInfo);
+
+        sysUserCashAccountService.updateCourseBalance(studentId, surplusCourseFee);
 		classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT_SCHOOL);
 		classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
 
-		courseScheduleService.batchDeleteMusicGroupCourseWithStudent(vipGroupId.toString(),studentId,GroupType.VIP);
-
 		List<Integer> studentPaymentIds = courseScheduleStudentPaymentDao.findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent(classGroup.getId(), studentId);
 		if(!CollectionUtils.isEmpty(studentPaymentIds)){
 			courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
 		}
 
-		courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1);
+	}
 
-		//学员退出班级群
-		ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
-		imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, null));
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void recoverForStudent(Long vipGroupId, Integer studentId) {
+		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
+			throw new BizException("请指定小课与学生");
+		}
+		VipGroup vipGroup=vipGroupDao.get(vipGroupId);
+		if(Objects.isNull(vipGroup)){
+			throw new BizException("指定的课程不存在");
+		}
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
+			throw new BizException("不能对已停止的课程进行此操作");
+		}
+		if(vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)){
+			throw new BizException("此课程已结束");
+		}
+		List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
+		if(!CollectionUtils.isEmpty(studentApplyRefunds)){
+			throw new BizException("此学生存在退课申请,请到系统日志中查看");
+		}
+
+		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
+
+		ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
+				studentId);
+
+		if(Objects.isNull(classStudentMapperByUserIdAndClassGroupId)){
+			throw new BizException("指定学生不在此课程中");
+		}
+
+		if(!classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)){
+			throw new BizException("当前学生不是休学状态");
+		}
+
+		StudentPauseInfo studentPauseInfo = studentPauseInfoDao.findByGroupAndUser(GroupType.VIP, vipGroupId.toString(), studentId);
+		Map<String, Object> courseInfo = JSON.parseObject(studentPauseInfo.getCoursesJson(), Map.class);
+		List<BigDecimal> coursePrices = (List<BigDecimal>) courseInfo.get("coursePriceInfo");
+		coursePrices.sort(Comparator.naturalOrder());
+
+		BigDecimal surplusCourseFee = new BigDecimal(0);
+
+		Date now=new Date();
+
+		List<CourseSchedule> surplusCourseWithGroup = courseScheduleDao.findSurplusCourseWithGroup(GroupType.VIP, vipGroupId.toString());
+		surplusCourseWithGroup.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
+
+		List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
+		for (int i=0;i<surplusCourseWithGroup.size();i++) {
+			CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+			courseScheduleStudentPayment.setGroupType(GroupType.VIP);
+			courseScheduleStudentPayment.setMusicGroupId(vipGroupId.toString());
+			courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
+			courseScheduleStudentPayment.setCourseScheduleId(surplusCourseWithGroup.get(i).getId());
+			courseScheduleStudentPayment.setUserId(studentId);
+			courseScheduleStudentPayment.setExpectPrice(coursePrices.get(i));
+			courseScheduleStudentPayment.setCreateTime(now);
+			courseScheduleStudentPayment.setUpdateTime(now);
+			courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
+			courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+			surplusCourseFee.add(coursePrices.get(i));
+		}
+		if(!CollectionUtils.isEmpty(courseScheduleStudentPaymentList)){
+			courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
+		}
+		sysUserCashAccountService.updateCourseBalance(studentId, surplusCourseFee);
+		classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+		classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
+		studentPauseInfo.setDelFlag(1);
+		studentPauseInfoDao.update(studentPauseInfo);
 	}
 
-	@Override
+    @Override
 	@Transactional(rollbackFor = Exception.class)
 	public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
 		if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
@@ -1390,7 +1488,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("未找到对应班级");
 		}
 		BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
-		result.put("suplusCourseFee",Objects.isNull(bigDecimal)?new BigDecimal(0):bigDecimal);
+		if(Objects.isNull(bigDecimal)){
+			bigDecimal = new BigDecimal(0);
+		}
+		bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
+		result.put("suplusCourseFee", bigDecimal);
 		return result;
 	}
 
@@ -1457,7 +1559,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				courseScheduleService.batchDeleteMusicGroupCourseWithStudent(studentPaymentOrder.getMusicGroupId(),studentApplyRefunds.getUserId(),GroupType.VIP);
 
 
-				courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(Integer.parseInt(studentPaymentOrder.getMusicGroupId()),-1);
+				courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(Integer.parseInt(studentPaymentOrder.getMusicGroupId()),-1, null);
 
 				//学员退出班级群
 				ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentApplyRefunds.getUserId().toString())};
@@ -1887,6 +1989,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
 		classGroupService.updateClassGroupInfo(classGroup.getId());
 
+
 		ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
 		imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(),
 				imGroupMembers, classGroup.getName()));
@@ -2115,6 +2218,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
 		}
 
+		VipGroupStatusEnum vipGroupStatus = vipGroup.getStatus();
+
         Integer currentStudentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
 		if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
             &&currentStudentNum.compareTo(classGroup.getExpectStudentNum())>=0){
@@ -2125,7 +2230,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		classGroupDao.update(classGroup);
 		classGroupService.updateClassGroupInfo(classGroup.getId());
 
-		courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),studentIds.size());
+		courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),studentIds.size(), vipGroupStatus);
 
 		try {
 			ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);

+ 2 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -145,6 +145,8 @@
     </select>
     <select id="findStudentByCourse" resultMap="com.ym.mec.biz.dal.dao.StudentAttendanceDao.studentAttendanceViewUtilEntity">
         SELECT
+            cssp.group_type_,
+            cssp.music_group_id_,
             su.id_ student_id_,
             su.username_,
             su.avatar_,

+ 70 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -67,6 +67,22 @@
         <result column="rest_of_class_" property="restOfClass"/>
         <result column="class_group_id_" property="classGroupId"/>
     </resultMap>
+
+    <resultMap type="com.ym.mec.biz.dal.dto.StudentCourseInfoDto" id="StudentCourseInfoDto">
+        <constructor>
+            <arg column="class_date_" javaType="string"/>
+            <arg column="start_class_time_" javaType="string"/>
+            <arg column="end_class_time_" javaType="string"/>
+        </constructor>
+        <result column="id_" property="id"/>
+        <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="class_group_id_" property="classGroupId"/>
+        <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="actual_teacher_id_" property="actualTeacherId"/>
+        <result column="teach_mode_" property="teachMode" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="expect_price_" property="expectPrice"/>
+    </resultMap>
     
     <resultMap type="com.ym.mec.biz.dal.entity.StudentAttendance" id="StudentAttendance">
         <result column="music_group_id_" property="musicGroupId"/>
@@ -1682,4 +1698,58 @@
         AND cs.status_ = 'NOT_START'
         GROUP BY cs.class_group_id_
     </select>
+
+    <select id="findUserSurplusCourseInfoByGroup" resultMap="StudentCourseInfoDto">
+        SELECT
+            cs.id_,
+            cs.music_group_id_,
+            cs.class_group_id_,
+            cs.status_,
+            cs.class_date_,
+            cs.start_class_time_,
+            cs.end_class_time_,
+            cs.actual_teacher_id_,
+            cs.teach_mode_,
+            cssp.expect_price_
+        FROM
+            course_schedule cs
+            LEFT JOIN course_schedule_student_payment cssp ON cs.id_ = cssp.course_schedule_id_
+        WHERE
+            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
+            AND cs.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) > NOW()
+            AND cs.music_group_id_ = #{groupId}
+            AND cssp.user_id_=#{userId}
+    </select>
+    <select id="getMinCourseTime" resultType="java.util.Date">
+        SELECT MIN(CONCAT(class_date_,' ',start_class_time_))
+        FROM course_schedule
+        WHERE group_type_=#{groupType}
+        AND music_group_id_=#{groupId}
+    </select>
+    <select id="getMaxCourseTime" resultType="java.util.Date">
+        SELECT MAX(CONCAT(class_date_,' ',start_class_time_))
+        FROM course_schedule
+        WHERE group_type_=#{groupType}
+        AND music_group_id_=#{groupId}
+    </select>
+    <select id="findSurplusCourseWithGroup" resultMap="CourseSchedule">
+        SELECT
+            cs.id_,
+            cs.music_group_id_,
+            cs.class_group_id_,
+            cs.status_,
+            cs.class_date_,
+            CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) start_class_time_,
+            cs.end_class_time_,
+            cs.actual_teacher_id_,
+            cs.teach_mode_
+        FROM
+            course_schedule cs
+        WHERE
+            (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
+            AND cs.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) > NOW()
+            AND cs.music_group_id_ = #{groupId}
+    </select>
 </mapper>

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -258,6 +258,7 @@
 		<foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
 			#{courseScheduleId}
 		</foreach>
+		AND mg.settlement_type_ IS NOT NULL
 	</select>
 	<select id="findMusicGroupChargeTypeByCourse" resultType="map">
 		SELECT

+ 1 - 0
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -132,6 +132,7 @@
         <result property="studentId" column="student_id_"/>
         <result property="userName" column="username_"/>
         <result property="musicGroupId" column="music_group_id_"/>
+        <result property="groupType" column="group_type_"/>
         <result property="subjectId" column="subject_id_"/>
         <result property="subjectName" column="subject_name_"/>
         <result property="avatar" column="avatar_"/>

+ 88 - 0
mec-biz/src/main/resources/config/mybatis/StudentPauseInfoMapper.xml

@@ -0,0 +1,88 @@
+<?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="com.ym.mec.biz.dal.dao.StudentPauseInfoDao">
+
+    <resultMap type="com.ym.mec.biz.dal.entity.StudentPauseInfo" id="StudentPauseInfo">
+        <result column="id_" property="id"/>
+        <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="class_group_id_" property="classGroupId"/>
+        <result column="user_id_" property="userId"/>
+        <result column="courses_json_" property="coursesJson"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+        <result column="del_flag_" property="delFlag"/>
+    </resultMap>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="StudentPauseInfo">
+		SELECT * FROM student_pause_info WHERE id_ = #{id}
+	</select>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="StudentPauseInfo">
+		SELECT * FROM student_pause_info WHERE del_flag_ = 0 ORDER BY id_
+	</select>
+
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentPauseInfo" useGeneratedKeys="true"
+            keyColumn="id"
+            keyProperty="id">
+        INSERT INTO student_pause_info (group_type_,music_group_id_,class_group_id_,user_id_,courses_json_,create_time_,update_time_)
+        VALUES(#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{classGroupId},#{userId},#{coursesJson},now(),now())
+    </insert>
+
+    <!-- 根据主键查询一条记录 -->
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentPauseInfo">
+        UPDATE student_pause_info
+        <set>
+            <if test="delFlag != null">
+                group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
+            <if test="classGroupId != null">
+                class_group_id_ = #{classGroupId},
+            </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
+            <if test="coursesJson != null">
+                courses_json_ = #{coursesJson},
+            </if>
+            <if test="delFlag != null">
+                del_flag_ = #{delFlag},
+            </if>
+            update_time_ = NOW()
+        </set>
+        WHERE id_ = #{id}
+    </update>
+
+    <!-- 根据主键删除一条记录 -->
+    <delete id="delete">
+		DELETE FROM student_pause_info WHERE id_ = #{id}
+	</delete>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="StudentPauseInfo" parameterType="map">
+        SELECT * FROM student_pause_info
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM student_pause_info
+	</select>
+    <select id="findByGroupAndUser" resultMap="StudentPauseInfo">
+        SELECT * FROM student_pause_info
+        WHERE group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            AND music_group_id_ = #{groupId}
+            AND user_id_ = #{userId}
+            AND del_flag_ = 0
+    </select>
+</mapper>

+ 13 - 0
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -185,4 +185,17 @@
     <select id="findNames" resultType="java.lang.String">
         SELECT GROUP_CONCAT(DISTINCT s.name_) FROM `subject` s WHERE FIND_IN_SET(s.id_,#{subjectIdList})
     </select>
+    <select id="findStudentSubjectNameMaps" resultType="java.util.Map">
+        SELECT
+            sr.user_id_ as 'key',
+            s.name_ as 'value'
+        FROM
+            student_registration sr
+            LEFT JOIN `subject` s ON sr.subject_id_ = s.id_
+        WHERE 1=1
+        AND
+        <foreach collection="studentInfos" item="student" open="(" close=")" separator=" OR ">
+            sr.user_id_=#{student.studentId} AND sr.music_group_id_=#{student.musicGroupId}
+        </foreach>
+    </select>
 </mapper>

+ 5 - 1
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -492,7 +492,11 @@
             suaa.course_balance_,
             cgsm.create_time_,
             cgsm.update_time_,
-            CASE cgsm.status_ WHEN 'QUIT' THEN 1 ELSE 0 END student_status_
+            CASE cgsm.status_
+              WHEN 'QUIT' THEN 1
+              WHEN 'QUIT_SCHOOL' THEN 3
+              ELSE 0
+              END student_status_
         FROM
             class_group cg
             LEFT JOIN class_group_student_mapper cgsm ON cg.id_=cgsm.class_group_id_

+ 63 - 4
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -2,23 +2,28 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 import com.ym.mec.biz.dal.dto.StudentHasCourseDto;
 import com.ym.mec.biz.dal.dto.TeacherSalaryDto;
 import com.ym.mec.biz.dal.dto.musicalListDetailDto;
+import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
+import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
-import com.ym.mec.biz.service.StudentManageService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -27,6 +32,8 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -45,6 +52,10 @@ public class ExportController extends BaseController {
     private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
     @Autowired
     private SysUserFeignService sysUserFeignService;
+    @Autowired
+    private EmployeeDao employeeDao;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
 
     @ApiOperation(value = "导出学员是否有课")
     @PostMapping("export/studentHasCourse")
@@ -141,4 +152,52 @@ public class ExportController extends BaseController {
         }
     }
 
+    @ApiOperation(value = "订单列表导出")
+    @RequestMapping("order/orderList")
+    @PreAuthorize("@pcs.hasPermissions('order/orderList')")
+    public void orderList(StudentPaymentOrderQueryInfo queryInfo, HttpServletResponse response) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (!sysUser.getIsSuperAdmin()) {
+            Employee employee = employeeDao.get(sysUser.getId());
+            if (StringUtils.isEmpty(queryInfo.getOrganId())) {
+                queryInfo.setOrganId(employee.getOrganIdList());
+            }
+        }
+
+        PageInfo<StudentPaymentOrder> studentPaymentOrderPageInfo = studentPaymentOrderService.queryPage(queryInfo);
+
+        for (StudentPaymentOrder row : studentPaymentOrderPageInfo.getRows()) {
+            BigDecimal balancePaymentAmount = row.getBalancePaymentAmount() == null ? BigDecimal.ZERO : row.getBalancePaymentAmount();
+            if (queryInfo.getOrderType().equals(1)) {
+                BigDecimal comAmount = row.getComAmount() == null ? BigDecimal.ZERO : row.getComAmount();
+                row.setExpectAmount(comAmount.add(balancePaymentAmount));
+                row.setActualAmount(comAmount.add(balancePaymentAmount));
+            }else {
+                BigDecimal perAmount = row.getPerAmount() == null ? BigDecimal.ZERO : row.getPerAmount();
+                row.setExpectAmount(perAmount.add(balancePaymentAmount));
+                row.setActualAmount(perAmount.add(balancePaymentAmount));
+            }
+            if(row.getGroupType().equals(GroupType.SPORADIC)){
+                row.setSporadicAmount(row.getActualAmount());
+                row.setExpectAmount(BigDecimal.ZERO);
+                row.setActualAmount(BigDecimal.ZERO);
+            }
+        }
+
+        try {
+            String[] header = {"序号", "学生姓名", "交易流水号", "订单编号", "收款渠道", "收款账户", "支付金额", "到账时间",
+            "关联乐团ID/VIP课ID","课程形态","押金","乐器","教辅费用","零星收款费用","零星收款类别","手续费","专业","分部","单位/学校","备注"};
+            String[] body = {"id", "user.username", "transNo", "orderNo", "paymentChannel", "merNos", "actualAmount", "payTime", "musicGroupId",
+            "groupType",    "groupType","groupType","groupType","SporadicAmount","SporadicAmount","groupType","groupType","groupType","groupType","memo"};
+            HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPaymentOrderPageInfo.getRows());
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            workbook.write(response.getOutputStream());
+            workbook.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
 }

+ 16 - 0
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -149,6 +149,22 @@ public class VipGroupManageController extends BaseController {
         return succeed(vipGroupService.findVipGroupAttendances(queryInfo));
     }
 
+    @ApiOperation(value = "休学")
+    @PostMapping("/pauseForStudent")
+    @PreAuthorize("@pcs.hasPermissions('vipGroupManage/pauseForStudent')")
+    public Object pauseForStudent(Long vipGroupId,Integer studentId){
+        vipGroupService.pauseForStudent(vipGroupId,studentId);
+        return succeed();
+    }
+
+    @ApiOperation(value = "恢复休学")
+    @PostMapping("/recoverForStudent")
+    @PreAuthorize("@pcs.hasPermissions('vipGroupManage/recoverForStudent')")
+    public Object recoverForStudent(Long vipGroupId,Integer studentId){
+        vipGroupService.recoverForStudent(vipGroupId,studentId);
+        return succeed();
+    }
+
     @ApiOperation(value = "退课申请")
     @PostMapping("/applyRefundForStudent")
     @PreAuthorize("@pcs.hasPermissions('vipGroupManage/applyRefundForStudent')")

+ 2 - 2
pom.xml

@@ -260,7 +260,7 @@
 				<filtering>true</filtering>
 				<excludes>
 					<exclude>**/*.ttf</exclude>
-					<exclude>**/*.woff</exclude>
+					<exclude>**/*.ttc</exclude>
 				</excludes>
 			</resource>
 			<resource>
@@ -268,7 +268,7 @@
 				<filtering>false</filtering>
 				<includes>
 					<include>**/*.ttf</include>
-					<include>**/*.woff</include>
+					<include>**/*.ttc</include>
 				</includes>
 			</resource>
 		</resources>