支付宝api
parent
a4922593b9
commit
e8f7c1d1ea
|
@ -9,6 +9,7 @@ import com.alipay.api.request.AlipayTradePagePayRequest;
|
|||
import com.muyu.cloud.market.config.AliPayConfig;
|
||||
import com.muyu.cloud.market.domin.Orders;
|
||||
import com.muyu.cloud.market.domin.PayInfo;
|
||||
import com.muyu.cloud.market.service.OrderShowService;
|
||||
import com.muyu.cloud.market.service.PayInfoService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
@ -41,8 +42,10 @@ public class AliPayController {
|
|||
|
||||
@Resource
|
||||
private PayInfoService payInfoService;
|
||||
@Resource
|
||||
private OrderShowService orderShowService;
|
||||
|
||||
@GetMapping("/pay") // /alipay/pay?orderNo=xxx
|
||||
@GetMapping("/pay")
|
||||
public void pay(String ordersNum, HttpServletResponse httpResponse) throws Exception {
|
||||
//查询订单信息
|
||||
Orders orders = payInfoService.selectByordersNum (ordersNum);
|
||||
|
@ -111,12 +114,13 @@ public class AliPayController {
|
|||
String tradeNo = params.get("out_trade_no"); // 订单编号
|
||||
String gmtPayment = params.get("gmt_payment"); // 支付时间
|
||||
String alipayTradeNo = params.get("trade_no"); // 支付宝交易编号
|
||||
|
||||
// 更新订单状态为已支付,设置支付信息
|
||||
// Orders orders = ordersService.selectByOrderNo(tradeNo);
|
||||
// orders.setStatus("已支付");
|
||||
// orders.setPayTime(gmtPayment);
|
||||
// orders.setPayNo(alipayTradeNo);
|
||||
// ordersService.updateById(orders);
|
||||
// Orders orders = orderShowService.selectByOrderNo(tradeNo);
|
||||
// orders.setOrdersState(Integer.valueOf("已支付"));
|
||||
// orders.setCreateTime(gmtPayment);
|
||||
// orders.setOrdersNum(alipayTradeNo);
|
||||
// orderShowService.updateOrders(orders);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.cloud.market.domin.req.OrdersAddReq;
|
|||
import com.muyu.cloud.market.domin.req.OrdersListReq;
|
||||
import com.muyu.cloud.market.domin.req.OrdersUpdReq;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -66,12 +67,12 @@ public interface OrderShowMapper {
|
|||
|
||||
|
||||
/**
|
||||
* 添加订单(下单时),扣减库存
|
||||
* 修改订单支付状态未付款后,增加库存
|
||||
* 支付宝
|
||||
* @param ordersNum
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@Select("select * from orders where orders_num = #{ordersNum}")
|
||||
Orders selectByordersNum(String ordersNum);
|
||||
|
||||
/**
|
||||
* 订单修改支付状态后,更改该商品的销量
|
||||
|
|
|
@ -64,7 +64,12 @@ public interface OrderShowService {
|
|||
*/
|
||||
Orders findAllById (Integer ordersId);
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝对接模块
|
||||
* @param ordersNum
|
||||
* @return
|
||||
*/
|
||||
Orders selectByOrderNo(String ordersNum);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -123,6 +123,11 @@ public class OrderShowServiceImpl implements OrderShowService {
|
|||
}
|
||||
|
||||
|
||||
public Orders selectByOrderNo(String ordersNum) {
|
||||
return orderShowMapper.selectByordersNum(ordersNum);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue