Browse Source

Merge branch 'apply_multi_order' into online1

yonge 4 years ago
parent
commit
155545e5fb
91 changed files with 3263 additions and 1058 deletions
  1. 47 4
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java
  2. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/FinancialExpenditureDao.java
  3. 4 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SellOrderDao.java
  4. 39 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java
  5. 15 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java
  6. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  7. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareRecordDao.java
  8. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java
  9. 44 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupRegAndMoneyDto.java
  10. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java
  11. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicPitchDetailDto.java
  12. 53 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PushInfoDto.java
  13. 112 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SoundCompareHelper.java
  14. 17 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java
  15. 49 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SubjectApplyDetailDto.java
  16. 86 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/WavHeader.java
  17. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/WebSocketInfo.java
  18. 75 32
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Employee.java
  19. 46 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/FinancialExpenditure.java
  20. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrder.java
  21. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPaymentOrderDetail.java
  22. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java
  23. 70 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicCompareRecord.java
  24. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/DealStatusEnum.java
  25. 31 27
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  26. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java
  27. 12 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java
  28. 440 0
      mec-biz/src/main/java/com/ym/mec/biz/handler/WebSocketHandler.java
  29. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/service/ExtracurricularExercisesReplyService.java
  30. 14 5
      mec-biz/src/main/java/com/ym/mec/biz/service/FinancialExpenditureService.java
  31. 0 10
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectPlanService.java
  32. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationService.java
  33. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java
  34. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SoundSocketService.java
  35. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderDetailService.java
  36. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java
  37. 7 3
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  38. 21 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicCompareRecordService.java
  39. 18 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  40. 0 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExtracurricularExercisesReplyServiceImpl.java
  41. 157 148
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java
  42. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  43. 167 107
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  44. 34 57
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  45. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  46. 40 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java
  47. 188 85
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java
  48. 12 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  49. 325 258
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  50. 60 17
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
  51. 36 26
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java
  52. 43 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareRecordServiceImpl.java
  53. 63 20
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  54. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  55. 5 1
      mec-biz/src/main/resources/config/mybatis/EmployeeMapper.xml
  56. 3 1
      mec-biz/src/main/resources/config/mybatis/FinancialExpenditureMapper.xml
  57. 1 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  58. 9 3
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  59. 9 4
      mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml
  60. 23 5
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  61. 120 7
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  62. 37 8
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  63. 73 0
      mec-biz/src/main/resources/config/mybatis/SysMusicCompareRecordMapper.xml
  64. 12 10
      mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml
  65. 7 0
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  66. 5 0
      mec-common/common-core/pom.xml
  67. 7 1
      mec-gateway/mec-gateway-web/src/main/java/com/ym/mec/gateway/web/config/WebSecurityConfig.java
  68. 8 1
      mec-im/src/main/resources/logback-spring.xml
  69. 5 0
      mec-student/pom.xml
  70. 40 0
      mec-student/src/main/java/com/ym/mec/student/config/WebSocketConfig.java
  71. 50 21
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  72. 1 1
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java
  73. 24 5
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  74. 28 0
      mec-student/src/main/java/com/ym/mec/student/interceptor/WebSocketHandshakeInterceptor.java
  75. 8 1
      mec-student/src/main/resources/logback-spring.xml
  76. 0 5
      mec-teacher/pom.xml
  77. 23 4
      mec-teacher/src/main/java/com/ym/mec/teacher/config/WebSocketConfig.java
  78. 29 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/SoundController.java
  79. 28 0
      mec-teacher/src/main/java/com/ym/mec/teacher/interceptor/WebSocketHandshakeInterceptor.java
  80. 0 50
      mec-teacher/src/main/java/com/ym/mec/teacher/websocket/SoundWebSocket.java
  81. 8 1
      mec-teacher/src/main/resources/logback-spring.xml
  82. 1 1
      mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java
  83. 4 0
      mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java
  84. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java
  85. 13 0
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  86. 2 0
      mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java
  87. 67 0
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduFinancialExpenditureController.java
  88. 10 0
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduOrganizationController.java
  89. 57 39
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java
  90. 60 0
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduSendNoticeController.java
  91. 8 1
      mec-web/src/main/resources/logback-spring.xml

+ 47 - 4
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUser.java

@@ -1,6 +1,5 @@
 package com.ym.mec.auth.api.entity;
 
