Compare commits

...

2 Commits

Author SHA256 Message Date
yanglei
c721708e49 通过商户(骑行)订单订单号查询支付订单状态 2026-01-06 10:45:42 +08:00
yanglei
ab590e25c2 用户支付 2026-01-06 10:45:42 +08:00
4 changed files with 90 additions and 1 deletions

View File

@ -4,11 +4,14 @@ import com.cdzy.common.model.response.JsonResult;
import com.ebike.feign.component.FeignTokenInterceptor;
import com.ebike.feign.config.ExampleFeignConfiguration;
import com.ebike.feign.model.dto.FeignEbikeRefundDto;
import com.ebike.feign.model.vo.FeignEbikeWxHandleNotifyVo;
import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author yanglei
@ -17,6 +20,14 @@ import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = "ebike-payment", configuration = {ExampleFeignConfiguration.class, FeignTokenInterceptor.class})
public interface PaymentFeignClient {
/**
* 用户支付下单
*
* @param orderId 订单id
*/
@GetMapping("wxPayment/prepay")
JsonResult<JsonNode> prepay(@RequestParam(name = "orderId") Long orderId);
/**
* 用户退款
*
@ -32,4 +43,12 @@ public interface PaymentFeignClient {
*/
@GetMapping("wxPayment/checkRefundStatus/{refundId}")
JsonResult<?> checkRefundStatus(@PathVariable(name = "refundId") Long refundId);
/**
* 通过商户(骑行)订单订单号查询支付订单状态
*
* @param orderId 订单id
*/
@GetMapping("/wxPayment/queryOrderStatus/{orderId}")
JsonResult<FeignEbikeWxHandleNotifyVo> queryOrderStatusById(@PathVariable(name = "orderId") Long orderId);
}

View File

@ -0,0 +1,24 @@
package com.ebike.feign.model.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author yanglei
* @since 2026-01-06 10:38
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FeignEbikeWxHandleNotifyVo {
/**
* 解析是否成功
*/
private boolean success = false;
/**
* 解析错误消息
*/
private String message;
}

View File

@ -1,5 +1,7 @@
package com.cdzy.user.controller;
import com.cdzy.common.enums.Code;
import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.model.request.PageParam;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.user.model.dto.EbikeUserCyclingDto;
@ -9,13 +11,21 @@ import com.cdzy.user.model.vo.EbikeBikeInfoVo;
import com.cdzy.user.model.vo.EbikeRevenueStatisticsVo;
import com.cdzy.user.model.vo.EbikeUserAllOrdersVo;
import com.cdzy.user.service.EbikeOrderService;
import com.ebike.feign.clients.PaymentFeignClient;
import com.ebike.feign.model.dto.FeignEbikeDto;
import com.ebike.feign.model.vo.FeignEbikeBikeRadiusVo;
import com.ebike.feign.model.vo.FeignEbikeWxHandleNotifyVo;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -33,6 +43,9 @@ public class EbikeOrderController {
@Resource
private EbikeOrderService ebikeOrderService;
@Resource
private PaymentFeignClient paymentFeignClient;
/**
* 车辆列表
*
@ -130,4 +143,18 @@ public class EbikeOrderController {
List<EbikeRevenueStatisticsVo> revenueStatistics = ebikeOrderService.getRevenueStatistics();
return JsonResult.success(revenueStatistics);
}
/**
* 通过商户(骑行)订单订单号查询支付订单状态
*
* @param orderId 订单id
*/
@GetMapping("/queryOrderStatus/{orderId}")
public JsonResult<?> queryOrderStatusById(@PathVariable(name = "orderId") Long orderId) {
JsonResult<FeignEbikeWxHandleNotifyVo> jsonResult = paymentFeignClient.queryOrderStatusById(orderId);
if (jsonResult.getCode() != Code.SUCCESS) {
throw new EbikeException(jsonResult.getMessage());
}
return JsonResult.success(jsonResult.getData());
}
}

View File

@ -1,8 +1,12 @@
package com.cdzy.user.controller;
import com.cdzy.common.enums.Code;
import com.cdzy.common.ex.EbikeException;
import com.cdzy.common.model.response.JsonResult;
import com.cdzy.user.model.entity.EbikePayment;
import com.cdzy.user.service.EbikePaymentService;
import com.ebike.feign.clients.PaymentFeignClient;
import com.fasterxml.jackson.databind.JsonNode;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -23,6 +27,9 @@ public class EbikePaymentController {
@Resource
private EbikePaymentService ebikePaymentService;
@Resource
private PaymentFeignClient paymentFeignClient;
/**
* 根据订单号获取支付订单
*
@ -34,4 +41,16 @@ public class EbikePaymentController {
EbikePayment ebikePayment = ebikePaymentService.queryPaymentInfo(orderId);
return JsonResult.success(ebikePayment);
}
/**
* 用户支付下单
*/
@GetMapping("/prepay")
public JsonResult<?> prepay(@RequestParam("orderId") Long orderId) {
JsonResult<JsonNode> jsonResult = paymentFeignClient.prepay(orderId);
if (jsonResult.getCode() != Code.SUCCESS) {
throw new EbikeException(jsonResult.getMessage());
}
return JsonResult.success(jsonResult.getData());
}
}