From 287cbb376dea7b3972e5f38a38fad043aa4d3b68 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期四, 01 八月 2024 16:05:33 +0800 Subject: [PATCH] 修改2.0 bug --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java | 58 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 35 insertions(+), 23 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java index cc9ef4f..3cc0ac7 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java @@ -574,8 +574,9 @@ } String audioUrl = ""; + String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; try { - audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); + audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); } catch (Exception e) { throw new RuntimeException(e); } @@ -585,7 +586,7 @@ public void run() { Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); + process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); } catch (IOException e) { throw new RuntimeException(e); } @@ -744,6 +745,10 @@ orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); this.insert(orderLogistics); + UserInfo userInfo = userInfoService.selectById(uid); + userInfo.setLanguage(language); + userInfoService.updateById(userInfo); + new Thread(() -> { try { String vehicleId = null; @@ -789,8 +794,9 @@ } String audioUrl = ""; + String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; try { - audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); + audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); } catch (Exception e) { throw new RuntimeException(e); } @@ -800,7 +806,7 @@ public void run() { Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); + process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); } catch (IOException e) { throw new RuntimeException(e); } @@ -901,8 +907,9 @@ } String audioUrl = ""; + String fileName = "pushOrder" + orderLogistics.getDriverId() + UUIDUtil.getRandomCode(5) + ".mp3"; try { - audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, "pushOrder" + orderLogistics.getDriverId() + ".mp3"); + audioUrl = TextToSpeechUtil.create(language1 == 1 ? "cmn-CN" : language1 == 2 ? "en-US" : "fr-FR", text, fileName); } catch (Exception e) { throw new RuntimeException(e); } @@ -912,7 +919,7 @@ public void run() { Process process = null; try { - process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/pushOrder" + orderLogistics.getDriverId() + ".mp3"); + process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName); } catch (IOException e) { throw new RuntimeException(e); } @@ -1647,7 +1654,7 @@ public void run() { pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); - pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4); + pushUtil.pushOfflinePayment(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, orderLogistics.getPayMoney()); } }).start(); @@ -2584,12 +2591,15 @@ OrderLogistics orderLogistics = this.selectById(orderId); long timeOutCancel = 0L; + long driverTimeOut = 0L; if(null != orderLogistics.getEstimateArriveTime()){ CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId())); JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); int driverTimeout = jsonObject.getIntValue("driverTimeout") * 60000; timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout; + driverTimeOut = orderLogistics.getEstimateArriveTime().getTime(); } + map.put("driverTimeOut", driverTimeOut); map.put("timeOutCancel", timeOutCancel); } return maps; @@ -2648,7 +2658,7 @@ if(null == orderLogistics){ 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(orderLogistics.getState() > 5 && orderLogistics.getState() != 11){ + if(orderLogistics.getState() > 5 && orderLogistics.getState() != 12){ return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale."); } @@ -2699,13 +2709,13 @@ String audioUrl = ""; switch (language1){ case 1: - audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-CN.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-CN.mp3"; break; case 2: - audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-EN.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-EN.mp3"; break; case 3: - audioUrl = "http://182.160.16.251:81/files/audio/UserCancelledOrder-FR.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/UserCancelledOrder-FR.mp3"; break; } pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), 4, orderLogistics.getState(), 0, ""); @@ -2812,6 +2822,11 @@ if(state == 11){ map.put("state", map.get("oldState")); } + if(state == 12){ + OrderCancel query = orderCancelService.query(orderId, 4, null, null, 1); + map.put("cancelPayMoney", null == query ? 0 : query.getMoney()); + map.put("cancelMoney", null == query ? 0 : query.getMoney()); + } if(Integer.valueOf(String.valueOf(map.get("state"))) != 8 && Integer.valueOf(String.valueOf(map.get("state"))) != 9){ map.put("redPacketMoney", null); map.put("couponMoney", null); @@ -2822,6 +2837,7 @@ Integer orderNum=this.selectCount(new EntityWrapper<OrderLogistics>().eq("userId",orderLogistics.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())")); if(query2.getDistance()*1000>orderLogistics.getMileage() && query2.getOrderNum()>orderNum){ Double special = query2.getLogistics(); + map.put("discount", special); orderLogistics.setDiscount(special); Double orderMoney = orderLogistics.getOrderMoney(); double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); @@ -2832,17 +2848,11 @@ } } -// Map<String, String> geocode = gdMapGeocodingUtil.geocode(map.get("startLon").toString(), map.get("startLat").toString()); -// map.put("startCity", geocode.get("city")); -// geocode = gdMapGeocodingUtil.geocode(map.get("endLon").toString(), map.get("endLat").toString()); -// map.put("endCity", geocode.get("city")); -// GoogleMapUtil.getReverseGeocode() - String driverId = redisUtil.getValue("DEVICE_" + map.get("driverId")); map.put("device", ToolUtil.isNotEmpty(driverId) ? 2 : 1); map.put("orderType", orderLogistics.getType()); - if(state == 8){ + if(state == 8 || state == 9){ map.put("receipt", "http://182.160.16.251:81/files/html/parcel_receipt_" + orderId + ".html"); }else{ map.put("receipt", ""); @@ -2852,12 +2862,14 @@ companyId = Integer.valueOf(String.valueOf(map.get("companyId"))); } map.put("timeOutCancel", 0); + map.put("driverTimeOut", 0); if(null != orderLogistics.getEstimateArriveTime()){ CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", companyId)); JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent()); int driverTimeout = jsonObject.getIntValue("driverTimeout"); long timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout; map.put("timeOutCancel", timeOutCancel); + map.put("driverTimeOut", orderLogistics.getEstimateArriveTime().getTime()); } return map; } @@ -2980,7 +2992,7 @@ if(null == orderLogistics){ 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(orderLogistics.getState() != 13){ + if(orderLogistics.getState() != 12){ return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale.", ""); } OrderCancel orderCancel = null; @@ -2990,7 +3002,7 @@ orderCancel = orderCancelService.selectById(cancleId); } - Double amount = queryCancleAmount(id, language).getData().getAmount(); + Double amount = orderCancel.getMoney(); if(0 < amount){ if(payType == 1){//手机支付 orderCancel.setPayType(1); @@ -3212,13 +3224,13 @@ String audioUrl = ""; switch (language1){ case 1: - audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-CN.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-CN.mp3"; break; case 2: - audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-EN.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-EN.mp3"; break; case 3: - audioUrl = "http://182.160.16.251:81/files/audio/ChangeAddress-FR.mp3"; + audioUrl = "http://182.160.16.251:81/files/audio/system/ChangeAddress-FR.mp3"; break; } pushUtil.pushModifyAddress(2, orderLogistics.getDriverId(), orderId, 4, 1, audioUrl); -- Gitblit v1.7.1