Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/yonge' into yonge

Joburgess 5 rokov pred
rodič
commit
d1a1169604
43 zmenil súbory, kde vykonal 913 pridanie a 472 odobranie
  1. 7 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderCourseSettingsDao.java
  2. 15 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  3. 7 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java
  4. 16 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java
  5. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/RouteScaleDto.java
  6. 16 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentAttendanceViewDto.java
  7. 14 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentCompetitionRankingDto.java
  8. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
  9. 15 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentAttendance.java
  10. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysPaymentConfig.java
  11. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FeeTypeEnum.java
  12. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SellOrderQueryInfo.java
  13. 35 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysPaymentConfigQueryInfo.java
  14. 25 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java
  15. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java
  16. 34 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChargeTypeSubjectMapperServiceImpl.java
  17. 44 73
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  18. 48 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java
  19. 16 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  20. 15 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  21. 42 102
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  22. 63 25
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  23. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  24. 62 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  25. 73 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  26. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentAttendanceServiceImpl.java
  27. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCompetitionServiceImpl.java
  28. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  29. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysUserCashAccountServiceImpl.java
  30. 20 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  31. 0 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderCourseSettingsMapper.xml
  32. 4 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderDetailMapper.xml
  33. 20 5
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  34. 127 110
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml
  35. 4 0
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  36. 1 1
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  37. 10 8
      mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml
  38. 31 3
      mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml
  39. 0 45
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  40. 8 0
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java
  41. 52 1
      mec-web/src/main/java/com/ym/mec/web/controller/SysPaymentConfigController.java
  42. 0 3
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java
  43. 0 2
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

+ 7 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderCourseSettingsDao.java

@@ -19,15 +19,15 @@ public interface MusicGroupPaymentCalenderCourseSettingsDao extends BaseDAO<Inte
 	List<MusicGroupPaymentCalenderCourseSettings> getWithPaymentCalender(@Param("calenderId") Long calenderId);
 
 	/**
-	 * @describe 根据缴费日历和课程类型获取课程价格设置
-	 * @author Joburgess
-	 * @date 2020.11.04
 	 * @param calenderId:
 	 * @param courseType:
 	 * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings
+	 * @describe 根据缴费日历和课程类型获取课程价格设置
+	 * @author Joburgess
+	 * @date 2020.11.04
 	 */
 	MusicGroupPaymentCalenderCourseSettings getWithPaymentCalenderAndCourseType(@Param("calenderId") Long calenderId,
-																				@Param("courseType")CourseSchedule.CourseScheduleType courseType);
+																				@Param("courseType") CourseSchedule.CourseScheduleType courseType);
 
 	int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);
 
@@ -49,19 +49,20 @@ public interface MusicGroupPaymentCalenderCourseSettingsDao extends BaseDAO<Inte
 
 	/**
 	 * 批量新增
+	 *
 	 * @param musicGroupPaymentCalenderCourseSettingsList
 	 * @return
 	 */
 	int batchInsert(List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList);
 
 	/**
+	 * @param calenderId:
+	 * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
 	 * @describe 获取收费标准
 	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
 	 * @author zouxuan
 	 * @date 2020/10/30
 	 * @time 16:04
-	 * @param calenderId:
-	 * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings>
 	 */
 	List<MusicGroupPaymentCalenderCourseSettings> queryCalenderCourseSettings(Long calenderId);
 }

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

@@ -1,19 +1,14 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType;
 import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.*;
 
 public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPaymentCalender> {
 
@@ -249,4 +244,16 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @return java.util.Map<java.lang.String,java.lang.String>
      */
     List<Map<String, String>> queryUserPaymentStatus(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
+
+    /**
+     * @describe 获取学员再乐团的缴费状态
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/11/11
+     * @time 14:03
+     * @param studentId:
+     * @param musicGroupId:
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.String>>
+     */
+    List<Map<Integer,String>> queryUserCoursePaymentStatus(@Param("studentId") Set studentId, @Param("musicGroupId") String musicGroupId);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDetailDao.java

@@ -123,6 +123,13 @@ public interface MusicGroupPaymentCalenderDetailDao extends BaseDAO<Long, MusicG
 	Set<Integer> queryStudentIds(Long calenderId);
 
 	/**
+	 * 获取未缴费的员列表
+	 * @param calenderId
+	 * @return
+	 */
+	Set<Integer> queryNoPaymentStudentIds(Long calenderId);
+
+	/**
 	 * 查询进行中的缴费
 	 * @param musicGroupId
 	 * @param userId

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule;
+
 import java.util.List;
 
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
@@ -10,27 +11,34 @@ import org.apache.ibatis.annotations.Param;
 public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> {
 
     /**
-     * @describe 获取指定学员,指定课程,指定课程时长下的可用缴费记录
-     * @author Joburgess
-     * @date 2020.11.04
      * @param studentId:
      * @param courseType:
      * @param courseMinutes:
      * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail
+     * @describe 获取指定学员,指定课程,指定课程时长下的可用缴费记录
+     * @author Joburgess
+     * @date 2020.11.04
      */
     MusicGroupPaymentStudentCourseDetail getUnUseWithStudentAndCourseTypeAndCourseMinutes(@Param("studentId") Integer studentId,
-                                                                                           @Param("courseType")CourseSchedule.CourseScheduleType courseType,
-                                                                                           @Param("courseMinutes") Integer courseMinutes);
+                                                                                          @Param("courseType") CourseSchedule.CourseScheduleType courseType,
+                                                                                          @Param("courseMinutes") Integer courseMinutes);
 
     /**
+     * @param studentIds:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail>
      * @describe
      * @author Joburgess
      * @date 2020.11.04
-     * @param studentIds:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail>
      */
     List<MusicGroupPaymentStudentCourseDetail> getUnUseWithStudents(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);
 
-	int batchInsert(List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList);
+    int batchInsert(List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList);
 
+    /**
+     * 删除用户购买乐团课程记录
+     * @param userId
+     * @param musicGroupId
+     * @return
+     */
+    int deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 }

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

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.dto;
 
+import com.ym.mec.biz.dal.enums.FeeTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 
 import java.math.BigDecimal;
