zouxuan před 2 roky
rodič
revize
ce8a5bf752
38 změnil soubory, kde provedl 871 přidání a 718 odebrání
  1. 3 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ActivityUserMapperDao.java
  2. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherFreeCourseDao.java
  3. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  4. 0 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  5. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java
  6. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganCourseTypeOriginalCostDao.java
  7. 64 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CheckScheduleQualificationDto.java
  8. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ActivityUserMapper.java
  9. 92 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherFreeCourse.java
  10. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java
  11. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentStudentCourseDetail.java
  12. 149 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportCloud.java
  13. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/service/ActivityUserMapperService.java
  14. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  15. 0 19
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java
  16. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java
  17. 0 41
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  18. 61 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ActivityUserMapperServiceImpl.java
  19. 0 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  20. 2 30
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java
  21. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  22. 20 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  23. 30 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  24. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  25. 0 302
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  26. 88 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java
  27. 29 174
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  28. 18 14
      mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml
  29. 80 0
      mec-biz/src/main/resources/config/mybatis/CloudTeacherFreeCourseMapper.xml
  30. 3 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  31. 2 20
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  32. 7 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml
  33. 86 0
      mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml
  34. 9 0
      mec-biz/src/main/resources/config/mybatis/OrganCourseTypeOriginalCostMapper.xml
  35. 0 22
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  36. 7 12
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  37. 1 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ActivityUserMapperController.java
  38. 0 8
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

+ 3 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ActivityUserMapperDao.java

@@ -1,11 +1,9 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.ActivityStudentDto;
-import com.ym.mec.biz.dal.dto.ActivityUserDto;
-import com.ym.mec.biz.dal.dto.CourseFormDto;
-import com.ym.mec.biz.dal.dto.ExportStudentSubCourse;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ActivityUserMapper;
 import com.ym.mec.biz.dal.page.ActivityUserQueryInfo;
+import com.ym.mec.biz.service.impl.ActivityUserMapperServiceImpl;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
@@ -119,9 +117,7 @@ public interface ActivityUserMapperDao extends BaseDAO<Integer, ActivityUserMapp
     */
     List<Integer> queryActivityCourseTimeList(@Param("queryInfo") ActivityUserQueryInfo activityUserQueryInfo);
 
-    List<ActivityUserMapper> findTotalByStudents(@Param("studentIdList") List<Integer> studentIdList,
-                                            @Param("categoryId") Integer categoryId,
-                                            @Param("classMinutes") Integer classMinutes);
+    List<ActivityUserMapper> findTotalByStudents(@Param("dto") CheckScheduleQualificationDto checkScheduleQualificationDto);
     List<ActivityUserMapper> findByStudents(@Param("studentIdList") List<Integer> studentIdList,
                                             @Param("categoryId") Integer categoryId,
                                             @Param("classMinutes") Integer classMinutes);
@@ -132,7 +128,6 @@ public interface ActivityUserMapperDao extends BaseDAO<Integer, ActivityUserMapp
 
     void batchUpdate(@Param("useActivityUserMappers") List<ActivityUserMapper> useActivityUserMappers);
     void batchUpdateFree(@Param("useActivityUserMappers") List<ActivityUserMapper> useActivityUserMappers);
-    void batchUpdate1(@Param("useActivityUserMappers") List<ActivityUserMapper> useActivityUserMappers);
 
     List<ActivityUserMapper> findByIds(@Param("activityUserMapperIds") String activityUserMapperIds);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherFreeCourseDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse;
+
+public interface CloudTeacherFreeCourseDao extends BaseDAO<Long, CloudTeacherFreeCourse> {
+
+	
+}

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -1945,4 +1945,13 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     * @date 2022/8/15 17:01
     */
     List<CourseScheduleStudentDto> queryDetailList(@Param("queryInfo") CourseDetailQueryInfo courseDetailQueryInfo);
