From 41a5ac443936a0c3d891d04955a8b77566220f05 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 12 二月 2025 21:39:28 +0800 Subject: [PATCH] 协客云的三个接口修改 --- src/main/java/com/gs/xky/service/XkyService.java | 23 +++++++++++ src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java | 2 src/main/java/com/gs/xky/dto/LineList.java | 2 src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java | 7 +++ src/main/java/com/gs/xky/entity/DeliveryNotice.java | 4 + src/test/java/com/gs/xky/XkyApplicationTests.java | 27 +++++++++++++ 6 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java b/src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java index 36b2649..2909b0c 100644 --- a/src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java +++ b/src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java @@ -28,7 +28,7 @@ private String smallPackageSn; //褰撳墠灏忓寘鏉$爜鐨勬祦姘寸爜 private String bigPackageSn; //褰撳墠澶у寘鏉$爜鐨勬祦姘寸爜 private String outPackageSn; //褰撳墠澶栫鏉$爜鐨勬祦姘寸爜 - private String dynamicData; //鏉$爜瑙勫垯涓搴旂殑鍔ㄦ�佸瓧娈电殑鍊�, key瀵瑰簲鐨勫彇鍊间负dynamicDescList.field鐨勫�硷紱濡傛灉浼佷笟璋冩暣浜嗘潯鐮佽鍒欙紝璇锋牴鎹甦ynamicDescList杩斿洖鐨勭粨鏋滐紝浜嗚В鍚勫姩鎬佹暟鎹殑鍚箟 + //private String dynamicData; //鏉$爜瑙勫垯涓搴旂殑鍔ㄦ�佸瓧娈电殑鍊�, key瀵瑰簲鐨勫彇鍊间负dynamicDescList.field鐨勫�硷紱濡傛灉浼佷笟璋冩暣浜嗘潯鐮佽鍒欙紝璇锋牴鎹甦ynamicDescList杩斿洖鐨勭粨鏋滐紝浜嗚В鍚勫姩鎬佹暟鎹殑鍚箟 private String packLevel; //鍖呰灞傜骇 } diff --git a/src/main/java/com/gs/xky/dto/LineList.java b/src/main/java/com/gs/xky/dto/LineList.java index d5735b4..661d2df 100644 --- a/src/main/java/com/gs/xky/dto/LineList.java +++ b/src/main/java/com/gs/xky/dto/LineList.java @@ -31,7 +31,7 @@ private String scheduleDetailNo; //瀵瑰簲鎺掔▼ItemDetail鐨勪富閿垪 private String urgentFlag; //鏄惁鎬ユ枡 0:鍚� ; 1锛氭槸 private String srcBillType; //鍘熷鍗曟嵁绫诲瀷1锛氳鍗曪紱2锛氭帓绋�; 3:鎸夐��璐� 4:鎸夊鍝� - private String purchaseDesc; //閲囪喘椤规鐨勯噰璐鏄庝俊鎭� + // private String purchaseDesc; //閲囪喘椤规鐨勯噰璐鏄庝俊鎭� private String srcOrderLineRemark; //鍗曟嵁澶囨敞锛宻rcBillType=1 瀵瑰簲閲囪喘璁㈠崟鍗曡韩鐨勫娉�; srcBillType=2 瀵瑰簲鎺掔▼椤规鐨勫娉� private String status; //鐘舵�侊紙1:寰呯鏀讹紱2:绛炬敹涓紱3: 宸插畬鎴愶紱锛� private String receiveStatus; //鏀惰揣鐘舵�侊紙0-鏈敹璐�;1-閮ㄥ垎鏀惰揣;2-鍏ㄩ儴鏀惰揣锛� diff --git a/src/main/java/com/gs/xky/entity/DeliveryNotice.java b/src/main/java/com/gs/xky/entity/DeliveryNotice.java index d6f10b0..420a5fd 100644 --- a/src/main/java/com/gs/xky/entity/DeliveryNotice.java +++ b/src/main/java/com/gs/xky/entity/DeliveryNotice.java @@ -169,7 +169,7 @@ /** * 璐х墿閫佽揪鏃ユ湡(鏃堕棿鎴�) */ - private Date cargoDeliveryTime; + private String cargoDeliveryTime; /** * 鐗╂祦鏂瑰紡:1-渚涘簲鍟嗛�佽揣 2-蹇�� 3-閲囪喘鏂硅嚜鎻� */ @@ -186,4 +186,6 @@ * 浼樺厛妫�楠�:0-姝e父 1-浼樺厛 2-绱ф�� */ private String firstCheck; + + private Date createDate; } \ No newline at end of file diff --git a/src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java b/src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java index dbe82a4..86b8cea 100644 --- a/src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java +++ b/src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java @@ -2,6 +2,7 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -65,6 +66,12 @@ DeliveryNoticeDetail detail = new DeliveryNoticeDetail(); BeanUtil.copyProperties(list, detail); detail.setPid(id); + + if (StrUtil.isNotEmpty(detail.getPoLineNo())) { + String[] split = detail.getPoLineNo().split("-"); + detail.setPoLineNo(split[0]); + } + noticeDetails.add(detail); } diff --git a/src/main/java/com/gs/xky/service/XkyService.java b/src/main/java/com/gs/xky/service/XkyService.java index 7a26aea..fa4f579 100644 --- a/src/main/java/com/gs/xky/service/XkyService.java +++ b/src/main/java/com/gs/xky/service/XkyService.java @@ -10,6 +10,8 @@ import com.gs.xky.dto.XkyDetail; import com.gs.xky.dto.XkyEntity; import com.gs.xky.entity.DeliveryNotice; +import com.gs.xky.entity.DeliveryNoticeDetail; +import com.gs.xky.entity.TblBarcodeInformation; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,6 +30,7 @@ private final DeliveryNoticeService deliveryNoticeService; private final TblBarcodeInformationService barcodeInformationService; + private final DeliveryNoticeDetailService deliveryNoticeDetailService; public void GetSaveDetail() throws IOException { long currentTimeMillis = System.currentTimeMillis(); @@ -55,13 +58,31 @@ LambdaUpdateWrapper<DeliveryNotice> deliveryNoticeWrapper = new LambdaUpdateWrapper<>(); + LambdaUpdateWrapper<DeliveryNoticeDetail> updateWrapper = new LambdaUpdateWrapper<>(); + + LambdaUpdateWrapper<TblBarcodeInformation> updateWrapper1 = new LambdaUpdateWrapper<>(); + deliveryNoList.forEach(deliveryNo -> { try { if ("4".equals(deliveryNo.getStatus()) || "8".equals(deliveryNo.getStatus())) { deliveryNoticeWrapper.clear(); + updateWrapper.clear(); + updateWrapper1.clear(); deliveryNoticeWrapper.eq(DeliveryNotice::getDeliveryNo, deliveryNo.getDeliveryNo()); - deliveryNoticeService.remove(deliveryNoticeWrapper); + + DeliveryNotice one = deliveryNoticeService.getOne(deliveryNoticeWrapper, false); + + if (deliveryNoticeService.remove(deliveryNoticeWrapper)) { + + updateWrapper.eq(DeliveryNoticeDetail::getPid, one.getId()); + deliveryNoticeDetailService.remove(updateWrapper); + + updateWrapper1.eq(TblBarcodeInformation::getDeliveryNo, deliveryNo.getDeliveryNo()); + barcodeInformationService.remove(updateWrapper1); + } + + } XkyDetail detail = getDetail(deliveryNo.getDeliveryNo()); diff --git a/src/test/java/com/gs/xky/XkyApplicationTests.java b/src/test/java/com/gs/xky/XkyApplicationTests.java index 7344742..83d8dec 100644 --- a/src/test/java/com/gs/xky/XkyApplicationTests.java +++ b/src/test/java/com/gs/xky/XkyApplicationTests.java @@ -1,5 +1,12 @@ package com.gs.xky; +import com.alibaba.fastjson2.JSON; +import com.gs.xky.config.ApiResponse; +import com.gs.xky.config.BodyParam; +import com.gs.xky.config.DataAcquisitionConfiguration; +import com.gs.xky.config.XkyCommonParam; +import com.gs.xky.dto.XkyDetail; +import com.gs.xky.service.ApiService; import com.gs.xky.service.XkyService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -14,10 +21,30 @@ @Autowired private XkyService xkyService; + @Autowired + private ApiService apiService; + @Test void contextLoads() throws IOException { xkyService.GetSaveDetail(); } + @Test + void cs() throws IOException { + XkyCommonParam param = XkyCommonParam.GetInit(); + + // 鍒涘缓 BodyParam 瀵硅薄骞惰祴鍊� + BodyParam bodyParam = new BodyParam(); + + bodyParam.setErpCode(DataAcquisitionConfiguration.TEST_ERP_CODE); + bodyParam.setDeliveryNo("22250212VVWU"); + + param.setBody(bodyParam); + + ApiResponse<XkyDetail> noList = apiService.sendListRequest(param, XkyDetail.class, "https://openapi.xiekeyun.com/delivery/getDetail.json"); + + System.out.println(JSON.toJSONString(noList.getData())); + } + } \ No newline at end of file -- Gitblit v1.9.3