| | |
| | | orderLogistics.setTravelTime(null == travelTime ? new Date() : travelTime); |
| | | orderLogistics.setOrderSource(orderSource); |
| | | orderLogistics.setIsDelete(1); |
| | | orderLogistics.setTripId(tripId); |
| | | orderLogistics.setIsover(0); |
| | | this.insert(orderLogistics); |
| | | |
| | | //添加消息 |
| | |
| | | public ResultUtil placeOrderPackage(String remark, String placementLon, String placementLat, String startLon, String startLat, String startAddress, |
| | | String recipient, String recipientPhone, String endLon, String endLat, String endAddress, |
| | | Integer serverCarModelId, Integer driverId, Integer orderSource, Integer uid, Integer language) throws Exception { |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | 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."); |
| | | } |
| | | Company company = companyCityService.query1(uid, placementLon, placementLat); |
| | | if(null != userInfo && null != company){ |
| | | userInfo.setCompanyId(company.getId()); |
| | | userInfoService.updateById(userInfo); |
| | | } |
| | | /** |
| | | * 1.下了即时单就不能下预约单和即时单 |
| | | * 2.下了预约单和再下一张即时单不能再下预约单 |
| | |
| | | return ResultUtil.error(language == 1 ? "请选择服务车型" : language == 2 ? "Please select vehicle-type" : "Veuillez sélectionner le type de véhicule"); |
| | | } |
| | | |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | OrderLogistics orderLogistics = new OrderLogistics(); |
| | | orderLogistics.setType(4); |
| | | orderLogistics.setUserId(uid); |
| | |
| | | orderLogistics.setIsReassign(1); |
| | | orderLogistics.setIsDelete(1); |
| | | orderLogistics.setTripId(tripId); |
| | | orderLogistics.setIsover(0); |
| | | DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId); |
| | | Long distance1 = distancematrix1.getDistance(); |
| | | orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | this.insert(orderLogistics); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | userInfo.setLanguage(language); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | //google创建车辆信息 |
| | | String vehicleId = null; |
| | |
| | | dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setCarId(dr.getCarId()); |
| | | CarService query1 = carServiceMapper.query(1, dr.getCarId()); |
| | | CarService query1 = carServiceMapper.query(4, dr.getCarId()); |
| | | orderLogistics.setServerCarModelId(query1.getServerCarModelId()); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | |
| | | String value = redisUtil.getValue("DRIVER" + driver1.getId()); |
| | | if(ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderLogistics.setEstimateArriveTime(new Date(timeOut)); |
| | | orderLogistics.setEstimateArriveMileage(distancematrix.getDistance()); |
| | | } |
| | | |
| | | dr.setState(3); |
| | | driverService.updateById(dr); |
| | | this.updateById(orderLogistics); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | System.err.println("直推司机后推送司机订单状态"); |
| | | pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl); |
| | | } |
| | | }).start(); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | public ResultUtil addCancle(Integer id, String reason, String remark, Integer uid, Double lon, Double lat, String address, Integer language) throws Exception { |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | if(ToolUtil.isNotEmpty(remark)){ |
| | | remark = remark.toLowerCase(); |
| | | List<SensitiveWords> sensitiveWords = sensitiveWordsMapper.selectList(null); |
| | | List<String> list = Arrays.asList(remark.split(" ")); |
| | | for(SensitiveWords s : sensitiveWords){ |
| | | List<String> str = new ArrayList<>(); |
| | | String lowerCase = s.getContent().toLowerCase(); |
| | | for (String s1 : list) { |
| | | if(lowerCase.equals(s1.toLowerCase())){ |
| | | str.add("***"); |
| | | }else{ |
| | | str.add(s1); |
| | | } |
| | | } |
| | | list = str; |
| | | for(SensitiveWords s : sensitiveWords) { |
| | | remark = remark.replaceAll(s.getContent().toLowerCase(), "***"); |
| | | } |
| | | remark = list.stream().collect(Collectors.joining(" ")); |
| | | } |
| | | } |
| | | |
| | |
| | | if(orderLogistics.getState() > 5 && orderLogistics.getState() != 11 && orderLogistics.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", orderLogistics.getId()).eq("orderType", 4)); |
| | | if(null == orderLogistics.getDriverId()){//没有接单的情况 |
| | | integer = orderCancelService.saveData(id, 4, 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, 4, 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); |
| | | orderLogistics.setState(10); |
| | | this.updateById(orderLogistics); |
| | | }else { |
| | | BaseWarpper data = queryCancleAmount(id, language).getData(); |
| | | Double amount = data.getAmount(); |
| | | if(0 == amount){ |
| | | integer = orderCancelService.saveData(id, 4, reason, remark, null, null, 2, 1, uid); |
| | | integer = orderCancelService.saveData(id, 4, reason, remark, null, 0D, 2, 1, uid); |
| | | if(5 == orderLogistics.getState()){ |
| | | orderLogistics.setState(6); |
| | | orderLogistics.setGetoffLon(lon); |
| | |
| | | BaseWarpper baseWarpper = new BaseWarpper(); |
| | | double amount = 0; |
| | | CancleOrder query = cancleOrderService.query(orderLogistics.getCompanyId()); |
| | | if(null == query || null == orderLogistics.getDriverId() || orderLogistics.getState() == 11){ |
| | | if(null == query){ |
| | | return ResultUtil.error("请先添加取消规则"); |
| | | } |
| | | if(null == orderLogistics.getDriverId() || orderLogistics.getState() == 11){ |
| | | baseWarpper.setAmount(amount); |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | |
| | | ChinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | } |
| | | |
| | | if(5 == orderLogistics.getOldState()){ |
| | | orderLogistics.setState(6); |
| | | }else{ |
| | | orderLogistics.setState(10); |
| | | } |
| | | orderLogistics.setState(10); |
| | | orderLogistics.setTelX(""); |
| | | orderLogistics.setBindId(""); |
| | | this.updateById(orderLogistics); |
| | |
| | | if(orderLogistics.getBindId() != null){ |
| | | ChinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | } |
| | | if(5 == orderLogistics.getOldState()){ |
| | | orderLogistics.setState(6); |
| | | }else{ |
| | | orderLogistics.setState(10); |
| | | } |
| | | orderLogistics.setState(10); |
| | | orderLogistics.setBindId(""); |
| | | orderLogistics.setTelX(""); |
| | | this.updateById(orderLogistics); |