Browse Source

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

 Conflicts:
	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
zouxuan 2 years ago
parent
commit
1e412501d4
65 changed files with 813 additions and 991 deletions
  1. 10 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ChargeTypeSubjectMapperDao.java
  2. 0 9
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleTeacherSalaryDao.java
  3. 0 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupOrganizationCourseSettingsDao.java
  4. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  5. 8 44
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java
  6. 1 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java
  7. 4 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationCourseUnitPriceSettingsDao.java
  8. 1 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  9. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentMusicCourseFeeDao.java
  10. 4 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectDao.java
  11. 10 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeTypeSubjectMapper.java
  12. 0 23
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  13. 11 13
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupOrganizationCourseSettings.java
  14. 2 64
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java
  15. 9 220
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java
  16. 2 53
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java
  17. 14 20
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OrganizationCourseUnitPriceSettings.java
  18. 38 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentMusicCourseFee.java
  19. 0 10
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java
  20. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/CourseViewTypeEnum.java
  21. 9 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/ChargeTypeSubjectMapperQueryInfo.java
  22. 9 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseSettingQueryInfo.java
  23. 9 7
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/OrganizationCourseUnitPriceSettingsQueryInfo.java
  24. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java
  25. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentStudentCourseDetailService.java
  26. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java
  27. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationCourseUnitPriceSettingsService.java
  28. 24 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentMusicCourseFeeService.java
  29. 3 11
      mec-biz/src/main/java/com/ym/mec/biz/service/SubjectService.java
  30. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChargeTypeSubjectMapperServiceImpl.java
  31. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  32. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberFeeSettingServiceImpl.java
  33. 12 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  34. 6 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java
  35. 54 127
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  36. 13 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  37. 173 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentStudentCourseDetailServiceImpl.java
  38. 11 64
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  39. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  40. 26 39
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java
  41. 4 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationCourseUnitPriceSettingsServiceImpl.java
  42. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  43. 20 20
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  44. 60 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentMusicCourseFeeServiceImpl.java
  45. 36 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  46. 0 15
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java
  47. 3 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java
  48. 21 16
      mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml
  49. 1 5
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  50. 2 15
      mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml
  51. 4 11
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  52. 8 8
      mec-biz/src/main/resources/config/mybatis/MusicGroupOrganizationCourseSettingsMapper.xml
  53. 11 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  54. 3 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  55. 10 37
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml
  56. 0 6
      mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml
  57. 15 16
      mec-biz/src/main/resources/config/mybatis/OrganizationCourseUnitPriceSettingsMapper.xml
  58. 6 5
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  59. 21 0
      mec-biz/src/main/resources/config/mybatis/StudentMusicCourseFeeMapper.xml
  60. 1 7
      mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml
  61. 1 1
      mec-biz/src/main/resources/config/mybatis/TempLittleArtistTrainingCampMapper.xml
  62. 0 1
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  63. 0 2
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  64. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/OrganizationCourseUnitPriceSettingsController.java
  65. 17 19
      mec-web/src/main/java/com/ym/mec/web/controller/SubjectController.java

+ 10 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ChargeTypeSubjectMapperDao.java

@@ -2,16 +2,18 @@ package com.ym.mec.biz.dal.dao;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.ym.mec.biz.dal.entity.ChargeTypeSubjectMapper;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
 
 public interface ChargeTypeSubjectMapperDao extends BaseDAO<Long, ChargeTypeSubjectMapper> {
 
     /**
      * 删除当前收费类型关联的科目
      */
-    void deleteByChargeTypeId(Integer chargeTypeId);
+    void deleteByChargeTypeId(CourseViewTypeEnum courseViewType);
 
     int batchInsert(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList);
 
@@ -24,7 +26,11 @@ public interface ChargeTypeSubjectMapperDao extends BaseDAO<Long, ChargeTypeSubj
      * @param subjectId
      * @return
      */
-    ChargeTypeSubjectMapper getSubjectDiscount(@Param("chargeTypeId") Integer chargeTypeId, @Param("subjectId") Integer subjectId);
+    ChargeTypeSubjectMapper getSubjectDiscount(@Param("courseViewType") CourseViewTypeEnum courseViewType, @Param("subjectId") Integer subjectId);
+
+    ChargeTypeSubjectMapper getSubjectsDiscount(@Param("courseViewType") CourseViewTypeEnum courseViewType, @Param("subjectIds") String subjectIds);
 
-    ChargeTypeSubjectMapper getSubjectsDiscount(@Param("chargeTypeId") Integer chargeTypeId, @Param("subjectIds") String subjectIds);
+    ChargeTypeSubjectMapper findByViewTypeANdSubject(@Param("courseViewType") CourseViewTypeEnum courseViewType,
+                                                     @Param("subjectId") Integer subjectId,
+                                                     @Param("tenantId") Integer tenantId);
 }

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

@@ -180,15 +180,6 @@ public interface CourseScheduleTeacherSalaryDao extends BaseDAO<Long, CourseSche
 
 	/**
 	 * @param courseScheduleIds: 课程编号列表
-	 * @return java.util.List<java.util.Map < java.lang.String, java.lang.Integer>>
-	 * @describe 根据课程获取对应乐团的收费类型
-	 * @author Joburgess
-	 * @date 2019/11/3
-	 */
-	List<Map<String, Integer>> findMusicGroupChargeTypeByCourse(@Param("courseScheduleIds") List<Long> courseScheduleIds);
-
-	/**
-	 * @param courseScheduleIds: 课程编号列表
 	 * @return java.util.List<java.util.Map < java.lang.Integer, java.math.BigDecimal>>
 	 * @describe 根据课程获取对应的教学点补贴
 	 * @author Joburgess

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupOrganizationCourseSettingsDao.java

@@ -3,8 +3,6 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings;
 import com.ym.mec.common.dal.BaseDAO;
 
-import java.util.List;
-
 public interface MusicGroupOrganizationCourseSettingsDao extends BaseDAO<Integer, MusicGroupOrganizationCourseSettings> {
 
 }

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

@@ -327,4 +327,6 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     * @date 2022/3/17 11:18
     */
     List<Map<Long, Integer>> findCooperationByIds(@Param("calenderIds") List<Long> calenderIds);
+
+    void updatePaymentNum(@Param("calenderId") Long calenderId, @Param("actualNum") Integer actualNum, @Param("expectNum") Integer expectNum);
 }

+ 8 - 44
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java

@@ -1,15 +1,13 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.dto.StudentSubTotalCourseTimesDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> {
 
@@ -60,31 +58,6 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
     int batchInsert(List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList);
 
     /**
-     * 删除用户购买乐团课程记录
-     *
-     * @param userId
-     * @param musicGroupId
-     * @return
-     */
-    int deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
-
-    /**
-     * 根据缴费编号删除信息
-     *
-     * @param musicGroupPaymentCalenderId
-     * @return
-     */
-    int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
-
-    /**
-     * 删除信息
-     *
-     * @param musicGroupPaymentCalenderDetailIdList
-     * @return
-     */
-    int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
-
-    /**
      * 查询对象
      *
      * @param musicGroupPaymentCalenderDetailIdList
@@ -104,18 +77,7 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
 
     List<StudentSubTotalCourseTimesDto> pageStudentSubTotalCourseTimes(Map<String, Object> params);
 
-    List<MusicGroupPaymentStudentCourseDetail> findByCalenderAndUserId(@Param("calenderId") Long calenderId, @Param("userId") Integer userId);
-
-    /**
-     * 更新学员实际缴费金额
-     *
-     * @param courseType
-     * @param musicGroupPaymentCalenderIds
-     * @param courseCurrentPrice
-     */
-    void updateByCourseType(@Param("courseType") String courseType,
-                            @Param("musicGroupPaymentCalenderIds") String musicGroupPaymentCalenderIds,
-                            @Param("courseCurrentPrice") BigDecimal courseCurrentPrice);
+    List<MusicGroupPaymentStudentCourseDetail> findByCalenderAndUserId(@Param("calenderId") String calenderId, @Param("userId") Integer userId);
 
     /**
      * @param musicGroupId
@@ -137,5 +99,7 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      */
     int clearRemainCourseMinutesByMusicGroupId(String musicGroupId);
 
-    void deleteByUserIdAndCalenderId(@Param("userId") Integer userId, @Param("calenderIds") List<Long> calenderIds);
+    void delByIds(@Param("courseDetailIds") List<Long> courseDetailIds);
+
+    List<MusicGroupPaymentStudentCourseDetail> findByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 }

+ 1 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java

@@ -1,15 +1,11 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.biz.dal.entity.OperatingReportCloud;
+import com.ym.mec.common.dal.BaseDAO;
 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

+ 4 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationCourseUnitPriceSettingsDao.java

@@ -2,7 +2,9 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -18,7 +20,7 @@ public interface OrganizationCourseUnitPriceSettingsDao extends BaseDAO<Integer,
 	 * @return
 	 */
 	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(@Param("organId") Integer organId,
-			@Param("courseScheduleType") CourseScheduleType courseType, @Param("chargeTypeId") Integer chargeTypeId);
+			@Param("courseScheduleType") CourseScheduleType courseType, @Param("courseViewType") CourseViewTypeEnum courseViewType);
 
 	/**
 	 * 批量新增
@@ -34,7 +36,7 @@ public interface OrganizationCourseUnitPriceSettingsDao extends BaseDAO<Integer,
 	 * @param organId
 	 * @return
 	 */
-    List<Map<String, Integer>> queryMapByOrganIdAndChargeTypeId(@Param("chargeTypeId") Integer chargeTypeId, @Param("organId") Integer organId);
+    List<Map<String, Integer>> queryMapByOrganIdAndChargeTypeId(@Param("courseViewType") CourseViewTypeEnum courseViewType, @Param("organId") Integer organId);
 
     List<OrganizationCourseUnitPriceSettings> querySingle(@Param("organId")Integer organId, @Param("courseType") String courseType, @Param("tenantId") Integer tenantId);
 

+ 1 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -364,7 +364,5 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
                                                                           @Param("endTime") String endTime);
 
 
-    List<TempCampUserTrainingSequenceVo> getStudentCloudStudySequenceDaysV2(@Param("studentIds") List<Integer> studentIds,
-                                                                          @Param("startTime") String startTime,
-                                                                          @Param("endTime") String endTime);
+    List<TempCampUserTrainingSequenceVo> getStudentCloudStudySequenceDaysV2(@Param("studentIds") List<Integer> studentIds,@Param("campId") String campId);
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentMusicCourseFeeDao.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.biz.dal.entity.StudentMusicCourseFee;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+
+public interface StudentMusicCourseFeeDao extends BaseMapper<StudentMusicCourseFee> {
+
+    void addExpectPrice(@Param("id") Integer id, @Param("expectPrice") BigDecimal expectPrice);
+
+    void cutExpectPrice(@Param("id") Integer id, @Param("expectPrice") BigDecimal expectPrice);
+}

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

@@ -5,8 +5,10 @@ import com.ym.mec.biz.dal.dto.StudentAttendanceViewDto;
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.common.dal.BaseDAO;
+
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -23,14 +25,6 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
     List<Subject> findSubByMusicGroupId(String musicGroupId);
 
     /**
-     * 通过乐团收费方式,获取默认的声部列表
-     *
-     * @param chargeTypeId
-     * @return
-     */
-    List<Subject> findSubByChargeType(Integer chargeTypeId);
-
-    /**
      * 根据父级id查询子级列表
      *
      * @param parentId
@@ -41,10 +35,10 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
     /**
      * 通过乐团收费类型,获取默认的声部列表
      *
-     * @param chargeTypeId
+     * @param courseViewType
      * @return
      */
-    List<Subject> findDefaultSubByChargeTypeId(Integer chargeTypeId);
+    List<Subject> findDefaultSubByChargeTypeId(@Param("courseViewType") CourseViewTypeEnum courseViewType);
 
     /**
      * 通过乐团编号获取声部列表以及声部报名、缴费、计划人数

+ 10 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeTypeSubjectMapper.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.common.entity.BaseEntity;
 
@@ -17,9 +18,8 @@ public class ChargeTypeSubjectMapper extends BaseEntity {
 	/**  */
 	private Long id;
 	
-	/**  */
-	@ApiModelProperty(value = "收费类型编号",required = false)
-	private Integer chargeTypeId;
+	@ApiModelProperty(value = "收费模式",required = false)
+	private CourseViewTypeEnum courseViewType;
 	
 	/**  */
 	@ApiModelProperty(value = "科目编号",required = false)