@@ -18,6 +19,8 @@ public class RouteScaleDto {
 
     private String feeFlag;
 
+    private FeeTypeEnum feeType;
+
     public Integer getOrganId() {
         return organId;
     }
@@ -66,4 +69,12 @@ public class RouteScaleDto {
     public void setPayType(PaymentChannelEnum payType) {
         this.payType = payType;
     }
+
+    public FeeTypeEnum getFeeType() {
+        return feeType;
+    }
+
+    public void setFeeType(FeeTypeEnum feeType) {
+        this.feeType = feeType;
+    }
 }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentAttendanceViewDto.java

@@ -2,6 +2,8 @@ package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.StringUtils;
+import sun.swing.StringUIClientPropertyKey;
 
 /**
  * @Author Joburgess
@@ -37,9 +39,23 @@ public class StudentAttendanceViewDto {
     @ApiModelProperty(value = "学生头像")
     private String avatar;
 
+    @ApiModelProperty(value = "缴费状态")
+    private String paymentStatus = "PAID_COMPLETED";
+
     @ApiModelProperty(value = "学生在学状态",required = false)
     private StudentAttendanceStatusEnum status;
 
+    public String getPaymentStatus() {
+        return paymentStatus;
+    }
+
+    public void setPaymentStatus(String paymentStatus) {
+        if(StringUtils.isEmpty(paymentStatus)){
+            paymentStatus = "NON_PAYMENT";
+        }
+        this.paymentStatus = paymentStatus;
+    }
+
     public String getPhone() {
         return phone;
     }

+ 14 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentCompetitionRankingDto.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 
+import io.swagger.annotations.ApiModelProperty;
+
 /**
  * @Author Joburgess
  * @Date 2020.11.10
@@ -8,6 +10,8 @@ public class StudentCompetitionRankingDto {
 
     private Long competitionId;
 
+    private Integer prizeLevel;
+
     private String username;
 
     private String pictureUrl;
@@ -15,12 +19,21 @@ public class StudentCompetitionRankingDto {
     public StudentCompetitionRankingDto() {
     }
 
-    public StudentCompetitionRankingDto(Long competitionId, String username, String pictureUrl) {
+    public StudentCompetitionRankingDto(Long competitionId, Integer prizeLevel, String username, String pictureUrl) {
         this.competitionId = competitionId;
+        this.prizeLevel = prizeLevel;
         this.username = username;
         this.pictureUrl = pictureUrl;
     }
 
+    public Integer getPrizeLevel() {
+        return prizeLevel;
+    }
+
+    public void setPrizeLevel(Integer prizeLevel) {
+        this.prizeLevel = prizeLevel;
+    }
+
     public Long getCompetitionId() {
         return competitionId;
     }

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

@@ -17,7 +17,7 @@ import com.ym.mec.common.enums.BaseEnum;
 public class MusicGroupPaymentCalender {
 
 	public enum PaymentCalenderStatusEnum implements BaseEnum<String, PaymentCalenderStatusEnum> {
-		AUDITING("审核中"), REJECT("拒绝"), NO("未开启缴费"), OPEN("开启缴费"), OVER("缴费已结束");
+		AUDITING("审核中"), REJECT("拒绝"), NO("未开启缴费"), OPEN("开启缴费"), OVER("缴费已结束"), PAID("已缴费");
 
 		private String desc;
 

+ 15 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentAttendance.java

@@ -5,6 +5,7 @@ import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import java.util.Date;
@@ -76,6 +77,20 @@ public class StudentAttendance {
 	@ApiModelProperty(value = "当前课时")
 	private Integer currentClassTimes;
 
+	@ApiModelProperty(value = "缴费状态")
+	private String paymentStatus = "PAID_COMPLETED";
+
+	public String getPaymentStatus() {
+		return paymentStatus;
+	}
+
+	public void setPaymentStatus(String paymentStatus) {
+		if(StringUtils.isEmpty(paymentStatus)){
+			paymentStatus = "NON_PAYMENT";
+		}
+		this.paymentStatus = paymentStatus;
+	}
+
 	public Long getCurrentScheduleId() {
 		return currentScheduleId;
 	}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysPaymentConfig.java

@@ -44,6 +44,12 @@ public class SysPaymentConfig {
     private String routeScale;
 
     /**
+     * 根据费用分配规则
+     */
+    @ApiModelProperty(value = "根据费用分配规则")
+    private String typeRouteScale;
+
+    /**
      * 分部id
      */
     @ApiModelProperty(value = "分部id")
@@ -247,5 +253,13 @@ public class SysPaymentConfig {
     public void setAccountType(AccountType accountType) {
         this.accountType = accountType;
     }
+
+    public String getTypeRouteScale() {
+        return typeRouteScale;
+    }
+
+    public void setTypeRouteScale(String typeRouteScale) {
+        this.typeRouteScale = typeRouteScale;
+    }
 }
 

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FeeTypeEnum.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum FeeTypeEnum implements BaseEnum<String, FeeTypeEnum> {
+	SERVICE("SERVICE", "服务"),
+	SELL("SELL", "销售");
+
+	private String code;
+
+	private String desc;
+
+	private FeeTypeEnum(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	@Override
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+}

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SellOrderQueryInfo.java

@@ -25,6 +25,8 @@ public class SellOrderQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "结束时间",required = false)
     private Date endTime;
 
+    @ApiModelProperty(value = "用户名称或编号",required = false)
+    private String userName;
 
     public String getOrganIdList() {
         return organIdList;
@@ -73,4 +75,12 @@ public class SellOrderQueryInfo extends QueryInfo {
     public void setCooperationOrganId(Integer cooperationOrganId) {
         this.cooperationOrganId = cooperationOrganId;
     }
+
+	public String getUserName() {
+		return userName;
+	}
+
+	public void setUserName(String userName) {
+		this.userName = userName;
+	}
 }

+ 35 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysPaymentConfigQueryInfo.java

@@ -0,0 +1,35 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class SysPaymentConfigQueryInfo extends QueryInfo {
+
+    /**
+     * 分部id
+     */
+    @ApiModelProperty(value = "分部id", required = true)
+    private Integer organId;
+
+    /**
+     * 是否设置按费用类型分润
+     */
+    @ApiModelProperty(value = "是否设置按费用类型分润 1-是 0 -否", required = true)
+    private Integer hasTypeRoute;
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getHasTypeRoute() {
+        return hasTypeRoute;
+    }
+
+    public void setHasTypeRoute(Integer hasTypeRoute) {
+        this.hasTypeRoute = hasTypeRoute;
+    }
+}

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java

@@ -1,15 +1,20 @@
 package com.ym.mec.biz.service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDetailDto;
 import com.ym.mec.biz.dal.dto.MusicGroupPaymentCalenderAuditDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
 import com.ym.mec.biz.dal.page.MusicGroupPaymentCalenderQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
+import org.apache.ibatis.annotations.Param;
+
 public interface MusicGroupPaymentCalenderService extends BaseService<Long, MusicGroupPaymentCalender> {
 
 	/**
@@ -32,6 +37,14 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	Long merge(MusicGroupPaymentCalender musicGroupPaymentCalender);
 	
 	/**
+	 * 
+	 * @param id
+	 * @param memo
+	 * @return
+	 */
+	boolean makesureSchoolePaid(Long id, String memo);
+	
+	/**
 	 * 自动更新付款日历记录状态
 	 * @return
 	 */
@@ -136,4 +149,16 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @return com.ym.mec.biz.dal.entity.MusicGroupStudentFee
 	 */
     MusicGroupStudentFee updateCalender(Long detailId, Integer userId);
+
+	/**
+	 * @describe 推送学生待续费通知
+	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+	 * @author zouxuan
+	 * @date 2020/11/3
+	 * @time 17:04
+	 * @param calenderId:
+	 * @param musicGroup:
+	 * @return com.ym.mec.biz.dal.entity.MusicGroupStudentFee
+	 */
+	void pushWaitRenewMessage(Long calenderId, MusicGroup musicGroup);
 }

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

@@ -69,4 +69,12 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
      */
     List<SellOrder> getRefundSellOrder(Long orderId);
 
+
+    /**
+     * 获取订单的实际销售金额(除去余额部分)
+     * @param orderNo
+     * @return
+     */
+    BigDecimal getSellActualAmount(String orderNo);
+
 }

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

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 import java.util.List;
 
+import com.ym.mec.common.exception.BizException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -12,32 +13,37 @@ import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
 @Service
-public class ChargeTypeSubjectMapperServiceImpl extends BaseServiceImpl<Long, ChargeTypeSubjectMapper>  implements ChargeTypeSubjectMapperService {
-	
-	@Autowired
-	private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
-
-	@Override
-	public BaseDAO<Long, ChargeTypeSubjectMapper> getDAO() {
-		return chargeTypeSubjectMapperDao;
-	}
-
-	@Override
-	public boolean deleteById(Long id) {
-		chargeTypeSubjectMapperDao.delete(id);
-		return true;
-	}
-
-	@Override
-	public boolean batchInsert(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList) {
-		chargeTypeSubjectMapperDao.batchInsert(chargeTypeSubjectMapperList);
-		return true;
-	}
-
-	@Override
-	public boolean batchUpdate(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList) {
-		chargeTypeSubjectMapperDao.batchUpdate(chargeTypeSubjectMapperList);
-		return true;
-	}
-	
+public class ChargeTypeSubjectMapperServiceImpl extends BaseServiceImpl<Long, ChargeTypeSubjectMapper> implements ChargeTypeSubjectMapperService {
+
+    @Autowired
+    private ChargeTypeSubjectMapperDao chargeTypeSubjectMapperDao;
+
+    @Override
+    public BaseDAO<Long, ChargeTypeSubjectMapper> getDAO() {
+        return chargeTypeSubjectMapperDao;
+    }
+
+    @Override
+    public boolean deleteById(Long id) {
+        chargeTypeSubjectMapperDao.delete(id);
+        return true;
+    }
+
+    @Override
+    public boolean batchInsert(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList) {
+        ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(chargeTypeSubjectMapperList.get(0).getChargeTypeId(), chargeTypeSubjectMapperList.get(0).getSubjectId());
+        if (subjectDiscount != null) {
+            throw new BizException("此声部商品折扣已添加");
+        }
+
+        chargeTypeSubjectMapperDao.batchInsert(chargeTypeSubjectMapperList);
+        return true;
+    }
+
+    @Override
+    public boolean batchUpdate(List<ChargeTypeSubjectMapper> chargeTypeSubjectMapperList) {
+        chargeTypeSubjectMapperDao.batchUpdate(chargeTypeSubjectMapperList);
+        return true;
+    }
+
 }

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

@@ -1,9 +1,5 @@
 package com.ym.mec.biz.service.impl;
 
-import static com.ym.mec.biz.dal.enums.GroupType.COMM;
-import static com.ym.mec.biz.dal.enums.GroupType.PRACTICE;
-import static com.ym.mec.biz.dal.enums.GroupType.VIP;
-
 import java.math.BigDecimal;
 import java.time.Duration;
 import java.time.Instant;
@@ -24,6 +20,8 @@ import java.util.Objects;
 import java.util.Set;
 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;
@@ -36,30 +34,6 @@ import com.alibaba.fastjson.JSON;
 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.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupRelationDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.CoursesGroupDao;
-import com.ym.mec.biz.dal.dao.GroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupBuildLogDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.PracticeGroupDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.StudentApplyRefundsDao;
-import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
 import com.ym.mec.biz.dal.dto.ClassGroupImGroupDto;
 import com.ym.mec.biz.dal.dto.ClassGroupTeacherMapDto;
@@ -78,27 +52,7 @@ import com.ym.mec.biz.dal.dto.TeacherClassHeadInfo;
 import com.ym.mec.biz.dal.dto.TeacherMusicClassInfoDto;
 import com.ym.mec.biz.dal.dto.TeacherVipClassInfoDto;
 import com.ym.mec.biz.dal.dto.UserMusicGroupQueryInfo;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupRelation;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
-import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.CoursesGroup;
-import com.ym.mec.biz.dal.entity.Group;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupBuildLog;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderCourseSettings;
-import com.ym.mec.biz.dal.entity.PracticeGroup;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SysConfig;
-import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
-import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
@@ -128,11 +82,12 @@ import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
-import com.ym.mec.jiari.JiaRiFeignService;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateConvertor;
 import com.ym.mec.util.date.DateUtil;
 
+import static com.ym.mec.biz.dal.enums.GroupType.*;
+
 @Service
 public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> implements ClassGroupService {
 
@@ -187,8 +142,6 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Autowired
     private ImFeignService imFeignService;
     @Autowired
-    private JiaRiFeignService jiaRiFeignService;
-    @Autowired
     private CourseScheduleService courseScheduleService;
     @Autowired
     private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
@@ -215,6 +168,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private StudentDao studentDao;
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsService musicGroupPaymentCalenderCourseSettingsService;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -299,7 +254,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setUserId(Integer.parseInt(userId));
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+            classGroupStudentMapper.setGroupType(MUSIC);
             classGroupStudentList.add(classGroupStudentMapper);
 
             StudentRegistration studentRegistration = new StudentRegistration();
@@ -384,7 +339,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setUserId(Integer.parseInt(userId));
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+            classGroupStudentMapper.setGroupType(MUSIC);
             classGroupStudentList.add(classGroupStudentMapper);
 
             StudentRegistration studentRegistration = new StudentRegistration();
@@ -424,7 +379,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroup.setSubjectIdList(subjectIds);
         classGroup.setName(name);
         classGroup.setType(ClassGroupTypeEnum.MIX);
-        classGroup.setGroupType(GroupType.MUSIC);
+        classGroup.setGroupType(MUSIC);
         classGroup.setExpectStudentNum(studentNum);
         classGroup.setStudentNum(studentNum);
         classGroup.setCreateTime(date);
@@ -444,7 +399,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             mixClassGroupStudentMapper.setUserId(classGroupStudentMapper.getUserId());
             mixClassGroupStudentMapper.setCreateTime(date);
             mixClassGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            mixClassGroupStudentMapper.setGroupType(GroupType.MUSIC);
+            mixClassGroupStudentMapper.setGroupType(MUSIC);
             mixClassGroupStudentMappers.add(mixClassGroupStudentMapper);
 
             userIdList.add(classGroupStudentMapper.getUserId());
@@ -498,7 +453,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 classGroupTeacherMapperDao.delClassGroupTeacherMapper(classGroupIds);
 
                 List<CourseSchedule> classGroupNoStartCourseSchedules = courseScheduleService.findClassGroupNoStartCourseSchedules(classGroupIds,
-                        GroupType.MUSIC);
+                        MUSIC);
 
                 if (classGroupNoStartCourseSchedules.size() > 0) {
                     List<Long> courseScheduleIds = classGroupNoStartCourseSchedules.stream().map(courseSchedule -> courseSchedule.getId())
@@ -529,7 +484,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 Date date;
                 date = new Date();
                 highClassGroup.setId(null);
-                highClassGroup.setGroupType(GroupType.MUSIC);
+                highClassGroup.setGroupType(MUSIC);
                 highClassGroup.setCreateTime(date);
                 highClassGroup.setUpdateTime(date);
                 highClassGroup.setType(ClassGroupTypeEnum.HIGH);
@@ -543,7 +498,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 classGroupTeacherMapper.setClassGroupId(highClassGroup.getId());
                 classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
                 classGroupTeacherMapper.setUserId(highClassGroup.getUserId());
-                classGroupTeacherMapper.setGroupType(GroupType.MUSIC);
+                classGroupTeacherMapper.setGroupType(MUSIC);
                 classGroupTeacherMapper.setCreateTime(date);
                 classGroupTeacherMapper.setUpdateTime(date);
                 classGroupTeacherMapperList.add(classGroupTeacherMapper);
@@ -593,7 +548,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                         courseSchedule.setUpdateTime(date);
                         courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
                         courseSchedule.setType(CourseSchedule.CourseScheduleType.HIGH);
-                        courseSchedule.setGroupType(GroupType.MUSIC);
+                        courseSchedule.setGroupType(MUSIC);
                         courseSchedule.setName(courseScheduleName + "-" + CourseSchedule.CourseScheduleType.HIGH.getMsg());
                         courseSchedule.setOrganId(musicGroup.getOrganId());
                         courseScheduleList.add(courseSchedule);
@@ -824,8 +779,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Set<String> vipIds = vipCourses.stream().map(CourseListDto::getVipId).collect(Collectors.toSet());
         Map<String, String> vipStuNames = MapUtil.convertIntegerMap(classGroupDao.findVipStuNames(StringUtils.join(vipIds, ","), "VIP"));
 
-        if (!CollectionUtils.isEmpty(typeGroupMap.get(GroupType.MUSIC))) {
-            musicGroupIds = typeGroupMap.get(GroupType.MUSIC).stream().map(Group::getId).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(typeGroupMap.get(MUSIC))) {
+            musicGroupIds = typeGroupMap.get(MUSIC).stream().map(Group::getId).collect(Collectors.toList());
         } else {
             musicGroupIds = null;
         }
@@ -873,8 +828,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         courseListDtos.addAll(practiceCourse);
         //检测对应乐团是否已申请退费
         List<Map<String, Integer>> isApplyMaps;
-        if (!CollectionUtils.isEmpty(typeGroupMap.get(GroupType.MUSIC))) {
-            musicGroupIds = typeGroupMap.get(GroupType.MUSIC).stream().map(Group::getId).collect(Collectors.toList());
+        if (!CollectionUtils.isEmpty(typeGroupMap.get(MUSIC))) {
+            musicGroupIds = typeGroupMap.get(MUSIC).stream().map(Group::getId).collect(Collectors.toList());
         } else {
             musicGroupIds = null;
         }
@@ -1365,7 +1320,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         Map<Integer, Long> classGroupStudentNumMap = MapUtil.convertIntegerMap(classGroupStudentNumMaps);
         Map<Integer, Long> currentClassTimes;
         Map<Integer, Long> noStartClassTimes = MapUtil.convertIntegerMap(courseScheduleDao.countCurrentNumByClassGroupId(classGroupIds, null));
-        if (!type.equals(GroupType.MUSIC)) {
+        if (!type.equals(MUSIC)) {
             currentClassTimes = noStartClassTimes;
         } else {
             currentClassTimes = MapUtil.convertIntegerMap(courseScheduleDao.countCurrentNumByClassGroupId(classGroupIds, user.getId()));
@@ -1574,6 +1529,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         truantStudent.addAll(otherStudent);
         truantStudent.addAll(leaveStudent);
         if (!CollectionUtils.isEmpty(truantStudent)) {
+            CourseSchedule schedule = courseScheduleDao.get(courseScheduleId);
+            if(schedule.getGroupType() == MUSIC){
+                Set<Long> collect = truantStudent.stream().map(e -> e.getStudentId()).collect(Collectors.toSet());
+                Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect,schedule.getMusicGroupId()));
+                truantStudent.forEach(studentAttendanceViewDto -> {
+                    studentAttendanceViewDto.setPaymentStatus(paymentStatusMap.get(studentAttendanceViewDto.getStudentId().intValue()));
+                });
+            }
             List<StudentAttendanceViewDto> tempIds = truantStudent.stream()
                     .filter(studentAttendanceViewDto -> studentAttendanceViewDto.getGroupType().equals("MUSIC"))
                     .collect(Collectors.toList());
@@ -1648,6 +1611,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
         String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
 
+        if(classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
+            teachMode = TeachModeEnum.ONLINE;
+            List<String> studentNames = studentDao.getStudentNames(studentIdList);
+            classGroup4MixDtos.get(0).setClassGroupName(subjectNames + "•" + StringUtils.join(studentNames, ","));
+        }
+
         if (classGroup4MixDtos.get(0).getType() == null) {
             classGroup4MixDtos.get(0).setType(ClassGroupTypeEnum.NORMAL);
         }
@@ -1660,7 +1629,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroup.setStudentNum(studentList.size());
         classGroup.setType(classGroup4MixDtos.get(0).getType());
         classGroup.setDelFlag(0);
-        classGroup.setGroupType(GroupType.MUSIC);
+        classGroup.setGroupType(MUSIC);
         classGroup.setCurrentClassTimes(0);
         classGroup.setTotalClassTimes(classGroup4MixDtos.get(0).getCourseTimes());
         classGroup.setCreateTime(date);
@@ -1683,7 +1652,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setUserId(studentRegistration.getUserId());
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+            classGroupStudentMapper.setGroupType(MUSIC);
             classGroupStudentMapperList.add(classGroupStudentMapper);
 
             userIds.add(studentRegistration.getUserId());
@@ -1789,10 +1758,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseSchedule.setUpdateTime(date);
                     courseSchedule.setTeachMode(teachMode);
                     courseSchedule.setType(classGroup4MixDto.getCourseType());
-                    courseSchedule.setGroupType(GroupType.MUSIC);
+                    courseSchedule.setGroupType(MUSIC);
                     courseSchedule.setOrganId(musicGroup.getOrganId());
                     if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
                         courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
+                    }else if(classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)){
+                        courseSchedule.setName(classGroup.getName());
                     } else {
                         courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
                     }
@@ -2079,7 +2050,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     } else {
                         courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
                     }
-                    courseSchedule.setGroupType(GroupType.MUSIC);
+                    courseSchedule.setGroupType(MUSIC);
                     courseSchedule.setTeacherId(teacherId);
                     courseSchedule.setActualTeacherId(teacherId);
                     courseSchedule.setOrganId(musicGroup.getOrganId());
@@ -2244,7 +2215,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroup.setExpectStudentNum(studentList.size());
         classGroup.setStudentNum(studentList.size());
         classGroup.setType(ClassGroupTypeEnum.SNAP);
-        classGroup.setGroupType(GroupType.MUSIC);
+        classGroup.setGroupType(MUSIC);
         classGroup.setDelFlag(0);
         classGroup.setTotalClassTimes(classGroup4MixDtos.get(0).getCourseTimes());
         classGroup.setCurrentClassTimes(0);
@@ -2263,7 +2234,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setUserId(studentRegistration.getUserId());
             classGroupStudentMapper.setCreateTime(date);
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-            classGroupStudentMapper.setGroupType(GroupType.MUSIC);
+            classGroupStudentMapper.setGroupType(MUSIC);
             classGroupStudentMapperList.add(classGroupStudentMapper);
             userIds.add(studentRegistration.getUserId());
         }
@@ -2365,7 +2336,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseSchedule.setUpdateTime(date);
                     courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
                     courseSchedule.setType(classGroup4MixDto.getCourseType());
-                    courseSchedule.setGroupType(GroupType.MUSIC);
+                    courseSchedule.setGroupType(MUSIC);
                     courseSchedule.setMusicGroupId(classGroup.getMusicGroupId());
                     if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
                         courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
@@ -2795,7 +2766,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public Boolean checkSetSalary(String musicGroupId) {
-        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalary = courseScheduleTeacherSalaryDao.findCourseScheduleTeacherSalaryByMusicGroupId(musicGroupId, GroupType.MUSIC);
+        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalary = courseScheduleTeacherSalaryDao.findCourseScheduleTeacherSalaryByMusicGroupId(musicGroupId, MUSIC);
         if (courseScheduleTeacherSalary != null && courseScheduleTeacherSalary.size() > 0) {
             return true;
         }
@@ -3094,7 +3065,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if (classGroup != null) {
             classGroup.setViewGroupName(classGroup.getName());
             classGroup.setName(StringUtils.isEmpty(classGroup.getGroupName()) ? classGroup.getName() : classGroup.getGroupName());
-            if (classGroup.getGroupType() == GroupType.MUSIC) {
+            if (classGroup.getGroupType() == MUSIC) {
                 MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
                 if (musicGroup != null) {
                     classGroup.setMusicGroupName(musicGroup.getName());

+ 48 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.entity.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -17,15 +18,6 @@ import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
 import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
 import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dto.ClassGroupStudentInfoDto;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupRelation;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
@@ -363,6 +355,13 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         if(Objects.isNull(classGroup)){
             throw new BizException("班级信息错误");
         }
+
+        if(ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())){
+            String subjectName = classGroup.getName().split("•")[0];
+            List<String> studentNames = studentDao.getStudentNames(new ArrayList<>(studentIds));
+            classGroup.setName(subjectName + "•" + studentNames);
+        }
+
         List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findAllByClassGroup(classGroupId);
 
         Set<Integer> allStudentIds = new HashSet<>();
@@ -428,8 +427,48 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
             return;
         }
 
+        if(ClassGroupTypeEnum.MUSIC_NETWORK.equals(classGroup.getType())){
+            for (CourseSchedule courseSchedule : classGroupNotStartCourse) {
+                courseSchedule.setName(classGroup.getName());
+            }
+            courseScheduleDao.batchUpdate(classGroupNotStartCourse);
+        }
+
         List<Long> courseIds = classGroupNotStartCourse.stream().map(CourseSchedule::getId).collect(Collectors.toList());
 
+        //4、调整未上课课酬
+        List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroupId.intValue());
+        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) && classGroupNotStartCourse.size() > 0) {
+            Date nowDate = new Date();
+            List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
+            List<Long> courseScheduleIds = classGroupNotStartCourse.stream().map(CourseSchedule::getId).collect(Collectors.toList());
+            courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
+            for (CourseSchedule courseSchedule : classGroupNotStartCourse) {
+                for (ClassGroupTeacherMapper classGroupTeacher : classGroupTeachers) {
+                    List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacher.getUserId(), ClassGroupTypeEnum.HIGH_ONLINE.getCode(), null);
+                    if (teacherSalaryList == null || teacherSalaryList.size() == 0) {
+                        throw new BizException("请设置老师线上网管课课酬");
+                    }
+                    Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
+                    TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(courseSchedule.getType());
+                    BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentIds.size()+"");
+
+                    CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
+                    courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleTeacherSalary.setGroupType(courseSchedule.getGroupType());
+                    courseScheduleTeacherSalary.setMusicGroupId(courseSchedule.getMusicGroupId());
+                    courseScheduleTeacherSalary.setTeacherRole(classGroupTeacher.getTeacherRole());
+                    courseScheduleTeacherSalary.setUserId(classGroupTeacher.getUserId());
+                    courseScheduleTeacherSalary.setExpectSalary(salary);
+                    courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
+                    courseScheduleTeacherSalary.setCreateTime(nowDate);
+                    courseScheduleTeacherSalary.setUpdateTime(nowDate);
+                    courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
+                }
+            }
+            courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
+        }
+
         if(!CollectionUtils.isEmpty(removeStudentIds)){
             courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, new ArrayList<>(removeStudentIds));
             List<ImGroupMember> imGroupMemberList = new ArrayList<>();

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

