From 26079aa3c34f47e952a9538a93d6f8a3bab9a0fc Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 23 八月 2024 09:12:44 +0800 Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/IgoTravel into 2.0 --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java | 416 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 249 insertions(+), 167 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java index a72144f..d7db9e8 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper; -import com.stylefeng.guns.modular.crossCity.model.OrderCrossCity; import com.stylefeng.guns.modular.crossCity.server.IOrderCrossCityService; import com.stylefeng.guns.modular.crossCity.server.impl.OrderCrossCityServiceImpl; import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; @@ -28,7 +27,6 @@ import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils; import com.stylefeng.guns.modular.system.warpper.BaseWarpper; import com.stylefeng.guns.modular.system.warpper.EndPushWarpper; -import com.stylefeng.guns.modular.system.warpper.OrderInfoWarpper; import com.stylefeng.guns.modular.system.warpper.OrderServerWarpper; import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; import com.stylefeng.guns.modular.taxi.model.OrderTaxi; @@ -39,7 +37,6 @@ import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; -import org.jsoup.nodes.FormElement; import org.jsoup.select.Elements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -88,92 +85,92 @@ @Resource private RegionMapper regionMapper; - @Autowired + @Resource private DateUtil dateUtil; - @Autowired + @Resource private IUserInfoService userInfoService; - @Autowired + @Resource private IDriverService driverService; - @Autowired + @Resource private IDriverServiceService driverServiceService; - @Autowired + @Resource private PushUtil pushUtil; - @Autowired + @Resource private ICompanyCityService companyCityService; - @Autowired + @Resource private IPushOrderService pushOrderService; - @Autowired + @Resource private ISystemNoticeService systemNoticeService; - @Autowired + @Resource private ICancleOrderService cancleOrderService; - @Autowired + @Resource private IOrderCancelService orderCancelService; - @Autowired + @Resource private RestTemplate internalRestTemplate; - @Autowired + @Resource private IPaymentRecordService paymentRecordService; - @Autowired + @Resource private ITransactionDetailsService transactionDetailsService; - @Autowired + @Resource private ChinaMobileUtil chinaMobileUtil; - @Autowired + @Resource private IIncomeService incomeService; - @Autowired + @Resource private IUserCouponRecordService userCouponRecordService; - @Autowired + @Resource private IUserRedPacketRecordService userRedPacketRecordService; - @Autowired + @Resource private ICompanyService companyService; - @Autowired + @Resource private IUserActivityRedenvelopeService userActivityRedenvelopeService; - @Autowired + @Resource private RedisUtil redisUtil; - @Autowired + @Resource private IOrderPositionService orderPositionService; - @Autowired + @Resource private IOrderCrossCityService orderCrossCityService; - @Autowired + @Resource private IAssignOrderService assignOrderService; @Resource private CarMapper carMapper; - @Autowired + @Resource private IOrderEvaluateService orderEvaluateService; - @Autowired + @Resource private IOrderLogisticsService orderLogisticsService; - @Autowired + @Resource private IBankCardService bankCardService; @Value("${filePath}") private String filePath; - @Autowired + @Resource private IOrderTaxiService orderTaxiService; public static List<Integer> orderIds = new ArrayList<>(); @@ -184,32 +181,35 @@ @Value("${spring.mail.template-path}") private String templatePath; - @Autowired + @Resource private ISettlementDetailService settlementDetailService; - @Autowired + @Resource private ISettlementRecordService settlementRecordService; - @Autowired + @Resource private ISettlementAllocationService settlementAllocationService; - @Autowired + @Resource private TEmailService emailService; - @Autowired + @Resource private IPhoneService phoneService; - @Autowired + @Resource private IRedEnvelopePaymentSettingsService redEnvelopePaymentSettingsService; - @Autowired + @Resource private FleetEngineUtil fleetEngineUtil; @Resource private CarModelMapper carModelMapper; - @Autowired + @Resource private ICarService carService; + + @Resource + private IDriverWorkService driverWorkService; @@ -371,7 +371,6 @@ new Thread(() -> { try { - String vehicleId = null; if(null != orderPrivateCar.getDriverId()){ Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); Car car = carMapper.selectById(driver.getCarId()); @@ -379,6 +378,7 @@ car.setVehicleId(UUIDUtil.getRandomCode()); carMapper.updateById(car); } + String vehicleId = car.getVehicleId(); //查询车辆信息,没有则创建信息 String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId()); if(ToolUtil.isEmpty(vehicles)){ @@ -386,10 +386,12 @@ fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId()); } + + //创建行程数据 + fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), + orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); } - //创建行程数据 - fleetEngineUtil.createTrip(vehicleId, 1, orderPrivateCar.getTripId(), - orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(), orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString()); + }catch (Exception e){ e.printStackTrace(); } @@ -497,65 +499,70 @@ }else{ dr = drivers.get(0); } - - orderPrivateCar.setDriverId(dr.getId()); - orderPrivateCar.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : ( - dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); - orderPrivateCar.setState(2); - orderPrivateCar.setCarId(dr.getCarId()); - CarService query1 = carServiceMapper.query(1, dr.getCarId()); - orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); - orderPrivateCar.setSnatchOrderTime(new Date()); - - dr.setState(3); - driverService.updateById(dr); - this.updateById(orderPrivateCar); - Integer language1 = dr.getLanguage(); - String text = ""; - switch (language1){ - case 1: - text = "收到新的打车订单,从" + orderPrivateCar.getStartAddress() + "出发,全程约" + orderPrivateCar.getEstimatedMileage() + "公里"; - break; - case 2: - text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre"; - break; - case 3: - text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage"; - break; + Driver driver = driverService.selectById(dr.getId()); + DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", dr.getId()) + .eq("state", 1).like("type", "1")); + if(driver.getState() == 2 && null != driverWork){ + orderPrivateCar.setDriverId(dr.getId()); + orderPrivateCar.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : ( + dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1)); + orderPrivateCar.setState(2); + orderPrivateCar.setCarId(dr.getCarId()); + CarService query1 = carServiceMapper.query(1, dr.getCarId()); + orderPrivateCar.setServerCarModelId(query1.getServerCarModelId()); + orderPrivateCar.setSnatchOrderTime(new Date()); + + dr.setState(3); + driverService.updateById(dr); + this.updateById(orderPrivateCar); + + Integer language1 = dr.getLanguage(); + String text = ""; + switch (language1){ + case 1: + text = "收到新的打车订单,从" + orderPrivateCar.getStartAddress() + "出发,全程约" + orderPrivateCar.getEstimatedMileage() + "公里"; + break; + case 2: + text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre"; + break; + case 3: + text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage"; + break; - } - String audioUrl = ""; - String fileName = "pushOrder" + orderPrivateCar.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; - try { - audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); - } catch (Exception e) { - throw new RuntimeException(e); - } - //定时任务删除语音文件 - new Timer().schedule(new TimerTask() { - @Override - public void run() { - Process process = null; - try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); - } catch (IOException e) { - throw new RuntimeException(e); - } - if (process != null) { - process.destroy(); - } } - }, 30000); + String audioUrl = ""; + String fileName = "pushOrder" + orderPrivateCar.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; + try { + audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); + } catch (Exception e) { + throw new RuntimeException(e); + } + //定时任务删除语音文件 + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Process process = null; + try { + process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (process != null) { + process.destroy(); + } + } + }, 30000); - String finalAudioUrl = audioUrl; - new Thread(new Runnable() { - @Override - public void run() { - pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0, ""); - pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0, finalAudioUrl); - } - }).start(); + String finalAudioUrl = audioUrl; + new Thread(new Runnable() { + @Override + public void run() { + pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0, ""); + pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0, finalAudioUrl); + } + }).start(); + } } } } @@ -564,22 +571,6 @@ //推单操作 if(orderPrivateCar.getState() == 1){ this.pushOrder(orderPrivateCar); - }else{ -// //接单后定时任务判断司机是否去接乘客,没有则推送提醒 -// CancleOrder cancleOrder = cancleOrderService.query(orderPrivateCar.getCompanyId()); -// if(null != cancleOrder){ -// JSONObject object = JSON.parseObject(cancleOrder.getContent()); -// long time = object.getInteger("driverTimeout") * 60000L; -// new Timer().schedule(new TimerTask() { -// @Override -// public void run() { -// OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderPrivateCar.getId()); -// if(orderPrivateCar1.getState() == 2){ -// pushUtil.pushDriverTimeOut(1, orderPrivateCar1.getUserId(), orderPrivateCar1.getId(), 1); -// } -// } -// }, time); -// } } @@ -749,7 +740,7 @@ if(null == orderPrivateCar){ return ResultUtil.error(language == 1 ? "取消订单失败,订单信息有误" : language == 2 ? "Failed to cancel order, order-information error." : "Échec de l’annulation de la commande, erreur d’information de commande."); } - if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 12){ + if(orderPrivateCar.getState() > 5 && orderPrivateCar.getState() != 11 && orderPrivateCar.getState() != 12){ return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); } @@ -848,7 +839,7 @@ } //修改行程信息 - if(orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12){ + if((orderPrivateCar.getState() == 10 || orderPrivateCar.getState() == 12) && null != orderPrivateCar.getDriverId()){ fleetEngineUtil.updateTrip("CANCELED", null, null, orderPrivateCar.getTripId(), null, null, null, null); } @@ -1048,6 +1039,13 @@ continue; } + Driver driver1 = driverService.selectById(driver.getId()); + DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driver1.getId()) + .eq("state", 1).like("type", "1")); + if(driver1.getState() != 2 || null == driverWork){ + continue; + } + String text = ""; Integer language = driver.getLanguage(); switch (language){ @@ -1192,7 +1190,7 @@ return ResultUtil.error(language == 1 ? "订单不在待支付状态,不允许支付" : language == 2 ? "The order is no longer with Pending Payment, making payments is not allowed." : "La commande n’est plus en attente de paiement, il n’est pas permis d’effectuer des paiements.", ""); } Integer uid = orderPrivateCar.getUserId(); - Double orderMoney = orderPrivateCar.getOrderMoney(); + BigDecimal orderMoney = new BigDecimal(orderPrivateCar.getOrderMoney()); UserInfo userInfo = userInfoService.selectById(uid); ResultUtil resultUtil = ResultUtil.success(""); orderPrivateCar.setCouponMoney(0D);//初始化历史数据 @@ -1206,9 +1204,9 @@ Double special = query2.getSpecial(); if(null != special){ orderPrivateCar.setDiscount(special); - double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); + BigDecimal v = orderMoney.multiply(new BigDecimal(special / 10)).setScale(2, RoundingMode.HALF_EVEN); if(orderMoney.compareTo(v) > 0){ - orderPrivateCar.setDiscountMoney(orderMoney - v); + orderPrivateCar.setDiscountMoney(orderMoney.subtract(v).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); orderPrivateCar.setActivityId(query2.getId()); orderMoney = v; } @@ -1235,14 +1233,13 @@ if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 1){ return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); } - if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){ + if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(new BigDecimal(userCouponRecord.getFullMoney())) < 0){ return ResultUtil.error(language == 1 ? "优惠券不能用于此订单" : language == 2 ? "Coupon cannot be used for this order." : "Le coupon ne peut pas être utilisé pour cette commande.", ""); } - orderMoney = orderMoney - userCouponRecord.getMoney(); + orderMoney = orderMoney.subtract(new BigDecimal(userCouponRecord.getMoney())).setScale(2, RoundingMode.HALF_EVEN); orderPrivateCar.setCouponMoney(userCouponRecord.getMoney()); orderPrivateCar.setCouponId(couponId); } - orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); //计算红包 if(null != redDeduction && 1 == redDeduction && null == orderPrivateCar.getRedPacketId()){ @@ -1253,10 +1250,10 @@ .eq("state", 1).eq("companyId", orderPrivateCar.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false)); BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio(); - BigDecimal multiply1 = new BigDecimal(orderMoney).multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); - if(total.compareTo(multiply1.doubleValue()) >= 0){ + BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN); + if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){ orderPrivateCar.setRedPacketMoney(multiply1.doubleValue()); - orderMoney = orderMoney - multiply1.doubleValue(); + orderMoney = orderMoney.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN); //获取红包id JSONArray jsonArray = new JSONArray(); @@ -1264,6 +1261,9 @@ JSONObject jsonObject = new JSONObject(); jsonObject.put("id", userRedPacketRecord.getId()); BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); + if(multiply1.compareTo(BigDecimal.ZERO) == 0){ + break; + } if(multiply1.compareTo(remainingAmount) >= 0){ userRedPacketRecord.setRemainingAmount(0D); userRedPacketRecord.setEndTime(new Date()); @@ -1272,25 +1272,29 @@ jsonObject.put("money", remainingAmount); jsonArray.add(jsonObject); userRedPacketRecordService.updateById(userRedPacketRecord); - }else{ + }else if(remainingAmount.compareTo(multiply1) > 0){ userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply1).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); jsonObject.put("money", multiply1); jsonArray.add(jsonObject); userRedPacketRecordService.updateById(userRedPacketRecord); - break; + multiply1 = BigDecimal.ZERO; } } orderPrivateCar.setRedPacketId(jsonArray.toJSONString()); - }else{ + } + if(total > 0 && total.compareTo(multiply1.doubleValue()) < 0){ orderPrivateCar.setRedPacketMoney(total); - orderMoney = orderMoney - total; + orderMoney = orderMoney.subtract(new BigDecimal(total)).setScale(2, RoundingMode.HALF_EVEN); //获取红包id JSONArray jsonArray = new JSONArray(); BigDecimal multiply = new BigDecimal(total); for (UserRedPacketRecord userRedPacketRecord : userRedPacketRecords) { JSONObject jsonObject = new JSONObject(); jsonObject.put("id", userRedPacketRecord.getId()); - BigDecimal remainingAmount = new BigDecimal(userRedPacketRecord.getRemainingAmount()); + BigDecimal remainingAmount = BigDecimal.valueOf(userRedPacketRecord.getRemainingAmount()); + if(multiply.compareTo(BigDecimal.ZERO) == 0){ + break; + } if(multiply.compareTo(remainingAmount) >= 0){ userRedPacketRecord.setRemainingAmount(0D); userRedPacketRecord.setEndTime(new Date()); @@ -1299,12 +1303,12 @@ jsonObject.put("money", remainingAmount); jsonArray.add(jsonObject); userRedPacketRecordService.updateById(userRedPacketRecord); - }else{ + }else if(remainingAmount.compareTo(multiply) > 0){ userRedPacketRecord.setRemainingAmount(remainingAmount.subtract(multiply).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); jsonObject.put("money", multiply); jsonArray.add(jsonObject); userRedPacketRecordService.updateById(userRedPacketRecord); - break; + multiply = BigDecimal.ZERO; } } orderPrivateCar.setRedPacketId(jsonArray.toJSONString()); @@ -1322,7 +1326,7 @@ checkoutRequest.setAccountNumber(userInfo.getPhone()); checkoutRequest.setCustomerFirstName(userInfo.getFirstName()); checkoutRequest.setCustomerLastName(userInfo.getLastName()); - checkoutRequest.setRequestAmount(orderMoney); + checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); checkoutRequest.setMerchantTransactionId(merchantTransactionId); checkoutRequest.setRequestDescription("Travel completion payment"); checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); @@ -1332,7 +1336,8 @@ resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); if(resultUtil.getCode()==200){ - paymentRecordService.saveData(1, null, null, orderId, 1, 1, orderMoney, null, 1);//添加预支付数据 + paymentRecordService.saveData(1, null, null, orderId, 1, 1, + orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据 }else{ resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", ""); } @@ -1348,7 +1353,7 @@ checkoutRequest.setAccountNumber(bankCard.getCode()); checkoutRequest.setCustomerFirstName(bankCard.getFirstName()); checkoutRequest.setCustomerLastName(bankCard.getLastName()); - checkoutRequest.setRequestAmount(orderMoney); + checkoutRequest.setRequestAmount(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); checkoutRequest.setMerchantTransactionId(merchantTransactionId); checkoutRequest.setRequestDescription("Travel completion payment"); checkoutRequest.setCallbackUrl(callbackPath + "/base/wxPayOrderTaxi"); @@ -1358,28 +1363,30 @@ resultUtil = TinggPayUtil.checkoutRequest(checkoutRequest); if(resultUtil.getCode()==200){ - paymentRecordService.saveData(1, null, null, orderId, 1, 2, orderMoney, null, 1);//添加预支付数据 + paymentRecordService.saveData(1, null, null, orderId, 1, 2, + orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), null, 1);//添加预支付数据 }else{ resultUtil = ResultUtil.error(language == 1 ? "支付失败" : language == 2 ? "Payment failure" : "Paiement échoué", ""); } } if(payType == 3){//余额支付 - if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){ + if(userInfo.getBalance() == null || new BigDecimal(userInfo.getBalance()).compareTo(orderMoney) < 0){ return ResultUtil.error(language == 1 ? "账户余额不足" : language == 2 ? "Insufficient balance" : "Solde insuffisant", ""); } - userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId()); userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 //添加交易明细 - transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 1, orderId); + transactionDetailsService.saveData(uid, "完成订单", orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), + 2, 1, 1, 1, orderId); userInfoService.updateById(userInfo); orderPrivateCar.setState(8); orderPrivateCar.setPayType(3); - orderPrivateCar.setPayMoney(orderMoney); + orderPrivateCar.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); //处理优惠券和红包 if(null != userCouponRecord){ @@ -1428,7 +1435,7 @@ if(null != orderPrivateCar.getDriverId()){ aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); } - Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); + Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); @@ -1499,6 +1506,12 @@ pay_type_chinese.text("余额支付"); Element pay_money_chinese = document.getElementById("pay_money_chinese"); pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_chinese = document.getElementById("dispute_chinese"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_chinese.remove(); + } Element pdf_chinese = document.getElementById("pdf_chinese"); pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_chinese = document.getElementById("lost_item_chinese"); @@ -1600,6 +1613,12 @@ pay_type_english.text("I-GO Wallet"); Element pay_money_english = document.getElementById("pay_money_english"); pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_english = document.getElementById("dispute_english"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_english.remove(); + } Element pdf_english = document.getElementById("pdf_english"); pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_english = document.getElementById("lost_item_english"); @@ -1701,6 +1720,12 @@ pay_type_french.text("Portefeuille I-GO"); Element pay_money_french = document.getElementById("pay_money_french"); pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_french = document.getElementById("dispute_french"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_french.remove(); + } Element pdf_french = document.getElementById("pdf_french"); pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_french = document.getElementById("lost_item_french"); @@ -1813,13 +1838,14 @@ userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分 //添加交易明细 - transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 1, orderId); + transactionDetailsService.saveData(uid, "完成订单", orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue(), + 2, 1, 1, 1, orderId); userInfoService.updateById(userInfo); orderPrivateCar.setState(8); orderPrivateCar.setPayType(4); orderPrivateCar.setDriverPay(2); - orderPrivateCar.setPayMoney(orderMoney); + orderPrivateCar.setPayMoney(orderMoney.setScale(2, RoundingMode.HALF_EVEN).doubleValue()); Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); @@ -1916,7 +1942,7 @@ settlementRecord.setInsertTime(new Date()); settlementRecordService.insert(settlementRecord); }else{ - settlementRecord.setPayMoney(total.doubleValue()); + settlementRecord.setPayMoney(settlementRecord.getPayMoney() + total.doubleValue()); settlementRecordService.updateById(settlementRecord); } for (SettlementDetail detail : settlementDetailList) { @@ -1944,7 +1970,7 @@ if(null != orderPrivateCar.getDriverId()){ aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); } - Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); + Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); if(1 == language){ document.getElementById("english").remove(); @@ -2016,6 +2042,12 @@ pay_type_chinese.text("现金"); Element pay_money_chinese = document.getElementById("pay_money_chinese"); pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_chinese = document.getElementById("dispute_chinese"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_chinese.remove(); + } Element pdf_chinese = document.getElementById("pdf_chinese"); pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_chinese = document.getElementById("lost_item_chinese"); @@ -2117,6 +2149,12 @@ pay_type_english.text("Cash"); Element pay_money_english = document.getElementById("pay_money_english"); pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_english = document.getElementById("dispute_english"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_english.remove(); + } Element pdf_english = document.getElementById("pdf_english"); pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_english = document.getElementById("lost_item_english"); @@ -2218,6 +2256,12 @@ pay_type_french.text("En espèces"); Element pay_money_french = document.getElementById("pay_money_french"); pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_french = document.getElementById("dispute_french"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_french.remove(); + } Element pdf_french = document.getElementById("pdf_french"); pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + orderId + "&orderType=1"); Element lost_item_french = document.getElementById("lost_item_french"); @@ -2431,7 +2475,7 @@ Element user_french = document.getElementById("user_french"); user_french.text("Bonjour " + userInfo.getNickName() + ","); Element time_french = document.getElementById("time_french"); - time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme i-go pour plus de détails."); + time_french.text("Cette promotion est valable du " + DateUtil.conversionFormat(language, sdf.format(id.getStartTime())) + " au " + DateUtil.conversionFormat(language, sdf.format(id.getEndTime())) + ". Veuillez consulter la plateforme I-GO pour plus de détails."); } EmailUtil.send(userInfo.getEmail(), language == 1 ? "红包活动" : language == 2 ? "Lucky-promo activities" : "Activités bonus", document.html()); @@ -2621,7 +2665,7 @@ if(null != orderPrivateCar.getDriverId()){ aDouble = orderEvaluateService.queryDriverScore(orderPrivateCar.getDriverId()); } - Double aDouble1 = Double.valueOf(orderPrivateCar.getMileage() / 1000); + Double aDouble1 = new BigDecimal(orderPrivateCar.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); if(1 == language){ document.getElementById("english").remove(); document.getElementById("french").remove(); @@ -2692,6 +2736,12 @@ pay_type_chinese.text(orderPrivateCar.getPayType() == 1 ? "手机支付" : (orderPrivateCar.getPayType() == 2?"银行卡支付":(orderPrivateCar.getPayType() == 3?"余额支付":"现金支付"))); Element pay_money_chinese = document.getElementById("pay_money_chinese"); pay_money_chinese.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_chinese = document.getElementById("dispute_chinese"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_chinese.text("(注意: 争议订单,经过三方协商,平台最终定价为 GHS" + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_chinese.remove(); + } Element pdf_chinese = document.getElementById("pdf_chinese"); pdf_chinese.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1"); Element lost_item_chinese = document.getElementById("lost_item_chinese"); @@ -2793,6 +2843,12 @@ pay_type_english.text(orderPrivateCar.getPayType() == 1 ? "Mobile money" :(orderPrivateCar.getPayType() == 2?"Bank card":(orderPrivateCar.getPayType() == 3?"I-GO Wallet":"Cash"))); Element pay_money_english = document.getElementById("pay_money_english"); pay_money_english.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_english = document.getElementById("dispute_english"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_english.text("(Note: Disputed order, after tripartite negotiation, the final pricing of the platform is GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_english.remove(); + } Element pdf_english = document.getElementById("pdf_english"); pdf_english.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1"); Element lost_item_english = document.getElementById("lost_item_english"); @@ -2894,6 +2950,12 @@ pay_type_french.text(orderPrivateCar.getPayType() == 1 ? "Argent mobile" : (orderPrivateCar.getPayType() == 2?"Carte bancaire":(orderPrivateCar.getPayType() == 3?"Portefeuille I-GO":"En espèces"))); Element pay_money_french = document.getElementById("pay_money_french"); pay_money_french.text("GHS " + new BigDecimal(orderPrivateCar.getPayMoney()).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); + Element dispute_french = document.getElementById("dispute_french"); + if(null != orderPrivateCar.getIsDispute() && orderPrivateCar.getIsDispute() == 1){ + dispute_french.text("(Remarque: Il s’agit d’une commande contestée, et après des négociations entre trois parties, la plateforme l’a finalement tarifée à GHS " + new BigDecimal(orderPrivateCar.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN) + ")"); + }else{ + dispute_french.remove(); + } Element pdf_french = document.getElementById("pdf_french"); pdf_french.attr("href", "http://182.160.16.251:80/user/base/order/uploadReceiptPdf?orderId=" + id + "&orderType=1"); Element lost_item_french = document.getElementById("lost_item_french"); @@ -3032,18 +3094,29 @@ } OrderPrivateCar orderPrivateCar = orderPrivateCarMapper.selectById(orderId); - long timeOutCancel = 0L; - if(null != orderPrivateCar.getEstimateArriveTime()){ - CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderPrivateCar.getCompanyId())); - JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); - int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; - if(orderPrivateCar.getOrderType() == 1){ - timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout; - }else{ - timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout; + Integer driverTimeOutTime = 0; + Integer driverTimeOut = 0; + CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderPrivateCar.getCompanyId())); + JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); + int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); + if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){ + long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L; + if(System.currentTimeMillis() > time){ + driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); + driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; + driverTimeOut = 1; + } + }else{ + long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L; + if(System.currentTimeMillis() >= time){ + driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); + driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; + driverTimeOut = 1; } } - map.put("timeOutCancel", timeOutCancel); + + map.put("driverTimeOutTime", driverTimeOutTime); + map.put("driverTimeOut", driverTimeOut); } return maps; } @@ -3054,7 +3127,7 @@ endTime = dateUtil.getStartOrEndDate(endTime, "end"); List<Map<String, Object>> list = orderPrivateCarMapper.queryInvoiceOrder(type, startTime, endTime, startMoney, endMoney, uid); for (Map<String, Object> map : list) { - map.put("orderName", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course"); + map.put("orderName", language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); if(null != map.get("time")){ String time = map.get("time").toString(); map.put("time", DateUtil.conversionFormat(language, time)); @@ -3119,21 +3192,30 @@ companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); } - long timeOutCancel = 0L; - long driverTimeOut = 0L; + Integer driverTimeOutTime = 0; + Integer driverTimeOut = 0; CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); - int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; + int driverTimeout1 = jsonObject.getIntValue("driverTimeout"); if(orderPrivateCar.getOrderType() == 1 && null != orderPrivateCar.getEstimateArriveTime()){ - timeOutCancel = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout; - driverTimeOut = orderPrivateCar.getEstimateArriveTime().getTime(); + long time = orderPrivateCar.getEstimateArriveTime().getTime() + driverTimeout1 * 60000L; + if(System.currentTimeMillis() > time){ + driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); + driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; + driverTimeOut = 1; + } }else{ - timeOutCancel = orderPrivateCar.getTravelTime().getTime() + driverTimeout; - driverTimeOut = orderPrivateCar.getTravelTime().getTime(); + long time = orderPrivateCar.getTravelTime().getTime() + driverTimeout1 * 60000L; + if(System.currentTimeMillis() >= time){ + driverTimeOutTime = Double.valueOf((System.currentTimeMillis() - time) / 60000).intValue(); + driverTimeOutTime = driverTimeOutTime == 0 ? 1 : driverTimeOutTime; + driverTimeOut = 1; + } } - map.put("timeOutCancel", timeOutCancel); + map.put("driverTimeOutTime", driverTimeOutTime); map.put("driverTimeOut", driverTimeOut); + map.put("isDispute", orderPrivateCar.getIsDispute()); return map; } @@ -3173,7 +3255,7 @@ //读取文件(字符流) BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); //循环取出数据 - String str = null; + String str; StringBuffer sb = new StringBuffer(); while ((str = in.readLine()) != null) { sb.append(str); @@ -3262,7 +3344,7 @@ public List<Map<String, Object>> queryRedEnvelope(Integer language, Integer uid) throws Exception { List<Map<String, Object>> list = orderPrivateCarMapper.queryRedEnvelope(uid); for (Map<String, Object> map : list) { - map.put("name", language == 1 ? "打车订单" : language == 2 ? "Ride" : "Course"); + map.put("name", language == 1 ? "打车" : language == 2 ? "Ride" : "Course"); if(null != map.get("time")){ String time = map.get("time").toString(); map.put("time", DateUtil.conversionFormat(language, time)); -- Gitblit v1.7.1