-import com.ym.mec.auth.api.enums.CertificateTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.io.Serializable;
@@ -18,7 +17,7 @@ import com.ym.mec.auth.api.enums.YesOrNoEnum;
 public class SysUser implements Serializable{
 
 	/**
-	 * 
+	 *
 	 */
 	private static final long serialVersionUID = -1374403507360017093L;
 
@@ -115,14 +114,14 @@ public class SysUser implements Serializable{
 
 	@ApiModelProperty(value = "微信号",required = false)
 	private String wechatId;
-	
+
 	@ApiModelProperty(value = "是否是超管",required = false)
 	private Boolean isSuperAdmin = false;
 
 	private Integer serviceTag;
 
 	private Integer operatingTag;
-	
+
 	private Integer teacherId;
 
 	@ApiModelProperty(value = "用户角色",required = false)
@@ -136,6 +135,18 @@ public class SysUser implements Serializable{
 
 	private String certificateType;
 
+	@ApiModelProperty(value = "部门id",required = false)
+	private Integer deptId;
+
+	@ApiModelProperty(value = "岗位id",required = false)
+	private Integer postId;
+
+	@ApiModelProperty(value = "银行卡号",required = false)
+	private String bankCard;
+
+	@ApiModelProperty(value = "开户行",required = false)
+	private String openBankAddress;
+
 	public String getCertificateType() {
 		return certificateType;
 	}
@@ -422,4 +433,36 @@ public class SysUser implements Serializable{
 	public void setCurrentGradeNum(Integer currentGradeNum) {
 		this.currentGradeNum = currentGradeNum;
 	}
+
+	public Integer getDeptId() {
+		return deptId;
+	}
+
+	public void setDeptId(Integer deptId) {
+		this.deptId = deptId;
+	}
+
+	public Integer getPostId() {
+		return postId;
+	}
+
+	public void setPostId(Integer postId) {
+		this.postId = postId;
+	}
+
+	public String getBankCard() {
+		return bankCard;
+	}
+
+	public void setBankCard(String bankCard) {
+		this.bankCard = bankCard;
+	}
+
+	public String getOpenBankAddress() {
+		return openBankAddress;
+	}
+
+	public void setOpenBankAddress(String openBankAddress) {
+		this.openBankAddress = openBankAddress;
+	}
 }

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

@@ -11,7 +11,7 @@ import java.util.Map;
 
 public interface FinancialExpenditureDao extends BaseDAO<Long, FinancialExpenditure> {
 
-    void batchInsert(@Param("financialExpenditures") List<FinancialExpenditure> financialExpenditures);
+    int batchInsert(@Param("financialExpenditures") List<FinancialExpenditure> financialExpenditures);
 
     int findFinancialExpenditureCount(Map<String, Object> params);
 
@@ -36,4 +36,4 @@ public interface FinancialExpenditureDao extends BaseDAO<Long, FinancialExpendit
      * @time 11:38
      */
     List<String> countBydingTalk(@Param("collect") List<Object> collect);
-}
+}

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

@@ -130,10 +130,10 @@ public interface SellOrderDao extends BaseDAO<Integer, SellOrder> {
     /**
      * 获取订单的销售成本
      *
-     * @param orderId
+     * @param orderIdList
      * @return
      */
-    BigDecimal getOrderSellCost(@Param("orderId") Long orderId);
+    BigDecimal getOrderSellCost(@Param("orderIdList") List<Long> orderIdList);
 
     /**
      * 获取声部更换的销售、成本
@@ -189,10 +189,10 @@ public interface SellOrderDao extends BaseDAO<Integer, SellOrder> {
     /**
      * 获取退货的sellOrder
      *
-     * @param orderId
+     * @param orderIdList
      * @return
      */
-    List<SellOrder> getRefundSellOrder(@Param("orderId") Long orderId);
+    List<SellOrder> getRefundSellOrder(@Param("orderIdList") List<Long> orderIdList);
 
     /**
      * 获取订单的各类型费用

+ 39 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -1,21 +1,29 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.*;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.Mapper;
+import com.ym.mec.biz.dal.dto.OrderByTypeExportDto;
+import com.ym.mec.biz.dal.dto.OrderStatisDto;
+import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
+import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
+import com.ym.mec.biz.dal.dto.StudentVipDouble11Dto;
+import com.ym.mec.biz.dal.dto.UserGoodsDto;
 import com.ym.mec.biz.dal.entity.Goods;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
 
 public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrder> {
 
@@ -88,6 +96,15 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @return
      */
     StudentPaymentOrder findOrderByOrderNo(@Param("orderNo") String orderNo);
+    
+    /**
+     * 根据批次号查询
+     * @param userId 用户编号
+     * @param batchNo 批次号
+     * @param status 状态
+     * @return
+     */
+    List<StudentPaymentOrder> queryByBatchNo(@Param("userId")Integer userId, @Param("batchNo") String batchNo, @Param("status") DealStatusEnum status);
 
     /**
      * 查询指定交易状态的乐团报名的订单信息
@@ -405,4 +422,18 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
      * @return
      */
     StudentPaymentOrder getUserReplacementIngOrder(@Param("userId") Integer userId, @Param("replacementId") Integer replacementId);
+    
+    /**
+     * 批量更新
+     * @param studentPaymentOrderList
+     * @return
+     */
+    int batchUpdate(@Param("studentPaymentOrderList") List<StudentPaymentOrder> studentPaymentOrderList);
+    
+    /**
+     * 查询乐团报名的总收入
+     * @param musicGroupIds
+     * @return
+     */
+    List<Mapper> getMoneyInMusicApply(@Param("musicGroupIds") List<String> musicGroupIds);
 }

+ 15 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java

@@ -1,16 +1,18 @@
 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.Mapper;
 import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.common.dal.BaseDAO;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
 
 public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPaymentOrderDetail> {
 
@@ -143,5 +145,12 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
      * @param orderId
      * @return
      */
-    List<StudentPaymentOrderDetail> getOrderDetailByOrderId(@Param("orderId") Long orderId);
+    List<StudentPaymentOrderDetail> getOrderDetailByOrderId(@Param("orderIdList") List<Long> orderIdList);
+    
+    /**
+     * 查询乐团报名的乐器购买人数
+     * @param musicGroupIds
+     * @return
+     */
+    List<Mapper> getInstrumentNumInMusicApply(@Param("musicGroupIds") List<String> musicGroupIds);
 }

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

@@ -632,4 +632,6 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     List<StudentRegistration> queryMemberEndAutoQuitMusic(@Param("memberEndAutoQuitMusic") String memberEndAutoQuitMusic,
                                                           @Param("educationUserId") Integer educationUserId,
                                                           @Param("organIds") String organIds);
+    
+    List<SubjectApplyDetailDto> queryStudentApplyDetail(@Param("musicGroupId") String musicGroupId);
 }

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

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

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

@@ -330,6 +330,8 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
      */
     SysUser getUser(int userId);
 
+    SysUser getUserWithPhone(@Param("phone") String phone);
+
     /**
      * 获取教师基本信息
      *

+ 44 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupRegAndMoneyDto.java

@@ -20,6 +20,9 @@ public class MusicGroupRegAndMoneyDto {
 
     @ApiModelProperty(value = "乐团状态", required = false)
     private String musicGroupStatus;
+    
+    @ApiModelProperty(value = "课程展现形式",required = false)
+	private Integer courseViewType;
 
     @ApiModelProperty(value = "预报名人数", required = false)
     private Integer preRegNum = 0;
@@ -44,6 +47,15 @@ public class MusicGroupRegAndMoneyDto {
 
     @ApiModelProperty(value = "回款金额", required = false)
     private BigDecimal money = BigDecimal.ZERO;
+    
+    @ApiModelProperty(value = "入团人数", required = false)
+    private Integer studentNumOfNormal = 0;
+    
+    @ApiModelProperty(value = "入团未购云教练人数", required = false)
+    private Integer noCloudTeacherStudentNumOfNormal = 0;
+    
+    @ApiModelProperty(value = "购买乐器未入团人数", required = false)
+    private Integer cloudTeacherStudentNumOfApply = 0;
 
     public String getMusicGroupId() {
         return musicGroupId;
@@ -140,4 +152,36 @@ public class MusicGroupRegAndMoneyDto {
     public void setMoney(BigDecimal money) {
         this.money = money;
     }
+
+	public Integer getStudentNumOfNormal() {
+		return studentNumOfNormal;
+	}
+
+	public void setStudentNumOfNormal(Integer studentNumOfNormal) {
+		this.studentNumOfNormal = studentNumOfNormal;
+	}
+
+	public Integer getNoCloudTeacherStudentNumOfNormal() {
+		return noCloudTeacherStudentNumOfNormal;
+	}
+
+	public void setNoCloudTeacherStudentNumOfNormal(Integer noCloudTeacherStudentNumOfNormal) {
+		this.noCloudTeacherStudentNumOfNormal = noCloudTeacherStudentNumOfNormal;
+	}
+
+	public Integer getCloudTeacherStudentNumOfApply() {
+		return cloudTeacherStudentNumOfApply;
+	}
+
+	public void setCloudTeacherStudentNumOfApply(Integer cloudTeacherStudentNumOfApply) {
+		this.cloudTeacherStudentNumOfApply = cloudTeacherStudentNumOfApply;
+	}
+
+	public Integer getCourseViewType() {
+		return courseViewType;
+	}
+
+	public void Integer(Integer courseViewType) {
+		this.courseViewType = courseViewType;
+	}
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicGroupSubjectGoodsAndInfoDto.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.dal.dto;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -12,6 +13,7 @@ import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 
 /**
  * 乐团报名缴费相关信息
@@ -47,6 +49,8 @@ public class MusicGroupSubjectGoodsAndInfoDto {
     
     @ApiModelProperty(value = "会员权益",required = false)
     private List<MemberPrivilegesItem> memberPrivilegesItemList;
+    
+    private List<StudentPaymentOrderDetail> studentPaymentOrderDetailList;
 
     public Map getCourseScheduleInfo() {
         return CourseScheduleInfo;
@@ -127,4 +131,12 @@ public class MusicGroupSubjectGoodsAndInfoDto {
 	public void setMemberPrivilegesItemList(List<MemberPrivilegesItem> memberPrivilegesItemList) {
 		this.memberPrivilegesItemList = memberPrivilegesItemList;
 	}
+
+	public List<StudentPaymentOrderDetail> getStudentPaymentOrderDetailList() {
+		return studentPaymentOrderDetailList;
+	}
+
+	public void setStudentPaymentOrderDetailList(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList) {
+		this.studentPaymentOrderDetailList = studentPaymentOrderDetailList;
+	}
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/MusicPitchDetailDto.java

@@ -17,6 +17,9 @@ public class MusicPitchDetailDto {
     @ApiModelProperty("频率Hz")
     private float frequency;
 
+    @ApiModelProperty("小节数")
+    private int measureIndex;
+
     public MusicPitchDetailDto() {
     }
 
@@ -54,4 +57,12 @@ public class MusicPitchDetailDto {
     public void setFrequency(float frequency) {
         this.frequency = frequency;
     }
+
+    public int getMeasureIndex() {
+        return measureIndex;
+    }
+
+    public void setMeasureIndex(int measureIndex) {
+        this.measureIndex = measureIndex;
+    }
 }

+ 53 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PushInfoDto.java

@@ -0,0 +1,53 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+public class PushInfoDto {
+
+    @ApiModelProperty(value = "通知用户",required = false)
+    private List<Integer> userIds;
+
+    @ApiModelProperty(value = "消息类型",required = false)
+    private MessageTypeEnum messageType;
+
+    @ApiModelProperty(value = "im内容",required = false)
+    private String imContent;
+
+    @ApiModelProperty(value = "审批查看url",required = false)
+    private String workOrderUrl;
+
+    public List<Integer> getUserIds() {
+        return userIds;
+    }
+
+    public void setUserIds(List<Integer> userIds) {
+        this.userIds = userIds;
+    }
+
+    public MessageTypeEnum getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(MessageTypeEnum messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getImContent() {
+        return imContent;
+    }
+
+    public void setImContent(String imContent) {
+        this.imContent = imContent;
+    }
+
+    public String getWorkOrderUrl() {
+        return workOrderUrl;
+    }
+
+    public void setWorkOrderUrl(String workOrderUrl) {
+        this.workOrderUrl = workOrderUrl;
+    }
+}

+ 112 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SoundCompareHelper.java

@@ -0,0 +1,112 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.RandomAccessFile;
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/22 0022
+ */
+public class SoundCompareHelper {
+
+    @ApiModelProperty(value = "伴奏编号")
+    private Integer musicScoreId;
+
+    @ApiModelProperty(value = "小节开始时间")
+    private double measureStartTime;
+
+    @ApiModelProperty
+    private RandomAccessFile accessFile;
+
+    @ApiModelProperty(value = "小节xml信息字典")
+    private Map<Integer, List<MusicPitchDetailDto>> measureXmlInfoMap = new HashMap<>();
+
+    @ApiModelProperty(value = "小节结束时间字典")
+    private Map<Integer, Integer> measureEndTime = new HashMap<>();
+
+    @ApiModelProperty(value = "录音音频信息")
+    private List<MusicPitchDetailDto> recordMeasurePithInfo = new ArrayList<>();
+
+    @ApiModelProperty(value = "小节分数记录")
+    private Map<String, BigDecimal> userScoreMap = new HashMap<>();
+
+    private Map<Integer, Map<String, BigDecimal>> userMeasureScoreMap = new HashMap<>();
+
+    @ApiModelProperty(value = "偏移时间量,解决客户端录音播放不同步导致的声音留白")
+    private int offsetTime;
+
+    public int getOffsetTime() {
+        return offsetTime;
+    }
+
+    public void setOffsetTime(int offsetTime) {
+        this.offsetTime = offsetTime;
+    }
+
+    public Integer getMusicScoreId() {
+        return musicScoreId;
+    }
+
+    public void setMusicScoreId(Integer musicScoreId) {
+        this.musicScoreId = musicScoreId;
+    }
+
+    public RandomAccessFile getAccessFile() {
+        return accessFile;
+    }
+
+    public void setAccessFile(RandomAccessFile accessFile) {
+        this.accessFile = accessFile;
+    }
+
+    public double getMeasureStartTime() {
+        return measureStartTime;
+    }
+
+    public void setMeasureStartTime(double measureStartTime) {
+        this.measureStartTime = measureStartTime;
+    }
+
+    public Map<Integer, List<MusicPitchDetailDto>> getMeasureXmlInfoMap() {
+        return measureXmlInfoMap;
+    }
+
+    public void setMeasureXmlInfoMap(Map<Integer, List<MusicPitchDetailDto>> measureXmlInfoMap) {
+        this.measureXmlInfoMap = measureXmlInfoMap;
+    }
+
+    public Map<Integer, Integer> getMeasureEndTime() {
+        return measureEndTime;
+    }
+
+    public void setMeasureEndTime(Map<Integer, Integer> measureEndTime) {
+        this.measureEndTime = measureEndTime;
+    }
+
+    public List<MusicPitchDetailDto> getRecordMeasurePithInfo() {
+        return recordMeasurePithInfo;
+    }
+
+    public void setRecordMeasurePithInfo(List<MusicPitchDetailDto> recordMeasurePithInfo) {
+        this.recordMeasurePithInfo = recordMeasurePithInfo;
+    }
+
+    public Map<String, BigDecimal> getUserScoreMap() {
+        return userScoreMap;
+    }
+
+    public void setUserScoreMap(Map<String, BigDecimal> userScoreMap) {
+        this.userScoreMap = userScoreMap;
+    }
+
+    public Map<Integer, Map<String, BigDecimal>> getUserMeasureScoreMap() {
+        return userMeasureScoreMap;
+    }
+
+    public void setUserMeasureScoreMap(Map<Integer, Map<String, BigDecimal>> userMeasureScoreMap) {
+        this.userMeasureScoreMap = userMeasureScoreMap;
+    }
+}

+ 17 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentApplyDetailDto.java

@@ -1,16 +1,16 @@
 package com.ym.mec.biz.dal.dto;
 
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
-import io.swagger.annotations.ApiModelProperty;
-
+import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.common.enums.UserGenderEnum;
-import com.ym.mec.common.page.QueryInfo;
-
-import java.math.BigDecimal;
-import java.util.Date;
 
 public class StudentApplyDetailDto{
 
@@ -59,6 +59,9 @@ public class StudentApplyDetailDto{
 
     @ApiModelProperty(value = "学员缴费状态",required = false)
     private PaymentStatusEnum paymentStatus;
+    
+    @ApiModelProperty(value = "学员在团状态",required = false)
+    private StudentMusicGroupStatusEnum studentStatus;
 
     @ApiModelProperty(value = "乐器团购类型",required = false)
     private KitGroupPurchaseTypeEnum kitGroupPurchaseTypeEnum;
@@ -291,4 +294,12 @@ public class StudentApplyDetailDto{
     public void setNoneNeedCloudTeacher(Integer noneNeedCloudTeacher) {
         this.noneNeedCloudTeacher = noneNeedCloudTeacher;
     }
+
+	public StudentMusicGroupStatusEnum getStudentStatus() {
+		return studentStatus;
+	}
+
+	public void setStudentStatus(StudentMusicGroupStatusEnum studentStatus) {
+		this.studentStatus = studentStatus;
+	}
 }

+ 49 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SubjectApplyDetailDto.java

@@ -17,16 +17,16 @@ public class SubjectApplyDetailDto {
     private String subjectName;
 
     @ApiModelProperty(value = "预计招收人数",required = false)
-    private Integer expectedStudentNum;
+    private Integer expectedStudentNum = 0;
 
-    @ApiModelProperty(value = "实际招收人数",required = false)
-    private Integer applyStudentNum;
+    @ApiModelProperty(value = "报名人数",required = false)
+    private Integer applyStudentNum = 0;
 
     @ApiModelProperty(value = "缴费人数",required = false)
-    private Integer payNum;
+    private Integer payNum = 0;
 
     @ApiModelProperty(value = "未分班人数",required = false)
-    private Integer notPartClassNum;
+    private Integer notPartClassNum = 0;
 
     @ApiModelProperty(value = "缴费中人数",required = false)
     private Integer payingNum=0;
@@ -34,6 +34,18 @@ public class SubjectApplyDetailDto {
     @ApiModelProperty(value = "审核中人数",required = false)
     private Integer checkNum=0;
 
+    @ApiModelProperty(value = "在读人数",required = false)
+    private Integer normalNum=0;
+    
+    @ApiModelProperty(value = "购买云教练人数",required = false)
+    private Integer buyCloudTeacherNum = 0;
+    
+    @ApiModelProperty(value = "购买乐器未入团人数", required = false)
+    private Integer cloudTeacherStudentNumOfApply = 0;
+    
+    @ApiModelProperty(value = "没买云教练入团人数", required = false)
+    private Integer noCloudTeacherStudentNumOfNormal = 0;
+
     public Integer getMusicGroupSubjectPlanId() {
         return musicGroupSubjectPlanId;
     }
@@ -105,4 +117,36 @@ public class SubjectApplyDetailDto {
     public void setCheckNum(Integer checkNum) {
         this.checkNum = checkNum;
     }
+
+	public Integer getNormalNum() {
+		return normalNum;
+	}
+
+	public void setNormalNum(Integer normalNum) {
+		this.normalNum = normalNum;
+	}
+
+	public Integer getBuyCloudTeacherNum() {
+		return buyCloudTeacherNum;
+	}
+
+	public void setBuyCloudTeacherNum(Integer buyCloudTeacherNum) {
+		this.buyCloudTeacherNum = buyCloudTeacherNum;
+	}
+
+	public Integer getCloudTeacherStudentNumOfApply() {
+		return cloudTeacherStudentNumOfApply;
+	}
+
+	public void setCloudTeacherStudentNumOfApply(Integer cloudTeacherStudentNumOfApply) {
+		this.cloudTeacherStudentNumOfApply = cloudTeacherStudentNumOfApply;
+	}
+
+	public Integer getNoCloudTeacherStudentNumOfNormal() {
+		return noCloudTeacherStudentNumOfNormal;
+	}
+
+	public void setNoCloudTeacherStudentNumOfNormal(Integer noCloudTeacherStudentNumOfNormal) {
+		this.noCloudTeacherStudentNumOfNormal = noCloudTeacherStudentNumOfNormal;
+	}
 }

+ 86 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/WavHeader.java

@@ -0,0 +1,86 @@
+package com.ym.mec.biz.dal.dto;
+
+/**
+ * WAV文件头工具类
+ *
+ * @author maple
+ * @time 2018/4/10.
+ */
+public class WavHeader {
+
+    /**
+     * 返回WAV文件头的byte数组
+     */
+    public static byte[] getWaveHeader(long totalAudioLength, long frameRate, long frameRateSize) {
+        return wavFileHeader(
+                totalAudioLength - 44,
+                totalAudioLength - 44 + 36,
+                frameRate,
+                1,
+                frameRateSize * frameRate * 1 / 8,
+                (byte) frameRateSize
+        );
+    }
+
+    /**
+     * 获取wav文件头
+     *
+     * @param totalAudioLen  -
+     * @param totalDataLen   -
+     * @param longSampleRate - 采样率
+     * @param channels       - 通道数
+     * @param byteRate       -
+     * @param bitsPerSample  - 16/8 bit
+     * @return
+     */
+    private static byte[] wavFileHeader(long totalAudioLen, long totalDataLen, long longSampleRate,
+                                 int channels, long byteRate, byte bitsPerSample) {
+        byte[] header = new byte[44];
+        header[0] = 'R'; // RIFF/WAVE header
+        header[1] = 'I';
+        header[2] = 'F';
+        header[3] = 'F';
+        header[4] = (byte) (totalDataLen & 0xff);
+        header[5] = (byte) ((totalDataLen >> 8) & 0xff);
+        header[6] = (byte) ((totalDataLen >> 16) & 0xff);
+        header[7] = (byte) ((totalDataLen >> 24) & 0xff);
+        header[8] = 'W';
+        header[9] = 'A';
+        header[10] = 'V';
+        header[11] = 'E';
+        header[12] = 'f'; // 'fmt ' chunk
+        header[13] = 'm';
+        header[14] = 't';
+        header[15] = ' ';
+        header[16] = 16; // 4 bytes: size of 'fmt ' chunk
+        header[17] = 0;
+        header[18] = 0;
+        header[19] = 0;
+        header[20] = 1; // format = 1
+        header[21] = 0;
+        header[22] = (byte) channels;
+        header[23] = 0;
+        header[24] = (byte) (longSampleRate & 0xff);
+        header[25] = (byte) ((longSampleRate >> 8) & 0xff);
+        header[26] = (byte) ((longSampleRate >> 16) & 0xff);
+        header[27] = (byte) ((longSampleRate >> 24) & 0xff);
+        header[28] = (byte) (byteRate & 0xff);
+        header[29] = (byte) ((byteRate >> 8) & 0xff);
+        header[30] = (byte) ((byteRate >> 16) & 0xff);
+        header[31] = (byte) ((byteRate >> 24) & 0xff);
+        header[32] = (byte) (channels * (bitsPerSample / 8)); //
+        // block align
+        header[33] = 0;
+        header[34] = bitsPerSample; // bits per sample
+        header[35] = 0;
+        header[36] = 'd';
+        header[37] = 'a';
+        header[38] = 't';
+        header[39] = 'a';
+        header[40] = (byte) (totalAudioLen & 0xff);
+        header[41] = (byte) ((totalAudioLen >> 8) & 0xff);
+        header[42] = (byte) ((totalAudioLen >> 16) & 0xff);
+        header[43] = (byte) ((totalAudioLen >> 24) & 0xff);
+        return header;
+    }
+}

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

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/17 0017
+ */
+public class WebSocketInfo {
+
+    private HashMap<String, String> header = new HashMap<>();
+
+    private Object body;
+
+    public HashMap<String, String> getHeader() {
+        return header;
+    }
+
+    public void setHeader(HashMap<String, String> header) {
+        this.header = header;
+    }
+
+    public Object getBody() {
+        return body;
+    }
+
+    public void setBody(Object body) {
+        this.body = body;
+    }
+}

+ 75 - 32
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Employee.java

@@ -17,53 +17,65 @@ public class Employee extends SysUser {
 
 	/**  */
 	private Integer userId;
-	
+
 	/**  */
 	@ApiModelProperty(value = "机构编号列表,逗号分隔",required = false)
 	private String organIdList;
-	
+
 	/** 工作性质(兼职、全职、临时) */
 	@ApiModelProperty(value = "工作性质",required = false)
 	private JobNatureEnum jobNature;
-	
+
 	/** 是否试用期(1-是 0-否) */
 	@ApiModelProperty(value = "是否试用期",required = false)
 	private YesOrNoEnum isProbationPeriod;
-	
+
 	/** 学历 */
 	@ApiModelProperty(value = "学历",required = false)
 	private String educationBackground;
-	
+
 	/** 毕业学校 */
 	@ApiModelProperty(value = "毕业学校",required = false)
 	private String graduateSchool;
-	
+
 	/** 技术职称 */
 	@ApiModelProperty(value = "技术职称",required = false)
 	private String technicalTitles;
-	
+
 	/** 入职时间 */
 	@ApiModelProperty(value = "入职时间",required = false)
 	private java.util.Date entryDate;
-	
+
 	/** 证件类型 */
 	@ApiModelProperty(value = "证件类型",required = false)
 	private String certificateType;
-	
+
 	/** 证件号码 */
 	@ApiModelProperty(value = "证件号码",required = false)
 	private String certificateNum;
-	
+
+	@ApiModelProperty(value = "部门id",required = false)
+	private Integer depId;
+
+	@ApiModelProperty(value = "岗位id",required = false)
+	private Integer postId;
+
+	@ApiModelProperty(value = "银行卡号",required = false)
+	private String bankCard;
+
+	@ApiModelProperty(value = "开户行",required = false)
+	private String openBankAddress;
+
 	/**  */
 	private java.util.Date updateTime;
-	
+
 	/**  */
 	private java.util.Date createTime;
-	
+
 	/** 介绍 */
 	@ApiModelProperty(value = "介绍",required = false)
 	private String introduction;
-	
+
 	/** 离职日期 */
 	@ApiModelProperty(value = "离职日期",required = false)
 	private java.util.Date demissionDate;
@@ -118,79 +130,79 @@ public class Employee extends SysUser {
 	public void setEducationBackground(String educationBackground){
 		this.educationBackground = educationBackground;
 	}
-	
+
 	public String getEducationBackground(){
 		return this.educationBackground;
 	}
-			
+
 	public void setGraduateSchool(String graduateSchool){
 		this.graduateSchool = graduateSchool;
 	}
-	
+
 	public String getGraduateSchool(){
 		return this.graduateSchool;
 	}
-			
+
 	public void setTechnicalTitles(String technicalTitles){
 		this.technicalTitles = technicalTitles;
 	}
-	
+
 	public String getTechnicalTitles(){
 		return this.technicalTitles;
 	}
-			
+
 	public void setEntryDate(java.util.Date entryDate){
 		this.entryDate = entryDate;
 	}
-	
+
 	public java.util.Date getEntryDate(){
 		return this.entryDate;
 	}
-			
+
 	public void setCertificateType(String certificateType){
 		this.certificateType = certificateType;
 	}
-	
+
 	public String getCertificateType(){
 		return this.certificateType;
 	}
-			
+
 	public void setCertificateNum(String certificateNum){
 		this.certificateNum = certificateNum;
 	}
-	
+
 	public String getCertificateNum(){
 		return this.certificateNum;
 	}
-			
+
 	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 void setIntroduction(String introduction){
 		this.introduction = introduction;
 	}
-	
+
 	public String getIntroduction(){
 		return this.introduction;
 	}
-			
+
 	public void setDemissionDate(java.util.Date demissionDate){
 		this.demissionDate = demissionDate;
 	}
-	
+
 	public java.util.Date getDemissionDate(){
 		return this.demissionDate;
 	}
@@ -216,4 +228,35 @@ public class Employee extends SysUser {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public Integer getDeptId() {
+		return depId;
+	}
+
+	public void setDeptId(Integer deptId) {
+		this.depId = deptId;
+	}
+
+	public Integer getPostId() {
+		return postId;
+	}
+
+	public void setPostId(Integer postId) {
+		this.postId = postId;
+	}
+
+	public String getBankCard() {
+		return bankCard;
+	}
+
+	public void setBankCard(String bankCard) {
+		this.bankCard = bankCard;
+	}
+
+	public String getOpenBankAddress() {
+		return openBankAddress;
+	}
+
+	public void setOpenBankAddress(String openBankAddress) {
+		this.openBankAddress = openBankAddress;
+	}
 }

+ 46 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/FinancialExpenditure.java

@@ -23,10 +23,10 @@ public class FinancialExpenditure {
 	@ApiModelProperty(value = "钉钉流程编号",required = false)
 	private String dingtalkProcessNo;
 	/**  */
-	@ApiModelProperty(value = "分部",required = false)
+	@ApiModelProperty(value = "分部id",required = false)
 	private Integer organId;
 	/**  */
-	@ApiModelProperty(value = "学校/合作单位",required = false)
+	@ApiModelProperty(value = "学校/合作单位id",required = false)
 	private Integer cooperationOrganId;
 	/**  */
 	@ApiModelProperty(value = "申请人",required = false)
@@ -49,6 +49,18 @@ public class FinancialExpenditure {
 	/**  */
 	@ApiModelProperty(value = "事由",required = false)
 	private String cause;
+
+	@ApiModelProperty(value = "分部",required = false)
+	private String organName;
+
+	@ApiModelProperty(value = "学校/合作单位",required = false)
+	private String cooperationOrganName;
+
+	@ApiModelProperty(value = "费用类型Str",required = false)
+	private String feeType;
+
+	@ApiModelProperty(value = "费用项目str",required = false)
+	private String feeProjectItem;
 	/**  */
 	private Date createTime;
 	/**  */
@@ -183,4 +195,36 @@ public class FinancialExpenditure {
 	public void setType(ExpenditureTypeEnum type) {
 		this.type = type;
 	}
+
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
+	public String getCooperationOrganName() {
+		return cooperationOrganName;
+	}
+
+	public void setCooperationOrganName(String cooperationOrganName) {
+		this.cooperationOrganName = cooperationOrganName;
+	}
+
+	public String getFeeType() {
+		return feeType;
+	}
+
+	public void setFeeType(String feeType) {
+		this.feeType = feeType;
+	}
+
+	public String getFeeProjectItem() {
+		return feeProjectItem;
+	}
+
+	public void setFeeProjectItem(String feeProjectItem) {
+		this.feeProjectItem = feeProjectItem;
+	}
 }

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

@@ -119,6 +119,8 @@ public class StudentPaymentOrder {
 
 	//课程优惠金额
 	private BigDecimal courseRemitFee;
+	
+	private String batchNo;
 
 	public String getReceiveStatus() {
 		return receiveStatus;
@@ -364,4 +366,12 @@ public class StudentPaymentOrder {
 	public void setCourseRemitFee(BigDecimal courseRemitFee) {
 		this.courseRemitFee = courseRemitFee;
 	}
+
+	public String getBatchNo() {
+		return batchNo;
+	}
+
+	public void setBatchNo(String batchNo) {
+		this.batchNo = batchNo;
+	}
 }

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

@@ -19,6 +19,8 @@ public class StudentPaymentOrderDetail {
 	/**  */
 	private Long id;
 	
+	private String name;
+	
 	/** 类型(乐器、辅件、教材、课程) */
 	@ApiModelProperty(value = "类型",required = true)
 	private OrderDetailTypeEnum type;
@@ -50,7 +52,7 @@ public class StudentPaymentOrderDetail {
 	private List<Goods> goodsList;
 
 	//减免费用
-	private BigDecimal remitFee;
+	private BigDecimal remitFee = BigDecimal.ZERO;
 
 	//学生乐器id
 	private Long studentInstrumentId;
@@ -71,6 +73,14 @@ public class StudentPaymentOrderDetail {
 		return this.id;
 	}
 
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
 	public OrderDetailTypeEnum getType() {
 		return type;
 	}

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

@@ -138,6 +138,8 @@ public class StudentRegistration {
 
     @ApiModelProperty(value = "会员截止时间",required = true)
     private Date membershipEndTime;
+    
+    private Long musicGroupPaymentCalenderId;
 
     public Date getMembershipEndTime() {
         return membershipEndTime;
@@ -489,4 +491,12 @@ public class StudentRegistration {
     public void setNoneNeedCloudTeacher(Integer noneNeedCloudTeacher) {
         this.noneNeedCloudTeacher = noneNeedCloudTeacher;
     }
+
+	public Long getMusicGroupPaymentCalenderId() {
+		return musicGroupPaymentCalenderId;
+	}
+
+	public void setMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId) {
+		this.musicGroupPaymentCalenderId = musicGroupPaymentCalenderId;
+	}
 }

+ 70 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicCompareRecord.java

@@ -0,0 +1,70 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(sys_music_compare_record):
+ */
+public class SysMusicCompareRecord {
+
+	/**  */
+	private Long id;
+	
+	/** 用户编号 */
+	private Integer userId;
+	
+	/** 教程编号 */
+	private Integer sysMusicScoreId;
+	
+	/** 评分数据 */
+	private String scoreData;
+	
+	/** 创建时间 */
+	private java.util.Date createTime;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setSysMusicScoreId(Integer sysMusicScoreId){
+		this.sysMusicScoreId = sysMusicScoreId;
+	}
+	
+	public Integer getSysMusicScoreId(){
+		return this.sysMusicScoreId;
+	}
+			
+	public void setScoreData(String scoreData){
+		this.scoreData = scoreData;
+	}
+	
+	public String getScoreData(){
+		return this.scoreData;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

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

@@ -6,7 +6,6 @@ import com.ym.mec.common.enums.BaseEnum;
  * '交易状态(1,交易中;2,成功交易;3,交易失败,4交易关闭;)',
  */
 public enum DealStatusEnum implements BaseEnum<String, DealStatusEnum> {
-	WAIT_PAY("WAIT_PAY", "等待支付"),
 	ING("ING", "交易中"),
 	SUCCESS("SUCCESS", "成功交易"),
 	FAILED("FAILED", "交易失败"),

+ 31 - 27
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -27,37 +27,37 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     STUDENT_PUSH_ONLINE_COURSE_ACTION("STUDENT_PUSH_ONLINE_COURSE_ACTION", "线上课开始"),
     STUDENT_PUSH_NAMES_ACHIEVE("STUDENT_PUSH_NAMES_ACHIEVE", "点名完成"),
     SYSTEM_PUSH_NAMES_ACHIEVE("SYSTEM_PUSH_NAMES_ACHIEVE", "点名完成"),
-//    SCHEDULE_CHANGE("SCHEDULE_CHANGE", "课表变动"),
+    //    SCHEDULE_CHANGE("SCHEDULE_CHANGE", "课表变动"),
 //    STUDENT_SMS_TEACHING_SCHOOL_CHANGE("STUDENT_SMS_TEACHING_SCHOOL_CHANGE", "教学点变动"),
     STUDENT_PUSH_JOB_MESSAGE("STUDENT_PUSH_JOB_MESSAGE", "作业提醒"),
-//    STUDENT_PUSH_CLASS_MESSAGE("STUDENT_PUSH_CLASS_MESSAGE", "班级消息"),
+    //    STUDENT_PUSH_CLASS_MESSAGE("STUDENT_PUSH_CLASS_MESSAGE", "班级消息"),
     TEACHER_PUSH_MUSIC_GROUP_COURSE_ADD_PLAN("TEACHER_PUSH_MUSIC_GROUP_COURSE_ADD_PLAN", "乐团课新增安排"),
     TEACHER_SMS_PUSH_VIP_COURSE_APPLY_RESULT("TEACHER_SMS_PUSH_VIP_COURSE_APPLY_RESULT", "VIP课申请结果"),
     TEACHER_SMS_VIP_COURSE_ADD("TEACHER_SMS_VIP_COURSE_ADD", "VIP课新增"),
     TEACHER_PUSH_VIP_COURSE_STOP("TEACHER_PUSH_VIP_COURSE_STOP", "VIP课停止"),
-//    TEACHER_PUSH_ACTION_COURSE_MESSAGE("TEACHER_PUSH_ACTION_COURSE_MESSAGE", "开课提醒"),
+    //    TEACHER_PUSH_ACTION_COURSE_MESSAGE("TEACHER_PUSH_ACTION_COURSE_MESSAGE", "开课提醒"),
     TEACHER_PUSH_HAVE_COURSE_MESSAGE("TEACHER_PUSH_HAVE_COURSE_MESSAGE", "有课提醒"),
     TEACHER_PUSH_ATTEND_CLASS_MESSAGE("TEACHER_PUSH_ATTEND_CLASS_MESSAGE", "上课提醒"),
-//    TEACHER_PUSH_SIGN_IN_MESSAGE("TEACHER_PUSH_SIGN_IN_MESSAGE", "签到提醒"),
+    //    TEACHER_PUSH_SIGN_IN_MESSAGE("TEACHER_PUSH_SIGN_IN_MESSAGE", "签到提醒"),
 //    TEACHER_PUSH_NAMES_MESSAGE("TEACHER_PUSH_NAMES_MESSAGE", "点名提醒"),
     TEACHER_PUSH_SIGN_OUT_MESSAGE("TEACHER_PUSH_SIGN_OUT_MESSAGE", "签退提醒"),
     TEACHER_PUSH_JOB_WAIT_REPLY("TEACHER_PUSH_JOB_WAIT_REPLY", "作业待回复"),
-//    TEACHER_PUSH_SUBSTITUTE_PLAN("TEACHER_PUSH_SUBSTITUTE_PLAN", "代课安排"),
+    //    TEACHER_PUSH_SUBSTITUTE_PLAN("TEACHER_PUSH_SUBSTITUTE_PLAN", "代课安排"),
     TEACHER_PUSH_LEAVE_RESULT("TEACHER_PUSH_LEAVE_RESULT", "请假结果"),
     TEACHER_PUSH_COURSE_SCHEDULE_CHANGE_RESULT("TEACHER_PUSH_COURSE_SCHEDULE_CHANGE_RESULT", "课时调整结果"),
     TEACHER_PUSH_STUDENT_LEAVE("TEACHER_PUSH_STUDENT_LEAVE", "学员请假"),
-//    TEACHER_PUSH_CLASS_MESSAGE("TEACHER_PUSH_CLASS_MESSAGE", "班级消息"),
+    //    TEACHER_PUSH_CLASS_MESSAGE("TEACHER_PUSH_CLASS_MESSAGE", "班级消息"),
     STUDENT_SMS_PAYMENT_FAILED("STUDENT_SMS_PAYMENT_FAILED", "缴费失败结果通知"),
-//    STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED("STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED", "乐团续费失败结果"),
+    //    STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED("STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED", "乐团续费失败结果"),
     STUDENT_PUSH_VIP_STOP("STUDENT_PUSH_VIP_STOP", "VIP课取消"),
-//    SMS_MUSIC_GROUP_ADD_STUDENT("SMS_MUSIC_GROUP_ADD_STUDENT", "入团通知"),
+    //    SMS_MUSIC_GROUP_ADD_STUDENT("SMS_MUSIC_GROUP_ADD_STUDENT", "入团通知"),
     TEACHER_PUSH_VIP_STOP("TEACHER_PUSH_VIP_STOP", "VIP课取消"),
     STUDENT_SMS_OPEN_PAYMENT("STUDENT_SMS_OPEN_PAYMENT", "开启缴费"),
-//    SMS_MUSIC_GROUP_ADD_STUDENT_FREE("SMS_MUSIC_GROUP_ADD_STUDENT_FREE", "入团通知"),
+    //    SMS_MUSIC_GROUP_ADD_STUDENT_FREE("SMS_MUSIC_GROUP_ADD_STUDENT_FREE", "入团通知"),
     STUDENT_SMS_PUSH_SPORADIC_PAYMENT_SUCCESS("STUDENT_SMS_PUSH_SPORADIC_PAYMENT_SUCCESS", "零星支付成功结果"),
     STUDENT_SMS_PUSH_SPORADIC_PAYMENT_FAILED("STUDENT_SMS_PUSH_SPORADIC_PAYMENT_FAILED", "零星支付失败结果"),
     TEACHER_PUSH_COURSE_COLLIDE("TEACHER_PUSH_COURSE_COLLIDE", "课程冲突"),
-//    PUSH_STUDY_REPORT("PUSH_STUDY_REPORT", "陪练报告"),
+    //    PUSH_STUDY_REPORT("PUSH_STUDY_REPORT", "陪练报告"),
     STUDENT_SMS_PUSH_PAY_PRACTICE_BUY_SUCCESS("STUDENT_SMS_PUSH_PAY_PRACTICE_BUY_SUCCESS", "网管课购买成功"),
     STUDENT_SMS_PUSH_PRACTICE_COMPLETED_STUDY_REPORT("STUDENT_SMS_PUSH_PRACTICE_COMPLETED_STUDY_REPORT", "网管课完成学习报告"),
     STUDENT_SMS_PUSH_FREE_PRACTICE_APPLY_PUSH("STUDENT_SMS_PUSH_FREE_PRACTICE_APPLY_PUSH", "免费陪练课预约推送"),
@@ -75,7 +75,9 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     IM_HOMEWORK_TEACHER_REPLY_PUSH("IM_HOMEWORK_TEACHER_REPLY_PUSH", "作业点评提醒"),
     IM_HOMEWORK_REMIND_DETAIL("IM_HOMEWORK_REMIND_DETAIL", "作业提醒"),
 
-    /** 课外训练消息 */
+    /**
+     * 课外训练消息
+     */
     STUDENT_PUSH_EXTRA_REMIND("STUDENT_PUSH_EXTRA_REMIND", "作业提醒"),
     EXTRA_REMIND_IM("EXTRA_REMIND_IM", "作业提醒"),
     EXTRA_REMIND_IM_DETAIL("EXTRA_REMIND_IM_DETAIL", "作业提醒"),
@@ -90,10 +92,10 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_PUSH_SALARY_CONFIRM("TEACHER_PUSH_SALARY_CONFIRM", "课酬确认"),
     STUDENT_PUSH_TRIAL_PRACTICE_CREATE("STUDENT_PUSH_TRIAL_PRACTICE_CREATE", "试听课安排"),
     TEACHER_SMS_PUSH_PRACTICE_CREATE("TEACHER_SMS_PUSH_PRACTICE_CREATE", "新增网管课程"),
-    STUDENT_PUSH_REPAIR_UNSEND_COMPLETED("STUDENT_PUSH_REPAIR_UNSEND_COMPLETED","乐器维修完成自取"),
-    STUDENT_PUSH_REPAIR_SEND_COMPLETED("STUDENT_PUSH_REPAIR_SEND_COMPLETED","乐器维修完成邮寄"),
-    STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS("STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS","乐器线上维修支付成功"),
-    STUDENT_PUSH_REPAIR_OFFLINE_PAYMENT_SUCCESS("STUDENT_PUSH_REPAIR_OFFLINE_PAYMENT_SUCCESS","乐器线下维修支付成功"),
+    STUDENT_PUSH_REPAIR_UNSEND_COMPLETED("STUDENT_PUSH_REPAIR_UNSEND_COMPLETED", "乐器维修完成自取"),
+    STUDENT_PUSH_REPAIR_SEND_COMPLETED("STUDENT_PUSH_REPAIR_SEND_COMPLETED", "乐器维修完成邮寄"),
+    STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS("STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS", "乐器线上维修支付成功"),
+    STUDENT_PUSH_REPAIR_OFFLINE_PAYMENT_SUCCESS("STUDENT_PUSH_REPAIR_OFFLINE_PAYMENT_SUCCESS", "乐器线下维修支付成功"),
 
     TEACHER_PUSH_MUSIC_NETWORK_CRATE("TEACHER_PUSH_MUSIC_NETWORK_CRATE", "乐团网管课安排"),
     STUDENT_PUSH_MUSIC_NETWORK_CRATE("STUDENT_PUSH_MUSIC_NETWORK_CRATE", "乐团课通知"),
@@ -101,13 +103,13 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     STUDENT_PUSH_PRACTICE_RENEW_REMIND("STUDENT_PUSH_PRACTICE_RENEW_REMIND", "网管课续费推送"),
     TEACHER_PUSH_ATTENDANCE_COMPLAINTS_RESULT("TEACHER_PUSH_ATTENDANCE_COMPLAINTS_RESULT", "考勤申述结果"),
     TEACHER_PUSH_PUBLIC_EXTRA_REMIND("TEACHER_PUSH_PUBLIC_EXTRA_REMIND", "本周应布置课外训练"),
-    SYSTEM_SMS_PUSH_PAYMENT_DETAIL("SYSTEM_SMS_PUSH_PAYMENT_DETAIL","缴费项目缴费详情提醒"),
-    SYSTEM_SMS_PUSH_PAYMENT_CREATE("SYSTEM_SMS_PUSH_PAYMENT_CREATE","缴费项目创建提醒"),
-    SYSTEM_SMS_GOODS_REPERTORY_WARN("SYSTEM_SMS_GOODS_REPERTORY_WARN","商品库存预警"),
+    SYSTEM_SMS_PUSH_PAYMENT_DETAIL("SYSTEM_SMS_PUSH_PAYMENT_DETAIL", "缴费项目缴费详情提醒"),
+    SYSTEM_SMS_PUSH_PAYMENT_CREATE("SYSTEM_SMS_PUSH_PAYMENT_CREATE", "缴费项目创建提醒"),
+    SYSTEM_SMS_GOODS_REPERTORY_WARN("SYSTEM_SMS_GOODS_REPERTORY_WARN", "商品库存预警"),
     SYSTEM_PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY("SYSTEM_PUSH_STUDENT_COMMIT_QUIT_MUSIC_APPLY", "学员申请退团"),
     SYSTEM_PUSH_STUDENT_REVOKE_QUIT_MUSIC_APPLY("SYSTEM_PUSH_STUDENT_REVOKE_QUIT_MUSIC_APPLY", "撤销退团申请"),
-    STUDENT_SMS_IM_MUSIC_GROUP_PARENT_MEETING_NOTICE("STUDENT_SMS_IM_MUSIC_GROUP_PARENT_MEETING_NOTICE","乐团家长会通知"),
-    SYSTEM_PUSH_SMS_INSPECTION_NOTICE("SYSTEM_PUSH_SMS_INSPECTION_NOTICE","巡查日程提醒"),
+    STUDENT_SMS_IM_MUSIC_GROUP_PARENT_MEETING_NOTICE("STUDENT_SMS_IM_MUSIC_GROUP_PARENT_MEETING_NOTICE", "乐团家长会通知"),
+    SYSTEM_PUSH_SMS_INSPECTION_NOTICE("SYSTEM_PUSH_SMS_INSPECTION_NOTICE", "巡查日程提醒"),
     STUDENT_SMS_WAIT_RENEW_MESSAGE("STUDENT_SMS_WAIT_RENEW_MESSAGE", "待续费通知"),
     TEACHER_PUSH_SERVE("TEACHER_PUSH_SERVE", "服务指标未完成提醒"),
     STUDENT_PUSH_MAINTENANCE_NOTICE("STUDENT_PUSH_MAINTENANCE_NOTICE", "乐保到期提醒"),
@@ -126,7 +128,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_PUSH_VIP_COURSE_ADD("TEACHER_PUSH_VIP_COURSE_ADD", "VIP课新增"),
 
 
-//    EDUCATION_PUSH_MUSIC_GROUP_FOUND("EDUCATION_PUSH_MUSIC_GROUP_FOUND", "乐团成立"),
+    //    EDUCATION_PUSH_MUSIC_GROUP_FOUND("EDUCATION_PUSH_MUSIC_GROUP_FOUND", "乐团成立"),
 //    EDUCATION_PUSH_MUSIC_GROUP_CLOSE("EDUCATION_PUSH_MUSIC_GROUP_CLOSE", "乐团关闭"),
 //    EDUCATION_PUSH_COURSE_CHANGE("EDUCATION_PUSH_COURSE_CHANGE", "课程调整"),
 //    EDUCATION_PUSH_TOMORROW_COURSE_PLAN("EDUCATION_PUSH_TOMORROW_COURSE_PLAN", "明日课程安排"),
@@ -145,7 +147,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
 
     BACKSTAGE_CREATE_MUSIC_GROUP_APPLY("BACKSTAGE_CREATE_MUSIC_GROUP_APPLY", "建团申请"),
     BACKSTAGE_CREATE_MUSIC_GROUP_ADJUST_SUCCESS("BACKSTAGE_CREATE_MUSIC_GROUP_ADJUST_SUCCESS", "建团申请审核通过"),
-//    BACKSTAGE_ACTION_APPLY("BACKSTAGE_ACTION_APPLY", "开启报名"),
+    //    BACKSTAGE_ACTION_APPLY("BACKSTAGE_ACTION_APPLY", "开启报名"),
     BACKSTAGE_PAYMENT_CALENDER_AUDIT("BACKSTAGE_PAYMENT_CALENDER_AUDIT", "缴费项目审核"),
     BACKSTAGE_ACTION_PAYMENT("BACKSTAGE_ACTION_PAYMENT", "开启缴费"),
 
@@ -153,18 +155,18 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     BACKSTAGE_ACTION_GROUP("BACKSTAGE_ACTION_GROUP", "开团"),
     BACKSTAGE_STUDENT_SUBJECT_CHANGE("BACKSTAGE_STUDENT_SUBJECT_CHANGE", "学员声部调整"),
     BACKSTAGE_MUSIC_GROUP_MARKING("BACKSTAGE_MUSIC_GROUP_MARKING", "乐团筹备中"),
-//    BACKSTAGE_MARK_OK("BACKSTAGE_MARK_OK", "筹备完成"),
+    //    BACKSTAGE_MARK_OK("BACKSTAGE_MARK_OK", "筹备完成"),
 //    BACKSTAGE_MARK_QUIT("BACKSTAGE_MARK_QUIT", "筹备中,退回"),
     BACKSTAGE_MUSIC_GROUP_ADD_STUDENT("BACKSTAGE_MUSIC_GROUP_ADD_STUDENT", "乐团添加学员"),
-//    BACKSTAGE_TEACHER_AMOUNT_CHANGE("BACKSTAGE_TEACHER_AMOUNT_CHANGE", "老师课酬调整"),
+    //    BACKSTAGE_TEACHER_AMOUNT_CHANGE("BACKSTAGE_TEACHER_AMOUNT_CHANGE", "老师课酬调整"),
 //    BACKSTAGE_COURSE_CHANGE("BACKSTAGE_COURSE_CHANGE", "课时、课程调整"),
 //    BACKSTAGE_MUSIC_GROUP_IN_CHANGE("BACKSTAGE_MUSIC_GROUP_IN_CHANGE", "乐团内调整"),
 //    BACKSTAGE_SPAN_GROUP_CHANGE("BACKSTAGE_SPAN_GROUP_CHANGE", "跨越团调整"),
     BACKSTAGE_MUSIC_GROUP_STOP("BACKSTAGE_MUSIC_GROUP_STOP", "乐团暂停"),
-//    BACKSTAGE_MUSIC_GROUP_CLOSE("BACKSTAGE_MUSIC_GROUP_CLOSE", "乐团结束"),
+    //    BACKSTAGE_MUSIC_GROUP_CLOSE("BACKSTAGE_MUSIC_GROUP_CLOSE", "乐团结束"),
 //    BACKSTAGE_VIP_COURSE_APPLY("BACKSTAGE_VIP_COURSE_APPLY", "VIP课申请"),
     BACKSTAGE_TEACHER_APPLY_VIP("BACKSTAGE_TEACHER_APPLY_VIP", "VIP课申请"),
-//    BACKSTAGE_VIP_COURSE_STOP("BACKSTAGE_VIP_COURSE_STOP", "VIP课停止"),
+    //    BACKSTAGE_VIP_COURSE_STOP("BACKSTAGE_VIP_COURSE_STOP", "VIP课停止"),
 //    BACKSTAGE_TEACHER_FREEZE("BACKSTAGE_TEACHER_FREEZE", "老师冻结"),
 //    BACKSTAGE_TEACHER_POSITIVE("BACKSTAGE_TEACHER_POSITIVE", "老师转正"),
 //    BACKSTAGE_STUDENT_OK_QUIT_GROUP("BACKSTAGE_STUDENT_OK_QUIT_GROUP", "学员确认退团"),
@@ -179,7 +181,9 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     BACKSTAGE_STUDENT_APPLY_WITHDRAW("BACKSTAGE_STUDENT_APPLY_WITHDRAW", "学员申请提现"),
     CHILDREN_DAY_NOTICE_PUSH("CHILDREN_DAY_NOTICE_PUSH", "技能评测考级报名推送"),
     CHILDREN_DAY_NOTICE_MSG("CHILDREN_DAY_NOTICE_MSG", "技能评测考级报名短信"),
-    NO_BUY_CLOUD_TEACHER_MSG("NO_BUY_CLOUD_TEACHER_MSG", "未购买买云教练短信");
+    NO_BUY_CLOUD_TEACHER_MSG("NO_BUY_CLOUD_TEACHER_MSG", "未购买买云教练短信"),
+    OA_NOTICE_PUSH("OA_NOTICE_PUSH", "待审批提醒"),
+    OA_CC_NOTICE_PUSH("OA_CC_NOTICE_PUSH", "审批抄送提醒");
 
     MessageTypeEnum(String code, String msg) {
         this.code = code;

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

@@ -7,6 +7,7 @@ import com.ym.mec.common.enums.BaseEnum;
  */
 public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	APPLY("APPLY", "报名"),
+	ADD_STUDENT("ADD_STUDENT","进行中加学员"),
 	RENEW("RENEW", "续费"),
 	SPORADIC("SPORADIC", "零星收费"),
 	OTHER("OTHER", "其他"),

+ 12 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentRegistrationQueryInfo.java

@@ -2,11 +2,8 @@ package com.ym.mec.biz.dal.page;
 
 import io.swagger.annotations.ApiModelProperty;
 
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.common.page.QueryInfo;
 
-import javax.xml.crypto.Data;
-
 public class StudentRegistrationQueryInfo extends QueryInfo {
 
     @ApiModelProperty(value = "乐团编号",required = false)
@@ -24,6 +21,9 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "学员缴费状态 0-未开启缴费 1-开启缴费 2-已缴费",required = false)
     private String paymentStatus;
 
+    @ApiModelProperty(value = "学员在读状态",required = false)
+    private String studentStatus;
+
     @ApiModelProperty(value = "用户名或手机号",required = false)
     private String name;
 
@@ -103,7 +103,15 @@ public class StudentRegistrationQueryInfo extends QueryInfo {
         this.paymentStatus = paymentStatus;
     }
 
-    public String getCreateYear() {
+    public String getStudentStatus() {
+		return studentStatus;
+	}
+
+	public void setStudentStatus(String studentStatus) {
+		this.studentStatus = studentStatus;
+	}
+
+	public String getCreateYear() {
         return createYear;
     }
 

+ 440 - 0
mec-biz/src/main/java/com/ym/mec/biz/handler/WebSocketHandler.java

@@ -0,0 +1,440 @@
+package com.ym.mec.biz.handler;
+
+import be.tarsos.dsp.AudioDispatcher;
+import be.tarsos.dsp.io.jvm.AudioDispatcherFactory;
+import be.tarsos.dsp.pitch.PitchProcessor;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.biz.dal.dto.MusicPitchDetailDto;
+import com.ym.mec.biz.dal.dto.SoundCompareHelper;
+import com.ym.mec.biz.dal.dto.WavHeader;
+import com.ym.mec.biz.dal.dto.WebSocketInfo;
+import com.ym.mec.biz.service.SoundSocketService;
+import com.ym.mec.biz.service.SysMusicCompareRecordService;
+import com.ym.mec.common.constant.CommonConstants;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.socket.*;
+import org.springframework.web.socket.handler.AbstractWebSocketHandler;
+
+import javax.sound.sampled.AudioFormat;
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/9 0009
+ */
+@Service
+public class WebSocketHandler extends AbstractWebSocketHandler {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketHandler.class);
+
+    //存储客户端链接
+    public static final Map<String, WebSocketSession> WS_CLIENTS = new ConcurrentHashMap<>();
+
+    private final BigDecimal oneHundred = new BigDecimal(100);
+
+    //检测偏移时长的最终时间
+    private final int endCheckOffsetTime = 500;
+
+    private final float simpleRate = 44100;
+    private int simpleSize = 1024;
+
+    private final AudioFormat audioFormat = new AudioFormat(simpleRate, 16, 1, true, false);
+    private static final PitchProcessor.PitchEstimationAlgorithm algo = PitchProcessor.PitchEstimationAlgorithm.FFT_YIN;
+
+    private static final String tmpDir = FileUtils.getTempDirectoryPath() + "/soundCompare/";
+
+    //用户对应评分信息
+    private Map<String, SoundCompareHelper> userSoundInfoMap = new ConcurrentHashMap<>();
+
+    @Autowired
+    private SysMusicCompareRecordService sysMusicCompareRecordService;
+
+    public WebSocketHandler() {
+        super();
+        File soundDir = new File(tmpDir);
+        if(!soundDir.exists()){
+            soundDir.mkdir();
+        }
+    }
+
+    @Override
+    public void afterConnectionEstablished(WebSocketSession session) throws Exception {
+        String phone = session.getPrincipal().getName().split(":")[1];
+        LOGGER.info("{}上线", phone);
+        WS_CLIENTS.put(phone, session);
+        super.afterConnectionEstablished(session);
+    }
+
+    @Override
+    public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
+        super.handleMessage(session, message);
+    }
+
+    @Override
+    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
+        String phone = session.getPrincipal().getName().split(":")[1];
+        LOGGER.info("{}: {}", phone, message.getPayload());
+        WebSocketInfo webSocketInfo = JSON.parseObject(message.getPayload(), WebSocketInfo.class);
+        JSONObject bodyObject = (JSONObject) webSocketInfo.getBody();
+
+        String commond = "";
+        if(webSocketInfo.getHeader().containsKey(SoundSocketService.COMMOND)){
+            commond = webSocketInfo.getHeader().get(SoundSocketService.COMMOND);
+        }
+        switch (commond){
+            case SoundSocketService.MUSIC_XML:
+                userSoundInfoMap.put(phone, new SoundCompareHelper());
+                List<MusicPitchDetailDto> musicXmlInfos = JSON.parseArray(bodyObject.getString("musicXmlInfos"), MusicPitchDetailDto.class);
+                userSoundInfoMap.get(phone).setMusicScoreId(bodyObject.getInteger("id"));
+                userSoundInfoMap.get(phone).setMeasureXmlInfoMap(musicXmlInfos.stream().collect(Collectors.groupingBy(MusicPitchDetailDto::getMeasureIndex)));
+                for (Map.Entry<Integer, List<MusicPitchDetailDto>> userMeasureXmlInfoEntry : userSoundInfoMap.get(phone).getMeasureXmlInfoMap().entrySet()) {
+                    MusicPitchDetailDto musicPitchDetailDto = userMeasureXmlInfoEntry.getValue().stream().max(Comparator.comparing(MusicPitchDetailDto::getTimeStamp)).get();
+                    userSoundInfoMap.get(phone).getMeasureEndTime().put(userMeasureXmlInfoEntry.getKey(), musicPitchDetailDto.getTimeStamp()+musicPitchDetailDto.getDuration());
+                }
+                break;
+            case SoundSocketService.RECORD_START:
+                if(!userSoundInfoMap.containsKey(phone)){
+                    break;
+                }
+                File file = new File(tmpDir+phone + "_"+ userSoundInfoMap.get(phone).getMusicScoreId() +"_"+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) +".wav");
+                userSoundInfoMap.get(phone).setAccessFile(new RandomAccessFile(file, "rw"));
+                break;
+            case SoundSocketService.RECORD_END:
+                if(!userSoundInfoMap.containsKey(phone)){
+                    break;
+                }
+                if(!CollectionUtils.isEmpty(userSoundInfoMap.get(phone).getMeasureEndTime())){
+                    Integer lastMeasureIndex = userSoundInfoMap.get(phone).getMeasureEndTime().keySet().stream().min(Integer::compareTo).get();
+                    double recordTime = userSoundInfoMap.get(phone).getAccessFile().length()/(audioFormat.getFrameSize()*audioFormat.getFrameRate())*1000;
+                    //如果结束时时长大于某小节,则此小节需要评分
+                    if(recordTime>userSoundInfoMap.get(phone).getMeasureEndTime().get(lastMeasureIndex)){
+                        measureCompare(phone, lastMeasureIndex);
+                        userSoundInfoMap.get(phone).getMeasureEndTime().remove(lastMeasureIndex);
+                    }
+                }
+                calTotalScore(phone);
+                createHeader(phone);
+                break;
+            case SoundSocketService.RECORD_CANCEL:
+                createHeader(phone);
+                break;
+            default:
+                break;
+        }
+    }
+
+    @Override
+    protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message) throws Exception {
+        String phone = session.getPrincipal().getName().split(":")[1];
+        if(!userSoundInfoMap.containsKey(phone)){
+            return;
+        }
+        if(Objects.nonNull(userSoundInfoMap.get(phone).getAccessFile())){
+            userSoundInfoMap.get(phone).getAccessFile().write(message.getPayload().array());
+        }
+        List<MusicPitchDetailDto> recordInfo = new ArrayList<>();
+        AudioDispatcher dispatcher = AudioDispatcherFactory.fromByteArray(message.getPayload().array(), audioFormat, simpleSize, 128);
+        dispatcher.addAudioProcessor(new PitchProcessor(algo, simpleRate, simpleSize, (pitchDetectionResult, audioEvent) -> {
+            int timeStamp = (int) (userSoundInfoMap.get(phone).getMeasureStartTime() + audioEvent.getTimeStamp()*1000);
+            float pitch = pitchDetectionResult.getPitch();
+//            LOGGER.info("频率:{}, {}", timeStamp, pitch);
+            recordInfo.add(new MusicPitchDetailDto(timeStamp, pitch));
+        }));
+        dispatcher.run();
+        if(Objects.isNull(userSoundInfoMap.get(phone).getAccessFile())){
+            return;
+        }
+
+        double recordTime = userSoundInfoMap.get(phone).getAccessFile().length()/(audioFormat.getFrameSize()*audioFormat.getFrameRate())*1000;
+
+        userSoundInfoMap.get(phone).setMeasureStartTime(recordTime);
+        userSoundInfoMap.get(phone).getRecordMeasurePithInfo().addAll(recordInfo);
+
+        //如果是第一小节,需要计算出录音与播放不同步导致的空白时间偏移量
+        if(userSoundInfoMap.get(phone).getOffsetTime()<=0&&recordTime<endCheckOffsetTime){
+            int hasPitchNum = 0;
+            for (MusicPitchDetailDto ri : userSoundInfoMap.get(phone).getRecordMeasurePithInfo()) {
+                if(hasPitchNum<=0){
+                    userSoundInfoMap.get(phone).setOffsetTime(ri.getTimeStamp());
+                }
+                if(ri.getFrequency()>0){
+                    hasPitchNum++;
+                }else{
+                    hasPitchNum=0;
+                }
+                if(hasPitchNum>=3){
+                    LOGGER.info("偏移时间:{}", userSoundInfoMap.get(phone).getOffsetTime());
+                    break;
+                }
+            }
+            if(hasPitchNum<3){
+                userSoundInfoMap.get(phone).setOffsetTime(0);
+            }
+        }
+
+        if(userSoundInfoMap.get(phone).getOffsetTime()<=0&&recordTime<endCheckOffsetTime){
+            return;
+        }
+        for (Map.Entry<Integer, Integer> userMeasureEndTimeMapEntry : userSoundInfoMap.get(phone).getMeasureEndTime().entrySet()) {
+            if((recordTime - userSoundInfoMap.get(phone).getOffsetTime())>userMeasureEndTimeMapEntry.getValue()){
+                measureCompare(phone, userMeasureEndTimeMapEntry.getKey());
+                userSoundInfoMap.get(phone).getMeasureEndTime().remove(userMeasureEndTimeMapEntry.getKey());
+                break;
+            }
+        }
+    }
+
+    @Override
+    protected void handlePongMessage(WebSocketSession session, PongMessage message) throws Exception {
+        super.handlePongMessage(session, message);
+        LOGGER.info("心跳信息:{}", new String(message.getPayload().array(), "utf-8"));
+    }
+
+    @Override
+    public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
+        String phone = session.getPrincipal().getName().split(":")[1];
+        session.close();
+        if(!WS_CLIENTS.containsKey(phone)){
+            return;
+        }
+        exception.printStackTrace();
+        LOGGER.info("发生了错误,移除客户端: {}", phone);
+        WS_CLIENTS.remove(phone);
+        createHeader(phone);
+    }
+
+    @Override
+    public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
+        super.afterConnectionClosed(session, status);
+        String phone = session.getPrincipal().getName().split(":")[1];
+        LOGGER.info("{}离线", phone);
+        WS_CLIENTS.remove(phone);
+        createHeader(phone);
+    }
+
+    @Override
+    public boolean supportsPartialMessages() {
+        return super.supportsPartialMessages();
+    }
+
+    /**
+     * @describe 保存录音数据,并生成wav头信息
+     * @author Joburgess
+     * @date 2021/6/25 0025
+     * @param phone:
+     * @return void
+     */
+    private void createHeader(String phone) throws IOException {
+        if(!userSoundInfoMap.containsKey(phone)){
+            return;
+        }
+        if(Objects.nonNull(userSoundInfoMap.get(phone).getAccessFile())){
+            RandomAccessFile randomAccessFile = userSoundInfoMap.get(phone).getAccessFile();
+            LOGGER.info("音频时长:{}", randomAccessFile.length()/(audioFormat.getFrameSize()*audioFormat.getFrameRate())*1000);
+            randomAccessFile.seek(0);
+            randomAccessFile.write(WavHeader.getWaveHeader(randomAccessFile.length(), (long) audioFormat.getFrameRate(), audioFormat.getSampleSizeInBits()));
+            randomAccessFile.close();
+            userSoundInfoMap.get(phone).setAccessFile(null);
+        }
+//        userSoundInfoMap.get(phone).setRecordMeasurePithInfo(null);
+        LOGGER.info("评分数据:{}", JSON.toJSONString(userSoundInfoMap.get(phone)));
+        userSoundInfoMap.remove(phone);
+    }
+
+    /**
+     * @describe 数据比对,生成分数
+     * @author Joburgess
+     * @date 2021/6/25 0025
+     * @param phone:
+     * @param measureIndex:
+     * @return void
+     */
+    private void measureCompare(String phone, int measureIndex) throws IOException {
+        //相似度
+        BigDecimal intonation = BigDecimal.ZERO;
+        //节奏
+        BigDecimal cadence = BigDecimal.ZERO;
+        //完整度
+        BigDecimal integrity = BigDecimal.ZERO;
+
+        try {
+            //最低有效频率
+            float minValidFrequency = 20;
+
+            //有效音频数量
+            float validNum = 0;
+            //音频有效阈值
+            float validDuty = 0.5f;
+
+            //音准匹配数量
+            float intonationNum = 0;
+            //音准匹配误差范围
+            float intonationErrRange = 15;
+            //音准有效阈值
+            float intonationValidDuty = 0.7f;
+
+            //节奏匹配数量
+            float cadenceNum = 0;
+            //节奏匹配误差范围
+            float cadenceErrRange = 30;
+            //节奏有效阈值
+            float cadenceValidDuty = 0.6f;
+
+            int totalCompareNum = userSoundInfoMap.get(phone).getMeasureXmlInfoMap().get(measureIndex).size();
+
+            for (MusicPitchDetailDto musicXmlInfo : userSoundInfoMap.get(phone).getMeasureXmlInfoMap().get(measureIndex)) {
+                int startTimeStamp = musicXmlInfo.getTimeStamp() + userSoundInfoMap.get(phone).getOffsetTime();
+                int endTimeStamp = musicXmlInfo.getTimeStamp()+musicXmlInfo.getDuration() + userSoundInfoMap.get(phone).getOffsetTime();
+
+                //时间范围内有效音准数量
+                float recordValidIntonationNum = 0;
+                //时间范围内有效节奏数量
+                float cadenceValidNum = 0;
+                //时间范围内有效音频数量
+                float recordValidNum = 0;
+                //时间范围内匹配次数
+                float compareNum = 0;
+                for (MusicPitchDetailDto recordInfo : userSoundInfoMap.get(phone).getRecordMeasurePithInfo()) {
+                    //如果在时间范围之外直接跳过
+                    if(recordInfo.getTimeStamp()<startTimeStamp||recordInfo.getTimeStamp()>endTimeStamp){
+                        continue;
+                    }
+//                    LOGGER.info("{}频率({}-{}):{}, {}", recordInfo.getTimeStamp(), startTimeStamp, endTimeStamp, musicXmlInfo.getFrequency(), recordInfo.getFrequency());
+                    compareNum++;
+                    //如果在最低有效频率以下则跳过
+                    if(recordInfo.getFrequency()<minValidFrequency&&musicXmlInfo.getFrequency()!=-1){
+                        continue;
+                    }
+                    recordValidNum++;
+                    //如果频率差值在节奏误差范围内
+                    if(Math.abs(recordInfo.getFrequency()-musicXmlInfo.getFrequency())<=cadenceErrRange){
+                        cadenceValidNum++;
+                    }
+                    //如果频率差值在音准误差范围内
+                    if(Math.abs(recordInfo.getFrequency()-musicXmlInfo.getFrequency())<=intonationErrRange){
+                        recordValidIntonationNum++;
+                    }
+                }
+                //有效音频占比
+                float recordValidDuty = recordValidNum/compareNum;
+                if(recordValidDuty<validDuty){
+                    continue;
+                }
+                validNum++;
+                //有效音高占比
+                float intonationDuty = recordValidIntonationNum/compareNum;
+                //有效节奏占比
+                float cadenceDuty = cadenceValidNum/compareNum;
+                if(intonationDuty>=intonationValidDuty){
+                    intonationNum++;
+                }
+                if(cadenceDuty>=cadenceValidDuty){
+                    cadenceNum++;
+                }
+            }
+
+            intonation = new BigDecimal(intonationNum).divide(new BigDecimal(totalCompareNum), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(oneHundred).setScale(0, BigDecimal.ROUND_HALF_UP);
+            cadence = new BigDecimal(cadenceNum).divide(new BigDecimal(totalCompareNum), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(oneHundred).setScale(0, BigDecimal.ROUND_HALF_UP);
+            integrity = new BigDecimal(validNum).divide(new BigDecimal(totalCompareNum), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(oneHundred).setScale(0, BigDecimal.ROUND_HALF_UP);
+        } catch (ArithmeticException e){
+            LOGGER.info("无musicXml信息");
+        }
+
+        if(userSoundInfoMap.get(phone).getUserScoreMap().containsKey("intonation")){
+            userSoundInfoMap.get(phone).getUserScoreMap().put("intonation", intonation.add(userSoundInfoMap.get(phone).getUserScoreMap().get("intonation")));
+        }else{
+            userSoundInfoMap.get(phone).getUserScoreMap().put("intonation", intonation);
+        }
+
+        if(userSoundInfoMap.get(phone).getUserScoreMap().containsKey("cadence")){
+            userSoundInfoMap.get(phone).getUserScoreMap().put("cadence", cadence.add(userSoundInfoMap.get(phone).getUserScoreMap().get("cadence")));
+        }else{
+            userSoundInfoMap.get(phone).getUserScoreMap().put("cadence", cadence);
+        }
+
+        if(userSoundInfoMap.get(phone).getUserScoreMap().containsKey("integrity")){
+            userSoundInfoMap.get(phone).getUserScoreMap().put("integrity", integrity.add(userSoundInfoMap.get(phone).getUserScoreMap().get("integrity")));
+        }else{
+            userSoundInfoMap.get(phone).getUserScoreMap().put("integrity", integrity);
+        }
+
+        Map<String, BigDecimal> scoreData = new HashMap<>();
+        scoreData.put("intonation", intonation);
+        scoreData.put("cadence", cadence);
+        scoreData.put("integrity", integrity);
+
+        userSoundInfoMap.get(phone).getUserMeasureScoreMap().put(measureIndex, scoreData);
+
+        WS_CLIENTS.get(phone).sendMessage(new TextMessage(JSON.toJSONString(createPushInfo("measureScore", measureIndex, intonation, cadence, integrity))));
+    }
+
+    /**
+     * @describe 计算最终评分
+     * @author Joburgess
+     * @date 2021/6/25 0025
+     * @param phone:
+     * @return void
+     */
+    private void calTotalScore(String phone) throws IOException {
+        int totalCompareNum = userSoundInfoMap.get(phone).getMeasureXmlInfoMap().keySet().size();
+        int currentCompareNum = totalCompareNum-userSoundInfoMap.get(phone).getMeasureEndTime().keySet().size();
+        BigDecimal intonation = BigDecimal.ZERO;
+        BigDecimal cadence = BigDecimal.ZERO;
+        BigDecimal integrity = BigDecimal.ZERO;
+
+        if(currentCompareNum>0){
+            intonation = userSoundInfoMap.get(phone).getUserScoreMap().get("intonation").divide(new BigDecimal(currentCompareNum), 0, BigDecimal.ROUND_DOWN);
+            cadence = userSoundInfoMap.get(phone).getUserScoreMap().get("cadence").divide(new BigDecimal(currentCompareNum), 0, BigDecimal.ROUND_DOWN);
+            integrity = new BigDecimal(currentCompareNum).divide(new BigDecimal(totalCompareNum), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN).multiply(oneHundred).setScale(0, BigDecimal.ROUND_DOWN);
+        }
+
+        WS_CLIENTS.get(phone).sendMessage(new TextMessage(JSON.toJSONString(createPushInfo("overall", -1, intonation, cadence, integrity))));
+
+        //存储评分数据
+        sysMusicCompareRecordService.saveMusicCompareData(phone, userSoundInfoMap.get(phone).getMusicScoreId(), userSoundInfoMap.get(phone).getUserMeasureScoreMap());
+    }
+
+    /**
+     * @describe 生成评分结果
+     * @author Joburgess
+     * @date 2021/6/25 0025
+     * @param command:
+     * @param measureIndex:
+     * @param intonation:
+     * @param cadence:
+     * @param integrity:
+     * @return com.ym.mec.biz.dal.dto.WebSocketInfo
+     */
+    private WebSocketInfo createPushInfo(String command, Integer measureIndex,
+                                         BigDecimal intonation, BigDecimal cadence, BigDecimal integrity){
+        WebSocketInfo webSocketInfo = new WebSocketInfo();
+        HashMap<String, String> header = new HashMap<>();
+        header.put("commond", command);
+        webSocketInfo.setHeader(header);
+        Map<String, Object> result = new HashMap<>();
+        BigDecimal score = intonation.multiply(new BigDecimal(0.5)).add(cadence.multiply(new BigDecimal(0.5))).setScale(0, BigDecimal.ROUND_HALF_UP);
+//        BigDecimal score = cadence.setScale(0, BigDecimal.ROUND_HALF_UP);
+        result.put("score", score);
+        result.put("intonation", intonation);
+        result.put("cadence", cadence);
+        result.put("integrity", integrity);
+        result.put("measureIndex", measureIndex);
+        webSocketInfo.setBody(result);
+        LOGGER.info("小节频分:{}", JSON.toJSONString(webSocketInfo));
+        return webSocketInfo;
+    }
+}

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

@@ -12,7 +12,6 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
 import java.util.List;
-import java.util.Map;
 
 public interface ExtracurricularExercisesReplyService extends BaseService<Long, ExtracurricularExercisesReply> {
 

+ 14 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/FinancialExpenditureService.java

@@ -13,26 +13,35 @@ import java.util.List;
 
 public interface FinancialExpenditureService extends BaseService<Long, FinancialExpenditure> {
     /**
+     * @param file:
+     * @return java.lang.Object
      * @describe 导入财务支出
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/7
      * @time 18:31
-     * @param file:
-     * @return java.lang.Object
      */
     List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception;
 
     PageInfo<FinancialExpenditureDto> queryFinancialExpenditurePage(FinancialExpenditureQueryInfo queryInfo);
 
     /**
+     * @param ids:
+     * @return void
      * @describe 批量删除
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan
      * @date 2020/9/9
      * @time 11:44
-     * @param ids:
-     * @return void
      */
     void batchDel(String ids);
-}
+
+
+    /**
+     * 批量插入支出记录
+     *
+     * @param financialExpenditures
+     * @return
+     */
+    List<FinancialExpenditure> batchAdd(List<FinancialExpenditure> financialExpenditures);
+}

+ 0 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupSubjectPlanService.java

@@ -66,16 +66,6 @@ public interface MusicGroupSubjectPlanService extends BaseService<Integer, Music
     MusicGroupSubjectPlan findSubjectPlan(String musicGroupId, Integer subjectId);
 
     /**
-     * 中途添加的学生的缴费信息
-     *
-     * @param musicGroupId
-     * @param subjectId
-     * @return
-     */
-    MusicGroupSubjectGoodsAndInfoDto getStudentGoodsAndInfo(String musicGroupId, Integer subjectId, StudentRegistration studentRegistration);
-
-
-    /**
      * 获取声部的乐器、辅件(包含折扣)
      * @param subjectId
      * @param type

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

@@ -1,7 +1,6 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.enums.GradeTypeEnum;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;

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

@@ -65,10 +65,10 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
 
     /**
      * 获取订单退货的sellOrder
-     * @param orderId
+     * @param orderIdList
      * @return
      */
-    List<SellOrder> getRefundSellOrder(Long orderId);
+    List<SellOrder> getRefundSellOrder(List<Long> orderIdList);
 
 
     /**

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

@@ -0,0 +1,15 @@
+package com.ym.mec.biz.service;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/17 0017
+ */
+public interface SoundSocketService {
+
+    String COMMOND = "commond";
+    String MUSIC_XML = "musicXml";
+    String RECORD_START = "recordStart";
+    String RECORD_END = "recordEnd";
+    String RECORD_CANCEL = "recordCancel";
+
+}

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

@@ -79,6 +79,14 @@ public interface StudentPaymentOrderDetailService extends BaseService<Long, Stud
      */
     List<StudentPaymentOrderDetail> getOrderDetail(Long orderId);
 
+
+    /**
+     * 获取订单详细
+     * @param orderIdList
+     * @return
+     */
+    List<StudentPaymentOrderDetail> getOrderDetail(List<Long> orderIdList);
+
     /**
      * 获取订单类型的详情
      * @param orderId

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

@@ -61,6 +61,15 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
      * @return
      */
     StudentPaymentOrder findOrderByOrderNo(String orderNo);
+    
+    /**
+     * 根据批次号查询
+     * @param userId 用户编号
+     * @param batchNo 批次号
+     * @param status 状态
+     * @return
+     */
+    List<StudentPaymentOrder> queryByBatchNo(Integer userId, String batchNo, DealStatusEnum status);
 
     /**
      * 查找支付成功和支付中订单
@@ -173,7 +182,8 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
      */
     StudentPaymentOrder getUserReplacementIngOrder(Integer userId, Integer replacementId);
 
-
     void callOrderCallBack(StudentPaymentOrder order) throws Exception;
+    
+    int batchUpdate(List<StudentPaymentOrder> studentPaymentOrderList);
 
 }

+ 7 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -10,7 +10,6 @@ import com.ym.mec.biz.dal.dto.PageInfoReg;
 import com.ym.mec.biz.dal.dto.RegisterDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
 import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
@@ -56,7 +55,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @param musicGroupId
      * @return
      */
-    StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId);
+    List<StudentPaymentOrderDetail> queryFeeDetail(Integer studentId, String musicGroupId);
 
     /**
      * 获取未分配的班级的学生
@@ -445,5 +444,10 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     StudentRegistration getStudentRegister(String musicGroupId, Integer studentId);
 
-
+    /**
+     * 云教练收费:审核中的记录审核失败
+     * @param studentRegistration
+     * @return
+     */
+    Boolean setCloudTeacherToFailed(StudentRegistration studentRegistration);
 }

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

@@ -0,0 +1,21 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.SysMusicCompareRecord;
+import com.ym.mec.common.service.BaseService;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public interface SysMusicCompareRecordService extends BaseService<Long, SysMusicCompareRecord> {
+
+    /**
+     * @describe 保存用户评测记录
+     * @author Joburgess
+     * @date 2021/6/25 0025
+     * @param phone:
+     * @param userMeasureScoreMap:
+     * @return void
+     */
+    void saveMusicCompareData(String phone, Integer sysMusicScoreId, Map<Integer, Map<String, BigDecimal>> userMeasureScoreMap);
+
+}

+ 18 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -6,15 +6,13 @@ import java.math.BigDecimal;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 
-import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
-import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
-import com.ym.mec.util.http.HttpUtil;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -32,6 +30,13 @@ import org.springframework.util.CollectionUtils;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.auth.api.enums.CertificateTypeEnum;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SysUserContractsDao;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
 import com.ym.mec.biz.dal.entity.Goods;
@@ -48,6 +53,7 @@ import com.ym.mec.biz.dal.entity.SysUserContracts;
 import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
 import com.ym.mec.biz.dal.entity.SysUserTsign;
 import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
@@ -62,6 +68,8 @@ import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.SysUserContractsService;
 import com.ym.mec.biz.service.SysUserTsignService;
 import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.storage.StoragePluginContext;
@@ -811,22 +819,9 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 		double depositFee = 0d;
 		if (kitGroupPurchaseTypeEnum == KitGroupPurchaseTypeEnum.LEASE) {
-			StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService
-					.findMusicGroupApplyOrderByStatus(userId, musicGroupId, DealStatusEnum.WAIT_PAY);
-
-			if (studentPaymentOrder == null) {
-				MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
-				if (musicGroupSubjectPlan != null) {
-					depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
-				}
-			} else {
-
-				List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
-				for (StudentPaymentOrderDetail detail : orderDetailList) {
-					if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-						depositFee = detail.getPrice().doubleValue();
-					}
-				}
+			MusicGroupSubjectGoodsGroup musicGroupSubjectPlan = musicGroupSubjectGoodsGroupService.query(musicGroupId, subjectId, goodsIds);
+			if (musicGroupSubjectPlan != null) {
+				depositFee = musicGroupSubjectPlan.getDepositFee().doubleValue();
 			}
 		}
 		params.put("depositFee", depositFee);

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

@@ -41,8 +41,6 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 	@Autowired
 	private ExtracurricularExercisesDao extracurricularExercisesDao;
 	@Autowired
-	private ExtracurricularExercisesMessageDao extracurricularExercisesMessageDao;
-	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;

+ 157 - 148
mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java

@@ -37,157 +37,166 @@ import java.util.stream.Collectors;
 
 @Service
 public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, FinancialExpenditure> implements FinancialExpenditureService {
-	
-	@Autowired
-	private FinancialExpenditureDao financialExpenditureDao;
 
-	@Override
-	public BaseDAO<Long, FinancialExpenditure> getDAO() {
-		return financialExpenditureDao;
-	}
+    @Autowired
+    private FinancialExpenditureDao financialExpenditureDao;
 
-	private static final Logger LOGGER = LoggerFactory.getLogger(FinancialExpenditureServiceImpl.class);
+    @Override
+    public BaseDAO<Long, FinancialExpenditure> getDAO() {
+        return financialExpenditureDao;
+    }
 
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception {
-		Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
-		InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
-		Map<String,String> columns = IniFileUtil.readIniFile(inputStream,TemplateTypeEnum.FINANCIAL_EXPENDITURE.getMsg());
-		List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
-		Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
-		Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
-		StringBuffer sb = new StringBuffer();
-		for (String e : sheetsListMap.keySet()) {
-			List<Map<String, Object>> sheet = sheetsListMap.get(e);
-			List<Object> collect = sheet.stream().map(m -> m.get("钉钉流程编号")).collect(Collectors.toList());
-			if(collect == null || collect.size() == 0){
-				continue;
-			}
-			valueIsNull: for (int j = 0; j < sheet.size(); j++) {
-				int rowNum = j + 2;
-				Map<String, Object> row = sheet.get(j);
-				if (row.size() == 0) {
-					continue;
-				}
-				JSONObject objectMap = new JSONObject();
-				for (String s : row.keySet()) {
-					if(!columns.containsKey(s)){
-						continue;
-					}
-					String columnValue = columns.get(s);
-					if (columnValue.equals("type")) {
-						for (ExpenditureTypeEnum expenditureType : ExpenditureTypeEnum.values()) {
-							if (expenditureType.getDesc().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, expenditureType);
-								break;
-							}
-						}
-						continue;
-					}
-					if (columnValue.equals("dingtalkProcessNo")) {
-						if (StringUtils.isEmpty(row.get(s).toString())) {
-							sb.append("第" + rowNum).append("行数据导入失败:钉钉流程编号不可为空;");
-							continue valueIsNull;
-						} else {
-							objectMap.put("incomeType", row.get(s));
-						}
-					}
-					if (columnValue.equals("feeProject")) {
-						for (FeeProjectEnum feeProject : FeeProjectEnum.values()) {
-							if (feeProject.getDesc().equals(row.get(s).toString())) {
-								objectMap.put(columnValue, feeProject);
-								break;
-							}
-						}
-						continue;
-					}
-					if (columnValue.equals("amount")) {
-						if(StringUtils.isEmpty(row.get(s).toString())){
-							sb.append("第" + rowNum).append("行数据导入失败:费用不可为空;");
-							continue valueIsNull;
-						}else {
-							objectMap.put("amount", row.get(s));
-						}
-						continue;
-					}
-					if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
-						Integer integer = organMap.get(row.get(s));
-						if(integer == null){
-							sb.append("第" + rowNum).append("行数据导入失败:分部校验失败;");
-							continue valueIsNull;
-						}else {
-							objectMap.put("organId", integer);
-						}
-						continue;
-					}
-					if (columnValue.equals("cooperationOrganName") && StringUtils.isNotEmpty(row.get(s).toString())) {
-						Integer integer = cooperationOrganMap.get(row.get(s));
-						if(integer == null){
-							sb.append("第" + rowNum).append("行数据导入失败:合作单位校验失败;");
-							continue valueIsNull;
-						}else {
-							objectMap.put("cooperationOrganId", integer);
-						}
-						continue;
-					}
-					if (columnValue.equals("paymentTime") && StringUtils.isNotEmpty(row.get(s).toString())) {
-						String toString = row.get(s).toString();
-						if(StringUtils.isNotEmpty(toString)){
-							Date date = DateUtil.stringToDate(toString, DateUtil.DEFAULT_PATTERN);
-							if(date == null){
-								throw new BizException("导入数据错误  付款时间格式错误");
-							}else {
-								objectMap.put(columnValue, DateUtil.format(date,DateUtil.DEFAULT_PATTERN));
-							}
-						}
-						continue;
-					}
-					objectMap.put(columnValue, row.get(s));
-				}
-				FinancialExpenditure financialExpenditure = null;
-				try {
-					financialExpenditure = JSONObject.parseObject(objectMap.toJSONString(),FinancialExpenditure.class);
-					financialExpenditures.add(financialExpenditure);
-				} catch (Exception ex) {
-					throw new BizException("导入数据出错,请检查Excel表格");
-				}
-			}
-		}
-		if(sb.length() > 0){
-			throw new BizException(sb.toString());
-		}
-		if(financialExpenditures.size() != 0){
-			financialExpenditureDao.batchInsert(financialExpenditures);
-		}
-		return financialExpenditures;
-	}
+    private static final Logger LOGGER = LoggerFactory.getLogger(FinancialExpenditureServiceImpl.class);
 
-	@Override
-	public PageInfo<FinancialExpenditureDto> queryFinancialExpenditurePage(FinancialExpenditureQueryInfo queryInfo){
-		PageInfo<FinancialExpenditureDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-		Map<String, Object> params = new HashMap<>();
-		MapUtil.populateMap(params, queryInfo);
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public List<FinancialExpenditure> importFinancialExpenditure(MultipartFile file) throws Exception {
+        Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(new ByteArrayInputStream(file.getBytes()), 2, file.getOriginalFilename());
+        InputStream inputStream = new ClassPathResource("columnMapper.ini").getInputStream();
+        Map<String, String> columns = IniFileUtil.readIniFile(inputStream, TemplateTypeEnum.FINANCIAL_EXPENDITURE.getMsg());
+        List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
+        Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
+        Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
+        StringBuffer sb = new StringBuffer();
+        for (String e : sheetsListMap.keySet()) {
+            List<Map<String, Object>> sheet = sheetsListMap.get(e);
+            List<Object> collect = sheet.stream().map(m -> m.get("钉钉流程编号")).collect(Collectors.toList());
+            if (collect == null || collect.size() == 0) {
+                continue;
+            }
+            valueIsNull:
+            for (int j = 0; j < sheet.size(); j++) {
+                int rowNum = j + 2;
+                Map<String, Object> row = sheet.get(j);
+                if (row.size() == 0) {
+                    continue;
+                }
+                JSONObject objectMap = new JSONObject();
+                for (String s : row.keySet()) {
+                    if (!columns.containsKey(s)) {
+                        continue;
+                    }
+                    String columnValue = columns.get(s);
+                    if (columnValue.equals("type")) {
+                        for (ExpenditureTypeEnum expenditureType : ExpenditureTypeEnum.values()) {
+                            if (expenditureType.getDesc().equals(row.get(s).toString())) {
+                                objectMap.put(columnValue, expenditureType);
+                                break;
+                            }
+                        }
+                        continue;
+                    }
+                    if (columnValue.equals("dingtalkProcessNo")) {
+                        if (StringUtils.isEmpty(row.get(s).toString())) {
+                            sb.append("第" + rowNum).append("行数据导入失败:钉钉流程编号不可为空;");
+                            continue valueIsNull;
+                        } else {
+                            objectMap.put("incomeType", row.get(s));
+                        }
+                    }
+                    if (columnValue.equals("feeProject")) {
+                        for (FeeProjectEnum feeProject : FeeProjectEnum.values()) {
+                            if (feeProject.getDesc().equals(row.get(s).toString())) {
+                                objectMap.put(columnValue, feeProject);
+                                break;
+                            }
+                        }
+                        continue;
+                    }
+                    if (columnValue.equals("amount")) {
+                        if (StringUtils.isEmpty(row.get(s).toString())) {
+                            sb.append("第" + rowNum).append("行数据导入失败:费用不可为空;");
+                            continue valueIsNull;
+                        } else {
+                            objectMap.put("amount", row.get(s));
+                        }
+                        continue;
+                    }
+                    if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
+                        Integer integer = organMap.get(row.get(s));
+                        if (integer == null) {
+                            sb.append("第" + rowNum).append("行数据导入失败:分部校验失败;");
+                            continue valueIsNull;
+                        } else {
+                            objectMap.put("organId", integer);
+                        }
+                        continue;
+                    }
+                    if (columnValue.equals("cooperationOrganName") && StringUtils.isNotEmpty(row.get(s).toString())) {
+                        Integer integer = cooperationOrganMap.get(row.get(s));
+                        if (integer == null) {
+                            sb.append("第" + rowNum).append("行数据导入失败:合作单位校验失败;");
+                            continue valueIsNull;
+                        } else {
+                            objectMap.put("cooperationOrganId", integer);
+                        }
+                        continue;
+                    }
+                    if (columnValue.equals("paymentTime") && StringUtils.isNotEmpty(row.get(s).toString())) {
+                        String toString = row.get(s).toString();
+                        if (StringUtils.isNotEmpty(toString)) {
+                            Date date = DateUtil.stringToDate(toString, DateUtil.DEFAULT_PATTERN);
+                            if (date == null) {
+                                throw new BizException("导入数据错误  付款时间格式错误");
+                            } else {
+                                objectMap.put(columnValue, DateUtil.format(date, DateUtil.DEFAULT_PATTERN));
+                            }
+                        }
+                        continue;
+                    }
+                    objectMap.put(columnValue, row.get(s));
+                }
+                FinancialExpenditure financialExpenditure = null;
+                try {
+                    financialExpenditure = JSONObject.parseObject(objectMap.toJSONString(), FinancialExpenditure.class);
+                    financialExpenditures.add(financialExpenditure);
+                } catch (Exception ex) {
+                    throw new BizException("导入数据出错,请检查Excel表格");
+                }
+            }
+        }
+        if (sb.length() > 0) {
+            throw new BizException(sb.toString());
+        }
+        if (financialExpenditures.size() != 0) {
+            financialExpenditureDao.batchInsert(financialExpenditures);
+        }
+        return financialExpenditures;
+    }
 
-		List<FinancialExpenditureDto> dataList = null;
-		int count = financialExpenditureDao.findFinancialExpenditureCount(params);
-		if (count > 0) {
-			pageInfo.setTotal(count);
-			params.put("offset", pageInfo.getOffset());
-			dataList = financialExpenditureDao.queryFinancialExpenditurePage(params);
-		}
-		if (count == 0) {
-			dataList = new ArrayList<>();
-		}
-		pageInfo.setRows(dataList);
-		return pageInfo;
-	}
+    @Override
+    public PageInfo<FinancialExpenditureDto> queryFinancialExpenditurePage(FinancialExpenditureQueryInfo queryInfo) {
+        PageInfo<FinancialExpenditureDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
 
-	@Override
-	public void batchDel(String ids) {
-		if(StringUtils.isEmpty(ids)){
-			throw new BizException("参数校验失败");
-		}
-		financialExpenditureDao.batchDel(ids);
-	}
-}
+        List<FinancialExpenditureDto> dataList = null;
+        int count = financialExpenditureDao.findFinancialExpenditureCount(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            dataList = financialExpenditureDao.queryFinancialExpenditurePage(params);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
+    @Override
+    public void batchDel(String ids) {
+        if (StringUtils.isEmpty(ids)) {
+            throw new BizException("参数校验失败");
+        }
+        financialExpenditureDao.batchDel(ids);
+    }
+
+    @Override
+    public List<FinancialExpenditure> batchAdd(List<FinancialExpenditure> financialExpenditures) {
+        financialExpenditureDao.batchInsert(financialExpenditures);
+        return financialExpenditures;
+    }
+
+
+}

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -126,6 +126,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private StudentRegistrationDao studentRegistrationDao;
 	@Autowired
 	private GroupEventSource groupEventSource;
+
 	@Autowired
 	private StudentPaymentOrderDao studentPaymentOrderDao;
 	@Autowired
@@ -1549,6 +1550,14 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
 			throw new BizException("缴费项目中已存在学员,不能删除");
 		}
+		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
+				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT && calender.getStatus() != DRAFT) {
+			throw new BizException("删除失败,{} 的缴费项目不允许删除");
+		}
+		MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
+		if(byBatchNo != null){
+			throw new BizException("删除失败,班级调整的缴费项目不允许删除");
+		}
 
 		if (calender.getPaymentType() == PaymentType.MUSIC_APPLY) {
 			// 是否存在缴费中的

+ 167 - 107
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -653,6 +653,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (studentRegistration == null) {
             throw new BizException("报名信息有误,请核查");
         }
+        
+        MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
+        if(musicGroupRegCalender == null){
+        	throw new BizException("缴费信息不存在");
+        }
 
         Integer userId = studentRegistration.getUserId();
 
@@ -715,7 +720,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+        
+        studentRegistration.setMusicGroupPaymentCalenderId(musicGroupRegCalender.getId());
         studentRegistration.setOrganId(musicGroup.getOrganId());
+        
         studentRegistration.setPayingStatus(1);
 
         Date date = new Date();
@@ -723,10 +731,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         CloudTeacherOrder cloudTeacherOrder = null;
         //云教练/云教练+
         if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
-            MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
-            if(musicGroupRegCalender == null){
-            	throw new BizException("缴费信息不存在");
-            }
             BigDecimal cloudTeacherPrice = BigDecimal.ZERO;
 			if (musicGroupRegCalender.getMemberRankSettingId() != null) {
 				cloudTeacherPrice = musicGroupRegCalender.getMemberPaymentAmount();
@@ -738,7 +742,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 			}
             
             orderAmount = orderAmount.add(cloudTeacherPrice);
-            studentRegistration.setHasCloudTeacher(1);
+            studentRegistration.setHasCloudTeacher(0);
             
 
             //创建订单
@@ -791,6 +795,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团报名");
             }
         }
+        studentPaymentOrder.setBatchNo(musicGroupRegCalender.getId() + "");
         studentPaymentOrder.setPaymentChannel("BALANCE");
         studentPaymentOrder.setRemitFee(remitFee);
         studentPaymentOrder.setCourseRemitFee(courseRemitFee);
@@ -878,6 +883,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (ApplyOrder == null) {
             throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
         }
+
+    	MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
+        if(musicGroupRegCalender == null){
+        	throw new BizException("缴费信息不存在");
+        }
+        
         //手动关闭订单
         ApplyOrder.setStatus(DealStatusEnum.FAILED);
         ApplyOrder.setMemo("用户手动关闭");
@@ -942,6 +953,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
+        
+        studentRegistration.setMusicGroupPaymentCalenderId(musicGroupRegCalender.getId());
         studentRegistration.setOrganId(musicGroup.getOrganId());
         studentRegistration.setPayingStatus(1);
 
@@ -952,10 +965,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //云教练/云教练+
         if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
         	
-        	MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
-            if(musicGroupRegCalender == null){
-            	throw new BizException("缴费信息不存在");
-            }
             BigDecimal cloudTeacherPrice = BigDecimal.ZERO;
 			if (musicGroupRegCalender.getMemberRankSettingId() != null) {
 				cloudTeacherPrice = musicGroupRegCalender.getMemberPaymentAmount();
@@ -967,7 +976,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 			}
             
             orderAmount = orderAmount.add(cloudTeacherPrice);
-            studentRegistration.setHasCloudTeacher(1);
+            studentRegistration.setHasCloudTeacher(0);
             
 
             //创建订单
@@ -1021,6 +1030,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐团报名");
             }
         }
+        studentPaymentOrder.setBatchNo(musicGroupRegCalender.getId() + "");
         studentPaymentOrder.setPaymentChannel("BALANCE");
         studentPaymentOrder.setRemitFee(remitFee);
         studentPaymentOrder.setCourseRemitFee(courseRemitFee);
@@ -1853,6 +1863,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
             throw new BizException("申请失败,乐团状态[已取消]或[已暂停]");
         }
+        
+        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if (studentRegistration == null) {
+            throw new BizException("用户注册信息不存在");
+        }
+
+        StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
+        if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL && currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.APPLY) {
+        	throw new BizException("用户当前在团状态不能退团");
+        }
 
         // 有进行中的课程不能退团
         List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
@@ -1860,6 +1880,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (courseScheduleList != null && courseScheduleList.size() > 0) {
             throw new BizException("退团失败,存在[进行中]的课程");
         }
+		
+        boolean hasPaid = studentRegistration.getMusicGroupStatus().equals(StudentMusicGroupStatusEnum.NORMAL);
 
         musicGroupQuit.setStatus(status);
         musicGroupQuit.setReason(reason);
@@ -1870,11 +1892,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         if (status == ApprovalStatus.APPROVED) {
 
-            StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-            if (studentRegistration == null) {
-                throw new BizException("用户注册信息不存在");
-            }
-
             List<Integer> classGroupIdList = classGroupStudentMapperDao.queryClassGroupIdList(musicGroupId, userId, GroupType.MUSIC);
             //更新学员在班级的状态
             for (Integer classGroupId : classGroupIdList) {
@@ -1890,7 +1907,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
             // 退团
             BigDecimal surplusCourseFee = studentRegistration.getSurplusCourseFee();
-            StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
             studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
             studentRegistration.setHasCloudTeacher(0);
@@ -1939,22 +1955,40 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
             BigDecimal amount = new BigDecimal(0);
-
-            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
-
-            boolean hasPaid = studentRegistration.getMusicGroupStatus().equals(StudentMusicGroupStatusEnum.NORMAL);
+            
+            List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
+            
+            if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
+    			if(currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.NORMAL || (currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.APPLY && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES)){
+    				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
+    				if (studentPaymentOrder != null) {
+    					studentPaymentOrderList.add(studentPaymentOrder);
+    				}
+    			}
+    			
+    		} else {
+				studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(userId, studentRegistration.getMusicGroupPaymentCalenderId() + "",
+						DealStatusEnum.SUCCESS);
+			}
+            
             // 缴费人数更新
             MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
             if (hasPaid && musicGroupSubjectPlan != null) {
                 musicGroupSubjectPlan.setUpdateTime(date);
                 //减去缴费人数(器乐收费,0元时不减缴费人数)
                 if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
-                    if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
-                        musicGroupSubjectPlan.setPaidZeroNum(musicGroupSubjectPlan.getPaidZeroNum() - 1);
-                        musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-                    } else if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() == null) {
-                        musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-                    }
+                    
+                	for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
+                		if (studentPaymentOrder != null && "200".equals(studentPaymentOrder.getPaymentAccountNo())) {
+                            musicGroupSubjectPlan.setPaidZeroNum(musicGroupSubjectPlan.getPaidZeroNum() - 1);
+                            musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+                            break;
+                        } else if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() == null) {
+                            musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+                            break;
+                        }
+                	}
+                	
                 } else {
                     musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
                 }
