记得上下班打卡 | git大法好,push需谨慎

Commit 78b5d5ed authored by 张国柄's avatar 张国柄

~API:商铺活动:优惠券新增、详情、列表;

parent 8aaafc1b
......@@ -118,4 +118,25 @@ public class GoblinRedisConst {
*/
public static final String REAL_STOCK_SKU = PREFIX.concat("real_stock_sku:");
/* ----------------------------------------------------------------- */
/**
* 商铺活动:优惠券基本信息
* {goblin:s_coupon:${store_coupon_id}, com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponVo}
*/
public static final String STORE_COUPON = PREFIX.concat("s_coupon:");
/**
* 商铺活动:优惠券适用商品ID集合
* {goblin:s_coupon_r:${store_coupon_id}, JsonUtils.toJson(List<String:spu_id>)}
*/
public static final String STORE_COUPON_RULE = PREFIX.concat("s_coupon_r:");
/* ----------------------------------------------------------------- */
/**
* 商品SPU参与的活动ID集合
* {goblin:spu_market:${spu_id}, JsonUtils.toJson(List<com.liquidnet.service.goblin.dto.GoblinGoodsMarketDto>)}
*/
public static final String GOODS_MARKET = PREFIX.concat("spu_market:");
/* ----------------------------------------------------------------- */
}
package com.liquidnet.service.goblin.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class GoblinGoodsMarketDto implements Serializable, Cloneable {
private static final long serialVersionUID = -3312075068650898199L;
private String marketId;
private String marketType;
}
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtCouponAddParam", description = "商铺活动:添加优惠券入参")
......@@ -24,7 +26,7 @@ public class GoblinStoreMgtCouponAddParam implements Serializable {
* ---------------------------- 基本信息 ----------------------------
**/
@ApiModelProperty(position = 12, required = true, value = "卡券名称[50]")
@ApiModelProperty(position = 12, required = true, value = "卡券名称[50]", example = "DEV_CESHI")
@NotBlank(message = "卡券名称不能为空")
@Size(max = 50, message = "商品名称长度超限")
private String title;
......@@ -35,34 +37,89 @@ public class GoblinStoreMgtCouponAddParam implements Serializable {
@Size(max = 255, message = "卡券描述长度超限")
private String notice;
@ApiModelProperty(position = 15, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]")
@ApiModelProperty(position = 15, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]", example = "2022-12-01 00:00:00")
@NotBlank(message = "发布时间不能为空")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
private String startDt;
@ApiModelProperty(position = 16, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]")
@ApiModelProperty(position = 16, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]", example = "2022-12-01 00:00:00")
@NotBlank(message = "发布时间不能为空")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
private String endDt;
@ApiModelProperty(position = 17, required = true, value = "卡券类型信息LIST")
@NotNull(message = "卡券类型信息不能为空")
@Valid
private List<GoblinStoreMgtCouponAddType> couponTypeParamList;
@ApiModelProperty(position = 10, required = true, value = "券类型[1-代金券|2-折扣券|3-满减券]", allowableValues = "1,2,3", example = "1")
@NotNull(message = "券类型不能为空")
@Pattern(regexp = "\\b(1|2|3)\\b", message = "券类型参数无效")
private String type;//
@ApiModelProperty(position = 11, required = true, value = "卡券库存,默认:0为无限", example = "0")
@NotNull(message = "卡券库存不能为空")
@Min(value = 0, message = "卡券库存不能小于0")
private Integer stock;
@ApiModelProperty(position = 12, required = true, value = "触发金额[8,2]", example = "1")
@DecimalMin(value = "0.01", message = "触发金额不能小于0.01")
private BigDecimal triggers;
@ApiModelProperty(position = 12, required = false, value = "面值[8,2]", example = "5")
@DecimalMin(value = "0.01", message = "面值不能小于0.01")
private BigDecimal valFace;
@ApiModelProperty(position = 12, required = false, value = "折扣[8,2]", example = "0.8")
@DecimalMin(value = "0.01", message = "折扣不能小于0.01")
private BigDecimal discount;
@ApiModelProperty(position = 12, required = false, value = "满减~满[8,2]", example = "10")
@DecimalMin(value = "0.02", message = "满减金额不能小于0.02")
private BigDecimal valOver;
@ApiModelProperty(position = 12, required = false, value = "满减~减[8,2]", example = "5")
@DecimalMin(value = "0.01", message = "满减面额不能小于0.01")
private BigDecimal valMinus;
@ApiModelProperty(position = 12, required = false, value = "抵扣上限金额[8,2]", example = "2")
@DecimalMin(value = "0.01", message = "抵扣上限金额不能小于0.01")
private BigDecimal deduction;
@ApiModelProperty(position = 18, required = true, value = "限领数量,默认:1张/人", example = "1")
@NotNull(message = "限领数量不能为空")
@Min(value = 1, message = "限领数量不能小于1")
private Integer receiveLimit;
@ApiModelProperty(position = 19, required = true, value = "领取约束[0-不开放|1-开放]", allowableValues = "0,1")
@NotNull(message = "领取约束不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "领取约束参数无效")
private Integer receiveCurb;
private String receiveCurb;//
/**
* ---------------------------- 发放设置 ----------------------------
**/
@ApiModelProperty(position = 20, required = true, value = "使用范围[0-全部商品|1-部分商品]", allowableValues = "0,1", example = "0")
private String useScope;
@NotNull(message = "使用范围不能为空")
@Pattern(regexp = "\\b(0|1)\\b", message = "使用范围参数无效")
private String useScope;//
@ApiModelProperty(position = 21, required = false, value = "适用SPUID集合LIST")
private List<String> spuIdList;
// private List<GoblinStoreMgtCouponAddGoods> skuParamList;
public GoblinStoreCouponBasicVo initStoreCouponBasicInfo() {
GoblinStoreCouponBasicVo storeCouponBasicVo = GoblinStoreCouponBasicVo.getNew();
// storeCouponBasicVo.setStoreCouponId();
// storeCouponBasicVo.setStoreCouponNo();
storeCouponBasicVo.setStoreId(this.getStoreId());
storeCouponBasicVo.setTitle(this.getTitle());
storeCouponBasicVo.setLabel(this.getLabel());
storeCouponBasicVo.setNotice(this.getNotice());
storeCouponBasicVo.setType(this.getType());
storeCouponBasicVo.setStock(this.getStock());
storeCouponBasicVo.setTriggers(this.getTriggers());
// storeCouponBasicVo.setValFace();
// storeCouponBasicVo.setDiscount();
// storeCouponBasicVo.setValOver();
// storeCouponBasicVo.setValMinus();
// storeCouponBasicVo.setDeduction();
storeCouponBasicVo.setReceiveLimit(this.getReceiveLimit());
storeCouponBasicVo.setReceiveCurb(this.getReceiveCurb());
storeCouponBasicVo.setUseScope(this.getUseScope());
storeCouponBasicVo.setState("0");// 等待开始
storeCouponBasicVo.setStartTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getStartDt()));
storeCouponBasicVo.setEndTime(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getEndDt()));
storeCouponBasicVo.setSpuIdList(this.getSpuIdList());
return storeCouponBasicVo;
}
}
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(value = "GoblinStoreMgtCouponTypeParam", description = "商铺活动:添加优惠券:卡券类型入参")
@Data
public class GoblinStoreMgtCouponAddType implements Serializable {
private static final long serialVersionUID = 1851062573283411594L;
@ApiModelProperty(position = 10, required = true, value = "券类型[1-代金券|2-折扣券|3-满减券]", allowableValues = "1,2,3")
@NotNull(message = "券类型不能为空")
@Pattern(regexp = "\\b(1|2|3)\\b", message = "券类型参数无效")
private String type;
@ApiModelProperty(position = 11, required = true, value = "卡券库存,默认:0为无限")
@NotNull(message = "卡券库存不能为空")
@Min(value = 0, message = "卡券库存不能小于0")
private Integer stock;
@ApiModelProperty(position = 12, required = true, value = "触发金额[8,2]", example = "1")
@DecimalMin(value = "0.01", message = "触发金额不能小于0.01")
private BigDecimal triggers;
@ApiModelProperty(position = 12, required = false, value = "面值[8,2]", example = "5")
@DecimalMin(value = "0.01", message = "面值不能小于0.01")
private BigDecimal valFace;
@ApiModelProperty(position = 12, required = false, value = "折扣[8,2]", example = "0.8")
@DecimalMin(value = "0.01", message = "折扣不能小于0.01")
private BigDecimal discount;
@ApiModelProperty(position = 12, required = false, value = "满减~满[8,2]", example = "10")
@DecimalMin(value = "0.02", message = "满减金额不能小于0.02")
private BigDecimal valOver;
@ApiModelProperty(position = 12, required = false, value = "满减~减[8,2]", example = "5")
@DecimalMin(value = "0.01", message = "满减面额不能小于0.01")
private BigDecimal valMinus;
@ApiModelProperty(position = 12, required = false, value = "抵扣上限金额[8,2]", example = "2")
@DecimalMin(value = "0.01", message = "抵扣上限金额不能小于0.01")
private BigDecimal deduction;
}
......@@ -29,7 +29,7 @@ public class GoblinStoreMgtCouponFilterParam implements Serializable {
@ApiModelProperty(position = 14, required = false, value = "卡券编码[64]")
private String storeCouponNo;
@ApiModelProperty(position = 15, required = false, value = "卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]", allowableValues = "0,1,2,3")
private String state;
private Integer state;
@ApiModelProperty(position = 16, required = false, value = "开始日期[YYYY-MM-DD]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "开始日期格式有误")
private String startTime;
......
package com.liquidnet.service.goblin.dto.manage.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtCouponInfoVo", description = "商铺活动:优惠券详情")
......@@ -19,48 +14,10 @@ import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreMgtCouponInfoVo implements Serializable, Cloneable {
private static final long serialVersionUID = -5779799640116243874L;
@ApiModelProperty(position = 10, value = "卡券ID[64]")
private String storeCouponId;
@ApiModelProperty(position = 11, value = "卡券编码")
private String storeCouponNo;
@ApiModelProperty(position = 12, value = "店铺ID")
private String storeId;
@ApiModelProperty(position = 13, value = "卡券名称")
private String title;
@ApiModelProperty(position = 14, value = "标注")
private String label;
@ApiModelProperty(position = 15, value = "卡券描述")
private String notice;
@ApiModelProperty(position = 16, value = "券类型[1-代金券|2-折扣券|3-满减券]")
private Integer type;
@ApiModelProperty(position = 17, value = "卡券库存,默认:0为无限")
private Integer stock;
@ApiModelProperty(position = 18, value = "触发金额")
private BigDecimal triggers;
@ApiModelProperty(position = 19, value = "面值")
private BigDecimal valFace;
@ApiModelProperty(position = 20, value = "折扣[8折即0.8]")
private BigDecimal discount;
@ApiModelProperty(position = 21, value = "满减~满")
private BigDecimal valOver;
@ApiModelProperty(position = 22, value = "满减~减")
private BigDecimal valMinus;
@ApiModelProperty(position = 23, value = "抵扣上限金额(最多扣除金额)")
private BigDecimal deduction;
@ApiModelProperty(position = 24, value = "限领数量,默认:1张/人")
private Integer receiveLimit;
@ApiModelProperty(position = 25, value = "领取约束[0-不开放|1-开放]")
private Integer receiveCurb;
@ApiModelProperty(position = 26, value = "使用范围[0-全部商品|1-部分商品]")
private Integer useScope;
@ApiModelProperty(position = 27, value = "卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]")
private Integer state;
@ApiModelProperty(position = 28, value = "开始时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime startTime;
@ApiModelProperty(position = 14, value = "结束时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime endTime;
@ApiModelProperty(position = 10, value = "卡券信息")
private GoblinStoreCouponVo couponVo;
@ApiModelProperty(position = 10, value = "关联商品信息[仅当`couponVo.useScope=1`,即部分商品时处理该数据]")
private List<GoblinStoreMgtCouponSpuListVo> spuVoList;
private static final GoblinStoreMgtCouponInfoVo obj = new GoblinStoreMgtCouponInfoVo();
......
......@@ -37,4 +37,10 @@ public class GoblinStoreMgtCouponListVo implements Serializable, Cloneable {
@ApiModelProperty(position = 19, value = "创建时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt;
@ApiModelProperty(position = 20, value = "已领取库存")
private Integer receiveStock;
@ApiModelProperty(position = 21, value = "已使用库存")
private Integer usedStock;
}
package com.liquidnet.service.goblin.dto.manage.vo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(value = "GoblinStoreMgtCouponSpuListVo", description = "商铺活动:优惠券关联商品SPU信息")
@Data
public class GoblinStoreMgtCouponSpuListVo implements Serializable, Cloneable {
private static final long serialVersionUID = -4451898306126594819L;
@ApiModelProperty(position = 11, value = "spuId")
private String spuId;
@ApiModelProperty(position = 12, value = "商品名称")
private String name;
@ApiModelProperty(position = 13, value = "封面图片地址")
private String coverPic;
@ApiModelProperty(position = 14, value = "商品一级分类ID[30]")
private String cateFid;
@ApiModelProperty(position = 15, value = "商品二级分类ID[30]")
private String cateSid;
@ApiModelProperty(position = 16, value = "商品三级分类ID[30]")
private String cateTid;
@ApiModelProperty(position = 17, value = "价格区间MIN[20,2]")
private BigDecimal priceGe;
@ApiModelProperty(position = 18, value = "价格区间MAX[20,2]")
private BigDecimal priceLe;
private static final GoblinStoreMgtCouponSpuListVo obj = new GoblinStoreMgtCouponSpuListVo();
public static GoblinStoreMgtCouponSpuListVo getNew() {
try {
return (GoblinStoreMgtCouponSpuListVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinStoreMgtCouponSpuListVo();
}
}
public GoblinStoreMgtCouponSpuListVo copy(GoblinGoodsInfoVo source) {
if (null == source) return this;
this.setSpuId(source.getSpuId());
this.setName(source.getName());
this.setCoverPic(source.getCoverPic());
this.setCateFid(source.getCateFid());
this.setCateSid(source.getCateSid());
this.setCateTid(source.getCateTid());
this.setPriceGe(source.getPriceGe());
this.setPriceLe(source.getPriceLe());
return this;
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "GoblinStoreCouponBasicVo", description = "商铺活动:优惠券详情(包含关联商品ID)")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreCouponBasicVo implements Serializable, Cloneable {
private static final long serialVersionUID = -6233852543461320809L;
@ApiModelProperty(position = 10, value = "卡券ID[64]")
private String storeCouponId;
@ApiModelProperty(position = 11, value = "卡券编码")
private String storeCouponNo;
@ApiModelProperty(position = 12, value = "店铺ID")
private String storeId;
@ApiModelProperty(position = 13, value = "卡券名称")
private String title;
@ApiModelProperty(position = 14, value = "标注")
private String label;
@ApiModelProperty(position = 15, value = "卡券描述")
private String notice;
@ApiModelProperty(position = 16, value = "券类型[1-代金券|2-折扣券|3-满减券]")
private String type;
@ApiModelProperty(position = 17, value = "卡券库存,默认:0为无限")
private Integer stock;
@ApiModelProperty(position = 18, value = "触发金额")
private BigDecimal triggers;
@ApiModelProperty(position = 19, value = "面值")
private BigDecimal valFace;
@ApiModelProperty(position = 20, value = "折扣[8折即0.8]")
private BigDecimal discount;
@ApiModelProperty(position = 21, value = "满减~满")
private BigDecimal valOver;
@ApiModelProperty(position = 22, value = "满减~减")
private BigDecimal valMinus;
@ApiModelProperty(position = 23, value = "抵扣上限金额(最多扣除金额)")
private BigDecimal deduction;
@ApiModelProperty(position = 24, value = "叠加限制[0-限制|1-叠加]")
private String overlay;
@ApiModelProperty(position = 25, value = "#同类别券叠加适用")
private String overlayLevel;
@ApiModelProperty(position = 26, value = "限领数量,默认:1张/人")
private Integer receiveLimit;
@ApiModelProperty(position = 27, value = "领取约束[0-不开放|1-开放]")
private String receiveCurb;
@ApiModelProperty(position = 28, value = "使用范围[0-全部商品|1-部分商品]")
private String useScope;
@ApiModelProperty(position = 29, value = "卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]")
private String state;
@ApiModelProperty(position = 30, value = "开始时间")
// @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime startTime;
@ApiModelProperty(position = 31, value = "结束时间")
// @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime endTime;
@ApiModelProperty(position = 31, value = "删除标记[0-未删除|1-删除]")
private String delFlg;
private String createdBy;
// @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt;
private String updatedBy;
// @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt;
private String deletedBy;
// @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime deletedAt;
@ApiModelProperty(position = 32, required = false, value = "适用SPUID集合LIST")
private List<String> spuIdList;
private static final GoblinStoreCouponBasicVo obj = new GoblinStoreCouponBasicVo();
public static GoblinStoreCouponBasicVo getNew() {
try {
return (GoblinStoreCouponBasicVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinStoreCouponBasicVo();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinStoreCouponVo", description = "商铺活动:优惠券详情")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreCouponVo implements Serializable, Cloneable {
private static final long serialVersionUID = -6233852543461320809L;
@ApiModelProperty(position = 10, value = "卡券ID[64]")
private String storeCouponId;
@ApiModelProperty(position = 11, value = "卡券编码")
private String storeCouponNo;
@ApiModelProperty(position = 12, value = "店铺ID")
private String storeId;
@ApiModelProperty(position = 13, value = "卡券名称")
private String title;
@ApiModelProperty(position = 14, value = "标注")
private String label;
@ApiModelProperty(position = 15, value = "卡券描述")
private String notice;
@ApiModelProperty(position = 16, value = "券类型[1-代金券|2-折扣券|3-满减券]")
private String type;
@ApiModelProperty(position = 17, value = "卡券库存,默认:0为无限")
private Integer stock;
@ApiModelProperty(position = 18, value = "触发金额")
private BigDecimal triggers;
@ApiModelProperty(position = 19, value = "面值")
private BigDecimal valFace;
@ApiModelProperty(position = 20, value = "折扣[8折即0.8]")
private BigDecimal discount;
@ApiModelProperty(position = 21, value = "满减~满")
private BigDecimal valOver;
@ApiModelProperty(position = 22, value = "满减~减")
private BigDecimal valMinus;
@ApiModelProperty(position = 23, value = "抵扣上限金额(最多扣除金额)")
private BigDecimal deduction;
@ApiModelProperty(position = 24, value = "限领数量,默认:1张/人")
private Integer receiveLimit;
@ApiModelProperty(position = 25, value = "领取约束[0-不开放|1-开放]")
private String receiveCurb;
@ApiModelProperty(position = 26, value = "使用范围[0-全部商品|1-部分商品]")
private String useScope;
@ApiModelProperty(position = 27, value = "卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]")
private String state;
@ApiModelProperty(position = 28, value = "开始时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime startTime;
@ApiModelProperty(position = 14, value = "结束时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime endTime;
private static final GoblinStoreCouponVo obj = new GoblinStoreCouponVo();
public static GoblinStoreCouponVo getNew() {
try {
return (GoblinStoreCouponVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinStoreCouponVo();
}
}
}
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
public interface IGoblinstoreMgtCouponService {
/**
* 商铺活动:优惠券列表
*
* @param mgtCouponFilterParam GoblinStoreMgtCouponFilterParam
* @return PagedResult<GoblinStoreMgtCouponListVo>
*/
PagedResult<GoblinStoreMgtCouponListVo> couponList(GoblinStoreMgtCouponFilterParam mgtCouponFilterParam);
/**
* 商铺活动:优惠券添加
*
* @param uid UID
* @param storeCouponBasicVo GoblinStoreCouponBasicVo
*/
void couponAdd(String uid, GoblinStoreCouponBasicVo storeCouponBasicVo);
/**
* 商铺活动:优惠券详情
*
* @param storeId 店铺ID
* @param storeCouponId 优惠券ID
* @return GoblinStoreMgtCouponInfoVo
*/
GoblinStoreMgtCouponInfoVo couponInfo(String storeId, String storeCouponId);
//
// /**
// * 商铺活动:商品编辑:优惠券编辑
// *
// * @param uid UID
// * @param storeMgtGoodsAddParam GoblinStoreMgtGoodsAddParam
// * @return boolean
// */
// boolean goodsEdit(String uid, GoblinStoreMgtGoodsAddParam storeMgtGoodsAddParam);
//
// /**
// * 商铺活动:商品编辑:SKU编辑
// *
// * @param uid UID
// * @param storeMgtGoodsEditSkuParam GoblinStoreMgtGoodsEditSkuParam
// * @param goodsInfoVo GoblinGoodsInfoVo
// * @param del优惠券SpecMap Map<String, String>
// * @param beUpdate优惠券SpecFlg boolean
// * @return boolean
// */
// boolean goodsEditStock(String uid, GoblinStoreMgtGoodsEditSkuParam storeMgtGoodsEditSkuParam,
// GoblinGoodsInfoVo goodsInfoVo, Map<String, String> del优惠券SpecMap, boolean beUpdate优惠券SpecFlg);
//
// /**
// * 商铺活动:上下架商品
// *
// * @param storeMgtGoodsActionParam GoblinStoreMgtGoodsActionParam
// * @param uid UID
// * @param shelvesFlg true:上架|false:下架
// */
// void goodsShelvesProcessing(GoblinStoreMgtGoodsActionParam storeMgtGoodsActionParam, String uid, boolean shelvesFlg);
//
// /**
// * 商铺活动:删除商品
// *
// * @param storeMgtGoodsActionParam GoblinStoreMgtGoodsActionParam
// * @param uid UID
// */
// void goodsRemove(GoblinStoreMgtGoodsActionParam storeMgtGoodsActionParam, String uid);
}
......@@ -58,7 +58,7 @@ public class GoblinStoreCoupon implements Serializable {
/**
* 券类型[1-代金券|2-折扣券|3-满减券]
*/
private Integer type;
private String type;
/**
* 卡券库存,默认:0为无限
......@@ -98,12 +98,12 @@ public class GoblinStoreCoupon implements Serializable {
/**
* 叠加限制[0-限制|1-叠加]
*/
private Integer overlay;
private String overlay;
/**
* #同类别券叠加适用
*/
private Integer overlayLevel;
private String overlayLevel;
/**
* 限领数量,默认:1张/人
......@@ -113,17 +113,17 @@ public class GoblinStoreCoupon implements Serializable {
/**
* 领取约束[0-不开放|1-开放]
*/
private Integer receiveCurb;
private String receiveCurb;
/**
* 使用范围[0-全部商品|1-部分商品]
*/
private Integer useScope;
private String useScope;
/**
* 卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]
*/
private Integer state;
private String state;
/**
* 开始时间
......@@ -138,7 +138,7 @@ public class GoblinStoreCoupon implements Serializable {
/**
* 删除标记[0-未删除|1-删除]
*/
private Integer delFlg;
private String delFlg;
private String createdBy;
......
......@@ -42,7 +42,7 @@ public class GoblinStoreCouponRule implements Serializable {
/**
* 删除标记[0-未删除|1-删除]
*/
private Integer delFlg;
private String delFlg;
private String createdBy;
......
......@@ -39,7 +39,7 @@ public class GoblinUserCoupon implements Serializable {
/**
* 用户券状态[1-可用|2-无效|3-已过期|5-已使用]
*/
private Integer state;
private String state;
/**
* 激活时间
......
......@@ -963,37 +963,37 @@ drop table if exists goblin_store_coupon;
create table goblin_store_coupon
(
mid bigint unsigned auto_increment primary key,
store_coupon_id varchar(64) not null comment '卡券ID',
store_coupon_no varchar(64) not null comment '卡券编码',
store_id varchar(64) not null comment '店铺ID',
title varchar(50) not null comment '卡券名称',
label varchar(50) null comment '标注',
notice varchar(255) null comment '卡券描述',
type smallint not null comment '券类型[1-代金券|2-折扣券|3-满减券]',
store_coupon_id varchar(64) not null comment '卡券ID',
store_coupon_no varchar(64) not null comment '卡券编码',
store_id varchar(64) not null comment '店铺ID',
title varchar(50) not null comment '卡券名称',
label varchar(50) null comment '标注',
notice varchar(255) null comment '卡券描述',
type char not null comment '券类型[1-代金券|2-折扣券|3-满减券]',
stock int not null comment '卡券库存,默认:0为无限',
triggers decimal(8, 2) null comment '触发金额',
val_face decimal(8, 2) null comment '面值',
discount decimal(8, 2) null comment '折扣[8折即0.8]',
val_over decimal(8, 2) null comment '满减~满',
val_minus decimal(8, 2) null comment '满减~减',
deduction decimal(8, 2) null comment '抵扣上限金额(最多扣除金额)',
stock int not null comment '卡券库存,默认:0为无限',
triggers decimal(8, 2) null comment '触发金额',
val_face decimal(8, 2) null comment '面值',
discount decimal(8, 2) null comment '折扣[8折即0.8]',
val_over decimal(8, 2) null comment '满减~满',
val_minus decimal(8, 2) null comment '满减~减',
deduction decimal(8, 2) null comment '抵扣上限金额(最多扣除金额)',
overlay tinyint default 1 null comment '叠加限制[0-限制|1-叠加]',
overlay_level tinyint default 0 null comment '#同类别券叠加适用',
receive_limit int default 1 comment '限领数量,默认:1张/人',
receive_curb tinyint null comment '领取约束[0-不开放|1-开放]',
use_scope smallint comment '使用范围[0-全部商品|1-部分商品]',
state tinyint not null comment '卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]',
start_time datetime(3) not null comment '开始时间',
end_time datetime(3) not null comment '结束时间',
del_flg tinyint default 0 comment '删除标记[0-未删除|1-删除]',
created_by varchar(64) not null,
created_at datetime(3) not null,
updated_by varchar(64) null,
updated_at datetime(3) null,
deleted_by varchar(64) null,
deleted_at datetime(3) null,
overlay char default '1' null comment '叠加限制[0-限制|1-叠加]',
overlay_level char default '0' null comment '#同类别券叠加适用',
receive_limit int default 1 comment '限领数量,默认:1张/人',
receive_curb char null comment '领取约束[0-不开放|1-开放]',
use_scope char null comment '使用范围[0-全部商品|1-部分商品]',
state char not null comment '卡券状态[0-等待开始|1-活动中|2-活动结束|3-停用]',
start_time datetime(3) not null comment '开始时间',
end_time datetime(3) not null comment '结束时间',
del_flg char default '0' comment '删除标记[0-未删除|1-删除]',
created_by varchar(64) not null,
created_at datetime(3) not null,
updated_by varchar(64) null,
updated_at datetime(3) null,
deleted_by varchar(64) null,
deleted_at datetime(3) null,
comment text
) engine = InnoDB comment '商铺营销-优惠券';
......@@ -1006,7 +1006,7 @@ create table goblin_store_coupon_rule
store_coupon_id varchar(64) not null comment '卡券ID',
spu_id varchar(64) not null comment 'spu_id',
sku_id varchar(64) null comment 'sku_id',
del_flg tinyint default 0 comment '删除标记[0-未删除|1-删除]',
del_flg char default '0' comment '删除标记[0-未删除|1-删除]',
created_by varchar(64) not null,
created_at datetime(3) not null,
updated_by varchar(64) null,
......@@ -1025,7 +1025,7 @@ create table goblin_user_coupon
ucoupon_id varchar(64) not null,
store_coupon_id varchar(64) not null comment '~goblin_store_coupon.store_coupon_id',
uid varchar(64) not null comment '~adam_user.uid',
state tinyint null comment '用户券状态[1-可用|2-无效|3-已过期|5-已使用]',
state char null comment '用户券状态[1-可用|2-无效|3-已过期|5-已使用]',
bind_at datetime(3) null comment '激活时间',
dued_at datetime(3) null comment '到期时间',
used_at datetime(3) null comment '使用时间',
......
......@@ -7,11 +7,13 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponActionParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
import com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtCouponService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
......@@ -38,15 +40,21 @@ public class GoblinStoreMgtCouponController {
GoblinRedisUtils goblinRedisUtils;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Autowired
IGoblinstoreMgtCouponService goblinstoreMgtCouponService;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "优惠券列表")
@PostMapping("list")
public ResponseDto<PagedResult<GoblinStoreMgtCouponListVo>> list(@Valid @RequestBody GoblinStoreMgtCouponFilterParam mgtCouponFilterParam) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, mgtCouponFilterParam.getStoreId())) {
return ResponseDto.success();
}
if (log.isDebugEnabled()) {
log.debug("商铺活动:优惠券列表:[mgtCouponFilterParam={}]", JsonUtils.toJson(mgtCouponFilterParam));
}
return ResponseDto.success();
return ResponseDto.success(goblinstoreMgtCouponService.couponList(mgtCouponFilterParam));
}
@ApiOperationSupport(order = 2)
......@@ -91,10 +99,34 @@ public class GoblinStoreMgtCouponController {
@ApiOperation(value = "新增优惠券")
@PutMapping("add")
public ResponseDto<Object> add(@Valid @RequestBody GoblinStoreMgtCouponAddParam mgtCouponAddParam) {
String currentUid = CurrentUtil.getCurrentUid();
String storeId = mgtCouponAddParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
if (log.isDebugEnabled()) {
log.debug("商铺活动:新增优惠券:[mgtCouponAddParam={}]", JsonUtils.toJson(mgtCouponAddParam));
}
return ResponseDto.success();
GoblinStoreCouponBasicVo storeCouponBasicVo = mgtCouponAddParam.initStoreCouponBasicInfo();
switch (storeCouponBasicVo.getType()) {
case "1":// 代金
storeCouponBasicVo.setValFace(mgtCouponAddParam.getValFace());
break;
case "2":// 折扣
storeCouponBasicVo.setDiscount(mgtCouponAddParam.getDiscount());
storeCouponBasicVo.setDeduction(mgtCouponAddParam.getDeduction());
break;
case "3":// 满减
storeCouponBasicVo.setValOver(mgtCouponAddParam.getValOver());
storeCouponBasicVo.setValMinus(mgtCouponAddParam.getValMinus());
storeCouponBasicVo.setDeduction(mgtCouponAddParam.getDeduction());
break;
}
goblinstoreMgtCouponService.couponAdd(currentUid, storeCouponBasicVo);
return ResponseDto.success(storeCouponBasicVo.getStoreCouponId());
}
@ApiOperationSupport(order = 5)
......@@ -112,7 +144,7 @@ public class GoblinStoreMgtCouponController {
if (log.isDebugEnabled()) {
log.debug("商铺活动:优惠券详情:[storeId={},storeCouponId={}]", storeId, storeCouponId);
}
return ResponseDto.success();
return ResponseDto.success(goblinstoreMgtCouponService.couponInfo(storeId, storeCouponId));
}
@ApiOperationSupport(order = 6)
......
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponSpuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinSelfGoodsCategoryVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponBasicVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreCouponVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
import com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtCouponService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponService {
@Autowired
QueueUtils queueUtils;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
GoblinMongoUtils goblinMongoUtils;
@Autowired
IGoblinStoreMgtExtraService goblinStoreMgtExtraService;
@Override
public PagedResult<GoblinStoreMgtCouponListVo> couponList(GoblinStoreMgtCouponFilterParam filterParam) {
PagedResult<GoblinStoreMgtCouponListVo> mgtCouponListVoPagedResult = goblinMongoUtils.getMgtStoreCouponListVos(filterParam);
if (mgtCouponListVoPagedResult.getTotal() > 0) {
List<GoblinStoreMgtCouponListVo> volist = mgtCouponListVoPagedResult.getList();
}
return mgtCouponListVoPagedResult;
}
@Override
public void couponAdd(String uid, GoblinStoreCouponBasicVo storeCouponBasicVo) {
String storeCouponId = IDGenerator.nextMilliId();
LocalDateTime now = LocalDateTime.now();
storeCouponBasicVo.setStoreCouponId(storeCouponId);
storeCouponBasicVo.setStoreCouponNo(storeCouponId);
storeCouponBasicVo.setDelFlg("0");
storeCouponBasicVo.setCreatedAt(now);
storeCouponBasicVo.setCreatedBy(uid);
goblinMongoUtils.setMgtStoreCouponBasicVo(storeCouponBasicVo);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_store_coupon.insert"));
LinkedList<Object[]> initStoreCouponObjs = CollectionUtil.linkedListObjectArr();
initStoreCouponObjs.add(new Object[]{
storeCouponId, storeCouponBasicVo.getStoreCouponNo(), storeCouponBasicVo.getStoreId(),
storeCouponBasicVo.getTitle(), storeCouponBasicVo.getLabel(), storeCouponBasicVo.getNotice(),
storeCouponBasicVo.getType(), storeCouponBasicVo.getStock(), storeCouponBasicVo.getTriggers(),
storeCouponBasicVo.getValFace(), storeCouponBasicVo.getDiscount(), storeCouponBasicVo.getValOver(),
storeCouponBasicVo.getValMinus(), storeCouponBasicVo.getDeduction(), storeCouponBasicVo.getReceiveLimit(),
storeCouponBasicVo.getReceiveCurb(), storeCouponBasicVo.getUseScope(), storeCouponBasicVo.getState(),
storeCouponBasicVo.getStartTime(), storeCouponBasicVo.getEndTime(), storeCouponBasicVo.getCreatedBy(),
storeCouponBasicVo.getCreatedAt()
});
toMqSqls.add(SqlMapping.get("goblin_store_coupon_rule.insert"));
LinkedList<Object[]> initStoreCouponRuleObjs = CollectionUtil.linkedListObjectArr();
if ("1".equals(storeCouponBasicVo.getUseScope()) && !CollectionUtils.isEmpty(storeCouponBasicVo.getSpuIdList())) {// 部分商品
storeCouponBasicVo.getSpuIdList().forEach(spuId -> initStoreCouponRuleObjs.add(new Object[]{storeCouponId, spuId, uid, now}));
}
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.gets(toMqSqls, initStoreCouponObjs, initStoreCouponRuleObjs));
}
@Override
public GoblinStoreMgtCouponInfoVo couponInfo(String storeId, String storeCouponId) {
GoblinStoreMgtCouponInfoVo mgtCouponInfoVo = GoblinStoreMgtCouponInfoVo.getNew();
GoblinStoreCouponVo couponVo = goblinRedisUtils.getStoreCouponVo(storeCouponId);
if (null != couponVo) {
mgtCouponInfoVo.setCouponVo(couponVo);
if ("1".equals(couponVo.getUseScope())) {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(storeCouponId);
if (CollectionUtils.isEmpty(spuIds)) {
ArrayList<GoblinStoreMgtCouponSpuListVo> couponSpuListVos = ObjectUtil.getGoblinStoreMgtCouponSpuListVoArrayList();
spuIds.forEach(spuId -> {
GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(spuId);
couponSpuListVos.add(GoblinStoreMgtCouponSpuListVo.getNew().copy(goodsInfoVo));
});
mgtCouponInfoVo.setSpuVoList(couponSpuListVos);
}
}
}
return mgtCouponInfoVo;
}
}
......@@ -4,9 +4,11 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtCouponFilterParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsFilterParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtNoticeFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
......@@ -301,8 +303,12 @@ public class GoblinMongoUtils {
}
public boolean delGoodsInfoVo(String spuId) {
return mongoTemplate.remove(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0")),
GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()).getDeletedCount() > 0;
// return mongoTemplate.remove(Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0")),
// GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()).getDeletedCount() > 0;
return mongoTemplate.getCollection(GoblinGoodsInfoVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("spuId").is(spuId).and("delFlg").is("0")).getQueryObject(),
Update.update("delFlg", "1").getUpdateObject()
).getModifiedCount() > 0;
}
public boolean delGoodsInfoVoBySpuIds(String storeId, List<String> spuIdList, String uid, LocalDateTime time) {
......@@ -914,4 +920,80 @@ public class GoblinMongoUtils {
return mongoTemplate.find(query,
GoblinFrontNavigation.class, GoblinFrontNavigation.class.getSimpleName());
}
/* ---------------------------------------- 商铺活动:优惠券 ---------------------------------------- */
public GoblinStoreCouponBasicVo setMgtStoreCouponBasicVo(GoblinStoreCouponBasicVo vo) {
return mongoTemplate.insert(vo, GoblinStoreCouponBasicVo.class.getSimpleName());
}
public boolean delMgtStoreCouponBasicVo(String storeCouponId, String uid, LocalDateTime time) {
return mongoTemplate.updateFirst(
Query.query(Criteria.where("storeCouponId").is(storeCouponId).and("delFlg").is("0")),
Update.update("delFlg", "1").set("updatedBy", uid).set("updatedAt", time).set("deletedBy", uid).set("deletedAt", time),
GoblinStoreCouponBasicVo.class.getSimpleName()
).getModifiedCount() > 0;
}
public GoblinStoreCouponBasicVo getMgtStoreCouponBasicVo(String storeCouponId) {
return mongoTemplate.findOne(
Query.query(Criteria.where("storeCouponId").is(storeCouponId).and("delFlg").is("0")),
GoblinStoreCouponBasicVo.class, GoblinStoreCouponBasicVo.class.getSimpleName()
);
}
public GoblinStoreCouponVo getStoreCouponVo(String storeCouponId) {
return mongoTemplate.findOne(
Query.query(Criteria.where("storeCouponId").is(storeCouponId).and("delFlg").is("0")),
GoblinStoreCouponVo.class, GoblinStoreCouponBasicVo.class.getSimpleName()
);
}
public PagedResult<GoblinStoreMgtCouponListVo> getMgtStoreCouponListVos(GoblinStoreMgtCouponFilterParam filterParam) {
Criteria criteria = Criteria.where("delFlg").is("0").and("storeId").is(filterParam.getStoreId());
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.and("title").regex(pattern);
}
if (StringUtils.isNotBlank(filterParam.getStoreCouponNo())) {
criteria.and("storeCouponNo").is(filterParam.getStoreCouponNo());
}
if (filterParam.getState() != null) {
criteria.and("state").is(filterParam.getState());
}
if (StringUtils.isNotBlank(filterParam.getStartTime())) {
LocalDateTime startTime = DateUtil.Formatter.yyyy_MM_dd.parse(filterParam.getStartTime());
LocalDateTime startTimeBegin = startTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
criteria.and("startTime").gte(startTimeBegin);
}
if (StringUtils.isNotBlank(filterParam.getEndTime())) {
LocalDateTime endTime = DateUtil.Formatter.yyyy_MM_dd.parse(filterParam.getEndTime());
LocalDateTime endTimeEnd = endTime.withHour(23).withMinute(59).withSecond(59).withNano(999);
criteria.and("endTime").gte(endTimeEnd);
}
if (StringUtils.isNotBlank(filterParam.getCreatedDt())) {
LocalDateTime createDt = DateUtil.Formatter.yyyy_MM_dd.parse(filterParam.getCreatedDt());
LocalDateTime createdAtBegin = createDt.withHour(0).withMinute(0).withSecond(0).withNano(0);
LocalDateTime createdAtEnd = createDt.withHour(23).withMinute(59).withSecond(59).withNano(999);
criteria.and("createdAt").gte(createdAtBegin).lte(createdAtEnd);
}
Query query = Query.query(criteria);
long count = mongoTemplate.count(query, GoblinStoreCouponBasicVo.class.getSimpleName());
PagedResult<GoblinStoreMgtCouponListVo> pagedResult = ObjectUtil.getGoblinStoreMgtCouponListVoPagedResult();
if (count <= 0) return pagedResult;
query.with(PageRequest.of(filterParam.getPageNum() - 1, filterParam.getPageSize()));
query.with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinStoreMgtCouponListVo> mgtCouponListVos = mongoTemplate.find(query, GoblinStoreMgtCouponListVo.class, GoblinStoreCouponBasicVo.class.getSimpleName());
return pagedResult.setList(mgtCouponListVos).setTotal(count, filterParam.getPageSize());
}
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.GoblinGoodsMarketDto;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontBanner;
......@@ -91,9 +92,8 @@ public class GoblinRedisUtils {
public List<GoblinSelfTagVo> getSelfExtagVos() {// 专属标签(音乐人等)
String valStr = (String) redisUtil.get(GoblinRedisConst.BASIC_SELF_EXTAG);
boolean valStrIsEmptyFlg = StringUtils.isEmpty(valStr);
List<GoblinSelfTagVo> vos;
if (valStrIsEmptyFlg) {
if (StringUtils.isEmpty(valStr)) {
if (!CollectionUtils.isEmpty(vos = goblinMongoUtils.getSelfTagVos("1"))) {
redisUtil.set(GoblinRedisConst.BASIC_SELF_GOODS_TAG, JsonUtils.toJson(vos));
}
......@@ -921,4 +921,87 @@ public class GoblinRedisUtils {
return vo;
}
/* ---------------------------------------- 商铺活动:优惠券数据源 ---------------------------------------- */
public GoblinStoreCouponVo getStoreCouponVo(String storeCouponId) {
String rk = GoblinRedisConst.STORE_COUPON.concat(storeCouponId);
GoblinStoreCouponVo vo = (GoblinStoreCouponVo) redisUtil.get(rk);
if (null == vo && null != (vo = goblinMongoUtils.getStoreCouponVo(storeCouponId))) {
redisUtil.set(rk, vo);
}
return vo;
}
public List<String> getStoreCouponSpuIds(String storeCouponId) {
String rk = GoblinRedisConst.STORE_COUPON_RULE.concat(storeCouponId);
String valStr = (String) redisUtil.get(rk);
List<String> strs;
if (StringUtils.isEmpty(valStr)) {
GoblinStoreCouponBasicVo storeCouponBasicVo = goblinMongoUtils.getMgtStoreCouponBasicVo(storeCouponId);
strs = null == storeCouponBasicVo ? null : storeCouponBasicVo.getSpuIdList();
if (!CollectionUtils.isEmpty(strs)) {
redisUtil.set(rk, JsonUtils.toJson(strs));
}
} else {
strs = JsonUtils.fromJson(valStr, new TypeReference<List<String>>() {
});
}
return strs;
}
/* ---------------------------------------- 商铺活动:商品相关 ---------------------------------------- */
public List<GoblinGoodsMarketDto> getGoodsMarketDtos(String spuId) {
String rk = GoblinRedisConst.GOODS_MARKET.concat(spuId);
String valStr = (String) redisUtil.get(rk);
List<GoblinGoodsMarketDto> dtos;
if (StringUtils.isEmpty(valStr)) {
// TODO: 2022/2/17 zhanggb mongodb 查取该商品所有参与的活动并整理集合
dtos = ObjectUtil.getGoblinGoodsMarketDtoArrayList();
} else {
dtos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinGoodsMarketDto>>() {
});
}
return dtos;
}
public boolean addGoodsMarketDto(String spuId, GoblinGoodsMarketDto dto) {
String rk = GoblinRedisConst.GOODS_MARKET.concat(spuId);
String valStr = (String) redisUtil.get(rk);
List<GoblinGoodsMarketDto> dtos;
if (StringUtils.isEmpty(valStr)) {
// TODO: 2022/2/17 zhanggb mongodb 查取该商品所有参与的活动并整理集合
dtos = ObjectUtil.getGoblinGoodsMarketDtoArrayList();
} else {
dtos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinGoodsMarketDto>>() {
});
}
dtos.add(dto);
return redisUtil.set(rk, JsonUtils.toJson(dtos));
}
public void delGoodsMarket(String spuId) {
redisUtil.del(GoblinRedisConst.GOODS_MARKET.concat(spuId));
}
public void delGoodsMarket(String spuId, GoblinGoodsMarketDto dto) {
String rk = GoblinRedisConst.GOODS_MARKET.concat(spuId);
String valStr = (String) redisUtil.get(rk);
List<GoblinGoodsMarketDto> dtos;
if (StringUtils.isEmpty(valStr)) {
// TODO: 2022/2/17 zhanggb mongodb 查取该商品所有参与的活动并整理集合
dtos = ObjectUtil.getGoblinGoodsMarketDtoArrayList();
} else {
dtos = JsonUtils.fromJson(valStr, new TypeReference<List<GoblinGoodsMarketDto>>() {
});
}
if (!CollectionUtils.isEmpty(dtos)) {
dtos.removeIf(r -> r.getMarketId().equals(dto.getMarketId()) && r.getMarketType().equals(dto.getMarketType()));
}
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
package com.liquidnet.service.goblin.util;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.GoblinGoodsMarketDto;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMgtGoodsListVoExcel;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtCouponSpuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtThumbVo;
import com.liquidnet.service.goblin.dto.vo.*;
......@@ -20,6 +23,7 @@ import java.util.ArrayList;
public class ObjectUtil {
private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreNoticeVo> goblinStoreNoticeVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreMgtCouponListVo> goblinStoreMgtCouponListVoPagedResult = new PagedResult<>();
private static final ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList = new ArrayList<>();
......@@ -63,6 +67,8 @@ public class ObjectUtil {
private static final ArrayList<GoblinGoodsSkuInfoDetailVo> goblinGoodsSkuInfoDetailVos = new ArrayList<>();
private static final ArrayList<GoblinGoodsInfoListVo> goblinGoodsInfoListVo = new ArrayList<>();
private static final ArrayList<GoblinStoreMgtGoodsListVoExcel> goblinStoreMgtGoodsListVoExcelArrayList = new ArrayList<>();
private static final ArrayList<GoblinStoreMgtCouponSpuListVo> goblinStoreMgtCouponSpuListVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsMarketDto> goblinGoodsMarketDtoArrayList = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject();
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
......@@ -75,6 +81,10 @@ public class ObjectUtil {
return goblinStoreNoticeVoPagedResult.clone();
}
public static PagedResult<GoblinStoreMgtCouponListVo> getGoblinStoreMgtCouponListVoPagedResult() {
return goblinStoreMgtCouponListVoPagedResult.clone();
}
public static ArrayList<GoblinGoodsInfoListVo> getGoblinGoodsInfoListVo() {
return (ArrayList<GoblinGoodsInfoListVo>) goblinGoodsInfoListVo.clone();
}
......@@ -239,11 +249,18 @@ public class ObjectUtil {
return (ArrayList<GoblinSelfZhengzaiSkuVo>) goblinSelfZhengzaiSkuVoArrayList.clone();
}
public static ArrayList<GoblinFrontNavigationVo> getgoblinFrontNavigationVoArrayList() {
return (ArrayList<GoblinFrontNavigationVo>) goblinFrontNavigationVoArrayList.clone();
}
public static ArrayList<GoblinStoreMgtCouponSpuListVo> getGoblinStoreMgtCouponSpuListVoArrayList() {
return (ArrayList<GoblinStoreMgtCouponSpuListVo>) goblinStoreMgtCouponSpuListVoArrayList.clone();
}
public static ArrayList<GoblinGoodsMarketDto> getGoblinGoodsMarketDtoArrayList() {
return (ArrayList<GoblinGoodsMarketDto>) goblinGoodsMarketDtoArrayList.clone();
}
public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.clone();
}
......
......@@ -106,4 +106,9 @@ goblin_order.user.applyRefund=INSERT INTO goblin_back_order (`back_order_id`,`ba
#---- 购物车操作
goblin_shop.cart.delete = UPDATE goblin_shopping_cart set del_tag=? where user_id=? and sku_id=?
goblin_shop.cart.insert = insert into goblin_shopping_cart (car_id, user_id, store_id,spu_id, sku_id, `number`,marketing_id, del_tag, `comment`,`type`) values (?,?,?,?,?,?,?,?,?,?)
goblin_shop.cart.update = update goblin_shopping_cart set `number` = ? where car_id=? and user_id=? and del_tag=0
\ No newline at end of file
goblin_shop.cart.update = update goblin_shopping_cart set `number` = ? where car_id=? and user_id=? and del_tag=0
#---- 商铺活动:优惠券
goblin_store_coupon.insert=INSERT INTO goblin_store_coupon (store_coupon_id,store_coupon_no,store_id,title,label, notice,type,stock,triggers,val_face, discount,val_over,val_minus,deduction,receive_limit, receive_curb,use_scope,state,start_time,end_time, created_by,created_at)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_store_coupon_rule.insert=INSERT INTO dev_ln_scene.goblin_store_coupon_rule (store_coupon_id,spu_id,created_by,created_at)VALUES(?,?,?,?)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment