通过商户(骑行)订单订单号查询支付订单状态

This commit is contained in:
yanglei 2026-01-06 10:45:00 +08:00
parent ab590e25c2
commit c721708e49
4 changed files with 67 additions and 5 deletions

View File

@ -4,6 +4,8 @@ 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;
@ -24,7 +26,7 @@ public interface PaymentFeignClient {
* @param orderId 订单id
*/
@GetMapping("wxPayment/prepay")
JsonResult<?> prepay(@RequestParam(name = "orderId") Long orderId);
JsonResult<JsonNode> prepay(@RequestParam(name = "orderId") Long orderId);
/**
* 用户退款
@ -41,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

@ -6,6 +6,7 @@ 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;
@ -42,14 +43,14 @@ public class EbikePaymentController {
}
/**
* 支付下单
* 用户支付下单
*/
@GetMapping("/prepay")
public JsonResult<?> prepay(@RequestParam("orderId") Long orderId) {
JsonResult<?> jsonResult = paymentFeignClient.prepay(orderId);
JsonResult<JsonNode> jsonResult = paymentFeignClient.prepay(orderId);
if (jsonResult.getCode() != Code.SUCCESS) {
throw new EbikeException(jsonResult.getMessage());
}
return JsonResult.success();
return JsonResult.success(jsonResult.getData());
}
}