Jelajahi Sumber

655新增打印机地磅映射

donglang 6 hari lalu
induk
melakukan
5288d2f359

+ 3 - 0
iot-platform-manager/src/main/java/com/platform/external/response/TradeOrderTransportInfoResp.java

@@ -34,6 +34,9 @@ public class TradeOrderTransportInfoResp implements Serializable {
     @Schema(description = "任务信息列表")
     private List<TaskInfo> tasks = new ArrayList<>();
 
+    @Schema(description = "地磅编号")
+    private Long weighbridgeId;
+
     /**
      * 单车任务信息。
      */

+ 12 - 5
iot-platform-manager/src/main/java/com/platform/service/XpCloudPrintService.java

@@ -33,11 +33,7 @@ import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.time.Instant;
 import java.time.format.DateTimeFormatter;
-import java.util.AbstractMap;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.UUID;
+import java.util.*;
 
 /**
  * 芯烨云打印服务
@@ -74,6 +70,12 @@ public class XpCloudPrintService {
     @Resource
     private io.github.dv996coding.service.PrintService printService;
 
+    // 映射地磅编号和打印机
+    Map<Long, String> map = Map.of(
+            10100111L, "142F4FYCJ39234B", //山下
+            10100112L, "142F4FYCJ39234B",  //山上靠近地磅房
+            10100113L, "1424RPQP6GC5E4A"); // 山上靠近加工厂
+
     /**
      * 调用SDK执行图片打印
      *
@@ -176,6 +178,11 @@ public class XpCloudPrintService {
             // 9. 将内容对象转换为芯烨云支持的XML格式字符串
             String xmlContent = buildReceiptXml(content);
 
+            //获取打印机编号
+            Long weighbridgeId = transportInfo.getWeighbridgeId();
+            log.info("[地磅打印机映射]车辆过磅的地磅编号:{}",weighbridgeId);
+            reqVo.setSn(map.get(weighbridgeId));
+
             // 10. 构建最终发送给芯烨云开放平台的JSON请求体(包含鉴权信息、SN、内容等)
             JSONObject printBody = buildReceiptPrintJsonBody(reqVo, xmlContent);