Explorar o código

Merge remote-tracking branch 'origin/master'

Joburgess %!s(int64=4) %!d(string=hai) anos
pai
achega
6ce7b76240
Modificáronse 57 ficheiros con 2198 adicións e 192 borrados
  1. 8 8
      codegen/src/main/resources/generateConfigration.xml
  2. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java
  3. 36 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  4. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java
  5. 49 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java
  6. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDetailDao.java
  7. 27 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectChangeDao.java
  8. 64 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderPushDto.java
  9. 62 16
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsSellDto.java
  10. 38 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentGoodsSellDto.java
  11. 33 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroup.java
  12. 45 6
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupPaymentCalender.java
  13. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupStudentFee.java
  14. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java
  15. 172 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentGoodsSell.java
  16. 326 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SubjectChange.java
  17. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/GroupType.java
  18. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  19. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java
  20. 30 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SubjectChangeStatusEnum.java
  21. 41 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsSellQueryInfo.java
  22. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  23. 13 4
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java
  24. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java
  25. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  26. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  27. 5 7
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java
  28. 22 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SubjectChangeService.java
  29. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/FinancialExpenditureServiceImpl.java
  30. 63 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  31. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  32. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  33. 51 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  34. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  35. 47 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  36. 96 28
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  37. 161 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
  38. 19 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupMapper.xml
  39. 70 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  40. 18 4
      mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml
  41. 1 1
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  42. 118 0
      mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml
  43. 70 24
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml
  44. 143 0
      mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml
  45. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  46. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  47. 4 4
      mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java
  48. 29 16
      mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java
  49. 4 1
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  50. 51 0
      mec-student/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java
  51. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/UpdateMusicGroupStudentFeeStatus.java
  52. 10 15
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java
  53. 33 3
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  54. 65 0
      mec-web/src/main/java/com/ym/mec/web/controller/SubjectChangeController.java
  55. 6 4
      mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java
  56. 47 8
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java
  57. 0 3
      mec-web/src/main/resources/application.yml

+ 8 - 8
codegen/src/main/resources/generateConfigration.xml

@@ -2,16 +2,16 @@
 <GenerateConfiguration>
 	<dbConfiguration>
 		<driverClass>com.mysql.jdbc.Driver</driverClass>
-		<url>jdbc:mysql://47.114.176.40:3306/edu_saas</url>
-		<username>edu_saas</username>
+		<url>jdbc:mysql://47.114.1.200:3306/mec_dev</url>
+		<username>mec_dev</username>
 		<password>dayaDataOnline@2019</password>
-		<catalog>edu_saas</catalog>
-		<schema>edu_saas</schema>
+		<catalog>mec_dev</catalog>
+		<schema>mec_dev</schema>
 	</dbConfiguration>
-	<srcBase>e:/javabean</srcBase>
-	<pojoPackageName>com.keao.edu.datasource.dal.entity</pojoPackageName>
-	<daoPackageName>com.keao.edu.datasource.dal.dao</daoPackageName>
-	<servicePackageName>com.keao.edu.datasource.service</servicePackageName>
+	<srcBase>d:/javabean</srcBase>
+	<pojoPackageName>com.ym.mec.biz.dal.entity</pojoPackageName>
+	<daoPackageName>com.ym.mec.biz.dal.dao</daoPackageName>
+	<servicePackageName>com.ym.mec.biz.service</servicePackageName>
 	<sqlmapPackageName>resources</sqlmapPackageName>
 	<sqlmapConfigPackageName>resources/config</sqlmapConfigPackageName>
 </GenerateConfiguration>

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java

@@ -1,6 +1,5 @@
 package com.ym.mec.biz.dal.dao;
 
-import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.MusicCardDto;
 import com.ym.mec.biz.dal.dto.MusicGroupRegisterDto;
 import com.ym.mec.biz.dal.dto.RegisterSubjectDto;
@@ -282,4 +281,15 @@ public interface MusicGroupDao extends BaseDAO<String, MusicGroup> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.MusicCardDto>
      */
     List<MusicCardDto> queryOrganMusicInfos(@Param("organId") Integer organId);
+
+    /**
+     * @describe 获取学员第一个教务老师
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/24
+     * @time 10:27
+     * @param userId:
+     * @return java.lang.Integer
+     */
+    Integer getFirstEduTeacherId(@Param("userId") Integer userId);
 }

+ 36 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java

@@ -1,10 +1,8 @@
 package com.ym.mec.biz.dal.dao;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import org.apache.ibatis.annotations.Param;
 
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
@@ -69,7 +67,7 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @return
      */
     int queryIntersectionByPaymentDate(@Param("musicGroupId") String musicGroupId, @Param("startPaymentDate") Date startPaymentDate,
-                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate);
+                                       @Param("deadlinePaymentDate") Date deadlinePaymentDate,@Param("calenderId") Long calenderId);
 
     /**
      * 统计预计缴费人数
@@ -95,4 +93,37 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
     MusicGroupPaymentCalender getLastStartOne(@Param("musicGroupId") String musicGroupId);
 
     int queryIntersectionByDate(@Param("musicGroupId") String musicGroupId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    /**
+     * @describe 根据指定乐团的有效日期查询交集
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/21
+     * @time 10:46
+     * @param musicGroupId:
+     * @param paymentValidStartDate:
+     * @param paymentValidEndDate:
+     * @return int
+     */
+    int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId,
+                                     @Param("paymentValidStartDate") String paymentValidStartDate,
+                                     @Param("paymentValidEndDate") String paymentValidEndDate,
+                                     @Param("calenderId") Long calenderId);
+
+    /**
+     * @describe 获取指定时间后的缴费信息
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/21
+     * @time 17:35
+     * @param configValue:
+     * @return void
+     */
+    List<Map<Long, Long>> queryCalenderByDay(String configValue);
+
+    List<MusicGroupPaymentCalender> queryByIds(@Param("calenderId") Set<Long> calenderId);
+
+    List<Long> queryEndIds(@Param("configValue1") String configValue1, @Param("format") String format);
+
+    List<CalenderPushDto> getCalenderPushDto(@Param("calenderIds") Collection<Long> calenderIds);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java

@@ -209,4 +209,14 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 * @param paymentStatus
 	 */
 	void updatePaymentStatus(@Param("calenderId") Long calenderId, @Param("paymentStatus") String paymentStatus);
+
+	/**
+	 * @describe 将缴费截止的缴费状态更改为未缴费
+	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+	 * @author zouxuan
+	 * @date 2020/9/21
+	 * @time 14:34
+	 * @return void
+	 */
+    void updateFeeStatus();
 }

+ 49 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java

@@ -0,0 +1,49 @@
+package com.ym.mec.biz.dal.dao;
+
+
+import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface StudentGoodsSellDao extends BaseDAO<Integer, StudentGoodsSell> {
+
+
+    /**
+     * @describe 获取教务老师关联的学员商品订单
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/23
+     * @time 14:00
+     * @param params:
+     * @return int
+     */
+    int countStudentGoodsOrders(Map<String, Object> params);
+
+    /**
+     * @describe 获取教务老师关联的学员商品订单
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/23
+     * @time 14:01
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentGoodsSellDto>
+     */
+    List<StudentGoodsSellDto> queryStudentGoodsOrders(Map<String, Object> params);
+
+    /**
+     * @describe 根据订单编号获取学员商品订单
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/23
+     * @time 17:04
+     * @param orderNo:
+     * @return com.ym.mec.biz.dal.entity.StudentGoodsSell
+     */
+    StudentGoodsSell findByOrderNo(@Param("orderNo") String orderNo);
+
+    StudentGoodsSellDto getStudentGoodsSellDto(String orderNo);
+}

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

@@ -74,6 +74,7 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单商品
+     *
      * @param orderId
      * @return
      */
@@ -81,15 +82,24 @@ public interface StudentPaymentOrderDetailDao extends BaseDAO<Long, StudentPayme
 
     /**
      * 获取订单详细
+     *
      * @param orderId
      * @return
      */
     List<StudentPaymentOrderDetail> getOrderDetail(@Param("orderId") Long orderId);
 
     /**
-     *
      * @param orderId
      * @return
      */
     List<String> getOrderDetailType(@Param("orderId") Long orderId);
+
+    /**
+     * 获取学生乐团报名购买的乐器信息
+     *
+     * @param studentId
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentPaymentOrderDetail> getStudentApplyDetail(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
 }

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectChangeDao.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface SubjectChangeDao extends BaseDAO<Integer, SubjectChange> {
+
+
+    /**
+     * 获取学生最后一次乐器替换记录
+     *
+     * @param studentId
+     * @param musicGroupId
+     * @return
+     */
+    SubjectChange getStudentLastChange(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 获取更换详情
+     * @param id
+     * @return
+     */
+    SubjectChange getChangeInfo(@Param("id") Integer id);
+}

+ 64 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CalenderPushDto.java

@@ -0,0 +1,64 @@
+package com.ym.mec.biz.dal.dto;
+
+public class CalenderPushDto{
+
+    private Long calenderId;
+
+    private Integer teacherId;
+
+    private String teacherPhone;
+
+    private String musicGroupName;
+
+    private String paymentValidStartDate;
+
+    private String paymentValidEndDate;
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public Long getCalenderId() {
+        return calenderId;
+    }
+
+    public void setCalenderId(Long calenderId) {
+        this.calenderId = calenderId;
+    }
+
+    public String getTeacherPhone() {
+        return teacherPhone;
+    }
+
+    public void setTeacherPhone(String teacherPhone) {
+        this.teacherPhone = teacherPhone;
+    }
+
+    public String getMusicGroupName() {
+        return musicGroupName;
+    }
+
+    public void setMusicGroupName(String musicGroupName) {
+        this.musicGroupName = musicGroupName;
+    }
+
+    public String getPaymentValidStartDate() {
+        return paymentValidStartDate;
+    }
+
+    public void setPaymentValidStartDate(String paymentValidStartDate) {
+        this.paymentValidStartDate = paymentValidStartDate;
+    }
+
+    public String getPaymentValidEndDate() {
+        return paymentValidEndDate;
+    }
+
+    public void setPaymentValidEndDate(String paymentValidEndDate) {
+        this.paymentValidEndDate = paymentValidEndDate;
+    }
+}

+ 62 - 16
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsSellDto.java