@@ -1992,50 +2026,48 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     studentService.cleanMember(userId);
                 }
             }
-            if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL) {
-                return true;
-            }
 
             if (isRefundCourseFee) {
                 // 退课程费用
                 amount = amount.add(surplusCourseFee);
             }
 
-            if (studentPaymentOrder != null) {
-                List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
+            if (studentPaymentOrderList.size() > 0) {
+            	
+            	List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+            	
+            	Long minPaymentOrderId = Collections.min(paymentOrderIdList);
+
+                List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
 
                 SubjectChange studentLastChange = null;
                 if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
                     studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
                 }
+                
+				if (studentLastChange != null && minPaymentOrderId <= studentLastChange.getOriginalOrderId()) {
+					if (isRefundInstrumentFee) {
+						amount = amount.add(studentLastChange.getChangeMusicalPrice());
+					}
 
-                BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
-                for (StudentPaymentOrderDetail detail : orderDetailList) {
-                    if (remitFee.compareTo(detail.getPrice()) >= 0) {
-                        remitFee = remitFee.subtract(detail.getPrice());
-                        detail.setPrice(BigDecimal.ZERO);
-                    } else {
-                        detail.setPrice(detail.getPrice().subtract(remitFee));
-                        remitFee = BigDecimal.ZERO;
-                    }
-
-                    if (isRefundInstrumentFee && studentLastChange == null) {
-                        // 退乐器费用
-                        if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-                            amount = amount.add(detail.getPrice());
-                        }
-
-                    }
-                    if (isRefundTeachingAssistantsFee && studentLastChange == null) {
-                        // 退教辅费用
-                        if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
-                            amount = amount.add(detail.getPrice());
-                        }
-                    }
-                }
-                if (studentLastChange != null) {
-                    amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
-                }
+					if (isRefundTeachingAssistantsFee) {
+						amount = amount.add(studentLastChange.getChangeAccessoriesPrice());
+					}
+				} else {
+					for (StudentPaymentOrderDetail detail : orderDetailList) {
+
+						// 退乐器费用
+						if (isRefundInstrumentFee && detail.getType() == OrderDetailTypeEnum.MUSICAL) {
+							amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
+						}
+
+						// 退教辅费用
+						if (isRefundTeachingAssistantsFee
+								&& (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING)) {
+							amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
+						}
+					}
+				}
             }
 
             //退乐保费用