@@ -40,7 +40,7 @@ public class ChargeTypeSubjectMapper extends BaseEntity {
 	private BigDecimal depositFee;
 
 	/**  */
-	@ApiModelProperty(value = "课程费用(比例)",required = false)
+	@ApiModelProperty(value = "乐器收入",required = false)
 	private BigDecimal fee;
 	
 	@ApiModelProperty(value = "商品折扣率",required = false)
@@ -54,14 +54,14 @@ public class ChargeTypeSubjectMapper extends BaseEntity {
 		return this.id;
 	}
 			
-	public void setChargeTypeId(Integer chargeTypeId){
-		this.chargeTypeId = chargeTypeId;
+	public CourseViewTypeEnum getCourseViewType() {
+		return courseViewType;
 	}
-	
-	public Integer getChargeTypeId(){
-		return this.chargeTypeId;
+
+	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+		this.courseViewType = courseViewType;
 	}
-			
+
 	public void setSubjectId(Integer subjectId){
 		this.subjectId = subjectId;
 	}

+ 0 - 23
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java

@@ -74,13 +74,6 @@ public class MusicGroup extends BaseEntity {
 	@ApiModelProperty(value = "衔接老师编号",required = false)
 	private Integer transactionTeacherId;
 	
-	/** 收费类型 */
-	@ApiModelProperty(value = "收费类型",required = false)
-	private Integer chargeTypeId;
-	/** 收费类型 */
-	@ApiModelProperty(value = "收费类型名称",required = false)
-	private String chargeTypeName;
-	
 	@ApiModelProperty(value = "课程形态",required = false)
 	private String courseForm;
 
@@ -414,14 +407,6 @@ public class MusicGroup extends BaseEntity {
 		this.educationalTeacherName = educationalTeacherName;
 	}
 
-	public String getChargeTypeName() {
-		return chargeTypeName;
-	}
-
-	public void setChargeTypeName(String chargeTypeName) {
-		this.chargeTypeName = chargeTypeName;
-	}
-
 	public Integer getPayNum() {
 		return payNum;
 	}
@@ -510,14 +495,6 @@ public class MusicGroup extends BaseEntity {
 		return this.educationalTeacherId;
 	}
 			
-	public void setChargeTypeId(Integer chargeTypeId){
-		this.chargeTypeId = chargeTypeId;
-	}
-	
-	public Integer getChargeTypeId(){
-		return this.chargeTypeId;
-	}
-			
 	public String getCourseForm() {
 		return courseForm;
 	}

+ 11 - 13
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupOrganizationCourseSettings.java

@@ -6,6 +6,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.entity.BaseEntity;
 
 public class MusicGroupOrganizationCourseSettings extends BaseEntity {
@@ -23,12 +24,9 @@ public class MusicGroupOrganizationCourseSettings extends BaseEntity {
     */
     @ApiModelProperty(value="分部")
     private Integer organId;
-
-    /**
-    * 收费模式
-    */
-    @ApiModelProperty(value="收费模式")
-    private Integer chargeTypeId;
+	
+	@ApiModelProperty(value = "收费模式",required = false)
+	private CourseViewTypeEnum courseViewType;
 
     /**
     * 总价
@@ -75,15 +73,15 @@ public class MusicGroupOrganizationCourseSettings extends BaseEntity {
         this.organId = organId;
     }
 
-    public Integer getChargeTypeId() {
-        return chargeTypeId;
-    }
+    public CourseViewTypeEnum getCourseViewType() {
+		return courseViewType;
+	}
 
-    public void setChargeTypeId(Integer chargeTypeId) {
-        this.chargeTypeId = chargeTypeId;
-    }
+	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+		this.courseViewType = courseViewType;
+	}
 
-    public BigDecimal getTotalCurrentPrice() {
+	public BigDecimal getTotalCurrentPrice() {
         return totalCurrentPrice;
     }
 

+ 2 - 64
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java

@@ -2,10 +2,12 @@ package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.math.BigDecimal;
 import java.util.Date;
 
+@Data
 public class MusicGroupPaymentCalenderBase extends BaseEntity {
     private long id;
 
@@ -27,68 +29,4 @@ public class MusicGroupPaymentCalenderBase extends BaseEntity {
     private Date createTime;
 
     private Date updateTime;
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public BigDecimal getOriginalAmount() {
-        return originalAmount;
-    }
-
-    public void setOriginalAmount(BigDecimal originalAmount) {
-        this.originalAmount = originalAmount;
-    }
-
-    public Long getCalenderId() {
-        return calenderId;
-    }
-
-    public void setCalenderId(Long calenderId) {
-        this.calenderId = calenderId;
-    }
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public Boolean getOptionalFlag() {
-        return optionalFlag;
-    }
-
-    public void setOptionalFlag(Boolean optionalFlag) {
-        this.optionalFlag = optionalFlag;
-    }
-
-    public BigDecimal getNum() {
-        return num;
-    }
-
-    public void setNum(BigDecimal num) {
-        this.num = num;
-    }
-
-    public BigDecimal getActualAmount() {
-        return actualAmount;
-    }
-
-    public void setActualAmount(BigDecimal actualAmount) {
-        this.actualAmount = actualAmount;
-    }
 }

+ 9 - 220
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java

@@ -1,21 +1,19 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-
+import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
-
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
-import com.ym.mec.common.entity.BaseEntity;
-
 import java.math.BigDecimal;
-import java.util.Date;
 
 /**
  * 对应数据库表(music_group_payment_calender_detail):
  */
+@Data
 public class MusicGroupPaymentCalenderDetail extends BaseEntity {
 
 	/**  */
@@ -28,15 +26,16 @@ public class MusicGroupPaymentCalenderDetail extends BaseEntity {
 	private Integer userId;
 
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	private java.math.BigDecimal expectAmount;
+	//经营报表乐器收入
+	private java.math.BigDecimal expectAmount = BigDecimal.ZERO;
 
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	//经营报表需要,重新定义该字段
+	//经营报表云教练收入
 	private java.math.BigDecimal expectMemberAmount = BigDecimal.ZERO;
 	
 	/** 废弃字段,如果需要查看金额,请前往订单详情 */
-	//经营报表需要,重新定义该字段,记录云教练缴费课程预收(经营报表当月,根据缴费项目锁排课程总成本)
-	private java.math.BigDecimal actualAmount;
+	//经营报表溢出的课程费用
+	private java.math.BigDecimal actualAmount = BigDecimal.ZERO;
 	
 	/**  */
 	private PaymentStatus paymentStatus;
@@ -89,216 +88,6 @@ public class MusicGroupPaymentCalenderDetail extends BaseEntity {
 	
 	private SysUser responsible = new SysUser();
 
-	public BigDecimal getExpectMemberAmount() {
-		return expectMemberAmount;
-	}
-
-	public void setExpectMemberAmount(BigDecimal expectMemberAmount) {
-		this.expectMemberAmount = expectMemberAmount;
-	}
-
-	public MusicGroupPaymentCalender.PaymentType getPaymentType() {
-		return paymentType;
-	}
-
-	public void setPaymentType(MusicGroupPaymentCalender.PaymentType paymentType) {
-		this.paymentType = paymentType;
-	}
-
-	public Date getStartPaymentDateMgpc() {
-		return startPaymentDateMgpc;
-	}
-
-	public void setStartPaymentDateMgpc(Date startPaymentDateMgpc) {
-		this.startPaymentDateMgpc = startPaymentDateMgpc;
-	}
-
-	public Date getDeadlinePaymentDateMgpc() {
-		return deadlinePaymentDateMgpc;
-	}
-
-	public void setDeadlinePaymentDateMgpc(Date deadlinePaymentDateMgpc) {
-		this.deadlinePaymentDateMgpc = deadlinePaymentDateMgpc;
-	}
-
-	public YesOrNoEnum getOpenFlag() {
-		return openFlag;
-	}
-
-	public void setOpenFlag(YesOrNoEnum openFlag) {
-		this.openFlag = openFlag;
-	}
-
-	private StudentRegistration studentRegistration = new StudentRegistration();
-
-	public String getMusicGroupId() {
-		return musicGroupId;
-	}
-
-	public void setMusicGroupId(String musicGroupId) {
-		this.musicGroupId = musicGroupId;
-	}
-
-	public Date getStartPaymentDate() {
-		return startPaymentDate;
-	}
-
-	public void setStartPaymentDate(Date startPaymentDate) {
-		this.startPaymentDate = startPaymentDate;
-	}
-
-	public Date getDeadlinePaymentDate() {
-		return deadlinePaymentDate;
-	}
-
-	public void setDeadlinePaymentDate(Date deadlinePaymentDate) {
-		this.deadlinePaymentDate = deadlinePaymentDate;
-	}
-
-	public Integer getOpen() {
-		return open;
-	}
-
-	public void setOpen(Integer open) {
-		this.open = open;
-	}
-
-	public StudentRegistration getStudentRegistration() {
-		return studentRegistration;
-	}
-
-	public void setStudentRegistration(StudentRegistration studentRegistration) {
-		this.studentRegistration = studentRegistration;
-	}
-
-	public SysUser getSysUser() {
-		return sysUser;
-	}
-
-	public void setSysUser(SysUser sysUser) {
-		this.sysUser = sysUser;
-	}
-
-	public void setId(Long id){
-		this.id = id;
-	}
-	
-	public Long getId(){
-		return this.id;
-	}
-			
-	public void setMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId){
-		this.musicGroupPaymentCalenderId = musicGroupPaymentCalenderId;
-	}
-	
-	public Long getMusicGroupPaymentCalenderId(){
-		return this.musicGroupPaymentCalenderId;
-	}
-
-	public Long getPaymentOrderId() {
-		return paymentOrderId;
-	}
-
-	public void setPaymentOrderId(Long paymentOrderId) {
-		this.paymentOrderId = paymentOrderId;
-	}
-
-	public void setUserId(Integer userId){
-		this.userId = userId;
-	}
-	
-	public Integer getUserId(){
-		return this.userId;
-	}
-			
-	public void setExpectAmount(java.math.BigDecimal expectAmount){
-		this.expectAmount = expectAmount;
-	}
-	
-	public java.math.BigDecimal getExpectAmount(){
-		return this.expectAmount;
-	}
-			
-	public void setActualAmount(java.math.BigDecimal actualAmount){
-		this.actualAmount = actualAmount;
-	}
-	
-	public java.math.BigDecimal getActualAmount(){
-		return this.actualAmount;
-	}
-			
-	public void setPaymentStatus(PaymentStatus paymentStatus){
-		this.paymentStatus = paymentStatus;
-	}
-	
-	public PaymentStatus getPaymentStatus(){
-		return this.paymentStatus;
-	}
-			
-	public void setUserStatus(String userStatus){
-		this.userStatus = userStatus;
-	}
-	
-	public String getUserStatus(){
-		return this.userStatus;
-	}
-			
-	public void setPayTime(java.util.Date payTime){
-		this.payTime = payTime;
-	}
-	
-	public java.util.Date getPayTime(){
-		return this.payTime;
-	}
-			
-	public void setUpdateTime(java.util.Date updateTime){
-		this.updateTime = updateTime;
-	}
-	
-	public java.util.Date getUpdateTime(){
-		return this.updateTime;
-	}
-			
-	public void setCreateTime(java.util.Date createTime){
-		this.createTime = createTime;
-	}
-	
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-
-	public Integer getUseInCourse() {
-		return useInCourse;
-	}
-
-	public void setUseInCourse(Integer useInCourse) {
-		this.useInCourse = useInCourse;
-	}
-
-	public Integer getResponsibleUserId() {
-		return responsibleUserId;
-	}
-
-	public void setResponsibleUserId(Integer responsibleUserId) {
-		this.responsibleUserId = responsibleUserId;
-	}
-
-	public String getResponsibleRecord() {
-		return responsibleRecord;
-	}
-
-	public void setResponsibleRecord(String responsibleRecord) {
-		this.responsibleRecord = responsibleRecord;
-	}
-
-	public SysUser getResponsible() {
-		return responsible;
-	}
-
-	public void setResponsible(SysUser responsible) {
-		this.responsible = responsible;
-	}
-
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 2 - 53
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java

@@ -2,9 +2,9 @@ package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.PeriodEnum;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
-import java.math.BigDecimal;
-
+@Data
 public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBase{
     @ApiModelProperty(value = "会员名称", required = false)
     private String name;
@@ -19,55 +19,4 @@ public class MusicGroupPaymentCalenderMember extends MusicGroupPaymentCalenderBa
 
     @ApiModelProperty(value = "自动激活团练宝标识", required = false)
     private Boolean autoActivationFlag = false;
-
-    @ApiModelProperty(value = "团练宝收入,actualAmount减去收入以及其他费用,剩下的就是课程费用", required = false)
-    private BigDecimal income;
-
-    public BigDecimal getIncome() {
-        return income;
-    }
-
-    public void setIncome(BigDecimal income) {
-        this.income = income;
-    }
-
-    public Boolean getAutoActivationFlag() {
-        return autoActivationFlag;
-    }
-
-    public void setAutoActivationFlag(Boolean autoActivationFlag) {
-        this.autoActivationFlag = autoActivationFlag;
-    }
-
-    public Integer getOrganId() {
-        return organId;
-    }
-
-    public void setOrganId(Integer organId) {
-        this.organId = organId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public PeriodEnum getPeriod() {
-        return period;
-    }
-
-    public void setPeriod(PeriodEnum period) {
-        this.period = period;
-    }
-
-    public Integer getMemberRankSettingId() {
-        return memberRankSettingId;
-    }
-
-    public void setMemberRankSettingId(Integer memberRankSettingId) {
-        this.memberRankSettingId = memberRankSettingId;
-    }
 }

+ 14 - 20
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OrganizationCourseUnitPriceSettings.java

@@ -1,10 +1,13 @@
 package com.ym.mec.biz.dal.entity;
 
+import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.entity.BaseEntity;
 
 /**
@@ -20,9 +23,10 @@ public class OrganizationCourseUnitPriceSettings extends BaseEntity {
 	
 	/** 课程类型 */
 	private CourseScheduleType courseType;
-
-	private Integer chargeTypeId;
 	
+	@ApiModelProperty(value = "收费模式",required = false)
+	private CourseViewTypeEnum courseViewType;
+
 	private BigDecimal unitPrice = new BigDecimal(0);
 	
 	/**  */
@@ -33,8 +37,6 @@ public class OrganizationCourseUnitPriceSettings extends BaseEntity {
 	
 	private Organization organ = new Organization();
 	
-	private ChargeType chargeType = new ChargeType();
-	
 	public void setId(Integer id){
 		this.id = id;
 	}
@@ -51,6 +53,14 @@ public class OrganizationCourseUnitPriceSettings extends BaseEntity {
 		return this.organId;
 	}
 			
+	public CourseViewTypeEnum getCourseViewType() {
+		return courseViewType;
+	}
+
+	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+		this.courseViewType = courseViewType;
+	}
+
 	public CourseScheduleType getCourseType() {
 		return courseType;
 	}
@@ -82,14 +92,6 @@ public class OrganizationCourseUnitPriceSettings extends BaseEntity {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
-	public Integer getChargeTypeId() {
-		return chargeTypeId;
-	}
-
-	public void setChargeTypeId(Integer chargeTypeId) {
-		this.chargeTypeId = chargeTypeId;
-	}
 
 	public Organization getOrgan() {
 		return organ;
@@ -99,14 +101,6 @@ public class OrganizationCourseUnitPriceSettings extends BaseEntity {
 		this.organ = organ;
 	}
 
-	public ChargeType getChargeType() {
-		return chargeType;
-	}
-
-	public void setChargeType(ChargeType chargeType) {
-		this.chargeType = chargeType;
-	}
-
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 38 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentMusicCourseFee.java

@@ -0,0 +1,38 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.common.entity.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 对应数据库表(student_music_course_fee):
+ */
+@Data
+public class StudentMusicCourseFee extends BaseEntity {
+
+	private Integer id;
+
+	@ApiModelProperty(value = "学员编号",required = false)
+	private Integer userId;
+
+	@ApiModelProperty(value = "分部编号",required = false)
+	private Integer organId;
+
+	@ApiModelProperty(value = "乐团编号",required = false)
+	private String musicGroupId;
+
+	@ApiModelProperty(value = "预计总课费",required = false)
+	private BigDecimal expectPrice = BigDecimal.ZERO;
+
+	@ApiModelProperty(value = "实收总课费",required = false)
+	private BigDecimal actualPrice = BigDecimal.ZERO;
+
+	@ApiModelProperty(value = "应收",required = false)
+	private BigDecimal receivablePrice = BigDecimal.ZERO;
+
+	private String createTime;
+
+	private String updateTime;
+}

+ 0 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java

@@ -127,8 +127,6 @@ public class StudentRegistration extends BaseEntity {
     //乐团
     private OwnershipType ownershipType;
 
-    private Integer chargeTypeId;
-
     @ApiModelProperty(value = "是否是合并的学员 0-否 1-是",required = true)
     private Integer isMerge = 0;
 
@@ -452,14 +450,6 @@ public class StudentRegistration extends BaseEntity {
         this.ownershipType = ownershipType;
     }
 
-	public Integer getChargeTypeId() {
-		return chargeTypeId;
-	}
-
-	public void setChargeTypeId(Integer chargeTypeId) {
-		this.chargeTypeId = chargeTypeId;
-	}
-
     public BigDecimal getSurplusCourseFee() {
         return surplusCourseFee;
     }

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/CourseViewTypeEnum.java

@@ -5,7 +5,8 @@ import com.ym.mec.common.enums.BaseEnum;
 public enum CourseViewTypeEnum implements BaseEnum<Integer, CourseViewTypeEnum> {
     COURSE_FEE(0, "课程收费", 2),
     AMR(1, "器乐练习系统", 3),
-    MEMBER_FEE(2, "会员收费", 4);
+    MEMBER_FEE(2, "会员收费", 4),
+    FREE(3, "免费", 4);
 
     private Integer code;
 
@@ -18,6 +19,15 @@ public enum CourseViewTypeEnum implements BaseEnum<Integer, CourseViewTypeEnum>
         this.msg = msg;
         this.contractVersion = contractVersion;
     }
+    
+    public static CourseViewTypeEnum codeOf(int code){
+    	for(CourseViewTypeEnum e : CourseViewTypeEnum.values()){
+    		if(e.code == code){
+    			return e;
+    		}
+    	}
+    	return null;
+    }
 
     public void setCode(Integer code) {
         this.code = code;

+ 9 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/page/ChargeTypeSubjectMapperQueryInfo.java

@@ -1,20 +1,24 @@
 package com.ym.mec.biz.dal.page;
 
+import io.swagger.annotations.ApiModelProperty;
+
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.page.QueryInfo;
 
 public class ChargeTypeSubjectMapperQueryInfo extends QueryInfo {
 
-	private Integer chargeTypeId;
+	@ApiModelProperty(value = "收费模式",required = false)
+	private CourseViewTypeEnum courseViewType;
 
 	/**  */
 	private Integer subjectId;
 
-	public Integer getChargeTypeId() {
-		return chargeTypeId;
+	public CourseViewTypeEnum getCourseViewType() {
+		return courseViewType;
 	}
 
-	public void setChargeTypeId(Integer chargeTypeId) {
-		this.chargeTypeId = chargeTypeId;
+	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+		this.courseViewType = courseViewType;
 	}
 
 	public Integer getSubjectId() {

+ 9 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CourseSettingQueryInfo.java

@@ -8,8 +8,8 @@ public class CourseSettingQueryInfo extends QueryInfo {
     @ApiModelProperty(value="分部id")
     private Integer organId;
 
-    @ApiModelProperty(value="收费模式id")
-    private Integer chargeTypeId;
+    @ApiModelProperty(value="收费模式")
+    private Integer courseViewType;
 
     public Integer getOrganId() {
         return organId;
@@ -19,11 +19,12 @@ public class CourseSettingQueryInfo extends QueryInfo {
         this.organId = organId;
     }
 
-    public Integer getChargeTypeId() {
-        return chargeTypeId;
-    }
+	public Integer getCourseViewType() {
+		return courseViewType;
+	}
+
+	public void setCourseViewType(Integer courseViewType) {
+		this.courseViewType = courseViewType;
+	}
 
-    public void setChargeTypeId(Integer chargeTypeId) {
-        this.chargeTypeId = chargeTypeId;
-    }
 }

+ 9 - 7
mec-biz/src/main/java/com/ym/mec/biz/dal/page/OrganizationCourseUnitPriceSettingsQueryInfo.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.page;
 import io.swagger.annotations.ApiModelProperty;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.page.QueryInfo;
 
 public class OrganizationCourseUnitPriceSettingsQueryInfo extends QueryInfo {
@@ -12,9 +13,9 @@ public class OrganizationCourseUnitPriceSettingsQueryInfo extends QueryInfo {
 
 	@ApiModelProperty(value = "课程类型", required = false)
 	private CourseScheduleType courseScheduleType;
-
-	@ApiModelProperty(value = "乐团收费类型编号", required = false)
-	private Integer chargeTypeId;
+	
+	@ApiModelProperty(value = "收费模式",required = false)
+	private CourseViewTypeEnum courseViewType;
 
 	public Integer getOrganId() {
 		return organId;
@@ -32,11 +33,12 @@ public class OrganizationCourseUnitPriceSettingsQueryInfo extends QueryInfo {
 		this.courseScheduleType = courseScheduleType;
 	}
 
-	public Integer getChargeTypeId() {
-		return chargeTypeId;
+	public CourseViewTypeEnum getCourseViewType() {
+		return courseViewType;
 	}
 
-	public void setChargeTypeId(Integer chargeTypeId) {
-		this.chargeTypeId = chargeTypeId;
+	public void setCourseViewType(CourseViewTypeEnum courseViewType) {
+		this.courseViewType = courseViewType;
 	}
+
 }

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

@@ -97,10 +97,9 @@ public interface MusicGroupPaymentCalenderDetailService extends BaseService<Long
     /**
     * @description: 生成缴费项目学员详情
      * @param studentPaymentOrder
- * @param studentRegistration
     * @return void
     * @author zx
     * @date 2021/12/30 15:16
     */
-    void addCalenderDetail(StudentPaymentOrder studentPaymentOrder,StudentRegistration studentRegistration);
+    MusicGroupPaymentCalenderDetail addCalenderDetail(StudentPaymentOrder studentPaymentOrder);
 }

+ 33 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentStudentCourseDetailService.java

@@ -1,8 +1,41 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 public interface MusicGroupPaymentStudentCourseDetailService extends BaseService<Long, MusicGroupPaymentStudentCourseDetail> {
 
+    /**
+    * @description: 新增学员可排课时长
+     * @param userIdList
+     * @param calender
+     * @param userCalenderDetailMap
+    * @return void
+    * @author zx
+    * @date 2023/3/23 11:07
+    */
+    void batchInsert(Set<Integer> userIdList,
+                     MusicGroupPaymentCalender calender,
+                     Map<Integer, Long> userCalenderDetailMap);
+
+    void batchInsert(Integer userId,
+                     MusicGroupPaymentCalender musicGroupPaymentCalender,
+                     Long calenderDetailId,
+                     Long paymentOrderId);
+
+    List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
+
+    void deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
+
+    void deleteByMusicGroupPaymentCalenderId(String calenderId,Integer userId);
+
+    void deleteByUserIdAndMusicGroupId(Integer userId, String musicGroupId);
+
+    void clearRemainCourseMinutesByMusicGroupId(String musicGroupId);
 }

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

@@ -22,7 +22,7 @@ public interface OperatingReportCloudService extends BaseService<Integer, Operat
     * @author zx
     * @date 2022/9/6 10:09
     */
-    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender, Long orderId);
+    void updateSet(MusicGroupPaymentCalender musicGroupPaymentCalender, BigDecimal amount);
 
     /**
     * @description: 乐团排课、活动排课,计算课程预收

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationCourseUnitPriceSettingsService.java

@@ -2,8 +2,9 @@ package com.ym.mec.biz.service;
 
 import java.util.List;
 
-import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.common.service.BaseService;
 
 public interface OrganizationCourseUnitPriceSettingsService extends BaseService<Integer, OrganizationCourseUnitPriceSettings> {
@@ -19,10 +20,10 @@ public interface OrganizationCourseUnitPriceSettingsService extends BaseService<
 	 * 根据分部编号以及课程类型查询对象
 	 * @param organId 分部编号
 	 * @param courseType 课程类型
-	 * @param chargeTypeId 收费类型编号
+	 * @param courseViewType 收费模式
 	 * @return
 	 */
-	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(Integer organId, CourseScheduleType courseType, Integer chargeTypeId);
+	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(Integer organId, CourseScheduleType courseType, CourseViewTypeEnum courseViewType);
 
 	List<OrganizationCourseUnitPriceSettings> querySingle(Integer organId, String courseType, Integer tenantId);
 

+ 24 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentMusicCourseFeeService.java

@@ -0,0 +1,24 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.dao.StudentMusicCourseFeeDao;
+import com.ym.mec.biz.dal.entity.StudentMusicCourseFee;
+
+import java.math.BigDecimal;
+
+
+/**
+* @description: 学员乐团课程费用汇总
+* @author zx
+* @date 2023/3/22 16:39
+*/
+public interface StudentMusicCourseFeeService extends IService<StudentMusicCourseFee> {
+
+    StudentMusicCourseFeeDao getDao();
+
+    void addExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice);
+
+    void cutExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice);
+}
+
+

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

@@ -1,5 +1,8 @@
 package com.ym.mec.biz.service;
 
+import java.util.List;
+import java.util.Map;
+
 import com.ym.mec.biz.dal.dto.ConditionDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
@@ -9,9 +12,6 @@ import com.ym.mec.biz.dal.page.SubjectQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
-import java.util.List;
-import java.util.Map;
-
 public interface SubjectService extends BaseService<Integer, Subject> {
 
     /**
@@ -31,14 +31,6 @@ public interface SubjectService extends BaseService<Integer, Subject> {
     PageInfo<Subject> queryPageTree(SubjectQueryInfo queryInfo);
 
     /**
-     * 通过乐团收费类型,获取默认的声部列表
-     *
-     * @param chargeTypeId
-     * @return
-     */
-    List<Subject> findDefaultSubByChargeTypeId(Integer chargeTypeId,Integer organId,Integer number);
-
-    /**
      * 通过乐团编号获取声部列表以及声部报名、缴费、计划人数
      *
      * @param musicGroupId

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

@@ -31,7 +31,7 @@ public class ChargeTypeSubjectMapperServiceImpl extends BaseServiceImpl<Long, Ch
 
     @Override
     public boolean batchInsert(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList) {
-        ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(chargeTypeSubjectMapperList.get(0).getChargeTypeId(), chargeTypeSubjectMapperList.get(0).getSubjectId());
+        ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(chargeTypeSubjectMapperList.get(0).getCourseViewType(), chargeTypeSubjectMapperList.get(0).getSubjectId());
         if (subjectDiscount != null) {
             throw new BizException("此声部商品折扣已添加");
         }

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

@@ -4070,7 +4070,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Map<String, Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
         //获取分布默认的课程类型单价
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
-        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
+        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getCourseViewType(), musicGroup.getOrganId()));
         Set<String> courseTypes = map.keySet();
         Set<String> groupType = new HashSet<>();
         for (Integer classGroupId : classGroupIds) {
@@ -4152,7 +4152,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
                     for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
                         OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
-                                musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
+                                musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getCourseViewType());
                         if (defaultUnitPrice == null) {
                             throw new BizException("请先设置分部课程类型单价");
                         }
@@ -4446,7 +4446,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         /*if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
             throw new BizException("操作失败:主班乐团不能是系统收费团");
         }*/
-        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
+        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getCourseViewType(), musicGroup.getOrganId()));
         Set<String> masterKeySet = masterMap.keySet();
         //计算主班课程类型剩余价值
         BigDecimal masterTotalPrice = BigDecimal.ZERO;
@@ -4476,7 +4476,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Map<String, BigDecimal> resultMap = new HashMap<>();
         //获取分布默认的课程类型单价
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId);
-        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
+        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getCourseViewType(), musicGroup.getOrganId()));
         Set<String> masterKeySet = masterMap.keySet();
         //计算主班课程类型剩余价值
         for (String s : masterKeySet) {

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberFeeSettingServiceImpl.java

@@ -122,4 +122,31 @@ public class MemberFeeSettingServiceImpl extends BaseServiceImpl<Integer, Member
         return amount;
     }
 
+    public static BigDecimal getIncome (PeriodEnum periodEnum, MemberFeeSetting memberFee) {
+        BigDecimal amount;
+        switch (periodEnum) {
+            case DAY:
+                amount = memberFee.getIncomeDayFee();
+                break;
+            case MONTH:
+                amount = memberFee.getIncomeMonthFee();
+                break;
+            case QUARTERLY:
+                amount = memberFee.getIncomeQuarterlyFee();
+                break;
+            case YEAR_HALF:
+                amount = memberFee.getIncomeHalfYearFee();
+                break;
+            case YEAR:
+                amount = memberFee.getIncomeYearFee();
+                break;
+            default:
+                throw new BizException("请选择正确的会员有效期");
+        }
+        if (Objects.isNull(amount)) {
+            throw new BizException("未设置云教练经营报表确认收入");
+        }
+        return amount;
+    }
+
 }

+ 12 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -663,19 +663,21 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public boolean liveBuyOrderCallback(StudentPaymentOrder studentPaymentOrder) {
         //查询原定的是否已处理
-        StudentPaymentOrder orignStudentPaymentOrder = studentPaymentOrderService.lockOrder(studentPaymentOrder.getId());
-        logger.info("XXX-createOrder ---> liveBuyOrderCallback:{}", JSON.toJSONString(orignStudentPaymentOrder));
+        /*StudentPaymentOrder orignStudentPaymentOrder = studentPaymentOrderService.lockOrder(studentPaymentOrder.getId());
         if (orignStudentPaymentOrder == null) {
             return false;
         }
         if (orignStudentPaymentOrder.getStatus() != DealStatusEnum.ING) {
             return false;
-        }
+        }*/
         Integer userId = studentPaymentOrder.getUserId();
         Date nowDate = new Date();
         // 更新订单信息
         studentPaymentOrder.setUpdateTime(nowDate);
-        studentPaymentOrderService.update(studentPaymentOrder);
+        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        if (updateCount <= 0) {
+            throw new BizException("订单更新失败");
+        }
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             //退还优惠券和余额
@@ -764,18 +766,21 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {
         //查询原定的是否已处理
-        StudentPaymentOrder orignStudentPaymentOrder = studentPaymentOrderService.lockOrder(studentPaymentOrder.getId());
+        /*StudentPaymentOrder orignStudentPaymentOrder = studentPaymentOrderService.lockOrder(studentPaymentOrder.getId());
         if (orignStudentPaymentOrder == null) {
             return false;
         }
         if (orignStudentPaymentOrder.getStatus() != DealStatusEnum.ING) {
             return false;
-        }
+        }*/
         Integer userId = studentPaymentOrder.getUserId();
         Date nowDate = new Date();
         // 更新订单信息
         studentPaymentOrder.setUpdateTime(nowDate);
-        studentPaymentOrderService.update(studentPaymentOrder);
+        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        if (updateCount <= 0) {
+            throw new BizException("订单更新失败");
+        }
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             //退还优惠券和余额

+ 6 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.MusicGroupOrganizationCourseSettingsDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
 import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentBaseCalender;
@@ -8,26 +9,18 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.CalenderBaseServiceEnum;
 import com.ym.mec.biz.service.MusicGroupOrganizationCourseSettingsService;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderBaseService;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.exception.BizException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Service;
-
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderCourseSettingsService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.util.*;
-import java.util.function.BiFunction;
-import java.util.function.BinaryOperator;
 import java.util.stream.Collectors;
 
-import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum.AUDITING;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.MUSIC_RENEW;
@@ -148,7 +141,7 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 				// 如果是课程收费,判断是否审核
 				for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 					OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
-							musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
+							musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getCourseViewType());
 					if (defaultUnitPrice == null) {
 						throw new BizException("请先设置分部课程类型单价");
 					}
@@ -200,7 +193,7 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
 				// 如果是课程收费,判断是否审核
 				for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 					OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
-							musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getChargeTypeId());
+							musicGroup.getOrganId(), courseSettings.getCourseType(), musicGroup.getCourseViewType());
 					if (defaultUnitPrice == null) {
 						throw new BizException("请先设置分部课程类型单价");
 					}

+ 54 - 127
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.dto.SimpleUserDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatusEnum;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.page.ArrearageStudentsQueryInfo;
@@ -46,9 +47,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
     @Autowired
     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
     @Autowired
-    private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
-    @Autowired
-    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    private MusicGroupPaymentStudentCourseDetailService musicGroupPaymentStudentCourseDetailService;
     @Autowired
     private MusicGroupDao musicGroupDao;
     @Autowired
@@ -70,11 +69,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
     @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
-    private StudentDao studentDao;
-    @Autowired
     private VipGroupActivityDao vipGroupActivityDao;
     @Autowired
     private OperatingReportCloudService operatingReportCloudService;
+    @Autowired
+    private MemberFeeSettingService memberFeeSettingService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalenderDetail> getDAO() {
@@ -215,15 +214,11 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             throw new BizException("操作失败:包含已存在的学员");
         }
 
-        List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(musicGroupPaymentCalenderId);
-
         Date date = new Date();
         MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
-        Map<Integer, Long> userMap = new HashMap<>();
+        Map<Integer, Long> userCalenderDetailMap = new HashMap<>();
         Map<Integer, Integer> activityuserMap = new HashMap<>();
         List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<>();
-        //创建缴费明细
-        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 
         List<MusicGroupPaymentCalenderActivity> calenderActivities = musicGroupPaymentCalenderActivityService.findByCalenderId(musicGroupPaymentCalenderId);
         Map<Integer, VipGroupActivity> collect = new HashMap<>();
@@ -248,12 +243,15 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
+            //设置云教练、课程收入
+            this.setCourseIncome(calenderMember,musicGroupPaymentCalenderDetail);
+            Integer organId = musicGroupPaymentCalender.getOrganId();
             musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
             if (musicGroupPaymentCalender.getCurrentTotalAmount().compareTo(BigDecimal.ZERO) == 0 || musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
                 // 添加会员
                 if (calenderMember != null) {
                     CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
-                    cloudTeacherOrder.setOrganId(musicGroup.getOrganId());
+                    cloudTeacherOrder.setOrganId(organId);
                     cloudTeacherOrder.setType(calenderMember.getPeriod());
                     cloudTeacherOrder.setAmount(BigDecimal.ZERO);
                     cloudTeacherOrder.setStudentId(studentId);
@@ -277,7 +275,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
                         activityUserMapper.setSubNoCoursePrice(BigDecimal.ZERO);
                         activityUserMapper.setActivityId(calenderActivity.getActivityId());
                         activityUserMapper.setUserId(studentId);
-                        activityUserMapper.setOrganId(musicGroup.getOrganId());
+                        activityUserMapper.setOrganId(organId);
                         if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
                             activityUserMapper.setAddMemo("学校缴费新增学员");
                         }else {
@@ -300,7 +298,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
         if (musicGroupPaymentCalenderDetailList.size() > 0) {
             musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
-            musicGroupPaymentCalenderDetailList.stream().forEach(e -> userMap.put(e.getUserId(), e.getId()));
+            musicGroupPaymentCalenderDetailList.stream().forEach(e -> userCalenderDetailMap.put(e.getUserId(), e.getId()));
         }
         //更新预计缴费人数
         musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + userIdList.size());
@@ -309,43 +307,9 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + userIdList.size());
         }
         musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
-
         //创建学生课排课分钟数
-        if (courseSettingsList != null && courseSettingsList.size() > 0) {
-            List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<>();
-            MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
-            for (Integer studentId : userIdList) {
-                for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
-                    if (courseSettings.getCourseTotalMinuties() == null || courseSettings.getCourseTotalMinuties() == 0) {
-                        continue;
-                    }
-                    musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
-                    musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupId);
-                    musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
-                    musicGroupPaymentStudentCourseDetail.setCreateTime(date);
-                    musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalenderId);
-                    musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(userMap.get(studentId));
-                    musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
-                    musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSettings.getCourseTotalMinuties());
-                    musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
-                    musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
-                    musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
-                    musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
-                    if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
-                        musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(BigDecimal.ZERO);
-                        musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(BigDecimal.ZERO);
-                    }
-                    musicGroupPaymentStudentCourseDetail.setUpdateTime(date);
-                    musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
-                    musicGroupPaymentStudentCourseDetail.setUserId(studentId);
-                    musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(musicGroupPaymentCalender.getCloudTeacherPaymentFlag());
-                    musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
-                }
-            }
-            if (musicGroupPaymentStudentCourseDetailList.size() > 0) {
-                musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
-            }
-        }
+        musicGroupPaymentStudentCourseDetailService.batchInsert(userIdList,musicGroupPaymentCalender,userCalenderDetailMap);
+
         //给学员推送缴费通知
         if (musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN) {
             musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalender.getId(),
@@ -353,6 +317,24 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
         }
     }
 
+    public void setCourseIncome(MusicGroupPaymentCalenderMember calenderMember, MusicGroupPaymentCalenderDetail calenderDetail){
+        if(Objects.nonNull(calenderMember)){
+            MusicGroup musicGroup = musicGroupDao.get(calenderDetail.getMusicGroupId());
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                //获取云教练溢出费用
+                BigDecimal courseIncome = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
+                        calenderMember.getNum(), MemberFeeSettingServiceImpl::getIncome);
+                if(calenderMember.getActualAmount().compareTo(courseIncome) > 0){
+                    calenderDetail.setExpectMemberAmount(courseIncome);
+                    calenderDetail.setActualAmount(calenderMember.getActualAmount().subtract(courseIncome));
+                }
+            }else {
+                calenderDetail.setExpectMemberAmount(calenderMember.getActualAmount());
+                calenderDetail.setActualAmount(BigDecimal.ZERO);
+            }
+        }
+    }
+
     @Override
     public List<FeeStudentDto> queryFeeStudents(String musicGroupId, String search, Integer subjectId) {
         return musicGroupStudentFeeDao.queryFeeStudents(musicGroupId, search, subjectId);
@@ -383,7 +365,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetailIdList.add(Long.parseLong(s));
         }
         //是否已排课
-        List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList);
+        List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList =
+                musicGroupPaymentStudentCourseDetailService.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList);
         count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
         if (count > 0) {
             throw new BizException("删除失败:存在已排课的学员");
@@ -391,11 +374,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
         int currentNum = musicGroupPaymentCalender.getExpectNum() - details.size();
         musicGroupPaymentCalender.setExpectNum(currentNum < 0 ? 0 : currentNum);
-        musicGroupPaymentCalender.setUpdateTime(new Date());
         musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
 
         musicGroupPaymentCalenderDetailDao.batchDel(musicGroupPaymentCalenderDetailIds);
-        musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
+        musicGroupPaymentStudentCourseDetailService.deleteByMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdList);
     }
 
     @Override
