Ver código fonte

订单代码

chenxiaofei 1 mês atrás
pai
commit
e5366d0f46

+ 8 - 2
iot-platform-manager/src/main/java/com/platform/service/XpCloudPrintService.java

@@ -19,6 +19,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
@@ -54,6 +55,11 @@ public class XpCloudPrintService {
 
     private final KwsPrintReceiptRecordRepository kwsPrintReceiptRecordRepository;
 
+    @Value("weigh.weigher")
+    private String weigher;
+    @Value("weigh.copies")
+    private Integer weighbridgeCopies;
+
     /**
      * 调用芯烨云 {@code open.xpyun.net} 开放接口(小票 {@code /xprinter/print})的 HTTP 客户端。
      */
@@ -295,7 +301,7 @@ public class XpCloudPrintService {
                 new AbstractMap.SimpleEntry<>("taskNo", content.getTaskNo()),                 // 任务单号
                 new AbstractMap.SimpleEntry<>("acceptTime", content.getAcceptTime()),         // 接单时间
                 new AbstractMap.SimpleEntry<>("finishTime", content.getFinishTime()),         // 完成时间
-                new AbstractMap.SimpleEntry<>("weigher", content.getWeigher()),               // 计重人
+                new AbstractMap.SimpleEntry<>("weigher", weigher),               // 计重人
                 new AbstractMap.SimpleEntry<>("driverName", content.getDriverName()),         // 司机姓名
                 new AbstractMap.SimpleEntry<>("driverMobile", content.getDriverMobile()),     // 司机手机号
                 new AbstractMap.SimpleEntry<>("driverIdCard", content.getDriverIdCard()),     // 司机身份证
@@ -605,7 +611,7 @@ public class XpCloudPrintService {
         body.put("content", xmlContent);     // 打印内容(XML 格式)
 
         // 5. 处理打印份数:若未指定则默认为 1 份
-        int copies = reqVo.getCopies() != null ? reqVo.getCopies() : 1;
+        Integer copies = Objects.nonNull(weighbridgeCopies) ? weighbridgeCopies : 1;
         body.put("copies", copies);
 
         // 6. 可选参数:打印模式(0:云端排队, 1:即时打印)