+
+    /**
+    * @description: 标记云教练课程
+     * @param courseIds
+    * @return void
+    * @author zx
+    * @date 2022/9/6 14:07
+    */
+    void markFreeCourse(@Param("courseIds") String courseIds);
 }

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -40,14 +40,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
 
 
     /**
-     * 批量插入
-     *
-     * @param musicGroupPaymentCalenderList
-     * @return
-     */
-    int batchInsert(List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList);
-
-    /**
      * 查询指定状态的记录
      *
      * @param status

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface OperatingReportCloudDao extends BaseDAO<Integer, OperatingReportCloud> {
+
+
+    void batchInsert(@Param("operatingReportClouds") List<OperatingReportCloud> operatingReportClouds);
+
+    OperatingReportCloud findByCalenderId(@Param("calenderId") Long calenderId, @Param("userId") Integer userId);
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganCourseTypeOriginalCostDao.java

@@ -2,7 +2,15 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.OrganCourseTypeOriginalCost;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
 
 public interface OrganCourseTypeOriginalCostDao extends BaseDAO<Integer, OrganCourseTypeOriginalCost> {
 
+    //获取对应分部课程类型成本价
+    BigDecimal findByOrganIdAndCourseType(@Param("organId") Integer organId, @Param("courseType") String courseType);
+
+    //计算课程成本价
+    BigDecimal getCourseCostPrice(@Param("courseIds") String courseIds);
 }

+ 64 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CheckScheduleQualificationDto.java

@@ -0,0 +1,64 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.List;
+
+public class CheckScheduleQualificationDto {
+    private List<Integer> studentIdList;
+
+    private Integer categoryId;
+
+    private Integer classMinutes;
+
+    private Integer courseNum;
+
+    private Long groupId;
+
+    public CheckScheduleQualificationDto(List<Integer> studentIdList, Integer categoryId, Integer classMinutes, Integer courseNum, Long groupId) {
+        this.studentIdList = studentIdList;
+        this.categoryId = categoryId;
+        this.classMinutes = classMinutes;
+        this.courseNum = courseNum;
+        this.groupId = groupId;
+    }
+
+    public List<Integer> getStudentIdList() {
+        return studentIdList;
+    }
+
+    public void setStudentIdList(List<Integer> studentIdList) {
+        this.studentIdList = studentIdList;
+    }
+
+    public Integer getCategoryId() {
+        return categoryId;
+    }
+
+    public void setCategoryId(Integer categoryId) {
+        this.categoryId = categoryId;
+    }
+
+    public Integer getClassMinutes() {
+        return classMinutes;
+    }
+
+    public void setClassMinutes(Integer classMinutes) {
+        this.classMinutes = classMinutes;
+    }
+
+    public Integer getCourseNum() {
+        return courseNum;
+    }
+
+    public void setCourseNum(Integer courseNum) {
+        this.courseNum = courseNum;
+    }
+
+    public Long getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(Long groupId) {
+        this.groupId = groupId;
+    }
+
+}

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

@@ -115,6 +115,17 @@ public class ActivityUserMapper extends BaseEntity {
 	@ApiModelProperty(value = "赠送的优惠券编号")
 	private Integer giveCouponId;
 
+	@ApiModelProperty(value = "关联的云教练缴费项目编号")
+	private Long calenderId;
+
+	public Long getCalenderId() {
+		return calenderId;
+	}
+
+	public void setCalenderId(Long calenderId) {
+		this.calenderId = calenderId;
+	}
+
 	public BigDecimal getCurrentCoursePrice() {
 		return currentCoursePrice;
 	}

+ 92 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherFreeCourse.java

@@ -0,0 +1,92 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(cloud_teacher_free_course):
+ */
+public class CloudTeacherFreeCourse {
+
+	/**  */
+	private Long id;
+	
+	/** 课程编号 */
+	private Long courseId;
+	
+	/** 学员缴费项目详情编号 */
+	private Integer calenderDetailId;
+	
+	/** 课程成本 */
+	private java.math.BigDecimal cost;
+	
+	/** 是否结算经营报表 */
+	private Integer operatingFlag;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setCourseId(Long courseId){
+		this.courseId = courseId;
+	}
+	
+	public Long getCourseId(){
+		return this.courseId;
+	}
+			
+	public void setCalenderDetailId(Integer calenderDetailId){
+		this.calenderDetailId = calenderDetailId;
+	}
+	
+	public Integer getCalenderDetailId(){
+		return this.calenderDetailId;
+	}
+			
+	public void setCost(java.math.BigDecimal cost){
+		this.cost = cost;
+	}
+	
+	public java.math.BigDecimal getCost(){
+		return this.cost;
+	}
+			
+	public void setOperatingFlag(Integer operatingFlag){
+		this.operatingFlag = operatingFlag;
+	}
+	
+	public Integer getOperatingFlag(){
+		return this.operatingFlag;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

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

@@ -59,6 +59,17 @@ public class CourseScheduleStudentPayment extends BaseEntity implements Comparab
 	@ApiModelProperty(value = "如果是活动排课,那么这里关联的是学员排课资格编号",required = false)
 	private Integer activityUserMapperId;
 
+	@ApiModelProperty(value = "关联的云教练缴费项目编号",required = false)
+	private Long calenderId;
+
+	public Long getCalenderId() {
+		return calenderId;
+	}
+
+	public void setCalenderId(Long calenderId) {
+		this.calenderId = calenderId;
+	}
+
 	public Integer getActivityUserMapperId() {
 		return activityUserMapperId;
 	}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentStudentCourseDetail.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.entity;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.common.entity.BaseEntity;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
@@ -38,6 +39,17 @@ public class MusicGroupPaymentStudentCourseDetail extends BaseEntity {
 
 	/**  已消耗时长*/
 	private Integer usedCourseMinutes;
+
+	@ApiModelProperty(value = "标记是否云教练缴费项目",required = false)
+	private Boolean cloudTeacherPaymentFlag = false;
+
+	public Boolean getCloudTeacherPaymentFlag() {
+		return cloudTeacherPaymentFlag;
+	}
+
+	public void setCloudTeacherPaymentFlag(Boolean cloudTeacherPaymentFlag) {
+		this.cloudTeacherPaymentFlag = cloudTeacherPaymentFlag;
+	}
 	
 	/**  */
 	private java.util.Date createTime;

+ 149 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportCloud.java

@@ -0,0 +1,149 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.math.BigDecimal;
+
+/**
+ * 对应数据库表(operating_report_cloud):用于记录云教练缴费,相关课程和云教练预收
+ */
+public class OperatingReportCloud {
+
+	/**  */
+	private Integer id;
+	
+	/** 缴费项目关联的课程编号 */
+	private String courseIds;
+
+	/** 分部编号 */
+	private Integer organId;
+	
+	/** 学员编号 */
+	private Integer userId;
+
+	/** 缴费项目编号 */
+	private Long calenderId;
+	
+	/** 云教练预收开始计费时间(该字段只会再结算经营报表的时候去更新,因为课程会不断调整,结算的时候取缴费项目关联的课程的第一节课的日期) */
+	private java.util.Date startDate;
+	
+	/** 云教练预收截止计费时间 */
+	private java.util.Date endDate;
+	
+	/** 云教练预收 */
+	private java.math.BigDecimal cloudPrice = BigDecimal.ZERO;
+	
+	/** 课程预收 */
+	private java.math.BigDecimal coursePrice = BigDecimal.ZERO;
+	
+	/** 月底结算经营报表的标识,如果已经结算过,那么这条记录不会再修改 */
+	private Boolean settlementFlag = false;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+
+	public String getCourseIds() {
+		return courseIds;
+	}
+
+	public void setCourseIds(String courseIds) {
+		this.courseIds = courseIds;
+	}
+
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setOrganId(Integer organId){
+		this.organId = organId;
+	}
+	
+	public Integer getOrganId(){
+		return this.organId;
+	}
+
+	public Long getCalenderId() {
+		return calenderId;
+	}
+
+	public void setCalenderId(Long calenderId) {
+		this.calenderId = calenderId;
+	}
+
+	public void setStartDate(java.util.Date startDate){
+		this.startDate = startDate;
+	}
+	
+	public java.util.Date getStartDate(){
+		return this.startDate;
+	}
+			
+	public void setEndDate(java.util.Date endDate){
+		this.endDate = endDate;
+	}
+	
+	public java.util.Date getEndDate(){
+		return this.endDate;
+	}
+			
+	public void setCloudPrice(java.math.BigDecimal cloudPrice){
+		this.cloudPrice = cloudPrice;
+	}
+	
+	public java.math.BigDecimal getCloudPrice(){
+		return this.cloudPrice;
+	}
+			
+	public void setCoursePrice(java.math.BigDecimal coursePrice){
+		this.coursePrice = coursePrice;
+	}
+	
+	public java.math.BigDecimal getCoursePrice(){
+		return this.coursePrice;
+	}
+
+	public Boolean getSettlementFlag() {
+		return settlementFlag;
+	}
+
+	public void setSettlementFlag(Boolean settlementFlag) {
+		this.settlementFlag = settlementFlag;
+	}
+
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 1 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/ActivityUserMapperService.java

@@ -177,9 +177,7 @@ public interface ActivityUserMapperService extends BaseService<Integer, Activity
     * @author zx
     * @date 2022/7/27 14:23
     */
-    List<CourseScheduleStudentPayment> use(Integer categoryId,Integer classMinutes,
-                                           int courseNum,
-                                           Long groupId,List<Integer> studentIdList);
+    List<CourseScheduleStudentPayment> use(CheckScheduleQualificationDto checkScheduleQualificationDto);
 
     /**
     * @description: 网管课活动排课

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
@@ -20,6 +21,7 @@ import java.util.List;
 import java.util.Map;
 
 public interface CourseScheduleService extends BaseService<Long, CourseSchedule> {
+	CourseScheduleDao getDao();
 	
 	/**
 	 * 查询课程信息

+ 0 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -6,7 +6,6 @@ import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
 import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
 import com.ym.mec.biz.dal.page.MusicMemberQueryInfo;
 import com.ym.mec.common.entity.HttpResponseResult;
-import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -79,12 +78,6 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
      */
     HttpResponseResult pay(RegisterPayDto registerPayDto) throws Exception;
 
-    /**
-     * 继续缴费
-     * @param registerPayDto
-     * @return
-     */
-//	Map rePay(RegisterPayDto registerPayDto) throws Exception;
 
     /**
      * 获取学生所在乐团详情
@@ -319,13 +312,6 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
      */
     MusicGroup getMusicGroupDetail(String musicGroupId);
 
-    /**
-     * 获取乐团老师列表
-     *
-     * @param musicGroupId
-     * @return
-     */
-    List<ImGroupMember> queryMusicGroupTeachers(String musicGroupId);
 
     /**
      * 乐团确认成立
@@ -403,11 +389,6 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
      */
     List<MusicCardDto> queryOrganMusicInfos(Integer organId);
 
-    /**
-     * 补全musicGroupStudentFee表数据
-     * @param musicGroupIds
-     */
-//	void musicGroupStudentFeePatch(List<String> musicGroupIds);
 
     /**
      * 给乐团添加报名学生

+ 36 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java

@@ -0,0 +1,36 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dao.OperatingReportCloudDao;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.List;
+
+public interface OperatingReportCloudService extends BaseService<Integer, OperatingReportCloud> {
+
+    OperatingReportCloudDao getDao();
+
+    /**
+    * @description: 缴费后,更新缴费项目关联的课程、云教练预收
+     * @param musicGroupPaymentCalender
+     * @param userId
+    * @return void
+    * @author zx
+    * @date 2022/9/6 10:09
+    */
+    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender,Integer userId);
+
+    /**
+    * @description: 乐团排课、活动排课,计算课程预收
+     * @param calenderId
+     * @param scheduleIdList
+     * @param userId
+    * @return void
+    * @author zx
+    * @date 2022/9/6 10:52
+    */
+    void updateSet(Long calenderId,Integer userId, String scheduleIdList);
+}

+ 0 - 41
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -68,14 +68,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
     List<MusicGroupSubjectPlan> getNoClassStuCountByMusicGroupId(String musicGroupId);
 
     /**
-     * 根据user_id 和 乐团id更新
-     *
-     * @param studentRegistration
-     * @return
-     */
-    Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration);
-
-    /**
      * 添加学生报名信息
      *
      * @param studentRegistration
@@ -167,14 +159,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
     List<StudentRegistration> findMusicGroupNoClassGroupStudent(String musicGroupId, Integer actualSubjectId);
 
     /**
-     * 根据id list 查询报名学生
-     *
-     * @param idList
-     * @return
-     */
-    List<StudentRegistration> findStudentListByIdList(List<Long> idList);
-
-    /**
      * 批量插入
      *
      * @param studentRegistrationList
@@ -184,16 +168,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 
 
     /**
-     * 根据userId 和班级id查询学生
-     *
-     * @param userId
-     * @param classGroupId
-     * @return
-     */
-    StudentRegistration findStudentByClassGroupIdAndUserId(Integer userId, Integer classGroupId);
-
-
-    /**
      * 查询乐团声部下的学生
      *
      * @return
@@ -217,21 +191,6 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     int openPayment(String ids) throws IOException;
 
-    /**
-     * 根据乐团编号获取已缴费学员列表
-     *
-     * @param musicGroupId
-     * @return
-     */
-    List<StudentRegistration> queryStudentByMusicGroupId(String musicGroupId);
-
-    /**
-     * 根据家长的手机号列表,获取用户编号
-     *
-     * @param parentPhones
-     * @return
-     */
-    List<Map<Integer, String>> findParentId(String parentPhones);
 
     /**
      * 更新用户注册信息

+ 61 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ActivityUserMapperServiceImpl.java

@@ -95,6 +95,12 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 	private ImGroupMemberService imGroupMemberService;
 	@Autowired
 	private ImUserFriendService imUserFriendService;
+	@Autowired
+	private OperatingReportCloudService operatingReportCloudService;
+	@Autowired
+	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	@Autowired
+	private MusicGroupPaymentCalenderActivityDao musicGroupPaymentCalenderActivityDao;
 
 	@Override
 	public BaseDAO<Integer, ActivityUserMapper> getDAO() {
@@ -315,6 +321,17 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 		Map<Integer, VipGroupActivity> collect = vipGroupActivities.stream().collect(Collectors.groupingBy(e -> e.getId(),
 				Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
 		List<ActivityUserMapper> activityUserMapperList = new ArrayList<>();
+		Long calenderId = null;
+		//如果是云教练缴费,并且小课包是0元那么标记为云教练赠送排课资格
+		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(studentPaymentOrder.getCalenderId());
+		if(musicGroupPaymentCalender.getCloudTeacherPaymentFlag()){
+			List<MusicGroupPaymentCalenderActivity> activities = musicGroupPaymentCalenderActivityDao.findByCalenderId(musicGroupPaymentCalender.getId());
+			BigDecimal reduce = activities.stream().map(e -> e.getActualAmount()).reduce(ZERO, BigDecimal::add);
+			if(reduce.compareTo(ZERO) == 0){
+				calenderId = studentPaymentOrder.getCalenderId();
+			}
+		}
+
 		for (StudentPaymentOrderDetail orderDetail : activity) {
 			ActivityUserMapper activityUserMapper = new ActivityUserMapper();
 			activityUserMapper.setTenantId(studentPaymentOrder.getTenantId());
@@ -327,6 +344,7 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 			activityUserMapper.setUserId(studentPaymentOrder.getUserId());
 			activityUserMapper.setTeacherId(student.getTeacherId());
 			activityUserMapper.setPaymentOrderId(studentPaymentOrder.getId());
+			activityUserMapper.setCalenderId(calenderId);
 			if(orderDetail.getType() == OrderDetailTypeEnum.VIP){
 				activityUserMapper.setVipFlag(1);
 			}else {
@@ -504,8 +522,8 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 		vipGroupDao.insert(applyBaseInfo);
 
 		//校验排课资格,消耗排课资格(获取被使用的排课资格)
-		List<CourseScheduleStudentPayment> courseScheduleStudentPayments =
-				this.checkScheduleQualification(studentIdList, vipGroupCategory.getId(), applyBaseInfo.getSingleClassMinutes(), courseNum, applyBaseInfo.getId());
+		CheckScheduleQualificationDto dto = new CheckScheduleQualificationDto(studentIdList, vipGroupCategory.getId(), applyBaseInfo.getSingleClassMinutes(), courseNum, applyBaseInfo.getId());
+		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = this.checkScheduleQualification(dto);
 
 		List<VipGroupStudentCoursePrice> vscps = vipGroup.getVipGroupApplyBaseInfo().getVipGroupStudentCoursePrices();
 		if (org.springframework.util.CollectionUtils.isEmpty(vscps)) {
@@ -657,6 +675,22 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 		}
 
 		if (courseScheduleStudentPayments.size() > 0) {
+			List<CourseScheduleStudentPayment> payments = courseScheduleStudentPayments.stream().filter(e -> e.getCalenderId() != null).collect(Collectors.toList());
+			if(CollectionUtils.isNotEmpty(payments)){
+				//更新课程预收
+				Map<Long,List<CourseScheduleStudentPayment>> map = payments.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCalenderId));
+				for (Long calenderId : map.keySet()) {
+					List<CourseScheduleStudentPayment> studentPayments = map.get(calenderId);
+					Map<Integer,String> userMap = studentPayments.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getUserId,
+							Collectors.collectingAndThen(Collectors.toList(),value->value.stream().map(e->e.getCourseScheduleId().toString()).collect(Collectors.joining(",")))));
+					userMap.keySet().stream().forEach(e-> operatingReportCloudService.updateSet(calenderId,e,userMap.get(e)));
+				}
+				//标记赠送课
+				String courseIdList = payments.stream().map(e -> e.getCourseScheduleId().toString()).collect(Collectors.joining(","));
+				if(StringUtils.isNotEmpty(courseIdList)){
+					courseScheduleService.getDao().markFreeCourse(courseIdList);
+				}
+			}
 			courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 			studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
 		}
@@ -671,30 +705,31 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 		return BaseController.succeed(applyBaseInfo.getAuditStatus().getCode());
     }
 
+
 	//校验排课资格并消耗
-	private List<CourseScheduleStudentPayment> checkScheduleQualification(List<Integer> studentIdList,Integer categoryId,Integer classMinutes,Integer courseNum,Long groupId) {
+	private List<CourseScheduleStudentPayment> checkScheduleQualification(CheckScheduleQualificationDto checkScheduleQualificationDto) {
 		//获取学员排课资格
-		List<ActivityUserMapper> totalActivityUserMappers = activityUserMapperDao.findTotalByStudents(studentIdList,categoryId,classMinutes);
+		List<ActivityUserMapper> totalActivityUserMappers = activityUserMapperDao.findTotalByStudents(checkScheduleQualificationDto);
 		if (CollectionUtils.isEmpty(totalActivityUserMappers)) {
 			throw new BizException("所选学员暂无排课资格");
 		}
 		totalActivityUserMappers.stream().collect(Collectors.groupingBy(ActivityUserMapper::getUserId,Collectors.collectingAndThen(Collectors.toList(), list -> {
 			Integer sum = list.stream().mapToInt(ActivityUserMapper::getSubCourseNum).sum();
-			if (sum < courseNum) {
+			if (sum < checkScheduleQualificationDto.getCourseNum()) {
 				throw new BizException("所选学员排课资格不足");
 			}
 			return sum;
 		})));
 		//消耗排课资格(获取被使用的排课资格)
-		return this.use(categoryId,classMinutes, courseNum,groupId,studentIdList);
+		return this.use(checkScheduleQualificationDto);
 	}
 
 	private void getStudentPayment(Integer userId,
-								   BigDecimal totalAmount,
 								   Integer courseNum,
 								   List<CourseScheduleStudentPayment> courseScheduleStudentPayments,
-								   Integer activityUserMapperId){
+								   ActivityUserMapper activityUserMapper){
 		//实际支付金额,去除优惠券
+		BigDecimal totalAmount = activityUserMapper.getSubNoCoursePrice();
 		BigDecimal singleAmount = totalAmount.divide(new BigDecimal(courseNum), ROUND_DOWN);
 		BigDecimal firstSingleAmount = totalAmount.subtract(singleAmount.multiply(new BigDecimal(courseNum))).add(singleAmount);
 		for (Integer i = 0; i < courseNum; i++) {
@@ -705,8 +740,9 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 			} else {
 				courseScheduleStudentPayment.setExpectPrice(singleAmount);
 			}
-			courseScheduleStudentPayment.setActivityUserMapperId(activityUserMapperId);
+			courseScheduleStudentPayment.setActivityUserMapperId(activityUserMapper.getId());
 			courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
+			courseScheduleStudentPayment.setCalenderId(activityUserMapper.getCalenderId());
 			courseScheduleStudentPayments.add(courseScheduleStudentPayment);
 		}
 	}
@@ -714,26 +750,27 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 								   Integer courseNum,
 								   BigDecimal singlePrice,
 								   List<CourseScheduleStudentPayment> courseScheduleStudentPayments,
-								   Integer activityUserMapperId){
+								   ActivityUserMapper activityUserMapper){
 		for (Integer i = 0; i < courseNum; i++) {
 			CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
 			courseScheduleStudentPayment.setUserId(userId);
 			courseScheduleStudentPayment.setExpectPrice(singlePrice);
 			courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
-			courseScheduleStudentPayment.setActivityUserMapperId(activityUserMapperId);
+			courseScheduleStudentPayment.setActivityUserMapperId(activityUserMapper.getId());
+			courseScheduleStudentPayment.setCalenderId(activityUserMapper.getCalenderId());
 			courseScheduleStudentPayments.add(courseScheduleStudentPayment);
 		}
 	}
 
 	@Override
-	public List<CourseScheduleStudentPayment> use(Integer categoryId,Integer classMinutes,
-												  int courseNum,
-												  Long groupId,List<Integer> studentIdList) {
+	public List<CourseScheduleStudentPayment> use(CheckScheduleQualificationDto dto) {
 		Map<Integer,Integer> subCourseMap = new HashMap<>();
+		List<Integer> studentIdList = dto.getStudentIdList();
+		Integer courseNum = dto.getCourseNum();
 		studentIdList.stream().forEach(e-> subCourseMap.put(e,courseNum));
 		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
 		//获取学员付费排课资格
-		List<ActivityUserMapper> activityUserMappers = activityUserMapperDao.findByStudents(studentIdList,categoryId,classMinutes);
+		List<ActivityUserMapper> activityUserMappers = activityUserMapperDao.findByStudents(studentIdList,dto.getCategoryId(),dto.getClassMinutes());
 		if(CollectionUtils.isNotEmpty(activityUserMappers)){
 			Map<Integer, List<ActivityUserMapper>> collect = activityUserMappers.stream().collect(Collectors.groupingBy(ActivityUserMapper::getUserId));
 			one:for (Integer integer : collect.keySet()) {
@@ -744,7 +781,7 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 						continue one;
 					}
 					//区分vip还是网管
-					this.modifyGroupId(activityUserMapper,groupId);
+					this.modifyGroupId(activityUserMapper,dto.getGroupId());
 					int num = activityUserMapper.getSubCourseNum();
 					//剩余课次不足
 					if(num <= subCourseNum){
@@ -752,7 +789,7 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 						subCourseMap.put(integer, subCourseNum);
 						activityUserMapper.setSubCourseNum(0);
 						//生成学员课程支付记录
-						this.getStudentPayment(integer,activityUserMapper.getSubNoCoursePrice(),num,courseScheduleStudentPayments,activityUserMapper.getId());
+						this.getStudentPayment(integer,num,courseScheduleStudentPayments,activityUserMapper);
 						activityUserMapper.setCurrentCoursePrice(activityUserMapper.getSubNoCoursePrice());
 						activityUserMapper.setSubNoCoursePrice(BigDecimal.ZERO);
 					}else {
@@ -764,7 +801,7 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 						BigDecimal divide = singlePrice.multiply(new BigDecimal(subCourseNum));
 						activityUserMapper.setSubNoCoursePrice(activityUserMapper.getSubNoCoursePrice().subtract(divide));
 						activityUserMapper.setCurrentCoursePrice(divide);
-						this.getStudentPayment(integer,subCourseNum,singlePrice,courseScheduleStudentPayments,activityUserMapper.getId());
+						this.getStudentPayment(integer,subCourseNum,singlePrice,courseScheduleStudentPayments,activityUserMapper);
 						//剩余课次充足
 						continue one;
 					}
@@ -773,7 +810,7 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 			activityUserMapperDao.batchUpdate(activityUserMappers);
 		}
 		//获取学员赠送排课资格
-		List<ActivityUserMapper> freeActivityUserMappers = activityUserMapperDao.findByStudents1(studentIdList,categoryId,classMinutes);
+		List<ActivityUserMapper> freeActivityUserMappers = activityUserMapperDao.findByStudents1(studentIdList,dto.getCategoryId(),dto.getClassMinutes());
 		if(CollectionUtils.isNotEmpty(freeActivityUserMappers)){
 			Map<Integer, List<ActivityUserMapper>> collect1 = freeActivityUserMappers.stream().collect(Collectors.groupingBy(ActivityUserMapper::getUserId));
 			one:for (Integer integer : subCourseMap.keySet()) {
@@ -787,16 +824,16 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 						continue one;
 					}
 					//区分vip还是网管
-					this.modifyGiveGroupId(activityUserMapper,groupId);
+					this.modifyGiveGroupId(activityUserMapper,dto.getGroupId());
 					int num = activityUserMapper.getSubGiveCourseNum();
 					//剩余课次不足
 					if(num <= subCourseNum){
 						activityUserMapper.setSubGiveCourseNum(0);
 						subCourseNum = subCourseNum - num;
-						this.getStudentPayment(integer,num,BigDecimal.ZERO,courseScheduleStudentPayments,activityUserMapper.getId());
+						this.getStudentPayment(integer,num,BigDecimal.ZERO,courseScheduleStudentPayments,activityUserMapper);
 					}else {
 						activityUserMapper.setSubGiveCourseNum(num - subCourseNum);
-						this.getStudentPayment(integer,subCourseNum,BigDecimal.ZERO,courseScheduleStudentPayments,activityUserMapper.getId());
+						this.getStudentPayment(integer,subCourseNum,BigDecimal.ZERO,courseScheduleStudentPayments,activityUserMapper);
 						continue one;
 					}
 				}
@@ -924,8 +961,9 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
 		//消耗排课资格
 		List<Integer> studentIdList = new ArrayList<>();
 		studentIdList.add(studentId);
+		CheckScheduleQualificationDto dto = new CheckScheduleQualificationDto(studentIdList, null, applyBaseInfo.getSingleClassMinutes(), applyBaseInfo.getAllCourseNum(), applyBaseInfo.getId());
 		List<CourseScheduleStudentPayment> courseScheduleStudentPayments =
-				this.checkScheduleQualification(studentIdList,null, applyBaseInfo.getSingleClassMinutes(), applyBaseInfo.getAllCourseNum(), applyBaseInfo.getId());
+				this.checkScheduleQualification(dto);
 
 		//创建班级信息
 		ClassGroup classGroup = new ClassGroup();

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

@@ -1237,7 +1237,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Set<Long> existCourseIds = new HashSet<>();
         if (!CollectionUtils.isEmpty(ccs)) {
             existCourseIds = ccs.stream().map(CourseScheduleStudentPayment::getCourseScheduleId).collect(Collectors.toSet());
-            ;
         }
 
         Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
@@ -2456,15 +2455,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //计算每节课的课酬
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
         List<CourseSchedule> courseScheduleList = new ArrayList<>();
-        List<CourseScheduleType> courseTypes = classGroup4MixDtos.stream().map(e -> e.getCourseType()).distinct().collect(Collectors.toList());
-        /*if(!checkCourseTimesFlag){
-            //校验剩余时长是否一致
-            Integer checkCourseTimes = musicGroupPaymentStudentCourseDetailDao.checkCourseTimes(musicGroupId, courseTypes, studentIds);
-            if(checkCourseTimes == null || checkCourseTimes == 0){
-                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                return BaseController.failed(HttpStatus.ALREADY_REPORTED,"班级剩余排课时长不一致,请再次确认");
-            }
-        }*/
 
         for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
             List<ClassGroupTeacherMapper> teacherMappers = classGroup4MixDto.getClassGroupTeacherMapperList();
@@ -2564,10 +2554,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                     totalCourseDuration += classCourseDuration;
 
-//                    if (totalCourseDuration > totalMinutes) {
-//                        break WhileNode;
-//                    }
-
                     courseTimeDto.setCourseNum(courseTimeDto.getCourseNum() + 1);
                     generateCourseTimes += 1;
 

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

@@ -492,17 +492,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         }
 
         //线上基础技能班,原始分班人数不能小于3人大于6人
