| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.global.api.model.ResultStatusType; |
| | | import com.alipay.global.api.response.ams.pay.AlipayPayQueryResponse; |
| | | import com.alipay.global.api.response.ams.pay.AlipayPayResponse; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.common.constant.state.Order; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * 订单相关逻辑类 |
| | |
| | | if(payType == 1) {//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(driver.getPhone())); |
| | | checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | checkoutRequest.setAccountNumber(driver.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(driver.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(driver.getLastName()); |
| | | checkoutRequest.setRequestAmount(money); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(driver.getPhone())); |
| | | // checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | // checkoutRequest.setAccountNumber(driver.getPhone()); |
| | | // checkoutRequest.setCustomerFirstName(driver.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(driver.getLastName()); |
| | | // checkoutRequest.setRequestAmount(money); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | // checkoutRequest.setPendingRedirectUrl(""); |
| | | // checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | // checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | // ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(money.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Travel completion payment"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxPayOrderTaxiAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderId + orderType + ""); |
| | | ResultUtil resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, uid, 2, orderId, orderType, 1, money, null, 1);//添加预支付数据 |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | if(7 != orderPrivateCar.getState()){ |
| | | return; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | orderPrivateCarService.payOrderPrivateCarCallback(orderId, data.getPaymentId(), language); |
| | | return; |
| | | } |
| | | } |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(7 != orderLogistics.getState()){ |
| | | return; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil2 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil2.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil2.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | orderLogisticsService.payOrderLogisticsCallback(orderId, data.getPaymentId(), language); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | }, 5, TimeUnit.SECONDS); |
| | | |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | } |
| | |
| | | BankCard bankCard = bankCardService.selectById(bankCardId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + orderId; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(money); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | // checkoutRequest.setCustomerEmail(driver.getEmail()); |
| | | // checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | // checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | // checkoutRequest.setRequestAmount(money); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); |
| | | // checkoutRequest.setPendingRedirectUrl(""); |
| | | // checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | // checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | // ResultUtil resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(money.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Travel completion payment"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxPayOrderTaxiAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderId + orderType + ""); |
| | | ResultUtil resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, uid, 2, orderId, orderType, 2, money, null, 1);//添加预支付数据 |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | switch (orderType){ |
| | | case 1: |
| | | OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId); |
| | | if(7 != orderPrivateCar.getState()){ |
| | | return; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | orderPrivateCarService.payOrderPrivateCarCallback(orderId, data.getPaymentId(), language); |
| | | return; |
| | | } |
| | | } |
| | | case 4: |
| | | OrderLogistics orderLogistics = orderLogisticsService.selectById(orderId); |
| | | if(7 != orderLogistics.getState()){ |
| | | return; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil2 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil2.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil2.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | orderLogisticsService.payOrderLogisticsCallback(orderId, data.getPaymentId(), language); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | }, 5, TimeUnit.SECONDS); |
| | | }else{ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | } |
| | |
| | | @Override |
| | | public void getDriverNowPosition() { |
| | | for (OrderPrivateCar orderPrivateCar : orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().eq("state", 5))) { |
| | | String trackId = orderPrivateCar.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderPrivateCar.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | // String trackId = orderPrivateCar.getTrackId(); |
| | | // if(ToolUtil.isNotEmpty(trackId)){ |
| | | // String trip = fleetEngineUtil.getTrip(trackId); |
| | | // JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | // JSONObject location = lastLocation.getJSONObject("location"); |
| | | // Double latitude = location.getDouble("latitude"); |
| | | // Double longitude = location.getDouble("longitude"); |
| | | // OrderPosition orderPosition = new OrderPosition(); |
| | | // orderPosition.setOrderId(orderPrivateCar.getId()); |
| | | // orderPosition.setOrderType(1); |
| | | // orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | // orderPosition.setLat(latitude.toString()); |
| | | // orderPosition.setLon(longitude.toString()); |
| | | // orderPosition.setInsertTime(new Date()); |
| | | // try { |
| | | // orderPositionService.saveData(orderPosition); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().eq("state", 5)); |
| | | for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | String trackId = orderLogistics.getTrackId(); |
| | | if(ToolUtil.isNotEmpty(trackId)){ |
| | | String trip = fleetEngineUtil.getTrip(trackId); |
| | | JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | JSONObject location = lastLocation.getJSONObject("location"); |
| | | Double latitude = location.getDouble("latitude"); |
| | | Double longitude = location.getDouble("longitude"); |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderLogistics.getId()); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderLogistics.getDriverId()); |
| | | orderPosition.setLat(latitude.toString()); |
| | | orderPosition.setLon(longitude.toString()); |
| | | orderPosition.setInsertTime(new Date()); |
| | | try { |
| | | orderPositionService.saveData(orderPosition); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | // String trackId = orderLogistics.getTrackId(); |
| | | // if(ToolUtil.isNotEmpty(trackId)){ |
| | | // String trip = fleetEngineUtil.getTrip(trackId); |
| | | // JSONObject lastLocation = JSON.parseObject(trip).getJSONObject("lastLocation"); |
| | | // JSONObject location = lastLocation.getJSONObject("location"); |
| | | // Double latitude = location.getDouble("latitude"); |
| | | // Double longitude = location.getDouble("longitude"); |
| | | // OrderPosition orderPosition = new OrderPosition(); |
| | | // orderPosition.setOrderId(orderLogistics.getId()); |
| | | // orderPosition.setOrderType(1); |
| | | // orderPosition.setDriverId(orderLogistics.getDriverId()); |
| | | // orderPosition.setLat(latitude.toString()); |
| | | // orderPosition.setLon(longitude.toString()); |
| | | // orderPosition.setInsertTime(new Date()); |
| | | // try { |
| | | // orderPositionService.saveData(orderPosition); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void overGoogleOrder() { |
| | | List<OrderPrivateCar> privateCars = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().isNotNull("tripId") |
| | | .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | for (OrderPrivateCar privateCar : privateCars) { |
| | | Integer state = privateCar.getState(); |
| | | String tripId = privateCar.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if(null != trip && "" == trip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | | Car car = carService.selectById(privateCar.getCarId()); |
| | | if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | } |
| | | } |
| | | if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | if(updateTrip){ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | privateCar.setIsover(1); |
| | | orderPrivateCarService.updateById(privateCar); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().isNotNull("tripId") |
| | | .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | Integer state = orderLogistics.getState(); |
| | | String tripId = orderLogistics.getTripId(); |
| | | String trip = fleetEngineUtil.getTrip(tripId); |
| | | if(null != trip && "" == trip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | continue; |
| | | } |
| | | if(ToolUtil.isNotEmpty(trip)){ |
| | | JSONObject jsonObject = JSON.parseObject(trip); |
| | | String tripStatus = jsonObject.getString("tripStatus"); |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | } |
| | | if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | | orderLogistics.setIsover(1); |
| | | orderLogisticsService.updateById(orderLogistics); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // List<OrderPrivateCar> privateCars = orderPrivateCarService.selectList(new EntityWrapper<OrderPrivateCar>().isNotNull("tripId") |
| | | // .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | // for (OrderPrivateCar privateCar : privateCars) { |
| | | // Integer state = privateCar.getState(); |
| | | // String tripId = privateCar.getTripId(); |
| | | // String trip = fleetEngineUtil.getTrip(tripId); |
| | | // if(null != trip && "" == trip){ |
| | | // privateCar.setIsover(1); |
| | | // orderPrivateCarService.updateById(privateCar); |
| | | // continue; |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(trip)){ |
| | | // JSONObject jsonObject = JSON.parseObject(trip); |
| | | // String tripStatus = jsonObject.getString("tripStatus"); |
| | | // Car car = carService.selectById(privateCar.getCarId()); |
| | | // if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | // //修改行程信息 |
| | | // boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | // if(!updateTrip){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | // if(updateTrip){ |
| | | // privateCar.setIsover(1); |
| | | // orderPrivateCarService.updateById(privateCar); |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(3000L); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // privateCar.setIsover(1); |
| | | // orderPrivateCarService.updateById(privateCar); |
| | | // } |
| | | // } |
| | | // if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | // //修改行程信息 |
| | | // boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | // if(!updateTrip){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, privateCar.getId(), 1); |
| | | // if(updateTrip){ |
| | | // privateCar.setIsover(1); |
| | | // orderPrivateCarService.updateById(privateCar); |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(3000L); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // privateCar.setIsover(1); |
| | | // orderPrivateCarService.updateById(privateCar); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // List<OrderLogistics> orderLogisticsList = orderLogisticsService.selectList(new EntityWrapper<OrderLogistics>().isNotNull("tripId") |
| | | // .eq("isover", 0).in("state", Arrays.asList(6, 7, 8, 9, 10, 12)).eq("isDelete", 1)); |
| | | // for (OrderLogistics orderLogistics : orderLogisticsList) { |
| | | // Integer state = orderLogistics.getState(); |
| | | // String tripId = orderLogistics.getTripId(); |
| | | // String trip = fleetEngineUtil.getTrip(tripId); |
| | | // if(null != trip && "" == trip){ |
| | | // orderLogistics.setIsover(1); |
| | | // orderLogisticsService.updateById(orderLogistics); |
| | | // continue; |
| | | // } |
| | | // if(ToolUtil.isNotEmpty(trip)){ |
| | | // JSONObject jsonObject = JSON.parseObject(trip); |
| | | // String tripStatus = jsonObject.getString("tripStatus"); |
| | | // Car car = carService.selectById(orderLogistics.getCarId()); |
| | | // if(Arrays.asList(10, 12).contains(state) && !"CANCELED".equals(tripStatus)){ |
| | | // //修改行程信息 |
| | | // boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | // if(!updateTrip){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | // if(updateTrip){ |
| | | // orderLogistics.setIsover(1); |
| | | // orderLogisticsService.updateById(orderLogistics); |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(3000L); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // orderLogistics.setIsover(1); |
| | | // orderLogisticsService.updateById(orderLogistics); |
| | | // } |
| | | // } |
| | | // if(Arrays.asList(6, 7, 8, 9).contains(state) && !"COMPLETE".equals(tripStatus)){ |
| | | // //修改行程信息 |
| | | // boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | // if(!updateTrip){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateTrip = fleetEngineUtil.updateTrip("COMPLETE", (null != car ? car.getVehicleId() : null), null, tripId, null, null, null, null, orderLogistics.getId(), 4); |
| | | // if(updateTrip){ |
| | | // orderLogistics.setIsover(1); |
| | | // orderLogisticsService.updateById(orderLogistics); |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(3000L); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // orderLogistics.setIsover(1); |
| | | // orderLogisticsService.updateById(orderLogistics); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | |