瀏覽代碼

Merge branch 'zx_saas_0810' of http://git.dayaedu.com/yonge/mec into master_saas

 Conflicts:
	mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
zouxuan 2 年之前
父節點
當前提交
91ded56fb2
共有 61 個文件被更改,包括 1864 次插入808 次删除
  1. 3 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ActivityUserMapperDao.java
  2. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherFreeCourseDao.java
  3. 1 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java
  4. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  5. 0 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  6. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicMarginDao.java
  7. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java
  8. 68 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportNewDao.java
  9. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganCourseTypeOriginalCostDao.java
  10. 64 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CheckScheduleQualificationDto.java
  11. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ActivityUserMapper.java
  12. 80 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherFreeCourse.java
  13. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CloudTeacherOrder.java
  14. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java
  15. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentStudentCourseDetail.java
  16. 191 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicMargin.java
  17. 138 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportCloud.java
  18. 54 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportNew.java
  19. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicMarginQueryInfo.java
  20. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/service/ActivityUserMapperService.java
  21. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherFreeCourseService.java
  22. 0 8
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java
  23. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  24. 0 19
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java
  25. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicMarginService.java
  26. 37 0
      mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java
  27. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportNewService.java
  28. 0 41
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  29. 63 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ActivityUserMapperServiceImpl.java
  30. 0 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  31. 2 30
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java
  32. 36 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherFreeCourseServiceImpl.java
  33. 10 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  34. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  35. 21 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  36. 6 34
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  37. 16 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  38. 5 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  39. 0 302
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  40. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicMarginServiceImpl.java
  41. 103 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java
  42. 97 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java
  43. 29 174
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  44. 18 14
      mec-biz/src/main/resources/config/mybatis/ActivityUserMapperMapper.xml
  45. 70 0
      mec-biz/src/main/resources/config/mybatis/CloudTeacherFreeCourseMapper.xml
  46. 7 12
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  47. 3 0
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  48. 2 20
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  49. 7 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml
  50. 123 0
      mec-biz/src/main/resources/config/mybatis/MusicMarginMapper.xml
  51. 86 0
      mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml
  52. 237 0
      mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml
  53. 9 0
      mec-biz/src/main/resources/config/mybatis/OrganCourseTypeOriginalCostMapper.xml
  54. 0 22
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  55. 7 12
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  56. 1 3
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/ActivityUserMapperController.java
  57. 0 8
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderDetailController.java
  58. 0 14
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java
  59. 70 0
      mec-web/src/main/java/com/ym/mec/web/controller/MusicMarginController.java
  60. 0 7
      mec-web/src/main/java/com/ym/mec/web/controller/OperatingReportController.java
  61. 11 2
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.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);
 }

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

@@ -0,0 +1,12 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CloudTeacherFreeCourseDao extends BaseDAO<Long, CloudTeacherFreeCourse> {
+
+    void batchInsert(@Param("scheduleIdList") String scheduleIdList, @Param("calenderId") Long calenderId);
+}

+ 1 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java

@@ -3,11 +3,11 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.dto.CloudTeacherActiveTargetDetailDto;
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
 import com.ym.mec.biz.dal.dto.Mapper;
-import com.ym.mec.biz.dal.dto.SysUserDto;
 import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
 import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
+
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
@@ -39,13 +39,6 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
     List<CloudTeacherOrder> getStudentCloudTeacherOrders(@Param("studentIds") List<Integer> studentIds, @Param("musicGroupId") String musicGroupId);
 
     /**
-     * 获取乐团报名的云教练订单
-     * @param studentId
-     * @return
-     */
-    List<CloudTeacherOrder> getStudentCloudTeacherOrder(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
-    
-    /**
      * 根据订单编号查询订单详情
      * @param orderId
      * @return

+ 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

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicMarginDao.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.MusicMargin;
+
+public interface MusicMarginDao extends BaseDAO<Integer, MusicMargin> {
+
+	
+}

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

@@ -0,0 +1,22 @@
+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);
+
+    /**
+    * @description: 根据缴费项目编号和是否当月结算查询
+     * @param calenderId
+     * @param monthFlag
+    * @return com.ym.mec.biz.dal.entity.OperatingReportCloud
+    * @author zx
+    * @date 2022/9/7 09:45
+    */
+    OperatingReportCloud findByCalenderId(@Param("calenderId") Long calenderId, @Param("monthFlag") Boolean monthFlag);
+}

+ 68 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportNewDao.java

@@ -0,0 +1,68 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.OperatingReportNew;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+public interface OperatingReportNewDao extends BaseDAO<Integer, OperatingReportNew> {
+
+    List<OperatingReportNew> initOperatingReport(String currentMonth);
+
+    //获取销售收入和销售成本
+    List<OperatingReportNew> sumSellAmount(String month);
+
+    //云教练赠送课程服务收入
+    List<Map<Integer,BigDecimal>> sumCloudCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+
+    //付费课程收入
+    List<Map<Integer,BigDecimal>> sumCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+
+    //个人云教练服务收入
+    List<Map<Integer,BigDecimal>> sumPersonalCloudAmount(@Param("month") String month, @Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+
+    //团体云教练服务收入
+    List<Map<Integer,BigDecimal>> sumGroupCloudAmount(@Param("month") String month, @Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+
+    //业务退费
+    List<Map<Integer,BigDecimal>> sumRefundAmount(@Param("month") String month);
+
+    //变动费用
+    List<Map<Integer,BigDecimal>> sumVariableCosts(@Param("month") String month);
+
+    //固定费用
+    List<Map<Integer,BigDecimal>> sumFixedCosts(@Param("month") String month);
+
+    //个人云教练预收款
+    List<Map<Integer,BigDecimal>> sumCloudPreAmount(@Param("month") String month, @Param("lastDay") String lastDay);
+
+    //团体云教练分月结转
+    List<Map<Integer,BigDecimal>> sumGroupCloudPreAmount(@Param("month") String month, @Param("lastDay") String lastDay);
+
+    //团体云教练当月一次性结转
+    List<Map<Integer,BigDecimal>> sumGroupAmount();
+
+    //云教练赠课预收
+    List<Map<Integer,BigDecimal>> sumCloudCoursePreAmount(@Param("lastDay") String lastDay);
+
+    //付费课程预收
+    List<Map<Integer,BigDecimal>> sumCoursePreAmount(@Param("lastDay") String lastDay);
+
+    //其他预收
+    List<Map<Integer,BigDecimal>> sumOtherPreAmount();
+
+    //销售预收
+    List<Map<Integer,BigDecimal>> sumSalePreAmount();
+
+    //欠费总金额
+    List<Map<Integer,BigDecimal>> sumArrearsAmount();
+
+    //待缴费学校金额
+    List<Map<Integer,BigDecimal>> sumSchoolAmount();
+
+    //更新云教练计费时间
+    void initCloudStartTime(@Param("lastDay") String lastDay);
+}

+ 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;
 	}

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

@@ -0,0 +1,80 @@
+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 Long calenderId;
+	
+	/** 课程成本 */
+	private java.math.BigDecimal cost;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+
+	public Long getCalenderId() {
+		return calenderId;
+	}
+
+	public void setCalenderId(Long calenderId) {
+		this.calenderId = calenderId;
+	}
+
+	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 setCost(java.math.BigDecimal cost){
+		this.cost = cost;
+	}
+	
+	public java.math.BigDecimal getCost(){
+		return this.cost;
+	}
+
+	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);
+	}
+
+}

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