@@ -46,7 +46,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	@Autowired
 	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
 	@Autowired
-	private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+	private VipGroupDefaultClassesUnitPriceDao vipGroupDefaultClassesUnitPriceDao;
 	@Autowired
 	private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
 	@Autowired
@@ -65,6 +65,11 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			throw new BizException("未找到相关vip课程");
 		}
 
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroupId);
+		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
+			throw new BizException("课程单价设置错误");
+		}
+
 		//获取活动信息
 		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroupApplyBaseInfoDto.getVipGroupActivityId().intValue());
 
@@ -121,7 +126,6 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 						default:
 							throw new BizException("活动类型错误!");
 					}
-                    courseScheduleStudentPayment.setOriginalPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
 				}else{
 					//学生线下单节课应缴费计算
 					switch (vipGroupActivity.getType()) {
@@ -147,7 +151,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 							throw new BizException("活动类型错误!");
 					}
 				}
-                courseScheduleStudentPayment.setOriginalPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
+                courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(teachModeEnum)?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
 				courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
 				courseScheduleStudentPayments.add(courseScheduleStudentPayment);
 			}
@@ -396,15 +400,18 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 			//学员总缴费金额
 			BigDecimal totalActualAmount = musicGroupPaymentCalenderDetails.stream().map(e -> Objects.isNull(e.getActualAmount())?BigDecimal.ZERO:e.getActualAmount()).reduce(BigDecimal.ZERO, BigDecimal::add);
 
-			for (CourseScheduleStudentPayment courseScheduleStudentPayment : studentStudentPaymentMapEntry.getValue()) {
-				if(totalActualAmount.compareTo(courseScheduleStudentPayment.getExpectPrice())>=0){
-					courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
-					totalActualAmount=totalActualAmount.subtract(courseScheduleStudentPayment.getExpectPrice());
+			for(int i=0;i<studentStudentPaymentMapEntry.getValue().size();i++){
+				if(totalActualAmount.compareTo(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice())>=0){
+					studentStudentPaymentMapEntry.getValue().get(i).setActualPrice(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice());
+					totalActualAmount=totalActualAmount.subtract(studentStudentPaymentMapEntry.getValue().get(i).getExpectPrice());
 				}else{
-					courseScheduleStudentPayment.setActualPrice(totalActualAmount);
+					studentStudentPaymentMapEntry.getValue().get(i).setActualPrice(totalActualAmount);
 					totalActualAmount=BigDecimal.ZERO;
 				}
-				updateStudentPayments.add(courseScheduleStudentPayment);
+				updateStudentPayments.add(studentStudentPaymentMapEntry.getValue().get(i));
+				if(i==studentStudentPaymentMapEntry.getValue().size()-1){
+					studentStudentPaymentMapEntry.getValue().get(0).setActualPrice(studentStudentPaymentMapEntry.getValue().get(0).getExpectPrice().add(totalActualAmount));
+				}
 			}
 		}
 

+ 15 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentCalenderStatus
 import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.service.MusicGroupPaymentCalenderDetailService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysMessageService;
 import com.ym.mec.common.dal.BaseDAO;
@@ -31,8 +32,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	
 	@Autowired
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
+//	@Autowired
+//	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	@Autowired
-	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
+	private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
 	
 	@Autowired
 	private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
@@ -66,7 +69,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 			throw new BizException("缴费记录不存在");
 		}
 		Date date = new Date();
