商品校验调整

This commit is contained in:
2024-11-19 16:37:03 +08:00
parent 2fce514c38
commit 51c160aa26
3 changed files with 145 additions and 91 deletions

View File

@@ -1,13 +1,20 @@
package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.io.Serializable;
import java.util.List;
/**
* (TbProduct)实体类
*
* @author ww
* @since 2024-11-19 15:23:12
*/
@Data
public class TbProduct implements Serializable {
private static final long serialVersionUID = 371589032559725924L;
/**
* id
*/
@@ -20,10 +27,6 @@ public class TbProduct implements Serializable {
* 商品规格
*/
private Integer specId;
/**
* 商户Id
*/
private String merchantId;
private String shopId;
/**
@@ -35,9 +38,14 @@ public class TbProduct implements Serializable {
*/
private String shortTitle;
/**
* 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon
* 普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon
*/
private String type;
/**
* 计量商品 normal
* 多规格商品 sku
*/
private String typeEnum;
/**
* 包装费
*/
@@ -47,12 +55,10 @@ public class TbProduct implements Serializable {
*/
private BigDecimal lowPrice;
private BigDecimal lowMemberPrice;
/**
* 单位Id
*/
private Integer unitId;
private String unitSnap;
/**
* 商品封面图
*/
@@ -69,22 +75,10 @@ public class TbProduct implements Serializable {
* 0--待审核 1审核通过 -1审核失败 -2违规下架
*/
private Integer status;
/**
* 审核失败原因
*/
private String failMsg;
/**
* 是否热销
*/
private Integer isHot;
/**
* 计量商品 normal
* 称重商品 weight
* 多规格商品 sku
* 套餐商品 group
* 时价商品 currentPrice
*/
private String typeEnum;
/**
* 是否回收站 0-否1回收站
*/
@@ -101,6 +95,10 @@ public class TbProduct implements Serializable {
private Long createdAt;
private Long updatedAt;
/**
* 0 固定套餐 1可选套餐
*/
private Integer groupType;
/**
* 套餐内容
*/
@@ -141,6 +139,42 @@ public class TbProduct implements Serializable {
* 库存警戒线
*/
private Integer warnLine;
/**
* 堂食 table 自取 dine 配送 delivery 快递 express
*/
private String showType;
/**
* 称重 价格/千克
*/
private BigDecimal weight;
/**
* 是否允许临时改价
*/
private Integer isTempPrice;
/**
* 日销售上限
*/
private Integer dayLimit;
/**
* 每单销售上限
*/
private Integer singleOrderLimit;
/**
* 每人销售上限
*/
private Integer singlePeopleLimit;
/**
* 周 数组 周一,周二,周日
*/
private String days;
/**
* 可用开始时间
*/
private LocalTime startTime;
/**
* 可用结束时间
*/
private LocalTime endTime;
private int orderCount;
@@ -152,6 +186,4 @@ public class TbProduct implements Serializable {
private List<?> skuList;
private static final long serialVersionUID = 1L;
}

View File

@@ -70,33 +70,33 @@ public class ProductService {
}
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){
List<TbProduct> TbProduct=null;
if(ObjectUtil.isEmpty(categoryId)){
TbProduct=tbProductMapper.selectByShopId(shopId,commdityName);
}else {
TbProduct=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId) {
List<TbProduct> tbProducts = null;
if (ObjectUtil.isEmpty(categoryId)) {
tbProducts = tbProductMapper.selectByShopId(shopId, commdityName);
} else {
tbProducts = tbProductMapper.selectByShopIdAndShopType(shopId, categoryId, commdityName);
}
String day = DateUtils.getDay();
if(ObjectUtil.isNotEmpty(TbProduct)){
TbProduct.parallelStream().forEach(it->{
Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day, "");
it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount);
TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
if(ObjectUtil.isEmpty(tbProductSpec)){
tbProductSpec=new TbProductSpec();
if (ObjectUtil.isNotEmpty(tbProducts)) {
tbProducts.parallelStream().forEach(it -> {
Integer orderCount = tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(), it.getId().toString(), masterId, day, "");
it.setOrderCount((ObjectUtil.isNull(orderCount) || ObjectUtil.isEmpty(orderCount)) ? 0 : orderCount);
TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
if (ObjectUtil.isEmpty(tbProductSpec)) {
tbProductSpec = new TbProductSpec();
}
it.setTbProductSpec(tbProductSpec);
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
if(ObjectUtil.isEmpty(skuResult)){
skuResult=new TbProductSkuResult();
TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
if (ObjectUtil.isEmpty(skuResult)) {
skuResult = new TbProductSkuResult();
}
it.setProductSkuResult(skuResult);
});
}
return Result.success(CodeEnum.SUCCESS,TbProduct);
return Result.success(CodeEnum.SUCCESS, tbProducts);
}