소스 검색

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into feature/0406-degree

 Conflicts:
	mec-student/src/main/java/com/ym/mec/student/StudentApplication.java
	mec-teacher/src/main/java/com/ym/mec/teacher/TeacherApplication.java
zouxuan 2 년 전
부모
커밋
55b2961cbe
100개의 변경된 파일1926개의 추가작업 그리고 1857개의 파일을 삭제
  1. 31 16
      mec-biz/src/main/java/com/mec/redisson/RedissonTopicListener.java
  2. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ChargeTypeSubjectMapperDao.java
  3. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  4. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java
  5. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/HumanCostDao.java
  6. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  7. 8 44
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java
  8. 1 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportCloudDao.java
  9. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportNewDao.java
  10. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentMusicCourseFeeDao.java
  11. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java
  12. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  13. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsOrderItemVO.java
  14. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/LiveRoomStatus.java
  15. 3 48
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDetailDto.java
  16. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OperatingReportNewDto1.java
  17. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ChargeTypeSubjectMapper.java
  18. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java
  19. 8 355
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java
  20. 120 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/HumanCost.java
  21. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  22. 2 64
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderBase.java
  23. 9 102
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderCourseSettings.java
  24. 9 218
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderDetail.java
  25. 4 50
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java
  26. 10 408
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java
  27. 50 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentMusicCourseFee.java
  28. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Teacher.java
  29. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/EGroupDefinedDataType.java
  30. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java
  31. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SellTypeEnum.java
  32. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SysUserRoleEnum.java
  33. 61 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/vo/ImLiveBroadcastRoomMemberVo.java
  34. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TempUserTrainingTimeDetailVo.java
  35. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/redisson/RedissonMessageService.java
  36. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  37. 17 0
      mec-biz/src/main/java/com/ym/mec/biz/service/HumanCostService.java
  38. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ImLiveBroadcastRoomMemberService.java
  39. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/ImLiveBroadcastRoomService.java
  40. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderDetailService.java
  41. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentStudentCourseDetailService.java
  42. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/OperatingReportCloudService.java
  43. 26 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentMusicCourseFeeService.java
  44. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  45. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  46. 49 57
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  47. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  48. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java
  49. 29 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/HumanCostServiceImpl.java
  50. 21 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomMemberServiceImpl.java
  51. 49 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java
  52. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberFeeSettingServiceImpl.java
  53. 10 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  54. 5 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderCourseSettingsServiceImpl.java
  55. 55 126
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  56. 61 30
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  57. 250 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentStudentCourseDetailServiceImpl.java
  58. 10 46
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  59. 26 39
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportCloudServiceImpl.java
  60. 26 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java
  61. 68 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentMusicCourseFeeServiceImpl.java
  62. 47 7
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  63. 110 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  64. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java
  65. 6 6
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultMusicGroupSalaryServiceImpl.java
  66. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultPracticeGroupSalaryServiceImpl.java
  67. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherDefaultVipGroupSalaryServiceImpl.java
  68. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java
  69. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  70. 5 0
      mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml
  71. 14 9
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  72. 18 4
      mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml
  73. 28 0
      mec-biz/src/main/resources/config/mybatis/HumanCostMapper.xml
  74. 4 3
      mec-biz/src/main/resources/config/mybatis/ImLiveBroadcastRoomMemberMapper.xml
  75. 1 1
      mec-biz/src/main/resources/config/mybatis/MemberFeeSettingMapper.xml
  76. 8 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupOrganizationCourseSettingsDetailMapper.xml
  77. 8 5
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml
  78. 3 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  79. 6 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMemberMapper.xml
  80. 10 37
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml
  81. 0 7
      mec-biz/src/main/resources/config/mybatis/OperatingReportCloudMapper.xml
  82. 6 17
      mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml
  83. 13 5
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  84. 24 0
      mec-biz/src/main/resources/config/mybatis/StudentMusicCourseFeeMapper.xml
  85. 3 2
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  86. 3 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  87. 8 1
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  88. 22 0
      mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java
  89. 33 28
      mec-im/src/main/java/com/ym/controller/UserController.java
  90. 5 0
      mec-mall/mall-admin/pom.xml
  91. 38 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/ExportController.java
  92. 2 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dao/OmsOrderDao.java
  93. 4 48
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dto/OmsOrderQueryParam.java
  94. 113 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dto/OrderDetailVo.java
  95. 20 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/enums/OpenTypeEnum.java
  96. 2 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/OmsOrderService.java
  97. 5 0
      mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java
  98. 39 1
      mec-mall/mall-admin/src/main/resources/config/mybatis/OmsOrderDao.xml
  99. 12 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveBroadcastRoomController.java
  100. 26 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveBroadcastRoomMemberController.java

+ 31 - 16
mec-biz/src/main/java/com/mec/redisson/RedissonTopicListener.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.redisson.RedissonMessageService;
 import com.ym.mec.biz.service.ImLiveBroadcastRoomService;
 import lombok.extern.slf4j.Slf4j;
 import org.redisson.api.RBucket;
+import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.ApplicationArguments;
@@ -43,24 +44,38 @@ public class RedissonTopicListener implements ApplicationRunner, Ordered {
                     log.error("RedissonMessageService subscribe sleep error", e);
                 }
 
-                // 缓存JoinRoom用户信息到redis
-                RBucket<Object> bucket = redissonClient.getBucket(RedissonMessageService.LIVE_ROOM_MEMBER + message);
-                if (!bucket.isExists()) {
-                   return;
-                }
-                bucket.delete();
-
-                ImLiveBroadcastRoomVo imLiveBroadcastRoomVo = imLiveBroadcastRoomService.queryRoomInfo(message);
-                if (Objects.isNull(imLiveBroadcastRoomVo)) {
-                    return;
-                }
+                RLock lock = redissonClient.getLock(RedissonMessageService.LIVE_ROOM_MEMBER_LOCK + message);
                 try {
-                    imLiveBroadcastRoomService.setGroupMemberDefinedData(imLiveBroadcastRoomVo,imLiveBroadcastRoomVo.getLookNum(),imLiveBroadcastRoomVo.getTotalLookNum());
-                } catch (Exception e) {
-                    log.error("RedissonMessageService subscribe setGroupMemberDefinedData error", e);
-                    bucket.set(message, 30, TimeUnit.MINUTES);
+                    if (lock.tryLock()) {
+                        // 缓存JoinRoom用户信息到redis
+                        RBucket<Object> bucket = redissonClient.getBucket(RedissonMessageService.LIVE_ROOM_MEMBER + message);
+                        if (!bucket.isExists()) {
+                            return;
+                        }
+                        Integer times = (Integer) bucket.get();
+                        bucket.delete();
+
+                        ImLiveBroadcastRoomVo imLiveBroadcastRoomVo = imLiveBroadcastRoomService.queryRoomInfo(message);
+                        if (Objects.isNull(imLiveBroadcastRoomVo)) {
+                            return;
+                        }
+                        try {
+                            imLiveBroadcastRoomService.setGroupMemberDefinedData(imLiveBroadcastRoomVo,imLiveBroadcastRoomVo.getLookNum(),imLiveBroadcastRoomVo.getTotalLookNum());
+                        } catch (Exception e) {
+                            log.error("RedissonMessageService subscribe setGroupMemberDefinedData error", e);
+                            if (times>=3) {
+                                return;
+                            }
+                            bucket.set(times +1, 30, TimeUnit.MINUTES);
+                        }
+                        redissonMessageService.publish(RedissonMessageService.TOPIC_MESSAGE, message);
+                    }
+                } finally {
+                    if (lock.getHoldCount() != 0 && lock.isHeldByCurrentThread()) {
+                        lock.unlock();
+                    }
                 }
-                redissonMessageService.publish(RedissonMessageService.TOPIC_MESSAGE, message);
+
 
             });
             log.info("---> RedissonMessageService subscribe success");

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

@@ -29,4 +29,8 @@ public interface ChargeTypeSubjectMapperDao extends BaseDAO<Long, ChargeTypeSubj
     ChargeTypeSubjectMapper getSubjectDiscount(@Param("courseViewType") CourseViewTypeEnum courseViewType, @Param("subjectId") Integer subjectId);
 
     ChargeTypeSubjectMapper getSubjectsDiscount(@Param("courseViewType") CourseViewTypeEnum courseViewType, @Param("subjectIds") String subjectIds);
+
+    ChargeTypeSubjectMapper findByViewTypeANdSubject(@Param("courseViewType") CourseViewTypeEnum courseViewType,
+                                                     @Param("subjectId") Integer subjectId,
+                                                     @Param("tenantId") Integer tenantId);
 }

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

@@ -1964,4 +1964,21 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<String> queryStartedCourseMusicGroupIdList(String groupType);
 
     void batchUpdateDelFlag(@Param("courseIds") String courseIds);
+
+    /**
+    * @description: 标记当月的乐团课为已结算
+     * @param currentMonth
+    * @return void
+    * @author zx
+    * @date 2023/3/29 14:51
+    */
+    void makeSettlementReport(@Param("currentMonth") String currentMonth);
+
+
+    /**
+     * @describe 判断指定课程是否已经结算
+     * @param courseScheduleId: 课程编号
+     * @return boolean
+     */
+    int checkCourseIsSettlementReport(@Param("courseScheduleId") Long courseScheduleId);
 }

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

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.page.GoodsQuery;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -197,4 +198,5 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      */
     Integer getReplacementInstrumentCount(Map<String, Object> params);
 
+    BigDecimal getOrganCostPrice(@Param("complementGoodsIdList") String complementGoodsIdList);
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/HumanCostDao.java

@@ -0,0 +1,20 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ym.mec.biz.dal.entity.HumanCost;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 人力资源成本(HumanCost)表数据库访问层
+ *
+ * @author zx
+ * @since 2023-04-17 15:31:30
+ */
+public interface HumanCostDao extends BaseMapper<HumanCost> {
+
+   int insertBatch(@Param("entities") List<HumanCost> entities);
+   
+}
+

+ 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 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OperatingReportNewDao.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dao;
 
+import com.ym.mec.biz.dal.dto.OperatingReportNewDto1;
 import com.ym.mec.biz.dal.entity.OperatingReportNew;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
@@ -16,10 +17,10 @@ public interface OperatingReportNewDao extends BaseDAO<Integer, OperatingReportN
     List<OperatingReportNew> sumSellAmount(String month);
 
     //云教练赠送课程服务收入
-    List<Map<Integer,BigDecimal>> sumCloudCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+//    List<Map<Integer,BigDecimal>> sumCloudCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
 
     //付费课程收入
-    List<Map<Integer,BigDecimal>> sumCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
+    List<Map<Integer,BigDecimal>> sumCourseAmount(@Param("firstDay") String firstDay, @Param("lastDay") String lastDay, @Param("currentYear") String currentYear);
 
     //个人云教练服务收入
     List<Map<Integer,BigDecimal>> sumPersonalCloudAmount(@Param("month") String month, @Param("firstDay") String firstDay, @Param("lastDay") String lastDay);
@@ -46,7 +47,7 @@ public interface OperatingReportNewDao extends BaseDAO<Integer, OperatingReportN
     List<Map<Integer,BigDecimal>> sumGroupAmount(@Param("month") String month);
 
     //云教练赠课预收
-    List<Map<Integer,BigDecimal>> sumCloudCoursePreAmount(@Param("lastDay") String lastDay);
+//    List<Map<Integer,BigDecimal>> sumCloudCoursePreAmount(@Param("lastDay") String lastDay);
 
     //付费课程预收
     List<Map<Integer,BigDecimal>> sumCoursePreAmount(@Param("lastDay") String lastDay);

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

@@ -0,0 +1,16 @@
+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);
+
+    void addActualPrice(@Param("id") Integer id, @Param("actualPrice") BigDecimal actualPrice);
+}

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -139,7 +139,8 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
      * @date 2020/12/7 0007
      */
     List<StudentPaymentOrderDetail> getWithUserAndOrderType(@Param("userId") Integer userId,
-                                                            @Param("orderType") OrderTypeEnum orderType);
+                                                            @Param("musicGroupId") String musicGroupId,
+                                                            @Param("orderDetailType") OrderDetailTypeEnum orderDetailType);
 
     List<StudentPaymentOrderDetail> getWithIds(@Param("paymentOrderIds") List<Long> paymentOrderIds);
 

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

@@ -757,4 +757,6 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     * @date 2022/10/9 18:11
     */
     List<Map<Integer, String>> queryStudentEduMap(Integer userId);
+
+    void updateCourseFee(@Param("id") Long id, @Param("musicalFee") BigDecimal musicalFee);
 }

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsOrderItemVO.java

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.dal.dto;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class GoodsOrderItemVO {
+    private double couponAmount; // 优惠券金额
+    private int giftGrowth; // 赠送成长值
+    private int giftIntegration; // 赠送积分
+    private long id; // 唯一标识符
+    private double integrationAmount; // 积分抵扣金额
+    private long orderId; // 所属订单的唯一标识符
+    private String orderSn; // 订单编号
+    private double precisionAmount; // 精确金额
+    private String productAttr; // 商品属性,JSON 格式
+    private String productBrand; // 商品品牌
+    private long productCategoryId; // 商品分类的唯一标识符
+    private long productId; // 商品的唯一标识符
+    private String productSn; // 商品货号
+    private String productName; // 商品名称
+    private String productPic; // 商品图片
+    private double productPrice; // 商品价格
+    private int productQuantity; // 商品数量
+    private String productSkuCode; // 商品 SKU 编码
+    private long productSkuId; // 商品 SKU 的唯一标识符
+    private double promotionAmount; // 促销金额
+    private String promotionName; // 促销名称
+    private BigDecimal realAmount; // 实际支付金额
+    private int returnStatus; // 退货状态
+}

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/LiveRoomStatus.java

@@ -35,4 +35,7 @@ public class LiveRoomStatus {
     @ApiModelProperty(value = "直播时长")
     private Integer liveTotalTime;
 
+    @ApiModelProperty(value = "全员闭麦状态 1:开启 0:关闭")
+    private Integer micStatus;
+
 }

+ 3 - 48
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupPaymentCalenderDetailDto.java

@@ -1,8 +1,11 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import lombok.Data;
+
 import java.math.BigDecimal;
 
