diff --git a/agileboot-common/src/main/java/com/agileboot/common/constant/PayApiConstants.java b/agileboot-common/src/main/java/com/agileboot/common/constant/PayApiConstants.java index 0cde211..5b052c0 100644 --- a/agileboot-common/src/main/java/com/agileboot/common/constant/PayApiConstants.java +++ b/agileboot-common/src/main/java/com/agileboot/common/constant/PayApiConstants.java @@ -2,6 +2,7 @@ package com.agileboot.common.constant; public class PayApiConstants { public static final String biz_id = "wxshop"; + public static final String old_biz_id = "wxshop_old"; public static final String appkey = "wxshop202503081132"; public static final String pay_url = "http://222.218.10.217:7890/open/trade/wx/jsapi/precreate"; public static final String pay_callback_url = "http://wxshop.ab98.cn/shop-api/api/payment/callback"; diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/approval/ReturnApprovalApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/approval/ReturnApprovalApplicationService.java index 5f3ff37..f45b48a 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/approval/ReturnApprovalApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/approval/ReturnApprovalApplicationService.java @@ -159,10 +159,34 @@ public class ReturnApprovalApplicationService { // 微信退款 RefundVO refundVO = null; try { - refundVO = paymentApplicationService.refund( - PayApiConstants.biz_id, PayApiConstants.appkey, - orderModel.getBizOrderId(), orderModel.getUcid(), - "退还", returnAmount.intValue()); + // 检查订单创建时间是否在2025年6月10日11:05之前 + Date cutoffDate = DateUtil.parse("2025-06-10 11:05:00", "yyyy-MM-dd HH:mm:ss"); + if (orderModel.getCreateTime().after(cutoffDate)) { + refundVO = paymentApplicationService.refund( + PayApiConstants.biz_id, PayApiConstants.appkey, + orderModel.getBizOrderId(), orderModel.getUcid(), + "退还", returnAmount.intValue()); + } else { + try { + refundVO = paymentApplicationService.refund( + PayApiConstants.old_biz_id, PayApiConstants.appkey, + orderModel.getBizOrderId(), orderModel.getUcid(), + "退还", returnAmount.intValue()); + } catch (Exception e) { + AddPaymentOperationLogCommand paymentOperationLogCommand = new AddPaymentOperationLogCommand(); + paymentOperationLogCommand.setParams(JSONUtil.toJsonStr(command)); + paymentOperationLogCommand.setOperationType("refund"); + paymentOperationLogCommand.setStatus(3); + paymentOperationLogCommand.setRemark(ExceptionUtils.getStackTrace(e)); + paymentOperationLogCommand.initBaseEntity(); + paymentOperationLogApplicationService.addPaymentOperationLog(paymentOperationLogCommand); + + refundVO = paymentApplicationService.refund( + PayApiConstants.biz_id, PayApiConstants.appkey, + orderModel.getBizOrderId(), orderModel.getUcid(), + "退还", returnAmount.intValue()); + } + } AddPaymentOperationLogCommand paymentOperationLogCommand = new AddPaymentOperationLogCommand(); paymentOperationLogCommand.setParams(JSONUtil.toJsonStr(command)); diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/shop/payment/PaymentApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/shop/payment/PaymentApplicationService.java index 21013e1..49f9d86 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/shop/payment/PaymentApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/shop/payment/PaymentApplicationService.java @@ -156,7 +156,7 @@ public class PaymentApplicationService { String result = HttpUtil.post(url, sb.toString()); CommonResponse res = JSONUtil.toBean(result, new TypeReference>(){}, true); if (res.getCode() != CommonErrorCode.OK.getErrorCode()) { - throw new Exception(res.getMsg()); + throw new Exception(res.getMsg() + ",请求参数:" + JSONUtil.toJsonStr(params) + ",响应结果:" + result); } return res.getData(); }