商品多余字段删除
This commit is contained in:
@@ -1,45 +1,26 @@
|
||||
package com.chaozhanggui.system.cashierservice.dao;
|
||||
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProduct;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbProductWithBLOBs;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.ProConsSkuInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TbProductMapper {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(TbProductWithBLOBs record);
|
||||
|
||||
int insertSelective(TbProductWithBLOBs record);
|
||||
|
||||
TbProductWithBLOBs selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TbProductWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(TbProductWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(TbProduct record);
|
||||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
|
||||
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProductWithBLOBs> selectByShopIdAndShopTypeUnGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
TbProduct selectByPrimaryKey(Integer id);
|
||||
|
||||
List<TbProduct> selectByShopId(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndCheckGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
List<TbProduct> selectByShopIdAndShopType(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndShopTypeCheckGrounding(@Param("shopId") String shopId, @Param("categoryId") String categoryId,@Param("commdityName") String commdityName);
|
||||
List<TbProduct> selectByShopIdAndShopTypeUnGrounding(@Param("shopId") String shopId,@Param("commdityName") String commdityName);
|
||||
|
||||
Integer countOrderByshopIdAndProductId(@Param("shopId") String shopId, @Param("productId") String productId, @Param("masterId") String masterId,@Param("day") String day, @Param("tableId") String tableId);
|
||||
|
||||
@Update("update tb_product set stock_number = stock_number - #{num,jdbcType=INTEGER} where id = #{productId}")
|
||||
void updateStockById(@Param("productId")Integer productId, @Param("num")Integer num);
|
||||
|
||||
|
||||
|
||||
@@ -1,154 +1,160 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TbProduct implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 商品分类
|
||||
*/
|
||||
private String categoryId;
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
*/
|
||||
private Integer specId;
|
||||
|
||||
private String sourcePath;
|
||||
|
||||
private Integer brandId;
|
||||
|
||||
/**
|
||||
* 商户Id
|
||||
*/
|
||||
private String merchantId;
|
||||
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 短标题--促销语
|
||||
*/
|
||||
private String shortTitle;
|
||||
|
||||
/**
|
||||
* 商品类型(属性):REAL- 实物商品 VIR---虚拟商品
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 商品最低价
|
||||
*/
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unitSnap;
|
||||
|
||||
private String coverImg;
|
||||
|
||||
private String shareImg;
|
||||
|
||||
private String videoCoverImg;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
private Integer limitNumber;
|
||||
|
||||
private Integer productScore;
|
||||
|
||||
private Byte status;
|
||||
|
||||
private String failMsg;
|
||||
|
||||
private Byte isRecommend;
|
||||
|
||||
private Byte isHot;
|
||||
|
||||
private Byte isNew;
|
||||
|
||||
private Byte isOnSale;
|
||||
|
||||
private Byte isShow;
|
||||
|
||||
private String typeEnum;
|
||||
|
||||
/**
|
||||
* 是否共享库存
|
||||
* 单位Id
|
||||
*/
|
||||
private Byte isDistribute;
|
||||
|
||||
private Byte isDel;
|
||||
|
||||
private Byte isStock;
|
||||
|
||||
private Byte isPauseSale;
|
||||
|
||||
private Byte isFreeFreight;
|
||||
|
||||
private Long freightId;
|
||||
|
||||
private String strategyType;
|
||||
|
||||
private Integer strategyId;
|
||||
|
||||
private Byte isVip;
|
||||
|
||||
private Byte isDelete;
|
||||
private Integer unitId;
|
||||
private String unitSnap;
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
/**
|
||||
* 商品图片(第一张为缩略图,其他为详情)
|
||||
*/
|
||||
private String images;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 0--待审核 1审核通过 -1审核失败 -2违规下架
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 审核失败原因
|
||||
*/
|
||||
private String failMsg;
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
private Integer isHot;
|
||||
/**
|
||||
* 计量商品 normal
|
||||
* 称重商品 weight
|
||||
* 多规格商品 sku
|
||||
* 套餐商品 group
|
||||
* 时价商品 currentPrice
|
||||
*/
|
||||
private String typeEnum;
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站
|
||||
*/
|
||||
private Integer isDel;
|
||||
/**
|
||||
* 是否开启库存
|
||||
*/
|
||||
private Integer isStock;
|
||||
/**
|
||||
* 是否暂停销售
|
||||
*/
|
||||
private Integer isPauseSale;
|
||||
/**
|
||||
* 是否删除0不删1删除
|
||||
*/
|
||||
private Integer isDelete;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
|
||||
private Double baseSalesNumber;
|
||||
|
||||
private Integer realSalesNumber;
|
||||
|
||||
private Integer salesNumber;
|
||||
|
||||
private Integer thumbCount;
|
||||
|
||||
private Integer storeCount;
|
||||
|
||||
private Integer furnishMeal;
|
||||
|
||||
private Integer furnishExpress;
|
||||
|
||||
private Integer furnishDraw;
|
||||
|
||||
private Integer furnishVir;
|
||||
|
||||
private Byte isCombo;
|
||||
|
||||
private Byte isShowCash;
|
||||
|
||||
private Byte isShowMall;
|
||||
|
||||
private Byte isNeedExamine;
|
||||
|
||||
private Byte showOnMallStatus;
|
||||
|
||||
private Long showOnMallTime;
|
||||
|
||||
private String showOnMallErrorMsg;
|
||||
|
||||
private Byte enableLabel;
|
||||
|
||||
private String taxConfigId;
|
||||
|
||||
/**
|
||||
* 套餐内容
|
||||
*/
|
||||
private String groupSnap;
|
||||
/**
|
||||
* 规格详情
|
||||
*/
|
||||
private String specInfo;
|
||||
/**
|
||||
* 已选择的规格
|
||||
*/
|
||||
private String selectSpec;
|
||||
/**
|
||||
* 已选规格表格头部
|
||||
*/
|
||||
private String specTableHeaders;
|
||||
|
||||
/**
|
||||
* 团购卷分类,可有多个分类
|
||||
*/
|
||||
private String groupCategoryId;
|
||||
/**
|
||||
* 销量
|
||||
*/
|
||||
private Integer realSalesNumber;
|
||||
/**
|
||||
* 商品级库存数量
|
||||
*/
|
||||
private Integer stockNumber;
|
||||
/**
|
||||
* 是否上架
|
||||
*/
|
||||
private Integer isGrounding;
|
||||
/**
|
||||
* 退款是否退回库存
|
||||
*/
|
||||
private Integer isRefundStock;
|
||||
/**
|
||||
* 库存警戒线
|
||||
*/
|
||||
private Integer warnLine;
|
||||
|
||||
private Integer warnLine = 0;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private int orderCount;
|
||||
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private TbProductSpec tbProductSpec;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private TbProductSkuResult productSkuResult;
|
||||
|
||||
private Object groundingSpecInfo;
|
||||
private List<?> skuList;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class TbProductStockDetail implements Serializable {
|
||||
|
||||
private String productName;
|
||||
|
||||
private Byte isStock;
|
||||
private Integer isStock;
|
||||
|
||||
private String specSnap;
|
||||
|
||||
@@ -90,11 +90,11 @@ public class TbProductStockDetail implements Serializable {
|
||||
this.productName = productName == null ? null : productName.trim();
|
||||
}
|
||||
|
||||
public Byte getIsStock() {
|
||||
public Integer getIsStock() {
|
||||
return isStock;
|
||||
}
|
||||
|
||||
public void setIsStock(Byte isStock) {
|
||||
public void setIsStock(Integer isStock) {
|
||||
this.isStock = isStock;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private Object groundingSpecInfo;
|
||||
private String images;
|
||||
|
||||
private String video;
|
||||
|
||||
private String notice;
|
||||
|
||||
private String groupSnap;
|
||||
|
||||
private String specInfo;
|
||||
|
||||
private String selectSpec;
|
||||
|
||||
private List<?> skuList;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void setGroundingSpecInfo(Object groundingSpecInfo) {
|
||||
this.groundingSpecInfo = groundingSpecInfo;
|
||||
}
|
||||
|
||||
public void setSkuList(List<?> skuList) {
|
||||
this.skuList = skuList;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images == null ? null : images.trim();
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video == null ? null : video.trim();
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
this.notice = notice == null ? null : notice.trim();
|
||||
}
|
||||
|
||||
public void setGroupSnap(String groupSnap) {
|
||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||
}
|
||||
|
||||
public void setSpecInfo(String specInfo) {
|
||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||
}
|
||||
|
||||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class ConsMsgConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(skuWithBLOBs.getProductId()));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(skuWithBLOBs.getProductId()));
|
||||
if (Objects.isNull(product)) {
|
||||
log.info("商品信息不存在");
|
||||
return;
|
||||
|
||||
@@ -386,7 +386,7 @@ public class DutyService {
|
||||
if (tbProductSku == null) {
|
||||
return;
|
||||
}
|
||||
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));
|
||||
TbProduct product = productMapper.selectByPrimaryKey(Integer.valueOf(tbProductSku.getProductId()));
|
||||
|
||||
|
||||
if (ObjectUtil.isNotEmpty(product)) {
|
||||
|
||||
@@ -601,7 +601,7 @@ public class OrderService {
|
||||
if (Objects.nonNull(skuWithBLOBs)) {
|
||||
cashierCart.setSkuName(skuWithBLOBs.getSpecSnap());
|
||||
}
|
||||
TbProductWithBLOBs tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProduct tbProduct = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if (Objects.nonNull(tbProduct)) {
|
||||
cashierCart.setSelectSpec(tbProduct.getSelectSpec());
|
||||
if (tbProduct.getSpecId() != null) {
|
||||
@@ -643,7 +643,7 @@ public class OrderService {
|
||||
return Result.success(CodeEnum.SUCCESS, returnCart(dto));
|
||||
}
|
||||
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if (ObjectUtil.isEmpty(product)) {
|
||||
return Result.fail(CodeEnum.PRODUCTINFOERROR);
|
||||
}
|
||||
@@ -901,7 +901,7 @@ public class OrderService {
|
||||
orderDetail.setPlaceNum(currentPlaceNum);
|
||||
}
|
||||
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if ("takeaway".equals(orderVo.getSendType()) || "takeself".equals(orderVo.getSendType())) {
|
||||
if (Objects.nonNull(product.getPackFee())) {
|
||||
packAMount = packAMount.add(product.getPackFee());
|
||||
@@ -1269,7 +1269,7 @@ public class OrderService {
|
||||
}
|
||||
List<TbCashierCart> list = cashierCartMapper.selectAllByMarketId(day, String.valueOf(cartVo.getShopId()), cartVo.getMasterId());
|
||||
for (TbCashierCart cashierCart : list) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(cashierCart.getProductId()));
|
||||
if ("true".equals(cartVo.getStatus())) {
|
||||
cashierCart.setTotalAmount(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(product.getPackFee())));
|
||||
cashierCart.setPackFee(new BigDecimal(cashierCart.getTotalNumber()).multiply(product.getPackFee()));
|
||||
|
||||
@@ -1424,7 +1424,7 @@ public class PayService {
|
||||
detail = tbOrderDetailMapper.selectByPrimaryKey(detail.getId());
|
||||
|
||||
TbProductSku productSku = productSkuMapper.selectByPrimaryKey(detail.getProductSkuId());
|
||||
TbProductWithBLOBs product = productMapper.selectByPrimaryKey(detail.getProductId());
|
||||
TbProduct product = productMapper.selectByPrimaryKey(detail.getProductId());
|
||||
|
||||
TbProductStockDetail tbProductStockDetail = new TbProductStockDetail();
|
||||
tbProductStockDetail.setCreatedAt(System.currentTimeMillis());
|
||||
|
||||
@@ -71,16 +71,16 @@ public class ProductService {
|
||||
|
||||
|
||||
public Result queryCommodityInfo(String shopId, String categoryId, String commdityName, Integer page, Integer pageSize, String masterId){
|
||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
List<TbProduct> TbProduct=null;
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||
TbProduct=tbProductMapper.selectByShopId(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||
TbProduct=tbProductMapper.selectByShopIdAndShopType(shopId,categoryId,commdityName);
|
||||
}
|
||||
|
||||
String day = DateUtils.getDay();
|
||||
if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){
|
||||
tbProductWithBLOBs.parallelStream().forEach(it->{
|
||||
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());
|
||||
@@ -96,7 +96,7 @@ public class ProductService {
|
||||
it.setProductSkuResult(skuResult);
|
||||
});
|
||||
}
|
||||
return Result.success(CodeEnum.SUCCESS,tbProductWithBLOBs);
|
||||
return Result.success(CodeEnum.SUCCESS,TbProduct);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,21 +111,21 @@ public class ProductService {
|
||||
}
|
||||
|
||||
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) {
|
||||
List<TbProductWithBLOBs> tbProductWithBLOBs=null;
|
||||
List<TbProduct> tbProducts=null;
|
||||
PageHelperUtil.startPage(page,pageSize);
|
||||
if(ObjectUtil.isEmpty(categoryId)){
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
tbProducts=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||
}else {
|
||||
if (Integer.valueOf(categoryId).equals(-1)) {
|
||||
tbProductWithBLOBs = tbProductMapper.selectByShopIdAndShopTypeUnGrounding(shopId,commdityName);
|
||||
tbProducts = tbProductMapper.selectByShopIdAndShopTypeUnGrounding(shopId,commdityName);
|
||||
}else {
|
||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
tbProducts=tbProductMapper.selectByShopIdAndShopTypeCheckGrounding(shopId,categoryId,commdityName);
|
||||
}
|
||||
}
|
||||
|
||||
String day = DateUtils.getDay();
|
||||
if(ObjectUtil.isNotEmpty(tbProductWithBLOBs)){
|
||||
tbProductWithBLOBs.parallelStream().forEach(it->{
|
||||
if(ObjectUtil.isNotEmpty(tbProducts)){
|
||||
tbProducts.parallelStream().forEach(it->{
|
||||
Integer orderCount=tbProductMapper.countOrderByshopIdAndProductId(it.getShopId(),it.getId().toString(),masterId,day, tableId);
|
||||
it.setOrderCount((ObjectUtil.isNull(orderCount)||ObjectUtil.isEmpty(orderCount))?0:orderCount);
|
||||
TbProductSpec tbProductSpec= tbProductSpecMapper.selectByPrimaryKey(it.getSpecId());
|
||||
@@ -143,7 +143,7 @@ public class ProductService {
|
||||
it.setGroundingSpecInfo(querySpec(Integer.valueOf(shopId), it.getId()));
|
||||
});
|
||||
}
|
||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||
PageInfo pageInfo=new PageInfo(tbProducts);
|
||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ProductService {
|
||||
}
|
||||
|
||||
public void decrStock(String productId, String skuId, int decrNum) {
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(Integer.valueOf(productId));
|
||||
if (product.getIsStock() == 1) {
|
||||
if (tbProductMapper.decrStock(productId, decrNum) < 1) {
|
||||
throw new MsgException("库存不足,下单失败");
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TbGroupOrderInfoService {
|
||||
*/
|
||||
public Result queryById(Integer id) {
|
||||
TbGroupOrderInfo tbGroupOrderInfo = tbGroupOrderInfoMapper.queryById(id);
|
||||
TbProductWithBLOBs tbProduct = productMapper.selectByPrimaryKey(tbGroupOrderInfo.getProId());
|
||||
TbProduct tbProduct = productMapper.selectByPrimaryKey(tbGroupOrderInfo.getProId());
|
||||
TbProductSkuWithBLOBs tbProductSku = skuMapper.selectByProduct(tbGroupOrderInfo.getProId());
|
||||
|
||||
GroupOrderInfoVo productInfo = new GroupOrderInfoVo();
|
||||
|
||||
Reference in New Issue
Block a user