+@Data
 public class MusicGroupPaymentCalenderDetailDto extends MusicGroupPaymentCalenderDetail {
     //辅件
     private BigDecimal accessoriesAmount = BigDecimal.ZERO;
@@ -16,52 +19,4 @@ public class MusicGroupPaymentCalenderDetailDto extends MusicGroupPaymentCalende
     private BigDecimal activityAmount = BigDecimal.ZERO;
     //课程
     private BigDecimal courseAmount = BigDecimal.ZERO;
-
-    public BigDecimal getCourseAmount() {
-        return courseAmount;
-    }
-
-    public void setCourseAmount(BigDecimal courseAmount) {
-        this.courseAmount = courseAmount;
-    }
-
-    public BigDecimal getAccessoriesAmount() {
-        return accessoriesAmount;
-    }
-
-    public void setAccessoriesAmount(BigDecimal accessoriesAmount) {
-        this.accessoriesAmount = accessoriesAmount;
-    }
-
-    public BigDecimal getCloudAmount() {
-        return cloudAmount;
-    }
-
-    public void setCloudAmount(BigDecimal cloudAmount) {
-        this.cloudAmount = cloudAmount;
-    }
-
-    public BigDecimal getMusicalAmount() {
-        return musicalAmount;
-    }
-
-    public void setMusicalAmount(BigDecimal musicalAmount) {
-        this.musicalAmount = musicalAmount;
-    }
-
-    public BigDecimal getMaintenanceAmount() {
-        return maintenanceAmount;
-    }
-
-    public void setMaintenanceAmount(BigDecimal maintenanceAmount) {
-        this.maintenanceAmount = maintenanceAmount;
-    }
-
-    public BigDecimal getActivityAmount() {
-        return activityAmount;
-    }
-
-    public void setActivityAmount(BigDecimal activityAmount) {
-        this.activityAmount = activityAmount;
-    }
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/OperatingReportNewDto1.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.dal.dto;
+
+import lombok.Data;
+
+@Data
+public class OperatingReportNewDto1{
+    private String musicGroupId;
+
+    private Integer userId;
+
+    private String courseType;
+
+    private Integer signClassTime;
+}

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

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

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

@@ -158,6 +158,9 @@ public class CourseSchedule  extends BaseEntity{
 
 	private Integer isSettlement = 0;
 
+	//是否结算经营报表
+	private Boolean settlementReportFlag = false;
+
 	private String classGroupType;
 
 	private java.util.Date coursesExpireDate;
@@ -204,6 +207,14 @@ public class CourseSchedule  extends BaseEntity{
 	//当前课程是否是转换课
 	private Boolean convertFlag = false;
 
+	public Boolean getSettlementReportFlag() {
+		return settlementReportFlag;
+	}
+
+	public void setSettlementReportFlag(Boolean settlementReportFlag) {
+		this.settlementReportFlag = settlementReportFlag;
+	}
+
 	public Boolean getConvertFlag() {
 		return convertFlag;
 	}

+ 8 - 355
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Goods.java

@@ -3,10 +3,9 @@ package com.ym.mec.biz.dal.entity;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.dal.enums.StockType;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
-import com.ym.mec.common.entity.BaseEntity;
-
+import com.ym.mec.common.tenant.TenantContextHolder;
 import io.swagger.annotations.ApiModelProperty;
-
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.math.BigDecimal;
@@ -15,7 +14,8 @@ import java.util.List;
 /**
  * 对应数据库表(goods):
  */
-public class Goods extends BaseEntity {
+@Data
+public class Goods {
 
 	/** 商品编号 */
 	@ApiModelProperty(value = "商品编号",required = false)
@@ -79,6 +79,9 @@ public class Goods extends BaseEntity {
 	@ApiModelProperty(value = "协议成本价",required = false)
 	private BigDecimal agreeCostPrice;
 
+	@ApiModelProperty(value = "分部成本价",required = false)
+	private BigDecimal organCostPrice;
+
 	/** 页面简介 */
 	@ApiModelProperty(value = "页面简介",required = false)
 	private String brief;
@@ -172,357 +175,7 @@ public class Goods extends BaseEntity {
 	@ApiModelProperty(value = "库存预警")
 	private YesOrNoEnum stockWarning;
 
-	public String getStudentShowOrganId() {
-		return studentShowOrganId;
-	}
-
-	public void setStudentShowOrganId(String studentShowOrganId) {
-		this.studentShowOrganId = studentShowOrganId;
-	}
-
-	public String getEducationShowOrganId() {
-		return educationShowOrganId;
-	}
-
-	public void setEducationShowOrganId(String educationShowOrganId) {
-		this.educationShowOrganId = educationShowOrganId;
-	}
-
-	public String getCourseFeeShowOrganId() {
-		return courseFeeShowOrganId;
-	}
-
-	public void setCourseFeeShowOrganId(String courseFeeShowOrganId) {
-		this.courseFeeShowOrganId = courseFeeShowOrganId;
-	}
-
-	public String getMemberFeeShowOrganId() {
-		return memberFeeShowOrganId;
-	}
-
-	public void setMemberFeeShowOrganId(String memberFeeShowOrganId) {
-		this.memberFeeShowOrganId = memberFeeShowOrganId;
-	}
-
-	public String getReplacementShowOrganId() {
-		return replacementShowOrganId;
-	}
-
-	public void setReplacementShowOrganId(String replacementShowOrganId) {
-		this.replacementShowOrganId = replacementShowOrganId;
-	}
-
-	public String getStudentShowOrganName() {
-		return studentShowOrganName;
-	}
-
-	public void setStudentShowOrganName(String studentShowOrganName) {
-		this.studentShowOrganName = studentShowOrganName;
-	}
-
-	public String getEducationShowOrganName() {
-		return educationShowOrganName;
-	}
-
-	public void setEducationShowOrganName(String educationShowOrganName) {
-		this.educationShowOrganName = educationShowOrganName;
-	}
-
-	public String getCourseFeeShowOrganName() {
-		return courseFeeShowOrganName;
-	}
-
-	public void setCourseFeeShowOrganName(String courseFeeShowOrganName) {
-		this.courseFeeShowOrganName = courseFeeShowOrganName;
-	}
-
-	public String getMemberFeeShowOrganName() {
-		return memberFeeShowOrganName;
-	}
-
-	public void setMemberFeeShowOrganName(String memberFeeShowOrganName) {
-		this.memberFeeShowOrganName = memberFeeShowOrganName;
-	}
-
-	public String getReplacementShowOrganName() {
-		return replacementShowOrganName;
-	}
-
-	public void setReplacementShowOrganName(String replacementShowOrganName) {
-		this.replacementShowOrganName = replacementShowOrganName;
-	}
-
-	public YesOrNoEnum getStockWarning() {
-		return stockWarning;
-	}
-
-	public void setStockWarning(YesOrNoEnum stockWarning) {
-		this.stockWarning = stockWarning;
-	}
-
-	public StockType getStockType() {
-		return stockType;
-	}
-
-	public void setStockType(StockType stockType) {
-		this.stockType = stockType;
-	}
-
-	public BigDecimal getAgreeCostPrice() {
-		return agreeCostPrice;
-	}
-
-	public void setAgreeCostPrice(BigDecimal agreeCostPrice) {
-		this.agreeCostPrice = agreeCostPrice;
-	}
-
-	public String getSubjectIds() {
-        return subjectIds;
-    }
-
-    public void setSubjectIds(String subjectIds) {
-        this.subjectIds = subjectIds;
-    }
-
-	public BigDecimal getCostPrice() {
-		return costPrice;
-	}
-
-	public void setCostPrice(BigDecimal costPrice) {
-		this.costPrice = costPrice;
-	}
-
-	public String getGoodsCategoryName() {
-		return goodsCategoryName;
-	}
-
-	public void setGoodsCategoryName(String goodsCategoryName) {
-		this.goodsCategoryName = goodsCategoryName;
-	}
-
-	public GoodsType getType() {
-		return type;
-	}
-
-	public void setType(GoodsType type) {
-		this.type = type;
-	}
-
-	public String getComplementGoodsIdList() {
-		return complementGoodsIdList;
-	}
-
-	public void setComplementGoodsIdList(String complementGoodsIdList) {
-		this.complementGoodsIdList = complementGoodsIdList;
-	}
-
-	public void setId(Integer id){
-		this.id = id;
-	}
-
-	public Integer getId(){
-		return this.id;
-	}
-
-	public void setGoodsCategoryId(Integer goodsCategoryId){
-		this.goodsCategoryId = goodsCategoryId;
-	}
-
-	public Integer getGoodsCategoryId(){
-		return this.goodsCategoryId;
-	}
-
-	public void setSn(String sn){
-		this.sn = sn;
-	}
-
-	public String getSn(){
-		return this.sn;
-	}
-
-	public void setName(String name){
-		this.name = name;
-	}
-
-	public String getName(){
-		return this.name;
-	}
-
-	public void setBrand(String brand){
-		this.brand = brand;
-	}
-
-	public String getBrand(){
-		return this.brand;
-	}
-
-	public void setSpecification(String specification){
-		this.specification = specification;
-	}
-
-	public String getSpecification(){
-		return this.specification;
-	}
-
-	public void setImage(String image){
-		this.image = image;
-	}
-
-	public String getImage(){
-		return this.image;
-	}
-
-	public void setStockCount(Integer stockCount){
-		this.stockCount = stockCount;
-	}
-
-	public Integer getStockCount(){
-		return this.stockCount;
-	}
-
-	public void setSellCount(Integer sellCount){
-		this.sellCount = sellCount;
-	}
-
-	public Integer getSellCount(){
-		return this.sellCount;
-	}
-
-	public BigDecimal getMarketPrice() {
-		return marketPrice;
-	}
-
-	public void setMarketPrice(BigDecimal marketPrice) {
-		this.marketPrice = marketPrice;
-	}
-
-	public BigDecimal getDiscountPrice() {
-		return discountPrice;
-	}
-
-	public void setDiscountPrice(BigDecimal discountPrice) {
-		this.discountPrice = discountPrice;
-	}
-
-	public BigDecimal getGroupPurchasePrice() {
-		return groupPurchasePrice;
-	}
-
-	public void setGroupPurchasePrice(BigDecimal groupPurchasePrice) {
-		this.groupPurchasePrice = groupPurchasePrice;
-	}
-
-	public void setBrief(String brief){
-		this.brief = brief;
-	}
-
-	public String getBrief(){
-		return this.brief;
-	}
-
-	public void setDesc(String desc){
-		this.desc = desc;
-	}
-
-	public String getDesc(){
-		return this.desc;
-	}
-
-	public YesOrNoEnum getIsNew() {
-		return isNew;
-	}
-
-	public void setIsNew(YesOrNoEnum isNew) {
-		this.isNew = isNew;
-	}
-
-	public YesOrNoEnum getIsTop() {
-		return isTop;
-	}
-
-	public void setIsTop(YesOrNoEnum isTop) {
-		this.isTop = isTop;
-	}
-
-	public YesOrNoEnum getStatus() {
-		return status;
-	}
-
-	public void setStatus(YesOrNoEnum status) {
-		this.status = status;
-	}
-
-	public void setMemo(String memo){
-		this.memo = memo;
-	}
-
-	public String getMemo(){
-		return this.memo;
-	}
-
-	public void setPublishTime(java.util.Date publishTime){
-		this.publishTime = publishTime;
-	}
-
-	public java.util.Date getPublishTime(){
-		return this.publishTime;
-	}
-
-	public void setCreateTime(java.util.Date createTime){
-		this.createTime = createTime;
-	}
-
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-
-	public void setUpdateTime(java.util.Date updateTime){
-		this.updateTime = updateTime;
-	}
-
-	public java.util.Date getUpdateTime(){
-		return this.updateTime;
-	}
-
-	public List<Goods> getGoodsList() {
-		return goodsList;
-	}
-
-	public void setGoodsList(List<Goods> goodsList) {
-		this.goodsList = goodsList;
-	}
-
-	public Integer getTaxStockCount() {
-		return taxStockCount;
-	}
-
-	public void setTaxStockCount(Integer taxStockCount) {
-		this.taxStockCount = taxStockCount;
-	}
-
-	public String getSupplyChannel() {
-		return supplyChannel;
-	}
-
-	public void setSupplyChannel(String supplyChannel) {
-		this.supplyChannel = supplyChannel;
-	}
-
-	public String getFreeFeeShowOrganId() {
-		return freeFeeShowOrganId;
-	}
-
-	public void setFreeFeeShowOrganId(String freeFeeShowOrganId) {
-		this.freeFeeShowOrganId = freeFeeShowOrganId;
-	}
-
-	public String getFreeFeeShowOrganName() {
-		return freeFeeShowOrganName;
-	}
-
-	public void setFreeFeeShowOrganName(String freeFeeShowOrganName) {
-		this.freeFeeShowOrganName = freeFeeShowOrganName;
-	}
+	private Integer tenantId = TenantContextHolder.getTenantId();
 
 	@Override
 	public String toString() {

+ 120 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/HumanCost.java

@@ -0,0 +1,120 @@
+package com.ym.mec.biz.dal.entity;
+
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import com.baomidou.mybatisplus.annotation.TableId;
+
+import java.io.Serializable;
+
+/**
+ * 人力资源成本(HumanCost)表实体类
+ *
+ * @author zx
+ * @since 2023-04-17 15:31:31
+ */
+@ApiModel(value = "human_cost-人力资源成本")
+public class HumanCost implements Serializable {
+  @TableField("id_")
+     @ApiModelProperty(value = "${column.comment}")
+    private Integer id;
+    
+  @TableField("organ_id_")
+     @ApiModelProperty(value = "分部")
+    private Integer organId;
+    
+  @TableField("organ_name_")
+     @ApiModelProperty(value = "分部")
+    private String organName;
+    
+  @TableField("fixed_cost_")
+     @ApiModelProperty(value = "固定成本")
+    private BigDecimal fixedCost;
+    
+  @TableField("change_cost_")
+     @ApiModelProperty(value = "变动成本")
+    private BigDecimal changeCost;
+    
+  @TableField("month_")
+     @ApiModelProperty(value = "月份")
+    private String month;
+    
+  @TableField("create_time_")
+     @ApiModelProperty(value = "${column.comment}")
+    private Date createTime;
+    
+  @TableField("update_time_")
+     @ApiModelProperty(value = "${column.comment}")
+    private Date updateTime;
+    
+    
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
+    public BigDecimal getFixedCost() {
+        return fixedCost;
+    }
+
+    public void setFixedCost(BigDecimal fixedCost) {
+        this.fixedCost = fixedCost;
+    }
+
+    public BigDecimal getChangeCost() {
+        return changeCost;
+    }
+
+    public void setChangeCost(BigDecimal changeCost) {
+        this.changeCost = changeCost;
+    }
+
+    public String getMonth() {
+        return month;
+    }
+
+    public void setMonth(String month) {
+        this.month = month;
+    }
+
+    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;
+    }
+
+}
+

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

@@ -210,7 +210,7 @@ public class MusicGroup extends BaseEntity {
 	private Integer musicGroupPlanMakingId;
 	
 	@ApiModelProperty(value = "成团年级",required = false)
-	private Integer firstRecruitGrade;
+	private String firstRecruitGrade;
 	
 	@ApiModelProperty(value = "默认收费标准",required = false)
 	private BigDecimal defaultChargeStandard;
@@ -750,11 +750,11 @@ public class MusicGroup extends BaseEntity {
 		this.musicGroupPlanMakingId = musicGroupPlanMakingId;
 	}
 
-	public Integer getFirstRecruitGrade() {
+	public String getFirstRecruitGrade() {
 		return firstRecruitGrade;
 	}
 
-	public void setFirstRecruitGrade(Integer firstRecruitGrade) {
+	public void setFirstRecruitGrade(String firstRecruitGrade) {
 		this.firstRecruitGrade = firstRecruitGrade;
 	}
 

+ 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 - 102
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderCourseSettings.java

@@ -1,25 +1,22 @@
 package com.ym.mec.biz.dal.entity;
 
+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.CourseSchedule.CourseScheduleType;
-import com.ym.mec.common.entity.BaseEntity;
-
 import java.math.BigDecimal;
 
 /**
  * 对应数据库表(music_group_payment_calender_course_settings):
  */
+@Data
 public class MusicGroupPaymentCalenderCourseSettings extends BaseEntity {
 
-	/**  */
 	private Integer id;
 	
-	/**  */
 	private Long musicGroupPaymentCalenderId;
 
-	/**  */
 	private String name;
 	
 	@ApiModelProperty(value = "课程类型", required = false)
@@ -33,114 +30,24 @@ public class MusicGroupPaymentCalenderCourseSettings extends BaseEntity {
 	
 	@ApiModelProperty(value = "课程原价", required = false)
 	private java.math.BigDecimal courseOriginalPrice;
-	
+
 	@ApiModelProperty(value = "课程现价", required = false)
 	private java.math.BigDecimal courseCurrentPrice;
+
+	@ApiModelProperty(value = "乐器、云教练溢出课程费用", required = false)
+	private java.math.BigDecimal overflowCoursePrice = BigDecimal.ZERO;
 	
 	@ApiModelProperty(value = "是否学生可选", required = false)
 	private boolean isStudentOptional = true;
-	
+
+
 	/**  */
 	private java.util.Date createTime;
 	
 	/**  */
 	private java.util.Date updateTime;
-
-	public void setStudentOptional(boolean studentOptional) {
-		isStudentOptional = studentOptional;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public void setId(Integer id){
-		this.id = id;
-	}
-	
-	public Integer getId(){
-		return this.id;
-	}
-			
-	public void setMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId){
-		this.musicGroupPaymentCalenderId = musicGroupPaymentCalenderId;
-	}
-	
-	public Long getMusicGroupPaymentCalenderId(){
-		return this.musicGroupPaymentCalenderId;
-	}
-			
-	public void setCourseType(CourseScheduleType courseType){
-		this.courseType = courseType;
-	}
-	
-	public CourseScheduleType getCourseType() {
-		return this.courseType;
-	}
-
-	public Integer getCourseTotalMinuties() {
-		return courseTotalMinuties;
-	}
-
-	public void setCourseTotalMinuties(Integer courseTotalMinuties) {
-		this.courseTotalMinuties = courseTotalMinuties;
-	}
-			
-	public void setUnitPrice(java.math.BigDecimal unitPrice){
-		this.unitPrice = unitPrice;
-	}
-	
-	public java.math.BigDecimal getUnitPrice(){
-		return this.unitPrice;
-	}
-			
-	public void setCourseOriginalPrice(java.math.BigDecimal courseOriginalPrice){
-		this.courseOriginalPrice = courseOriginalPrice;
-	}
-	
-	public java.math.BigDecimal getCourseOriginalPrice(){
-		return this.courseOriginalPrice;
-	}
-			
-	public void setCourseCurrentPrice(java.math.BigDecimal courseCurrentPrice){
-		this.courseCurrentPrice = courseCurrentPrice;
-	}
-	
-	public java.math.BigDecimal getCourseCurrentPrice(){
-		return this.courseCurrentPrice;
-	}
-			
-	public void setIsStudentOptional(boolean isStudentOptional){
-		this.isStudentOptional = isStudentOptional;
-	}
-	
-	public boolean getIsStudentOptional(){
-		return this.isStudentOptional;
-	}
-			
-	public void setCreateTime(java.util.Date createTime){
-		this.createTime = createTime;
-	}
-	
-	public java.util.Date getCreateTime(){
-		return this.createTime;
-	}
-			
-	public void setUpdateTime(java.util.Date updateTime){
-		this.updateTime = updateTime;
-	}
-	
-	public java.util.Date getUpdateTime(){
-		return this.updateTime;
-	}
-			
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);
 	}
-
 }

+ 9 - 218
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,8 @@ 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);

+ 4 - 50
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalenderMember.java

@@ -2,9 +2,11 @@ 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;
@@ -20,54 +22,6 @@ 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;
-    }
+    @ApiModelProperty(value = "团练宝收入实际收入,用于结算经营报表,actualAmount减去收入以及其他费用,剩下的就是课程费用", required = false)
+    private BigDecimal income = BigDecimal.ZERO;
 }

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

@@ -6,127 +6,78 @@ import com.ym.mec.biz.dal.enums.SellTypeEnum;
 import com.ym.mec.biz.dal.enums.StockType;
 import com.ym.mec.common.entity.BaseEntity;
 
+import com.ym.mec.common.tenant.TenantContextHolder;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.math.BigDecimal;
 import java.util.Date;
 
 @ApiModel(value="com-ym-SellOrder")
-public class SellOrder extends BaseEntity {
-    @ApiModelProperty(value="")
+@Data
+public class SellOrder{
     private Integer id;
 
-    /**
-     * 教务id
-     */
     @ApiModelProperty(value="教务id")
     private Integer eduTeacherId;
 
     @ApiModelProperty(value="教务老师")
     private String eduTeacher;
 
-    /**
-    * 分部id
-    */
     @ApiModelProperty(value="分部id")
     private Integer organId;
 
-    /**
-     * 学校id
-     */
     @ApiModelProperty(value="学校id")
     private Integer cooperationOrganId;
 
-    /**
-     * 学校名称
-     */
     @ApiModelProperty(value="学校名称")
     private String schoolName;
 
-    /**
-    * 交易流水号
-    */
     @ApiModelProperty(value="交易流水号")
     private String transNo;
 
-    /**
-     * 交易流水号
-     */
     @ApiModelProperty(value="订单id")
     private Long orderId;
 
     private String organName;
 
-    /**
-    * 订单号
-    */
     @ApiModelProperty(value="订单号")
     private String orderNo;
 
-    /**
-    * 应付金额
-    */
     @ApiModelProperty(value="应付金额")
     private BigDecimal expectAmount = BigDecimal.ZERO;
 
-    /**
-    * 现金支付金额
-    */
     @ApiModelProperty(value="现金支付金额")
     private BigDecimal actualAmount = BigDecimal.ZERO;
 
-    /**
-    * 余额支付金额
-    */
     @ApiModelProperty(value="余额支付金额")
     private BigDecimal balanceAmount = BigDecimal.ZERO;
 
-    /**
-    * 销售成本
-    */
-    @ApiModelProperty(value="销售成本")
-    private BigDecimal sellCost;
+    @ApiModelProperty(value="总部销售成本")
+    private BigDecimal sellCost = BigDecimal.ZERO;
+
+    @ApiModelProperty(value="分部销售成本")
+    private BigDecimal organSellCost = BigDecimal.ZERO;
 
-    /**
-     * 销售成本2
-     */
     @ApiModelProperty(value="销售成本2")
     private String sellCost2;
 
-    /**
-    * 销售类型
-    */
     @ApiModelProperty(value="销售类型")
     private SellTypeEnum type;
 
-    /**
-     * 组合商品id
-     */
     @ApiModelProperty(value="组合商品id")
     private Integer parentGoodsId;
 
-    /**
-    * 商品id
-    */
     @ApiModelProperty(value="商品id")
     private Integer goodsId;
 
-    /**
-     * 商品名称
-     */
     @ApiModelProperty(value="商品名称")
     private String goodsName;
 
-    /**
-    * 数量
-    */
     @ApiModelProperty(value="数量")
     private Integer num;
 
-    /**
-    * 用户id
-    */
     @ApiModelProperty(value="用户id")
     private Integer userId;
 
@@ -134,68 +85,37 @@ public class SellOrder extends BaseEntity {
 
     private String phone;
 
-    /**
-    * 交易方式
-    */
     @ApiModelProperty(value="交易方式")
     private String paymentChannel;
 
     private String paymentChannelStr;
 
-    /**
-    * 收款账户
-    */
     @ApiModelProperty(value="收款账户")
     private String merNo;
 
-    /**
-     * 批次号
-     */
     @ApiModelProperty(value="批次号")
     private String batchNo;
 
-    /**
-    * 库存类型
-    */
     @ApiModelProperty(value="库存类型")
     private StockType stockType;
 
-    /**
-     * 账户类型
-     */
     @ApiModelProperty(value = "账户类型")
     private AccountType accountType;
 
     private String accountTypeStr;
 
-    /**
-     * 状态
-     */
     @ApiModelProperty(value = "状态")
     private SellStatus status;
 
-
-    /**
-     * 退货时间
-     */
     @ApiModelProperty(value="退货时间")
     private Date refundTime;
 
-    /**
-    * 交易时间
-    */
     @ApiModelProperty(value="交易时间")
     private Date sellTime;
 
-    /**
-    * 创建时间
-    */
     @ApiModelProperty(value="创建时间")
     private Date createIme;
 
-    /**
-    * 更新时间
-    */
     @ApiModelProperty(value="更新时间")
     private Date updateTime;
 
@@ -212,323 +132,5 @@ public class SellOrder extends BaseEntity {
     @ApiModelProperty(value="订单金额")
     private BigDecimal orderAmount = BigDecimal.ZERO;
 
-    public BigDecimal getOrderAmount() {
-        return orderAmount;
-    }
-
-    public void setOrderAmount(BigDecimal orderAmount) {
-        this.orderAmount = orderAmount;
-    }
-
-    public BigDecimal getCouponRemitAmount() {
-        return couponRemitAmount;
-    }
-
-    public void setCouponRemitAmount(BigDecimal couponRemitAmount) {
-        this.couponRemitAmount = couponRemitAmount;
-    }
-
-    public String getReceiveStatus() {
-        return receiveStatus;
-    }
-
-    public void setReceiveStatus(String receiveStatus) {
-        this.receiveStatus = receiveStatus;
-    }
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getOrganId() {
-        return organId;
-    }
-
-    public void setOrganId(Integer organId) {
-        this.organId = organId;
-    }
-
-    public Integer getCooperationOrganId() {
-        return cooperationOrganId;
-    }
-
-    public void setCooperationOrganId(Integer cooperationOrganId) {
-        this.cooperationOrganId = cooperationOrganId;
-    }
-
-    public String getTransNo() {
-        return transNo;
-    }
-
-    public void setTransNo(String transNo) {
-        this.transNo = transNo;
-    }
-
-    public String getOrderNo() {
-        return orderNo;
-    }
-
-    public void setOrderNo(String orderNo) {
-        this.orderNo = orderNo;
-    }
-
-    public BigDecimal getExpectAmount() {
-        return expectAmount;
-    }
-
-    public void setExpectAmount(BigDecimal expectAmount) {
-        this.expectAmount = expectAmount;
-    }
-
-    public BigDecimal getActualAmount() {
-        return actualAmount;
-    }
-
-    public void setActualAmount(BigDecimal actualAmount) {
-        this.actualAmount = actualAmount;
-    }
-
-    public BigDecimal getBalanceAmount() {
-        return balanceAmount;
-    }
-
-    public void setBalanceAmount(BigDecimal balanceAmount) {
-        this.balanceAmount = balanceAmount;
-    }
-
-    public BigDecimal getSellCost() {
-        return sellCost;
-    }
-
-    public void setSellCost(BigDecimal sellCost) {
-        this.sellCost = sellCost;
-    }
-
-    public SellTypeEnum getType() {
-        return type;
-    }
-
-    public void setType(SellTypeEnum type) {
-        this.type = type;
-    }
-
-    public Integer getGoodsId() {
-        return goodsId;
-    }
-
-    public void setGoodsId(Integer goodsId) {
-        this.goodsId = goodsId;
-    }
-
-    public Integer getNum() {
-        return num;
-    }
-
-    public void setNum(Integer num) {
-        this.num = num;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public String getPaymentChannel() {
-        return paymentChannel;
-    }
-
-    public void setPaymentChannel(String paymentChannel) {
-        this.paymentChannel = paymentChannel;
-    }
-
-    public String getMerNo() {
-        return merNo;
-    }
-
-    public void setMerNo(String merNo) {
-        this.merNo = merNo;
-    }
-
-    public Date getSellTime() {
-        return sellTime;
-    }
-
-    public void setSellTime(Date sellTime) {
-        this.sellTime = sellTime;
-    }
-
-    public Date getCreateIme() {
-        return createIme;
-    }
-
-    public void setCreateIme(Date createIme) {
-        this.createIme = createIme;
-    }
-
-    public Date getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(Date updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public String getGoodsName() {
-        return goodsName;
-    }
-
-    public void setGoodsName(String goodsName) {
-        this.goodsName = goodsName;
-    }
-
-    public String getSellCost2() {
-        return sellCost2;
-    }
-
-    public void setSellCost2(String sellCost2) {
-        this.sellCost2 = sellCost2;
-    }
-
-    public Long getOrderId() {
-        return orderId;
-    }
-
-    public void setOrderId(Long orderId) {
-        this.orderId = orderId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-
-    public String getOrganName() {
-        return organName;
-    }
-
-    public void setOrganName(String organName) {
-        this.organName = organName;
-    }
-
-    public String getSchoolName() {
-        return schoolName;
-    }
-
-    public void setSchoolName(String schoolName) {
-        this.schoolName = schoolName;
-    }
-
-    public Integer getEduTeacherId() {
-        return eduTeacherId;
-    }
-
-    public void setEduTeacherId(Integer eduTeacherId) {
-        this.eduTeacherId = eduTeacherId;
-    }
-
-    public String getEduTeacher() {
-        return eduTeacher;
-    }
-
-    public void setEduTeacher(String eduTeacher) {
-        this.eduTeacher = eduTeacher;
-    }
-
-    public StockType getStockType() {
-        return stockType;
-    }
-
-    public void setStockType(StockType stockType) {
-        this.stockType = stockType;
-    }
-
-    public AccountType getAccountType() {
-        return accountType;
-    }
-
-    public void setAccountType(AccountType accountType) {
-        this.accountType = accountType;
-    }
-
-    public String getBatchNo() {
-        return batchNo;
-    }
-
-    public void setBatchNo(String batchNo) {
-        this.batchNo = batchNo;
-    }
-
-    public SellStatus getStatus() {
-        return status;
-    }
-
-    public void setStatus(SellStatus status) {
-        this.status = status;
-    }
-
-    public Integer getParentGoodsId() {
-        return parentGoodsId;
-    }
-
-    public void setParentGoodsId(Integer parentGoodsId) {
-        this.parentGoodsId = parentGoodsId;
-    }
-
-    public Date getRefundTime() {
-        return refundTime;
-    }
-
-    public void setRefundTime(Date refundTime) {
-        this.refundTime = refundTime;
-    }
-
-    public Boolean getHasRoute() {
-        return hasRoute;
-    }
-
-    public void setHasRoute(Boolean hasRoute) {
-        this.hasRoute = hasRoute;
-    }
-
-    public String getPaymentChannelStr() {
-        return paymentChannelStr;
-    }
-
-    public void setPaymentChannelStr(String paymentChannelStr) {
-        this.paymentChannelStr = paymentChannelStr;
-    }
-
-    public String getAccountTypeStr() {
-        return accountTypeStr;
-    }
-
-    public void setAccountTypeStr(String accountTypeStr) {
-        this.accountTypeStr = accountTypeStr;
-    }
-
-    public String getReceiveStatusStr() {
-        return receiveStatusStr;
-    }
-
-    public void setReceiveStatusStr(String receiveStatusStr) {
-        this.receiveStatusStr = receiveStatusStr;
-    }
+    private Integer tenantId = TenantContextHolder.getTenantId();
 }

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

@@ -0,0 +1,50 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+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{
+
+	@TableId(value = "id_", type = IdType.AUTO)
+	private Integer id;
+
+	@TableField("user_id_")
+	@ApiModelProperty(value = "学员编号",required = false)
+	private Integer userId;
+
+	@TableField("organ_id_")
+	@ApiModelProperty(value = "分部编号",required = false)
+	private Integer organId;
+
+	@TableField("music_group_id_")
+	@ApiModelProperty(value = "乐团编号",required = false)
+	private String musicGroupId;
+
+	@TableField("expect_price_")
+	@ApiModelProperty(value = "预计总课费",required = false)
+	private BigDecimal expectPrice = BigDecimal.ZERO;
+
+	@TableField("actual_price_")
+	@ApiModelProperty(value = "实收总课费",required = false)
+	private BigDecimal actualPrice = BigDecimal.ZERO;
+
+	@TableField("receivable_price_")
+	@ApiModelProperty(value = "应收",required = false)
+	private BigDecimal receivablePrice = BigDecimal.ZERO;
+
+	@TableField("create_time_")
+	private String createTime;
+
+	@TableField("update_time_")
+	private String updateTime;
+}

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

@@ -134,6 +134,9 @@ public class Teacher extends SysUser {
 	@ApiModelProperty(value = "岗位管理部门",required = false)
 	private String postDeptIds;
 
+	@ApiModelProperty(value = "云教练限制")
+	private Boolean coursewareLimit;
+
 	public Boolean getIsSettlementSalary() {
 		return isSettlementSalary;
 	}
@@ -422,6 +425,14 @@ public class Teacher extends SysUser {
 		this.postDeptIds = postDeptIds;
 	}
 
+	public Boolean getCoursewareLimit() {
+		return coursewareLimit;
+	}
+
+	public void setCoursewareLimit(Boolean coursewareLimit) {
+		this.coursewareLimit = coursewareLimit;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/EGroupDefinedDataType.java

@@ -44,6 +44,10 @@ public enum EGroupDefinedDataType {
      */
     ANCHOR_CAMERA("主播摄像头状态"), // 开启摄像头 "ON" 关闭摄像头 "OFF"
 
+    /**
+     * 主播全员闭麦状态
+     */
+    ANCHOR_MIC("主播全员闭麦状态"), // 开启 "ON" 关闭 "OFF"
     ;
     private String code;
 

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderDetailTypeEnum.java

@@ -9,6 +9,7 @@ public enum OrderDetailTypeEnum implements BaseEnum<String, OrderDetailTypeEnum>
     MUSICAL("MUSICAL", "乐器"),
     ACCESSORIES("ACCESSORIES", "辅件"),
     TEACHING("TEACHING", "教谱"),
+    STAFF("STAFF", "曲谱"),
     OTHER("OTHER", "其他"),
     COURSE("COURSE", "乐团课"),
     HIGH_ONLINE_COURSE("HIGH_ONLINE_COURSE", "线上基础技能课"),

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SellTypeEnum.java

@@ -7,6 +7,8 @@ public enum SellTypeEnum implements BaseEnum<String, SellTypeEnum> {
 	INSTRUMENT("INSTRUMENT", "乐器销售"),
 	ACCESSORIES("ACCESSORIES", "配件销售"),
 	SCHOOL_BUY("SCHOOL_BUY", "学校采购"),
+	TEACHING("TEACHING", "教材销售"),
+	STAFF("STAFF", "曲谱销售"),
 	OTHER("OTHER", "书籍(其他)");
 
 	private String code;

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

@@ -10,7 +10,7 @@ public enum SysUserRoleEnum implements BaseEnum<String,SysUserRoleEnum> {
     HR_DIRECTOR,ACCOUNT_SUPERVISOR, CHAIRMAN_ASSISTANT,
     MALL_OPERATION,TEACH_SUPERVISOR,OFFICE_ADMIN,DEPUTY_DIRECTOR,
     PIANO_TEACHER,CHRISTIAN, VICE_PRESIDENT,TEACH_RESEARCHERS, TEACH_DIRECTOR,WAREHOUS_SUPERVIOSR,
-    AFTER_SALES,DEVELOP_DIRECTOR, EXECUTIVE,OPERATE_COMMISSIONER, FUND_SUPERVISOR,MANAGER, CEO,CHAIRMAN,ORDER_GOOD;
+    AFTER_SALES,DEVELOP_DIRECTOR, EXECUTIVE,OPERATE_COMMISSIONER,OPERATE_DIRECTOR, FUND_SUPERVISOR,MANAGER, CEO,CHAIRMAN,ORDER_GOOD;
 
     @Override
     public String getCode() {

+ 61 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/ImLiveBroadcastRoomMemberVo.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.vo;
 
+import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -54,6 +55,66 @@ public class ImLiveBroadcastRoomMemberVo implements java.io.Serializable {
     @ApiModelProperty(value = "是否黑名单")
     private boolean blackFlag;
 
+    public ImLiveBroadcastRoomSimpleMemberVo getSimpleMemberVo(ImLiveBroadcastRoomMemberVo memberVo) {
+        return JSON.parseObject(JSON.toJSONString(memberVo), ImLiveBroadcastRoomSimpleMemberVo.class);
+    }
+
+    public static class ImLiveBroadcastRoomSimpleMemberVo {
+
+        @ApiModelProperty(value = "学生头像")
+        private String avatar;
+        @ApiModelProperty(value = "是否黑名单")
+        private boolean blackFlag;
+        @ApiModelProperty(value = "进入房间时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private Date joinTime;
+        @ApiModelProperty(value = "学生编号")
+        private Integer studentId;
+
+        @ApiModelProperty(value = "学生姓名")
+        private String studentName;
+
+        public String getAvatar() {
+            return avatar;
+        }
+
+        public void setAvatar(String avatar) {
+            this.avatar = avatar;
+        }
+
+        public boolean isBlackFlag() {
+            return blackFlag;
+        }
+
+        public void setBlackFlag(boolean blackFlag) {
+            this.blackFlag = blackFlag;
+        }
+
+        public Date getJoinTime() {
+            return joinTime;
+        }
+
+        public void setJoinTime(Date joinTime) {
+            this.joinTime = joinTime;
+        }
+
+        public Integer getStudentId() {
+            return studentId;
+        }
+
+        public void setStudentId(Integer studentId) {
+            this.studentId = studentId;
+        }
+
+        public String getStudentName() {
+            return studentName;
+        }
+
+        public void setStudentName(String studentName) {
+            this.studentName = studentName;
+        }
+    }
+
     public boolean isBlackFlag() {
         return blackFlag;
     }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TempUserTrainingTimeDetailVo.java

@@ -21,7 +21,7 @@ public class TempUserTrainingTimeDetailVo implements Serializable {
     @ApiModelProperty(value = "训练时长/秒-保留2位")
     private BigDecimal playTime;
 
-    @ApiModelProperty(value = "是否完成训练  0-未完成 1-已完成")
+    @ApiModelProperty(value = "是否完成训练  -1:未练习 0-未完成 1-已完成")
     private Integer isFinish;
 
     @ApiModelProperty(value = "打卡标准")

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/redisson/RedissonMessageService.java

@@ -17,6 +17,7 @@ public class RedissonMessageService {
     public static final String TOPIC_MESSAGE = "topic:message";
     // 直播在线人数
     public static final String LIVE_ROOM_MEMBER = "delayQueue:liveRoomMember:";
+    public static final String LIVE_ROOM_MEMBER_LOCK = "LOCK:liveRoomMember:";
 
     private final RedissonClient redissonClient;
 

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

@@ -303,6 +303,8 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	 */
 	boolean checkSingleCourseConflict(CourseSchedule courseSchedule, List<CourseSchedule> adjustCourses, Map<String, List<CourseSchedule>> result);
 
+	void checkCourseIsSettlement(CourseSchedule courseSchedule);
+
 	/**
 	 * @describe 课程时间校正,将冲突课程的时间校正到当天空闲时间段
 	 * @author Joburgess

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/HumanCostService.java

@@ -0,0 +1,17 @@
+package com.ym.mec.biz.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ym.mec.biz.dal.dao.HumanCostDao;
+import com.ym.mec.biz.dal.entity.HumanCost;
+
+/**
+ * 人力资源成本(HumanCost)表服务接口
+ *
+ * @author zx
+ * @since 2023-04-17 15:31:32
+ */
+public interface HumanCostService extends IService<HumanCost> {
+
+    HumanCostDao getDao();
+}
+

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

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomDetailVo;
 import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomMemberVo;
 import com.ym.mec.common.page.PageInfo;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,5 +31,9 @@ public interface ImLiveBroadcastRoomMemberService extends IService<ImLiveBroadca
      */
     PageInfo<ImLiveBroadcastRoomMemberVo> queryRoomMember(Map<String, Object> param);
 
+    /**
+     * 查询在房间人员
+     */
+    List<Integer> getLiveRoomMember(String roomUid);
 }
 

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.microsvc.toolkit.middleware.live.message.TencentWrapper;
 import com.ym.mec.biz.dal.dto.ImLiveBroadcastRoomDto;
 import com.ym.mec.biz.dal.dto.LiveRoomStatus;
 import com.ym.mec.biz.dal.dto.RoomReservationUserSearch;
@@ -186,5 +187,12 @@ public interface ImLiveBroadcastRoomService extends IService<ImLiveBroadcastRoom
      * @param roomUid 直播间uid
      */
     int syncLikeCount(String roomUid);
+
+    /**
+     * 直播间推流状态查询
+     * @param roomUid 直播间ID
+     * @return TencentWrapper.LiveStreamState
+     */
+    TencentWrapper.LiveStreamState roomLiveStreamStatus(String roomUid);
 }
 

+ 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: 乐团排课、活动排课,计算课程预收

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

@@ -0,0 +1,26 @@
+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 addActualPrice(Integer userId, String musicGroupId, BigDecimal actualPrice);
+
+    void addExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice);
+
+    void cutExpectPrice(Integer userId, String musicGroupId, BigDecimal expectPrice);
+}
+
+

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

@@ -1216,7 +1216,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
                 unitPriceMap.put(
                         musicGroupPaymentCalenderCourseSettings.getCourseType(),
-                        musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
+                        musicGroupPaymentCalenderCourseSettings.getOverflowCoursePrice().divide(
                                 new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
 
                 originUnitPriceMap.put(
@@ -4157,7 +4157,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                             throw new BizException("请先设置分部课程类型单价");
                         }
                         if (defaultUnitPrice.getUnitPrice().multiply(new BigDecimal(courseSettings.getCourseTotalMinuties())).setScale(0, BigDecimal.ROUND_HALF_UP)
-                                .compareTo(courseSettings.getCourseCurrentPrice()) != 0) {
+                                .compareTo(courseSettings.getOverflowCoursePrice()) != 0) {
                             status = AUDITING;
                             break;
                         }

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

@@ -288,12 +288,13 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         cloudTeacherOrder.setAmount(cloudTeacherFee);
         cloudTeacherOrder.setStudentId(order.getUserId());
         cloudTeacherOrder.setStatus(1);
-        MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(order.getCalenderId());
+        cloudTeacherOrder.setOperatingAmount(calenderMember.getIncome().compareTo(BigDecimal.ZERO) == 0?cloudTeacherFee:calenderMember.getIncome());
+        /*MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(order.getCalenderId());
         if(calender.getCloudTeacherPaymentFlag()){
             cloudTeacherOrder.setOperatingAmount(BigDecimal.ZERO);
         }else {
             cloudTeacherOrder.setOperatingAmount(cloudTeacherFee);
-        }
+        }*/
         //保存云教练订单
         this.save(cloudTeacherOrder,calenderMember.getAutoActivationFlag());
     }

+ 49 - 57
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -39,7 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.TransactionStatus;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
@@ -58,11 +57,8 @@ import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType.MIX;
 import static com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType.MUSIC_NETWORK;
-import static com.ym.mec.biz.dal.enums.ClassGroupTypeEnum.HIGH_ONLINE;
 import static com.ym.mec.biz.dal.enums.GroupType.*;
-import static com.ym.mec.biz.dal.enums.MusicGroupStatusEnum.PROGRESS;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.FREE;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.TRIAL;
 import static com.ym.mec.biz.dal.enums.SysUserRoleEnum.ORGAN_MANAGER;
@@ -1670,30 +1666,22 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					CourseSchedule currentCourseSchedule = courseSchedules.get(courseStartDates.size() - 1);
 					int singleClassMinutes = DateUtil.minutesBetween(currentCourseSchedule.getStartClassTime(), currentCourseSchedule.getEndClassTime());
 					Date courseEndTime = DateUtil.addMinutes(courseStartTime, singleClassMinutes);
-					int settlementNum = courseScheduleTeacherSalaryDao.checkCourseIsSettlement(courseSchedules.get(courseStartDates.size() - 1).getId().intValue());
-					if (settlementNum > 0) {
-						throw new BizException("{}[{}]{}-{}课程已结算",
-								courseSchedules.get(courseStartDates.size() - 1).getName(),
-								courseSchedules.get(courseStartDates.size() - 1).getId(),
-								DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getStartClassTime(),
-										DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT),
-								DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getEndClassTime(),
-										DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT));
-					}
-					int num = studentAttendanceDao.countStudentAttendenceNum(courseSchedules.get(courseStartDates.size() - 1).getId().intValue());
+					//校验课程是否结算
+					this.checkCourseIsSettlement(currentCourseSchedule);
+					int num = studentAttendanceDao.countStudentAttendenceNum(currentCourseSchedule.getId().intValue());
 					if (num > 0) {
 						throw new BizException("{}[{}]{}-{}课程已点名",
-								courseSchedules.get(courseStartDates.size() - 1).getName(),
-								courseSchedules.get(courseStartDates.size() - 1).getId(),
-								DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getStartClassTime(),
+								currentCourseSchedule.getName(),
+								currentCourseSchedule.getId(),
+								DateUtil.dateToString(currentCourseSchedule.getStartClassTime(),
 										DateUtil.EXPANDED_DATE_TIME_FORMAT),
-								DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getEndClassTime(),
+								DateUtil.dateToString(currentCourseSchedule.getEndClassTime(),
 										DateUtil.EXPANDED_DATE_TIME_FORMAT));
 					}
-					courseSchedules.get(courseStartDates.size() - 1).setStatus(CourseStatusEnum.NOT_START);
-					courseSchedules.get(courseStartDates.size() - 1).setClassDate(courseStartTime);
-					courseSchedules.get(courseStartDates.size() - 1).setStartClassTime(courseStartTime);
-					courseSchedules.get(courseStartDates.size() - 1).setEndClassTime(courseEndTime);
+					currentCourseSchedule.setStatus(CourseStatusEnum.NOT_START);
+					currentCourseSchedule.setClassDate(courseStartTime);
+					currentCourseSchedule.setStartClassTime(courseStartTime);
+					currentCourseSchedule.setEndClassTime(courseEndTime);
 				}
 				if (courseStartDates.size() == adjustCourseScheduleIds.size()) {
 					break;
@@ -1714,6 +1702,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	}
 
 	@Override
+	public void checkCourseIsSettlement(CourseSchedule courseSchedule) {
+		int settlementNum = courseScheduleTeacherSalaryDao.checkCourseIsSettlement(courseSchedule.getId().intValue());
+		if(settlementNum <= 0){
+			settlementNum = courseScheduleDao.checkCourseIsSettlementReport(courseSchedule.getId());
+		}
+		if (settlementNum > 0) {
+			throw new BizException("{}[{}]{}-{}课程已结算",
+					courseSchedule.getName(),
+					courseSchedule.getId(),
+					DateUtil.dateToString(courseSchedule.getStartClassTime(),
+							DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT),
+					DateUtil.dateToString(courseSchedule.getEndClassTime(),
+							DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT));
+		}
+	}
+
+	@Override
 	public boolean courseTimeRevise(CourseSchedule courseSchedule, List<CourseSchedule> sameDayCourses) {
 		int singleClassMinutes = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
 		sameDayCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
@@ -2443,30 +2448,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                         throw new BizException("单节课时不允许跨天");
                     }
                     courseStartDates.add(DateUtil.stringToDate(dateYmdStr, DateUtil.EXPANDED_DATE_TIME_FORMAT));
-                    int settlementNum = courseScheduleTeacherSalaryDao.checkCourseIsSettlement(courseSchedules.get(courseStartDates.size() - 1).getId().intValue());
-                    if (settlementNum > 0) {
-                        throw new BizException("{}[{}]{}-{}课程已结算",
-                                courseSchedules.get(courseStartDates.size() - 1).getName(),
-                                courseSchedules.get(courseStartDates.size() - 1).getId(),
-                                DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getStartClassTime(),
-                                        DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT),
-                                DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getEndClassTime(),
-                                        DateUtil.ISO_EXPANDED_DATE_TIME_FORMAT));
-                    }
-                    int num = studentAttendanceDao.countStudentAttendenceNum(courseSchedules.get(courseStartDates.size() - 1).getId().intValue());
+					CourseSchedule courseSchedule = courseSchedules.get(courseStartDates.size() - 1);
+					//校验课程是否结算
+					this.checkCourseIsSettlement(courseSchedule);
+                    int num = studentAttendanceDao.countStudentAttendenceNum(courseSchedule.getId().intValue());
                     if (num > 0) {
                         throw new BizException("{}[{}]{}-{}课程已点名",
-                                courseSchedules.get(courseStartDates.size() - 1).getName(),
-                                courseSchedules.get(courseStartDates.size() - 1).getId(),
-                                DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getStartClassTime(),
+								courseSchedule.getName(),
+								courseSchedule.getId(),
+                                DateUtil.dateToString(courseSchedule.getStartClassTime(),
                                         DateUtil.EXPANDED_DATE_TIME_FORMAT),
-                                DateUtil.dateToString(courseSchedules.get(courseStartDates.size() - 1).getEndClassTime(),
+                                DateUtil.dateToString(courseSchedule.getEndClassTime(),
                                         DateUtil.EXPANDED_DATE_TIME_FORMAT));
                     }
-                    courseSchedules.get(courseStartDates.size() - 1).setStatus(CourseStatusEnum.NOT_START);
-                    courseSchedules.get(courseStartDates.size() - 1).setClassDate(courseStartTime);
-                    courseSchedules.get(courseStartDates.size() - 1).setStartClassTime(courseStartTime);
-                    courseSchedules.get(courseStartDates.size() - 1).setEndClassTime(courseEndTime);
+                    courseSchedule.setStatus(CourseStatusEnum.NOT_START);
+                    courseSchedule.setClassDate(courseStartTime);
+                    courseSchedule.setStartClassTime(courseStartTime);
+                    courseSchedule.setEndClassTime(courseEndTime);
 
 					Integer allowOnlineToOffline = 0;
 					if(Objects.nonNull(vipGroupActivity)){
@@ -2480,9 +2478,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 					}
 
 					if (Objects.nonNull(vipGroupCourseAdjustInfo.getTeachMode())) {
-                    	boolean onlineToOffline = courseSchedules.get(courseStartDates.size() - 1).getTeachMode().equals(TeachModeEnum.ONLINE)
+                    	boolean onlineToOffline = courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)
 								&&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE);
-						boolean offlineToOnline = courseSchedules.get(courseStartDates.size() - 1).getTeachMode().equals(TeachModeEnum.OFFLINE)
+						boolean offlineToOnline = courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)
 								&&vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.ONLINE);
                         if(onlineToOffline && Objects.nonNull(vipGroupActivity) && (allowOnlineToOffline == 0 || allowOnlineToOffline == 3)){
                             throw new BizException("此VIP课活动不支持线上课调整为线下课");
@@ -2493,13 +2491,13 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 						if(onlineToOffline&&Objects.isNull(vipGroupCourseAdjustInfo.getSchoolId())){
 							throw new BizException("请选择教学点");
 						}
-                        courseSchedules.get(courseStartDates.size() - 1).setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
+						courseSchedule.setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
                         if (vipGroupCourseAdjustInfo.getTeachMode().equals(TeachModeEnum.OFFLINE)) {
                             if(Objects.nonNull(vipGroupCourseAdjustInfo.getSchoolId())){
-                                courseSchedules.get(courseStartDates.size() - 1).setSchoolId(vipGroupCourseAdjustInfo.getSchoolId());
+								courseSchedule.setSchoolId(vipGroupCourseAdjustInfo.getSchoolId());
                             }
                         } else {
-                            courseSchedules.get(courseStartDates.size() - 1).setSchoolId(null);
+							courseSchedule.setSchoolId(null);
                         }
                     }
                 }
@@ -3111,16 +3109,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			newCourseSchedule.setValidStartTime(oldCourseSchedule.getValidStartTime());
 
             //课程是否已结算
-            int settlementNum = courseScheduleTeacherSalaryDao.checkCourseIsSettlement(oldCourseSchedule.getId().intValue());
-            if (settlementNum > 0) {
-                throw new BizException("{}[{}]{}-{}课程已结算",
-                        oldCourseSchedule.getName(),
-                        oldCourseSchedule.getId(),
-                        DateUtil.dateToString(oldCourseSchedule.getStartClassTime(),
-                                DateUtil.EXPANDED_DATE_TIME_FORMAT),
-                        DateUtil.dateToString(oldCourseSchedule.getEndClassTime(),
-                                DateUtil.EXPANDED_DATE_TIME_FORMAT));
-            }
+			this.checkCourseIsSettlement(oldCourseSchedule);
 
 			if (newCourseSchedule.getGroupType() != GroupType.COMM) {
 				// 学生已点名不能调整(请假可以调整)
@@ -4010,6 +3999,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         }
 
         int settlementTimes = courseScheduleTeacherSalaryDao.checkCourseIsSettlement(courseScheduleComplaints.getCourseScheduleId().intValue());
+		if(settlementTimes <= 0){
+			settlementTimes = courseScheduleDao.checkCourseIsSettlementReport(courseScheduleComplaints.getCourseScheduleId());
+		}
         if (settlementTimes > 0) {
             throw new BizException("该课程已结算");
         }

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

@@ -341,7 +341,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 				BigDecimal unitMinuteOriginalPrice = courseSetting.getCourseOriginalPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
 
 				//课程每分钟现价
-				BigDecimal unitMinuteCurrentPrice = courseSetting.getCourseCurrentPrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
+				BigDecimal unitMinuteCurrentPrice = courseSetting.getOverflowCoursePrice().divide(new BigDecimal(courseSetting.getCourseTotalMinuties()), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
 
 				//默认课程时长
 				int courseDuration = Integer.parseInt(jsonObject.get(courseSchedule.getType().getCode()).toString());

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

@@ -434,7 +434,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 					goodsProcurement.setTaxStockSoldNum(new AtomicInteger(goodsProcurement.getTaxStockSoldNum()).incrementAndGet());
 				}
 			}
-
+			//如果有采购清单,初始化总部成本价
 			if(Objects.nonNull(goodsProcurement)){
 				goodsProcurementDao.update(goodsProcurement);
 				noneBatchNoSellOrder.setBatchNo(goodsProcurement.getBatchNo());
@@ -522,6 +522,11 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 					}else if(StockType.EXTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.EXTERNAL.equals(accountType))){
 						sellOrder.setStockType(StockType.EXTERNAL);
 					}
+					if(StringUtils.isNotEmpty(goods.getComplementGoodsIdList())){
+						sellOrder.setOrganSellCost(goodsDao.getOrganCostPrice(goods.getComplementGoodsIdList()));
+					}else {
+						sellOrder.setOrganSellCost(goods.getOrganCostPrice());
+					}
 					sellOrder.setGoodsName(goods.getName());
 					sellOrder.setAccountType(accountType);
 					sellOrder.setBatchNo(batchNoGoodsIdMapEntry.getKey());
@@ -555,6 +560,11 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 				sellOrder.setGoodsName(goods.getName());
 				sellOrder.setAccountType(accountType);
 				sellOrder.setBatchNo(goodsProcurement.getBatchNo());
+				if(StringUtils.isNotEmpty(goods.getComplementGoodsIdList())){
+					sellOrder.setOrganSellCost(goodsDao.getOrganCostPrice(goods.getComplementGoodsIdList()));
+				}else {
+					sellOrder.setOrganSellCost(goods.getOrganCostPrice());
+				}
 				if(Objects.nonNull(goodsProcurement.getBatchNo())){
 					sellOrder.setSellCost(goodsProcurement.getDiscountPrice());
 					Map<String, BigDecimal> CostMap = new HashMap<>();

+ 29 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/HumanCostServiceImpl.java

@@ -0,0 +1,29 @@
+package com.ym.mec.biz.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ym.mec.biz.dal.dao.HumanCostDao;
+import com.ym.mec.biz.dal.entity.HumanCost;
+import com.ym.mec.biz.service.HumanCostService;
+import org.springframework.stereotype.Service;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 人力资源成本(HumanCost)表服务实现类
+ *
+ * @author zx
+ * @since 2023-04-17 15:31:32
+ */
+@Service("humanCostService")
+public class HumanCostServiceImpl extends ServiceImpl<HumanCostDao, HumanCost> implements HumanCostService {
+
+    private final static Logger log = LoggerFactory.getLogger(HumanCostServiceImpl.class);
+
+    @Override
+    public HumanCostDao getDao(){
+            return this.baseMapper;
+    }
+
+}
+

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomMemberServiceImpl.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ym.mec.biz.dal.dao.ImLiveBroadcastRoomMemberDao;
+import com.ym.mec.biz.dal.dto.LiveRoomStatus;
 import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomMember;
 import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomDetailVo;
 import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomMemberVo;
@@ -17,7 +18,10 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 直播间人员关系表(ImLiveBroadcastRoomMember)表服务实现类
@@ -57,5 +61,22 @@ public class ImLiveBroadcastRoomMemberServiceImpl extends ServiceImpl<ImLiveBroa
         return PageUtil.pageInfo(baseMapper.queryMemberPage(pageInfo, param));
     }
 
+    /**
+     * 查询在房间人员
+     *
+     * @param roomUid
+     */
+    @Override
+    public List<Integer> getLiveRoomMember(String roomUid) {
+        List<ImLiveBroadcastRoomMember> list = this.lambdaQuery()
+                                                   .eq(ImLiveBroadcastRoomMember::getRoomUid, roomUid)
+                                                   .eq(ImLiveBroadcastRoomMember::getLiveRoomStatus, true)
+                                                   .list();
+        if (list == null || list.isEmpty())
+            return new ArrayList<>();
+
+        return list.stream().map(ImLiveBroadcastRoomMember::getUserId).collect(Collectors.toList());
+    }
+
 }
 

+ 49 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomServiceImpl.java

@@ -736,7 +736,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
                     pluginService.rtcRoomRecordStop(taskId);
                 }
             }
-//            imFeignService.destroyLiveRoom(roomUid);
+
+            //            imFeignService.destroyLiveRoom(roomUid);
             log.info("roomDestroy>>>> destroyLiveRoom {}", JSONObject.toJSONString(message));
         } catch (Exception e) {
             log.error("roomDestroy>>>> errorMsg{}", e.getMessage(), e.getCause());
@@ -764,6 +765,8 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
                 member.setTenantId(v.getTenantId());
                 member.setRoomUid(roomUid);
                 member.setUserId(v.getUserId());
+                member.setOnlineStatus(0);
+                member.setLiveRoomStatus(0);
                 member.setJoinTime(v.getFirstJoinTime());
                 member.setTotalTime(getLookMinutes(v.getDynamicLookTime(), now, v.getTotalViewTime()));
                 memberList.add(member);
@@ -921,7 +924,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
                 // 缓存JoinRoom用户信息到redis
                 RBucket<Object> bucket = redissonClient.getBucket(RedissonMessageService.LIVE_ROOM_MEMBER + roomUid);
                 if (!bucket.isExists()) {
-                    bucket.set(roomUid, 30, TimeUnit.MINUTES);
+                    bucket.set(0, 30, TimeUnit.MINUTES);
                     // 发布删除缓存消息
                     redissonMessageService.publish(RedissonMessageService.TOPIC_MESSAGE, roomUid);
                 }
@@ -1119,7 +1122,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         // 缓存JoinRoom用户信息到redis
         RBucket<Object> bucket = redissonClient.getBucket(RedissonMessageService.LIVE_ROOM_MEMBER + roomUid);
         if (!bucket.isExists()) {
-            bucket.set(roomUid, 30, TimeUnit.MINUTES);
+            bucket.set(0, 30, TimeUnit.MINUTES);
             // 发布删除缓存消息
             redissonMessageService.publish(RedissonMessageService.TOPIC_MESSAGE, roomUid);
         }
@@ -2367,12 +2370,21 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
 
         imLiveBroadcastRoom.setBanStatus(liveRoom.getBanStatus());
         whetherChat(room.getId(), liveRoom.getBanStatus());
+
         // 不用前端传时间
         // imLiveBroadcastRoom.setLiveTotalTime(liveRoom.getLiveTotalTime());
+
         // 设置摄像头状态
         if (liveRoom.getCameraStatus() != null) {
-            setGroupDefinedData(room,EGroupDefinedDataType.ANCHOR_CAMERA,liveRoom.getCameraStatus() == 1?
-                EOnOffStatus.ON.getCode():EOnOffStatus.OFF.getCode());
+            setGroupDefinedData(room, EGroupDefinedDataType.ANCHOR_CAMERA,
+                    liveRoom.getCameraStatus() == 1 ? EOnOffStatus.ON.getCode():EOnOffStatus.OFF.getCode());
+            return true;
+        }
+
+        // 设置全员闭麦状态
+        if (Objects.nonNull(liveRoom.getMicStatus())) {
+            setGroupDefinedData(room, EGroupDefinedDataType.ANCHOR_MIC,
+                    liveRoom.getMicStatus() == 1 ? EOnOffStatus.ON.getCode() : EOnOffStatus.OFF.getCode());
             return true;
         }
 
@@ -2648,6 +2660,38 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
         return 0;
     }
 
+    /**
+     * 直播间推流状态查询
+     *
+     * @param roomUid 直播间ID
+     * @return TencentWrapper.LiveStreamState
+     */
+    @Override
+    public TencentWrapper.LiveStreamState roomLiveStreamStatus(String roomUid) {
+
+        // 直播间信息
+        ImLiveBroadcastRoomVo roomVo = getImLiveBroadcastRoomVo(roomUid);
+        if (Objects.isNull(roomVo)) {
+            throw new BizException("无效的直播间ID");
+        }
+
+        TencentWrapper.LiveStreamState liveStreamState = TencentWrapper.LiveStreamState
+                .builder()
+                .streamState("inactive")
+                .requestId("")
+                .build();
+        // 直播间推流状态
+        try {
+            LivePluginService pluginService = livePluginContext.getPluginService(roomVo.getServiceProvider());
+
+            liveStreamState = pluginService.liveStreamState(getStreamId(roomUid, roomVo.getSpeakerId()));
+        } catch (Exception e) {
+            log.error("roomLiveStreamStatus roomUid={}", roomUid, e);
+        }
+
+        return liveStreamState;
+    }
+
 
     /**
      * 查询直播间所有用户信息

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

+ 10 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -232,7 +232,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         studentPaymentOrder.setMusicGroupId(paymentId.toString());
         studentPaymentOrder.setMemo(cloudCoachPaymentProgram.getRemark());
         studentPaymentOrder.setGroupType(GroupType.MEMBER);
-        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
+        this.getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
+        Map<String, Object> result = studentPaymentOrderService.createOrder(studentPaymentOrder, null, "BUY_MEMBER");
         return BaseController.succeed(result);
     }
 
@@ -261,8 +262,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         studentPaymentOrder.setOrganId(sysUser.getOrganId());
         studentPaymentOrder.setMemo("学员云教练购买");
         studentPaymentOrder.setGroupType(GroupType.MEMBER);
-        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
-        //生团练宝订单
+        this.getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
+        //生团练宝订单
         CloudTeacherOrder cloudTeacherOrder = new CloudTeacherOrder();
         cloudTeacherOrder.setOrderId(studentPaymentOrder.getId());
         cloudTeacherOrder.setLevel(1);
@@ -272,8 +273,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         cloudTeacherOrder.setStudentId(sysUser.getId());
         cloudTeacherOrder.setOrganId(studentPaymentOrder.getOrganId());
         cloudTeacherOrder.setAmount(studentPaymentOrder.getExpectAmount());
-        cloudTeacherOrder.setOperatingAmount(studentPaymentOrder.getExpectAmount());
         cloudTeacherOrderService.insert(cloudTeacherOrder);
+        Map<String, Object> result = studentPaymentOrderService.createOrder(studentPaymentOrder, null, "BUY_MEMBER");
         return BaseController.succeed(result);
     }
 
@@ -368,7 +369,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         studentPaymentOrder.setMusicGroupId(memberPayParamDto.getLiveId());
         //保存商品编号
         studentPaymentOrder.setClassGroupId(memberPayParamDto.getLiveGoodsId());
-        Map<String, Object> result = getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
+        this.getMap(memberPayParamDto.getAmount(), memberPayParamDto.getUseBalancePayment(),studentPaymentOrder);
+        Map<String, Object> result = studentPaymentOrderService.createOrder(studentPaymentOrder, null, "BUY_MEMBER");
         return BaseController.succeed(result);
     }
 
@@ -505,7 +507,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         studentPaymentOrder.setOrganId(sysUser.getOrganId());
         studentPaymentOrder.setGroupType(GroupType.MEMBER);
         studentPaymentOrder.setMemo("团练宝购买");
-        Map<String, Object> result = getMap(dto.getAmount(), dto.getUseBalancePayment(),studentPaymentOrder);
+        this.getMap(dto.getAmount(), dto.getUseBalancePayment(),studentPaymentOrder);
+        Map<String, Object> result = studentPaymentOrderService.createOrder(studentPaymentOrder, null, "BUY_MEMBER");
         return BaseController.succeed(result);
     }
 
@@ -602,7 +605,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
     }
 
     //写入支付数据
-    private Map<String, Object> getMap(BigDecimal amount, Boolean UseBalance,StudentPaymentOrder studentPaymentOrder) throws Exception {
+    private void getMap(BigDecimal amount, Boolean UseBalance,StudentPaymentOrder studentPaymentOrder) throws Exception {
         Date date = new Date();
         BigDecimal actualAmount = studentPaymentOrder.getActualAmount();
         studentPaymentOrder.setRoutingOrganId(studentPaymentOrder.getOrganId());
@@ -633,8 +636,6 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrder.setVersion(0);
         studentPaymentOrderService.insert(studentPaymentOrder);
-        Map<String, Object> result = studentPaymentOrderService.createOrder(studentPaymentOrder, null, "BUY_MEMBER");
-        return result;
     }
 
     public void useBalanceAmount(StudentPaymentOrder studentPaymentOrder, String memo) {

+ 5 - 14
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;
@@ -90,13 +83,11 @@ public class MusicGroupPaymentCalenderCourseSettingsServiceImpl extends BaseServ
     public void batchInsert(MusicGroupPaymentCalender musicGroupPaymentCalender) {
 		List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingss = musicGroupPaymentCalender.getMusicGroupPaymentCalenderCourseSettingsList();
 		if (musicGroupPaymentCalenderCourseSettingss != null && musicGroupPaymentCalenderCourseSettingss.size() > 0) {
-//			if (musicGroupPaymentCalender.getPayUserType() == SCHOOL) {
-//				musicGroupPaymentCalenderCourseSettingss.forEach(e->e.setCourseCurrentPrice(BigDecimal.ZERO));
-//			}
 			MusicGroupOrganizationCourseSettings courseSettings = musicGroupOrganizationCourseSettingsService.get(musicGroupPaymentCalender
 					.getMusicGroupOrganizationCourseSettingId());
 			for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingss) {
 				musicGroupPaymentCalenderCourseSettings.setMusicGroupPaymentCalenderId(musicGroupPaymentCalender.getId());
+				musicGroupPaymentCalenderCourseSettings.setOverflowCoursePrice(musicGroupPaymentCalenderCourseSettings.getOverflowCoursePrice().add(musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice()));
 				if (courseSettings != null) {
 					musicGroupPaymentCalenderCourseSettings.setName(courseSettings.getName());
 				}

+ 55 - 126
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,16 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
             musicGroupPaymentCalenderDetail.setStartPaymentDate(musicGroupPaymentCalender.getStartPaymentDate());
             musicGroupPaymentCalenderDetail.setDeadlinePaymentDate(musicGroupPaymentCalender.getDeadlinePaymentDate());
             musicGroupPaymentCalenderDetail.setResponsibleUserId(musicGroupPaymentCalender.getOperator());
+            musicGroupPaymentCalenderDetail.setMusicGroupId(musicGroupPaymentCalender.getMusicGroupId());
+            //设置云教练、课程收入
+            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 +276,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 +299,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 +308,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 +318,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 +366,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 +375,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 +482,51 @@ 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;
     }
 }

+ 61 - 30
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
@@ -86,7 +85,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private SendSeoMessageSource sendSeoMessageSource;
     @Autowired
-    private SysUserFeignService sysUserFeignService;
+    private SysUserService sysUserService;
     @Autowired
     private ImUserFriendService imUserFriendService;
     @Autowired
@@ -127,6 +126,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     private ImGroupService imGroupService;
     @Autowired
     private ImGroupMemberService imGroupMemberService;
+    @Autowired
+    private MemberFeeSettingService memberFeeSettingService;
 
     @Override
     public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -149,10 +150,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         if (musicGroup == null) {
             throw new BizException("乐团查询失败,请检查参数");
         }
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("请登录");
-        }
+        SysUser sysUser = sysUserService.getUser();
         // 所有缴费项目已完成排课才能创建下一个缴费项目
         /*String organBatchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, null, null, musicGroupPaymentCalenderDto.getIgnoreBatchNoList());
         if (StringUtils.isNoneBlank(organBatchNo)) {
@@ -239,10 +237,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             throw new BizException("乐团查询失败,请检查参数");
         });
 
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        checkObjectNull(sysUser, o -> {
-            throw new BizException("请登录");
-        });
+        SysUser sysUser = sysUserService.getUser();
 
         // 不是进行中,只能创建一次缴费
         if (musicGroup.getStatus() != MusicGroupStatusEnum.PROGRESS) {
@@ -399,8 +394,24 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             musicGroupPaymentCalenderActivityService.batchInsert(musicGroupPaymentBaseCalender, calenderId);
         }
         //保存课程费用列表
-        musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList());
-        musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
+        List<MusicGroupPaymentCalenderCourseSettings> courseSettingsList = musicGroupPaymentBaseCalender.getMusicGroupPaymentCalenderCourseSettingsList();
+        if(CollectionUtils.isNotEmpty(courseSettingsList)){
+            //是否会员团
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE && Objects.nonNull(calenderMember)){
+                //获取云教练溢出费用
+                BigDecimal courseIncome = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
+                        calenderMember.getNum(), MemberFeeSettingServiceImpl::getIncome);
+                calenderMember.setIncome(courseIncome);
+                musicGroupPaymentCalenderMemberService.update(calenderMember);
+                //获取云教练溢出费用
+                BigDecimal currentFee = memberFeeSettingService.getAmount(musicGroup.getOrganId(), 1, calenderMember.getPeriod(),
+                        calenderMember.getNum(), MemberFeeSettingServiceImpl::getCurrentFee);
+                //平摊金额
+                distributeTotalAmount(courseSettingsList,currentFee.subtract(courseIncome));
+            }
+            musicGroupPaymentCalender.setMusicGroupPaymentCalenderCourseSettingsList(courseSettingsList);
+            musicGroupPaymentCalenderCourseSettingsService.batchInsert(musicGroupPaymentCalender);
+        }
 
         // 如果是报名,需要修改乐团状态
         if (musicGroupPaymentCalender.getPaymentType() == MUSIC_APPLY) {
@@ -422,9 +433,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);
@@ -436,6 +453,30 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         return BaseController.succeed(map);
     }
 
+    public static void distributeTotalAmount(List<MusicGroupPaymentCalenderCourseSettings> settings, BigDecimal totalAmount) {
+        if(CollectionUtils.isEmpty(settings) || BigDecimal.ZERO.compareTo(totalAmount) == 0){
+            return;
+        }
+        BigDecimal remainingAmount = totalAmount;
+        int lastIndex = settings.size() - 1;
+        BigDecimal totalUnitPrice = settings.stream().map(e -> e.getUnitPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+        // 分摊总金额
+        for (int i = 0; i < lastIndex; i++) {
+            MusicGroupPaymentCalenderCourseSettings setting = settings.get(i);
+            BigDecimal ratio = setting.getUnitPrice().divide(totalUnitPrice, 10, BigDecimal.ROUND_HALF_UP);
+            BigDecimal itemAmount = totalAmount.multiply(ratio).setScale(2, BigDecimal.ROUND_HALF_UP);
+            setting.setOverflowCoursePrice(itemAmount.add(setting.getOverflowCoursePrice()));
+            remainingAmount = remainingAmount.subtract(itemAmount);
+        }
+
+        // 将剩余的金额放在最后一个Item对象中
+        MusicGroupPaymentCalenderCourseSettings lastItem = settings.get(lastIndex);
+        lastItem.setOverflowCoursePrice(lastItem.getOverflowCoursePrice().add(remainingAmount));
+    }
+
+
+
     //校验缴费项目进行中加学员
     public void checkAddStudent(CalenderAddStudent calenderAddStudent, MusicGroup musicGroup) {
         //获取缴费状态在审核中或者已拒绝的缴费项目的学员
@@ -552,10 +593,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         if (musicGroup == null) {
             throw new BizException("乐团查询失败,请检查参数");
         }
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("请登录");
-        }
+        SysUser sysUser = sysUserService.getUser();
 
         List<Long> calenderIds = musicGroupPaymentCalenderList.stream().map(MusicGroupPaymentCalender::getId).collect(Collectors.toList());
         //删除原来数据
@@ -838,7 +876,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
             try {
                 String studentIds = groupPaymentCalenders.get(0).getStudentIds();
                 if (StringUtils.isNotEmpty(studentIds)) {
-                    SysUser sysUser = sysUserFeignService.queryUserById(Integer.parseInt(studentIds));
+                    SysUser sysUser = sysUserService.queryUserById(Integer.parseInt(studentIds));
                     calenderAuditDetailDto.setPhone(sysUser.getPhone());
                     calenderAuditDetailDto.setUsername(sysUser.getUsername());
                 }
@@ -924,12 +962,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
                     musicGroup.setStatus(MusicGroupStatusEnum.PRE_APPLY);
                     musicGroup.setUpdateTime(date);
                     musicGroupDao.update(musicGroup);
-                    SysUser sysUser = sysUserFeignService.queryUserInfo();
-                    if (sysUser == null || sysUser.getId() == null) {
-                        throw new BizException("请重新登录");
-                    }
                     //记录操作日志
-                    musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目通过(费用审核中 -> 预报名)", sysUser.getId(), ""));
+                    musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroup.getId(), "报名缴费项目通过(费用审核中 -> 预报名)",sysUserService.getUserId(), ""));
                     this.createPreImGroup(musicGroup);
                 }
             } else if (calender.getPaymentType() == ADD_STUDENT) {
@@ -1004,10 +1038,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void auditRefuse(String batchNs, String auditMemo) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null || sysUser.getId() == null) {
-            throw new BizException("请重新登录");
-        }
+        SysUser sysUser = sysUserService.getUser();
         String[] split = batchNs.split(",");
         Date date = new Date();
         
@@ -1081,7 +1112,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
         if (calenders.size() == 0) {
             throw new BizException("缴费批次不存在");
         }
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        SysUser sysUser = sysUserService.getUser();
         Date date = new Date();
         calenders.forEach(e -> {
             if (e.getPaymentType() == ADD_STUDENT) {
@@ -1325,7 +1356,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);

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

@@ -1,21 +1,269 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.StudentApplyInstrumentDto;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 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.*;
+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.PayUserType.STUDENT;
 
 @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;
+	@Autowired
+	private MusicGroupDao musicGroupDao;
+	@Autowired
+	private StudentRegistrationDao studentRegistrationDao;
+	@Autowired
+	private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
+	@Autowired
+	private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
 
 	@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.getOverflowCoursePrice());
+					musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSettings.getCourseOriginalPrice());
+					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSettings.getOverflowCoursePrice());
+					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();
+			String musicGroupId = musicGroupPaymentCalender.getMusicGroupId();
+			MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+			//免费团,并且购买乐器
+			BigDecimal musicalFee = BigDecimal.ZERO;
+			if(musicGroup.getCourseViewType() == CourseViewTypeEnum.FREE){
+				StudentPaymentOrderDetail orderMusical = studentPaymentOrderDetailDao.findApplyOrderMusical(paymentOrderId);
+				if(Objects.nonNull(orderMusical)){
+					//如果是免费团,那么要处理乐器溢出的课程费用
+					CourseViewTypeEnum courseViewType = musicGroup.getCourseViewType();
+					StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+					Integer subjectId = studentRegistration.getActualSubjectId();
+					ChargeTypeSubjectMapper chargeType = chargeTypeSubjectMapperDao.findByViewTypeANdSubject(courseViewType,subjectId,musicGroup.getTenantId());
+					if(Objects.nonNull(chargeType) && chargeType.getFee() != null && orderMusical.getPrice().compareTo(BigDecimal.ZERO) > 0
+							&& chargeType.getFee().compareTo(orderMusical.getPrice()) < 0){
+						musicalFee = orderMusical.getPrice().subtract(chargeType.getFee());
+						//累加充值金额
+						studentRegistrationDao.updateCourseFee(studentRegistration.getId(),musicalFee);
+						//添加日志
+						StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
+						studentCourseFeeDetail.setTenantId(musicGroup.getTenantId());
+						studentCourseFeeDetail.setStudentRegistrationId(studentRegistration.getId());
+						studentCourseFeeDetail.setAmount(musicalFee);
+						studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(musicalFee));
+						studentCourseFeeDetail.setMemo("免费团,购买乐器赠送课费");
+						studentCourseFeeDetail.setOperator(userId);
+						studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
+						List<MusicGroupPaymentStudentCourseDetail> courseDetails = musicGroupPaymentStudentCourseDetailDao.findByCalenderAndUserId(musicGroupPaymentCalender.getId().toString(), userId);
+						if(CollectionUtils.isNotEmpty(courseDetails)){
+							distributeTotalAmount(courseDetails,musicalFee);
+							musicGroupPaymentStudentCourseDetailDao.batchUpdate(courseDetails);
+						}
+					}
+				}
+			}
+			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.getOverflowCoursePrice().add(musicalFee));
+				musicGroupPaymentStudentCourseDetail.setSubCourseOriginalPrice(courseSetting.getCourseOriginalPrice());
+				musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(courseSetting.getOverflowCoursePrice().add(musicalFee));
+				if(musicGroupPaymentCalender.getPayUserType() == SCHOOL){
+					musicGroupPaymentStudentCourseDetail.setCourseCurrentPrice(BigDecimal.ZERO);
+					musicGroupPaymentStudentCourseDetail.setSubCourseCurrentPrice(BigDecimal.ZERO);
+				}
+				musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(0);
+				musicGroupPaymentStudentCourseDetail.setCloudTeacherPaymentFlag(cloudTeacherPaymentFlag);
+				musicGroupPaymentStudentCourseDetails.add(musicGroupPaymentStudentCourseDetail);
+			}
+			if (musicGroupPaymentStudentCourseDetails.size() > 0) {
+				if(musicGroupPaymentCalender.getPayUserType() == STUDENT && musicGroup.getCourseViewType() == CourseViewTypeEnum.FREE) {
+					List<StudentPaymentOrderDetail> instrumentDtos = studentPaymentOrderDetailDao.getWithUserAndOrderType(userId, musicGroupId, OrderDetailTypeEnum.MUSICAL);
+					//是否买过乐器
+					if(CollectionUtils.isNotEmpty(instrumentDtos)){
+						StudentPaymentOrderDetail orderMusical = instrumentDtos.get(0);
+						//如果是免费团,那么要处理乐器溢出的课程费用
+						CourseViewTypeEnum courseViewType = musicGroup.getCourseViewType();
+						StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+						Integer subjectId = studentRegistration.getActualSubjectId();
+						ChargeTypeSubjectMapper chargeType = chargeTypeSubjectMapperDao.findByViewTypeANdSubject(courseViewType,subjectId,musicGroup.getTenantId());
+						if(Objects.nonNull(chargeType) && chargeType.getFee() != null && orderMusical.getPrice().compareTo(BigDecimal.ZERO) > 0
+								&& chargeType.getFee().compareTo(orderMusical.getPrice()) < 0){
+							musicalFee = orderMusical.getPrice().subtract(chargeType.getFee());
+							distributeTotalAmount(musicGroupPaymentStudentCourseDetails,musicalFee);
+						}
+					}
+				}
+				musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetails);
+			}
+		}
+	}
+
+	public static void distributeTotalAmount(List<MusicGroupPaymentStudentCourseDetail> courseDetails, BigDecimal totalAmount) {
+		if(CollectionUtils.isEmpty(courseDetails) || BigDecimal.ZERO.compareTo(totalAmount) == 0){
+			return;
+		}
+		BigDecimal remainingAmount = totalAmount;
+		int lastIndex = courseDetails.size() - 1;
+		BigDecimal totalUnitPrice = courseDetails.stream().map(e -> e.getCourseOriginalPrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+		// 分摊总金额
+		for (int i = 0; i < lastIndex; i++) {
+			MusicGroupPaymentStudentCourseDetail courseDetail = courseDetails.get(i);
+			BigDecimal ratio = courseDetail.getCourseOriginalPrice().divide(totalUnitPrice, 10, BigDecimal.ROUND_HALF_UP);
+			BigDecimal itemAmount = totalAmount.multiply(ratio).setScale(2, BigDecimal.ROUND_HALF_UP);
+			courseDetail.setCourseCurrentPrice(itemAmount.add(courseDetail.getCourseCurrentPrice()));
+			courseDetail.setSubCourseCurrentPrice(courseDetail.getCourseCurrentPrice());
+			remainingAmount = remainingAmount.subtract(itemAmount);
+		}
+
+		// 将剩余的金额放在最后一个Item对象中
+		MusicGroupPaymentStudentCourseDetail lastItem = courseDetails.get(lastIndex);
+		lastItem.setCourseCurrentPrice(lastItem.getCourseCurrentPrice().add(remainingAmount));
+		lastItem.setSubCourseCurrentPrice(lastItem.getCourseCurrentPrice());
+	}
+
+	@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));
+					}
+				}
+			}*/
+		}
+	}
 }

+ 10 - 46
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -168,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
@@ -410,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);
@@ -430,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);
 			}
 		}
 