@@ -2078,6 +2110,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (musicGroup.getStatus() == MusicGroupStatusEnum.CANCELED || musicGroup.getStatus() == MusicGroupStatusEnum.PAUSE) {
             throw new BizException("退团失败,乐团状态[已取消]或[已暂停]");
         }
+        
+        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+        if (studentRegistration == null) {
+            throw new BizException("用户注册信息不存在");
+        }
+
+        StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
+        if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL && currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.APPLY) {
+        	throw new BizException("用户当前在团状态不能退团");
+        }
 
         // 有进行中的课程不能退团
         List<CourseSchedule> courseScheduleList = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(musicGroupId, GroupType.MUSIC.getCode(),
@@ -2085,6 +2127,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         if (courseScheduleList != null && courseScheduleList.size() > 0) {
             throw new BizException("退团失败,存在[进行中]的课程");
         }
+		
+        boolean hasPaid = studentRegistration.getMusicGroupStatus().equals(StudentMusicGroupStatusEnum.NORMAL);
+        
         //如果是会员团,并且有预排课计划
         MusicGroupSchoolTermCourseDetail termCourseDetail = musicGroupSchoolTermCourseDetailDao.findByCourseDateAndMusicGroupId(musicGroupId, null, 0);
         if(termCourseDetail != null){
@@ -2099,13 +2144,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         courseScheduleStudentPaymentService.updateCourseActualPrice(Arrays.asList(musicGroupId), Arrays.asList(userId), GroupType.MUSIC);
 
-        // 判断乐器是否是租赁
-        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-        if (studentRegistration == null) {
-            throw new BizException("用户注册信息不存在");
-        }
-        boolean hasPaid = studentRegistration.getMusicGroupStatus().equals(StudentMusicGroupStatusEnum.NORMAL);
-
         Date date = new Date();
 
         MusicGroupQuit musicGroupQuit = musicGroupQuitDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
@@ -2143,7 +2181,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupStudentFeeDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
         BigDecimal surplusCourseFee = studentRegistration.getSurplusCourseFee();
-        StudentMusicGroupStatusEnum currentStudentMusicGroupStatus = studentRegistration.getMusicGroupStatus();
         // 退团
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.QUIT);
         studentRegistration.setSurplusCourseFee(BigDecimal.ZERO);
@@ -2193,8 +2230,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
 
         BigDecimal amount = new BigDecimal(0);
-
-        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
+        
+        List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
+        
+		if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
+			if(currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.NORMAL || (currentStudentMusicGroupStatus == StudentMusicGroupStatusEnum.APPLY && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES)){
+				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
+				if (studentPaymentOrder != null) {
+					studentPaymentOrderList.add(studentPaymentOrder);
+				}
+			}
+			
+		} else {
+			studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(sysUser.getId(), studentRegistration.getMusicGroupPaymentCalenderId() + "",
+					DealStatusEnum.SUCCESS);
+		}
 
         // 判断乐器是否是租赁
         MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, studentRegistration.getActualSubjectId());
@@ -2202,12 +2252,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             musicGroupSubjectPlan.setUpdateTime(date);
             //减去缴费人数(器乐收费,0元时不减缴费人数)
             if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
-                if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
-                    musicGroupSubjectPlan.setPaidZeroNum(musicGroupSubjectPlan.getPaidZeroNum() - 1);
-                    musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-                } else if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() == null) {
-                    musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
-                }
+            	
+            	for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
+            		if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() != null && studentPaymentOrder.getPaymentAccountNo().equals("200")) {
+                        musicGroupSubjectPlan.setPaidZeroNum(musicGroupSubjectPlan.getPaidZeroNum() - 1);
+                        musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+                        break;
+                    } else if (studentPaymentOrder != null && studentPaymentOrder.getPaymentAccountNo() == null) {
+                        musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
+                        break;
+                    }
+            	}
             } else {
                 musicGroupSubjectPlan.setPaidStudentNum(musicGroupSubjectPlan.getPaidStudentNum() - 1);
             }
@@ -2244,50 +2299,48 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
         }
 
-        if (currentStudentMusicGroupStatus != StudentMusicGroupStatusEnum.NORMAL) {
-            return true;
-        }
-
         if (isRefundCourseFee) {
             // 退课程费用
             amount = amount.add(surplusCourseFee);
         }
 
-        if (studentPaymentOrder != null) {
-            List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
+        if (studentPaymentOrderList.size() > 0) {
+        	
+        	List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+        	
+        	Long minPaymentOrderId = Collections.min(paymentOrderIdList);
+
+            List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
 
             SubjectChange studentLastChange = null;
             if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
                 studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
             }
+            
+			if (studentLastChange != null && minPaymentOrderId <= studentLastChange.getOriginalOrderId()) {
+				if (isRefundInstrumentFee) {
+					amount = amount.add(studentLastChange.getChangeMusicalPrice());
+				}
 
-            BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
+				if (isRefundTeachingAssistantsFee) {
+					amount = amount.add(studentLastChange.getChangeAccessoriesPrice());
+				}
+			} else {
+				for (StudentPaymentOrderDetail detail : orderDetailList) {
 
-            for (StudentPaymentOrderDetail detail : orderDetailList) {
-                if (remitFee.compareTo(detail.getPrice()) >= 0) {
-                    remitFee = remitFee.subtract(detail.getPrice());
-                    detail.setPrice(BigDecimal.ZERO);
-                } else {
-                    detail.setPrice(detail.getPrice().subtract(remitFee));
-                    remitFee = BigDecimal.ZERO;
-                }
-                if (isRefundInstrumentFee && studentLastChange == null) {
-                    // 退乐器费用
-                    if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
-                        amount = amount.add(detail.getPrice());
-                    }
+					// 退乐器费用
+					if (isRefundInstrumentFee && detail.getType() == OrderDetailTypeEnum.MUSICAL) {
+						amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
+					}
 
-                }
-                if (isRefundTeachingAssistantsFee && studentLastChange == null) {
-                    // 退教辅费用
-                    if (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING) {
-                        amount = amount.add(detail.getPrice());
-                    }
-                }
-            }
-            if (studentLastChange != null) {
-                amount = amount.add(studentLastChange.getChangeMusicalPrice()).add(studentLastChange.getChangeAccessoriesPrice());
-            }
+					// 退教辅费用
+					if (isRefundTeachingAssistantsFee
+							&& (detail.getType() == OrderDetailTypeEnum.ACCESSORIES || detail.getType() == OrderDetailTypeEnum.TEACHING)) {
+						amount = amount.add(detail.getPrice()).subtract(detail.getRemitFee());
+					}
+				}
+			}
+        
         }
 
         //退乐保费用
@@ -2351,11 +2404,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrder.setGroupType(GroupType.MUSIC);
         studentPaymentOrder.setUserId(userId);
         studentPaymentOrder.setOrderNo(orderNo);
-        studentPaymentOrder.setType(OrderTypeEnum.RENEW);
+        
+		if (calender.getPaymentType() == PaymentType.ADD_STUDENT) {
+			studentPaymentOrder.setType(OrderTypeEnum.ADD_STUDENT);
+		} else {
+			studentPaymentOrder.setType(OrderTypeEnum.RENEW);
+		}
         studentPaymentOrder.setExpectAmount(amount);
         studentPaymentOrder.setActualAmount(amount);
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
         studentPaymentOrder.setMusicGroupId(calender.getMusicGroupId());
+        studentPaymentOrder.setBatchNo(calender.getId() + "");
         studentPaymentOrder.setCreateTime(date);
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrder.setVersion(0);
@@ -2494,6 +2553,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             if (paymentCalender.getPaymentType() == MusicGroupPaymentCalender.PaymentType.ADD_STUDENT) {
                 studentRegistration.setPaymentStatus(YES);
                 studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+                studentRegistration.setMusicGroupPaymentCalenderId(paymentCalender.getId());
                 studentRegistrationDao.update(studentRegistration);
                 
                 //统计变更学员数
@@ -3131,7 +3191,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //有已付费,在储备中的人,不容许到储备中
         int payAndCheckNum = studentRegistrationDao.countPayAndCheckNum(musicGroupId);
         if(payAndCheckNum > 0){
-            throw new BizException("有已付费,审核中的学生,请处理后再开团");
+            throw new BizException("有订单审核中的学生,请处理后再进行下一步");
         }
 
         //新建团:(乐团合作单位没有进行中 、暂停、关闭 的乐团)

+ 34 - 57
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -1,23 +1,41 @@
 package com.ym.mec.biz.service.impl;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
+import javax.annotation.Resource;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSON;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.ChargeTypeSubjectMapperDao;
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
+import com.ym.mec.biz.dal.dao.OrganizationCloudTeacherFeeDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dto.MusicGroupGoodsAndDiscountDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegRespDto;
 import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
+import com.ym.mec.biz.dal.entity.ChargeTypeSubjectMapper;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.biz.dal.entity.OrganizationCloudTeacherFee;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.service.GoodsService;
 import com.ym.mec.biz.service.MemberRankPrivilegesService;
 import com.ym.mec.biz.service.MusicGroupService;
@@ -64,6 +82,9 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 
 	@Autowired
 	private MemberRankPrivilegesService memberRankPrivilegesService;
+	
+    @Resource
+    private SysUserFeignService sysUserFeignService;
 
     @Override
     public BaseDAO<Integer, MusicGroupSubjectPlan> getDAO() {
@@ -156,6 +177,14 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 				musicGroupSubjectGoodsAndInfo.setMemberPrivilegesItemList(memberRankPrivilegesService.queryByMemberRankId(1));
 			}
 		}
+		
+		// 查询已购买内容
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser != null){
+        	Integer userId = sysUser.getId();
+        	musicGroupSubjectGoodsAndInfo.setStudentPaymentOrderDetailList(studentPaymentOrderDetailDao.findUserApplyOrder(userId, musicGroupId, DealStatusEnum.SUCCESS));
+        }
+        
         return musicGroupSubjectGoodsAndInfo;
     }
 
@@ -205,58 +234,6 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
     }
 
     @Override
-    public MusicGroupSubjectGoodsAndInfoDto getStudentGoodsAndInfo(String musicGroupId, Integer subjectId, StudentRegistration studentRegistration) {
-        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-
-        //课程形态
-        Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);
-
-        //乐团计划及收费信息
-        MusicGroupSubjectPlan musicOneSubjectClassPlan = this.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
-        musicOneSubjectClassPlan.setFee(studentRegistration.getTemporaryCourseFee());
-        musicOneSubjectClassPlan.setDepositFee(studentRegistration.getTemporaryCourseFee());
-
-        //乐团乐器及辅件信息
-        List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
-
-        List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.findUserApplyOrder(studentRegistration.getUserId(), musicGroupId, DealStatusEnum.WAIT_PAY);
-        for (StudentPaymentOrderDetail orderDetail : orderDetails) {
-            if (orderDetail == null || orderDetail.getGoodsIdList() == null || orderDetail.getGoodsIdList().isEmpty())
-                continue;
-            MusicGroupSubjectGoodsGroup musicGroupSubjectGoodsGroup = new MusicGroupSubjectGoodsGroup();
-            if (orderDetail.getType().equals(OrderDetailTypeEnum.MUSICAL)) {
-                musicGroupSubjectGoodsGroup.setName("乐器");
-                musicGroupSubjectGoodsGroup.setType(GoodsType.INSTRUMENT);
-            } else {
-                musicGroupSubjectGoodsGroup.setName("辅件");
-                musicGroupSubjectGoodsGroup.setType(GoodsType.ACCESSORIES);
-            }
-            if (orderDetail.getKitGroupPurchaseType() != null) {
-                if (orderDetail.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.LEASE)) {
-                    musicGroupSubjectGoodsGroup.setDepositFee(orderDetail.getPrice());
-                }
-                String kitGroupPurchaseTypeJson = "{\"" + orderDetail.getKitGroupPurchaseType().getCode() + "\":0}";
-                musicGroupSubjectGoodsGroup.setKitGroupPurchaseTypeJson(kitGroupPurchaseTypeJson);
-            }
-
-            musicGroupSubjectGoodsGroup.setId(orderDetail.getId());
-            musicGroupSubjectGoodsGroup.setGoodsIdList(orderDetail.getGoodsIdList());
-            musicGroupSubjectGoodsGroup.setMusicGroupId(musicGroupId);
-            musicGroupSubjectGoodsGroup.setPrice(orderDetail.getPrice());
-            List<Goods> goodies = goodsService.findGoodsByIds(orderDetail.getGoodsIdList());
-            musicGroupSubjectGoodsGroup.setGoodsList(goodies);
-            goodsGroups.add(musicGroupSubjectGoodsGroup);
-        }
-
-        //获取声部(科目)下其他商品
-        MusicGroupSubjectGoodsAndInfoDto musicGroupSubjectGoodsAndInfo = new MusicGroupSubjectGoodsAndInfoDto();
-        musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectPlan(musicOneSubjectClassPlan);
-        musicGroupSubjectGoodsAndInfo.setCourseScheduleInfo(courseForm);
-        musicGroupSubjectGoodsAndInfo.setMusicGroupSubjectGoodsGroupList(goodsGroups);
-        return musicGroupSubjectGoodsAndInfo;
-    }
-
-    @Override
     public MusicGroupSubjectPlan findSubjectPlan(String musicGroupId, Integer subjectId) {
         return musicGroupSubjectPlanDao.findSubjectPlan(musicGroupId, subjectId);
     }

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

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -353,8 +354,8 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
     }
 
     @Override