@@ -2,37 +2,83 @@ package com.ym.mec.biz.dal.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
+
 public class GoodsSellDto{
-	@ApiModelProperty(value = "使用余额", required = false)
-	private Boolean isUseBalancePayment;
+	@ApiModelProperty(value = "商品数量", required = false)
+	private Integer goodsNum = 1;
+
+	@ApiModelProperty(value = "商品编号", required = false)
+	private Integer goodsId;
+
+	@ApiModelProperty(value = "商品图片", required = false)
+	private String image;
+
+	@ApiModelProperty(value = "商品名称", required = false)
+	private String goodsName;
+
+	@ApiModelProperty(value = "商品销售类型", required = false)
+	private String goodsType;
+
+	@ApiModelProperty(value = "商品销售价", required = false)
+	private BigDecimal goodsPrice = BigDecimal.ZERO;
 
-	@ApiModelProperty(value = "商品列表", required = false)
-	String goodsId;
+	@ApiModelProperty(value = "商品销售总价", required = false)
+	private BigDecimal totalGoodsPrice = BigDecimal.ZERO;
 
-	@ApiModelProperty(value = "是否重复支付", required = false)
-	private boolean isRepeatPay;
+	public String getGoodsType() {
+		return goodsType;
+	}
+
+	public void setGoodsType(String goodsType) {
+		this.goodsType = goodsType;
+	}
+
+	public BigDecimal getTotalGoodsPrice() {
+		return totalGoodsPrice;
+	}
+
+	public void setTotalGoodsPrice(BigDecimal totalGoodsPrice) {
+		this.totalGoodsPrice = totalGoodsPrice;
+	}
+
+	public BigDecimal getGoodsPrice() {
+		return goodsPrice;
+	}
+
+	public void setGoodsPrice(BigDecimal goodsPrice) {
+		this.goodsPrice = goodsPrice;
+	}
+
+	public String getImage() {
+		return image;
+	}
+
+	public void setImage(String image) {
+		this.image = image;
+	}
 
-	public boolean getIsRepeatPay() {
-		return isRepeatPay;
+	public String getGoodsName() {
+		return goodsName;
 	}
 
-	public void setIsRepeatPay(boolean repeatPay) {
-		isRepeatPay = repeatPay;
+	public void setGoodsName(String goodsName) {
+		this.goodsName = goodsName;
 	}
 
-	public Boolean getIsUseBalancePayment() {
-		return isUseBalancePayment;
+	public Integer getGoodsNum() {
+		return goodsNum;
 	}
 
-	public void setIsUseBalancePayment(Boolean useBalancePayment) {
-		isUseBalancePayment = useBalancePayment;
+	public void setGoodsNum(Integer goodsNum) {
+		this.goodsNum = goodsNum;
 	}
 
-	public String getGoodsId() {
+	public Integer getGoodsId() {
 		return goodsId;
 	}
 
-	public void setGoodsId(String goodsId) {
+	public void setGoodsId(Integer goodsId) {
 		this.goodsId = goodsId;
 	}
 }

+ 38 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentGoodsSellDto.java

@@ -0,0 +1,38 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+
+import java.math.BigDecimal;
+
+public class StudentGoodsSellDto extends StudentPaymentOrder {
+
+    private String goodsJson;
+
+    private BigDecimal totalAmount;
+
+    private BigDecimal marketAmount;
+
+    public String getGoodsJson() {
+        return goodsJson;
+    }
+
+    public void setGoodsJson(String goodsJson) {
+        this.goodsJson = goodsJson;
+    }
+
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public BigDecimal getMarketAmount() {
+        return marketAmount;
+    }
+
+    public void setMarketAmount(BigDecimal marketAmount) {
+        this.marketAmount = marketAmount;
+    }
+}

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

@@ -86,6 +86,15 @@ public class MusicGroup {
 	/** 缴费截止日期 */
 	@ApiModelProperty(value = "乐团缴费截止日期",required = false)
 	private java.util.Date paymentExpireDate;
+
+	@ApiModelProperty(value = "缴费有效期开始时间", required = false)
+	private String paymentValidStartDate;
+
+	@ApiModelProperty(value = "缴费有效期结束时间", required = false)
+	private String paymentValidEndDate;
+
+	@ApiModelProperty(value = "缴费方式0按月,1按季,2一次性", required = false)
+	private Integer paymentPattern;
 	
 	/** 计费开始日期 */
 	@ApiModelProperty(value = "乐团计费开始日期 ",required = false)
@@ -156,6 +165,30 @@ public class MusicGroup {
 
 	private Boolean hasVerifyMusicalList = false;
 
+	public Integer getPaymentPattern() {
+		return paymentPattern;
+	}
+
+	public void setPaymentPattern(Integer paymentPattern) {
+		this.paymentPattern = paymentPattern;
+	}
+
+	public String getPaymentValidStartDate() {
+		return paymentValidStartDate;
+	}
+
+	public void setPaymentValidStartDate(String paymentValidStartDate) {
+		this.paymentValidStartDate = paymentValidStartDate;
+	}
+
+	public String getPaymentValidEndDate() {
+		return paymentValidEndDate;
+	}
+
+	public void setPaymentValidEndDate(String paymentValidEndDate) {
+		this.paymentValidEndDate = paymentValidEndDate;
+	}
+
 	public String getSubjectName() {
 		return subjectName;
 	}

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

@@ -43,23 +43,32 @@ public class MusicGroupPaymentCalender implements Comparable<MusicGroupPaymentCa
 		}
 	}
 
-	/**  */
 	private Long id;
 
-	/**  */
 	@ApiModelProperty(value = "乐团编号", required = false)
 	private String musicGroupId;
 
-	/** 缴费月份 */
 	@ApiModelProperty(value = "缴费月份", required = false)
 	private Integer paymentMonth;
 
-	/** 开始缴费日期 */
 	@ApiModelProperty(value = "开始缴费日期", required = false)
 	private java.util.Date startPaymentDate;
 
+	@ApiModelProperty(value = "截止缴费日期", required = false)
 	private Date deadlinePaymentDate;
 
+	@ApiModelProperty(value = "缴费有效期开始时间", required = false)
+	private String paymentValidStartDate;
+
+	@ApiModelProperty(value = "缴费有效期截止时间", required = false)
+	private String paymentValidEndDate;
+
+	@ApiModelProperty(value = "缴费方式0按月,1按季,2一次性", required = false)
+	private Integer paymentPattern;
+
+	@ApiModelProperty(value = "缴费类型0续费,1报名", required = false)
+	private Integer paymentType;
+
 	private PaymentStatusEnum paymentStatus;
 
 	private Integer expectNum;
@@ -70,14 +79,44 @@ public class MusicGroupPaymentCalender implements Comparable<MusicGroupPaymentCa
 
 	private FeeType type;
 
-	/**  */
 	private java.util.Date createTime;
 
-	/**  */
 	private java.util.Date updateTime;
 
 	private String studentIds;
 
+	public Integer getPaymentType() {
+		return paymentType;
+	}
+
+	public void setPaymentType(Integer paymentType) {
+		this.paymentType = paymentType;
+	}
+
+	public Integer getPaymentPattern() {
+		return paymentPattern;
+	}
+
+	public void setPaymentPattern(Integer paymentPattern) {
+		this.paymentPattern = paymentPattern;
+	}
+
+	public String getPaymentValidStartDate() {
+		return paymentValidStartDate;
+	}
+
+	public void setPaymentValidStartDate(String paymentValidStartDate) {
+		this.paymentValidStartDate = paymentValidStartDate;
+	}
+
+	public String getPaymentValidEndDate() {
+		return paymentValidEndDate;
+	}
+
+	public void setPaymentValidEndDate(String paymentValidEndDate) {
+		this.paymentValidEndDate = paymentValidEndDate;
+	}
+
 	public String getStudentIds() {
 		return studentIds;
 	}

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

@@ -58,6 +58,9 @@ public class MusicGroupStudentFee {
 	@ApiModelProperty(value = "最近缴费时间", required = false)
 	private Date latestPaidTime;
 
+	@ApiModelProperty(value = "缴费有效期结束时间", required = false)
+	private String paymentValidEndDate;
+
 	@ApiModelProperty(value = "连续旷到次数", required = false)
 	private Integer continuousAbsenteeismTimes;
 
@@ -98,6 +101,14 @@ public class MusicGroupStudentFee {
 	public MusicGroupStudentFee() {
 	}
 
+	public String getPaymentValidEndDate() {
+		return paymentValidEndDate;
+	}
+
+	public void setPaymentValidEndDate(String paymentValidEndDate) {
+		this.paymentValidEndDate = paymentValidEndDate;
+	}
+
 	public SysUser getSysUser() {
 		return sysUser;
 	}

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

@@ -53,19 +53,19 @@ public class SellOrder {
     * 应付金额
     */
     @ApiModelProperty(value="应付金额")
-    private BigDecimal expectAmount;
+    private BigDecimal expectAmount = BigDecimal.ZERO;
 
     /**
     * 现金支付金额
     */
     @ApiModelProperty(value="现金支付金额")
-    private BigDecimal actualAmount;
+    private BigDecimal actualAmount = BigDecimal.ZERO;
 
     /**
     * 余额支付金额
     */
     @ApiModelProperty(value="余额支付金额")
-    private BigDecimal balanceAmount;
+    private BigDecimal balanceAmount = BigDecimal.ZERO;
 
     /**
     * 销售成本

+ 172 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentGoodsSell.java

@@ -0,0 +1,172 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.dto.GoodsSellDto;
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 对应数据库表(student_goods_sell):
+ */
+public class StudentGoodsSell {
+
+	private Integer id;
+	
+	@ApiModelProperty(value = "用户编号",required = true)
+	private Integer userId;
+	
+	@ApiModelProperty(value = "教师编号",required = true)
+	private Integer teacherId;
+	
+	@ApiModelProperty(value = "商品列表",required = true)
+	private String goodsJson;
+
+	@ApiModelProperty(value = "订单编号",required = true)
+	private String orderNo;
+	
+	@ApiModelProperty(value = "总金额",required = true)
+	private java.math.BigDecimal totalAmount = BigDecimal.ZERO;
+	
+	@ApiModelProperty(value = "减免费用",required = true)
+	private java.math.BigDecimal marketAmount = BigDecimal.ZERO;
+
+	private Date createTime;
+
+	private Date updateTime;
+
+	@ApiModelProperty(value = "是否使用余额",required = true)
+	private Boolean isUseBalancePayment = false;
+
+	@ApiModelProperty(value = "是否重复支付",required = true)
+	private boolean isRepeatPay;
+
+	@ApiModelProperty(value = "商品列表",required = true)
+	private List<GoodsSellDto> goodsSellDtos;
+
+	@ApiModelProperty(value = "支付类型",required = true)
+	private Integer type = 0;
+
+	@ApiModelProperty(value = "分部编号", required = false)
+	private Integer organId;
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public List<GoodsSellDto> getGoodsSellDtos() {
+		return goodsSellDtos;
+	}
+
+	public void setGoodsSellDtos(List<GoodsSellDto> goodsSellDtos) {
+		this.goodsSellDtos = goodsSellDtos;
+	}
+
+	public String getOrderNo() {
+		return orderNo;
+	}
+
+	public void setOrderNo(String orderNo) {
+		this.orderNo = orderNo;
+	}
+
+	public boolean getIsRepeatPay() {
+		return isRepeatPay;
+	}
+
+	public void setIsRepeatPay(boolean repeatPay) {
+		isRepeatPay = repeatPay;
+	}
+
+	public Boolean getIsUseBalancePayment() {
+		return isUseBalancePayment;
+	}
+
+	public void setIsUseBalancePayment(Boolean useBalancePayment) {
+		isUseBalancePayment = useBalancePayment;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setUserId(Integer userId){
+		this.userId = userId;
+	}
+	
+	public Integer getUserId(){
+		return this.userId;
+	}
+			
+	public void setTeacherId(Integer teacherId){
+		this.teacherId = teacherId;
+	}
+	
+	public Integer getTeacherId(){
+		return this.teacherId;
+	}
+			
+	public void setGoodsJson(String goodsJson){
+		this.goodsJson = goodsJson;
+	}
+	
+	public String getGoodsJson(){
+		return this.goodsJson;
+	}
+			
+	public void setTotalAmount(java.math.BigDecimal totalAmount){
+		this.totalAmount = totalAmount;
+	}
+	
+	public java.math.BigDecimal getTotalAmount(){
+		return this.totalAmount;
+	}
+			
+	public void setMarketAmount(java.math.BigDecimal marketAmount){
+		this.marketAmount = marketAmount;
+	}
+	
+	public java.math.BigDecimal getMarketAmount(){
+		return this.marketAmount;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 326 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SubjectChange.java

@@ -0,0 +1,326 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.biz.dal.enums.SubjectChangeStatusEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+@ApiModel(value="com-ym-SubjectChange")
+public class SubjectChange {
+    @ApiModelProperty(value="")
+    private Integer id;
+
+    @ApiModelProperty(value="学生id")
+    private Integer studentId;
+
+    private String studentName;
+
+    @ApiModelProperty(value="分部id")
+    private Integer organId;
+
+    @ApiModelProperty(value="乐团id")
+    private String musicGroupId;
+
+    /**
+    * 原始课程费用
+    */
+    @ApiModelProperty(value="原始课程费用")
+    private BigDecimal originalCourseFee;
+
+    /**
+    * 原始乐器编号
+    */
+    @ApiModelProperty(value="原始乐器编号")
+    private Integer originalMusical;
+
+    private Goods originalMusicalGoods;
+
+    /**
+    * 原始乐器价格
+    */
+    @ApiModelProperty(value="原始乐器价格")
+    private BigDecimal originalMusicalPrice;
+
+    /**
+    * 辅件ids
+    */
+    @ApiModelProperty(value="辅件ids")
+    private String originalAccessories;
+
+    private List<Goods> originalAccessoriesGoods;
+
+    /**
+    * 辅件价格
+    */
+    @ApiModelProperty(value="辅件价格")
+    private BigDecimal originalAccessoriesPrice;
+
+    /**
+    * 替换课程价格
+    */
+    @ApiModelProperty(value="替换课程价格")
+    private BigDecimal changeCourseFee;
+
+    /**
+    * 替换乐器
+    */
+    @ApiModelProperty(value="替换乐器")
+    private Integer changeMusical;
+
+    private Goods changeMusicalGoods;
+
+
+    /**
+    * 替换乐器价格
+    */
+    @ApiModelProperty(value="替换乐器价格")
+    private BigDecimal changeMusicalPrice;
+
+    /**
+    * 替换辅件
+    */
+    @ApiModelProperty(value="替换辅件")
+    private String changeAccessories;
+    private List<Goods> changeAccessoriesGoods;
+
+
+    /**
+    * 替换辅件价格
+    */
+    @ApiModelProperty(value="替换辅件价格")
+    private BigDecimal changeAccessoriesPrice;
+
+    /**
+    * 乐器辅件差额
+    */
+    @ApiModelProperty(value="乐器辅件差额")
+    private BigDecimal goodsMargin;
+
+    /**
+    * 课程差额
+    */
+    @ApiModelProperty(value="课程差额")
+    private BigDecimal courseMargin;
+
+    /**
+    * 状态
+    */
+    @ApiModelProperty(value="状态")
+    private SubjectChangeStatusEnum status;
+
+    /**
+    * 创建时间
+    */
+    @ApiModelProperty(value="创建时间")
+    private Date createTime;
+
+    /**
+    * 修改时间
+    */
+    @ApiModelProperty(value="修改时间")
+    private Date updateTime;
+
+    private Integer version;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public BigDecimal getOriginalCourseFee() {
+        return originalCourseFee;
+    }
+
+    public void setOriginalCourseFee(BigDecimal originalCourseFee) {
+        this.originalCourseFee = originalCourseFee;
+    }
+
+    public Integer getOriginalMusical() {
+        return originalMusical;
+    }
+
+    public void setOriginalMusical(Integer originalMusical) {
+        this.originalMusical = originalMusical;
+    }
+
+    public BigDecimal getOriginalMusicalPrice() {
+        return originalMusicalPrice;
+    }
+
+    public void setOriginalMusicalPrice(BigDecimal originalMusicalPrice) {
+        this.originalMusicalPrice = originalMusicalPrice;
+    }
+
+    public String getOriginalAccessories() {
+        return originalAccessories;
+    }
+
+    public void setOriginalAccessories(String originalAccessories) {
+        this.originalAccessories = originalAccessories;
+    }
+
+    public BigDecimal getOriginalAccessoriesPrice() {
+        return originalAccessoriesPrice;
+    }
+
+    public void setOriginalAccessoriesPrice(BigDecimal originalAccessoriesPrice) {
+        this.originalAccessoriesPrice = originalAccessoriesPrice;
+    }
+
+    public BigDecimal getChangeCourseFee() {
+        return changeCourseFee;
+    }
+
+    public void setChangeCourseFee(BigDecimal changeCourseFee) {
+        this.changeCourseFee = changeCourseFee;
+    }
+
+    public Integer getChangeMusical() {
+        return changeMusical;
+    }
+
+    public void setChangeMusical(Integer changeMusical) {
+        this.changeMusical = changeMusical;
+    }
+
+    public BigDecimal getChangeMusicalPrice() {
+        return changeMusicalPrice;
+    }
+
+    public void setChangeMusicalPrice(BigDecimal changeMusicalPrice) {
+        this.changeMusicalPrice = changeMusicalPrice;
+    }
+
+    public String getChangeAccessories() {
+        return changeAccessories;
+    }
+
+    public void setChangeAccessories(String changeAccessories) {
+        this.changeAccessories = changeAccessories;
+    }
+
+    public BigDecimal getChangeAccessoriesPrice() {
+        return changeAccessoriesPrice;
+    }
+
+    public void setChangeAccessoriesPrice(BigDecimal changeAccessoriesPrice) {
+        this.changeAccessoriesPrice = changeAccessoriesPrice;
+    }
+
+    public BigDecimal getGoodsMargin() {
+        return goodsMargin;
+    }
+
+    public void setGoodsMargin(BigDecimal goodsMargin) {
+        this.goodsMargin = goodsMargin;
+    }
+
+    public BigDecimal getCourseMargin() {
+        return courseMargin;
+    }
+
+    public void setCourseMargin(BigDecimal courseMargin) {
+        this.courseMargin = courseMargin;
+    }
+
+    public SubjectChangeStatusEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(SubjectChangeStatusEnum status) {
+        this.status = status;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public Goods getOriginalMusicalGoods() {
+        return originalMusicalGoods;
+    }
+
+    public void setOriginalMusicalGoods(Goods originalMusicalGoods) {
+        this.originalMusicalGoods = originalMusicalGoods;
+    }
+
+    public List<Goods> getOriginalAccessoriesGoods() {
+        return originalAccessoriesGoods;
+    }
+
+    public void setOriginalAccessoriesGoods(List<Goods> originalAccessoriesGoods) {
+        this.originalAccessoriesGoods = originalAccessoriesGoods;
+    }
+
+    public Goods getChangeMusicalGoods() {
+        return changeMusicalGoods;
+    }
+
+    public void setChangeMusicalGoods(Goods changeMusicalGoods) {
+        this.changeMusicalGoods = changeMusicalGoods;
+    }
+
+    public List<Goods> getChangeAccessoriesGoods() {
+        return changeAccessoriesGoods;
+    }
+
+    public void setChangeAccessoriesGoods(List<Goods> changeAccessoriesGoods) {
+        this.changeAccessoriesGoods = changeAccessoriesGoods;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+}

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

@@ -11,7 +11,8 @@ public enum GroupType implements BaseEnum<String, GroupType> {
 	COMM("对外课程"),
 	REPAIR("乐器维修"),
 	GOODS_SELL("商品销售"),
-	OUTORDER("外部订单");
+	OUTORDER("外部订单"),
+	SUBJECT_CHANGE("声部更换");
 
 	private String desc;
 

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

@@ -154,6 +154,8 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     SMS_REPAIR_ONLINE_PAYMENT_SUCCESS("SMS_REPAIR_ONLINE_PAYMENT_SUCCESS","乐器线上维修支付成功"),
     SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS("SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS","乐器线下维修支付成功"),
     SMS_REPAIR_UNSEND_COMPLETED("SMS_REPAIR_UNSEND_COMPLETED","乐器维修完成自取"),
+    SMS_PAYMENT_DETAIL("SMS_PAYMENT_DETAIL","缴费项目缴费详情提醒"),
+    SMS_PAYMENT_CREATE("SMS_PAYMENT_CREATE","缴费项目创建提醒"),
     SMS_REPAIR_SEND_COMPLETED("SMS_REPAIR_SEND_COMPLETED","乐器维修完成邮寄");
 
 

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

@@ -18,7 +18,8 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
 	TENANT_RECHARGE("TENANT_RECHARGE","租户充值"),
 	GOODS_SELL("GOODS_SELL","商品销售"),
 	OUTORDER("OUTORDER", "外部订单"),
-	REPAIR("REPAIR","乐器维修");
+	REPAIR("REPAIR","乐器维修"),
+	SUBJECT_CHANGE("SUBJECT_CHANGE","声部更换");
 
 
 	private String code;

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SubjectChangeStatusEnum.java

@@ -0,0 +1,30 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+public enum SubjectChangeStatusEnum implements BaseEnum<Integer, SubjectChangeStatusEnum> {
+
+    CANCELED(-1, "已取消"),
+    WAIT_PAY(0, "待支付"),
+    ING(1, "支付中"),
+    SUCCESSED(2, "已支付");
+
+    private Integer code;
+
+    private String desc;
+
+    private SubjectChangeStatusEnum(Integer code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    @Override
+    public Integer getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+}

+ 41 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/GoodsSellQueryInfo.java

@@ -0,0 +1,41 @@
+package com.ym.mec.biz.dal.page;
+
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.common.page.QueryInfo;
+import io.swagger.annotations.ApiModelProperty;
+
+public class GoodsSellQueryInfo extends QueryInfo {
+	
+	@ApiModelProperty(value = "教师编号", required = false)
+	private Integer teacherId;
+
+	@ApiModelProperty(value = "学员编号", required = false)
+	private Integer studentId;
+
+	@ApiModelProperty(value = "交易状态",required = true)
+	private DealStatusEnum status;
+
+	public Integer getTeacherId() {
+		return teacherId;
+	}
+
+	public void setTeacherId(Integer teacherId) {
+		this.teacherId = teacherId;
+	}
+
+	public Integer getStudentId() {
+		return studentId;
+	}
+
+	public void setStudentId(Integer studentId) {
+		this.studentId = studentId;
+	}
+
+	public DealStatusEnum getStatus() {
+		return status;
+	}
+
+	public void setStatus(DealStatusEnum status) {
+		this.status = status;
+	}
+}

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

@@ -302,7 +302,7 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 
 	/**
 	 * @describe 临时课检测
-	 * @author Joburgess
+	 * @author 周剑河
 	 * @date 2019/12/6
 	 * @param courseSchedules: 课程计划列表
 	 * @return void

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

@@ -40,11 +40,9 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 
 	/**
 	 * 修改缴费日期
-	 * @param startTime
-	 * @param endTime
-	 * @param id
+	 * @param paymentCalender
 	 */
-    void updateStartTime(Date startTime,Date endTime,Long id);
+    void updateStartTime(MusicGroupPaymentCalender paymentCalender);
 
 	/**
 	 * 删除
@@ -73,4 +71,15 @@ public interface MusicGroupPaymentCalenderService extends BaseService<Long, Musi
 	 * @return
 	 */
 	void paymentPush(Long id, String userIds);
+
+	/**
+	 * @describe 更新乐团学员缴费状态
+	 * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+	 * @author zouxuan
+	 * @date 2020/9/21
+	 * @time 13:56
+	 * @param :
+	 * @return void
+	 */
+	void autoUpdateMusicGroupStudentFeeStatus();
 }

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

@@ -31,4 +31,5 @@ public interface SellOrderService extends BaseService<Integer, SellOrder> {
      */
     List<SellOrder> addOrderDetail2SellOrder(List<StudentPaymentOrderDetail> orderDetails, StudentPaymentOrder studentPaymentOrder, MusicGroup musicGroup);
 
+    void batchInsert(List<SellOrder> sellOrders);
 }

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

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service;
+
+
+import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.common.service.BaseService;
+
+public interface StudentGoodsSellService extends BaseService<Integer, StudentGoodsSell> {
+
+    /**
+     * @describe 分页查询教务老师关联的学员订单
+     * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
+     * @author zouxuan
+     * @date 2020/9/23
+     * @time 11:51
+     * @param queryInfo:
+     * @return java.lang.Object
+     */
+    PageInfo<StudentGoodsSellDto> queryStudentGoodsOrders(QueryInfo queryInfo);
+}

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

@@ -250,4 +250,12 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	StudentMusicDetailDto getStudentDetail(Integer studentId);
+
+	/**
+	 * 获取学生
+	 * @param studentId
+	 * @param musicGroupId
+	 * @return
+	 */
+	List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId,String musicGroupId);
 }

+ 5 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java

@@ -1,16 +1,14 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.GoodsSellDto;
+import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
-import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
-import java.util.Date;
 import java.util.Map;
 
 public interface StudentRepairService extends BaseService<Integer, StudentRepair> {
@@ -75,10 +73,10 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @author zouxuan
      * @date 2020/9/16
      * @time 13:47
-     * @param goodsSellDto:
+     * @param studentGoodsSell:
      * @return java.util.Map
      */
-    Map addGoodsSellOrder(GoodsSellDto goodsSellDto) throws Exception;
+    Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
 
     /**
      * @describe 商品销售订单回调
@@ -89,5 +87,5 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @param order:
      * @return void
      */
-    void goodsSellorderCallback(StudentPaymentOrder order);
+    void goodsSellOrderCallback(StudentPaymentOrder order);
 }

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

@@ -0,0 +1,22 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.common.service.BaseService;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public interface SubjectChangeService extends BaseService<Integer, SubjectChange> {
+
+    SubjectChange getChangeInfo(Integer id);
+
+    /**
+     * 支付声部更换费用
+     *
+     * @param id
+     * @param amount
+     * @param isUseBalancePayment
+     * @return
+     */
+    Map payChange(Integer id, BigDecimal amount, Boolean isUseBalancePayment) throws Exception;
+}

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

@@ -58,7 +58,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
 		List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
 		Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
 		Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
-		Map<String, Integer> phoneMap = getMap("sys_user", "phone_", "id_", true, String.class, Integer.class);
+//		Map<String, Integer> phoneMap = getMap("sys_user", "phone_", "id_", true, String.class, Integer.class);
 		for (String e : sheetsListMap.keySet()) {
 			List<Map<String, Object>> sheet = sheetsListMap.get(e);
 			List<Object> collect = sheet.stream().map(m -> m.get("钉钉流程编号")).collect(Collectors.toList());

+ 63 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalenderDetail;
@@ -35,10 +36,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-
 	@Autowired
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
-
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 	@Autowired
@@ -70,13 +69,18 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		// 判断缴费开始时间、结束时间是否被其他缴费记录占用
 		int count = musicGroupPaymentCalenderDao.queryIntersectionByPaymentDate(musicGroupId, musicGroupPaymentCalender.getStartPaymentDate(),
-				musicGroupPaymentCalender.getDeadlinePaymentDate());
+				musicGroupPaymentCalender.getDeadlinePaymentDate(),null);
 
 //		String format = DateUtil.format(musicGroupPaymentCalender.getStartPaymentDate(), DateUtil.DEFAULT_PATTERN);
 //		String format1 = DateUtil.format(musicGroupPaymentCalender.getDeadlinePaymentDate(), DateUtil.DEFAULT_PATTERN);
 //		int count = musicGroupPaymentCalenderDao.queryIntersectionByDate(musicGroupId, format,format1);
 		if (count > 0) {
-			throw new BizException("缴费时间存在冲突,请修改缴费开始日期");
+			throw new BizException("缴费日期存在冲突,请修改缴费日期");
+		}
+		count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
+				musicGroupPaymentCalender.getPaymentValidEndDate(),null);
+		if (count > 0) {
+			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
 		}
 		if (date.after(musicGroupPaymentCalender.getDeadlinePaymentDate())) {
 			musicGroupPaymentCalender.setPaymentStatus(PaymentStatusEnum.YES);
@@ -149,6 +153,45 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	}
 
 	@Override
+	public void autoUpdateMusicGroupStudentFeeStatus() {
+		Date date = new Date();
+		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
+		//将有效期已截止的学员缴费信息修改为未缴费
+		musicGroupStudentFeeDao.updateFeeStatus();
+		//获取距离缴费开启指定天数后的缴费明细
+		String configValue = sysConfigDao.findConfigValue("push_payment_detail");
+		Map<Long, Long> maps = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryCalenderByDay(configValue));
+		if(maps != null && maps.size() > 0){
+			Set<Long> calenderId = maps.keySet();
+			List<CalenderPushDto> calenderPushDtos = musicGroupPaymentCalenderDao.getCalenderPushDto(calenderId);
+			Map<Long, List<CalenderPushDto>> collect = calenderPushDtos.stream().collect(Collectors.groupingBy(CalenderPushDto::getCalenderId));
+			calenderId.forEach(e->{
+				CalenderPushDto calenderPushDto = collect.get(e).get(0);
+				Map<Integer, String> receivers = new HashMap<>(1);
+				receivers.put(calenderPushDto.getTeacherId(),calenderPushDto.getTeacherPhone());
+				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_DETAIL,
+						receivers, null, 0, null, null,calenderPushDto.getMusicGroupName(),
+						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate(),maps.get(e));
+			});
+		}
+		//获取离截止还有指定时间的缴费项,并发送推送消息给指定老师
+		String configValue1 = sysConfigDao.findConfigValue("push_create_payment_calender");
+		List<Long> calenderIds = musicGroupPaymentCalenderDao.queryEndIds(configValue1,format);
+		if(calenderIds != null && calenderIds.size() > 0){
+			List<CalenderPushDto> calenderPushDtos = musicGroupPaymentCalenderDao.getCalenderPushDto(calenderIds);
+			Map<Long, List<CalenderPushDto>> collect = calenderPushDtos.stream().collect(Collectors.groupingBy(CalenderPushDto::getCalenderId));
+			calenderIds.forEach(e->{
+				CalenderPushDto calenderPushDto = collect.get(e).get(0);
+				Map<Integer, String> receivers = new HashMap<>(1);
+				receivers.put(calenderPushDto.getTeacherId(),calenderPushDto.getTeacherPhone());
+				sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_CREATE,
+						receivers, null, 0, null, null,calenderPushDto.getMusicGroupName(),
+						calenderPushDto.getPaymentValidStartDate(),calenderPushDto.getPaymentValidEndDate());
+			});
+		}
+	}
+
+	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean autoUpdateMusicGroupPaymentCalenderStatus() {
 		// 获取当天创建且未缴费的数据,并推送
@@ -342,11 +385,11 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void updateStartTime(Date startTime,Date endTime,Long id) {
-		if (startTime == null || id == null || endTime == null) {
-			throw new BizException("参数校验失败");
-		}
-		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(id);
+	public void updateStartTime(MusicGroupPaymentCalender paymentCalender) {
+//		if (startTime == null || id == null || endTime == null) {
+//			throw new BizException("参数校验失败");
+//		}
+		MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(paymentCalender.getId());
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
@@ -355,19 +398,25 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		}
 		Date date = new Date();
 		// 判断缴费开始时间、结束时间是否被其他缴费记录占用
-		int count = musicGroupPaymentCalenderDao.queryIntersectionByPaymentDate(calender.getMusicGroupId(), startTime,endTime);
+		int count = musicGroupPaymentCalenderDao.queryIntersectionByPaymentDate(calender.getMusicGroupId(), paymentCalender.getStartPaymentDate(),paymentCalender.getDeadlinePaymentDate(),paymentCalender.getId());
 //		String format = DateUtil.format(startTime, DateUtil.DEFAULT_PATTERN);
 //		String format1 = DateUtil.format(endTime, DateUtil.DEFAULT_PATTERN);
 //		int count = musicGroupPaymentCalenderDao.queryIntersectionByDate(calender.getMusicGroupId(), format,format1);
 		if (count > 0) {
 			throw new BizException("缴费时间存在冲突,请修改缴费开始日期");
 		}
-		calender.setStartPaymentDate(startTime);
-		calender.setDeadlinePaymentDate(endTime);
+		count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(calender.getMusicGroupId(), paymentCalender.getPaymentValidStartDate(),
+				paymentCalender.getPaymentValidEndDate(),paymentCalender.getId());
+		if (count > 0) {
+			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
+		}
+		calender.setStartPaymentDate(paymentCalender.getStartPaymentDate());
+		calender.setDeadlinePaymentDate(paymentCalender.getDeadlinePaymentDate());
+		calender.setPaymentPattern(paymentCalender.getPaymentPattern());
 		calender.setUpdateTime(date);
-		if (endTime.before(date) && !DateUtil.isSameDay(date,endTime)) {
+		if (paymentCalender.getDeadlinePaymentDate().before(date) && !DateUtil.isSameDay(date,paymentCalender.getDeadlinePaymentDate())) {
 			calender.setPaymentStatus(PaymentStatusEnum.YES);
-		} else if (date.after(startTime) || DateUtil.isSameDay(date,endTime)) {
+		} else if (date.after(paymentCalender.getStartPaymentDate()) || DateUtil.isSameDay(date,paymentCalender.getStartPaymentDate())) {
 			calender.setPaymentStatus(PaymentStatusEnum.OPEN);
 			//修改Fee缴费状态为未缴费
 			musicGroupStudentFeeDao.updatePaymentStatus(calender.getId(),"NON_PAYMENT");

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

@@ -26,7 +26,6 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
-
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -1758,6 +1757,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                 musicGroupStudentFee.setRemainNetworkClassTimes(getRemainNetworkClassTimes + 1);
             }
 //            musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId, musicGroupStudentFee.getNextPaymentDate(), musicGroupStudentFee));
+            musicGroupStudentFee.setPaymentValidEndDate(musicGroupPaymentCalender.getPaymentValidEndDate());
             musicGroupStudentFeeDao.update(musicGroupStudentFee);
 
             //更新学生的缴费记录状态

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

@@ -214,4 +214,9 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         return sellOrders;
     }
 
+    @Override
+    public void batchInsert(List<SellOrder> sellOrders) {
+        sellOrderDao.batchInsert(sellOrders);
+    }
+
 }

+ 51 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java

@@ -0,0 +1,51 @@
+package com.ym.mec.biz.service.impl;
+
+
+import com.ym.mec.biz.dal.dao.StudentGoodsSellDao;
+import com.ym.mec.biz.dal.dto.StudentGoodsSellDto;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.biz.service.StudentGoodsSellService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, StudentGoodsSell> implements StudentGoodsSellService {
+	
+	@Autowired
+	private StudentGoodsSellDao studentGoodsSellDao;
+
+	@Override
+	public BaseDAO<Integer, StudentGoodsSell> getDAO() {
+		return studentGoodsSellDao;
+	}
+
+	@Override
+	public PageInfo<StudentGoodsSellDto> queryStudentGoodsOrders(QueryInfo queryInfo) {
+		//根据订单状态和教务老师获取订单列表
+		PageInfo<StudentGoodsSellDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+		List<StudentGoodsSellDto> dataList = null;
+		int count = studentGoodsSellDao.countStudentGoodsOrders(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = studentGoodsSellDao.queryStudentGoodsOrders(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+}

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

@@ -246,7 +246,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         } else if (order.getType().equals(OrderTypeEnum.REPAIR)) {
             studentRepairService.orderCallback(order);
         } else if (order.getType().equals(OrderTypeEnum.GOODS_SELL)) {
-            studentRepairService.goodsSellorderCallback(order);
+            studentRepairService.goodsSellOrderCallback(order);
         }
     }
 
@@ -283,7 +283,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                 } else if (order.getType().equals(OrderTypeEnum.REPAIR)) {
                     studentRepairService.orderCallback(order);
                 } else if (order.getType().equals(OrderTypeEnum.GOODS_SELL)) {
-                    studentRepairService.goodsSellorderCallback(order);
+                    studentRepairService.goodsSellOrderCallback(order);
                 }
             } catch (Exception e) {
                 e.printStackTrace();

+ 47 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -96,6 +96,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private SellOrderService sellOrderService;
     @Autowired
     private ESealPlugin eSealPlugin;
+    @Autowired
+    private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -236,8 +242,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
                 sysUser.setImToken(register.getToken());
             } else {
-                if(StringUtils.isNotEmpty(sysUser.getUsername())){
-                    if(!sysUser.getUsername().equals(studentRegistration.getName())){
+                if (StringUtils.isNotEmpty(sysUser.getUsername())) {
+                    if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");
                     }
                 }
@@ -592,8 +598,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
             } else {
-                if(StringUtils.isNotEmpty(sysUser.getUsername())){
-                    if(!sysUser.getUsername().equals(studentRegistration.getName())){
+                if (StringUtils.isNotEmpty(sysUser.getUsername())) {
+                    if (!sysUser.getUsername().equals(studentRegistration.getName())) {
                         throw new BizException("操作失败:账户已被注册");
                     }
                 }
@@ -698,9 +704,13 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             MusicGroupStudentFee musicGroupStudentFee = new MusicGroupStudentFee(musicGroupId,
                     userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
                     null, studentAddDto.getTemporaryCourseFee(), paymentStatus);
+
             if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() * 100 == 0) {
                 musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
             }
+            if(studentRegistration.getPaymentStatus() == PaymentStatusEnum.YES){
+                musicGroupStudentFee.setPaymentValidEndDate(musicGroup.getPaymentValidEndDate());
+            }
             musicGroupStudentFeeDao.insert(musicGroupStudentFee);
 //            musicGroupStudentFeeDao.insert(new MusicGroupStudentFee(musicGroupId,
 //                    userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
@@ -866,6 +876,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE) {
                     musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
                 }
+                musicGroupStudentFee.setPaymentValidEndDate(musicGroup.getPaymentValidEndDate());
                 musicGroupStudentFee.setUpdateTime(nowDate);
                 musicGroupStudentFeeDao.update(musicGroupStudentFee);
                 //添加学生
@@ -912,7 +923,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //销售订单详情
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
             if (orderDetails.size() > 0) {
-                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder,musicGroup);
+                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, musicGroup);
             }
 
             //三方乐团不发送缴费通知
@@ -1113,4 +1124,35 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public StudentMusicDetailDto getStudentDetail(Integer studentId) {
         return studentRegistrationDao.getStudentDetail(studentId);
     }
+
+    @Override
+    public List<StudentPaymentOrderDetail> getStudentApplyDetail(Integer studentId, String musicGroupId) {
+        SubjectChange studentLastChange = subjectChangeDao.getStudentLastChange(studentId, musicGroupId);
+        List<StudentPaymentOrderDetail> details = new ArrayList<>();
+        if (studentLastChange != null) {
+            StudentPaymentOrderDetail course = new StudentPaymentOrderDetail();
+            course.setType(OrderDetailTypeEnum.COURSE);
+            course.setPrice(studentLastChange.getChangeCourseFee());
+            details.add(course);
+            if (studentLastChange.getChangeMusical() != null) {
+                StudentPaymentOrderDetail musical = new StudentPaymentOrderDetail();
+                musical.setType(OrderDetailTypeEnum.MUSICAL);
+                musical.setPrice(studentLastChange.getChangeMusicalPrice());
+                musical.setGoodsList(goodsDao.findGoodsByIds(studentLastChange.getChangeMusical().toString()));
+                details.add(musical);
+            }
+
+            if (studentLastChange.getChangeAccessories() != null) {
+                StudentPaymentOrderDetail accessories = new StudentPaymentOrderDetail();
+                accessories.setType(OrderDetailTypeEnum.ACCESSORIES);
+                accessories.setPrice(studentLastChange.getChangeAccessoriesPrice());
+                accessories.setGoodsList(goodsDao.findGoodsByIds(studentLastChange.getChangeAccessories()));
+                details.add(accessories);
+            }
+        }
+        if (details.size() <= 0) {
+            details = studentPaymentOrderDetailDao.getStudentApplyDetail(studentId, musicGroupId);
+        }
+        return details;
+    }
 }

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

@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 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.SellOrderDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentRepairDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.GoodsSellDto;
 import com.ym.mec.biz.dal.dto.RepairGoodsDto;
@@ -28,6 +25,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -51,7 +49,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
     @Autowired
-    private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
+    private MusicGroupDao musicGroupDao;
     @Autowired
     private SysUserCashAccountService sysUserCashAccountService;
     @Autowired
@@ -61,15 +59,15 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Autowired
     private StudentDao studentDao;
     @Autowired
-    private GoodsService goodsService;
-    @Autowired
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
     @Autowired
     private SellOrderService sellOrderService;
     @Autowired
-    private SellOrderDao sellOrderDao;
+    private StudentGoodsSellDao studentGoodsSellDao;
     @Autowired
     private ContractService contractService;
+    @Autowired
+    private GoodsService goodsService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -106,12 +104,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Map addGoodsSellOrder(GoodsSellDto goodsSellDto) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        Integer studentId = sysUser.getId();
-        String goodsId = goodsSellDto.getGoodsId();
-        if (StringUtils.isEmpty(goodsId)) {
+    @Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
+    public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
+        Integer studentId = studentGoodsSell.getUserId();
+        List<GoodsSellDto> goodsSellDtos = studentGoodsSell.getGoodsSellDtos();
+        if(goodsSellDtos == null || goodsSellDtos.size() == 0){
             throw new BizException("请选择需要购买的商品");
         }
         if (studentId == null) {
@@ -120,14 +117,45 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentDao.lockUser(studentId);
         SysUser student = sysUserFeignService.queryUserById(studentId);
         String orderNo = idGeneratorService.generatorId("payment") + "";
+        studentGoodsSell.setOrderNo(orderNo);
+        if(studentGoodsSell.getTeacherId() == null){
+            //获取学员第一个教务老师
+            studentGoodsSell.setTeacherId(musicGroupDao.getFirstEduTeacherId(studentGoodsSell.getUserId()));
+        }
+        List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
 
-        String[] goodsIds = goodsId.split(",");
-        Map<String, BigDecimal> map = getMap("goods", "id_", "group_purchase_price_", goodsId, String.class, BigDecimal.class);
+//        String[] goodsIds = goodsJson.split(",");
+        Map<Integer, BigDecimal> map = getMap("goods", "id_", "market_price_", goodsIds, Integer.class, BigDecimal.class);
+        for (GoodsSellDto goodsSellDto : goodsSellDtos) {
+            goodsSellDto.setGoodsPrice(map.get(goodsSellDto.getGoodsId()));
+            goodsSellDto.setTotalGoodsPrice(map.get(goodsSellDto.getGoodsId()).multiply(new BigDecimal(goodsSellDto.getGoodsNum())));
+        }
+        Map<Integer, List<GoodsSellDto>> goodsMap = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
         BigDecimal amount = BigDecimal.ZERO;
-        for (String id : goodsIds) {
-            amount.add(map.get(id));
+        for (Integer id : goodsIds) {
+            GoodsSellDto goodsSellDto = goodsMap.get(id).get(0);
+            amount = amount.add(goodsSellDto.getTotalGoodsPrice());
+        }
+        amount = amount.subtract(studentGoodsSell.getMarketAmount());
+        if(amount.signum() < 0){
+            throw new BizException("操作失败:订单金额异常");
+        }
+        studentGoodsSell.setOrganId(student.getOrganId());
+        studentGoodsSell.setTotalAmount(amount);
+        studentGoodsSell.setGoodsJson(JSONObject.toJSONString(goodsSellDtos));
+        if(studentGoodsSell.getId() == null){
+            studentGoodsSellDao.insert(studentGoodsSell);
+        }else {
+            studentGoodsSellDao.update(studentGoodsSell);
         }
-        List<Goods> goods = goodsService.findGoodsByIds(goodsId);
+
+        if (studentGoodsSell.getType() == 1) {
+            Map<String, Object> repairInfoMap = new HashMap<>();
+            MapUtil.populateMap(repairInfoMap, studentGoodsSell);
+            return repairInfoMap;
+        }
+
+//        List<Goods> goods = goodsService.findGoodsByIds(StringUtils.join(goodsIds,","));
 
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentId);
@@ -141,7 +169,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setRoutingOrganId(student.getOrganId());
         studentPaymentOrderService.insert(studentPaymentOrder);
 
-        Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getId));
+        /*Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getId));
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         for (String id : goodsIds) {
             Goods e = collect.get(id).get(0);
@@ -162,11 +190,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             studentPaymentOrderDetail.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.GROUP);
             studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         }
-        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);*/
 
         studentPaymentOrder.setVersion(0);
         BigDecimal balance = BigDecimal.ZERO;
-        if (goodsSellDto.getIsUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
+        if (studentGoodsSell.getIsUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
             SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(studentId);
             if (userCashAccount == null) {
                 throw new BizException("用户账户不存在");
@@ -509,7 +537,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public void goodsSellorderCallback(StudentPaymentOrder studentPaymentOrder) {
+    public void goodsSellOrderCallback(StudentPaymentOrder studentPaymentOrder) {
         Date nowDate = new Date();
         //更新订单信息
         studentPaymentOrder.setUpdateTime(nowDate);
@@ -555,11 +583,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 rechargeDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
             }
             sysUserCashAccountDetailService.insert(paymentDetail);
-            //销售订单详情
-            List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
-            if (orderDetails.size() > 0) {
-                sellOrderService.addOrderDetail2SellOrder(orderDetails, studentPaymentOrder, null);
-            }
+            saveSellOrder(studentPaymentOrder.getOrderNo());
         } else if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                 sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "乐器维修支付失败");
@@ -567,6 +591,50 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
     }
 
+    private void saveSellOrder(String orderNo){
+        StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
+        StudentGoodsSell studentGoodsSell = studentGoodsSellDao.findByOrderNo(orderNo);
+        String goodsJson = studentGoodsSell.getGoodsJson();
+        List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(goodsJson, GoodsSellDto.class);
+        Map<Integer, List<GoodsSellDto>> collect = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
+        List<Integer> goodsId = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
+        List<Goods> goodsByIds = goodsService.findGoodsByIds(StringUtils.join(goodsId, ","));
+        Map<Integer, List<Goods>> goodsMap = goodsByIds.stream().collect(Collectors.groupingBy(Goods::getId));
+        Map<String, BigDecimal> costMap = new HashMap<>(2);
+        List<SellOrder> sellOrders = new ArrayList<>();
+        goodsId.forEach(e->{
+            GoodsSellDto goodsSellDto = collect.get(e).get(0);
+            Goods goods = goodsMap.get(e).get(0);
+
+            costMap.put("sellCost", goods.getDiscountPrice());
+            if (goods.getAgreeCostPrice() != null) {
+                costMap.put("SellCost2", goods.getAgreeCostPrice());
+            }
+            SellOrder sellOrder = new SellOrder();
+            sellOrder.setOrganId(orderByOrderNo.getOrganId());
+            sellOrder.setTransNo(orderByOrderNo.getTransNo());
+            sellOrder.setOrderId(orderByOrderNo.getId());
+            sellOrder.setOrderNo(orderByOrderNo.getOrderNo());
+            sellOrder.setExpectAmount(orderByOrderNo.getExpectAmount());
+            sellOrder.setActualAmount(orderByOrderNo.getActualAmount());
+            sellOrder.setBalanceAmount(orderByOrderNo.getBalancePaymentAmount());
+            sellOrder.setSellCost(goods.getDiscountPrice());
+            sellOrder.setSellCost2(JSONObject.toJSONString(costMap));
+            sellOrder.setType(SellTypeEnum.valueOf(goods.getType().getCode()));
+            sellOrder.setGoodsId(e);
+            sellOrder.setGoodsName(goods.getName());
+            sellOrder.setNum(goodsSellDto.getGoodsNum());
+            sellOrder.setUserId(studentGoodsSell.getUserId());
+            sellOrder.setPaymentChannel(orderByOrderNo.getPaymentChannel());
+            sellOrder.setMerNo(orderByOrderNo.getMerNos());
+            sellOrder.setSellTime(orderByOrderNo.getPayTime());
+            sellOrders.add(sellOrder);
+        });
+        if(sellOrders.size() > 0){
+            sellOrderService.batchInsert(sellOrders);
+        }
+    }
+
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public Boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {

+ 161 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -0,0 +1,161 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.SubjectChangeDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.IdGeneratorService;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectChange> implements SubjectChangeService {
+
+    @Autowired
+    private SubjectChangeDao subjectChangeDao;
+    @Autowired
+    private GoodsDao goodsDao;
+    @Autowired
+    private StudentDao studentDao;
+    @Autowired
+    private IdGeneratorService idGeneratorService;
+    @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
+    private SysUserCashAccountService sysUserCashAccountService;
+    @Autowired
+    private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
+    @Autowired
+    private SysConfigDao sysConfigDao;
+    @Autowired
+    private PayService payService;
+
+    @Override
+    public BaseDAO<Integer, SubjectChange> getDAO() {
+        return subjectChangeDao;
+    }
+
+    @Override
+    public SubjectChange getChangeInfo(Integer id) {
+        SubjectChange subjectChange = subjectChangeDao.getChangeInfo(id);
+        if (subjectChange == null) {
+            return null;
+        }
+        if (subjectChange.getOriginalMusical() != null) {
+            subjectChange.setOriginalMusicalGoods(goodsDao.get(subjectChange.getOriginalMusical()));
+        }
+        if (subjectChange.getOriginalAccessories() != null) {
+            subjectChange.setChangeAccessoriesGoods(goodsDao.findGoodsByIds(subjectChange.getOriginalAccessories()));
+        }
+
+        if (subjectChange.getChangeMusical() != null) {
+            subjectChange.setChangeMusicalGoods(goodsDao.get(subjectChange.getChangeMusical()));
+        }
+        if (subjectChange.getChangeAccessories() != null) {
+            subjectChange.setChangeAccessoriesGoods(goodsDao.findGoodsByIds(subjectChange.getChangeAccessories()));
+        }
+
+        return subjectChange;
+    }
+
+    @Override
+    public Map payChange(Integer id, BigDecimal viewAmount, Boolean isUseBalancePayment) throws Exception {
+        SubjectChange subjectChange = subjectChangeDao.get(id);
+        BigDecimal amount = subjectChange.getGoodsMargin().add(subjectChange.getCourseMargin());
+
+        Date date = new Date();
+        studentDao.lockUser(subjectChange.getStudentId());
+        subjectChange.setUpdateTime(date);
+        subjectChange.setStatus(SubjectChangeStatusEnum.ING);
+        if (subjectChangeDao.update(subjectChange) <= 0) {
+            throw new BizException("下单失败,请重试");
+        }
+
+        String orderNo = idGeneratorService.generatorId("payment") + "";
+
+        String channelType = "";
+
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+        studentPaymentOrder.setUserId(subjectChange.getStudentId());
+        studentPaymentOrder.setGroupType(GroupType.SUBJECT_CHANGE);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.SUBJECT_CHANGE);
+        studentPaymentOrder.setExpectAmount(amount);
+        studentPaymentOrder.setActualAmount(amount);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setMusicGroupId(subjectChange.getId().toString());
+        studentPaymentOrder.setPaymentChannel("BALANCE");
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrder.setOrganId(subjectChange.getOrganId());
+        studentPaymentOrder.setRoutingOrganId(subjectChange.getOrganId());
+
+        studentPaymentOrderService.insert(studentPaymentOrder);
+        studentPaymentOrder.setVersion(0);
+
+        BigDecimal balance = BigDecimal.ZERO;
+        if (isUseBalancePayment != null && amount.compareTo(BigDecimal.ZERO) > 0) {
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(subjectChange.getStudentId());
+            if (userCashAccount == null) {
+                throw new BizException("用户账户找不到");
+            }
+            if (userCashAccount.getBalance() != null && userCashAccount.getBalance().compareTo(BigDecimal.ZERO) > 0) {
+                balance = amount.compareTo(userCashAccount.getBalance()) >= 0 ? userCashAccount.getBalance() : amount;
+                amount = amount.subtract(balance);
+                studentPaymentOrder.setActualAmount(amount);
+                studentPaymentOrder.setBalancePaymentAmount(balance);
+                sysUserCashAccountService.updateBalance(subjectChange.getStudentId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐器维修");
+            }
+        }
+        if (amount.compareTo(viewAmount) != 0) {
+            throw new BizException("价格异常");
+        }
+        studentPaymentOrderService.update(studentPaymentOrder);
+
+        studentPaymentOrder.setVersion(studentPaymentOrder.getVersion() + 1);
+
+        if (amount.compareTo(BigDecimal.ZERO) == 0) {
+            studentPaymentRouteOrderService.addRouteOrder(orderNo, subjectChange.getOrganId(), studentPaymentOrder.getExpectAmount());
+            Map<String, String> notifyMap = new HashMap<>();
+            notifyMap.put("tradeState", "1");
+            notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
+            notifyMap.put("channelType", channelType);
+            notifyMap.put("orderNo", "");
+            studentPaymentOrderService.updateOrder(notifyMap);
+            notifyMap.put("orderNo", orderNo);
+            return notifyMap;
+        }
+
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+
+        Map<String, Object> payMap = payService.getPayMap(
+                amount,
+                balance,
+                orderNo,
+                baseApiUrl + "/api-student/studentOrder/notify",
+                baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
+                "声部更换",
+                "声部更换",
+                subjectChange.getOrganId(),
+                "subjectChange"
+        );
+
+        studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
+        studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
+        studentPaymentOrder.setUpdateTime(date);
+        studentPaymentOrderService.update(studentPaymentOrder);
+        return payMap;
+    }
+}

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

@@ -36,6 +36,9 @@
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="fee_type_" property="feeType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="del_flag_" property="delFlag"/>
+        <result column="payment_valid_start_date_" property="paymentValidStartDate"/>
+        <result column="payment_valid_end_date_" property="paymentValidEndDate"/>
+        <result column="payment_pattern_" property="paymentPattern"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -68,7 +71,7 @@
          bill_start_date_, improvent_classes_num_, enroll_classes_, payment_expire_date_, is_extra_class_,
          settlement_type_, cooperation_organ_id_, enlightenment_course_time_,
          parent_meeting_time_, img_, director_user_id_, is_classroom_lessons_, memo_, expect_start_group_date_,
-         ownership_type_, repair_user_id_, fee_type_, del_flag_)
+         ownership_type_, repair_user_id_, fee_type_, del_flag_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_)
         VALUES (#{id}, #{name}, #{organId}, #{schoolId}, #{applyExpireDate}, #{teamTeacherId}, #{educationalTeacherId},
                 #{chargeTypeId}, #{courseForm}, now(), now(),
                 #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{billStartDate},
@@ -78,13 +81,22 @@
                 #{cooperationOrganId}, #{enlightenmentCourseTime}, #{parentMeetingTime}, #{img}, #{directorUserId},
                 #{isClassroomLessons}, #{memo}, #{expectStartGroupDate},
                 #{ownershipType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{repairUserId},
-                #{feeType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{delFlag})
+                #{feeType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}, #{delFlag},#{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroup">
         UPDATE music_group
         <set>
+            <if test="paymentPattern != null">
+                payment_pattern_ = #{paymentPattern},
+            </if>
+            <if test="paymentValidStartDate != null">
+                payment_valid_start_date_ = #{paymentValidStartDate},
+            </if>
+            <if test="paymentValidEndDate != null">
+                payment_valid_end_date_ = #{paymentValidEndDate},
+            </if>
             <if test="ownershipType != null">
                 ownership_type_ = #{ownershipType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -597,4 +609,9 @@
         </if>
         ORDER BY mg.create_time_ DESC
     </select>
+    <select id="getFirstEduTeacherId" resultType="java.lang.Integer">
+        SELECT mg.educational_teacher_id_ FROM student_registration sr
+        LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
+        WHERE user_id_ = #{userId} AND mg.status_ != 'CANCELED' AND sr.music_group_status_ != 'QUIT' LIMIT 1
+    </select>
 </mapper>

+ 70 - 2
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml

@@ -19,6 +19,10 @@
         <result column="type_" property="type" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+        <result column="payment_valid_start_date_" property="paymentValidStartDate"/>
+        <result column="payment_valid_end_date_" property="paymentValidEndDate"/>
+        <result column="payment_pattern_" property="paymentPattern"/>
+        <result column="payment_type_" property="paymentType"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -35,9 +39,11 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
         INSERT INTO music_group_payment_calender
-        (music_group_id_,payment_month_,start_payment_date_,deadline_payment_date_,payment_status_,expect_num_,actual_num_,memo_,type_,create_time_,update_time_)
+        (music_group_id_,payment_month_,start_payment_date_,deadline_payment_date_,payment_status_,expect_num_,
+        actual_num_,memo_,type_,create_time_,update_time_,payment_valid_start_date_,payment_valid_end_date_,payment_pattern_,payment_type_)
         VALUES(#{musicGroupId},#{paymentMonth},#{startPaymentDate},#{deadlinePaymentDate},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
-        #{expectNum},#{actualNum},#{memo},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now())
+        #{expectNum},#{actualNum},#{memo},#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),
+        #{paymentValidStartDate},#{paymentValidEndDate},#{paymentPattern},#{paymentType})
     </insert>
     <insert id="batchAdd">
         INSERT INTO music_group_payment_calender
@@ -52,6 +58,16 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender">
         UPDATE music_group_payment_calender
         <set>
+            <if test="paymentType != null">
+                payment_type_ = #{paymentType},
+            </if>
+            <if test="paymentValidStartDate != null">
+                payment_valid_start_date_ = #{paymentValidStartDate},
+                payment_valid_end_date_ = #{paymentValidEndDate},
+            </if>
+            <if test="paymentPattern != null">
+                payment_pattern_ = #{paymentPattern},
+            </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -90,6 +106,9 @@
 	    <foreach collection="list" item="item" index="index" open="" close="" separator=";">
 	        UPDATE music_group_payment_calender
 	        <set>
+                <if test="paymentPattern != null">
+                    payment_pattern_ = #{paymentPattern},
+                </if>
 	            <if test="item.type != null">
 	                type_ = #{item.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 	            </if>
@@ -175,6 +194,9 @@
         WHERE music_group_id_ = #{musicGroupId} 
         and (start_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate}
         or deadline_payment_date_ between #{startPaymentDate} and #{deadlinePaymentDate})
+        <if test="calenderId != null">
+            AND mgpc.id_ != #{calenderId}
+        </if>
     </select>
     <select id="countExpectNum" resultType="java.util.Map">
         SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(DISTINCT mgpcd.user_id_) 'value' FROM music_group_payment_calender_detail mgpcd
@@ -204,4 +226,50 @@
         AND (DATE_FORMAT(mgpcd.start_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime}
         OR DATE_FORMAT(mgpcd.deadline_payment_date_,'%Y-%m-%d') between #{startTime} AND #{endTime})
     </select>
+    <select id="queryIntersectionByValidDate" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM music_group_payment_calender mgpc
+        WHERE music_group_id_ = #{musicGroupId}
+        AND (payment_valid_end_date_ IS NULL OR payment_valid_start_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}
+        OR payment_valid_end_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate})
+        <if test="calenderId != null">
+            AND mgpc.id_ = #{calenderId}
+        </if>
+    </select>
+    <select id="queryCalenderByDay" resultType="java.util.Map">
+        SELECT mgpcd.music_group_payment_calender_id_ 'key',COUNT(mgpcd.payment_status_) 'value'
+        FROM music_group_payment_calender_detail mgpcd
+        WHERE mgpcd.music_group_payment_calender_id_ IN
+        (SELECT id_ FROM music_group_payment_calender WHERE payment_status_ != 0 AND DATEDIFF('',DATE_FORMAT(start_payment_date_,'%Y-%m-%d')) = #{configValue})
+        AND mgpcd.payment_status_ = 'NON_PAYMENT'
+        GROUP BY mgpcd.music_group_payment_calender_id_
+    </select>
+    <select id="queryByIds" resultMap="MusicGroupPaymentCalender">
+        SELECT * FROM music_group_payment_calender WHERE id_ IN
+        <foreach collection="calenderId" open="(" close=")" item="item" separator=",">
+            #{item}
+        </foreach>
+    </select>
+    <select id="queryEndIds" resultType="java.lang.Long">
+        SELECT DISTINCT mgpc.id_ FROM music_group_payment_calender mgpc
+        WHERE mgpc.payment_status_ = 2 AND DATEDIFF(#{format},DATE_FORMAT(mgpc.payment_valid_end_date_,'%Y-%m-%d')) = #{configValue1};
+    </select>
+    <resultMap id="CalenderPushDto" type="com.ym.mec.biz.dal.dto.CalenderPushDto">
+        <result property="paymentValidEndDate" column="payment_valid_end_date_"/>
+        <result property="paymentValidStartDate" column="payment_valid_start_date_"/>
+        <result property="teacherId" column="educational_teacher_id_"/>
+        <result property="musicGroupName" column="name_"/>
+        <result property="teacherPhone" column="phone_"/>
+        <result property="calenderId" column="id_"/>
+    </resultMap>
+    <select id="getCalenderPushDto" resultMap="CalenderPushDto">
+        SELECT mgpc.id_,mgpc.payment_valid_start_date_,mgpc.payment_valid_end_date_,
+        mg.educational_teacher_id_,su.real_name_,mg.name_,su.phone_
+        FROM music_group_payment_calender mgpc
+        LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
+        LEFT JOIN sys_user su ON su.id_ = mg.educational_teacher_id_
+        WHERE mgpc.id_ IN
+        <foreach collection="calenderIds" open="(" close=")" separator="," item="item">
+            #{item}
+        </foreach>
+    </select>
 </mapper>

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

@@ -15,6 +15,7 @@
         <result column="course_fee_" property="courseFee"/>
         <result column="next_payment_date_" property="nextPaymentDate"/>
         <result column="latest_paid_time_" property="latestPaidTime"/>
+        <result column="payment_valid_end_date_" property="paymentValidEndDate"/>
         <result column="continuous_absenteeism_times_" property="continuousAbsenteeismTimes"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -42,15 +43,21 @@
     <!-- 向数据库增加一条记录 -->
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentFee" useGeneratedKeys="true"
             keyColumn="id" keyProperty="id">
-		INSERT INTO music_group_student_fee_ (id_,music_group_id_,user_id_,course_fee_,create_time_,update_time_,next_payment_date_,latest_paid_time_,continuous_absenteeism_times_,subject_id_,payment_status_,temporary_course_fee_,payment_period_list_,remain_network_class_times_)
-		VALUES(#{id},#{musicGroupId},#{userId},#{courseFee},now(),now(),#{nextPaymentDate},#{latestPaidTime},#{continuousAbsenteeismTimes},#{subjectId},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{temporaryCourseFee},#{paymentPeriodList},#{remainNetworkClassTimes})
+		INSERT INTO music_group_student_fee_ (id_,music_group_id_,user_id_,course_fee_,create_time_,
+		update_time_,next_payment_date_,latest_paid_time_,continuous_absenteeism_times_,subject_id_,
+		payment_status_,temporary_course_fee_,payment_period_list_,remain_network_class_times_,payment_valid_end_date_)
+		VALUES(#{id},#{musicGroupId},#{userId},#{courseFee},now(),now(),#{nextPaymentDate},#{latestPaidTime},
+		#{continuousAbsenteeismTimes},#{subjectId},#{paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+		#{temporaryCourseFee},#{paymentPeriodList},#{remainNetworkClassTimes},#{paymentValidEndDate})
 	</insert>
 
     <insert id="batchInsert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentFee">
-        INSERT INTO music_group_student_fee_ (music_group_id_,user_id_,create_time_,update_time_,next_payment_date_,subject_id_,payment_status_,course_fee_,payment_period_list_,remain_network_class_times_)
+        INSERT INTO music_group_student_fee_ (music_group_id_,user_id_,create_time_,update_time_,next_payment_date_,
+        subject_id_,payment_status_,course_fee_,payment_period_list_,remain_network_class_times_,payment_valid_end_date_)
 		VALUES
 		<foreach collection="musicGroupStudentFees" item="item" separator=",">
-            (#{item.musicGroupId},#{item.userId},NOW(),NOW(),#{nextPaymentDate},#{item.subjectId},#{paymentStatus},#{item.courseFee},#{item.paymentPeriodList},#{item.remainNetworkClassTimes})
+            (#{item.musicGroupId},#{item.userId},NOW(),NOW(),#{nextPaymentDate},#{item.subjectId},
+            #{paymentStatus},#{item.courseFee},#{item.paymentPeriodList},#{item.remainNetworkClassTimes},#{item.paymentValidEndDate})
         </foreach>
     </insert>
 
@@ -58,6 +65,9 @@
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.MusicGroupStudentFee">
         UPDATE music_group_student_fee_
         <set>
+            <if test="paymentValidEndDate != null">
+                payment_valid_end_date_ = #{paymentValidEndDate},
+            </if>
             <if test="userId != null">
                 user_id_ = #{userId},
             </if>
@@ -364,4 +374,8 @@
         SET mgsf.payment_status_ = #{paymentStatus},mgsf.update_time_ = NOW()
         WHERE mgpcd.music_group_payment_calender_id_ = mgpc.id_ AND mgpc.id_ = #{calenderId}
     </update>
+    <update id="updateFeeStatus">
+        UPDATE music_group_student_fee_ mgsf SET mgsf.payment_status_ = 'NON_PAYMENT',mgsf.update_time_ = NOW()
+        WHERE mgsf.payment_valid_end_date_ IS NOT NULL AND mgsf.payment_status_ = 'PAID_COMPLETED' AND mgsf.payment_valid_end_date_ &lt; NOW()
+    </update>
 </mapper>

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

@@ -139,7 +139,7 @@
             (#{sellOrder.organId},#{sellOrder.cooperationOrganId},#{sellOrder.transNo},#{sellOrder.orderId},#{sellOrder.orderNo},
             #{sellOrder.expectAmount},#{sellOrder.actualAmount},#{sellOrder.balanceAmount},#{sellOrder.type},#{sellOrder.goodsId},
             #{sellOrder.goodsName},#{sellOrder.sellCost},#{sellOrder.sellCost2},#{sellOrder.num},#{sellOrder.userId},
-            #{sellOrder.paymentChannel},#{sellOrder.merNo},#{sellOrder.sellTime},#{sellOrder.createIme},#{sellOrder.updateTime})
+            #{sellOrder.paymentChannel},#{sellOrder.merNo},#{sellOrder.sellTime},NOW(),NOW())
         </foreach>
     </insert>
 

+ 118 - 0
mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.StudentGoodsSellDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.StudentGoodsSell" id="StudentGoodsSell">
+		<result column="id_" property="id" />
+		<result column="user_id_" property="userId" />
+		<result column="teacher_id_" property="teacherId" />
+		<result column="goods_json_" property="goodsJson" />
+		<result column="total_amount_" property="totalAmount" />
+		<result column="market_amount_" property="marketAmount" />
+		<result column="order_no_" property="orderNo" />
+		<result column="organ_id_" property="organId" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="StudentGoodsSell" >
+		SELECT * FROM student_goods_sell WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="StudentGoodsSell">
+		SELECT * FROM student_goods_sell ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentGoodsSell" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO student_goods_sell (id_,user_id_,teacher_id_,goods_json_,total_amount_,market_amount_,create_time_,update_time_,order_no_,organ_id_)
+		VALUES(#{id},#{userId},#{teacherId},#{goodsJson},#{totalAmount},#{marketAmount},NOW(),NOW(),#{orderNo},#{organId})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentGoodsSell">
+		UPDATE student_goods_sell <set>
+		<if test="organId != null">
+			organ_id_ = #{organId},
+		</if>
+		<if test="orderNo != null">
+			order_no_ = #{orderNo},
+		</if>
+		<if test="userId != null">
+			user_id_ = #{userId},
+		</if>
+		<if test="totalAmount != null">
+			total_amount_ = #{totalAmount},
+		</if>
+		<if test="marketAmount != null">
+			market_amount_ = #{marketAmount},
+		</if>
+		<if test="teacherId != null">
+			teacher_id_ = #{teacherId},
+		</if>
+		<if test="goodsJson != null">
+			goods_json_ = #{goodsJson},
+		</if>
+		update_time_ = NOW()
+		</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM student_goods_sell WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="StudentGoodsSell" parameterType="map">
+		SELECT * FROM student_goods_sell ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM student_goods_sell
+	</select>
+    <select id="countStudentGoodsOrders" resultType="java.lang.Integer">
+		SELECT COUNT(spo.id_) FROM student_payment_order spo
+		LEFT JOIN student_goods_sell sgs ON spo.id_ = sgs.order_no_
+		<include refid="queryStudentGoodsOrdersSql"/>
+	</select>
+	<resultMap type="com.ym.mec.biz.dal.dto.StudentGoodsSellDto" id="StudentGoodsSellDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
+		<result column="goods_json_" property="goodsJson" />
+		<result column="total_amount_" property="totalAmount" />
+		<result column="market_amount_" property="marketAmount" />
+	</resultMap>
+	<sql id="queryStudentGoodsOrdersSql">
+		<where>
+			<if test="teacherId != null">
+				sgs.teacher_id_ = #{teacherId}
+			</if>
+			<if test="studentId != null">
+				AND sgs.user_id_ = #{studentId}
+			</if>
+			<if test="paymentStatus != null">
+				AND spo.status_ = #{paymentStatus}
+			</if>
+		</where>
+	</sql>
+	<select id="queryStudentGoodsOrders" resultMap="StudentGoodsSellDto">
+		SELECT spo.*,sgs.goods_json_,sgs.total_amount_,sgs.market_amount_ FROM student_payment_order spo
+		LEFT JOIN student_goods_sell sgs ON spo.id_ = sgs.order_no_
+		<include refid="queryStudentGoodsOrdersSql"/>
+		ORDER BY spo.create_time_ DESC
+		<include refid="global.limit"/>
+	</select>
+	<select id="findByOrderNo" resultMap="StudentGoodsSell">
+		SELECT * FROM student_goods_sell WHERE order_no_ = #{orderNo} LIMIT 1
+	</select>
+	<select id="getStudentGoodsSellDto" resultMap="StudentGoodsSellDto">
+		SELECT spo.*,sgs.goods_json_,sgs.total_amount_,sgs.market_amount_ FROM student_payment_order spo
+		LEFT JOIN student_goods_sell sgs ON spo.order_no_ = sgs.order_no_
+		WHERE spo.order_no_ = #{orderNo} LIMIT 1
+	</select>
+</mapper>

+ 70 - 24
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderDetailMapper.xml

@@ -14,7 +14,8 @@
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
         <result column="payment_order_id_" property="paymentOrderId"/>
-        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="kit_group_purchase_type_" property="kitGroupPurchaseType"
+                typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
             <result column="goods_id_" property="id"/>
             <result column="goods_name_" property="name"/>
@@ -27,7 +28,9 @@
 
     <!-- 根据主键查询一条记录 -->
     <select id="get" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE id_ = #{id}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </select>
 
     <!-- 全查询 -->
@@ -68,7 +71,8 @@
                 payment_order_id_ = #{paymentOrderId},
             </if>
             <if test="kitGroupPurchaseType != null">
-                kit_group_purchase_type_ = #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+                kit_group_purchase_type_ =
+                #{kitGroupPurchaseType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="type != null">
                 type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -79,7 +83,9 @@
 
     <!-- 根据主键删除一条记录 -->
     <delete id="delete">
-        DELETE FROM student_payment_order_detail WHERE id_ = #{id}
+        DELETE
+        FROM student_payment_order_detail
+        WHERE id_ = #{id}
     </delete>
 
     <!-- 分页查询 -->
@@ -107,27 +113,32 @@
 
     <!-- 查询注册订单详情 -->
     <select id="findApplyOrderSuccess" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
         WHERE spo.music_group_id_ = #{musicGroupId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
-        AND sr.music_group_id_=#{musicGroupId} AND sr.music_group_status_ != 'QUIT'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
     </select>
 
     <!-- 查询订单详情 -->
     <select id="findApplyOrderGoods" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
     </select>
 
     <!-- 查询用户注册订单详情 -->
     <select id="findUserApplyOrder" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.* FROM student_payment_order spo
-        LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
+        SELECT spod.*
+        FROM student_payment_order spo
+                 LEFT JOIN student_payment_order_detail spod ON spo.id_ = spod.payment_order_id_
         WHERE spo.user_id_ = #{userId}
-        AND spo.status_=#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-        AND spo.type_ = 'APPLY'
+          AND spo.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          AND spo.type_ = 'APPLY'
     </select>
     <resultMap id="musicalListDetailDtoMap" type="com.ym.mec.biz.dal.dto.MusicalListDetailDto">
         <result property="paymentOrderId" column="payment_order_id_"/>
@@ -143,10 +154,13 @@
         <result property="goodsNames" column="goods_names_"/>
     </resultMap>
     <select id="getMusicalListDetail" resultMap="musicalListDetailDtoMap">
-        SELECT MAX(spo.id_) payment_order_id_,spo.user_id_  FROM student_payment_order spo
-        LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
-        WHERE spo.music_group_id_ = #{musicGroupId} AND spo.status_ = 'SUCCESS'
-        AND sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_!='QUIT'
+        SELECT MAX(spo.id_) payment_order_id_, spo.user_id_
+        FROM student_payment_order spo
+                 LEFT JOIN student_registration sr ON spo.user_id_ = sr.user_id_
+        WHERE spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND sr.music_group_id_ = #{musicGroupId}
+          AND sr.music_group_status_ != 'QUIT'
         GROUP BY spo.user_id_
     </select>
     <select id="queryGoodsNames" resultType="java.util.Map">
@@ -169,16 +183,48 @@
     </select>
 
     <select id="findApplyOrderMusical" resultMap="StudentPaymentOrderDetail">
-        SELECT * FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId} AND type_ = 'MUSICAL' LIMIT 1
+        SELECT *
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+          AND type_ = 'MUSICAL'
+        LIMIT 1
     </select>
 
     <select id="getOrderDetail" resultMap="StudentPaymentOrderDetail">
-        SELECT spod.*,g.id_ goods_id_,g.name_ goods_name_,g.group_purchase_price_,g.discount_price_,g.agree_cost_price_,g.type_ goods_type_ FROM student_payment_order_detail spod
-                          LEFT JOIN goods g ON FIND_IN_SET(g.id_,spod.goods_id_list_)
-        WHERE spod.payment_order_id_ = #{orderId} AND spod.goods_id_list_ IS NOT NULL
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+        WHERE spod.payment_order_id_ = #{orderId}
+          AND spod.goods_id_list_ IS NOT NULL
     </select>
 
     <select id="getOrderDetailType" resultType="java.lang.String">
-        SELECT DISTINCT type_ FROM student_payment_order_detail WHERE payment_order_id_ = #{orderId}
+        SELECT DISTINCT type_
+        FROM student_payment_order_detail
+        WHERE payment_order_id_ = #{orderId}
+    </select>
+
+    <select id="getStudentApplyDetail" resultMap="StudentPaymentOrderDetail">
+        SELECT spod.*,
+               g.id_   goods_id_,
+               g.name_ goods_name_,
+               g.group_purchase_price_,
+               g.discount_price_,
+               g.agree_cost_price_,
+               g.type_ goods_type_
+        FROM student_payment_order_detail spod
+                 LEFT JOIN goods g ON FIND_IN_SET(g.id_, spod.goods_id_list_)
+                 LEFT JOIN student_payment_order spo on spod.payment_order_id_ = spo.id_
+        WHERE spo.user_id_ = #{studentId}
+          AND spo.music_group_id_ = #{musicGroupId}
+          AND spo.status_ = 'SUCCESS'
+          AND spo.type_ = 'APPLY'
+          AND spod.type_ IN ('MUSICAL', 'ACCESSORIES', 'TEACHING', 'OTHER', 'COURSE')
     </select>
 </mapper>

+ 143 - 0
mec-biz/src/main/resources/config/mybatis/SubjectChangeMapper.xml

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ym.mec.biz.dal.dao.SubjectChangeDao">
+    <resultMap id="SubjectChange" type="com.ym.mec.biz.dal.entity.SubjectChange">
+        <!--@mbg.generated-->
+        <!--@Table subject_change-->
+        <id column="id_" property="id"/>
+        <result column="student_id_" property="studentId"/>
+        <result column="studentName" property="studentName"/>
+        <result column="organ_id_" property="organId"/>
+        <result column="music_group_id_" property="musicGroupId"/>
+        <result column="original_course_fee_" property="originalCourseFee"/>
+        <result column="original_musical_" property="originalMusical"/>
+        <result column="original_musical_price_" property="originalMusicalPrice"/>
+        <result column="original_accessories_" property="originalAccessories"/>
+        <result column="original_accessories_price_" property="originalAccessoriesPrice"/>
+        <result column="change_course_fee_" property="changeCourseFee"/>
+        <result column="change_musical_" property="changeMusical"/>
+        <result column="change_musical_price_" property="changeMusicalPrice"/>
+        <result column="change_accessories_" property="changeAccessories"/>
+        <result column="change_accessories_price_" property="changeAccessoriesPrice"/>
+        <result column="goods_margin_" property="goodsMargin"/>
+        <result column="course_margin_" property="courseMargin"/>
+        <result column="status_" property="status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="version_" property="version"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
+        id_,student_id_,organ_id_, music_group_id_,original_course_fee_, original_musical_, original_musical_price_,
+        original_accessories_,
+        original_accessories_price_, change_course_fee_, change_musical_, change_musical_price_,
+        change_accessories_, change_accessories_price_, goods_margin_, course_margin_, status_,
+        create_time_, update_time,version_
+    </sql>
+    <select id="get" parameterType="java.lang.Integer" resultMap="SubjectChange">
+        <!--@mbg.generated-->
+        select
+        <include refid="Base_Column_List"/>
+        from subject_change
+        where id_ = #{id}
+    </select>
+    <delete id="delete" parameterType="java.lang.Integer">
+        <!--@mbg.generated-->
+        delete from subject_change
+        where id_ = #{id}
+    </delete>
+    <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SubjectChange"
+            useGeneratedKeys="true">
+        <!--@mbg.generated-->
+        insert into subject_change (student_id_,organ_id_,music_group_id_,original_course_fee_, original_musical_,
+        original_musical_price_,
+        original_accessories_,
+        original_accessories_price_, change_course_fee_, change_musical_, change_musical_price_,
+        change_accessories_, change_accessories_price_, goods_margin_, course_margin_,
+        status_, create_time_, update_time,version_)
+        values (#{studentId},#{organId},#{musicGroupId},#{originalCourseFee}, #{originalMusical}, #{originalMusicalPrice},
+        #{originalAccessories},
+        #{originalAccessoriesPrice}, #{changeCourseFee}, #{changeMusical}, #{changeMusicalPrice},
+        #{changeAccessories}, #{changeAccessoriesPrice}, #{goodsMargin}, #{courseMargin},
+        #{status}, #{createTime}, #{updateTime},0)
+    </insert>
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.SubjectChange">
+        <!--@mbg.generated-->
+        update subject_change
+        <set>
+            <if test="studentId != null">
+                student_id_ = #{studentId},
+            </if>
+            <if test="organId != null">
+                organ_id_ = #{organId},
+            </if>
+            <if test="musicGroupId != null">
+                music_group_id_ = #{musicGroupId},
+            </if>
+            <if test="originalCourseFee != null">
+                original_course_fee_ = #{originalCourseFee},
+            </if>
+            <if test="originalMusical != null">
+                original_musical_ = #{originalMusical},
+            </if>
+            <if test="originalMusicalPrice != null">
+                original_musical_price_ = #{originalMusicalPrice},
+            </if>
+            <if test="originalAccessories != null">
+                original_accessories_ = #{originalAccessories},
+            </if>
+            <if test="originalAccessoriesPrice != null">
+                original_accessories_price_ = #{originalAccessoriesPrice},
+            </if>
+            <if test="changeCourseFee != null">
+                change_course_fee_ = #{changeCourseFee},
+            </if>
+            <if test="changeMusical != null">
+                change_musical_ = #{changeMusical},
+            </if>
+            <if test="changeMusicalPrice != null">
+                change_musical_price_ = #{changeMusicalPrice},
+            </if>
+            <if test="changeAccessories != null">
+                change_accessories_ = #{changeAccessories},
+            </if>
+            <if test="changeAccessoriesPrice != null">
+                change_accessories_price_ = #{changeAccessoriesPrice},
+            </if>
+            <if test="goodsMargin != null">
+                goods_margin_ = #{goodsMargin},
+            </if>
+            <if test="courseMargin != null">
+                course_margin_ = #{courseMargin},
+            </if>
+            <if test="status != null">
+                status_ = #{status},
+            </if>
+            <if test="createTime != null">
+                create_time_ = #{createTime},
+            </if>
+            <if test="updateTime != null">
+                update_time = #{updateTime},
+            </if>
+            version_ = version_+1
+        </set>
+        where id_ = #{id} AND version_ = #{version}
+    </update>
+
+    <select id="getStudentLastChange" resultMap="SubjectChange">
+        SELECT *
+        FROM subject_change
+        WHERE student_id_ = #{studentId}
+          AND music_group_id_ = #{musicGroupId}
+          AND status_ = 'SUCCESSED'
+        ORDER BY create_time_ DESC
+        LIMIT 1
+    </select>
+
+    <select id="getChangeInfo" resultMap="SubjectChange">
+        SELECT sc.*,su.username_ studentName
+        FROM subject_change sc
+        LEFT jOIN sys_user su ON su.id_=sc.student_id_
+        WHERE sc.id_ = #{id}
+    </select>
+</mapper>

+ 4 - 0
mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java

@@ -16,6 +16,10 @@ public interface TaskRemoteService {
 	// 教师异常考勤推送
 	public void pushTeacherExceptionAttendanceTask();
 
+	@GetMapping(value = "task/updateMusicGroupStudentFeeStatus")
+	// 更新学员缴费状态(新)
+	public void updateMusicGroupStudentFeeStatus();
+
 	@GetMapping(value = "task/refreshPaymentFeeStatus")
 	// 刷新付费状态
 	public void refreshPaymentFeeStatus();

+ 5 - 0
mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java

@@ -157,6 +157,11 @@ public class TaskRemoteServiceFallback implements TaskRemoteService {
 	}
 
 	@Override
+	public void updateMusicGroupStudentFeeStatus() {
+		logger.info("更新乐团学员缴费状态失败");
+	}
+
+	@Override
 	public void studentServeRemind() {
 		logger.info("本周应布置课外训练推送失败");
 	}

+ 4 - 4
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -1,5 +1,7 @@
 package com.ym.mec.student.config;
 
+import com.ym.mec.common.security.BaseAccessDeniedHandler;
+import com.ym.mec.common.security.BaseAuthenticationEntryPoint;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
@@ -8,9 +10,6 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.E
 import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
 import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
 
-import com.ym.mec.common.security.BaseAccessDeniedHandler;
-import com.ym.mec.common.security.BaseAuthenticationEntryPoint;
-
 @Configuration
 @EnableResourceServer
 @EnableGlobalMethodSecurity(prePostEnabled = true)
@@ -37,7 +36,8 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 				"/degree/*",
 				"/practiceGroup/queryOrderInfo",
 				"/systemDate/query",
-				"/organization/getOrgans").permitAll().anyRequest().authenticated().and().httpBasic();
+				"/organization/getOrgans," +
+				"/repair/addGoodsSellOrder").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 29 - 16
mec-student/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -3,7 +3,7 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.GoodsSellDto;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
@@ -11,22 +11,18 @@ import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
+import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
-import com.ym.mec.biz.service.GoodsCategoryService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRepairService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.Map;
@@ -46,22 +42,28 @@ public class RepairController extends BaseController {
     private GoodsService goodsService;
     @Autowired
     private GoodsCategoryService goodsCategoryService;
+    @Autowired
+    private StudentGoodsSellService studentGoodsSellService;
 
     @ApiOperation("添加商品销售订单")
     @PostMapping(value = "/addGoodsSellOrder")
-    public HttpResponseResult addGoodsSellOrder(GoodsSellDto goodsSellDto) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("请登录");
+    public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
+        if(studentGoodsSell.getUserId() == null){
+            SysUser sysUser = sysUserFeignService.queryUserInfo();
+            if (sysUser == null) {
+                throw new BizException("请登录");
+            }
+            studentGoodsSell.setUserId(sysUser.getId());
         }
-        if (goodsSellDto.getIsRepeatPay() == false) {
-            List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, sysUser.getId(), DealStatusEnum.ING,
+        if (studentGoodsSell.getIsRepeatPay() == false) {
+            List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             if (list.size() > 0) {
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
         }
-        Map map = studentRepairService.addGoodsSellOrder(goodsSellDto);
+
+        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
         if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, "恭喜您,购买成功!");
         }
@@ -128,4 +130,15 @@ public class RepairController extends BaseController {
     public Object queryGoodsCategoryPage(GoodsCategoryQueryInfo queryInfo) {
         return succeed(goodsCategoryService.queryPage(queryInfo));
     }
+
+    @ApiOperation(value = "分页查询学员商品订单")
+    @GetMapping("/queryStudentGoodsOrders")
+    public Object queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        queryInfo.setStudentId(sysUser.getId());
+        return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
+    }
 }

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

@@ -70,6 +70,8 @@ public class StudentOrderController extends BaseController {
     private TenantPaymentOrderService tenantPaymentOrderService;
     @Autowired
     private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
+    @Autowired
+    private StudentGoodsSellDao studentGoodsSellDao;
 
 
     @Value("${spring.profiles.active:dev}")
@@ -133,8 +135,9 @@ public class StudentOrderController extends BaseController {
         } else if (orderByOrderNo.getGroupType().equals(GroupType.SPORADIC)) {
             SporadicChargeInfo info = sporadicChargeInfoService.get(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
             orderDetail.put("detail", info);
+        }else if(orderByOrderNo.getGroupType().equals(GroupType.GOODS_SELL)){
+            orderDetail.put("detail", studentGoodsSellDao.getStudentGoodsSellDto(orderNo));
         }
-
         return succeed(orderDetail);
     }
 

+ 51 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java

@@ -0,0 +1,51 @@
+package com.ym.mec.student.controller;
+
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.service.SubjectChangeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+@RequestMapping("subjectChange")
+@Api(tags = "声部更换服务")
+@RestController
+public class SubjectChangeController extends BaseController {
+
+    @Autowired
+    private SubjectChangeService subjectChangeService;
+
+
+    @ApiOperation(value = "获取更换详情")
+    @GetMapping("/getChangeInfo")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer")})
+    public HttpResponseResult<SubjectChange> getChangeInfo(Integer id) {
+        if (id == null) {
+            return failed("参数校验异常");
+        }
+        return succeed(subjectChangeService.getChangeInfo(id));
+    }
+
+    @ApiOperation(value = "支付更换声部费用")
+    @PostMapping("/payChange")
+    @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "金额", value = "amount", required = true, dataType = "BigDecimal"),
+            @ApiImplicitParam(name = "是否使余额", value = "isUseBalancePayment", required = true, dataType = "Boolean")
+    })
+    public HttpResponseResult<Map> payChaange(Integer id, BigDecimal amount, Boolean isUseBalancePayment) throws Exception {
+        return succeed(subjectChangeService.payChange(id, amount, isUseBalancePayment));
+    }
+
+
+}

+ 19 - 0
mec-task/src/main/java/com/ym/mec/task/jobs/UpdateMusicGroupStudentFeeStatus.java

@@ -0,0 +1,19 @@
+package com.ym.mec.task.jobs;
+
+import com.ym.mec.task.TaskRemoteService;
+import com.ym.mec.task.core.BaseTask;
+import com.ym.mec.task.core.TaskException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UpdateMusicGroupStudentFeeStatus extends BaseTask {
+
+	@Autowired
+	private TaskRemoteService taskRemoteService;
+
+	@Override
+	public void execute() throws TaskException {
+		taskRemoteService.updateMusicGroupStudentFeeStatus();
+	}
+}

+ 10 - 15
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java

@@ -1,22 +1,17 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
+import com.ym.mec.biz.dal.page.MusicCalenderQueryInfo;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
+import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import java.util.Date;
-import java.util.List;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.page.MusicCalenderQueryInfo;
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
-import com.ym.mec.common.controller.BaseController;
+import java.util.Date;
+import java.util.List;
 
 @RequestMapping("musicGroupPaymentCalender")
 @Api(tags = "乐团缴费日历服务")
@@ -50,11 +45,11 @@ public class MusicGroupPaymentCalenderController extends BaseController {
         return succeed();
     }
 
-    @ApiOperation(value = "修改乐团缴费日历")
+    @ApiOperation(value = "修改乐团缴费时间")
     @PostMapping("/updateStartTime")
     @PreAuthorize("@pcs.hasPermissions('musicGroupPaymentCalender/updateStartTime')")
-    public Object updateStartTime(Date startTime,Date endTime,Long id) {
-        musicGroupPaymentCalenderService.updateStartTime(startTime,endTime,id);
+    public Object updateStartTime(MusicGroupPaymentCalender paymentCalender) {
+        musicGroupPaymentCalenderService.updateStartTime(paymentCalender);
         return succeed();
     }
 

+ 33 - 3
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,9 +1,13 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
 import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -18,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.IOException;
 import java.util.Date;
+import java.util.List;
 
 @RequestMapping("studentRegistration")
 @Api(tags = "学生报名信息服务")
@@ -26,6 +31,8 @@ public class StudentRegistrationController extends BaseController {
 
     @Autowired
     private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
     @ApiOperation(value = "乐团添加学员")
     @PostMapping("/insertStudent")
@@ -49,11 +56,11 @@ public class StudentRegistrationController extends BaseController {
     @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "学生编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "subId", value = "声部编号", required = true, dataType = "Integer"),
             @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer")})
-    public Object batchUpdateSubject(Integer userId,Integer subId,String musicGroupId) throws Exception {
+    public Object batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
         if (null == userId || subId == null || StringUtils.isEmpty(musicGroupId)) {
             return failed("参数校验异常");
         }
-        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId,musicGroupId));
+        return succeed(studentRegistrationService.batchUpdateSubject(userId, subId, musicGroupId));
     }
 
     @ApiOperation(value = "乐团【报名中、缴费中】 学生详情列表分页查询")
@@ -126,7 +133,30 @@ public class StudentRegistrationController extends BaseController {
             @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
             @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
     public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
-        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type,actualSubjectId));
+        return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, type, actualSubjectId));
     }
 
+    @ApiOperation(value = "获取学生报名缴费详情")
+    @GetMapping("/getApplyDetail")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getApplyDetail')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<List<StudentPaymentOrderDetail>> getApplyDetail(Integer studentId, String musicGroupId) {
+        if (studentId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(studentRegistrationService.getStudentApplyDetail(studentId, musicGroupId));
+    }
+
+    @ApiOperation(value = "获取乐团声部费用信息及乐器和辅件")
+    @GetMapping("/getSubjectGoodsAndInfo")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/getSubjectGoodsAndInfo')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
+    }
 }

+ 65 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SubjectChangeController.java

@@ -0,0 +1,65 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.dto.MusicGroupSubjectGoodsAndInfoDto;
+import com.ym.mec.biz.dal.dto.StudentAddDto;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.SubjectChange;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.SubjectChangeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RequestMapping("subjectChange")
+@Api(tags = "声部更换服务")
+@RestController
+public class SubjectChangeController extends BaseController {
+
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
+    @Autowired
+    private SubjectChangeService subjectChangeService;
+
+    @ApiOperation(value = "获取学生报名缴费详情")
+    @GetMapping("/getApplyDetail")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/getApplyDetail')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "studentId", value = "学生编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<List<StudentPaymentOrderDetail>> getApplyDetail(Integer studentId, String musicGroupId) {
+        if (studentId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(studentRegistrationService.getStudentApplyDetail(studentId, musicGroupId));
+    }
+
+    @ApiOperation(value = "获取乐团声部费用信息及乐器和辅件")
+    @GetMapping("/getSubjectGoodsAndInfo")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/getSubjectGoodsAndInfo')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "subjectId", value = "声部信息", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String")})
+    public HttpResponseResult<MusicGroupSubjectGoodsAndInfoDto> getSubjectGoodsAndInfo(Integer subjectId, String musicGroupId) {
+        if (subjectId == null || StringUtils.isEmpty(musicGroupId)) {
+            return failed("参数校验异常");
+        }
+        return succeed(musicGroupSubjectPlanService.getSubjectGoodsAndInfo(musicGroupId, subjectId));
+    }
+
+    @ApiOperation(value = "添加乐器更换")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('subjectChange/add')")
+    public Object add(SubjectChange subjectChange) throws Exception {
+        return succeed(subjectChangeService.insert(subjectChange));
+    }
+}

+ 6 - 4
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -2,7 +2,6 @@ package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
-
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -57,9 +56,6 @@ public class TaskController extends BaseController {
 	private CoursesGroupService coursesGroupService;
 
 	@Autowired
-	private ExtracurricularExercisesReplyService extracurricularExercisesReplyService;
-
-	@Autowired
 	private ExtracurricularExercisesService extracurricularExercisesService;
 	
 	@Autowired
@@ -252,6 +248,12 @@ public class TaskController extends BaseController {
 		musicGroupPaymentCalenderService.autoUpdateMusicGroupPaymentCalenderStatus();
 	}
 
+	// 更新乐团学员缴费状态
+	@GetMapping("/updateMusicGroupStudentFeeStatus")
+	public void updateMusicGroupStudentFeeStatus() {
+		musicGroupPaymentCalenderService.autoUpdateMusicGroupStudentFeeStatus();
+	}
+
 	// 推送教师异常考勤
 	@GetMapping("/pushTeacherExceptionAttendanceTask")
 	public void pushTeacherExceptionAttendanceTask() {

+ 47 - 8
mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -6,28 +6,31 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.EmployeeDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
+import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
-import com.ym.mec.biz.service.GoodsCategoryService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.StudentRepairService;
-import com.ym.mec.biz.service.SubjectService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 
 @RequestMapping("eduRepair")
@@ -43,11 +46,15 @@ public class EduRepairController extends BaseController {
     @Autowired
     private StudentRepairService studentRepairService;
     @Autowired
+    private StudentPaymentOrderService studentPaymentOrderService;
+    @Autowired
     private SubjectService subjectService;
     @Autowired
     private GoodsService goodsService;
     @Autowired
     private GoodsCategoryService goodsCategoryService;
+    @Autowired
+    private StudentGoodsSellService studentGoodsSellService;
 
     @ApiOperation("获取学生列表")
     @GetMapping(value = "/getStudents")
@@ -66,6 +73,28 @@ public class EduRepairController extends BaseController {
         return succeed(studentRepairService.getStudents(queryInfo));
     }
 
+    @ApiOperation("添加商品销售订单")
+    @PostMapping(value = "/addGoodsSellOrder")
+    public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("请登录");
+        }
+        if (studentGoodsSell.getIsRepeatPay() == false) {
+            List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null,studentGoodsSell.getUserId(), DealStatusEnum.ING,
+                    OrderTypeEnum.RENEW);
+            if (list.size() > 0) {
+                return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
+            }
+        }
+        studentGoodsSell.setTeacherId(sysUser.getId());
+        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        if(map.containsKey("tradeState")){
+            return failed(HttpStatus.CREATED, "恭喜您,购买成功!");
+        }
+        return succeed(map);
+    }
+
     @ApiOperation("添加维修单")
     @PostMapping(value = "/addRepair")
     public HttpResponseResult addRepair(StudentRepair repairInfo) throws Exception {
@@ -157,4 +186,14 @@ public class EduRepairController extends BaseController {
         return succeed(goodsCategoryService.queryPage(queryInfo));
     }
 
+    @ApiOperation(value = "分页查询教务老师关联的学员商品订单")
+    @GetMapping("/queryStudentGoodsOrders")
+    public Object queryStudentGoodsOrders(GoodsSellQueryInfo queryInfo) {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        queryInfo.setTeacherId(sysUser.getId());
+        return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
+    }
 }

+ 0 - 3
mec-web/src/main/resources/application.yml

@@ -102,9 +102,6 @@ ribbon:
   ReadTimeout: 60000
   ConnectTimeout: 60000
 
-logging:
-  level:
-    com.ym.mec.auth.api.client.SysUserFeignService: INFO
 
 message:
   debugMode: true