-        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
-
-//            if (studentIds.size() < 3 && musicGroup.getStatus().equals(MusicGroupStatusEnum.PREPARE)) {
-//                throw new BizException("线上基础技能班人数不能少于3人");
-//            }
-//            if (studentIds.size() < 3 && !musicGroup.getStatus().equals(MusicGroupStatusEnum.PREPARE) && oldNormalStudentIds.size() <= 0) {
-//                throw new BizException("线上基础技能班人数不能少于3人");
-//            }
-            if (studentIds.size() > 6) {
-                throw new BizException("线上基础技能班人数不能多于6人");
-            }
+        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) && studentIds.size() > 6) {
+            throw new BizException("线上基础技能班人数不能多于6人");
         }
 
         Set<Integer> repeatStudentIds = allStudentIds.stream().filter(oldNormalStudentIds::contains).collect(Collectors.toSet());
@@ -605,9 +596,6 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
         //4、调整未上课课酬
         if(!CollectionUtils.isEmpty(classGroupNotStartCourse)){
-            List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroupId.intValue());
-            Date nowDate = new Date();
-//            List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
             List<Long> courseScheduleIds = classGroupNotStartCourse.stream().map(CourseSchedule::getId).collect(Collectors.toList());
 
             List<CourseScheduleTeacherSalary> oldCourseSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
