| | |
| | | package com.sandu.ximon.admin.service; |
| | | |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.service.impl.BaseServiceImpl; |
| | | import com.sandu.common.third.pay.wx.WxFastPayService; |
| | | import com.sandu.ximon.admin.pay.wx.WxFastPayService; |
| | | import com.sandu.ximon.admin.security.SecurityUtils; |
| | | import com.sandu.ximon.admin.utils.AliPayUtils; |
| | | import com.sandu.ximon.dao.domain.C3mOrder; |
| | | import com.sandu.ximon.dao.enums.OrderStatus; |
| | |
| | | private final C3mOrderMapper c3mOrderMapper; |
| | | private final WxFastPayService fastPayService; |
| | | |
| | | public boolean orderRefund(String outTradeNo, Double refundAmount, Long userId, String username) { |
| | | public boolean orderRefund(String outTradeNo, Double refundAmount/*, Long userId, String username*/) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | String username = SecurityUtils.getUsername(); |
| | | C3mOrder orderByOutTradeNo = c3mOrderMapper.getOrderByOutTradeNo(outTradeNo); |
| | | if (orderByOutTradeNo.getTotalAmount() < refundAmount) { |
| | | throw new BusinessException("退款金额错误,不能大于付款金额"); |
| | | } |
| | | if (null == orderByOutTradeNo) { |
| | | return false; |
| | | } else { |
| | |
| | | C3mOrder.getRefundAmount()); |
| | | } else if (C3mOrder.getOrderType().equals(OrderType.WXPAY.getCode())) { |
| | | // 进行微信退款 |
| | | // b = WxPayUtils.getBean().wxRefund( |
| | | // C3mOrder.getTotalAmount(), |
| | | // C3mOrder.getRefundAmount(), |
| | | // C3mOrder.getOutTradeNo(), |
| | | // C3mOrder.getPoleId() |
| | | // ); |
| | | b = fastPayService.refund( |
| | | C3mOrder.getTotalAmount(), |
| | | C3mOrder.getRefundAmount(), |
| | | C3mOrder.getOutTradeNo(), |
| | | C3mOrder.getPoleId() |
| | | ); |
| | | } |
| | | C3mOrder.setRefundTimestamp(new Date().getTime()); |
| | | C3mOrder.setRefundMsg(msg); |