-    public List<SellOrder> getRefundSellOrder(Long orderId) {
-        return sellOrderDao.getRefundSellOrder(orderId);
+    public List<SellOrder> getRefundSellOrder(List<Long> orderIdList) {
+        return sellOrderDao.getRefundSellOrder(orderIdList);
     }
 
     @Override

+ 40 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentInstrumentServiceImpl.java

@@ -1,30 +1,55 @@
 package com.ym.mec.biz.service.impl;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import com.ym.mec.biz.dal.dao.GoodsDao;
 import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.MaintenancePayDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.GoodsCategory;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.GoodsCategoryService;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.PayService;
+import com.ym.mec.biz.service.StudentInstrumentService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 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.date.DateUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
 
 @Service
 public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentInstrument> implements StudentInstrumentService {
@@ -371,6 +396,7 @@ public class StudentInstrumentServiceImpl extends BaseServiceImpl<Long, StudentI
         }
         studentInstrument.setChangeOrderId(subjectChange.getOrderId().longValue());
         studentInstrument.setGoodsId(subjectChange.getChangeMusical());
+        
         if (studentInstrument.getId() == null) {
             addStudentInstrument(studentInstrument);
             return true;

+ 188 - 85
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderDetailServiceImpl.java

@@ -1,26 +1,51 @@
 package com.ym.mec.biz.service.impl;
 
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
+
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPurchaseListDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.dao.SubjectDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPurchaseList;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
 
 @Service
 public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrderDetail> implements StudentPaymentOrderDetailService {
@@ -50,6 +75,9 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+
     @Override
     public BaseDAO<Long, StudentPaymentOrderDetail> getDAO() {
         return studentPaymentOrderDetailDao;
@@ -247,86 +275,140 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
 
     @Override
     public List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer studentId) {
-        List<MusicalListDetailDto> musicalListDetailDtos = studentPaymentOrderDetailDao.getMusicalListDetail(musicGroupId, studentId);
-        if (musicalListDetailDtos.size() <= 0) {
-            return musicalListDetailDtos;
-        }
-        List<Long> paymentOrderNo = musicalListDetailDtos.stream().map(MusicalListDetailDto::getPaymentOrderId).collect(Collectors.toList());
-        List<Integer> userIds = musicalListDetailDtos.stream().map(MusicalListDetailDto::getUserId).collect(Collectors.toList());
-        //商品名称
+
+        List<MusicalListDetailDto> musicalListDetailDtos = new ArrayList<MusicalListDetailDto>();
+        
+    	List<String> musicGroupIdList = new ArrayList<String>();
+    	musicGroupIdList.add(musicGroupId);
+    	
+    	List<StudentRegistration> studentRegistrationList = studentRegistrationDao.findByMusicGroupIds(musicGroupIdList,StudentMusicGroupStatusEnum.NORMAL);
+    	
+    	if(studentRegistrationList == null || studentRegistrationList.size() == 0){
+    		return musicalListDetailDtos;
+    	}
+
+        List<Integer> userIds = studentRegistrationList.stream().distinct().map(StudentRegistration::getUserId).collect(Collectors.toList());
+        
+        List<SubjectChange> subjectChangeList = subjectChangeDao.getStudentGoods(musicGroupId);
+        Map<Integer,SubjectChange> subjectChangeMap = subjectChangeList.stream().collect(Collectors.toMap(SubjectChange :: getStudentId, t -> t));
+        
+        SubjectChange subjectChange = null;
+        
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         Organization organization = organizationDao.get(musicGroup.getOrganId());
-        Map<Long, String> goodsNameMap = MapUtil.convertIntegerMap(studentPaymentOrderDetailDao.queryGoodsNames(paymentOrderNo));
         Map<Integer, String> usernameMap = MapUtil.convertIntegerMap(teacherDao.queryUsernameByIds(userIds));
-        Map<Long, BigDecimal> expectAmountMap = MapUtil.convertIntegerMap(studentPaymentOrderDao.queryExpectAmount(paymentOrderNo));
-        Map<Long, BigDecimal> musicalAmountMap = MapUtil.convertIntegerMap(studentPaymentOrderDetailDao.queryGoodsPrice(paymentOrderNo, "MUSICAL"));
-        Map<Long, BigDecimal> accessoriesAmountMap = MapUtil.convertIntegerMap(studentPaymentOrderDetailDao.queryGoodsPrice(paymentOrderNo, "ACCESSORIES"));
-        String courseTypes = Arrays.stream(CourseSchedule.CourseScheduleType.values()).map(CourseSchedule.CourseScheduleType::getCode).collect(Collectors.joining(",")) + ",COURSE";
-        Map<Long, BigDecimal> courseAmountMap = MapUtil.convertIntegerMap(studentPaymentOrderDetailDao.queryGoodsPrice(paymentOrderNo, courseTypes));
-        Map<Long, String> purchaseTypeMap = MapUtil.convertIntegerMap(studentPaymentOrderDetailDao.queryPurchaseTypeMap(paymentOrderNo));
         Map<Integer, String> userSubjectMap = subjectDao.getRegisterSubject(musicGroupId, userIds).stream().collect(Collectors.toMap(StudentRegistration::getUserId, StudentRegistration::getSubjectName));
-        List<StudentPaymentOrderDetail> details = studentPaymentOrderDetailDao.getOrderGoodies(paymentOrderNo);
-
-        musicalListDetailDtos.forEach(e -> {
-            e.setGoodsNames(goodsNameMap.get(e.getPaymentOrderId()));
-            e.setMusicGroupName(musicGroup.getName());
-            e.setUsername(usernameMap.get(e.getUserId()));
-            e.setOrganName(organization.getName());
-            e.setMusicalAmount(musicalAmountMap.get(e.getPaymentOrderId()));
-            e.setAccessoriesAmount(accessoriesAmountMap.get(e.getPaymentOrderId()));
-            e.setOrderAmount(expectAmountMap.get(e.getPaymentOrderId()));
-            e.setCourseAmount(courseAmountMap.get(e.getPaymentOrderId()));
-            e.setSubjectName(userSubjectMap.get(e.getUserId()));
-            String s = purchaseTypeMap.get(e.getPaymentOrderId());
-            if (StringUtils.isNotEmpty(s)) {
-                e.setKitGroupPurchaseTypeEnum(KitGroupPurchaseTypeEnum.valueOf(purchaseTypeMap.get(e.getPaymentOrderId())));
-            }
-            SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(e.getUserId(), musicGroupId);
-            if (studentLastChange != null) {
-                studentLastChange.setOriginalKitGroupPurchaseType(studentLastChange.getKitGroupPurchaseType());
-            }
+        Integer userId = null;
+        
+        for(StudentRegistration studentRegistration : studentRegistrationList){
+        	
+        	MusicalListDetailDto dto = new MusicalListDetailDto();
+        	
+        	userId = studentRegistration.getUserId();
+        	
+        	List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
 
-            List<Goods> accessories = new ArrayList<>();
-            for (StudentPaymentOrderDetail detail : details) {
-                if (!e.getPaymentOrderId().equals(detail.getPaymentOrderId())) continue;
-                if (detail.getType().equals(OrderDetailTypeEnum.MUSICAL)) {
-                    e.setMusicalName(detail.getGoodsList().stream().map(Goods::getName).collect(Collectors.joining(",")));
-                } else {
-                    accessories.addAll(detail.getGoodsList());
-                }
-            }
-            accessories.sort(Comparator.comparing(Goods::getId));
-            e.setAccessoriesName(accessories.stream().map(Goods::getName).collect(Collectors.joining(",")));
-        });
-        List<SubjectChange> studentGoodies = subjectChangeDao.getStudentGoods(musicGroupId);
-        if (studentGoodies.size() <= 0) {
-            return musicalListDetailDtos;
-        }
-        List<SubjectChange> margins = subjectChangeDao.getMargin(musicGroupId);
-
-        for (MusicalListDetailDto musicalListDetailDto : musicalListDetailDtos) {
-            for (SubjectChange studentGoods : studentGoodies) {
-                if (!musicalListDetailDto.getUserId().equals(studentGoods.getStudentId())) continue;
-                musicalListDetailDto.setMusicalName("");
-                if (studentGoods.getChangeMusicalGoods() != null) {
-                    musicalListDetailDto.setMusicalName(studentGoods.getChangeMusicalGoods().getName());
-                }
-                musicalListDetailDto.setAccessoriesName("");
-                if (studentGoods.getChangeAccessoriesGoods() != null) {
-                    List<Goods> changeAccessoriesGoods = studentGoods.getChangeAccessoriesGoods();
-                    changeAccessoriesGoods.sort(Comparator.comparing(Goods::getId));
-                    String accessoriesNames = changeAccessoriesGoods.stream().map(Goods::getName).collect(Collectors.joining(","));
-                    musicalListDetailDto.setAccessoriesName(accessoriesNames);
-                }
-                musicalListDetailDto.setMusicalAmount(studentGoods.getChangeMusicalPrice());
-                musicalListDetailDto.setAccessoriesAmount(studentGoods.getChangeAccessoriesPrice());
-                musicalListDetailDto.setKitGroupPurchaseTypeEnum(studentGoods.getKitGroupPurchaseType());
-            }
-            for (SubjectChange margin : margins) {
-                if (!musicalListDetailDto.getUserId().equals(margin.getStudentId())) continue;
-                musicalListDetailDto.setOrderAmount(musicalListDetailDto.getOrderAmount().add(margin.getGoodsMargin()));
-            }
+			if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
+				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, musicGroupId, SUCCESS);
+				if (studentPaymentOrder != null) {
+					studentPaymentOrderList.add(studentPaymentOrder);
+				}
+
+			} else {
+				studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(userId, studentRegistration.getMusicGroupPaymentCalenderId() + "",
+						DealStatusEnum.SUCCESS);
+			}
+
+			List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+			
+			Long minPaymentOrderId = Collections.min(paymentOrderIdList);
+
+			List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
+			
+			Map<OrderDetailTypeEnum,BigDecimal> userOrderTypeMap = new HashMap<OrderDetailTypeEnum, BigDecimal>();;
+			
+			BigDecimal amount = BigDecimal.ZERO;
+			KitGroupPurchaseTypeEnum kitGroupPurchaseType = null;
+			String goodsId = null ,accessoriesId = null ;
+			BigDecimal orderTotalAmount = BigDecimal.ZERO;
+			BigDecimal withoutMusicalTotalAmount = BigDecimal.ZERO;
+			
+			for(StudentPaymentOrderDetail spod : orderDetailList){
+				
+				if (spod.getType() == OrderDetailTypeEnum.COURSE || spod.getType() == OrderDetailTypeEnum.HIGH_ONLINE_COURSE
+						|| spod.getType() == OrderDetailTypeEnum.SINGLE || spod.getType() == OrderDetailTypeEnum.VIP
+						|| spod.getType() == OrderDetailTypeEnum.HIGH || spod.getType() == OrderDetailTypeEnum.MIX
+						|| spod.getType() == OrderDetailTypeEnum.DEMO || spod.getType() == OrderDetailTypeEnum.COMPREHENSIVE
+						|| spod.getType() == OrderDetailTypeEnum.ENLIGHTENMENT || spod.getType() == OrderDetailTypeEnum.TRAINING_SINGLE
+						|| spod.getType() == OrderDetailTypeEnum.TRAINING_MIX || spod.getType() == OrderDetailTypeEnum.HIGH_ONLINE
+						|| spod.getType() == OrderDetailTypeEnum.MUSIC_NETWORK || spod.getType() == OrderDetailTypeEnum.CLASSROOM || spod.getType() == OrderDetailTypeEnum.THEORY_COURSE) {
+					spod.setType(OrderDetailTypeEnum.COURSE);
+					withoutMusicalTotalAmount = withoutMusicalTotalAmount.add(spod.getPrice().subtract(spod.getRemitFee()));
+				}else if(spod.getType() == OrderDetailTypeEnum.MUSICAL){
+					kitGroupPurchaseType = spod.getKitGroupPurchaseType();
+					goodsId = spod.getGoodsIdList();
+				}else if(spod.getType() == OrderDetailTypeEnum.ACCESSORIES){
+					accessoriesId = spod.getGoodsIdList();
+				}else{
+					withoutMusicalTotalAmount = withoutMusicalTotalAmount.add(spod.getPrice().subtract(spod.getRemitFee()));
+				}
+				
+				amount = userOrderTypeMap.get(spod.getType());
+				if(amount != null){
+					amount = amount.add(spod.getPrice().subtract(spod.getRemitFee()));
+				}else{
+					amount = spod.getPrice().subtract(spod.getRemitFee());
+				}
+				userOrderTypeMap.put(spod.getType(), amount);
+				
+				orderTotalAmount = orderTotalAmount.add(spod.getPrice().subtract(spod.getRemitFee()));
+			}
+        	
+        	subjectChange = subjectChangeMap.get(studentRegistration.getUserId());
+        	if(subjectChange != null && minPaymentOrderId <= subjectChange.getOriginalOrderId()){
+        		dto.setAccessoriesAmount(subjectChange.getChangeAccessoriesPrice());
+        		if(subjectChange.getChangeAccessoriesGoods() != null){
+        			dto.setAccessoriesName(subjectChange.getChangeAccessoriesGoods().stream().map(Goods::getName).collect(Collectors.joining(",")));
+        		}
+        		
+        		dto.setCourseAmount(userOrderTypeMap.get(OrderDetailTypeEnum.COURSE));
+        		//dto.setGoodsNames(goodsNames);
+        		dto.setKitGroupPurchaseTypeEnum(subjectChange.getKitGroupPurchaseType());
+        		dto.setMusicalAmount(subjectChange.getChangeMusicalPrice());
+        		if(subjectChange.getChangeMusicalGoods() != null){
+        			dto.setMusicalName(subjectChange.getChangeMusicalGoods().getName());
+        		}
+        		dto.setMusicGroupName(musicGroup.getName());
+        		dto.setOrganName(organization.getName());
+        		dto.setOrderAmount(withoutMusicalTotalAmount.add(subjectChange.getChangeMusicalPrice().add(subjectChange.getChangeAccessoriesPrice())));
+        		dto.setUserId(userId);
+        		dto.setSubjectName(userSubjectMap.get(userId));
+        		dto.setUsername(usernameMap.get(userId));
+        	}else{
+        		
+        		if(StringUtils.isNoneBlank(accessoriesId)){
+        			dto.setAccessoriesName(goodsService.findGoodsByIds(accessoriesId).stream().map(Goods::getName).collect(Collectors.joining(",")));
+        		}
+
+        		dto.setAccessoriesAmount(userOrderTypeMap.get(OrderDetailTypeEnum.ACCESSORIES));
+    			dto.setCourseAmount(userOrderTypeMap.get(OrderDetailTypeEnum.COURSE));
+        		dto.setMusicalAmount(userOrderTypeMap.get(OrderDetailTypeEnum.MUSICAL));
+    		
+        		//dto.setGoodsNames(goodsNames);
+        		dto.setKitGroupPurchaseTypeEnum(kitGroupPurchaseType);
+        		if(StringUtils.isNoneBlank(goodsId)){
+        			dto.setMusicalName(goodsService.findGoodsByIds(goodsId).stream().map(Goods::getName).collect(Collectors.joining(",")));
+        		}
+        		dto.setMusicGroupName(musicGroup.getName());
+        		dto.setOrganName(organization.getName());
+        		dto.setOrderAmount(orderTotalAmount);
+        		dto.setUserId(userId);
+        		dto.setSubjectName(userSubjectMap.get(userId));
+        		dto.setUsername(usernameMap.get(userId));
+        	}
+        	musicalListDetailDtos.add(dto);
         }
+    	
         return musicalListDetailDtos;
     }
 
@@ -336,11 +418,32 @@ public class StudentPaymentOrderDetailServiceImpl extends BaseServiceImpl<Long,
     }
 
     @Override
-    public List<StudentPaymentOrderDetail> getOrderDetail(Long orderId) {
-        return studentPaymentOrderDetailDao.getOrderDetail(orderId);
-    }
+	public List<StudentPaymentOrderDetail> getOrderDetail(Long orderId) {
+		
+    	List<Long> orderIdList = new ArrayList<Long>();
+    	orderIdList.add(orderId);
+    		
+    	return getOrderDetail(orderIdList);
+	}
 
     @Override
+	public List<StudentPaymentOrderDetail> getOrderDetail(List<Long> orderIdList) {
+    	List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailDao.getOrderDetailByOrderId(orderIdList);
+
+		for (StudentPaymentOrderDetail spod : studentPaymentOrderDetailList) {
+			if (spod.getType() == OrderDetailTypeEnum.ACCESSORIES || spod.getType() == OrderDetailTypeEnum.MUSICAL
+					|| spod.getType() == OrderDetailTypeEnum.TEACHING) {
+				List<Goods> goods = goodsService.findGoodsByIds(spod.getGoodsIdList());
+				if (goods != null && goods.size() > 0) {
+					spod.setName(goods.stream().map(t -> t.getName()).collect(Collectors.joining(",")));
+				}
+			}
+		}
+
+		return studentPaymentOrderDetailList;
+	}
+
+	@Override
     public List<String> getOrderDetailType(Long orderId) {
         return studentPaymentOrderDetailDao.getOrderDetailType(orderId);
     }

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

@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
@@ -193,6 +194,11 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+	public List<StudentPaymentOrder> queryByBatchNo(Integer userId, String batchNo, DealStatusEnum status) {
+		return studentPaymentOrderDao.queryByBatchNo(userId, batchNo, status);
+	}
+
+	@Override
     public int findPayOrderNum() {
         return studentPaymentOrderDao.findPayOrderNum();
     }
@@ -433,7 +439,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             studentRegistrationService.updateApplyOrder(order);
         } else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)) {
             vipGroupService.orderCallback(order);
-        } else if (order.getType().equals(OrderTypeEnum.RENEW)) {
+        } else if (order.getType().equals(OrderTypeEnum.RENEW) || order.getType().equals(OrderTypeEnum.ADD_STUDENT)) {
             musicGroupService.renewForCallback(order);
         } else if (order.getType().equals(OrderTypeEnum.SPORADIC) || order.getType().equals(OrderTypeEnum.LUCK) || order.getType().equals(OrderTypeEnum.DOUBLE_ELEVEN2020)) {
             sporadicChargeInfoService.renewForCallback(order);
@@ -634,4 +640,9 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentPaymentOrder getUserReplacementIngOrder(Integer userId, Integer replacementId) {
         return studentPaymentOrderDao.getUserReplacementIngOrder(userId, replacementId);
     }
+
+	@Override
+	public int batchUpdate(List<StudentPaymentOrder> studentPaymentOrderList) {
+		return studentPaymentOrderDao.batchUpdate(studentPaymentOrderList);
+	}
 }

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

@@ -6,19 +6,20 @@ import static com.ym.mec.biz.dal.enums.PaymentStatusEnum.YES;
 
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.page.NoClassMusicStudentQueryInfo;
-import com.ym.mec.biz.dal.page.RegistrationOrPreQueryInfo;
-import com.ym.mec.biz.service.*;
-
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,13 +36,103 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.ImGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderCourseSettingsDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao;
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
+import com.ym.mec.biz.dal.dao.MusicGroupSubjectPlanDao;
+import com.ym.mec.biz.dal.dao.OrganizationCloudTeacherFeeDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.StudentCourseFeeDetailDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentInstrumentDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.dao.SubjectDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.NoClassMusicStudentDto;
+import com.ym.mec.biz.dal.dto.PageInfoReg;
+import com.ym.mec.biz.dal.dto.RegisterDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
-import com.ym.mec.biz.dal.dto.StudentFeeDetailDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.dto.StudentMusicDetailDto;
 import com.ym.mec.biz.dal.dto.StudentMusicGroupDto;
+import com.ym.mec.biz.dal.entity.ClassGroup;
+import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderStudentDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
+import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
+import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.OrganizationCloudTeacherFee;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentCourseFeeDetail;
+import com.ym.mec.biz.dal.entity.StudentInstrument;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GoodsType;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
+import com.ym.mec.biz.dal.page.NoClassMusicStudentQueryInfo;
+import com.ym.mec.biz.dal.page.RegistrationOrPreQueryInfo;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.service.ClassGroupService;
+import com.ym.mec.biz.service.ClassGroupStudentMapperService;
+import com.ym.mec.biz.service.CloudTeacherOrderService;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.CourseScheduleService;
+import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
+import com.ym.mec.biz.service.ImGroupMemberService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
+import com.ym.mec.biz.service.SellOrderService;
+import com.ym.mec.biz.service.StudentInstrumentService;
+import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.SubjectService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.ImResult;
@@ -239,42 +330,59 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public StudentFeeDetailDto queryFeeDetail(Integer studentId, String musicGroupId) {
-        StudentFeeDetailDto studentFeeDetailDto = new StudentFeeDetailDto();
-        List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroupId, studentId);
-        if (musicalList.size() <= 0) {
-            return studentFeeDetailDto;
-        }
-        MusicalListDetailDto detailDto = musicalList.get(0);
-        studentFeeDetailDto.setTotalAmount(detailDto.getOrderAmount());
-        studentFeeDetailDto.setCourseFee(detailDto.getCourseAmount());
-        if (KitGroupPurchaseTypeEnum.LEASE.equals(detailDto.getKitGroupPurchaseTypeEnum())) {
-            studentFeeDetailDto.setDepositFee(detailDto.getMusicalAmount());
-        }
-        List<StudentFeeDto> studentFeeDtos = new ArrayList<>();
-        if (detailDto.getMusicalName() != null) {
-            StudentFeeDto studentFeeDto = new StudentFeeDto();
-            studentFeeDto.setGoodsName(detailDto.getMusicalName());
-            studentFeeDto.setGoodsType("INSTRUMENT");
-            studentFeeDto.setMusicalFee(detailDto.getMusicalAmount());
-            studentFeeDtos.add(studentFeeDto);
-        }
-        if (detailDto.getAccessoriesName() != null) {
-            StudentFeeDto studentFeeDto = new StudentFeeDto();
-            studentFeeDto.setGoodsName(detailDto.getAccessoriesName());
-            studentFeeDto.setGoodsType("ACCESSORIES");
-            studentFeeDto.setMusicalFee(detailDto.getAccessoriesAmount());
-            studentFeeDtos.add(studentFeeDto);
-        }
-        StudentFeeDto studentFeeDto = new StudentFeeDto();
-        studentFeeDto.setGoodsType("COURSE");
-        studentFeeDto.setMusicalFee(detailDto.getCourseAmount());
-        studentFeeDtos.add(studentFeeDto);
-        studentFeeDetailDto.setGoods(studentFeeDtos);
-
-        return studentFeeDetailDto;
-        //return studentRegistrationDao.queryFeeDetail(studentId, musicGroupId);
-    }
+	public List<StudentPaymentOrderDetail> queryFeeDetail(Integer studentId, String musicGroupId) {
+
+		List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, musicGroupId, studentId,
+				DealStatusEnum.SUCCESS, OrderTypeEnum.APPLY);
+
+		List<Long> orderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+
+		List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.getOrderDetail(orderIdList);
+
+		SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(studentId, musicGroupId);
+		
+		if (studentLastChange != null) {
+			Iterator<StudentPaymentOrderDetail> iterator = studentPaymentOrderDetailList.iterator();
+			StudentPaymentOrderDetail spod = null;
+			while (iterator.hasNext()) {
+				spod = iterator.next();
+				if (spod.getType() == OrderDetailTypeEnum.ACCESSORIES || spod.getType() == OrderDetailTypeEnum.MUSICAL) {
+					iterator.remove();
+				}
+			}
+
+			if (StringUtils.isNoneBlank(studentLastChange.getChangeAccessories())) {
+				StudentPaymentOrderDetail detail = new StudentPaymentOrderDetail();
+				detail.setGoodsIdList(studentLastChange.getChangeAccessories());
+				List<Goods> goods = goodsDao.findGoodsByIds(detail.getGoodsIdList());
+				if (goods != null && goods.size() > 0) {
+					detail.setName(goods.stream().map(t -> t.getName()).collect(Collectors.joining(",")));
+				}
+				detail.setPaymentOrderId((long) studentLastChange.getOriginalOrderId());
+				detail.setPrice(studentLastChange.getChangeAccessoriesPrice());
+				detail.setType(OrderDetailTypeEnum.ACCESSORIES);
+				detail.setCreateTime(studentLastChange.getCreateTime());
+
+				studentPaymentOrderDetailList.add(detail);
+			}
+			if (studentLastChange.getChangeMusical() != null) {
+				StudentPaymentOrderDetail detail = new StudentPaymentOrderDetail();
+				detail.setGoodsIdList(studentLastChange.getChangeMusical() + "");
+				List<Goods> goods = goodsDao.findGoodsByIds(detail.getGoodsIdList());
+				if (goods != null && goods.size() > 0) {
+					detail.setName(goods.stream().map(t -> t.getName()).collect(Collectors.joining(",")));
+				}
+				detail.setPaymentOrderId((long) studentLastChange.getOriginalOrderId());
+				detail.setPrice(studentLastChange.getChangeMusicalPrice());
+				detail.setType(OrderDetailTypeEnum.MUSICAL);
+				detail.setCreateTime(studentLastChange.getCreateTime());
+
+				studentPaymentOrderDetailList.add(detail);
+			}
+		}
+
+		return studentPaymentOrderDetailList;
+	}
 
     @Override
     public List<Map<String, Object>> getNoClassStuBySubjectId(String musicGroupId, String actualSubjectId) {
@@ -525,26 +633,30 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         //增加缴费学生数,0元订单不增加报名人数(没买云教练/云教练+的)
         boolean paidZeroFlag = false;
-        boolean firstPaidZeroFlag = false;
 
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
-        if (musicOneSubjectClassPlan.getPaidStudentNum() >= musicOneSubjectClassPlan.getExpectedStudentNum()) {
-            throw new BizException("乐团该声部人数暂时已满,请稍后再试");
-        }
+        
+        //判断之前是否已有订单
+        List<StudentPaymentOrder> oldStudentPaymentOrderList = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, studentRegistration.getMusicGroupId(), studentRegistration.getUserId(),DealStatusEnum.SUCCESS , OrderTypeEnum.APPLY);
         
         int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
         int paidZeroNum = musicOneSubjectClassPlan.getPaidZeroNum() == null ? 0 : musicOneSubjectClassPlan.getPaidZeroNum();
         if ((musicGroup.getCourseViewType().equals(CourseViewTypeEnum.MEMBER_FEE) && !buyCloudTeacher))
         {
             paidZeroFlag = true;
-            if (studentRegistration.getNoneNeedCloudTeacher().equals(1)) {
+            if (studentRegistration.getNoneNeedCloudTeacher().equals(1) && (oldStudentPaymentOrderList == null || oldStudentPaymentOrderList.size() == 0)) {
                 musicOneSubjectClassPlan.setPaidZeroNum(paidZeroNum + 1);
                 musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
-                firstPaidZeroFlag = true;
             }
         } else {
-            musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
+			if (oldStudentPaymentOrderList == null || oldStudentPaymentOrderList.size() == 0) {
+				musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
+			}
+        }
+        if (musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()) {
+            throw new BizException("乐团该声部人数暂时已满,请稍后再试");
         }
+        
         int count = musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
         if (count <= 0) {
             throw new BizException("排队人数过多,请重试");
@@ -715,159 +827,127 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         StudentRegistration phoneAndMusicGroupId = studentRegistrationDao.getByPhoneAndMusicGroupId(musicGroupId, studentRegistration.getParentsPhone());
         if (phoneAndMusicGroupId != null && phoneAndMusicGroupId.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT && phoneAndMusicGroupId.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
             throw new BizException("该学员已存在");
+        }
+
+        SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        Integer userId;
+        if (sysUser == null) {
+            //新增user
+            sysUser = new SysUser();
+            sysUser.setPhone(studentRegistration.getParentsPhone());
+//            sysUser.setRealName(studentRegistration.getParentsName());
+            sysUser.setUsername(studentRegistration.getName());
+            sysUser.setGender(studentRegistration.getGender());
+            sysUser.setUserType("STUDENT");
+//            sysUser.setIdCardNo(studentRegistration.getIdCardNo());
+            sysUser.setOrganId(musicGroup.getOrganId());
+            sysUser.setBirthdate(studentRegistration.getBirthdate());
+            teacherDao.addSysUser(sysUser);
+            userId = sysUser.getId();
+            studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
+            //添加用户现金账户
+            sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
+            ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), null));
+            sysUser.setImToken(register.getToken());
+            teacherDao.updateUser(sysUser);
         } else {
-            SysUser sysUser = studentRegistrationDao.getSysUserByPhone(studentRegistration.getParentsPhone());
-            MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-            Integer userId;
-            if (sysUser == null) {
-                //新增user
-                sysUser = new SysUser();
-                sysUser.setPhone(studentRegistration.getParentsPhone());
-//                sysUser.setRealName(studentRegistration.getParentsName());
-                sysUser.setUsername(studentRegistration.getName());
-                sysUser.setGender(studentRegistration.getGender());
-                sysUser.setUserType("STUDENT");
-//                sysUser.setIdCardNo(studentRegistration.getIdCardNo());
-                sysUser.setOrganId(musicGroup.getOrganId());
-                sysUser.setBirthdate(studentRegistration.getBirthdate());
-                teacherDao.addSysUser(sysUser);
-                userId = sysUser.getId();
-                studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
-                //添加用户现金账户
-                sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
-                ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), null));
-                sysUser.setImToken(register.getToken());
-                teacherDao.updateUser(sysUser);
-            } else {
-                if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
-                    //该学员是否在其他的会员团
-                    boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId,sysUser.getId());
-                    if(hasMemberGroup){
-                        throw new BizException("操作失败:该学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
-                    }
-                }
-                StudentRegistration oldReg = studentRegistrationDao.getByUserIdAndMusicGroupId(musicGroupId, sysUser.getId());
-                if (oldReg != null && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
-                    throw new BizException("该学员已存在,原手机号为" + oldReg.getParentsPhone());
-                }
-                if (oldReg != null) {
-                    phoneAndMusicGroupId = oldReg;
+            if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
+                //该学员是否在其他的会员团
+                boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId,sysUser.getId());
+                if(hasMemberGroup){
+                    throw new BizException("操作失败:该学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
                 }
-                if (StringUtils.isNotEmpty(sysUser.getUsername())) {
-                    if (!sysUser.getUsername().equals(studentRegistration.getName())) {
-                        throw new BizException("操作失败:账户已被注册");
-                    }
-                }
-                if (!sysUser.getUserType().contains("STUDENT")) {
-                    sysUser.setUserType(sysUser.getUserType() + ",STUDENT");
+            }
+            StudentRegistration oldReg = studentRegistrationDao.getByUserIdAndMusicGroupId(musicGroupId, sysUser.getId());
+            if (oldReg != null && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.QUIT && oldReg.getMusicGroupStatus() != StudentMusicGroupStatusEnum.APPLY) {
+                throw new BizException("该学员已存在,原手机号为" + oldReg.getParentsPhone());
+            }
+            if (StringUtils.isNotEmpty(sysUser.getUsername())) {
+                if (!sysUser.getUsername().equals(studentRegistration.getName())) {
+                    throw new BizException("操作失败:账户已被注册");
                 }
-                sysUser.setPhone(studentRegistration.getParentsPhone());
-//                sysUser.setRealName(studentRegistration.getParentsName());
-                sysUser.setUsername(studentRegistration.getName());
-                sysUser.setGender(studentRegistration.getGender());
-                sysUser.setOrganId(musicGroup.getOrganId());
-                sysUser.setBirthdate(studentRegistration.getBirthdate());
-                teacherDao.updateUser(sysUser);
-                userId = sysUser.getId();
-                Student student = studentDao.get(userId);
-                if (student == null) {
-                    studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
-                } else if (StringUtils.isEmpty(student.getSubjectIdList())) {
-                    student.setSubjectIdList(studentRegistration.getSubjectId().toString());
+            }
+            if (!sysUser.getUserType().contains("STUDENT")) {
+                sysUser.setUserType(sysUser.getUserType() + ",STUDENT");
+            }
+            sysUser.setPhone(studentRegistration.getParentsPhone());
+//            sysUser.setRealName(studentRegistration.getParentsName());
+            sysUser.setUsername(studentRegistration.getName());
+            sysUser.setGender(studentRegistration.getGender());
+            sysUser.setOrganId(musicGroup.getOrganId());
+            sysUser.setBirthdate(studentRegistration.getBirthdate());
+            teacherDao.updateUser(sysUser);
+            userId = sysUser.getId();
+            Student student = studentDao.get(userId);
+            if (student == null) {
+                studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
+            } else if (StringUtils.isEmpty(student.getSubjectIdList())) {
+                student.setSubjectIdList(studentRegistration.getSubjectId().toString());
+                student.setUpdateTime(date);
+                studentDao.update(student);
+            } else if (StringUtils.isNotEmpty(student.getSubjectIdList())) {
+                String[] split = student.getSubjectIdList().split(",");
+                List<String> list = new ArrayList<>(Arrays.asList(split));
+                if (!list.contains(studentRegistration.getSubjectId().toString())) {
+                    list.add(studentRegistration.getSubjectId().toString());
+                    student.setSubjectIdList(StringUtils.join(list, ","));
                     student.setUpdateTime(date);
                     studentDao.update(student);
-                } else if (StringUtils.isNotEmpty(student.getSubjectIdList())) {
-                    String[] split = student.getSubjectIdList().split(",");
-                    List<String> list = new ArrayList<>(Arrays.asList(split));
-                    if (!list.contains(studentRegistration.getSubjectId().toString())) {
-                        list.add(studentRegistration.getSubjectId().toString());
-                        student.setSubjectIdList(StringUtils.join(list, ","));
-                        student.setUpdateTime(date);
-                        studentDao.update(student);
-                    }
                 }
-                imGroupDao.updateNickname(userId, sysUser.getUsername());
-                imGroupDao.updateUserFriendNickname(userId, sysUser.getUsername());
-            }
-            MusicGroupStudentFee studentFeeDaoByUser = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
-            if (studentFeeDaoByUser != null) {
-                throw new BizException("该学员已存在");
             }
-            Organization organization = organizationDao.get(musicGroup.getOrganId());
-            String studentGrade = studentService.getStudentGrade(organization.getGradeType(), studentRegistration.getCurrentGradeNum());
-            studentRegistration.setCurrentGrade(studentGrade);
-            studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
-            studentRegistration.setUserId(userId);
-            studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
-            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
-            studentRegistration.setTemporaryCourseFee(studentAddDto.getTemporaryCourseFee());
-            //学生报名表
-            Set<Integer> roleIds = new HashSet<>(1);
-            roleIds.add(SysUserRole.SECTION_MANAGER);
-            Set<Integer> integers = musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId());
-            integers.add(musicGroup.getEducationalTeacherId());
-            sysMessageService.batchSeoMessage(integers, MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
-            //增加报名学生数
-            musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getSubjectId(), 1);
-            //汇总金额
-
-            MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee(musicGroupId,
-                    userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
-                    null, studentAddDto.getTemporaryCourseFee(), null);
-
-            /*if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() * 100 == 0) {
-                musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
-            }*/
-            musicGroupStudentFeeDao.insert(musicGroupStudentFee);
-
-            StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
+            imGroupDao.updateNickname(userId, sysUser.getUsername());
+            imGroupDao.updateUserFriendNickname(userId, sysUser.getUsername());
+        }
+        MusicGroupStudentFee studentFeeDaoByUser = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
+        if (studentFeeDaoByUser != null) {
+            throw new BizException("该学员已存在");
+        }
+        Organization organization = organizationDao.get(musicGroup.getOrganId());
+        String studentGrade = studentService.getStudentGrade(organization.getGradeType(), studentRegistration.getCurrentGradeNum());
+        studentRegistration.setCurrentGrade(studentGrade);
+        studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
+        studentRegistration.setUserId(userId);
+        studentRegistration.setPaymentStatus(PaymentStatusEnum.OPEN);
+        studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.APPLY);
+        studentRegistration.setTemporaryCourseFee(studentAddDto.getTemporaryCourseFee());
+        studentRegistration.setMusicGroupPaymentCalenderId(null);
+        
+        //增加报名学生数
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getSubjectId(), 1);
+        //汇总金额
 
