|
@@ -5,14 +5,22 @@ import com.ym.mec.biz.dal.entity.CloudTeacherStudent;
|
|
|
import com.ym.mec.biz.dal.page.CloudTeacherAddQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
|
|
|
import com.ym.mec.biz.service.CloudTeacherOrderService;
|
|
|
+import com.ym.mec.biz.service.OrderPayOpsService;
|
|
|
+import com.ym.mec.biz.service.impl.TenantInfoServiceImpl;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.thirdparty.yqpay.Msg;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -27,7 +35,10 @@ public class CloudTeacherOrderController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private CloudTeacherOrderService cloudTeacherOrderService;
|
|
|
+ @Autowired
|
|
|
+ private OrderPayOpsService orderPayOpsService;
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(CloudTeacherOrderController.class);
|
|
|
|
|
|
@ApiOperation(value ="手动添加会员")
|
|
|
@PostMapping("/addStudents")
|
|
@@ -65,14 +76,6 @@ public class CloudTeacherOrderController extends BaseController {
|
|
|
return succeed(cloudTeacherOrderService.queryRecord(cloudTeacherOrderQueryInfo));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value ="测试支付通知")
|
|
|
- @PostMapping("/testPayNotify")
|
|
|
- // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryActive')")
|
|
|
- public Object testPayNotify(@RequestBody Msg msg) throws Exception {
|
|
|
- return succeed(cloudTeacherOrderService.payNotify(msg));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
@ApiOperation(value ="激活团练宝用户")
|
|
|
@PostMapping("/pay")
|
|
|
// @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/pay')")
|
|
@@ -80,17 +83,28 @@ public class CloudTeacherOrderController extends BaseController {
|
|
|
return succeed(cloudTeacherOrderService.pay(cloudTeacherStudents));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value ="支付回调")
|
|
|
- @PostMapping("/payNotify")
|
|
|
- // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payNotify')")
|
|
|
- public Msg payNotify(@ModelAttribute Msg msg) throws Exception {
|
|
|
- return cloudTeacherOrderService.payNotify(msg);
|
|
|
+ @ApiOperation(value ="支付执行")
|
|
|
+ @GetMapping("/payExecute")
|
|
|
+ @PostMapping("/executePayment")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "amount", value = "支付金额", required = true, dataType = "BigDecimal"),
|
|
|
+ @ApiImplicitParam(name = "orderNo", value = "订单号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "payChannel", value = "支付方式(alipay-支付宝app支付)", required = true, dataType = "String"),
|
|
|
+ })
|
|
|
+ // @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payExecute')")
|
|
|
+ public Object executePayment(BigDecimal amount, String orderNo, String payChannel, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sign, String code, String platform) {
|
|
|
+ try {
|
|
|
+ Map<String, Object> payment = orderPayOpsService.executePayment(amount, orderNo, payChannel, returnUrl, orderSubject, orderBody, sign, code, platform);
|
|
|
+ return succeed(payment);
|
|
|
+ } catch (Exception e) {
|
|
|
+ return failed(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value ="轮询查询订单状态")
|
|
|
@GetMapping("/payCheck")
|
|
|
// @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/payCheck')")
|
|
|
- public Object payCheck(@RequestParam String orderNo ) {
|
|
|
+ public Object payCheck(@RequestParam String orderNo ) throws Exception {
|
|
|
return succeed(cloudTeacherOrderService.payCheck(orderNo));
|
|
|
}
|
|
|
}
|