From a627c05912ab55061c7ee9b670512e3ee3800d44 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 26 五月 2025 15:08:34 +0800
Subject: [PATCH] 添加检验生成失败的补偿机制
---
src/main/java/com/gs/xky/service/XkyService.java | 8 +++++---
src/test/java/com/gs/xky/XkyApplicationTests.java | 28 ++++++++++++++++++++++------
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/gs/xky/service/XkyService.java b/src/main/java/com/gs/xky/service/XkyService.java
index b907d43..3666f39 100644
--- a/src/main/java/com/gs/xky/service/XkyService.java
+++ b/src/main/java/com/gs/xky/service/XkyService.java
@@ -71,13 +71,15 @@
if ("6".equals(deliveryNo.getStatus()) || "0".equals(deliveryNo.getLogisticsStatus())) {
log.info("銆怗etSaveDetail銆戠Щ闄ら�佽揣鍗�: {}", deliveryNo.getDeliveryNo());
remove(deliveryNo);
- } else if ("1".equals(deliveryNo.getStatus()) && "2".equals(deliveryNo.getLogisticsStatus())) {
- log.info("銆怗etSaveDetail銆戝鐞嗛�佽揣鍗�: {}", deliveryNo.getDeliveryNo());
+ } else if ("1".equals(deliveryNo.getStatus()) && ("2".equals(deliveryNo.getLogisticsStatus()) || "1".equals(deliveryNo.getLogisticsStatus()))) {
XkyDetail detail = getDetail(deliveryNo.getDeliveryNo());
deliveryNoticeService.saveDeliveryNotice(detail);
List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo());
barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo());
- deliveryNoticeService.callPdaReceiptBtn("閫佽揣鍗曠鏀禰BTNOK[PL017[" + deliveryNo.getDeliveryNo(), "");
+ //宸查�佽揪鐨勬墠鑷姩杞崲涓篗ES鍒拌揣鍗�
+ if ("2".equals(deliveryNo.getLogisticsStatus())) {
+ deliveryNoticeService.callPdaReceiptBtn("閫佽揣鍗曠鏀禰BTNOK[PL017[" + deliveryNo.getDeliveryNo(), "");
+ }
}
} catch (IOException e) {
log.error("銆怗etSaveDetail 澶勭悊寮傚父銆戦�佽揣鍗�: {}, 寮傚父: {}", deliveryNo.getDeliveryNo(), e.getMessage(), e);
diff --git a/src/test/java/com/gs/xky/XkyApplicationTests.java b/src/test/java/com/gs/xky/XkyApplicationTests.java
index 35d4455..f743bd8 100644
--- a/src/test/java/com/gs/xky/XkyApplicationTests.java
+++ b/src/test/java/com/gs/xky/XkyApplicationTests.java
@@ -47,6 +47,11 @@
}
@Test
+ public void getDeviceRealTimeData() throws IOException {
+ // xkyService.GetSaveDetail();
+ }
+
+ @Test
void cs() throws IOException {
XkyCommonParam param = XkyCommonParam.GetInit();
@@ -54,7 +59,7 @@
BodyParam bodyParam = new BodyParam();
bodyParam.setErpCode(DataAcquisitionConfiguration.TEST_ERP_CODE);
- bodyParam.setDeliveryNo("222504279H65");
+ bodyParam.setDeliveryNo("22250526H9UR");
bodyParam.setStatus(new int[]{1, 6});
param.setBody(bodyParam);
@@ -62,13 +67,24 @@
ApiResponse<XkyDetail> detail = apiService.sendListRequest(param, XkyDetail.class, "https://openapi.xiekeyun.com/delivery/getDetail.json");
XkyDetail deliveryNo = detail.getData();
+ if ("6".equals(deliveryNo.getStatus()) || "0".equals(deliveryNo.getLogisticsStatus())) {
+// remove(deliveryNo);
+ } else if ("1".equals(deliveryNo.getStatus()) && ("2".equals(deliveryNo.getLogisticsStatus()) || "1".equals(deliveryNo.getLogisticsStatus()))) {
+ XkyDetail detail1 = deliveryNo;
+ deliveryNoticeService.saveDeliveryNotice(detail1);
+ List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo());
+ barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo());
+ if ("2".equals(deliveryNo.getLogisticsStatus())) {
+ deliveryNoticeService.callPdaReceiptBtn("閫佽揣鍗曠鏀禰BTNOK[PL017[" + deliveryNo.getDeliveryNo(), "");
+ }
+ }
// List<LineList> collect = deliveryNo.getLineList().stream().filter(s -> "1".equals(s.getStatus())).collect(Collectors.toList());
// System.out.println(JSON.toJSONString(collect));
- deliveryNoticeService.saveDeliveryNotice(deliveryNo);
- List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo());
- barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo());
-
- deliveryNoticeService.callPdaReceiptBtn("閫佽揣鍗曠鏀禰BTNOK[PL017[" + deliveryNo.getDeliveryNo(), "");
+// deliveryNoticeService.saveDeliveryNotice(deliveryNo);
+// List<BarcodeDeliveryNo> barcodeDeliveryNos = GetBarcodeInformation(deliveryNo.getDeliveryNo());
+// barcodeInformationService.SaveBarcodeInformation(barcodeDeliveryNos, deliveryNo.getDeliveryNo());
+//
+// deliveryNoticeService.callPdaReceiptBtn("閫佽揣鍗曠鏀禰BTNOK[PL017[" + deliveryNo.getDeliveryNo(), "");
}
private List<BarcodeDeliveryNo> GetBarcodeInformation(String deliveryNo) throws IOException {
--
Gitblit v1.9.3