@@ -2337,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);
@@ -2603,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);
 
@@ -2824,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>();
 
@@ -3755,7 +3719,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }*/
         
         //清除剩余未排课时长
-        musicGroupPaymentStudentCourseDetailDao.clearRemainCourseMinutesByMusicGroupId(musicGroupId);
+        musicGroupPaymentStudentCourseDetailService.clearRemainCourseMinutesByMusicGroupId(musicGroupId);
 
         //统计变更学员数
         groupEventSource.musicGroupStudentChangeEvent(closeMusicGroupDto.getMusicGroupId(), StudentMusicGroupStatusEnum.QUIT, null);

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

+ 26 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OperatingReportNewServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.service.impl;
 
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dao.OperatingReportCloudDao;
 import com.ym.mec.biz.dal.dao.OperatingReportNewDao;
 import com.ym.mec.biz.dal.dao.VipGroupCategoryDao;
@@ -30,6 +31,8 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 	private VipGroupCategoryDao vipGroupCategoryDao;
 	@Autowired
 	private OperatingReportCloudDao operatingReportCloudDao;
+	@Autowired
+	private CourseScheduleDao courseScheduleDao;
 
 	@Override
 	public BaseDAO<Integer, OperatingReportNew> getDAO() {
@@ -47,6 +50,7 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		String firstDayOfMonth = DateUtil.dateToString(DateUtil.getFirstDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
 		String lastDayOfMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_EXPANDED_DATE_FORMAT);
 		String currentMonth = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_YEAR_MONTH_FORMAT);