@@ -623,22 +611,6 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
                 }
                 courseScheduleTeacherSalaryService.createMusicGroupCourseTeacherSalary(null, idCourseMap.get(oldCourseSalary.getCourseScheduleId()), oldCourseSalary);
             }
-
-//            for (CourseSchedule courseSchedule : classGroupNotStartCourse) {
-//                for (ClassGroupTeacherMapper classGroupTeacher : classGroupTeachers) {
-//                    CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
-//                    courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
-//                    courseScheduleTeacherSalary.setGroupType(courseSchedule.getGroupType());
-//                    courseScheduleTeacherSalary.setMusicGroupId(courseSchedule.getMusicGroupId());
-//                    courseScheduleTeacherSalary.setTeacherRole(classGroupTeacher.getTeacherRole());
-//                    courseScheduleTeacherSalary.setUserId(classGroupTeacher.getUserId());
-//                    courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
-//                    courseScheduleTeacherSalary.setCreateTime(nowDate);
-//                    courseScheduleTeacherSalary.setUpdateTime(nowDate);
-//                    courseScheduleTeacherSalaryService.createMusicGroupCourseTeacherSalary(musicGroup, courseSchedule, courseScheduleTeacherSalary);
-//                    courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
-//                }
-//            }
             courseScheduleTeacherSalaryService.batchInsert(oldCourseSalaries);
         }
 

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -173,6 +173,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     }
 
     @Override
+    public CourseScheduleDao getDao() {
+        return courseScheduleDao;
+    }
+
+    @Override
 	public CourseSchedule queryById(Long courseScheduleId) {
     	CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
     	if(courseSchedule != null){

+ 20 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -11,6 +11,7 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.CourseScheduleStudentPaymentQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
+import com.ym.mec.biz.service.OperatingReportCloudService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.constant.CommonConstants;
@@ -55,7 +56,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	@Autowired
-	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
+	private OperatingReportCloudService operatingReportCloudService;
 	@Autowired
 	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 	@Autowired
@@ -387,6 +388,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void createForMusicGroup(String musicGroupId, List<CourseSchedule> courseSchedules, List<Integer> studentIds) {
 		Map<Integer, List<CourseSchedule>> memberCourseMap = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getMemberFlag));
+		//课程是否需要标记为云教练赠送
+		Boolean cloudTeacherPaymentFlag = false;
 		for (Integer memberFlag : memberCourseMap.keySet()) {
 			List<CourseSchedule> courseScheduleList = memberCourseMap.get(memberFlag);
 			if(courseScheduleList != null && courseScheduleList.size() > 0){
@@ -471,7 +474,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							List<CourseScheduleStudentPayment> typeCourseStudentPayments = new ArrayList<>();
 							courseScheduleTypeListEntry.getValue().sort(Comparator.comparing(CourseSchedule::getStartClassTime));
 							BigDecimal typeCourseTotalOriginalPrice = new BigDecimal("0"), typeCourseTotalCurrentPrice = new BigDecimal("0");
-							for (CourseSchedule courseSchedule : courseScheduleTypeListEntry.getValue()) {
+							List<CourseSchedule> scheduleList = courseScheduleTypeListEntry.getValue();
+							for (CourseSchedule courseSchedule : scheduleList) {
 								if(existCourseIds.contains(courseSchedule.getId())){
 									throw new BizException("该学员已在此班级{}课程中", courseSchedule.getId());
 								}
@@ -505,14 +509,20 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 								typeCourseStudentPayments.get(0).setExpectPrice(typeCourseStudentPayments.get(0).getExpectPrice().add(totalCourseCurrentPrice.subtract(typeCourseTotalCurrentPrice)));
 							}
 							courseScheduleStudentPayments.addAll(typeCourseStudentPayments);
-							for (MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail : musicGroupPaymentStudentCourseDetails) {
-								if(typeCourseDuration>musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes()){
-									musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes());
-									typeCourseDuration = typeCourseDuration-musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes();
+							for (MusicGroupPaymentStudentCourseDetail detail : musicGroupPaymentStudentCourseDetails) {
+								if(typeCourseDuration>detail.getTotalCourseMinutes()){
+									detail.setUsedCourseMinutes(detail.getTotalCourseMinutes());
+									typeCourseDuration = typeCourseDuration-detail.getTotalCourseMinutes();
 								}else{
-									musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(typeCourseDuration);
+									detail.setUsedCourseMinutes(typeCourseDuration);
 									typeCourseDuration = 0;
 								}
+								//如果是免费的云教练课程
+								if(detail.getCloudTeacherPaymentFlag()){
+									cloudTeacherPaymentFlag = true;
+									String courseIds = scheduleList.stream().map(e -> e.getId().toString()).collect(Collectors.joining(","));
+									operatingReportCloudService.updateSet(detail.getMusicGroupPaymentCalenderId(),detail.getUserId(),courseIds);
+								}
 							}
 							musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
 						}
@@ -521,6 +531,9 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 				}
 			}
 		}
+		if(cloudTeacherPaymentFlag){
+			courseScheduleDao.markFreeCourse(courseSchedules.stream().map(e->e.getId().toString()).collect(Collectors.joining(",")));
+		}
 	}
 
 	@Override

+ 30 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -70,6 +70,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
     private StudentDao studentDao;
     @Autowired
     private VipGroupActivityDao vipGroupActivityDao;
+    @Autowired
+    private OperatingReportCloudService operatingReportCloudService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalenderDetail> getDAO() {
@@ -175,9 +177,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void batchAdd(String batchNo, Set<Integer> userIdList) {
-
         List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
-        if (musicGroupPaymentCalenderList == null || musicGroupPaymentCalenderList.size() == 0) {
+        if (CollectionUtils.isEmpty(musicGroupPaymentCalenderList)) {
             throw new BizException("操作失败:缴费项目不存在");
         }
         MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderList.get(0);
@@ -240,6 +241,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         Date date = new Date();
         MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
         Map<Integer, Long> userMap = new HashMap<>();
+        Map<Integer, Integer> activityuserMap = new HashMap<>();
         List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
         //创建缴费明细
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
@@ -304,6 +306,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                         activityUserMapperList.add(activityUserMapper);
                     }
                     activityUserMapperService.batchInsert(activityUserMapperList);
+                    activityUserMapperList.stream().forEach(e -> activityuserMap.put(e.getUserId(), e.getId()));
                 }
             }
         }
@@ -340,6 +343,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                     musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
                     musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
                     musicGroupPaymentStudentCourseDetail.setUserId(studentId);
+                    musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(musicGroupPaymentCalender.getCloudTeacherPaymentFlag());
                     musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
                 }
             }
@@ -347,6 +351,20 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                 musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
             }
         }
+
+        //记录云教练缴费预收
+        if(musicGroupPaymentCalender.getCloudTeacherPaymentFlag() && musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0){
+            List<OperatingReportCloud> operatingReportClouds = new ArrayList<>();
+            for (Integer studentId : userIdList) {
+                OperatingReportCloud operatingReportCloud = new OperatingReportCloud();
+                operatingReportCloud.setCalenderId(musicGroupPaymentCalenderId);
+                operatingReportCloud.setOrganId(musicGroupPaymentCalender.getOrganId());
+                operatingReportCloud.setUserId(operatingReportCloud.getUserId());
+                operatingReportClouds.add(operatingReportCloud);
+            }
+            operatingReportCloudService.getDao().batchInsert(operatingReportClouds);
+        }
+
         //给学员推送缴费通知
         if (musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
             musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalender.getId(),
@@ -527,7 +545,6 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalender.setUpdateTime(nowDate);
             musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
         }
-
         MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(currentPaymentCalenderId, studentPaymentOrder.getUserId());
         if (musicGroupPaymentCalenderDetail == null) {
             musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
@@ -553,6 +570,15 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
         }
 
+        //保存、更新云教练缴费项目预收
+        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getUserId());
+
+        Boolean cloudTeacherPaymentFlag = false;
+        if(musicGroupPaymentCalender.getCloudTeacherPaymentFlag()){
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
+            BigDecimal reduce = courseSettings.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            cloudTeacherPaymentFlag = reduce.compareTo(BigDecimal.ZERO) == 0;
+        }
         //续费项目加学员时就生成了课程时长,报名项目在缴费成功后才需要添加课程时长
         if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
             List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = new ArrayList<>();
@@ -579,6 +605,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                 musicGroupPaymentStudentCourseDetail.setCreateTime(nowDate);
                 musicGroupPaymentStudentCourseDetail.setUpdateTime(nowDate);
                 musicGroupPaymentStudentCourseDetail.setTenantId(tenantId);
+                musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(cloudTeacherPaymentFlag);
                 musicGroupPaymentStudentCourseDetails.add(musicGroupPaymentStudentCourseDetail);
             }
             if (musicGroupPaymentStudentCourseDetails.size() > 0) {

+ 1 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -60,8 +60,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
     @Autowired
-    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-    @Autowired
     private MusicGroupPaymentCalenderCourseSettingsServiceImpl musicGroupPaymentCalenderCourseSettingsService;
     @Autowired
     private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
@@ -296,7 +294,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         BigDecimal repairActualAmount = musicGroupPaymentCalenderRepairService.getActualAmount(musicGroupPaymentBaseCalender);
         BigDecimal activityActualAmount = musicGroupPaymentCalenderActivityService.getActualAmount(musicGroupPaymentBaseCalender);
         if(memberActualAmount.compareTo(BigDecimal.ZERO) > 0 && (courseActualAmount.compareTo(BigDecimal.ZERO) == 0 || activityActualAmount.compareTo(BigDecimal.ZERO) == 0)){
-//            musicGroupPaymentCalender.set
+            musicGroupPaymentCalender.setCloudTeacherPaymentFlag(true);
         }
 
         BigDecimal actualTotalAmount = courseActualAmount.add(memberActualAmount)

+ 0 - 302
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -1360,293 +1360,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         return BaseController.succeed(payMap);
     }
 
