Browse Source

商品销售,缴费周期

zouxuan 4 years ago
parent
commit
623e69e9be
30 changed files with 446 additions and 90 deletions
  1. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupDao.java
  2. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentCalenderDao.java
  3. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupStudentFeeDao.java
  4. 40 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java
  5. 58 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsSellDto.java
  6. 38 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentGoodsSellDto.java
  7. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SellOrder.java
  8. 16 4
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentGoodsSell.java
  9. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  10. 2 4
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupPaymentCalenderService.java
  11. 1 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SellOrderService.java
  12. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentGoodsSellService.java
  13. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java
  14. 19 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  15. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  16. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java
  17. 29 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentGoodsSellServiceImpl.java
  18. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  19. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  20. 70 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  21. 7 3
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentCalenderMapper.xml
  22. 4 0
      mec-biz/src/main/resources/config/mybatis/MusicGroupStudentFeeMapper.xml
  23. 1 1
      mec-biz/src/main/resources/config/mybatis/SellOrderMapper.xml
  24. 41 2
      mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml
  25. 4 0
      mec-client-api/src/main/java/com/ym/mec/task/TaskRemoteService.java
  26. 5 0
      mec-client-api/src/main/java/com/ym/mec/task/fallback/TaskRemoteServiceFallback.java
  27. 4 1
      mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  28. 19 0
      mec-task/src/main/java/com/ym/mec/task/jobs/UpdateMusicGroupStudentFeeStatus.java
  29. 10 15
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupPaymentCalenderController.java
  30. 42 8
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

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

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

@@ -67,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);
 
     /**
      * 统计预计缴费人数
@@ -105,7 +105,10 @@ public interface MusicGroupPaymentCalenderDao extends BaseDAO<Long, MusicGroupPa
      * @param paymentValidEndDate:
      * @return int
      */
-    int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId, @Param("paymentValidStartDate") String paymentValidStartDate, @Param("paymentValidEndDate") String paymentValidEndDate);
+    int queryIntersectionByValidDate(@Param("musicGroupId") String musicGroupId,
+                                     @Param("paymentValidStartDate") String paymentValidStartDate,
+                                     @Param("paymentValidEndDate") String paymentValidEndDate,
+                                     @Param("calenderId") Long calenderId);
 
     /**
      * @describe 获取指定时间后的缴费信息

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

@@ -216,8 +216,7 @@ public interface MusicGroupStudentFeeDao extends BaseDAO<Long, MusicGroupStudent
 	 * @author zouxuan
 	 * @date 2020/9/21
 	 * @time 14:34
-	 * @param format:
 	 * @return void
 	 */
-    void updateFeeStatus(@Param("format") String format);
+    void updateFeeStatus();
 }

+ 40 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentGoodsSellDao.java

@@ -1,10 +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);
 }

+ 58 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/GoodsSellDto.java

@@ -2,13 +2,70 @@ package com.ym.mec.biz.dal.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
+
 public class GoodsSellDto{
 	@ApiModelProperty(value = "商品数量", required = false)
-	private Integer goodsNum;
+	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)
+	private BigDecimal totalGoodsPrice = BigDecimal.ZERO;
+
+	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 String getGoodsName() {
+		return goodsName;
+	}
+
+	public void setGoodsName(String goodsName) {
+		this.goodsName = goodsName;
+	}
+
 	public Integer getGoodsNum() {
 		return goodsNum;
 	}

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

