浏览代码

增加查询报名待支付的订单

周箭河 4 年之前
父节点
当前提交
0e58c87c79
共有 1 个文件被更改,包括 22 次插入6 次删除
  1. 22 6
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

+ 22 - 6
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -186,22 +186,22 @@ public class MusicGroupController extends BaseController {
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
         }
-        MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId,userId);
+        MusicGroupPaymentCalenderDetail calenderDetail = musicGroupPaymentCalenderDetailDao.findByCalenderIdAndUserId(calenderId, userId);
         if (calenderDetail == null) {
             throw new BizException("缴费项不存在该学员,请联系教务老师");
         }
-        if(calenderDetail.getPaymentStatus() == PaymentStatus.PAID_COMPLETED){
+        if (calenderDetail.getPaymentStatus() == PaymentStatus.PAID_COMPLETED) {
             throw new BizException("您已缴费,请勿重复提交");
-        }else if(calenderDetail.getPaymentStatus() == PaymentStatus.PROCESSING){
+        } else if (calenderDetail.getPaymentStatus() == PaymentStatus.PROCESSING) {
             throw new BizException("存在待处理的订单,请稍候尝试");
         }
         //缴费项目已开启或者单独开启
         Map renew;
-        if(calender.getStatus() == PaymentCalenderStatusEnum.OPEN || calenderDetail.getOpen() == 1){
+        if (calender.getStatus() == PaymentCalenderStatusEnum.OPEN || calenderDetail.getOpen() == 1) {
             renew = musicGroupService.renew(calenderId, userId, isUseBalancePayment);
-        }else if(calender.getStatus() == PaymentCalenderStatusEnum.OVER){
+        } else if (calender.getStatus() == PaymentCalenderStatusEnum.OVER) {
             throw new BizException("缴费已截止,如有问题请联系指导老师");
-        }else {
+        } else {
             throw new BizException("缴费暂未开始,如有问题请联系指导老师");
         }
         if (renew.containsKey("tradeState")) {
@@ -217,6 +217,22 @@ public class MusicGroupController extends BaseController {
         return succeed(musicGroupService.applyQuitMusicGroup(musicGroupId));
     }
 
+    @ApiOperation(value = "查询是否有待支付的报名订单")
+    @GetMapping("/checkWaitPayApplyOrder")
+    @ApiImplicitParams({@ApiImplicitParam(name = "registerId", value = "注册id", required = true, dataType = "int")})
+    public HttpResponseResult<StudentPaymentOrder> checkWaitPayApplyOrder(Long registerId) throws Exception {
+
+        StudentRegistration studentRegistration = studentRegistrationService.get(registerId);
+        if (studentRegistration == null) {
+            return failed("报名信息有误,请核查");
+        }
+        Integer userId = studentRegistration.getUserId();
+
+        //判断用户是否已存在订单
+        StudentPaymentOrder applyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
+        return succeed(applyOrder);
+    }
+
     @ApiOperation(value = "乐团报名支付")
     @PostMapping("/pay")
     @ApiImplicitParams({@ApiImplicitParam(name = "registerPayDto", value = "支付信息", required = true, dataType = "RegisterPayDto")})