Jelajahi Sumber

采购付款导出

yzc 1 tahun lalu
induk
melakukan
be995a14cf
16 mengubah file dengan 415 tambahan dan 7 penghapusan
  1. 9 0
      hx-purchase/src/main/java/com/fjhx/purchase/controller/purchase/PurchaseController.java
  2. 68 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/deliver/DeliverGoodsDetailsPoVo.java
  3. 64 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/PayExportExcel.java
  4. 59 0
      hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/PurchaseJson.java
  5. 2 1
      hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/vo/PurchaseDetailVo.java
  6. 2 0
      hx-purchase/src/main/java/com/fjhx/purchase/mapper/purchase/PurchaseMapper.java
  7. 3 0
      hx-purchase/src/main/java/com/fjhx/purchase/mapper/purchase/PurchasePayRecordDetailMapper.java
  8. 3 0
      hx-purchase/src/main/java/com/fjhx/purchase/service/WdlyService.java
  9. 4 0
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/PurchasePayRecordDetailService.java
  10. 7 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/PurchaseService.java
  11. 7 0
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordDetailServiceImpl.java
  12. 165 2
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java
  13. 7 1
      hx-purchase/src/main/resources/mapper/purchase/PurchaseMapper.xml
  14. 7 1
      hx-purchase/src/main/resources/mapper/purchase/PurchasePayRecordDetailMapper.xml
  15. 6 0
      hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/WdlyServiceImpl.java
  16. 2 1
      hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/deliver/impl/DeliverGoodsServiceImpl.java

+ 9 - 0
hx-purchase/src/main/java/com/fjhx/purchase/controller/purchase/PurchaseController.java

@@ -14,6 +14,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 
@@ -129,4 +130,12 @@ public class PurchaseController {
         purchaseService.editPurchaseStatus(purchaseDto);
     }
 
+    /**
+     * 采购付款excel导出
+     */
+    @PostMapping("/purchasePayExcelExport")
+    void purchasePayExcelExport(@RequestBody PurchaseSelectDto dto, HttpServletResponse httpServletResponse) {
+        purchaseService.purchasePayExcelExport(dto, httpServletResponse);
+    }
+
 }

+ 68 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/deliver/DeliverGoodsDetailsPoVo.java

@@ -0,0 +1,68 @@
+package com.fjhx.purchase.entity.deliver;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 发货明细列表查询返回值实体
+ *
+ * @author
+ * @since 2023-04-13
+ */
+@Getter
+@Setter
+public class DeliverGoodsDetailsPoVo extends DeliverGoodsDetailsPo {
+
+    /**
+     * 产品id
+     */
+    private Long productId;
+
+    /**
+     * 产品类型
+     */
+    private String type;
+    /**
+     * 产品编号
+     */
+    private String code;
+    /**
+     * 产品名称
+     */
+    private String name;
+    /**
+     * 产品规格
+     */
+    private String spec;
+    /**
+     * 产品单位
+     */
+    private String unit;
+    /**
+     * 采购数量
+     */
+    private BigDecimal count;
+
+    /**
+     * 产品类型定义
+     */
+    private Integer definition;
+
+    /**
+     * 在途数量
+     */
+    private BigDecimal transitQuantity;
+
+    /**
+     * 物流单号
+     */
+    private String logisticsCode;
+
+    /**
+     * 采购id
+     */
+    private Long purchaseId;
+
+}

+ 64 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/PayExportExcel.java