-            if (waitPayOrder != null) {
-                waitPayOrder.setStatus(DealStatusEnum.CLOSE);
-                studentPaymentOrderService.update(waitPayOrder);
-            }
-            //生成订单
-            StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
-            studentPaymentOrder.setUserId(userId);
-            studentPaymentOrder.setGroupType(GroupType.MUSIC);
-            studentPaymentOrder.setType(OrderTypeEnum.APPLY);
-            studentPaymentOrder.setStatus(DealStatusEnum.WAIT_PAY);
-            studentPaymentOrder.setMusicGroupId(musicGroupId);
-            studentPaymentOrder.setClassGroupId(studentAddDto.getSignClassId());
-            studentPaymentOrder.setOrganId(musicGroup.getOrganId());
-            studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
-
-            //生成订单明细
-            List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
-            if (studentPaymentOrderDetails == null) {
-                studentPaymentOrderDetails = new ArrayList<>();
-            }
-            //汇总金额
+        MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee(musicGroupId,
+                userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
+                null, studentAddDto.getTemporaryCourseFee(), null);
 
-            BigDecimal reduce = studentPaymentOrderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
-            if (reduce.compareTo(BigDecimal.ZERO) == 0) {
-                studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
-                studentPaymentOrder.setActualAmount(reduce);
-                studentPaymentOrder.setPayTime(date);
-            }
-            studentPaymentOrder.setExpectAmount(reduce);
-            studentPaymentOrderService.insert(studentPaymentOrder);
+        /*if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() * 100 == 0) {
+            musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
+        }*/
+        musicGroupStudentFeeDao.insert(musicGroupStudentFee);
 
-            //当前学员是否以前存在过当前乐团
-            if (phoneAndMusicGroupId != null) {
-                studentRegistration.setId(phoneAndMusicGroupId.getId());
-                studentRegistrationDao.update(studentRegistration);
-            } else {
-                studentRegistrationDao.insertBasic(studentRegistration);
-            }
-            Student student = studentDao.get(userId);
-            student.setCurrentGradeNum(studentRegistration.getCurrentGradeNum());
-            student.setCurrentClass(studentRegistration.getCurrentClass());
-            studentDao.update(student);
-            //studentRegistrationDao.updateCurrentClass(studentRegistration);
-            imFeignService.update(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
-            return userId;
+        //当前学员是否以前存在过当前乐团
+        if (phoneAndMusicGroupId != null) {
+            studentRegistration.setId(phoneAndMusicGroupId.getId());
+            studentRegistrationDao.update(studentRegistration);
+        } else {
+            studentRegistrationDao.insertBasic(studentRegistration);
         }
+        Student student = studentDao.get(userId);
+        student.setCurrentGradeNum(studentRegistration.getCurrentGradeNum());
+        student.setCurrentClass(studentRegistration.getCurrentClass());
+        studentDao.update(student);
+        //studentRegistrationDao.updateCurrentClass(studentRegistration);
+        imFeignService.update(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
+        
+        //学生报名表
+        Set<Integer> roleIds = new HashSet<>(1);
+        roleIds.add(SysUserRole.SECTION_MANAGER);
+        Set<Integer> integers = musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId());
+        integers.add(musicGroup.getEducationalTeacherId());
+        sysMessageService.batchSeoMessage(integers, MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
+        
+        return userId;
     }
 
     @Override
@@ -914,13 +994,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //修改原有乐团注册信息
                 studentRegistrationDao.update(studentRegistration);
             }
-            Boolean orderFlag = true;
             //用户是否在主乐团
             StudentRegistration registration = studentRegistrationDao.getStudentRegister(newMusicGroupId, studentRegistration.getUserId());
             if (registration != null) {
-                if (registration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL) {
-                    orderFlag = false;
-                }
                 //修改剩余课程余额
                 Date date = new Date();
                 registration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
@@ -947,28 +1023,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     musicGroupStudentFeeDao.insert(musicGroupStudentFee);
                 }
             }
-            StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(registration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-
-            if (waitPayOrder != null) {
-                waitPayOrder.setStatus(DealStatusEnum.CLOSE);
-                studentPaymentOrderService.update(waitPayOrder);
-            }
-            if (orderFlag) {
-                //生成订单
-                StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
-                studentPaymentOrder.setUserId(registration.getUserId());
-                studentPaymentOrder.setGroupType(GroupType.MUSIC);
-                studentPaymentOrder.setType(OrderTypeEnum.APPLY);
-                studentPaymentOrder.setMusicGroupId(registration.getMusicGroupId());
-                studentPaymentOrder.setClassGroupId(registration.getClassGroupId());
-                studentPaymentOrder.setOrganId(registration.getOrganId());
-                studentPaymentOrder.setRoutingOrganId(registration.getOrganId());
-                studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
-                studentPaymentOrder.setActualAmount(BigDecimal.ZERO);
-                studentPaymentOrder.setPayTime(new Date());
-                studentPaymentOrder.setExpectAmount(BigDecimal.ZERO);
-                studentPaymentOrderService.insert(studentPaymentOrder);
-            }
             //主班新增余额日志
             if (amount.doubleValue() != 0d && masterTotalPrice.doubleValue() > 0d) {
                 StudentCourseFeeDetail studentCourseFeeDetail = new StudentCourseFeeDetail();
@@ -1084,15 +1138,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         Date nowDate = new Date();
 
         //成功报名状态变更
-        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId());
+        StudentRegistration studentRegistration = studentRegistrationDao.lockWithUserAndMusic(studentPaymentOrder.getUserId(), studentPaymentOrder.getMusicGroupId());
 
-        if (studentRegistration.getPaymentStatus().equals(YES)) {
-            return studentPaymentOrder;
-        }
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
 
         if (studentPaymentOrder.getStatus().equals(DealStatusEnum.SUCCESS)) {
-            MusicGroup musicGroup = musicGroupDao.getLocked(studentRegistration.getMusicGroupId());
+            MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
 
             if (studentRegistration.getTemporaryCourseFee() != null) {
                 studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
@@ -1105,7 +1156,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
 
-            List<StudentPaymentOrderDetail> allDetails = studentPaymentOrderDetailDao.getOrderDetailByOrderId(studentPaymentOrder.getId());
+            List<Long> orderIdList = new ArrayList<Long>();
+            orderIdList.add(studentPaymentOrder.getId());
+            List<StudentPaymentOrderDetail> allDetails = studentPaymentOrderDetailDao.getOrderDetailByOrderId(orderIdList);
             BigDecimal courseFee = allDetails.stream().filter(o -> !o.getType().getCode().equals("MUSICAL"))
                     .filter(o -> !o.getType().getCode().equals("ACCESSORIES"))
                     .filter(o -> !o.getType().getCode().equals("MAINTENANCE"))
@@ -1118,9 +1171,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<OrderDetailTypeEnum> orderTypeList = allDetails.stream().map(t -> t.getType()).collect(Collectors.toList());
             
 			if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
-				if (studentRegistration.getNoneNeedCloudTeacher() == 1 || orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER)
+
+				if(studentRegistration.getNoneNeedCloudTeacher() == 1){
+					studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+				}
+				
+				if (orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER)
 						|| orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)) {
 					studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+					studentRegistration.setNoneNeedCloudTeacher(1);
+					studentRegistration.setHasCloudTeacher(1);
 				}
 			} else {
 				studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
@@ -1139,18 +1199,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentCourseFeeDetail.setOperator(studentPaymentOrder.getUserId());
             studentCourseFeeDetailDao.insert(studentCourseFeeDetail);
 
-            MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(studentRegistration.getUserId(), studentRegistration.getMusicGroupId());
-            //进行中乐团加入学生缴费
-            if (studentRegistration.getTemporaryCourseFee() != null) {
-                //关闭待支付订单
-                StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-                waitPayOrder.setStatus(DealStatusEnum.CLOSE);
-                studentPaymentOrderService.update(waitPayOrder);
-                musicGroupStudentFee.setLatestPaidTime(nowDate);
-                musicGroupStudentFee.setPaymentStatus(PAID_COMPLETED);
-                musicGroupStudentFee.setTemporaryCourseFee(BigDecimal.ZERO);
-                musicGroupStudentFee.setUpdateTime(nowDate);
-            }
             //插入交易明细
             BigDecimal amount = studentPaymentOrder.getActualAmount();
             SysUserCashAccount cashAccount = sysUserCashAccountService.get(studentRegistration.getUserId());
@@ -1239,7 +1287,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED)) {
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
             studentRegistration.setPayingStatus(0);
-            studentRegistration.setHasCloudTeacher(0);
             studentRegistrationDao.update(studentRegistration);
 
             //减去缴费人数(器乐收费,0元时不减缴费人数)
@@ -1280,23 +1327,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     private boolean addCalenderDetail(StudentPaymentOrder studentPaymentOrder, StudentRegistration studentRegistration) {
         Date nowDate = new Date();
-        MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee();
-        musicGroupStudentFee.setLatestPaidTime(nowDate);
-        musicGroupStudentFee.setPaymentStatus(PAID_COMPLETED);
-        musicGroupStudentFee.setUpdateTime(nowDate);
-        musicGroupStudentFee.setContinuousAbsenteeismTimes(0);
-        musicGroupStudentFee.setSubjectId(studentRegistration.getActualSubjectId());
-        musicGroupStudentFee.setIsLock(0);
-        musicGroupStudentFee.setMusicGroupId(studentRegistration.getMusicGroupId());
-        musicGroupStudentFee.setUserId(studentRegistration.getUserId());
 
         String currentMusicGroupId = studentRegistration.getMusicGroupId();
 
         //缴费详情 calender detail
         MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderService.findByMusicGroupRegCalender(currentMusicGroupId);
         if (musicGroupRegCalender == null) {
-            musicGroupStudentFeeDao.insert(musicGroupStudentFee);
-            return true;
+            throw new BizException("报名缴费信息查询失败");
         }
 
         String batchNo = musicGroupRegCalender.getBatchNo();
@@ -1304,12 +1341,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByBatchNo(batchNo);
 
-        if (musicGroupRegCalender.getIsGiveMusicNetwork() != null && musicGroupRegCalender.getIsGiveMusicNetwork()) {
-            //赠送网管课
-            musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + musicGroupPaymentCalenderList.size());
-        }
-        musicGroupStudentFeeDao.insert(musicGroupStudentFee);
-
         for (MusicGroupPaymentCalender musicGroupPaymentCalender : musicGroupPaymentCalenderList) {
             if (currentPaymentCalenderId.longValue() == musicGroupPaymentCalender.getId()) {
                 // 更新实际缴费人数
@@ -1953,6 +1984,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         
         studentRegistration.setPayingStatus(0);
+        studentRegistration.setNoneNeedCloudTeacher(1);
         studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
         studentRegistrationDao.update(studentRegistration);
         StudentPaymentOrder order = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
@@ -1976,4 +2008,39 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentRegistration getStudentRegister(String musicGroupId, Integer studentId) {
         return studentRegistrationDao.getStudentRegister(musicGroupId,studentId);
     }
+
+	@Override
+    @Transactional(rollbackFor = Exception.class)
+	public Boolean setCloudTeacherToFailed(StudentRegistration studentRegistration) {
+        
+        if(studentRegistration.getPayingStatus() != 2){
+        	throw new BizException("只有'审核中'的记录才能取消审核");
+        }
+		
+		Date date = new Date();
+		
+		studentRegistration.setPayingStatus(0);
+		studentRegistration.setUpdateTime(date);
+		update(studentRegistration);
+		
+		List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderService.queryByCondition(GroupType.MUSIC, studentRegistration.getMusicGroupId(), studentRegistration.getUserId(), DealStatusEnum.ING, OrderTypeEnum.APPLY);
+		
+		List<StudentPaymentOrder> updateList = new ArrayList<StudentPaymentOrder>();
+		
+		if(studentPaymentOrderList != null && studentPaymentOrderList.size() > 0){
+			for(StudentPaymentOrder studentPaymentOrder : studentPaymentOrderList){
+				if(StringUtils.equals("205", studentPaymentOrder.getPaymentAccountNo())){
+					studentPaymentOrder.setStatus(DealStatusEnum.CLOSE);
+					studentPaymentOrder.setMemo("云教练审核拒绝");
+					updateList.add(studentPaymentOrder);
+				}
+			}
+		}
+		
+		if(updateList.size() > 0){
+			studentPaymentOrderService.batchUpdate(updateList);
+		}
+		
+		return true;
+	}
 }

+ 60 - 17
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
+
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
@@ -13,6 +15,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -72,6 +75,8 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
     private StudentInstrumentService studentInstrumentService;
     @Autowired
     private MusicGroupPurchaseListDao musicGroupPurchaseListDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -230,9 +235,13 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         }
         Date nowDate = new Date();
         SubjectChange studentOriginal = getStudentOriginal(subjectChange.getStudentId(), subjectChange.getMusicGroupId());
-        subjectChange.setOriginalOrderId(studentOriginal.getOrderId());
-        subjectChange.setOriginalCost(studentOriginal.getOriginalCost());
-        subjectChange.setOriginalAccessories(studentOriginal.getOriginalAccessories());
+        if(studentOriginal != null){
+        	subjectChange.setOriginalOrderId(studentOriginal.getOrderId());
+        	subjectChange.setOriginalCost(studentOriginal.getOriginalCost());
+        	subjectChange.setOriginalAccessories(studentOriginal.getOriginalAccessories());
+            subjectChange.setOriginalKitGroupPurchaseType(
+            studentOriginal.getOriginalKitGroupPurchaseType() == null ? KitGroupPurchaseTypeEnum.OWNED : studentOriginal.getOriginalKitGroupPurchaseType());
+        }
         subjectChange.setStatus(SubjectChangeStatusEnum.WAIT_PAY);
         MusicGroup musicGroup = musicGroupDao.get(subjectChange.getMusicGroupId());
         subjectChange.setOrganId(musicGroup.getOrganId());
@@ -242,8 +251,6 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         BigDecimal goodsMargin = subjectChange.getChangeMusicalPrice().add(subjectChange.getChangeAccessoriesPrice())
                 .subtract(subjectChange.getOriginalMusicalPrice()).subtract(subjectChange.getOriginalAccessoriesPrice());
         subjectChange.setGoodsMargin(goodsMargin);
-        subjectChange.setOriginalKitGroupPurchaseType(
-                studentOriginal.getOriginalKitGroupPurchaseType() == null ? KitGroupPurchaseTypeEnum.OWNED : studentOriginal.getOriginalKitGroupPurchaseType());
         String goodsIds = "";
         if (subjectChange.getKitGroupPurchaseType().equals(KitGroupPurchaseTypeEnum.OWNED)) {
             subjectChange.setChangeMusical(null);
@@ -332,11 +339,14 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
 
     @Override
     public SubjectChange getStudentOriginal(Integer studentId, String musicGroupId) {
+    	
         //1、存在历史的更换
         SubjectChange subjectChange = new SubjectChange();
         SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(studentId, musicGroupId);
         if (studentLastChange != null) {
-            Set<Integer> refundSellOrderGoodsIds = getRefundGoodsId(studentLastChange.getOrderId().longValue());
+        	List<Long> orderIdList = new ArrayList<Long>();
+        	orderIdList.add(studentLastChange.getOrderId().longValue());
+        	Set<Integer> refundSellOrderGoodsIds = getRefundGoodsId(orderIdList);
             subjectChange.setStudentId(studentLastChange.getStudentId());
             subjectChange.setOrderId(studentLastChange.getOrderId());
             subjectChange.setCooperationOrganId(studentLastChange.getCooperationOrganId());
@@ -372,19 +382,53 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
             return subjectChange;
         }
         //2.1不存在历史的更换
-        List<StudentPaymentOrderDetail> details = studentPaymentOrderDetailDao.getStudentApplyDetail(studentId, musicGroupId);
-        if (details.size() <= 0) {
-            return null;
-        }
-
-        Set<Integer> refundSellOrderGoodsIds = getRefundGoodsId(details.get(0).getPaymentOrderId());
+        StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(studentId, musicGroupId);
+        if (studentRegistration == null) {
+            throw new BizException("用户注册信息不存在");
+        }
+        
+        List<StudentPaymentOrder> studentPaymentOrderList = new ArrayList<StudentPaymentOrder>();
+        
+		if (studentRegistration.getMusicGroupPaymentCalenderId() == null) {
+			if(studentRegistration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.NORMAL){
+				StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentId, musicGroupId, SUCCESS);
+				if (studentPaymentOrder != null) {
+					studentPaymentOrderList.add(studentPaymentOrder);
+				}
+			}
+		} else {
+			studentPaymentOrderList = studentPaymentOrderService.queryByBatchNo(studentId, studentRegistration.getMusicGroupPaymentCalenderId() + "",
+					DealStatusEnum.SUCCESS);
+		}
+        
+        List<Long> paymentOrderIdList = studentPaymentOrderList.stream().map(t -> t.getId()).collect(Collectors.toList());
+
+        List<StudentPaymentOrderDetail> details = studentPaymentOrderDetailDao.getWithIds(paymentOrderIdList);
+        
+
+        //查询乐器订单
+        StudentPaymentOrderDetail musicalOrderDetail =null, accessoriesOrderDetail = null;
+        		
+        for(StudentPaymentOrderDetail detail : details){
+        	if(detail.getType() == OrderDetailTypeEnum.ACCESSORIES){
+        		accessoriesOrderDetail = detail;
+        	}else if(detail.getType() == OrderDetailTypeEnum.MUSICAL){
+        		musicalOrderDetail = detail;
+        	}
+        }
+
+        Set<Integer> refundSellOrderGoodsIds = getRefundGoodsId(details.stream().map(t -> t.getPaymentOrderId()).collect(Collectors.toList()));
 
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         subjectChange.setStudentId(studentId);
         subjectChange.setOrganId(musicGroup.getOrganId());
         subjectChange.setCooperationOrganId(musicGroup.getCooperationOrganId());
         subjectChange.setMusicGroupId(musicGroupId);
-        subjectChange.setOrderId(details.get(0).getPaymentOrderId().intValue());
+		if (musicalOrderDetail != null) {
+			subjectChange.setOrderId(musicalOrderDetail.getPaymentOrderId().intValue());
+		} else if (accessoriesOrderDetail != null) {
+			subjectChange.setOrderId(accessoriesOrderDetail.getPaymentOrderId().intValue());
+		}
         String accessoriesIds = "";
         BigDecimal accessoriesPrice = BigDecimal.ZERO;
         for (StudentPaymentOrderDetail detail : details) {
@@ -421,15 +465,14 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
             BigDecimal price = accessoriesGoods.stream().map(Goods::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add);
             subjectChange.setOriginalAccessoriesPrice(price);
         }
-        Long orderId = details.get(0).getPaymentOrderId();
         //2.2 计算销售成本
-        BigDecimal orderSellCost = sellOrderDao.getOrderSellCost(orderId);
+        BigDecimal orderSellCost = sellOrderDao.getOrderSellCost(paymentOrderIdList);
         subjectChange.setOriginalCost(orderSellCost == null ? BigDecimal.ZERO : orderSellCost);
         return subjectChange;
     }
 
-    private Set<Integer> getRefundGoodsId(Long orderId) {
-        List<SellOrder> refundSellOrders = sellOrderService.getRefundSellOrder(orderId);
+    private Set<Integer> getRefundGoodsId(List<Long> orderIdList) {
+        List<SellOrder> refundSellOrders = sellOrderService.getRefundSellOrder(orderIdList);
         Set<Integer> refundSellOrderGoodsIds = refundSellOrders.stream().filter(e -> e.getParentGoodsId() == null).map(SellOrder::getGoodsId).collect(Collectors.toSet());
         Set<Integer> refundSellOrderParentGoodsId = refundSellOrders.stream().filter(e -> e.getParentGoodsId() != null).map(SellOrder::getParentGoodsId).collect(Collectors.toSet());
         refundSellOrderGoodsIds.addAll(refundSellOrderParentGoodsId);

+ 36 - 26
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -1,15 +1,30 @@
 package com.ym.mec.biz.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.dao.*;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import com.ym.mec.biz.dal.dao.ChargeTypeOrganizationFeeDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SubjectDao;
+import com.ym.mec.biz.dal.dao.SubjectGoodsMapperDao;
 import com.ym.mec.biz.dal.dto.ConditionDto;
 import com.ym.mec.biz.dal.dto.SubFeeSettingDto;
 import com.ym.mec.biz.dal.dto.SubjectApplyDetailDto;
 import com.ym.mec.biz.dal.entity.ChargeTypeOrganizationFee;
-import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
-import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.SubjectQueryInfo;
 import com.ym.mec.biz.service.SubjectService;
@@ -17,14 +32,6 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
-import org.apache.commons.lang3.StringUtils;
-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.stream.Collectors;
 
 @Service
 public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implements SubjectService {
@@ -75,21 +82,24 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
     @Override
     public List<SubjectApplyDetailDto> findSubApplyDetail(String musicGroupId) {
         List<SubjectApplyDetailDto> subApplyDetail = subjectDao.findSubApplyDetail(musicGroupId);
-        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-//        //统计当前乐团不同声部的报名人数
-        Map<Integer, Integer> applyNum = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countApplyNum(musicGroupId))), HashMap.class);
-        Map<Integer, Integer> payNumMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayNum(musicGroupId))), HashMap.class);
-        Map<Integer, Integer> payingMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayingNum(musicGroupId, 1))), HashMap.class);
-        Map<Integer, Integer> payCheckMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(studentRegistrationDao.countPayingNum(musicGroupId, 2))), HashMap.class);
+        
+        List<SubjectApplyDetailDto> registers = studentRegistrationDao.queryStudentApplyDetail(musicGroupId);
+        
+        Map<Integer,SubjectApplyDetailDto> map = registers.stream().collect(Collectors.toMap(SubjectApplyDetailDto :: getSubjectId, t -> t));
+        
         subApplyDetail.forEach(detail -> {
-            Integer num = payNumMap.get(detail.getSubjectId());
-            detail.setPayNum(num == null ? 0 : num);
-            num = applyNum.get(detail.getSubjectId());
-            detail.setApplyStudentNum(num == null ? 0 : num);
-            num = payingMap.get(detail.getSubjectId());
-            detail.setPayingNum(num == null ? 0 : num);
-            num = payCheckMap.get(detail.getSubjectId());
-            detail.setCheckNum(num == null ? 0 : num);
+        	SubjectApplyDetailDto dto = new SubjectApplyDetailDto();
+        	if(map.containsKey(detail.getSubjectId())){
+        		dto = map.get(detail.getSubjectId());
+        	}
+    		detail.setPayNum(dto.getPayNum());
+            detail.setApplyStudentNum(dto.getApplyStudentNum());
+            detail.setPayingNum(dto.getPayingNum());
+            detail.setCheckNum(dto.getCheckNum());
+            detail.setNormalNum(dto.getNormalNum());
+            detail.setBuyCloudTeacherNum(dto.getBuyCloudTeacherNum());
+            detail.setCloudTeacherStudentNumOfApply(dto.getCloudTeacherStudentNumOfApply());
+            detail.setNoCloudTeacherStudentNumOfNormal(dto.getNoCloudTeacherStudentNumOfNormal());
         });
         return subApplyDetail;
     }

+ 43 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicCompareRecordServiceImpl.java

@@ -0,0 +1,43 @@
+package com.ym.mec.biz.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.common.dal.BaseDAO;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.biz.dal.entity.SysMusicCompareRecord;
+import com.ym.mec.biz.service.SysMusicCompareRecordService;
+import com.ym.mec.biz.dal.dao.SysMusicCompareRecordDao;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Map;
+import java.util.Objects;
+
+@Service
+public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysMusicCompareRecord>  implements SysMusicCompareRecordService {
+	
+	@Autowired
+	private SysMusicCompareRecordDao sysMusicCompareRecordDao;
+	@Autowired
+	private TeacherDao teacherDao;
+
+	@Override
+	public BaseDAO<Long, SysMusicCompareRecord> getDAO() {
+		return sysMusicCompareRecordDao;
+	}
+
+	@Override
+	public void saveMusicCompareData(String phone, Integer sysMusicScoreId, Map<Integer, Map<String, BigDecimal>> userMeasureScoreMap) {
+		SysUser user = teacherDao.getUserWithPhone(phone);
+		if(Objects.isNull(user)){
+			return;
+		}
+		SysMusicCompareRecord sysMusicCompareRecord = new SysMusicCompareRecord();
+		sysMusicCompareRecord.setUserId(user.getId());
+		sysMusicCompareRecord.setSysMusicScoreId(sysMusicScoreId);
+		sysMusicCompareRecord.setScoreData(JSON.toJSONString(userMeasureScoreMap));
+		sysMusicCompareRecordDao.insert(sysMusicCompareRecord);
+	}
+}

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

