商品表字段 修改

This commit is contained in:
wangw 2024-11-18 14:36:34 +08:00
parent ca82c8a59f
commit ec3ec9eac9
6 changed files with 32 additions and 324 deletions

View File

@ -50,9 +50,6 @@ public class TbProduct implements Serializable {
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer id; private Integer id;
@Column(name = "`source_path`")
@ApiModelProperty(value = "商品来源 NORMAL普通商品 --,SCORE积分商品")
private String sourcePath="NORMAL";
@Column(name = "`merchant_id`") @Column(name = "`merchant_id`")
@ApiModelProperty(value = "商户Id") @ApiModelProperty(value = "商户Id")
@ -66,10 +63,6 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "商品名称") @ApiModelProperty(value = "商品名称")
private String name; private String name;
@Column(name = "`type`")
@ApiModelProperty(value = "商品类型(属性):REAL- 实物商品 VIR---虚拟商品")
private String type = "REAL";
@Column(name = "`pack_fee`") @Column(name = "`pack_fee`")
@ApiModelProperty(value = "包装费") @ApiModelProperty(value = "包装费")
private BigDecimal packFee; private BigDecimal packFee;
@ -95,10 +88,6 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "商品规格") @ApiModelProperty(value = "商品规格")
private Integer specId; private Integer specId;
@Column(name = "`brand_id`")
@ApiModelProperty(value = "品牌Id")
private Integer brandId;
@Column(name = "`short_title`") @Column(name = "`short_title`")
@ApiModelProperty(value = "短标题--促销语") @ApiModelProperty(value = "短标题--促销语")
private String shortTitle; private String shortTitle;
@ -107,72 +96,27 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "lowMemberPrice") @ApiModelProperty(value = "lowMemberPrice")
private BigDecimal lowMemberPrice; private BigDecimal lowMemberPrice;
@Column(name = "`unit_snap`")
@ApiModelProperty(value = "单位镜像")
private String unitSnap;
@Column(name = "`share_img`")
@ApiModelProperty(value = "商品分享图")
private String shareImg;
@Column(name = "`images`") @Column(name = "`images`")
@ApiModelProperty(value = "商品图片(第一张为缩略图,其他为详情)") @ApiModelProperty(value = "商品图片(第一张为缩略图,其他为详情)")
private String images; private String images;
@Column(name = "`video`")
@ApiModelProperty(value = "商品视频URL地址")
private String video;
@Column(name = "`video_cover_img`")
@ApiModelProperty(value = "视频封面图")
private String videoCoverImg;
@Column(name = "`sort`") @Column(name = "`sort`")
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort = 0; private Integer sort = 0;
@Column(name = "`limit_number`")
@ApiModelProperty(value = "0-不限购")
private Integer limitNumber = 0;
@Column(name = "`product_score`")
@ApiModelProperty(value = "商品赚送积分")
private Integer productScore;
@Column(name = "`status`",nullable = false) @Column(name = "`status`",nullable = false)
@NotNull @NotNull
@ApiModelProperty(value = "0--待审核 1审核通过 -1审核失败 -2违规下架") @ApiModelProperty(value = "0--待审核 1审核通过 -1审核失败 -2违规下架")
private Integer status = 0; private Integer status = 0;
@Column(name = "`fail_msg`")
@ApiModelProperty(value = "审核失败原因")
private String failMsg;
@Column(name = "`is_recommend`")
@ApiModelProperty(value = "是否推荐,店铺推荐展示")
private Integer isRecommend = 0;
@Column(name = "`is_hot`") @Column(name = "`is_hot`")
@ApiModelProperty(value = "是否热销") @ApiModelProperty(value = "是否热销")
private Integer isHot = 0; private Integer isHot = 0;
@Column(name = "`is_new`")
@ApiModelProperty(value = "是否新品")
private Integer isNew;
@Column(name = "`is_on_sale`")
@ApiModelProperty(value = "是否促销1-是0-否")
private Integer isOnSale = 0;
@Column(name = "`is_show`")
@ApiModelProperty(value = "是否展示0-下架 1上架---废弃")
private Integer isShow = 0;
@Column(name = "`type_enum`") @Column(name = "`type_enum`")
@ApiModelProperty(value = "商品规格0-单规格 1多规格") @ApiModelProperty(value = "商品规格0-单规格 1多规格")
private String typeEnum; private String typeEnum;
@Column(name = "`is_del`",nullable = false) @Column(name = "`is_del`",nullable = false)
@NotNull @NotNull
@ApiModelProperty(value = "是否回收站 0-否1回收站") @ApiModelProperty(value = "是否回收站 0-否1回收站")
@ -186,36 +130,6 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "是否暂停销售") @ApiModelProperty(value = "是否暂停销售")
private Integer isPauseSale = 0; private Integer isPauseSale = 0;
@Column(name = "`is_free_freight`",nullable = false)
@NotNull
@ApiModelProperty(value = "是否免邮1-是 0-否")
private Integer isFreeFreight=1;
@Column(name = "`freight_id`")
@ApiModelProperty(value = "邮费模版")
private Long freightId;
@Column(name = "`strategy_type`")
@ApiModelProperty(value = "商品当前生效策略")
private String strategyType;
@Column(name = "`strategy_id`")
@ApiModelProperty(value = "策略Id")
private Integer strategyId = 1;
@Column(name = "`is_vip`")
@ApiModelProperty(value = "vip专属")
private Integer isVip = 0;
@Column(name = "`is_delete`",nullable = false)
@NotNull
@ApiModelProperty(value = "是否删除")
private Integer isDelete = 0;
@Column(name = "`notice`")
@ApiModelProperty(value = "购买须知")
private String notice;
@Column(name = "`created_at`") @Column(name = "`created_at`")
@ApiModelProperty(value = "createdAt") @ApiModelProperty(value = "createdAt")
private Long createdAt; private Long createdAt;
@ -224,26 +138,6 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "updatedAt") @ApiModelProperty(value = "updatedAt")
private Long updatedAt; private Long updatedAt;
@Column(name = "`base_sales_number`")
@ApiModelProperty(value = "基础出售数量")
private Double baseSalesNumber =0.00;
@Column(name = "`real_sales_number`")
@ApiModelProperty(value = "实际销量")
private Integer realSalesNumber = 0;
@Column(name = "`sales_number`")
@ApiModelProperty(value = "合计销量")
private Integer salesNumber = 0;
@Column(name = "`thumb_count`")
@ApiModelProperty(value = "点赞次数")
private Integer thumbCount = 0;
@Column(name = "`store_count`")
@ApiModelProperty(value = "收藏次数")
private Integer storeCount = 0;
@Column(name = "`furnish_meal`") @Column(name = "`furnish_meal`")
@ApiModelProperty(value = "支持堂食") @ApiModelProperty(value = "支持堂食")
private Integer furnishMeal = 0; private Integer furnishMeal = 0;
@ -260,46 +154,10 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "支持虚拟") @ApiModelProperty(value = "支持虚拟")
private Integer furnishVir = 0; private Integer furnishVir = 0;
@Column(name = "`is_combo`")
@ApiModelProperty(value = "是否套餐")
private Integer isCombo =0;
@Column(name = "`group_snap`") @Column(name = "`group_snap`")
@ApiModelProperty(value = "套餐内容") @ApiModelProperty(value = "套餐内容")
private String groupSnap; private String groupSnap;
@Column(name = "`is_show_cash`")
@ApiModelProperty(value = "isShowCash")
private Integer isShowCash =0;
@Column(name = "`is_show_mall`")
@ApiModelProperty(value = "isShowMall")
private Integer isShowMall = 0;
@Column(name = "`is_need_examine`")
@ApiModelProperty(value = "是否需要审核")
private Integer isNeedExamine = 0;
@Column(name = "`show_on_mall_status`")
@ApiModelProperty(value = "线上商城展示状态0待审核 -1 异常 1正常")
private Integer showOnMallStatus = 1;
@Column(name = "`show_on_mall_time`")
@ApiModelProperty(value = "提交审核时间")
private Long showOnMallTime;
@Column(name = "`show_on_mall_error_msg`")
@ApiModelProperty(value = "线上商城展示失败原因")
private String showOnMallErrorMsg;
@Column(name = "`enable_label`")
@ApiModelProperty(value = "使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数")
private Integer enableLabel = 0;
@Column(name = "`tax_config_id`")
@ApiModelProperty(value = "税率")
private String taxConfigId;
@Column(name = "spec_info") @Column(name = "spec_info")
@ApiModelProperty(value = "specInfo") @ApiModelProperty(value = "specInfo")
private String specInfo; private String specInfo;