+		String currentYear = DateUtil.dateToString(DateUtil.getLastDayOfMonth(month),DateUtil.ISO_YEAR_FORMAT);
 		operatingReportNewDao.deleteByMonth(currentMonth);
 		List<OperatingReportNew> operatingList = operatingReportNewDao.initOperatingReport(currentMonth);
 		//更新团体云教练计费时间()
@@ -61,12 +65,24 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 		//服务收入
 		//导入的服务收入  (全部记录为课程收入)
 		Map<Integer, BigDecimal> collect24 = MapUtil.convertIntegerMap(operatingReportNewDao.sumImportServerOrderAmount(currentMonth));
+		//1、调整student_registration表surplus_course_fee_字段,原有逻辑是用于保存学员已缴费,但是未排课的总乐团课程费用。在课程结束后按课程预计金额分摊到课程实际收入。
+		// 现在需要新增逻辑,记录免费团溢出的乐器课费、以及云教练团溢出的课费。用于在课程结束后计算实际课费,涉及到乐团缴费项目、支付回调
+
+		//2、music_group_payment_calender_course_settings表新增字段,用于记录 云教练、乐器溢出的课程费用,在排课时用于计算预计课费、涉及到降费项目创建、报名支付回调
+
+		//3、course_schedule表新增字段 标记课程是否结算经营报表,用于年底确认经营报表收入、或者已结束调整到未开始,涉及到所有的排课、调整、合班、合课逻辑
+
+		//4、课程调整逻辑修改、已结算经营报表的课程不允许调整(需要合业务部门确认)。如果可以调整,需要在course_schedule_student_payment 表新增结算金额,用于记录已结算的金额,在下次结算时去单独计算。
+
+		//5、初始化历史云教练缴费数据,按课程数量和课费总额比例计算,已排课的初始化预计金额、已缴费的初始化实际金额、以及部分排课数据初始化
+
+		//6、云教练按月计算收入,只计算配置金额,溢出的部分分配给课程
 		//云教练赠送课程实际收入
