Explorar el Código

物流数据Excel导出

yzc hace 1 año
padre
commit
33940947e6

+ 11 - 4
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/controller/logistics/LogisticsInfosController.java

@@ -13,6 +13,7 @@ import com.ruoyi.common.core.domain.entity.SysDept;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 
@@ -106,9 +107,9 @@ public class LogisticsInfosController {
     }
 
     @PostMapping("/test")
-    public void test(@RequestBody List<LogisticsInfosDto> dtos){
+    public void test(@RequestBody List<LogisticsInfosDto> dtos) {
         for (LogisticsInfosDto dto : dtos) {
-            KD100Util.monitor(dto.getLogisticsCompanyCode(),dto.getCode(),dto.getBusinessId(),dto.getBusinessType(), LogisticsInfos.class);
+            KD100Util.monitor(dto.getLogisticsCompanyCode(), dto.getCode(), dto.getBusinessId(), dto.getBusinessType(), LogisticsInfos.class);
             try {
                 Thread.sleep(1000);
             } catch (InterruptedException e) {
@@ -116,8 +117,14 @@ public class LogisticsInfosController {
             }
         }
     }
+
     @PostMapping("/test1")
-    public void test1(@RequestBody LogisticsInfosDto dto){
-        KD100Util.subscribe("","");
+    public void test1(@RequestBody LogisticsInfosDto dto) {
+        KD100Util.subscribe("", "");
+    }
+
+    @PostMapping("/exportExcel")
+    void exportExcel(@RequestBody LogisticsInfosSelectDto dto, HttpServletResponse httpServletResponse) {
+        logisticsInfosService.exportExcel(dto, httpServletResponse);
     }
 }

+ 61 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/logistics/LogisticsInfosExcelBo.java

@@ -0,0 +1,61 @@
+package com.fjhx.victoriatourist.entity.logistics;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+@Getter
+@Setter
+public class LogisticsInfosExcelBo {
+    @ColumnWidth(15)
+    @ExcelProperty("数据来源")
+    private String businessType;
+
+    @ColumnWidth(25)
+    @ExcelProperty("关联单号")
+    private String businessCode;
+
+    @ColumnWidth(15)
+    @ExcelProperty("项目组")
+    private String deptName;
+
+    @ColumnWidth(20)
+    @ExcelProperty("物流/快递公司")
+    private String logisticsCompanyName;
+
+    @ColumnWidth(20)
+    @ExcelProperty("物流/快递单号")
+    private String code;
+
+    @ColumnWidth(15)
+    @ExcelProperty("物流状态")
+    private String logisticsStatus;
+
+    @ColumnWidth(20)
+    @ExcelProperty("创建时间")
+    private Date createTime;
+
+    @ColumnWidth(20)
+    @ExcelProperty("到货物流备注")
+    private String arrivalRemark;
+
+    @ExcelIgnore
+    List<LogisticsProductInfo> logisticsProductInfoList;
+    @ColumnWidth(20)
+    @ExcelProperty("SKU")
+    private String sku;
+
+    @ColumnWidth(20)
+    @ExcelProperty("货物型号")
+    private String productSpec;
+
+    @ColumnWidth(20)
+    @ExcelProperty("采购实发数量")
+    private String quantity;
+
+}

+ 16 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/logistics/LogisticsProductInfo.java

@@ -0,0 +1,16 @@
+package com.fjhx.victoriatourist.entity.logistics;
+
+import com.ruoyi.common.core.domain.BaseIdPo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+@Getter
+@Setter
+public class LogisticsProductInfo extends BaseIdPo {
+    private Long productId;
+    private String productCode;
+    private String productSpec;
+    private BigDecimal quantity;
+}

+ 8 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/logistics/vo/LogisticsInfosVo.java

@@ -1,10 +1,13 @@
 package com.fjhx.victoriatourist.entity.logistics.vo;
 
 import com.fjhx.area.service.SetCustomizeAreaName;
+import com.fjhx.victoriatourist.entity.logistics.LogisticsProductInfo;
 import com.fjhx.victoriatourist.entity.logistics.po.LogisticsInfos;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.List;
+
 /**
  * 物流信息列表查询返回值实体
  *
@@ -47,4 +50,9 @@ public class LogisticsInfosVo extends LogisticsInfos implements SetCustomizeArea
      * 到货状态
      */
     private Integer arrivalStatus;
+
+    /**
+     * 物流产品信息列表
+     */
+    private List<LogisticsProductInfo> logisticsProductInfoList;
 }

+ 12 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/mapper/logistics/LogisticsInfosMapper.java

@@ -2,6 +2,7 @@ package com.fjhx.victoriatourist.mapper.logistics;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.victoriatourist.entity.logistics.LogisticsProductInfo;
 import com.fjhx.victoriatourist.entity.logistics.po.LogisticsInfos;
 import com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo;
 import com.ruoyi.common.core.domain.entity.SysDept;
@@ -24,10 +25,21 @@ public interface LogisticsInfosMapper extends BaseMapper<LogisticsInfos> {
     /**
      * 物流信息分页
      */
+    List<LogisticsInfosVo> getList(@Param("ew") IWrapper<LogisticsInfos> wrapper, @Param("businessType") Integer businessType);
     Page<LogisticsInfosVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<LogisticsInfos> wrapper, @Param("businessType") Integer businessType);
 
     /**
      * 获取物流关联产品部门列表
      */
     List<SysDept> getDepts();
+
+    /**
+     * 获取物流产品信息 根据发货id
+     */
+    List<LogisticsProductInfo> getLogisticsProductInfoByDeliverGoods(@Param("ew") IWrapper<Object> wrapper);
+
+    /**
+     * 获取物流产品信息 根据待出入库id
+     */
+    List<LogisticsProductInfo> getLogisticsProductInfoByStockWait(@Param("ew") IWrapper<Object> wrapper);
 }

