| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | Order order = getOrderPrice(1, d, 0, new Order(), city); |
| | | Order order1 = new Order(); |
| | | order1.setCreateTime(new Date()); |
| | | Order order = getOrderPrice(1, d, 0D, order1, city); |
| | | Double estimatedPrice = order.getEstimatedPrice(); |
| | | Coupon coupon = userToCouponService.queryCoupon(uid, estimatedPrice); |
| | | if(null != coupon){ |
| | |
| | | * @param city 查询天气的城市 |
| | | * @return |
| | | */ |
| | | public Order getOrderPrice(Integer type, Double distance, Integer waitTime, Order order, String city){ |
| | | public Order getOrderPrice(Integer type, Double distance, Double waitTime, Order order, String city){ |
| | | distance = new BigDecimal(distance).setScale(0, BigDecimal.ROUND_UP).doubleValue(); |
| | | waitTime = new BigDecimal(waitTime).setScale(0, BigDecimal.ROUND_UP).doubleValue(); |
| | | order = getOrderInitialPrice(order); |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | if(null == systemConfig){ |
| | |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); |
| | | Date date = new Date(); |
| | | Date date = order.getCreateTime(); |
| | | for (int i = 0; i < chargeStandard.size(); i++) {//计算各个时段 |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | |
| | | } |
| | | |
| | | //计算额外费用 |
| | | Integer num1 = extraCost.getInteger("num1");//等待时长 |
| | | Double num1 = extraCost.getDouble("num1");//等待时长 |
| | | Double num2 = extraCost.getDouble("num2");//等待费 |
| | | Integer num3 = extraCost.getInteger("num3");//等待超出时长 |
| | | Double num3 = extraCost.getDouble("num3");//等待超出时长 |
| | | Double num4 = extraCost.getDouble("num4");//等到超出时长费用单价 X/分钟 |
| | | Double num5 = extraCost.getDouble("num5");//恶劣天气公里 |
| | | Double num6 = extraCost.getDouble("num6");//恶劣天气费 |
| | |
| | | order.setWaitTime(num1);//等待时长 |
| | | order.setWaitTimePrice(num2);//等待费用 |
| | | |
| | | Integer w = waitTime - num3; |
| | | Double w = waitTime - num3; |
| | | BigDecimal multiply = new BigDecimal(w).multiply(new BigDecimal(num4)); |
| | | order.setOutWaitTime(w);//等待时长超出分钟 |
| | | order.setOutWaitTimePrice(multiply.doubleValue());//等待时长超出费用 |
| | |
| | | order.setOverLongDistancePrice(0d);//超出长途里程费 |
| | | // order.setWaitTime(0);//等待时长 |
| | | order.setWaitTimePrice(0D);//等待费 |
| | | order.setOutWaitTime(0);//超出等待时长 |
| | | order.setOutWaitTime(0D);//超出等待时长 |
| | | order.setOutWaitTimePrice(0D);//超出等待时长费 |
| | | order.setBadWeatherDistance(0D);//恶劣天气里程 |
| | | order.setBadWeatherPrice(0D);//恶劣天气里程费 |
| | |
| | | .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); |
| | | city = null != weatherCity ? weatherCity.getId().toString() : ""; |
| | | } |
| | | order = getOrderPrice(1, d, 0, order, city); |
| | | order.setCreateTime(new Date()); |
| | | order = getOrderPrice(1, d, 0D, order, city); |
| | | if(null != travelOrder.getDriverId()){ |
| | | DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", travelOrder.getDriverId()).eq("status", 1)); |
| | | if(null == driverWork){ |
| | |
| | | */ |
| | | public void pushOrder(Long orderId){ |
| | | try { |
| | | Order order = this.selectById(orderId); |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | | * 没有1 - 》 |
| | | * 2.按照后台推送配置在范围内查找合适司机 |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | boolean lock = redisUtil.lock(5); |
| | | if(!lock){ |
| | | int num1 = 1; |
| | |
| | | } |
| | | } |
| | | } |
| | | Order order = this.selectById(orderId); |
| | | /** |
| | | * 1.先找最大推单范围内的优推司机 -》 距离最近 |
| | | * 没有1 - 》 |
| | | * 2.按照后台推送配置在范围内查找合适司机 |
| | | * 合适司:积分 > 评分 > 距离 |
| | | * 3.司机没有接单直接将订单置入大厅 |
| | | */ |
| | | if(!lock){ |
| | | order.setHallOrder(1); |
| | | this.updateById(order); |
| | | ExtraPushOrder(order); |
| | | redisUtil.unlock(); |
| | | } |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 1)); |
| | | if(null == systemConfig){ |
| | | redisUtil.unlock(); |
| | |
| | | new Timer().schedule(new TimerTask() { |
| | | @Override |
| | | public void run() { |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | |
| | | Order order1 = OrderServiceImpl.this.selectById(order.getId()); |
| | | if(order1.getState() == 101 || order1.getState() == 201){ |
| | | order1.setHallOrder(1); |
| | | OrderServiceImpl.this.updateById(order1); |
| | | |
| | | driver1.setServerStatus(1); |
| | | driverService.updateById(driver1); |
| | | ExtraPushOrder(order); |
| | | } |
| | | } |
| | |
| | | } |
| | | Order order1 = new Order(); |
| | | BeanUtils.copyProperties(order, order1); |
| | | Order orderPrice = getOrderPrice(1, d, 0, order1, city); |
| | | Order orderPrice = getOrderPrice(1, d, 0D, order1, city); |
| | | order.setEstimatedPrice(orderPrice.getEstimatedPrice()); |
| | | this.updateById(order); |
| | | |
| | |
| | | SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); |
| | | if(null != systemConfig1){ |
| | | JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); |
| | | //司机推荐首单收入 |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ |
| | | //司机推荐用户收入 |
| | | if(null != appUser.getInviterType() && appUser.getInviterType() == 2){ |
| | | Double num1 = jsonObject1.getDouble("num1"); |
| | | num1 = (num3 >= num1 ? num1 : num3); |
| | | |
| | |
| | | accountChangeDetail.setType(1); |
| | | accountChangeDetail.setChangeType(5); |
| | | accountChangeDetail.setOldData(driver1.getCouponBalance() + driver1.getCommission()); |
| | | accountChangeDetail.setExplain("邀请用户首单奖励"); |
| | | accountChangeDetail.setExplain("邀请用户奖励"); |
| | | accountChangeDetail.setCreateTime(new Date()); |
| | | driver1.setCommission(driver1.getCommission() + num1); |
| | | accountChangeDetail.setNewData(driver1.getCouponBalance() + driver1.getCommission()); |