|
@@ -137,6 +137,7 @@ import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.PayStatus;
|
|
|
import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PeriodEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
@@ -1007,10 +1008,20 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
Integer userId = studentRegistration.getUserId();
|
|
|
|
|
|
- StudentPaymentOrder ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
|
|
|
- if (ApplyOrder == null) {
|
|
|
+ StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
|
|
|
+ if (applyOrder == null) {
|
|
|
throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
|
|
|
}
|
|
|
+
|
|
|
+ // 查询订单状态
|
|
|
+ PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
+ if(payStatus != PayStatus.FAILED){
|
|
|
+ if(payStatus == PayStatus.SUCCESSED){
|
|
|
+ throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
+ }else if(payStatus == PayStatus.PAYING){
|
|
|
+ throw new BizException("订单还在交易中,请稍后重试");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
MusicGroupPaymentCalender musicGroupRegCalender = musicGroupPaymentCalenderDao.getMusicGroupRegCalender(studentRegistration.getMusicGroupId());
|
|
|
if(musicGroupRegCalender == null){
|
|
@@ -1018,9 +1029,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
//手动关闭订单
|
|
|
- ApplyOrder.setStatus(DealStatusEnum.FAILED);
|
|
|
- ApplyOrder.setMemo("用户手动关闭");
|
|
|
- studentPaymentOrderService.callOrderCallBack(ApplyOrder);
|
|
|
+ applyOrder.setStatus(DealStatusEnum.FAILED);
|
|
|
+ applyOrder.setMemo("用户手动关闭");
|
|
|
+ studentPaymentOrderService.callOrderCallBack(applyOrder);
|
|
|
|
|
|
BigDecimal amount = registerPayDto.getAmount(); //前端获取的价格
|
|
|
BigDecimal orderAmount = new BigDecimal("0");
|
|
@@ -1792,7 +1803,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("乐团找不到");
|
|
|
}
|
|
|
|
|
|
- if (!(musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
|
|
|
+ if (!(musicGroup.getStatus() == MusicGroupStatusEnum.APPLY ||
|
|
|
+ musicGroup.getStatus() == MusicGroupStatusEnum.PAY ||
|
|
|
musicGroup.getStatus() == MusicGroupStatusEnum.PREPARE ||
|
|
|
musicGroup.getStatus() == MusicGroupStatusEnum.PROGRESS)) {
|
|
|
throw new BizException("乐团当前状态是[{}],不能延长缴费", musicGroup.getStatus().getMsg());
|
|
@@ -2554,15 +2566,22 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//关闭之前的订单
|
|
|
if (calenderDetail.getPaymentOrderId() != null) {
|
|
|
StudentPaymentOrder oldStudentPaymentOrder = studentPaymentOrderDao.get(calenderDetail.getPaymentOrderId());
|
|
|
- if (oldStudentPaymentOrder != null) {
|
|
|
- if (oldStudentPaymentOrder.getStatus() == SUCCESS) {
|
|
|
- throw new BizException("您已支付请勿重复提交");
|
|
|
- } else if (oldStudentPaymentOrder.getStatus() == ING) {
|
|
|
- oldStudentPaymentOrder.setStatus(CLOSE);
|
|
|
- studentPaymentOrderService.update(oldStudentPaymentOrder);
|
|
|
- if (oldStudentPaymentOrder.getBalancePaymentAmount() != null && oldStudentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- sysUserCashAccountService.updateBalance(oldStudentPaymentOrder.getUserId(), oldStudentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
|
|
|
- }
|
|
|
+ if (oldStudentPaymentOrder != null && oldStudentPaymentOrder.getStatus() == ING) {
|
|
|
+
|
|
|
+ // 查询订单状态
|
|
|
+ PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldStudentPaymentOrder.getPaymentChannel(), oldStudentPaymentOrder.getOrderNo(), oldStudentPaymentOrder.getTransNo());
|
|
|
+ if(payStatus != PayStatus.FAILED){
|
|
|
+ if(payStatus == PayStatus.SUCCESSED){
|
|
|
+ throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
+ }else if(payStatus == PayStatus.PAYING){
|
|
|
+ throw new BizException("订单还在交易中,请稍后重试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ oldStudentPaymentOrder.setStatus(CLOSE);
|
|
|
+ studentPaymentOrderService.update(oldStudentPaymentOrder);
|
|
|
+ if (oldStudentPaymentOrder.getBalancePaymentAmount() != null && oldStudentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(oldStudentPaymentOrder.getUserId(), oldStudentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -3728,6 +3747,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//查询当前乐团报名订单中购买了乐保的订单
|
|
|
List<StudentApplyInstrumentDto> maintenanceList = studentPaymentOrderDetailDao.queryByType(musicGroupId, OrderDetailTypeEnum.MAINTENANCE);
|
|
|
|
|
|
+ if(maintenanceList == null || maintenanceList.size() == 0){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
List<Long> instrumentIdList = maintenanceList.stream().map(t -> t.getStudentInstrumentId()).collect(Collectors.toList());
|
|
|
|
|
|
List<StudentInstrument> studentInstrumentList = studentInstrumentDao.queryById(instrumentIdList);
|