@@ -499,105 +481,50 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void addCalenderDetail(StudentPaymentOrder studentPaymentOrder, StudentRegistration studentRegistration) {
-        Date nowDate = new Date();
-        Integer tenantId = studentPaymentOrder.getTenantId();
+    public MusicGroupPaymentCalenderDetail addCalenderDetail(StudentPaymentOrder studentPaymentOrder) {
         //缴费详情 calender detail
-        MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderService.get(studentPaymentOrder.getCalenderId());
-        Long currentPaymentCalenderId = studentPaymentOrder.getCalenderId();
+        Long calenderId = studentPaymentOrder.getCalenderId();
+        MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderService.get(calenderId);
         //查询缴费项目关联的订单
-        List<StudentPaymentOrder> orderList = studentPaymentOrderDao.findByCalenderId(currentPaymentCalenderId, studentPaymentOrder.getUserId());
+        List<StudentPaymentOrder> orderList = studentPaymentOrderDao.findByCalenderId(calenderId, studentPaymentOrder.getUserId());
         if (orderList.size() == 1) {
-            // 更新实际缴费人数
-            if (musicGroupPaymentCalender.getActualNum() == null) {
-                musicGroupPaymentCalender.setActualNum(1);
-            } else {
-                musicGroupPaymentCalender.setActualNum(musicGroupPaymentCalender.getActualNum() + 1);
-            }
+            // 更新缴费人数
+            Integer expectNum = 0;
             if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
-                if (musicGroupPaymentCalender.getExpectNum() == null) {
-                    musicGroupPaymentCalender.setExpectNum(1);
-                } else {
-                    musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + 1);
-                }
+                expectNum = 1;
             }
-            musicGroupPaymentCalender.setUpdateTime(nowDate);
-            musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+            musicGroupPaymentCalenderDao.updatePaymentNum(studentPaymentOrder.getCalenderId(),1,expectNum);
         }