@@ -0,0 +1,64 @@
+package com.fjhx.purchase.entity.purchase;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Getter
+@Setter
+public class PayExportExcel {
+    @ColumnWidth(20)
+    @ExcelProperty("采购单号")
+    private String contractCode;
+    @ColumnWidth(20)
+    @ExcelProperty("采购时间")
+    private Date purchaseTime;
+    @ColumnWidth(20)
+    @ExcelProperty("物品编码")
+    private String productCode;
+    @ExcelProperty("规格")
+    private String productSpec;
+    @ExcelProperty("单位")
+    private String productUnit;
+    @ColumnWidth(20)
+    @ExcelProperty("已采购数量")
+    private BigDecimal purchaseQuantity;
+    @ExcelProperty("单价")
+    private BigDecimal price;
+    @ExcelProperty("金额")
+    private BigDecimal amount;
+    @ColumnWidth(20)
+    @ExcelProperty("优惠金额")
+    private String preferential;
+    @ColumnWidth(20)
+    @ExcelProperty("付款账号")
+    private String payAccount;
+    @ColumnWidth(20)
+    @ExcelProperty("付款金额")
+    private BigDecimal payAmount;
+    @ColumnWidth(20)
+    @ExcelProperty("付款时间")
+    private String payTime;
+    @ColumnWidth(20)
+    @ExcelProperty("已入库数量")
+    private BigDecimal receiptQuantity;
+    @ColumnWidth(20)
+    @ExcelProperty("已质检数量")
+    private BigDecimal qualityQuantity;
+    @ColumnWidth(20)
+    @ExcelProperty("不合格数量")
+    private BigDecimal disqualificationCount;
+    @ColumnWidth(20)
+    @ExcelProperty("退货数量")
+    private BigDecimal returnQuantity;
+    @ColumnWidth(20)
+    @ExcelProperty("退货金额")
+    private BigDecimal returnAmount;
+    @ColumnWidth(20)
+    @ExcelProperty("物流单号")
+    private String logisticsCode;
+}

+ 59 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/PurchaseJson.java

@@ -0,0 +1,59 @@
+package com.fjhx.purchase.entity.purchase;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Getter
+@Setter
+public class PurchaseJson {
+    /**
+     * 其他费用
+     */
+    private List<OtherFee> otherFeeList;
+    /**
+     * 是否合同
+     */
+    private String isAgreement;
+    /**
+     * 付款方式
+     */
+    private String paymentMethod;
+    /**
+     * 合同编号
+     */
+    private String contractCode;
+    /**
+     * 运费
+     */
+    private String freight;
+    /**
+     * 优惠
+     */
+    private String preferential;
+    //------
+    private BigDecimal paidAmount;
+
+    private String receiptWarehouseId;
+
+    private String receiptWarehouseName;
+
+    @Getter
+    @Setter
+    class OtherFee {
+        /**
+         * 费用金额
+         */
+        private BigDecimal price;
+        /**
+         * 费用名称
+         */
+        private String name;
+        /**
+         * 费用说明
+         */
+        private String remark;
+    }
+}

+ 2 - 1
hx-purchase/src/main/java/com/fjhx/purchase/entity/purchase/vo/PurchaseDetailVo.java

@@ -1,6 +1,7 @@
 package com.fjhx.purchase.entity.purchase.vo;
 
 import com.fjhx.purchase.entity.arrival.vo.ArrivalDetailVo;
+import com.fjhx.purchase.entity.deliver.DeliverGoodsDetailsPoVo;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.quality.vo.QualityDetailVo;
 import com.fjhx.wms.entity.stock.vo.StockJournalDetailsVo;
@@ -68,7 +69,7 @@ public class PurchaseDetailVo extends PurchaseDetail {
     /**
      * 发货记录列表
      */
-    private Object deliverGoodsDetailList;
+    private List<DeliverGoodsDetailsPoVo> deliverGoodsDetailList;
     /**
      * 到货记录列表
      */

+ 2 - 0
hx-purchase/src/main/java/com/fjhx/purchase/mapper/purchase/PurchaseMapper.java

@@ -29,6 +29,8 @@ public interface PurchaseMapper extends BaseMapper<Purchase> {
      * 采购分页
      */
     Page<PurchaseVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<Purchase> wrapper);
+    List<PurchaseVo> getList(@Param("ew") IWrapper<Purchase> wrapper);
+
 
 
 

+ 3 - 0
hx-purchase/src/main/java/com/fjhx/purchase/mapper/purchase/PurchasePayRecordDetailMapper.java

@@ -7,6 +7,8 @@ import com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -22,5 +24,6 @@ public interface PurchasePayRecordDetailMapper extends BaseMapper<PurchasePayRec
      * 采购付款记录分页
      */
     Page<PurchasePayRecordDetailVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<PurchasePayRecordDetail> wrapper);
