From ad76eb64b4425d4769b8d5e091845c725225d5b3 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 5 Aug 2024 11:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/impl/BsOrderRefundServiceImpl.java | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java index 99f8aa4..8b1a796 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderRefundServiceImpl.java @@ -15,6 +15,7 @@ import com.hfkj.entity.BsOrderRefundExample; import com.hfkj.mer.BsMerPayConfigService; import com.hfkj.model.order.OrderChildModel; import com.hfkj.model.order.OrderModel; +import com.hfkj.service.hlt.HuiLianTongUnionCardService; import com.hfkj.service.order.BsOrderChildService; import com.hfkj.service.order.BsOrderRefundService; import com.hfkj.service.order.BsOrderService; @@ -36,10 +37,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @className: BsOrderRefundServiceImpl @@ -96,12 +94,25 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { } } else if (OrderPayChannelEnum.type3.getCode() == orderRefund.getRefundPayChannel()) { - // 商户退款 - JSONObject refundObj = huiftTradeService.thirdPayRefund(orderRefund.getRefundOrderNo(), orderRefund.getRefundPrice(), orderRefund.getOrderNo()); - orderRefund.setRefundSerialNo(refundObj.getString("refundTraceNo")); - orderRefund.setRefundPayChannelOrderNo(refundObj.getString("refundOrderNo")); - return true; - } else { + // 商户退款 + JSONObject refundObj = huiftTradeService.thirdPayRefund(orderRefund.getRefundOrderNo(), orderRefund.getRefundPrice(), orderRefund.getOrderNo()); + orderRefund.setRefundSerialNo(refundObj.getString("refundTraceNo")); + orderRefund.setRefundPayChannelOrderNo(refundObj.getString("refundOrderNo")); + return true; + + } /*else if (OrderPayChannelEnum.type4.getCode() == orderRefund.getRefundPayChannel()) { + // 商户退款 + JSONObject refundObj = HuiLianTongUnionCardService.refund(orderRefund.getRefundOrderNo(), orderRefund.getOrderNo()); + if (!refundObj.getString("respCode").equals("0000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage")); + } + JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data")); + if (!(consumptionResult.getBoolean("success") || Objects.equals(consumptionResult.getString("message"), "原交易已撤销,不可再次操作"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!"+consumptionResult.getString("message")); + } + orderRefund.setRefundSerialNo(consumptionResult.getString("orderId")); + return true; + }*/ else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!该支付方式暂不支持退款"); } } catch (BaseException e) { @@ -254,6 +265,10 @@ public class BsOrderRefundServiceImpl implements BsOrderRefundService { BsOrderRefundExample example = new BsOrderRefundExample(); BsOrderRefundExample.Criteria criteria = example.createCriteria(); + if (MapUtils.getLong(param, "merId") != null) { + criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId")); + } + if (StringUtils.isNotBlank(MapUtils.getString(param, "userPhone"))) { criteria.andUserPhoneEqualTo(MapUtils.getString(param, "userPhone")); }