-        MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(currentPaymentCalenderId, studentPaymentOrder.getUserId());
+        Date date = new Date();
+        MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, studentPaymentOrder.getUserId());
+        //只有报名订单,缴费详情才会是null
         if (musicGroupPaymentCalenderDetail == null) {
             musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-            musicGroupPaymentCalenderDetail.setTenantId(tenantId);
+            musicGroupPaymentCalenderDetail.setTenantId(studentPaymentOrder.getTenantId());
             musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
             musicGroupPaymentCalenderDetail.setUserId(studentPaymentOrder.getUserId());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
-            musicGroupPaymentCalenderDetail.setPayTime(nowDate);
+            musicGroupPaymentCalenderDetail.setPayTime(date);
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             musicGroupPaymentCalenderDetail.setUseInCourse(0);
             musicGroupPaymentCalenderDetail.setOpen(1);
             musicGroupPaymentCalenderDetail.setUserStatus(null);
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
-            musicGroupPaymentCalenderDetail.setCreateTime(nowDate);
-            musicGroupPaymentCalenderDetail.setUpdateTime(nowDate);
             musicGroupPaymentCalenderDetailDao.insert(musicGroupPaymentCalenderDetail);
         } else {
             musicGroupPaymentCalenderDetail.setPaymentStatus(PAID_COMPLETED);
-            musicGroupPaymentCalenderDetail.setPayTime(nowDate);
+            musicGroupPaymentCalenderDetail.setPayTime(date);
             musicGroupPaymentCalenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
-            musicGroupPaymentCalenderDetailDao.update(musicGroupPaymentCalenderDetail);
         }
-
         //保存、更新云教练缴费项目预收
-        operatingReportCloudService.updateSet(musicGroupPaymentCalender,studentPaymentOrder.getId());
-
-        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;
-        }
+        operatingReportCloudService.updateSet(musicGroupPaymentCalender,musicGroupPaymentCalenderDetail.getExpectMemberAmount());
         //续费项目加学员时就生成了课程时长,报名项目在缴费成功后才需要添加课程时长
-        if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
-            List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = new ArrayList<>();
-            List<String> orderDetailTypes = studentPaymentOrderDetailDao.getOrderDetailType(studentPaymentOrder.getId());
-            List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao
-                    .getWithPaymentCalender(musicGroupPaymentCalender.getId());
-            for (MusicGroupPaymentCalenderCourseSettings courseSetting : courseSettingsList) {
-                if (musicGroupPaymentCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)
-                        && !orderDetailTypes.contains(courseSetting.getCourseType().getCode())) {
-                    continue;
-                }
-                if (courseSetting.getCourseTotalMinuties() == null || courseSetting.getCourseTotalMinuties() == 0) {
-                    continue;
-                }
-                MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
-                musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
-                musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-                musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetail.getId());
-                musicGroupPaymentStudentCourseDetail.setUserId(studentPaymentOrder.getUserId());
-                musicGroupPaymentStudentCourseDetail.setCourseType(courseSetting.getCourseType());
-                musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSetting.getCourseTotalMinuties());
-                musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSetting.getCourseTotalMinuties());
-                musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
-                musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
-                musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
-                musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
-                if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
-                    musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(BigDecimal.ZERO);
-                    musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(BigDecimal.ZERO);
-                }
-                musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
-                musicGroupPaymentStudentCourseDetail.setCreateTime(nowDate);
-                musicGroupPaymentStudentCourseDetail.setUpdateTime(nowDate);
-                musicGroupPaymentStudentCourseDetail.setTenantId(tenantId);
-                musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(cloudTeacherPaymentFlag);
-                musicGroupPaymentStudentCourseDetails.add(musicGroupPaymentStudentCourseDetail);
-            }
-            if (musicGroupPaymentStudentCourseDetails.size() > 0) {
-                musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetails);
-            }
-        }
+        musicGroupPaymentStudentCourseDetailService.batchInsert(studentPaymentOrder.getUserId(),
+                musicGroupPaymentCalender,
+                musicGroupPaymentCalenderDetail.getId(),
+                studentPaymentOrder.getId());
+        return musicGroupPaymentCalenderDetail;
     }
 }

+ 13 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -27,7 +27,6 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
-
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
@@ -62,7 +61,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsServiceImpl musicGroupPaymentCalenderCourseSettingsService;
     @Autowired
-    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    private MusicGroupPaymentStudentCourseDetailService musicGroupPaymentStudentCourseDetailService;
     @Autowired
     private MusicGroupSchoolTermCourseDetailDao musicGroupSchoolTermCourseDetailDao;
     @Autowired
@@ -127,6 +126,10 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     private ImGroupService imGroupService;
     @Autowired
     private ImGroupMemberService imGroupMemberService;
+    @Autowired
+    private MemberFeeSettingService memberFeeSettingService;
+    @Autowired
+    private StudentMusicCourseFeeService studentMusicCourseFeeService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -422,9 +425,15 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             addStudent(musicGroupPaymentCalender, musicGroup);
             //将0元未缴费学员缴费状态更新为已缴费
             this.updateNoPaymentAndZeroPaymentStatus(musicGroupPaymentCalender, true);
+            List<MusicGroupPaymentCalenderCourseSettings> settingsList = musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
             // 学生加到班级
             classGroupService.addStudentToClassGroupAndCourseArranging(calenderAddStudent.getStudentIds(), calenderAddStudent.getClassGroupIds(),
-                    batchNo, musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList(), musicGroup);
+                    batchNo, settingsList, musicGroup);
+            //记录经营报表学员课程费用
+            if(CollectionUtils.isNotEmpty(settingsList)){
+                BigDecimal coursePrice = settingsList.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                studentMusicCourseFeeService.addExpectPrice(calenderAddStudent.getStudentIds(),musicGroupId,coursePrice);
+            }
             ExecutorService executor = Executors.newFixedThreadPool(5);
             CompletableFuture.runAsync(() -> {
                 imUserFriendService.refreshGroupImUserFriend(musicGroupId, GroupType.MUSIC);
@@ -1325,7 +1334,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
         musicGroupPaymentCalenderDao.delete(id);
         musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
-        musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);
+        musicGroupPaymentStudentCourseDetailService.deleteByMusicGroupPaymentCalenderId(id.toString(),null);
         musicGroupPaymentCalenderActivityService.delByCalenderId(id);
         musicGroupPaymentCalenderMemberService.deleteByCalenderId(id);
         musicGroupPaymentCalenderRepairService.deleteByCalenderId(id);

+ 173 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentStudentCourseDetailServiceImpl.java

@@ -1,21 +1,194 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
 import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.biz.service.MusicGroupPaymentStudentCourseDetailService;
+import com.ym.mec.biz.service.StudentMusicCourseFeeService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
 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.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
 
 @Service
 public class MusicGroupPaymentStudentCourseDetailServiceImpl extends BaseServiceImpl<Long, MusicGroupPaymentStudentCourseDetail>  implements MusicGroupPaymentStudentCourseDetailService {
 	
 	@Autowired
 	private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+	@Autowired
+	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
+	@Autowired
+	private StudentMusicCourseFeeService studentMusicCourseFeeService;
+	@Autowired
+	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> getDAO() {
 		return musicGroupPaymentStudentCourseDetailDao;
 	}
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void batchInsert(Set<Integer> userIdList,
+							MusicGroupPaymentCalender calender,
+							Map<Integer, Long> userCalenderDetailMap) {
+		List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalender(calender.getId());
+		//创建学生课排课分钟数
+		if (courseSettingsList != null && courseSettingsList.size() > 0) {
+			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<>();
+			MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
+			Long calenderId = calender.getId();
+			String musicGroupId = calender.getMusicGroupId();
+			MusicGroupPaymentCalender.PayUserType payUserType = calender.getPayUserType();
+			Boolean cloudTeacherPaymentFlag = calender.getCloudTeacherPaymentFlag();
+			for (Integer studentId : userIdList) {
+				BigDecimal reduce = BigDecimal.ZERO;
+
+				for (MusicGroupPaymentCalenderCourseSettings courseSettings : courseSettingsList) {
+					if (courseSettings.getCourseTotalMinuties() == null || courseSettings.getCourseTotalMinuties() == 0) {
+						continue;
+					}
+					musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
+					musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupId);
+					musicGroupPaymentStudentCourseDetail.setCourseType(courseSettings.getCourseType());
+					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(calenderId);
+					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(userCalenderDetailMap.get(studentId));
+					musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSettings.getCourseTotalMinuties());
+					musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSettings.getCourseTotalMinuties());
+					musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
+					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
+					musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
+					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSettings.getCourseCurrentPrice());
+					if(payUserType == SCHOOL){
+						musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(BigDecimal.ZERO);
+						musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(BigDecimal.ZERO);
+					}
+					musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
+					musicGroupPaymentStudentCourseDetail.setUserId(studentId);
+					musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(cloudTeacherPaymentFlag);
+					musicGroupPaymentStudentCourseDetailList.add(musicGroupPaymentStudentCourseDetail);
+					reduce = reduce.add(musicGroupPaymentStudentCourseDetail.getCourseCurrentPrice());
+				}
+				if(reduce.compareTo(BigDecimal.ZERO) > 0){
+					//汇总学员乐团课费,如果有溢出的乐器费用、云教练费用,也一并汇总,用于计算经营报表
+					studentMusicCourseFeeService.addExpectPrice(studentId,musicGroupId,reduce);
+				}
+			}
+			if (musicGroupPaymentStudentCourseDetailList.size() > 0) {
+				musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
+			}
+		}
+    }
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void batchInsert(Integer userId, MusicGroupPaymentCalender musicGroupPaymentCalender, Long calenderDetailId, Long paymentOrderId) {
+		//续费项目加学员时就生成了课程时长,报名项目在缴费成功后才需要添加课程时长
+		if (musicGroupPaymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.MUSIC_APPLY) {
+			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = new ArrayList<>();
+			List<String> orderDetailTypes = studentPaymentOrderDetailDao.getOrderDetailType(paymentOrderId);
+			List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao
+					.getWithPaymentCalender(musicGroupPaymentCalender.getId());
+			Boolean cloudTeacherPaymentFlag = musicGroupPaymentCalender.getCloudTeacherPaymentFlag();
+			BigDecimal reduce = BigDecimal.ZERO;
+			for (MusicGroupPaymentCalenderCourseSettings courseSetting : courseSettingsList) {
+				if (musicGroupPaymentCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)
+						&& !orderDetailTypes.contains(courseSetting.getCourseType().getCode())) {
+					continue;
+				}
+				if (courseSetting.getCourseTotalMinuties() == null || courseSetting.getCourseTotalMinuties() == 0) {
+					continue;
+				}
+				MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
+				musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
+				musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+				musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(calenderDetailId);
+				musicGroupPaymentStudentCourseDetail.setUserId(userId);
+				musicGroupPaymentStudentCourseDetail.setCourseType(courseSetting.getCourseType());
+				musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSetting.getCourseTotalMinuties());
+				musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSetting.getCourseTotalMinuties());
+				musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
+				musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
+				musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
+				musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
+				if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
+					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(BigDecimal.ZERO);
+					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(BigDecimal.ZERO);
+				}
+				musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
+				musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(cloudTeacherPaymentFlag);
+				musicGroupPaymentStudentCourseDetails.add(musicGroupPaymentStudentCourseDetail);
+			}
+			if(reduce.compareTo(BigDecimal.ZERO) > 0){
+				//汇总学员乐团课费,如果有溢出的乐器费用、云教练费用,也一并汇总,用于计算经营报表
+				studentMusicCourseFeeService.addExpectPrice(userId,musicGroupPaymentCalender.getMusicGroupId(),reduce);
+			}
+			if (musicGroupPaymentStudentCourseDetails.size() > 0) {
+				musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetails);
+			}
+		}
+	}
+
+	@Override
+	public List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList) {
+		return musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList) {
+		this.delByDetails(musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(musicGroupPaymentCalenderDetailIdList));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void deleteByMusicGroupPaymentCalenderId(String calenderId,Integer userId) {
+		this.delByDetails(musicGroupPaymentStudentCourseDetailDao.findByCalenderAndUserId(calenderId, userId));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void deleteByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
+		this.delByDetails(musicGroupPaymentStudentCourseDetailDao.findByUserIdAndMusicGroupId(userId, musicGroupId));
+	}
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void clearRemainCourseMinutesByMusicGroupId(String musicGroupId) {
+		musicGroupPaymentStudentCourseDetailDao.clearRemainCourseMinutesByMusicGroupId(musicGroupId);
+    }
+
+    void delByDetails(List<MusicGroupPaymentStudentCourseDetail> courseDetails){
+		if(CollectionUtils.isNotEmpty(courseDetails)){
+			List<Long> courseDetailIds = courseDetails.stream().map(e -> e.getId()).collect(Collectors.toList());
+			musicGroupPaymentStudentCourseDetailDao.delByIds(courseDetailIds);
+			//汇总学员乐团课费,如果有溢出的乐器费用、云教练费用,也一并汇总,用于计算经营报表
+			courseDetails = courseDetails.stream().filter(e -> e.getCourseCurrentPrice().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
+			if(CollectionUtils.isNotEmpty(courseDetails)){
+				Map<Integer, List<MusicGroupPaymentStudentCourseDetail>> userMap = courseDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
+				for (Integer userId : userMap.keySet()) {
+					List<MusicGroupPaymentStudentCourseDetail> studentCourseDetails = userMap.get(userId);
+					Map<String, BigDecimal> priceMap = studentCourseDetails.stream().collect(Collectors.groupingBy(e -> e.getMusicGroupId(),
+							Collectors.collectingAndThen(Collectors.toList(), v -> v.stream().map(e -> e.getCourseCurrentPrice()).reduce(BigDecimal.ZERO, BigDecimal::add))));
+					for (String musicGroupId : priceMap.keySet()) {
+						studentMusicCourseFeeService.cutExpectPrice(userId,musicGroupId,priceMap.get(musicGroupId));
+					}
+				}
+			}
+		}
+	}
 }

+ 11 - 64
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -68,8 +68,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     @Autowired
     private MusicGroupDao musicGroupDao;
     @Autowired
-    private ChargeTypeDao chargeTypeDao;
-    @Autowired
     private TeacherDao teacherDao;
     
     @Autowired
@@ -170,7 +168,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
     @Autowired
-    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    private MusicGroupPaymentStudentCourseDetailService musicGroupPaymentStudentCourseDetailService;
     @Autowired
     private SubjectChangeDao subjectChangeDao;
     @Autowired
@@ -412,12 +410,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
 			MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
 			List<MusicGroupPaymentCalenderDetail> insertMusicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
-
-			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = new ArrayList<>();
-
-			List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentCalenderCourseSettingsDao
-					.getWithPaymentCalender(musicGroupPaymentCalender.getId());
-
 			for (StudentImportDto si : studentBasicList) {
 				musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
 				musicGroupPaymentCalenderDetail.setTenantId(tenantId);
@@ -432,45 +424,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 				musicGroupPaymentCalenderDetail.setUserStatus(null);
 				musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
 				musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
-				musicGroupPaymentCalenderDetail.setCreateTime(nowDate);
-				musicGroupPaymentCalenderDetail.setUpdateTime(nowDate);
-
 				insertMusicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail);
-
-				for (MusicGroupPaymentCalenderCourseSettings courseSetting : courseSettingsList) {
-					if (courseSetting.getCourseTotalMinuties() == null || courseSetting.getCourseTotalMinuties() == 0) {
-						continue;
-					}
-					MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = new MusicGroupPaymentStudentCourseDetail();
-					musicGroupPaymentStudentCourseDetail.setMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
-					musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
-					//musicGroupPaymentStudentCourseDetail.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetail.getId());
-					musicGroupPaymentStudentCourseDetail.setUserId(si.getUserId());
-					musicGroupPaymentStudentCourseDetail.setCourseType(courseSetting.getCourseType());
-					musicGroupPaymentStudentCourseDetail.setTotalCourseMinutes(courseSetting.getCourseTotalMinuties());
-					musicGroupPaymentStudentCourseDetail.setSubCourseMinutes(courseSetting.getCourseTotalMinuties());
-					musicGroupPaymentStudentCourseDetail.setCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
-					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
-					musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
-					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSetting.getCourseCurrentPrice());
-					musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
-					musicGroupPaymentStudentCourseDetail.setCreateTime(nowDate);
-					musicGroupPaymentStudentCourseDetail.setUpdateTime(nowDate);
-					musicGroupPaymentStudentCourseDetail.setTenantId(tenantId);
-					musicGroupPaymentStudentCourseDetails.add(musicGroupPaymentStudentCourseDetail);
-				}
 			}
 			if (insertMusicGroupPaymentCalenderDetailList.size() > 0) {
 				musicGroupPaymentCalenderDetailDao.batchInsert(insertMusicGroupPaymentCalenderDetailList);
-
-				Map<Integer,Long> musicGroupPaymentCalenderDetailIdMap =  insertMusicGroupPaymentCalenderDetailList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderDetail :: getUserId, MusicGroupPaymentCalenderDetail :: getId));
-
-				if (musicGroupPaymentStudentCourseDetails.size() > 0) {
-					for(MusicGroupPaymentStudentCourseDetail cd : musicGroupPaymentStudentCourseDetails){
-						cd.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdMap.get(cd.getUserId()));
-					}
-					musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetails);
-				}
+                //创建学生课排课分钟数
+                Map<Integer, Long> userCalenderDetailMap = new HashMap<>(insertMusicGroupPaymentCalenderDetailList.size());
+                insertMusicGroupPaymentCalenderDetailList.stream().forEach(e -> userCalenderDetailMap.put(e.getUserId(), e.getId()));
+                Set<Integer> userIdList = studentBasicList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+                musicGroupPaymentStudentCourseDetailService.batchInsert(userIdList,musicGroupPaymentCalender,userCalenderDetailMap);
 			}
 		}
 
