|
@@ -1,5 +1,7 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
+import com.huifu.adapay.model.payment.PayChannelEnum;
|
|
|
+import com.huifu.adapay.model.payment.Payment;
|
|
|
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
@@ -8,6 +10,7 @@ import com.ym.mec.biz.service.StudentPaymentOrderService;
|
|
|
import com.ym.mec.biz.service.StudentRegistrationService;
|
|
|
import com.ym.mec.biz.service.VipGroupService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.thirdparty.adapay.Pay;
|
|
|
import com.ym.mec.thirdparty.union.NotifyMsg;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -17,6 +20,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
@RequestMapping("studentOrder")
|
|
@@ -30,7 +34,7 @@ public class StudentOrderController extends BaseController {
|
|
|
private StudentRegistrationService studentRegistrationService;
|
|
|
@Autowired
|
|
|
private VipGroupService vipGroupService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private MusicGroupService musicGroupService;
|
|
|
|
|
@@ -68,10 +72,10 @@ public class StudentOrderController extends BaseController {
|
|
|
order.setPayTime(notifyMsg.getPayTime());
|
|
|
if (order.getType().equals(OrderTypeEnum.APPLY)) { //报名订单
|
|
|
studentRegistrationService.updateApplyOrder(order);
|
|
|
- }else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)){
|
|
|
+ } else if (order.getType().equals(OrderTypeEnum.SMALL_CLASS_TO_BUY)) {
|
|
|
vipGroupService.orderCallback(order);
|
|
|
- }else if(order.getType().equals(OrderTypeEnum.RENEW)){
|
|
|
- musicGroupService.renewForCallback(order);
|
|
|
+ } else if (order.getType().equals(OrderTypeEnum.RENEW)) {
|
|
|
+ musicGroupService.renewForCallback(order);
|
|
|
}
|
|
|
|
|
|
return "SUCCESS";
|
|
@@ -80,16 +84,28 @@ public class StudentOrderController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "查询订单状态")
|
|
|
@GetMapping("/checkOrderStatus")
|
|
|
- public Object checkOrderStatus(String orderNo){
|
|
|
- if(StringUtils.isBlank(orderNo)){
|
|
|
+ public Object checkOrderStatus(String orderNo) {
|
|
|
+ if (StringUtils.isBlank(orderNo)) {
|
|
|
return failed("请指定订单");
|
|
|
}
|
|
|
StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(orderNo);
|
|
|
- if(Objects.isNull(orderByOrderNo)){
|
|
|
+ if (Objects.isNull(orderByOrderNo)) {
|
|
|
return failed("未找到指定订单");
|
|
|
}
|
|
|
return succeed(orderByOrderNo.getStatus());
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "台牌支付")
|
|
|
+ @GetMapping("/executePayment")
|
|
|
+ public Object executePayment() throws Exception {
|
|
|
+ String orderNo = "jsdk_payment_" + System.currentTimeMillis();
|
|
|
+ String payChannel = PayChannelEnum.ALIPAY_QR.getCode();
|
|
|
+ BigDecimal amount = new BigDecimal("0.01");
|
|
|
+ String orderSubject = "测试大雅订单";
|
|
|
+ String orderBody = "测试大雅订单";
|
|
|
+ Payment payment = Pay.executePayment(amount, orderNo, payChannel, orderSubject, orderBody);
|
|
|
+ return succeed(payment);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|