mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-03-04 19:20:46 +08:00
1.集成支付宝沙箱支付功能
2.订单下单 3.回调通知(未成功) 4.回查订单支付状态
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package cn.xf.basedemo.controller.business;
|
||||
|
||||
|
||||
import cn.xf.basedemo.service.OrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* PayCallbackController
|
||||
*
|
||||
* @author 海言
|
||||
* @date 2025/10/22
|
||||
* @time 16:16
|
||||
* @Description 支付回调控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pay/callback")
|
||||
public class PayCallbackController {
|
||||
|
||||
@Resource
|
||||
private OrderService userService;
|
||||
|
||||
//回调
|
||||
@Operation(summary = "支付宝支付回调", description = "支付宝支付回调")
|
||||
@PostMapping("/ali/notice")
|
||||
public String aliCallback(HttpServletRequest request) {
|
||||
userService.aliCallback(request);
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.xf.basedemo.controller.business;
|
||||
|
||||
|
||||
import cn.xf.basedemo.common.model.RetObj;
|
||||
import cn.xf.basedemo.model.req.PayOrderFrom;
|
||||
import cn.xf.basedemo.service.OrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* PayOrderController
|
||||
*
|
||||
* @author 海言
|
||||
* @date 2025/10/22
|
||||
* @time 14:07
|
||||
* @Description 支付下单控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/pay")
|
||||
public class PayOrderController {
|
||||
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@Operation(summary = "支付宝支付下单", description = "支付宝支付下单")
|
||||
@PostMapping("/ali/createOrder")
|
||||
public RetObj aliCreateOrder(@RequestBody PayOrderFrom from) {
|
||||
|
||||
return orderService.aliCreateOrder(from);
|
||||
}
|
||||
|
||||
//掉单查询支付宝支付订单状态
|
||||
@Operation(summary = "掉单查询支付宝支付订单状态", description = "掉单查询支付宝支付订单状态")
|
||||
@GetMapping("/ali/queryOrderStatus")
|
||||
public String queryAlipayOrderStatus(String orderNo) {
|
||||
return orderService.queryAlipayOrderStatus(orderNo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package cn.xf.basedemo.controller.business;
|
||||
import cn.xf.basedemo.common.model.LoginUser;
|
||||
import cn.xf.basedemo.common.model.RetObj;
|
||||
import cn.xf.basedemo.interceptor.SessionContext;
|
||||
import cn.xf.basedemo.model.res.LoginInfoRes;
|
||||
import cn.xf.basedemo.model.req.LoginInfoReq;
|
||||
import cn.xf.basedemo.service.UserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -27,7 +27,7 @@ public class UserController {
|
||||
|
||||
@Operation(summary = "用户登录", description = "用户登录")
|
||||
@PostMapping("/login")
|
||||
public RetObj login(@RequestBody LoginInfoRes res) {
|
||||
public RetObj login(@RequestBody LoginInfoReq res) {
|
||||
|
||||
return userService.login(res);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user