|
@@ -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");
|
|
@@ -2555,14 +2566,21 @@ 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, "关闭订单");
|
|
|
- }
|
|
|
+
|
|
|
+ // 查询订单状态
|
|
|
+ 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, "关闭订单");
|
|
|
}
|
|
|
}
|
|
|
}
|