支付宝api

dev2
Aaaaaaaa 2024-09-01 01:01:44 +08:00
parent a4922593b9
commit e8f7c1d1ea
4 changed files with 27 additions and 12 deletions

View File

@ -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);
}
}

View File

@ -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);
/**
* ,

View File

@ -64,7 +64,12 @@ public interface OrderShowService {
*/
Orders findAllById (Integer ordersId);
/**
*
* @param ordersNum
* @return
*/
Orders selectByOrderNo(String ordersNum);

View File

@ -123,6 +123,11 @@ public class OrderShowServiceImpl implements OrderShowService {
}
public Orders selectByOrderNo(String ordersNum) {
return orderShowMapper.selectByordersNum(ordersNum);
}
}