+ 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;
 
     /**
     * 销售成本

+ 16 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentGoodsSell.java

@@ -4,6 +4,7 @@ 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;
 
@@ -27,17 +28,17 @@ public class StudentGoodsSell {
 	private String orderNo;
 	
 	@ApiModelProperty(value = "总金额",required = true)
-	private java.math.BigDecimal totalAmount;
+	private java.math.BigDecimal totalAmount = BigDecimal.ZERO;
 	
 	@ApiModelProperty(value = "减免费用",required = true)
-	private java.math.BigDecimal marketAmount;
+	private java.math.BigDecimal marketAmount = BigDecimal.ZERO;
 
 	private Date createTime;
 
 	private Date updateTime;
 
 	@ApiModelProperty(value = "是否使用余额",required = true)
-	private Boolean isUseBalancePayment;
+	private Boolean isUseBalancePayment = false;
 
 	@ApiModelProperty(value = "是否重复支付",required = true)
 	private boolean isRepeatPay;
@@ -46,7 +47,18 @@ public class StudentGoodsSell {
 	private List<GoodsSellDto> goodsSellDtos;
 
 	@ApiModelProperty(value = "支付类型",required = true)
-	private Integer type;
+	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;

+ 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

+ 2 - 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);
 
 	/**
 	 * 删除

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

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

@@ -2,8 +2,19 @@ package com.ym.mec.biz.service;
 
 
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
+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
+     */
+    Object queryStudentGoodsOrders(QueryInfo queryInfo);
 }

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
+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;
@@ -86,5 +87,5 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @param order:
      * @return void
      */
-    void goodsSellorderCallback(StudentPaymentOrder order);
+    void goodsSellOrderCallback(StudentPaymentOrder order);
 }

+ 19 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -1,6 +1,5 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.CalenderPushDto;
 import com.ym.mec.biz.dal.entity.MusicGroup;
@@ -37,10 +36,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 
 	@Autowired
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-
 	@Autowired
 	private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
-
 	@Autowired
 	private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
 	@Autowired
@@ -49,8 +46,6 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	private SysConfigDao sysConfigDao;
 	@Autowired
 	private SysMessageService sysMessageService;
-	@Autowired
-	private SysUserFeignService sysUserFeignService;
 
 	@Override
 	public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
@@ -74,7 +69,7 @@ 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);
@@ -83,7 +78,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 			throw new BizException("缴费日期存在冲突,请修改缴费日期");
 		}
 		count = musicGroupPaymentCalenderDao.queryIntersectionByValidDate(musicGroupId, musicGroupPaymentCalender.getPaymentValidStartDate(),
-				musicGroupPaymentCalender.getPaymentValidEndDate());
+				musicGroupPaymentCalender.getPaymentValidEndDate(),null);
 		if (count > 0) {
 			throw new BizException("缴费有效期存在冲突,请修改缴费有效期");
 		}
@@ -162,7 +157,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		Date date = new Date();
 		String format = DateUtil.format(date, DateUtil.DEFAULT_PATTERN);
 		//将有效期已截止的学员缴费信息修改为未缴费
-		musicGroupStudentFeeDao.updateFeeStatus(format);
+		musicGroupStudentFeeDao.updateFeeStatus();
 		//获取距离缴费开启指定天数后的缴费明细
 		String configValue = sysConfigDao.findConfigValue("push_payment_detail");
 		Map<Long, Long> maps = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryCalenderByDay(configValue));
@@ -390,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("缴费信息不存在");
 		}
@@ -403,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);
+    }
+
 }

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

@@ -2,13 +2,22 @@ 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 {
 	
@@ -19,5 +28,24 @@ public class StudentGoodsSellServiceImpl extends BaseServiceImpl<Integer, Studen
 	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();

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

@@ -698,9 +698,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 +870,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);
                 //添加学生

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

@@ -28,6 +28,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;
 
@@ -61,8 +62,6 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Autowired
     private StudentDao studentDao;
     @Autowired
-    private GoodsService goodsService;
-    @Autowired
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
     @Autowired
     private SellOrderService sellOrderService;
@@ -70,6 +69,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     private StudentGoodsSellDao studentGoodsSellDao;
     @Autowired
     private ContractService contractService;
+    @Autowired
+    private GoodsService goodsService;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
@@ -106,7 +107,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     }
 
     @Override
-    @Transactional(rollbackFor = Exception.class)
+    @Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
     public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         Integer studentId = sysUser.getId();
@@ -123,15 +124,26 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentGoodsSell.setOrderNo(orderNo);
 
         List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