@@ -1,14 +1,71 @@
 package com.ym.mec.biz.service.impl;
 
+import java.math.BigDecimal;
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
 import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.YesOrNoEnum;
-import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
+import com.ym.mec.biz.dal.dao.DemoGroupDao;
+import com.ym.mec.biz.dal.dao.ImGroupDao;
+import com.ym.mec.biz.dal.dao.ImUserFriendDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.dao.SchoolDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dao.SubjectDao;
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
+import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.dto.BasicUserDto;
+import com.ym.mec.biz.dal.dto.ImUserFriendDto;
+import com.ym.mec.biz.dal.dto.MusicGroupStudentApplyDto;
+import com.ym.mec.biz.dal.dto.MusicGroupTeacherAttendanceDto;
+import com.ym.mec.biz.dal.dto.MusicGroupTeachersDto;
+import com.ym.mec.biz.dal.dto.TeacherBasicDto;
+import com.ym.mec.biz.dal.dto.TeacherCloseDto;
+import com.ym.mec.biz.dal.dto.TeacherDefaultSalaryDto;
+import com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto;
+import com.ym.mec.biz.dal.entity.CourseHomework;
+import com.ym.mec.biz.dal.entity.ImUserFriend;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.page.*;
+import com.ym.mec.biz.dal.page.MusicGroupTeacherAttendanceQueryInfo;
+import com.ym.mec.biz.dal.page.MusicGroupTeachersQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherCloseQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherNameQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherQueryInfo;
+import com.ym.mec.biz.dal.page.queryMusicGroupStudentQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.common.constant.CommonConstants;
@@ -21,25 +78,10 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
-import com.ym.mec.im.WebFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.idcard.IdcardValidator;
 
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.math.BigDecimal;
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
 @Service
 public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  implements TeacherService {
 
@@ -507,8 +549,9 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 				Map<Integer, List<StudentPaymentOrder>> collect = studentPaymentOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getUserId));
 				dataList.forEach(e->{
 					List<StudentPaymentOrder> paymentOrders = collect.get(e.getUserId());
+					
 					if(paymentOrders != null && paymentOrders.size() > 0){
-						e.setPaymentAmount(paymentOrders.get(0).getActualAmount());
+						e.setPaymentAmount(paymentOrders.stream().map(t -> t.getExpectAmount()).reduce(BigDecimal.ZERO, BigDecimal::add));
 						e.setPayTime(paymentOrders.get(0).getPayTime());
 					}
 				});

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

@@ -875,6 +875,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 					vipGroupApplyBaseInfoDto.getName());
 		} catch (Exception e) {
 			e.printStackTrace();
+			LOGGER.error("消息发送失败:{}", e);
 		}
 		return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
 	}

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

@@ -23,6 +23,10 @@
         <result column="demission_date_" property="demissionDate"/>
         <result column="contact_address_" property="contactAddress"/>
         <result column="postal_code_" property="postalCode"/>
+        <result column="dept_id_" property="deptId"/>
+        <result column="post_id_" property="postId"/>
+        <result column="bank_card_" property="bankCard"/>
+        <result column="open_bank_address_" property="openBankAddress"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.auth.api.entity.SysUser" id="SysUser">
@@ -156,7 +160,7 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-		DELETE FROM employee WHERE user_id_ = #{userId} 
+		DELETE FROM employee WHERE user_id_ = #{userId}
 	</delete>
     <delete id="delEmployeeRole">
         DELETE FROM sys_user_role WHERE user_id_ = #{userId}

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

@@ -54,7 +54,9 @@
                 #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
     </insert>
 
-    <insert id="batchInsert">
+    <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.FinancialExpenditure" useGeneratedKeys="true"
+            keyColumn="id"
+            keyProperty="id">
         INSERT INTO financial_expenditure (batch_no_,financial_process_no_,dingtalk_process_no_,
         organ_id_,cooperation_organ_id_,apply_user_,amount_,item_detail_,payment_time_,cause_,create_time_,update_time_,fee_project_,type_)
         VALUES

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

@@ -821,7 +821,7 @@
     </select>
 
     <select id="getMusicGroupByStatus" resultType="com.ym.mec.biz.dal.dto.MusicGroupRegAndMoneyDto">
-        SELECT mg.id_ musicGroupId,o.name_ organName,mg.name_ musicGroupName,mg.status_ musicGroupStatus FROM
+        SELECT mg.id_ musicGroupId,o.name_ organName,mg.name_ musicGroupName,mg.status_ musicGroupStatus,mg.course_view_type_ courseViewType FROM
         music_group mg
         LEFT JOIN organization o ON mg.organ_id_ = o.id_
         WHERE status_ IN ('PRE_APPLY','PRE_BUILD_FEE','FEE_AUDIT','APPLY','PAY')

+ 9 - 3
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -508,7 +508,10 @@
     <select id="getOrderSellCost" resultType="decimal">
         SELECT SUM(sell_cost_ * num_)
         FROM sell_order
-        WHERE order_id_ = #{orderId}
+        WHERE order_id_ IN
+        <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
+            #{orderId}
+        </foreach>
     </select>
 
     <!-- 获取分部学校的收入支出(声部更改) -->
@@ -579,8 +582,11 @@
     <select id="getRefundSellOrder" resultMap="SellOrder">
         SELECT *
         FROM sell_order
-        WHERE order_id_ = #{orderId}
-          AND status_ = 1
+        WHERE status_ = 1
+          and order_id_ in
+          <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
+            #{orderId}
+        </foreach>
     </select>
 
 

+ 9 - 4
mec-biz/src/main/resources/config/mybatis/StudentInstrumentMapper.xml

@@ -90,6 +90,12 @@
             <if test="delFlag != null">
                 del_flag_ = #{delFlag},
             </if>
+            <if test="goodsCategoryId != null">
+                goods_category_id_ = #{goodsCategoryId},
+            </if>
+            <if test="goodsCategoryName != null">
+                goods_category_name_ = #{goodsCategoryName},
+            </if>
             update_time = NOW(),
         </set>
         where id_ = #{id}
@@ -273,7 +279,7 @@
         SELECT student_id_,COUNT(*) goods_id_
         FROM student_instrument
         WHERE order_id_ IN (
-        SELECT MAX(id_)
+        SELECT id_
         FROM student_payment_order
         WHERE type_ = 'APPLY'
         AND music_group_id_ = #{musicGroupId}
@@ -282,7 +288,6 @@
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
             #{studentId}
         </foreach>
-        GROUP BY user_id_
         )
         AND student_id_ IN
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
@@ -294,8 +299,8 @@
 
     <select id="getStudentMaintenance" resultMap="StudentInstrument">
         SELECT * FROM student_instrument
-        WHERE order_id_ = (
-        SELECT MAX(id_)
+        WHERE order_id_ in (
+        SELECT id_
         FROM student_payment_order
         WHERE type_ = 'APPLY'
         AND music_group_id_ = #{musicGroupId}

+ 23 - 5
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -28,6 +28,11 @@
             <result column="complement_goods_id_list_" property="complementGoodsIdList"/>
         </collection>
     </resultMap>
+    
+    <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
+        <result column="key_" property="key"/>
+        <result column="value_" property="value"/>
+    </resultMap>
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrderDetail">
@@ -140,8 +145,8 @@
     <!-- 查询用户注册订单详情 -->
     <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
         SELECT spod.*
-        FROM student_payment_order spo
-                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+        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 spo.music_group_id_ = #{musicGroupId}
           AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
@@ -161,7 +166,7 @@
         <result property="goodsNames" column="goods_names_"/>
     </resultMap>
     <select id="getMusicalListDetail" resultMap="musicalListDetailDtoMap">
-        SELECT MAX(spo.id_) payment_order_id_, spo.user_id_
+        SELECT spo.id_ payment_order_id_, spo.user_id_
         FROM student_payment_order spo
                  LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
         WHERE spo.music_group_id_ = #{musicGroupId}
@@ -171,7 +176,6 @@
           AND spo.status_ = 'SUCCESS'
           AND sr.music_group_id_ = #{musicGroupId}
           AND sr.music_group_status_ != 'QUIT'
-        GROUP BY spo.user_id_
     </select>
     <select id="queryGoodsNames" resultType="java.util.Map">
         SELECT spod.payment_order_id_ 'key',GROUP_CONCAT(g.name_) 'value'
@@ -291,6 +295,20 @@
     </select>
 
     <select id="getOrderDetailByOrderId" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ IN
+        <foreach collection="orderIdList" open="(" close=")" separator="," item="item">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="getInstrumentNumInMusicApply" resultMap="Mapper">
+        SELECT count(distinct spo.user_id_) value_,spo.music_group_id_ key_ 
+        FROM student_payment_order_detail spod left join student_payment_order spo on spod.payment_order_id_ = spo.id_ 
+        WHERE spo.music_group_id_ IN
+        <foreach collection="musicGroupIds" item="musicGroupId" open="(" close=")" separator=",">
+            #{musicGroupId}
+        </foreach>
+        AND spo.type_ = 'APPLY' and spo.status_ = 'SUCCESS' and spod.type_ = 'MUSICAL'
+        GROUP BY spo.music_group_id_
     </select>
 </mapper>

+ 120 - 7
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -34,6 +34,7 @@
         <result column="pay_time_" property="payTime"/>
         <result column="version_" property="version"/>
         <result column="receive_status_" property="receiveStatus"/>
+        <result column="batch_no_" property="batchNo"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderDto" extends="StudentPaymentOrder"
@@ -74,6 +75,11 @@
         <result column="course_one_to_one_time_" property="courseOneToOneTime"/>
         <result column="course_one_to_two_time_" property="courseOneToTwoTime"/>
     </resultMap>
+    
+    <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
+        <result column="key_" property="key"/>
+        <result column="value_" property="value"/>
+    </resultMap>
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrder">
@@ -97,7 +103,7 @@
          per_amount_,
          balance_payment_amount_, remit_fee_, course_remit_fee_, trans_no_,
          status_, memo_, create_time_, update_time_, payment_channel_, payment_business_channel_,
-         payment_account_no_, mer_nos_, order_no_, music_group_id_, class_group_id_, pay_time_)
+         payment_account_no_, mer_nos_, order_no_, music_group_id_, class_group_id_, pay_time_,batch_no_)
         VALUES (#{id}, #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
                 #{userId}, #{organId}, #{routingOrganId},
                 #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -106,7 +112,7 @@
                 #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{memo}, now(), now(),
                 #{paymentChannel}, #{paymentBusinessChannel}, #{paymentAccountNo}, #{merNos}, #{orderNo},
                 #{musicGroupId},
-                #{classGroupId}, #{payTime})
+                #{classGroupId}, #{payTime},#{batchNo})
     </insert>
 
 
@@ -186,6 +192,9 @@
             <if test="payTime != null">
                 pay_time_ = #{payTime},
             </if>
+            <if test="batchNo != null">
+                batch_no_ = #{batchNo},
+            </if>
             <if test="version != null">
                 version_ = version_+1,
             </if>
@@ -193,6 +202,94 @@
         </set>
         WHERE id_ = #{id} AND version_ = #{version}
     </update>
+    
+    <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.StudentPaymentOrder">
+		<foreach collection="studentPaymentOrderList" item="studentPaymentOrder" separator=";">
+	        UPDATE student_payment_order
+	        <set>
+	            <if test="studentPaymentOrder.receiveStatus != null and studentPaymentOrder.receiveStatus != ''">
+	                receive_status_ = #{studentPaymentOrder.receiveStatus},
+	            </if>
+	            <if test="studentPaymentOrder.status != null">
+	                status_ = #{studentPaymentOrder.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+	            </if>
+	            <if test="studentPaymentOrder.groupType != null">
+	                group_type_ = #{studentPaymentOrder.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+	            </if>
+	            <if test="studentPaymentOrder.orderNo != null">
+	                order_no_ = #{studentPaymentOrder.orderNo},
+	            </if>
+	            <if test="studentPaymentOrder.classGroupId != null">
+	                class_group_id_ = #{studentPaymentOrder.classGroupId},
+	            </if>
+	            <if test="studentPaymentOrder.expectAmount != null">
+	                expect_amount_ = #{studentPaymentOrder.expectAmount},
+	            </if>
+	            <if test="studentPaymentOrder.memo != null">
+	                memo_ = #{studentPaymentOrder.memo},
+	            </if>
+	            <if test="studentPaymentOrder.paymentChannel != null">
+	                payment_channel_ = #{studentPaymentOrder.paymentChannel},
+	            </if>
+	            <if test="studentPaymentOrder.userId != null">
+	                user_id_ = #{studentPaymentOrder.userId},
+	            </if>
+	            <if test="studentPaymentOrder.paymentAccountNo != null">
+	                payment_account_no_ = #{studentPaymentOrder.paymentAccountNo},
+	            </if>
+	            <if test="studentPaymentOrder.merNos != null">
+	                mer_nos_ = #{studentPaymentOrder.merNos},
+	            </if>
+	            <if test="studentPaymentOrder.paymentBusinessChannel != null">
+	                payment_business_channel_ = #{studentPaymentOrder.paymentBusinessChannel},
+	            </if>
+	            <if test="studentPaymentOrder.transNo != null">
+	                trans_no_ = #{studentPaymentOrder.transNo},
+	            </if>
+	            <if test="studentPaymentOrder.actualAmount != null">
+	                actual_amount_ = #{studentPaymentOrder.actualAmount},
+	            </if>
+	            <if test="studentPaymentOrder.comAmount != null">
+	                com_amount_ = #{studentPaymentOrder.comAmount},
+	            </if>
+	            <if test="studentPaymentOrder.perAmount != null">
+	                per_amount_ = #{studentPaymentOrder.perAmount},
+	            </if>
+	            <if test="studentPaymentOrder.balancePaymentAmount != null">
+	                balance_payment_amount_ = #{studentPaymentOrder.balancePaymentAmount},
+	            </if>
+	            <if test="studentPaymentOrder.remitFee != null">
+	                remit_fee_ = #{studentPaymentOrder.remitFee},
+	            </if>
+	            <if test="studentPaymentOrder.courseRemitFee != null">
+	                course_remit_fee_ = #{studentPaymentOrder.courseRemitFee},
+	            </if>
+	            <if test="studentPaymentOrder.type != null">
+	                type_ = #{studentPaymentOrder.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+	            </if>
+	            <if test="studentPaymentOrder.musicGroupId != null">
+	                music_group_id_ = #{studentPaymentOrder.musicGroupId},
+	            </if>
+	            <if test="studentPaymentOrder.organId != null">
+	                organ_id_ = #{studentPaymentOrder.organId},
+	            </if>
+	            <if test="studentPaymentOrder.routingOrganId != null">
+	                routing_organ_id_ = #{studentPaymentOrder.routingOrganId},
+	            </if>
+	            <if test="studentPaymentOrder.payTime != null">
+	                pay_time_ = #{studentPaymentOrder.payTime},
+	            </if>
+	            <if test="studentPaymentOrder.batchNo != null">
+	                batch_no_ = #{studentPaymentOrder.batchNo},
+	            </if>
+	            <if test="studentPaymentOrder.version != null">
+	                version_ = version_+1,
+	            </if>
+	            update_time_ = NOW()
+	        </set>
+	        WHERE id_ = #{studentPaymentOrder.id} AND version_ = #{studentPaymentOrder.version}
+		</foreach>
+    </update>
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
@@ -349,6 +446,14 @@
         ORDER BY id_ DESC
         LIMIT 1
     </select>
+    
+    <select id="queryByBatchNo" resultMap="StudentPaymentOrder" parameterType="map">
+        SELECT *
+        FROM student_payment_order
+        WHERE batch_no_ = #{batchNo}
+          AND status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          and user_id_ = #{userId}
+    </select>
 
     <!-- 根据订单号查询订单 -->
     <select id="findOrderByOrderNo" resultMap="StudentPaymentOrder">
@@ -371,7 +476,7 @@
         <![CDATA[
         SELECT COUNT(*)
         FROM student_payment_order
-        WHERE FIND_IN_SET(status_, 'SUCCESS,ING,WAIT_PAY')
+        WHERE FIND_IN_SET(status_, 'SUCCESS,ING')
         ]]>
     </select>
 
@@ -441,15 +546,13 @@
     <select id="findStudentPaymentOrder" resultMap="StudentPaymentOrder">
         SELECT *
         FROM student_payment_order
-        WHERE id_ IN (SELECT MAX(sp.id_)
-                      FROM (SELECT *
+        WHERE id_ IN (SELECT id_
                             FROM student_payment_order
                             WHERE group_type_ = #{groupType}
                               AND type_ = 'APPLY'
                               AND music_group_id_ = #{musicGroupId}
                               AND status_ = 'SUCCESS'
-                            ORDER BY id_ DESC) sp
-                      GROUP BY sp.user_id_)
+                            ORDER BY id_ DESC)
     </select>
     <select id="findOrderByGroupType" resultType="int">
         SELECT COUNT(id_) FROM student_payment_order
@@ -879,4 +982,14 @@
     <select id="getUserReplacementIngOrder" resultMap="StudentPaymentOrder">
         SELECT * FROM student_payment_order WHERE user_id_=#{userId} AND music_group_id_ = #{replacementId} AND status_ = 'ING' LIMIT 1
     </select>
+
+    <select id="getMoneyInMusicApply" resultMap="Mapper">
+        SELECT sum(spo.expect_amount_) value_,spo.music_group_id_ key_ 
+        FROM student_payment_order spo WHERE spo.music_group_id_ IN
+        <foreach collection="musicGroupIds" item="musicGroupId" open="(" close=")" separator=",">
+            #{musicGroupId}
+        </foreach>
+        AND spo.type_ = 'APPLY' and spo.status_ = 'SUCCESS'
+        GROUP BY spo.music_group_id_
+    </select>
 </mapper>

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

@@ -49,6 +49,7 @@
         <result column="has_cloud_teacher_" property="hasCloudTeacher"/>
         <result column="none_need_cloud_teacher_" property="noneNeedCloudTeacher"/>
         <result column="membership_end_time_" property="membershipEndTime"/>
+        <result column="music_group_payment_calender_id_" property="musicGroupPaymentCalenderId"/>
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.dto.StudentMusicGroupDto" id="StudentMusicGroupDto"
@@ -201,6 +202,9 @@
             <if test="updateTime != null">
                 update_time_,
             </if>
+            <if test="musicGroupPaymentCalenderId != null">
+                music_group_payment_calender_id_,
+            </if>
         </trim>
         VALUES
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -270,6 +274,9 @@
             <if test="updateTime != null">
                 NOW(),
             </if>
+            <if test="musicGroupPaymentCalenderId != null">
+                #{musicGroupPaymentCalenderId},
+            </if>
         </trim>
     </insert>
 
@@ -352,6 +359,7 @@
             <if test="noneNeedCloudTeacher != null">
                 none_need_cloud_teacher_ =#{noneNeedCloudTeacher},
             </if>
+                music_group_payment_calender_id_ =#{musicGroupPaymentCalenderId}
         </set>
         WHERE id_ = #{id}
     </update>
@@ -407,6 +415,9 @@
             <if test="paymentStatus != null">
                 AND sr.payment_status_ = #{paymentStatus}
             </if>
+            <if test="studentStatus != null">
+                AND sr.music_group_status_ = #{studentStatus}
+            </if>
             <if test="visited != null and visited == true">
                 AND sv.num >0
             </if>
@@ -448,6 +459,8 @@
         <result column="actual_subject_name_" property="actualSubjectName"/>
         <result column="payment_status_" property="paymentStatus"
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="music_group_status_" property="studentStatus"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="gender_" property="gender" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="user_id_" property="studentId"/>
         <result column="id_" property="id"/>
@@ -474,6 +487,7 @@
         actual_subject_name_,
         su.phone_ parents_phone_,
         sr.payment_status_,
+        sr.music_group_status_,
         sr.remark_,
         sr.actual_subject_id_,
         IFNULL(sv.num, 0) visit_num_,
@@ -715,7 +729,7 @@
         INSERT INTO student_registration
         (parents_phone_, id_, user_id_, name_, music_group_id_, current_grade_, current_class_, subject_id_,
         is_allow_adjust_, kit_purchase_method_, remark_, create_time_, update_time_,
-        parents_name_, parents_company_, payment_status_, actual_subject_id_, music_group_status_, is_merge_)
+        parents_name_, parents_company_, payment_status_, actual_subject_id_, music_group_status_, is_merge_,music_group_payment_calender_id_)
         VALUES
         <foreach collection="list" item="item" index="index" separator=",">
             (#{item.parentsPhone}, #{item.id}, #{item.userId}, #{item.name}, #{item.musicGroupId}, #{item.currentGrade},
@@ -724,7 +738,7 @@
             #{item.kitPurchaseMethod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             #{item.remark}, now(), now(), #{item.parentsName}, #{item.parentsCompany},
             #{item.paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{item.subjectId},
-            #{item.musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{item.isMerge})
+            #{item.musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{item.isMerge},#{item.musicGroupPaymentCalenderId})
         </foreach>
     </insert>
 
@@ -733,12 +747,12 @@
         INSERT INTO student_registration
         (parents_phone_, user_id_, name_, music_group_id_, current_grade_, current_class_, subject_id_,
         create_time_, update_time_, parents_name_, payment_status_, actual_subject_id_, music_group_status_,
-        temporary_course_fee_, class_group_id_,current_grade_num_,current_grade_date_)
+        temporary_course_fee_, class_group_id_,current_grade_num_,current_grade_date_,music_group_payment_calender_id_)
         VALUES (#{parentsPhone}, #{userId}, #{name}, #{musicGroupId}, #{currentGrade}, #{currentClass}, #{subjectId},
         now(), now(), #{parentsName}, #{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{subjectId},
         #{musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{temporaryCourseFee},
-        #{classGroupId},#{currentGradeNum},#{currentGradeDate})
+        #{classGroupId},#{currentGradeNum},#{currentGradeDate},#{musicGroupPaymentCalenderId})
     </insert>
 
     <!-- 查询乐团userIdList的学生 -->
@@ -1385,7 +1399,7 @@
         LEFT JOIN subject s1 ON spr.subject_first_ = s1.id_
         LEFT JOIN subject s2 ON sr.actual_subject_id_ = s2.id_
         LEFT JOIN (
-        SELECT spo.user_id_, MAX(spo.pay_time_) payTime
+        SELECT spo.user_id_, min(spo.pay_time_) payTime
         FROM student_payment_order spo
         WHERE spo.music_group_id_ = #{musicGroupId}
         AND spo.status_ = 'SUCCESS'
@@ -1461,7 +1475,7 @@
         LEFT JOIN student_pre_registration spr
         ON spr.user_id_ = u.user_id_ AND spr.music_group_id_ = #{musicGroupId}
         LEFT JOIN (
-        SELECT spo.user_id_, MAX(spo.pay_time_) payTime
+        SELECT spo.user_id_, min(spo.pay_time_) payTime
         FROM student_payment_order spo
         WHERE spo.music_group_id_ = #{musicGroupId}
         AND spo.status_ = 'SUCCESS'
@@ -1513,7 +1527,10 @@
     <!-- 获取报名相关数据 -->
     <select id="getRegisters" resultType="com.ym.mec.biz.dal.dto.MusicGroupRegAndMoneyDto">
         SELECT music_group_id_ musicGroupId, COUNT(*) regNum,SUM(IF(payment_status_ = '2',1,0)) payNum,
-        SUM(IF(paying_status_='2',1,0)) checkNum,SUM(IF((music_group_status_= 'NORMAL' and has_cloud_teacher_=1),1,0)) buyCloudTeacherNum
+        SUM(IF(paying_status_='2',1,0)) checkNum,SUM(IF((payment_status_= '2' and has_cloud_teacher_=1),1,0)) buyCloudTeacherNum,
+        SUM(IF((music_group_status_= 'NORMAL' and paying_status_ != 2),1,0)) studentNumOfNormal,
+        SUM(IF((music_group_status_= 'NORMAL' and has_cloud_teacher_ = 0),1,0)) noCloudTeacherStudentNumOfNormal,
+        SUM(IF((music_group_status_ != 'NORMAL' and payment_status_= '2'),1,0)) cloudTeacherStudentNumOfApply
         FROM student_registration
         WHERE music_group_id_ IN
         <foreach collection="musicGroupIds" item="musicGroupId" open="(" close=")" separator=",">
@@ -1527,7 +1544,6 @@
         SELECT COUNT(*)
         FROM student_registration
         WHERE music_group_id_ = #{musicGroupId}
-          AND payment_status_ =2
           AND paying_status_ = 2
           AND music_group_status_ = 'NORMAL'
     </select>
@@ -1551,4 +1567,17 @@
             AND (MAX(cto.id_) IS NULL OR DATEDIFF(MAX(cto.end_time_),NOW()) &lt; 0)
         </if>
     </select>
+    
+    <select id="queryStudentApplyDetail" resultType="com.ym.mec.biz.dal.dto.SubjectApplyDetailDto">
+        SELECT music_group_id_ musicGroupId,actual_subject_id_ subjectId, COUNT(*) applyStudentNum,SUM(IF(payment_status_ = '2',1,0)) payNum,
+        SUM(IF(paying_status_='2',1,0)) checkNum,SUM(IF((payment_status_= '2' and has_cloud_teacher_=1),1,0)) buyCloudTeacherNum,
+        SUM(IF((music_group_status_= 'NORMAL' and paying_status_ != 2),1,0)) normalNum,
+        SUM(IF((music_group_status_= 'NORMAL' and has_cloud_teacher_ = 0),1,0)) noCloudTeacherStudentNumOfNormal,
+        SUM(IF((music_group_status_ != 'NORMAL' and payment_status_= '2'),1,0)) cloudTeacherStudentNumOfApply,
+        SUM(IF((paying_status_ = '1'),1,0)) payingNum
+        FROM student_registration
+        WHERE music_group_id_ = #{musicGroupId}
+        AND music_group_status_ != 'QUIT'
+        GROUP BY music_group_id_,actual_subject_id_
+    </select>
 </mapper>

+ 73 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicCompareRecordMapper.xml

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

+ 12 - 10
mec-biz/src/main/resources/config/mybatis/SysMusicScoreAccompanimentMapper.xml

@@ -34,8 +34,8 @@
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="SysMusicScoreAccompaniment" >
 		SELECT sesa.*,ses.name_,ses.type_,ses.url_,sesc.name_ categories_name_,sesc.id_ categories_id_,ses.client_type_
-		FROM sys_music_score_accompaniment sesa
-		LEFT JOIN sys_music_score ses ON ses.id_ = sesa.exam_song_id_
+		FROM sys_music_score ses
+		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
 		WHERE sesa.id_ = #{id}
 	</select>
@@ -120,8 +120,8 @@
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysMusicScoreAccompaniment" parameterType="map">
 		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,ses.client_type_
-		FROM sys_music_score_accompaniment sesa
-		LEFT JOIN sys_music_score ses ON ses.id_ = sesa.exam_song_id_
+		FROM sys_music_score ses
+		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
 		LEFT JOIN `subject` s ON s.id_ = sesa.subject_id_
 		<include refid="queryPageSql"/>
@@ -131,8 +131,9 @@
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(sesa.id_) FROM sys_music_score_accompaniment sesa
-		LEFT JOIN sys_music_score ses ON ses.id_ = sesa.exam_song_id_
+		SELECT COUNT(sesa.id_)
+		FROM sys_music_score ses
+		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
 		<include refid="queryPageSql"/>
 	</select>
@@ -154,8 +155,8 @@
 	</select>
 	<select id="queryAccPage" resultMap="SysMusicScoreAccompaniment">
 		SELECT sesa.*,ses.name_,ses.type_,ses.url_,s.name_ subject_name_,sesc.name_ categories_name_,sesc.id_ categories_id_,ses.client_type_
-		FROM sys_music_score_accompaniment sesa
-		LEFT JOIN sys_music_score ses ON ses.id_ = sesa.exam_song_id_
+		FROM sys_music_score ses
+		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
 		LEFT JOIN subject s ON s.id_ = sesa.subject_id_
 		<include refid="queryPageSql"/>
@@ -163,8 +164,9 @@
 	</select>
 
 	<select id="findAccCount" resultType="java.lang.Integer">
-		SELECT COUNT(DISTINCT sesa.id_) FROM sys_music_score_accompaniment sesa
-		LEFT JOIN sys_music_score ses ON ses.id_ = sesa.exam_song_id_
+		SELECT COUNT(DISTINCT sesa.id_)
+		FROM sys_music_score ses
+		LEFT JOIN sys_music_score_accompaniment sesa ON ses.id_ = sesa.exam_song_id_
 		LEFT JOIN sys_music_score_categories sesc ON sesc.id_ = ses.music_score_categories_id_
 		<include refid="queryPageSql"/>
 	</select>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -1011,6 +1011,13 @@
         FROM sys_user su
         WHERE su.id_ = #{id} LIMIT 1
     </select>
+
+    <select id="getUserWithPhone" resultMap="SysUser">
+        SELECT su.*
+        FROM sys_user su
+        WHERE su.phone_ = #{phone} LIMIT 1
+    </select>
+
     <select id="queryTeacherBaseInfo"  resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
         SELECT
         CASE WHEN su.user_type_ LIKE '%TEACHER%' OR su.user_type_ LIKE '%SYSTEM%' THEN su.real_name_ ELSE su.username_ END username_,

+ 5 - 0
mec-common/common-core/pom.xml

@@ -44,6 +44,11 @@
 			<groupId>org.springframework.cloud</groupId>
 			<artifactId>spring-cloud-starter-openfeign</artifactId>
 		</dependency>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-websocket</artifactId>
+		</dependency>
 		
 		<dependency>
 			<groupId>com.ym</groupId>

+ 7 - 1
mec-gateway/mec-gateway-web/src/main/java/com/ym/mec/gateway/web/config/WebSecurityConfig.java

@@ -9,7 +9,13 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
 
 	@Override
 	protected void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable();
+		http.csrf().disable().httpBasic().disable()
+				.authorizeRequests()
+				.antMatchers(
+						"/**"
+				)
+				.permitAll()
+				.anyRequest().authenticated();
 	}
 
 }

+ 8 - 1
mec-im/src/main/resources/logback-spring.xml

@@ -44,6 +44,13 @@
 		</root>
 	</springProfile>
 
+	<springProfile name="dev_server">
+		<root level="INFO">
+			<appender-ref ref="stdout" />
+			<appender-ref ref="file" />
+		</root>
+	</springProfile>
+
 	<!--生产环境:输出到文件 -->
 	<springProfile name="prod">
 		<root level="INFO">
@@ -52,4 +59,4 @@
 		</root>
 	</springProfile>
 
-</configuration>
+</configuration>

+ 5 - 0
mec-student/pom.xml

@@ -32,6 +32,11 @@
 			<artifactId>spring-cloud-sleuth-zipkin</artifactId>
 		</dependency>
 
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-websocket</artifactId>
+		</dependency>
+
 		<!-- swagger-spring-boot -->
 		<dependency>
 			<groupId>com.spring4all</groupId>

+ 40 - 0
mec-student/src/main/java/com/ym/mec/student/config/WebSocketConfig.java

@@ -0,0 +1,40 @@
+package com.ym.mec.student.config;
+
+import com.ym.mec.biz.handler.WebSocketHandler;
+import com.ym.mec.student.interceptor.WebSocketHandshakeInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.config.annotation.EnableWebSocket;
+import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
+import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
+import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/8 0008
+ */
+@Configuration
+@EnableWebSocket
+public class WebSocketConfig implements WebSocketConfigurer {
+
+    @Autowired
+    private WebSocketHandler webSocketHandler;
+    @Autowired
+    private WebSocketHandshakeInterceptor webSocketHandshakeInterceptor;
+
+    @Override
+    public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
+        webSocketHandlerRegistry.addHandler(webSocketHandler, "/ws")
+                .addInterceptors(webSocketHandshakeInterceptor);
+    }
+
+    @Bean
+    public ServletServerContainerFactoryBean createWebSocketContainer() {
+        ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
+        container.setMaxTextMessageBufferSize(8192*4);
+        container.setMaxBinaryMessageBufferSize(8192*4);
+        return container;
+    }
+
+}

