| | |
| | | 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.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.sql.Time; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | this.insert(orderLogistics); |
| | | |
| | | //google创建车辆信息 |
| | | String vehicleId = null; |
| | | if(null != orderLogistics.getDriverId()){ |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | Car car = carMapper.selectById(driver.getCarId()); |
| | | if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | carMapper.updateById(car); |
| | | } |
| | | //查询车辆信息,没有则创建信息 |
| | | String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | if(ToolUtil.isEmpty(vehicles)){ |
| | | CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | 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; |
| | | } |
| | | Thread.sleep(5000L); |
| | | } |
| | | } |
| | | boolean updateVehicles = fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(!updateVehicles){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateVehicles = fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | if(updateVehicles){ |
| | | break; |
| | | } |
| | | Thread.sleep(5000L); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // String vehicleId = null; |
| | | // if(null != orderLogistics.getDriverId()){ |
| | | // Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | | // Car car = carMapper.selectById(driver.getCarId()); |
| | | // if(!StringUtils.hasLength(car.getVehicleId())){ |
| | | // car.setVehicleId(UUIDUtil.getRandomCode()); |
| | | // carMapper.updateById(car); |
| | | // } |
| | | // //查询车辆信息,没有则创建信息 |
| | | // String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); |
| | | // if(ToolUtil.isEmpty(vehicles)){ |
| | | // CarModel carModel = carModelMapper.selectById(car.getCarModelId()); |
| | | // 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; |
| | | // } |
| | | // Thread.sleep(5000L); |
| | | // } |
| | | // } |
| | | // boolean updateVehicles = fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(!updateVehicles){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateVehicles = fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); |
| | | // if(updateVehicles){ |
| | | // break; |
| | | // } |
| | | // Thread.sleep(5000L); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | //创建行程数据 |
| | | String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | int count = this.selectCount(new EntityWrapper<OrderLogistics>().eq("tripId", orderLogistics.getTripId())); |
| | | int count1 = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("tripId", orderLogistics.getTripId())); |
| | | if(ToolUtil.isNotEmpty(trip) || (count + count1) > 0){ |
| | | String randomCode = UUIDUtil.getRandomCode(); |
| | | redisUtil.setStrValue("trip" + orderLogistics.getUserId(), randomCode); |
| | | OrderLogistics orderLogistics1 = new OrderLogistics(); |
| | | orderLogistics1.setId(orderLogistics.getId()); |
| | | orderLogistics1.setTripId(randomCode); |
| | | this.updateById(orderLogistics1); |
| | | orderLogistics.setTripId(randomCode); |
| | | } |
| | | JSONObject createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | JSONObject error = createTrip.getJSONObject("error"); |
| | | if(null != error){ |
| | | for (int i = 0; i < 5; i++) { |
| | | createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | error = createTrip.getJSONObject("error"); |
| | | String tripStatus = createTrip.getString("tripStatus"); |
| | | if(null == error && "NEW".equals(tripStatus)){ |
| | | break; |
| | | } |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | | // String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId()); |
| | | // int count = this.selectCount(new EntityWrapper<OrderLogistics>().eq("tripId", orderLogistics.getTripId())); |
| | | // int count1 = orderPrivateCarService.selectCount(new EntityWrapper<OrderPrivateCar>().eq("tripId", orderLogistics.getTripId())); |
| | | // if(ToolUtil.isNotEmpty(trip) || (count + count1) > 0){ |
| | | // String randomCode = UUIDUtil.getRandomCode(); |
| | | // redisUtil.setStrValue("trip" + orderLogistics.getUserId(), randomCode); |
| | | // OrderLogistics orderLogistics1 = new OrderLogistics(); |
| | | // orderLogistics1.setId(orderLogistics.getId()); |
| | | // orderLogistics1.setTripId(randomCode); |
| | | // this.updateById(orderLogistics1); |
| | | // orderLogistics.setTripId(randomCode); |
| | | // } |
| | | // JSONObject createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | // orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | // JSONObject error = createTrip.getJSONObject("error"); |
| | | // if(null != error){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // createTrip = fleetEngineUtil.createTrip(vehicleId, 1, orderLogistics.getTripId(), |
| | | // orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | // error = createTrip.getJSONObject("error"); |
| | | // String tripStatus = createTrip.getString("tripStatus"); |
| | | // if(null == error && "NEW".equals(tripStatus)){ |
| | | // break; |
| | | // } |
| | | // try { |
| | | // Thread.sleep(3000L); |
| | | // } catch (InterruptedException e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | if(orderSource == 2){//扫码下单 |
| | | Driver driver = driverService.selectById(orderLogistics.getDriverId()); |
| | |
| | | // orderMoney += null != orderLogistics.getTipMoney() ? orderLogistics.getTipMoney() : 0; |
| | | } |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(""); |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | //计算折扣 |
| | | UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderLogistics.getCompanyId()); |
| | | if(null != query2){ |
| | |
| | | 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(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | // checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | // checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | // checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | // 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(orderMoney.setScale(2, RoundingMode.HALF_EVEN).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(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 1, |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 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); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 7) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payOrderLogisticsCallback(orderLogistics1.getId(), data.getPaymentId(), language); |
| | | break; |
| | | } |
| | | } |
| | | 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" : "Paiement échoué", ""); |
| | | } |
| | |
| | | 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(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | // checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | // checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | // checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); |
| | | // 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 = TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(orderMoney.setScale(2, RoundingMode.HALF_EVEN).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(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | |
| | | if(resultUtil.getCode()==200){ |
| | | this.updateById(orderLogistics); |
| | | paymentRecordService.saveData(1, null, null, orderId, 4, 2, |
| | | orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), 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); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 7) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payOrderLogisticsCallback(orderLogistics1.getId(), data.getPaymentId(), language); |
| | | break; |
| | | } |
| | | } |
| | | 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" : "Paiement échoué", ""); |
| | | } |
| | |
| | | } |
| | | |
| | | //司机下班,修改谷歌上的车辆信息 |
| | | 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; |
| | | } |
| | | Thread.sleep(5000L); |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | Thread.sleep(5000L); |
| | | } |
| | | } |
| | | }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; |
| | | } |
| | | Thread.sleep(5000L); |
| | | } |
| | | } |
| | | } |
| | | }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; |
| | | // } |
| | | // Thread.sleep(5000L); |
| | | // } |
| | | // } |
| | | // 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; |
| | | // } |
| | | // Thread.sleep(5000L); |
| | | // } |
| | | // } |
| | | // }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; |
| | | // } |
| | | // Thread.sleep(5000L); |
| | | // } |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // }).start(); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | // checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | // checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | // checkoutRequest.setRequestAmount(orderMoney); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | // checkoutRequest.setPendingRedirectUrl(""); |
| | | // checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | // checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | // return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(orderMoney.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Travel completion payment"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxPayOrderLogisticsSpreadAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | ResultUtil<AlipayPayResponse> resultUtil2 = AntomPaymentUtil.pay(payment); |
| | | if(200 == resultUtil2.getCode()){ |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | Thread.sleep(5000); |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 13) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payOrderLogisticsSpreadCallback(orderLogistics1.getId(), data.getPaymentId(), language); |
| | | break; |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | return resultUtil2; |
| | | } |
| | | if(payType == 2){//银行卡支付 |
| | | 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(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(orderMoney); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | checkoutRequest.setPendingRedirectUrl(""); |
| | | checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | // CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | // checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | // checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | // checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | // checkoutRequest.setRequestAmount(orderMoney); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Travel completion payment"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderLogisticsSpread"); |
| | | // checkoutRequest.setPendingRedirectUrl(""); |
| | | // checkoutRequest.setSuccessRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | // checkoutRequest.setFailRedirectUrl("https://igo.i-go.group/payMoney/pages/fail.html"); |
| | | // return TinggPayUtil.checkoutRequest(checkoutRequest); |
| | | |
| | | AntomPaymentUtil.PaymentVO payment = new AntomPaymentUtil.PaymentVO(); |
| | | payment.setPaymentRequestId(merchantTransactionId); |
| | | payment.setAmountValue(orderMoney.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Travel completion payment"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxPayOrderLogisticsSpreadAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | ResultUtil<AlipayPayResponse> resultUtil2 = AntomPaymentUtil.pay(payment); |
| | | if(200 == resultUtil2.getCode()){ |
| | | //创建定时任务查询订单支付状态 |
| | | ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); |
| | | scheduledExecutorService.schedule(() -> { |
| | | try { |
| | | Thread.sleep(5000); |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 13) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payOrderLogisticsSpreadCallback(orderLogistics1.getId(), data.getPaymentId(), language); |
| | | break; |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | return resultUtil2; |
| | | } |
| | | |
| | | if(payType == 3){//余额支付 |
| | |
| | | transactionDetailsService.saveData(orderLogistics.getUserId(), "包裹补差价", orderMoney, 2, 1, 1, 4, id); |
| | | userInfoService.updateById(userInfo); |
| | | |
| | | orderLogistics.setState(12);//已支付差价 |
| | | orderLogistics.setState(orderLogistics.getOldState());//已支付差价 |
| | | this.updateById(orderLogistics); |
| | | |
| | | //添加已收入明细 |
| | |
| | | driverService.updateById(driver); |
| | | } |
| | | |
| | | if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | // if(orderLogistics.getState() == 10 || orderLogistics.getState() == 12){ |
| | | // Car car = carService.selectById(orderLogistics.getCarId()); |
| | | //修改行程信息 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | this.updateById(orderLogistics); |
| | | break; |
| | | } |
| | | Thread.sleep(3000L); |
| | | } |
| | | }else{ |
| | | orderLogistics.setIsover(1); |
| | | this.updateById(orderLogistics); |
| | | } |
| | | } |
| | | // boolean updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | // if(!updateTrip){ |
| | | // for (int i = 0; i < 5; i++) { |
| | | // updateTrip = fleetEngineUtil.updateTrip("CANCELED", (null != car ? car.getVehicleId() : null), null, orderLogistics.getTripId(), null, null, null, null); |
| | | // if(updateTrip){ |
| | | // orderLogistics.setIsover(1); |
| | | // this.updateById(orderLogistics); |
| | | // break; |
| | | // } |
| | | // Thread.sleep(3000L); |
| | | // } |
| | | // }else{ |
| | | // orderLogistics.setIsover(1); |
| | | // this.updateById(orderLogistics); |
| | | // } |
| | | // } |
| | | //添加消息 |
| | | systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO " |
| | | : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1); |
| | |
| | | orderCancelService.updateById(orderCancel); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + language + id; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(userInfo.getPhone())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | 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(userInfo.getPhone())); |
| | | // checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(userInfo.getPhone()); |
| | | // checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(userInfo.getLastName()); |
| | | // checkoutRequest.setRequestAmount(amount); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | // 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(amount.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Cancel a trip"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxCancelOrderTaxiAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 1, amount, 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); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 12) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payCancelOrderPrivateCar(orderLogistics1.getId(), data.getPaymentId(), finalLanguage2); |
| | | break; |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | } |
| | |
| | | BankCard bankCard = bankCardService.selectById(bankCardId); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String merchantTransactionId = sdf.format(new Date()) + "4" + id; |
| | | CheckoutRequest checkoutRequest = new CheckoutRequest(); |
| | | checkoutRequest.setMsisdn(Long.valueOf(bankCard.getCode())); |
| | | checkoutRequest.setCustomerEmail(userInfo.getEmail()); |
| | | checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | checkoutRequest.setRequestAmount(amount); |
| | | checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | 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(userInfo.getEmail()); |
| | | // checkoutRequest.setAccountNumber(bankCard.getCode()); |
| | | // checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); |
| | | // checkoutRequest.setCustomerLastName(bankCard.getLastName()); |
| | | // checkoutRequest.setRequestAmount(amount); |
| | | // checkoutRequest.setMerchantTransactionId(merchantTransactionId); |
| | | // checkoutRequest.setRequestDescription("Cancel a trip"); |
| | | // checkoutRequest.setCallbackUrl(callbackPath + "/base/wxCancelOrderTaxi"); |
| | | // 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(amount.toString()); |
| | | payment.setCurrency(""); |
| | | payment.setOrderDescription("Cancel a trip"); |
| | | payment.setPaymentNotifyUrl(callbackPath + "/base/wxCancelOrderTaxiAntom"); |
| | | payment.setPaymentRedirectUrl("https://igo.i-go.group/payMoney/pages/success.html"); |
| | | payment.setReferenceOrderId(orderLogistics.getId() + orderLogistics.getType() + ""); |
| | | resultUtil = AntomPaymentUtil.pay(payment); |
| | | if(resultUtil.getCode()==200){ |
| | | paymentRecordService.saveData(1, null, null, id, 4, 2, amount, 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); |
| | | OrderLogistics orderLogistics1 = this.selectById(orderLogistics.getId()); |
| | | if (orderLogistics1.getState() != 12) { |
| | | break; |
| | | } |
| | | ResultUtil<AlipayPayQueryResponse> resultUtil1 = AntomPaymentUtil.inquiryPayment(merchantTransactionId); |
| | | if(200 == resultUtil1.getCode()){ |
| | | AlipayPayQueryResponse data = resultUtil1.getData(); |
| | | ResultStatusType resultStatus = data.getResult().getResultStatus(); |
| | | if(resultStatus.equals(ResultStatusType.S)){ |
| | | payCancelOrderPrivateCar(orderLogistics1.getId(), data.getPaymentId(), finalLanguage2); |
| | | break; |
| | | } |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | scheduledExecutorService.shutdown(); |
| | | } |
| | | |
| | | }, 5, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | } |