feat(product): 查询产品时增加销售价和库存信息

- 在 QueryProductBo 中添加销售价和库存字段
- 实现 ProductService 中的 getStock 方法
- 在 ProductMapper 中添加 getStock 接口- 更新 ProductMapper.xml,添加库存查询 SQL
- 移除客户和供应商相关代码中的助记码字段
- 调整销售订单、采购订单等中的审批人和抄送人 ID
- 新增 YdoolPersonIds 枚举类,用于定义审批人和抄送人 ID
This commit is contained in:
lijiaqi 2024-11-19 13:43:47 +08:00
parent 128b28e62f
commit 00c1db8105
19 changed files with 112 additions and 40 deletions

View File

@ -1,5 +1,6 @@
package com.lframework.xingyun.basedata.bo.product.info;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lframework.starter.common.constants.StringPool;
import com.lframework.starter.web.annotations.convert.EnumConvert;
@ -8,9 +9,14 @@ 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.ProductSale;
import com.lframework.xingyun.basedata.service.product.ProductBrandService;
import com.lframework.xingyun.basedata.service.product.ProductCategoryService;
import com.lframework.xingyun.basedata.service.product.ProductSaleService;
import com.lframework.xingyun.basedata.service.product.ProductService;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import lombok.Data;
@ -86,6 +92,19 @@ public class QueryProductBo extends BaseBo<Product> {
@JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
private LocalDateTime updateTime;
/**
* 销售价
*/
@ApiModelProperty("销售价")
private BigDecimal salePrice;
/**
* 库存
*/
@ApiModelProperty("库存")
private Integer stock;
public QueryProductBo() {
}
@ -105,5 +124,12 @@ public class QueryProductBo extends BaseBo<Product> {
ProductBrandService productBrandService = ApplicationUtil.getBean(ProductBrandService.class);
ProductBrand brand = productBrandService.findById(dto.getBrandId());
this.brandName = brand.getName();
ProductSaleService productSaleService = ApplicationUtil.getBean(ProductSaleService.class);
ProductSale productSale = productSaleService.getById(dto.getId());
this.salePrice = productSale.getPrice();
ProductService productService = ApplicationUtil.getBean(ProductService.class);
this.stock = productService.getStock(dto.getId());
}
}

View File