-		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(calenderDetails.get(0).getMusicGroupPaymentCalenderId());
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderDetails.get(0).getMusicGroupPaymentCalenderId());
 		Set<Integer> studentIds = new HashSet<>();
 				calenderDetails.forEach(e->{
 			if(e.getPaymentStatus() == null || e.getPaymentStatus() != NON_PAYMENT){
@@ -124,12 +127,12 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		//获取可开启缴费列表
 		List<MusicGroupPaymentCalenderDetail> calenderDetails = musicGroupPaymentCalenderDetailDao.queryCanOpenList(ids);
 		if(calenderDetails.size() == 0){
-			return "操作失败,没有可以开启缴费的学员";
+			return "操作失败:所选学员已开启缴费,或已完成缴费";
 		}
 		int length = ids.split(",").length;
 		Date date = new Date();
 		Long calenderId = calenderDetails.get(0).getMusicGroupPaymentCalenderId();
-		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(calenderId);
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(calenderId);
 		calenderDetails.forEach(e->{
 			e.setUpdateTime(date);
 			e.setOpen(1);
@@ -173,7 +176,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(musicGroupPaymentCalenderId == null || userId == null){
 			throw new BizException("参数校验异常");
 		}
-		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderService.get(musicGroupPaymentCalenderId);
 		if(calender == null){
 			throw new BizException("缴费信息不存在");
 		}
@@ -195,7 +198,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		Date date = new Date();
 		calender.setUpdateTime(date);
 		calender.setExpectNum(calender.getExpectNum() + 1);
-		musicGroupPaymentCalenderDao.update(calender);
+		musicGroupPaymentCalenderService.update(calender);
 		//生成详情
 		musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
 		musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(calender.getId());
@@ -234,7 +237,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 	@Transactional(rollbackFor = Exception.class)
 	public void batchAdd(Long musicGroupPaymentCalenderId, List<Integer> userIdList) {
 		
-		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(musicGroupPaymentCalenderId);
+		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderService.get(musicGroupPaymentCalenderId);
 		if(musicGroupPaymentCalender == null){
 			throw new BizException("查询缴费信息失败");
 		}
@@ -281,7 +284,7 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		//更新预计缴费人数
 		musicGroupPaymentCalender.setExpectNum(musicGroupPaymentCalender.getExpectNum() + userIdList.size());
 		musicGroupPaymentCalender.setUpdateTime(date);
-		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+		musicGroupPaymentCalenderService.update(musicGroupPaymentCalender);
 		
 		List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = new ArrayList<MusicGroupPaymentStudentCourseDetail>();
 		MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail = null;
@@ -308,6 +311,10 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 		if(musicGroupPaymentStudentCourseDetailList.size() > 0){
 			musicGroupPaymentStudentCourseDetailDao.batchInsert(musicGroupPaymentStudentCourseDetailList);
 		}
+		//给学员推送缴费通知
+		if(musicGroupPaymentCalender.getStatus() == PaymentCalenderStatusEnum.OPEN){
+			musicGroupPaymentCalenderService.pushWaitRenewMessage(musicGroupPaymentCalenderId,musicGroupDao.get(musicGroupPaymentCalender.getMusicGroupId()));
+		}
 	}
 
 	@Override

+ 42 - 102
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -29,6 +29,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.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -41,6 +42,7 @@ import java.util.Map.Entry;
 import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.SCHOOL;
+import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PayUserType.STUDENT;
 import static com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender.PaymentType.*;
 
 @Service
@@ -191,9 +193,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			}else {
 				musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.NO);
 			}
-			
 			//如果是进行中加学生
 			if (musicGroupPaymentCalender.getPaymentType() == PaymentType.ADD_STUDENT) {
+				musicGroupPaymentCalender.setPayUserType(STUDENT);
+				musicGroupPaymentCalender.setIsGiveMusicNetwork(false);
+				musicGroupPaymentCalender.setExpectNum(1);
 				addStudent(musicGroupPaymentCalender,musicGroupPaymentCalenderCourseSettingsList);
 			}
 		}else {
@@ -416,6 +420,25 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		return musicGroupPaymentCalender.getId();
 	}
 
+	@Override
+	public boolean makesureSchoolePaid(Long id, String memo) {
+		MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.get(id);
+		if(musicGroupPaymentCalender == null){
+			throw new BizException("查询缴费信息失败");
+		}
+		
+		if(musicGroupPaymentCalender.getPayUserType() != PayUserType.SCHOOL){
+			throw new BizException("只有学校缴费才能确认缴费状态");
+		}
+		
+		musicGroupPaymentCalender.setStatus(PaymentCalenderStatusEnum.PAID);
+		musicGroupPaymentCalender.setMemo(memo);
+		musicGroupPaymentCalender.setUpdateTime(new Date());
+		musicGroupPaymentCalenderDao.update(musicGroupPaymentCalender);
+		
+		return true;
+	}
+
 	public void addStudent(MusicGroupPaymentCalender musicGroupPaymentCalender,List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList){
 		//如果是进行中加学生
 		Date date = new Date();
@@ -635,28 +658,25 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 	}
 
-	@Override
-	@Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
-	public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
-		// 获取当天创建且未缴费的数据,并推送
-		List<MusicGroupPaymentCalenderDetail> details = musicGroupPaymentCalenderDetailDao.queryNoPaymentCanPushList();
-		if (details != null && details.size() > 0) {
-			Set<String> musicGroupIds = details.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toSet());
-			Map<String, String> musicGroupNameMap = MapUtil.convertMybatisMap(musicGroupDao.queryMusicGroupNameMap(musicGroupIds));
-			for (MusicGroupPaymentCalenderDetail detail : details) {
-				if (detail.getExpectAmount().doubleValue() == 0) {
-					continue;
-				}
-				Map<Integer, String> push = new HashMap<>(1);
-				push.put(detail.getUserId(), detail.getUserId() + "");
-				String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-				String memo = "4?" + baseUrl + "/#/renew?musicGroupId=" + detail.getMusicGroupId();
-				// 发送续费通知
-				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
-						null, 0, memo, "STUDENT", musicGroupNameMap.get(detail.getMusicGroupId()));
+	//推送待续费通知
+	public void pushWaitRenewMessage(Long calenderId,MusicGroup musicGroup){
+		Set<Integer> studentIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentStudentIds(calenderId);
+		if (studentIds.size() > 0) {
+			Map<Integer, String> push = new HashMap<>();
+			for (Integer userId : studentIds) {
+				push.put(userId, userId + "");
 			}
+			String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+			String memo = "4?" + baseUrl + "/#/renew?musicGroupId=" + musicGroup.getId();
+			// 发送续费通知
+			sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
+					null, 0, memo, "STUDENT", musicGroup.getName());
 		}
+	}
 
+    @Override
+	@Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
+	public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
 		Date date = new Date();
 		List<PaymentStatusEnum> statusList = new ArrayList<PaymentStatusEnum>();
 		statusList.add(PaymentStatusEnum.NO);
@@ -664,48 +684,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.queryByPaymentStatus(statusList,PayUserType.STUDENT.getCode());
 
 		List<MusicGroupPaymentCalender> updateMusicGroupPaymentCalenderList = new ArrayList<MusicGroupPaymentCalender>();
-
-		MusicGroupPaymentCalenderDetail musicGroupPaymentCalenderDetail = null;
-		MusicGroupStudentFee musicGroupStudentFee = null;
-		List<MusicGroupStudentFee> updateMusicGroupStudentFeeList = new ArrayList<MusicGroupStudentFee>();
-		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
-		List<MusicGroupPaymentCalenderDetail> updateMusicGroupPaymentCalenderDetailList = new ArrayList<MusicGroupPaymentCalenderDetail>();
-
 		for (MusicGroupPaymentCalender mgpc : musicGroupPaymentCalenderList) {
-			Set<Integer> studentIds = musicGroupPaymentCalenderDetailDao.queryStudentIds(mgpc.getId());
-			List<MusicGroupStudentFee> musicGroupStudentFeeList = musicGroupStudentFeeDao.queryByMusicGroupId(mgpc.getMusicGroupId(),
-					StringUtils.join(studentIds, ","));
-			Map<Integer, MusicGroupStudentFee> feeMap = musicGroupStudentFeeList.stream()
-					.collect(Collectors.toMap(MusicGroupStudentFee::getUserId, fee -> fee));
-
 			if (mgpc.getDeadlinePaymentDate() != null && date.after(mgpc.getDeadlinePaymentDate()) && mgpc.getStatus() == PaymentCalenderStatusEnum.OPEN) {
 				// “进行中”更新至“已结束”
 				mgpc.setUpdateTime(date);
 				mgpc.setStatus(PaymentCalenderStatusEnum.OVER);
 				updateMusicGroupPaymentCalenderList.add(mgpc);
 
-				// 0元学生改成“已缴费”
-				List<MusicGroupPaymentCalenderDetail> list = musicGroupPaymentCalenderDetailDao.queryByCalenderId(mgpc.getId(),PaymentStatus.NON_PAYMENT.getCode());
-				for (MusicGroupPaymentCalenderDetail mgpcd : list) {
-					if (mgpcd.getExpectAmount().doubleValue() == 0) {
-						mgpcd.setActualAmount(BigDecimal.ZERO);
-						mgpcd.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
-						mgpcd.setUpdateTime(date);
-						updateMusicGroupPaymentCalenderDetailList.add(mgpcd);
-
-						// 更新fee表,且加1
-						musicGroupStudentFee = feeMap.get(mgpcd.getUserId());
-						if (musicGroupStudentFee != null) {
-							musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
-							musicGroupStudentFee.setUpdateTime(date);
-							if(mgpc.getIsGiveMusicNetwork()){
-								musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getContinuousAbsenteeismTimes() + 1);
-							}
-							updateMusicGroupStudentFeeList.add(musicGroupStudentFee);
-						}
-					}
-				}
-
 			} else if (mgpc.getStartPaymentDate() != null && date.after(mgpc.getStartPaymentDate()) && mgpc.getStatus() == PaymentCalenderStatusEnum.NO) {
 				MusicGroup musicGroup = musicGroupDao.get(mgpc.getMusicGroupId());
 				//如果乐团还在审核中
@@ -716,58 +701,13 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 				mgpc.setUpdateTime(date);
 				mgpc.setStatus(PaymentCalenderStatusEnum.OPEN);
 				updateMusicGroupPaymentCalenderList.add(mgpc);
-
-				// 学生状态更新进行中
-				// Set<Integer> studentIds = new HashSet<Integer>();
-				// 创建缴费明细
-				/*
-				 * for (MusicGroupStudentFee mgsf : musicGroupStudentFeeList) { if (mgsf.getPaymentStatus() != PaymentStatus.PAID_COMPLETED) {
-				 * continue; } musicGroupPaymentCalenderDetail = new MusicGroupPaymentCalenderDetail();
-				 * musicGroupPaymentCalenderDetail.setMusicGroupPaymentCalenderId(mgpc.getId()); musicGroupPaymentCalenderDetail.setCreateTime(date);
-				 * musicGroupPaymentCalenderDetail.setExpectAmount(mgsf.getCourseFee());
-				 * musicGroupPaymentCalenderDetail.setPaymentStatus(PaymentStatus.NON_PAYMENT); if (mgsf.getCourseFee().doubleValue() != 0) {
-				 * studentIds.add(mgsf.getUserId()); } musicGroupPaymentCalenderDetail.setUpdateTime(date);
-				 * musicGroupPaymentCalenderDetail.setUserId(mgsf.getUserId());
-				 * 
-				 * musicGroupPaymentCalenderDetailList.add(musicGroupPaymentCalenderDetail); }
-				 */
-
-				// 更新学员缴费状态
-				for (MusicGroupStudentFee mgsf : musicGroupStudentFeeList) {
-					mgsf.setPaymentStatus(PaymentStatus.NON_PAYMENT);
-					mgsf.setUpdateTime(date);
-					updateMusicGroupStudentFeeList.add(mgsf);
-				}
-				if (studentIds.size() > 0) {
-					Map<Integer, String> push = new HashMap<>();
-					for (Integer userId : studentIds) {
-						push.put(userId, userId + "");
-					}
-					String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-					String memo = "4?" + baseUrl + "/#/renew?musicGroupId=" + musicGroup.getId();
-					// 发送续费通知
-					sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_WAIT_RENEW_MESSAGE, push,
-							null, 0, memo, "STUDENT", musicGroup.getName());
-				}
+				//推送待续费通知
+				pushWaitRenewMessage(mgpc.getId(),musicGroup);
 			}
 		}
-
 		if (updateMusicGroupPaymentCalenderList.size() > 0) {
 			musicGroupPaymentCalenderDao.batchUpdate(updateMusicGroupPaymentCalenderList);
 		}
-
-		if (musicGroupPaymentCalenderDetailList.size() > 0) {
-			musicGroupPaymentCalenderDetailDao.batchInsert(musicGroupPaymentCalenderDetailList);
-		}
-
-		if (updateMusicGroupStudentFeeList.size() > 0) {
-			musicGroupStudentFeeDao.batchUpdate(updateMusicGroupStudentFeeList);
-		}
-
-		if (updateMusicGroupPaymentCalenderDetailList.size() > 0) {
-			musicGroupPaymentCalenderDetailDao.batchUpdate(updateMusicGroupPaymentCalenderDetailList);
-		}
-
 		return true;
 	}
 

+ 63 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -157,6 +157,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
     @Autowired
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
+    @Autowired
+    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
 
     private SimpleDateFormat sdf_ymd = new SimpleDateFormat("yyyy-MM-dd");
 