+    List<PurchasePayRecordDetailVo> getList(@Param("ew") IWrapper<PurchasePayRecordDetail> wrapper);
 
 }

+ 3 - 0
hx-purchase/src/main/java/com/fjhx/purchase/service/WdlyService.java

@@ -2,6 +2,7 @@ package com.fjhx.purchase.service;
 
 import com.fjhx.purchase.entity.deliver.DeliverGoodsDetailsPo;
 import com.fjhx.purchase.entity.deliver.DeliverGoodsPo;
+import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
 
 import java.util.List;
 
@@ -19,4 +20,6 @@ public interface WdlyService {
     List<DeliverGoodsDetailsPo> getDeliverGoodsDetailsInfo(Long id);
 
     void addAbnormalInfo(Long linkId, String linkCode, Long deliverGoodsId);
+
+    PurchaseVo arrivalDetail(Long purchaseId);
 }

+ 4 - 0
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/PurchasePayRecordDetailService.java

@@ -6,6 +6,8 @@ import com.fjhx.purchase.entity.purchase.po.PurchasePayRecordDetail;
 import com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo;
 import com.ruoyi.common.core.service.BaseService;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -26,4 +28,6 @@ public interface PurchasePayRecordDetailService extends BaseService<PurchasePayR
      * 清空付款记录
      */
     void empty(PurchasePayRecordDetailSelectDto dto);
+
+    List<PurchasePayRecordDetailVo> getList(PurchasePayRecordDetailSelectDto dto);
 }

+ 7 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/PurchaseService.java

@@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.service.BaseService;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 
@@ -85,10 +86,15 @@ public interface PurchaseService extends BaseService<Purchase> {
     /**
      * 获取已采购数量
      */
-     List<PurchaseDetailPo> getPurchaseCountList(IWrapper<Object> wrapper);
+    List<PurchaseDetailPo> getPurchaseCountList(IWrapper<Object> wrapper);
 
     /**
      * 修改采购状态(采购作废/结束)
      */
     void editPurchaseStatus(PurchaseDto purchaseDto);
+
+    /**
+     * 采购付款excel导出
+     */
+    void purchasePayExcelExport(PurchaseSelectDto dto, HttpServletResponse httpServletResponse);
 }

+ 7 - 0
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordDetailServiceImpl.java

@@ -75,4 +75,11 @@ public class PurchasePayRecordDetailServiceImpl extends ServiceImpl<PurchasePayR
         this.remove(q -> q.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId()));
     }
 
+    @Override
+    public List<PurchasePayRecordDetailVo> getList(PurchasePayRecordDetailSelectDto dto){
+        IWrapper<PurchasePayRecordDetail> wrapper = getWrapper();
+        wrapper.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId());
+        return baseMapper.getList(wrapper);
+    }
+
 }

+ 165 - 2
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java

@@ -3,6 +3,7 @@ package com.fjhx.purchase.service.purchase.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
@@ -23,22 +24,30 @@ import com.fjhx.common.service.documentary.GetDocumentaryBusinessTemplate;
 import com.fjhx.common.utils.Assert;
 import com.fjhx.item.entity.product.vo.ProductInfoVo;
 import com.fjhx.item.service.product.ProductInfoService;
+import com.fjhx.item.util.excel.util.ExcelUtil;
+import com.fjhx.purchase.entity.deliver.DeliverGoodsDetailsPoVo;
 import com.fjhx.purchase.entity.invoice.vo.InvoiceDetailsVo;
 import com.fjhx.purchase.entity.pay.vo.PayDetailVo;