-		Map<Integer, BigDecimal> collect1 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCourseAmount(firstDayOfMonth,lastDayOfMonth));
+//		Map<Integer, BigDecimal> collect1 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCourseAmount(firstDayOfMonth,lastDayOfMonth));
 		//亏损的云教练算到当月实际收入
-		Map<Integer, BigDecimal> collect22 = MapUtil.convertIntegerMap(operatingReportNewDao.sumLossCloudAmount(currentMonth));
+//		Map<Integer, BigDecimal> collect22 = MapUtil.convertIntegerMap(operatingReportNewDao.sumLossCloudAmount(currentMonth));
 		//付费课程实际收入
-		Map<Integer, BigDecimal> collect2 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCourseAmount(firstDayOfMonth,lastDayOfMonth));
+		Map<Integer, BigDecimal> collect2 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCourseAmount(firstDayOfMonth,lastDayOfMonth,currentYear));
 
 		//个人云教练当月收入
 		Map<Integer, BigDecimal> collect3 = MapUtil.convertIntegerMap(operatingReportNewDao.sumPersonalCloudAmount(currentMonth,firstDayOfMonth,lastDayOfMonth));
@@ -99,7 +115,7 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 
 		//课程预收
 		//云教练赠课预收
-		Map<Integer, BigDecimal> collect11 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCoursePreAmount(lastDayOfMonth));
+//		Map<Integer, BigDecimal> collect11 = MapUtil.convertIntegerMap(operatingReportNewDao.sumCloudCoursePreAmount(lastDayOfMonth));
 		//云教练赠送,未排课排课资格预收
 		//获取categoryId
 		VipGroupCategory category = vipGroupCategoryDao.getTheory();
@@ -139,14 +155,14 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 				operatingReportNew.setSaleCost(reportNew.getSaleCost());
 			}
 
-			operatingReportNew.setCourseAmount(getAmount(collect1.get(organId)));
-			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect2.get(organId))));
+			operatingReportNew.setCourseAmount(getAmount(collect2.get(organId)));
+//			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect2.get(organId))));
 			operatingReportNew.setCourseAmount(operatingReportNew.getCourseAmount().add(getAmount(collect24.get(organId))));
 
 			operatingReportNew.setCloudAmount(getAmount(collect3.get(organId)));
 			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect4.get(organId))));
 			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect5.get(organId))));
-			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect22.get(organId))));
+//			operatingReportNew.setCloudAmount(operatingReportNew.getCloudAmount().add(getAmount(collect22.get(organId))));
 
 			operatingReportNew.setMaintenanceAmount(getAmount(collect26.get(organId)));
 			operatingReportNew.setBusinessRefund(getAmount(collect6.get(organId)));
@@ -164,7 +180,7 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 					add(getAmount(collect10.get(organId))).
 					add(getAmount(collect27.get(organId))).
 					add(getAmount(collect25.get(organId))));
-			operatingReportNew.setCoursePrepaidFee(getAmount(collect11.get(organId)).add(getAmount(collect12.get(organId))).
+			operatingReportNew.setCoursePrepaidFee(getAmount(collect12.get(organId)).
 					add(getAmount(collect20.get(organId))).add(getAmount(collect21.get(organId))).add(getAmount(collect23.get(organId))));
 			operatingReportNew.setSalePrepaidFee(getAmount(collect13.get(organId)));
 			operatingReportNew.setOtherPrepaidFee(getAmount(collect14.get(organId)));
@@ -181,6 +197,8 @@ public class OperatingReportNewServiceImpl extends BaseServiceImpl<Integer, Oper
 			operatingReportNew.setQuasiDiscretionaryProfit(operatingReportNew.getTotalIncome().subtract(operatingReportNew.getTotalCost()));
 		}
 		operatingReportNewDao.batchInsert(operatingList);
+		//将本月乐团课标记为已结算
+		courseScheduleDao.makeSettlementReport(currentMonth);
 	}
 	private BigDecimal getAmount(BigDecimal amount){
 		if(amount == null){

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

@@ -0,0 +1,68 @@
+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 addActualPrice(Integer userId, String musicGroupId, BigDecimal actualPrice) {
+        StudentMusicCourseFee one = this.lambdaQuery().eq(StudentMusicCourseFee::getMusicGroupId, musicGroupId)
+                .eq(StudentMusicCourseFee::getUserId, userId).one();
+        this.baseMapper.addActualPrice(one.getId(),actualPrice);
+    }
+
+    @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);
+    }
+}
+

+ 47 - 7
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() {
@@ -137,6 +145,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         return studentPaymentOrderDetailList;
     }
 
+
     @Override
     public List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status, Integer deliveryStatus) {
         return studentPaymentOrderDetailDao.findApplyOrderSuccess(musicGroupId, status, deliveryStatus);
@@ -619,7 +628,11 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
     public void addOrderDetailTo(StudentPaymentOrder studentPaymentOrder, MusicGroup musicGroup, StudentRegistration studentRegistration) {
         //SurplusCourseFee
-        List<StudentPaymentOrderDetail> allDetails = this.findByOrderId(studentPaymentOrder.getId());
+        Integer userId = studentPaymentOrder.getUserId();
+        Long orderId = studentPaymentOrder.getId();
+        String musicGroupId = musicGroup.getId();
+        Integer tenantId = studentPaymentOrder.getTenantId();
+        List<StudentPaymentOrderDetail> allDetails = this.findByOrderId(orderId);
         BigDecimal courseFee = allDetails.stream().filter(o -> !(o.getType() == MUSICAL)
                         && !(o.getType() == VIP)
                         && !(o.getType() == PRACTICE)
@@ -632,7 +645,7 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
         
         if (studentRegistration.getTemporaryCourseFee() != null) {
-            studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
+            studentRegistration.setTemporaryCourseFee(BigDecimal.ZERO);
         }
         studentRegistration.setPaymentStatus(YES);
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
@@ -644,19 +657,26 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
             studentRegistration.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(courseFee));
             //添加日志
             StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
-            studentCourseFeeDetail.setTenantId(studentPaymentOrder.getTenantId());
+            studentCourseFeeDetail.setTenantId(tenantId);
             studentCourseFeeDetail.setStudentRegistrationId(studentRegistration.getId());
             studentCourseFeeDetail.setAmount(courseFee);
             studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee());
             studentCourseFeeDetail.setMemo("乐团缴费充值");
-            studentCourseFeeDetail.setOperator(studentPaymentOrder.getUserId());
+            studentCourseFeeDetail.setOperator(userId);
             studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
+            //记录用户实际课费
+//            studentMusicCourseFeeService.addActualPrice(userId,musicGroupId,courseFee);
         }
