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

Commit 2f7401fd authored by 张禹's avatar 张禹

Merge branch 'hjc_goblin_list' into 'master'

Hjc goblin list

See merge request !239
parents 0766b5e6 63b2abc4
......@@ -131,6 +131,7 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_NFT_ORDER_BUG_LOCK = PREFIX.concat("nft:order:lock:");// nft购买用户锁 userId
public static final String REDIS_GOBLIN_NFT_ORDER_EX_LOCK = PREFIX.concat("nft:order:exLock:");// nft兑换码锁 code
public static final String REDIS_GOBLIN_NFT_GOODS_LIST = PREFIX.concat("nft:goodsList");// nft商品列表
public static final String REDIS_GOBLIN_NFT_GOODS_LIST_INFO = PREFIX.concat("nft:goodsList:info:");// nft商品列表单藏品详情 skuId
public static final String REDIS_GOBLIN_NFT_NUM_ACCOUNT = PREFIX.concat("nft:account:");// nft用户数字账户是否开通 userId
......@@ -149,7 +150,7 @@ public class GoblinRedisConst {
*/
public static final String STORE_COUPON = PREFIX.concat("s_coupon:");
/**
* 商铺活动:优惠券适用商品ID集合
* 商铺活动:优惠券适用商品ID集合item
* {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:");
......@@ -235,6 +236,11 @@ public class GoblinRedisConst {
public static final String NFT_PAY_TYPE = PREFIX.concat("nft:payType");
public static final String LIST_DETAILS = PREFIX.concat("list:");//名单列表详情 $key:$listId
public static final String REDIS_BLACK = PREFIX.concat("black:");//黑名单 key:$listId:$skuId:$mobile
public static final String REDIS_WHITE = PREFIX.concat("white:");//白名单 key:$listId:$skuId:$mobile
public static final String LIST_COLLECT = PREFIX.concat("list:collect");//名单列表详情 $key:$skuId
public static final String ADAM_IS_MEMBER = "kylin:member:uid:";//是否会员 $key:$uid
/**
* nft兑换活动配置
*/
......
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsSkuArActionParam", description = "商品管理:藏品AR:管理(删除...)")
@Data
public class GoblinStoreMgtGoodsSkuArActionParam implements Serializable {
private static final long serialVersionUID = 3193592471744574048L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "操作类型[REMOVE-删除]")
@Pattern(regexp = "\\b(REMOVE)\\b", message = "操作类型无效")
private String action;
@ApiModelProperty(position = 12, required = true, value = "单品ID列表")
private List<String> skuIdList;
}
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsSkuArAddParam", description = "商品管理:藏品AR:新增入参")
@Data
public class GoblinStoreMgtGoodsSkuArAddParam implements Serializable {
private static final long serialVersionUID = -6002785025793722474L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID")
@NotNull(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "单品ID")
@NotNull(message = "单品ID不能为空")
private String skuId;
@ApiModelProperty(position = 12, required = true, value = "单品AR文件URL-iOS版[256]")
@NotNull(message = "iOS文件不能为空")
private String arUrlIos;
@ApiModelProperty(position = 13, required = true, value = "单品AR文件URL-android版[256]")
@NotNull(message = "android文件不能为空")
private String arUrlAndroid;
}
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsSkuExtraFilterParam", description = "商品管理:藏品AR:列表筛选条件")
@Data
public class GoblinStoreMgtGoodsSkuArFilterParam implements Serializable {
private static final long serialVersionUID = -8520107197264504640L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "当前记录起始索引", example = "1")
@Min(value = 1, message = "起始索引无效")
@NotNull(message = "起始索引无效")
private Integer pageNum;
@ApiModelProperty(position = 12, required = true, value = "每页显示记录数", example = "20")
@Min(value = 1, message = "显示记录数不能小于1")
@Max(value = 100, message = "显示记录数不能大于100")
@NotNull(message = "显示记录数不能为空")
private Integer pageSize;
@ApiModelProperty(position = 13, required = false, value = "搜索关键字[128]")
@Size(min = 2, max = 100, message = "搜索关键字长度范围2~100")
private String keyword;
}
package com.liquidnet.service.goblin.dto.manage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsSkuSimpleFilterParam", description = "商品管理:SKU列表筛选条件入参")
@Data
public class GoblinStoreMgtGoodsSkuSimpleFilterParam implements Serializable {
private static final long serialVersionUID = -2875361058424448491L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "当前记录起始索引", example = "1")
@Min(value = 1, message = "起始索引不能小于1")
@NotNull(message = "起始索引无效")
private Integer pageNum;
@ApiModelProperty(position = 13, required = false, value = "搜索关键字[128]")
@Size(min = 2, max = 100, message = "搜索关键字长度范围2~100")
private String keyword;
@ApiModelProperty(position = 14, required = false, value = "商品类型[0-常规|1-数字藏品],未指定则代表全部")
private Integer skuType;
// @ApiModelProperty(position = 15, required = false, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]", allowableValues = "0,1,2,3")
// private String shelvesStatus;
}
package com.liquidnet.service.goblin.dto.manage.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsSkuArListVo", description = "商品管理:藏品AR列表信息")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinStoreMgtGoodsSkuArListVo implements Serializable, Cloneable {
private static final long serialVersionUID = -6629148859241936997L;
@ApiModelProperty(position = 10, value = "商品单品ID")
private String skuId;
@ApiModelProperty(position = 11, value = "单品的名称[100]")
private String name;
@ApiModelProperty(position = 12, value = "单品的副标题[128]")
private String subtitle;
@ApiModelProperty(position = 13, value = "单品AR文件URL-iOS版[256]")
private String arUrlIos;
@ApiModelProperty(position = 14, value = "单品AR文件URL-android版[256]")
private String arUrlAndroid;
private static final GoblinStoreMgtGoodsSkuArListVo obj = new GoblinStoreMgtGoodsSkuArListVo();
public static GoblinStoreMgtGoodsSkuArListVo getNew() {
try {
return (GoblinStoreMgtGoodsSkuArListVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinStoreMgtGoodsSkuArListVo();
}
}
}
......@@ -48,6 +48,8 @@ public class GoblinStoreMgtGoodsSkuListVo implements Serializable, Cloneable {
private Integer upchain;
@ApiModelProperty(position = 38, value = "盲盒命中率")
private BigDecimal hitRatio;
@ApiModelProperty(position = 39, value = "系统时间")
private String sysTime;
public String getSaleStartTime() {
return DateUtil.Formatter.yyyyMMddHHmmss.format(saleStartTime);
......
package com.liquidnet.service.goblin.dto.manage.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinStoreMgtGoodsSkuSimpleVo", description = "商品管理:SKU列表(简版)")
@Data
public class GoblinStoreMgtGoodsSkuSimpleVo implements Serializable {
private static final long serialVersionUID = 7389835893135307728L;
@ApiModelProperty(position = 10, value = "商品ID[64]")
private String spuId;
@ApiModelProperty(position = 11, value = "单品ID[64]")
private String skuId;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
private int skuType;
@ApiModelProperty(position = 13, value = "单品名称[100]")
private String name;
@ApiModelProperty(position = 14, value = "单品副标题[100]")
private String subtitle;
}
......@@ -147,9 +147,14 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime deletedAt;
@ApiModelProperty(position = 40, value = "单品AR文件URL-iOS版")
private String arUrlIos;
@ApiModelProperty(position = 40, value = "单品AR文件URL-android版")
private String arUrlAndroid;
@ApiModelProperty(position = 40, value = "单品规格信息")
private List<GoblinGoodsSpecDto> skuSpecList;
@ApiModelProperty(position = 54, value = "单品音乐人标签[藏品类型时使用]")
@ApiModelProperty(position = 41, value = "单品音乐人标签[藏品类型时使用]")
private List<GoblinGoodsExtagVo> extagVoList;
/* -------------------------------- 只展示,不存储 -------------------------------- */
......
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
public class GoblinListCollectVo implements Serializable, Cloneable{
@ApiModelProperty(value = "listId")
private String listId;
@ApiModelProperty(value = "spuId")
private String spuId;
@ApiModelProperty(value = "skuId")
private String skuId;
@ApiModelProperty(value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
@ApiModelProperty(value = "android价格")
private BigDecimal price;
@ApiModelProperty(value = "苹果价格")
private BigDecimal priceV;
@ApiModelProperty(value = "苹果价格id")
private String productId;
@ApiModelProperty(value = "优先购类型[0-会员|1-指定用户]")
private Integer whiteType;
@ApiModelProperty(value = "开始时间")
private LocalDateTime timeStart;
@ApiModelProperty(value = "结束时间")
private LocalDateTime timeEnd;
private static final GoblinListCollectVo obj = new GoblinListCollectVo();
public static GoblinListCollectVo getNew() {
try {
return (GoblinListCollectVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new GoblinListCollectVo();
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class GoblinListDetailsItemVo implements Serializable, Cloneable{
@ApiModelProperty(value = "spuId")
private String spuId;
@ApiModelProperty(value = "skuId")
private String skuId;
@ApiModelProperty(value = "sku名称")
private String skuName;
@ApiModelProperty(value = "剩余库存")
private Integer surplusStock;
@ApiModelProperty(value = "android价格")
private BigDecimal price;
@ApiModelProperty(value = "库存")
private Integer skuStock;
@ApiModelProperty(value = "苹果价格")
private BigDecimal priceV;
@ApiModelProperty(value = "苹果价格id")
private String productId;
private static final GoblinListDetailsItemVo obj = new GoblinListDetailsItemVo();
public static GoblinListDetailsItemVo getNew() {
try {
return (GoblinListDetailsItemVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new GoblinListDetailsItemVo();
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class GoblinListDetailsVo implements Serializable, Cloneable {
@ApiModelProperty(value = "名单id")
private String listId;
@ApiModelProperty(value = "用户id")
private String uid;
@ApiModelProperty(value = "优先购名称")
private String name;
@ApiModelProperty(value = "优先购类型[0-会员|1-指定用户]")
private Integer whiteType;
@ApiModelProperty(value = "优先购文件地址")
private String whiteUrl;
@ApiModelProperty(value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
@ApiModelProperty(value = "开始时间")
private String timeStart;
@ApiModelProperty(value = "结束时间")
private String timeEnd;
@ApiModelProperty(value = "黑名单文件地址")
private String blackUrl;
@ApiModelProperty(value = "商品数据")
private List<GoblinListDetailsItemVo> itemVo;
@ApiModelProperty(value = "创建时间")
private String createdAt;
@ApiModelProperty(value = "白名单文件名称")
private String whiteName;
@ApiModelProperty(value = "黑名单文件名称")
private String blackName;
private static final GoblinListDetailsVo obj = new GoblinListDetailsVo();
public static GoblinListDetailsVo getNew() {
try {
return (GoblinListDetailsVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new GoblinListDetailsVo();
}
}
package com.liquidnet.service.goblin.dto.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class GoblinListVo implements Serializable, Cloneable {
@ApiModelProperty(value = "名单id")
private String listId;
@ApiModelProperty(value = "优先购名称")
private String name;
@ApiModelProperty(value = "开始时间")
private String timeStart;
@ApiModelProperty(value = "结束时间")
private String timeEnd;
@ApiModelProperty(value = "是否有黑名单[1-有|2-无]")
private Integer hasBlack;
@ApiModelProperty(value = "商品数量")
private Integer skuCount;
private static final GoblinListVo obj = new GoblinListVo();
public static GoblinListVo getNew() {
try {
return (GoblinListVo) obj.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return new GoblinListVo();
}
}
......@@ -94,6 +94,13 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 65, value = "是否开启兑换 1未开启 2已开启")
private int isExchange;
@ApiModelProperty(position = 65, value = "单品AR文件URL-iOS版")
private String arUrlIos;
@ApiModelProperty(position = 66, value = "单品AR文件URL-Android版")
private String arUrlAndroid;
@ApiModelProperty(position = 67, value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
private static final GoblinNftGoodsSkuInfoVo obj = new GoblinNftGoodsSkuInfoVo();
public static GoblinNftGoodsSkuInfoVo getNew() {
......@@ -136,6 +143,8 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
this.setAboutPeople(anticipateValueVo.getAboutPeople());
this.setAboutAvatarList(anticipateValueVo.getAboutAvatarList());
}
this.setArUrlIos(source.getArUrlIos());
this.setArUrlAndroid(source.getArUrlAndroid());
return this;
}
}
......@@ -21,6 +21,7 @@ public class GoblinNftGoodsSkuListJobVo implements Serializable {
private String spuId;
@ApiModelProperty(position = 16, value = "是否盲盒[0-否|1-是]")
private String unbox;
private String listId;
@ApiModelProperty(position = 27, value = "开售时间")
private LocalDateTime saleStartTime;
......
......@@ -50,6 +50,8 @@ public class GoblinNftGoodsSkuListVo implements Serializable, Cloneable {
private String aboutEndDate;
@ApiModelProperty(position = 61, value = "预约状态(0:未开始,1:可预约,3:已结束)")
private Integer state;
@ApiModelProperty(position = 62, value = "标签[0-提前购买|1-分段购买]")
private Integer tagType;
private static final GoblinNftGoodsSkuListVo obj = new GoblinNftGoodsSkuListVo();
......
......@@ -30,12 +30,15 @@ public class GoblinPayOrderDetailsVo implements Serializable, Cloneable {
@ApiModelProperty(position = 22, value = "IOS商品价格[20,2]")
private BigDecimal priceV;
@ApiModelProperty(value = "商铺名称")
@ApiModelProperty(position = 23, value = "商铺名称")
private String storeName;
@ApiModelProperty(position = 23, value = "数量")
@ApiModelProperty(position = 24, value = "数量")
private Integer num;
@ApiModelProperty(position = 25, value = "分批、提前购 是否有购买权限 0没有 1有")
private Integer isListCanBuy;
private static final GoblinPayOrderDetailsVo obj = new GoblinPayOrderDetailsVo();
public static GoblinPayOrderDetailsVo getNew() {
......
......@@ -42,6 +42,11 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 23, value = "藏品详情")
private String details;
@ApiModelProperty(position = 23, value = "单品AR文件URL-iOS版")
private String arUrlIos;
@ApiModelProperty(position = 25, value = "单品AR文件URL-android版")
private String arUrlAndroid;
private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo();
public static GoblinUserDigitalArtworkInfoVo getNew() {
......
package com.liquidnet.service.goblin.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data
public class GoblinListCreateItemParam {
@ApiModelProperty(value = "spuId",required = true)
@NotNull(message = "spuId不能为空")
private String spuId;
@ApiModelProperty(value = "skuId",required = true)
@NotNull(message = "skuId不能为空")
private String skuId;
@ApiModelProperty(value = "android价格",required = true)
@NotNull(message = "price不能为空")
private BigDecimal price;
@ApiModelProperty(value = "库存",required = true)
@NotNull(message = "库存不能为空")
private Integer skuStock;
@ApiModelProperty(value = "苹果价格",required = true)
@NotNull(message = "苹果价格不能为空")
private BigDecimal priceV;
@ApiModelProperty(value = "苹果价格id",required = true)
@NotNull(message = "苹果价格id不能为空")
private String productId;
}
package com.liquidnet.service.goblin.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class GoblinListCreateParam {
@ApiModelProperty(value = "优先购名称",required = true)
@NotNull(message = "优先购名称不能为空")
private String name;
@ApiModelProperty(value = "优先购类型[0-会员|1-指定用户]",required = true)
@NotNull(message = "优先购类型不能为空")
private Integer whiteType;
@ApiModelProperty(value = "标签[0-提前购买|1-分段购买]",required = true)
@NotNull(message = "标签类型不能为空")
private Integer tagType;
@ApiModelProperty(value = "优先购文件地址")
private String whiteUrl;
@ApiModelProperty(value = "开始时间",required = true)
@NotNull(message = "开始时间不能为空")
private String timeStart;
@ApiModelProperty(value = "结束时间")
private String timeEnd;
@ApiModelProperty(value = "黑名单文件地址")
private String blackUrl;
@ApiModelProperty(value = "黑名单文件名称")
private String blackName;
@ApiModelProperty(value = "白名单文件名称")
private String whiteName;
@ApiModelProperty(value = "商品数据",required = true)
private List<GoblinListCreateItemParam> itemParams;
}
package com.liquidnet.service.goblin.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class GoblinListUpdateParam {
@ApiModelProperty(value = "名单id",required = true)
@NotNull(message = "名单id不能为空")
private String listId;
@ApiModelProperty(value = "优先购类型[0-会员|1-指定用户]",required = true)
@NotNull(message = "优先购类型不能为空")
private Integer whiteType;
@ApiModelProperty(value = "优先购文件地址")
private String whiteUrl;
@ApiModelProperty(value = "黑名单文件地址")
private String blackUrl;
@ApiModelProperty(value = "黑名单文件名称")
private String blackName;
@ApiModelProperty(value = "白名单文件名称")
private String whiteName;
}
......@@ -11,5 +11,5 @@ public interface IGoblinNftOrderAppService {
ResponseDto<GoblinNftOrderDetailsVo> orderDetails(String orderId);
GoblinPayOrderDetailsVo payOrderDetails(String skuId);
ResponseDto<GoblinPayOrderDetailsVo> payOrderDetails(String skuId);
}
package com.liquidnet.service.goblin.service.manage;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinListDetailsVo;
import com.liquidnet.service.goblin.dto.vo.GoblinListVo;
import com.liquidnet.service.goblin.param.GoblinListCreateParam;
import com.liquidnet.service.goblin.param.GoblinListUpdateParam;
import java.util.List;
/**
* <p>
* 商城-名单表 服务类
* </p>
*
* @author liquidnet
* @since 2022-04-29
*/
public interface IGoblinListService {
ResponseDto<PageInfo<GoblinListVo>> getList(String name, Integer page);
ResponseDto<GoblinListDetailsVo> getDetails(String listId);
ResponseDto<Boolean> create(GoblinListCreateParam param);
ResponseDto<Boolean> update(GoblinListUpdateParam param);
ResponseDto<Boolean> delete(String listId);
}
package com.liquidnet.service.goblin.service.manage;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuArListVo;
import java.util.List;
public interface IGoblinStoreMgtGoodsSkuExtraService {
/**
* 商品管理:藏品AR:列表
*
* @param mgtGoodsSkuExtraFilterParam GoblinStoreMgtGoodsSkuExtraFilterParam
* @return PagedResult<GoblinStoreMgtGoodsSkuArListVo>
*/
PagedResult<GoblinStoreMgtGoodsSkuArListVo> skuArList(GoblinStoreMgtGoodsSkuArFilterParam mgtGoodsSkuExtraFilterParam);
/**
* 商品管理:藏品AR:添加编辑
*
* @param uid UID
* @param mgtGoodsSkuArAddParam GoblinStoreMgtGoodsSkuArAddParam
* @param editFlg true-编辑|false-添加
* @return boolean
*/
boolean skuArAddEdit(String uid, GoblinStoreMgtGoodsSkuArAddParam mgtGoodsSkuArAddParam, boolean editFlg);
/**
* 商品管理:藏品AR:删除
*
* @param uid UID
* @param skuIdList List<单品ID>
* @return boolean
*/
boolean skuArDel(String uid, List<String> skuIdList);
}
......@@ -5,6 +5,7 @@ import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuSimpleVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
......@@ -20,6 +21,8 @@ public interface IGoblinstoreMgtGoodsService {
*/
PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam mgtGoodsFilterParam);
PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> skuList(GoblinStoreMgtGoodsSkuSimpleFilterParam mgtGoodsSkuSimpleFilterParam);
PagedResult<GoblinStoreMgtGoodsSkuListVo> skusList(GoblinStoreMgtGoodsSkuFilterParam mgtGoodsSkuFilterParam);
/**
......
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 商品单品扩展信息
* </p>
*
* @author liquidnet
* @since 2022-05-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinGoodsSkuExtra implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
private String skuId;
/**
* 单品AR文件URL-iOS版
*/
private String arUrlIos;
/**
* 单品AR文件URL-android版
*/
private String arUrlAndroid;
/**
* 删除标记[0-未删除|1删除]
*/
private String delFlg;
private String createdBy;
private LocalDateTime createdAt;
private String updatedBy;
private LocalDateTime updatedAt;
private String deletedBy;
private LocalDateTime deletedAt;
private String comment;
}
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 商城-名单表
* </p>
*
* @author liquidnet
* @since 2022-04-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinList implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 名单id
*/
private String listId;
/**
* 用户id
*/
private String uid;
/**
* 名单名称
*/
private String name;
/**
* 白名单类型[0-会员|1-指定用户]
*/
private Integer whiteType;
/**
* 标签[0-提前购买|1-分段购买]
*/
private Integer tagType;
/**
* 白名单xls地址
*/
private String whiteUrl;
/**
* 开始时间
*/
private LocalDateTime timeStart;
/**
* 结束时间
*/
private LocalDateTime timeEnd;
/**
* 黑名单类型[0-会员|1-指定用户]
*/
private Integer blackType;
/**
* 黑名单xls地址
*/
private String blackUrl;
/**
* 删除标记
*/
private String delTag;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 商城-名单详情表
* </p>
*
* @author liquidnet
* @since 2022-04-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinListDetails implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 名单id
*/
private String listId;
/**
* spuId
*/
private String spuId;
/**
* skuId
*/
private String skuId;
/**
* 补充字段
*/
private String comment;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinGoodsSkuExtra;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 商品单品扩展信息 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2022-05-05
*/
public interface GoblinGoodsSkuExtraMapper extends BaseMapper<GoblinGoodsSkuExtra> {
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinListDetails;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 商城-名单详情表 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2022-04-29
*/
public interface GoblinListDetailsMapper extends BaseMapper<GoblinListDetails> {
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinList;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 商城-名单表 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2022-04-29
*/
public interface GoblinListMapper extends BaseMapper<GoblinList> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinGoodsSkuExtraMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinListDetailsMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinListMapper">
</mapper>
......@@ -16,4 +16,7 @@ public interface FeignGoblinTaskClient {
@GetMapping("rsc/nft/job/goodsList")
ResponseDto<Boolean> goodsList();
@GetMapping("rsc/nft/job/goblinNftListStock")
ResponseDto<Boolean> goblinNftListStock();
}
......@@ -330,7 +330,7 @@ public class CouponBaseUtil {
boolean isHas = false;
for (CandyUserCouponBasicDto dtoItem : dtoList) {
if (dtoItem.getUcouponId().equals(uCouponId)) {
if (dtoItem.getState().equals(1)) {
if (dtoItem.getState().equals(1) && dtoItem.getDuedAt().isBefore(LocalDateTime.now())) {
dtoItem.setState(5);
dtoItem.setUsedAt(LocalDateTime.now());
dtoItem.setUsedFor(content);
......
package com.liquidnet.service.consumer.kylin.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode
public class PhoneUnIdDto {
private String mobile;
}
......@@ -11,10 +11,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.kylin.utils.GoblinNftUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.GoblinNftOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinUserCouponVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.BackCouponParam;
import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult;
......@@ -172,10 +169,17 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
if (nftOrder.getStatus().equals(GoblinStatusConst.NftStatus.ORDER_STATUS_1.getValue())) {
// 库存购买数量回滚
goblinNftUtils.decrSkuCountByUid(nftOrder.getUserId(), nftOrder.getSkuId(), nftOrder.getNum());
LocalDateTime nowTime = LocalDateTime.now();
if (StringUtils.isEmpty(nftOrder.getBoxSkuId())) {// 购买藏品
goblinNftUtils.incrSkuStock(nftOrder.getSkuId(), nftOrder.getNum());
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}",listId);
goblinNftUtils.incrSkuStock(listId, nftOrder.getSkuId(), nftOrder.getNum());
} else {// 购买盲盒
goblinNftUtils.incrSkuStock(nftOrder.getBoxSkuId(), nftOrder.getNum());
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getBoxSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}",listId);
goblinNftUtils.incrSkuStock(listId, nftOrder.getBoxSkuId(), nftOrder.getNum());
}
// 订单状态
......
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.consumer.kylin.dto.PhoneDto;
import com.liquidnet.service.consumer.kylin.dto.PhoneUnIdDto;
import com.liquidnet.service.consumer.kylin.service.IBaseDao;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import lombok.extern.slf4j.Slf4j;
......@@ -16,6 +17,7 @@ import org.springframework.data.redis.stream.StreamListener;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
......@@ -35,7 +37,7 @@ public abstract class AbstractXlsRedisReceiver implements StreamListener<String,
String redisStreamKey = this.getRedisStreamKey();
log.debug("CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]", redisStreamKey, message.getId(), message.getStream(), message.getValue());
boolean result = this.consumerMessageHandler(message.getValue());
log.info("CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
log.info("XLS MESSAGE CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
try {
stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
......@@ -52,40 +54,91 @@ public abstract class AbstractXlsRedisReceiver implements StreamListener<String,
private boolean consumerMessageHandler(Map<String, String> message) {
LinkedList<Object[]> objs = CollectionUtil.linkedListObjectArr();
String xlsPath = null, skuId = null;
String oXlsPath = null;
Integer type = null;
boolean aBoolean = false;
try {
xlsPath = message.get("message");
String[] path = message.get("message").split(",");
if (path.length == 0) {
xlsPath = "";
} else {
xlsPath = path[0];
}
if (path.length > 1) {
oXlsPath = path[1];
}
String finalSkuId = (skuId = message.get("skuId"));
String listId;
// try {
listId = message.getOrDefault("listId", "");
// }catch (Exception e){
// listId = "";
// }
Integer finalType = (type = Integer.parseInt(message.get("type")));
EasyExcel.read(new URL(xlsPath).openStream(), PhoneDto.class, new PageReadListener<PhoneDto>(dataList -> {
for (PhoneDto data : dataList) {
if (data.getMobile() == null) {
continue;
}
String redisKey = GoblinRedisConst.REDIS_CAN_BUY.concat(finalSkuId + ":").concat(data.getMobile());
if (finalType.equals(1)) {//添加
if (log.isDebugEnabled()) {
log.debug("添加 读取到一条数据{}", JSON.toJSONString(data));
if (finalType.equals(1) || finalType.equals(2)) {
EasyExcel.read(new URL(xlsPath).openStream(), PhoneDto.class, new PageReadListener<PhoneDto>(dataList -> {
for (PhoneDto data : dataList) {
if (data.getMobile() == null) {
continue;
}
redisUtil.set(redisKey, 0);
} else {
if (log.isDebugEnabled()) {
log.debug("删除 读取到一条数据{}", JSON.toJSONString(data));
String redisKey = GoblinRedisConst.REDIS_CAN_BUY.concat(finalSkuId + ":").concat(data.getMobile());
if (finalType.equals(1)) {//添加
if (log.isDebugEnabled()) {
log.debug("添加 读取到一条数据{}", JSON.toJSONString(data));
}
redisUtil.set(redisKey, 0);
} else {
if (log.isDebugEnabled()) {
log.debug("删除 读取到一条数据{}", JSON.toJSONString(data));
}
redisUtil.del(redisKey);
}
redisUtil.del(redisKey);
}
})).sheet().doRead();
objs.add(new Object[]{skuId, xlsPath, type, 1, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
} else if (finalType.equals(3) || finalType.equals(4)) {
if (oXlsPath != null && !oXlsPath.equals("")) {//删除旧的黑白名单
EasyExcel.read(new URL(oXlsPath).openStream(), new PageReadListener<HashMap<String, String>>(dataList -> {
for (HashMap<String, String> data : dataList) {
if (data.get(0) == null) {
continue;
}
if (finalType.equals(3)) {
log.debug("删除 白名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.del(GoblinRedisConst.REDIS_WHITE.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)));
} else {
log.debug("删除 黑名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.del(GoblinRedisConst.REDIS_BLACK.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)));
}
}
})).sheet().doRead();
}
})).sheet().doRead();
objs.add(new Object[]{skuId, xlsPath, type, 1, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
if (xlsPath != null && !xlsPath.equals("")) {//添加
EasyExcel.read(new URL(xlsPath).openStream(), new PageReadListener<HashMap<String, String>>(dataList -> {
for (HashMap<String, String> data : dataList) {
if (data.get(0) == null) {
continue;
}
if (finalType.equals(3)) {
log.debug("添加 白名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.set(GoblinRedisConst.REDIS_WHITE.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)), 1);
} else {
log.debug("添加 黑名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.set(GoblinRedisConst.REDIS_BLACK.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)), 1);
}
}
})).sheet().doRead();
}
aBoolean = true;
}
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), message, e);
try {
objs.add(new Object[]{skuId, xlsPath, type, 2, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
if (type.equals(1) || type.equals(2)) {
objs.add(new Object[]{skuId, xlsPath, type, 2, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
}
} catch (Exception ignored) {
}
}
......
package com.liquidnet.service.consumer.kylin.utils;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinListCollectVo;
import com.liquidnet.service.goblin.dto.vo.GoblinNftOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreNoticeVo;
import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -12,6 +17,13 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class GoblinNftUtils {
......@@ -30,9 +42,13 @@ public class GoblinNftUtils {
return (int) redisUtil.decr(redisKey, stock);
}
public int incrSkuStock(String skuId, Integer stock) {
String redisKey = GoblinRedisConst.REAL_STOCK_SKU.concat(skuId);
return (int) redisUtil.incr(redisKey, stock);
public int incrSkuStock(String marketPre, String skuId, Integer stock) {
String rk = GoblinRedisConst.REAL_STOCK_SKU;
if (marketPre != null && !marketPre.equals("null")) {
rk = rk.concat(marketPre + ":");
}
rk = rk.concat(skuId);
return (int) redisUtil.incr(rk, stock);
}
// 减少 用户sku购买个数
......@@ -70,6 +86,59 @@ public class GoblinNftUtils {
object);
}
/**
* 根据时间获取当前分段购vo 如果当前没有返回下一个
*
* @param now
* @param skuId
* @return
*/
public GoblinListCollectVo getCollectByNowNext(LocalDateTime now, String skuId) {
GoblinListCollectVo collectVo = null;
GoblinListCollectVo collectTemp = null;
GoblinListCollectVo collectNext = null;
List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId);
for (int i = 0; i < collectVos.size(); i++) {
GoblinListCollectVo collectVoItem = collectVos.get(i);
if (now.isAfter(collectVoItem.getTimeStart()) && collectVoItem.getTimeEnd() == null) {
if (collectTemp == null || collectTemp.getTimeStart().isBefore(collectVoItem.getTimeStart())) {
collectTemp = collectVoItem;
}
} else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem;
} else if (now.isBefore(collectVoItem.getTimeStart())) {
if (collectNext == null || collectNext.getTimeStart().isAfter(collectNext.getTimeStart())) {
collectNext = collectVoItem;
}
}else if(collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())){
collectTemp = null;
}
}
if (collectVo == null && collectTemp != null) {
collectVo = collectTemp;
} else if (collectVo == null) {
collectVo = collectNext;
}
return collectVo;
}
/**
* 分段购获取
*
* @param skuId
* @return
*/
public List<GoblinListCollectVo> getGoblinListCollect(String skuId) {
Object obj = redisUtil.get(GoblinRedisConst.LIST_COLLECT.concat(skuId));
if (obj == null) {
return new ArrayList<>();
} else {
List<GoblinListCollectVo> list = (List<GoblinListCollectVo>) obj;
list = list.stream().sorted(Comparator.comparing(GoblinListCollectVo::getTimeStart)).collect(Collectors.toList());
return list;
}
}
public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.clone();
}
......
......@@ -11,10 +11,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.order.utils.GoblinNftUtils;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.GoblinNftOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo;
import com.liquidnet.service.goblin.dto.vo.GoblinStoreOrderVo;
import com.liquidnet.service.goblin.dto.vo.GoblinUserCouponVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.BackCouponParam;
import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult;
......@@ -172,10 +169,17 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
if (nftOrder.getStatus().equals(GoblinStatusConst.NftStatus.ORDER_STATUS_1.getValue())) {
// 库存购买数量回滚
goblinNftUtils.decrSkuCountByUid(nftOrder.getUserId(), nftOrder.getSkuId(), nftOrder.getNum());
LocalDateTime nowTime = LocalDateTime.now();
if (StringUtils.isEmpty(nftOrder.getBoxSkuId())) {// 购买藏品
goblinNftUtils.incrSkuStock(nftOrder.getSkuId(), nftOrder.getNum());
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}",listId);
goblinNftUtils.incrSkuStock(listId, nftOrder.getSkuId(), nftOrder.getNum());
} else {// 购买盲盒
goblinNftUtils.incrSkuStock(nftOrder.getBoxSkuId(), nftOrder.getNum());
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getBoxSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}",listId);
goblinNftUtils.incrSkuStock(listId, nftOrder.getBoxSkuId(), nftOrder.getNum());
}
// 订单状态
......
......@@ -2,6 +2,7 @@ package com.liquidnet.service.consumer.order.utils;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinListCollectVo;
import com.liquidnet.service.goblin.dto.vo.GoblinNftOrderVo;
import com.mongodb.BasicDBObject;
import com.mongodb.client.result.UpdateResult;
......@@ -12,6 +13,12 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class GoblinNftUtils {
......@@ -30,9 +37,13 @@ public class GoblinNftUtils {
return (int) redisUtil.decr(redisKey, stock);
}
public int incrSkuStock(String skuId, Integer stock) {
String redisKey = GoblinRedisConst.REAL_STOCK_SKU.concat(skuId);
return (int) redisUtil.incr(redisKey, stock);
public int incrSkuStock(String marketPre, String skuId, Integer stock) {
String rk = GoblinRedisConst.REAL_STOCK_SKU;
if (marketPre != null && !marketPre.equals("null")) {
rk = rk.concat(marketPre + ":");
}
rk = rk.concat(skuId);
return (int) redisUtil.incr(rk, stock);
}
// 减少 用户sku购买个数
......@@ -63,6 +74,59 @@ public class GoblinNftUtils {
mongoTemplate.insert(vo, GoblinNftOrderVo.class.getSimpleName());
}
/**
* 根据时间获取当前分段购vo 如果当前没有返回下一个
*
* @param now
* @param skuId
* @return
*/
public GoblinListCollectVo getCollectByNowNext(LocalDateTime now, String skuId) {
GoblinListCollectVo collectVo = null;
GoblinListCollectVo collectTemp = null;
GoblinListCollectVo collectNext = null;
List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId);
for (int i = 0; i < collectVos.size(); i++) {
GoblinListCollectVo collectVoItem = collectVos.get(i);
if (now.isAfter(collectVoItem.getTimeStart()) && collectVoItem.getTimeEnd() == null) {
if (collectTemp == null || collectTemp.getTimeStart().isBefore(collectVoItem.getTimeStart())) {
collectTemp = collectVoItem;
}
} else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem;
} else if (now.isBefore(collectVoItem.getTimeStart())) {
if (collectNext == null || collectNext.getTimeStart().isAfter(collectNext.getTimeStart())) {
collectNext = collectVoItem;
}
}else if(collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())){
collectTemp = null;
}
}
if (collectVo == null && collectTemp != null) {
collectVo = collectTemp;
} else if (collectVo == null) {
collectVo = collectNext;
}
return collectVo;
}
/**
* 分段购获取
*
* @param skuId
* @return
*/
public List<GoblinListCollectVo> getGoblinListCollect(String skuId) {
Object obj = redisUtil.get(GoblinRedisConst.LIST_COLLECT.concat(skuId));
if (obj == null) {
return new ArrayList<>();
} else {
List<GoblinListCollectVo> list = (List<GoblinListCollectVo>) obj;
list = list.stream().sorted(Comparator.comparing(GoblinListCollectVo::getTimeStart)).collect(Collectors.toList());
return list;
}
}
public UpdateResult updateGoblinNftOrderVo(GoblinNftOrderVo data) {
BasicDBObject object = cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(data));
return mongoTemplate.getCollection(GoblinNftOrderVo.class.getSimpleName()).updateOne(
......
......@@ -44,13 +44,13 @@ public class ConsumerGoblinXlsRedisStreamConfig extends RedisStreamConfig {
return subscription;
}
// @Bean
// public Subscription subscriptionGoblinXls1(RedisConnectionFactory factory) {
// var listenerContainer = this.buildStreamMessageListenerContainer(factory);
// var subscription = receiveGoblinXls(listenerContainer, 1);
// listenerContainer.start();
// return subscription;
// }
@Bean
public Subscription subscriptionGoblinXls1(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveGoblinXls(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
//
// @Bean
// public Subscription subscriptionGoblinXls2(RedisConnectionFactory factory) {
......
......@@ -16,6 +16,7 @@ import org.springframework.data.redis.stream.StreamListener;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
......@@ -35,7 +36,7 @@ public abstract class AbstractXlsRedisReceiver implements StreamListener<String,
String redisStreamKey = this.getRedisStreamKey();
log.debug("CONSUMER MSG[streamKey:{},messageId:{},stream:{},body:{}]", redisStreamKey, message.getId(), message.getStream(), message.getValue());
boolean result = this.consumerMessageHandler(message.getValue());
log.info("CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
log.info("XLS MESSAGE CONSUMER MSG RESULT:{} ==> [{}]MESSAGE_ID:{}", result, redisStreamKey, message.getId());
try {
stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
......@@ -52,40 +53,91 @@ public abstract class AbstractXlsRedisReceiver implements StreamListener<String,
private boolean consumerMessageHandler(Map<String, String> message) {
LinkedList<Object[]> objs = CollectionUtil.linkedListObjectArr();
String xlsPath = null, skuId = null;
String oXlsPath = null;
Integer type = null;
boolean aBoolean = false;
try {
xlsPath = message.get("message");
String[] path = message.get("message").split(",");
if (path.length == 0) {
xlsPath = "";
} else {
xlsPath = path[0];
}
if (path.length > 1) {
oXlsPath = path[1];
}
String finalSkuId = (skuId = message.get("skuId"));
String listId;
// try {
listId = message.getOrDefault("listId", "");
// }catch (Exception e){
// listId = "";
// }
Integer finalType = (type = Integer.parseInt(message.get("type")));
EasyExcel.read(new URL(xlsPath).openStream(), PhoneDto.class, new PageReadListener<PhoneDto>(dataList -> {
for (PhoneDto data : dataList) {
if (data.getMobile() == null) {
continue;
}
String redisKey = GoblinRedisConst.REDIS_CAN_BUY.concat(finalSkuId + ":").concat(data.getMobile());
if (finalType.equals(1)) {//添加
if (log.isDebugEnabled()) {
log.debug("添加 读取到一条数据{}", JSON.toJSONString(data));
if (finalType.equals(1) || finalType.equals(2)) {
EasyExcel.read(new URL(xlsPath).openStream(), PhoneDto.class, new PageReadListener<PhoneDto>(dataList -> {
for (PhoneDto data : dataList) {
if (data.getMobile() == null) {
continue;
}
redisUtil.set(redisKey, 0);
} else {
if (log.isDebugEnabled()) {
log.debug("删除 读取到一条数据{}", JSON.toJSONString(data));
String redisKey = GoblinRedisConst.REDIS_CAN_BUY.concat(finalSkuId + ":").concat(data.getMobile());
if (finalType.equals(1)) {//添加
if (log.isDebugEnabled()) {
log.debug("添加 读取到一条数据{}", JSON.toJSONString(data));
}
redisUtil.set(redisKey, 0);
} else {
if (log.isDebugEnabled()) {
log.debug("删除 读取到一条数据{}", JSON.toJSONString(data));
}
redisUtil.del(redisKey);
}
redisUtil.del(redisKey);
}
})).sheet().doRead();
objs.add(new Object[]{skuId, xlsPath, type, 1, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
} else if (finalType.equals(3) || finalType.equals(4)) {
if (oXlsPath != null && !oXlsPath.equals("")) {//删除旧的黑白名单
EasyExcel.read(new URL(oXlsPath).openStream(), new PageReadListener<HashMap<String, String>>(dataList -> {
for (HashMap<String, String> data : dataList) {
if (data.get(0) == null) {
continue;
}
if (finalType.equals(3)) {
log.debug("删除 白名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.del(GoblinRedisConst.REDIS_WHITE.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)));
} else {
log.debug("删除 黑名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.del(GoblinRedisConst.REDIS_BLACK.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)));
}
}
})).sheet().doRead();
}
})).sheet().doRead();
objs.add(new Object[]{skuId, xlsPath, type, 1, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
if (xlsPath != null && !xlsPath.equals("")) {//添加
EasyExcel.read(new URL(xlsPath).openStream(), new PageReadListener<HashMap<String, String>>(dataList -> {
for (HashMap<String, String> data : dataList) {
if (data.get(0) == null) {
continue;
}
if (finalType.equals(3)) {
log.debug("添加 白名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.set(GoblinRedisConst.REDIS_WHITE.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)), 1);
} else {
log.debug("添加 黑名单 读取到一条数据{}", JSON.toJSONString(data));
redisUtil.set(GoblinRedisConst.REDIS_BLACK.concat(listId + ":").concat(finalSkuId + ":").concat(data.get(0)), 1);
}
}
})).sheet().doRead();
}
aBoolean = true;
}
} catch (Exception e) {
log.error("CONSUMER MSG EX_HANDLE ==> [{}]:{}", this.getRedisStreamKey(), message, e);
try {
objs.add(new Object[]{skuId, xlsPath, type, 2, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
if (type.equals(1) || type.equals(2)) {
objs.add(new Object[]{skuId, xlsPath, type, 2, LocalDateTime.now()});
aBoolean = baseDao.batchSql(SQL_INSERT_GOODS_BUY_ROSTER_LOG, objs);
}
} catch (Exception ignored) {
}
}
......
......@@ -29,4 +29,13 @@ public class GoblinTaskHandler {
}
}
@XxlJob(value = "sev-goblin:rollbackNftStock")
public void goblinNftListStock() {
try {
XxlJobHelper.handleSuccess("结果:" + feignGoblinTaskClient.goblinNftListStock().getData());
} catch (Exception e) {
XxlJobHelper.log(e);
XxlJobHelper.handleFail();
}
}
}
DROP TABLE IF EXISTS `goblin_list`;
CREATE TABLE `goblin_list`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`list_id` varchar(64) DEFAULT '' COMMENT '名单id',
`uid` varchar(64) DEFAULT '' COMMENT '用户id',
`name` varchar(64) DEFAULT '' COMMENT '名单名称',
`white_type` int DEFAULT 1 COMMENT '白名单类型[0-会员|1-指定用户]',
`white_url` varchar(512) DEFAULT '' COMMENT '白名单xls地址',
`time_start` datetime DEFAULT null COMMENT '开始时间',
`time_end` datetime DEFAULT null COMMENT '结束时间',
`tag_type` int DEFAULT 0 COMMENT '标签[0-提前购买|1-分段购买]',
`black_type` int DEFAULT 1 COMMENT '黑名单类型[0-会员|1-指定用户]',
`black_url` varchar(512) DEFAULT '' COMMENT '黑名单xls地址',
`del_tag` int DEFAULT 0 COMMENT '是否删除[0-否|1-是]',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '商城-名单表'
ROW_FORMAT = DYNAMIC;
DROP TABLE IF EXISTS `goblin_list_details`;
CREATE TABLE `goblin_list_details`
(
`mid` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`list_id` varchar(64) DEFAULT '' COMMENT '名单id',
`spu_id` varchar(64) DEFAULT '' COMMENT 'spuId',
`sku_id` varchar(64) DEFAULT '' COMMENT 'skuId',
`price` varchar(64) DEFAULT '' COMMENT '单品现价',
`sku_stock` int DEFAULT 0 COMMENT '单品库存',
`price_v` decimal(20, 2) DEFAULT 0.00 COMMENT '苹果商品价格',
`product_id` varchar(64) DEFAULT '' COMMENT '苹果商品价格ID',
`comment` varchar(255) DEFAULT '' COMMENT '补充字段',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`) USING BTREE
) ENGINE = InnoDB
AUTO_INCREMENT = 1
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT = '商城-名单详情表'
ROW_FORMAT = DYNAMIC;
# -- >>------------------------------------------------------------------------------------
drop table if exists goblin_goods_sku_extra;
create table goblin_goods_sku_extra
(
mid bigint auto_increment primary key,
sku_id varchar(64) not null,
ar_url_ios varchar(256) null comment '单品AR文件URL-iOS版',
ar_url_android varchar(256) null comment '单品AR文件URL-android版',
del_flg char default '0' comment '删除标记[0-未删除|1删除]',
created_by varchar(64) not null,
created_at datetime not null,
updated_by varchar(64) null,
updated_at datetime null,
deleted_by varchar(64) null,
deleted_at datetime null,
comment varchar(500)
) engine = InnoDB comment '商品单品扩展信息';
create index idx_ggse_sku_id on goblin_goods_sku_extra (sku_id);
# -- >>------------------------------------------------------------------------------------
\ No newline at end of file
......@@ -96,7 +96,7 @@ public class MybatisPlusCodeGenerator {
String resourcePath = "/Users/hujiachen/Downloads/tmp";
String directory = "com.liquidnet.service.goblin";
String[] dbTableArray = new String[]{
"goblin_marketing_zhengzai_relation"
"goblin_marketing_zhengzai_relation"
};
doGenerator(resourcePath, dsc, directory, dbTableArray);
......
......@@ -54,11 +54,7 @@ public class GoblinNftOrderAppController {
public ResponseDto<GoblinPayOrderDetailsVo> payOrderDetails(
@RequestParam("skuId") @NotBlank(message = "skuId不能为空") String skuId
) {
GoblinPayOrderDetailsVo vo = goblinNftOrderAppService.payOrderDetails(skuId);
if (vo == null) {
return ResponseDto.failure("获取失败");
}
return ResponseDto.success(vo);
return goblinNftOrderAppService.payOrderDetails(skuId);
}
}
......@@ -27,4 +27,10 @@ public class GoblinNftJobController {
return goblinNftJobService.goodsList();
}
@GetMapping("goblinNftListStock")
@ApiOperation("处理[未开售/开售]五分钟内的nft[优先购/分批购]库存job ")
public ResponseDto<Boolean> goblinNftListStock() {
return goblinNftJobService.goblinNftListStock();
}
}
package com.liquidnet.service.goblin.controller.manage;
import com.github.pagehelper.PageInfo;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreZhengzaiCommonParam;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.param.GoblinListCreateParam;
import com.liquidnet.service.goblin.param.GoblinListUpdateParam;
import com.liquidnet.service.goblin.service.manage.IGoblinListService;
import com.liquidnet.service.goblin.service.manage.IGoblinZhengzaiService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 正在下单活动管理
*/
@ApiSupport(order = 149201)
@Slf4j
@RestController
@Api(tags = "活动-名单")
@RequestMapping("store/list")
public class GoblinListController {
@Autowired
IGoblinListService goblinListService;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "name", value = "活动名称"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "page", value = "页数"),
})
@GetMapping("list")
public ResponseDto<PageInfo<GoblinListVo>> list(@RequestParam(value = "name", required = false) String name,
@RequestParam Integer page) {
return goblinListService.getList(name, page);
}
@ApiOperation(value = "详情")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "listId", value = "名单id"),
})
@GetMapping("details")
public ResponseDto<GoblinListDetailsVo> details(@NotBlank(message = "集合ID不能为空") @RequestParam String listId) {
return goblinListService.getDetails(listId);
}
@ApiOperation(value = "创建")
@PostMapping("create")
public ResponseDto<Boolean> create(@RequestBody GoblinListCreateParam para) {
return goblinListService.create(para);
}
@ApiOperationSupport(order = 1)
@ApiOperation(value = "修改")
@PutMapping("change")
public ResponseDto<Boolean> update(@RequestBody GoblinListUpdateParam param) {
return goblinListService.update(param);
}
@ApiOperationSupport(order = 1)
@ApiOperation(value = "删除")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "listId", value = "名单id"),
})
@DeleteMapping("delete")
public ResponseDto<Boolean> update(@NotBlank(message = "集合ID不能为空") @RequestParam String listId) {
return goblinListService.delete(listId);
}
}
......@@ -32,7 +32,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ApiSupport(order = 149005)
@ApiSupport(order = 149006)
@Api(tags = "店铺商品分类")
@Slf4j
@Validated
......
......@@ -51,7 +51,7 @@ import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.List;
@ApiSupport(order = 149006)
@ApiSupport(order = 149007)
@Api(tags = "商铺活动:优惠券管理")
@Slf4j
@Validated
......
......@@ -20,9 +20,9 @@ import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuSimpleVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
import com.liquidnet.service.goblin.service.manage.IGoblinZhengzaiService;
import com.liquidnet.service.goblin.service.manage.IGoblinstoreMgtGoodsService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
......@@ -82,22 +82,36 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.success(goblinstoreMgtGoodsService.goodsList(storeMgtGoodsFilterParam));
}
@ApiOperationSupport(order = 11)
@ApiOperation(value = "SKU筛选列表")
@PostMapping("sku_search")
public ResponseDto<PagedResult<GoblinStoreMgtGoodsSkuSimpleVo>> skuList(@Valid @RequestBody GoblinStoreMgtGoodsSkuSimpleFilterParam mgtGoodsSkuSimpleFilterParam) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, mgtGoodsSkuSimpleFilterParam.getStoreId())) {
log.warn("商品管理:SKU筛选列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsSkuSimpleFilterParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuSimpleFilterParam));
return ResponseDto.success();
}
if (log.isDebugEnabled()) {
log.debug("商品管理:SKU筛选列表:[GoblinStoreMgtGoodsSkuSimpleFilterParam={}]", JsonUtils.toJson(mgtGoodsSkuSimpleFilterParam));
}
return ResponseDto.success(goblinstoreMgtGoodsService.skuList(mgtGoodsSkuSimpleFilterParam));
}
@ApiOperationSupport(order = 10)
@ApiOperation(value = "SKU搜索列表")
@PostMapping("edit_sku/search")
public ResponseDto<PagedResult<GoblinStoreMgtGoodsSkuListVo>> skuSearch(@Valid @RequestBody GoblinStoreMgtGoodsSkuFilterParam goblinStoreMgtGoodsSkuFilterParam) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, goblinStoreMgtGoodsSkuFilterParam.getStoreId())) {
log.warn("商品管理:SKU搜索列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsFilterParam={}]", currentUid, JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
log.warn("商品管理:SKU搜索列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsSkuFilterParam={}]", currentUid, JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
return ResponseDto.success();
}
if (log.isDebugEnabled()) {
log.debug("商品管理:SKU搜索列表:[GoblinStoreMgtGoodsFilterParam={}]", JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
log.debug("商品管理:SKU搜索列表:[GoblinStoreMgtGoodsSkuFilterParam={}]", JsonUtils.toJson(goblinStoreMgtGoodsSkuFilterParam));
}
return ResponseDto.success(goblinstoreMgtGoodsService.skusList(goblinStoreMgtGoodsSkuFilterParam));
}
@ApiOperationSupport(order = 2)
@ApiOperation(value = "SPU导出")
@PostMapping("export")
......@@ -191,7 +205,7 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "非本店铺商品,无权操作");
}
if (goodsInfoVo.getSpuType() == 1) {
log.warn("商品管理:SPU管理:架警告:数字藏品不支持此操作[UID={},spuId={}]", currentUid, spuId);
log.warn("商品管理:SPU管理:架警告:数字藏品不支持此操作[UID={},spuId={}]", currentUid, spuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品为数字藏品");
}
if (!goodsInfoVo.getShelvesStatus().equals("3")) {// 非上架中不允许下架
......@@ -210,7 +224,7 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品不存在或已删除");
}
if (goodsInfoVo.getSpuType() == 1) {
log.warn("商品管理:SPU管理:上架警告:数字藏品不支持此操作[UID={},spuId={}]", currentUid, spuId);
log.warn("商品管理:SPU管理:删除警告:数字藏品不支持此操作[UID={},spuId={}]", currentUid, spuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品为数字藏品");
}
if (!goodsInfoVo.getStoreId().equals(storeId)) {
......
package com.liquidnet.service.goblin.controller.manage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.CurrentUtil;
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.GoblinStoreMgtGoodsSkuArActionParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuArListVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtGoodsSkuExtraService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@ApiSupport(order = 149005)
@Api(tags = "商品管理:单品拓展信息")
@Slf4j
@Validated
@RestController
@RequestMapping("store/mgt/sku_extra")
public class GoblinStoreMgtGoodsSkuExtraController {
@Autowired
IGoblinStoreMgtGoodsSkuExtraService goblinStoreMgtGoodsSkuExtraService;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "藏品AR:列表")
@PostMapping("ar_list")
public ResponseDto<PagedResult<GoblinStoreMgtGoodsSkuArListVo>> arList(@Valid @RequestBody GoblinStoreMgtGoodsSkuArFilterParam mgtGoodsSkuArFilterParam) {
String currentUid = CurrentUtil.getCurrentUid();
if (!goblinRedisUtils.hasStoreId(currentUid, mgtGoodsSkuArFilterParam.getStoreId())) {
log.warn("商品管理:藏品AR:列表:无权操作该店铺,请核实[UID={},GoblinStoreMgtGoodsSkuArFilterParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArFilterParam));
return ResponseDto.success();
}
if (log.isDebugEnabled()) {
log.debug("商品管理:藏品AR:列表[GoblinStoreMgtGoodsSkuArFilterParam={}]", JsonUtils.toJson(mgtGoodsSkuArFilterParam));
}
return ResponseDto.success(goblinStoreMgtGoodsSkuExtraService.skuArList(mgtGoodsSkuArFilterParam));
}
@ApiOperationSupport(order = 2)
@ApiOperation(value = "藏品AR:管理")
@PostMapping("ar_action")
public ResponseDto<Object> action(@Valid @RequestBody GoblinStoreMgtGoodsSkuArActionParam mgtGoodsSkuArActionParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSkuArActionParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
List<String> skuIdList = mgtGoodsSkuArActionParam.getSkuIdList();
if (CollectionUtils.isEmpty(skuIdList)) {
return ResponseDto.failure(ErrorMapping.get("149021"));
}
if (log.isDebugEnabled()) {
log.debug("商品管理:藏品AR:管理[UID={},GoblinStoreMgtGoodsActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
}
boolean resultFlg;
switch (mgtGoodsSkuArActionParam.getAction()) {
case "REMOVE":
for (String skuId : skuIdList) {
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getDelFlg().equals("0")) {
log.warn("商品管理:藏品AR:管理:藏品不存在或已删除[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "藏品AR不存在或已删除");
}
if (mgtGoodsSkuInfoVo.getSkuType() != 1) {
log.warn("商品管理:藏品AR:管理:非数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,非数字藏品");
}
if (!mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) {
log.warn("商品管理:藏品AR:管理:非本店铺藏品,无权操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "非本店铺藏品,无权操作");
}
}
resultFlg = goblinStoreMgtGoodsSkuExtraService.skuArDel(currentUid, skuIdList);
break;
default:
log.warn("商品管理:藏品AR:管理:Invalid operation[UID={},GoblinStoreMgtGoodsSkuArActionParam={}]", currentUid, JsonUtils.toJson(mgtGoodsSkuArActionParam));
return ResponseDto.failure(ErrorMapping.get("149001"));
}
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
}
@ApiOperationSupport(order = 4)
@ApiOperation(value = "藏品AR:添加")
@PostMapping("ar_add")
public ResponseDto<Object> arAdd(@Valid @RequestBody GoblinStoreMgtGoodsSkuArAddParam mgtGoodsSkuArAddParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSkuArAddParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo;
if (null == (mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(mgtGoodsSkuArAddParam.getSkuId()))
|| !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)
|| !mgtGoodsSkuInfoVo.getDelFlg().equals("0")
) {
return ResponseDto.failure(ErrorMapping.get("149011"));
}
if (StringUtils.isNotEmpty(mgtGoodsSkuInfoVo.getArUrlIos())) {
return ResponseDto.failure(ErrorMapping.get("149019"));
}
if (log.isDebugEnabled()) {
log.debug("商品管理:藏品AR:添加[GoblinStoreMgtGoodsSkuArAddParam={}]", JsonUtils.toJson(mgtGoodsSkuArAddParam));
}
boolean resultFlg = goblinStoreMgtGoodsSkuExtraService.skuArAddEdit(currentUid, mgtGoodsSkuArAddParam, false);
return resultFlg ? ResponseDto.success() : ResponseDto.failure(ErrorMapping.get("149003"));
}
@ApiOperationSupport(order = 5)
@ApiOperation(value = "藏品AR:编辑")
@PostMapping("ar_edit")
public ResponseDto<Object> arEdit(@Valid @RequestBody GoblinStoreMgtGoodsSkuArAddParam mgtGoodsSkuArEditParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsSkuArEditParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo;
if (null == (mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(mgtGoodsSkuArEditParam.getSkuId()))
|| !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)
|| !mgtGoodsSkuInfoVo.getDelFlg().equals("0")
) {
return ResponseDto.failure(ErrorMapping.get("149011"));
}
if (StringUtils.isEmpty(mgtGoodsSkuInfoVo.getArUrlIos())) {
return ResponseDto.failure(ErrorMapping.get("149020"));
}
if (log.isDebugEnabled()) {
log.debug("商品管理:藏品AR:编辑[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(mgtGoodsSkuArEditParam));
}
boolean resultFlg = goblinStoreMgtGoodsSkuExtraService.skuArAddEdit(currentUid, mgtGoodsSkuArEditParam, true);
return resultFlg ? ResponseDto.success() : ResponseDto.failure(ErrorMapping.get("149003"));
}
}
......@@ -45,10 +45,11 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
@Autowired
IGoblinGoodsAnticipateMgService goblinGoodsAnticipateMgService;
final static int size = 20;
final static int size = 10;
@Override
public ResponseDto<PagedResult<GoblinNftGoodsSkuListVo>> goodsList(int page) {
LocalDateTime now = LocalDateTime.now();
List<String> startSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("1");
List<String> notStartSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("2");
List<String> soldOutSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("3");
......@@ -68,7 +69,9 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
for (int i = finalCount; i < initCount; i++) {
String skuId = allIdList.get(i);
// sku信息
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(now, skuId);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType");
GoblinNftGoodsSkuListVo goblinNftGoodsSkuListVo = GoblinNftGoodsSkuListVo.getNew().copy(skuInfoVo);
// spu信息
Object spuInfoMap = spuInfoList.get(skuInfoVo.getSpuId());
......@@ -89,6 +92,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 0);
goblinNftGoodsSkuListVo.setAnticipateValueVo(anticipateValueVo);
}
goblinNftGoodsSkuListVo.setTagType(tagType);
// 写入列表
skuList.add(goblinNftGoodsSkuListVo);
}
......@@ -98,9 +102,51 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
return ResponseDto.success(listVoPagedResult);
}
/*@Override
public ResponseDto<PagedResult<GoblinNftGoodsSkuListVo>> goodsList(int page) {
List<String> startSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("1");
List<String> notStartSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("2");
List<String> soldOutSkuIdList = goblinRedisUtils.getGoblinNftGoodsInfoListVo("3");
List<String> allIdList = Stream.of(startSkuIdList, notStartSkuIdList, soldOutSkuIdList).flatMap(Collection::stream).collect(Collectors.toList());
int finalCount = (page - 1) * size;
int initCount = page * size;
if (finalCount < 0) {
finalCount = 0;
}
int allSize = allIdList.size();
if (initCount > allSize) {
initCount = allSize;
}
List<GoblinNftGoodsSkuListVo> skuList = ObjectUtil.getGoblinNftGoodsSkuListVoArrayList();
for (int i = finalCount; i < initCount; i++) {
String skuId = allIdList.get(i);
// sku信息
GoblinNftGoodsSkuListVo goblinNftGoodsListInfoVo = goblinRedisUtils.getGoblinNftGoodsListInfoVo(skuId);
if (null != goblinNftGoodsListInfoVo) {
// 库存、预约
if (soldOutSkuIdList.contains(skuId)) {// 是售罄的
goblinNftGoodsListInfoVo.setIsStock(0);
} else {
goblinNftGoodsListInfoVo.setIsStock(1);
}
// 写入列表
skuList.add(goblinNftGoodsListInfoVo);
}
}
PagedResult<GoblinNftGoodsSkuListVo> listVoPagedResult = ObjectUtil.getGoblinNftGoodsSkuListVoPagedResult();
listVoPagedResult.setList(skuList).setPageSize(GoblinNftGoodsAppServiceImpl.size).setCurrentPage(page);
return ResponseDto.success(listVoPagedResult);
}*/
@Override
public GoblinNftGoodsSkuInfoVo goodsDetail(String skuId) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
LocalDateTime now = LocalDateTime.now();
HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(now, skuId);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId");
if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) {
//获取预约相关
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1);
......@@ -120,7 +166,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
GoblinNftGoodsDetailSpuInfoVo nftGoodsDetailSpuInfoVo = GoblinNftGoodsDetailSpuInfoVo.getNew().copy(goodsInfoVo);
nftGoodsSkuInfoVo.setGoblinNftGoodsDetailSpuInfoVo(nftGoodsDetailSpuInfoVo);
// 库存
HashMap<String, Integer> stockHashMap = goblinOrderUtils.getIsStock(skuId, skuInfoVo.getUnbox(), skuInfoVo.getSoldoutStatus(), goodsInfoVo.getSkuIdList());
HashMap<String, Integer> stockHashMap = goblinOrderUtils.getIsStock(listId, skuId, skuInfoVo.getUnbox(), skuInfoVo.getSoldoutStatus(), goodsInfoVo.getSkuIdList());
nftGoodsSkuInfoVo.setIsStock(stockHashMap.get("isStock"));
// 总库存
if (skuInfoVo.getUnbox().equals("1")) {
......@@ -128,6 +174,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
}
// 系统时间
nftGoodsSkuInfoVo.setSystime(LocalDateTime.now());
nftGoodsSkuInfoVo.setTagType(tagType);
// 是否开启兑换
nftGoodsSkuInfoVo.setIsExchange(goblinRedisUtils.getIsExchange(skuId));
return nftGoodsSkuInfoVo;
......@@ -135,5 +182,4 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
return null;
}
}
}
......@@ -8,9 +8,12 @@ import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.service.IGoblinNftOrderAppService;
import com.liquidnet.service.goblin.util.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
@Service
......@@ -82,17 +85,36 @@ public class GoblinNftOrderAppServiceImpl implements IGoblinNftOrderAppService {
}
@Override
public GoblinPayOrderDetailsVo payOrderDetails(String skuId) {
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
public ResponseDto<GoblinPayOrderDetailsVo> payOrderDetails(String skuId) {
String uid = CurrentUtil.getCurrentUid();
String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), "");
LocalDateTime nowTime = LocalDateTime.now();
HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(nowTime, skuId);
GoblinGoodsSkuInfoVo goodsSkuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Object tagType = map.get("tagType");
String listId = (String) map.get("listId");
Integer whiteType = (Integer) map.get("whiteType");
if (goblinRedisUtils.getSkuAllStatusShow(goodsSkuInfoVo)) {
GoblinPayOrderDetailsVo payOrderDetailsVo = GoblinPayOrderDetailsVo.getNew().copy(goodsSkuInfoVo);
payOrderDetailsVo.setNum(1);
GoblinStoreInfoVo storeInfoVo = goblinRedisUtils.getStoreInfoVo(goodsSkuInfoVo.getStoreId());
payOrderDetailsVo.setStoreName(storeInfoVo.getStoreName());
return payOrderDetailsVo;
// 分批、提前购黑、白名单
Integer isListCanBuy = 1;
if (null != tagType) {
Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType);
if (!listCanBuy) {
isListCanBuy = 0;
}
}
payOrderDetailsVo.setIsListCanBuy(isListCanBuy);
return ResponseDto.success(payOrderDetailsVo);
} else {
return null;
return ResponseDto.failure("藏品不存在");
}
}
......
......@@ -123,6 +123,8 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
artworkInfoVo.setAuthor(goodsInfoVo.getAuthor());
artworkInfoVo.setPublisher(goodsInfoVo.getPublisher());
artworkInfoVo.setDetails(goodsSkuInfoVo.getDetails());
artworkInfoVo.setArUrlIos(goodsSkuInfoVo.getArUrlIos());
artworkInfoVo.setArUrlAndroid(goodsSkuInfoVo.getArUrlAndroid());
// artworkInfoVo.setGenerateTime(goodsSkuInfoVo.getDeclareAt());
return artworkInfoVo;
......
......@@ -10,10 +10,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsInfoVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsListVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuListVo;
import com.liquidnet.service.goblin.dto.manage.vo.*;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
......@@ -101,6 +98,11 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
return goodsListVoPagedResult;
}
@Override
public PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> skuList(GoblinStoreMgtGoodsSkuSimpleFilterParam mgtGoodsSkuSimpleFilterParam) {
return goblinMongoUtils.getMgtGoodsSkuSimpleVos(mgtGoodsSkuSimpleFilterParam);
}
@Override
public PagedResult<GoblinStoreMgtGoodsSkuListVo> skusList(GoblinStoreMgtGoodsSkuFilterParam mgtGoodsSkuFilterParam) {
PagedResult<GoblinStoreMgtGoodsSkuListVo> voList = goblinMongoUtils.getSkuSearch(mgtGoodsSkuFilterParam);
......
package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
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.GoblinStoreMgtGoodsSkuArAddParam;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSkuArFilterParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinStoreMgtGoodsSkuArListVo;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtGoodsSkuExtraService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
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 java.time.LocalDateTime;
import java.util.LinkedList;
import java.util.List;
@Slf4j
@Service
public class GoblinStoreMgtGoodsSkuExtraServiceImpl implements IGoblinStoreMgtGoodsSkuExtraService {
@Autowired
private QueueUtils queueUtils;
@Autowired
private GoblinMongoUtils goblinMongoUtils;
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Override
public PagedResult<GoblinStoreMgtGoodsSkuArListVo> skuArList(GoblinStoreMgtGoodsSkuArFilterParam mgtGoodsSkuExtraFilterParam) {
return goblinMongoUtils.getSkuArList(mgtGoodsSkuExtraFilterParam);
}
@Override
public boolean skuArAddEdit(String uid, GoblinStoreMgtGoodsSkuArAddParam mgtGoodsSkuArAddParam, boolean editFlg) {
LocalDateTime now = LocalDateTime.now();
String skuId = mgtGoodsSkuArAddParam.getSkuId();
String arUrlIos = mgtGoodsSkuArAddParam.getArUrlIos();
String arUrlAndroid = mgtGoodsSkuArAddParam.getArUrlAndroid();
if (goblinMongoUtils.updateGoodsSkuInfoVoForArUrl(skuId, uid, now, arUrlIos, arUrlAndroid, editFlg)) {
log.info("商品管理:藏品AR:{}[UID={},PARAMS={}]", editFlg ? "编辑" : "添加", uid, JsonUtils.toJson(mgtGoodsSkuArAddParam));
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
goblinRedisUtils.delGoodsSkuInfoVoByUnShelves(skuId);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> addEditGoodsSkuExtraObjs = CollectionUtil.linkedListObjectArr();
if (editFlg) {
toMqSqls.add(SqlMapping.get("goblin_goods_sku_extra.edit_ar"));
addEditGoodsSkuExtraObjs.add(new Object[]{arUrlIos, arUrlAndroid, uid, now, skuId});
} else {
toMqSqls.add(SqlMapping.get("goblin_goods_sku_extra.add_ar"));
addEditGoodsSkuExtraObjs.add(new Object[]{skuId, arUrlIos, arUrlAndroid, uid, now});
}
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, addEditGoodsSkuExtraObjs));
return true;
}
return false;
}
@Override
public boolean skuArDel(String uid, List<String> skuIdList) {
LocalDateTime now = LocalDateTime.now();
if (goblinMongoUtils.updateGoodsSkuInfoVoDelArUrl(uid, now, skuIdList)) {
log.info("商品管理:藏品AR:删除[UID={},PARAMS={}]", uid, JsonUtils.toJson(skuIdList));
LinkedList<Object[]> delGoodsSkuExtraObjs = CollectionUtil.linkedListObjectArr();
skuIdList.forEach(skuId -> {
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
goblinRedisUtils.delGoodsSkuInfoVoByUnShelves(skuId);
delGoodsSkuExtraObjs.add(new Object[]{uid, now, skuId});
});
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods_sku_extra.del_ar"));
// LinkedList<Object[]> delGoodsSkuExtraObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, delGoodsSkuExtraObjs));
return true;
}
return false;
}
}
......@@ -778,6 +778,59 @@ public class GoblinMongoUtils {
return storeSkuIdList;
}
// SKU搜索
public PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> getMgtGoodsSkuSimpleVos(GoblinStoreMgtGoodsSkuSimpleFilterParam filterParam) {
Criteria criteria = Criteria.where("delFlg").is("0").and("storeId").is(filterParam.getStoreId());
// if (null != filterParam.getSkuType()) {
// if (0 == filterParam.getSkuType()) {
// criteria.orOperator(Criteria.where("skuType").exists(false), (Criteria.where("skuType").is(0)));
// } else {
// criteria.and("skuType").is(1);
// }
// }
// if (StringUtils.isNotBlank(filterParam.getKeyword())) {
// Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
// criteria.orOperator(Criteria.where("name").regex(pattern), Criteria.where("subtitle").regex(pattern));
// }
if (null != filterParam.getSkuType()) {
if (0 == filterParam.getSkuType() && StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.orOperator(
Criteria.where("skuType").exists(false).and("name").regex(pattern),
Criteria.where("skuType").exists(false).and("subtitle").regex(pattern),
Criteria.where("skuType").is(0).and("name").regex(pattern),
Criteria.where("skuType").is(0).and("subtitle").regex(pattern)
);
filterParam.setKeyword(null);
} else if (0 == filterParam.getSkuType()) {
criteria.orOperator(Criteria.where("skuType").exists(false), (Criteria.where("skuType").is(0)));
} else if (1 == filterParam.getSkuType()) {
criteria.and("skuType").is(1);
}
}
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.orOperator(Criteria.where("name").regex(pattern), Criteria.where("subtitle").regex(pattern));
}
// if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) {
// criteria.and("shelvesStatus").is(filterParam.getShelvesStatus());
// }
Query query = Query.query(criteria);
long count = mongoTemplate.count(query, GoblinGoodsSkuInfoVo.class.getSimpleName());
PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> pagedResult = ObjectUtil.getGoblinStoreMgtGoodsSkuSimpleVoPagedResult();
if (count <= 0) return pagedResult;
int pageSize = 20;
query.with(PageRequest.of(filterParam.getPageNum() - 1, pageSize));
query.with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinStoreMgtGoodsSkuSimpleVo> list = mongoTemplate.find(query, GoblinStoreMgtGoodsSkuSimpleVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
return pagedResult.setList(list).setTotal(count, pageSize);
}
// SKU信息
public GoblinGoodsSkuInfoVo getGoodsSkuInfoVo(String skuId) {
// return mongoTemplate.findOne(Query.query(Criteria.where("skuId").is(skuId).and("delFlg").is("0").and("shelvesStatus").is("3")),
......@@ -866,6 +919,18 @@ public class GoblinMongoUtils {
GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0;
}
public boolean updateGoodsSkuInfoVoForArUrl(String skuId, String uid, LocalDateTime now, String arUrlIos, String arUrlAndroid, boolean editFlg) {
return mongoTemplate.updateMulti(Query.query(Criteria.where("skuId").is(skuId).and("delFlg").is("0").and("arUrlIos").exists(editFlg)),
Update.update("updatedBy", uid).set("updatedAt", now).set("arUrlIos", arUrlIos).set("arUrlAndroid", arUrlAndroid),
GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0;
}
public boolean updateGoodsSkuInfoVoDelArUrl(String uid, LocalDateTime now, List<String> skuIds) {
return mongoTemplate.updateMulti(Query.query(Criteria.where("skuId").in(skuIds).and("delFlg").is("0").and("arUrlIos").exists(true)),
Update.update("updatedBy", uid).set("updatedAt", now).unset("arUrlIos").unset("arUrlAndroid"),
GoblinGoodsSkuInfoVo.class.getSimpleName()).getModifiedCount() > 0;
}
/* ---------------------------------------- ---------------------------------------- */
/**
......@@ -1087,6 +1152,7 @@ public class GoblinMongoUtils {
}
}
//资金列表
public HashMap<String, Object> moneyGetSpuList(String spuName, String st, String et, String storeId, int page) {
//查询销量
......@@ -1547,6 +1613,7 @@ public class GoblinMongoUtils {
}
public PagedResult<GoblinStoreMgtGoodsSkuListVo> getSkuSearch(GoblinStoreMgtGoodsSkuFilterParam filterParam) {
String sysTime = DateUtil.getNowTime();
Criteria criteria = Criteria.where("storeId").is(filterParam.getStoreId()).and("spuId").is(filterParam.getSpuId()).and("delFlg").is("0");
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
......@@ -1586,16 +1653,36 @@ public class GoblinMongoUtils {
if("4".equals(filterParam.getShelvesStatus())) {
stock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
}else {
stock += redisUtils.getSkuAllStatusStock(itemVo);
stock += redisUtils.getSkuAllStatusStock(itemVo,null);
}
}
mgtGoodsSkuListVo.setSurplusStock(stock);
}
mgtGoodsSkuListVo.setSysTime(sysTime);
voList.add(mgtGoodsSkuListVo);
}
return pagedResult.setList(voList).setTotal(count, 20);
}
public PagedResult<GoblinStoreMgtGoodsSkuArListVo> getSkuArList(GoblinStoreMgtGoodsSkuArFilterParam filterParam) {
Criteria criteria = Criteria.where("storeId").is(filterParam.getStoreId()).and("delFlg").is("0").and("arUrlIos").exists(true);
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
Pattern pattern = Pattern.compile("^.*" + filterParam.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
criteria.orOperator(Criteria.where("name").regex(pattern), Criteria.where("subtitle").regex(pattern));
}
Query query = Query.query(criteria);
long count = mongoTemplate.count(query, GoblinGoodsSkuInfoVo.class.getSimpleName());
PagedResult<GoblinStoreMgtGoodsSkuArListVo> pagedResult = ObjectUtil.getGoblinStoreMgtGoodsSkuArListVoPagedResult();
if (count <= 0) return pagedResult;
query.with(PageRequest.of(filterParam.getPageNum() - 1, filterParam.getPageSize()));
query.with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinStoreMgtGoodsSkuArListVo> list = mongoTemplate.find(query, GoblinStoreMgtGoodsSkuArListVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
return pagedResult.setList(list).setTotal(count, filterParam.getPageSize());
}
/**
* 记录用户藏品数据
*/
......@@ -1603,6 +1690,42 @@ public class GoblinMongoUtils {
mongoTemplate.insert(vo, GoblinUserDigitalArtworkVo.class.getSimpleName());
}
/**
* 新增名单数据
*/
public void insertGoblinListDetailsVo(GoblinListDetailsVo vo) {
mongoTemplate.insert(vo, GoblinListDetailsVo.class.getSimpleName());
}
public void removeGoblinListDetailsVo(String listId) {
mongoTemplate.remove(Query.query(Criteria.where("listId").is(listId)), GoblinListDetailsVo.class.getSimpleName());
}
public Boolean changeGoblinListDetailsVo(GoblinListDetailsVo vo) {
return mongoTemplate.getCollection(GoblinListDetailsVo.class.getSimpleName())
.updateOne(Query.query(Criteria.where("listId").is(vo.getListId())).getQueryObject(),
ObjectUtil.cloneBasicDBObject().append("$set", mongoConverter.convertToMongoType(vo))
).getModifiedCount() > 0;
}
public HashMap<String, Object> getGoblinListVo(String name, String uid, Integer pageNum) {
int pageSize = 20;
Criteria criteria = Criteria.where("uid").is(uid);
if (name != null && !name.equals("")) {
criteria = criteria.and("name").regex("^.*" + name + ".*$");
}
Query query = Query.query(criteria);
long total = mongoTemplate.count(query, GoblinListDetailsVo.class, GoblinListDetailsVo.class.getSimpleName());
query.with(PageRequest.of(pageNum - 1, pageSize)).with(Sort.by(Sort.Order.desc("createdAt")));
List<GoblinListDetailsVo> list = mongoTemplate.find(query, GoblinListDetailsVo.class, GoblinListDetailsVo.class.getSimpleName());
HashMap<String, Object> map = CollectionUtil.mapStringObject();
map.put("data", list);
map.put("total", total);
return map;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -19,6 +19,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -90,21 +91,23 @@ public class GoblinOrderUtils {
}
// NFT判断是否售罄
public HashMap<String, Integer> getIsStock(String skuId, String unbox, String soldoutStatus, List<String> skuIdList) {
public HashMap<String, Integer> getIsStock(String listId, String skuId, String unbox, String soldoutStatus, List<String> skuIdList) {
HashMap<String, Integer> returnMap = CollectionUtil.mapStringInteger();
Integer isStock = 0;
Integer totalStock = 0;
if (null == soldoutStatus || soldoutStatus.equals("0")) {// 未设置售罄 查询库存
int surplusStock = 0;
if (unbox.equals("0")) {// 不是盲盒
surplusStock = redisUtils.getSkuStock(null, skuId);
surplusStock = redisUtils.getSkuStock(listId, skuId);
} else {
for (String skuIdItem : skuIdList) {// 盲盒计算所有sku库存总数
if (skuIdItem.equals(skuId)) {// 过滤自己
continue;
}
GoblinGoodsSkuInfoVo itemVo = redisUtils.getGoodsSkuInfoVo(skuIdItem);
surplusStock += redisUtils.getSkuAllStatusStock(itemVo);
HashMap<String, Object> map = redisUtils.getGoodsSkuInfoVo(LocalDateTime.now(), skuIdItem);
GoblinGoodsSkuInfoVo itemVo = (GoblinGoodsSkuInfoVo) map.get("vo");
String listId2 = (String) map.get("listId");
surplusStock += redisUtils.getSkuAllStatusStock(itemVo, listId2);
totalStock += redisUtils.getSkuTotalStock(itemVo);
}
}
......
package com.liquidnet.service.goblin.util;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
......@@ -12,21 +13,25 @@ import com.liquidnet.service.goblin.entity.GoblinOrderAttr;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
import com.liquidnet.service.goblin.param.BackCouponParam;
import com.liquidnet.service.goblin.param.GoblinListCreateItemParam;
import com.liquidnet.service.goblin.param.GoblinOrderSqlParam;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.WriteModel;
import org.bson.Document;
import java.util.ArrayList;
import java.util.List;
public class ObjectUtil {
private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> goblinStoreMgtGoodsSkuSimpleVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreNoticeVo> goblinStoreNoticeVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreMgtCouponListVo> goblinStoreMgtCouponListVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinUserDigitalArtworkListVo> goblinUserDigitalArtworkListVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinUserDigitalArtworkVo> goblinUserDigitalArtworkVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinNftGoodsSkuListVo> goblinNftGoodsSkuListVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinNftOrderDetailsVo> goblinNftOrderDetailsVoPagedResult = new PagedResult<>();
private static final PagedResult<GoblinStoreMgtGoodsSkuArListVo> goblinStoreMgtGoodsSkuArListVoPagedResult = new PagedResult<>();
private static final ArrayList<GoblinGoodsInfoVo> goblinGoodsInfoVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinFrontBanner> goblinFrontBannerArrayList = new ArrayList<>();
......@@ -83,16 +88,30 @@ public class ObjectUtil {
private static final ArrayList<TempCouponVo> tempCouponVo = new ArrayList<>();
private static final ArrayList<GoblinUserDigitalArtworkListVo> GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST = new ArrayList<>();
private static final PagedResult<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVo = new PagedResult<>();
private static final ArrayList<GoblinListVo> goblinListVo = new ArrayList<>();
private static final ArrayList<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinNftGoodsSkuListJobVo> goblinNftGoodsSkuListJobVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinListDetailsItemVo> goblinListDetailsItemVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinListCollectVo> goblinListCollectVo = new ArrayList<>();
private static final BasicDBObject basicDBObject = new BasicDBObject();
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
public static ArrayList<GoblinListVo> getGoblinListVo() {
return (ArrayList<GoblinListVo>) goblinListVo.clone();
}
public static ArrayList<GoblinListCollectVo> getGoblinListCollectVo() {
return (ArrayList<GoblinListCollectVo>) goblinListCollectVo.clone();
}
public static PagedResult<GoblinStoreMgtGoodsListVo> getGoblinStoreMgtGoodsVoPagedResult() {
return goblinStoreMgtGoodsVoPagedResult.clone();
}
public static PagedResult<GoblinStoreMgtGoodsSkuSimpleVo> getGoblinStoreMgtGoodsSkuSimpleVoPagedResult() {
return goblinStoreMgtGoodsSkuSimpleVoPagedResult.clone();
}
public static PagedResult<GoblinStoreNoticeVo> getGoblinStoreNoticeVoPagedResult() {
return goblinStoreNoticeVoPagedResult.clone();
}
......@@ -101,6 +120,10 @@ public class ObjectUtil {
return goblinStoreMgtGoodsSkuListVo.clone();
}
public static ArrayList<GoblinListDetailsItemVo> goblinListDetailsItemVoArrayList() {
return (ArrayList<GoblinListDetailsItemVo>) goblinListDetailsItemVoArrayList.clone();
}
public static ArrayList<GoblinStoreMgtGoodsSkuListVo> getGoblinStoreMgtGoodsSkuListVoArrayList() {
return (ArrayList<GoblinStoreMgtGoodsSkuListVo>) goblinStoreMgtGoodsSkuListVoArrayList.clone();
}
......@@ -129,6 +152,10 @@ public class ObjectUtil {
return goblinNftOrderDetailsVoPagedResult.clone();
}
public static PagedResult<GoblinStoreMgtGoodsSkuArListVo> getGoblinStoreMgtGoodsSkuArListVoPagedResult() {
return goblinStoreMgtGoodsSkuArListVoPagedResult.clone();
}
public static ArrayList<GoblinMailVo> goblinMailVo() {
return (ArrayList<GoblinMailVo>) goblinMailVo.clone();
}
......@@ -144,6 +171,7 @@ public class ObjectUtil {
public static ArrayList<GoblinGoodsInfoListVo> getGoblinGoodsInfoListVo() {
return (ArrayList<GoblinGoodsInfoListVo>) goblinGoodsInfoListVo.clone();
}
public static ArrayList<GoblinUserCouponVo> getGoblinUserCouponVo() {
return (ArrayList<GoblinUserCouponVo>) goblinUserCouponVo.clone();
}
......
......@@ -44,7 +44,7 @@ public class QueueUtils {
* 发送消息 - REDIS [XLS]
*
* @param xlsPath xls 对应的OSS 全量路径
* @param type [1-添加|2-删除]
* @param type [1-添加|2-删除|3-白名单|4-白名单]
* @param skuId skuId
*/
public void sendMsgByRedisXls(String xlsPath, String type, String skuId) {
......@@ -58,4 +58,22 @@ public class QueueUtils {
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(MQConst.GoblinQueue.GOBLIN_XLS_OPERA.getKey()));
}
}
/**
* 发送消息 - REDIS [XLS]
*
* @param nXlsPath xls 新地址
* @param oXlsPath xls 旧地址
* @param type [1-添加|2-删除|3-白名单|4-白名单]
* @param skuId skuId
*/
public void sendMsgByRedisXls(String listId,String nXlsPath, String oXlsPath, String type, String skuId) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put(MQConst.QUEUE_MESSAGE_KEY, nXlsPath.concat(",").concat(oXlsPath));
map.put("listId", listId);
map.put("type", type);
map.put("skuId", skuId);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(MQConst.GoblinQueue.GOBLIN_XLS_OPERA.getKey()));
}
}
......@@ -66,6 +66,9 @@
149016=\u8BF7\u5148\u5C06\u5546\u54C1\u4E0B\u67B6\u540E\u64CD\u4F5C
149017=\u8BF7\u5148\u5C06\u6D3B\u52A8\u505C\u7528\u540E\u64CD\u4F5C
149018=\u85CF\u54C1\u540D\u79F0\u91CD\u590D\uFF0C\u8BF7\u6838\u5B9E
149019=\u85CF\u54C1AR\u6587\u4EF6\u5DF2\u6DFB\u52A0\uFF0C\u8BF7\u6838\u5B9E
149020=\u85CF\u54C1\u672A\u6DFB\u52A0AR\u6587\u4EF6\uFF0C\u8BF7\u6838\u5B9E
149021=\u8BF7\u70B9\u9009\u85CF\u54C1\u540E\u64CD\u4F5C
148001=\u6B63\u5728\u4E0B\u5355\u5E93\u5B58\u4E0D\u8DB3
......
......@@ -60,6 +60,10 @@ goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg='1',upd
goblin_goods_sku.update_by_del_spu=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku_extra.add_ar=INSERT INTO goblin_goods_sku_extra (sku_id,ar_url_ios,ar_url_android,del_flg,created_by,created_at) VALUES (?,?,?,'0',?,?)
goblin_goods_sku_extra.edit_ar=UPDATE goblin_goods_sku_extra SET ar_url_ios=?,ar_url_android=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku_extra.del_ar=UPDATE goblin_goods_sku_extra SET del_flg='1',updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
#goblin_goods_sku_nft.insert_for_digital=INSERT INTO goblin_goods_sku_nft (sku_id,route_type,material_type,material_url,upchain,display_url,nft_url,series_id,series_hash,nft_hash,declare_at,created_at)VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods_sku_nft.insert_for_digital=INSERT INTO goblin_goods_sku_nft (sku_id,route_type,material_type,material_url,upchain,display_url,nft_url,created_at)VALUES(?,?,?,?,?,?,?,?)
#goblin_goods_sku_nft.update_for_digital=UPDATE goblin_goods_sku_nft SET upchain=?,series_id=?,series_hash=?,nft_hash=?,declare_at=?,updated_at=? WHERE skuId=? AND upchain=9
......@@ -147,3 +151,10 @@ goblin_goods_anticipate_user_update=UPDATE goblin_goods_anticipate_user SET stat
goblin_goods_anticipate_user_update_sku=UPDATE goblin_goods_anticipate_user SET state = 1 WHERE sku_id = ?
#---- \u4E1A\u52A1\u8D26\u53F7\u8BB0\u5F55
adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `work`, ppwd, `state`, created_at) VALUES (?,?,?,?,?,?,?)
#---- \u9ED1\u767D\u540D\u5355 ----
goblin_list_insert = INSERT INTO goblin_list (`list_id`,`uid`,`name`,`white_type`,`white_url`,`time_start`,`time_end`,`tag_type`,`black_url`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)
goblin_list_detail_insert = INSERT INTO goblin_list_details (`list_id`,`spu_id`,`sku_id`,`created_at`,`sku_stock`,`price_v`,`product_id`,`price`) VALUES (?,?,?,?,?,?,?,?)
goblin_list_update = UPDATE goblin_list SET white_url = ? ,white_type = ? , black_url = ? , updated_at = ? WHERE list_id = ?
goblin_list_remove = UPDATE goblin_list set del_tag = 1 , updated_at = ? WHERE list_id = ?
\ No newline at end of file
......@@ -76,10 +76,26 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("此数字藏品仅限预约用户购买~");
}
// 是否存在此商品信息 是否隐藏
// 基础参数
String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), "");
String skuId = payParam.getSkuId();
int number = 1;
GoblinGoodsSkuInfoVo skuVo = goblinRedisUtils.getGoodsSkuInfoVo(skuId);
LocalDateTime nowTime = LocalDateTime.now();
HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(nowTime, skuId);
GoblinGoodsSkuInfoVo skuVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Object tagType = map.get("tagType");
String listId = (String) map.get("listId");
Integer whiteType = (Integer) map.get("whiteType");
// 分批、提前购黑、白名单
if (null != tagType) {
Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType);
if (!listCanBuy) {
return ResponseDto.failure("该藏品仅对部分用户开放~");
}
}
// 是否存在此商品信息 是否隐藏
if (!nftOrderUtils.getSkuAllStatusShow(skuVo)) {
return ResponseDto.failure("该商品不存在~");
}
......@@ -95,7 +111,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
// 判断开售、停售时间
LocalDateTime saleStartTime = skuVo.getSaleStartTime();
LocalDateTime saleStopTime = skuVo.getSaleStopTime();
LocalDateTime nowTime = LocalDateTime.now();
if (nowTime.isBefore(saleStartTime)) {
return ResponseDto.failure("该商品还未开始售卖~");
} else if (null != saleStopTime && nowTime.isAfter(saleStopTime)) {
......@@ -112,7 +127,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
}
}
// 权限限购
String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), "");
boolean isVip = nftOrderUtils.isVipMember(uid);
String buyFactor = skuVo.getBuyFactor();
if (null == buyFactor) {
......@@ -138,19 +152,21 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
if (CollectionUtil.isEmpty(skuIdList)) {
return ResponseDto.failure("该商品SPU不存在~");
} else {
GoblinGoodsSkuInfoVo skuInfoVo = lotteryDraw(skuIdList, number);
HashMap<String, Object> lotteryDrawMap = lotteryDraw(skuIdList, number, nowTime);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) lotteryDrawMap.get("goodsSkuInfoVo");
if (null == skuInfoVo) {
goblinRedisUtils.decrSkuCountByUid(uid, skuId, number);
return ResponseDto.failure("盲盒库存不足啦~");
}
boxSkuId = skuInfoVo.getSkuId();
stockSkuId = boxSkuId;
listId = (String) lotteryDrawMap.get("listId");
}
} else {// 普通藏品逻辑
// 判断库存
int surplusGeneral = nftOrderUtils.decrSkuStock(skuId, number);
int surplusGeneral = goblinRedisUtils.decrSkuStock(listId, skuId, number);
if (surplusGeneral < 0) {
nftOrderUtils.backSkuCountAndStock(uid, stockSkuId, skuId, number);
nftOrderUtils.backSkuCountAndStock(listId, uid, stockSkuId, skuId, number);
return ResponseDto.failure("库存不足啦~");
}
}
......@@ -194,14 +210,14 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
int orderType1 = GoblinStatusConst.NftStatus.ORDER_TYPE_1.getValue();
GoblinNftOrder nftOrder = order(payParam, skuVo.getStoreId(), uid, spuId, number, orderId, orderCode, totalPrice, voucherPrice, storeVoucherPrice, boxSkuId, skuVo.getName() + " " + skuVo.getSubtitle(), orderType1);
if (null == nftOrder) {
nftOrderUtils.backSkuCountAndStock(uid, stockSkuId, skuId, number);
nftOrderUtils.backSkuCountAndStock(listId, uid, stockSkuId, skuId, number);
return ResponseDto.failure("下单失败~");
}
// 下单唤起支付
GoblinNftPayResultVo nftPayResultVo = payOrder(nftOrder, uid, payParam, skuVo.getProductId());
if (null == nftPayResultVo) {
nftOrderUtils.backSkuCountAndStock(uid, stockSkuId, skuId, number);
nftOrderUtils.backSkuCountAndStock(listId, uid, stockSkuId, skuId, number);
return ResponseDto.failure("下单失败啦~");
}
return ResponseDto.success(nftPayResultVo);
......@@ -215,18 +231,22 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
}
}
private GoblinGoodsSkuInfoVo lotteryDraw(List<String> skuIdList, int number) {
private HashMap<String, Object> lotteryDraw(List<String> skuIdList, int number, LocalDateTime nowTime) {
try {
ArrayList<GoblinGoodsSkuInfoVo> skuInfoVos = ObjectUtil.cloneArrayGoblinGoodsSkuInfoListVo();
ArrayList<String> listIds = ObjectUtil.cloneArrayListString();
for (String kid : skuIdList) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(kid);
HashMap<String, Object> map = goblinRedisUtils.getGoodsSkuInfoVo(nowTime, kid);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
String listId = (String) map.get("listId");
// 是盲盒的扔掉
if (skuInfoVo.getUnbox().equals("1")) {
continue;
}
// 不能购买的 没库存的 概率是0的 过滤
if (nftOrderUtils.getSkuAllStatusShow(skuInfoVo) && nftOrderUtils.getSkuAllStatusStock(skuInfoVo) > 0) {
if (nftOrderUtils.getSkuAllStatusShow(skuInfoVo) && nftOrderUtils.getSkuAllStatusStock(listId, skuInfoVo) > 0) {
skuInfoVos.add(skuInfoVo);
listIds.add(listId);
}
}
if (CollectionUtil.isEmpty(skuInfoVos)) {
......@@ -254,6 +274,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
// 未设置概率的写入概率
ArrayList<GoblinGoodsSkuInfoVo> newSkuInfoVos = ObjectUtil.cloneArrayGoblinGoodsSkuInfoListVo();
ArrayList<String> newListIds = ObjectUtil.cloneArrayListString();
int skuListSize = skuInfoVos.size();
for (int i = 0; i < skuListSize; i++) {
GoblinGoodsSkuInfoVo infoVo = skuInfoVos.get(i);
......@@ -274,6 +295,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
infoVo.setHitRatio(skuInfoVos.get(i - 1).getHitRatio().add(infoVo.getHitRatio()));
}
newSkuInfoVos.add(infoVo);
newListIds.add(listIds.get(i));
}
......@@ -295,13 +317,17 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
int index = hitRatioList.indexOf(nextDoubleNew);
GoblinGoodsSkuInfoVo goodsSkuInfoVo = newSkuInfoVos.get(index);
String endListId = newListIds.get(index);
// 判断库存
int surplusGeneral = nftOrderUtils.decrSkuStock(goodsSkuInfoVo.getSkuId(), number);
int surplusGeneral = goblinRedisUtils.decrSkuStock(endListId, goodsSkuInfoVo.getSkuId(), number);
if (surplusGeneral < 0) {
nftOrderUtils.incrSkuStock(goodsSkuInfoVo.getSkuId(), number);
return lotteryDraw(skuIdList, number);
goblinRedisUtils.incrSkuStock(endListId, goodsSkuInfoVo.getSkuId(), number);
return lotteryDraw(skuIdList, number, nowTime);
} else {
return goodsSkuInfoVo;
HashMap<String, Object> map = CollectionUtil.mapStringObject();
map.put("goodsSkuInfoVo", goodsSkuInfoVo);
map.put("listId", endListId);
return map;
}
}
} catch (Exception e) {
......
......@@ -56,11 +56,11 @@ public class GoblinNftOrderUtils {
}
// 回滚用户sku购买个数和库存
public void backSkuCountAndStock(String uid, String stockSkuId, String bySkuId, int number) {
public void backSkuCountAndStock(String listId, String uid, String stockSkuId, String bySkuId, int number) {
// 减少用户购买个数
goblinRedisUtils.decrSkuCountByUid(uid, bySkuId, number);
// 增加库存
incrSkuStock(stockSkuId, number);
goblinRedisUtils.incrSkuStock(listId, stockSkuId, number);
}
// 订单详情vo
......@@ -416,7 +416,7 @@ public class GoblinNftOrderUtils {
* String unbox; 是否盲盒[0-否|1-是]
*/
// 获取盲盒下藏品的库存 各种状态下不能算库存的排除掉
public int getSkuAllStatusStock(GoblinGoodsSkuInfoVo info) {
public int getSkuAllStatusStock(String listId, GoblinGoodsSkuInfoVo info) {
if (
info != null
&& LocalDateTime.now().isAfter(info.getSaleStartTime())
......@@ -424,7 +424,7 @@ public class GoblinNftOrderUtils {
&& (null == info.getSkuCanbuy() || info.getSkuCanbuy().equals("1"))
&& (null == info.getHitRatio() || info.getHitRatio().compareTo(BigDecimal.ZERO) > 0)
) {// 可以返回库存
return goblinRedisUtils.getSkuStock(info.getSkuId());
return goblinRedisUtils.getSkuStock(listId, info.getSkuId());
} else {// 不计入库存
return 0;
}
......
......@@ -50,11 +50,16 @@ public class ObjectUtil {
private static final ArrayList<WriteModel<Document>> writeModelDocumentArrayList = new ArrayList<>();
private static final ArrayList<GoblinUserCouponVo> goblinUserCouponVo = new ArrayList<>();
private static final ArrayList<GoblinBackOrderSkuVo> goblinBackOrderSkuVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinListCollectVo> goblinListCollectVo = new ArrayList<>();
public static Object[] objectsArray;
public static final Integer[] integerArray2 = new Integer[2];
public static ArrayList<GoblinListCollectVo> getGoblinListCollectVo() {
return (ArrayList<GoblinListCollectVo>) goblinListCollectVo.clone();
}
public static ArrayList<GoblinBackOrderSkuVo> goblinBackOrderSkuVoArrayList() {
return (ArrayList<GoblinBackOrderSkuVo>) goblinBackOrderSkuVoArrayList.clone();
}
......
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