| | |
| | | package com.stylefeng.guns.modular.specialTrain.server.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | @Service |
| | | public class OrderPrivateCarServiceImpl extends ServiceImpl<OrderPrivateCarMapper, OrderPrivateCar> implements IOrderPrivateCarService { |
| | | |
| | | public static List<Integer> orderIds = new ArrayList<>(); |
| | | public static Set<Integer> orderIds = ConcurrentHashMap.newKeySet();; |
| | | @Resource |
| | | private OrderPrivateCarMapper orderPrivateCarMapper; |
| | | @Resource |
| | |
| | | return ResultUtil.error("订单已取消,请刷新页面"); |
| | | } |
| | | if (!Integer.valueOf(2).equals(orderPrivateCar.getPaymentMode())) { |
| | | ResultUtil refundResult = handlePrivateCarPrepayCancelRefund(orderPrivateCar, reason, remark, uid); |
| | | if (refundResult != null) { |
| | | if (!ResultUtil.SUCCESS.equals(refundResult.getCode())) { |
| | | return refundResult; |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", null); |
| | | return ResultUtil.success(map); |
| | | } |
| | | handlePrivateCarPrepayCancelRefund(orderPrivateCar,reason); |
| | | } |
| | | Integer number1 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("pid", orderPrivateCar.getPid() == null ? orderPrivateCar.getId() : orderPrivateCar.getPid()).lt("state", 6)); |
| | | Integer number2 = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("id", orderPrivateCar.getPid() == null ? orderPrivateCar.getId() : orderPrivateCar.getPid()).lt("state", 6)); |
| | |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 1); |
| | | fillPrivateCarPrepayDisplayMoney(this.selectById(orderId), map); |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | orderMoney = orderMoney < 0 ? 0 : orderMoney; |
| | | ResultUtil prepaySettleResult = settlePrivateCarPrepayIfNoSecondPay(orderPrivateCar, userInfo, orderMoney); |
| | | if (prepaySettleResult != null) { |
| | | return prepaySettleResult; |
| | | } |
| | | orderMoney = getPrivateCarPrepayFinalPayAmount(orderPrivateCar, orderMoney); |
| | | if (payType == 1) {//微信支付 |
| | | String outTradeNo = orderId + "_1_" + UUIDUtil.getRandomCode(5); |
| | | JSONObject response = cbyzxOrderPayHelper.createOrder(orderPrivateCar.getUserId(), userInfo.getAppletsOpenId(), outTradeNo, orderMoney); |
| | |
| | | orderMoney = new BigDecimal(orderMoney).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | System.out.println("!!!" + orderMoney + "!!!!"); |
| | | orderMoney = orderMoney < 0 ? 0 : orderMoney; |
| | | orderPrivateCar.setPayMoney(orderMoney); |
| | | ResultUtil prepaySettleResult = settlePrivateCarPrepayIfNoSecondPay(orderPrivateCar, userInfo, orderMoney); |
| | | if (prepaySettleResult != null) { |
| | | return prepaySettleResult; |
| | | } |
| | | orderMoney = getPrivateCarPrepayFinalPayAmount(orderPrivateCar, orderMoney); |
| | | if (!isPrivateCarPrepaySpreadStage(orderPrivateCar)) { |
| | | orderPrivateCar.setPayMoney(orderMoney); |
| | | } |
| | | if (payType == 1) {//微信支付 |
| | | if (orderMoney == 0) { |
| | | return ResultUtil.error("请使用余额支付"); |
| | |
| | | .doubleValue(); |
| | | } |
| | | |
| | | private boolean isPrivateCarPrepayFinalStage(OrderPrivateCar orderPrivateCar) { |
| | | return orderPrivateCar != null |
| | | && Integer.valueOf(7).equals(orderPrivateCar.getState()); |
| | | } |
| | | |
| | | private BigDecimal toMoney(Double amount) { |
| | | return new BigDecimal(String.valueOf(amount == null ? 0D : amount)).setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private PaymentRecord getPrivateCarPrepayPaidRecord(OrderPrivateCar orderPrivateCar) throws Exception { |
| | | PaymentRecord paymentRecord = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, orderPrivateCar.getId(), 1, orderPrivateCar.getPayType(), 2); |
| | | if (paymentRecord == null) { |
| | | paymentRecord = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, orderPrivateCar.getId(), 1, null, 2); |
| | | } |
| | | if (paymentRecord == null) { |
| | | paymentRecord = paymentRecordService.query(1, null, null, orderPrivateCar.getId(), 1, null, 2); |
| | | } |
| | | if (paymentRecord != null && orderPrivateCar.getPayType() == null) { |
| | | orderPrivateCar.setPayType(paymentRecord.getPayType()); |
| | | } |
| | | return paymentRecord; |
| | | } |
| | | |
| | | private BigDecimal getPrivateCarPrepayPaidAmount(OrderPrivateCar orderPrivateCar) throws Exception { |
| | | PaymentRecord paymentRecord = getPrivateCarPrepayPaidRecord(orderPrivateCar); |
| | | if (paymentRecord != null && paymentRecord.getAmount() != null && paymentRecord.getAmount() > 0) { |
| | | return toMoney(paymentRecord.getAmount()); |
| | | } |
| | | if ((Integer.valueOf(1).equals(orderPrivateCar.getPaymentMode()) || (orderPrivateCar.getPrepayStage() != null && orderPrivateCar.getPrepayStage() > 0)) |
| | | && orderPrivateCar.getPayMoney() != null && orderPrivateCar.getPayMoney() > 0) { |
| | | return toMoney(orderPrivateCar.getPayMoney()); |
| | | } |
| | | return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private Double getPrivateCarPrepayFinalPayAmount(OrderPrivateCar orderPrivateCar, Double finalAmount) throws Exception { |
| | | if (!isPrivateCarPrepayFinalStage(orderPrivateCar)) { |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | BigDecimal paidAmount = getPrivateCarPrepayPaidAmount(orderPrivateCar); |
| | | if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | BigDecimal spreadAmount = toMoney(finalAmount).subtract(paidAmount).setScale(2, RoundingMode.HALF_UP); |
| | | if (spreadAmount.compareTo(BigDecimal.ZERO) > 0) { |
| | | orderPrivateCar.setPrepayStage(3); |
| | | return spreadAmount.doubleValue(); |
| | | } |
| | | return 0D; |
| | | } |
| | | |
| | | private Double getPrivateCarPrepayDisplayPayAmount(OrderPrivateCar orderPrivateCar, Double finalAmount) { |
| | | if (!isPrivateCarPrepayFinalStage(orderPrivateCar)) { |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | try { |
| | | BigDecimal paidAmount = getPrivateCarPrepayPaidAmount(orderPrivateCar); |
| | | if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | BigDecimal displayAmount = toMoney(finalAmount).subtract(paidAmount).setScale(2, RoundingMode.HALF_UP); |
| | | return displayAmount.compareTo(BigDecimal.ZERO) > 0 ? displayAmount.doubleValue() : 0D; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | } |
| | | |
| | | private void fillPrivateCarPrepayDisplayMoney(OrderPrivateCar orderPrivateCar, Map<String, Object> map) { |
| | | if (map == null || orderPrivateCar == null || !isPrivateCarPrepayFinalStage(orderPrivateCar)) { |
| | | return; |
| | | } |
| | | Double finalAmount = null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : orderPrivateCar.getOrderMoney(); |
| | | Double displayAmount = getPrivateCarPrepayDisplayPayAmount(orderPrivateCar, finalAmount); |
| | | map.put("orderMoney", displayAmount); |
| | | map.put("payMoney", displayAmount); |
| | | } |
| | | |
| | | private ResultUtil settlePrivateCarPrepayIfNoSecondPay(OrderPrivateCar orderPrivateCar, UserInfo userInfo, Double finalAmount) throws Exception { |
| | | if (!isPrivateCarPrepayFinalStage(orderPrivateCar)) { |
| | | return null; |
| | | } |
| | | BigDecimal paidAmount = getPrivateCarPrepayPaidAmount(orderPrivateCar); |
| | | if (paidAmount.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return null; |
| | | } |
| | | BigDecimal settleAmount = toMoney(finalAmount); |
| | | BigDecimal refundAmount = paidAmount.subtract(settleAmount).setScale(2, RoundingMode.HALF_UP); |
| | | if (refundAmount.compareTo(BigDecimal.ZERO) < 0) { |
| | | return null; |
| | | } |
| | | if (refundAmount.compareTo(BigDecimal.ZERO) > 0) { |
| | | ResultUtil refundResult = refundPrivateCarPrepayDifference(orderPrivateCar, userInfo, refundAmount.doubleValue()); |
| | | if (!ResultUtil.SUCCESS.equals(refundResult.getCode())) { |
| | | return refundResult; |
| | | } |
| | | } |
| | | finishPrivateCarPrepayOrder(orderPrivateCar, settleAmount.doubleValue()); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | private ResultUtil refundPrivateCarPrepayDifference(OrderPrivateCar orderPrivateCar, UserInfo userInfo, Double refundAmount) throws Exception { |
| | | if (Integer.valueOf(3).equals(orderPrivateCar.getPayType())) { |
| | | userInfo.setBalance(new BigDecimal(null != userInfo.getBalance() ? userInfo.getBalance() : 0D) |
| | | .add(toMoney(refundAmount)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userInfoService.updateById(userInfo); |
| | | orderPrivateCar.setPrepayRefundNo("BALANCE_REFUND_1_" + orderPrivateCar.getId() + "_" + ToolUtil.getRandomString(5)); |
| | | orderPrivateCar.setPrepayRefundAmount(refundAmount); |
| | | orderPrivateCar.setPrepayRefundTime(new Date()); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车先付订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | PaymentRecord paymentRecord = getPrivateCarPrepayPaidRecord(orderPrivateCar); |
| | | if (paymentRecord == null) { |
| | | return ResultUtil.error("先付订单缺少已支付流水,无法退款"); |
| | | } |
| | | if (Integer.valueOf(1).equals(orderPrivateCar.getPayType())) { |
| | | CbyzxPayUtil.ClosePayOrderRequest request = new CbyzxPayUtil.ClosePayOrderRequest(); |
| | | request.setOutRequestNo(ToolUtil.isNotEmpty(orderPrivateCar.getPrepaySecondPayNo()) ? orderPrivateCar.getPrepaySecondPayNo() : paymentRecord.getCode()); |
| | | request.setRefundOutRequestNo("PREPAY_DIFF_REFUND_1_" + orderPrivateCar.getId() + ToolUtil.getRandomString(5)); |
| | | request.setRefundAmount(toFen(refundAmount)); |
| | | request.setRefundDesc("快车先付订单多退少补退款"); |
| | | JSONObject response = CbyzxPayUtil.closePayOrder(request); |
| | | if (!isPrivateCarPrepayRefundSuccess(response)) { |
| | | return ResultUtil.error(extractPrivateCarRefundMessage(response), response); |
| | | } |
| | | orderPrivateCar.setPrepayRefundNo(extractPrivateCarRefundNo(response)); |
| | | orderPrivateCar.setPrepayRefundAmount(refundAmount); |
| | | orderPrivateCar.setPrepayRefundTime(new Date()); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车先付订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | return ResultUtil.success(response); |
| | | } |
| | | if (Integer.valueOf(2).equals(orderPrivateCar.getPayType())) { |
| | | Map<String, String> map = payMoneyUtil.aliRefund(paymentRecord.getCode(), refundAmount.toString()); |
| | | if (!"10000".equals(map.get("code"))) { |
| | | return ResultUtil.error(map.get("msg")); |
| | | } |
| | | orderPrivateCar.setPrepayRefundNo(map.get("trade_no")); |
| | | orderPrivateCar.setPrepayRefundAmount(refundAmount); |
| | | orderPrivateCar.setPrepayRefundTime(new Date()); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车先付订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | return ResultUtil.success(map); |
| | | } |
| | | return ResultUtil.error("先付订单支付方式不支持退款"); |
| | | } |
| | | |
| | | private void finishPrivateCarPrepayOrder(OrderPrivateCar orderPrivateCar, Double settleAmount) throws Exception { |
| | | orderPrivateCar.setState(8); |
| | | orderPrivateCar.setPayMoney(settleAmount); |
| | | orderPrivateCar.setPayTime(new Date()); |
| | | orderPrivateCar.setPrepayStage(5); |
| | | if (orderPrivateCar.getRecoveryOrder() != null && 0 == orderPrivateCar.getRecoveryOrder()) { |
| | | Double incomeAmount = (2 == orderPrivateCar.getAbnormal() && 2 == orderPrivateCar.getAbnormalStatus() |
| | | ? orderPrivateCar.getResponsibilityMoney().doubleValue() : orderPrivateCar.getOrderMoney()); |
| | | Map<String, Object> map = incomeService.saveIncome(orderPrivateCar.getId(), 1, incomeAmount); |
| | | orderPrivateCar.setSplitAllocation(JSON.toJSONString(map)); |
| | | } |
| | | this.updateAllColumnById(orderPrivateCar); |
| | | promotion(orderPrivateCar.getId()); |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | } |
| | | }).start(); |
| | | systemNoticeService.addSystemNotice(1, "您的快车先付订单已完成结算,请注意查收。", orderPrivateCar.getUserId(), 1); |
| | | } |
| | | |
| | | private void consumePrivateCarBenefits(OrderPrivateCar orderPrivateCar) throws Exception { |
| | | if (null != orderPrivateCar.getCouponId()) { |
| | | UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderPrivateCar.getCouponId()); |
| | |
| | | return orderPrivateCar != null && Integer.valueOf(1).equals(orderPrivateCar.getPaymentMode()); |
| | | } |
| | | |
| | | private void handlePrivateCarPrepayCancelRefund(OrderPrivateCar orderPrivateCar, String reason) throws Exception { |
| | | if (!isPrivateCarPrepayMode(orderPrivateCar)) { |
| | | return; |
| | | } |
| | | if (Integer.valueOf(3).equals(orderPrivateCar.getPayType())) { |
| | | Double refundAmount = orderPrivateCar.getPayMoney(); |
| | | if (refundAmount == null || refundAmount <= 0) { |
| | | throw new RuntimeException("余额先付订单退款金额异常"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | if (userInfo == null) { |
| | | throw new RuntimeException("用户信息不存在,无法退款"); |
| | | } |
| | | userInfo.setBalance(new BigDecimal(null != userInfo.getBalance() ? userInfo.getBalance() : 0) |
| | | .add(new BigDecimal(refundAmount)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userInfoService.updateById(userInfo); |
| | | restorePrivateCarBenefits(orderPrivateCar); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车取消订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCar.setPrepayStage(5); |
| | | orderPrivateCar.setPrepayRefundNo("BALANCE_REFUND_1_" + orderPrivateCar.getId() + "_" + ToolUtil.getRandomString(5)); |
| | | orderPrivateCar.setPrepayRefundAmount(refundAmount); |
| | | orderPrivateCar.setPrepayRefundTime(new Date()); |
| | | this.updateById(orderPrivateCar); |
| | | systemNoticeService.addSystemNotice(1, "您的快车余额先付订单已取消,退款已退回账户余额,请注意查收。", orderPrivateCar.getUserId(), 1); |
| | | } else if (Integer.valueOf(1).equals(orderPrivateCar.getPayType())){ |
| | | String outRequestNo = orderPrivateCar.getPrepaySecondPayNo(); |
| | | if (ToolUtil.isEmpty(outRequestNo)) { |
| | | throw new RuntimeException("微信先付订单缺少支付单号,无法关闭支付单"); |
| | | } |
| | | Double refundAmount = orderPrivateCar.getPayMoney(); |
| | | if (refundAmount == null || refundAmount <= 0) { |
| | | throw new RuntimeException("微信先付订单退款金额异常"); |
| | | } |
| | | CbyzxPayUtil.ClosePayOrderRequest request = new CbyzxPayUtil.ClosePayOrderRequest(); |
| | | request.setOutRequestNo(outRequestNo); |
| | | request.setRefundOutRequestNo(buildPrepayRefundOutNo(orderPrivateCar.getId())); |
| | | request.setRefundAmount(toFen(refundAmount)); |
| | | request.setRefundDesc(ToolUtil.isNotEmpty(reason) ? reason : "快车订单取消退款"); |
| | | JSONObject response = CbyzxPayUtil.closePayOrder(request); |
| | | if (!isPrivateCarPrepayRefundSuccess(response)) { |
| | | throw new RuntimeException(extractPrivateCarRefundMessage(response)); |
| | | } |
| | | restorePrivateCarBenefits(orderPrivateCar); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车取消订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | systemNoticeService.addSystemNotice(1, "您的快车微信先付订单已取消,退款已原路退回,请注意查收。", orderPrivateCar.getUserId(), 1); |
| | | } |
| | | } |
| | | |
| | | private ResultUtil handlePrivateCarPrepayCancelRefund(OrderPrivateCar orderPrivateCar, String reason, String remark, Integer uid) throws Exception { |
| | | System.out.println("快车退款!!!!"); |
| | | if (!isPrivateCarPrepayMode(orderPrivateCar)) { |
| | | return null; |
| | | } |
| | | if (Integer.valueOf(3).equals(orderPrivateCar.getPayType())) { |
| | | Double refundAmount = orderPrivateCar.getPayMoney(); |
| | | System.out.println("快车余额退款金额!!!!"+ refundAmount); |
| | | if (refundAmount == null || refundAmount <= 0) { |
| | | return ResultUtil.error("余额先付订单退款金额异常"); |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | if (userInfo == null) { |
| | | return ResultUtil.error("用户信息不存在,无法退款"); |
| | | } |
| | | userInfo.setBalance(new BigDecimal(null != userInfo.getBalance() ? userInfo.getBalance() : 0) |
| | | .add(new BigDecimal(refundAmount)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | userInfoService.updateById(userInfo); |
| | | restorePrivateCarBenefits(orderPrivateCar); |
| | | transactionDetailsService.saveData(orderPrivateCar.getUserId(), "快车取消订单退款", refundAmount, 1, 1, 1, 1, orderPrivateCar.getId()); |
| | | orderCancelService.saveData(orderPrivateCar.getId(), 1, |
| | | ToolUtil.isNotEmpty(reason) ? reason : "无司机接单", |
| | | ToolUtil.isNotEmpty(remark) ? remark : (ToolUtil.isNotEmpty(reason) ? reason : "无司机接单"), |
| | | 1, refundAmount, 2, 1, uid); |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCar.setPrepayStage(5); |
| | | orderPrivateCar.setPrepayRefundNo("BALANCE_REFUND_1_" + orderPrivateCar.getId() + "_" + ToolUtil.getRandomString(5)); |
| | | orderPrivateCar.setPrepayRefundAmount(refundAmount); |
| | | orderPrivateCar.setPrepayRefundTime(new Date()); |
| | | this.updateById(orderPrivateCar); |
| | | if (orderPrivateCar.getDriverId() != null) { |
| | | this.deleteTask(orderPrivateCar.getId()); |
| | | pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0); |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | if (driver != null) { |
| | | driver.setState(2); |
| | | driverService.updateById(driver); |
| | | } |
| | | if (orderPrivateCar.getBindId() != null) { |
| | | chinaMobileUtil.midAxbUnBindSend(orderPrivateCar.getBindId(), orderPrivateCar.getTelX(), (System.currentTimeMillis() + 600000)); |
| | | } |
| | | } |
| | | System.out.println("余额退款通知940"); |
| | | systemNoticeService.addSystemNotice(1, "您的快车余额先付订单已取消,退款已退回账户余额,请注意查收。", orderPrivateCar.getUserId(), 1); |
| | | return ResultUtil.success(); |
| | | } |
| | | String outRequestNo = orderPrivateCar.getPrepaySecondPayNo(); |
| | | if (ToolUtil.isEmpty(outRequestNo)) { |
| | |
| | | private void handlePrivateCarPrepayFirstPaid(OrderPrivateCar orderPrivateCar, UserInfo userInfo, Double payAmount, Integer payType) throws Exception { |
| | | OpenCity openCity = openCityService.openCity1(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString()); |
| | | SysIntegral query1 = sysIntegralMapper.query(openCity.getId()); |
| | | System.out.println("快车预付回调-------057,"+query1); |
| | | if (null != query1) { |
| | | userInfo.setIntegral(userInfo.getIntegral() + (payAmount.intValue() * query1.getIntegral())); |
| | | } |
| | |
| | | if (query == null) { |
| | | query = paymentRecordService.query(1, orderPrivateCar.getUserId(), 1, Integer.valueOf(id), 1, type, 1); |
| | | } |
| | | System.out.println("快车预付回调-------084,"+query); |
| | | if (null != query && query.getState() == 1) { |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | | |
| | | System.out.println("快车预付回调-------090"); |
| | | if (isPrivateCarPrepayFirstStage(orderPrivateCar)) { |
| | | orderPrivateCar.setPrepaySecondPayNo(outTradeNo); |
| | | handlePrivateCarPrepayFirstPaid(orderPrivateCar, userInfo, query.getAmount(), type); |
| | |
| | | vo.setDriverInfoWarpper(driverInfoWarpper); |
| | | //其余信息 |
| | | BeanUtils.copyProperties(order, vo); |
| | | vo.setPayMoney(getPrivateCarPrepayDisplayPayAmount(order, order.getOrderMoney())); |
| | | unPayOrderVOList.add(vo); |
| | | } |
| | | |
| | |
| | | } |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | | System.out.println("pushOrder2:" + pushOrder); |
| | | if (orderPrivateCar.getState() > 1) { |
| | | push = true; |
| | | break; |
| | |
| | | |
| | | }else { |
| | | // 没找到车辆 |
| | | Thread.sleep(5000); |
| | | ResultUtil refundResult = handlePrivateCarPrepayCancelRefund(orderPrivateCar, "无司机接单", "无司机接单", orderPrivateCar.getUserId()); |
| | | if (refundResult == null) { |
| | | orderPrivateCar.setState(10); |
| | | orderPrivateCarMapper.updateById(orderPrivateCar); |
| | | } |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 1); |
| | | pushUtil.pushEndPush(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 10); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | | System.out.println("pushOrder1:" + pushOrder); |
| | | int i2 = pushOrder.getPushTime() / 10; |
| | | if (i2 == 0) { |
| | | i2 = 1; |