@@ -2339,7 +2301,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             List<MusicGroupPaymentCalender> paymentCalenders = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
             if(CollectionUtils.isNotEmpty(paymentCalenders)){
                 List<Long> calenderIds = paymentCalenders.stream().map(e -> e.getId()).collect(Collectors.toList());
-                musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndCalenderId(userId, calenderIds);
+                musicGroupPaymentStudentCourseDetailService.deleteByMusicGroupPaymentCalenderId(StringUtils.join(calenderIds,","),userId);
             }
 
             BigDecimal amount = new BigDecimal(0);
@@ -2605,7 +2567,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
         }
         //删除用户购买的课程记录
-        musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+        musicGroupPaymentStudentCourseDetailService.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
         BigDecimal amount = new BigDecimal(0);
 
@@ -2826,7 +2788,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupPaymentCalenderDetailDao.delete(mgpcd.getId());
         }
         //删除用户购买的课程记录
-        musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+        musicGroupPaymentStudentCourseDetailService.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
         List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
 
@@ -3168,14 +3130,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         Map<String, BigDecimal> chargeStandardMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryChargeStandard(StringUtils.join(musicGroupIds, ",")));
 
-        // 获取收费类型编号列表
-        Set<Integer> chargeTypeIds = musicGroupList.stream().map(e -> e.getChargeTypeId()).collect(Collectors.toSet());
-        if (chargeTypeIds == null) {
-            chargeTypeIds = new HashSet<>();
-        }
-        List<Map<Integer, String>> chargeTypeNames = chargeTypeDao.queryNameByIds(StringUtils.join(chargeTypeIds, ","));
-        Map<Integer, String> chargeTypeNameMap = MapUtil.convertMybatisMap(chargeTypeNames);
-
         //获取教学点编号
         Map<Integer, String> cooperationOrganNames = MapUtil.convertMybatisMap(cooperationOrganDao.queryNameByIds(StringUtils.join(musicGroupList.stream().map(MusicGroup::getCooperationOrganId).collect(Collectors.toSet()), ",")));
 
@@ -3197,7 +3151,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             e.setDirectorUserName(directorUserNameMap.get(e.getDirectorUserId()));
             e.setPayNum(payNumMap.get(e.getId()) == null ? 0 : payNumMap.get(e.getId()));
             e.setGroupMemberNum(e.getGroupMemberNum() == null ? 0 : e.getGroupMemberNum());
-            e.setChargeTypeName(chargeTypeNameMap.get(e.getChargeTypeId()));
             e.setHasVerifyMusicalList(purchaseListMap.get(e.getId()) != null);
             if (e.getStatus().equals(MusicGroupStatusEnum.PREPARE) || e.getStatus().equals(MusicGroupStatusEnum.PROGRESS)) {
                 if (viewRegButtonMap.containsKey(e.getId())) {
@@ -3358,7 +3311,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         Date date = new Date();
         //缴费方式不同
         if ((group.getStatus().equals(MusicGroupStatusEnum.AUDIT_FAILED) || group.getStatus().equals(MusicGroupStatusEnum.DRAFT))
-                && !group.getChargeTypeId().equals(musicGroup.getChargeTypeId())) {
+                && group.getCourseViewType() != musicGroup.getCourseViewType()) {
             //删除原有的声部商品组合
             musicGroupSubjectGoodsGroupDao.delByMusicGroupId(musicGroupId);
             //删除原有的缴费项目
@@ -3411,8 +3364,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         SubFeeSettingDto subFeeSettingDto = new SubFeeSettingDto();
         //获取乐团信息
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-        ChargeType chargeType = chargeTypeDao.get(musicGroup.getChargeTypeId());
-        musicGroup.setChargeTypeName(chargeType.getName());
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(musicGroup.getId());
         if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
             musicGroup.setPaymentExpireDate(regCalender.getDeadlinePaymentDate());
@@ -3505,10 +3456,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroup.setSchoolName(school.getName());
             musicGroup.setAddress(school.getAddress());
         }
-        ChargeType chargeType = chargeTypeDao.get(musicGroup.getChargeTypeId());
-        if (chargeType != null) {
-            musicGroup.setChargeTypeName(chargeType.getName());
-        }
         int highClassGroupNum = studentRegistrationDao.findMusicGroupStudentNum(musicGroupId) / 5;
         musicGroup.setImproventClassesNum(highClassGroupNum);
         return musicGroup;
@@ -3772,7 +3719,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }*/
         
         //清除剩余未排课时长
-        musicGroupPaymentStudentCourseDetailDao.clearRemainCourseMinutesByMusicGroupId(musicGroupId);
+        musicGroupPaymentStudentCourseDetailService.clearRemainCourseMinutesByMusicGroupId(musicGroupId);
 
         //统计变更学员数
         groupEventSource.musicGroupStudentChangeEvent(closeMusicGroupDto.getMusicGroupId(), StudentMusicGroupStatusEnum.QUIT, null);

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

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.entity.*;
+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.service.*;
@@ -201,11 +202,11 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
             organId = musicGroup.getOrganId();
         }
         List<MusicGroupGoodsAndDiscountDto> goodsList = goodsDao.getMusicGroupGoodsAndDiscount(subjectId, type, courseViewType,organId, TenantContextHolder.getTenantId());
-        if (chargeTypeId == null || (type != null && !"INSTRUMENT".equals(type))) {
+        if (courseViewType == null || (type != null && !"INSTRUMENT".equals(type))) {
             return goodsList;
         }
 
-        ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(chargeTypeId, subjectId);
+        ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(CourseViewTypeEnum.codeOf(courseViewType), subjectId);
         
         if (subjectDiscount == null){
         	subjectDiscount = new ChargeTypeSubjectMapper();

+ 26 - 39
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java

@@ -1,16 +1,15 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+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.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 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.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,10 +30,6 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 	@Autowired
 	private CloudTeacherFreeCourseService cloudTeacherFreeCourseService;
 	@Autowired
-	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
-	@Autowired
-	private StudentPaymentOrderDao studentPaymentOrderDao;
-	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
 	@Override
@@ -49,39 +44,31 @@ public class OperatingReportCloudServiceImpl extends BaseServiceImpl<Integer, Op
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateSet(MusicGroupPaymentCalender calender, Long orderId) {
-		if(!calender.getCloudTeacherPaymentFlag()){
-			return;
-		}
-		BigDecimal amount = BigDecimal.ZERO;
-		//查询云教练价格
-		List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailDao.findApplyOrderGoods(orderId);
-		if(CollectionUtils.isNotEmpty(orderDetail)){
-			amount = orderDetail.stream().filter(e->e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)
-					.map(e->e.getPrice()).reduce(BigDecimal.ZERO,BigDecimal::add);
-		}else {
-			amount = studentPaymentOrderDao.get(orderId).getActualAmount();
-		}
-		if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
-			this.saveMonthOperating(calender,amount);
-			return;
-		}
-		//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
-		//获取云教练信息
-		OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId());
-		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()){
+	public void updateSet(MusicGroupPaymentCalender calender, BigDecimal amount) {
+		//是否有云教练收入需要结转
+		if(BigDecimal.ZERO.compareTo(amount) < 0){
+			//如果是学员缴费,直接结转到本月
+			if(calender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT){
 				this.saveMonthOperating(calender,amount);
 			}else {
-				reportCloud.setCloudPrice(reportCloud.getCloudPrice().add(amount));
-				reportCloud.setUpdateTime(new Date());
-				operatingReportCloudDao.update(reportCloud);
+				//找出非当月结算的缴费项目预算,如果为空则创建。如果已结算则创建当月结转的云教练预收、否则修改云教练预算
+				//获取云教练信息
+				OperatingReportCloud reportCloud = operatingReportCloudDao.findByCalenderId(calender.getId());
+				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()){
+						this.saveMonthOperating(calender,amount);
+					}else {
+						reportCloud.setCloudPrice(reportCloud.getCloudPrice().add(amount));
+						reportCloud.setUpdateTime(new Date());
+						operatingReportCloudDao.update(reportCloud);
+					}
+				}
 			}
 		}
 	}

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

@@ -8,9 +8,11 @@ import org.springframework.stereotype.Service;
 import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
 import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.service.OrganizationCourseUnitPriceSettingsService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+
 import org.springframework.transaction.annotation.Transactional;
 
 @Service
@@ -31,8 +33,8 @@ public class OrganizationCourseUnitPriceSettingsServiceImpl extends BaseServiceI
 	}
 
 	@Override