+        List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
+        //学生云教练处理
+        if (detailTypeEnums.contains(CLOUD_TEACHER) && studentPaymentOrder.getType() == OrderTypeEnum.APPLY) {
+            studentRegistration.setHasCloudTeacher(1);
+        }
+        studentRegistrationDao.update(studentRegistration);
 
         //缴费项目详情
-        musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder, studentRegistration);
+        MusicGroupPaymentCalenderDetail paymentCalenderDetail = musicGroupPaymentCalenderDetailService.addCalenderDetail(studentPaymentOrder);
 
-        List<OrderDetailTypeEnum> detailTypeEnums = allDetails.stream().map(StudentPaymentOrderDetail::getType).collect(Collectors.toList());
         //销售订单详情
         if (allDetails.size() > 0 && (detailTypeEnums.contains(MUSICAL) || detailTypeEnums.contains(ACCESSORIES) || detailTypeEnums.contains(TEACHING))) {
             BigDecimal couponRemitFee = studentPaymentOrder.getCouponRemitFee();
@@ -703,13 +723,33 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
         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){
+                    BigDecimal subtract = calenderMember.getActualAmount().subtract(courseIncome);
+                    //累加充值金额
+                    studentRegistrationDao.updateCourseFee(studentRegistration.getId(),subtract);
+                    //添加日志
+                    StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
+                    studentCourseFeeDetail.setTenantId(tenantId);
+                    studentCourseFeeDetail.setStudentRegistrationId(studentRegistration.getId());
+                    studentCourseFeeDetail.setAmount(subtract);
+                    studentCourseFeeDetail.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(subtract));
+                    studentCourseFeeDetail.setMemo("会员团,购买云教练赠送课费");
+                    studentCourseFeeDetail.setOperator(userId);
+                    studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
+                }
             }
             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);
         }
-        studentRegistrationDao.update(studentRegistration);
     }
 
     @Override

+ 110 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
@@ -119,6 +120,10 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     private TenantConfigService tenantConfigService;
     @Autowired
     private GoodsProcurementDao goodsProcurementDao;
+    @Autowired
+    private SysPaymentConfigService sysPaymentConfigService;
+    @Autowired
+    private SellOrderDao sellOrderDao;
 
     @Lazy
     @Autowired
@@ -1318,6 +1323,111 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             } catch (Exception e) {
                 logger.error("产品协议生成失败", e);
             }
+            Long paymentOrderId = studentPaymentOrder.getId();
+            Integer organId = studentPaymentOrder.getOrganId();
+            String transNo = studentPaymentOrder.getTransNo();
+            String orderNo = studentPaymentOrder.getOrderNo();
+            BigDecimal balancePaymentAmount = studentPaymentOrder.getBalancePaymentAmount();
+            //解析student_goods_sell字段goodsJson,生成订单详情和sellOrder
+            StudentGoodsSellDto studentGoodsSellDto = studentGoodsSellDao.getStudentGoodsSellDto(studentPaymentOrder.getOrderNo());
+            if(Objects.nonNull(studentGoodsSellDto)){
+                if(StringUtils.isNotEmpty(studentGoodsSellDto.getGoodsJson())){
+                    JSONObject jsonObject = JSON.parseObject(studentGoodsSellDto.getGoodsJson());
+                    String orderItemList = jsonObject.getString("orderItemList");
+                    if(StringUtils.isNotEmpty(orderItemList)){
+                        List<GoodsOrderItemVO> goodsOrderItemVOS = JSON.parseArray(orderItemList, GoodsOrderItemVO.class);
+                        long count = goodsOrderItemVOS.stream().filter(e -> StringUtils.isEmpty(e.getOrderSn())).count();
+                        //如果有空的商品货号,不处理
+                        if(count == 0l){
+                            List<String> productSns = goodsOrderItemVOS.stream().map(e -> e.getProductSn()).distinct().collect(Collectors.toList());
+                            List<Goods> goodsList = goodsDao.findBySns(productSns);
+                            //如果有不匹配的商品货号,不处理
+                            if(CollectionUtils.isEmpty(goodsList) || goodsList.size() < productSns.size()){
+                                return;
+                            }
+                            Map<String, Goods> goodsSnMap = goodsList.stream().collect(Collectors.groupingBy(e -> e.getSn(),
+                                    Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0))));
+                            List<StudentPaymentOrderDetail> orderDetails = new ArrayList<>();
+                            List<SellOrder> sellOrders = new ArrayList<>();
+                            BigDecimal subjectBalance = balancePaymentAmount;
+                            for (int i = 0; i < goodsOrderItemVOS.size(); i++) {
+                                GoodsOrderItemVO goodsVo = goodsOrderItemVOS.get(i);
+                                Goods goods = goodsSnMap.get(goodsVo.getProductSn());
+                                for (int j = 0; j < goodsVo.getProductQuantity(); j++) {
+                                    StudentPaymentOrderDetail detail = new StudentPaymentOrderDetail();
+                                    detail.setType(OrderDetailTypeEnum.valueOf(goods.getType() == GoodsType.INSTRUMENT?"MUSICAL":goods.getType().getCode()));
+                                    detail.setGoodsIdList(goods.getId().toString());
+                                    detail.setPrice(goodsVo.getRealAmount());
+                                    detail.setRemitFee(BigDecimal.ZERO);
+                                    detail.setPaymentOrderId(paymentOrderId);
+                                    orderDetails.add(detail);
+                                }
+
+                                BigDecimal totalAmount = goodsVo.getRealAmount().multiply(new BigDecimal(goodsVo.getProductQuantity()));
+                                SellOrder sellOrder = new SellOrder();
+                                sellOrder.setOrganId(organId);
+                                sellOrder.setTransNo(transNo);
+                                sellOrder.setOrderId(paymentOrderId);
+                                sellOrder.setOrderNo(orderNo);
+                                sellOrder.setExpectAmount(goodsVo.getRealAmount());
+                                if(goodsOrderItemVOS.size() - 1 == i){
+                                    sellOrder.setBalanceAmount(subjectBalance);
+                                }else {
+                                    //获取比例
+                                    BigDecimal ratioAmount = totalAmount.divide(studentGoodsSellDto.getExpectAmount(), 6, BigDecimal.ROUND_HALF_UP);
+                                    BigDecimal multiply = balancePaymentAmount.multiply(ratioAmount).setScale(2, BigDecimal.ROUND_HALF_UP);
+                                    subjectBalance = subjectBalance.subtract(multiply);
+                                    sellOrder.setBalanceAmount(multiply);
+                                }
+                                sellOrder.setActualAmount(totalAmount.subtract(sellOrder.getBalanceAmount()));
+
+                                AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(studentPaymentOrder.getPaymentChannel()), studentPaymentOrder.getMerNos(), studentPaymentOrder.getTenantId());
+                                GoodsProcurement goodsProcurement = null;
+                                if(StockType.INTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.INTERNAL.equals(accountType))){
+                                    goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                                    if(Objects.nonNull(goodsProcurement)){
+                                        goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).incrementAndGet());
+                                    }
+                                }else if(StockType.EXTERNAL.equals(goods.getStockType())||(StockType.ALL.equals(goods.getStockType())&&AccountType.EXTERNAL.equals(accountType))){
+                                    goodsProcurement = goodsProcurementDao.getWithTaxStockSurplusProcurement(goods.getId());
+                                    if(Objects.nonNull(goodsProcurement)){
+                                        goodsProcurement.setTaxStockSoldNum(new AtomicInteger(goodsProcurement.getTaxStockSoldNum()).incrementAndGet());
+                                    }
+                                }
+
+                                //如果有采购清单,初始化总部成本价
+                                if(Objects.nonNull(goodsProcurement)){
+                                    goodsProcurementDao.update(goodsProcurement);
+                                    sellOrder.setBatchNo(goodsProcurement.getBatchNo());
+                                    sellOrder.setSellCost(goodsProcurement.getDiscountPrice());
+                                    Map<String, BigDecimal> CostMap = new HashMap<>();
+                                    CostMap.put("sellCost", goodsProcurement.getDiscountPrice());
+                                    if (Objects.nonNull(goodsProcurement.getAgreeCostPrice())) {
+                                        CostMap.put("SellCost2", goodsProcurement.getAgreeCostPrice());
+                                    }
+                                    sellOrder.setSellCost2(JSON.toJSONString(CostMap));
+                                    sellOrder.setBatchNo(goodsProcurement.getBatchNo());
+                                    sellOrder.setOrganSellCost(goods.getOrganCostPrice());
+                                }
+                                sellOrder.setNum(goodsVo.getProductQuantity());
+                                sellOrder.setUserId(userId);
+                                sellOrder.setPaymentChannel(studentPaymentOrder.getPaymentChannel());
+                                sellOrder.setMerNo(studentPaymentOrder.getMerNos());
+                                sellOrder.setStockType(goods.getStockType());
+                                sellOrder.setAccountType(accountType);
+                                sellOrder.setStatus(SellStatus.NORMAL);
+                                sellOrder.setSellTime(studentPaymentOrder.getPayTime());
+                                sellOrder.setGoodsId(goods.getId());
+                                sellOrder.setGoodsName(goods.getName());
+                                sellOrder.setType(SellTypeEnum.valueOf(goods.getType().getCode()));
+                                sellOrders.add(sellOrder);
+                            }
+                            sellOrderDao.batchInsert(sellOrders);
+                            studentPaymentOrderDetailService.batchAdd(orderDetails);
+                        }
+                    }
+                }
+            }
             // 完全余额支付 不生成下面的记录
             if (BigDecimal.ZERO.compareTo(studentPaymentOrder.getActualAmount()) == 0) return;
 

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

@@ -321,7 +321,6 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
                     for (MusicGroupPaymentCalenderDetail calenderDetail : calenderDetails) {
                         calenderDetail.setPaymentStatus(MusicGroupStudentFee.PaymentStatus.PAID_COMPLETED);
                         calenderDetail.setPayTime(nowDate);
-                        calenderDetail.setUpdateTime(nowDate);
                     }
                     if (calenderDetails.size() > 0) {
                         musicGroupPaymentCalenderDetailDao.batchUpdate(calenderDetails);

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

@@ -105,7 +105,7 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 				// 批量新增
 				teacherDefaultMusicGroupSalaryDao.batchAdd(salaries);
 
-				String typeList = salaryMap.keySet().stream().map(e -> e.getCode()).collect(Collectors.joining(","));
+				/*String typeList = salaryMap.keySet().stream().map(e -> e.getCode()).collect(Collectors.joining(","));
 				// 查询所有需要修改的课酬
 				List<CourseScheduleTeacherSalary> updateTeacherSalaryList = courseScheduleTeacherSalaryDao.queryUserNoSettlementListByTypeAndStartClassDate(
 						userId, typeList, startDate);
@@ -169,10 +169,10 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 											ts.setExpectSalary(duration.divide(new BigDecimal(mins), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(tdms.getAssistantTeacher90MinSalary()));
 										}
 									}
-									/*if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
+									if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
 										int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(ts.getCourseScheduleId());
 										ts.setExpectSalary(ts.getExpectSalary().multiply(new BigDecimal(studentNum)));
-									}*/
+									}
 									list.add(ts);
 								} else if (musicGroup.getSettlementType() == SalarySettlementTypeEnum.TEACHER_DEFAULT) {// 默认课酬
 									mins = 30;
@@ -191,10 +191,10 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 											ts.setExpectSalary(duration.divide(minsDecimal, CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(tdms.getAssistantTeacher30MinSalary()));
 										}
 									}
-									/*if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
+									if(CourseScheduleType.HIGH.equals(tdms.getCourseScheduleType())){
 										int studentNum = courseScheduleStudentPaymentDao.countCourseOnlyStudentNum(ts.getCourseScheduleId());
 										ts.setExpectSalary(ts.getExpectSalary().multiply(new BigDecimal(studentNum)));
-									}*/
+									}
 									list.add(ts);
 								}
 								if(ts.getExpectSalary() == null){
@@ -206,7 +206,7 @@ public class TeacherDefaultMusicGroupSalaryServiceImpl extends BaseServiceImpl<L
 					if (list.size() > 0) {
 						courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(list);
 					}
-				}
+				}*/
 			}
 		}
 	}

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

@@ -72,7 +72,7 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 			if(startDate != null){
 				//更新课酬
 
-				String typeList = CourseScheduleType.PRACTICE.getCode();
+				/*String typeList = CourseScheduleType.PRACTICE.getCode();
 				// 查询所有需要修改的课酬
 				List<CourseScheduleTeacherSalary> updateTeacherSalaryList = courseScheduleTeacherSalaryDao.queryUserNoSettlementListByTypeAndStartClassDate(
 						userId, typeList, startDate);
@@ -104,7 +104,7 @@ public class TeacherDefaultPracticeGroupSalaryServiceImpl extends BaseServiceImp
 					if (list.size() > 0) {
 						courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(list);
 					}
-				}
+				}*/
 			}
 			
 			return true;

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

@@ -117,7 +117,7 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 				// 新增
 				teacherDefaultVipGroupSalaryDao.batchAdd(teacherDefaultVipGroupSalaries);
 
-				String typeList = CourseScheduleType.VIP.getCode();
+				/*String typeList = CourseScheduleType.VIP.getCode();
 				// 查询所有需要修改的课酬
 				List<CourseScheduleTeacherSalary> updateTeacherSalaryList = courseScheduleTeacherSalaryDao.queryUserNoSettlementListByTypeAndStartClassDate(
 						userId, typeList, startDate);
@@ -186,7 +186,7 @@ public class TeacherDefaultVipGroupSalaryServiceImpl extends BaseServiceImpl<Lon
 					if (list.size() > 0) {
 						courseScheduleTeacherSalaryDao.batchUpdateTeacherExpectSalarys(list);
 					}
-				}
+				}*/
 			}
 		}
 	}

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

@@ -240,7 +240,7 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
             tempUserTrainingTimeDetailVo.setUserId(userId);
             tempUserTrainingTimeDetailVo.setTrainingDate(DateUtil.toDate(generateDate.toString()));
             tempUserTrainingTimeDetailVo.setPlayTime(BigDecimal.ZERO);
-            tempUserTrainingTimeDetailVo.setIsFinish(0);
+            tempUserTrainingTimeDetailVo.setIsFinish(-1);
             tempUserTrainingTimeDetailVo.setSignStandard(camp.getSignStandard());
             tempUserTrainingTimeDetailVo.setStandardDays(camp.getStandardDays());
             resultList.add(tempUserTrainingTimeDetailVo);
