啊鑫
2025-02-12 41a5ac443936a0c3d891d04955a8b77566220f05
协客云的三个接口修改
已修改6个文件
65 ■■■■■ 文件已修改
src/main/java/com/gs/xky/dto/BarcodeDeliveryNo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gs/xky/dto/LineList.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gs/xky/entity/DeliveryNotice.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gs/xky/service/Impl/DeliveryNoticeServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gs/xky/service/XkyService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/gs/xky/XkyApplicationTests.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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的值;如果企业调整了条码规则,请根据dynamicDescList返回的结果,了解各动态数据的含义
    //private String dynamicData;  //条码规则中对应的动态字段的值, key对应的取值为dynamicDescList.field的值;如果企业调整了条码规则,请根据dynamicDescList返回的结果,了解各动态数据的含义
    private String packLevel;  //包装层级
}
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; //单据备注,srcBillType=1 对应采购订单单身的备注; srcBillType=2 对应排程项次的备注
    private String status; //状态(1:待签收;2:签收中;3: 已完成;)
    private String receiveStatus; //收货状态(0-未收货;1-部分收货;2-全部收货)
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-正常 1-优先 2-紧急
     */
    private String firstCheck;
    private Date createDate;
}
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);
        }
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());
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()));
    }
}