From 78c509f50f2e56b756bfea13c9390c29e3649bf7 Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Mon, 25 Nov 2024 13:52:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(stock):=20=E5=A2=9E=E5=8A=A0=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E8=B0=83=E6=95=B4=E7=9B=B8=E5=85=B3=20BO=20=E5=92=8C?= =?UTF-8?q?=20DTO=20=E4=B8=AD=E7=9A=84=E4=BE=9B=E5=BA=94=E5=95=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 StockCostAdjustProductBo、StockCostAdjustSheetFullBo、StockAdjustProductBo 和 StockAdjustSheetFullBo 中添加供应商 ID、编号和名称字段 - 在 StockCostAdjustProductDto 和 StockAdjustProductDto 中添加供应商 ID、编号和名称字段 - 更新数据库查询语句,加入供应商信息的查询 --- .../adjust/cost/StockCostAdjustProductBo.java | 21 +++++++++++ .../cost/StockCostAdjustSheetFullBo.java | 34 +++++++++++++++--- .../adjust/stock/StockAdjustProductBo.java | 22 ++++++++++++ .../adjust/stock/StockAdjustSheetFullBo.java | 35 ++++++++++++++++--- .../cost/StockCostAdjustProductDto.java | 14 ++++++++ .../adjust/stock/StockAdjustProductDto.java | 17 +++++++++ .../stock/adjust/StockAdjustSheetMapper.xml | 9 ++++- .../adjust/StockCostAdjustSheetMapper.xml | 9 ++++- 8 files changed, 151 insertions(+), 10 deletions(-) diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java index a4a6295..1dfbba2 100644 --- a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustProductBo.java @@ -81,6 +81,24 @@ public class StockCostAdjustProductBo extends BaseBo @ApiModelProperty("调价前成本价") private BigDecimal oriPrice; + /** + * 供应商id + */ + @ApiModelProperty("供应商id") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + public StockCostAdjustProductBo() { } @@ -96,5 +114,8 @@ public class StockCostAdjustProductBo extends BaseBo this.productId = dto.getId(); this.productCode = dto.getCode(); this.productName = dto.getName(); + this.supplierId = dto.getSupplierId(); + this.supplierCode = dto.getSupplierCode(); + this.supplierName = dto.getSupplierName(); } } diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java index f692ab6..63956b4 100644 --- a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/cost/StockCostAdjustSheetFullBo.java @@ -4,18 +4,17 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.lframework.starter.common.constants.StringPool; import com.lframework.starter.common.utils.NumberUtil; +import com.lframework.starter.common.utils.ObjectUtil; import com.lframework.starter.common.utils.StringUtil; import com.lframework.starter.web.bo.BaseBo; import com.lframework.starter.web.common.utils.ApplicationUtil; import com.lframework.starter.web.utils.EnumUtil; -import com.lframework.xingyun.basedata.entity.Product; -import com.lframework.xingyun.basedata.entity.ProductBrand; -import com.lframework.xingyun.basedata.entity.ProductCategory; -import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.*; import com.lframework.xingyun.basedata.service.product.ProductBrandService; import com.lframework.xingyun.basedata.service.product.ProductCategoryService; import com.lframework.xingyun.basedata.service.product.ProductService; import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; import com.lframework.xingyun.sc.dto.stock.adjust.cost.StockCostAdjustSheetFullDto; import com.lframework.xingyun.sc.entity.ProductStock; import com.lframework.xingyun.sc.enums.StockCostAdjustSheetStatus; @@ -266,6 +265,24 @@ public class StockCostAdjustSheetFullBo extends BaseBo { @ApiModelProperty(hidden = true) private String scId; + /** + * 供应商id + */ + @ApiModelProperty("供应商id") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + public StockAdjustProductBo() { } @@ -101,5 +119,9 @@ public class StockAdjustProductBo extends BaseBo { ProductStock productStock = productStockService.getByProductIdAndScId(dto.getId(), this.scId); this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); + + this.supplierId = dto.getSupplierId(); + this.supplierCode = dto.getSupplierCode(); + this.supplierName = dto.getSupplierName(); } } diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java index 8955330..ae68b78 100644 --- a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/bo/stock/adjust/stock/StockAdjustSheetFullBo.java @@ -3,19 +3,18 @@ package com.lframework.xingyun.sc.bo.stock.adjust.stock; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.lframework.starter.common.constants.StringPool; +import com.lframework.starter.common.utils.ObjectUtil; import com.lframework.starter.common.utils.StringUtil; import com.lframework.starter.web.annotations.convert.EnumConvert; import com.lframework.starter.web.bo.BaseBo; import com.lframework.starter.web.common.utils.ApplicationUtil; import com.lframework.starter.web.utils.EnumUtil; -import com.lframework.xingyun.basedata.entity.Product; -import com.lframework.xingyun.basedata.entity.ProductBrand; -import com.lframework.xingyun.basedata.entity.ProductCategory; -import com.lframework.xingyun.basedata.entity.StoreCenter; +import com.lframework.xingyun.basedata.entity.*; import com.lframework.xingyun.basedata.service.product.ProductBrandService; import com.lframework.xingyun.basedata.service.product.ProductCategoryService; import com.lframework.xingyun.basedata.service.product.ProductService; import com.lframework.xingyun.basedata.service.storecenter.StoreCenterService; +import com.lframework.xingyun.basedata.service.supplier.SupplierService; import com.lframework.xingyun.sc.dto.stock.adjust.stock.StockAdjustSheetFullDto; import com.lframework.xingyun.sc.entity.ProductStock; import com.lframework.xingyun.sc.entity.StockAdjustReason; @@ -269,6 +268,24 @@ public class StockAdjustSheetFullBo extends BaseBo { @ApiModelProperty(hidden = true) private Integer status; + /** + * 供应商id + */ + @ApiModelProperty("供应商id") + private String supplierId; + + /** + * 供应商编号 + */ + @ApiModelProperty("供应商编号") + private String supplierCode; + + /** + * 供应商名称 + */ + @ApiModelProperty("供应商名称") + private String supplierName; + public DetailBo(StockAdjustSheetFullDto.DetailDto dto, String scId, Integer status) { this.scId = scId; @@ -315,6 +332,16 @@ public class StockAdjustSheetFullBo extends BaseBo { this.scId); this.curStockNum = productStock == null ? 0 : productStock.getStockNum(); } + + + SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class); + Supplier supplier = supplierService.findById(product.getSupplierId()); + + if (ObjectUtil.isNotNull(supplier)) { + this.supplierCode = supplier.getCode(); + this.supplierName = supplier.getName(); + this.supplierId = supplier.getId(); + } } } } diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java index c39774e..533c520 100644 --- a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/cost/StockCostAdjustProductDto.java @@ -79,4 +79,18 @@ public class StockCostAdjustProductDto implements BaseDto, Serializable { * 调价前成本价 */ private BigDecimal oriPrice; + /** + * 供应商id + */ + private String supplierId; + + /** + * 供应商编号 + */ + private String supplierCode; + + /** + * 供应商名称 + */ + private String supplierName; } diff --git a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java index b3efb21..9f06c8c 100644 --- a/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java +++ b/xingyun-sc/src/main/java/com/lframework/xingyun/sc/dto/stock/adjust/stock/StockAdjustProductDto.java @@ -2,6 +2,8 @@ package com.lframework.xingyun.sc.dto.stock.adjust.stock; import com.lframework.starter.web.dto.BaseDto; import java.io.Serializable; + +import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @@ -68,4 +70,19 @@ public class StockAdjustProductDto implements BaseDto, Serializable { * 当前库存数量 */ private Integer curStockNum; + + /** + * 供应商id + */ + private String supplierId; + + /** + * 供应商编号 + */ + private String supplierCode; + + /** + * 供应商名称 + */ + private String supplierName; } diff --git a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml index 4027e69..e1a166b 100644 --- a/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml +++ b/xingyun-sc/src/main/resources/mappers/stock/adjust/StockAdjustSheetMapper.xml @@ -36,6 +36,9 @@ + + + @@ -81,11 +84,15 @@ g.sku_code, g.external_code, g.spec, - g.unit + g.unit, + g.supplier_id, + s.code AS supplier_code, + s.name AS supplier_name FROM base_data_product AS g LEFT JOIN base_data_product_category AS c ON c.id = g.category_id LEFT JOIN base_data_product_brand AS b ON b.id = g.brand_id LEFT JOIN recursion_mapping AS rm ON rm.node_id = c.id and rm.node_type = 2 + LEFT JOIN base_data_supplier AS s ON s.id = g.supplier_id