Merge remote-tracking branch 'origin/test' into dev
This commit is contained in:
@@ -117,7 +117,6 @@ public class LoginContoller {
|
||||
if (!hasOpenId) {
|
||||
return Result.fail("登录失败:" + wxResp.getString("errmsg"));
|
||||
}
|
||||
String a = "{\"width\":\"58\",\"printerNum\":\"1\",\"categoryList\":[{\"id\":30,\"name\":\"奶茶\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":35,\"name\":\"酒水饮料\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":65,\"name\":\"火锅\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":95,\"name\":\"串串\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null},{\"id\":96,\"name\":\"烧烤\",\"shortName\":null,\"tree\":null,\"pid\":null,\"pic\":null,\"merchantId\":null,\"shopId\":null,\"style\":null,\"isShow\":null,\"detail\":null,\"sort\":null,\"keyWord\":null,\"createdAt\":null,\"updatedAt\":null}],\"model\":\"normal\",\"feet\":\"0\",\"autoCut\":\"1\"}";
|
||||
// 3.接收微信接口服务 获取返回的参数
|
||||
String openid = wxResp.getString("openid");
|
||||
return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request));
|
||||
|
||||
@@ -96,10 +96,9 @@ public class ProductController {
|
||||
@RequestParam(value = "code", required = false) String code,
|
||||
@RequestParam("shopId") String shopId,
|
||||
@RequestParam("productId") String productId,
|
||||
@RequestParam("spec_tag") String spec_tag,
|
||||
@RequestParam("isVip") String isVip
|
||||
@RequestParam("spec_tag") String spec_tag
|
||||
) {
|
||||
return productService.queryProductSku(code,shopId, productId, spec_tag,isVip);
|
||||
return productService.queryProductSku(code,shopId, productId, spec_tag);
|
||||
}
|
||||
|
||||
@PostMapping("addCart")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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.vo.ShopGroupInfoVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -15,7 +14,7 @@ import java.util.Set;
|
||||
@Mapper
|
||||
public interface TbProductMapper {
|
||||
|
||||
TbProductWithBLOBs selectByPrimaryKey(Integer id);
|
||||
TbProduct selectByPrimaryKey(Integer id);
|
||||
|
||||
TbProduct selectById(Integer id);
|
||||
|
||||
@@ -27,7 +26,7 @@ public interface TbProductMapper {
|
||||
|
||||
List<TbProduct> selectByIds(@Param("list") List<String> ids);
|
||||
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
|
||||
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId,@Param("isVip") String isVip);
|
||||
Integer selectByCodeAndSkuId(@Param("code") String code,@Param("skuId") Integer skuId,@Param("shopId") String shopId);
|
||||
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
|
||||
|
||||
List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
|
||||
@@ -39,9 +38,9 @@ public interface TbProductMapper {
|
||||
@Param("startTime") String startTime, @Param("endTime") String endTime,
|
||||
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
|
||||
|
||||
|
||||
@Update("update tb_product set real_sales_number = real_sales_number + #{number,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}")
|
||||
void upGroupRealSalesNumber(@Param("id") String id,@Param("number") Integer number);
|
||||
|
||||
@Update("update tb_product set stock_number = stock_number - #{num,jdbcType=INTEGER} where id = #{productId}")
|
||||
void updateStockById(@Param("productId") String productId, @Param("num") Integer num);
|
||||
|
||||
@Update("update tb_product set stock_number=stock_number-#{num} WHERE id=#{id} and stock_number-#{num} >= 0")
|
||||
|
||||
@@ -1,685 +1,164 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* (TbProduct)实体类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2024-11-18 14:41:53
|
||||
*/
|
||||
@Data
|
||||
public class TbProduct implements Serializable {
|
||||
private static final long serialVersionUID = -40921077034892720L;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 商品类型(属性):普通商品 normal 套餐商品 package 称重商品 weigh 团购券商品 coupon
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 商品最低价
|
||||
*/
|
||||
private BigDecimal lowPrice;
|
||||
|
||||
private BigDecimal lowMemberPrice;
|
||||
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 单位Id
|
||||
*/
|
||||
private Integer unitId;
|
||||
private String unitSnap;
|
||||
|
||||
/**
|
||||
* 商品封面图
|
||||
*/
|
||||
private String coverImg;
|
||||
|
||||
private String shareImg;
|
||||
|
||||
/**
|
||||
* 商品图片(第一张为缩略图,其他为详情)
|
||||
*/
|
||||
private String images;
|
||||
|
||||
private String videoCoverImg;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
private Integer limitNumber;
|
||||
|
||||
private Integer productScore;
|
||||
|
||||
private Byte status;
|
||||
|
||||
/**
|
||||
* 0--待审核 1审核通过 -1审核失败 -2违规下架
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 审核失败原因
|
||||
*/
|
||||
private String failMsg;
|
||||
|
||||
private Byte isRecommend;
|
||||
|
||||
private Byte isHot;
|
||||
|
||||
private Byte isNew;
|
||||
|
||||
private Byte isOnSale;
|
||||
|
||||
private Byte isShow;
|
||||
|
||||
/**
|
||||
* 是否热销
|
||||
*/
|
||||
private Integer isHot;
|
||||
/**
|
||||
* 计量商品 normal
|
||||
* 称重商品 weight
|
||||
* 多规格商品 sku
|
||||
* 套餐商品 group
|
||||
* 时价商品 currentPrice
|
||||
*/
|
||||
private String typeEnum;
|
||||
|
||||
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;
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站
|
||||
*/
|
||||
private Integer isDel;
|
||||
/**
|
||||
* 是否开启库存
|
||||
*/
|
||||
private Integer isStock;
|
||||
/**
|
||||
* 是否暂停销售
|
||||
*/
|
||||
private Integer isPauseSale;
|
||||
|
||||
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 String cartNumber="0";
|
||||
private String groupCategoryId;
|
||||
|
||||
private Integer stockNumber;
|
||||
private Integer suit;
|
||||
private Integer isVip;
|
||||
|
||||
//是否可售 1 可售 0非可售
|
||||
private Integer isSale = 1;
|
||||
|
||||
private Integer warnLine = 0;
|
||||
|
||||
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images;
|
||||
}
|
||||
|
||||
public String getCartNumber() {
|
||||
return cartNumber;
|
||||
}
|
||||
|
||||
public void setCartNumber(String cartNumber) {
|
||||
this.cartNumber = cartNumber;
|
||||
}
|
||||
|
||||
@Transient
|
||||
private TbProductSkuResult productSkuResult;
|
||||
|
||||
|
||||
public TbProductSkuResult getProductSkuResult() {
|
||||
return productSkuResult;
|
||||
}
|
||||
|
||||
public void setProductSkuResult(TbProductSkuResult productSkuResult) {
|
||||
this.productSkuResult = productSkuResult;
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(String categoryId) {
|
||||
this.categoryId = categoryId == null ? null : categoryId.trim();
|
||||
}
|
||||
|
||||
public Integer getSpecId() {
|
||||
return specId;
|
||||
}
|
||||
|
||||
public void setSpecId(Integer specId) {
|
||||
this.specId = specId;
|
||||
}
|
||||
|
||||
public String getSourcePath() {
|
||||
return sourcePath;
|
||||
}
|
||||
|
||||
public void setSourcePath(String sourcePath) {
|
||||
this.sourcePath = sourcePath == null ? null : sourcePath.trim();
|
||||
}
|
||||
|
||||
public Integer getBrandId() {
|
||||
return brandId;
|
||||
}
|
||||
|
||||
public void setBrandId(Integer brandId) {
|
||||
this.brandId = brandId;
|
||||
}
|
||||
|
||||
public String getMerchantId() {
|
||||
return merchantId;
|
||||
}
|
||||
|
||||
public void setMerchantId(String merchantId) {
|
||||
this.merchantId = merchantId == null ? null : merchantId.trim();
|
||||
}
|
||||
|
||||
public String getShopId() {
|
||||
return shopId;
|
||||
}
|
||||
|
||||
public void setShopId(String shopId) {
|
||||
this.shopId = shopId == null ? null : shopId.trim();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
public String getShortTitle() {
|
||||
return shortTitle;
|
||||
}
|
||||
|
||||
public void setShortTitle(String shortTitle) {
|
||||
this.shortTitle = shortTitle == null ? null : shortTitle.trim();
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type == null ? null : type.trim();
|
||||
}
|
||||
|
||||
public BigDecimal getPackFee() {
|
||||
return packFee;
|
||||
}
|
||||
|
||||
public void setPackFee(BigDecimal packFee) {
|
||||
this.packFee = packFee;
|
||||
}
|
||||
|
||||
public BigDecimal getLowPrice() {
|
||||
return lowPrice;
|
||||
}
|
||||
|
||||
public void setLowPrice(BigDecimal lowPrice) {
|
||||
this.lowPrice = lowPrice;
|
||||
}
|
||||
|
||||
public BigDecimal getLowMemberPrice() {
|
||||
return lowMemberPrice;
|
||||
}
|
||||
|
||||
public void setLowMemberPrice(BigDecimal lowMemberPrice) {
|
||||
this.lowMemberPrice = lowMemberPrice;
|
||||
}
|
||||
|
||||
public String getUnitId() {
|
||||
return unitId;
|
||||
}
|
||||
|
||||
public void setUnitId(String unitId) {
|
||||
this.unitId = unitId == null ? null : unitId.trim();
|
||||
}
|
||||
|
||||
public String getUnitSnap() {
|
||||
return unitSnap;
|
||||
}
|
||||
|
||||
public void setUnitSnap(String unitSnap) {
|
||||
this.unitSnap = unitSnap == null ? null : unitSnap.trim();
|
||||
}
|
||||
|
||||
public String getCoverImg() {
|
||||
return coverImg;
|
||||
}
|
||||
|
||||
public void setCoverImg(String coverImg) {
|
||||
this.coverImg = coverImg == null ? null : coverImg.trim();
|
||||
}
|
||||
|
||||
public String getShareImg() {
|
||||
return shareImg;
|
||||
}
|
||||
|
||||
public void setShareImg(String shareImg) {
|
||||
this.shareImg = shareImg == null ? null : shareImg.trim();
|
||||
}
|
||||
|
||||
public String getVideoCoverImg() {
|
||||
return videoCoverImg;
|
||||
}
|
||||
|
||||
public void setVideoCoverImg(String videoCoverImg) {
|
||||
this.videoCoverImg = videoCoverImg == null ? null : videoCoverImg.trim();
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getLimitNumber() {
|
||||
return limitNumber;
|
||||
}
|
||||
|
||||
public void setLimitNumber(Integer limitNumber) {
|
||||
this.limitNumber = limitNumber;
|
||||
}
|
||||
|
||||
public Integer getProductScore() {
|
||||
return productScore;
|
||||
}
|
||||
|
||||
public void setProductScore(Integer productScore) {
|
||||
this.productScore = productScore;
|
||||
}
|
||||
|
||||
public Byte getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Byte status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getFailMsg() {
|
||||
return failMsg;
|
||||
}
|
||||
|
||||
public void setFailMsg(String failMsg) {
|
||||
this.failMsg = failMsg == null ? null : failMsg.trim();
|
||||
}
|
||||
|
||||
public Byte getIsRecommend() {
|
||||
return isRecommend;
|
||||
}
|
||||
|
||||
public void setIsRecommend(Byte isRecommend) {
|
||||
this.isRecommend = isRecommend;
|
||||
}
|
||||
|
||||
public Byte getIsHot() {
|
||||
return isHot;
|
||||
}
|
||||
|
||||
public void setIsHot(Byte isHot) {
|
||||
this.isHot = isHot;
|
||||
}
|
||||
|
||||
public Byte getIsNew() {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public void setIsNew(Byte isNew) {
|
||||
this.isNew = isNew;
|
||||
}
|
||||
|
||||
public Byte getIsOnSale() {
|
||||
return isOnSale;
|
||||
}
|
||||
|
||||
public void setIsOnSale(Byte isOnSale) {
|
||||
this.isOnSale = isOnSale;
|
||||
}
|
||||
|
||||
public Byte getIsShow() {
|
||||
return isShow;
|
||||
}
|
||||
|
||||
public void setIsShow(Byte isShow) {
|
||||
this.isShow = isShow;
|
||||
}
|
||||
|
||||
public String getTypeEnum() {
|
||||
return typeEnum;
|
||||
}
|
||||
|
||||
public void setTypeEnum(String typeEnum) {
|
||||
this.typeEnum = typeEnum == null ? null : typeEnum.trim();
|
||||
}
|
||||
|
||||
|
||||
public Byte getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
||||
public void setIsDel(Byte isDel) {
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public Byte getIsStock() {
|
||||
return isStock;
|
||||
}
|
||||
|
||||
public void setIsStock(Byte isStock) {
|
||||
this.isStock = isStock;
|
||||
}
|
||||
|
||||
public Byte getIsPauseSale() {
|
||||
return isPauseSale;
|
||||
}
|
||||
|
||||
public void setIsPauseSale(Byte isPauseSale) {
|
||||
this.isPauseSale = isPauseSale;
|
||||
}
|
||||
|
||||
public Byte getIsFreeFreight() {
|
||||
return isFreeFreight;
|
||||
}
|
||||
|
||||
public void setIsFreeFreight(Byte isFreeFreight) {
|
||||
this.isFreeFreight = isFreeFreight;
|
||||
}
|
||||
|
||||
public Long getFreightId() {
|
||||
return freightId;
|
||||
}
|
||||
|
||||
public void setFreightId(Long freightId) {
|
||||
this.freightId = freightId;
|
||||
}
|
||||
|
||||
public String getStrategyType() {
|
||||
return strategyType;
|
||||
}
|
||||
|
||||
public void setStrategyType(String strategyType) {
|
||||
this.strategyType = strategyType == null ? null : strategyType.trim();
|
||||
}
|
||||
|
||||
public Integer getStrategyId() {
|
||||
return strategyId;
|
||||
}
|
||||
|
||||
public void setStrategyId(Integer strategyId) {
|
||||
this.strategyId = strategyId;
|
||||
}
|
||||
|
||||
public Byte getIsVip() {
|
||||
return isVip;
|
||||
}
|
||||
|
||||
public void setIsVip(Byte isVip) {
|
||||
this.isVip = isVip;
|
||||
}
|
||||
|
||||
public Byte getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(Byte isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Long getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Long createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Long getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Long updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public Double getBaseSalesNumber() {
|
||||
return baseSalesNumber;
|
||||
}
|
||||
|
||||
public void setBaseSalesNumber(Double baseSalesNumber) {
|
||||
this.baseSalesNumber = baseSalesNumber;
|
||||
}
|
||||
|
||||
public Integer getRealSalesNumber() {
|
||||
return realSalesNumber;
|
||||
}
|
||||
|
||||
public void setRealSalesNumber(Integer realSalesNumber) {
|
||||
this.realSalesNumber = realSalesNumber;
|
||||
}
|
||||
|
||||
public Integer getSalesNumber() {
|
||||
return salesNumber;
|
||||
}
|
||||
|
||||
public void setSalesNumber(Integer salesNumber) {
|
||||
this.salesNumber = salesNumber;
|
||||
}
|
||||
|
||||
public Integer getThumbCount() {
|
||||
return thumbCount;
|
||||
}
|
||||
|
||||
public void setThumbCount(Integer thumbCount) {
|
||||
this.thumbCount = thumbCount;
|
||||
}
|
||||
|
||||
public Integer getStoreCount() {
|
||||
return storeCount;
|
||||
}
|
||||
|
||||
public void setStoreCount(Integer storeCount) {
|
||||
this.storeCount = storeCount;
|
||||
}
|
||||
|
||||
public Integer getFurnishMeal() {
|
||||
return furnishMeal;
|
||||
}
|
||||
|
||||
public void setFurnishMeal(Integer furnishMeal) {
|
||||
this.furnishMeal = furnishMeal;
|
||||
}
|
||||
|
||||
public Integer getFurnishExpress() {
|
||||
return furnishExpress;
|
||||
}
|
||||
|
||||
public void setFurnishExpress(Integer furnishExpress) {
|
||||
this.furnishExpress = furnishExpress;
|
||||
}
|
||||
|
||||
public Integer getFurnishDraw() {
|
||||
return furnishDraw;
|
||||
}
|
||||
|
||||
public void setFurnishDraw(Integer furnishDraw) {
|
||||
this.furnishDraw = furnishDraw;
|
||||
}
|
||||
|
||||
public Integer getFurnishVir() {
|
||||
return furnishVir;
|
||||
}
|
||||
|
||||
public void setFurnishVir(Integer furnishVir) {
|
||||
this.furnishVir = furnishVir;
|
||||
}
|
||||
|
||||
public Byte getIsCombo() {
|
||||
return isCombo;
|
||||
}
|
||||
|
||||
public void setIsCombo(Byte isCombo) {
|
||||
this.isCombo = isCombo;
|
||||
}
|
||||
|
||||
public Byte getIsShowCash() {
|
||||
return isShowCash;
|
||||
}
|
||||
|
||||
public void setIsShowCash(Byte isShowCash) {
|
||||
this.isShowCash = isShowCash;
|
||||
}
|
||||
|
||||
public Byte getIsShowMall() {
|
||||
return isShowMall;
|
||||
}
|
||||
|
||||
public void setIsShowMall(Byte isShowMall) {
|
||||
this.isShowMall = isShowMall;
|
||||
}
|
||||
|
||||
public Byte getIsNeedExamine() {
|
||||
return isNeedExamine;
|
||||
}
|
||||
|
||||
public void setIsNeedExamine(Byte isNeedExamine) {
|
||||
this.isNeedExamine = isNeedExamine;
|
||||
}
|
||||
|
||||
public Byte getShowOnMallStatus() {
|
||||
return showOnMallStatus;
|
||||
}
|
||||
|
||||
public void setShowOnMallStatus(Byte showOnMallStatus) {
|
||||
this.showOnMallStatus = showOnMallStatus;
|
||||
}
|
||||
|
||||
public Long getShowOnMallTime() {
|
||||
return showOnMallTime;
|
||||
}
|
||||
|
||||
public void setShowOnMallTime(Long showOnMallTime) {
|
||||
this.showOnMallTime = showOnMallTime;
|
||||
}
|
||||
|
||||
public String getShowOnMallErrorMsg() {
|
||||
return showOnMallErrorMsg;
|
||||
}
|
||||
|
||||
public void setShowOnMallErrorMsg(String showOnMallErrorMsg) {
|
||||
this.showOnMallErrorMsg = showOnMallErrorMsg == null ? null : showOnMallErrorMsg.trim();
|
||||
}
|
||||
|
||||
public Byte getEnableLabel() {
|
||||
return enableLabel;
|
||||
}
|
||||
|
||||
public void setEnableLabel(Byte enableLabel) {
|
||||
this.enableLabel = enableLabel;
|
||||
}
|
||||
|
||||
public String getTaxConfigId() {
|
||||
return taxConfigId;
|
||||
}
|
||||
|
||||
public void setTaxConfigId(String taxConfigId) {
|
||||
this.taxConfigId = taxConfigId == null ? null : taxConfigId.trim();
|
||||
}
|
||||
|
||||
public String getSpecTableHeaders() {
|
||||
return specTableHeaders;
|
||||
}
|
||||
|
||||
public String getGroupCategoryId() {
|
||||
return groupCategoryId;
|
||||
}
|
||||
|
||||
public void setGroupCategoryId(String groupCategoryId) {
|
||||
this.groupCategoryId = groupCategoryId;
|
||||
}
|
||||
|
||||
|
||||
public void setSpecTableHeaders(String specTableHeaders) {
|
||||
this.specTableHeaders = specTableHeaders == null ? null : specTableHeaders.trim();
|
||||
}
|
||||
|
||||
public void setStockNumber(Integer stockNumber) {
|
||||
this.stockNumber = stockNumber;
|
||||
}
|
||||
|
||||
public Integer getStockNumber() {
|
||||
return this.stockNumber;
|
||||
}
|
||||
|
||||
public Integer getSuit() {
|
||||
return suit;
|
||||
}
|
||||
|
||||
public void setSuit(Integer suit) {
|
||||
this.suit = suit;
|
||||
}
|
||||
|
||||
public Integer getIsSale() {
|
||||
return isSale;
|
||||
}
|
||||
|
||||
public void setIsSale(Integer isSale) {
|
||||
this.isSale = isSale;
|
||||
}
|
||||
|
||||
public Integer getWarnLine() {
|
||||
return warnLine;
|
||||
}
|
||||
|
||||
public void setWarnLine(Integer warnLine) {
|
||||
this.warnLine = warnLine;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.chaozhanggui.system.cashierservice.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TbProductWithBLOBs extends TbProduct implements Serializable {
|
||||
private String images;
|
||||
|
||||
private String video;
|
||||
|
||||
private String notice;
|
||||
|
||||
private String groupSnap;
|
||||
|
||||
private String specInfo;
|
||||
|
||||
private String selectSpec;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(String images) {
|
||||
this.images = images == null ? null : images.trim();
|
||||
}
|
||||
|
||||
public String getVideo() {
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setVideo(String video) {
|
||||
this.video = video == null ? null : video.trim();
|
||||
}
|
||||
|
||||
public String getNotice() {
|
||||
return notice;
|
||||
}
|
||||
|
||||
public void setNotice(String notice) {
|
||||
this.notice = notice == null ? null : notice.trim();
|
||||
}
|
||||
|
||||
public String getGroupSnap() {
|
||||
return groupSnap;
|
||||
}
|
||||
|
||||
public void setGroupSnap(String groupSnap) {
|
||||
this.groupSnap = groupSnap == null ? null : groupSnap.trim();
|
||||
}
|
||||
|
||||
public String getSpecInfo() {
|
||||
return specInfo;
|
||||
}
|
||||
|
||||
public void setSpecInfo(String specInfo) {
|
||||
this.specInfo = specInfo == null ? null : specInfo.trim();
|
||||
}
|
||||
|
||||
public String getSelectSpec() {
|
||||
return selectSpec;
|
||||
}
|
||||
|
||||
public void setSelectSpec(String selectSpec) {
|
||||
this.selectSpec = selectSpec == null ? null : selectSpec.trim();
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,9 @@ public class RedisCst {
|
||||
public static final String DINE_IN_TABLE_CART = "DINE_IN_TABLE_CART:";
|
||||
// 当前台桌人数
|
||||
public static final String CURRENT_TABLE_SEAR_COUNT = "CURRENT_TABLE_SEAR_COUNT:";
|
||||
// 取餐码
|
||||
public static final String MASTER_ID = "SHOP:CODE:USER:pc:";
|
||||
|
||||
|
||||
|
||||
public static String getCurrentOrderKey(String tableId, String shopId) {
|
||||
@@ -87,4 +90,8 @@ public class RedisCst {
|
||||
public static String getCurrentTableSeatCount(Object shopId, String tableId) {
|
||||
return CURRENT_TABLE_SEAR_COUNT + (shopId + ":" + tableId);
|
||||
}
|
||||
|
||||
public static String getMasterIdKey(String shopId, String day, String tableId) {
|
||||
return MASTER_ID + shopId + ":" + day + ":" + tableId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -293,7 +294,6 @@ public class CartService {
|
||||
String skuId = jsonObject.getString("skuId");
|
||||
Integer type = jsonObject.getInteger("type");
|
||||
Integer buyNum = jsonObject.getInteger("num");
|
||||
Integer isVip = jsonObject.getInteger("isVip");
|
||||
Integer userId = jsonObject.getInteger("userId");
|
||||
// 商品备注
|
||||
String note = jsonObject.getString("note");
|
||||
@@ -355,7 +355,7 @@ public class CartService {
|
||||
if (Objects.isNull(array) || array.isEmpty()) {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonArray.add(cashierCart);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
cashierCartArrayList.add(cashierCart);
|
||||
@@ -374,11 +374,11 @@ public class CartService {
|
||||
TbCashierCart cashierCart = JSONUtil.parseJSONStr2T(object.toJSONString(), TbCashierCart.class);
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
|
||||
if (cashierCart.getSkuId().equals(skuId) && (isVip == null || cashierCart.getIsVip().intValue() == isVip)) {
|
||||
if (cashierCart.getSkuId().equals(skuId)) {
|
||||
cashierCart.setTotalNumber(buyNum);
|
||||
cashierCart.setNumber(buyNum);
|
||||
cashierCart.setNote(note);
|
||||
if (tbProductSkuWithBLOBs != null && type == 0 && isVip != null && isVip == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
if (tbProductSkuWithBLOBs != null && type == 0 && tbProductSkuWithBLOBs.getSuit() != null
|
||||
&& tbProductSkuWithBLOBs.getSuit() > 1 && cashierCart.getNumber() < tbProductSkuWithBLOBs.getSuit()) {
|
||||
cashierCartMapper.deleteByPrimaryKey(cashierCart.getId());
|
||||
continue;
|
||||
@@ -402,11 +402,11 @@ public class CartService {
|
||||
product.getPackFee().multiply(BigDecimal.valueOf(buyNum)) : BigDecimal.ZERO);
|
||||
|
||||
}
|
||||
if (isVip != null && isVip == 1) {
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
} else {
|
||||
cashierCart.resetTotalAmount();
|
||||
}
|
||||
// if (isVip != null && isVip == 1) {
|
||||
// cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
// } else {
|
||||
cashierCart.resetTotalAmount();
|
||||
// }
|
||||
cashierCart.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
mpCashierCartMapper.updateById(cashierCart);
|
||||
} else {
|
||||
@@ -429,7 +429,7 @@ public class CartService {
|
||||
|
||||
if (flag && type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
jsonArray.add(cashierCart);
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
@@ -442,19 +442,17 @@ public class CartService {
|
||||
} else {
|
||||
if (type == 1) {
|
||||
TbCashierCart cashierCart = addCart(productId, skuId,
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, isVip, note, shopEatTypeInfoDTO);
|
||||
jsonObject.getInteger("userId"), buyNum, tableId, shopId, note, shopEatTypeInfoDTO);
|
||||
if (!TableConstant.CART_SEAT_ID.equals(productId)) {
|
||||
jsonArray.add(cashierCart);
|
||||
}
|
||||
cashierCart.setPlaceNum(cashierCart.getPlaceNum() == null ? 0 : cashierCart.getPlaceNum());
|
||||
cashierCartArrayList.add(cashierCart);
|
||||
if (isVip != 1) {
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
cashierCart.getMemberPrice() != null && cashierCart.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? cashierCart.getMemberPrice() : cashierCart.getSalePrice();
|
||||
memberAmount = memberAmount.add(mPrice.multiply(BigDecimal.valueOf(cashierCart.getTotalNumber())).add(cashierCart.getPackFee()));
|
||||
amount = amount.add(new BigDecimal(cashierCart.getTotalNumber()).multiply(cashierCart.getSalePrice().add(cashierCart.getPackFee())));
|
||||
BigDecimal mPrice = cashierCart.getIsMember() != null && cashierCart.getIsMember() == 1 &&
|
||||
cashierCart.getMemberPrice() != null && cashierCart.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? cashierCart.getMemberPrice() : cashierCart.getSalePrice();
|
||||
memberAmount = memberAmount.add(mPrice.multiply(BigDecimal.valueOf(cashierCart.getTotalNumber())).add(cashierCart.getPackFee()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (MsgException e) {
|
||||
@@ -579,7 +577,7 @@ public class CartService {
|
||||
}
|
||||
|
||||
private TbCashierCart addCart(String productId, String skuId, Integer userId, Integer num,
|
||||
String tableId, String shopId, Integer isVip, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO) throws Exception {
|
||||
String tableId, String shopId, String note, ShopEatTypeInfoDTO shopEatTypeInfoDTO) throws Exception {
|
||||
try {
|
||||
// 查询用户信息
|
||||
TbShopUser shopUser = shopUserMapper.selectByUserIdAndShopId(String.valueOf(userId), shopId);
|
||||
@@ -591,7 +589,7 @@ public class CartService {
|
||||
String key = tableId + "-" + shopId;
|
||||
TbProductSkuWithBLOBs productSku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(skuId));
|
||||
TbCashierCart cashierCart = new TbCashierCart();
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1 && isVip != 1) {
|
||||
if (productSku.getSuit() != null && productSku.getSuit() > 1) {
|
||||
if (product.getIsStock() == 1) {
|
||||
boolean isSale = false;
|
||||
if (num > productSku.getSuit()) {
|
||||
@@ -642,14 +640,8 @@ public class CartService {
|
||||
if (shopEatTypeInfoDTO.isTakeout() && product.getPackFee() != null) {
|
||||
cashierCart.setPackFee(product.getPackFee().multiply(BigDecimal.valueOf(num)));
|
||||
}
|
||||
if (isVip == 1) {
|
||||
cashierCart.setIsVip(Byte.parseByte("1"));
|
||||
cashierCart.setTotalAmount(BigDecimal.ZERO);
|
||||
cashierCart.setSalePrice(BigDecimal.ZERO);
|
||||
} else {
|
||||
cashierCart.setIsVip((byte) 0);
|
||||
cashierCart.resetTotalAmount();
|
||||
}
|
||||
cashierCart.setIsVip((byte) 0);
|
||||
cashierCart.resetTotalAmount();
|
||||
cashierCart.setPlatformType(PlatformTypeEnum.MINI_APP.getValue());
|
||||
mpCashierCartMapper.insert(cashierCart);
|
||||
|
||||
@@ -984,8 +976,19 @@ public class CartService {
|
||||
|
||||
}
|
||||
|
||||
public synchronized void addGlobalCode(String day, String clientType, String shopId) {
|
||||
String code = stringRedisTemplate.opsForValue().get("SHOP:CODE:" + clientType + ":" + shopId + ":" + day);
|
||||
if (StrUtil.isBlank(code)) {
|
||||
stringRedisTemplate.opsForValue().set("SHOP:CODE:" + clientType + ":" + shopId + ":" + day, "1");
|
||||
} else {
|
||||
stringRedisTemplate.opsForValue().get("SHOP:CODE:" + clientType + ":" + shopId + ":" + (Integer.parseInt(code) + 1));
|
||||
}
|
||||
stringRedisTemplate.opsForValue().setIfAbsent("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + day, "1");
|
||||
}
|
||||
|
||||
|
||||
private TbOrderInfo createOrderInfoWithCoupon(CreateOrderDTO createOrderDTO, OrderPriceDTO priceDTO, ShopEatTypeInfoDTO eatTypeInfoDTO,
|
||||
TbOrderInfo orderInfo, TbCashierCart seatCart, TbShopUser shopUser, TbShopTable shopTable, OrderCouponInfoDTO couponInfoDTO) {
|
||||
TbOrderInfo orderInfo, TbCashierCart seatCart, TbShopUser shopUser, TbShopTable shopTable, OrderCouponInfoDTO couponInfoDTO, String masterId) {
|
||||
Integer placeNum = getCurrentPlaceNum(eatTypeInfoDTO.getTableId(), eatTypeInfoDTO.getShopInfo().getId(), eatTypeInfoDTO);
|
||||
// 修改订单信息
|
||||
if (orderInfo == null) {
|
||||
@@ -1005,8 +1008,16 @@ public class CartService {
|
||||
}
|
||||
orderInfo.setMerchantId(merchantAccount.getId().toString());
|
||||
orderInfo.setIsPostpaid(eatTypeInfoDTO.isDineInAfter() ? 1 : 0);
|
||||
if (eatTypeInfoDTO.isIncrMaterId()) {
|
||||
String key = RedisCst.getMasterIdKey(String.valueOf(createOrderDTO.getShopId()), DateUtils.getDay(), orderInfo.getTableId());
|
||||
stringRedisTemplate.delete(key);
|
||||
} else {
|
||||
addGlobalCode(DateUtils.getDay(), "pc", String.valueOf(createOrderDTO.getShopId()));
|
||||
}
|
||||
}
|
||||
|
||||
// 更新取餐号
|
||||
orderInfo.setMasterId(masterId);
|
||||
orderInfo.setOutNumber(getOutNumber(createOrderDTO.getShopId().toString()).toString());
|
||||
orderInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
orderInfo.setSettlementAmount(priceDTO.getTotalAmount());
|
||||
@@ -1038,9 +1049,8 @@ public class CartService {
|
||||
}
|
||||
|
||||
private OrderPriceDTO createOrderDetailWithCoupon(List<TbCashierCart> fullCashierCarts, Integer orderId,
|
||||
Integer shopId, ShopEatTypeInfoDTO shopEatTypeInfoDTO, boolean onlyChangeCoupon) {
|
||||
Integer shopId, ShopEatTypeInfoDTO shopEatTypeInfoDTO, boolean onlyChangeCoupon, String masterId) {
|
||||
OrderPriceDTO priceDTO = new OrderPriceDTO();
|
||||
|
||||
List<Integer> cartIds = fullCashierCarts.stream().map(TbCashierCart::getId).collect(Collectors.toList());
|
||||
// 查询历史orderDetail
|
||||
List<TbOrderDetail> oldOrderDetailList = orderDetailService
|
||||
@@ -1056,6 +1066,9 @@ public class CartService {
|
||||
});
|
||||
|
||||
for (TbCashierCart cashierCart : fullCashierCarts) {
|
||||
// if (StrUtil.isNotBlank(cashierCart.getMasterId())) {
|
||||
cashierCart.setMasterId(masterId);
|
||||
// }
|
||||
// 设置打包费
|
||||
if (shopEatTypeInfoDTO.isTakeout() && !TableConstant.CashierCart.ID.equals(cashierCart.getProductId())) {
|
||||
cashierCart.setTableId("");
|
||||
@@ -1151,7 +1164,7 @@ public class CartService {
|
||||
couponVo.setCurrentUseNum(couponVo.getCurrentUseNum() - cashierCart.getNumber());
|
||||
currentUseNum = BigDecimal.valueOf(cashierCart.getNumber());
|
||||
// 优惠券数量小于购物车数量,分割购物车数据
|
||||
}else if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) {
|
||||
} else if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) {
|
||||
currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum());
|
||||
BigDecimal cartNum = BigDecimal.valueOf(cashierCart.getNumber());
|
||||
int balanceNum = cashierCart.getTotalNumber() - couponVo.getCurrentUseNum();
|
||||
@@ -1225,13 +1238,18 @@ public class CartService {
|
||||
tbUserCouponVos = new ArrayList<>();
|
||||
tbUserCouponVos.add(item);
|
||||
couponMap.put(item.getProId().toString(), tbUserCouponVos);
|
||||
}else {
|
||||
} else {
|
||||
tbUserCouponVos.add(item);
|
||||
}
|
||||
});
|
||||
HashMap<String, List<TbUserCouponVo>> usedCouponMap = new HashMap<>();
|
||||
ArrayList<TbActivateOutRecord> outRecords = new ArrayList<>();
|
||||
ArrayList<TbCashierCart> resetCouponList = new ArrayList<>();
|
||||
for (TbCashierCart cashierCart : cartInfoDTO.getNewCashierCarts()) {
|
||||
if (!couponMap.isEmpty()) {
|
||||
resetCouponList.add(cashierCart);
|
||||
cashierCart.setUserCouponId(null);
|
||||
}
|
||||
discountAmount = reduceProCoupon(couponMap, cashierCart, usedCouponMap, discountAmount, balanceCartList, outRecords, memberId);
|
||||
}
|
||||
|
||||
@@ -1241,6 +1259,21 @@ public class CartService {
|
||||
cashierCartService.saveBatch(balanceCartList);
|
||||
}
|
||||
// 更新购物车信息
|
||||
if (!resetCouponList.isEmpty()) {
|
||||
// 取消之前使用的历史券
|
||||
|
||||
ArrayList<Integer> resetCartIds = new ArrayList<>();
|
||||
resetCouponList.forEach(item -> {
|
||||
if (item.getUserCouponId() == null) {
|
||||
resetCartIds.add(item.getId());
|
||||
}
|
||||
});
|
||||
if (!resetCartIds.isEmpty()) {
|
||||
cashierCartService.update(new LambdaUpdateWrapper<TbCashierCart>()
|
||||
.in(TbCashierCart::getId, resetCartIds)
|
||||
.set(TbCashierCart::getUserCouponId, null));
|
||||
}
|
||||
}
|
||||
cashierCartService.updateBatchById(cartInfoDTO.getNewCashierCarts());
|
||||
|
||||
couponInfoDTO.setOutRecordList(outRecords);
|
||||
@@ -1262,7 +1295,7 @@ public class CartService {
|
||||
// 设置会员信息及价格
|
||||
if (shopUser.getIsVip() == 0) {
|
||||
tbCashierCart.setIsMember(0);
|
||||
}else {
|
||||
} else {
|
||||
if (!TableConstant.CashierCart.ID.equals(tbCashierCart.getProductId())) {
|
||||
TbProductSkuWithBLOBs sku = productSkuMapper.selectByPrimaryKey(Integer.valueOf(tbCashierCart.getSkuId()));
|
||||
tbCashierCart.setIsMember(sku.getMemberPrice() != null && sku.getMemberPrice().compareTo(BigDecimal.ZERO) > 0 ? 1 : 0);
|
||||
@@ -1325,6 +1358,42 @@ public class CartService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getMasterId(String shopId, String tableId) {
|
||||
String day = DateUtils.getDay();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
// 当前台桌码
|
||||
String key = RedisCst.getMasterIdKey(shopId, day, tableId);
|
||||
String userCode = stringRedisTemplate.opsForValue().get(key);
|
||||
|
||||
if (StringUtils.isEmpty(userCode) || "null".equals(userCode) || "#null".equals(userCode)) {
|
||||
String code = "#" + generateOrderCode(day, "pc", String.valueOf(shopId));
|
||||
stringRedisTemplate.opsForValue().set(key, code);
|
||||
return code;
|
||||
} else {
|
||||
return userCode;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized String generateOrderCode(String day, String clientType, String shopId) {
|
||||
String code = stringRedisTemplate.opsForValue().get("SHOP:CODE:" + clientType + ":" + shopId + ":" + day);
|
||||
// 使用顺序递增的计数器生成取餐码
|
||||
String orderCode = "";
|
||||
if (StringUtils.isEmpty(code) || "null".equals(code)) {
|
||||
orderCode = "1";
|
||||
stringRedisTemplate.opsForValue().set("SHOP:CODE:" + clientType + ":" + shopId + ":" + day, "1");
|
||||
} else {
|
||||
orderCode = String.valueOf(Integer.parseInt(code.replace("#", "")) + 1);
|
||||
}
|
||||
stringRedisTemplate.opsForValue().set("SHOP:CODE:" + clientType + ":" + shopId + ":" + day, orderCode);
|
||||
boolean flag = Boolean.TRUE.equals(stringRedisTemplate.opsForValue().setIfAbsent("SHOP:CODE:SET" + clientType + ":" + shopId + ":" + day, orderCode));
|
||||
if (flag) {
|
||||
return generateOrderCode(day, clientType, shopId);
|
||||
}
|
||||
// 增加计数器
|
||||
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result createOrder(CreateOrderDTO orderDTO) {
|
||||
try {
|
||||
@@ -1357,7 +1426,7 @@ public class CartService {
|
||||
List<TbCashierCart> cashierCartList;
|
||||
if (orderDTO.isOnlyChangeCoupon()) {
|
||||
cashierCartList = cashierCartService.selectByOrderId(orderDTO.getShopId(), orderDTO.getOrderId());
|
||||
}else {
|
||||
} else {
|
||||
cashierCartList = cashierCartService.selectByShopEatTypeInfo(shopEatTypeInfoDTO, orderDTO.getUserId());
|
||||
}
|
||||
if (cashierCartList.isEmpty()) {
|
||||
@@ -1394,12 +1463,14 @@ public class CartService {
|
||||
}
|
||||
|
||||
// 创建订单详情数据
|
||||
OrderPriceDTO detailPriceDTO = createOrderDetailWithCoupon(cartInfoDTO.getCashierCarts(), cartInfoDTO.getOrderId(), orderDTO.getShopId(), shopEatTypeInfoDTO, orderDTO.isOnlyChangeCoupon());
|
||||
String masterId = getMasterId(shopId, shopEatTypeInfoDTO.getTableId());
|
||||
OrderPriceDTO detailPriceDTO = createOrderDetailWithCoupon(cartInfoDTO.getCashierCarts(), cartInfoDTO.getOrderId(),
|
||||
orderDTO.getShopId(), shopEatTypeInfoDTO, orderDTO.isOnlyChangeCoupon(), masterId);
|
||||
detailPriceDTO.setProductDiscountAmount(discountAmount);
|
||||
|
||||
// 是否是第一次创建订单
|
||||
orderInfo = createOrderInfoWithCoupon(orderDTO, detailPriceDTO, shopEatTypeInfoDTO,
|
||||
orderInfo, cartInfoDTO.getSeatCart(), tbShopUser, shopTable, couponInfo);
|
||||
orderInfo, cartInfoDTO.getSeatCart(), tbShopUser, shopTable, couponInfo, masterId);
|
||||
|
||||
if (orderInfo.getId() == null) {
|
||||
mpOrderInfoMapper.insert(orderInfo);
|
||||
@@ -1407,7 +1478,7 @@ public class CartService {
|
||||
|
||||
// 计算订单满减优惠
|
||||
TbActivateOutRecord outRecord = calcOrderInfoDiscount(orderDTO, orderInfo, couponInfo, Integer.valueOf(tbShopUser.getId()));
|
||||
if (couponInfo != null) {
|
||||
if (couponInfo != null) {
|
||||
if (outRecord != null) {
|
||||
couponInfo.getOutRecordList().add(outRecord);
|
||||
}
|
||||
@@ -1441,6 +1512,7 @@ public class CartService {
|
||||
mpOrderInfoMapper.updateById(orderInfo);
|
||||
|
||||
if (!orderDTO.isOnlyChangeCoupon()) {
|
||||
|
||||
String tableCartKey = RedisCst.getTableCartKey(shopId, shopEatTypeInfoDTO.isOpenDineIn() ? tableId : null, Integer.valueOf(userId));
|
||||
redisUtil.deleteByKey(tableCartKey);
|
||||
}
|
||||
@@ -1572,7 +1644,7 @@ public class CartService {
|
||||
// .eq(TbCashierCart::getTableId, choseEatModelDTO.getTableId())
|
||||
.and(q -> q.eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()).or().isNull(TbCashierCart::getUseType).or().eq(TbCashierCart::getUseType, ""))
|
||||
.eq(TbCashierCart::getStatus, "create");
|
||||
}else {
|
||||
} else {
|
||||
queryWrapper = new LambdaQueryWrapper<TbCashierCart>()
|
||||
.eq(TbCashierCart::getShopId, choseEatModelDTO.getShopId())
|
||||
.gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())
|
||||
|
||||
@@ -86,7 +86,7 @@ public class GroupOrderInfoService {
|
||||
result.setAddress(shopInfo.getAddress());
|
||||
result.setShopPhone(shopInfo.getPhone());
|
||||
|
||||
TbProductWithBLOBs product = tbProductMapper.selectByPrimaryKey(groupOrder.getProId());
|
||||
TbProduct product = tbProductMapper.selectByPrimaryKey(groupOrder.getProId());
|
||||
result.setTagVos(JSONUtil.parseListTNewList(product.getGroupSnap(), ProductVo.class));
|
||||
|
||||
|
||||
|
||||
@@ -558,7 +558,13 @@ public class PayService {
|
||||
return Result.fail("订单十五分钟内有效,当前已超时,请重新下单。");
|
||||
}
|
||||
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getUserId()));
|
||||
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(memberId);
|
||||
if (ObjectUtil.isEmpty(user) || user.getIsVip() == null || !"1".equals(user.getIsVip().toString())) {
|
||||
// return Result.failCode("会员卡余额不足","1");
|
||||
return Result.success(CodeEnum.SUCCESS, "4");
|
||||
}
|
||||
|
||||
TbUserInfo userInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(user.getUserId()));
|
||||
if (ObjectUtil.isEmpty(userInfo)) {
|
||||
return Result.fail("未获取到用户信息");
|
||||
}
|
||||
@@ -583,11 +589,6 @@ public class PayService {
|
||||
}
|
||||
|
||||
|
||||
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(memberId);
|
||||
if (ObjectUtil.isEmpty(user) || user.getIsVip() == null || !"1".equals(user.getIsVip().toString())) {
|
||||
// return Result.failCode("会员卡余额不足","1");
|
||||
return Result.success(CodeEnum.SUCCESS, "4");
|
||||
}
|
||||
|
||||
if (N.gt(orderInfo.getOrderAmount(), user.getAmount())) {
|
||||
// return Result.failCode("会员卡余额不足","2");
|
||||
@@ -615,6 +616,7 @@ public class PayService {
|
||||
|
||||
orderInfo.setPayAmount(orderInfo.getOrderAmount());
|
||||
orderInfo.setMemberId(memberId);
|
||||
orderInfo.setUserId(userInfo.getId().toString());
|
||||
orderInfo.setPayType("deposit");
|
||||
orderInfo.setStatus("closed");
|
||||
orderInfo.setPaidTime(System.currentTimeMillis());
|
||||
@@ -684,6 +686,12 @@ public class PayService {
|
||||
|
||||
// 重置台桌状态
|
||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
||||
// 增加台桌取餐码
|
||||
if (TableConstant.OrderInfo.UseType.DINE_IN_AFTER.equalsVals(orderInfo.getUseType())) {
|
||||
String key = RedisCst.getMasterIdKey(String.valueOf(orderInfo.getShopId()), DateUtils.getDay(), orderInfo.getTableId());
|
||||
stringRedisTemplate.delete(key);
|
||||
}
|
||||
|
||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||
@@ -1333,6 +1341,12 @@ public class PayService {
|
||||
|
||||
// 重置台桌状态
|
||||
if (StrUtil.isNotBlank(orderInfo.getTableId())) {
|
||||
// 增加台桌取餐码
|
||||
if (TableConstant.OrderInfo.UseType.DINE_IN_AFTER.equalsVals(orderInfo.getUseType())) {
|
||||
String key = RedisCst.getMasterIdKey(String.valueOf(orderInfo.getShopId()), DateUtils.getDay(), orderInfo.getTableId());
|
||||
stringRedisTemplate.delete(key);
|
||||
}
|
||||
|
||||
TbShopTable shopTable = mpShopTableService.selectByQrcode(orderInfo.getTableId());
|
||||
if (shopTable.getAutoClear() != null && shopTable.getAutoClear() == 1) {
|
||||
mpShopTableService.updateStateByQrcode(orderInfo.getTableId(), TableConstant.ShopTable.State.IDLE);
|
||||
@@ -1509,7 +1523,7 @@ public class PayService {
|
||||
//充值送积分
|
||||
TbActivate activate = tbActivateMapper.selectByAmountScope(tbShopUser.getShopId(), memberIn.getAmount());
|
||||
if (ObjectUtil.isNotNull(activate)) {
|
||||
tbMemberPointsService.addPoints(Convert.toLong(tbShopUser.getId()), activate.getGiftAmount(), StrUtil.format("充值¥{}送{}积分", memberIn.getAmount(), activate.getGiftAmount()), null, memberIn.getOrderNo());
|
||||
tbMemberPointsService.addPoints(Convert.toLong(tbShopUser.getId()), activate.getGiftPoints(), StrUtil.format("充值¥{}送{}积分", memberIn.getAmount(), activate.getGiftPoints()), null, memberIn.getOrderNo());
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -1711,7 +1725,7 @@ public class PayService {
|
||||
//充值送积分
|
||||
TbActivate activate = tbActivateMapper.selectByAmountScope(tbShopUser.getShopId(), memberIn.getAmount());
|
||||
if (ObjectUtil.isNotNull(activate)) {
|
||||
tbMemberPointsService.addPoints(Convert.toLong(tbShopUser.getId()), activate.getGiftAmount(), StrUtil.format("充值¥{}送{}积分", memberIn.getAmount(), activate.getGiftAmount()), null, memberIn.getOrderNo());
|
||||
tbMemberPointsService.addPoints(Convert.toLong(tbShopUser.getId()), activate.getGiftPoints(), StrUtil.format("充值¥{}送{}积分", memberIn.getAmount(), activate.getGiftPoints()), null, memberIn.getOrderNo());
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("shopId", memberIn.getShopId());
|
||||
|
||||
@@ -424,7 +424,7 @@ public class ProductService {
|
||||
spec.put("isGrounding", true);
|
||||
TbProductSku sku = (TbProductSku) spec.get("info");
|
||||
if (sku != null) {
|
||||
tbProduct.setIsPauseSale(sku.getIsPauseSale().byteValue());
|
||||
tbProduct.setIsPauseSale(sku.getIsPauseSale());
|
||||
checkPauseSale(tbProduct, new ArrayList<>(Collections.singletonList(sku)), true);
|
||||
spec.put("isPauseSale", tbProduct.getIsPauseSale());
|
||||
}else {
|
||||
@@ -441,7 +441,7 @@ public class ProductService {
|
||||
itemMap.put("isGrounding", false);
|
||||
TbProductSku sku = unGroundingMap.get("specSnap");
|
||||
if (sku != null) {
|
||||
tbProduct.setIsPauseSale(sku.getIsPauseSale().byteValue());
|
||||
tbProduct.setIsPauseSale(sku.getIsPauseSale());
|
||||
checkPauseSale(tbProduct, Collections.singletonList(sku), true);
|
||||
itemMap.put("isPauseSale", tbProduct.getIsPauseSale());
|
||||
}else {
|
||||
@@ -515,7 +515,7 @@ public class ProductService {
|
||||
}
|
||||
|
||||
if (item.getMemberPrice() == null || item.getMemberPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
item.setMealPrice(item.getSalePrice());
|
||||
item.setMemberPrice(item.getSalePrice());
|
||||
}
|
||||
}
|
||||
// 销量
|
||||
@@ -535,7 +535,7 @@ public class ProductService {
|
||||
it.setProductSkuResult(skuResult);
|
||||
if (isVip) {
|
||||
it.setLowPrice(BigDecimal.ZERO);
|
||||
it.setIsVip(Byte.parseByte("1"));
|
||||
it.setIsVip(1);
|
||||
}
|
||||
});
|
||||
return products;
|
||||
@@ -547,7 +547,7 @@ public class ProductService {
|
||||
public void checkPauseSale(TbProduct tbProduct, List<TbProductSku> skus, boolean isSingle) {
|
||||
if (tbProduct.getIsStock() == 1) {//库存开关 1开启
|
||||
if (tbProduct.getStockNumber() != null && tbProduct.getStockNumber() <= 0) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
tbProduct.setIsPauseSale(1);//售罄 1暂停
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -573,14 +573,14 @@ public class ProductService {
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isEmpty(skus)) {
|
||||
tbProduct.setIsPauseSale(Byte.parseByte("1"));//售罄 1暂停
|
||||
tbProduct.setIsPauseSale(1);//售罄 1暂停
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Result queryProductSku(String code, String shopId, String productId, String spec_tag,String isVip) {
|
||||
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId) || StringUtils.isEmpty(isVip)|| isVip.equals("undefined") ) {
|
||||
public Result queryProductSku(String code, String shopId, String productId, String spec_tag) {
|
||||
if (ObjectUtil.isEmpty(shopId) || ObjectUtil.isEmpty(productId) ) {
|
||||
return Result.fail("参数错误");
|
||||
}
|
||||
TbProductSkuWithBLOBs tbProductSkuWithBLOBs = tbProductSkuMapper.selectByShopIdAndProductIdAndSpec(shopId, productId, spec_tag);
|
||||
@@ -593,7 +593,7 @@ public class ProductService {
|
||||
tbProductSkuWithBLOBs.setId(null);
|
||||
}else {
|
||||
if (StringUtils.isNotBlank(code)) {
|
||||
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId,isVip);
|
||||
Integer sum = tbProductMapper.selectByCodeAndSkuId(code, tbProductSkuWithBLOBs.getId(), shopId);
|
||||
tbProductSkuWithBLOBs.setNumber(sum);
|
||||
}
|
||||
}
|
||||
@@ -704,7 +704,11 @@ public class ProductService {
|
||||
homeVO.setDiscount(BigDecimalUtils.getDiscount(tbProductSku.getOriginPrice(), tbProductSku.getSalePrice()));
|
||||
}
|
||||
//销量
|
||||
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||
if (o.getNumber() == null) {
|
||||
homeVO.setRealSalesNumber(BigDecimal.ZERO);
|
||||
}else {
|
||||
homeVO.setRealSalesNumber(new BigDecimal(o.getNumber()));
|
||||
}
|
||||
//现价
|
||||
homeVO.setSalePrice(new BigDecimal(tbProductSku.getSalePrice().toString()));
|
||||
// 共省金额
|
||||
@@ -734,13 +738,13 @@ public class ProductService {
|
||||
lat = "34.343207";
|
||||
lng = "108.939645";
|
||||
}
|
||||
CompletableFuture<TbProductWithBLOBs> product = CompletableFuture.supplyAsync(() ->
|
||||
CompletableFuture<TbProduct> product = CompletableFuture.supplyAsync(() ->
|
||||
tbProductMapper.selectByPrimaryKey(productId));
|
||||
CompletableFuture<List<TbProductSku>> productSku = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSkuMapper.selectSku(productId.toString()));
|
||||
Threads.call(product, productSku);
|
||||
|
||||
TbProductWithBLOBs tbProduct = product.get();
|
||||
TbProduct tbProduct = product.get();
|
||||
TbShopInfo tbShopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(tbProduct.getShopId()));
|
||||
TbPurchaseNotice tbPurchaseNotice = purchaseNoticeMapper.queryByCouponId(tbProduct.getId());
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -406,7 +406,7 @@
|
||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||
WHERE
|
||||
pro.type_enum = 'group'
|
||||
AND pro.is_combo = '1'
|
||||
# AND pro.is_combo = '1'
|
||||
GROUP BY
|
||||
sku.product_id
|
||||
ORDER BY
|
||||
@@ -426,7 +426,7 @@
|
||||
LEFT JOIN tb_product_sku sku ON pro.id = sku.product_id
|
||||
WHERE
|
||||
pro.type_enum = 'group'
|
||||
AND pro.is_combo = '1'
|
||||
# AND pro.is_combo = '1'
|
||||
GROUP BY
|
||||
sku.product_id
|
||||
ORDER BY
|
||||
|
||||
Reference in New Issue
Block a user