@@ -260,6 +260,7 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
                 BigDecimal t = nowTrainingTime.get(s);
                 if (Objects.nonNull(t)) {
                     vo.setPlayTime(t);
+                    vo.setIsFinish(0);
                     //大于1200秒
                     if (t.intValue() > camp.getSignStandard() * 60) {
                         vo.setIsFinish(1);
@@ -284,7 +285,7 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         //训练营详情-查询条件时间设置
         queryUserTrainingDetailOpsParam(param);
         Page<TempCampUserTrainingDetailVo> page = PageUtil.getPageInfo(param);
-        page.setDesc("t.playDay");
+        page.setDesc("t.playDay,t.id");
         IPage<TempCampUserTrainingDetailVo> vos = baseMapper.queryUserTrainingDetailV2(page, param);
         List<TempCampUserTrainingDetailVo> records = vos.getRecords();
         if(CollectionUtils.isNotEmpty(records)){

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -4257,6 +4257,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         		vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
                 vipGroup.setUpdateTime(now);
                 vipGroup.setStopReason("没有学员");
+                
+                // 删除课表
+                courseScheduleDao.deleteCourseSchedulesByMusicGroupID(vipGroup.getId() + "", GroupType.VIP);
+                courseScheduleTeacherSalaryDao.deleteByMusicGroupId(vipGroup.getId() + "", GroupType.VIP);
+
+                //删除考勤
+                teacherAttendanceDao.deleteByMusicGroupId(vipGroup.getId() + "", GroupType.VIP);
         	}
             vipGroupDao.batchUpdate(vipGroupList);
             

+ 5 - 0
mec-biz/src/main/resources/config/mybatis/ChargeTypeSubjectMapperMapper.xml

@@ -168,4 +168,9 @@
         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>

+ 14 - 9
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -43,6 +43,7 @@
         <result column="tenant_id_" property="tenantId"/>
         <result column="evaluate_flag_" property="evaluateFlag"/>
         <result column="convert_flag_" property="convertFlag"/>
+        <result column="settlement_report_flag_" property="settlementReportFlag"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
@@ -214,14 +215,14 @@
             keyProperty="id">
         INSERT INTO course_schedule
         (id_,group_type_,music_group_id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,
-        teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_,teach_mode_,student_num_,leave_student_num_,
+        teacher_id_,actual_teacher_id_,type_,name_,teach_mode_,student_num_,leave_student_num_,
         schoole_id_,is_lock_,note_,teaching_content_,organ_id_,member_flag_,pre_course_flag_,valid_end_time_,valid_start_time_,tenant_id_)
         VALUE
         <foreach collection="list" item="course" separator=",">
             (#{course.id},#{course.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.musicGroupId},
             #{course.classGroupId},#{course.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{course.subsidy},#{course.classDate},#{course.startClassTime},#{course.endClassTime},#{course.teacherId},
-            #{course.teacherId},now(),now(),#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            #{course.teacherId},#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{course.name},#{course.teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.studentNum},
             #{course.leaveStudentNum},#{course.schoolId},#{course.isLock},#{course.note},#{course.teachingContent},
             #{course.organId},#{course.memberFlag},#{course.preCourseFlag},#{course.validEndTime},#{course.validStartTime},#{course.tenantId})
@@ -232,14 +233,14 @@
             keyProperty="id">
         INSERT INTO course_schedule
         (id_,group_type_,music_group_id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,
-        teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_,teach_mode_,student_num_,leave_student_num_,
+        teacher_id_,actual_teacher_id_,type_,name_,teach_mode_,student_num_,leave_student_num_,
         schoole_id_,is_lock_,note_,teaching_content_,organ_id_,member_flag_,pre_course_flag_,valid_end_time_,valid_start_time_,tenant_id_)
         VALUE
         <foreach collection="list" item="course" separator=",">
             (#{course.id},#{course.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.musicGroupId},
             #{course.classGroupId},#{course.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{course.subsidy},#{course.classDate},#{course.startClassTime},#{course.endClassTime},#{course.teacherId},
-            #{course.actualTeacherId},now(),now(),#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            #{course.actualTeacherId},#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{course.name},#{course.teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.studentNum},
             #{course.leaveStudentNum},#{course.schoolId},#{course.isLock},#{course.note},#{course.teachingContent},
             #{course.organId},#{course.memberFlag},#{course.preCourseFlag},#{course.validEndTime},#{course.validStartTime},#{course.tenantId})
@@ -322,7 +323,6 @@
             <if test="isLock != null">
                 is_lock_ = #{isLock},
             </if>
-            update_time_ = NOW()
         </set>
         WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
@@ -346,8 +346,7 @@
 
     <update id="logicDeleteCourseSchedulesByMusicGroupID">
         update course_schedule
-        set del_flag_    = '1',
-            update_time_ = NOW()
+        set del_flag_    = '1'
         WHERE music_group_id_ = #{musicGroupID}
           AND group_type_ = 'MUSIC'
           and status_ = 'NOT_START'
@@ -355,8 +354,7 @@
 
     <update id="resumeCourseScheduleByMusicGroupId">
         update course_schedule
-        set del_flag_    = '0',
-            update_time_ = NOW()
+        set del_flag_    = '0'
         WHERE music_group_id_ = #{musicGroupID}
           AND group_type_ = 'MUSIC'
           and status_ = 'NOT_START'
@@ -3224,6 +3222,9 @@
     <update id="batchUpdateDelFlag">
         UPDATE course_schedule SET del_flag_ = 0,update_time_ = NOW() WHERE FIND_IN_SET(id_,#{courseIds})
     </update>
+    <update id="makeSettlementReport">
+        update course_schedule set settlement_report_flag_ = 1 where DATE_FORMAT(class_date_,'%Y-%m') = #{currentMonth}
+    </update>
 
     <select id="getStudentCourseScheduleNum" resultMap="com.ym.mec.biz.dal.dao.PracticeGroupDao.courseGroupExport">
         SELECT COUNT(*) total_class_times_,cssp.user_id_ student_id_
@@ -4124,4 +4125,8 @@
     <select id="queryStartedCourseMusicGroupIdList" resultType="java.lang.String">
 		select distinct cs.music_group_id_ from course_schedule cs where cs.group_type_ = #{groupType} and cs.status_ = 'OVER'
     </select>
+
+    <select id="checkCourseIsSettlementReport" resultType="int">
+        SELECT COUNT(*) FROM course_schedule where settlement_report_flag_ = 1 and id_ = #{courseScheduleId}
+    </select>
 </mapper>

+ 18 - 4
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -22,6 +22,7 @@
         <result column="discount_price_" property="discountPrice"/>
         <result column="group_purchase_price_" property="groupPurchasePrice"/>
         <result column="agree_cost_price_" property="agreeCostPrice"/>
+        <result column="organ_cost_price_" property="organCostPrice"/>
         <result column="brief_" property="brief"/>
         <result column="desc_" property="desc"/>
         <result column="is_new_" property="isNew" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
@@ -73,20 +74,23 @@
         (goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,tax_stock_count_,sell_count_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,is_new_,is_top_,status_,memo_,publish_time_,
         complement_goods_id_list_,update_time_,create_time_,type_,agree_cost_price_,stock_warning_,stock_type_
-            ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_)
+            ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,
+         member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_)
         VALUES(#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{taxStockCount},#{sellCount},#{marketPrice},
         #{discountPrice},#{groupPurchasePrice},#{brief},#{desc},
         #{isNew,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{isTop,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{memo},#{publishTime},#{complementGoodsIdList},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{agreeCostPrice},
         #{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},#{memberFeeShowOrganId},#{freeFeeShowOrganId},#{tenantId})
+        #{studentShowOrganId},#{educationShowOrganId},#{replacementShowOrganId},#{courseFeeShowOrganId},
+               #{memberFeeShowOrganId},#{freeFeeShowOrganId},#{tenantId},#{organCostPrice})
     </insert>
     <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO goods
         (goods_category_id_,name_,brand_,specification_,image_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_,
         stock_count_,tax_stock_count_,stock_warning_,stock_type_
-        ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_)
+        ,student_show_organ_id_,education_show_organ_id_,replacement_show_organ_id_,course_fee_show_organ_id_,
+         member_fee_show_organ_id_,free_fee_show_organ_id_,tenant_id_,organ_cost_price_)
         VALUES
         <foreach collection="list" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
@@ -95,7 +99,8 @@
             #{goods.stockCount},#{goods.taxStockCount},
             #{goods.stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{goods.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},#{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},,#{goods.freeFeeShowOrganId},#{goods.tenantId}
+            #{goods.studentShowOrganId},#{goods.educationShowOrganId},#{goods.replacementShowOrganId},
+             #{goods.courseFeeShowOrganId},#{goods.memberFeeShowOrganId},#{goods.freeFeeShowOrganId},#{goods.tenantId},#{goods.organCostPrice}
             )
         </foreach>
     </insert>
@@ -112,6 +117,9 @@
             <if test="agreeCostPrice != null">
                 agree_cost_price_ = #{agreeCostPrice},
             </if>
+            <if test="organCostPrice != null">
+                organ_cost_price_ = #{organCostPrice},
+            </if>
             <if test="specification != null">
                 specification_ = #{specification},
             </if>
@@ -211,6 +219,9 @@
                 <if test="goods.agreeCostPrice != null">
                     agree_cost_price_ = #{goods.agreeCostPrice},
                 </if>
+                <if test="goods.organCostPrice != null">
+                    organ_cost_price_ = #{goods.organCostPrice},
+                </if>
                 <if test="goods.specification != null">
                     specification_ = #{goods.specification},
                 </if>
@@ -537,6 +548,9 @@
         <include refid="replacementQuerySql"/>
         <include refid="global.limit"/>
     </select>
+    <select id="getOrganCostPrice" resultType="java.math.BigDecimal">
+        select SUM(organ_cost_price_) from goods where FIND_IN_SET(id_,#{complementGoodsIdList});
+    </select>
 
     <sql id="replacementQuerySql">
         <where>

+ 28 - 0
mec-biz/src/main/resources/config/mybatis/HumanCostMapper.xml

@@ -0,0 +1,28 @@
+<?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.HumanCostDao">
+  <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.HumanCost">
+                         <result column="id_" jdbcType="INTEGER" property="id"/>
+                                  <result column="organ_id_" jdbcType="INTEGER" property="organId"/>
+                                  <result column="organ_name_" jdbcType="VARCHAR" property="organName"/>
+                                  <result column="fixed_cost_" jdbcType="VARCHAR" property="fixedCost"/>
+                                  <result column="change_cost_" jdbcType="VARCHAR" property="changeCost"/>
+                                  <result column="month_" jdbcType="VARCHAR" property="month"/>
+                                  <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
+                                  <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
+                </resultMap>
+  
+  <sql id="Base_Column_List">    
+                                            id_, organ_id_, organ_name_, fixed_cost_, change_cost_, month_, create_time_, update_time_
+  </sql>
+  
+   <insert id="insertBatch" keyColumn="" keyProperty="" useGeneratedKeys="true"
+            parameterType="com.ym.mec.biz.dal.entity.HumanCost">
+       insert into human_cost(id_, organ_id_, organ_name_, fixed_cost_, change_cost_, month_, create_time_, update_time_)
+       values
+       <foreach collection="entities" item="entity" separator=",">
+       (#{entity.id}, #{entity.organId}, #{entity.organName}, #{entity.fixedCost}, #{entity.changeCost}, #{entity.month}, #{entity.createTime}, #{entity.updateTime})
+       </foreach>
+   </insert>
+
+</mapper>

+ 4 - 3
mec-biz/src/main/resources/config/mybatis/ImLiveBroadcastRoomMemberMapper.xml

@@ -17,11 +17,11 @@
 
     <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
             parameterType="com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomMember">
-        insert into im_live_broadcast_room_member(tenant_id_, room_uid_, user_id_, join_time_, total_time_) values
+        insert into im_live_broadcast_room_member(tenant_id_, room_uid_, user_id_, join_time_, total_time_,online_status_,live_room_status_) values
         <foreach collection="entities" item="entity" separator=",">
-            (#{entity.tenantId}, #{entity.roomUid}, #{entity.userId}, #{entity.joinTime}, #{entity.totalTime})
+            (#{entity.tenantId}, #{entity.roomUid}, #{entity.userId}, #{entity.joinTime}, #{entity.totalTime},0,0)
         </foreach>
-        ON DUPLICATE KEY UPDATE join_time_ = VALUES(join_time_), total_time_ = VALUES(total_time_)
+        ON DUPLICATE KEY UPDATE join_time_ = VALUES(join_time_), total_time_ = VALUES(total_time_),online_status_ = 0,live_room_status_ = 0
     </insert>
 
     <select id="queryMemberPage" resultType="com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomMemberVo">
@@ -63,6 +63,7 @@
             and a.whether_mic_status_ = #{param.whetherMicStatus}
         </if>
         group by a.user_id_
+        ORDER BY a.join_time_
     </select>
 
     <update id="updateOnlineStatus">

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

@@ -25,7 +25,7 @@
 		<result column="current_year_fee_" property="currentYearFee" />
 		<result column="group_purchase_year_fee_" property="groupPurchaseYearFee" />
 		<result column="original_year_fee_" property="originalYearFee" />
-		<result column="income_year_fee" property="incomeYearFee" />
+		<result column="income_year_fee_" property="incomeYearFee" />
 		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 

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

@@ -115,7 +115,13 @@
     </delete>
 
     <select id="queryByMusicGroupOrganizationCourseSettingsId" resultMap="MusicGroupOrganizationCourseSettingsDetail">
-        SELECT * FROM music_group_organization_course_settings_detail
-        where music_group_organization_course_settings_id_ = #{musicGroupOrganizationCourseSettingsId}
+        SELECT mgocsd.id_, mgocsd.music_group_organization_course_settings_id_, mgocsd.course_type_, mgocsd.course_total_minuties_,
+               mgocsd.course_original_price_, mgocsd.course_current_price_, mgocsd.is_student_optional_, mgocsd.create_time_,
+               mgocsd.update_time_, mgocsd.tenant_id_,ocups.unit_price_ FROM music_group_organization_course_settings_detail mgocsd
+                                                                                 left join music_group_organization_course_settings mgocs ON mgocsd.music_group_organization_course_settings_id_ = mgocs.id_
+                                                                                 left join organization_course_unit_price_settings ocups ON ocups.course_view_type_ = mgocs.course_view_type_ AND ocups.course_type_ = mgocsd.course_type_
+        where mgocsd.music_group_organization_course_settings_id_ = #{musicGroupOrganizationCourseSettingsId}
+          AND ocups.course_view_type_ = mgocs.course_view_type_ AND ocups.course_type_ = mgocsd.course_type_ AND mgocsd.music_group_organization_course_settings_id_ = mgocs.id_
+          AND mgocs.organ_id_ = ocups.organ_id_
     </select>
 </mapper>

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

@@ -14,6 +14,7 @@
 		<result column="unit_price_" property="unitPrice" />
 		<result column="course_original_price_" property="courseOriginalPrice" />
 		<result column="course_current_price_" property="courseCurrentPrice" />
+		<result column="overflow_course_price_" property="overflowCoursePrice" />
 		<result column="is_student_optional_" property="isStudentOptional" />
 		<result column="name_" property="name" />
 		<result column="create_time_" property="createTime" />
@@ -37,21 +38,21 @@
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO music_group_payment_calender_course_settings
 		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,
-		course_current_price_,is_student_optional_,create_time_,update_time_,name_,tenant_id_)
+		course_current_price_,is_student_optional_,name_,tenant_id_,overflow_course_price_)
 		VALUES(#{musicGroupPaymentCalenderId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{courseTotalMinuties},
-		#{unitPrice},#{courseOriginalPrice},#{courseCurrentPrice},#{isStudentOptional},#{createTime},#{updateTime},#{name},#{tenantId})
+		#{unitPrice},#{courseOriginalPrice},#{courseCurrentPrice},#{isStudentOptional},#{name},#{tenantId},#{overflowCoursePrice})
 	</insert>
 	
 	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
 		INSERT INTO music_group_payment_calender_course_settings
 		(music_group_payment_calender_id_,course_type_,course_total_minuties_,unit_price_,course_original_price_,
-		course_current_price_,is_student_optional_,create_time_,update_time_,name_,tenant_id_)
+		course_current_price_,is_student_optional_,name_,tenant_id_,overflow_course_price_)
 		VALUES
 		<foreach collection="list" item="item" separator=",">
 		(#{item.musicGroupPaymentCalenderId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 		#{item.courseTotalMinuties},#{item.unitPrice},#{item.courseOriginalPrice},#{item.courseCurrentPrice},
-		#{item.isStudentOptional},NOW(),NOW(),#{item.name},#{item.tenantId})
+		#{item.isStudentOptional},#{item.name},#{item.tenantId},#{item.overflowCoursePrice})
 		</foreach>
 	</insert>
 
@@ -60,6 +61,9 @@
 		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings">
 		UPDATE music_group_payment_calender_course_settings
 		<set>
+			<if test="overflowCoursePrice != null and overflowCoursePrice != ''">
+				overflow_course_price_ = #{overflowCoursePrice},
+			</if>
 			<if test="name != null and name != ''">
 				name_ = #{name},
 			</if>
@@ -84,7 +88,6 @@
 			<if test="courseTotalMinuties != null">
 				course_total_minuties_ = #{courseTotalMinuties},
 			</if>
-				update_time_ = NOW()
 		</set>
 		WHERE id_ = #{id} and tenant_id_ = #{tenantId}
 	</update>

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

+ 6 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMemberMapper.xml

@@ -16,6 +16,7 @@
 		<result column="optional_flag_" property="optionalFlag" />
 		<result column="actual_amount_" property="actualAmount" />
 		<result column="original_amount_" property="originalAmount" />
+		<result column="income_" property="income" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
         <result column="tenant_id_" property="tenantId"/>
@@ -35,9 +36,9 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderMember" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO music_group_payment_calender_member (calender_id_,name_,num_,period_,
-		member_rank_setting_id_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_,tenant_id_,auto_activation_flag_)
+		member_rank_setting_id_,optional_flag_,actual_amount_,original_amount_,create_time_,update_time_,tenant_id_,auto_activation_flag_,income_)
 		VALUES(#{calenderId},#{name},#{num},#{period,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{memberRankSettingId},#{optionalFlag},#{actualAmount},
-		       #{originalAmount},NOW(),NOW(),#{tenantId},#{autoActivationFlag})
+		       #{originalAmount},NOW(),NOW(),#{tenantId},#{autoActivationFlag},#{income})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -67,6 +68,9 @@
 		<if test="originalAmount != null">
 		original_amount_ = #{originalAmount},
 		</if>
+		<if test="income != null">
+			income_ = #{income},
+		</if>
 		<if test="name != null">
 		name_ = #{name},
 		</if>

+ 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 - 7
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">
@@ -67,7 +61,6 @@
 	</update>
     <update id="settlementCalender">
 		UPDATE operating_report_cloud orc
-		LEFT JOIN cloud_teacher_free_course ctf ON ctf.calender_id_ = orc.calender_id_
 		SET orc.settlement_flag_ = 1
 		WHERE orc.month_flag_ = 0 AND orc.settlement_flag_ = 0 AND DATE_FORMAT(orc.start_date_,'%Y-%m') = #{month};
 	</update>

+ 6 - 17
mec-biz/src/main/resources/config/mybatis/OperatingReportNewMapper.xml

@@ -129,8 +129,9 @@
 		update operating_report_cloud orc
 		left join (
 		select orc.calender_id_,MIN(cs.class_date_) start_date_ from operating_report_cloud orc
-		LEFT JOIN cloud_teacher_free_course ctf ON ctf.calender_id_ = orc.calender_id_
-		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
+		left join music_group_payment_calender mgpc ON mgpc.id_ = orc.calender_id_
+		left join course_schedule_student_payment cssp ON cssp.batch_no_ = mgpc.batch_no_
+		left join course_schedule cs ON cs.id_ = cssp.course_schedule_id_
 		where orc.month_flag_ = false AND orc.settlement_flag_ = false AND orc.start_date_ IS NULL
 		AND cs.class_date_ &lt;= #{lastDay}
 		group by orc.calender_id_) mc ON orc.calender_id_ = mc.calender_id_
@@ -186,24 +187,19 @@
 		      (DATE_FORMAT(spo.pay_time_,'%Y-%m') = #{month} AND (mg.musical_instruments_provide_status_ IS NULL OR mg.musical_instruments_provide_status_ = 1))
 		group by so.organ_id_
 	</select>
-	<select id="sumCloudCourseAmount" resultType="java.util.Map">
-		SELECT cs.organ_id_ 'key',SUM(ctf.cost_) 'value' FROM cloud_teacher_free_course ctf
-		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
-		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
-		AND cs.class_date_ BETWEEN #{firstDay} AND #{lastDay} group by cs.organ_id_;
-	</select>
 	<select id="sumCourseAmount" resultType="java.util.Map">
 		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
 		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
 		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0 AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
-		AND cssp.actual_price_ > 0 AND cs.class_date_ BETWEEN #{firstDay} AND #{lastDay} group by cs.organ_id_;
+		AND cssp.actual_price_ > 0 AND cs.class_date_ BETWEEN #{firstDay} AND #{lastDay}
+		AND DATE_FORMAT(cs.create_time_,'%Y') = #{currentYear} AND cs.settlement_report_flag_ = 0 group by cs.organ_id_;
 	</select>
 	<select id="sumPersonalCloudAmount" resultType="java.util.Map">
 		select cto.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / (TIMESTAMPDIFF(DAY,cto.start_time_,cto.end_time_) + 1) *
 		(TIMESTAMPDIFF(DAY,CASE WHEN start_time_ &lt; #{firstDay} THEN #{firstDay} ELSE DATE_FORMAT(start_time_,'%Y-%m-%d') END,
 		CASE WHEN DATE_FORMAT(end_time_,'%Y-%m') > #{month} THEN #{lastDay} ELSE DATE_FORMAT(end_time_,'%Y-%m-%d') END) + 1)),2) 'value'
 		from cloud_teacher_order cto
-		where operating_amount_ > 0 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m')
+		where operating_amount_ > 0 AND #{month} BETWEEN DATE_FORMAT(start_time_,'%Y-%m') AND cto.settlement_report_flag_ = 0 AND cto.status_ = 2
 		AND DATE_FORMAT(end_time_,'%Y-%m') group by cto.organ_id_;
 	</select>
 	<select id="sumGroupCloudAmount" resultType="java.util.Map">
@@ -240,13 +236,6 @@
 		from operating_report_cloud orc
 		where orc.cloud_price_ > 0 AND orc.month_flag_ = true AND DATE_FORMAT(orc.create_time_,'%Y-%m') = #{month} group by orc.organ_id_;
 	</select>
-	<select id="sumCloudCoursePreAmount" resultType="java.util.Map">
-		SELECT cs.organ_id_ 'key',SUM(ctf.cost_) 'value' FROM cloud_teacher_free_course ctf
-		LEFT JOIN course_schedule cs ON cs.id_ = ctf.course_id_
-		where cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.pre_course_flag_ = 0
-		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_) AND cs.class_date_ > #{lastDay}
-		group by cs.organ_id_;
-	</select>
 	<select id="sumCoursePreAmount" resultType="java.util.Map">
 		SELECT cs.organ_id_ 'key',SUM(cssp.actual_price_) 'value' FROM course_schedule cs
 		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_

+ 13 - 5
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -23,6 +23,7 @@
         <result column="goods_id_" property="goodsId"/>
         <result column="goods_name_" property="goodsName"/>
         <result column="sell_cost_" property="sellCost"/>
+        <result column="organ_sell_cost_" property="organSellCost"/>
         <result column="sell_cost2_" property="sellCost2"/>
         <result column="num_" property="num"/>
         <result column="user_id_" property="userId"/>
@@ -49,7 +50,7 @@
         actual_amount_,balance_amount_, sell_cost_, sell_cost2_, type_,parent_goods_id_, goods_id_,goods_name_, num_,
         user_id_,
         payment_channel_,mer_no_,batch_no_,stock_type_,account_type_,status_, refund_time_,sell_time_, create_ime_,
-        update_time_,coupon_remit_amount_
+        update_time_,coupon_remit_amount_,organ_sell_cost_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SellOrder">
         <!--@mbg.generated-->
@@ -69,13 +70,14 @@
         insert into sell_order (edu_teacher_id_,organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_,
         expect_amount_,actual_amount_,balance_amount_, type_,parent_goods_id_, goods_id_,goods_name_, sell_cost_,
         sell_cost2_, num_, user_id_, payment_channel_,
-        mer_no_,batch_no_,stock_type_,account_type_, refund_time_,sell_time_, create_ime_, update_time_,coupon_remit_amount_,tenant_id_)
+        mer_no_,batch_no_,stock_type_,account_type_, refund_time_,sell_time_,
+        create_ime_, update_time_,coupon_remit_amount_,tenant_id_,organ_sell_cost_)
         values (#{eduTeacherId},#{organId}, #{cooperationOrganId}, #{transNo}, #{orderNo},#{orderId}, #{expectAmount},
         #{actualAmount}, #{balanceAmount}, #{type},#{parentGoodsId}, #{goodsId}, #{goodsName}, #{sellCost},
         #{sellCost2}, #{num}, #{userId},
         #{paymentChannel}, #{merNo},#{batchNo},
         #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{accountType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{refundTime},#{sellTime}, #{createIme}, #{updateTime}, #{couponRemitAmount},#{tenantId})
+        #{refundTime},#{sellTime}, #{createIme}, #{updateTime}, #{couponRemitAmount},#{tenantId},#{organSellCost})
     </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.SellOrder">
         <!--@mbg.generated-->
@@ -126,6 +128,9 @@
             <if test="sellCost != null">
                 sell_cost_ = #{sellCost},
             </if>
+            <if test="organSellCost != null">
+                organ_sell_cost_ = #{organSellCost},
+            </if>
             <if test="sellCost2 != null">
                 sell_cost2_ = #{sellCost2},
             </if>
@@ -215,6 +220,9 @@
                 <if test="sellOrder.sellCost != null">
                     sell_cost_ = #{sellOrder.sellCost},
                 </if>
+                <if test="sellOrder.organSellCost != null">
+                    organ_sell_cost_ = #{sellOrder.organSellCost},
+                </if>
                 <if test="sellOrder.sellCost2 != null">
                     sell_cost2_ = #{sellOrder.sellCost2},
                 </if>
@@ -261,7 +269,7 @@
         insert into sell_order (organ_id_, cooperation_organ_id_, trans_no_,order_id_, order_no_, expect_amount_,
         actual_amount_,balance_amount_, type_, parent_goods_id_, goods_id_,goods_name_, sell_cost_, sell_cost2_, num_,
         user_id_, payment_channel_,
-        mer_no_,batch_no_,stock_type_,account_type_, sell_time_,edu_teacher_id_, create_ime_, update_time_,coupon_remit_amount_,tenant_id_)
+        mer_no_,batch_no_,stock_type_,account_type_, sell_time_,edu_teacher_id_, create_ime_, update_time_,coupon_remit_amount_,tenant_id_,organ_sell_cost_)
         VALUE
         <foreach collection="sellOrders" separator="," item="sellOrder">
             (#{sellOrder.organId},#{sellOrder.cooperationOrganId},#{sellOrder.transNo},#{sellOrder.orderId},#{sellOrder.orderNo},
@@ -269,7 +277,7 @@
             #{sellOrder.goodsName},#{sellOrder.sellCost},#{sellOrder.sellCost2},#{sellOrder.num},#{sellOrder.userId},
             #{sellOrder.paymentChannel},#{sellOrder.merNo},#{sellOrder.batchNo},
             #{sellOrder.stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{sellOrder.accountType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-            #{sellOrder.sellTime},#{sellOrder.eduTeacherId},NOW(),NOW(),#{sellOrder.couponRemitAmount},#{sellOrder.tenantId})
+            #{sellOrder.sellTime},#{sellOrder.eduTeacherId},NOW(),NOW(),#{sellOrder.couponRemitAmount},#{sellOrder.tenantId},#{sellOrder.organSellCost})
         </foreach>
     </insert>
 

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

@@ -0,0 +1,24 @@
+<?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>
+    <insert id="addActualPrice">
+        update student_music_course_fee set actual_price_ = actual_price_ + #{actualPrice} where id_ = #{id}
+    </insert>
+</mapper>

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -373,9 +373,10 @@
     <select id="getWithUserAndOrderType" resultMap="StudentPaymentOrderDetail">
         SELECT spod.* FROM student_payment_order_detail spod
         LEFT JOIN student_payment_order spo ON spo.id_=spod.payment_order_id_
-        WHERE spo.user_id_= #{userId}
-        AND spod.type_ = #{orderType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+        WHERE spo.user_id_= #{userId} AND spo.music_group_id_ = #{musicGroupId}
+        AND spod.type_ = #{orderDetailType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         AND spo.status_='SUCCESS'
+        AND spo.type_ = 'APPLY'
     </select>
 
     <select id="getOrderDetailByOrderId" resultMap="StudentPaymentOrderDetail">

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

@@ -1362,6 +1362,9 @@
             AND music_group_id_ = #{musicGroupId}
         </if>
     </update>
+    <update id="updateCourseFee">
+        UPDATE student_registration SET surplus_course_fee_ = surplus_course_fee_ + #{musicalFee} WHERE id_ = #{id}
+    </update>
 
     <select id="countPayingNum" resultType="map">
         SELECT COUNT(DISTINCT user_id_) `value`, actual_subject_id_ `key`

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

@@ -61,6 +61,7 @@
         <result column="is_settlement_salary_" property="isSettlementSalary"/>
         <result column="contract_url_" property="contractUrl"/>
         <result column="tenant_id_" property="tenantId"/>
+        <result column="courseware_limit_" property="coursewareLimit"/>
     </resultMap>
     
     <resultMap type="com.ym.mec.biz.dal.dto.TeacherDefaultSalaryDto" id="TeacherDefaultSalaryDto">
@@ -124,7 +125,7 @@
         su.real_name_,su.id_card_no_,su.password_,su.salt_,su.phone_,su.avatar_,
         su.lock_flag_,su.del_flag_,su.wx_openid_,su.qq_openid_,su.user_type_,
         su.gender_,su.nation_,su.birthdate_,su.email_,su.im_token_,su.username_,su.organ_id_,
-        t.is_settlement_salary_,su.tenant_id_
+        t.is_settlement_salary_,su.tenant_id_, t.courseware_limit_
         FROM teacher t
         LEFT JOIN sys_user su ON t.id_ = su.id_
         WHERE t.id_ = #{id} AND su.del_flag_ = 0
@@ -237,6 +238,9 @@
             <if test="postDeptIds != null">
                 post_dept_ids_ = #{postDeptIds},
             </if>
+            <if test="coursewareLimit != null">
+                courseware_limit_ = #{coursewareLimit},
+            </if>
         </set>
         WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>
@@ -323,6 +327,9 @@
             <if test="postDeptIds != null">
                 post_dept_ids_ = #{postDeptIds},
             </if>
+            <if test="coursewareLimit != null">
+                courseware_limit_ = #{coursewareLimit},
+            </if>
         </set>
         WHERE id_ = #{id} and tenant_id_ = #{tenantId}
     </update>

+ 22 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

@@ -7,10 +7,15 @@
  */
 package com.ym.mec.common.page;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.function.Function;
+
+import static java.util.stream.Collectors.toList;
 
 /**
  * 分页对象
@@ -161,4 +166,21 @@ public class PageInfo<T> implements Serializable {
 		this.footer = footer;
 	}
 
+
+
+    /**
+     * <p>
+     * IPage 的泛型转换
+     * </p>
+     *
+     * @param mapper 转换函数
+     * @param <R>    转换后的泛型
+     * @return 转换泛型后的 IPage
+     */
+    @SuppressWarnings("unchecked")
+    public  <R> PageInfo<R> convert(Function<? super T, ? extends R> mapper) {
+        List<R> collect = this.getRows().stream().map(mapper).collect(toList());
+        ((PageInfo<R>) this).setRows(collect);
+        return (PageInfo<R>) this;
+    }
 }

+ 33 - 28
mec-im/src/main/java/com/ym/controller/UserController.java

@@ -163,36 +163,38 @@ public class UserController {
 
         TencentData.CallbackStreamStateEvent event = TencentData.CallbackStreamStateEvent.from(body);
 
-        List<ImUserState> userState = new ArrayList<>();
-        ImUserState imUserState = new ImUserState();
-        userState.add(imUserState);
-        imUserState.setUserid(getSpeakerId(event.getStreamId()).toString());
-        // 断流事件通知
-        if (event.getEventType() == 0) {
-
-            // 更新推流时长
-            if (StringUtils.isNotBlank(event.getPushDuration()) && event.getPushDuration().matches("\\d+")) {
-                // 更新直播推流时长
-                imLiveBroadcastRoomService.updateLiveRoomPushStreamTime(event);
+        // 直播间推流事件
+        if (event.getStreamId().startsWith("LIVE")) {
+
+            ImUserState imUserState = new ImUserState();
+            imUserState.setUserid(getSpeakerId(event.getStreamId()).toString());
+            // 断流事件通知
+            if (event.getEventType() == 0) {
+
+                // 更新推流时长
+                if (StringUtils.isNotBlank(event.getPushDuration()) && event.getPushDuration().matches("\\d+")) {
+                    // 更新直播推流时长
+                    imLiveBroadcastRoomService.updateLiveRoomPushStreamTime(event);
+                }
+                imUserState.setStatus("3");
+
+                // 自动关闭录制
+                imLiveBroadcastRoomService.closeLive(getRoomUid(event.getStreamId()), getSpeakerId(event.getStreamId()),event.getSequence());
+
+                // 同步点赞数
+                imLiveBroadcastRoomService.syncLikeCount(getRoomUid(event.getStreamId()));
             }
-            imUserState.setStatus("3");
 
-            // 自动关闭录制
-            imLiveBroadcastRoomService.closeLive(getRoomUid(event.getStreamId()), getSpeakerId(event.getStreamId()),event.getSequence());
+            // 推流事件通知
+            if (event.getEventType() == 1) {
+                // 自动开启录制
+                imLiveBroadcastRoomService.startLive(getRoomUid(event.getStreamId()), getSpeakerId(event.getStreamId()), null,event.getSequence());
 
-            // 同步点赞数
-            imLiveBroadcastRoomService.syncLikeCount(getRoomUid(event.getStreamId()));
-        }
-
-        // 推流事件通知
-        if (event.getEventType() == 1) {
-            // 自动开启录制
-            imLiveBroadcastRoomService.startLive(getRoomUid(event.getStreamId()), getSpeakerId(event.getStreamId()), null,event.getSequence());
-
-            imUserState.setStatus("0");
+                imUserState.setStatus("0");
+            }
+            //imLiveBroadcastRoomService.opsRoom(Lists.newArrayList(imUserState));
         }
 
-        // imLiveBroadcastRoomService.opsRoom(userState);
         return TencentData.StreamEventCallbackResult.builder().code(0).build();
     }
 
@@ -212,10 +214,13 @@ public class UserController {
 
         TencentData.CallbackSteamRecordEvent event = TencentData.CallbackSteamRecordEvent.from(body);
 
-        log.info("taskId={}, url={}", event.getTaskId(), event.getVideoUrl());
+        // 直播录制事件通知
+        if (event.getStreamId().startsWith("LIVE")) {
+            log.info("taskId={}, url={}", event.getTaskId(), event.getVideoUrl());
 
-        // 生成直播录制信息
-        liveRoomService.createLiveRoomVideoRecord(event);
+            // 生成直播录制信息
+            liveRoomService.createLiveRoomVideoRecord(event);
+        }
 
         return TencentData.StreamEventCallbackResult.builder().code(0).build();
     }

+ 5 - 0
mec-mall/mall-admin/pom.xml

@@ -44,6 +44,11 @@
             <version>20.0</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.2.1</version>
+        </dependency>
 
 
     </dependencies>

+ 38 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/ExportController.java

@@ -0,0 +1,38 @@
+package com.yonge.cooleshow.admin.controller;
+
+import com.alibaba.excel.EasyExcel;
+import com.yonge.cooleshow.admin.dto.OmsOrderQueryParam;
+import com.yonge.cooleshow.admin.dto.OrderDetailVo;
+import com.yonge.cooleshow.admin.service.OmsOrderService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@Api(tags = "数据导出服务")
+@RequestMapping("/export")
+public class ExportController {
+    @Autowired
+    private OmsOrderService orderService;
+
+    @ApiOperation("订单详情")
+    @RequestMapping(value = "/orderDetail", method = RequestMethod.POST)
+    public void orderDetail(@RequestBody OmsOrderQueryParam queryParam, HttpServletResponse response) throws IOException {
+        List<OrderDetailVo> orderList = orderService.queryOrderDetail(queryParam);
+        // 设置文本内省
+        response.setContentType("application/vnd.ms-excel");
+        // 设置字符编码
+        response.setCharacterEncoding("utf-8");
+        // 设置响应头
+        response.setHeader("Content-disposition", "attachment;filename=订单详情.xlsx");
+        EasyExcel.write(response.getOutputStream(), OrderDetailVo.class).sheet("订单详情").doWrite(orderList);
+    }
+}

+ 2 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dao/OmsOrderDao.java

@@ -46,4 +46,6 @@ public interface OmsOrderDao {
      */
     List<OrderStatistical> selectOrderCountAndAmount(@Param("startTime") Date startTime, @Param("endTime") Date endTime,
                                                      @Param("dateFormat") String dateFormat);
+
+    List<OrderDetailVo> queryOrderDetail(@Param("queryParam") OmsOrderQueryParam queryParam);
 }

+ 4 - 48
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dto/OmsOrderQueryParam.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.admin.dto;
 
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 
 /**
@@ -8,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
  * Created by macro on 2018/10/11.
  */
 
+@Data
 public class OmsOrderQueryParam {
     @ApiModelProperty(value = "订单编号")
     private String orderSn;
@@ -21,52 +23,6 @@ public class OmsOrderQueryParam {
     private Integer sourceType;
     @ApiModelProperty(value = "订单提交时间")
     private String createTime;
-
-    public String getOrderSn() {
-        return orderSn;
-    }
-
-    public void setOrderSn(String orderSn) {
-        this.orderSn = orderSn;
-    }
-
-    public String getReceiverKeyword() {
-        return receiverKeyword;
-    }
-
-    public void setReceiverKeyword(String receiverKeyword) {
-        this.receiverKeyword = receiverKeyword;
-    }
-
-    public Integer getStatus() {
-        return status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public Integer getOrderType() {
-        return orderType;
-    }
-
-    public void setOrderType(Integer orderType) {
-        this.orderType = orderType;
-    }
-
-    public Integer getSourceType() {
-        return sourceType;
-    }
-
-    public void setSourceType(Integer sourceType) {
-        this.sourceType = sourceType;
-    }
-
-    public String getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(String createTime) {
-        this.createTime = createTime;
-    }
+    @ApiModelProperty(value = "订单提交时间")
+    private String endTime;
 }

+ 113 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/dto/OrderDetailVo.java

@@ -0,0 +1,113 @@
+package com.yonge.cooleshow.admin.dto;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.yonge.cooleshow.admin.enums.OpenTypeEnum;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class OrderDetailVo{
+
+    @ExcelProperty("分部")
+    private String organName;
+
+    @ExcelProperty("用户编号")
+    private Integer memberId;
+
+    @ExcelProperty("用户姓名")
+    private String memberUsername;
+
+    @ExcelProperty("交易流水号")
+    private String transNo;
+
+    @ExcelProperty("订单号")
+    private String orderSn;
+
+    @ExcelIgnore
+    private OpenTypeEnum openTypeEnum;
+
+    @ExcelProperty(value = "收款渠道")
+    private String openType;
+
+    @ExcelProperty("收款账户")
+    private String merNos;
+
+    @ExcelProperty("订单金额")
+    private BigDecimal expectAmount;
+
+    @ExcelProperty("到账时间")
+    private Date paymentTime;
+
+    @ExcelProperty("商品货号")
+    private String productSn;
+
+    @ExcelProperty("购买商品")
+    private String productName;
+
+    @ExcelProperty("商品规格")
+    private String productSpecification;
+
+    @ExcelIgnore
+    private String productAttr;
+
+    @ExcelProperty("商品属性")
+    private String productAttrDesc;
+
+    @ExcelProperty("数量")
+    private Integer productQuantity;
+
+    @ExcelProperty("收件人")
+    private String receiverName;
+
+    @ExcelProperty("电话")
+    private String receiverPhone;
+
+    @ExcelProperty("地址")
+    private String receiverDetailAddress;
+
+    @ExcelProperty("物流")
+    private String deliveryCompany;
+
+    @ExcelProperty("单号")
+    private String deliverySn;
+
+    @ExcelProperty("备注")
+    private String note;
+
+    public String getProductAttr() {
+        return productAttr;
+    }
+
+    public void setProductAttr(String productAttr) {
+        this.productAttr = productAttr;
+        if(StringUtils.isNotEmpty(productAttr)){
+            try {
+                List<JSONObject> list = JSON.parseArray(productAttr,JSONObject.class);
+                StringBuffer sb = new StringBuffer();
+                for (JSONObject jsonObject : list) {
+                    sb.append(jsonObject.get("key")).append(":").append(jsonObject.get("value")).append(";");
+                }
+                this.productAttrDesc = sb.toString();
+            }catch (Exception e){
+
+            }
+        }
+    }
+
+    public OpenTypeEnum getOpenTypeEnum() {
+        return openTypeEnum;
+    }
+
+    public void setOpenTypeEnum(OpenTypeEnum openTypeEnum) {
+        this.openTypeEnum = openTypeEnum;
+        this.openType = openTypeEnum.getMsg();
+    }
+}

+ 20 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/enums/OpenTypeEnum.java

@@ -0,0 +1,20 @@
+package com.yonge.cooleshow.admin.enums;
+
+public enum OpenTypeEnum {
+    ORIGINAL("微信支付宝"),
+    ADAPAY("汇付"),
+    ;
+    private String msg;
+
+    OpenTypeEnum(String msg) {
+        this.msg = msg;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 2 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/OmsOrderService.java

@@ -90,4 +90,6 @@ public interface OmsOrderService {
      * @return
      */
     HomeOrderStatistical orderStatistical(OrderStatisticalSearch search);
+
+    List<OrderDetailVo> queryOrderDetail(OmsOrderQueryParam queryParam);
 }

+ 5 - 0
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/service/impl/OmsOrderServiceImpl.java

@@ -345,6 +345,11 @@ public class OmsOrderServiceImpl implements OmsOrderService {
 
     }
 
+    @Override
+    public List<OrderDetailVo> queryOrderDetail(OmsOrderQueryParam queryParam) {
+        return orderDao.queryOrderDetail(queryParam);
+    }
+
     private Integer getProportion(BigDecimal now, BigDecimal last) {
         if (now.compareTo(BigDecimal.ZERO) == 0) {
             if(last.compareTo(BigDecimal.ZERO) == 0) {

+ 39 - 1
mec-mall/mall-admin/src/main/resources/config/mybatis/OmsOrderDao.xml

@@ -37,7 +37,7 @@
             AND o.order_type = #{queryParam.orderType}
         </if>
         <if test="queryParam.createTime!=null and queryParam.createTime!=''">
-            AND o.create_time LIKE concat(#{queryParam.createTime},"%")
+            AND DATE_FORMAT(o.create_time, '%Y-%m-%d') BETWEEN #{queryParam.createTime} AND #{queryParam.endTime}
         </if>
         <if test="queryParam.receiverKeyword!=null and queryParam.receiverKeyword!=''">
             AND (
@@ -181,4 +181,42 @@
             </when>
         </choose>
     </select>
+    <select id="queryOrderDetail" resultType="com.yonge.cooleshow.admin.dto.OrderDetailVo">
+        select o.name_ organName,oo.member_id memberId,oo.member_username memberUsername,spo.trans_no_ transNo,oo.order_sn orderSn,
+               uop.open_type_ openTypeEnum,spo.mer_nos_ merNos,spo.expect_amount_ expectAmount,oo.payment_time paymentTime,
+               pp.product_sn productSn,ooi.product_name productName,ooi.product_quantity productQuantity,oo.receiver_name receiverName,oo.receiver_phone receiverPhone,
+               CONCAT(oo.receiver_province,oo.receiver_city,oo.receiver_region,oo.receiver_detail_address) receiverDetailAddress,
+               oo.delivery_company deliveryCompany,oo.delivery_sn deliverySn,oo.note,ooi.product_attr productAttr
+        from oms_order oo
+                 left join mec_pro.student_payment_order spo ON spo.order_no_ = oo.order_sn
+                 left join mec_pro.organization o ON o.id_ = spo.organ_id_
+                 left join user_order_payment uop ON uop.order_no_ = oo.order_sn AND uop.status_ = 'succeeded'
+                 left join oms_order_item ooi ON ooi.order_id = oo.id
+                 left join pms_product pp ON pp.id = ooi.product_sku_id
+        <where>
+            oo.delete_status = 0
+            <if test="queryParam.orderSn!=null and queryParam.orderSn!=''">
+                AND oo.order_sn = #{queryParam.orderSn}
+            </if>
+            <if test="queryParam.status!=null">
+                AND oo.`status` = #{queryParam.status}
+            </if>
+            <if test="queryParam.sourceType!=null">
+                AND oo.source_type = #{queryParam.sourceType}
+            </if>
+            <if test="queryParam.orderType!=null">
+                AND oo.order_type = #{queryParam.orderType}
+            </if>
+            <if test="queryParam.createTime!=null and queryParam.createTime!=''">
+                AND oo.create_time LIKE concat(#{queryParam.createTime},"%")
+            </if>
+            <if test="queryParam.receiverKeyword!=null and queryParam.receiverKeyword!=''">
+                AND (
+                oo.receiver_name LIKE concat("%",#{queryParam.receiverKeyword},"%")
+                OR o.receiver_phone LIKE concat("%",#{queryParam.receiverKeyword},"%")
+                )
+            </if>
+        </where>
+        order by oo.id desc
+    </select>
 </mapper>

+ 12 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveBroadcastRoomController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.teacher.controller;
 
+import com.microsvc.toolkit.middleware.live.message.TencentWrapper;
 import com.ym.mec.biz.dal.dto.LiveRoomStatus;
 import com.ym.mec.biz.dal.dto.RoomReservationUserSearch;
 import com.ym.mec.biz.dal.page.LiveRoomGoodsOrderQueryInfo;
@@ -199,5 +200,16 @@ public class TeacherImLiveBroadcastRoomController extends BaseController {
     public HttpResponseResult<Boolean> updateRoomStatus(@RequestBody @Valid LiveRoomStatus status ) {
         return succeed(imLiveBroadcastRoomService.updateRoomStatus(status));
     }
+
+    @ApiOperation("直播间推流状态")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "roomUid", dataType = "String", value = "房间Uid", required = true),
+    })
+    @GetMapping(value = "/liveStreamStatus")
+    public HttpResponseResult<TencentWrapper.LiveStreamState> roomLiveStream(String roomUid) {
+
+        // 直播间推流状态查询
+        return succeed(imLiveBroadcastRoomService.roomLiveStreamStatus(roomUid));
+    }
 }
 

+ 26 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherImLiveBroadcastRoomMemberController.java

@@ -1,11 +1,13 @@
 package com.ym.mec.teacher.controller;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomDetailVo;
 import com.ym.mec.biz.dal.vo.ImLiveBroadcastRoomMemberVo;
 import com.ym.mec.biz.service.ImLiveBroadcastRoomMemberService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.PageUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -16,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 直播间人员关系表(ImLiveBroadcastRoomMember)表控制层
@@ -57,5 +61,27 @@ public class TeacherImLiveBroadcastRoomMemberController extends BaseController {
         return succeed(imLiveBroadcastRoomMemberService.queryRoomMember(param));
     }
 
+
+
+
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "search", dataType = "String", value = "模糊搜索 学员编号姓名"),
+        @ApiImplicitParam(name = "roomUid", dataType = "String", value = "房间uid"),
+        @ApiImplicitParam(name = "onlineStatus", dataType = "String ", value = "0:离线 1:在线  不传是全部"),
+        @ApiImplicitParam(name = "whetherMicStatus", dataType = "String", value = "连麦状态 0:未申请1:申请连麦中2:连麦中"),
+        @ApiImplicitParam(name = "page", dataType = "Integer", value = "页数"),
+        @ApiImplicitParam(name = "rows", dataType = "Integer", value = "每页数量"),
+    })
+    @ApiOperation("分页查询直播间人员列表")
+    @PostMapping("/queryRoomSimpleMember")
+    public HttpResponseResult<PageInfo<ImLiveBroadcastRoomMemberVo.ImLiveBroadcastRoomSimpleMemberVo>> queryRoomSimpleMember(@RequestBody Map<String, Object> param) {
+        PageInfo<ImLiveBroadcastRoomMemberVo> roomMember = imLiveBroadcastRoomMemberService.queryRoomMember(
+            param);
+
+        PageInfo<ImLiveBroadcastRoomMemberVo.ImLiveBroadcastRoomSimpleMemberVo> convert = roomMember.convert(
+            o -> o.getSimpleMemberVo(o));
+
+        return succeed(convert);
+    }
 }
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.