+ 50 - 21
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -9,6 +9,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
@@ -35,11 +36,14 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatus
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 import com.ym.mec.biz.dal.entity.StudentPreRegistration;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.service.MusicGroupService;
@@ -146,13 +150,6 @@ public class MusicGroupController extends BaseController {
             @ApiImplicitParam(name = "subjectId", value = "声部编号", required = true, dataType = "Integer")})
     public HttpResponseResult getSubjectGoodsAndInfo(String musicGroupId, Integer subjectId) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser != null && sysUser.getId() > 0) {
-            Integer userId = sysUser.getId();
-            StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-            if (studentRegistration != null && studentRegistration.getTemporaryCourseFee() != null) {
-                return succeed(musicGroupSubjectPlanService.getStudentGoodsAndInfo(musicGroupId, subjectId, studentRegistration));
-            }
-        }
         return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
     }
 
@@ -176,11 +173,45 @@ public class MusicGroupController extends BaseController {
         if (studentRegistration == null) {
             return failed(HttpStatus.CONTINUE, "乐团报名信息不存在");
         }
-        if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES) {
-            return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
-        }
-
-        if (studentRegistration.getPaymentStatus() != PaymentStatusEnum.OPEN) {
+        
+        // 判断是否可以继续购买
+        List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.findUserApplyOrder(userId, musicGroupId, DealStatusEnum.SUCCESS);
+        if(studentPaymentOrderDetailList != null && studentPaymentOrderDetailList.size() > 0){
+        	List<OrderDetailTypeEnum> typeList = studentPaymentOrderDetailList.stream().map(t -> t.getType()).collect(Collectors.toList());
+        	//判断是否所有类型都购买完
+			if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
+				if ((typeList.contains(OrderDetailTypeEnum.MUSICAL) || typeList.contains(OrderDetailTypeEnum.ACCESSORIES))
+						&& (typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.COURSE)
+								|| typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE_COURSE) || typeList.contains(OrderDetailTypeEnum.SINGLE)
+								|| typeList.contains(OrderDetailTypeEnum.MIX) || typeList.contains(OrderDetailTypeEnum.HIGH)
+								|| typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.DEMO)
+								|| typeList.contains(OrderDetailTypeEnum.COMPREHENSIVE) || typeList.contains(OrderDetailTypeEnum.ENLIGHTENMENT)
+								|| typeList.contains(OrderDetailTypeEnum.TRAINING_SINGLE) || typeList.contains(OrderDetailTypeEnum.TRAINING_MIX)
+								|| typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE) || typeList.contains(OrderDetailTypeEnum.MUSIC_NETWORK) || typeList
+									.contains(OrderDetailTypeEnum.CLASSROOM))) {
+					return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
+				}
+			} else {
+				if (typeList.contains(OrderDetailTypeEnum.MUSICAL)
+						&& typeList.contains(OrderDetailTypeEnum.ACCESSORIES)
+						&& (typeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER) || typeList.contains(OrderDetailTypeEnum.COURSE)
+								|| typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE_COURSE) || typeList.contains(OrderDetailTypeEnum.SINGLE)
+								|| typeList.contains(OrderDetailTypeEnum.MIX) || typeList.contains(OrderDetailTypeEnum.HIGH)
+								|| typeList.contains(OrderDetailTypeEnum.VIP) || typeList.contains(OrderDetailTypeEnum.DEMO)
+								|| typeList.contains(OrderDetailTypeEnum.COMPREHENSIVE) || typeList.contains(OrderDetailTypeEnum.ENLIGHTENMENT)
+								|| typeList.contains(OrderDetailTypeEnum.TRAINING_SINGLE) || typeList.contains(OrderDetailTypeEnum.TRAINING_MIX)
+								|| typeList.contains(OrderDetailTypeEnum.HIGH_ONLINE) || typeList.contains(OrderDetailTypeEnum.MUSIC_NETWORK) || typeList
+									.contains(OrderDetailTypeEnum.CLASSROOM))) {
+					return failed(HttpStatus.PROCESSING, "您已缴费,请等待乐团开启");
+				}
+			}
+        }
+        
+        /*if (studentRegistration.getPaymentStatus() != null && studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES) {
+            
+        }*/
+
+        if (studentRegistration.getPaymentStatus() == PaymentStatusEnum.NO) {
             return failed("乐团还未开启缴费,请等待通知");
         }
         if (musicGroup.getStatus() != MusicGroupStatusEnum.APPLY &&
@@ -299,13 +330,12 @@ public class MusicGroupController extends BaseController {
 
         Integer userId = studentRegistration.getUserId();
 
-        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
-        StudentPaymentOrder waitPay = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-        if (ApplyOrder != null && waitPay == null) {
+        /*StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
+        if (ApplyOrder != null) {
             return failed("您已支付成功,请勿重复支付");
-        }
+        }*/
         //判断用户是否已存在订单
-        ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
         if (ApplyOrder != null) {
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
         }
@@ -333,11 +363,10 @@ public class MusicGroupController extends BaseController {
             return failed(err + "不可缴费,请联系教务老师");
         }
         Integer userId = studentRegistration.getUserId();
-        StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
-        StudentPaymentOrder waitPay = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
-        if (ApplyOrder != null && waitPay == null) {
+        /*StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
+        if (ApplyOrder != null) {
             return failed("您已支付成功,请勿重复支付");
-        }
+        }*/
         Map payMap = musicGroupService.rePay(registerPayDto);
         if (payMap.containsKey("hasPaidZero")) {
             return failed(HttpStatus.RESET_CONTENT, payMap, "报名审核中");

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

@@ -58,7 +58,7 @@ public class MusicGroupRegisterController extends BaseController {
         if(musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
             boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroup.getId(), sysUser.getId());
             if(hasMemberGroup){
-                throw new BizException("您已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
+                throw new BizException("您已在其他会员团中,不可报名该乐团,请联系乐团主管");
             }
         }
 

+ 24 - 5
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -49,19 +49,42 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 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.thirdparty.adapay.ConfigInit;
 import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.util.CollectionUtils;
+import org.springframework.util.DigestUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @RequestMapping("studentOrder")
 @Api(tags = "订单回调")
@@ -78,8 +101,6 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
-    private YqPayFeignService yqPayFeignService;
-    @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
     @Autowired
     private SysConfigDao sysConfigDao;
@@ -92,8 +113,6 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private TenantPaymentOrderService tenantPaymentOrderService;
     @Autowired
-    private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
-    @Autowired
     private StudentGoodsSellDao studentGoodsSellDao;
     @Autowired
     private LuckDrawCountService luckDrawCountService;

+ 28 - 0
mec-student/src/main/java/com/ym/mec/student/interceptor/WebSocketHandshakeInterceptor.java

@@ -0,0 +1,28 @@
+package com.ym.mec.student.interceptor;
+
+import org.springframework.http.server.ServerHttpRequest;
+import org.springframework.http.server.ServerHttpResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.server.HandshakeInterceptor;
+
+import java.util.Map;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/9 0009
+ */
+@Component
+public class WebSocketHandshakeInterceptor implements HandshakeInterceptor {
+
+    @Override
+    public boolean beforeHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> map) throws Exception {
+        return true;
+    }
+
+    @Override
+    public void afterHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Exception e) {
+
+    }
+
+}

+ 8 - 1
mec-student/src/main/resources/logback-spring.xml

@@ -65,6 +65,13 @@
 		</root>
 	</springProfile>
 
+	<springProfile name="dev_server">
+		<root level="INFO">
+			<appender-ref ref="stdout" />
+			<appender-ref ref="file" />
+		</root>
+	</springProfile>
+
 	<!--生产环境:输出到文件 -->
 	<springProfile name="prod">
 		<root level="WARN">
@@ -73,4 +80,4 @@
 		</root>
 	</springProfile>
 
-</configuration>
+</configuration>

+ 0 - 5
mec-teacher/pom.xml

@@ -35,11 +35,6 @@
 			<artifactId>spring-cloud-sleuth-zipkin</artifactId>
 		</dependency>
 
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-websocket</artifactId>
-		</dependency>
-
 		<!-- swagger-spring-boot -->
 		<dependency>
 			<groupId>com.spring4all</groupId>

+ 23 - 4
mec-teacher/src/main/java/com/ym/mec/teacher/config/WebSocketConfig.java

@@ -1,9 +1,14 @@
 package com.ym.mec.teacher.config;
 
+import com.ym.mec.biz.handler.WebSocketHandler;
+import com.ym.mec.teacher.interceptor.WebSocketHandshakeInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.socket.config.annotation.EnableWebSocket;
-import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
+import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
+import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
 
 /**
  * @Author Joburgess
@@ -11,11 +16,25 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
  */
 @Configuration
 @EnableWebSocket
-public class WebSocketConfig {
+public class WebSocketConfig implements WebSocketConfigurer {
+
+    @Autowired
+    private WebSocketHandler webSocketHandler;
+    @Autowired
+    private WebSocketHandshakeInterceptor webSocketHandshakeInterceptor;
+
+    @Override
+    public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
+        webSocketHandlerRegistry.addHandler(webSocketHandler, "/ws")
+                .addInterceptors(webSocketHandshakeInterceptor);
+    }
 
     @Bean
-    public ServerEndpointExporter serverEndpoint() {
-        return new ServerEndpointExporter();
+    public ServletServerContainerFactoryBean createWebSocketContainer() {
+        ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
+        container.setMaxTextMessageBufferSize(8192*4);
+        container.setMaxBinaryMessageBufferSize(8192*4);
+        return container;
     }
 
 }

+ 29 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/SoundController.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.dto.MusicPitchDetailDto;
 import com.ym.mec.biz.service.SoundService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.biz.handler.WebSocketHandler;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
@@ -13,7 +14,9 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.socket.TextMessage;
 
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -25,6 +28,8 @@ import java.util.List;
 @RestController
 public class SoundController extends BaseController {
 
+    private final Logger LOGGER = LoggerFactory.getLogger(SoundController.class);
+
     @Autowired
     private SoundService soundService;
 
@@ -44,4 +49,28 @@ public class SoundController extends BaseController {
         return soundService.measureCompare(musicXmlInfoList, record);
     }
 
+    @RequestMapping("sendToUser")
+    public HttpResponseResult sendToUser(String phone, String message) throws IOException {
+        if(!WebSocketHandler.WS_CLIENTS.containsKey(phone)){
+            return failed("未上线");
+        }
+        if(!WebSocketHandler.WS_CLIENTS.get(phone).isOpen()){
+            return failed("已离线");
+        }
+        WebSocketHandler.WS_CLIENTS.get(phone).sendMessage(new TextMessage(message));
+        return succeed();
+    }
+
+    @RequestMapping("closeWebSocket")
+    public HttpResponseResult closeWebSocket(String phone) throws IOException {
+        if(!WebSocketHandler.WS_CLIENTS.containsKey(phone)){
+            return failed("未上线");
+        }
+        if(!WebSocketHandler.WS_CLIENTS.get(phone).isOpen()){
+            return failed("已离线");
+        }
+        WebSocketHandler.WS_CLIENTS.get(phone).close();
+        return succeed();
+    }
+
 }

+ 28 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/interceptor/WebSocketHandshakeInterceptor.java

@@ -0,0 +1,28 @@
+package com.ym.mec.teacher.interceptor;
+
+import org.springframework.http.server.ServerHttpRequest;
+import org.springframework.http.server.ServerHttpResponse;
+import org.springframework.stereotype.Component;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.server.HandshakeInterceptor;
+
+import java.util.Map;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/6/9 0009
+ */
+@Component
+public class WebSocketHandshakeInterceptor implements HandshakeInterceptor {
+
+    @Override
+    public boolean beforeHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Map<String, Object> map) throws Exception {
+        return true;
+    }
+
+    @Override
+    public void afterHandshake(ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse, WebSocketHandler webSocketHandler, Exception e) {
+
+    }
+
+}

+ 0 - 50
mec-teacher/src/main/java/com/ym/mec/teacher/websocket/SoundWebSocket.java

@@ -1,50 +0,0 @@
-package com.ym.mec.teacher.websocket;
-
-import org.springframework.stereotype.Component;
-
-import javax.websocket.OnClose;
-import javax.websocket.OnMessage;
-import javax.websocket.OnOpen;
-import javax.websocket.Session;
-import javax.websocket.server.ServerEndpoint;
-import java.io.IOException;
-
-/**
- * @Author Joburgess
- * @Date 2021/6/8 0008
- */
-@ServerEndpoint("/soundPoint")
-@Component
-public class SoundWebSocket {
-
-    /**
-     * 连接成功
-     *
-     * @param session
-     */
-    @OnOpen
-    public void onOpen(Session session) {
-        System.out.println("连接成功");
-    }
-
-    /**
-     * 连接关闭
-     *
-     * @param session
-     */
-    @OnClose
-    public void onClose(Session session) {
-        System.out.println("连接关闭");
-    }
-
-    /**
-     * 接收到消息
-     *
-     * @param text
-     */
-    @OnMessage
-    public String onMsg(String text) throws IOException {
-        return "servet 发送:" + text;
-    }
-
-}

+ 8 - 1
mec-teacher/src/main/resources/logback-spring.xml

@@ -65,6 +65,13 @@
 		</root>
 	</springProfile>
 
+	<springProfile name="dev_server">
+		<root level="INFO">
+			<appender-ref ref="stdout" />
+			<appender-ref ref="file" />
+		</root>
+	</springProfile>
+
 	<!--生产环境:输出到文件 -->
 	<springProfile name="prod">
 		<root level="WARN">
@@ -73,4 +80,4 @@
 		</root>
 	</springProfile>
 
-</configuration>
+</configuration>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -35,7 +35,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 				.hasIpAddress("0.0.0.0/0")
 				.antMatchers("/v2/api-docs", "/classGroup/highClassGroups", "/code/*", "/api/*", "/appVersionInfo/queryByPlatform", "/eduDegree/*",
 						"/uploadFile", "/eduContracts/queryProduceContract","/activity/doubleEleven2020Statis","/replacementInstrument/queryPage",
-						"/replacementInstrumentActivity/queryReplacementsStat","/eduStudentRegistration/queryPreApplyList","/eduSubject/findSubSubjects").permitAll().anyRequest().authenticated().and().httpBasic();
+						"/replacementInstrumentActivity/queryReplacementsStat","/eduStudentRegistration/queryPreApplyList","/eduSubject/findSubSubjects","/eduFinancialExpenditure/batchAdd","/eduSendNotice/*").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 4 - 0
mec-web/src/main/java/com/ym/mec/web/controller/EmployeeController.java

@@ -136,6 +136,10 @@ public class EmployeeController extends BaseController {
             sysUser.setRoles(employeeDao.queryUserRole(sysUser.getId()));
             sysUser.setContactAddress(employee.getContactAddress());
             sysUser.setPostalCode(employee.getPostalCode());
+            sysUser.setDeptId(employee.getDeptId());
+            sysUser.setPostId(employee.getPostId());
+            sysUser.setBankCard(employee.getBankCard());
+            sysUser.setOpenBankAddress(employee.getOpenBankAddress());
             return succeed(sysUser);
         }
         return failed("获取用户信息失败");

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

@@ -2141,8 +2141,8 @@ public class ExportController extends BaseController {
         OutputStream outputStream = response.getOutputStream();
         try {
 
-            String[] header = {"分部", "单位编号", "单位名称", "联系人", "职位", "手机号", "是否启用"};
-            String[] body = {"organization.name", "id", "name", "linkman", "job", "mobileNo", "isEnable == true ? '是':'否'"};
+            String[] header = {"分部", "单位编号", "单位名称", "是否启用","乐团主管","是否全职资源"};
+            String[] body = {"organization.name", "id", "name", "isEnable == true ? '是':'否'", "realName", "fullJobResource == 1 ? '是' : '否'"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, pageList.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=cooperationOrgan-" + DateUtil.getDate(new Date()) + ".xls");

+ 13 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -451,4 +451,17 @@ public class StudentRegistrationController extends BaseController {
             return succeed(studentRegistrationService.setNoneCloudTeacher(id));
         }
     }
+
+
+    @ApiOperation(value = "云教练审核失败")
+    @PostMapping("/setCloudTeacherToFailed")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/setCloudTeacherToFailed')")
+    public HttpResponseResult<Boolean> setCloudTeacherToFailed(Long id) {
+        StudentRegistration studentRegistration = studentRegistrationService.get(id);
+        
+        if(studentRegistration == null){
+        	return failed("参数提交错误");
+        }
+        return studentRegistrationService.setCloudTeacherToFailed(studentRegistration) ? succeed() : failed();
+    }
 }

+ 2 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SysMessageController.java

@@ -65,6 +65,7 @@ public class SysMessageController extends BaseController {
 				return succeed(JSON.parseArray("[{\"value\":\"全部\",\"key\":\"ALL\"}," +
 						"{\"value\":\"学员信息\",\"key\":\"STUDENT\"}," +
 						"{\"value\":\"乐团信息\",\"key\":\"MUSIC\"}," +
+						"{\"value\":\"审批信息\",\"key\":\"OA\"}," +
 						"{\"value\":\"其他\",\"key\":\"DEFAULT\"}]"));
 			}
 		}
@@ -72,6 +73,7 @@ public class SysMessageController extends BaseController {
 				"{\"value\":\"缴费信息\",\"key\":\"PAY\"}," +
 				"{\"value\":\"学员信息\",\"key\":\"STUDENT\"}," +
 				"{\"value\":\"乐团信息\",\"key\":\"MUSIC\"}," +
+				"{\"value\":\"审批信息\",\"key\":\"OA\"}," +
 				"{\"value\":\"其他\",\"key\":\"DEFAULT\"}]"));
 	}
 

+ 67 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduFinancialExpenditureController.java

@@ -0,0 +1,67 @@
+package com.ym.mec.web.controller.education;
+
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CooperationOrganDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.entity.Organization;
+import com.ym.mec.biz.dal.entity.StudentVisit;
+import com.ym.mec.biz.dal.enums.ExpenditureTypeEnum;
+import com.ym.mec.biz.dal.enums.FeeProjectEnum;
+import com.ym.mec.biz.service.FinancialExpenditureService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Api(tags = "支出记录(教务端)")
+@RequestMapping("eduFinancialExpenditure")
+@RestController
+public class EduFinancialExpenditureController extends BaseController {
+    @Autowired
+    private FinancialExpenditureService financialExpenditureService;
+    @Autowired
+    private OrganizationDao organizationDao;
+    @Autowired
+    private CooperationOrganDao cooperationOrganDao;
+
+    @ApiOperation(value = "批量添加支出记录")
+    @PostMapping(value = "/batchAdd")
+    public HttpResponseResult<List<FinancialExpenditure>> batchAdd(@RequestBody List<FinancialExpenditure> financialExpenditures) {
+        List<Organization> organs = organizationDao.findAllOrgans();
+        Map<String, Integer> organMap = organs.stream().collect(Collectors.toMap(Organization::getName, Organization::getId));
+        List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getAllCooperationOrgan();
+        Map<String, Integer> cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(e -> e.getName() + e.getOrganId(), e -> e.getId()));
+        for (FinancialExpenditure financialExpenditure : financialExpenditures) {
+            if (organMap.containsKey(financialExpenditure.getOrganName())) {
+                financialExpenditure.setOrganId(organMap.get(financialExpenditure.getOrganName()));
+            }
+            if (cooperationOrganMap.containsKey(financialExpenditure.getCooperationOrganName() + financialExpenditure.getOrganId())) {
+                Integer cooperationOrganId = cooperationOrganMap.get(financialExpenditure.getCooperationOrganName() + financialExpenditure.getOrganId());
+                financialExpenditure.setCooperationOrganId(cooperationOrganId);
+            }
+            for (ExpenditureTypeEnum typeEnum : ExpenditureTypeEnum.values()) {
+                if (typeEnum.getDesc().equals(financialExpenditure.getFeeType())) {
+                    financialExpenditure.setType(typeEnum);
+                }
+            }
+            for (FeeProjectEnum feeProjectEnum : FeeProjectEnum.values()) {
+                if (feeProjectEnum.getDesc().equals(financialExpenditure.getFeeProjectItem())) {
+                    financialExpenditure.setFeeProject(feeProjectEnum);
+                }
+            }
+        }
+        return succeed(financialExpenditureService.batchAdd(financialExpenditures));
+    }
+}

+ 10 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduOrganizationController.java

@@ -1,10 +1,12 @@
 package com.ym.mec.web.controller.education;
 
+import com.ym.mec.biz.service.CooperationOrganService;
 import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 @RequestMapping("eduOrganization")
@@ -14,10 +16,18 @@ public class EduOrganizationController extends BaseController {
 
     @Autowired
     private OrganizationService organizationService;
+    @Autowired
+    private CooperationOrganService cooperationOrganService;
 
     @ApiOperation(value = "获取员工所在分部列表")
     @GetMapping("/queryEmployeeOrgan")
     public Object queryEmployeeOrgan() throws Exception {
         return succeed(organizationService.queryEmployeeOrgan());
     }
+
+    @ApiOperation(value = "根据分部id获取合作单位(学校)列表")
+    @GetMapping("/queryByOrganId")
+    public Object queryByOrganId(String organId) {
+        return succeed(cooperationOrganService.queryByOrganId(organId));
+    }
 }

+ 57 - 39
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRegisterController.java

@@ -1,33 +1,36 @@
 package com.ym.mec.web.controller.education;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.CooperationOrganDao;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
+import com.ym.mec.biz.dal.dao.StudentPreRegistrationDao;
+import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
+import com.ym.mec.biz.dal.dto.Mapper;
 import com.ym.mec.biz.dal.dto.MusicGroupRegAndMoneyDto;
-import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
 import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
 
 @RequestMapping("eduRegister")
 @Api(tags = "乐团报名回款统计(教务端)")
@@ -45,6 +48,10 @@ public class EduRegisterController extends BaseController {
     @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Autowired
+    private StudentPaymentOrderDao studentPaymentOrderDao;
+    @Autowired
     private EmployeeDao employeeDao;
     @Autowired
     private CooperationOrganDao cooperationOrganDao;
@@ -90,28 +97,39 @@ public class EduRegisterController extends BaseController {
         //预报名人数
         List<MusicGroupRegAndMoneyDto> preRegisters = studentPreRegistrationDao.getPreRegisterNum(musicGroupIds);
         List<MusicGroupRegAndMoneyDto> registers = studentRegistrationDao.getRegisters(musicGroupIds);
+        List<Mapper> instrumentNumList = studentPaymentOrderDetailDao.getInstrumentNumInMusicApply(musicGroupIds);
+        List<Mapper> moneyList = studentPaymentOrderDao.getMoneyInMusicApply(musicGroupIds);
 
-        for (MusicGroupRegAndMoneyDto musicGroup : musicGroups) {
-            List<MusicalListDetailDto> musicalList = studentPaymentOrderDetailService.getMusicalListDetail(musicGroup.getMusicGroupId(), null);
-            if (musicalList != null && musicalList.size() > 0) {
-                Long instrumentNum = musicalList.stream().filter(e -> KitGroupPurchaseTypeEnum.GROUP.equals(e.getKitGroupPurchaseTypeEnum())).count();
-                BigDecimal money = musicalList.stream().filter(e -> e.getOrderAmount() != null).map(MusicalListDetailDto::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-                musicGroup.setBuyInstrumentNum(instrumentNum.intValue());
-                musicGroup.setMoney(money == null ? BigDecimal.ZERO : money);
-            }
+		for (MusicGroupRegAndMoneyDto musicGroup : musicGroups) {
 
-            for (MusicGroupRegAndMoneyDto preRegister : preRegisters) {
-                if (!musicGroup.getMusicGroupId().equals(preRegister.getMusicGroupId())) continue;
-                musicGroup.setPreRegNum(preRegister.getPreRegNum());
-            }
-            for (MusicGroupRegAndMoneyDto register : registers) {
-                if (!musicGroup.getMusicGroupId().equals(register.getMusicGroupId())) continue;
-                musicGroup.setRegNum(register.getRegNum());
-                musicGroup.setPayNum(register.getPayNum());
-                musicGroup.setCheckNum(register.getCheckNum());
-                musicGroup.setBuyCloudTeacherNum(register.getBuyCloudTeacherNum());
-            }
-        }
+			for (Mapper mapper : instrumentNumList) {
+				if (!musicGroup.getMusicGroupId().equals(mapper.getKey()))
+					continue;
+				musicGroup.setBuyInstrumentNum(Integer.parseInt(mapper.getValue().toString()));
+			}
+			for (Mapper mapper : moneyList) {
+				if (!musicGroup.getMusicGroupId().equals(mapper.getKey()))
+					continue;
+				musicGroup.setMoney((BigDecimal) mapper.getValue());
+			}
+
+			for (MusicGroupRegAndMoneyDto preRegister : preRegisters) {
+				if (!musicGroup.getMusicGroupId().equals(preRegister.getMusicGroupId()))
+					continue;
+				musicGroup.setPreRegNum(preRegister.getPreRegNum());
+			}
+			for (MusicGroupRegAndMoneyDto register : registers) {
+				if (!musicGroup.getMusicGroupId().equals(register.getMusicGroupId()))
+					continue;
+				musicGroup.setRegNum(register.getRegNum());
+				musicGroup.setPayNum(register.getPayNum());
+				musicGroup.setCheckNum(register.getCheckNum());
+				musicGroup.setBuyCloudTeacherNum(register.getBuyCloudTeacherNum());
+				musicGroup.setStudentNumOfNormal(register.getStudentNumOfNormal());
+				musicGroup.setNoCloudTeacherStudentNumOfNormal(register.getNoCloudTeacherStudentNumOfNormal());
+				musicGroup.setCloudTeacherStudentNumOfApply(register.getCloudTeacherStudentNumOfApply());
+			}
+		}
         return succeed(musicGroups);
     }
 }

+ 60 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduSendNoticeController.java

@@ -0,0 +1,60 @@
+package com.ym.mec.web.controller.education;
+
+
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dto.PushInfoDto;
+import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Api(tags = "发送PUSH、IM(教务端)")
+@RequestMapping("eduSendNotice")
+@RestController
+public class EduSendNoticeController extends BaseController {
+
+    @Autowired
+    private SysMessageService sysMessageService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+
+    @ApiOperation(value = "发送PUSH")
+    @PostMapping(value = "/push")
+    public HttpResponseResult push(@RequestBody PushInfoDto pushInfo) {
+        Map<Integer, String> userMap = new HashMap<>();
+        for (Integer userId : pushInfo.getUserIds()) {
+            userMap.put(userId, userId.toString());
+        }
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
+        String workOrderUrl = "8?" + baseApiUrl + pushInfo.getWorkOrderUrl();
+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, pushInfo.getMessageType(), userMap, null, 0, workOrderUrl, "SYSTEM");
+        return succeed();
+    }
+
+    @ApiOperation(value = "发送IM")
+    @PostMapping(value = "/im")
+    public HttpResponseResult im(@RequestBody PushInfoDto pushInfo) {
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
+        String workOrderUrl = baseApiUrl + pushInfo.getWorkOrderUrl();
+        String msg = pushInfo.getImContent() + " " + workOrderUrl;
+
+        for (Integer userId : pushInfo.getUserIds()) {
+            sysMessageService.sendNoAuthPrivateMessage("1", userId.toString(), msg);
+        }
+        return succeed();
+    }
+}

+ 8 - 1
mec-web/src/main/resources/logback-spring.xml

@@ -65,6 +65,13 @@
 		</root>
 	</springProfile>
 
+	<springProfile name="dev_server">
+		<root level="INFO">
+			<appender-ref ref="stdout" />
+			<appender-ref ref="file" />
+		</root>
+	</springProfile>
+
 	<!--生产环境:输出到文件 -->
 	<springProfile name="prod">
 		<root level="WARN">
@@ -73,4 +80,4 @@
 		</root>
 	</springProfile>
 
-</configuration>
+</configuration>