From ab2f615067be929202a0a2212362b1cb02c585ec Mon Sep 17 00:00:00 2001 From: "weicw1996@qq.com" Date: Tue, 8 Sep 2026 23:19:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(hjc):=20=E5=90=8E=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=80=E6=AC=BE=E6=8E=A5=E5=8F=A3=20-=20POST=20/api?= =?UTF-8?q?/hjc/order/refund(=E7=BD=AE=E5=B7=B2=E9=80=80=E6=AC=BE+?= =?UTF-8?q?=E6=8E=A8=E9=80=81REFUNDED)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hjc/controller/HjcOrderController.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/gxwebsoft/hjc/controller/HjcOrderController.java b/src/main/java/com/gxwebsoft/hjc/controller/HjcOrderController.java index 9eebd79..8566ce1 100644 --- a/src/main/java/com/gxwebsoft/hjc/controller/HjcOrderController.java +++ b/src/main/java/com/gxwebsoft/hjc/controller/HjcOrderController.java @@ -202,6 +202,26 @@ public class HjcOrderController extends BaseController { return success(hjcOrderService.pageRel(param)); } + @Operation(summary = "退款(标记已退款,幂等),并推送 REFUNDED 状态") + @PostMapping("/refund") + public ApiResult refund(@RequestBody Map body) { + String orderNo = body.get("orderNo") == null ? null : String.valueOf(body.get("orderNo")); + if (orderNo == null) { + return fail("订单号不能为空"); + } + HjcOrder order = hjcOrderService.getByOrderNo(orderNo); + if (order == null) { + return fail("订单不存在"); + } + if (order.getPayStatus() != null && order.getPayStatus() == 3) { + return success("已是退款状态", order); + } + order.setPayStatus(3); + hjcOrderService.updateById(order); + hjcBizService.pushOrderToOneStop(order); + return success("已退款", order); + } + private String firstNotBlank(String a, String b) { return a != null && !a.trim().isEmpty() ? a : b; }