-    /*@Override
-    @Transactional(rollbackFor = Exception.class)
-    public Map rePay(RegisterPayDto registerPayDto) throws Exception {
-        StudentRegistration studentRegistration = studentRegistrationService.get(registerPayDto.getRegisterId().longValue());
-        if (studentRegistration == null) {
-            throw new BizException("报名信息有误,请核查");
-        }
-        Integer tenantId = TenantContextHolder.getTenantId();
-
-        Integer userId = studentRegistration.getUserId();
-
-        List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
-
-        StudentPaymentOrder applyOrder = null;
-
-        if(applyOrderList != null && applyOrderList.size() > 0){
-        	applyOrder = applyOrderList.get(0);
-        }
-
-        if (applyOrder == null) {
-            throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
-        }
-
-        // 查询订单状态
-        PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
-        if(payStatus != PayStatus.FAILED){
-        	if(payStatus == PayStatus.SUCCESSED){
-        		throw new BizException("订单已支付成功,请勿重复支付");
-        	}*//*else if(payStatus == PayStatus.PAYING){
-        		throw new BizException("订单还在交易中,请稍后重试");
-        	}*//*
-        }
-
-    	MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(studentRegistration.getMusicGroupId());
-        if(musicGroupRegCalender == null){
-        	throw new BizException("缴费信息不存在");
-        }
-
-        //手动关闭订单
-        applyOrder.setStatus(DealStatusEnum.FAILED);
-        applyOrder.setMemo("用户手动关闭");
-        studentPaymentOrderService.callOrderCallBack(applyOrder);
-
-        BigDecimal amount = registerPayDto.getAmount(); //前端获取的价格
-        BigDecimal orderAmount = new BigDecimal("0");
-
-        //获取课程价格
-//        MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-//        BigDecimal courseFee = musicOneSubjectClassPlan.getFee() == null ? BigDecimal.ZERO : musicOneSubjectClassPlan.getFee();
-//        orderAmount = orderAmount.add(courseFee);
-
-        BigDecimal remitFee = BigDecimal.ZERO;
-        BigDecimal courseRemitFee = BigDecimal.ZERO; //课程减免费用
-        boolean remitCourseRFeeFlag = false; //减免课程费用标识
-
-        MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
-        if(musicGroup == null){
-        	throw new BizException("查询乐团信息失败");
-        }
-
-        //乐器及打包辅件
-        List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
-        if (registerPayDto.getGoodsGroups() != null && registerPayDto.getGoodsGroups().size() > 0) {
-            String goodsGroupIds = registerPayDto.getGoodsGroups().keySet().stream().map(Object::toString).collect(Collectors.joining(","));
-            goodsGroups = musicGroupSubjectGoodsGroupService.findGoodsGroupByIds(goodsGroupIds);
-        }
-        for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
-            Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
-            });
-
-            if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
-                String kitGroupPurchaseType = registerPayDto.getGoodsGroups().get(goodsGroup.getId());
-                if (!groupType.containsKey(kitGroupPurchaseType)) {
-                    throw new BizException("乐器提供方式不存在,请核查");
-                }
-                if (!kitGroupPurchaseType.equals("GROUP")) {
-                    goodsGroup.setPrice(kitGroupPurchaseType.equals("FREE") ? new BigDecimal(0) : goodsGroup.getDepositFee());
-                } else {
-                    remitCourseRFeeFlag = goodsGroup.getGroupRemissionCourseFee().equals(1);
-                }
-                goodsGroup.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.valueOf(kitGroupPurchaseType));
-                remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
-            }
-            goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
-
-            if(goodsGroup.getType().equals(GoodsType.ACCESSORIES)){
-            	if((registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-            		goodsGroup.setPrice(BigDecimal.ZERO);
-            		continue;
-            	}
-            }
-
-            if(musicGroup.getOrganId() == 55 && (registerPayDto.getNewCourse() == null || registerPayDto.getNewCourse().size() == 0) && !(registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus())){
-            	//取商品零售价
-                if (StringUtils.isNotBlank(goodsGroup.getGoodsIdList())) {
-                	List<Goods> goodsList = goodsDao.findGoodsByIds(goodsGroup.getGoodsIdList());
-                	for(Goods goods : goodsList){
-                		orderAmount = orderAmount.add(goods.getDiscountPrice());
-                	}
-                }
-            }else{
-            	orderAmount = orderAmount.add(goodsGroup.getPrice());
-            }
-        }
-
-        //新课程形态
-        List<MusicGroupPaymentCalenderCourseSettings> newCourses = new ArrayList<>();
-        if (musicGroupRegCalender.getPayUserType() == PayUserType.STUDENT && registerPayDto.getNewCourse() != null && registerPayDto.getNewCourse().size() > 0) {
-            newCourses = musicGroupPaymentCalenderCourseSettingsDao.getCalenderCourseSettings(registerPayDto.getNewCourse());
-            for (MusicGroupPaymentCalenderCourseSettings calenderCourseSetting : newCourses) {
-                if (remitCourseRFeeFlag && !calenderCourseSetting.getIsStudentOptional()) {
-                    courseRemitFee = courseRemitFee.add(calenderCourseSetting.getCourseCurrentPrice());
-                    continue;
-                }
-                orderAmount = orderAmount.add(calenderCourseSetting.getCourseCurrentPrice());
-            }
-        }
-
-        if (registerPayDto.getBuyMaintenance()) {
-            String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.ONE_YEAR_MUSICAL_REPAIR_AMOUNT, tenantId);
-            if(StringUtils.isEmpty(configValue)){
-                throw new BizException("乐保价格异常,请联系指导老师");
-            }
-            orderAmount = orderAmount.add(new BigDecimal(configValue));
-        }
-
-        studentRegistration.setMusicGroupPaymentCalenderId(musicGroupRegCalender.getId());
-        studentRegistration.setOrganId(musicGroup.getOrganId());
-        studentRegistration.setPayingStatus(1);
-
-        Date date = new Date();
-
-        CloudTeacherOrder cloudTeacherOrder = null;
-
-        //云教练/云教练+
-        if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
-
-            BigDecimal cloudTeacherPrice = BigDecimal.ZERO;
-			if (musicGroupRegCalender.getMemberRankSettingId() != null) {
-				cloudTeacherPrice = musicGroupRegCalender.getMemberPaymentAmount();
-			} else {
-				if (musicGroup.getCloudTeacherType() != null) {
-					OrganizationCloudTeacherFee cloudTeacher = organizationCloudTeacherFeeDao.getByOrganId(studentRegistration.getOrganId());
-					cloudTeacherPrice = musicGroup.getCloudTeacherType() == 0 ? cloudTeacher.getPrice() : cloudTeacher.getPlusPrice();
-				}
-			}
-
-            orderAmount = orderAmount.add(cloudTeacherPrice);
-            studentRegistration.setHasCloudTeacher(0);
-
-
-            //创建订单
-            cloudTeacherOrder = new CloudTeacherOrder();
-
-    		cloudTeacherOrder.setType(PeriodEnum.MONTH);//月
-			cloudTeacherOrder.setTime(musicGroupRegCalender.getMemberValidDate() == null ? 6 : musicGroupRegCalender.getMemberValidDate());
-
-    		cloudTeacherOrder.setOrganId(musicGroup.getOrganId());
-    		cloudTeacherOrder.setStudentId(studentRegistration.getUserId());
-    		cloudTeacherOrder.setLevel(musicGroupRegCalender.getMemberRankSettingId() == null ? 1 : musicGroupRegCalender.getMemberRankSettingId());
-    		cloudTeacherOrder.setAmount(musicGroupRegCalender.getMemberPaymentAmount() == null ? cloudTeacherPrice : musicGroupRegCalender.getMemberPaymentAmount());
-    		cloudTeacherOrder.setStatus(0);
-            cloudTeacherOrder.setMusicGroupId(musicGroup.getId());
-        }
-
-        String orderNo = idGeneratorService.generatorId("payment") + "";
-
-        String channelType = "";
-        StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(registerPayDto.getCouponIdList(),amount,true);
-        studentPaymentOrder.setUserId(studentRegistration.getUserId());
-        studentPaymentOrder.setGroupType(GroupType.MUSIC);
-        studentPaymentOrder.setOrderNo(orderNo);
-        studentPaymentOrder.setType(OrderTypeEnum.APPLY);
-        studentPaymentOrder.setStatus(DealStatusEnum.ING);
-        studentPaymentOrder.setPaymentChannel(channelType);
-        studentPaymentOrder.setMusicGroupId(studentRegistration.getMusicGroupId());
-        studentPaymentOrder.setCalenderId(musicGroupRegCalender.getId());
-        studentPaymentOrderService.insert(studentPaymentOrder);
-        //生成订单详情
-        studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration,studentPaymentOrder,goodsGroups,remitFee,
-                courseRemitFee,
-                newCourses,
-                registerPayDto);
-        studentPaymentOrder = studentPaymentOrderService.get(studentPaymentOrder.getId());
-        orderAmount = studentPaymentOrder.getActualAmount();
-        if (amount.compareTo(orderAmount) != 0) {
-            throw new BizException("商品价格不符");
-        }
-        if (amount.compareTo(BigDecimal.ZERO) < 0) {
-            throw new BizException("价格异常");
-        }
-        boolean canPay = studentPaymentOrder.getClassGroupId() != null && studentPaymentOrder.getClassGroupId().equals(206);
-
-        if(cloudTeacherOrder != null){
-    		cloudTeacherOrder.setOrderId(studentPaymentOrder.getId());
-    		cloudTeacherOrder.setCreateTime(date);
-    		cloudTeacherOrder.setUpdateTime(date);
-    		cloudTeacherOrderService.insert(cloudTeacherOrder);
-        }
-
-        BigDecimal balance = BigDecimal.ZERO;
-        if (registerPayDto.getUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
-            SysUserCashAccount userCashAccount = sysUserCashAccountService.get(userId);
-            if (userCashAccount == null) {
-                throw new BizException("用户账户找不到");
-            }
-            if (userCashAccount.getBalance() != null && userCashAccount.getBalance().compareTo(BigDecimal.ZERO) > 0) {
-                balance = amount.compareTo(userCashAccount.getBalance()) >= 0 ? userCashAccount.getBalance() : amount;
-                amount = amount.subtract(balance);
-                studentPaymentOrder.setPaymentChannel("BALANCE");
-                studentPaymentOrder.setActualAmount(amount);
-                studentPaymentOrder.setBalancePaymentAmount(balance);
-                sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团报名");
-            }
-        }
-        studentPaymentOrder.setBatchNo(musicGroupRegCalender.getId() + "");
-        studentPaymentOrder.setPaymentChannel("BALANCE");
-        studentPaymentOrder.setRemitFee(remitFee);
-        studentPaymentOrder.setCourseRemitFee(courseRemitFee);
-        studentPaymentOrder.setOrganId(musicGroup.getOrganId());
-        studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
-        studentPaymentOrder.setUpdateTime(date);
-
-        if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
-            if(!canPay) {
-                studentPaymentOrder.setPaymentChannel("ADAPAY");
-            }
-            studentRegistration.setPayingStatus(2);
-        }
-        studentPaymentOrderService.update(studentPaymentOrder);
-        studentPaymentOrder.setVersion(studentPaymentOrder.getVersion() + 1);
-
-        studentRegistrationService.update(studentRegistration);
-
-        if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
-            Integer teacherId = musicGroup.getEducationalTeacherId();
-            SysUser endTeacher = sysUserFeignService.queryUserById(teacherId);
-            Map<Integer, String> userPhoneMap = new HashMap<>();
-            userPhoneMap.put(endTeacher.getId(), endTeacher.getPhone());
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.NO_BUY_CLOUD_TEACHER_MSG,
-                    userPhoneMap, null, 0, null, null, musicGroup.getName(), studentRegistration.getName());
-
-            if(!canPay) {
-                Map<String, String> notifyMap = new HashMap<>();
-                notifyMap.put("hasPaidZero", "205");
-                notifyMap.put("orderNo", studentPaymentOrder.getOrderNo());
-                return notifyMap;
-            }
-        }
-
-        if (amount.compareTo(BigDecimal.ZERO) == 0) {
-            studentPaymentRouteOrderService.addRouteOrder(orderNo, musicGroup.getOrganId(), balance);
-            Map<String, String> notifyMap = new HashMap<>();
-            notifyMap.put("tradeState", "1");
-            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
-            notifyMap.put("channelType", channelType);
-            notifyMap.put("orderNo", "");
-            studentPaymentOrderService.updateOrder(notifyMap);
-            return notifyMap;
-        }
-
-        String orderSubject = "乐团报名";
-        String receiver = "register";
-        if (musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)) {
-            orderSubject = "乐团相关费用";
-        }
-        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
-        Map payMap = payService.getPayMap(
-                amount,
-                balance,
-                orderNo,
-                baseApiUrl + "/api-student/studentOrder/notify",
-                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
-                orderSubject,
-                orderSubject,
-                musicGroup.getOrganId(),
-                receiver
-        );
-
-        studentPaymentOrder.setOrganId(musicGroup.getOrganId());
-        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
-        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
-        studentPaymentOrder.setUpdateTime(date);
-        studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
-    }*/
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void updateSubjectInfo(SubFeeSettingDto subFeeSettingDto) throws Exception {
@@ -3808,21 +3521,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         return musicGroup;
     }
 