-	public OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(Integer organId, CourseScheduleType courseType, Integer chargeTypeId) {
-		return organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(organId, courseType, chargeTypeId);
+	public OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseTypeAndChargeType(Integer organId, CourseScheduleType courseType, CourseViewTypeEnum courseViewType) {
+		return organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(organId, courseType, courseViewType);
 	}
 
 	@Override

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -42,6 +42,7 @@ import com.ym.mec.biz.service.PayService;
 import com.ym.mec.biz.service.SellOrderService;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
@@ -144,18 +145,17 @@ public class PayServiceImpl implements PayService {
 			List<Integer> ignoreOrganList = Arrays.asList(4);
 			
 			// 是否由平台收款
-			//String isPlatformCollection = sysConfigDao.findConfigValue(SysConfigService.IS_OPEN_SMALL_CLASS_INCOME_TO_PLATFORM);
-			String isPlatformCollection = "1";
+			String isPlatformCollection = sysConfigDao.findConfigValue(SysConfigService.IS_OPEN_SMALL_CLASS_INCOME_TO_PLATFORM);
 			
 			if (StringUtils.equals("1", isPlatformCollection) && !ignoreOrganList.contains(organId)) {
 	        	
 	        	//String merNo = sysConfigDao.findConfigValue(SysConfigService.PLATFORM_PAYEE_ACCOUNT);
-				String merNo = ConfigInit.merNo;
+				String merNo = "H004233";
 	        	if(StringUtils.isBlank(merNo)){
 	        		throw new BizException("平台收款账户查询失败");
 	        	}
 	        	
-	        	Integer routeOrganId = 16;
+	        	Integer routeOrganId = 123;
 	        	
 	        	StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
 	            studentPaymentRouteOrder.setOrderNo(orderNo);

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

@@ -4317,18 +4317,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
     @Override
     @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-    public void activityOrderCallback(StudentPaymentOrder studentPaymentOrder) {
-        Integer userId = studentPaymentOrder.getUserId();
-        StudentPaymentOrder order = studentPaymentOrderDao.lockOrder(studentPaymentOrder.getId());
+    public void activityOrderCallback(StudentPaymentOrder order) {
+        Integer userId = order.getUserId();
+        /*StudentPaymentOrder order = studentPaymentOrderDao.lockOrder(studentPaymentOrder.getId());
         if (!order.getStatus().equals(DealStatusEnum.ING)) {
             return;
-        }
+        }*/
         //更新订单状态
-        int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
+        int updateCount = studentPaymentOrderService.update(order);
         if (updateCount <= 0) {
             throw new BizException("订单更新失败");
         }
-        if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
+        if (order.getStatus().equals(DealStatusEnum.SUCCESS)) {
             Integer activityId = Integer.parseInt(order.getActivityId());
             VipGroupActivity activity = vipGroupActivityDao.get(activityId);
             ActivityUserMapper activityUserMapper = new ActivityUserMapper();
@@ -4342,7 +4342,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             activityUserMapper.setOrganId(order.getOrganId());
             activityUserMapperService.copyProperty(activityUserMapper,activity,false,true);
             if (activity.isPayToBalance()) {
-                sysUserCashAccountService.appendCourseBalance(userId, studentPaymentOrder.getExpectAmount(), PlatformCashAccountDetailTypeEnum.RECHARGE, "通用营销活动购买");
+                sysUserCashAccountService.appendCourseBalance(userId, order.getExpectAmount(), PlatformCashAccountDetailTypeEnum.RECHARGE, "通用营销活动购买");
             }
             if (activity.getFullMinusCourseTimes() != -1 && order.getActivityBuyNum() >= activity.getFullMinusCourseTimes()) {
                 activityUserMapper.setGiveVipFlag(1);
@@ -4359,9 +4359,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             sysUserIncomeCashAccountDetail.setAmount(order.getActualAmount());
             sysUserIncomeCashAccountDetail.setBalance(sysUserCashAccount.getBalance().add(order.getActualAmount()));
             sysUserIncomeCashAccountDetail.setAttribute(order.getTransNo());
-            sysUserIncomeCashAccountDetail.setChannel(studentPaymentOrder.getPaymentChannel());
-            sysUserIncomeCashAccountDetail.setComAmount(studentPaymentOrder.getComAmount());
-            sysUserIncomeCashAccountDetail.setPerAmount(studentPaymentOrder.getPerAmount());
+            sysUserIncomeCashAccountDetail.setChannel(order.getPaymentChannel());
+            sysUserIncomeCashAccountDetail.setComAmount(order.getComAmount());
+            sysUserIncomeCashAccountDetail.setPerAmount(order.getPerAmount());
             //支出
             SysUserCashAccountDetail sysUserExpendCashAccountDetail = new SysUserCashAccountDetail();
             sysUserExpendCashAccountDetail.setUserId(order.getUserId());
@@ -4370,30 +4370,30 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             sysUserExpendCashAccountDetail.setAmount(order.getActualAmount().negate());
             sysUserExpendCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
             sysUserExpendCashAccountDetail.setAttribute(order.getTransNo());
-            sysUserExpendCashAccountDetail.setChannel(studentPaymentOrder.getPaymentChannel());
+            sysUserExpendCashAccountDetail.setChannel(order.getPaymentChannel());
 
-            if (studentPaymentOrder.getComAmount() != null) {
-                sysUserIncomeCashAccountDetail.setComAmount(studentPaymentOrder.getComAmount().negate());
+            if (order.getComAmount() != null) {
+                sysUserIncomeCashAccountDetail.setComAmount(order.getComAmount().negate());
             }
-            if (studentPaymentOrder.getPerAmount() != null) {
-                sysUserExpendCashAccountDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
+            if (order.getPerAmount() != null) {
+                sysUserExpendCashAccountDetail.setPerAmount(order.getPerAmount().negate());
             }
 
             sysUserCashAccountDetailService.insert(sysUserIncomeCashAccountDetail);
             sysUserCashAccountDetailService.insert(sysUserExpendCashAccountDetail);
 
             try {
-                contractService.transferProduceContract(userId, null, studentPaymentOrder.getType());
+                contractService.transferProduceContract(userId, null, order.getType());
             } catch (Exception e) {
                 LOGGER.error("产品协议生成失败", e);
             }
             studentDao.updateStudentServiceTag(userId, null, YesOrNoEnum.YES.getCode());
         }
-        if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED) || studentPaymentOrder.getStatus().equals(DealStatusEnum.CLOSE)) {
-            if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
-                sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "报名缴费失败");
+        if (order.getStatus().equals(DealStatusEnum.FAILED) || order.getStatus().equals(DealStatusEnum.CLOSE)) {
+            if (order.getBalancePaymentAmount() != null && order.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
+                sysUserCashAccountService.updateBalance(order.getUserId(), order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "报名缴费失败");
             }
-            sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
+            sysCouponCodeService.quit(order.getCouponCodeId());
         }
     }
 

+ 60 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentMusicCourseFeeServiceImpl.java

@@ -0,0 +1,60 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.dao.StudentMusicCourseFeeDao;
+import com.ym.mec.biz.dal.entity.StudentMusicCourseFee;
+import com.ym.mec.biz.service.StudentMusicCourseFeeService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.Objects;
+
+
+@Service("studentMusicCourseFeeService")
+public class StudentMusicCourseFeeServiceImpl extends ServiceImpl<StudentMusicCourseFeeDao, StudentMusicCourseFee> implements StudentMusicCourseFeeService {
+
+    @Override
+    public StudentMusicCourseFeeDao getDao() {
+        return this.baseMapper;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void addExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice) {
+        StudentMusicCourseFee one = this.lambdaQuery().eq(StudentMusicCourseFee::getMusicGroupId, musicGroupId)
+                .eq(StudentMusicCourseFee::getUserId, userId).one();
+        if(Objects.isNull(one)){
+            one = new StudentMusicCourseFee();
+            one.setExpectPrice(expectPrice);
+            one.setMusicGroupId(musicGroupId);
+            one.setUserId(userId);
+            this.save(one);
+        }else {
+            this.baseMapper.addExpectPrice(one.getId(),expectPrice);
+        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void cutExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice) {
+        StudentMusicCourseFee one = this.lambdaQuery().eq(StudentMusicCourseFee::getMusicGroupId, musicGroupId)
+                .eq(StudentMusicCourseFee::getUserId, userId).one();
+        if(Objects.isNull(one)){
+            one = new StudentMusicCourseFee();
+            one.setMusicGroupId(musicGroupId);
+            one.setUserId(userId);
+            this.save(one);
+        }else {
+            this.baseMapper.cutExpectPrice(one.getId(),expectPrice);
+        }
+    }
+
+    @Override
+    public boolean updateById(StudentMusicCourseFee entity) {
+        this.lambdaQuery().eq(StudentMusicCourseFee::getMusicGroupId,entity.getMusicGroupId())
+                .eq(StudentMusicCourseFee::getUserId,entity.getUserId()).one();
+        return super.save(entity);
+    }
+}
+

+ 36 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -61,6 +61,14 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
     private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
+    @Autowired
+    private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
+    @Autowired
+    private StudentMusicCourseFeeService studentMusicCourseFeeService;
+    @Autowired
+    private MemberFeeSettingService memberFeeSettingService;
+    @Autowired
+    private MusicGroupPaymentCalenderMemberDao musicGroupPaymentCalenderMemberDao;
 
     @Override
     public BaseDAO<Long, StudentPaymentOrderDetail> getDAO() {
@@ -654,7 +662,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         }
 
         //缴费项目详情
-        musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder, studentRegistration);
+        MusicGroupPaymentCalenderDetail paymentCalenderDetail = musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder);
 
         List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
         //销售订单详情
@@ -697,18 +705,45 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
                 repair.setStudentInstrumentId(studentInstrumentId);
                 studentPaymentOrderDetailDao.update(repair);
             }
+            if(studentPaymentOrder.getType() == OrderTypeEnum.APPLY){
+                //如果是免费团,那么要处理乐器溢出的课程费用
+                CourseViewTypeEnum courseViewType = musicGroup.getCourseViewType();
+                Integer subjectId = studentRegistration.getActualSubjectId();
+                ChargeTypeSubjectMapper chargeType = chargeTypeSubjectMapperDao.findByViewTypeANdSubject(courseViewType,subjectId,musicGroup.getTenantId());
+                if(Objects.nonNull(chargeType) && chargeType.getFee() != null && musical.getPrice().compareTo(BigDecimal.ZERO) > 0
+                        && chargeType.getFee().compareTo(musical.getPrice()) < 0){
+                    BigDecimal musicalFee = musical.getPrice().subtract(chargeType.getFee());
+                    studentMusicCourseFeeService.addExpectPrice(studentRegistration.getUserId(),
+                            musicGroup.getId(),musicalFee);
+                    //设置缴费项目详情乐器和课费
+                    paymentCalenderDetail.setExpectAmount(chargeType.getFee());
+                    paymentCalenderDetail.setActualAmount(musicalFee);
+                }
+            }
         }
 
         //学生云教练处理
         if (detailTypeEnums.contains(CLOUD_TEACHER)) {
             if(studentPaymentOrder.getType() == OrderTypeEnum.APPLY){
                 studentRegistration.setHasCloudTeacher(1);
+                //如果是报名订单,要处理云教练费用、以及溢出课费
+                if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                    //获取云教练溢出费用
+                    MusicGroupPaymentCalenderMember calenderMember = musicGroupPaymentCalenderMemberDao.findByCalenderId(paymentCalenderDetail.getMusicGroupPaymentCalenderId());
+                    BigDecimal courseIncome = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
+                            calenderMember.getNum(), MemberFeeSettingServiceImpl::getIncome);
+                    if(calenderMember.getActualAmount().compareTo(courseIncome) > 0){
+                        paymentCalenderDetail.setExpectMemberAmount(courseIncome);
+                        paymentCalenderDetail.setActualAmount(calenderMember.getActualAmount().subtract(courseIncome));
+                    }
+                }
             }
             BigDecimal cloudTeacherFee = allDetails.stream().filter(o -> o.getType() == CLOUD_TEACHER)
                     .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
             cloudTeacherOrderService.addOrderDetail2CloudTeacher(studentPaymentOrder, cloudTeacherFee);
         }
+        musicGroupPaymentCalenderDetailService.update(paymentCalenderDetail);
         studentRegistrationDao.update(studentRegistration);
     }
 

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

@@ -15,14 +15,12 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import com.ym.mec.biz.dal.dao.ChargeTypeOrganizationFeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SubjectGoodsMapperDao;
 import com.ym.mec.biz.dal.dto.ConditionDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
-import com.ym.mec.biz.dal.entity.ChargeTypeOrganizationFee;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
@@ -65,19 +63,6 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
     }
 
     @Override
