| | |
| | | if(ToolUtil.isEmpty(userInfo.getPhone())){ |
| | | return ResultUtil.error(language == 1 ? "请先绑定手机号码" : language == 2 ? "Please bind your mobile phone number first." : "Veuillez d’abord vous inscrire en liant votre numéro de téléphone portable."); |
| | | } |
| | | String[] split1 = placementLon.split(","); |
| | | Company company = companyCityService.query1(uid, split1[0], split1[1]); |
| | | Company company = companyCityService.query1(uid, placementLon, placementLat); |
| | | if(null != userInfo && null != company){ |
| | | userInfo.setCompanyId(company.getId()); |
| | | userInfoService.updateById(userInfo); |
| | |
| | | CarService query1 = carServiceMapper.query(1, dr.getCarId()); |
| | | orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderPrivateCar.setSnatchOrderTime(new Date()); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderPrivateCar.setEstimateArriveTime(new Date(timeOut)); |
| | | orderPrivateCar.setEstimateArriveMileage(distancematrix.getDistance()); |
| | | } |
| | | |
| | | dr.setState(3); |
| | | driverService.updateById(dr); |
| | |
| | | long t = object.getInteger("driverTimeout") * 60000L; |
| | | //司机超时未到达起点,免费取消 |
| | | if(orderPrivateCar.getOrderType() == 1){ |
| | | if(orderPrivateCar.getState() == 1 || orderPrivateCar.getState() == 11){ |
| | | baseWarpper.setAmount(0D); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | if(orderPrivateCar.getState() <= 3 && orderPrivateCar.getEstimateArriveTime().getTime() + t <= System.currentTimeMillis()){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | |
| | | if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11 && orderPrivateCar.getState() != 12){ |
| | | return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); |
| | | } |
| | | |
| | | orderCancelService.delete(new EntityWrapper<OrderCancel>().eq("orderId", orderPrivateCar.getId()).eq("orderType", 1)); |
| | | |
| | | //服务中也可以取消订单,所以取消订单时需要计算订单费用 |
| | | if(null == orderPrivateCar.getDriverId()){//没有接单的情况 |
| | |
| | | orderTaxiService.updateById(orderTaxi); |
| | | } |
| | | }else{ |
| | | integer = orderCancelService.saveData(id, 1, language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", null, null, 2, 1, uid); |
| | | integer = orderCancelService.saveData(id, 1, language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", null, 0D, 2, 1, uid); |
| | | orderPrivateCar.setState(10); |
| | | this.updateById(orderPrivateCar); |
| | | } |
| | |
| | | BaseWarpper data = queryCancleAmount(id, language).getData(); |
| | | Double amount = data.getAmount(); |
| | | if(0 == amount){ |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, null, 2, 1, uid); |
| | | integer = orderCancelService.saveData(id, 1, reason, remark, null, 0D, 2, 1, uid); |
| | | if(5 == orderPrivateCar.getState()){ |
| | | orderPrivateCar.setState(6); |
| | | orderPrivateCar.setGetoffLon(lon); |
| | |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId()); |
| | | if(null != query2){ |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()) |
| | | .eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); |
| | | if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){ |
| | | Double special = query2.getSpecial(); |
| | | if(null != special){ |
| | |
| | | Integer driverTimeOutTime = 0; |
| | | Integer driverTimeOut = 0; |
| | | CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); |
| | | if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){ |
| | | long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L; |
| | | if(System.currentTimeMillis() > time){ |
| | | driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | driverTimeOut = 1; |
| | | } |
| | | }else{ |
| | | long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L; |
| | | if(System.currentTimeMillis() >= time){ |
| | | driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | driverTimeOut = 1; |
| | | if(null != cancleOrder){ |
| | | JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); |
| | | int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); |
| | | if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){ |
| | | long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L; |
| | | if(System.currentTimeMillis() > time){ |
| | | driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | driverTimeOut = 1; |
| | | } |
| | | }else{ |
| | | long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L; |
| | | if(System.currentTimeMillis() >= time){ |
| | | driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); |
| | | driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; |
| | | driverTimeOut = 1; |
| | | } |
| | | } |
| | | } |
| | | |