+import com.fjhx.purchase.entity.purchase.PayExportExcel;
+import com.fjhx.purchase.entity.purchase.PurchaseJson;
 import com.fjhx.purchase.entity.purchase.bo.PurchaseDocumentaryBo;
 import com.fjhx.purchase.entity.purchase.dto.PurchaseDto;
+import com.fjhx.purchase.entity.purchase.dto.PurchasePayRecordDetailSelectDto;
 import com.fjhx.purchase.entity.purchase.dto.PurchaseSelectDto;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.purchase.po.PurchasePayRecordDetail;
 import com.fjhx.purchase.entity.purchase.po.PurchaseRefundRecord;
+import com.fjhx.purchase.entity.purchase.vo.PurchaseDetailVo;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseDocumentaryVo;
+import com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
 import com.fjhx.purchase.entity.quality.po.QualityDetail;
 import com.fjhx.purchase.entity.subscribe.po.Subscribe;
 import com.fjhx.purchase.entity.subscribe.po.SubscribeDetail;
 import com.fjhx.purchase.mapper.purchase.PurchaseMapper;
+import com.fjhx.purchase.service.WdlyService;
 import com.fjhx.purchase.service.arrival.ArrivalDetailService;
 import com.fjhx.purchase.service.arrival.ArrivalService;
 import com.fjhx.purchase.service.invoice.InvoiceDetailsService;
@@ -51,6 +60,7 @@ import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
 import com.fjhx.purchase.service.subscribe.SubscribeService;
 import com.fjhx.supply.entity.supplier.po.SupplierInfo;
 import com.fjhx.supply.service.supplier.SupplierInfoService;
+import com.fjhx.tenant.utils.DictUtils;
 import com.fjhx.wms.entity.PurchaseDetailPo;
 import com.fjhx.wms.entity.stock.po.Stock;
 import com.fjhx.wms.entity.warehouse.po.Warehouse;
@@ -71,7 +81,11 @@ import org.apache.commons.collections4.MapUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -133,6 +147,8 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
     private PurchaseRefundRecordService purchaseRefundRecordService;
     @Autowired
     private ISysRoleService sysRoleService;
