donglang пре 1 недеља
родитељ
комит
a62439303a

+ 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;
+
     /**
      * 单车任务信息。
      */

+ 11 - 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, "14GJ6N8TPA3634B", //山上
+            10100112L, "14U101CMC698648",  //山下靠近地磅房
+            10100113L, "14B8Y5XDZRD934B"); // 山下靠近加工厂
+
     /**
      * 调用SDK执行图片打印
      *
@@ -176,6 +178,10 @@ public class XpCloudPrintService {
             // 9. 将内容对象转换为芯烨云支持的XML格式字符串
             String xmlContent = buildReceiptXml(content);
 
+            //获取打印机编号
+            Long weighbridgeId = transportInfo.getWeighbridgeId();
+            reqVo.setSn(map.get(weighbridgeId));
+
             // 10. 构建最终发送给芯烨云开放平台的JSON请求体(包含鉴权信息、SN、内容等)
             JSONObject printBody = buildReceiptPrintJsonBody(reqVo, xmlContent);