-    @Override
-    public List<ImGroupMember> queryMusicGroupTeachers(String musicGroupId) {
-        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-        List<ImGroupMember> groupMembers = new ArrayList<>();
-        Set teacherIds = new HashSet(4);
-        teacherIds.add(musicGroup.getEducationalTeacherId());
-        teacherIds.add(musicGroup.getTeamTeacherId());
-        teacherIds.add(musicGroup.getOperatorUserId());
-        teacherIds.add(musicGroup.getDirectorUserId());
-        teacherIds.removeAll(Collections.singleton(null));
-        for (Object teacherId : teacherIds) {
-            groupMembers.add(new ImGroupMember(teacherId.toString()));
-        }
-        return groupMembers;
-    }
 
     @Override
     @Transactional(rollbackFor = Exception.class)

+ 88 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java

@@ -0,0 +1,88 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.OperatingReportCloudDao;
+import com.ym.mec.biz.dal.dao.OrganCourseTypeOriginalCostDao;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import com.ym.mec.biz.service.OperatingReportCloudService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Objects;
+
+@Service
+public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, OperatingReportCloud>  implements OperatingReportCloudService {
+	
+	@Autowired
+	private OperatingReportCloudDao operatingReportCloudDao;
+	@Autowired
+	private OrganCourseTypeOriginalCostDao organCourseTypeOriginalCostDao;
+
+	@Override
+	public BaseDAO<Integer, OperatingReportCloud> getDAO() {
+		return operatingReportCloudDao;
+	}
+
+	@Override
+	public OperatingReportCloudDao getDao() {
+		return operatingReportCloudDao;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateSet(MusicGroupPaymentCalender calender, Integer userId) {
+		if(calender.getCloudTeacherPaymentFlag()){
+			//获取云教练信息
+			OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId(),userId);
+			if(Objects.isNull(reportCloud)){
+				reportCloud = new OperatingReportCloud();
+				reportCloud.setCalenderId(calender.getId());
+				reportCloud.setCloudPrice(calender.getCurrentTotalAmount());
+				reportCloud.setUserId(userId);
+				reportCloud.setOrganId(calender.getOrganId());
+				operatingReportCloudDao.insert(reportCloud);
+			}else {
+				//如果缴费项目还没有排课,所以把应收转化为云教练预收
+				reportCloud.setUpdateTime(new Date());
+				if(StringUtils.isEmpty(reportCloud.getCourseIds())){
+					reportCloud.setCloudPrice(calender.getCurrentTotalAmount());
+				}else {
+					//如果已排课,需要更新课程、云教练预收
+					//计算课程预收
+					BigDecimal costPrice = organCourseTypeOriginalCostDao.getCourseCostPrice(reportCloud.getCourseIds());
+					reportCloud.setCloudPrice(reportCloud.getCloudPrice().subtract(costPrice));
+					reportCloud.setCoursePrice(reportCloud.getCoursePrice().add(reportCloud.getCoursePrice()));
+				}
+				operatingReportCloudDao.update(reportCloud);
+			}
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateSet(Long calenderId,Integer userId,String scheduleIdList) {
+		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calenderId,userId);
+		if(Objects.isNull(reportCloud)){
+			throw new BizException("操作失败,请联系管理员");
+		}
+		String courseIds = StringUtils.join(scheduleIdList,",");
+		if(StringUtils.isEmpty(reportCloud.getCourseIds())){
+			reportCloud.setCourseIds(courseIds);
+		}else {
+			reportCloud.setCourseIds(reportCloud.getCourseIds() + "," + StringUtils.join(scheduleIdList,","));
+		}
+		reportCloud.setUpdateTime(new Date());
+		//计算课程预收
+		BigDecimal costPrice = organCourseTypeOriginalCostDao.getCourseCostPrice(courseIds);
+		reportCloud.setCloudPrice(reportCloud.getCloudPrice().subtract(costPrice));
+		reportCloud.setCoursePrice(reportCloud.getCoursePrice().add(reportCloud.getCoursePrice()));
+		operatingReportCloudDao.update(reportCloud);
+	}
+}

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

@@ -1,158 +1,16 @@
 package com.ym.mec.biz.service.impl;
 
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
-import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
-import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.MAINTENANCE;
-import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.PRACTICE;
-import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.VIP;
-import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
-import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.stream.Collectors;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.GoodsProcurementDao;
-import com.ym.mec.biz.dal.dao.ImGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderStudentDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
-import com.ym.mec.biz.dal.dao.OrganizationDao;
-import com.ym.mec.biz.dal.dao.StudentCourseFeeDetailDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SubjectChangeDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dto.MusicGroupApplyGoodsDto;
-import com.ym.mec.biz.dal.dto.NoClassMusicStudentDto;
-import com.ym.mec.biz.dal.dto.PageInfoReg;
-import com.ym.mec.biz.dal.dto.RegisterDto;
-import com.ym.mec.biz.dal.dto.RegisterPayDto;
-import com.ym.mec.biz.dal.dto.StudentAddDto;
-import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentCourseInfoDto;
-import com.ym.mec.biz.dal.dto.StudentInfo;
-import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
-import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
-import com.ym.mec.biz.dal.dto.StudentRegisterInstrumentsDetailDto;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
-import com.ym.mec.biz.dal.entity.CooperationOrgan;
-import com.ym.mec.biz.dal.entity.CouponPayParam;
-import com.ym.mec.biz.dal.entity.CouponPayTypeInfo;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.GoodsProcurement;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderActivity;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderRepair;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentCourseFeeDetail;
-import com.ym.mec.biz.dal.entity.StudentInstrument;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SubjectChange;
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
-import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GoodsType;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
-import com.ym.mec.biz.dal.enums.SysUserRoleEnum;
-import com.ym.mec.biz.dal.page.MusicGroupRecordStudentQueryInfo;
-import com.ym.mec.biz.dal.page.NoClassMusicStudentQueryInfo;
-import com.ym.mec.biz.dal.page.RegistrationOrPreQueryInfo;
-import com.ym.mec.biz.dal.page.StudentPreRegistrationQueryInfo;
-import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.event.source.SendSeoMessageSource;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ClassGroupStudentMapperService;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.ImGroupMemberService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderActivityService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderMemberService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderRepairService;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.StudentService;
-import com.ym.mec.biz.service.SubjectService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysCouponCodeService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.SysTenantConfigService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountLogService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.ImResult;
@@ -166,6 +24,29 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.NON_PAYMENT;
+import static com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED;
+import static com.ym.mec.biz.dal.enums.OrderDetailTypeEnum.*;
+import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
+import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
 
 @Service
 public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, StudentRegistration> implements StudentRegistrationService {
@@ -542,11 +423,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration) {
-        return studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
-    }
-
-    @Override
     @Transactional(rollbackFor = Exception.class)
     public StudentRegistration addStudent(StudentRegistration studentRegistration) throws Exception {
         Integer userId = studentRegistration.getUserId();
@@ -1420,7 +1296,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                         HttpUtil.getSortUrl(studentApplyUrl));
             }
         }
-
         return studentPaymentOrder;
     }
 
@@ -1441,21 +1316,11 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public List<StudentRegistration> findStudentListByIdList(List<Long> idList) {
-        return studentRegistrationDao.findStudentListByIdList(idList);
-    }
-
-    @Override
     public int batchInsert(List<StudentRegistration> studentRegistrationList) {
         return studentRegistrationDao.batchInsert(studentRegistrationList);
     }
 
     @Override
