feat(stock): 添加供应商信息并优化查询功能
- 在多个 BO 和 DTO 中添加供应商 ID、编号和名称字段 - 更新查询接口和 Excel 导出模型,支持供应商信息展示 - 在查询 SQL 中添加供应商 ID 条件,支持按供应商筛选
This commit is contained in:
parent
f8e573162e
commit
3ff9f82a49
|
@ -1,21 +1,21 @@
|
|||
package com.lframework.xingyun.sc.bo.stock.product;
|
||||
|
||||
import com.lframework.starter.common.utils.NumberUtil;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
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.entity.ProductStock;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class QueryProductStockBo extends BaseBo<ProductStock> {
|
||||
|
||||
|
@ -91,6 +91,24 @@ public class QueryProductStockBo extends BaseBo<ProductStock> {
|
|||
@ApiModelProperty("含税金额")
|
||||
private BigDecimal taxAmount;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public QueryProductStockBo() {
|
||||
|
||||
}
|
||||
|
@ -118,6 +136,9 @@ public class QueryProductStockBo extends BaseBo<ProductStock> {
|
|||
ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class);
|
||||
ProductBrand productBrand = productBrandService.findById(product.getBrandId());
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
this.productCode = product.getCode();
|
||||
this.productName = product.getName();
|
||||
this.categoryName = productCategory.getName();
|
||||
|
@ -125,5 +146,10 @@ public class QueryProductStockBo extends BaseBo<ProductStock> {
|
|||
|
||||
this.taxPrice = NumberUtil.getNumber(dto.getTaxPrice(), 2);
|
||||
this.taxAmount = NumberUtil.getNumber(dto.getTaxAmount(), 2);
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
this.supplierId = supplier.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,15 @@ package com.lframework.xingyun.sc.bo.stock.product.log;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
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.entity.ProductStockLog;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -143,6 +142,24 @@ public class QueryProductStockLogBo extends BaseBo<ProductStockLog> {
|
|||
@ApiModelProperty("业务类型")
|
||||
private Integer bizType;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public QueryProductStockLogBo() {
|
||||
|
||||
}
|
||||
|
@ -176,6 +193,9 @@ public class QueryProductStockLogBo extends BaseBo<ProductStockLog> {
|
|||
ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class);
|
||||
ProductBrand productBrand = productBrandService.findById(product.getBrandId());
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
this.productCode = product.getCode();
|
||||
this.productName = product.getName();
|
||||
this.categoryName = productCategory.getName();
|
||||
|
@ -186,5 +206,11 @@ public class QueryProductStockLogBo extends BaseBo<ProductStockLog> {
|
|||
this.taxAmount = NumberUtil.getNumber(dto.getTaxAmount(), 2);
|
||||
|
||||
this.bizType = dto.getBizType().getCode();
|
||||
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
this.supplierId = supplier.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ package com.lframework.xingyun.sc.bo.stock.transfer;
|
|||
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.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.transfer.ScTransferOrderFullDto;
|
||||
import com.lframework.xingyun.sc.entity.ProductStock;
|
||||
import com.lframework.xingyun.sc.enums.ScTransferOrderStatus;
|
||||
|
@ -268,6 +267,24 @@ public class ScTransferOrderFullBo extends BaseBo<ScTransferOrderFullDto> {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public DetailBo(ScTransferOrderFullDto.DetailDto dto, String scId, Integer status) {
|
||||
|
||||
this.scId = scId;
|
||||
|
@ -314,6 +331,15 @@ public class ScTransferOrderFullBo extends BaseBo<ScTransferOrderFullDto> {
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,25 @@ public class ScTransferProductBo extends BaseBo<ScTransferProductDto> {
|
|||
@ApiModelProperty(hidden = true)
|
||||
private String scId;
|
||||
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ApiModelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ApiModelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public ScTransferProductBo() {
|
||||
|
||||
}
|
||||
|
@ -101,5 +120,8 @@ public class ScTransferProductBo extends BaseBo<ScTransferProductDto> {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.lframework.xingyun.sc.dto.stock.transfer;
|
|||
|
||||
import com.lframework.starter.web.dto.BaseDto;
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
@ -68,4 +70,20 @@ public class ScTransferProductDto implements BaseDto, Serializable {
|
|||
* 当前库存数量
|
||||
*/
|
||||
private Integer curStockNum;
|
||||
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
private String supplierId;
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
private String supplierName;
|
||||
}
|
||||
|
|
|
@ -2,19 +2,20 @@ package com.lframework.xingyun.sc.excel.stock;
|
|||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.lframework.starter.common.utils.NumberUtil;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
import com.lframework.starter.web.components.excel.ExcelModel;
|
||||
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.entity.ProductStock;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
@ -74,6 +75,19 @@ public class ProductStockExportModel extends BaseBo<ProductStock> implements Exc
|
|||
@ExcelProperty("含税金额")
|
||||
private BigDecimal taxAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ExcelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ExcelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public ProductStockExportModel() {
|
||||
|
||||
}
|
||||
|
@ -108,6 +122,9 @@ public class ProductStockExportModel extends BaseBo<ProductStock> implements Exc
|
|||
ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class);
|
||||
ProductBrand productBrand = productBrandService.findById(product.getBrandId());
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
this.productCode = product.getCode();
|
||||
this.productName = product.getName();
|
||||
this.categoryName = productCategory.getName();
|
||||
|
@ -116,5 +133,10 @@ public class ProductStockExportModel extends BaseBo<ProductStock> implements Exc
|
|||
this.setStockNum(dto.getStockNum());
|
||||
this.setTaxPrice(NumberUtil.getNumber(dto.getTaxPrice(), 2));
|
||||
this.setTaxAmount(NumberUtil.getNumber(dto.getTaxAmount(), 2));
|
||||
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,16 @@ import com.alibaba.excel.annotation.format.DateTimeFormat;
|
|||
import com.lframework.starter.common.constants.StringPool;
|
||||
import com.lframework.starter.common.utils.DateUtil;
|
||||
import com.lframework.starter.common.utils.NumberUtil;
|
||||
import com.lframework.starter.common.utils.ObjectUtil;
|
||||
import com.lframework.starter.web.bo.BaseBo;
|
||||
import com.lframework.starter.web.common.utils.ApplicationUtil;
|
||||
import com.lframework.starter.web.components.excel.ExcelModel;
|
||||
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.entity.ProductStockLog;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
@ -121,6 +120,19 @@ public class ProductStockLogExportModel extends BaseBo<ProductStockLog> implemen
|
|||
@ExcelProperty("业务类型")
|
||||
private String bizType;
|
||||
|
||||
|
||||
/**
|
||||
* 供应商编号
|
||||
*/
|
||||
@ExcelProperty("供应商编号")
|
||||
private String supplierCode;
|
||||
|
||||
/**
|
||||
* 供应商名称
|
||||
*/
|
||||
@ExcelProperty("供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
public ProductStockLogExportModel() {
|
||||
|
||||
}
|
||||
|
@ -153,6 +165,9 @@ public class ProductStockLogExportModel extends BaseBo<ProductStockLog> implemen
|
|||
ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class);
|
||||
ProductBrand productBrand = productBrandService.findById(product.getBrandId());
|
||||
|
||||
SupplierService supplierService = ApplicationUtil.getBean(SupplierService.class);
|
||||
Supplier supplier = supplierService.findById(product.getSupplierId());
|
||||
|
||||
this.productCode = product.getCode();
|
||||
this.productName = product.getName();
|
||||
this.categoryName = productCategory.getName();
|
||||
|
@ -168,5 +183,11 @@ public class ProductStockLogExportModel extends BaseBo<ProductStockLog> implemen
|
|||
this.setCreateTime(DateUtil.toDate(dto.getCreateTime()));
|
||||
this.setBizCode(dto.getBizCode());
|
||||
this.setBizType(dto.getBizType().getDesc());
|
||||
|
||||
|
||||
if (ObjectUtil.isNotNull(supplier)) {
|
||||
this.supplierCode = supplier.getCode();
|
||||
this.supplierName = supplier.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,4 +36,10 @@ public class QueryProductStockVo extends SortPageVo {
|
|||
*/
|
||||
@ApiModelProperty("商品品牌ID")
|
||||
private String brandId;
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
@ApiModelProperty("供应商id")
|
||||
private String supplierId;
|
||||
}
|
||||
|
|
|
@ -60,4 +60,10 @@ public class QueryProductStockLogVo extends SortPageVo {
|
|||
@ApiModelProperty("业务类型")
|
||||
@IsEnum(message = "业务类型不存在!", enumClass = ProductStockBizType.class)
|
||||
private Integer bizType;
|
||||
|
||||
/**
|
||||
* 供应商ID
|
||||
*/
|
||||
@ApiModelProperty("供应商ID")
|
||||
private String supplierId;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
<if test="vo.categoryId != null and vo.categoryId != ''">
|
||||
AND (g.category_id = #{vo.categoryId} OR FIND_IN_SET(#{vo.categoryId}, rm.path))
|
||||
</if>
|
||||
<if test="vo.supplierId != null and vo.supplierId != ''">
|
||||
AND g.supplier_id = #{vo.supplierId}
|
||||
</if>
|
||||
<if test="vo.createStartTime != null">
|
||||
AND gsl.create_time >= #{vo.createStartTime}
|
||||
</if>
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
<if test="vo.categoryId != null and vo.categoryId != ''">
|
||||
AND (g.category_id = #{vo.categoryId} OR FIND_IN_SET(#{vo.categoryId}, rm.path))
|
||||
</if>
|
||||
<if test="vo.supplierId != null and vo.supplierId != ''">
|
||||
AND g.supplier_id = #{vo.supplierId}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY sc.code, g.code
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
<result column="external_code" property="externalCode"/>
|
||||
<result column="spec" property="spec"/>
|
||||
<result column="unit" property="unit"/>
|
||||
<result column="supplier_id" property="supplierId"/>
|
||||
<result column="supplier_name" property="supplierName"/>
|
||||
<result column="supplier_code" property="supplierCode"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="ScTransferOrderDto_sql">
|
||||
|
@ -83,12 +86,16 @@
|
|||
g.sku_code,
|
||||
g.external_code,
|
||||
g.spec,
|
||||
g.unit
|
||||
g.unit,
|
||||
g.supplier_id,
|
||||
s.name AS supplier_name,
|
||||
s.code AS supplier_code
|
||||
FROM tbl_product_stock AS ps
|
||||
INNER JOIN base_data_product AS g ON g.id = ps.product_id AND g.product_type = 1
|
||||
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
|
||||
</sql>
|
||||
|
||||
<select id="query" resultType="com.lframework.xingyun.sc.entity.ScTransferOrder">
|
||||
|
|
Loading…
Reference in New Issue