From 29d33f7c6498b4cb2c3f91c18f0b3eaa147695ac Mon Sep 17 00:00:00 2001 From: MrZhai Date: Thu, 10 Mar 2022 16:57:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E5=B7=B2=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=87=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8F=8Avo=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/StockOrderController.java | 19 ++++++++++- .../req/business/StockOrderFilterRequest.java | 2 ++ .../business/StockOrderDetailEntityVo.java | 10 ++++++ .../business/StockOrderExportResponse.java | 29 ++++++++++++++++ .../service/business/StockOrderService.java | 9 +++++ .../business/impl/StockOrderServiceImpl.java | 33 +++++++++++++++++++ .../mybatis/mapper/business/StockOrderDao.xml | 3 ++ 7 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderDetailEntityVo.java create mode 100644 api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderExportResponse.java diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/business/StockOrderController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/business/StockOrderController.java index 58f03a1f..82301955 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/business/StockOrderController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/business/StockOrderController.java @@ -1,5 +1,6 @@ package com.glxp.api.admin.controller.business; +import cn.hutool.core.bean.BeanUtil; import com.github.pagehelper.PageInfo; import com.glxp.api.admin.constant.ConstantStatus; import com.glxp.api.admin.controller.inventory.InvPrintController; @@ -18,6 +19,7 @@ import com.glxp.api.admin.req.inout.DeleteRequest; import com.glxp.api.admin.req.inventory.PostStockPrintRequest; import com.glxp.api.admin.res.PageSimpleResponse; import com.glxp.api.admin.res.basic.UdiRelevanceResponse; +import com.glxp.api.admin.res.business.StockOrderExportResponse; import com.glxp.api.admin.res.inout.ErpOrderResponse; import com.glxp.api.admin.service.basic.UdiInfoService; import com.glxp.api.admin.service.basic.UdiRelevanceService; @@ -37,12 +39,12 @@ import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -451,4 +453,19 @@ public class StockOrderController { return ResultVOUtils.success(billNo); } + + /** + * 导出已验收单据数据接口 + * + * @param request + * @return + */ + @PostMapping("/udiwms/stock/order/exportOrderData") + public BaseResponse exportOrderData(StockOrderFilterRequest request) { + if (null == request || BeanUtil.isEmpty(request)) { + return ResultVOUtils.success(Collections.emptyList()); + } + List data = stockOrderService.exportOrderData(request); + return ResultVOUtils.success(data); + } } diff --git a/api-admin/src/main/java/com/glxp/api/admin/req/business/StockOrderFilterRequest.java b/api-admin/src/main/java/com/glxp/api/admin/req/business/StockOrderFilterRequest.java index 02b5240f..f390ff86 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/req/business/StockOrderFilterRequest.java +++ b/api-admin/src/main/java/com/glxp/api/admin/req/business/StockOrderFilterRequest.java @@ -29,4 +29,6 @@ public class StockOrderFilterRequest extends ListPageRequest { private String orderIdFk; private BigDecimal totalPrice; private String thirdOrderFk; + + private String locStorageCode; //当前仓库号 } diff --git a/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderDetailEntityVo.java b/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderDetailEntityVo.java new file mode 100644 index 00000000..9c80b269 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderDetailEntityVo.java @@ -0,0 +1,10 @@ +package com.glxp.api.admin.res.business; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.glxp.api.admin.entity.business.StockOrderDetailEntity; +import lombok.Data; + +@Data +@JsonIgnoreProperties("orderIdFk") +public class StockOrderDetailEntityVo extends StockOrderDetailEntity { +} diff --git a/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderExportResponse.java b/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderExportResponse.java new file mode 100644 index 00000000..42774a52 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/api/admin/res/business/StockOrderExportResponse.java @@ -0,0 +1,29 @@ +package com.glxp.api.admin.res.business; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.List; + +/** + * 已核对单据数据导出实体类 + */ +@Data +public class StockOrderExportResponse { + + private String id; + private String billNo; + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private String billdate; + private String corpId; + private String corpName; + private String billType; + private String locStorageCode; + + /** + * 订单详情数据 + */ + private List orderDetails; + +} + diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/business/StockOrderService.java b/api-admin/src/main/java/com/glxp/api/admin/service/business/StockOrderService.java index 7a680060..806068ee 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/business/StockOrderService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/business/StockOrderService.java @@ -5,6 +5,7 @@ import com.glxp.api.admin.entity.business.StockOrderEntity; import com.glxp.api.admin.entity.business.StockOrderPrintEntity; import com.glxp.api.admin.req.business.StockOrderFilterRequest; import com.glxp.api.admin.req.business.StockOrderQueryRequest; +import com.glxp.api.admin.res.business.StockOrderExportResponse; import java.util.List; @@ -36,4 +37,12 @@ public interface StockOrderService { List listOrderPrint(String orderId); + + /** + * 导出已验收单据信息 + * + * @param request + * @return + */ + List exportOrderData(StockOrderFilterRequest request); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/service/business/impl/StockOrderServiceImpl.java b/api-admin/src/main/java/com/glxp/api/admin/service/business/impl/StockOrderServiceImpl.java index cc08c72a..436a4c0f 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/service/business/impl/StockOrderServiceImpl.java +++ b/api-admin/src/main/java/com/glxp/api/admin/service/business/impl/StockOrderServiceImpl.java @@ -1,15 +1,24 @@ package com.glxp.api.admin.service.business.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import com.github.pagehelper.PageHelper; import com.glxp.api.admin.dao.business.StockOrderDao; +import com.glxp.api.admin.dao.business.StockOrderDetailDao; +import com.glxp.api.admin.entity.business.StockOrderDetailEntity; import com.glxp.api.admin.entity.business.StockOrderEntity; import com.glxp.api.admin.entity.business.StockOrderPrintEntity; +import com.glxp.api.admin.req.business.StockOrderDetailFilterRequest; import com.glxp.api.admin.req.business.StockOrderFilterRequest; import com.glxp.api.admin.req.business.StockOrderQueryRequest; +import com.glxp.api.admin.res.business.StockOrderDetailEntityVo; +import com.glxp.api.admin.res.business.StockOrderExportResponse; import com.glxp.api.admin.service.business.StockOrderService; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -18,6 +27,8 @@ public class StockOrderServiceImpl implements StockOrderService { @Resource StockOrderDao stockOrderDao; + @Resource + StockOrderDetailDao stockOrderDetailDao; @Override public List listStockOrders(StockOrderQueryRequest stockOrderQueryRequest) { @@ -107,4 +118,26 @@ public class StockOrderServiceImpl implements StockOrderService { return stockOrderDao.listOrderPrint(stockOrderFilterRequest); } + @Override + public List exportOrderData(StockOrderFilterRequest request) { + //单据状态为已验收 + request.setStatus("5"); + List stockOrderEntities = stockOrderDao.filterListOr(request); + if (CollUtil.isNotEmpty(stockOrderEntities)) { + List result = new ArrayList<>(); + for (StockOrderEntity stockOrderEntity : stockOrderEntities) { + StockOrderExportResponse response = new StockOrderExportResponse(); + BeanUtils.copyProperties(stockOrderEntity, response); + StockOrderDetailFilterRequest filterRequest = new StockOrderDetailFilterRequest(); + filterRequest.setOrderIdFk(stockOrderEntity.getOrderIdFk()); + List stockOrderDetailEntities = stockOrderDetailDao.filterStockOrderDetail(filterRequest); + List vos = BeanUtil.copyToList(stockOrderDetailEntities, StockOrderDetailEntityVo.class); + response.setOrderDetails(vos); + result.add(response); + } + return result; + } + return Collections.emptyList(); + } + } diff --git a/api-admin/src/main/resources/mybatis/mapper/business/StockOrderDao.xml b/api-admin/src/main/resources/mybatis/mapper/business/StockOrderDao.xml index 32c3b40b..27bfa3d7 100644 --- a/api-admin/src/main/resources/mybatis/mapper/business/StockOrderDao.xml +++ b/api-admin/src/main/resources/mybatis/mapper/business/StockOrderDao.xml @@ -140,6 +140,9 @@ and totalPrice = #{totalPrice} + + and locStorageCode = #{locStorageCode} + = DATE_FORMAT(#{startTime}, '%Y-%m-%d') ]]>