| | |
| | | switch (state){ |
| | | case 3://出发前往预约点 |
| | | // 判断是否有其他未完成的单子 |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryByState(orderPrivateCar.getUserId(), 1, 1, 3,4, 5,6); |
| | | List<OrderPrivateCar> orderPrivateCars = orderPrivateCarMapper.queryDriverByState(orderPrivateCar.getDriverId(), 1, 1, 3,4, 5,6); |
| | | if(!CollectionUtils.isEmpty(orderPrivateCars)){ |
| | | return ResultUtil.error("有未完成的服务订单"); |
| | | } |
| | |
| | | orderPrivateCar.setParkMoney(null == parkingFee ? 0D : parkingFee); |
| | | orderPrivateCar.setRoadTollMoney(null == crossingFee ? 0D : crossingFee); |
| | | orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney() + orderPrivateCar.getParkMoney() + orderPrivateCar.getRoadTollMoney()); |
| | | orderPrivateCar.setIsConfirm(1); |
| | | //判断是否首单免费-免费直接完成 |
| | | Integer orderNumber = this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).last("and (state=8 or state=9)")); |
| | | |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | incomeService.saveDriverData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue(),driver.getBalance()); |
| | | incomeService.saveDriverData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue(),driver.getLaveBusinessMoney()); |
| | | }else{ |
| | | orderPrivateCar.setState(7); |
| | | orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()-userInfo.getFreeMoney().doubleValue()); |
| | |
| | | driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | driverService.updateById(driver); |
| | | incomeService.saveDriverData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue(), driver.getBalance()); |
| | | incomeService.saveDriverData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue(), driver.getLaveBusinessMoney()); |
| | | }else { |
| | | orderPrivateCar.setState(7); |
| | | } |
| | |
| | | this.setMoney(orderPrivateCar, 0D, 0D); |
| | | } |
| | | |
| | | if(Objects.isNull(orderPrivateCar.getEstimatedPrice())){ |
| | | orderPrivateCar.setEstimatedPrice(0D); |
| | | } |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(new BigDecimal(orderPrivateCar.getEstimatedPrice())).abs().doubleValue() > 3){ |
| | | orderPrivateCar.setIsException(1); |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | | |
| | | if(orderPrivateCar.getIsConfirm() == 0){ |
| | | // 查询起点或者终点在特殊区域中 |
| | | List<SpecialAreaBilling> specialAreaBillings = specialAreaBillingService.selectList(new EntityWrapper<SpecialAreaBilling>() |
| | | .eq("state", 1)); |
| | | if(!CollectionUtils.isEmpty(specialAreaBillings)){ |
| | | // 判断起点或者终点在特殊区域中 |
| | | Iterator<SpecialAreaBilling> iterator = specialAreaBillings.iterator(); |
| | | while (iterator.hasNext()) { |
| | | SpecialAreaBilling specialAreaBilling = iterator.next(); |
| | | // 起点 |
| | | Double startLon = orderPrivateCar.getStartLon(); |
| | | Double startLat = orderPrivateCar.getStartLat(); |
| | | boolean start = ElectricFenceUtil.monitorElectricFenc(specialAreaBilling.getCoordinate(), startLon + "," + startLat); |
| | | // 终点 |
| | | Double endLon = orderPrivateCar.getEndLon(); |
| | | Double endLat = orderPrivateCar.getEndLat(); |
| | | boolean end = ElectricFenceUtil.monitorElectricFenc(specialAreaBilling.getCoordinate(), endLon + "," + endLat); |
| | | if(!start && !end){ |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | if(!CollectionUtils.isEmpty(specialAreaBillings)){ |
| | | // 拿到价格系数最高的特殊区域 |
| | | specialAreaBillings.sort(new Comparator<SpecialAreaBilling>() { |
| | | @Override |
| | | public int compare(SpecialAreaBilling o1, SpecialAreaBilling o2) { |
| | | return o2.getPriceCoefficient().compareTo(o1.getPriceCoefficient()); |
| | | } |
| | | }); |
| | | BigDecimal priceCoefficient = specialAreaBillings.get(0).getPriceCoefficient(); |
| | | orderPrivateCar.setOrderMoney(Objects.nonNull(orderPrivateCar.getOrderMoney())?new BigDecimal(orderPrivateCar.getOrderMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setStartMoney(Objects.nonNull(orderPrivateCar.getStartMoney())?new BigDecimal(orderPrivateCar.getStartMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setMileageMoney(Objects.nonNull(orderPrivateCar.getMileageMoney())?new BigDecimal(orderPrivateCar.getMileageMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setDurationMoney(Objects.nonNull(orderPrivateCar.getDurationMoney())?new BigDecimal(orderPrivateCar.getDurationMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setWaitMoney(Objects.nonNull(orderPrivateCar.getWaitMoney())?new BigDecimal(orderPrivateCar.getWaitMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setLongDistanceMoney(Objects.nonNull(orderPrivateCar.getLongDistanceMoney())?new BigDecimal(orderPrivateCar.getLongDistanceMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setParkMoney(Objects.nonNull(orderPrivateCar.getParkMoney())?new BigDecimal(orderPrivateCar.getParkMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | orderPrivateCar.setRoadTollMoney(Objects.nonNull(orderPrivateCar.getRoadTollMoney())?new BigDecimal(orderPrivateCar.getRoadTollMoney()).multiply(priceCoefficient).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue():0D); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("orderMoney", orderPrivateCar.getOrderMoney());//订单金额 |
| | | map.put("startMileage", orderPrivateCar.getStartMileage());//起步价 |
| | |
| | | map.put("couponMoney", orderPrivateCar.getCouponMoney());//优惠券抵扣金额 |
| | | map.put("discountMoney", orderPrivateCar.getDiscountMoney());//折扣抵扣金额 |
| | | map.put("discount", orderPrivateCar.getDiscount());//折扣 |
| | | if(Objects.isNull(orderPrivateCar.getEstimatedPrice())){ |
| | | orderPrivateCar.setEstimatedPrice(0D); |
| | | } |
| | | if(BigDecimal.valueOf(orderPrivateCar.getOrderMoney()).subtract(new BigDecimal(orderPrivateCar.getEstimatedPrice())).abs().doubleValue() > 3){ |
| | | orderPrivateCar.setIsException(1); |
| | | } |
| | | map.put("estimatedPrice", orderPrivateCar.getEstimatedPrice()); |
| | | map.put("isException", orderPrivateCar.getIsException());//是否异常 |
| | | return map; |
| | |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | orderPrivateCar.setPriceType(priceType); |
| | | orderPrivateCar.setUpdatePrice(updatePrice); |
| | | orderPrivateCar.setOrderMoney(updatePrice.doubleValue()); |
| | | orderPrivateCar.setPriceAuditState(1); |
| | | orderPrivateCar.setState(6); |
| | | this.updateById(orderPrivateCar); |