-    public StudentRegistration findStudentByClassGroupIdAndUserId(Integer userId, Integer classGroupId) {
-        return studentRegistrationDao.findStudentByClassGroupIdAndUserId(userId, classGroupId);
-    }
-
-    @Override
     public List<StudentRegistration> findMusicGroupStudent(String musicGroupId, String actualSubjectId) {
         List<Subject> subjectList = subjectService.findAll(new HashMap<>());
         List<StudentRegistration> musicGroupStudents = studentRegistrationDao.findMusicGroupStudent(musicGroupId, actualSubjectId);
@@ -1503,16 +1368,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public List<StudentRegistration> queryStudentByMusicGroupId(String musicGroupId) {
-        return studentRegistrationDao.queryStudentByMusicGroupId(musicGroupId);
-    }
-
-    @Override
-    public List<Map<Integer, String>> findParentId(String parentPhones) {
-        return studentRegistrationDao.findParentId(parentPhones);
-    }
-
-    @Override
     @Transactional(rollbackFor = Exception.class)
     public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
         if (StringUtils.isBlank(studentRegistration.getCertificateType())) {

+ 18 - 14
mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml

@@ -39,6 +39,7 @@
 		<result column="cut_memo_" property="cutMemo" />
 		<result column="give_coupon_id_" property="giveCouponId" />
 		<result column="create_time_" property="createTime" />
+		<result column="calender_id_" property="calenderId" />
 		<result column="update_time_" property="updateTime" />
 		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
@@ -60,13 +61,13 @@
 										  vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,
 		                                  member_order_id_,give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_,give_coupon_id_,
 										  total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_,sub_no_course_price_,single_course_time_,
-		                                  give_single_course_time_,category_id_,give_category_id_)
+		                                  give_single_course_time_,category_id_,give_category_id_,calender_id_)
 		                                  VALUES(#{activityId},#{userId},#{vipFlag},#{giveVipFlag},#{practiceFlag},
 		                                         #{givePracticeFlag},#{memberFlag},#{giveMemberFlag},NOW(),NOW(),#{paymentOrderId},#{vipGroupId},
 		                                         #{giveVipGroupId},#{practiceGroupId},#{givePracticeGroupId},#{returnFee},
 		                                         #{memberOrderId},#{giveMemberOrderId},#{teacherId},#{actualPrice},#{addMemo},#{cutMemo},#{tenantId},#{giveCouponId},
 		                                         #{totalCourseNum},#{totalGiveCourseNum},#{subCourseNum},#{subGiveCourseNum},#{subNoCoursePrice},
-		                                         #{singleCourseTime},#{giveSingleCourseTime},#{categoryId},#{giveCategoryId})
+		                                         #{singleCourseTime},#{giveSingleCourseTime},#{categoryId},#{giveCategoryId},#{calenderId})
 	</insert>
     <insert id="batchInsert">
 		INSERT INTO activity_user_mapper (activity_id_,user_id_,vip_flag_,give_vip_flag_,
@@ -74,7 +75,7 @@
 		vip_group_id_,give_vip_group_id_,practice_group_id_,give_practice_group_id_,return_fee_,member_order_id_,
 		                                  give_member_order_id_,teacher_id_,actual_price_,add_memo_,cut_memo_,tenant_id_,give_coupon_id_,
 		total_course_num_,total_give_course_num_,sub_course_num_,sub_give_course_num_,sub_no_course_price_,single_course_time_,
-		                                  give_single_course_time_,category_id_,give_category_id_)
+		                                  give_single_course_time_,category_id_,give_category_id_,calender_id_)
 		VALUES
 		<foreach collection="activityUserMappers" item="item" separator=",">
 			(#{item.activityId},#{item.userId},#{item.vipFlag},#{item.giveVipFlag},#{item.practiceFlag},
@@ -83,13 +84,16 @@
 			 #{item.memberOrderId},#{item.giveMemberOrderId},#{item.teacherId},#{item.actualPrice},#{item.addMemo},#{item.cutMemo},
 			 #{item.tenantId},#{item.giveCouponId},#{item.totalCourseNum},#{item.totalGiveCourseNum},#{item.subCourseNum},
 			 #{item.subGiveCourseNum},#{item.subNoCoursePrice},#{item.singleCourseTime},#{item.giveSingleCourseTime},
-			 #{item.categoryId},#{item.giveCategoryId})
+			 #{item.categoryId},#{item.giveCategoryId},#{item.calenderId})
 		</foreach>
 	</insert>
     <!-- 根据主键查询一条记录 -->
 	<update id="update" parameterType="com.ym.mec.biz.dal.entity.ActivityUserMapper">
 		UPDATE activity_user_mapper
 		<set>
+			<if test="calenderId != null">
+				calender_id_ = #{calenderId},
+			</if>
 			<if test="singleCourseTime != null">
 				single_course_time_ = #{singleCourseTime},
 			</if>
@@ -528,28 +532,28 @@
 		       give_practice_group_id_,actual_price_,sub_no_course_price_
 		from activity_user_mapper aum
 		WHERE aum.user_id_ IN
-		<foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
+		<foreach collection="dto.studentIdList" item="userId" open="(" separator="," close=")">
 			#{userId}
 		</foreach>
-		and aum.single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_course_num_ > 0
-		<if test="categoryId != null">
-			AND aum.category_id_ = #{categoryId}
+		and aum.single_course_time_ = #{dto.classMinutes} and return_fee_ = 0 and aum.sub_course_num_ > 0
+		<if test="dto.categoryId != null">
+			AND aum.category_id_ = #{dto.categoryId}
 		</if>
-		<if test="categoryId == null">
+		<if test="dto.categoryId == null">
 			AND aum.category_id_ IS NULL
 		</if>
 		UNION ALL
 		select aum.id_,give_category_id_ category_id_, user_id_,sub_give_course_num_ sub_course_num_,vip_group_id_, give_vip_group_id_, practice_group_id_, give_practice_group_id_,0 actual_price_,0 sub_no_course_price_
 		from activity_user_mapper aum
 		WHERE aum.user_id_ IN
-		<foreach collection="studentIdList" item="userId" open="(" separator="," close=")">
+		<foreach collection="dto.studentIdList" item="userId" open="(" separator="," close=")">
 			#{userId}
 		</foreach>
-		and aum.give_single_course_time_ = #{classMinutes} and return_fee_ = 0 and aum.sub_give_course_num_ > 0
-		<if test="categoryId != null">
-			AND aum.give_category_id_ = #{categoryId}
+		and aum.give_single_course_time_ = #{dto.classMinutes} and return_fee_ = 0 and aum.sub_give_course_num_ > 0
+		<if test="dto.categoryId != null">
+			AND aum.give_category_id_ = #{dto.categoryId}
 		</if>
-		<if test="categoryId == null">
+		<if test="dto.categoryId == null">
 			AND aum.give_category_id_ IS NULL
 		</if>
 

+ 80 - 0
mec-biz/src/main/resources/config/mybatis/CloudTeacherFreeCourseMapper.xml

@@ -0,0 +1,80 @@
+<?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.CloudTeacherFreeCourseDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse" id="CloudTeacherFreeCourse">
+		<result column="id_" property="id" />
+		<result column="course_id_" property="courseId" />
+		<result column="calender_detail_id_" property="calenderDetailId" />
+		<result column="cost_" property="cost" />
+		<result column="operating_flag_" property="operatingFlag" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="CloudTeacherFreeCourse" >
+		SELECT * FROM cloud_teacher_free_course WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="CloudTeacherFreeCourse">
+		SELECT * FROM cloud_teacher_free_course ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO cloud_teacher_free_course (id_,course_id_,calender_detail_id_,cost_,operating_flag_,create_time_,update_time_) VALUES(#{id},#{courseId},#{calenderDetailId},#{cost},#{operatingFlag},#{createTime},#{updateTime})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse">
+		UPDATE cloud_teacher_free_course <set>
+<if test="id != null">
+id_ = #{id},
+</if>
+<if test="cost != null">
+cost_ = #{cost},
+</if>
+<if test="updateTime != null">
+update_time_ = #{updateTime},
+</if>
+<if test="courseId != null">
+course_id_ = #{courseId},
+</if>
+<if test="calenderDetailId != null">
+calender_detail_id_ = #{calenderDetailId},
+</if>
+<if test="operatingFlag != null">
+operating_flag_ = #{operatingFlag},
+</if>
+<if test="createTime != null">
+create_time_ = #{createTime},
+</if>
+</set> WHERE id_ = #{id} 
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM cloud_teacher_free_course WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="CloudTeacherFreeCourse" parameterType="map">
+		SELECT * FROM cloud_teacher_free_course ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM cloud_teacher_free_course
+	</select>
+</mapper>

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

@@ -3179,6 +3179,9 @@
     <update id="updateEvaluate">
         UPDATE course_schedule SET evaluate_flag_ = 1 WHERE id_ = #{courseScheduleId}
     </update>
+    <update id="markFreeCourse">
+        UPDATE course_schedule SET member_flag_ = 1 WHERE FIND_IN_SET(id_,#{courseIds})
+    </update>
 
     <select id="getStudentCourseScheduleNum" resultMap="com.ym.mec.biz.dal.dao.PracticeGroupDao.courseGroupExport">
         SELECT COUNT(*) total_class_times_,cssp.user_id_ student_id_

+ 2 - 20
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -59,34 +59,16 @@
         actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,
         payment_pattern_,payment_type_,payment_amount_,batch_no_,audit_memo_,operator_,attribute1_,
          attribute2_,student_ids_,member_payment_amount_,member_rank_setting_id_,member_valid_date_
-         ,original_member_payment_amount_,current_total_amount_,original_total_amount_,tenant_id_,organ_id_)
+         ,original_member_payment_amount_,current_total_amount_,original_total_amount_,tenant_id_,organ_id_,cloud_teacher_payment_flag_)
         VALUES(#{musicGroupId},#{musicGroupOrganizationCourseSettingId},#{payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{rejectReason},#{startPaymentDate},#{deadlinePaymentDate},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{expectNum},#{actualNum},#{memo},#{isGiveMusicNetwork},now(),now(),
         #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{paymentAmount},#{batchNo},#{auditMemo},#{operator},#{attribute1},#{attribute2},#{studentIds},
                #{memberPaymentAmount},#{memberRankSettingId},#{memberValidDate},#{originalMemberPaymentAmount},
-               #{currentTotalAmount},#{originalTotalAmount},#{tenantId},#{organId})
+               #{currentTotalAmount},#{originalTotalAmount},#{tenantId},#{organId},#{cloudTeacherPaymentFlag})
     </insert>
 
-    <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
-            keyColumn="id_" keyProperty="id">
-        INSERT INTO music_group_payment_calender
-        (music_group_id_,music_group_organization_course_settings_id_,pay_user_type_,reject_reason_,start_payment_date_,deadline_payment_date_,status_,expect_num_,
-        actual_num_,memo_,is_give_music_network_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_amount_,
-        payment_type_,batch_no_,audit_memo_,operator_,attribute1_,attribute2_,student_ids_,
-         member_payment_amount_,member_rank_setting_id_,member_valid_date_,original_member_payment_amount_
-        ,current_total_amount_,original_total_amount_,tenant_id_,organ_id_)
-        VALUES
-        <foreach collection="list" item="item" index="index" separator=",">
-        (#{item.musicGroupId},#{item.musicGroupOrganizationCourseSettingId},#{item.payUserType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.rejectReason},#{item.startPaymentDate},#{item.deadlinePaymentDate},#{item.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{item.expectNum},#{item.actualNum},#{item.memo},#{item.isGiveMusicNetwork},now(),now(),
-        #{item.paymentValidStartDate},#{item.paymentValidEndDate},#{item.paymentPattern},#{item.paymentAmount},#{item.paymentType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{item.batchNo},#{item.auditMemo},#{item.operator},#{item.attribute1},#{item.attribute2},
-         #{item.studentIds},#{item.memberPaymentAmount},#{item.memberRankSettingId},#{item.memberValidDate},#{item.originalMemberPaymentAmount},
-         #{item.currentTotalAmount},#{item.originalTotalAmount},#{item.tenantId},#{item.organId})
-        </foreach>
-    </insert>
 
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender">

+ 7 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -16,6 +16,7 @@
         <result column="course_current_price_" property="courseCurrentPrice"/>
         <result column="total_course_minutes_" property="totalCourseMinutes"/>
         <result column="used_course_minutes_" property="usedCourseMinutes"/>
+        <result column="cloud_teacher_payment_flag_" property="cloudTeacherPaymentFlag"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="tenant_id_" property="tenantId"/>
@@ -43,23 +44,25 @@
         INSERT INTO music_group_payment_student_course_detail
         (music_group_payment_calender_id_, music_group_payment_calender_detail_id_, user_id_, course_type_,
          total_course_minutes_, used_course_minutes_, create_time_, update_time_, course_original_price_,
-         course_current_price_, tenant_id_)
+         course_current_price_, tenant_id_,cloud_teacher_payment_flag_)
         VALUES (#{musicGroupPaymentCalenderId}, #{musicGroupPaymentCalenderDetailId}, #{userId},
                 #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{totalCourseMinutes},
                 #{usedCourseMinutes},
-                NOW(), NOW(), #{courseOriginalPrice}, #{courseCurrentPrice}, #{tenantId})
+                NOW(), NOW(), #{courseOriginalPrice}, #{courseCurrentPrice}, #{tenantId},#{cloudTeacherPaymentFlag})
     </insert>
 
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO music_group_payment_student_course_detail
         (music_group_payment_calender_id_,music_group_payment_calender_detail_id_,user_id_,
-        course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_,course_original_price_,course_current_price_,tenant_id_)
+        course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_,course_original_price_,
+         course_current_price_,tenant_id_,cloud_teacher_payment_flag_)
         VALUES
         <foreach collection="list" item="item" separator=",">
             (#{item.musicGroupPaymentCalenderId},#{item.musicGroupPaymentCalenderDetailId},
             #{item.userId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{item.totalCourseMinutes},#{item.usedCourseMinutes},NOW(),NOW(),#{item.courseOriginalPrice},#{item.courseCurrentPrice},#{item.tenantId})
+            #{item.totalCourseMinutes},#{item.usedCourseMinutes},NOW(),NOW(),#{item.courseOriginalPrice},
+             #{item.courseCurrentPrice},#{item.tenantId},#{item.cloudTeacherPaymentFlag})
         </foreach>
     </insert>
 

+ 86 - 0
mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml

@@ -0,0 +1,86 @@
+<?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.OperatingReportCloudDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.OperatingReportCloud" id="OperatingReportCloud">
+		<result column="id_" property="id" />
+		<result column="organ_id_" property="organId" />
+		<result column="calender_id_" property="calenderId" />
+		<result column="user_id_" property="userId" />
+		<result column="start_date_" property="startDate" />
+		<result column="end_date_" property="endDate" />
+		<result column="cloud_price_" property="cloudPrice" />
+		<result column="course_price_" property="coursePrice" />
+		<result column="settlement_flag_" property="settlementFlag" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="OperatingReportCloud" >
+		SELECT * FROM operating_report_cloud WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="OperatingReportCloud">
+		SELECT * FROM operating_report_cloud ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.OperatingReportCloud" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO operating_report_cloud (organ_id_,calender_id_,user_id_,start_date_,end_date_,cloud_price_,course_price_,settlement_flag_,create_time_,update_time_)
+		VALUES(#{organId},#{calenderId},#{userId},#{startDate},#{endDate},#{cloudPrice},#{coursePrice},#{settlementFlag},#{createTime},#{updateTime})
+	</insert>
+	<insert id="batchInsert">
+		INSERT INTO operating_report_cloud (organ_id_,calender_id_,user_id_,create_time_,update_time_) VALUES
+		<foreach collection="operatingReportClouds" separator="," item="item">
+			(#{item.organId},#{item.calenderId},#{item.userId},NOW(),NOW())
+		</foreach>
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReportCloud">
+		UPDATE operating_report_cloud <set>
+		<if test="startDate != null">
+		start_date_ = #{startDate},
+		</if>
+		<if test="endDate != null">
+		end_date_ = #{endDate},
+		</if>
+		<if test="updateTime != null">
+		update_time_ = #{updateTime},
+		</if>
+		<if test="cloudPrice != null">
+		cloud_price_ = #{cloudPrice},
+		</if>
+		<if test="settlementFlag != null">
+		settlement_flag_ = #{settlementFlag},
+		</if>
+		<if test="coursePrice != null">
+		course_price_ = #{coursePrice},
+		</if>
+		</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM operating_report_cloud WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="OperatingReportCloud" parameterType="map">
+		SELECT * FROM operating_report_cloud ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM operating_report_cloud
+	</select>
+	<select id="findByCalenderId" resultMap="OperatingReportCloud">
+		SELECT * FROM operating_report_cloud WHERE calender_id_ = #{calenderId} AND user_id_ = #{userId} LIMIT 1
+	</select>
+</mapper>

+ 9 - 0
mec-biz/src/main/resources/config/mybatis/OrganCourseTypeOriginalCostMapper.xml

@@ -11,4 +11,13 @@
     <sql id="Base_Column_List">
         id_, organ_id_, course_type_, price_
     </sql>
+    <select id="findByOrganIdAndCourseType" resultType="java.math.BigDecimal">
+        select price_ from organ_course_type_original_cost
+        where (organ_id_ = #{organId} OR organ_id_ = 0) AND course_type_ = #{courseType} limit 1
+    </select>
+    <select id="getCourseCostPrice" resultType="java.math.BigDecimal">
+        SELECT SUM(oct.price_) FROM course_schedule cs
+        LEFT JOIN organ_course_type_original_cost oct ON oct.course_type_ = cs.type_ AND (oct.organ_id_ = cs.organ_id_  OR oct.organ_id_ = 0)
+        where FIND_IN_SET(cs.id_,#{courseIds})
+    </select>
 </mapper>

+ 0 - 22
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -288,28 +288,6 @@ public class MusicGroupController extends BaseController {
         return musicGroupService.pay(registerPayDto);
     }
 
-    @ApiOperation(value = "乐团报名重新支付")
-    @PostMapping("/rePay")
-    @ApiImplicitParams({@ApiImplicitParam(name = "registerPayDto", value = "支付信息", required = true, dataType = "RegisterPayDto")})
-    public HttpResponseResult rePay(@RequestBody RegisterPayDto registerPayDto) throws Exception {
-        /*StudentRegistration studentRegistration = studentRegistrationService.get(registerPayDto.getRegisterId().longValue());
-        if (studentRegistration == null) {
-            return failed("报名信息有误,请核查");
-        }
-        String err = studentRegistrationService.checkRegOrPayStatus(studentRegistration.getMusicGroupId());
-        if (err != null) {
-            return failed(err + "不可缴费,请联系教务老师");
-        }
-        Map payMap = musicGroupService.rePay(registerPayDto);
-        if (payMap.containsKey("hasPaidZero")) {
-            return failed(HttpStatus.RESET_CONTENT, payMap, "报名审核中");
-        }
-        if (payMap.containsKey("tradeState")) {
-            return failed(HttpStatus.CREATED, payMap, "恭喜您,报名成功!");
-        }
-        return succeed(payMap);*/
-        return failed("操作失败,请联系管理员");
-    }
 
     @ApiOperation(value = "订单状态查询")
     @GetMapping("/getOrderStatus")

+ 7 - 12
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -1,7 +1,5 @@
 package com.ym.mec.student.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
@@ -12,6 +10,7 @@ import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.service.MusicGroupService;
 import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -22,6 +21,7 @@ import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+
 import java.util.Date;
 
 @RequestMapping("register")
@@ -36,7 +36,7 @@ public class MusicGroupRegisterController extends BaseController {
     @Autowired
     private MusicGroupService musicGroupService;
     @Autowired
-    private SysUserFeignService sysUserFeignService;
+    private SysUserService sysUserService;
     @Autowired
     private StudentRegistrationDao studentRegistrationDao;
 
@@ -44,19 +44,14 @@ public class MusicGroupRegisterController extends BaseController {
     @ApiOperation(value = "新增学生报名信息")
     @PostMapping("/add")
     public HttpResponseResult add(@RequestBody StudentRegistration studentRegistration) throws Exception {
-
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed("用户信息获取失败");
-        }
-
+        Integer userId = sysUserService.getUserId();
         Date date = new Date();
         MusicGroup musicGroup = musicGroupService.get(studentRegistration.getMusicGroupId());
         if (musicGroup == null) {
             return failed("乐团信息不存在");
         }
         if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-            boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroup.getId(), sysUser.getId());
+            boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroup.getId(), userId);
             if(hasMemberGroup){
                 throw new BizException("您已在其他会员团中,不可报名该乐团,请联系乐团主管");
             }
@@ -71,7 +66,7 @@ public class MusicGroupRegisterController extends BaseController {
             return succeed(studentRegistrationService.updateStudent(studentRegistration));
         }
 
-        StudentRegistration hasReg = studentRegistrationDao.getByUserIdAndMusicGroupId(studentRegistration.getMusicGroupId(),sysUser.getId());
+        StudentRegistration hasReg = studentRegistrationDao.getByUserIdAndMusicGroupId(studentRegistration.getMusicGroupId(),userId);
         if (hasReg != null && hasReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT) {
             return succeed(hasReg);
         }
@@ -93,7 +88,7 @@ public class MusicGroupRegisterController extends BaseController {
         }
 
         if (studentRegistration.getUserId() == null) {
-            studentRegistration.setUserId(sysUser.getId());
+            studentRegistration.setUserId(userId);
         }
 
         return succeed(studentRegistrationService.addStudent(studentRegistration));

+ 1 - 3
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ActivityUserMapperController.java

@@ -78,9 +78,7 @@ public class ActivityUserMapperController extends BaseController {
         applyBaseInfo.setUserId(sysUserService.getUserId());
         Teacher teacher = teacherDao.get(applyBaseInfo.getUserId());
         applyBaseInfo.setOrganId(teacher.getTeacherOrganId());
-        for (CourseSchedule courseSchedule : vipGroupApplyDto.getCourseSchedules()) {
-            courseSchedule.setEndClassTime(DateUtil.addMinutes(courseSchedule.getStartClassTime(), applyBaseInfo.getSingleClassMinutes()));
-        }
+        vipGroupApplyDto.getCourseSchedules().stream().forEach(e->e.setEndClassTime(DateUtil.addMinutes(e.getStartClassTime(), applyBaseInfo.getSingleClassMinutes())));
         VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(applyBaseInfo.getVipGroupCategoryId(), applyBaseInfo.getOrganId());
         if(Objects.nonNull(vipGroupDefaultClassesUnitPrice)){
             applyBaseInfo.setOnlineClassesUnitPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());

+ 0 - 8
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java

@@ -38,14 +38,6 @@ public class MusicGroupPaymentCalenderDetailController extends BaseController {
         return succeed(musicGroupPaymentCalenderDetailService.queryDetailPage(queryInfo));
     }
 
-    @ApiOperation(value = "修改学员预计缴费金额")
-    @PostMapping("/updateExpectAmount")
-    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/updateExpectAmount')")
-    public Object updateExpectAmount(BigDecimal expectAmount,BigDecimal expectMemberAmount,String ids) {
-//        musicGroupPaymentCalenderDetailService.updateExpectAmount(expectAmount,expectMemberAmount,ids);
-        return succeed();
-    }
-
     @ApiOperation(value = "新增缴费学员列表获取")
     @PostMapping("/queryFeeStudents")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalenderDetail/queryFeeStudents')")