From e72e1c10a9d93769a3fea1f8c6ec5914699c5083 Mon Sep 17 00:00:00 2001 From: lzq <2495532633@qq.com> Date: Mon, 29 Dec 2025 20:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E7=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispose/dev/DiscoverTruckMsg.java | 41 +++ .../dispose/dev/ObtainTruckDataResultMsg.java | 41 +++ .../java/com/njzscloud/dispose/dev/Wbs.java | 35 ++ .../com/njzscloud/dispose/dev/WbsHandle.java | 78 +++++ .../njzscloud/dispose/event/SysMittEvent.java | 16 + z-doc/pdma/njzscloud-dispose.pdma | 324 ++++++++++-------- 6 files changed, 397 insertions(+), 138 deletions(-) create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/DiscoverTruckMsg.java create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/ObtainTruckDataResultMsg.java create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/Wbs.java create mode 100644 njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/WbsHandle.java diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/DiscoverTruckMsg.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/DiscoverTruckMsg.java new file mode 100644 index 0000000..9957c93 --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/DiscoverTruckMsg.java @@ -0,0 +1,41 @@ +package com.njzscloud.dispose.dev; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Getter +@Setter +@ToString +@Accessors(chain = true) +public class DiscoverTruckMsg { + /** + * 业务处理标识 + */ + private String id; + /** + * 过磅系统编号 + */ + private String sn; + /** + * 是否为前置道闸 + */ + private boolean front; + /** + * 组号 + */ + private String groupSn; + /** + * 道闸号 + */ + private String barrierSn; + /** + * 车牌号 + */ + private String licensePlate; + /** + * 车头照(base64编码) + */ + private String image; +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/ObtainTruckDataResultMsg.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/ObtainTruckDataResultMsg.java new file mode 100644 index 0000000..8ba6f40 --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/ObtainTruckDataResultMsg.java @@ -0,0 +1,41 @@ +package com.njzscloud.dispose.dev; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +@Getter +@Setter +@ToString +@Accessors(chain = true) +public class ObtainTruckDataResultMsg { + /** + * 业务处理标识 + */ + private String id; + /** + * 过磅系统编号 + */ + private String sn; + /** + * 组号 + */ + private String groupSn; + /** + * 道闸号 + */ + private String barrierSn; + /** + * 车斗照(base64编码) + */ + private String image; + /** + * 重量 + */ + private Integer weight; + /** + * 是否成功 + */ + private Boolean success; +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/Wbs.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/Wbs.java new file mode 100644 index 0000000..74a1959 --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/Wbs.java @@ -0,0 +1,35 @@ +package com.njzscloud.dispose.dev; + +import com.njzscloud.common.core.tuple.Tuple2; +import com.njzscloud.common.mqtt.support.MqttListener; +import com.njzscloud.common.mqtt.support.MqttMsg; +import org.springframework.stereotype.Component; + +import static com.njzscloud.dispose.event.SysMittEvent.DISCOVER_TRUCK; +import static com.njzscloud.dispose.event.SysMittEvent.OBTAIN_TRUCK_DATA_REPLY; + +@Component +public class Wbs { + @MqttListener(topic = "discover_truck") + public void discoverTruck(MqttMsg msg) { + DiscoverTruckMsg discoverTruckMsg = msg.getMsg(DiscoverTruckMsg.class); + WbsHandle wbsHandle = new WbsHandle(discoverTruckMsg.getId(), + discoverTruckMsg.getSn(), + discoverTruckMsg.getGroupSn(), + discoverTruckMsg.getBarrierSn()); + DISCOVER_TRUCK.emit(Tuple2.of(discoverTruckMsg, wbsHandle)); + } + + + @MqttListener(topic = "obtain_truck_data/reply") + public void obtainTruckDataReply(MqttMsg msg) { + ObtainTruckDataResultMsg obtainTruckDataResultMsg = msg.getMsg(ObtainTruckDataResultMsg.class); + WbsHandle wbsHandle = new WbsHandle(obtainTruckDataResultMsg.getId(), + obtainTruckDataResultMsg.getSn(), + obtainTruckDataResultMsg.getGroupSn(), + obtainTruckDataResultMsg.getBarrierSn()); + OBTAIN_TRUCK_DATA_REPLY.emit(Tuple2.of(obtainTruckDataResultMsg, wbsHandle)); + } + + +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/WbsHandle.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/WbsHandle.java new file mode 100644 index 0000000..45f106e --- /dev/null +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/dev/WbsHandle.java @@ -0,0 +1,78 @@ +package com.njzscloud.dispose.dev; + +import cn.hutool.core.map.MapUtil; +import com.njzscloud.common.mqtt.util.Mqtt; +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public class WbsHandle { + /** + * 业务处理标识 + */ + public final String id; + /** + * 过磅系统编号 + */ + public final String sn; + /** + * 组号 + */ + public final String groupSn; + /** + * 道闸号 + */ + public final String barrierSn; + + /** + * 播放语音 + * + * @param content 语音内容 + * @param times 播放次数 + */ + public void playVoice(String content, int times) { + if (times < 1) { + times = 1; + } + Mqtt.publish(sn + "/play_voice", MapUtil.builder() + .put("id", id) + .put("groupSn", groupSn) + .put("barrierSn", barrierSn) + .put("content", content) + .put("times", times) + .build()); + } + + /** + * 播放语音(默认播放 1 次) + * + * @param content 语音内容 + */ + public void playVoice(String content) { + playVoice(content, 1); + } + + /** + * 取过磅数据 + * + * @param orderId 订单ID + */ + public void obtainTruckData(Long orderId) { + Mqtt.publish(sn + "/obtain_truck_data", MapUtil.builder() + .put("id", id) + .put("orderId", orderId.toString()) + .put("groupSn", groupSn) + .put("barrierSn", barrierSn) + .build()); + } + + /** + * 打开道闸 + */ + public void open() { + Mqtt.publish(sn + "/open", MapUtil.builder() + .put("id", id) + .put("groupSn", groupSn) + .put("barrierSn", barrierSn) + .build()); + } +} diff --git a/njzscloud-svr/src/main/java/com/njzscloud/dispose/event/SysMittEvent.java b/njzscloud-svr/src/main/java/com/njzscloud/dispose/event/SysMittEvent.java index 264cde2..bc446a9 100644 --- a/njzscloud-svr/src/main/java/com/njzscloud/dispose/event/SysMittEvent.java +++ b/njzscloud-svr/src/main/java/com/njzscloud/dispose/event/SysMittEvent.java @@ -1,6 +1,10 @@ package com.njzscloud.dispose.event; import com.njzscloud.common.core.mitt.MittEvent; +import com.njzscloud.common.core.tuple.Tuple2; +import com.njzscloud.dispose.dev.DiscoverTruckMsg; +import com.njzscloud.dispose.dev.ObtainTruckDataResultMsg; +import com.njzscloud.dispose.dev.WbsHandle; import java.util.List; @@ -17,4 +21,16 @@ public class SysMittEvent { public static MittEvent SALES_ORDER = () -> { }; + /** + * 车辆触发识别 + */ + public static MittEvent> DISCOVER_TRUCK = () -> { + }; + + /** + * 过磅数据回复 + */ + public static MittEvent> OBTAIN_TRUCK_DATA_REPLY = () -> { + }; + } diff --git a/z-doc/pdma/njzscloud-dispose.pdma b/z-doc/pdma/njzscloud-dispose.pdma index 3f5b879..b51bcae 100644 --- a/z-doc/pdma/njzscloud-dispose.pdma +++ b/z-doc/pdma/njzscloud-dispose.pdma @@ -31977,74 +31977,6 @@ "attr20": null, "origin": "PASTE" }, - { - "id": "534B410A-5D21-4C88-A134-B1D419C9E4AD", - "defKey": "order_category", - "defName": "单据类型", - "intro": null, - "baseDataType": "VARCHAR", - "bizDomainType": "", - "dbDataType": "VARCHAR", - "dataLen": 16, - "numScale": null, - "primaryKey": 0, - "notNull": 1, - "autoIncrement": 0, - "defaultValue": null, - "stndDictId": "order_category", - "stndFieldId": null, - "stndDictKey": "order_category", - "stndFieldKey": null, - "stndComplianceLevel": null, - "stndComplianceType": null, - "dictFrom": "Manual", - "dictItems": [ - { - "itemKey": "XiaoShou", - "itemName": "销售", - "parentKey": "", - "intro": "", - "id": "A7B0FB0C-CDB4-4AC3-BC1E-B178A82AA5B4" - }, - { - "itemKey": "CaiGou", - "itemName": "采购", - "parentKey": "", - "intro": "", - "id": "7938B08C-655D-46ED-B0C0-9F2BC79D66DD" - }, - { - "itemKey": "QiTa", - "itemName": "其他", - "parentKey": "", - "intro": "", - "id": "D09CB9BB-41B8-48FE-A704-ED77FCBFF558" - } - ], - "fieldTier": "", - "mark": null, - "attr1": null, - "attr2": null, - "attr3": null, - "attr4": null, - "attr5": null, - "attr6": null, - "attr7": null, - "attr8": null, - "attr9": null, - "attr10": null, - "attr11": null, - "attr12": null, - "attr13": null, - "attr14": null, - "attr15": null, - "attr16": null, - "attr17": null, - "attr18": null, - "attr19": null, - "attr20": null, - "origin": "PASTE" - }, { "id": "865890E6-38D4-4A8B-921B-90377597BB5E", "defKey": "order_id", @@ -33022,74 +32954,6 @@ "attr20": null, "origin": "PASTE" }, - { - "id": "24433B38-6C1A-4B68-AE13-D61983DF02EF", - "defKey": "order_category", - "defName": "单据类型", - "intro": null, - "baseDataType": "VARCHAR", - "bizDomainType": "", - "dbDataType": "VARCHAR", - "dataLen": 16, - "numScale": null, - "primaryKey": 0, - "notNull": 1, - "autoIncrement": 0, - "defaultValue": null, - "stndDictId": "order_category", - "stndFieldId": null, - "stndDictKey": "order_category", - "stndFieldKey": null, - "stndComplianceLevel": null, - "stndComplianceType": null, - "dictFrom": "Manual", - "dictItems": [ - { - "itemKey": "XiaoShou", - "itemName": "销售", - "parentKey": "", - "intro": "", - "id": "A7B0FB0C-CDB4-4AC3-BC1E-B178A82AA5B4" - }, - { - "itemKey": "CaiGou", - "itemName": "采购", - "parentKey": "", - "intro": "", - "id": "7938B08C-655D-46ED-B0C0-9F2BC79D66DD" - }, - { - "itemKey": "QiTa", - "itemName": "其他", - "parentKey": "", - "intro": "", - "id": "D09CB9BB-41B8-48FE-A704-ED77FCBFF558" - } - ], - "fieldTier": "", - "mark": null, - "attr1": null, - "attr2": null, - "attr3": null, - "attr4": null, - "attr5": null, - "attr6": null, - "attr7": null, - "attr8": null, - "attr9": null, - "attr10": null, - "attr11": null, - "attr12": null, - "attr13": null, - "attr14": null, - "attr15": null, - "attr16": null, - "attr17": null, - "attr18": null, - "attr19": null, - "attr20": null, - "origin": "PASTE" - }, { "id": "7CB115F5-8C8A-4C28-B8EF-3C4BF550EA68", "defKey": "order_id", @@ -33883,6 +33747,98 @@ "attr20": null, "origin": "PASTE" }, + { + "id": "33F588A7-7BE3-4D7E-8CB1-A167A63E8B8A", + "defKey": "order_id", + "defName": "预约单 Id", + "intro": "cst_order.id", + "baseDataType": "BIGINT", + "bizDomainType": "", + "dbDataType": "BIGINT", + "dataLen": null, + "numScale": null, + "primaryKey": 0, + "notNull": 0, + "autoIncrement": 0, + "defaultValue": null, + "stndDictId": null, + "stndFieldId": null, + "stndDictKey": null, + "stndFieldKey": null, + "stndComplianceLevel": null, + "stndComplianceType": null, + "dictFrom": "", + "dictItems": null, + "fieldTier": "", + "mark": null, + "attr1": null, + "attr2": null, + "attr3": null, + "attr4": null, + "attr5": null, + "attr6": null, + "attr7": null, + "attr8": null, + "attr9": null, + "attr10": null, + "attr11": null, + "attr12": null, + "attr13": null, + "attr14": null, + "attr15": null, + "attr16": null, + "attr17": null, + "attr18": null, + "attr19": null, + "attr20": null, + "origin": "PASTE" + }, + { + "id": "46C80057-CCDB-4362-95E8-4FAC711812F7", + "defKey": "order_trans_id", + "defName": "预约单车次 Id", + "intro": "cst_order_trans.id", + "baseDataType": "BIGINT", + "bizDomainType": "", + "dbDataType": "BIGINT", + "dataLen": "", + "numScale": "", + "primaryKey": 0, + "notNull": 0, + "autoIncrement": 0, + "defaultValue": "", + "stndDictId": "", + "stndFieldId": "", + "stndDictKey": "", + "stndFieldKey": "", + "stndComplianceLevel": "", + "stndComplianceType": "", + "dictFrom": "", + "dictItems": null, + "fieldTier": "", + "mark": null, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "attr10": "", + "attr11": "", + "attr12": "", + "attr13": "", + "attr14": "", + "attr15": "", + "attr16": "", + "attr17": "", + "attr18": "", + "attr19": "", + "attr20": "", + "origin": "UI" + }, { "id": "05D96AA0-5321-4D27-8A58-4EE0460CB7AC", "defKey": "purchase_order_status", @@ -34843,6 +34799,98 @@ "attr20": null, "origin": "PASTE" }, + { + "id": "F387AF68-B6B6-4EF1-AFBC-2213BC711EAC", + "defKey": "order_id", + "defName": "预约单 Id", + "intro": "cst_order.id", + "baseDataType": "BIGINT", + "bizDomainType": "", + "dbDataType": "BIGINT", + "dataLen": null, + "numScale": null, + "primaryKey": 0, + "notNull": 0, + "autoIncrement": 0, + "defaultValue": "", + "stndDictId": null, + "stndFieldId": null, + "stndDictKey": null, + "stndFieldKey": null, + "stndComplianceLevel": null, + "stndComplianceType": null, + "dictFrom": "", + "dictItems": null, + "fieldTier": "", + "mark": null, + "attr1": null, + "attr2": null, + "attr3": null, + "attr4": null, + "attr5": null, + "attr6": null, + "attr7": null, + "attr8": null, + "attr9": null, + "attr10": null, + "attr11": null, + "attr12": null, + "attr13": null, + "attr14": null, + "attr15": null, + "attr16": null, + "attr17": null, + "attr18": null, + "attr19": null, + "attr20": null, + "origin": "PASTE" + }, + { + "id": "E0E33DE4-34B4-488E-B679-20DA8F88C107", + "defKey": "order_trans_id", + "defName": "预约单车次 Id", + "intro": "cst_order_trans.id", + "baseDataType": "BIGINT", + "bizDomainType": "", + "dbDataType": "BIGINT", + "dataLen": "", + "numScale": "", + "primaryKey": 0, + "notNull": 0, + "autoIncrement": 0, + "defaultValue": "", + "stndDictId": "", + "stndFieldId": "", + "stndDictKey": "", + "stndFieldKey": "", + "stndComplianceLevel": "", + "stndComplianceType": "", + "dictFrom": "", + "dictItems": null, + "fieldTier": "", + "mark": null, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "attr10": "", + "attr11": "", + "attr12": "", + "attr13": "", + "attr14": "", + "attr15": "", + "attr16": "", + "attr17": "", + "attr18": "", + "attr19": "", + "attr20": "", + "origin": "PASTE" + }, { "id": "D53F6AD5-1A84-4601-AD3F-2197BDA68264", "defKey": "sales_order_status", @@ -42411,7 +42459,7 @@ "readonly": false, "allowWs": false }, - "updateTime": 1766568257801, - "signature": "0b7c79e169f084c5db10948c471a274e", + "updateTime": 1766994831821, + "signature": "f9d8b0d74151ca1e43b7cb40107c6119", "branchId": "1111" } \ No newline at end of file