| | |
| | | } |
| | | |
| | | Integer lineShifDriverId = null; |
| | | if (lineId < 0 && lineDestinationId < 0) { |
| | | if (lineId < 0 && (lineDestinationId == null || lineDestinationId < 0)) { |
| | | lineShifDriverId = lineShiftDriverMapper.selectLineShiftDriverIdByCustomerId(-lineId); |
| | | } |
| | | ResultUtil<Map<String, Object>> result = this.getPriceV2(lineId, lineDestinationId, totalSeat, peopleNumber, endLon, endLat, lineShifDriverId); |
| | |
| | | } |
| | | String paymentCode = ToolUtil.isNotEmpty(cbyzxOrderPayHelper.extractRecordCode(response)) ? cbyzxOrderPayHelper.extractRecordCode(response) : outTradeNo; |
| | | resultUtil = ResultUtil.success(response); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, paymentCode, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, outTradeNo, 1);//添加预支付数据 |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | | resultUtil = payMoneyUtil.alipay("完成订单", "完成订单", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/aliPayOrderTaxi"); |
| | |
| | | String paymentCode = ToolUtil.isNotEmpty(cbyzxOrderPayHelper.extractRecordCode(response)) ? cbyzxOrderPayHelper.extractRecordCode(response) : outTradeNo; |
| | | resultUtil = ResultUtil.success(response); |
| | | this.updateById(orderCrossCity); |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, paymentCode, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, orderId, 3, 1, orderMoney, outTradeNo, 1);//添加预支付数据 |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | | if (orderMoney == 0) { |
| | |
| | | |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | // query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | |
| | | orderCrossCity.setMileage(0D); |
| | | |
| | | Integer lineShifDriverId = orderCrossCityWarpper.getLineShiftDriverId(); |
| | | if (orderCrossCityWarpper.getLineId() < 0 && orderCrossCityWarpper.getLineDestinationId() < 0) { |
| | | Integer lineDestinationId = orderCrossCityWarpper.getLineDestinationId(); |
| | | if (orderCrossCityWarpper.getLineId() < 0 && (lineDestinationId == null || lineDestinationId < 0)) { |
| | | lineShifDriverId = lineShiftDriverMapper.selectLineShiftDriverIdByCustomerId(-orderCrossCityWarpper.getLineId()); |
| | | } |
| | | ResultUtil<Map<String, Object>> price = this.getPriceV2(orderCrossCityWarpper.getLineId(), orderCrossCityWarpper.getLineDestinationId(), |
| | |
| | | if (money < 0) { |
| | | return ResultUtil.error("计算价格失败"); |
| | | } |
| | | orderCrossCity.setLineShiftDriverId(lineShifDriverId); |
| | | orderCrossCity.setOrderMoney(money); |
| | | Integer companyId = driver.getCompanyId(); |
| | | orderCrossCity.setCompanyId(companyId); |
| | |
| | | } |
| | | String recordCode = cbyzxOrderPayHelper.extractRecordCode(response); |
| | | String paymentCode = ToolUtil.isNotEmpty(recordCode) ? recordCode : outTradeNo; |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 1, query.getMoney(), paymentCode, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(1, orderCrossCity.getUserId(), 1, id, 3, 1, query.getMoney(), outTradeNo, 1);//添加预支付数据 |
| | | resultUtil = ResultUtil.success(response); |
| | | |
| | | // Map<String, String> map = icbcPayUtil.placeAnOrder(id + ",3", 9, 5, uid.toString(), "订单取消", query.getMoney(), callbackPath + "/base/wxCancelOrderTaxi", "", type, appletsOpenId); |
| | | // if(map.get("code").equals("200")){ |
| | |
| | | this.updateById(orderCrossCity); |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | // query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | OrderCancel query1 = orderCancelService.query(query.getOrderId(), query.getOrderType(), query.getAmount(), query.getPayType(), 1); |
| | |
| | | } |
| | | |
| | | if (query.getPayType() == 1) {//微信 |
| | | Map<String, String> map = payMoneyUtil.wxRefund(query.getCode(), id + "_3", query.getAmount().toString(), query.getAmount().toString(), "/base/cancleOrderWXPay"); |
| | | if (!"SUCCESS".equals(map.get("return_code"))) { |
| | | return ResultUtil.error(map.get("return_msg")); |
| | | CbyzxPayUtil.ClosePayOrderRequest request = new CbyzxPayUtil.ClosePayOrderRequest(); |
| | | request.setOutRequestNo(query.getCode()); |
| | | request.setRefundOutRequestNo(buildPrepayRefundOutNo(orderCrossCity.getId())); |
| | | |
| | | request.setRefundAmount(toFen(query.getAmount())); |
| | | request.setRefundDesc("跨城出行取消退款"); |
| | | JSONObject response = CbyzxPayUtil.closePayOrder(request); |
| | | System.out.println("跨城出行取消退款退款结果:" + response.toJSONString()); |
| | | if (!isTaxiPrepayRefundSuccess(response)) { |
| | | return ResultUtil.error(extractCrossCityRefundMessage(response), response); |
| | | } |
| | | transactionDetailsService.saveData(orderCrossCity.getUserId(), "跨城出行取消退款", query.getAmount(), 1, 1, 1, 3, id); |
| | | } else if (query.getPayType() == 4) { // 云闪付 |
| | |
| | | map.put("id", integer); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | |
| | | |
| | | private Integer toFen(Double amount) { |
| | | return new BigDecimal(String.valueOf(amount)).multiply(new BigDecimal("100")).setScale(0, RoundingMode.HALF_UP).intValue(); |
| | | } |
| | | |
| | | private String buildPrepayRefundOutNo(Integer orderId) { |
| | | return "CROSS_REFUND_1_" + orderId + ToolUtil.getRandomString(5); |
| | | } |
| | | |
| | | private boolean isTaxiPrepayRefundSuccess(JSONObject response) { |
| | | if (response == null) { |
| | | return false; |
| | | } |
| | | Object code = response.get("code"); |
| | | if (code == null || !"0".equals(String.valueOf(code))) { |
| | | return false; |
| | | } |
| | | JSONObject data = response.getJSONObject("data"); |
| | | return data != null && Boolean.TRUE.equals(data.getBoolean("isSuccess")); |
| | | } |
| | | |
| | | private String extractCrossCityRefundMessage(JSONObject response) { |
| | | if (response == null) { |
| | | return "微信跨城订单退款失败"; |
| | | } |
| | | JSONObject data = response.getJSONObject("data"); |
| | | if (data != null && ToolUtil.isNotEmpty(data.getString("failReason"))) { |
| | | return data.getString("failReason"); |
| | | } |
| | | String msg = response.getString("msg"); |
| | | return ToolUtil.isNotEmpty(msg) ? msg : "微信跨城订单退款失败"; |
| | | } |
| | | /** |
| | | * 获取服务中的订单数据 |
| | | * |
| | |
| | | } |
| | | String recordCode = cbyzxOrderPayHelper.extractRecordCode(response); |
| | | String paymentCode = ToolUtil.isNotEmpty(recordCode) ? recordCode : outTradeNo; |
| | | paymentRecordService.saveData(3, uid, 1, orderId, 3, 1, money, paymentCode, 1);//添加预支付数据 |
| | | paymentRecordService.saveData(3, uid, 1, orderId, 3, 1, money, outTradeNo, 1);//添加预支付数据 |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | | resultUtil = payMoneyUtil.alipay("感谢费", "感谢费", "", orderId + "_3_" + UUIDUtil.getRandomCode(5), money.toString(), "/base/aliPayThankYouFee"); |
| | |
| | | UserInfo userInfo = userInfoService.selectById(orderCrossCity.getUserId()); |
| | | PaymentRecord query = paymentRecordService.query(3, userInfo.getId(), 1, orderId, 3, payType, 1); |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | // query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | OpenCity openCity = openCityService.openCity1(orderCrossCity.getStartLon().toString(), orderCrossCity.getStartLat().toString()); |