@@ -447,7 +451,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
         if (studentRegistration.getTemporaryCourseFee() != null) {
-            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(),studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
+            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
             for (StudentPaymentOrderDetail orderDetail : orderDetails) {
                 if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
                     continue;
@@ -665,7 +669,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //乐器及打包辅件
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
         if (studentRegistration.getTemporaryCourseFee() != null) {
-            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(),studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
+            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.findUserApplyOrder(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
             for (StudentPaymentOrderDetail orderDetail : orderDetails) {
                 if (orderDetail == null || orderDetail.getPrice() == null || orderDetail.getGoodsIdList() == null) {
                     continue;
@@ -1125,24 +1129,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         return musicGroupDao.queryOrganMusicInfos(organId);
     }
 
-//    @Override
-//    public void musicGroupStudentFeePatch(List<String> musicGroupIds) {
-//        if(musicGroupIds != null && musicGroupIds.size() > 0){
-//            List<MusicGroupStudentFee> musicGroupStudentFees = null;
-//            for (String musicGroupId: musicGroupIds) {
-//                musicGroupStudentFees = musicGroupStudentFeeDao.initMusicGroupStudentFee(musicGroupId);
-//                if(musicGroupStudentFees != null && musicGroupStudentFees.size() > 0){
-//                    musicGroupStudentFeeDao.batchInsert(musicGroupStudentFees,musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, null,null),"PAID_COMPLETED");
-//                }
-//            }
-//        }
-//    }
-
     @Override
     public List<MusicCardDto> queryUserMusicGroups(Integer userId) {
         List<MusicCardDto> musicCardDtos = musicGroupDao.queryUserMusicGroups(userId);
         Set<String> musicGroupIds = musicCardDtos.stream().map(MusicCardDto::getMusicGroupId).collect(Collectors.toSet());
-//        Map<String, String> paymentStatus = MapUtil.convertMybatisMap(musicGroupStudentFeeDao.queryUserPaymentStatus(userId, StringUtils.join(musicGroupIds, ",")));
         Map<String, String> paymentStatus = MapUtil.convertMybatisMap(musicGroupPaymentCalenderDao.queryUserPaymentStatus(userId, StringUtils.join(musicGroupIds, ",")));
         // 获取学员在该乐团续费状态
         musicCardDtos.forEach(e -> {
@@ -1515,6 +1505,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
             studentRegistrationDao.update(studentRegistration);
 
+            //删除用户购买的课程记录
+            musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+
             BigDecimal amount = new BigDecimal(0);
 
             // 判断乐器是否是租赁
@@ -1529,6 +1522,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
             List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
 
+            Set<String> courseTypeSet = new HashSet<>();
+            if (isRefundCourseFee) {
+                List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(studentRegistration.getMusicGroupId());
+                courseTypeSet = courseSettings.stream().map(e -> e.getCourseType().getCode()).collect(Collectors.toSet());
+            }
+
+            SubjectChange studentLastChange = null;
+            if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
+                studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
+            }
+
             BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
             for (StudentPaymentOrderDetail detail : orderDetailList) {
                 if (remitFee.compareTo(detail.getPrice()) >= 0) {
@@ -1541,24 +1545,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
                 if (isRefundCourseFee) {
                     // 退课程费用
-                    if (detail.getType() == OrderDetailTypeEnum.COURSE) {
+                    if (courseTypeSet.contains(detail.getType().getCode())) {
                         amount = amount.add(detail.getPrice());
                     }
                 }
-                if (isRefundInstrumentFee) {
+                if (isRefundInstrumentFee && studentLastChange == null) {
                     // 退乐器费用
                     if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
                         amount = amount.add(detail.getPrice());
                     }
 
                 }
-                if (isRefundTeachingAssistantsFee) {
+                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 (amount.doubleValue() > 0) {
                 // 增加交易流水
                 sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
@@ -1618,6 +1625,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         studentRegistrationDao.update(studentRegistration);
 
+        //删除用户购买的课程记录
+        musicGroupPaymentStudentCourseDetailDao.deleteByUserIdAndMusicGroupId(userId, musicGroupId);
+
         BigDecimal amount = new BigDecimal(0);
 
         // 判断乐器是否是租赁
@@ -1630,6 +1640,18 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         }
 
         List<StudentPaymentOrderDetail> orderDetailList = studentPaymentOrderDetailDao.findApplyOrderGoods(studentPaymentOrder.getId());
+
+        Set<String> courseTypeSet = new HashSet<>();
+        if (isRefundCourseFee) {
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.getMusicGroupRegCalenderCourseSettings(studentRegistration.getMusicGroupId());
+            courseTypeSet = courseSettings.stream().map(e -> e.getCourseType().getCode()).collect(Collectors.toSet());
+        }
+
+        SubjectChange studentLastChange = null;
+        if (isRefundInstrumentFee || isRefundTeachingAssistantsFee) {
+            studentLastChange = subjectChangeDao.getStudentLastChange(userId, musicGroupId);
+        }
+
         BigDecimal remitFee = studentPaymentOrder.getRemitFee() == null ? BigDecimal.ZERO : studentPaymentOrder.getRemitFee();
 
         for (StudentPaymentOrderDetail detail : orderDetailList) {
@@ -1642,24 +1664,27 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             }
             if (isRefundCourseFee) {
                 // 退课程费用
-                if (detail.getType() == OrderDetailTypeEnum.COURSE) {
+                if (courseTypeSet.contains(detail.getType().getCode())) {
                     amount = amount.add(detail.getPrice());
                 }
             }
-            if (isRefundInstrumentFee) {
+            if (isRefundInstrumentFee && studentLastChange == null) {
                 // 退乐器费用
                 if (detail.getType() == OrderDetailTypeEnum.MUSICAL) {
                     amount = amount.add(detail.getPrice());
                 }
 
             }
-            if (isRefundTeachingAssistantsFee) {
+            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 (amount.doubleValue() > 0) {
             // 增加交易流水
             sysUserCashAccountDetailService.addCashAccountDetail(userId, amount, SysUserCashAccountDetailService.MUSIC_GROUP + musicGroupId, "",
@@ -1714,7 +1739,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         calenderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         musicGroupPaymentCalenderDetailDao.update(calenderDetail);
 
-        ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
+        /*ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
         studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
         studentPaymentOrderDetail.setPrice(amount);
@@ -1723,7 +1748,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
         studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
 
-        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);*/
 
         BigDecimal balance = BigDecimal.ZERO;
         if (isUseBalancePayment || amount.doubleValue() == 0) {
@@ -1812,7 +1837,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             //当前乐团报名是否赠送乐团网管课
             MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByOrderId(studentPaymentOrder.getId());
             MusicGroupStudentFee musicGroupStudentFee = musicGroupPaymentCalenderService.updateCalender(calenderDetail.getId(), studentRegistration.getUserId());
-
             musicGroupStudentFee.setUpdateTime(date);
             musicGroupStudentFee.setLatestPaidTime(date);
             musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
@@ -1843,6 +1867,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount());
             sysUserCashAccountDetailService.insert(rechargeDetail);
 
+            List<MusicGroupPaymentCalenderCourseSettings> courseSettings = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(calenderDetail.getMusicGroupPaymentCalenderId());
+            List<StudentPaymentOrderDetail> paymentOrderDetails = new ArrayList<>();
+            courseSettings.forEach(e -> {
+                StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetail.setType(OrderDetailTypeEnum.valueOf(e.getCourseType().getCode()));
+                studentPaymentOrderDetail.setPrice(e.getCourseCurrentPrice());
+                studentPaymentOrderDetail.setCreateTime(date);
+                studentPaymentOrderDetail.setUpdateTime(date);
+                studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+                paymentOrderDetails.add(studentPaymentOrderDetail);
+            });
+            studentPaymentOrderDetailService.batchAdd(paymentOrderDetails);
+
             //缴费
             SysUserCashAccountDetail paymentDetail = new SysUserCashAccountDetail();
             paymentDetail.setAmount(amount.negate());
@@ -2209,6 +2246,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         MusicGroupPaymentCalender regCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
         if (regCalender != null && regCalender.getPayUserType().equals(MusicGroupPaymentCalender.PayUserType.STUDENT)) {
             regCalender.setStatus(MusicGroupPaymentCalender.PaymentCalenderStatusEnum.OPEN);
+            regCalender.setDeadlinePaymentDate(DateUtil.toDate(expireDate));
             regCalender.setUpdateTime(new Date());
             musicGroupPaymentCalenderDao.update(regCalender);
         }

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

@@ -182,7 +182,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         //乐团乐器及辅件信息
         List<MusicGroupSubjectGoodsGroup> goodsGroups = new ArrayList<>();
 
-        List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.findUserApplyOrder(studentRegistration.getUserId(),musicGroupId, DealStatusEnum.WAIT_PAY);
+        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;
@@ -232,13 +232,13 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
         }
 
         ChargeTypeSubjectMapper subjectDiscount = chargeTypeSubjectMapperDao.getSubjectDiscount(chargeTypeId, subjectId);
-        if (subjectDiscount == null || subjectDiscount.getGoodsDiscountRate() == null) {
+        if (subjectDiscount == null || subjectDiscount.getGoodsDiscountRate() == null || subjectDiscount.getGoodsDiscountRate().compareTo(new BigDecimal(100)) == 0) {
             return goodsList;
         }
         for (MusicGroupGoodsAndDiscountDto musicGroupGoodsAndDiscountDto : goodsList) {
             if (musicGroupGoodsAndDiscountDto.getType() != null && musicGroupGoodsAndDiscountDto.getType().equals(GoodsType.INSTRUMENT)) {
                 musicGroupGoodsAndDiscountDto.setDiscountRate(subjectDiscount.getGoodsDiscountRate());
-                musicGroupGoodsAndDiscountDto.setGroupPurchasePrice(musicGroupGoodsAndDiscountDto.getGroupPurchasePrice().multiply(subjectDiscount.getGoodsDiscountRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
+                musicGroupGoodsAndDiscountDto.setGroupPurchasePrice(musicGroupGoodsAndDiscountDto.getDiscountPrice().multiply(subjectDiscount.getGoodsDiscountRate()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP));
             }
         }
         return goodsList;

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

@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.dto.RouteScaleDto;
 import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.entity.SysAccount;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.enums.FeeTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelTypeEnum;
 import com.ym.mec.biz.service.*;
@@ -41,6 +42,8 @@ public class PayServiceImpl implements PayService {
     private SysPaymentConfigService sysPaymentConfigService;
     @Autowired
     private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
+    @Autowired
+    private SellOrderService sellOrderService;
 
     @Override
     public Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer organId, String receiver) throws Exception {
@@ -51,6 +54,11 @@ public class PayServiceImpl implements PayService {
             routeScaleDtos = noUsePaymentConfig(amount);
         }
 
+        //根据费用类型
+        if(routeScaleDtos == null){
+            routeScaleDtos = getTypeRouteChannel(organId, orderNo, amount);
+        }
+
         //根据金额获取分润
         if (routeScaleDtos == null) {
             routeScaleDtos = getAmountChannel(organId, amount, receiver);
@@ -364,4 +372,58 @@ public class PayServiceImpl implements PayService {
         return unionPay;
     }
 
+    /**
+     * @param organId
+     * @param orderNo
+     * @param amount
+     * @return
+     */
+    private List<RouteScaleDto> getTypeRouteChannel(Integer organId, String orderNo, BigDecimal amount) {
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
+        if (paymentConfig == null || StringUtils.isBlank(paymentConfig.getTypeRouteScale())) {
+            return null;
+        }
+
+        String typeRouteScale = paymentConfig.getTypeRouteScale();
+        List<RouteScaleDto> routeScaleDtos = JSON.parseArray(typeRouteScale, RouteScaleDto.class);
+        List<Integer> organIds = routeScaleDtos.stream().map(RouteScaleDto::getOrganId).collect(Collectors.toList());
+        List<SysPaymentConfig> paymentConfigByOrganIds = sysPaymentConfigService.findPaymentConfigByOrganIds(organIds);
+
+        BigDecimal sellActualAmount = sellOrderService.getSellActualAmount(orderNo);
+        if (sellActualAmount == null) {
+            return null;
+        }
+
+        Iterator<RouteScaleDto> iterator = routeScaleDtos.iterator();
+        boolean hasFeeFlag = false;
+        while (iterator.hasNext()) {
+            RouteScaleDto routeScaleDto = iterator.next();
+            routeScaleDto.setPayType(paymentConfig.getPayType());
+            if (routeScaleDto.getFeeType().equals(FeeTypeEnum.SELL)) {
+                routeScaleDto.setAmount(sellActualAmount);
+            } else {
+                routeScaleDto.setAmount(amount.subtract(sellActualAmount));
+            }
+
+            if (routeScaleDto.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
+                iterator.remove();
+                continue;
+            }
+            if (!hasFeeFlag && routeScaleDto.getAmount().compareTo(amount.divide(new BigDecimal(2), 2, BigDecimal.ROUND_DOWN)) >= 0) {
+                routeScaleDto.setFeeFlag("Y");
+                hasFeeFlag = true;
+            }
+
+            for (SysPaymentConfig paymentConfigByOrganId : paymentConfigByOrganIds) {
+                if (!paymentConfigByOrganId.getOrganId().equals(routeScaleDto.getOrganId())) continue;
+                if (paymentConfig.getPayType().equals(PaymentChannelEnum.YQPAY)) {
+                    routeScaleDto.setMerNo(paymentConfigByOrganId.getYqMerNo());
+                } else {
+                    routeScaleDto.setMerNo(paymentConfigByOrganId.getHfMerNo());
+                }
+            }
+        }
+        return routeScaleDtos;
+    }
+
 }

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

@@ -1,10 +1,8 @@
 package com.ym.mec.biz.service.impl;
 
 
-import com.ym.mec.biz.dal.dao.GoodsDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.SellOrderDao;
-import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.alibaba.fastjson.JSONObject;
+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.service.*;
@@ -36,6 +34,12 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
     private SysUserCashAccountService sysUserCashAccountService;
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Autowired
+    private SporadicChargeInfoDao sporadicChargeInfoDao;
+    @Autowired
+    private StudentRepairDao studentRepairDao;
 
     @Override
     public BaseDAO<Integer, SellOrder> getDAO() {
@@ -338,4 +342,69 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         return sellOrderDao.getRefundSellOrder(orderId);
     }
 
+    @Override
+    public BigDecimal getSellActualAmount(String orderNo) {
+        StudentPaymentOrder order = studentPaymentOrderDao.findOrderByOrderNo(orderNo);
+        if (order == null) {
+            return null;
+        }
+
+        //零星支付除了充值其他都是服务费用
+        if (order.getType().equals(OrderTypeEnum.SPORADIC)) {
+            SporadicChargeInfo info = sporadicChargeInfoDao.get(Integer.parseInt(order.getMusicGroupId()));
+            if (info.getChargeType().equals(SporadicChargeTypeEnum.RECHARGE)) {
+                return null;
+            }
+        }
+        //乐器销售,声部更改
+        if (order.getType().equals(OrderTypeEnum.GOODS_SELL) || order.getType().equals(OrderTypeEnum.SUBJECT_CHANGE)) {
+            return order.getActualAmount();
+        }
+
+        //乐器维修
+        if (order.getType().equals(OrderTypeEnum.REPAIR)) {
+            StudentRepair repairInfo = studentRepairDao.getRepairInfo(Integer.parseInt(order.getMusicGroupId()));
+
+            if (StringUtils.isBlank(repairInfo.getGoodsJson())) {
+                return BigDecimal.ZERO;
+            }
+            List<Goods> goodies = JSONObject.parseArray(repairInfo.getGoodsJson(), Goods.class);
+            List<Integer> goodsIds = goodies.stream().map(Goods::getId).collect(Collectors.toList());
+            if (goodsIds.size() <= 0) {
+                return BigDecimal.ZERO;
+            }
+
+            BigDecimal goodsTotalPrice = BigDecimal.ZERO;
+            goodies = goodsDao.getGoodies(goodsIds);
+            int i = 1;
+            for (Integer goodsId : goodsIds) {
+                for (Goods goods : goodies) {
+                    if (goods.getId().equals(goodsId)) {
+                        goodsTotalPrice = goodsTotalPrice.add(goods.getDiscountPrice());
+                        break;
+                    }
+                }
+            }
+            BigDecimal balance = order.getBalancePaymentAmount() == null ? BigDecimal.ZERO : order.getBalancePaymentAmount();
+            BigDecimal goodsTotalBalance = goodsTotalPrice.multiply(balance).divide(order.getExpectAmount(), 2, BigDecimal.ROUND_HALF_UP);
+            return goodsTotalPrice.subtract(goodsTotalBalance);
+        }
+
+        //乐团报名
+        if (order.getType().equals(OrderTypeEnum.APPLY)) {
+            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailDao.getOrderDetail(order.getId());
+            //总余额支付
+            BigDecimal totalBalance = order.getBalancePaymentAmount() != null ? order.getBalancePaymentAmount() : BigDecimal.ZERO;
+            //总价格
+            BigDecimal totalPrice = order.getExpectAmount();
+            //商品总付款
+            BigDecimal detailTotalPrice = orderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+            //商品销售占的余额
+            BigDecimal detailTotalBalance = detailTotalPrice.multiply(totalBalance).divide(totalPrice, 2, BigDecimal.ROUND_HALF_UP);
+            return detailTotalPrice.subtract(detailTotalBalance);
+        }
+
+        return BigDecimal.ZERO;
+    }
+
 }

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

@@ -67,6 +67,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
     private TeacherAttendanceDao teacherAttendanceDao;
     @Autowired
     private StudentDao studentDao;
+    @Autowired
+    private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 
     @Override
     public BaseDAO<Long, StudentAttendance> getDAO() {
@@ -598,6 +600,14 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = studentAttendanceDao.findStudentAttendance(params);
+            CourseSchedule schedule = courseScheduleDao.get(Long.parseLong(queryInfo.getSearch()));
+            if(schedule.getGroupType() == GroupType.MUSIC){
+                Set<Integer> collect = dataList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+                Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect,schedule.getMusicGroupId()));
+                dataList.forEach(e -> {
+                    e.setPaymentStatus(paymentStatusMap.get(e.getUserId()));
+                });
+            }
         }
         if (count == 0) {
             dataList = new ArrayList<>();

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

@@ -45,6 +45,7 @@ public class StudentCompetitionServiceImpl extends BaseServiceImpl<Long, Student
 		if(StringUtils.isBlank(studentCompetition.getVideoUrl())){
 			throw new BizException("请指定参赛作品");
 		}
+		studentCompetition.setIsShow(false);
 		studentCompetitionDao.insert(studentCompetition);
 	}
 
@@ -79,7 +80,7 @@ public class StudentCompetitionServiceImpl extends BaseServiceImpl<Long, Student
 		List<StudentCompetition> winnerList = studentCompetitionDao.getWinnerList();
 		List<StudentCompetitionRankingDto> winnerSimpleInfoList = new ArrayList<>();
 		for (StudentCompetition studentCompetition : winnerList) {
-			winnerSimpleInfoList.add(new StudentCompetitionRankingDto(studentCompetition.getId(), studentCompetition.getUsername(), studentCompetition.getPictureUrl()));
+			winnerSimpleInfoList.add(new StudentCompetitionRankingDto(studentCompetition.getId(), studentCompetition.getPrizeLevel(), studentCompetition.getUsername(), studentCompetition.getPictureUrl()));
 		}
 		return winnerSimpleInfoList;
 	}

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

@@ -112,7 +112,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         //关闭老订单
         if (StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())) {
             StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo());
-            if (orderByOrderNo.getBalancePaymentAmount() != null) {
+            if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0l) {
                 studentGoodsSell.setIsUseBalancePayment(true);
             } else {
                 studentGoodsSell.setIsUseBalancePayment(false);
@@ -292,7 +292,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                     throw new BizException("该订单已支付");
                 }
                 //关闭老订单
-                if (studentPaymentOrder.getBalancePaymentAmount() != null) {
+                if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().longValue() != 0l) {
                     studentGoodsSell.setIsUseBalancePayment(true);
                 } else {
                     studentGoodsSell.setIsUseBalancePayment(false);

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

@@ -225,7 +225,7 @@ public class SysUserCashAccountServiceImpl extends BaseServiceImpl<Integer, SysU
 
         BigDecimal balance = cashAccount.getCourseBalance().add(decimal);
         if (balance.doubleValue() < 0) {
-            throw new BizException("现金账户[{}]课程余额不足,可用余额剩{}元", userId, cashAccount.getBalance().doubleValue());
+            throw new BizException("现金账户[{}]课程余额不足,可用余额剩{}元", userId, cashAccount.getCourseBalance().doubleValue());
         }
 
         Date date = new Date();

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

@@ -1845,6 +1845,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(!CollectionUtils.isEmpty(studentApplyRefunds)){
 			throw new BizException("此学生存在退课申请,请到系统日志中查看");
 		}
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
+		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
+			throw new BizException("课程单价设置错误");
+		}
 
 		ClassGroup classGroup = classGroupDao.findByVipGroup(studentRecoverInfo.getVipGroupId().longValue(), null);
 
@@ -1956,7 +1960,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			courseScheduleStudentPayment.setUserId(studentRecoverInfo.getUserId());
 			courseScheduleStudentPayment.setExpectPrice(coursePrices.get(i));
 			courseScheduleStudentPayment.setActualPrice(coursePrices.get(i));
-			courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(surplusCourseWithGroup.get(i))?vipGroup.getOnlineClassesUnitPrice():vipGroup.getOfflineClassesUnitPrice());
+			courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(surplusCourseWithGroup.get(i))?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
 			courseScheduleStudentPayment.setCreateTime(now);
 			courseScheduleStudentPayment.setUpdateTime(now);
 			courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
@@ -2525,6 +2529,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("此状态的vip课程不支持加课");
 		}
 
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
+		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
+			throw new BizException("课程单价设置错误");
+		}
+
 		Date now=new Date();
 
 //		BigDecimal onlineCoursePrice = courseScheduleStudentPaymentDao.findVipGroupCoursePrice(vipGroup.getId().intValue(),TeachModeEnum.ONLINE.getCode());
@@ -2539,6 +2548,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		BigDecimal surplusCourseTotalPrice = new BigDecimal(0);
 		BigDecimal singleClassPrice=vipGroupApplyDto.getSingleClassPrice();
 
+
 		//课程信息调整
 		for (CourseSchedule courseSchedule : vipGroupApplyDto.getCourseSchedules()) {
 			if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
@@ -2611,7 +2621,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 //				}else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
 //					courseScheduleStudentPayment.setExpectPrice(offlineCoursePrice);
 //				}
+				courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(vipGroupCourseSchedule.getTeachMode())?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
 				courseScheduleStudentPayment.setExpectPrice(singleClassPrice);
+				courseScheduleStudentPayment.setActualPrice(singleClassPrice);
 				courseScheduleStudentPayment.setCreateTime(now);
 				courseScheduleStudentPayment.setUpdateTime(now);
 				courseScheduleStudentPayments.add(courseScheduleStudentPayment);
@@ -2654,6 +2666,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
+		VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
+		if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
+			throw new BizException("课程单价设置错误");
+		}
+
 		if(VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())
 				||VipGroupStatusEnum.FINISHED.equals(vipGroup.getStatus())
 				||VipGroupStatusEnum.CANCEL.equals(vipGroup.getStatus())){
@@ -2838,10 +2855,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				courseScheduleStudentPayment.setUserId(studentId);
                 if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
 					courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice());
-					courseScheduleStudentPayment.setOriginalPrice(vipGroup.getOfflineClassesUnitPrice());
+					courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
                 }else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
 					courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice());
-					courseScheduleStudentPayment.setOriginalPrice(vipGroup.getOnlineClassesUnitPrice());
+					courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
                 }
 				if(hasGiveClass
 						&&vipGroup.getGiveTeachMode() == vipGroupCourseSchedule.getTeachMode()){

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

@@ -125,7 +125,6 @@
 		WHERE mgpc.music_group_id_ = #{musicGroupId}
 		AND mgpc.payment_type_ = 'MUSIC_APPLY'
 		AND mgpc.pay_user_type_='STUDENT'
-		AND mgpc.status_='OPEN'
 	</select>
 
     <select id="getCalenderCourseSettings" resultMap="MusicGroupPaymentCalenderCourseSettings">

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

@@ -275,7 +275,7 @@
 	</select>
 	<select id="queryCanOpenList" resultMap="MusicGroupPaymentCalenderDetail">
 		SELECT * FROM music_group_payment_calender_detail
-		WHERE FIND_IN_SET(id_,#{ids}) AND payment_status_ = 'NON_PAYMENT'
+		WHERE FIND_IN_SET(id_,#{ids}) AND payment_status_ = 'NON_PAYMENT' AND open_ = 0
 	</select>
 	<select id="queryIntersectionByPaymentDate" resultType="java.lang.Integer">
 		SELECT COUNT(mgpcd.id_) FROM music_group_payment_calender_detail mgpcd
@@ -365,4 +365,7 @@
 	<select id="findByOrderId" resultMap="MusicGroupPaymentCalenderDetail">
 		SELECT * FROM music_group_payment_calender_detail WHERE payment_order_id_ = #{orderId} LIMIT 1
 	</select>
+	<select id="queryNoPaymentStudentIds" resultType="java.lang.Integer">
+		SELECT user_id_ FROM music_group_payment_calender_detail WHERE music_group_payment_calender_id_ = #{calenderId} AND payment_status_ = 'NON_PAYMENT'
+	</select>
 </mapper>

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

@@ -484,12 +484,27 @@
         AND pay_user_type_='STUDENT'
     </select>
     <select id="queryUserPaymentStatus" resultType="java.util.Map">
-        SELECT mg.id_ 'key',CASE WHEN COUNT(mgpc.id_) = 0 OR COUNT(DISTINCT mgpcd.id_) > 0 THEN 'NON_PAYMENT' ELSE 'PAID_COMPLETED' END 'value'
+        SELECT mg.id_ 'key',CASE WHEN MIN(mgpcd.payment_status_) IS NULL THEN 'NON_PAYMENT' ELSE MIN(mgpcd.payment_status_) END 'value'
         FROM music_group mg
-		LEFT JOIN music_group_payment_calender mgpc ON mgpc.music_group_id_ = mg.id_
-        LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
-        AND mgpcd.user_id_ = #{userId} AND mgpcd.payment_status_ = 'NON_PAYMENT'
-        WHERE FIND_IN_SET(mg.id_,#{musicGroupId}) AND DATE_FORMAT(NOW(),'%Y-%m-%d') > DATE_FORMAT(mgpc.payment_valid_end_date_,'%Y-%m-%d')
+        LEFT JOIN music_group_payment_calender mgpc ON mgpc.music_group_id_ = mg.id_
+        AND mgpc.status_ IN ('NO','OPEN','OVER')
+        AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
+        LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_ AND mgpcd.user_id_ = #{userId}
+        WHERE FIND_IN_SET(mg.id_,#{musicGroupId})
         GROUP BY mg.id_
     </select>
+    <select id="queryUserCoursePaymentStatus" resultType="java.util.Map">
+        SELECT mgpcd.user_id_ 'key',
+        CASE WHEN MIN(mgpcd.payment_status_) IS NULL THEN 'NON_PAYMENT' ELSE MIN(mgpcd.payment_status_) END 'value'
+        FROM music_group mg
+        LEFT JOIN music_group_payment_calender mgpc ON mgpc.music_group_id_ = mg.id_
+        AND mgpc.status_ IN ('NO','OPEN','OVER')
+        AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
+        LEFT JOIN music_group_payment_calender_detail mgpcd ON mgpc.id_ = mgpcd.music_group_payment_calender_id_
+        WHERE mg.id_ = #{musicGroupId} AND mgpcd.user_id_ IN
+        <foreach collection="studentId" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+        GROUP BY mgpcd.user_id_
+    </select>
 </mapper>

+ 127 - 110
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -3,124 +3,141 @@
 <!-- 这个文件是自动生成的。 不要修改此文件。所有改动将在下次重新自动生成时丢失。 -->
 <mapper namespace="com.ym.mec.biz.dal.dao.MusicGroupPaymentStudentCourseDetailDao">
 
-	<resultMap
-		type="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail"
-		id="MusicGroupPaymentStudentCourseDetail">
-		<result column="id_" property="id" />
-		<result column="music_group_payment_calender_id_" property="musicGroupPaymentCalenderId" />
-		<result column="music_group_payment_calender_detail_id_"
-			property="musicGroupPaymentCalenderDetailId" />
-		<result column="user_id_" property="userId" />
-		<result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
-		<result column="total_course_minutes_" property="totalCourseMinutes" />
-		<result column="used_course_minutes_" property="usedCourseMinutes" />
-		<result column="create_time_" property="createTime" />
-		<result column="update_time_" property="updateTime" />
-	</resultMap>
+    <resultMap
+            type="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail"
+            id="MusicGroupPaymentStudentCourseDetail">
+        <result column="id_" property="id"/>
+        <result column="music_group_payment_calender_id_" property="musicGroupPaymentCalenderId"/>
+        <result column="music_group_payment_calender_detail_id_"
+                property="musicGroupPaymentCalenderDetailId"/>
+        <result column="user_id_" property="userId"/>
+        <result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="total_course_minutes_" property="totalCourseMinutes"/>
+        <result column="used_course_minutes_" property="usedCourseMinutes"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time_" property="updateTime"/>
+    </resultMap>
 
-	<!-- 根据主键查询一条记录 -->
-	<select id="get" resultMap="MusicGroupPaymentStudentCourseDetail">
-		SELECT * FROM music_group_payment_student_course_detail WHERE id_ =
-		#{id}
-	</select>
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="MusicGroupPaymentStudentCourseDetail">
+        SELECT *
+        FROM music_group_payment_student_course_detail
+        WHERE id_ =
+              #{id}
+    </select>
 
-	<!-- 全查询 -->
-	<select id="findAll" resultMap="MusicGroupPaymentStudentCourseDetail">
-		SELECT * FROM
-		music_group_payment_student_course_detail ORDER BY id_
-	</select>
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="MusicGroupPaymentStudentCourseDetail">
+        SELECT *
+        FROM music_group_payment_student_course_detail
+        ORDER BY id_
+    </select>
 
-	<!-- 向数据库增加一条记录 -->
-	<insert id="insert"
-		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail"
-		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
-			AS ID FROM DUAL </selectKey> -->
-		INSERT INTO music_group_payment_student_course_detail
-		(id_,music_group_payment_calender_id_,music_group_payment_calender_detail_id_,user_id_,course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_)
-		VALUES(#{id},#{musicGroupPaymentCalenderId},#{musicGroupPaymentCalenderDetailId},#{userId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{totalCourseMinutes},#{usedCourseMinutes},#{createTime},#{updateTime})
-	</insert>
-	
-	<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert"
+            parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail"
+            useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        <!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval
+            AS ID FROM DUAL </selectKey> -->
+        INSERT INTO music_group_payment_student_course_detail
+        (id_,music_group_payment_calender_id_,music_group_payment_calender_detail_id_,user_id_,course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_)
+        VALUES(#{id},#{musicGroupPaymentCalenderId},#{musicGroupPaymentCalenderDetailId},#{userId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{totalCourseMinutes},#{usedCourseMinutes},#{createTime},#{updateTime})
+    </insert>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
-		INSERT INTO music_group_payment_student_course_detail
-		(id_,music_group_payment_calender_id_,music_group_payment_calender_detail_id_,user_id_,course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_)
-		VALUES
-		<foreach collection="list" item="item" separator=",">
-		(#{item.id},#{item.musicGroupPaymentCalenderId},#{item.musicGroupPaymentCalenderDetailId},#{item.userId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.totalCourseMinutes},#{item.usedCourseMinutes},#{item.createTime},#{item.updateTime})
-		</foreach>
-	</insert>
+        INSERT INTO music_group_payment_student_course_detail
+        (id_,music_group_payment_calender_id_,music_group_payment_calender_detail_id_,user_id_,course_type_,total_course_minutes_,used_course_minutes_,create_time_,update_time_)
+        VALUES
+        <foreach collection="list" item="item" separator=",">
+            (#{item.id},#{item.musicGroupPaymentCalenderId},#{item.musicGroupPaymentCalenderDetailId},#{item.userId},#{item.courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.totalCourseMinutes},#{item.usedCourseMinutes},#{item.createTime},#{item.updateTime})
+        </foreach>
+    </insert>
 
-	<!-- 根据主键查询一条记录 -->
-	<update id="update"
-		parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail">
-		UPDATE music_group_payment_student_course_detail
-		<set>
-			<if test="usedCourseMinutes != null">
-				used_course_minutes_ = #{usedCourseMinutes},
-			</if>
-			<if test="totalCourseMinutes != null">
-				total_course_minutes_ = #{totalCourseMinutes},
-			</if>
-			<if test="userId != null">
-				user_id_ = #{userId},
-			</if>
-			<if test="musicGroupPaymentCalenderDetailId != null">
-				music_group_payment_calender_detail_id_ = #{musicGroupPaymentCalenderDetailId},
-			</if>
-			<if test="id != null">
-				id_ = #{id},
-			</if>
-			<if test="updateTime != null">
-				update_time_ = #{updateTime},
-			</if>
-			<if test="musicGroupPaymentCalenderId != null">
-				music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId},
-			</if>
-			<if test="courseType != null">
-				course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-			</if>
-			<if test="createTime != null">
-				create_time_ = #{createTime},
-			</if>
-		</set>
-		WHERE id_ = #{id}
-	</update>
+    <!-- 根据主键查询一条记录 -->
+    <update id="update"
+            parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail">
+        UPDATE music_group_payment_student_course_detail
+        <set>
+            <if test="usedCourseMinutes != null">
+                used_course_minutes_ = #{usedCourseMinutes},
+            </if>
+            <if test="totalCourseMinutes != null">
+                total_course_minutes_ = #{totalCourseMinutes},
+            </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
+            <if test="musicGroupPaymentCalenderDetailId != null">
+                music_group_payment_calender_detail_id_ = #{musicGroupPaymentCalenderDetailId},
+            </if>
+            <if test="id != null">
+                id_ = #{id},
+            </if>
+            <if test="updateTime != null">
+                update_time_ = #{updateTime},
+            </if>
+            <if test="musicGroupPaymentCalenderId != null">
+                music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId},
+            </if>
+            <if test="courseType != null">
+                course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+        </set>
+        WHERE id_ = #{id}
+    </update>
 
-	<!-- 根据主键删除一条记录 -->
-	<delete id="delete">
-		DELETE FROM
-		music_group_payment_student_course_detail WHERE id_ = #{id}
-	</delete>
+    <!-- 根据主键删除一条记录 -->
+    <delete id="delete">
+        DELETE
+        FROM music_group_payment_student_course_detail
+        WHERE id_ = #{id}
+    </delete>
 
-	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"
-		parameterType="map">
-		SELECT * FROM music_group_payment_student_course_detail ORDER BY id_
-		<include refid="global.limit" />
-	</select>
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="MusicGroupPaymentStudentCourseDetail"
+            parameterType="map">
+        SELECT * FROM music_group_payment_student_course_detail ORDER BY id_
+        <include refid="global.limit"/>
+    </select>
 
-	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM
-		music_group_payment_student_course_detail
-	</select>
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM music_group_payment_student_course_detail
+    </select>
     <select id="getUnUseWithStudentAndCourseTypeAndCourseMinutes" resultMap="MusicGroupPaymentStudentCourseDetail">
-		SELECT * FROM music_group_payment_student_course_detail
-		WHERE user_id_=#{studentId}
-		AND course_type_=#{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-		AND total_course_minutes_ &gt;= #{courseMinutes}
-		AND used_course_minutes_ &lt;= 0
-		ORDER BY id_ DESC LIMIT 1;
-	</select>
+        SELECT *
+        FROM music_group_payment_student_course_detail
+        WHERE user_id_ = #{studentId}
+          AND course_type_ = #{courseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND total_course_minutes_ &gt;= #{courseMinutes}
+          AND used_course_minutes_ &lt;= 0
+        ORDER BY id_
+        LIMIT 1;
+    </select>
     <select id="getUnUseWithStudents" resultMap="MusicGroupPaymentStudentCourseDetail">
-		SELECT * FROM music_group_payment_student_course_detail mgpscd
-		LEFT JOIN music_group_payment_calender mgpc ON mgpscd.music_group_payment_calender_id_ = mgpc.id_
-		WHERE used_course_minutes_ &lt;= 0
-		AND mgpc.music_group_id_ = #{musicGroupId}
-		AND user_id_ IN
-		<foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
-			#{studentId}
-		</foreach>
-	</select>
+        SELECT * FROM music_group_payment_student_course_detail mgpscd
+        LEFT JOIN music_group_payment_calender mgpc ON mgpscd.music_group_payment_calender_id_ = mgpc.id_
+        WHERE used_course_minutes_ &lt;= 0
+        AND mgpc.music_group_id_ = #{musicGroupId}
+        AND user_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+    </select>
+
+    <delete id="deleteByUserIdAndMusicGroupId">
+        DELETE
+        FROM music_group_payment_student_course_detail
+        WHERE user_id_ = #{userId}
+          AND music_group_payment_calender_id_ IN (
+            SELECT id_
+            FROM music_group_payment_calender
+            WHERE music_group_id_ = #{musicGroupId}
+        )
+    </delete>
 </mapper>

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml

@@ -287,6 +287,7 @@
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
         SELECT COUNT(*) FROM sell_order so
+        LEFT JOIN sys_user su ON so.user_id_ = su.id_
         LEFT JOIN student_payment_order spo ON so.order_id_ = spo.id_
         <include refid="queryPageSql"/>
     </select>
@@ -296,6 +297,9 @@
             <if test="search != null and search != ''">
                 AND (so.order_no_ = #{search} OR so.trans_no_ = #{search})
             </if>
+            <if test="userName != null and userName != ''">
+                AND (so.user_id_ like concat('%',#{userName},'%') OR su.username_ like concat('%',#{userName},'%'))
+            </if>
             <if test="organIdList != null and organIdList != ''">
                 AND FIND_IN_SET(so.organ_id_,#{organIdList})
             </if>

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

@@ -473,7 +473,7 @@
             GROUP BY sa.course_schedule_id_
     </select>
     <select id="findStudentAttendance" resultMap="StudentAttendance">
-        SELECT sa.*,su.username_,su.phone_,IF(s.name_ IS NULL,s1.name_,s.name_) subject_name_,su.avatar_
+        SELECT cssp.user_id_,sa.*,su.username_,su.phone_,IF(s.name_ IS NULL,s1.name_,s.name_) subject_name_,su.avatar_
         FROM course_schedule_student_payment cssp
         LEFT JOIN student_attendance sa ON cssp.course_schedule_id_ = sa.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
         LEFT JOIN sys_user su ON cssp.user_id_ = su.id_

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

@@ -262,14 +262,16 @@
     </select>
 
     <select id="getChangeGoods" resultMap="SubjectChange">
-        SELECT GROUP_CONCAT(original_musical_)     musicGroupName,
-               GROUP_CONCAT(original_accessories_) original_accessories_,
-               GROUP_CONCAT(change_musical_)       trans_no_,
-               GROUP_CONCAT(change_accessories_)   change_accessories_
-        FROM subject_change
-        WHERE music_group_id_ = #{musicGroupId}
-          AND status_ = 2
-        GROUP BY music_group_id_
+        SELECT GROUP_CONCAT(sc.original_musical_)     musicGroupName,
+               GROUP_CONCAT(sc.original_accessories_) original_accessories_,
+               GROUP_CONCAT(sc.change_musical_)       trans_no_,
+               GROUP_CONCAT(sc.change_accessories_)   change_accessories_
+        FROM subject_change sc
+                 LEFT JOIN student_registration sr ON sc.student_id_ = sr.user_id_
+        WHERE sc.music_group_id_ = #{musicGroupId}
+          AND sc.status_ = 2
+          AND sr.music_group_status_ != 'QUIT'
+        GROUP BY sc.music_group_id_
     </select>
     <resultMap id="SubjectChangeDto" type="com.ym.mec.biz.dal.entity.SubjectChange" extends="SubjectChange">
         <collection property="changeMusicalGoods" ofType="com.ym.mec.biz.dal.entity.Goods">

+ 31 - 3
mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml

@@ -5,12 +5,14 @@
         <!--@Table sys_payment_config-->
         <id column="id_" jdbcType="INTEGER" property="id"/>
         <result column="organ_id_" property="organId"/>
-        <result column="account_type_" property="accountType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="account_type_" property="accountType"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="pay_type_" property="payType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="yq_mer_no_" property="yqMerNo"/>
         <result column="hf_mer_no_" property="hfMerNo"/>
         <result column="type_" property="type"/>
         <result column="route_scale_" property="routeScale"/>
+        <result column="type_route_scale_" property="typeRouteScale"/>
         <result column="organ_name" property="organName"/>
         <result column="per_scale_" property="perScale"/>
         <result column="com_scale_" property="comScale"/>
@@ -23,7 +25,8 @@
     </resultMap>
     <sql id="Base_Column_List">
         <!--@mbg.generated-->
-        id_, organ_id_,account_type_,pay_type_,yq_mer_no_,hf_mer_no_,type_,route_scale_,create_time_, update_time_
+        id_, organ_id_,account_type_,pay_type_,yq_mer_no_,hf_mer_no_,type_,route_scale_,type_route_scale_,create_time_,
+        update_time_
     </sql>
     <select id="get" parameterType="java.lang.Integer" resultMap="SysPaymentConfig">
         <!--@mbg.generated-->
@@ -60,6 +63,9 @@
             <if test="routeScale != null">
                 route_scale_,
             </if>
+            <if test="typeRouteScale != null">
+                type_route_scale_,
+            </if>
             <if test="type != null">
                 type_,
             </if>
@@ -89,6 +95,9 @@
             <if test="routeScale != null">
                 #{routeScale},
             </if>
+            <if test="typeRouteScale != null">
+                #{typeRouteScale},
+            </if>
             <if test="type != null">
                 #{type},
             </if>
@@ -122,6 +131,9 @@
             <if test="routeScale != null">
                 route_scale_ = #{routeScale},
             </if>
+            <if test="typeRouteScale != null">
+                type_route_scale_ = #{typeRouteScale},
+            </if>
             <if test="type != null">
                 type_ = #{type},
             </if>
@@ -137,15 +149,31 @@
         ORDER BY id_
     </select>
 
+    <sql id="queryCondition">
+        <where>
+            <if test="organId!=null">
+                AND spc.organ_id_=#{organId}
+            </if>
+            <if test='hasTypeRoute != null and hasTypeRoute.toString()=="1".toString()'>
+                AND spc.type_route_scale_ != ''
+            </if>
+            <if test='hasTypeRoute != null and hasTypeRoute.toString()=="0".toString()'>
+                AND spc.type_route_scale_ = ''
+            </if>
+        </where>
+    </sql>
+
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="SysPaymentConfig" parameterType="map">
         SELECT spc.*,o.name_ organ_name FROM sys_payment_config spc LEFT JOIN organization o on spc.organ_id_ = o.id_
+        <include refid="queryCondition"/>
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-        SELECT COUNT(*) FROM sys_payment_config
+        SELECT COUNT(*) FROM sys_payment_config spc
+        <include refid="queryCondition"/>
         <include refid="global.limit"/>
     </select>
 

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

@@ -64,8 +64,6 @@ public class MusicGroupController extends BaseController {
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
-    private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
-    @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
@@ -168,49 +166,6 @@ public class MusicGroupController extends BaseController {
         return succeed(studentRegistration);
     }
 
-    /*@ApiOperation(value = "查询续费信息")
-    @GetMapping("/queryRenewInfo")
-    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
-    public HttpResponseResult queryRenewInfo(String musicGroupId) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        Integer userId = sysUser.getId();
-        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
-        if (musicGroup == null) {
-            return failed("乐团不存在");
-        }
-        MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
-
-        if (musicGroupStudentFee == null) {
-            throw new BizException("个人信息不存在");
-        }
-        if (musicGroupStudentFee.getPaymentStatus() != PaymentStatus.NON_PAYMENT) {
-            throw new BizException("已缴费");
-        }
-        MusicGroupPaymentCalenderDetail userLastCalenderDetail = musicGroupPaymentCalenderDetailDao.getUserLastCalenderDetail(musicGroupId, userId);
-        if (userLastCalenderDetail == null) {
-            MusicGroupPaymentCalender lastCalender = musicGroupPaymentCalenderDao.getLastStartOne(musicGroupId);
-            String tips = (lastCalender != null && lastCalender.getStatus() == PaymentCalenderStatusEnum.OVER) ? "缴费已截止,如有问题请联系指导老师" : "缴费暂未开始,如有问题请联系指导老师";
-            throw new BizException(tips);
-        }
-
-        BigDecimal amount = userLastCalenderDetail.getExpectAmount();
-
-        StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-        if (studentRegistration == null) {
-            return failed("乐团报名信息找不到");
-        }
-        MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(musicGroupId,
-                studentRegistration.getActualSubjectId());
-        ModelMap model = new ModelMap();
-        model.put("musicGroup", musicGroup);
-        model.put("amount", amount);
-        model.put("nextPaymentDate", musicGroupStudentFee.getNextPaymentDate());
-        model.put("musicGroupSubjectPlan", musicGroupSubjectPlan);
-        model.put("balance", studentRegistration.getBalance());
-
-        return succeed(model);
-    }*/
-
     @ApiOperation(value = "续费")
     @GetMapping("/renew")
     @ApiImplicitParams({@ApiImplicitParam(name = "calenderId", value = "缴费项目编号", required = true, dataType = "Long"),

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

@@ -95,6 +95,14 @@ public class MusicGroupPaymentCalenderController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "确认学校已缴费")
+    @PostMapping("/makesureSchoolePaid")
+    @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/makesureSchoolePaid')")
+	public Object makesureSchoolePaid(Long id, String memo) {
+		musicGroupPaymentCalenderService.makesureSchoolePaid(id, memo);
+		return succeed();
+	}
+
     @ApiOperation(value = "乐团缴费日历审核列表")
     @GetMapping("/auditList")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/auditList')")

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

@@ -2,11 +2,13 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
+import com.ym.mec.biz.dal.page.SysPaymentConfigQueryInfo;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.*;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -69,7 +71,7 @@ public class SysPaymentConfigController extends BaseController {
     @ApiOperation(value = "分页查询支付配置列表")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/queryPage')")
-    public Object queryPage(QueryInfo queryInfo) {
+    public Object queryPage(SysPaymentConfigQueryInfo queryInfo) {
         return succeed(sysPaymentConfigService.queryPage(queryInfo));
     }
 
@@ -80,4 +82,53 @@ public class SysPaymentConfigController extends BaseController {
         return succeed(sysPaymentConfigService.getPaymentConfigs(payType));
     }
 
+
+    @ApiOperation(value = "新增按费用类型配置")
+    @PostMapping("/addTypeRoute")
+    @PreAuthorize("@pcs.hasPermissions('paymentConfig/addTypeRoute')")
+    public HttpResponseResult<SysPaymentConfig> addTypeRoute(SysPaymentConfig config) {
+        if (StringUtils.isBlank(config.getTypeRouteScale())) {
+            return failed("分润配置不能为空");
+        }
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.get(config.getId());
+        if (paymentConfig != null && StringUtils.isNotBlank(paymentConfig.getTypeRouteScale())) {
+            return failed("此分部配置存在,请核查");
+        }
+        Date nowDate = new Date();
+        paymentConfig.setTypeRouteScale(config.getTypeRouteScale());
+        paymentConfig.setUpdateTime(nowDate);
+        sysPaymentConfigService.update(paymentConfig);
+        return succeed(paymentConfig);
+    }
+
+    @ApiOperation(value = "更新按费用类型配置")
+    @PostMapping("/updateTypeRoute")
+    @PreAuthorize("@pcs.hasPermissions('paymentConfig/updateTypeRoute')")
+    public HttpResponseResult<SysPaymentConfig> updateTypeRoute(SysPaymentConfig config) {
+        if (StringUtils.isBlank(config.getTypeRouteScale())) {
+            return failed("分润配置不能为空");
+        }
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.get(config.getId());
+        Date nowDate = new Date();
+        paymentConfig.setTypeRouteScale(config.getTypeRouteScale());
+        paymentConfig.setUpdateTime(nowDate);
+        sysPaymentConfigService.update(paymentConfig);
+        return succeed(paymentConfig);
+    }
+
+    @ApiOperation(value = "删除按费用类型配置")
+    @PostMapping("/delTypeRoute")
+    @PreAuthorize("@pcs.hasPermissions('paymentConfig/delTypeRoute')")
+    public HttpResponseResult<SysPaymentConfig> delTypeRoute(Integer id) {
+        SysPaymentConfig paymentConfig = sysPaymentConfigService.get(id);
+        if (paymentConfig == null) {
+            return failed("此分部配置不存在");
+        }
+        Date nowDate = new Date();
+        paymentConfig.setTypeRouteScale("");
+        paymentConfig.setUpdateTime(nowDate);
+        sysPaymentConfigService.update(paymentConfig);
+        return succeed(paymentConfig);
+    }
+
 }

+ 0 - 3
mec-web/src/main/java/com/ym/mec/web/controller/education/EduOnlineMusicGroupController.java

@@ -45,13 +45,10 @@ public class EduOnlineMusicGroupController extends BaseController {
     @Autowired
     private MusicGroupPaymentCalenderDetailService musicGroupPaymentCalenderDetailService;
     @Autowired
-    private EmployeeDao employeeDao;
-    @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
 
     @ApiOperation(value = "分页查询乐团列表")
     @GetMapping("/findMusicGroups")
-//    @PreAuthorize("@pcs.hasPermissions('eduOnlineMusic/findMusicGroups')")
     public HttpResponseResult findMusicGroups(MusicGroupQueryInfo queryInfo){
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {

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

@@ -48,8 +48,6 @@ public class EduPracticeGroupController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private PracticeGroupDao practiceGroupDao;
-    @Autowired
-    private TeacherCourseRewardService teacherCourseRewardService;
 
     List<Integer> excludeOrganIds=new ArrayList<>(Arrays.asList(new Integer[]{36}));