From 29845ad96c2e5a91fd7ac2fc858e56ec74a404d1 Mon Sep 17 00:00:00 2001 From: wuwenxiong <646448316@qq.com> Date: Mon, 30 Aug 2021 16:26:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E9=85=8D=E9=A2=9D=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=97=B6=E6=AE=B5=E9=99=90=E5=88=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=E5=81=9A=E6=AF=8F=E6=97=A5=E9=85=8D=E9=A2=9D-3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../truck/OrderclusterTruckController.java | 1 - .../transport/TransportSyncService.java | 95 ++++++++++++++++++- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordercluster/truck/OrderclusterTruckController.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordercluster/truck/OrderclusterTruckController.java index 75ddcb7..cc3aca0 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordercluster/truck/OrderclusterTruckController.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/order/ordercluster/truck/OrderclusterTruckController.java @@ -5,7 +5,6 @@ import com.cowr.common.view.Result; import com.cowr.model.OrderclusterTruck; import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckPKValidator; import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService; -import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckValidator; import com.jfinal.aop.Before; import com.jfinal.core.Controller; diff --git a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java index 7e69dbe..e086172 100644 --- a/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java +++ b/ssjygl-xsx-local/src/main/java/com/cowr/local/ssjygl/transport/TransportSyncService.java @@ -5,6 +5,7 @@ import com.cowr.common.enums.Enums; import com.cowr.common.enums.OrderStateEnum; import com.cowr.common.enums.OrderTypeEnum; import com.cowr.common.enums.TruckRodState; +import com.cowr.common.utils.DateTimeUtil; import com.cowr.common.view.Result; import com.cowr.local.ssjygl.devicectrl.common.Const; import com.cowr.local.ssjygl.main.CliCacheData; @@ -279,6 +280,30 @@ public class TransportSyncService { } // 判断是否有配额、是否在有效时间段内 + Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId()); + if (ordercluster == null) { + log.error("未找到集团订单信息"); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", "未找到集团订单信息")); + return result; + } + + BigDecimal total_weight = ordercluster.getTotalWeight(); + Date start_time = ordercluster.getStartTime(); + Date cutoff_time = ordercluster.getCutoffTime(); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); + + if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) { + log.error("【%s】无配额", ordercluster.getCustomerName()); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", ordercluster.getCustomerName() + " 无配额")); + return result; + } + + if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) { + log.error("【%s】有效入场时间为【%s】至【%s】", result.getLicense(), query_start_time, query_cutoff_time); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 有效入场时间为" + query_start_time + "至" + query_cutoff_time)); + return result; + } Transport transport = new Transport(); transport.setId(StrKit.getRandomUUID()); @@ -437,8 +462,33 @@ public class TransportSyncService { OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(supermarket_id, result.getLicense()); if (ot == null) { - log.error("车牌【%s】未授权,可能是在黑名单中", result.getLicense()); - //TODO: 发消息到web端? + log.error("【%s】未授权,可能是在黑名单中", result.getLicense()); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 未授权。可能是在黑名单中")); + return result; + } + // 判断是否有配额、是否在有效时间段内 + Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId()); + if (ordercluster == null) { + log.error("未找到集团订单信息"); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", "未找到集团订单信息")); + return result; + } + + BigDecimal total_weight = ordercluster.getTotalWeight(); + Date start_time = ordercluster.getStartTime(); + Date cutoff_time = ordercluster.getCutoffTime(); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); + + if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) { + log.error("【%s】无配额", ordercluster.getCustomerName()); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", ordercluster.getCustomerName() + " 无配额")); + return result; + } + + if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) { + log.error("【%s】有效入场时间为【%s】至【%s】", result.getLicense(), query_start_time, query_cutoff_time); + Config.socketio.pubMessage(new Record().set("truck_license", result.getLicense()).set("msg", result.getLicense() + " 有效入场时间为" + query_start_time + "至" + query_cutoff_time)); return result; } @@ -727,6 +777,26 @@ public class TransportSyncService { return Result.failedstr("车辆【%s】有未完成的入场记录,请先处理完毕!", truck_license); } + // 判断是否有配额、是否在有效时间段内 + Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId()); + if (ordercluster == null) { + return Result.failedstr("车辆【%s】未找到集团订单信息!", truck_license); + } + + BigDecimal total_weight = ordercluster.getTotalWeight(); + Date start_time = ordercluster.getStartTime(); + Date cutoff_time = ordercluster.getCutoffTime(); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); + + if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) { + return Result.failedstr("【%s】无配额!", ordercluster.getCustomerName()); + } + + if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) { + return Result.failedstr("【%s】有效入场时间为【%s】至【%s】", truck_license, query_start_time, query_cutoff_time); + } + Date now = new Date(); Transport transport = new Transport(); @@ -816,6 +886,27 @@ public class TransportSyncService { return Result.failedstr("车辆【%s】有未完成的入场记录,请先处理完毕!", truck_license); } + + // 判断是否有配额、是否在有效时间段内 + Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId()); + if (ordercluster == null) { + return Result.failedstr("车辆【%s】未找到集团订单信息!", truck_license); + } + + BigDecimal total_weight = ordercluster.getTotalWeight(); + Date start_time = ordercluster.getStartTime(); + Date cutoff_time = ordercluster.getCutoffTime(); + String query_start_time = DateTimeUtil.sdf.get().format(start_time); + String query_cutoff_time = DateTimeUtil.sdf.get().format(cutoff_time); + + if (total_weight != null && total_weight.compareTo(BigDecimal.ZERO) == 0) { + return Result.failedstr("【%s】无配额!", ordercluster.getCustomerName()); + } + + if (new Date().getTime() < start_time.getTime() || new Date().getTime() > cutoff_time.getTime()) { + return Result.failedstr("【%s】有效入场时间为【%s】至【%s】", truck_license, query_start_time, query_cutoff_time); + } + Transport transport = new Transport(); transport.setId(StrKit.getRandomUUID()); transport.setSupermarketId(supermarket_id);