-//        Map<Integer, List<GoodsSellDto>> goodsMap = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
-//        String[] goodsIds = goodsId.split(",");
+
+//        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 (Integer id : goodsIds) {
-            amount.add(map.get(id));
+            GoodsSellDto goodsSellDto = goodsMap.get(id).get(0);
+            amount = amount.add(goodsSellDto.getTotalGoodsPrice());
         }
-        studentGoodsSell.setGoodsJson(JSONObject.toJSONString(goodsSellDtos));
+        amount = amount.subtract(studentGoodsSell.getMarketAmount());
+        if(amount.signum() < 0){
+            throw new BizException("操作失败:订单金额异常");
+        }
+        studentGoodsSell.setOrganId(sysUser.getOrganId());
         studentGoodsSell.setTotalAmount(amount);
+        studentGoodsSell.setGoodsJson(JSONObject.toJSONString(goodsSellDtos));
         if(studentGoodsSell.getId() == null){
             studentGoodsSellDao.insert(studentGoodsSell);
         }else {
@@ -144,7 +156,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             return repairInfoMap;
         }
 
-        List<Goods> goods = goodsService.findGoodsByIds(StringUtils.join(goodsIds,","));
+//        List<Goods> goods = goodsService.findGoodsByIds(StringUtils.join(goodsIds,","));
 
         StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
         studentPaymentOrder.setUserId(studentId);
@@ -158,9 +170,9 @@ 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 (Integer id : goodsIds) {
+        for (String id : goodsIds) {
             Goods e = collect.get(id).get(0);
             StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
             studentPaymentOrderDetail.setRemitFee(BigDecimal.ZERO);
@@ -174,12 +186,12 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
             studentPaymentOrderDetail.setType(type);
             studentPaymentOrderDetail.setPrice(e.getGroupPurchasePrice());
-            studentPaymentOrderDetail.setGoodsIdList(id.toString());
+            studentPaymentOrderDetail.setGoodsIdList(id);
             studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
             studentPaymentOrderDetail.setKitGroupPurchaseType(KitGroupPurchaseTypeEnum.GROUP);
             studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         }
-        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);*/
 
         studentPaymentOrder.setVersion(0);
         BigDecimal balance = BigDecimal.ZERO;
@@ -526,7 +538,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);
@@ -572,11 +584,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, "乐器维修支付失败");
@@ -584,6 +592,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) {

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

@@ -63,8 +63,6 @@
             </if>
             <if test="paymentValidStartDate != null">
                 payment_valid_start_date_ = #{paymentValidStartDate},
-            </if>
-            <if test="paymentValidEndDate != null">
                 payment_valid_end_date_ = #{paymentValidEndDate},
             </if>
             <if test="paymentPattern != null">
@@ -196,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
@@ -228,8 +229,11 @@
     <select id="queryIntersectionByValidDate" resultType="java.lang.Integer">
         SELECT COUNT(*) FROM music_group_payment_calender mgpc
         WHERE music_group_id_ = #{musicGroupId}
-        AND (payment_valid_start_date_ BETWEEN #{paymentValidStartDate} AND #{paymentValidEndDate}
+        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'

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

@@ -374,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>
 

+ 41 - 2
mec-biz/src/main/resources/config/mybatis/StudentGoodsSellMapper.xml

@@ -14,6 +14,7 @@
 		<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>
@@ -30,13 +31,16 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<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_)
-		VALUES(#{id},#{userId},#{teacherId},#{goodsJson},#{totalAmount},#{marketAmount},NOW(),NOW(),#{orderNo})
+		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>
@@ -73,4 +77,39 @@
 	<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="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>

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

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

+ 42 - 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.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.common.page.QueryInfo;
 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,9 @@ public class EduRepairController extends BaseController {
         return succeed(goodsCategoryService.queryPage(queryInfo));
     }
 
+    @ApiOperation(value = "分页查询教务老师关联的学员订单")
+    @GetMapping("/queryStudentGoodsOrders")
+    public Object queryStudentGoodsOrders(QueryInfo queryInfo) {
+        return succeed(studentGoodsSellService.queryStudentGoodsOrders(queryInfo));
+    }
 }