-    public List<Subject> findDefaultSubByChargeTypeId(Integer chargeTypeId, Integer organId, Integer number) {
-        List<Subject> subByChargeTypeId = subjectDao.findDefaultSubByChargeTypeId(chargeTypeId);
-        ChargeTypeOrganizationFee byOrganId = chargeTypeOrganizationFeeDao.findByOrganId(chargeTypeId, organId);
-        if (byOrganId != null) {
-            BigDecimal bigDecimal = new BigDecimal(number);
-            subByChargeTypeId.forEach(e -> {
-                e.setFee(byOrganId.getCourseFee().multiply(bigDecimal));
-            });
-        }
-        return subByChargeTypeId;
-    }
-
-    @Override
     public List<SubjectApplyDetailDto> findSubApplyDetail(String musicGroupId) {
         List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
         

+ 3 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java

@@ -291,8 +291,7 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
             List<Integer> studentIds = records.stream().map(e -> e.getId()).collect(Collectors.toList());
             Map<Integer,String> subjectMap = MapUtil.convertIntegerMap(studentDao.getStudentSubjectMapList(studentIds));
             Map<Integer,String> groupNameMap = MapUtil.convertMybatisMap(musicGroupDao.queryNormalGroupName(studentIds));
-            List<TempCampUserTrainingSequenceVo> sequenceDays = studentDao.getStudentCloudStudySequenceDaysV2(studentIds,
-                    param.get("startTime").toString(),param.get("endTime").toString());
+            List<TempCampUserTrainingSequenceVo> sequenceDays = studentDao.getStudentCloudStudySequenceDaysV2(studentIds, param.get("campId").toString());
             Map<Integer, List<Long>> listMap = sequenceDays.stream().collect(Collectors.groupingBy(e -> e.getUserId(),
                     Collectors.collectingAndThen(Collectors.toList(),v->v.stream().map(e->e.getDayNum()).collect(Collectors.toList()))));
             Integer standardDays = Integer.parseInt(param.get("standardDays").toString());
@@ -631,8 +630,8 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         OutputStream outputStream = response.getOutputStream();
         HSSFWorkbook workbook = null;
         try {
-            String[] header = {"学员编号", "学员姓名",  "学员声部",  "乐团", "手机号", "群组", "打卡天数", "训练时长(分钟)", "打卡状态"};
-            String[] body = {"id", "username",  "subjectName",  "musicGroupName", "phone", "imGroupName", "playDay", "playTime", "standardFlag?'达标':'未达标'"};
+            String[] header = {"学员编号", "学员姓名",  "学员声部",  "乐团", "手机号", "群组", "打卡天数","最高连续打卡", "训练时长(分钟)", "打卡状态"};
+            String[] body = {"id", "username",  "subjectName",  "musicGroupName", "phone", "imGroupName", "playDay","cloudStudySequenceDays", "playTime", "standardFlag?'达标':'未达标'"};
             workbook = POIUtil.exportExcel(header, body, list);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=replacement-" + DateUtil.getDate(new Date()) + ".xls");

+ 21 - 16
mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml

@@ -8,7 +8,7 @@
 
     <resultMap type="com.ym.mec.biz.dal.entity.ChargeTypeSubjectMapper" id="ChargeTypeSubjectMapper">
         <result column="id_" property="id"/>
-        <result column="charge_type_id_" property="chargeTypeId"/>
+        <result column="course_view_type_" property="courseViewType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="subject_id_" property="subjectId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -37,9 +37,9 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ChargeTypeSubjectMapper" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
-        INSERT INTO charge_type_subject_mapper (charge_type_id_, subject_id_, kit_group_purchase_type_, deposit_fee_,
+        INSERT INTO charge_type_subject_mapper (course_view_type_, subject_id_, kit_group_purchase_type_, deposit_fee_,
                                                 fee_, goods_discount_rate_, create_time_, update_time_,tenant_id_)
-        VALUES (#{chargeTypeId}, #{subjectId},
+        VALUES (#{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{subjectId},
                 #{kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{depositFee},
                 #{fee}, #{goodsDiscountRate}, now(), now(),#{tenantId})
     </insert>
@@ -48,10 +48,10 @@
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO charge_type_subject_mapper
-        (charge_type_id_,subject_id_,kit_group_purchase_type_,deposit_fee_,fee_,goods_discount_rate_,create_time_,update_time_,tenant_id_)
+        (course_view_type_,subject_id_,kit_group_purchase_type_,deposit_fee_,fee_,goods_discount_rate_,create_time_,update_time_,tenant_id_)
         VALUES
         <foreach collection="list" item="item" separator=",">
-            (#{item.chargeTypeId},#{item.subjectId},#{item.kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.depositFee},#{item.fee},#{item.goodsDiscountRate},now(),now(),#{item.tenantId})
+            (#{item.courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.subjectId},#{item.kitGroupPurchaseTypeEnum,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.depositFee},#{item.fee},#{item.goodsDiscountRate},now(),now(),#{item.tenantId})
         </foreach>
     </insert>
 
@@ -62,8 +62,8 @@
             <if test="subjectId != null">
                 subject_id_ = #{subjectId},
             </if>
-            <if test="chargeTypeId != null">
-                charge_type_id_ = #{chargeTypeId},
+            <if test="courseViewType != null">
+                course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="kitGroupPurchaseTypeEnum != null">
                 kit_group_purchase_type_ =
@@ -92,8 +92,8 @@
                 <if test="item.subjectId != null">
                     subject_id_ = #{item.subjectId},
                 </if>
-                <if test="item.chargeTypeId != null">
-                    charge_type_id_ = #{item.chargeTypeId},
+                <if test="item.courseViewType != null">
+                    course_view_type_ = #{item.courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 </if>
                 <if test="item.kitGroupPurchaseTypeEnum != null">
                     kit_group_purchase_type_ =
@@ -126,14 +126,14 @@
     <delete id="deleteByChargeTypeId">
         DELETE
         FROM charge_type_subject_mapper
-        WHERE charge_type_id_ = #{chargeTypeId}
+        WHERE course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </delete>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="ChargeTypeSubjectMapper" parameterType="map">
         SELECT * FROM charge_type_subject_mapper where  tenant_id_ = #{tenantId}
-        	<if test="chargeTypeId != null">
-        		and charge_type_id_ = #{chargeTypeId}
+        	<if test="courseViewType != null">
+        		and course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="subjectId != null">
         		and subject_id_ = #{subjectId}
@@ -145,8 +145,8 @@
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*) FROM charge_type_subject_mapper where tenant_id_ = #{tenantId}
-        	<if test="chargeTypeId != null">
-        		and charge_type_id_ = #{chargeTypeId}
+        	<if test="courseViewType != null">
+        		and course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         	</if>
         	<if test="subjectId != null">
         		and subject_id_ = #{subjectId}
@@ -157,7 +157,7 @@
     <select id="getSubjectDiscount" resultMap="ChargeTypeSubjectMapper">
         SELECT *
         FROM charge_type_subject_mapper
-        WHERE charge_type_id_ = #{chargeTypeId}
+        WHERE course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND subject_id_ = #{subjectId}
     </select>
 
@@ -165,7 +165,12 @@
     <select id="getSubjectsDiscount" resultMap="ChargeTypeSubjectMapper">
         SELECT *
         FROM charge_type_subject_mapper
-        WHERE charge_type_id_ = #{chargeTypeId}
+        WHERE course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
           AND FIND_IN_SET(subject_id_, #{subjectIds})
     </select>
+    <select id="findByViewTypeANdSubject" resultMap="ChargeTypeSubjectMapper">
+        select * from charge_type_subject_mapper
+        where course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        and subject_id_ = #{subjectId} and tenant_id_ = #{tenantId} LIMIT 1
+    </select>
 </mapper>

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

@@ -261,14 +261,13 @@
     </resultMap>
     <select id="queryCloudTeacherActiveDetail" resultMap="CloudTeacherActiveTargetDetailDto">
         SELECT su.username_,cto.remark_,cto.amount_,cto.student_id_,GROUP_CONCAT(DISTINCT co.name_) cooperation_name_,
-        GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,GROUP_CONCAT(DISTINCT ct.name_) charge_type_name_,
+        GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,GROUP_CONCAT(DISTINCT case when mg.course_view_type_ = 2 then '会员收费' when mg.course_view_type_ = 3 then '免费' else '课程收费' end) charge_type_name_,
         sj.name_ subject_name_,st.current_grade_num_,cto.create_time_
         FROM cloud_teacher_order cto
         LEFT JOIN sys_user su ON su.id_ = cto.student_id_
         LEFT JOIN student_registration sr ON sr.user_id_ = cto.student_id_ AND sr.music_group_status_ = 'NORMAL'
         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_ AND mg.status_ = 'PROGRESS'
         LEFT JOIN cooperation_organ co ON co.id_ = mg.cooperation_organ_id_
-        LEFT JOIN charge_type ct ON ct.id_ = mg.charge_type_id_
         LEFT JOIN student st ON st.user_id_ = cto.student_id_
         LEFT JOIN `subject` sj ON sj.id_ = st.subject_id_list_
         <include refid="queryCloudTeacherActiveDetailSql"/>
@@ -458,9 +457,6 @@
             <if test="search != null and search != ''">
                 AND (su.id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR mg.id_ LIKE CONCAT('%',#{search},'%'))
             </if>
-            <if test="chargeType != null">
-                AND mg.charge_type_id_ = #{chargeType}
-            </if>
             <if test="subjectId != null">
                 AND st.subject_id_list_ = #{subjectId}
             </if>

+ 2 - 15
mec-biz/src/main/resources/config/mybatis/CourseScheduleTeacherSalaryMapper.xml

@@ -380,19 +380,6 @@
 		</foreach>
 		AND mg.settlement_type_ IS NOT NULL
 	</select>
-	<select id="findMusicGroupChargeTypeByCourse" resultType="map">
-		SELECT
-			cs.id_ AS 'key',
-			mg.charge_type_id_ AS 'value'
-		FROM
-			course_schedule cs
-			LEFT JOIN class_group cg ON cs.class_group_id_=cg.id_
-			LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
-		WHERE cs.id_ IN
-		<foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
-			#{courseScheduleId}
-		</foreach>
-	</select>
 	<select id="findCourseSubsidyByCourses" resultType="map">
 		SELECT
 			cs.id_ AS 'key',
@@ -729,7 +716,8 @@
  	</resultMap>
     <select id="exportMusicTeacherSalary" resultMap="ExportTeacherSalaryDtoMap">
 		SELECT cs.`id_` courseScheduleId,ts.user_id_ teacherId,mgo.name_ courseScheduleOrganName,mg.name_ groupName,
-		ct.name_ changeType,u.real_name_ teacherName,o.name_ teacherOrganName,cs.music_group_id_ group_id_,
+		case when mg.course_view_type_ = 2 then '会员收费' when mg.course_view_type_ = 3 then '免费' else '课程收费' end changeType,
+		u.real_name_ teacherName,o.name_ teacherOrganName,cs.music_group_id_ group_id_,
 		CASE WHEN cs.teach_mode_ = 'OFFLINE' THEN '线下' WHEN cs.teach_mode_ = 'ONLINE' THEN '线上' END teach_mode_,
 		CASE WHEN t.job_nature_ = 'PART_TIME' THEN '兼职' WHEN t.job_nature_ = 'FULL_TIME' THEN '全职' ELSE '零时工' END jobType,
 		CASE WHEN cs.type_ = 'SINGLE' THEN '单技课' WHEN cs.type_ = 'MIX' THEN '合奏课' WHEN cs.type_ = 'HIGH' THEN '基础技能课'  WHEN cs.type_ = 'VIP' THEN 'vip课'
@@ -757,7 +745,6 @@
 		LEFT JOIN course_schedule_student_payment sp ON sp.course_schedule_id_ = ts.course_schedule_id_
 		LEFT JOIN music_group mg ON (mg.id_ = ts.music_group_id_ AND ts.group_type_ = 'MUSIC')
 		LEFT JOIN organization mgo ON mgo.id_ = mg.organ_id_
-		LEFT JOIN charge_type ct ON ct.id_ = mg.charge_type_id_
 		WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.`del_flag_` != 1 AND cs.group_type_ = 'MUSIC' AND ts.settlement_time_ IS NOT NULL
 		AND t.is_settlement_salary_ = 1 and ts.tenant_id_ = #{tenantId}
 		<if test="courseTypeList != null">

+ 4 - 11
mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml

@@ -12,7 +12,6 @@
         <result column="team_teacher_id_" property="teamTeacherId"/>
         <result column="educational_teacher_id_" property="educationalTeacherId"/>
         <result column="transaction_teacher_id_" property="transactionTeacherId"/>
-        <result column="charge_type_id_" property="chargeTypeId"/>
         <result column="course_form_" property="courseForm"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -90,12 +89,12 @@
     </select>
 
     <select id="queryBasicInfo" resultMap="MusicGroupBasicDto">
-        SELECT mg.*,o.name_ organ_name_,s.name_ school_name_ ,co.name_ cooperation_organ_name_,ct.name_ charge_type_name_,
+        SELECT mg.*,o.name_ organ_name_,s.name_ school_name_ ,co.name_ cooperation_organ_name_,
         u1.real_name_ edu_teacher_name_,u2.real_name_ teans_teacher_name_,u2.phone_ teans_teacher_phone_,
         u3.real_name_ team_teacher_name_,u4.real_name_ dir_teacher_name_,u5.real_name_ repair_teacher_name_
         FROM music_group mg left join organization o on mg.organ_id_ = o.id_
         left join school s on mg.school_id_ = s.id_ left join cooperation_organ co on co.id_ = mg.cooperation_organ_id_
-        left join charge_type ct on ct.id_ = mg.charge_type_id_ left join sys_user u1 on u1.id_ = mg.educational_teacher_id_
+        left join sys_user u1 on u1.id_ = mg.educational_teacher_id_
         left join sys_user u2 on u2.id_ = mg.transaction_teacher_id_ left join sys_user u3 on u3.id_ = mg.team_teacher_id_
         left join sys_user u4 on u4.id_ = mg.director_user_id_ left join sys_user u5 on u5.id_ = mg.repair_user_id_
         WHERE mg.id_ = #{id}
@@ -114,7 +113,7 @@
         INSERT INTO music_group
                 (id_, name_, organ_id_, school_id_, apply_expire_date_, pre_apply_expire_date_, team_teacher_id_,
                  educational_teacher_id_,
-                 charge_type_id_, course_form_, create_time_, update_time_, status_,
+                 course_form_, create_time_, update_time_, status_,
                  bill_start_date_, improvent_classes_num_, enroll_classes_, payment_expire_date_, is_extra_class_,
                  settlement_type_, cooperation_organ_id_, enlightenment_course_time_,
                  parent_meeting_time_, img_, director_user_id_, is_classroom_lessons_, memo_, expect_start_group_date_,
@@ -123,7 +122,7 @@
                  music_group_plan_making_id_,first_recruit_grade_,default_charge_standard_,single_train_minutes_,course_plan_,sale_activity_desc_,graduate_grade_,basic_student_num_,payment_user_type_,charge_mode_)
         VALUES (#{id}, #{name}, #{organId}, #{schoolId}, #{applyExpireDate}, #{preApplyExpireDate}, #{teamTeacherId},
                 #{educationalTeacherId},
-                #{chargeTypeId}, #{courseForm}, now(), now(),
+                #{courseForm}, now(), now(),
                 #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{billStartDate},
                 #{improventClassesNum}, #{enrollClasses}, #{paymentExpireDate},
                 #{isExtraClass, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -171,9 +170,6 @@
             <if test="courseForm != null">
                 course_form_ = #{courseForm},
             </if>
-            <if test="chargeTypeId != null">
-                charge_type_id_ = #{chargeTypeId},
-            </if>
             <if test="educationalTeacherId != null">
                 educational_teacher_id_ = #{educationalTeacherId},
             </if>
@@ -326,9 +322,6 @@
                 AND (mg.name_ LIKE CONCAT('%',#{search},'%') OR mg.id_ LIKE CONCAT('%',#{search},'%')
                  OR mg.cooperation_organ_id_ = #{search} OR co.name_ LIKE CONCAT('%',#{search},'%'))
             </if>
-            <if test="chargeTypeId != null">
-                AND mg.charge_type_id_ = #{chargeTypeId}
-            </if>
             <if test="musicGroupStatus != null">
                 AND FIND_IN_SET(mg.status_,#{musicGroupStatus})
             </if>

+ 8 - 8
mec-biz/src/main/resources/config/mybatis/MusicGroupOrganizationCourseSettingsMapper.xml

@@ -8,7 +8,7 @@
         <id column="id_" property="id"/>
         <result column="name_" property="name"/>
         <result column="organ_id_" property="organId"/>
-        <result column="charge_type_id_" property="chargeTypeId"/>
+        <result column="course_view_type_" property="courseViewType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="total_current_price_" property="totalCurrentPrice"/>
         <result column="total_original_price_" property="totalOriginalPrice"/>
         <result column="create_time_" property="createTime"/>
@@ -17,7 +17,7 @@
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
-        id_, name_, organ_id_, charge_type_id_, total_current_price_, total_original_price_,
+        id_, name_, organ_id_, course_view_type_, total_current_price_, total_original_price_,
         create_time_, update_time_,tenant_id_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="MusicGroupOrganizationCourseSettings">
@@ -35,10 +35,10 @@
     <insert id="insert" keyColumn="id_" keyProperty="id"
             parameterType="com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings" useGeneratedKeys="true">
         <!--@mbg.generated-->
-        insert into music_group_organization_course_settings (name_, organ_id_, charge_type_id_, total_current_price_,
+        insert into music_group_organization_course_settings (name_, organ_id_, course_view_type_, total_current_price_,
         total_original_price_,
         create_time_, update_time_,tenant_id_)
-        values (#{name}, #{organId}, #{chargeTypeId}, #{totalCurrentPrice}, #{totalOriginalPrice},
+        values (#{name}, #{organId}, #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{totalCurrentPrice}, #{totalOriginalPrice},
         NOW(),NOW(),#{tenantId})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings">
@@ -51,8 +51,8 @@
             <if test="organId != null">
                 organ_id_ = #{organId},
             </if>
-            <if test="chargeTypeId != null">
-                charge_type_id_ = #{chargeTypeId},
+            <if test="courseViewType != null">
+                course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="totalCurrentPrice != null">
                 total_current_price_ = #{totalCurrentPrice},
@@ -95,8 +95,8 @@
             <if test="organId != null">
                 AND mgocs.organ_id_=#{organId}
             </if>
-            <if test="chargeTypeId != null">
-                AND mgocs.charge_type_id_ = #{chargeTypeId}
+            <if test="courseViewType != null">
+                AND mgocs.course_view_type_ = #{courseViewType}
             </if>
         </where>
     </sql>

+ 11 - 4
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml

@@ -28,6 +28,7 @@
 		<result column="use_in_course_" property="useInCourse"/>
 		<result column="responsible_user_id_" property="responsibleUserId"/>
 		<result column="responsible_record_" property="responsibleRecord"/>
+		<result column="course_income_" property="courseIncome"/>
 		<result column="responsible_username_" property="responsible.username"/>
 		<association property="sysUser" javaType="com.ym.mec.auth.api.entity.SysUser">
 			<result column="username_" property="username" />
@@ -56,11 +57,11 @@
 		INSERT INTO music_group_payment_calender_detail
 		(music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,payment_status_,
 		user_status_,pay_time_,update_time_,create_time_,start_payment_date_,deadline_payment_date_,
-		payment_order_id_,use_in_course_,responsible_user_id_,responsible_record_,expect_member_amount_,tenant_id_)
+		payment_order_id_,use_in_course_,responsible_user_id_,responsible_record_,expect_member_amount_,tenant_id_,course_income_)
 		VALUES(#{musicGroupPaymentCalenderId},#{userId},#{expectAmount},#{actualAmount},
 		       #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 		#{userStatus},#{payTime},NOW(),NOW(),#{startPaymentDate},#{deadlinePaymentDate},
-		       #{paymentOrderId},#{useInCourse},#{responsibleUserId},#{responsibleRecord},#{expectMemberAmount},#{tenantId})
+		       #{paymentOrderId},#{useInCourse},#{responsibleUserId},#{responsibleRecord},#{expectMemberAmount},#{tenantId},#{courseIncome})
 	</insert>
 
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
@@ -68,13 +69,13 @@
         INSERT INTO music_group_payment_calender_detail
 		(music_group_payment_calender_id_,user_id_,expect_amount_,actual_amount_,
 		payment_status_,user_status_,pay_time_,update_time_,create_time_,start_payment_date_,
-		 deadline_payment_date_,payment_order_id_,use_in_course_,responsible_user_id_,responsible_record_,expect_member_amount_,tenant_id_)
+		 deadline_payment_date_,payment_order_id_,use_in_course_,responsible_user_id_,responsible_record_,expect_member_amount_,tenant_id_,course_income_)
 		VALUES
 		<foreach collection="list" item="item" separator=",">
             (#{item.musicGroupPaymentCalenderId},#{item.userId},#{item.expectAmount},
             #{item.actualAmount},#{item.paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.userStatus},#{item.payTime},
             #{item.updateTime},#{item.createTime},#{item.startPaymentDate},#{item.deadlinePaymentDate},
-             #{item.paymentOrderId},#{item.useInCourse},#{item.responsibleUserId},#{item.responsibleRecord},#{item.expectMemberAmount},#{item.tenantId})
+             #{item.paymentOrderId},#{item.useInCourse},#{item.responsibleUserId},#{item.responsibleRecord},#{item.expectMemberAmount},#{item.tenantId},#{item.courseIncome})
         </foreach>
     </insert>
 
@@ -83,6 +84,9 @@
 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail">
 		UPDATE music_group_payment_calender_detail
 		<set>
+			<if test="courseIncome != null">
+				course_income_ = #{courseIncome},
+			</if>
 			<if test="startPaymentDate != null">
 				start_payment_date_ = #{startPaymentDate},
 			</if>
@@ -138,6 +142,9 @@
 		<foreach collection="calenderDetails" item="item" index="index" open="" close="" separator=";">
 			UPDATE music_group_payment_calender_detail
 			<set>
+				<if test="item.courseIncome != null">
+					course_income_ = #{item.courseIncome},
+				</if>
 				<if test="item.startPaymentDate != null">
 					start_payment_date_ = #{item.startPaymentDate},
 				</if>

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

@@ -276,6 +276,9 @@
         WHERE user_id_ = #{userId} AND payment_status_ = 'NON_PAYMENT')
         AND expect_num_ > 0 AND music_group_id_ = #{musicGroupId}
     </update>
+    <update id="updatePaymentNum">
+        UPDATE music_group_payment_calender SET expect_num_ = expect_num_ + #{expectNum},actual_num_ = actual_num_ + #{actualNum} WHERE id_ = #{calenderId}
+    </update>
     <select id="findStudentNoPaymentCalender" resultType="java.lang.Long">
         SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
         WHERE mgpc.student_ids_ = #{userId} AND mgpc.payment_type_ = 'ADD_STUDENT'

+ 10 - 37
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -160,13 +160,6 @@
             WHERE id_ = #{paymentCourseDetail.id} and tenant_id_ = #{paymentCourseDetail.tenantId}
         </foreach>
     </update>
-    <update id="updateByCourseType">
-        UPDATE music_group_payment_student_course_detail
-        SET course_current_price_ = #{courseCurrentPrice},
-            update_time_          = NOW()
-        WHERE course_type_ = #{courseType}
-          AND FIND_IN_SET(music_group_payment_calender_detail_id_, #{musicGroupPaymentCalenderIds})
-    </update>
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
@@ -175,23 +168,6 @@
         WHERE id_ = #{id}
     </delete>
 
-    <!-- 根据主键删除一条记录 -->
-    <delete id="deleteByMusicGroupPaymentCalenderId">
-        DELETE
-        FROM music_group_payment_student_course_detail
-        WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId}
-    </delete>
-
-    <delete id="deleteByMusicGroupPaymentCalenderDetailId">
-        DELETE FROM music_group_payment_student_course_detail
-        <where>
-            music_group_payment_calender_detail_id_ IN
-            <foreach item="item" collection="list" separator="," open="(" close=")" index="">
-                #{item}
-            </foreach>
-        </where>
-    </delete>
-
     <!-- 分页查询 -->
     <select id="queryByMusicGroupPaymentStudentCourseDetailId" resultMap="MusicGroupPaymentStudentCourseDetail"
             parameterType="map">
@@ -266,22 +242,20 @@
         GROUP BY mgpscd.user_id_,mgpscd.course_type_
         HAVING SUM(mgpscd.sub_course_minutes_) > 0
     </select>
-
-    <delete id="deleteByUserIdAndMusicGroupId">
-        DELETE
-        FROM music_group_payment_student_course_detail
+    <select id="findByUserIdAndMusicGroupId" resultMap="MusicGroupPaymentStudentCourseDetail">
+        SELECT * FROM music_group_payment_student_course_detail
         WHERE user_id_ = #{userId}
           AND music_group_payment_calender_id_ IN (
             SELECT id_
             FROM music_group_payment_calender
             WHERE music_group_id_ = #{musicGroupId}
         )
-    </delete>
-    <delete id="deleteByUserIdAndCalenderId">
-        DELETE
-        FROM music_group_payment_student_course_detail
-        WHERE user_id_ = #{userId} AND music_group_payment_calender_id_ IN
-        <foreach collection="calenderIds" open="(" close=")" item="id" separator=",">
+    </select>
+
+    <delete id="delByIds">
+        DELETE FROM music_group_payment_student_course_detail
+        WHERE id_ IN
+        <foreach collection="courseDetailIds" open="(" close=")" item="id" separator=",">
             #{id}
         </foreach>
     </delete>
@@ -369,7 +343,7 @@
     </select>
 
     <select id="findByCalenderAndUserId" resultMap="MusicGroupPaymentStudentCourseDetail">
-        SELECT * FROM music_group_payment_student_course_detail WHERE music_group_payment_calender_id_ = #{calenderId}
+        SELECT * FROM music_group_payment_student_course_detail WHERE FIND_IN_SET(music_group_payment_calender_id_,#{calenderId})
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>
@@ -390,7 +364,6 @@
     </select>
 
     <update id="clearRemainCourseMinutesByMusicGroupId">
-    	update music_group_payment_student_course_detail
-		set sub_course_minutes_ = 0 WHERE sub_course_minutes_ > 0 and music_group_id_ = #{musicGroupId}
+    	update music_group_payment_student_course_detail set sub_course_minutes_ = 0 WHERE sub_course_minutes_ > 0 and music_group_id_ = #{musicGroupId}
     </update>
 </mapper>

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

@@ -35,12 +35,6 @@
 		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">

+ 15 - 16
mec-biz/src/main/resources/config/mybatis/OrganizationCourseUnitPriceSettingsMapper.xml

@@ -7,7 +7,7 @@
 		<result column="id_" property="id" />
 		<result column="organ_id_" property="organId" />
 		<result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
-		<result column="charge_type_id_" property="chargeTypeId" />
+		<result column="course_view_type_" property="courseViewType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
 		<result column="unit_price_" property="unitPrice" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
@@ -29,16 +29,16 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO organization_course_unit_price_settings
-		(id_,organ_id_,course_type_,charge_type_id_,unit_price_,create_time_,update_time_,tenant_id_)
-		VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{chargeTypeId},#{unitPrice},now(),now(),#{tenantId})
+		(id_,organ_id_,course_type_,course_view_type_,unit_price_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{unitPrice},now(),now(),#{tenantId})
 	</insert>
 	
 	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO organization_course_unit_price_settings
-		(id_,organ_id_,course_type_,charge_type_id_,unit_price_,create_time_,update_time_,tenant_id_)
+		(id_,organ_id_,course_type_,course_view_type_,unit_price_,create_time_,update_time_,tenant_id_)
 		VALUES
 		<foreach collection="list" item="item" separator=",">
-		(#{item.id},#{item.organId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.chargeTypeId},#{item.unitPrice},now(),now(),#{item.tenantId})
+		(#{item.id},#{item.organId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.unitPrice},now(),now(),#{item.tenantId})
 		</foreach>
 	</insert>
 
@@ -58,8 +58,8 @@
 			<if test="courseType != null">
 				course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
-			<if test="chargeTypeId != null">
-				charge_type_id_ = #{chargeTypeId},
+			<if test="courseViewType != null">
+				course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 			</if>
 			<if test="unitPrice != null">
 				unit_price_ = #{unitPrice},
@@ -78,8 +78,7 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="OrganizationCourseUnitPriceSettings" parameterType="map">
-		SELECT ups.*,o.name_ organ_name_ ,ct.name_ charge_type_name_ FROM organization_course_unit_price_settings ups left join organization o on ups.organ_id_ = o.id_
-		left join charge_type ct on ct.id_ = ups.charge_type_id_
+		SELECT ups.*,o.name_ organ_name_  FROM organization_course_unit_price_settings ups left join organization o on ups.organ_id_ = o.id_
 		<where>
 			ups.tenant_id_ = #{tenantId}
 			<if test="organId != null">
@@ -88,8 +87,8 @@
 			<if test="courseScheduleType != null">
 				and ups.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
-			<if test="chargeTypeId != null">
-				and ups.charge_type_id_ = #{chargeTypeId}
+			<if test="courseViewType != null">
+				and ups.course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 		</where>
 		ORDER BY ups.id_ desc
@@ -107,19 +106,19 @@
 			<if test="courseScheduleType != null">
 				and ups.course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
-			<if test="chargeTypeId != null">
-				and ups.charge_type_id_ = #{chargeTypeId}
+			<if test="courseViewType != null">
+				and ups.course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 		</where>
 	</select>
 	
 	<select id="queryByOrganIdAndCourseTypeAndChargeType" resultMap="OrganizationCourseUnitPriceSettings" parameterType="map">
 		SELECT * FROM organization_course_unit_price_settings WHERE organ_id_ = #{organId} and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-		and charge_type_id_ = #{chargeTypeId}
+		and course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 	</select>
     <select id="queryMapByOrganIdAndChargeTypeId" resultType="java.util.Map">
 		SELECT course_type_ 'key',MAX(unit_price_)'value' FROM organization_course_unit_price_settings
-		WHERE organ_id_ = #{organId} AND charge_type_id_ = #{chargeTypeId}
+		WHERE organ_id_ = #{organId} AND course_view_type_ = #{courseViewType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		GROUP BY course_type_
 	</select>
 	<select id="querySingle" resultType="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings">
@@ -131,7 +130,7 @@
 	</select>
     <select id="queryByMusicGroupId" resultMap="OrganizationCourseUnitPriceSettings">
 		select ocups.* from organization_course_unit_price_settings ocups
-		LEFT JOIN music_group mg ON mg.organ_id_ = ocups.organ_id_ AND mg.charge_type_id_ = ocups.charge_type_id_
+		LEFT JOIN music_group mg ON mg.organ_id_ = ocups.organ_id_ AND mg.course_view_type_ = ocups.course_view_type_
 		where mg.id_ = #{musicGroupId}
 	</select>
 </mapper>

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -1275,14 +1275,15 @@
     </select>
 
     <select id="getStudentCloudStudySequenceDaysV2" resultType="com.ym.mec.biz.dal.vo.TempCampUserTrainingSequenceVo">
-        select user_id_ userId,TO_DAYS(DATE_FORMAT(day_,'%Y-%m-%d')) dayNum
-        from user_music_compare_camp_day_data
-        where DATE_FORMAT(day_,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
-        and user_id_ IN
+        select ucamp.user_id_ userId,TO_DAYS(DATE_FORMAT(ucamp.day_,'%Y-%m-%d')) dayNum
+        from user_music_compare_camp_day_data ucamp
+        left join temp_little_artist_training_camp camp on camp.id_ = ucamp.camp_id_
+        where ucamp.camp_id_ = #{campId}
+        and ucamp.user_id_ IN
         <foreach collection="studentIds" open="(" close=")" item="userId" separator=",">
             #{userId}
         </foreach>
-        group by user_id_,DATE_FORMAT(day_,'%Y-%m-%d')
+        and ucamp.train_time_ &gt;= camp.sign_standard_ * 60
     </select>
     <sql id="queryStudentBasicInfoSql">
         <where>

+ 21 - 0
mec-biz/src/main/resources/config/mybatis/StudentMusicCourseFeeMapper.xml

@@ -0,0 +1,21 @@
+<?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.StudentMusicCourseFeeDao">
+    <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.StudentMusicCourseFee">
+        <id column="id_" property="id"/>
+        <id column="organ_id_" property="organId"/>
+        <id column="music_group_id_" property="musicGroupId"/>
+        <id column="expect_price_" property="expectPrice"/>
+        <id column="actual_price_" property="actualPrice"/>
+        <id column="receivable_price_" property="receivablePrice"/>
+        <id column="create_time_" property="createTime"/>
+        <id column="update_time_" property="updateTime"/>
+    </resultMap>
+    <insert id="addExpectPrice">
+        update student_music_course_fee set expect_price_ = expect_price_ + #{expectPrice} where id_ = #{id}
+    </insert>
+
+    <insert id="cutExpectPrice">
+        update student_music_course_fee set expect_price_ = expect_price_ - #{expectPrice} where id_ = #{id}
+    </insert>
+</mapper>

+ 1 - 7
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -84,12 +84,6 @@
         WHERE mgsp.music_group_id_ = #{musicGroupId} AND s.del_flag_ = 0
     </select>
 
-    <select id="findSubByChargeType" resultMap="Subject">
-        SELECT s.* FROM charge_type_subject_mapper ctsm
-        LEFT JOIN `subject` s ON ctsm.subject_id_ = s.id_
-        WHERE ctsm.charge_type_id_ = #{chargeTypeId} AND s.del_flag_ = 0
-    </select>
-
     <select id="findByParentId" resultMap="Subject">
         SELECT * FROM subject <include refid="querySubPageSql"/>
     </select>
@@ -97,7 +91,7 @@
     <select id="findDefaultSubByChargeTypeId" resultMap="Subject">
         SELECT s.* FROM charge_type_subject_mapper ctsm
         LEFT JOIN `subject` s ON subject_id_ = s.id_
-        WHERE ctsm.charge_type_id_ = #{chargeTypeId} AND s.del_flag_ = 0
+        WHERE ctsm.course_view_type_ = #{courseViewType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND s.del_flag_ = 0
     </select>
 
     <resultMap id="subApplyDetail" type="com.ym.mec.biz.dal.dto.SubjectApplyDetailDto">

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

@@ -196,7 +196,7 @@
         d.phone_ AS phone,
         e.name_ AS imGroupName,
         sum( if(ifnull(c.train_time_,0) &gt;= b.sign_standard_ * 60,1,0)) AS playDay,
-        max(ifnull(c.train_time_,0)) AS playTime
+        sum(ifnull(c.train_time_,0)) AS playTime
         FROM
         `temp_little_artist_training_camp_user_relation` `a`
         left join temp_little_artist_training_camp b on b.id_ = a.activity_id_

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

@@ -190,7 +190,6 @@ public class MusicGroupController extends BaseController {
             return failed(err + "不能缴费");
         }
         studentRegistration.setOwnershipType(musicGroup.getOwnershipType());
-        studentRegistration.setChargeTypeId(musicGroup.getChargeTypeId());
         if (sysUser != null) {
             studentRegistration.setGender(sysUser.getGender());
         }

+ 0 - 2
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -264,7 +264,6 @@ public class StudentOrderController extends BaseController {
             orderDetail.put("course", musicGroup.getCourseForm());
             orderDetail.put("ownershipType", musicGroup.getOwnershipType());
             orderDetail.put("detailType", orderDetailType);
-            orderDetail.put("chargeTypeId", musicGroup.getChargeTypeId());
             orderDetail.put("courseViewType", musicGroup.getCourseViewType());
 
             //新的课程形态10.27
@@ -821,7 +820,6 @@ public class StudentOrderController extends BaseController {
         MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(musicGroupId);
         if (musicGroupRegCalender != null) {
             MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-            musicGroupRegCalender.setChargeTypeId(musicGroup.getChargeTypeId());
             List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(musicGroupId);
             musicGroupRegCalender.setMusicGroupPaymentCalenderCourseSettingsList(courseSettings);
             musicGroupRegCalender.setCourseViewType(musicGroup.getCourseViewType());

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationCourseUnitPriceSettingsController.java

@@ -57,7 +57,7 @@ public class OrganizationCourseUnitPriceSettingsController extends BaseControlle
 		for (OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings : organizationCourseUnitPriceSettingsList) {
 			OrganizationCourseUnitPriceSettings originalObj = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseTypeAndChargeType(
 					organizationCourseUnitPriceSettings.getOrganId(), organizationCourseUnitPriceSettings.getCourseType(),
-					organizationCourseUnitPriceSettings.getChargeTypeId());
+					organizationCourseUnitPriceSettings.getCourseViewType());
 			if (originalObj != null) {
 				return failed("当前分部已经存在该课程类型的单价");
 			}

+ 17 - 19
mec-web/src/main/java/com/ym/mec/web/controller/SubjectController.java

@@ -1,17 +1,27 @@
 package com.ym.mec.web.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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 com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
 import com.ym.mec.biz.dal.page.SubjectQueryInfo;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.exception.BizException;
-import io.swagger.annotations.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
 
 @RequestMapping("subject")
 @Api(tags = "科目服务")
@@ -58,18 +68,6 @@ public class SubjectController extends BaseController {
         return succeed(subjectService.findSubByMusicGroupId(musicGroupId));
     }
 
-    @ApiOperation(value = "通过乐团收费类型,获取默认的声部列表")
-    @GetMapping("/findDefaultSubByChargeTypeId")
-    @PreAuthorize("@pcs.hasPermissions('subject/findDefaultSubByChargeTypeId')")
-    @ApiImplicitParams({ @ApiImplicitParam(name = "chargeTypeId", value = "收费类型编号", required = true, dataType = "Integer"),
-            @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer")})
-    public Object findDefaultSubByChargeTypeId(Integer chargeTypeId,Integer organId,Integer number){
-        if(chargeTypeId == null || organId == null || number == null){
-            throw new BizException("参数校验错误");
-        }
-        return succeed(subjectService.findDefaultSubByChargeTypeId(chargeTypeId,organId,number));
-    }
-
     @ApiOperation(value = "新建乐团时,获取设置声部费用默认数据")
     @GetMapping("/setSubjectInfo")
     @PreAuthorize("@pcs.hasPermissions('subject/setSubjectInfo')")