@@ -50,6 +50,9 @@ public class CloudTeacherOrder extends BaseEntity {
     @ApiModelProperty(value = "购买价格")
     private BigDecimal amount;
 
+    @ApiModelProperty(value = "经营报表结算价")
+    private BigDecimal operatingAmount = BigDecimal.ZERO;
+
     /**
      * 退回金额
      */
@@ -116,10 +119,19 @@ public class CloudTeacherOrder extends BaseEntity {
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
 
+    @ApiModelProperty(value = "乐团编号")
     private String musicGroupId;
     
     private StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
 
+    public BigDecimal getOperatingAmount() {
+        return operatingAmount;
+    }
+
+    public void setOperatingAmount(BigDecimal operatingAmount) {
+        this.operatingAmount = operatingAmount;
+    }
+
     public Integer getActiveRemark() {
         return activeRemark;
     }

+ 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;

+ 191 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicMargin.java

@@ -0,0 +1,191 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(music_margin):
+ */
+public class MusicMargin {
+
+	/**  */
+	private Integer id;
+	
+	/** 类型 */
+	private String type;
+	
+	/** 日期 */
+	private String date;
+	
+	/** 分部 */
+	private String organ;
+	
+	/** 学校 */
+	private String school;
+	
+	/** 用户编号,财务操作退款时填入 */
+	private Integer userId;
+	
+	/** 学员姓名 */
+	private String username;
+	
+	/** 期初 */
+	private java.math.BigDecimal init;
+	
+	/** 收款 */
+	private java.math.BigDecimal payment;
+	
+	/** 退款 */
+	private java.math.BigDecimal refund;
+	
+	/** 是否退款0否1是2拒绝 */
+	private Integer refundFlag;
+	
+	/** 余额 */
+	private java.math.BigDecimal balance;
+	
+	/** 保证金类型 */
+	private String marginType;
+	
+	/** 匹配 */
+	private String match;
+	
+	/** 备注 */
+	private String memo;
+	
+	/** 流程编号 */
+	private String processNo;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setType(String type){
+		this.type = type;
+	}
+	
+	public String getType(){
+		return this.type;
+	}
+			
+	public void setDate(String date){
+		this.date = date;
+	}
+	
+	public String getDate(){
+		return this.date;
+	}
+			
+	public void setOrgan(String organ){
+		this.organ = organ;
+	}
+	
+	public String getOrgan(){
+		return this.organ;
+	}
+			
+	public void setSchool(String school){
+		this.school = school;
+	}
+	
+	public String getSchool(){
+		return this.school;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setUsername(String username){
+		this.username = username;
+	}
+	
+	public String getUsername(){
+		return this.username;
+	}
+			
+	public void setInit(java.math.BigDecimal init){
+		this.init = init;
+	}
+	
+	public java.math.BigDecimal getInit(){
+		return this.init;
+	}
+			
+	public void setPayment(java.math.BigDecimal payment){
+		this.payment = payment;
+	}
+	
+	public java.math.BigDecimal getPayment(){
+		return this.payment;
+	}
+			
+	public void setRefund(java.math.BigDecimal refund){
+		this.refund = refund;
+	}
+	
+	public java.math.BigDecimal getRefund(){
+		return this.refund;
+	}
+			
+	public void setRefundFlag(Integer refundFlag){
+		this.refundFlag = refundFlag;
+	}
+	
+	public Integer getRefundFlag(){
+		return this.refundFlag;
+	}
+			
+	public void setBalance(java.math.BigDecimal balance){
+		this.balance = balance;
+	}
+	
+	public java.math.BigDecimal getBalance(){
+		return this.balance;
+	}
+			
+	public void setMarginType(String marginType){
+		this.marginType = marginType;
+	}
+	
+	public String getMarginType(){
+		return this.marginType;
+	}
+			
+	public void setMatch(String match){
+		this.match = match;
+	}
+	
+	public String getMatch(){
+		return this.match;
+	}
+			
+	public void setMemo(String memo){
+		this.memo = memo;
+	}
+	
+	public String getMemo(){
+		return this.memo;
+	}
+			
+	public void setProcessNo(String processNo){
+		this.processNo = processNo;
+	}
+	
+	public String getProcessNo(){
+		return this.processNo;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

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

@@ -0,0 +1,138 @@
+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 Integer organId;
+	
+	/** 缴费项目编号 */
+	private Long calenderId;
+
+	//是否是当月全部结转(欠费或者进行中加学员都在当月全部结转)
+	private Boolean monthFlag = false;
+	
+	/** 云教练预收开始计费时间(该字段只会再结算经营报表的时候去更新,因为课程会不断调整,结算的时候取缴费项目关联的课程的第一节课的日期) */
+	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 Boolean getMonthFlag() {
+		return monthFlag;
+	}
+
+	public void setMonthFlag(Boolean monthFlag) {
+		this.monthFlag = monthFlag;
+	}
+
+	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);
+	}
+
+}

+ 54 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OperatingReportNew.java

@@ -6,12 +6,17 @@ import java.math.BigDecimal;
 
 public class OperatingReportNew {
 
+    private Integer id;
+
     @ApiModelProperty(value="负责人")
     private String principal;
 
     @ApiModelProperty(value="城市")
     private String organName;
 
+    @ApiModelProperty(value="城市")
+    private Integer organId;
+
     @ApiModelProperty(value="销售收入(当月实收)")
     //实物销售收入(已收货商品)
     private BigDecimal saleAmount;
@@ -20,6 +25,15 @@ public class OperatingReportNew {
     @ApiModelProperty(value="服务收入(当月实收)")
     private BigDecimal serviceAmount;
 
+    @ApiModelProperty(value="课程收入")
+    private BigDecimal courseAmount;
+
+    @ApiModelProperty(value="云教练收入")
+    private BigDecimal cloudAmount;
+
+    @ApiModelProperty(value="其他收入")
+    private BigDecimal otherAmount;
+
     //当月退费列表总金额(当月退费列表已退费总金额)
     @ApiModelProperty(value="业务退费")
     private BigDecimal businessRefund;
@@ -69,6 +83,46 @@ public class OperatingReportNew {
     @ApiModelProperty(value="月份")
     private String month;
 
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public BigDecimal getCourseAmount() {
+        return courseAmount;
+    }
+
+    public void setCourseAmount(BigDecimal courseAmount) {
+        this.courseAmount = courseAmount;
+    }
+
+    public BigDecimal getCloudAmount() {
+        return cloudAmount;
+    }
+
+    public void setCloudAmount(BigDecimal cloudAmount) {
+        this.cloudAmount = cloudAmount;
+    }
+
+    public BigDecimal getOtherAmount() {
+        return otherAmount;
+    }
+
+    public void setOtherAmount(BigDecimal otherAmount) {
+        this.otherAmount = otherAmount;
+    }
+
     public String getMonth() {
         return month;
     }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicMarginQueryInfo.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class MusicMarginQueryInfo extends QueryInfo {
+
+    private Integer refundFlag;
+
+    public Integer getRefundFlag() {
+        return refundFlag;
+    }
+
+    public void setRefundFlag(Integer refundFlag) {
+        this.refundFlag = refundFlag;
+    }
+}

+ 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: 网管课活动排课

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherFreeCourseService.java

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dao.CloudTeacherFreeCourseDao;
+import com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse;
+import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CloudTeacherFreeCourseService extends BaseService<Long, CloudTeacherFreeCourse> {
+
+    CloudTeacherFreeCourseDao getDao();
+
+    void batchInsert(List<Long> scheduleIdList,Long calenderId);
+}

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java

@@ -53,14 +53,6 @@ public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacher
     List<CloudTeacherOrder> getStudentCloudTeacherOrders(List<Integer> studentIds, String musicGroupId);
 
     /**
-     * 获取乐团报名的云教练订单
-     *
-     * @param studentId
-     * @return
-     */
-    List<CloudTeacherOrder> getStudentCloudTeacherOrder(Integer studentId, String musicGroupId);
-
-    /**
      * 根据订单编号查询订单详情
      *
      * @param orderId

+ 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);
 
     /**
      * 给乐团添加报名学生

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicMarginService.java

@@ -0,0 +1,8 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.MusicMargin;
+import com.ym.mec.common.service.BaseService;
+
+public interface MusicMarginService extends BaseService<Integer, MusicMargin> {
+
+}

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

@@ -0,0 +1,37 @@
+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.math.BigDecimal;
+import java.util.List;
+
+public interface OperatingReportCloudService extends BaseService<Integer, OperatingReportCloud> {
+
+    OperatingReportCloudDao getDao();
+
+    /**
+    * @description: 缴费后,更新缴费项目关联的课程、云教练预收
+     * @param musicGroupPaymentCalender
+    * @return void
+    * @author zx
+    * @date 2022/9/6 10:09
+    */
+    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender, BigDecimal amount);
+
+    /**
+    * @description: 乐团排课、活动排课,计算课程预收
+     * @param calenderId
+     * @param scheduleIdList
+    * @return void
+    * @author zx
+    * @date 2022/9/6 10:52
+    */
+    void updateSet(Long calenderId, List<Long> scheduleIdList);
+
+    void save(MusicGroupPaymentCalender musicGroupPaymentCalender);
+}

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

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dao.OperatingReportNewDao;
+import com.ym.mec.biz.dal.entity.OperatingReportNew;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.Date;
+
+public interface OperatingReportNewService extends BaseService<Integer, OperatingReportNew> {
+
+    OperatingReportNewDao getDao();
+
+    void operatingReportMonth(Date month);
+}

+ 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);
 
     /**
      * 更新用户注册信息

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

@@ -95,6 +95,14 @@ 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;
+	@Autowired
+	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
 
 	@Override
 	public BaseDAO<Integer, ActivityUserMapper> getDAO() {
@@ -315,6 +323,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 +346,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 +524,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 +677,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,List<Long>> userMap = studentPayments.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getUserId,
+							Collectors.collectingAndThen(Collectors.toList(),value->value.stream().map(e->e.getCourseScheduleId()).collect(Collectors.toList()))));
+					userMap.keySet().stream().forEach(e-> operatingReportCloudService.updateSet(calenderId,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 +707,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 +742,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 +752,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 +783,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 +791,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 +803,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 +812,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 +826,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 +963,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);
         }
 

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

@@ -0,0 +1,36 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.CloudTeacherFreeCourseDao;
+import com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse;
+import com.ym.mec.biz.service.CloudTeacherFreeCourseService;
+import com.ym.mec.common.dal.BaseDAO;
+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.util.List;
+
+@Service
+public class CloudTeacherFreeCourseServiceImpl extends BaseServiceImpl<Long, CloudTeacherFreeCourse>  implements CloudTeacherFreeCourseService {
+	
+	@Autowired
+	private CloudTeacherFreeCourseDao cloudTeacherFreeCourseDao;
+
+	@Override
+	public BaseDAO<Long, CloudTeacherFreeCourse> getDAO() {
+		return cloudTeacherFreeCourseDao;
+	}
+
+	@Override
+	public CloudTeacherFreeCourseDao getDao() {
+		return cloudTeacherFreeCourseDao;
+	}
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void batchInsert(List<Long> scheduleIdList,Long calenderId) {
+		cloudTeacherFreeCourseDao.batchInsert(StringUtils.join(scheduleIdList,","),calenderId);
+    }
+}

+ 10 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
 import com.ym.mec.biz.dal.dto.CloudTeacherOrderDto;
 import com.ym.mec.biz.dal.dto.Mapper;
 import com.ym.mec.biz.dal.entity.*;
@@ -52,6 +53,9 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
     private IdGeneratorService idGenerator;
     @Autowired
     private TenantOrderRecordService tenantOrderRecordService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+
     @Override
     public BaseDAO<Long, CloudTeacherOrder> getDAO() {
         return cloudTeacherOrderDao;
@@ -281,6 +285,12 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         cloudTeacherOrder.setAmount(cloudTeacherFee);
         cloudTeacherOrder.setStudentId(order.getUserId());
         cloudTeacherOrder.setStatus(1);
+        MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(order.getCalenderId());
+        if(calender.getCloudTeacherPaymentFlag()){
+            cloudTeacherOrder.setOperatingAmount(BigDecimal.ZERO);
+        }else {
+            cloudTeacherOrder.setOperatingAmount(cloudTeacherFee);
+        }
         //保存云教练订单
         this.save(cloudTeacherOrder,calenderMember.getAutoActivationFlag());
     }
@@ -322,11 +332,6 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
     }
 
     @Override
-    public List<CloudTeacherOrder> getStudentCloudTeacherOrder(Integer studentId, String musicGroupId) {
-        return cloudTeacherOrderDao.getStudentCloudTeacherOrder(studentId, musicGroupId);
-    }
-
-    @Override
     public CloudTeacherOrderDto queryOrderInfoByOrderId(Long orderId) {
         return cloudTeacherOrderDao.queryOrderInfoByOrderId(orderId);
     }

+ 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){

+ 21 - 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
@@ -76,6 +77,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
 	@Autowired
 	private StudentPaymentOrderDao studentPaymentOrderDaop;
+	@Autowired
+	private CloudTeacherFreeCourseDao cloudTeacherFreeCourseDao;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
@@ -387,6 +390,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 +476,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 +511,19 @@ 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;
+									operatingReportCloudService.updateSet(detail.getMusicGroupPaymentCalenderId(),scheduleList.stream().map(e->e.getId()).collect(Collectors.toList()));
+								}
 							}
 							musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
 						}
@@ -521,6 +532,9 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 				}
 			}
 		}
+		if(cloudTeacherPaymentFlag){
+			courseScheduleDao.markFreeCourse(courseSchedules.stream().map(e->e.getId().toString()).collect(Collectors.joining(",")));
+		}
 	}
 
 	@Override

+ 6 - 34
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -269,6 +269,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         cloudTeacherOrder.setStudentId(sysUser.getId());
         cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId());
         cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount());
+        cloudTeacherOrder.setOperatingAmount(studentPaymentOrder.getExpectAmount());
         cloudTeacherOrderService.insert(cloudTeacherOrder);
         return BaseController.succeed(result);
     }
@@ -695,6 +696,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             cloudTeacherOrder.setStudentId(studentPaymentOrder.getUserId());
             cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId());
             cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount());
+            cloudTeacherOrder.setOperatingAmount(studentPaymentOrder.getExpectAmount());
             cloudTeacherOrderService.save(cloudTeacherOrder,tenantConfigService.autoActivationFlag(cloudTeacherOrder.getTenantId()));
             //赠送陪练课
             ActivityUserMapper activityUserMapper = new ActivityUserMapper();
@@ -785,7 +787,6 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
             //是否通过活动购买的团练宝
             if(Objects.nonNull(studentPaymentOrder.getActivityId())){
-//                Student student = studentService.get(userId);
                 VipGroupActivity activity = vipGroupActivityDao.get(Integer.parseInt(studentPaymentOrder.getActivityId()));
                 //保存团练宝数据
                 CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
@@ -797,40 +798,9 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
                 cloudTeacherOrder.setStudentId(studentPaymentOrder.getUserId());
                 cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId());
                 cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount());
+                cloudTeacherOrder.setOperatingAmount(studentPaymentOrder.getExpectAmount());
                 cloudTeacherOrderService.save(cloudTeacherOrder,tenantConfigService.autoActivationFlag(cloudTeacherOrder.getTenantId()));
-                //赠送陪练课
-//                ActivityUserMapper activityUserMapper = new ActivityUserMapper();
-//                activityUserMapper.setTeacherId(student.getTeacherId());
-//                activityUserMapper.setPaymentOrderId(studentPaymentOrder.getId());
-//                activityUserMapper.setUserId(studentPaymentOrder.getUserId());
-//                activityUserMapper.setActivityId(activity.getId());
-//                activityUserMapper.setActualPrice(BigDecimal.ZERO);
-//                activityUserMapper.setGivePracticeFlag(1);
-//                activityUserMapper.setReturnFee(false);
-//                activityUserMapperDao.insert(activityUserMapper);
-                //赠送训练营
-//                TempLittleArtistTrainingCampUserRelation tempLittleArtistTrainingCamp = new TempLittleArtistTrainingCampUserRelation();
-//                tempLittleArtistTrainingCamp.setUserId(studentPaymentOrder.getUserId());
-//                tempLittleArtistTrainingCamp.setState("NOT_APPLY");
-//                tempLittleArtistTrainingCamp.setCreateTime(nowDate);
-//                tempLittleArtistTrainingCampUserRelationDao.insert(tempLittleArtistTrainingCamp);
-                //生成订单详情
-//                StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
-//                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-//                studentPaymentOrderDetail.setType(OrderDetailTypeEnum.CLOUD_TEACHER);
-//                studentPaymentOrderDetail.setGoodsIdList("1");
-//                studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount());
-//                studentPaymentOrderDetail.setTenantId(studentPaymentOrder.getTenantId());
-//                studentPaymentOrderDetail.setCreateTime(nowDate);
-//                studentPaymentOrderDetail.setUpdateTime(nowDate);
-//                studentPaymentOrderDetailDao.insert(studentPaymentOrderDetail);
-                //赠送优惠券
-//                Integer giveCouponId = activity.getGiveCouponId();
-//                Integer giveCouponNum = activity.getGiveCouponNum();
-//                if(Objects.nonNull(giveCouponId) && Objects.nonNull(giveCouponNum)){
-//                    sysCouponCodeService.exchangeCoupon(userId,giveCouponId,
-//                            studentPaymentOrder.getId(),giveCouponNum,2,null);
-//                }
+
                 Map<Integer, String> phoneMaps = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(userId.toString()));
                 String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
                 StringBuffer pushUrl = new StringBuffer(baseApiUrl).append("/#/artistRegistration");
@@ -877,6 +847,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
                         cloudTeacherOrder.setStudentId(coachPaymentDetails.getUserId());
                         cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId());
                         cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount());
+                        cloudTeacherOrder.setOperatingAmount(studentPaymentOrder.getExpectAmount());
                         cloudTeacherOrderService.save(cloudTeacherOrder,cloudCoachPaymentProgram.getAutoActivationFlag());
                         //修改缴费状态
                         coachPaymentDetails.setPaymentStatus(1);
@@ -925,6 +896,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         cto.setLevel(1);
         cto.setTime(totalMonth.intValue());
         cto.setAmount(studentPaymentOrder.getActualAmount().add(studentPaymentOrder.getBalancePaymentAmount()));
+        cto.setOperatingAmount(cto.getAmount());
         cto.setStartTime(now.toDate());
         cto.setEndTime(DateUtil.addDays(now.plusMonths(totalMonth.intValue()).toDate(),1));
         cto.setOrderId(studentPaymentOrder.getId());

+ 16 - 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);
                 }
             }
@@ -525,7 +529,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();
@@ -551,6 +554,15 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
         }
 
+        //保存、更新云教练缴费项目预收
+        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getActualAmount());
+
+        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<>();
@@ -577,6 +589,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) {

+ 5 - 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;
@@ -121,6 +119,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     private StudentRegistrationService studentRegistrationService;
     @Autowired
     private VipGroupActivityDao vipGroupActivityDao;
+    @Autowired
+    private OperatingReportCloudService operatingReportCloudService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -296,7 +296,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)
@@ -356,6 +356,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         String batchNo = idGeneratorService.generatorId() + "";
         musicGroupPaymentCalender.setBatchNo(batchNo);
         musicGroupPaymentCalenderDao.insert(musicGroupPaymentCalender);
+
+        operatingReportCloudService.save(musicGroupPaymentCalender);
         Long calenderId = musicGroupPaymentCalender.getId();
         //保存会员缴费信息
         MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentBaseCalender.getCalenderMember();

+ 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)

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

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.common.dal.BaseDAO;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.biz.dal.entity.MusicMargin;
+import com.ym.mec.biz.service.MusicMarginService;
+import com.ym.mec.biz.dal.dao.MusicMarginDao;
+import org.springframework.stereotype.Service;
+
+@Service
+public class MusicMarginServiceImpl extends BaseServiceImpl<Integer, MusicMargin>  implements MusicMarginService {
+	
+	@Autowired
+	private MusicMarginDao musicMarginDao;
+
+	@Override
+	public BaseDAO<Integer, MusicMargin> getDAO() {
+		return musicMarginDao;
+	}
+	
+}

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

@@ -0,0 +1,103 @@
+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.CloudTeacherFreeCourseService;
+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.List;
+import java.util.Objects;
+
+@Service
+public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, OperatingReportCloud>  implements OperatingReportCloudService {
+	
+	@Autowired
+	private OperatingReportCloudDao operatingReportCloudDao;
+	@Autowired
+	private OrganCourseTypeOriginalCostDao organCourseTypeOriginalCostDao;
+	@Autowired
+	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
+
+	@Override
+	public BaseDAO<Integer, OperatingReportCloud> getDAO() {
+		return operatingReportCloudDao;
+	}
+
+	@Override
+	public OperatingReportCloudDao getDao() {
+		return operatingReportCloudDao;
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateSet(MusicGroupPaymentCalender calender, BigDecimal amount) {
+		if(!calender.getCloudTeacherPaymentFlag()){
+			return;
+		}
+		//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
+		//获取云教练信息
+		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId(),false);
+		if(Objects.isNull(reportCloud)){
+			reportCloud = new OperatingReportCloud();
+			reportCloud.setCalenderId(calender.getId());
+			reportCloud.setCloudPrice(amount);
+			reportCloud.setOrganId(calender.getOrganId());
+			operatingReportCloudDao.insert(reportCloud);
+		}else {
+			if(reportCloud.getSettlementFlag()){
+				OperatingReportCloud monthReportCloud = new OperatingReportCloud();
+				reportCloud.setCalenderId(calender.getId());
+				reportCloud.setCloudPrice(amount);
+				reportCloud.setOrganId(calender.getOrganId());
+				reportCloud.setMonthFlag(true);
+				operatingReportCloudDao.insert(monthReportCloud);
+			}else {
+				reportCloud.setCloudPrice(reportCloud.getCloudPrice().add(amount));
+				reportCloud.setUpdateTime(new Date());
+				operatingReportCloudDao.update(reportCloud);
+			}
+		}
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateSet(Long calenderId,List<Long> scheduleIdList) {
+		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calenderId,false);
+		if(Objects.isNull(reportCloud)){
+			throw new BizException("操作失败,请联系管理员");
+		}
+		if(reportCloud.getSettlementFlag()){
+			return;
+		}
+		cloudTeacherFreeCourseService.batchInsert(scheduleIdList,calenderId);
+		//计算课程预收
+		BigDecimal costPrice = organCourseTypeOriginalCostDao.getCourseCostPrice(StringUtils.join(scheduleIdList,","));
+		reportCloud.setCloudPrice(reportCloud.getCloudPrice().subtract(costPrice));
+		reportCloud.setCoursePrice(reportCloud.getCoursePrice().add(reportCloud.getCoursePrice()));
+		reportCloud.setUpdateTime(new Date());
+		operatingReportCloudDao.update(reportCloud);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void save(MusicGroupPaymentCalender musicGroupPaymentCalender) {
+		if(musicGroupPaymentCalender.getCloudTeacherPaymentFlag()){
+			OperatingReportCloud reportCloud = new OperatingReportCloud();
+			reportCloud.setCalenderId(musicGroupPaymentCalender.getId());
+			reportCloud.setCloudPrice(BigDecimal.ZERO);
+			reportCloud.setOrganId(musicGroupPaymentCalender.getOrganId());
+			operatingReportCloudDao.insert(reportCloud);
+		}
+	}
+}

+ 97 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java

@@ -0,0 +1,97 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.OperatingReportNewDao;
+import com.ym.mec.biz.dal.entity.OperatingReport;
+import com.ym.mec.biz.dal.entity.OperatingReportNew;
+import com.ym.mec.biz.service.OperatingReportNewService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import com.ym.mec.util.date.DateUtil;
+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.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Service
+public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, OperatingReportNew>  implements OperatingReportNewService {
+	
+	@Autowired
+	private OperatingReportNewDao operatingReportNewDao;
+
+	@Override
+	public BaseDAO<Integer, OperatingReportNew> getDAO() {
+		return operatingReportNewDao;
+	}
+
+    @Override
+    public OperatingReportNewDao getDao() {
+        return operatingReportNewDao;
+    }
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void operatingReportMonth(Date month) {
+		String firstDayOfMonth = DateUtil.dateToString(DateUtil.getFirstDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
+		String lastDayOfMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
+		String currentMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_YEAR_MONTH_FORMAT);
+		List<OperatingReportNew> operatingList = operatingReportNewDao.initOperatingReport(currentMonth);
+		//更新团体云教练计费时间()
+		operatingReportNewDao.initCloudStartTime(lastDayOfMonth);
+		//销售收入、销售成本
+		List<OperatingReportNew> sellList = operatingReportNewDao.sumSellAmount(currentMonth);
+		Map<Integer, OperatingReportNew> collect = sellList.stream().collect(Collectors.groupingBy(OperatingReportNew::getOrganId,Collectors.collectingAndThen(Collectors.toList(),value->value.get(0))));
+		//服务收入
+		//云教练赠送课程实际收入
+		Map<Integer, BigDecimal> collect1 = MapUtil.mapListToMap(operatingReportNewDao.sumCloudCourseAmount(firstDayOfMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+		//付费课程实际收入
+		Map<Integer, BigDecimal> collect2 = MapUtil.mapListToMap(operatingReportNewDao.sumCourseAmount(firstDayOfMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+		//个人云教练当月收入
+		Map<Integer, BigDecimal> collect3 = MapUtil.mapListToMap(operatingReportNewDao.sumPersonalCloudAmount(currentMonth,firstDayOfMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+		//团体云教练费用
+		Map<Integer, BigDecimal> collect4 = MapUtil.mapListToMap(operatingReportNewDao.sumGroupCloudAmount(currentMonth,firstDayOfMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+		//团体云教练当月一次性结转
+		Map<Integer, BigDecimal> collect5 = MapUtil.mapListToMap(operatingReportNewDao.sumGroupAmount(),Integer.class,BigDecimal.class);
+
+		//业务退费
+		Map<Integer, BigDecimal> collect6 = MapUtil.mapListToMap(operatingReportNewDao.sumRefundAmount(currentMonth),Integer.class,BigDecimal.class);
+		//变动费用
+		Map<Integer, BigDecimal> collect7 = MapUtil.mapListToMap(operatingReportNewDao.sumVariableCosts(currentMonth),Integer.class,BigDecimal.class);
+		//固定费用
+		Map<Integer, BigDecimal> collect8 = MapUtil.mapListToMap(operatingReportNewDao.sumFixedCosts(currentMonth),Integer.class,BigDecimal.class);
+		//内部结算
+
+		//云教练预收款
+		//个人云教练预收款
+		Map<Integer, BigDecimal> collect9 = MapUtil.mapListToMap(operatingReportNewDao.sumCloudPreAmount(currentMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+		//团体云教练预收款
+		Map<Integer, BigDecimal> collect10 = MapUtil.mapListToMap(operatingReportNewDao.sumGroupCloudPreAmount(currentMonth,lastDayOfMonth),Integer.class,BigDecimal.class);
+
+		//课程预收
+		//云教练赠课预收
+		Map<Integer, BigDecimal> collect11 = MapUtil.mapListToMap(operatingReportNewDao.sumCloudCoursePreAmount(lastDayOfMonth),Integer.class,BigDecimal.class);
+		//付费课程预收
+		Map<Integer, BigDecimal> collect12 = MapUtil.mapListToMap(operatingReportNewDao.sumCoursePreAmount(lastDayOfMonth),Integer.class,BigDecimal.class);
+		//销售预收
+		Map<Integer, BigDecimal> collect13 = MapUtil.mapListToMap(operatingReportNewDao.sumSalePreAmount(),Integer.class,BigDecimal.class);
+		//其他预收
+		Map<Integer, BigDecimal> collect14 = MapUtil.mapListToMap(operatingReportNewDao.sumOtherPreAmount(),Integer.class,BigDecimal.class);
+
+		//预付款
+
+		//应收
+		//欠费学员总金额
+		Map<Integer, BigDecimal> collect15 = MapUtil.mapListToMap(operatingReportNewDao.sumArrearsAmount(),Integer.class,BigDecimal.class);
+		//学校缴费订单待收款金额
+		Map<Integer, BigDecimal> collect16 = MapUtil.mapListToMap(operatingReportNewDao.sumSchoolAmount(),Integer.class,BigDecimal.class);
+
+		//应付(乐器押金)
+
+
+	}
+}

+ 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>
 

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

@@ -0,0 +1,70 @@
+<?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_id_" property="calenderId" />
+		<result column="cost_" property="cost" />
+		<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">
+		INSERT INTO cloud_teacher_free_course (id_,course_id_,cost_,calender_id_,create_time_,update_time_)
+		VALUES(#{id},#{courseId},#{cost},#{calenderId},NOW(),NOW())
+	</insert>
+    <insert id="batchInsert">
+		insert into cloud_teacher_free_course (course_id_, cost_,calender_id_, create_time_, update_time_)
+		SELECT cs.id_,oct.price_,#{calenderId},NOW(),NOW() 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_,#{scheduleIdList})
+		GROUP BY cs.id_
+	</insert>
+
+    <!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherFreeCourse">
+		UPDATE cloud_teacher_free_course <set>
+		<if test="cost != null">
+		cost_ = #{cost},
+		</if>
+		<if test="updateTime != null">
+		update_time_ = #{updateTime},
+		</if>
+		<if test="courseId != null">
+		course_id_ = #{courseId},
+		</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>

+ 7 - 12
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -11,6 +11,7 @@
         <result column="level_" property="level"/>
         <result column="time_" property="time"/>
         <result column="amount_" property="amount"/>
+        <result column="operating_amount_" property="operatingAmount"/>
         <result column="refund_amount_" property="refundAmount"/>
         <result column="status_" property="status"/>
         <result column="start_time_" property="startTime"/>
@@ -34,6 +35,7 @@
         <result column="level_" property="cloudTeacherOrder.level"/>
         <result column="time_" property="cloudTeacherOrder.time"/>
         <result column="amount_" property="cloudTeacherOrder.amount"/>
+        <result column="operating_amount_" property="cloudTeacherOrder.operatingAmount"/>
         <result column="refund_amount_" property="cloudTeacherOrder.refundAmount"/>
         <result column="status_" property="cloudTeacherOrder.status"/>
         <result column="start_time_" property="cloudTeacherOrder.startTime"/>
@@ -58,9 +60,9 @@
     </delete>
     <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherOrder"
             useGeneratedKeys="true">
-        INSERT INTO cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_, refund_amount_, status_,
+        INSERT INTO cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_, operating_amount_, refund_amount_, status_,
         order_id_,platform_order_id_,start_time_,end_time_,remark_, create_time_, update_time_,music_group_id_,active_remark_,tenant_id_)
-        VALUES (#{organId},#{studentId}, #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{level}, #{time}, #{amount}, #{refundAmount},
+        VALUES (#{organId},#{studentId}, #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{level}, #{time}, #{amount}, #{operatingAmount}, #{refundAmount},
         #{status},#{orderId},#{platformOrderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherOrder">
@@ -91,6 +93,9 @@
             <if test="amount != null">
                 amount_ = #{amount},
             </if>
+            <if test="operatingAmount != null">
+                operating_amount_ = #{operatingAmount},
+            </if>
             <if test="refundAmount != null">
                 refund_amount_ = #{refundAmount},
             </if>
@@ -220,16 +225,6 @@
         AND status_ IN (1,2)
     </select>
 
-    <select id="getStudentCloudTeacherOrder" resultMap="CloudTeacherOrder">
-        SELECT *
-        FROM cloud_teacher_order
-        WHERE student_id_ = #{studentId}
-        <if test="musicGroupId != null and musicGroupId != ''">
-          AND music_group_id_ = #{musicGroupId}
-        </if>
-          AND status_ IN (1, 2)
-    </select>
-
     <select id="queryByOrderId" resultMap="CloudTeacherOrder">
         SELECT cto.* FROM cloud_teacher_order cto
         WHERE order_id_ = #{orderId}

+ 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>
 

+ 123 - 0
mec-biz/src/main/resources/config/mybatis/MusicMarginMapper.xml

@@ -0,0 +1,123 @@
+<?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.MusicMarginDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.MusicMargin" id="MusicMargin">
+		<result column="id_" property="id" />
+		<result column="type_" property="type" />
+		<result column="date_" property="date" />
+		<result column="organ_" property="organ" />
+		<result column="school_" property="school" />
+		<result column="user_id_" property="userId" />
+		<result column="username_" property="username" />
+		<result column="init_" property="init" />
+		<result column="payment_" property="payment" />
+		<result column="refund_" property="refund" />
+		<result column="refund_flag_" property="refundFlag" />
+		<result column="balance_" property="balance" />
+		<result column="margin_type_" property="marginType" />
+		<result column="match_" property="match" />
+		<result column="memo_" property="memo" />
+		<result column="process_no_" property="processNo" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="MusicMargin" >
+		SELECT * FROM music_margin WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="MusicMargin">
+		SELECT * FROM music_margin ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicMargin" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO music_margin (id_,type_,date_,organ_,school_,user_id_,username_,init_,payment_,refund_,refund_flag_,balance_,margin_type_,match_,memo_,process_no_) VALUES(#{id},#{type},#{date},#{organ},#{school},#{userId},#{username},#{init},#{payment},#{refund},#{refundFlag},#{balance},#{marginType},#{match},#{memo},#{processNo})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicMargin">
+		UPDATE music_margin <set>
+<if test="school != null">
+school_ = #{school},
+</if>
+<if test="id != null">
+id_ = #{id},
+</if>
+<if test="balance != null">
+balance_ = #{balance},
+</if>
+<if test="memo != null">
+memo_ = #{memo},
+</if>
+<if test="organ != null">
+organ_ = #{organ},
+</if>
+<if test="username != null">
+username_ = #{username},
+</if>
+<if test="refundFlag != null">
+refund_flag_ = #{refundFlag},
+</if>
+<if test="userId != null">
+user_id_ = #{userId},
+</if>
+<if test="payment != null">
+payment_ = #{payment},
+</if>
+<if test="refund != null">
+refund_ = #{refund},
+</if>
+<if test="init != null">
+init_ = #{init},
+</if>
+<if test="match != null">
+match_ = #{match},
+</if>
+<if test="processNo != null">
+process_no_ = #{processNo},
+</if>
+<if test="marginType != null">
+margin_type_ = #{marginType},
+</if>
+<if test="type != null">
+type_ = #{type},
+</if>
+<if test="date != null">
+date_ = #{date},
+</if>
+</set> WHERE id_ = #{id} 
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM music_margin WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="MusicMargin" parameterType="map">
+		SELECT * FROM music_margin
+		ORDER BY id_
+		<include refid="global.limit"/>
+	</select>
+	<sql id="queryPageSql">
+		<where>
+			<if test="refundFlag != null">
+				AND refund_flag_ = #{refundFlag}
+			</if>
+			<if test="search != null and search != ''">
+				AND (username_ LIKE CONCAT('%',#{search},'%') OR user_id_ = #{search})
+			</if>
+		</where>
+	</sql>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM music_margin
+	</select>
+</mapper>

+ 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="month_flag_" property="monthFlag" />
+		<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_,start_date_,end_date_,cloud_price_,course_price_,settlement_flag_,month_flag_,create_time_,update_time_)
+		VALUES(#{organId},#{calenderId},#{startDate},#{endDate},#{cloudPrice},#{coursePrice},#{settlementFlag},#{monthFlag},NOW(),NOW())
+	</insert>
+	<insert id="batchInsert">
+		INSERT INTO operating_report_cloud (organ_id_,calender_id_,month_flag_,create_time_,update_time_) VALUES
+		<foreach collection="operatingReportClouds" separator="," item="item">
+			(#{item.organId},#{item.calenderId},#{item.monthFlag},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 month_flag_ = #{monthFlag} LIMIT 1
+	</select>
+</mapper>

+ 237 - 0
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -0,0 +1,237 @@
+<?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.OperatingReportNewDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.OperatingReportNew" id="OperatingReportNew">
+		<result column="id_" property="id" />
+		<result column="principal_" property="principal" />
+		<result column="organ_name_" property="organName" />
+		<result column="organ_id_" property="organId" />
+		<result column="sale_amount_" property="saleAmount" />
+		<result column="service_amount_" property="serviceAmount" />
+		<result column="business_refund_" property="businessRefund" />
+		<result column="total_income_" property="totalIncome" />
+		<result column="sale_cost_" property="saleCost" />
+		<result column="fixed_costs_" property="fixedCosts" />
+		<result column="variable_costs_" property="variableCosts" />
+		<result column="internal_settlement_" property="internalSettlement" />
+		<result column="total_cost_" property="totalCost" />
+		<result column="quasi_discretionary_profit_" property="quasiDiscretionaryProfit" />
+		<result column="prepaid_fee_" property="prepaidFee" />
+		<result column="prepayments_" property="prepayments" />
+		<result column="receivables_" property="receivables" />
+		<result column="payable_" property="payable" />
+		<result column="month_" property="month" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="OperatingReportNew" >
+		SELECT * FROM operating_report_new WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="OperatingReportNew">
+		SELECT * FROM operating_report_new ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.OperatingReportNew" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO operating_report_new (id_,principal_,organ_name_,sale_amount_,service_amount_,business_refund_,total_income_,sale_cost_,fixed_costs_,variable_costs_,internal_settlement_,total_cost_,quasi_discretionary_profit_,prepaid_fee_,prepayments_,receivables_,payable_,month_)
+		VALUES(#{id},#{principal},#{organName},#{saleAmount},#{serviceAmount},#{businessRefund},#{totalIncome},#{saleCost},#{fixedCosts},#{variableCosts},#{internalSettlement},#{totalCost},#{quasiDiscretionaryProfit},#{prepaidFee},#{prepayments},#{receivables},#{payable},#{month})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReportNew">
+		UPDATE operating_report_new <set>
+		<if test="saleAmount != null">
+		sale_amount_ = #{saleAmount},
+		</if>
+		<if test="prepaidFee != null">
+		prepaid_fee_ = #{prepaidFee},
+		</if>
+		<if test="serviceAmount != null">
+		service_amount_ = #{serviceAmount},
+		</if>
+		<if test="payable != null">
+		payable_ = #{payable},
+		</if>
+		<if test="businessRefund != null">
+		business_refund_ = #{businessRefund},
+		</if>
+		<if test="totalCost != null">
+		total_cost_ = #{totalCost},
+		</if>
+		<if test="totalIncome != null">
+		total_income_ = #{totalIncome},
+		</if>
+		<if test="quasiDiscretionaryProfit != null">
+		quasi_discretionary_profit_ = #{quasiDiscretionaryProfit},
+		</if>
+		<if test="fixedCosts != null">
+		fixed_costs_ = #{fixedCosts},
+		</if>
+		<if test="internalSettlement != null">
+		internal_settlement_ = #{internalSettlement},
+		</if>
+		<if test="prepayments != null">
+		prepayments_ = #{prepayments},
+		</if>
+		<if test="month != null">
+		month_ = #{month},
+		</if>
+		<if test="variableCosts != null">
+		variable_costs_ = #{variableCosts},
+		</if>
+		<if test="organName != null">
+		organ_name_ = #{organName},
+		</if>
+		<if test="saleCost != null">
+		sale_cost_ = #{saleCost},
+		</if>
+		<if test="receivables != null">
+		receivables_ = #{receivables},
+		</if>
+		<if test="principal != null">
+		principal_ = #{principal},
+		</if>
+		</set> WHERE id_ = #{id}
+	</update>
+    <update id="initCloudStartTime">
+		update operating_report_cloud orc
+		left join (
+		select orc.calender_id_,MIN(cs.class_date_) start_date_ from operating_report_cloud orc
+		LEFT JOIN cloud_teacher_free_course ctf ON ctf.calender_id_ = orc.calender_id_
+		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
+		where orc.month_flag_ = false AND orc.settlement_flag_ = false AND orc.start_date_ IS NULL
+		AND cs.class_date_ &lt;= #{lastDay}
+		group by orc.calender_id_) mc ON orc.calender_id_ = mc.calender_id_
+		LEFT JOIN (select calender_id_,DATE_ADD(
+		DATE_ADD(create_time_, interval CASE WHEN period_ = 'YEAR_HALF' THEN 6
+		WHEN period_ = 'YEAR' THEN 12
+		WHEN period_ = 'QUARTERLY' THEN 3 ELSE num_ END MONTH),interval 1 DAY) end_date_
+		from music_group_payment_calender_member order by id_ DESC) mgpcm
+		ON mc.calender_id_ = mgpcm.calender_id_
+		set orc.start_date_ = mc.start_date_,orc.end_date_ = mgpcm.end_date_
+		where orc.calender_id_ = mc.calender_id_
+	</update>
+
+    <!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM operating_report_new WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="OperatingReportNew" parameterType="map">
+		SELECT * FROM operating_report_new ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM operating_report_new
+	</select>
+	<select id="initOperatingReport" resultMap="OperatingReportNew">
+		select id_ organ_id_,name_ organ_name_ from organization where del_flag_ = 0 and tenant_id_ = 1
+	</select>
+	<select id="sumSellAmount" resultMap="OperatingReportNew">
+		select so.organ_id_,SUM(so.actual_amount_) sale_amount_,SUM(so.sell_cost_) sale_cost_ from sell_order so
+		left join student_payment_order spo ON spo.order_no_ = so.order_no_
+		left join music_group mg ON mg.id_ = spo.music_group_id_ AND spo.group_type_ = 'MUSIC'
+		LEFT JOIN organization o ON o.id_ = so.organ_id_
+		where (mg.musical_instruments_provide_status_ = 1 AND mg.musical_instruments_provide_date_ = #{month}) OR (DATE_FORMAT(so.create_ime_,'%Y-%m') = #{month} AND (mg.musical_instruments_provide_status_ IS NULL OR mg.musical_instruments_provide_status_ = 1))
+		group by so.organ_id_
+	</select>
+	<select id="sumCloudCourseAmount" resultType="java.util.Map">
+		SELECT cs.organ_id_ 'key',SUM(ctf.cost_) 'value' FROM cloud_teacher_free_course ctf
+		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
+		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.class_date_ BETWEEN #{firstDay} AND #{lastDay} group by cs.organ_id_;
+	</select>
+	<select id="sumCourseAmount" resultType="java.util.Map">
+		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
+		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
+		left join organization o ON o.id_ = cs.organ_id_
+		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.class_date_ BETWEEN #{firstDay} AND #{lastDay} group by cs.organ_id_;
+	</select>
+	<select id="sumPersonalCloudAmount" resultType="java.util.Map">
+		select cto.organ_id_ 'key',TRUNCATE(SUM(amount_ / TIMESTAMPDIFF(DAY,start_time_,end_time_) *
+		TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{firstDay} THEN #{firstDay} ELSE DATE_FORMAT(start_time_,'%Y-%m-%d') END,
+		CASE WHEN end_time_ > #{month} THEN #{lastDay} ELSE DATE_FORMAT(end_time_,'%Y-%m-%d') END)),2) 'value'
+		from cloud_teacher_order cto
+		where music_group_id_ IS NULL AND amount_ > 0 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND DATE_FORMAT(end_time_,'%Y-%m') group by cto.organ_id_;
+	</select>
+	<select id="sumGroupCloudAmount" resultType="java.util.Map">
+		select orc.organ_id_ 'key',TRUNCATE(SUM(orc.cloud_price_ / TIMESTAMPDIFF(DAY,orc.start_date_,orc.end_date_) *
+		TIMESTAMPDIFF(DAY,CASE WHEN orc.start_date_ &lt; #{firstDay} THEN #{firstDay} ELSE orc.start_date_ END,
+		CASE WHEN orc.end_date_ > #{month} THEN #{lastDay} ELSE orc.end_date_ END)),2) 'value' from operating_report_cloud orc
+		where #{month} BETWEEN DATE_FORMAT(orc.start_date_,'%Y-%m') AND DATE_FORMAT(orc.end_date_,'%Y-%m') AND orc.start_date_  IS NOT NULL;
+	</select>
+	<select id="sumRefundAmount" resultType="java.util.Map">
+		select suc.organ_id_ 'key',SUM(amount_) 'value' from sys_user_cash_account_log suc
+		where DATE_FORMAT(suc.create_time_,'%Y-%m') = #{month} AND suc.amount_ > 0 group by suc.organ_id_;
+	</select>
+	<select id="sumVariableCosts" resultType="java.util.Map">
+		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ BETWEEN 6 AND 18 AND process_id_ = 28 group by fe.organ_id_;
+	</select>
+	<select id="sumFixedCosts" resultType="java.util.Map">
+		select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
+		where DATE_FORMAT(fe.create_time_,'%Y-%m') = #{month} AND fee_project_ BETWEEN 1 AND 5 AND process_id_ = 28 group by fe.organ_id_;
+	</select>
+	<select id="sumCloudPreAmount" resultType="java.util.Map">
+		select orc.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / TIMESTAMPDIFF(DAY,start_time_,end_time_) * TIMESTAMPDIFF(DAY,#{lastDay},end_time_)),2) 'value'
+		from cloud_teacher_order orc
+		where operating_amount_ > 0 AND DATE_FORMAT(end_time_,'%Y-%m') > #{month} group by orc.organ_id_;
+	</select>
+	<select id="sumGroupCloudPreAmount" resultType="java.util.Map">
+		select orc.organ_id_ 'key',TRUNCATE(SUM(orc.cloud_price_ / TIMESTAMPDIFF(DAY,orc.start_date_,orc.end_date_) * TIMESTAMPDIFF(DAY,#{lastDay},orc.end_date_)),2) 'value'
+		from operating_report_cloud orc
+		where DATE_FORMAT(orc.end_date_,'%Y-%m') > #{month} AND orc.cloud_price_ > 0 AND orc.month_flag_ = false group by orc.organ_id_;
+	</select>
+	<select id="sumGroupAmount" resultType="java.util.Map">
+		select orc.organ_id_ 'key',SUM(orc.cloud_price_) 'value'
+		from operating_report_cloud orc
+		where orc.cloud_price_ > 0 AND orc.month_flag_ = true AND orc.settlement_flag_ = false group by orc.organ_id_;
+	</select>
+	<select id="sumCloudCoursePreAmount" resultType="java.util.Map">
+		SELECT cs.organ_id_ 'key',SUM(ctf.cost_) 'value' FROM cloud_teacher_free_course ctf
+		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
+		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.class_date_ > #{lastDay}
+		group by cs.organ_id_;
+	</select>
+	<select id="sumCoursePreAmount" resultType="java.util.Map">
+		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
+		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
+		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.class_date_ > #{lastDay}
+		group by cs.organ_id_;
+	</select>
+	<select id="sumOtherPreAmount" resultType="java.util.Map">
+		select orc.organ_id_ 'key',SUM(orc.cloud_price_) 'value' from operating_report_cloud orc
+		where orc.course_price_ = 0 AND orc.month_flag_ = false AND orc.settlement_flag_ = false GROUP BY orc.organ_id_;
+	</select>
+	<select id="sumSalePreAmount" resultType="java.util.Map">
+		select mg.organ_id_ 'key',SUM(so.actual_amount_) 'value' from sell_order so
+		left join student_payment_order spo ON spo.order_no_ = so.order_no_
+		left join music_group mg ON mg.id_ = spo.music_group_id_ AND spo.group_type_ = 'MUSIC'
+		where mg.musical_instruments_provide_status_ = 0 AND so.actual_amount_ > 0
+		group by mg.organ_id_;
+	</select>
+	<select id="sumArrearsAmount" resultType="java.util.Map">
+		select a.organ_id_ 'key',SUM(a.amount_) 'value' FROM (
+		select SUM(mgpc.current_total_amount_) amount_,mgpc.organ_id_ from music_group_payment_calender_detail mgpcd
+		LEFT JOIN (select * from music_group_payment_student_course_detail where used_course_minutes_ > 0 group by music_group_payment_calender_id_,user_id_) mgpscd 			ON mgpscd.music_group_payment_calender_detail_id_ = mgpcd.id_
+		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = mgpscd.music_group_payment_calender_id_
+		WHERE mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpscd.used_course_minutes_ > 0 AND mgpc.current_total_amount_ > 0
+		GROUP BY mgpscd.music_group_payment_calender_id_,mgpscd.user_id_) a
+		group by organ_id_
+	</select>
+	<select id="sumSchoolAmount" resultType="java.util.Map">
+		select mgpc.organ_id_ 'key',SUM(mgpc.current_total_amount_ * mgpc.actual_num_) - SUM(spro.service_amount_) - SUM(spro.sale_amount_) 'value'
+		from student_payment_route_order spro
+		LEFT JOIN music_group_payment_calender mgpc ON mgpc.id_ = spro.calender_id_
+		where spro.calender_id_ IS NOT NULL AND spro.audit_status_ = 'PASS' AND mgpc.id_ = spro.calender_id_
+		group by mgpc.organ_id_
+	</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')")

+ 0 - 14
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java

@@ -15,11 +15,8 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.util.collection.MapUtil;
-import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.json.JsonUtil;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -81,17 +78,6 @@ public class MusicGroupQuitController extends BaseController {
                 if (studentMaintenance != null) {
                     row.setHasMaintenance(true);
                 }
-                List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderDao.getStudentCloudTeacherOrder(row.getUserId(),row.getMusicGroupId());
-                if(cloudTeacherOrders.size() > 0){
-                    BigDecimal orderAmount = BigDecimal.ZERO;
-                    for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
-                        if (cloudTeacherOrder.getEndTime() == null || DateUtil.stringToDate(DateUtil.format(cloudTeacherOrder.getEndTime(),DateUtil.ISO_EXPANDED_DATE_FORMAT),DateUtil.ISO_EXPANDED_DATE_FORMAT).compareTo(
-                                DateUtil.stringToDate(DateUtil.format(nowDate,DateUtil.ISO_EXPANDED_DATE_FORMAT),DateUtil.ISO_EXPANDED_DATE_FORMAT)) >= 0) {
-                            orderAmount = orderAmount.add(cloudTeacherOrder.getAmount());
-                        }
-                    }
-                    row.setCloudTeacherAmount(orderAmount);
-                }
             }
         }
         return succeed(musicGroupQuitPageInfo);

+ 70 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicMarginController.java

@@ -0,0 +1,70 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.MusicMargin;
+import com.ym.mec.biz.dal.page.MusicMarginQueryInfo;
+import com.ym.mec.biz.service.MusicMarginService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Objects;
+
+@Api(tags = "乐器保证金")
+@RequestMapping("musicMargin")
+@RestController
+public class MusicMarginController extends BaseController {
+
+    @Autowired
+    private MusicMarginService musicMarginService;
+
+    @ApiOperation(value = "退款")
+    @PostMapping("/refund")
+    @PreAuthorize("@pcs.hasPermissions('musicMargin/refund')")
+    public Object refund(@RequestBody MusicMargin musicMargin){
+        MusicMargin margin = musicMarginService.get(musicMargin.getId());
+        if(Objects.isNull(margin)){
+            throw new BizException("乐器保证金不存在");
+        }
+        margin.setRefundFlag(1);
+        margin.setRefund(musicMargin.getRefund());
+        margin.setMemo(musicMargin.getMemo());
+        musicMarginService.update(margin);
+        return succeed();
+    }
+
+    @ApiOperation(value = "拒绝退款")
+    @PostMapping("/refusedRefund")
+    @PreAuthorize("@pcs.hasPermissions('musicMargin/refusedRefund')")
+    public Object refusedRefund(@RequestBody MusicMargin musicMargin){
+        MusicMargin margin = musicMarginService.get(musicMargin.getId());
+        if(Objects.isNull(margin)){
+            throw new BizException("乐器保证金不存在");
+        }
+        margin.setRefundFlag(2);
+        margin.setMemo(musicMargin.getMemo());
+        musicMarginService.update(margin);
+        return succeed();
+    }
+
+    @ApiOperation(value = "分页查询")
+    @PostMapping("/queryPage")
+    @PreAuthorize("@pcs.hasPermissions('musicMargin/queryPage')")
+    public Object queryPage(@RequestBody MusicMarginQueryInfo queryInfo){
+        return succeed(musicMarginService.queryPage(queryInfo));
+    }
+
+    @ApiOperation(value = "删除")
+    @PostMapping("/delete")
+    @PreAuthorize("@pcs.hasPermissions('musicMargin/delete')")
+    public Object delete(Integer id){
+        musicMarginService.delete(id);
+        return succeed();
+    }
+}

+ 0 - 7
mec-web/src/main/java/com/ym/mec/web/controller/OperatingReportController.java

@@ -1,9 +1,5 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.OperatingReport;
 import com.ym.mec.biz.dal.page.OperatingReportQueryInfo;
 import com.ym.mec.biz.service.OperatingReportService;
@@ -15,7 +11,6 @@ import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.excel.POIUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -26,9 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.Arrays;
 import java.util.Date;
-import java.util.List;
 
 @Api(tags = "经营报表服务")
 @RequestMapping("operatingReport")

+ 11 - 2
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ym.mec.biz.dal.dao.MusicGroupSchoolTermCourseDetailDao;
 import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermCourseDetail;
+import com.ym.mec.biz.dal.entity.OperatingReport;
+import com.ym.mec.biz.dal.entity.OperatingReportCloud;
 import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.enums.IndexDataType;
 import com.ym.mec.biz.event.source.CourseEventSource;
@@ -49,8 +51,6 @@ public class TaskController extends BaseController {
 	@Autowired
 	private StudentPaymentOrderService studentPaymentOrderService;
 	@Autowired
-	private TenantPaymentOrderService tenantPaymentOrderService;
-	@Autowired
 	private TeacherCourseStatisticsService teacherCourseStatisticsService;
 	@Autowired
 	private PracticeGroupService practiceGroupService;
@@ -120,6 +120,15 @@ public class TaskController extends BaseController {
 	private ImSendGroupMessageService imSendGroupMessageService;
     @Autowired
     private TempLittleArtistTrainingCampService tempLittleArtistTrainingCampService;
+    @Autowired
+    private OperatingReportNewService operatingReportNewService;
+
+	//每月经营报表
+	@GetMapping(value = "/operatingReportMonth")
+	public void operatingReportMonth(){
+		Date month = DateUtil.addMonths(new Date(),-1);
+		operatingReportNewService.operatingReportMonth(month);
+	}
 
     @GetMapping(value = "/syncImHistoryMessageTask")
 	// 同步即时通讯聊天记录