| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.global.api.model.ResultStatusType; |
| | | import com.alipay.global.api.response.ams.pay.AlipayPayQueryResponse; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar; |
| | | import com.stylefeng.guns.modular.system.dao.CarModelMapper; |
| | | import com.stylefeng.guns.modular.system.dao.SettlementRecordMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | |
| | | 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; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | if(payType == 1){//手机支付 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + language + payType + driver1.getId(); |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(driver1.getPhone())); |
| | | checkoutRequest.setCustomerEmail(driver1.getEmail()); |
| | | checkoutRequest.setAccountNumber(driver1.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(driver1.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(driver1.getLastName()); |
| | | checkoutRequest.setRequestAmount(payMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Settlement cost"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallback"); |
| | | 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(driver1.getPhone())); |
| | | // checkoutRequest.setCustomerEmail(driver1.getEmail()); |
| | | // checkoutRequest.setAccountNumber(driver1.getPhone()); |
| | | // checkoutRequest.setCustomerFirstName(driver1.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(driver1.getLastName()); |
| | | // checkoutRequest.setRequestAmount(payMoney); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Settlement cost"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallback"); |
| | | // 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(payMoney.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Settlement cost"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallbackAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(driverId + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()!=200){ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | }else{ |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | List<SettlementRecord> settlementRecords1 = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId).eq("paymentStatus", 1)); |
| | | if(settlementRecords1.isEmpty()){ |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil2 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil2.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil2.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | for (SettlementRecord settlementRecord : settlementRecords1) { |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayTime(new Date()); |
| | | settlementRecord.setCode(data.getPaymentId()); |
| | | this.updateById(settlementRecord); |
| | | } |
| | | //添加司机结算的平台收入记录 |
| | | if(settlementRecords.size() > 0){ |
| | | incomeService.saveData(1, 1, 8, driverId, null, Double.valueOf(data.getPaymentAmount().getValue())); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | return resultUtil; |
| | | } |
| | |
| | | BankCard bankCard = bankCardService.selectById(bankCardId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + language + payType + driver1.getId(); |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | checkoutRequest.setCustomerEmail(driver1.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(payMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Settlement cost"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallback"); |
| | | 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | // checkoutRequest.setCustomerEmail(driver1.getEmail()); |
| | | // checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | // checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | // checkoutRequest.setRequestAmount(payMoney); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Settlement cost"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallback"); |
| | | // 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(payMoney.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Settlement cost"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/settlementRecord/paymentSettlementAmountCallbackAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(driverId + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()!=200){ |
| | | resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Échec de paiement", ""); |
| | | }else{ |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | List<SettlementRecord> settlementRecords1 = this.selectList(new EntityWrapper<SettlementRecord>().eq("driverId", driverId).eq("paymentStatus", 1)); |
| | | if(settlementRecords1.isEmpty()){ |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil2 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil2.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil2.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | for (SettlementRecord settlementRecord : settlementRecords1) { |
| | | settlementRecord.setPayType(payType); |
| | | settlementRecord.setPaymentStatus(2); |
| | | settlementRecord.setPayTime(new Date()); |
| | | settlementRecord.setCode(data.getPaymentId()); |
| | | this.updateById(settlementRecord); |
| | | } |
| | | //添加司机结算的平台收入记录 |
| | | if(settlementRecords.size() > 0){ |
| | | incomeService.saveData(1, 1, 8, driverId, null, Double.valueOf(data.getPaymentAmount().getValue())); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | return resultUtil; |
| | | } |
| | |
| | | } |
| | | |
| | | //司机下班,修改谷歌上的车辆信息 |
| | | new Thread(()->{ |
| | | try { |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!createVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(createVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | // new Thread(()->{ |
| | | // try { |
| | | // CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | // String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | // if(ToolUtil.isEmpty(vehicles)){ |
| | | // boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!createVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(createVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }).start(); |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //司机下班,修改谷歌上的车辆信息 |
| | | new Thread(()->{ |
| | | try { |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!createVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(createVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | // new Thread(()->{ |
| | | // try { |
| | | // CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | // String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | // if(ToolUtil.isEmpty(vehicles)){ |
| | | // boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!createVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(createVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | //司机下班,修改谷歌上的车辆信息 |
| | | new Thread(()->{ |
| | | try { |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!createVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(createVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(5000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | }).start(); |
| | | // new Thread(()->{ |
| | | // try { |
| | | // CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | // String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | // if(ToolUtil.isEmpty(vehicles)){ |
| | | // boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!createVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(createVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // }else{ |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("OFFLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(5000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }).start(); |
| | | } |
| | | } |
| | | } |