| | |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | | map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); |
| | | map.put("orderType", 2); |
| | | fillTaxiPrepayDisplayMoney(this.selectById(orderId), map); |
| | | return map; |
| | | } |
| | | |
| | |
| | | return spreadAmount.doubleValue(); |
| | | } |
| | | return 0D; |
| | | } |
| | | |
| | | private Double getTaxiPrepayDisplayPayAmount(OrderTaxi orderTaxi, Double finalAmount) { |
| | | if (!isTaxiPrepayFinalStage(orderTaxi)) { |
| | | return toMoney(finalAmount).doubleValue(); |
| | | } |
| | | try { |
| | | BigDecimal paidAmount = getTaxiPrepayPaidAmount(orderTaxi); |
| | | 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 fillTaxiPrepayDisplayMoney(OrderTaxi orderTaxi, Map<String, Object> map) { |
| | | if (map == null || orderTaxi == null || !isTaxiPrepayFinalStage(orderTaxi)) { |
| | | return; |
| | | } |
| | | Double finalAmount = null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : orderTaxi.getOrderMoney(); |
| | | Double displayAmount = getTaxiPrepayDisplayPayAmount(orderTaxi, finalAmount); |
| | | map.put("orderMoney", displayAmount); |
| | | map.put("payMoney", displayAmount); |
| | | } |
| | | |
| | | private ResultUtil settleTaxiPrepayIfNoSecondPay(OrderTaxi orderTaxi, UserInfo userInfo, Double finalAmount) throws Exception { |
| | |
| | | unPayOrderVO.setDriverInfoWarpper(driverInfoWarpper); |
| | | //鍏朵綑淇℃伅 |
| | | BeanUtils.copyProperties(orderTaxi, unPayOrderVO); |
| | | unPayOrderVO.setPayMoney(getTaxiPrepayDisplayPayAmount(orderTaxi, orderTaxi.getOrderMoney())); |
| | | unPayOrderVOList.add(unPayOrderVO); |
| | | |
| | | } |