View File

@ -50,4 +50,16 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
@Modifying @Modifying
@Query("update TbProductSku set salePrice = :salePrice where productId= :productId") @Query("update TbProductSku set salePrice = :salePrice where productId= :productId")
void upSalePrice(@Param("productId") String productId, @Param("lowPrice") BigDecimal salePrice); void upSalePrice(@Param("productId") String productId, @Param("lowPrice") BigDecimal salePrice);
@Query(value =
"SELECT " +
" sum( real_sales_number )," +
" product_id " +
" FROM" +
" tb_product_sku " +
" WHERE" +
" product_id IN :ids" +
" GROUP BY" +
" product_id", nativeQuery = true)
List<Object[]> searchProRealSalesNumber(@Param("ids") List<Integer> ids);
} }

View File

@ -1,12 +1,7 @@
package cn.ysk.cashier.repository.shop; package cn.ysk.cashier.repository.shop;
import javax.persistence.Tuple;
import cn.ysk.cashier.pojo.TbShopUserDutyDetail; import cn.ysk.cashier.pojo.TbShopUserDutyDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/** /**
* @author lyf * @author lyf
@ -14,14 +9,4 @@ import java.util.List;
public interface TbShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail,Integer> { public interface TbShopUserDutyDetailRepository extends JpaRepository<TbShopUserDutyDetail,Integer> {
@Query(value = "SELECT " +
"sum( num ), " +
"product_id " +
"FROM " +
"tb_shop_user_duty_detail " +
"WHERE " +
"product_id IN :ids " +
"GROUP BY " +
"product_id",nativeQuery = true)
List<Object[]> searchUUserDutyDetail(@Param("ids") List<Integer> ids);
} }

View File

@ -68,7 +68,6 @@ public class TbProductServiceImpl implements TbProductService {
private final TbProductSkuRepository tbProductSkuRepository; private final TbProductSkuRepository tbProductSkuRepository;
private final TbShopUnitRepository tbShopUnitRepository; private final TbShopUnitRepository tbShopUnitRepository;
private final TbProductSpecRepository tbProductSpecRepository; private final TbProductSpecRepository tbProductSpecRepository;
private final TbProductSkuMapper TbProductSkuMapper;
private final TbProductSkuResultRepository tbProductSkuResultRepository; private final TbProductSkuResultRepository tbProductSkuResultRepository;
private final TbShopCategoryRepository tbShopCategoryRepository; private final TbShopCategoryRepository tbShopCategoryRepository;
private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe; private final TbShopUserDutyDetailRepository tbShopUserDutyDetailRe;
@ -149,7 +148,7 @@ public class TbProductServiceImpl implements TbProductService {
//销量 //销量
List<Object[]> objects = new ArrayList<>(); List<Object[]> objects = new ArrayList<>();
if (!productIdInt.isEmpty()) { if (!productIdInt.isEmpty()) {
objects = tbShopUserDutyDetailRe.searchUUserDutyDetail(productIdInt); objects = tbProductSkuRepository.searchProRealSalesNumber(productIdInt);
} }
//组装 //组装
List<TbProductVo> tbProductVoList = new ArrayList<>(); List<TbProductVo> tbProductVoList = new ArrayList<>();
@ -218,8 +217,10 @@ public class TbProductServiceImpl implements TbProductService {
} else { } else {
for (Object[] o : objects) { for (Object[] o : objects) {
if (((Integer) o[1]).equals(product.getId())) { if (((Integer) o[1]).equals(product.getId())) {
BigDecimal bigDecimal = (BigDecimal) o[0]; if (o[0] != null) {
tbProductVo.setRealSalesNumber(bigDecimal.doubleValue()); BigDecimal bigDecimal = (BigDecimal) o[0];
tbProductVo.setRealSalesNumber(bigDecimal.doubleValue());
}
} }
} }
} }
@ -248,16 +249,16 @@ public class TbProductServiceImpl implements TbProductService {
productNewVo.setLowPrice(product.getLowPrice().toString()); productNewVo.setLowPrice(product.getLowPrice().toString());
productNewVo.setStockNumber(Double.valueOf(product.getStockNumber())); productNewVo.setStockNumber(Double.valueOf(product.getStockNumber()));
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString()); List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(product.getId().toString());
if ("sku".equals(product.getTypeEnum())){ if ("sku".equals(product.getTypeEnum())) {
if(tbProductSkus.size() > 1){ if (tbProductSkus.size() > 1) {
BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get(); BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get();
if (maxPrice.compareTo(new BigDecimal(productNewVo.getLowPrice())) == 0) { if (maxPrice.compareTo(new BigDecimal(productNewVo.getLowPrice())) == 0) {
productNewVo.setLowPrice("" +productNewVo.getLowPrice()); productNewVo.setLowPrice("" + productNewVo.getLowPrice());
}else { } else {
productNewVo.setLowPrice("" +productNewVo.getLowPrice() + "~¥" + maxPrice); productNewVo.setLowPrice("" + productNewVo.getLowPrice() + "~¥" + maxPrice);
} }
}else { } else {
productNewVo.setLowPrice("" +productNewVo.getLowPrice()); productNewVo.setLowPrice("" + productNewVo.getLowPrice());
} }
} }
ViewConSku viewConSku = new ViewConSku(); ViewConSku viewConSku = new ViewConSku();
@ -265,7 +266,7 @@ public class TbProductServiceImpl implements TbProductService {
viewConSku.setProductId(product.getId()); viewConSku.setProductId(product.getId());
Example<ViewConSku> query = Example.of(viewConSku); Example<ViewConSku> query = Example.of(viewConSku);
List<ViewConSku> skuCons = viewConSkuRepository.findAll(query); List<ViewConSku> skuCons = viewConSkuRepository.findAll(query);
if(product.getTypeEnum().equals("sku")){ if (product.getTypeEnum().equals("sku")) {
//规格填充 //规格填充
productNewVo.setSkuList(convert(tbProductSkus)); productNewVo.setSkuList(convert(tbProductSkus));
//耗材弹窗选项 //耗材弹窗选项
@ -276,11 +277,11 @@ public class TbProductServiceImpl implements TbProductService {
} }
} }
} }
productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons)? Collections.emptyList() :skuCons); productNewVo.setConInfos(CollectionUtils.isEmpty(skuCons) ? Collections.emptyList() : skuCons);
products.add(productNewVo); products.add(productNewVo);
} }
Map<String, Object> result = PageUtil.toPage(products, page.getTotalElements()); Map<String, Object> result = PageUtil.toPage(products, page.getTotalElements());
result.put("warnLine",warnLine); result.put("warnLine", warnLine);
return result; return result;
} }
@ -431,8 +432,6 @@ public class TbProductServiceImpl implements TbProductService {
product.setImages(resources.getImages().toString()); product.setImages(resources.getImages().toString());
} }
product.setIsDel(0); product.setIsDel(0);
product.setIsDelete(0);
product.setIsFreeFreight(1);
product.setStatus(1); product.setStatus(1);
product.setCreatedAt(Instant.now().toEpochMilli()); product.setCreatedAt(Instant.now().toEpochMilli());
product.setUpdatedAt(Instant.now().toEpochMilli()); product.setUpdatedAt(Instant.now().toEpochMilli());
@ -442,7 +441,6 @@ public class TbProductServiceImpl implements TbProductService {
//套餐内容 //套餐内容
if (!resources.getGroupSnap().isEmpty()) { if (!resources.getGroupSnap().isEmpty()) {
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap())); product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
product.setIsCombo(1);
} }
if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) { if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList()); List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
@ -527,15 +525,12 @@ public class TbProductServiceImpl implements TbProductService {
} }
if (!"group".equals(product.getTypeEnum())) { if (!"group".equals(product.getTypeEnum())) {
if (resources.getCategoryId() == null) throw new BadRequestException("商品分类不可为空"); if (resources.getCategoryId() == null) throw new BadRequestException("商品分类不可为空");
product.setIsCombo(0);
product.setGroupSnap(null); product.setGroupSnap(null);
if (resources.getNotices() != null && resources.getNotices().getId() != null) { if (resources.getNotices() != null && resources.getNotices().getId() != null) {
noticeRepository.deleteById(resources.getNotices().getId()); noticeRepository.deleteById(resources.getNotices().getId());
} }
} }
product.setIsDel(0); product.setIsDel(0);
product.setIsDelete(0);
product.setIsFreeFreight(1);
product.setStatus(1); product.setStatus(1);
product.setUpdatedAt(Instant.now().toEpochMilli()); product.setUpdatedAt(Instant.now().toEpochMilli());
product.setImages(resources.getImages().toString()); product.setImages(resources.getImages().toString());
@ -546,7 +541,8 @@ public class TbProductServiceImpl implements TbProductService {
//套餐内容 //套餐内容
if (!resources.getGroupSnap().isEmpty()) { if (!resources.getGroupSnap().isEmpty()) {
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap())); product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
product.setIsCombo(1); } else {
throw new BadRequestException("套餐内容不可为空");
} }
if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) { if (!CollectionUtils.isEmpty(resources.getGroupCategoryId())) {
List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList()); List<Integer> collect = resources.getGroupCategoryId().stream().map(TbCouponCategoryDto::getId).collect(Collectors.toList());
@ -607,7 +603,6 @@ public class TbProductServiceImpl implements TbProductService {
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void upProSort(TbProductSortCriteria param) { public void upProSort(TbProductSortCriteria param) {

View File

@ -1,30 +0,0 @@
package cn.ysk.cashier.vo;
import lombok.Data;
import org.hibernate.annotations.Formula;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* @author lyf
*/
@Data
public class ProductExtVO {
private BigInteger productId;
private String productName;
private Object productNum;
private Object amount;
public ProductExtVO(BigInteger productId, String productName, Object productNum, Object amount) {
this.productId = productId;
this.productName = productName;
this.productNum = productNum;
this.amount = amount;
}
public ProductExtVO() {
}
}