+ 2 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/WmsServiceImpl.java

@@ -173,6 +173,7 @@ public class WmsServiceImpl implements WmsService {
         logisticsInfos.setWarehouseId(dto.getWarehouseId());
         logisticsInfos.setReservationCode(dto.getReservationCode());
         logisticsInfos.setIsKd100(0);
+        logisticsInfos.setStockWaitId(stockWait.getId());
 
 
         if (ObjectUtil.isNotEmpty(dto.getLogisticsCode()) && ObjectUtil.isNotEmpty(dto.getLogisticsCompanyCode())) {
@@ -196,6 +197,7 @@ public class WmsServiceImpl implements WmsService {
             logisticsDetails.setLogisticsInfoCode(logisticsInfos.getCode());
             logisticsDetails.setBusinessDetailsId(stockWaitDetails.getId());
             logisticsDetails.setReceiptQuantity(stockWaitDetails.getQuantity());
+            logisticsDetails.setStockWaitDetailsId(stockWaitDetails.getId());
             logisticsDetailsList.add(logisticsDetails);
         }
         logisticsDetailsService.saveBatch(logisticsDetailsList);

+ 6 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/logistics/LogisticsInfosService.java

@@ -9,6 +9,7 @@ import com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo;
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.service.BaseService;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 
@@ -66,4 +67,9 @@ public interface LogisticsInfosService extends BaseService<LogisticsInfos> {
      * 获取物流关联产品部门列表
      */
     List<SysDept> getDepts();
+
+    /**
+     * 导出Excel
+     */
+    void exportExcel(LogisticsInfosSelectDto dto, HttpServletResponse httpServletResponse);
 }

+ 166 - 6
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/logistics/impl/LogisticsInfosServiceImpl.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.area.utils.CustomizeAreaUtil;
 import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.utils.Assert;
+import com.fjhx.item.util.excel.util.ExcelUtil;
 import com.fjhx.kd100.entity.company.po.CompanyInfo;
 import com.fjhx.kd100.entity.config.po.ConfigInfo;
 import com.fjhx.kd100.entity.logistics.po.LogisticsInfo;
@@ -22,6 +23,8 @@ import com.fjhx.kd100.util.KD100Util;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.service.purchase.PurchaseService;
 import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
+import com.fjhx.victoriatourist.entity.logistics.LogisticsInfosExcelBo;
+import com.fjhx.victoriatourist.entity.logistics.LogisticsProductInfo;
 import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosDto;
 import com.fjhx.victoriatourist.entity.logistics.dto.LogisticsInfosSelectDto;
 import com.fjhx.victoriatourist.entity.logistics.po.LogisticsDetails;
@@ -44,6 +47,8 @@ import org.springframework.context.event.EventListener;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -74,10 +79,7 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
     @Autowired
     private DeliverGoodsService deliverGoodsService;
 
-
-    @Override
-    public Page<LogisticsInfosVo> getPage(LogisticsInfosSelectDto dto) {
-        IWrapper<LogisticsInfos> wrapper = getWrapper();
+    private void setPageWrapper(IWrapper<LogisticsInfos> wrapper, LogisticsInfosSelectDto dto) {
         wrapper.eq("li", LogisticsInfos::getId, dto.getId());
 
         wrapper.eq("li", LogisticsInfos::getBusinessType, dto.getBusinessType());
@@ -115,16 +117,41 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         //部门(项目组)过滤
         wrapper.eq("de.dept_id", dto.getDeptId());
 
+        //时间范围过滤
+        wrapper.ge("li.create_time", dto.getBeginTime());
+        wrapper.le("li.create_time", dto.getEndTime());
+
+
         wrapper.groupBy("li.id");
 
         wrapper.orderByDesc("li", LogisticsInfos::getId);
         Assert.notEmpty(dto.getBusinessType(), "物流数据来源类型不能为空");
+    }
+
+    @Override
+    public Page<LogisticsInfosVo> getPage(LogisticsInfosSelectDto dto) {
+        IWrapper<LogisticsInfos> wrapper = getWrapper();
+
+        //设置通用查询条件
+        setPageWrapper(wrapper, dto);
+
         Page<LogisticsInfosVo> page = this.baseMapper.getPage(dto.getPage(), wrapper, dto.getBusinessType());
         List<LogisticsInfosVo> records = page.getRecords();
+
+        //赋值通用信息
+        setPageInfo(records);
+
+        return page;
+    }
+
+    private void setPageInfo(List<LogisticsInfosVo> records) {
+        if (ObjectUtil.isEmpty(records)) {
+            return;
+        }
         //赋值物流公司名字
         List<String> codes = records.stream().map(LogisticsInfosVo::getLogisticsCompanyCode).collect(Collectors.toList());
         if (ObjectUtil.isEmpty(codes)) {
-            return page;
+            return;
         }
         List<CompanyInfo> list = companyInfoService.list(q -> q.in(CompanyInfo::getCode, codes));
         if (ObjectUtil.isNotEmpty(list)) {
@@ -136,7 +163,56 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         }
         //赋值国省市名称
         CustomizeAreaUtil.setAreaName(records);
-        return page;
+
+        //赋值产品信息
+        setProductInfo(records);
+    }
+
+    /**
+     * 赋值物流关联业务产品信息
+     */
+    private void setProductInfo(List<LogisticsInfosVo> records) {
+        if (ObjectUtil.isEmpty(records)) {
+            return;
+        }
+        //采购到货
+        {
+            List<LogisticsInfosVo> collect0 = records.stream().filter(item -> item.getBusinessType().equals(1)).collect(Collectors.toList());
+            List<Long> ids0 = collect0.stream().map(LogisticsInfos::getId).collect(Collectors.toList());
+            List<LogisticsProductInfo> byDeliverGoods = baseMapper.getLogisticsProductInfoByDeliverGoods(IWrapper.getWrapper()
+                    .in("lis.id", ids0)
+            );
+            Map<Long, List<LogisticsProductInfo>> byDeliverGoodsMap = byDeliverGoods.stream().collect(Collectors.groupingBy(LogisticsProductInfo::getId));
+            for (LogisticsInfosVo logisticsInfosVo : collect0) {
+                logisticsInfosVo.setLogisticsProductInfoList(byDeliverGoodsMap.getOrDefault(logisticsInfosVo.getId(), new ArrayList<>()));
+            }
+        }
+
+        //京东数据
+        {
+            List<LogisticsInfosVo> collect1 = records.stream().filter(item -> item.getBusinessType().equals(2)).collect(Collectors.toList());
+            List<Long> ids1 = collect1.stream().map(LogisticsInfos::getId).collect(Collectors.toList());
+            List<LogisticsProductInfo> byStockWait = baseMapper.getLogisticsProductInfoByStockWait(IWrapper.getWrapper()
+                    .in("lis.id", ids1)
+            );
+            Map<Long, List<LogisticsProductInfo>> byStockWaitMap = byStockWait.stream().collect(Collectors.groupingBy(LogisticsProductInfo::getId));
+            for (LogisticsInfosVo logisticsInfosVo : collect1) {
+                logisticsInfosVo.setLogisticsProductInfoList(byStockWaitMap.getOrDefault(logisticsInfosVo.getId(), new ArrayList<>()));
+            }
+        }
+
+        //采购退货
+        {
+            List<LogisticsInfosVo> collect2 = records.stream().filter(item -> item.getBusinessType().equals(5)).collect(Collectors.toList());
+            List<Long> ids2 = collect2.stream().map(LogisticsInfos::getId).collect(Collectors.toList());
+            List<LogisticsProductInfo> byStockWait1 = baseMapper.getLogisticsProductInfoByStockWait(IWrapper.getWrapper()
+                    .in("lis.id", ids2)
+            );
+            Map<Long, List<LogisticsProductInfo>> byStockWaitMap1 = byStockWait1.stream().collect(Collectors.groupingBy(LogisticsProductInfo::getId));
+            for (LogisticsInfosVo logisticsInfosVo : collect2) {
+                logisticsInfosVo.setLogisticsProductInfoList(byStockWaitMap1.getOrDefault(logisticsInfosVo.getId(), new ArrayList<>()));
+            }
+        }
     }
 
     @Override
@@ -319,4 +395,88 @@ public class LogisticsInfosServiceImpl extends ServiceImpl<LogisticsInfosMapper,
         TenantHolder.clear();
     }
 
+    @Override
+    public void exportExcel(LogisticsInfosSelectDto dto, HttpServletResponse httpServletResponse) {
+        IWrapper<LogisticsInfos> wrapper = getWrapper();
+        setPageWrapper(wrapper, dto);
+        List<LogisticsInfosVo> list = baseMapper.getList(wrapper, dto.getBusinessType());
+        setPageInfo(list);
+
+        //导出Excel
+        List<LogisticsInfosExcelBo> logisticsInfosExcelBoList = BeanUtil.copyToList(list, LogisticsInfosExcelBo.class);
+        for (LogisticsInfosExcelBo logisticsInfosExcelBo : logisticsInfosExcelBoList) {
+            //数据来源
+            if (logisticsInfosExcelBo.getBusinessType().equals("1")) {
+                logisticsInfosExcelBo.setBusinessType("采购入库");
+            }
+            if (logisticsInfosExcelBo.getBusinessType().equals("2")) {
+                logisticsInfosExcelBo.setBusinessType("京东订单出库");
+            }
+            if (logisticsInfosExcelBo.getBusinessType().equals("5")) {
+                logisticsInfosExcelBo.setBusinessType("采购退货");
+            }
+            // 物流状态 -1未查询到快递信息 0在途,1揽收,2疑难,3签收,4退签,5派件,6退回,7转投,8清关,14拒签,15完成
+            String logisticsStatus = logisticsInfosExcelBo.getLogisticsStatus();
+            if (ObjectUtil.isNotEmpty(logisticsStatus)) {
+                switch (logisticsStatus) {
+                    case "-1":
+                        logisticsStatus = "未知";
+                        break;
+                    case "0":
+                        logisticsStatus = "在途";
+                        break;
+                    case "1":
+                        logisticsStatus = "揽收";
+                        break;
+                    case "2":
+                        logisticsStatus = "疑难";
+                        break;
+                    case "3":
+                        logisticsStatus = "签收";
+                        break;
+                    case "4":
+                        logisticsStatus = "退签";
+                        break;
+                    case "5":
+                        logisticsStatus = "派件";
+                        break;
+                    case "6":
+                        logisticsStatus = "退回";
+                        break;
+                    case "7":
+                        logisticsStatus = "转投";
+                        break;
+                    case "8":
+                        logisticsStatus = "清关";
+                        break;
+                    case "14":
+                        logisticsStatus = "拒签";
+                        break;
+                    case "15":
+                        logisticsStatus = "完成";
+                        break;
+                }
+                logisticsInfosExcelBo.setLogisticsStatus(logisticsStatus);
+            }
+
+            //物流产品信息
+            List<LogisticsProductInfo> logisticsProductInfoList = logisticsInfosExcelBo.getLogisticsProductInfoList();
+            StringJoiner sj1 = new StringJoiner("\r\n");
+            StringJoiner sj2 = new StringJoiner("\r\n");
+            StringJoiner sj3 = new StringJoiner("\r\n");
+
+            for (LogisticsProductInfo logisticsProductInfo : logisticsProductInfoList) {
+                sj1.add(logisticsProductInfo.getProductCode());
+                sj2.add(logisticsProductInfo.getProductSpec());
+                sj3.add(ObjectUtil.defaultIfNull(logisticsProductInfo.getQuantity(), BigDecimal.ZERO).toString());
+            }
+            logisticsInfosExcelBo.setSku(sj1.toString());
+            logisticsInfosExcelBo.setProductSpec(sj2.toString());
+            logisticsInfosExcelBo.setQuantity(sj3.toString());
+        }
+
+
+        ExcelUtil.export(httpServletResponse, logisticsInfosExcelBoList, LogisticsInfosExcelBo.class);
+    }
+
 }

+ 1 - 0
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/purchase/impl/PurchaseBackServiceImpl.java

@@ -206,6 +206,7 @@ public class PurchaseBackServiceImpl extends ServiceImpl<PurchaseBackMapper, Pur
         logisticsInfos.setId(IdWorker.getId());
         logisticsInfos.setPurchaseId(purchaseBack.getPurchaseId());
         logisticsInfos.setBusinessId(byId.getId());
+        logisticsInfos.setStockWaitId(byId.getId());
         logisticsInfos.setBusinessCode(byId.getBusinessCode());
         logisticsInfos.setBusinessType(5);//采购退货
         logisticsInfos.setLogisticsCompanyCode(stockWaitDto.getLogisticsCompanyCode());

+ 92 - 53
hx-victoriatourist/src/main/resources/mapper/logistics/LogisticsInfosMapper.xml

@@ -1,63 +1,72 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.victoriatourist.mapper.logistics.LogisticsInfosMapper">
-    <select id="getPage" resultType="com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo">
+    <sql id="list">
         select
-            li.id,
-            li.business_id,
-            IF( li.business_type IN ( 1, 5 ), p.contractCode, li.business_code ) AS businessCode,
-            li.business_type,
-            li.warehouse_id,
-            li.status,
-            li.in_stock_status,
-            li.code,
-            li.logistics_company_code,
-            li.logistics_status,
-            li.is_kd100,
-            li.create_user,
-            li.create_time,
-            li.update_user,
-            li.update_time,
-            li.country_id,
-            li.province_id,
-            li.city_id,
-            li.address,
-            li.purchase_id,
-            li.arrival_remark,
-            de.dept_name,
-            dg.status arrivalStatus
+        li.id,
+        li.business_id,
+        IF( li.business_type IN ( 1, 5 ), p.contractCode, li.business_code ) AS businessCode,
+        li.business_type,
+        li.warehouse_id,
+        li.status,
+        li.in_stock_status,
+        li.code,
+        li.logistics_company_code,
+        li.logistics_status,
+        li.is_kd100,
+        li.create_user,
+        li.create_time,
+        li.update_user,
+        li.update_time,
+        li.country_id,
+        li.province_id,
+        li.city_id,
+        li.address,
+        li.purchase_id,
+        li.arrival_remark,
+        de.dept_name,
+        dg.status arrivalStatus
         from logistics_infos li
-            LEFT JOIN deliver_goods dg on li.business_id = dg.id
-            LEFT JOIN bytesailing_purchase.purchase p ON p.id = li.purchase_id
-                <!-- 采购到货 采购退货 来源 -->
-                <if test="businessType eq 1 or businessType eq 5">
---                     LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = li.purchase_id
---                     LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
-                </if>
-                <!-- 京东退货来源 -->
-                <if test="businessType eq 4">
-                    LEFT JOIN jd_back_details jbd ON jbd.jd_back_id = li.business_id
-                    LEFT JOIN bytesailing_item.product_info pi ON jbd.product_code = pi.custom_code
-                </if>
-                <!-- 京东订单来源 -->
-                <if test="businessType eq 2">
-                    LEFT JOIN jd_order_details jod ON jod.jd_order_id = li.business_id
-                    LEFT JOIN bytesailing_item.product_info pi ON jod.product_id = pi.id
-                </if>
-                <!-- 销售订单来源 -->
-                <if test="businessType eq 3">
-                    LEFT JOIN order_details od ON od.order_id = li.business_id
-                    LEFT JOIN bytesailing_item.product_info pi ON od.product_id = pi.id
-                </if>
-                LEFT JOIN bytesailing_base.sys_dept de ON
-                <if test="businessType neq 1 and businessType neq 5">
-                    pi.deptIdWdly = de.dept_id
-                </if>
-                <if test="businessType eq 1 or businessType eq 5">
-                     p.team_id=de.dept_id
-                </if>
+        LEFT JOIN deliver_goods dg on li.business_id = dg.id
+        LEFT JOIN bytesailing_purchase.purchase p ON p.id = li.purchase_id
+        <!-- 采购到货 采购退货 来源 -->
+        <if test="businessType eq 1 or businessType eq 5">
+            --                     LEFT JOIN bytesailing_purchase.purchase_detail pd ON pd.purchase_id = li.purchase_id
+            --                     LEFT JOIN bytesailing_item.product_info pi ON pd.bussiness_id = pi.id
+        </if>
+        <!-- 京东退货来源 -->
+        <if test="businessType eq 4">
+            LEFT JOIN jd_back_details jbd ON jbd.jd_back_id = li.business_id
+            LEFT JOIN bytesailing_item.product_info pi ON jbd.product_code = pi.custom_code
+        </if>
+        <!-- 京东订单来源 -->
+        <if test="businessType eq 2">
+            LEFT JOIN jd_order_details jod ON jod.jd_order_id = li.business_id
+            LEFT JOIN bytesailing_item.product_info pi ON jod.product_id = pi.id
+        </if>
+        <!-- 销售订单来源 -->
+        <if test="businessType eq 3">
+            LEFT JOIN order_details od ON od.order_id = li.business_id
+            LEFT JOIN bytesailing_item.product_info pi ON od.product_id = pi.id
+        </if>
+        LEFT JOIN bytesailing_base.sys_dept de ON
+        <if test="businessType neq 1 and businessType neq 5">
+            pi.deptIdWdly = de.dept_id
+        </if>
+        <if test="businessType eq 1 or businessType eq 5">
+            p.team_id=de.dept_id
+        </if>
+    </sql>
+
+    <select id="getPage" resultType="com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo">
+        <include refid="list"/>
             ${ew.customSqlSegment}
     </select>
+    <select id="getList" resultType="com.fjhx.victoriatourist.entity.logistics.vo.LogisticsInfosVo">
+        <include refid="list"/>
+        ${ew.customSqlSegment}
+    </select>
+
     <select id="getDepts" resultType="com.ruoyi.common.core.domain.entity.SysDept">
         SELECT
             de.dept_id,
@@ -71,5 +80,35 @@
         GROUP BY
             de.dept_id
     </select>
+    <select id="getLogisticsProductInfoByDeliverGoods"
+            resultType="com.fjhx.victoriatourist.entity.logistics.LogisticsProductInfo">
+        SELECT
+            lis.id,
+            pi.id as productId,
+            pi.`name` as productName,
+            pi.custom_code as productCode,
+            pi.spec as productSpec,
+            dgd.deliver_goods_quantity as quantity
+        FROM
+            logistics_infos lis
+                JOIN deliver_goods_details dgd ON lis.deliver_goods_id = dgd.deliver_goods_id
+                JOIN bytesailing_item.product_info pi ON pi.id = dgd.product_id
+            ${ew.customSqlSegment}
+    </select>
+    <select id="getLogisticsProductInfoByStockWait"
+            resultType="com.fjhx.victoriatourist.entity.logistics.LogisticsProductInfo">
+        SELECT
+            lis.id,
+            pi.id as productId,
+            pi.`name` as productName,
+            pi.custom_code as productCode,
+            pi.spec as productSpec,
+            swd.quantity
+        FROM
+            logistics_infos lis
+                JOIN bytesailing_wms.stock_wait_details swd ON lis.stock_wait_id = swd.stock_wait_id
+                JOIN bytesailing_item.product_info pi ON pi.id = swd.product_id
+            ${ew.customSqlSegment}
+    </select>
 
 </mapper>