商品校验调整

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; package com.chaozhanggui.system.cashierservice.entity;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalTime;
import java.io.Serializable;
import java.util.List; import java.util.List;
/**
* (TbProduct)实体类
*
* @author ww
* @since 2024-11-19 15:23:12
*/
@Data @Data
public class TbProduct implements Serializable { public class TbProduct implements Serializable {
private static final long serialVersionUID = 371589032559725924L;
/** /**
* id * id
*/ */
@@ -20,10 +27,6 @@ public class TbProduct implements Serializable {
* 商品规格 * 商品规格
*/ */
private Integer specId; private Integer specId;
/**
* 商户Id
*/
private String merchantId;
private String shopId; private String shopId;
/** /**
@@ -35,9 +38,14 @@ public class TbProduct implements Serializable {
*/ */
private String shortTitle; private String shortTitle;
/** /**
* 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon * 普通商品 normal 套餐商品 package 称重商品 weigh 团购券 coupon
*/ */
private String type; private String type;
/**
* 计量商品 normal
* 多规格商品 sku
*/
private String typeEnum;
/** /**
* 包装费 * 包装费
*/ */
@@ -47,12 +55,10 @@ public class TbProduct implements Serializable {
*/ */
private BigDecimal lowPrice; private BigDecimal lowPrice;
private BigDecimal lowMemberPrice;
/** /**
* 单位Id * 单位Id
*/ */
private Integer unitId; private Integer unitId;
private String unitSnap;
/** /**
* 商品封面图 * 商品封面图
*/ */
@@ -69,22 +75,10 @@ public class TbProduct implements Serializable {
* 0--待审核 1审核通过 -1审核失败 -2违规下架 * 0--待审核 1审核通过 -1审核失败 -2违规下架
*/ */
private Integer status; private Integer status;
/**
* 审核失败原因
*/
private String failMsg;
/** /**
* 是否热销 * 是否热销
*/ */
private Integer isHot; private Integer isHot;
/**
* 计量商品 normal
* 称重商品 weight
* 多规格商品 sku
* 套餐商品 group
* 时价商品 currentPrice
*/
private String typeEnum;
/** /**
* 是否回收站 0-否1回收站 * 是否回收站 0-否1回收站
*/ */
@@ -101,6 +95,10 @@ public class TbProduct implements Serializable {
private Long createdAt; private Long createdAt;
private Long updatedAt; private Long updatedAt;
/**
* 0 固定套餐 1可选套餐
*/
private Integer groupType;
/** /**
* 套餐内容 * 套餐内容
*/ */
@@ -141,6 +139,42 @@ public class TbProduct implements Serializable {
* 库存警戒线 * 库存警戒线
*/ */
private Integer warnLine; 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; private int orderCount;
@@ -152,6 +186,4 @@ public class TbProduct implements Serializable {
private List<?> skuList; 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){ public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId) {
List<TbProduct> TbProduct=null; List<TbProduct> tbProducts = null;
if(ObjectUtil.isEmpty(categoryId)){ if (ObjectUtil.isEmpty(categoryId)) {
TbProduct=tbProductMapper.selectByShopId(shopId,commdityName); tbProducts = tbProductMapper.selectByShopId(shopId, commdityName);
}else { } else {
TbProduct=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName); tbProducts = tbProductMapper.selectByShopIdAndShopType(shopId, categoryId, commdityName);
} }
String day = DateUtils.getDay(); String day = DateUtils.getDay();
if(ObjectUtil.isNotEmpty(TbProduct)){ if (ObjectUtil.isNotEmpty(tbProducts)) {
TbProduct.parallelStream().forEach(it->{ tbProducts.parallelStream().forEach(it -> {
Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day, ""); Integer orderCount = tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(), it.getId().toString(), masterId, day, "");
it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount); it.setOrderCount((ObjectUtil.isNull(orderCount) || ObjectUtil.isEmpty(orderCount)) ? 0 : orderCount);
TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId()); TbProductSpec tbProductSpec = tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
if(ObjectUtil.isEmpty(tbProductSpec)){ if (ObjectUtil.isEmpty(tbProductSpec)) {
tbProductSpec=new TbProductSpec(); tbProductSpec = new TbProductSpec();
} }
it.setTbProductSpec(tbProductSpec); it.setTbProductSpec(tbProductSpec);
TbProductSkuResult skuResult=tbProductSkuResultMapper.selectByPrimaryKey(it.getId()); TbProductSkuResult skuResult = tbProductSkuResultMapper.selectByPrimaryKey(it.getId());
if(ObjectUtil.isEmpty(skuResult)){ if (ObjectUtil.isEmpty(skuResult)) {
skuResult=new TbProductSkuResult(); skuResult = new TbProductSkuResult();
} }
it.setProductSkuResult(skuResult); it.setProductSkuResult(skuResult);
}); });
} }
return Result.success(CodeEnum.SUCCESS,TbProduct); return Result.success(CodeEnum.SUCCESS, tbProducts);
} }

View File

@@ -1,45 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbProductMapper"> <mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbProductMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbProduct" id="BaseResultMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="categoryId" column="category_id" jdbcType="VARCHAR"/>
<result property="specId" column="spec_id" jdbcType="INTEGER"/>
<result property="merchantId" column="merchant_id" jdbcType="VARCHAR"/>
<result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="shortTitle" column="short_title" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="packFee" column="pack_fee" jdbcType="DECIMAL"/>
<result property="lowPrice" column="low_price" jdbcType="DECIMAL"/>
<result property="lowMemberPrice" column="low_member_price" jdbcType="DECIMAL"/>
<result property="unitId" column="unit_id" jdbcType="INTEGER"/>
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
<result property="images" column="images" jdbcType="VARCHAR"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="failMsg" column="fail_msg" jdbcType="VARCHAR"/>
<result property="isHot" column="is_hot" jdbcType="INTEGER"/>
<result property="typeEnum" column="type_enum" jdbcType="VARCHAR"/>
<result property="isDel" column="is_del" jdbcType="INTEGER"/>
<result property="isStock" column="is_stock" jdbcType="INTEGER"/>
<result property="isPauseSale" column="is_pause_sale" jdbcType="INTEGER"/>
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
<result property="specTableHeaders" column="spec_table_headers" jdbcType="VARCHAR"/>
<result property="realSalesNumber" column="real_sales_number" jdbcType="INTEGER"/>
<result property="stockNumber" column="stock_number" jdbcType="INTEGER"/>
<result property="isGrounding" column="is_grounding" jdbcType="INTEGER"/>
<result property="isRefundStock" column="is_refund_stock" jdbcType="INTEGER"/>
<result property="warnLine" column="warn_line" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List"> <resultMap type="com.chaozhanggui.system.cashierservice.entity.TbProduct" id="BaseResultMap">
id <result property="id" column="id" jdbcType="INTEGER"/>
, category_id, spec_id, merchant_id, shop_id, name, short_title, type, pack_fee, low_price, low_member_price, <result property="categoryId" column="category_id" jdbcType="VARCHAR"/>
unit_id, cover_img, images, sort, status, fail_msg, is_hot, type_enum, is_del, is_stock, is_pause_sale, <result property="specId" column="spec_id" jdbcType="INTEGER"/>
created_at, updated_at, group_snap, spec_info, select_spec, <result property="shopId" column="shop_id" jdbcType="VARCHAR"/>
spec_table_headers, group_category_id, real_sales_number, stock_number, is_grounding, is_refund_stock, warn_line </sql> <result property="name" column="name" jdbcType="VARCHAR"/>
<result property="shortTitle" column="short_title" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="packFee" column="pack_fee" jdbcType="NUMERIC"/>
<result property="lowPrice" column="low_price" jdbcType="NUMERIC"/>
<result property="unitId" column="unit_id" jdbcType="INTEGER"/>
<result property="coverImg" column="cover_img" jdbcType="VARCHAR"/>
<result property="images" column="images" jdbcType="VARCHAR"/>
<result property="sort" column="sort" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="isHot" column="is_hot" jdbcType="INTEGER"/>
<result property="typeEnum" column="type_enum" jdbcType="VARCHAR"/>
<result property="isDel" column="is_del" jdbcType="INTEGER"/>
<result property="isStock" column="is_stock" jdbcType="INTEGER"/>
<result property="isPauseSale" column="is_pause_sale" jdbcType="INTEGER"/>
<result property="createdAt" column="created_at" jdbcType="INTEGER"/>
<result property="updatedAt" column="updated_at" jdbcType="INTEGER"/>
<result property="groupType" column="group_type" jdbcType="INTEGER"/>
<result property="groupSnap" column="group_snap" jdbcType="VARCHAR"/>
<result property="specInfo" column="spec_info" jdbcType="VARCHAR"/>
<result property="selectSpec" column="select_spec" jdbcType="VARCHAR"/>
<result property="specTableHeaders" column="spec_table_headers" jdbcType="VARCHAR"/>
<result property="groupCategoryId" column="group_category_id" jdbcType="VARCHAR"/>
<result property="realSalesNumber" column="real_sales_number" jdbcType="INTEGER"/>
<result property="stockNumber" column="stock_number" jdbcType="INTEGER"/>
<result property="isGrounding" column="is_grounding" jdbcType="INTEGER"/>
<result property="isRefundStock" column="is_refund_stock" jdbcType="INTEGER"/>
<result property="warnLine" column="warn_line" jdbcType="INTEGER"/>
<result property="showType" column="show_type" jdbcType="VARCHAR"/>
<result property="weight" column="weight" jdbcType="NUMERIC"/>
<result property="isTempPrice" column="is_temp_price" jdbcType="INTEGER"/>
<result property="dayLimit" column="day_limit" jdbcType="INTEGER"/>
<result property="singleOrderLimit" column="single_order_limit" jdbcType="INTEGER"/>
<result property="singlePeopleLimit" column="single_people_limit" jdbcType="INTEGER"/>
<result property="days" column="days" jdbcType="VARCHAR"/>
<result property="startTime" column="start_time" jdbcType="VARCHAR"/>
<result property="endTime" column="end_time" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id, category_id, spec_id, merchant_id, shop_id, name, short_title,
type, pack_fee, low_price, unit_id, cover_img, images, sort, status,
is_hot, type_enum, is_del, is_stock, is_pause_sale, created_at, updated_at,
group_type, group_snap, spec_info, select_spec, spec_table_headers,
group_category_id, real_sales_number, stock_number, is_grounding,
is_refund_stock, warn_line, show_type, weight, is_temp_price,
day_limit, single_order_limit, single_people_limit, days, start_time, end_time </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
@@ -49,28 +63,30 @@
</select> </select>
<select id="selectByShopId" resultMap="BaseResultMap"> <select id="selectByShopId" resultMap="BaseResultMap">
select * from tb_product where shop_id=#{shopId} and status=1 and is_del = 0 and is_grounding = 1 and type_enum in ('normal','sku','currentPrice','weight') select * from tb_product where shop_id=#{shopId} and status=1 and is_del = 0 and is_grounding = 1 and type != 'coupon'
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and name like CONCAT('%',#{commdityName},'%') and name like CONCAT('%',#{commdityName},'%')
</if> </if>
order by `sort` asc order by `sort` asc
</select> </select>
<select id="selectByShopIdAndCheckGrounding" resultMap="BaseResultMap"> <select id="selectByShopIdAndCheckGrounding" resultMap="BaseResultMap">
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id and b.is_grounding=1 and b.is_del=0
where a.shop_id=#{shopId} and a.status=1 and a.is_del = 0 and a.is_grounding = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status = 1 and a.is_grounding = 1
and a.type != 'coupon' and a.is_del = 0
and a.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and a.start_time &lt;= CURRENT_TIMESTAMP and a.end_time &gt;= CURRENT_TIMESTAMP
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')
</if> </if>
and b.is_grounding=1 GROUP BY a.id ORDER BY a.`sort` GROUP BY a.id ORDER BY a.`sort`
</select> </select>
<select id="selectByShopIdAndShopType" resultMap="BaseResultMap"> <select id="selectByShopIdAndShopType" resultMap="BaseResultMap">
select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and is_del = 0 and is_grounding = 1 and type_enum in ('normal','sku','currentPrice','weight') select * from tb_product where shop_id=#{shopId} and status=1 and category_id=#{categoryId} and is_del = 0 and is_grounding = 1 and type != 'coupon'
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and name like CONCAT('%',#{commdityName},'%') and name like CONCAT('%',#{commdityName},'%')
@@ -84,7 +100,9 @@
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_del = 0 and a.is_grounding = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status=1 and a.category_id=#{categoryId} and a.is_grounding = 1
and a.type != 'coupon' and a.is_del = 0
and a.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and a.start_time &lt;= CURRENT_TIMESTAMP and a.end_time &gt;= CURRENT_TIMESTAMP
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')
@@ -96,18 +114,22 @@
select a.* from tb_product as a select a.* from tb_product as a
left join tb_product_sku as b on a.id = b.product_id left join tb_product_sku as b on a.id = b.product_id
where a.shop_id=#{shopId} and a.status=1 and a.is_del = 0 and a.is_grounding = 1 and a.type_enum in ('normal','sku','currentPrice','weight') where a.shop_id=#{shopId} and a.status=1 and a.is_grounding = 0
and a.type != 'coupon' and a.is_del = 0
and a.days LIKE concat('%',DAYNAME(CURRENT_DATE),'%') and a.start_time &lt;= CURRENT_TIMESTAMP and a.end_time &gt;= CURRENT_TIMESTAMP
<if test="commdityName != null and commdityName!='' "> <if test="commdityName != null and commdityName!='' ">
and a.name like CONCAT('%',#{commdityName},'%') and a.name like CONCAT('%',#{commdityName},'%')
</if> </if>
and b.is_grounding=0 GROUP BY a.id ORDER BY a.`sort` GROUP BY a.id ORDER BY a.`sort`
</select> </select>
<select id="countOrderByshopIdAndProductId" resultType="INTEGER"> <select id="countOrderByshopIdAndProductId" resultType="INTEGER">
SELECT SELECT
IFNULL(sum( number ) ,0) IFNULL(sum( number ) ,0)
FROM FROM
tb_cashier_cart tb_cashier_cart
WHERE WHERE
@@ -117,7 +139,7 @@
and master_id = #{masterId} and master_id = #{masterId}
and table_id = #{tableId} and table_id = #{tableId}
and trade_day = #{day} and trade_day = #{day}
group by shop_id,product_id group by shop_id,product_id
</select> </select>
<select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo"> <select id="selectBySkuId" resultType="com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo">
@@ -143,5 +165,5 @@
and c.product_sku_id=#{skuId} and c.product_sku_id=#{skuId}
group by i.id group by i.id
order by i.id order by i.id
</select> </select>
</mapper> </mapper>