View File

@ -25,27 +25,16 @@ public class TbProductVo {
private Integer id; private Integer id;
private String sourcePath;
private String merchantId; private String merchantId;
private String shopId; private String shopId;
private String name; private String name;
private String type;
private BigDecimal packFee; private BigDecimal packFee;
private BigDecimal lowPrice; private BigDecimal lowPrice;
private Integer unitId; private Integer unitId;
private String coverImg; private String coverImg;
@ -56,155 +45,54 @@ public class TbProductVo {
private Integer specId; private Integer specId;
private Integer brandId;
private String shortTitle; private String shortTitle;
private BigDecimal lowMemberPrice; private BigDecimal lowMemberPrice;
private String unitSnap;
private String shareImg; private String shareImg;
private JSONArray images; private JSONArray images;
private String video;
private String videoCoverImg;
private Integer sort; private Integer sort;
private Integer limitNumber; private Integer limitNumber;
private Integer productScore;
private Integer status; private Integer status;
private String failMsg; private String failMsg;
private Integer isRecommend;
private Integer isHot; private Integer isHot;
private Integer isNew;
private Integer isOnSale; private Integer isOnSale;
private Integer isShow;
private String typeEnum; private String typeEnum;
private Integer isDel; private Integer isDel;
private Integer isStock; private Integer isStock;
private Integer isPauseSale; private Integer isPauseSale;
private Integer isFreeFreight;
private Long freightId;
private String strategyType;
private Integer strategyId;
private Integer isVip; private Integer isVip;
private Integer isDelete;
private String notice;
private Long createdAt; private Long createdAt;
private Long updatedAt; private Long updatedAt;
private Double baseSalesNumber;
//销量
private Double realSalesNumber;
//库存
private Double stockNumber;
private Integer salesNumber;
private Integer thumbCount;
private Integer storeCount;
private Integer furnishMeal; private Integer furnishMeal;
private Double realSalesNumber;
private Double stockNumber;
private Integer furnishExpress; private Integer furnishExpress;
private Integer furnishDraw; private Integer furnishDraw;
private Integer furnishVir; private Integer furnishVir;
private Integer isCombo;
private JSONArray groupSnap; private JSONArray groupSnap;
private Integer isShowCash;
private Integer isShowMall;
private Integer isNeedExamine;
private Integer showOnMallStatus;
private Long showOnMallTime;
private String showOnMallErrorMsg;
private Integer enableLabel;
private String taxConfigId;
private String unitName; private String unitName;
private List<TbProductSku> skuList; private List<TbProductSku> skuList;