@ -54,10 +54,10 @@ public class CustomerImportListener extends ExcelImportListener<CustomerImportMo
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“名称”不能为空");
}
if (StringUtil.isBlank(data.getMnemonicCode())) {
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空");
}
// if (StringUtil.isBlank(data.getMnemonicCode())) {
// throw new DefaultClientException(
// "" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空");
// }
if (StringUtil.isBlank(data.getSettleType())) {
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“结账方式”不能为空");
@ -128,7 +128,7 @@ public class CustomerImportListener extends ExcelImportListener<CustomerImportMo
record.setCode(data.getCode());
record.setName(data.getName());
record.setMnemonicCode(data.getMnemonicCode());
// record.setMnemonicCode(data.getMnemonicCode());
record.setContact(data.getContact());
record.setTelephone(data.getTelephone());
record.setEmail(data.getEmail());

View File

@ -33,9 +33,9 @@ public class CustomerImportModel implements ExcelModel {
/**
* 助记码
*/
@ExcelRequired
@ExcelProperty("助记码")
private String mnemonicCode;
// @ExcelRequired
// @ExcelProperty("助记码")
// private String mnemonicCode;
/**
* 联系人

View File

@ -55,10 +55,10 @@ public class SupplierImportListener extends ExcelImportListener<SupplierImportMo
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“名称”不能为空");
}
if (StringUtil.isBlank(data.getMnemonicCode())) {
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空");
}
// if (StringUtil.isBlank(data.getMnemonicCode())) {
// throw new DefaultClientException(
// "" + context.readRowHolder().getRowIndex() + "行“助记码”不能为空");
// }
if (StringUtil.isBlank(data.getSettleType())) {
throw new DefaultClientException(
"" + context.readRowHolder().getRowIndex() + "行“结账方式”不能为空");
@ -150,7 +150,7 @@ public class SupplierImportListener extends ExcelImportListener<SupplierImportMo
record.setCode(data.getCode());
record.setName(data.getName());
record.setMnemonicCode(data.getMnemonicCode());
// record.setMnemonicCode(data.getMnemonicCode());
record.setContact(data.getContact());
record.setTelephone(data.getTelephone());
record.setEmail(data.getEmail());

View File

@ -34,9 +34,9 @@ public class SupplierImportModel implements ExcelModel {
/**
* 助记码
*/
@ExcelRequired
@ExcelProperty("助记码")
private String mnemonicCode;
// @ExcelRequired
// @ExcelProperty("助记码")
// private String mnemonicCode;
/**
* 联系人

View File

@ -544,6 +544,12 @@ public class ProductServiceImpl extends BaseMpServiceImpl<ProductMapper, Product
return getBaseMapper().getByBrandIds(brandIds, productType);
}
@Override
public Integer getStock(String id) {
Integer stock = this.getBaseMapper().getStock(id);
return ObjectUtil.isNull(stock) ? 0 : stock;
}
@CacheEvict(value = Product.CACHE_NAME, key = "@cacheVariables.tenantId() + #key")
@Override
public void cleanCacheByKey(Serializable key) {

View File

@ -9,9 +9,10 @@ import com.lframework.xingyun.template.core.annotations.permission.DataPermissio
import com.lframework.xingyun.template.core.annotations.sort.Sort;
import com.lframework.xingyun.template.core.annotations.sort.Sorts;
import com.lframework.xingyun.template.core.components.permission.SysDataPermissionDataPermissionType;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
@ -103,4 +104,12 @@ public interface ProductMapper extends BaseMapper<Product> {
*/
List<Product> getByBrandIds(@Param("brandIds") List<String> brandIds,
@Param("productType") Integer productType);
/**
* 查询库存
*
* @param productId
* @return
*/
Integer getStock(@Param("productId") String productId);
}

View File

@ -110,4 +110,12 @@ public interface ProductService extends BaseMpService<Product> {
* @return
*/
List<Product> getByBrandIds(List<String> brandIds, Integer productType);
/**
* 根据ID查询库存
*
* @param id
* @return
*/
Integer getStock(String id);
}

View File

@ -34,8 +34,8 @@ public class CreateCustomerVo implements BaseVo, Serializable {
/**
* 助记码
*/
@ApiModelProperty(value = "助记码", required = true)
@NotBlank(message = "请输入助记码!")
// @ApiModelProperty(value = "助记码", required = true)
// @NotBlank(message = "请输入助记码!")
private String mnemonicCode;
/**

View File

@ -39,8 +39,8 @@ public class UpdateCustomerVo implements BaseVo, Serializable {
/**
* 助记码
*/
@ApiModelProperty(value = "助记码", required = true)
@NotBlank(message = "请输入助记码!")
// @ApiModelProperty(value = "助记码", required = true)
// @NotBlank(message = "请输入助记码!")
private String mnemonicCode;
/**

View File

@ -36,8 +36,8 @@ public class CreateSupplierVo implements BaseVo, Serializable {
/**
* 助记码
*/
@ApiModelProperty(value = "助记码", required = true)
@NotBlank(message = "请输入助记码!")
// @ApiModelProperty(value = "助记码", required = true)
// @NotBlank(message = "请输入助记码!")
private String mnemonicCode;
/**

View File

@ -40,8 +40,8 @@ public class UpdateSupplierVo implements BaseVo, Serializable {
/**
* 助记码
*/
@ApiModelProperty(value = "助记码", required = true)
@NotBlank(message = "请输入助记码!")
// @ApiModelProperty(value = "助记码", required = true)
// @NotBlank(message = "请输入助记码!")
private String mnemonicCode;
/**

View File

@ -163,4 +163,8 @@
</where>
ORDER BY g.code
</select>
<select id="getStock" resultType="java.lang.Integer">
SELECT SUM(stock_num) FROM tbl_product_stock WHERE product_id = #{productId}
</select>
</mapper>

View File

@ -15,20 +15,17 @@ public enum SaleOrderStatus implements BaseEnum<Integer> {
private String desc;
SaleOrderStatus(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getDesc() {
return this.desc;
}
}

View File

@ -0,0 +1,25 @@
package com.lframework.xingyun.sc.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
public enum YdoolPersonIds {
SALE_ORDER_AUDIT_PERSON_IDS("9,262", "销售订单审批人"),
SALE_ORDER_PUSH_PERSON_IDS("9,262", "销售订单抄送人"),
;
@EnumValue
private final String ids;
private final String desc;
YdoolPersonIds(String ids, String desc) {
this.ids = ids;
this.desc = desc;
}
public String getIds() {
return ids;
}
public String getDesc() {
return desc;
}
}

View File

@ -673,8 +673,8 @@ public class PurchaseOrderServiceImpl extends BaseMpServiceImpl<PurchaseOrderMap
.set("order_id", id)
.set("all_money", bo.getTotalAmount())
.set("supplyer", bo.getSupplierName())
.set("audit_person_ids", "120,262")
.set("push_person_ids", "120,262")
.set("audit_person_ids", "9,262")
.set("push_person_ids", "9,262")
.set("remark", bo.getDescription())
.set("url","https://erp.fpvone.cn/#/purchasedet/"+id)
.set("ghd_goodlist_info", list);

View File

@ -729,8 +729,8 @@ public class RetailOutSheetServiceImpl extends
dict.set("user_id", salerCode)
.set("order_id", id)
.set("all_money", bo.getTotalAmount())
.set("audit_person_ids", "120,262")
.set("push_person_ids", "120,262")
.set("audit_person_ids", "9,262")
.set("push_person_ids", "9,262")
.set("remark", bo.getDescription())
.set("url","https://erp.fpvone.cn/#/retaildetail/"+id)
.set("ghd_goodlist_info", list);

View File

@ -53,10 +53,7 @@ import com.lframework.xingyun.sc.entity.SaleConfig;
import com.lframework.xingyun.sc.entity.SaleOrder;
import com.lframework.xingyun.sc.entity.SaleOrderDetail;
import com.lframework.xingyun.sc.entity.SaleOrderDetailBundle;
import com.lframework.xingyun.sc.enums.PurchaseOrderStatus;
import com.lframework.xingyun.sc.enums.RetailOutSheetStatus;
import com.lframework.xingyun.sc.enums.SaleOrderStatus;
import com.lframework.xingyun.sc.enums.ScOpLogType;
import com.lframework.xingyun.sc.enums.*;
import com.lframework.xingyun.sc.mappers.SaleOrderMapper;
import com.lframework.xingyun.sc.service.paytype.OrderPayTypeService;
import com.lframework.xingyun.sc.service.sale.SaleConfigService;
@ -634,8 +631,8 @@ public class SaleOrderServiceImpl extends BaseMpServiceImpl<SaleOrderMapper, Sal
.set("order_id", id)
.set("all_money", result.getTotalAmount())
.set("customer", result.getCustomerName())
.set("audit_person_ids", "120,262")
.set("push_person_ids", "120,262")
.set("audit_person_ids", YdoolPersonIds.SALE_ORDER_AUDIT_PERSON_IDS.getIds())
.set("push_person_ids", YdoolPersonIds.SALE_ORDER_PUSH_PERSON_IDS.getIds())
.set("remark", result.getDescription())
.set("url","https://erp.fpvone.cn/#/saledetail/"+id)
.set("ghd_goodlist_info", list);

View File

@ -532,8 +532,8 @@ public class StockAdjustSheetServiceImpl extends
.set("order_id", id)
.set("biz_type", StockAdjustSheetBizType.descByCode(bo.getBizType()))
.set("reason_name", bo.getReasonName())
.set("audit_person_ids", "120,262")
.set("push_person_ids", "120,262")
.set("audit_person_ids", "9,262")
.set("push_person_ids", "9,262")
.set("remark", bo.getDescription())
.set("url","https://erp.fpvone.cn/#/stockdetail/"+id)
.set("ghd_goodlist_info", list);