| | |
| | | package com.stylefeng.guns.modular.taxi.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | if (orderTaxi.getState() >= 5 && orderTaxi.getState() != 11) { |
| | | return ResultUtil.error("订单已取消,请刷新页面"); |
| | | } |
| | | if (!Integer.valueOf(2).equals(orderTaxi.getType())) { |
| | | System.out.println("出租车退款111!!!!"); |
| | | if (!Integer.valueOf(2).equals(orderTaxi.getPaymentMode())) { |
| | | System.out.println("出租车退款2222!!!!"); |
| | | ResultUtil refundResult = handleTaxiPrepayCancelRefund(orderTaxi, reason, remark, uid); |
| | | if (refundResult != null) { |
| | | System.out.println("出租车退款3333!!!!"+refundResult.getCode()); |
| | | if (!ResultUtil.SUCCESS.equals(refundResult.getCode())) { |
| | | return refundResult; |
| | | } |
| | |
| | | } |
| | | |
| | | private String buildPrepayRefundOutNo(Integer orderId) { |
| | | return "PREPAY_REFUND_2_" + orderId; |
| | | return "PREPAY_REFUND_2_" + orderId+ ToolUtil.getRandomString(5); |
| | | } |
| | | |
| | | private ResultUtil handleTaxiPrepayCancelRefund(OrderTaxi orderTaxi, String reason, String remark, Integer uid) throws Exception { |
| | | System.out.println("出租车退款!!!!"); |
| | | if (orderTaxi == null || !Integer.valueOf(1).equals(orderTaxi.getPaymentMode())) { |
| | | return null; |
| | | } |
| | |
| | | request.setRefundAmount(toFen(refundAmount)); |
| | | request.setRefundDesc(ToolUtil.isNotEmpty(reason) ? reason : "出租车订单取消退款"); |
| | | JSONObject response = CbyzxPayUtil.closePayOrder(request); |
| | | System.out.println("微信先付订单退款结果:" + response.toJSONString()); |
| | | if (!isTaxiPrepayRefundSuccess(response)) { |
| | | return ResultUtil.error(extractTaxiRefundMessage(response), response); |
| | | } |