+    @Autowired
+    private WdlyService wdlyService;
 
     /**
      * 列表
@@ -243,7 +259,13 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
 
 
         wrapper.groupBy("p.id");
-        Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        Page<PurchaseVo> page = new Page<>();
+        if (dto.getPageSize() == -1) {
+            page.setRecords(baseMapper.getList(wrapper));
+        } else {
+            page = baseMapper.getPage(dto.getPage(), wrapper);
+        }
+//        Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<PurchaseVo> list = page.getRecords();
         if (ObjectUtils.isEmpty(list)) {
             return page;
@@ -485,7 +507,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
         List<PurchaseDetail> oldPurchaseDetailList = purchaseDetailService.list(q -> q.eq(PurchaseDetail::getPurchaseId, purchaseDto.getId()));
         for (PurchaseDetail purchaseDetail : oldPurchaseDetailList) {
             PurchaseDetail newPurchaseDetail = dtoPurchaseDetailMap.get(purchaseDetail.getId());
-            if(ObjectUtil.isNotEmpty(newPurchaseDetail)) {
+            if (ObjectUtil.isNotEmpty(newPurchaseDetail)) {
                 purchaseDetail.setPrice(newPurchaseDetail.getPrice());
                 purchaseDetail.setAmount(newPurchaseDetail.getAmount());
             }
@@ -678,4 +700,145 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
                 .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
         );
     }
+
+    @Override
+    public void purchasePayExcelExport(PurchaseSelectDto dto, HttpServletResponse httpServletResponse) {
+        //产品单位字典读取
+        Map<String, String> unitDictMap = DictUtils.getDictMap("unit");
+        //付款账户字典
+        Map<String, String> purchasePaymentAccountMap = DictUtils.getDictMap("purchase_payment_account");
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
+
+        List<PayExportExcel> payExportExcelList = new ArrayList<>();
+
+        dto.setPageNum(1);
+        dto.setPageSize(-1);
+        Page<PurchaseVo> page = getPageByWdly(dto);
+        List<PurchaseVo> records = page.getRecords();
+
+        if (ObjectUtils.isEmpty(records)) {
+            ExcelUtil.export(httpServletResponse, payExportExcelList, PayExportExcel.class);
+        }
+
+        //预处理采购明细信息
+        List<Long> purchaseIds = records.stream().map(Purchase::getId).distinct().collect(Collectors.toList());
+        List<PurchaseDetail> purchaseDetailLists = purchaseDetailService.list(q -> q.in(PurchaseDetail::getPurchaseId, purchaseIds));
+        productInfoService.attributeAssign(purchaseDetailLists, PurchaseDetail::getBussinessId, (item, productInfo) -> {
+            //产品编号
+            item.setProductCode(productInfo.getCustomCode());
+            //产品规格
+            item.setProductSpec(productInfo.getSpec());
+            //产品单位
+            String unit = productInfo.getUnit();
+            item.setProductUnit(unitDictMap.getOrDefault(unit, unit));
+        });
+        Map<Long, List<PurchaseDetail>> purchaseDetailMap = purchaseDetailLists.stream().collect(Collectors.groupingBy(PurchaseDetail::getPurchaseId));
+
+        //赋值数据
+        for (PurchaseVo record : records) {
+            PayExportExcel payExportExcel = new PayExportExcel();
+            //解析采购json
+            PurchaseJson purchaseJson = JSONObject.parseObject(record.getVictoriatouristJson(), PurchaseJson.class);
+
+            //采购单号
+            payExportExcel.setContractCode(purchaseJson.getContractCode());
+            //采购时间
+            payExportExcel.setPurchaseTime(record.getCreateTime());
+            //采购明细
+            List<PurchaseDetail> purchaseDetailList = purchaseDetailMap.get(record.getId());
+            //采购金额
+            payExportExcel.setAmount(record.getAmount());
+            //优惠金额
+            payExportExcel.setPreferential(purchaseJson.getPreferential());
+            //付款信息
+            PurchasePayRecordDetailSelectDto dto1 = new PurchasePayRecordDetailSelectDto();
+            dto1.setPurchaseId(record.getId());
+            List<PurchasePayRecordDetailVo> purchasePayRecordDetailVos = purchasePayRecordDetailService.getList(dto1);
+            //付款账号
+            List<String> payAccounts = purchasePayRecordDetailVos.stream().map(PurchasePayRecordDetailVo::getPayAccount).collect(Collectors.toList());
+            StringJoiner payAccountsSj = new StringJoiner("\r\n");
+            for (String payAccount : payAccounts) {
+                payAccountsSj.add(purchasePaymentAccountMap.getOrDefault(payAccount, payAccount));
+            }
+            payExportExcel.setPayAccount(payAccountsSj.toString());
+            //付款金额
+            BigDecimal payAmount = purchasePayRecordDetailVos.stream().map(PurchasePayRecordDetail::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+            payExportExcel.setPayAmount(payAmount);
+            //付款时间
+            List<Date> payDates = purchasePayRecordDetailVos.stream().map(PurchasePayRecordDetail::getPayDate).collect(Collectors.toList());
+            StringJoiner sj = new StringJoiner("\r\n");
+            for (Date payDate : payDates) {
+                sj.add(sdf.format(payDate));
+            }
+            payExportExcel.setPayTime(sj.toString());
+            //已入库信息
+            PurchaseVo purchaseVo = wdlyService.arrivalDetail(record.getId());
+            List<PurchaseDetailVo> purchaseDetailVoList = purchaseVo.getPurchaseDetailVoList();
+            Map<Long, PurchaseDetailVo> PurchaseDetailVoMap = purchaseDetailVoList.stream().collect(Collectors.toMap(PurchaseDetailVo::getId, Function.identity()));
+
+            //遍历采购明细
+            for (PurchaseDetail purchaseDetail : purchaseDetailList) {
+                PayExportExcel newPayExportExcel = BeanUtil.copyProperties(payExportExcel, PayExportExcel.class);
+
+                //产品编号
+                newPayExportExcel.setProductCode(purchaseDetail.getProductCode());
+                //产品规格
+                newPayExportExcel.setProductSpec(purchaseDetail.getProductSpec());
+                //产品单位
+                newPayExportExcel.setProductUnit(purchaseDetail.getProductUnit());
+
+                //采购数量
+                newPayExportExcel.setPurchaseQuantity(purchaseDetail.getCount());
+                //采购单价
+                newPayExportExcel.setPrice(purchaseDetail.getPrice());
+                //到货信息
+                PurchaseDetailVo purchaseDetailVo = PurchaseDetailVoMap.get(purchaseDetail.getId());
+                //已入库数量
+                BigDecimal receiptQuantity = purchaseDetailVo.getReceiptQuantity();
+                if (ObjectUtils.isEmpty(receiptQuantity)) {
+                    receiptQuantity = BigDecimal.ZERO;
+                }
+                newPayExportExcel.setReceiptQuantity(receiptQuantity);
+                //已质检数量
+                BigDecimal qualityQuantity = purchaseDetailVo.getQualityQuantity();
+                if (ObjectUtils.isEmpty(qualityQuantity)) {
+                    qualityQuantity = BigDecimal.ZERO;
+                }
+                newPayExportExcel.setQualityQuantity(qualityQuantity);
+                //不合格数量
+                BigDecimal noQualifiedCount = purchaseDetailVo.getNoQualifiedCount();
+                if (ObjectUtils.isEmpty(noQualifiedCount)) {
+                    noQualifiedCount = BigDecimal.ZERO;
+                }
+                newPayExportExcel.setDisqualificationCount(noQualifiedCount);
+                //退货数量
+                BigDecimal purchaseBackQuantity = purchaseDetailVo.getPurchaseBackQuantity();
+                if (ObjectUtils.isEmpty(purchaseBackQuantity)) {
+                    purchaseBackQuantity = BigDecimal.ZERO;
+                }
+                newPayExportExcel.setReturnQuantity(purchaseBackQuantity);
+                //退货金额
+                newPayExportExcel.setReturnAmount(purchaseBackQuantity.multiply(purchaseDetail.getPrice()));
+                //物流单号
+                List<DeliverGoodsDetailsPoVo> deliverGoodsDetailList = purchaseDetailVo.getDeliverGoodsDetailList();
+                if (ObjectUtils.isNotEmpty(deliverGoodsDetailList)) {
+                    String logisticsCode = deliverGoodsDetailList.stream().map(DeliverGoodsDetailsPoVo::getLogisticsCode).collect(Collectors.joining("\r\n"));
+                    newPayExportExcel.setLogisticsCode(logisticsCode);
+                }
+
+                payExportExcelList.add(newPayExportExcel);
+            }
+
+        }
+        try {
+            File file = new File("C:\\Users\\ASUS\\Desktop\\ou.xlsx");
+            FileOutputStream fos = new FileOutputStream(file);
+            EasyExcel.write(fos, PayExportExcel.class).sheet("aa").doWrite(payExportExcelList);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+        ExcelUtil.export(httpServletResponse, payExportExcelList, PayExportExcel.class);
+    }
 }

+ 7 - 1
hx-purchase/src/main/resources/mapper/purchase/PurchaseMapper.xml

@@ -2,6 +2,12 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.purchase.mapper.purchase.PurchaseMapper">
     <select id="getPage" resultType="com.fjhx.purchase.entity.purchase.vo.PurchaseVo">
+        <include refid="pageOrList"/>
+    </select>
+    <select id="getList" resultType="com.fjhx.purchase.entity.purchase.vo.PurchaseVo">
+        <include refid="pageOrList"/>
+    </select>
+    <sql id="pageOrList">
         SELECT p.id,
                p.purchase_name,
                p.purchase_time,
@@ -35,7 +41,7 @@
                            ON CAST(json_unquote(pi.victoriatourist_json -> '$.deptId') AS UNSIGNED) = de.dept_id
                  LEFT JOIN bytesailing_victoriatourist.deliver_goods dg ON dg.purchase_id = p.id
             ${ew.customSqlSegment}
-    </select>
+        </sql>
     <select id="paymentBill" resultType="com.fjhx.purchase.entity.purchase.dto.PurchaseDto">
         SELECT
             pu.code,

+ 7 - 1
hx-purchase/src/main/resources/mapper/purchase/PurchasePayRecordDetailMapper.xml

@@ -1,7 +1,7 @@
 <?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.purchase.mapper.purchase.PurchasePayRecordDetailMapper">
-    <select id="getPage" resultType="com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo">
+    <sql id="pageOrList">
         SELECT pprd.id,
                pprd.purchase_id,
                pprd.amount,
@@ -16,6 +16,12 @@
         FROM purchase_pay_record_detail pprd
                  LEFT JOIN purchase_pay_record ppr ON pprd.purchase_pay_record_id = ppr.id
             ${ew.customSqlSegment}
+    </sql>
+    <select id="getPage" resultType="com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo">
+        <include refid="pageOrList"></include>
+    </select>
+    <select id="getList" resultType="com.fjhx.purchase.entity.purchase.vo.PurchasePayRecordDetailVo">
+        <include refid="pageOrList"></include>
     </select>
 
 </mapper>

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

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.fjhx.purchase.entity.deliver.DeliverGoodsDetailsPo;
 import com.fjhx.purchase.entity.deliver.DeliverGoodsPo;
+import com.fjhx.purchase.entity.purchase.vo.PurchaseVo;
 import com.fjhx.purchase.service.WdlyService;
 import com.fjhx.victoriatourist.entity.abnormal.po.AbnormalInfo;
 import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
@@ -87,4 +88,9 @@ public class WdlyServiceImpl implements WdlyService {
         abnormalInfo.setLogisticsInfosId(logisticsInfos.getId());
         abnormalInfoService.saveOrUpdate(abnormalInfo);
     }
+
+    @Override
+    public PurchaseVo arrivalDetail(Long purchaseId){
+       return  deliverGoodsService.arrivalDetail( purchaseId);
+    }
 }

+ 2 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/deliver/impl/DeliverGoodsServiceImpl.java

@@ -17,6 +17,7 @@ import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.kd100.util.KD100Util;
 import com.fjhx.purchase.entity.arrival.po.ArrivalDetail;
 import com.fjhx.purchase.entity.arrival.vo.ArrivalDetailVo;
+import com.fjhx.purchase.entity.deliver.DeliverGoodsDetailsPoVo;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.purchase.vo.PurchaseDetailVo;
@@ -329,7 +330,7 @@ public class DeliverGoodsServiceImpl extends ServiceImpl<DeliverGoodsMapper, Del
                         .map(DeliverGoodsDetailsVo::getDeliverGoodsQuantity)
                         .reduce(BigDecimal.ZERO, BigDecimal::add);
                 purchaseDetailVo.setDeliverGoodsQuantity(dgdCount);
-                purchaseDetailVo.setDeliverGoodsDetailList(list1);
+                purchaseDetailVo.setDeliverGoodsDetailList(BeanUtil.copyToList(list1, DeliverGoodsDetailsPoVo.class));
             }
         }
         //赋值到货信息