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

Commit e33e076c authored by Administrator's avatar Administrator 🎨

Merge branch 'pre' into 'master'

Pre

See merge request !242
parents 83b5501e 6d8e1032
...@@ -100,6 +100,11 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable { ...@@ -100,6 +100,11 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
private String arUrlAndroid; private String arUrlAndroid;
@ApiModelProperty(position = 67, value = "标签[0-提前购买|1-分段购买]") @ApiModelProperty(position = 67, value = "标签[0-提前购买|1-分段购买]")
private Integer tagType; private Integer tagType;
@ApiModelProperty(position = 68, value = "分批购活动id")
private String listId;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 69, value = "sku正常开售时间")
private LocalDateTime baseSaleStartTime;
private static final GoblinNftGoodsSkuInfoVo obj = new GoblinNftGoodsSkuInfoVo(); private static final GoblinNftGoodsSkuInfoVo obj = new GoblinNftGoodsSkuInfoVo();
......
...@@ -42,11 +42,14 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable { ...@@ -42,11 +42,14 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 23, value = "藏品详情") @ApiModelProperty(position = 23, value = "藏品详情")
private String details; private String details;
@ApiModelProperty(position = 23, value = "单品AR文件URL-iOS版") @ApiModelProperty(position = 24, value = "单品AR文件URL-iOS版")
private String arUrlIos; private String arUrlIos;
@ApiModelProperty(position = 25, value = "单品AR文件URL-android版") @ApiModelProperty(position = 25, value = "单品AR文件URL-android版")
private String arUrlAndroid; private String arUrlAndroid;
@ApiModelProperty(position = 26, value = "单品ID")
private String skuId;
private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo(); private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo();
public static GoblinUserDigitalArtworkInfoVo getNew() { public static GoblinUserDigitalArtworkInfoVo getNew() {
...@@ -71,6 +74,7 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable { ...@@ -71,6 +74,7 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
// this.setAuthor(); // this.setAuthor();
// this.setPublisher(); // this.setPublisher();
// this.setDetails(); // this.setDetails();
this.setSkuId(source.getSkuId());
return this; return this;
} }
} }
...@@ -117,6 +117,7 @@ global-auth: ...@@ -117,6 +117,7 @@ global-auth:
- ${liquidnet.info.context}/nftTrade/** - ${liquidnet.info.context}/nftTrade/**
- ${liquidnet.info.context}/nftTradeQuery/** - ${liquidnet.info.context}/nftTradeQuery/**
- ${liquidnet.info.context}/nftUser/** - ${liquidnet.info.context}/nftUser/**
- ${liquidnet.info.context}/nftGoods/payType
oncheck-url-pattern: oncheck-url-pattern:
- -
# ----------------------------------------------------------- # -----------------------------------------------------------
......
...@@ -249,9 +249,6 @@ public class GoblinGoodsSku implements Serializable { ...@@ -249,9 +249,6 @@ public class GoblinGoodsSku implements Serializable {
private LocalDateTime deletedAt; private LocalDateTime deletedAt;
private Integer upchain;
/** /**
* 物流模版id * 物流模版id
*/ */
......
...@@ -72,7 +72,7 @@ public abstract class AbstractDataUtils { ...@@ -72,7 +72,7 @@ public abstract class AbstractDataUtils {
this.getQueueUtil().sendMySqlRedis( this.getQueueUtil().sendMySqlRedis(
SqlMapping.get("galaxy_user_info.update"), SqlMapping.get("galaxy_user_info.update"),
new Object[]{userInfoBo.getUserName(),userInfoBo.getIdCardType(),userInfoBo.getIdCard(),userInfoBo.getMobile() new Object[]{userInfoBo.getUserName(),userInfoBo.getIdCardType(),userInfoBo.getIdCard(),userInfoBo.getMobile()
,userInfoBo.getBlockChainAddress(),new Date(),userInfoBo.getRouterType(),userInfoBo.getUserId() ,userInfoBo.getBlockChainAddress(),userInfoBo.getUserIdentification(),new Date(),userInfoBo.getRouterType(),userInfoBo.getUserId()
} }
, MQConst.GalaxyQueue.SQL_USER_INFO.getKey() , MQConst.GalaxyQueue.SQL_USER_INFO.getKey()
); );
......
...@@ -12,7 +12,7 @@ galaxy_nft_trade_info.insert=insert into galaxy_nft_trade_info (user_id, nft_id, ...@@ -12,7 +12,7 @@ galaxy_nft_trade_info.insert=insert into galaxy_nft_trade_info (user_id, nft_id,
galaxy_nft_order_fail_log.insert=insert into galaxy_nft_order_fail_log (nft_order_pay_id, user_id, nft_id, nft_name, series_name, series_id,series_code, taskId, fail_reason_desc, fail_reason_desc_second, deal_with_status, trade_type,router_type, created_at, updated_at)values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) galaxy_nft_order_fail_log.insert=insert into galaxy_nft_order_fail_log (nft_order_pay_id, user_id, nft_id, nft_name, series_name, series_id,series_code, taskId, fail_reason_desc, fail_reason_desc_second, deal_with_status, trade_type,router_type, created_at, updated_at)values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
# ------------------------更新用户注册信息---------------------------- # ------------------------更新用户注册信息----------------------------
galaxy_user_info.update=update galaxy_user_info set user_name = ?,id_card_type = ?,id_card = ?,mobile = ?,block_chain_address = ?,updated_at =? where router_type = ? and user_id = ? galaxy_user_info.update=update galaxy_user_info set user_name = ?,id_card_type = ?,id_card = ?,mobile = ?,block_chain_address = ?,user_identification = ?,updated_at =? where router_type = ? and user_id = ?
# ------------------------更新系列声明信息---------------------------- # ------------------------更新系列声明信息----------------------------
galaxy_series_info.updateSeriesIdAndStatus=update galaxy_series_info t set t.series_id = ?,t.chain_timestamp = ?,t.trade_hash = ?,t.series_claim_status = ? ,t.updated_at =? where t.series_code = ? galaxy_series_info.updateSeriesIdAndStatus=update galaxy_series_info t set t.series_id = ?,t.chain_timestamp = ?,t.trade_hash = ?,t.series_claim_status = ? ,t.updated_at =? where t.series_code = ?
# ------------------------更新系列NFT信息---------------------------- # ------------------------更新系列NFT信息----------------------------
......
...@@ -230,6 +230,19 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS ...@@ -230,6 +230,19 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//mongodb缓存 //mongodb缓存
// goblinMongoUtils.setHelpVo(helpVo); // goblinMongoUtils.setHelpVo(helpVo);
//记录助力人数头像(前六个)
List<String> helpUserAvatar = goblinRedisUtils.getHelpUserAvatar(sid);
if (helpUserAvatar.size() <= 6) {
//获取用户头像保存
AdamUserInfoVo userInfo = goblinAnticipateUtils.getUserInfo();
if (userInfo!=null){
//新增助力头像
goblinRedisUtils.setHelpUserAvatar(sid, userInfo.getAvatar());
}else {
return ResponseDto.failure(ErrorMapping.get(150008));
}
}
//加入redis缓存 //加入redis缓存
Duration between = Duration.between(shareVo.getAboutStartDate(), shareVo.getAboutEndDate()); Duration between = Duration.between(shareVo.getAboutStartDate(), shareVo.getAboutEndDate());
goblinRedisUtils.setHelpByUidAndSid(uid, sid, between.toDays()); goblinRedisUtils.setHelpByUidAndSid(uid, sid, between.toDays());
...@@ -246,15 +259,6 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS ...@@ -246,15 +259,6 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
}); });
sendRedis("goblin_goods_anticipate_help", sqlValue); sendRedis("goblin_goods_anticipate_help", sqlValue);
//记录助力人数头像(前六个)
List<String> helpUserAvatar = goblinRedisUtils.getHelpUserAvatar(sid);
if (helpUserAvatar.size() <= 6) {
//获取用户头像保存
AdamUserInfoVo userInfo = goblinAnticipateUtils.getUserInfo();
//新增助力头像
goblinRedisUtils.setHelpUserAvatar(sid, userInfo.getAvatar());
}
//判断主力人数是否达标,达标则自动预约 //判断主力人数是否达标,达标则自动预约
if (shareVo.getPeopleType().equals(goblinRedisUtils.getHelpSidAddHelp(sid))){ if (shareVo.getPeopleType().equals(goblinRedisUtils.getHelpSidAddHelp(sid))){
//主力人数达到可预约条件 //主力人数达到可预约条件
......
...@@ -147,6 +147,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService { ...@@ -147,6 +147,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo"); GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType"); Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId"); String listId = (String) map.get("listId");
LocalDateTime baseSaleStartTime = (LocalDateTime) map.get("baseSaleStartTime");
if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) { if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) {
//获取预约相关 //获取预约相关
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1); AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1);
...@@ -175,6 +176,8 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService { ...@@ -175,6 +176,8 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
// 系统时间 // 系统时间
nftGoodsSkuInfoVo.setSystime(LocalDateTime.now()); nftGoodsSkuInfoVo.setSystime(LocalDateTime.now());
nftGoodsSkuInfoVo.setTagType(tagType); nftGoodsSkuInfoVo.setTagType(tagType);
nftGoodsSkuInfoVo.setListId(listId);
nftGoodsSkuInfoVo.setBaseSaleStartTime(baseSaleStartTime);
// 是否开启兑换 // 是否开启兑换
nftGoodsSkuInfoVo.setIsExchange(goblinRedisUtils.getIsExchange(skuId)); nftGoodsSkuInfoVo.setIsExchange(goblinRedisUtils.getIsExchange(skuId));
return nftGoodsSkuInfoVo; return nftGoodsSkuInfoVo;
......
...@@ -104,7 +104,7 @@ public class GoblinNftOrderAppServiceImpl implements IGoblinNftOrderAppService { ...@@ -104,7 +104,7 @@ public class GoblinNftOrderAppServiceImpl implements IGoblinNftOrderAppService {
// 分批、提前购黑、白名单 // 分批、提前购黑、白名单
Integer isListCanBuy = 1; Integer isListCanBuy = 1;
if (null != tagType) { if (null != listId) {
Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType); Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType);
if (!listCanBuy) { if (!listCanBuy) {
isListCanBuy = 0; isListCanBuy = 0;
......
...@@ -21,6 +21,7 @@ import com.liquidnet.service.goblin.util.GoblinRedisUtils; ...@@ -21,6 +21,7 @@ import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil; import com.liquidnet.service.goblin.util.ObjectUtil;
import com.liquidnet.service.goblin.util.QueueUtils; import com.liquidnet.service.goblin.util.QueueUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -113,6 +114,10 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr ...@@ -113,6 +114,10 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId()); GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId());
GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(goodsSkuInfoVo.getSpuId()); GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(goodsSkuInfoVo.getSpuId());
GoblinNftOrderVo nftOrder = goblinRedisUtils.getGoblinNftOrder(userDigitalArtworkVo.getOrderId());
if (null != nftOrder && StringUtils.isNotBlank(nftOrder.getBoxSkuId())) {
artworkInfoVo.setSkuId(nftOrder.getSkuId());
}
artworkInfoVo.setCoverPic(goodsSkuInfoVo.getSkuPic()); artworkInfoVo.setCoverPic(goodsSkuInfoVo.getSkuPic());
artworkInfoVo.setName(goodsSkuInfoVo.getName()); artworkInfoVo.setName(goodsSkuInfoVo.getName());
......
...@@ -286,7 +286,7 @@ public class GoblinNftJobServiceImpl { ...@@ -286,7 +286,7 @@ public class GoblinNftJobServiceImpl {
List<GoblinNftGoodsSkuListJobVo> notStartSkuInfoVos = mongoTemplate.find(query1, GoblinNftGoodsSkuListJobVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName()); List<GoblinNftGoodsSkuListJobVo> notStartSkuInfoVos = mongoTemplate.find(query1, GoblinNftGoodsSkuListJobVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
for (GoblinNftGoodsSkuListJobVo item : notStartSkuInfoVos) { for (GoblinNftGoodsSkuListJobVo item : notStartSkuInfoVos) {
goblinRedisUtils.goblinNftListStock(now, item.getSkuId()); goblinRedisUtils.goblinNftListStock(now, item.getSkuId(),item.getSaleStartTime());
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -115,6 +115,10 @@ public class GoblinListServiceImpl implements IGoblinListService { ...@@ -115,6 +115,10 @@ public class GoblinListServiceImpl implements IGoblinListService {
if (param.getItemParams().size() > 1) { if (param.getItemParams().size() > 1) {
return ResponseDto.failure("只能配置一个sku"); return ResponseDto.failure("只能配置一个sku");
} }
//判断重名
if(mongoUtils.hasGoblinListDetailsVoByName(param.getName())){
return ResponseDto.failure("活动名称重复");
}
String skuId = param.getItemParams().get(0).getSkuId(); String skuId = param.getItemParams().get(0).getSkuId();
GoblinGoodsSkuInfoVo skuInfoVo = redisUtils.getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo skuInfoVo = redisUtils.getGoodsSkuInfoVo(skuId);
LocalDateTime st = LocalDateTime.parse(param.getTimeStart(), DTF_YMD_HMS); LocalDateTime st = LocalDateTime.parse(param.getTimeStart(), DTF_YMD_HMS);
...@@ -175,9 +179,9 @@ public class GoblinListServiceImpl implements IGoblinListService { ...@@ -175,9 +179,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
vo.setCreatedAt(DateUtil.format(now, DateUtil.Formatter.yyyyMMddHHmmss)); vo.setCreatedAt(DateUtil.format(now, DateUtil.Formatter.yyyyMMddHHmmss));
//判断 白名单类型 //判断 白名单类型
if (param.getWhiteType().equals(1)) {//需要xls文件 if (param.getWhiteType().equals(1)) {//需要xls文件
if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) { // if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) {
return ResponseDto.failure("未上传指定用户文件"); // return ResponseDto.failure("未上传指定用户文件");
} // }
vo.setWhiteUrl(param.getWhiteUrl()); vo.setWhiteUrl(param.getWhiteUrl());
vo.setWhiteName(param.getWhiteName()); vo.setWhiteName(param.getWhiteName());
} else {//不需要xls文件 } else {//不需要xls文件
...@@ -211,6 +215,9 @@ public class GoblinListServiceImpl implements IGoblinListService { ...@@ -211,6 +215,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
collectVo.setPriceV(itemVo.getPriceV()); collectVo.setPriceV(itemVo.getPriceV());
collectVo.setProductId(itemVo.getProductId()); collectVo.setProductId(itemVo.getProductId());
collectVo.setWhiteType(vo.getWhiteType()); collectVo.setWhiteType(vo.getWhiteType());
if(vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")){
collectVo.setWhiteType(-1);
}
collectVo.setTimeStart(st); collectVo.setTimeStart(st);
collectVo.setTimeEnd(et); collectVo.setTimeEnd(et);
collectVo.setTagType(vo.getTagType()); collectVo.setTagType(vo.getTagType());
...@@ -249,9 +256,9 @@ public class GoblinListServiceImpl implements IGoblinListService { ...@@ -249,9 +256,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
//判断 白名单类型 //判断 白名单类型
vo.setWhiteType(param.getWhiteType()); vo.setWhiteType(param.getWhiteType());
if (param.getWhiteType().equals(1)) {//需要xls文件 if (param.getWhiteType().equals(1)) {//需要xls文件
if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) { // if (param.getWhiteUrl() == null || param.getWhiteUrl().equals("")) {
return ResponseDto.failure("未上传指定用户文件"); // return ResponseDto.failure("未上传指定用户文件");
} // }
vo.setWhiteUrl(param.getWhiteUrl()); vo.setWhiteUrl(param.getWhiteUrl());
vo.setWhiteName(param.getWhiteName()); vo.setWhiteName(param.getWhiteName());
} else {//不需要xls文件 } else {//不需要xls文件
...@@ -270,6 +277,9 @@ public class GoblinListServiceImpl implements IGoblinListService { ...@@ -270,6 +277,9 @@ public class GoblinListServiceImpl implements IGoblinListService {
for (GoblinListCollectVo itemVo : collectVos) { for (GoblinListCollectVo itemVo : collectVos) {
if (itemVo.getListId().equals(param.getListId())) { if (itemVo.getListId().equals(param.getListId())) {
itemVo.setWhiteType(vo.getWhiteType()); itemVo.setWhiteType(vo.getWhiteType());
if(vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")){
itemVo.setWhiteType(-1);
}
break; break;
} }
} }
......
...@@ -62,14 +62,14 @@ public class GoblinMongoUtils { ...@@ -62,14 +62,14 @@ public class GoblinMongoUtils {
HashMap<String, Object> info = CollectionUtil.mapStringObject(); HashMap<String, Object> info = CollectionUtil.mapStringObject();
Pageable pageable = PageRequest.of(goblinGoodsAnticipateValueParam.getPageNum() - 1, 20, Sort.by(Sort.Direction.DESC, "createdDate")); Pageable pageable = PageRequest.of(goblinGoodsAnticipateValueParam.getPageNum() - 1, 20, Sort.by(Sort.Direction.DESC, "createdDate"));
Criteria criteria = Criteria.where("delTag").is(0).and("uid").is(uid); Criteria criteria = Criteria.where("delTag").is(0).and("uid").is(uid);
if (goblinGoodsAnticipateValueParam.getType()!=null){ if (goblinGoodsAnticipateValueParam.getType() != null) {
if (goblinGoodsAnticipateValueParam.getType()==1){ if (goblinGoodsAnticipateValueParam.getType() == 1) {
//预约提醒 //预约提醒
criteria = criteria.and("type").is(goblinGoodsAnticipateValueParam.getType()); criteria = criteria.and("type").is(goblinGoodsAnticipateValueParam.getType());
}else if (goblinGoodsAnticipateValueParam.getType()==2){ } else if (goblinGoodsAnticipateValueParam.getType() == 2) {
//预约购买 //预约购买
criteria = criteria.and("type").is(2).and("peopleType").is(0); criteria = criteria.and("type").is(2).and("peopleType").is(0);
}else if(goblinGoodsAnticipateValueParam.getType()==3){ } else if (goblinGoodsAnticipateValueParam.getType() == 3) {
//预约助力 //预约助力
criteria = criteria.and("type").is(2).and("peopleType").gt(0); criteria = criteria.and("type").is(2).and("peopleType").gt(0);
} }
...@@ -207,14 +207,14 @@ public class GoblinMongoUtils { ...@@ -207,14 +207,14 @@ public class GoblinMongoUtils {
/** /**
* 存入用户创建分享 不需要mongodb存储 * 存入用户创建分享 不需要mongodb存储
*/ */
public void setGoblinGoodsAnticipateShareVo(GoblinGoodsAnticipateShareVo goblinGoodsAnticipateShareVo){ public void setGoblinGoodsAnticipateShareVo(GoblinGoodsAnticipateShareVo goblinGoodsAnticipateShareVo) {
mongoTemplate.insert(goblinGoodsAnticipateShareVo,GoblinGoodsAnticipateShareVo.class.getSimpleName()); mongoTemplate.insert(goblinGoodsAnticipateShareVo, GoblinGoodsAnticipateShareVo.class.getSimpleName());
} }
/** /**
* 根据创建id查询分享信息 * 根据创建id查询分享信息
*/ */
public GoblinGoodsAnticipateShareVo getShareVoBySid(String sid){ public GoblinGoodsAnticipateShareVo getShareVoBySid(String sid) {
return mongoTemplate.findOne(Query.query(Criteria.where("sid").is(sid)), return mongoTemplate.findOne(Query.query(Criteria.where("sid").is(sid)),
GoblinGoodsAnticipateShareVo.class, GoblinGoodsAnticipateShareVo.class.getSimpleName()); GoblinGoodsAnticipateShareVo.class, GoblinGoodsAnticipateShareVo.class.getSimpleName());
} }
...@@ -222,17 +222,18 @@ public class GoblinMongoUtils { ...@@ -222,17 +222,18 @@ public class GoblinMongoUtils {
/** /**
* 分享id和助力人id 查询助力信息 不存mongodb * 分享id和助力人id 查询助力信息 不存mongodb
*/ */
public GoblinGoodsAnticipateHelpVo getHelpVo(String sid,String uid){ public GoblinGoodsAnticipateHelpVo getHelpVo(String sid, String uid) {
return mongoTemplate.findOne(Query.query(Criteria.where("sid").is(sid).and("helpUid").is(uid)), return mongoTemplate.findOne(Query.query(Criteria.where("sid").is(sid).and("helpUid").is(uid)),
GoblinGoodsAnticipateHelpVo.class, GoblinGoodsAnticipateHelpVo.class.getSimpleName()); GoblinGoodsAnticipateHelpVo.class, GoblinGoodsAnticipateHelpVo.class.getSimpleName());
} }
/** /**
* 助力vo 之后删去不需要储存 * 助力vo 之后删去不需要储存
*
* @param goodsAnticipateHelpVo * @param goodsAnticipateHelpVo
*/ */
public void setHelpVo(GoblinGoodsAnticipateHelpVo goodsAnticipateHelpVo){ public void setHelpVo(GoblinGoodsAnticipateHelpVo goodsAnticipateHelpVo) {
mongoTemplate.insert(goodsAnticipateHelpVo,GoblinGoodsAnticipateHelpVo.class.getSimpleName()); mongoTemplate.insert(goodsAnticipateHelpVo, GoblinGoodsAnticipateHelpVo.class.getSimpleName());
} }
/* ---------------------------------------- 平台分类数据源 ---------------------------------------- */ /* ---------------------------------------- 平台分类数据源 ---------------------------------------- */
...@@ -1171,7 +1172,7 @@ public class GoblinMongoUtils { ...@@ -1171,7 +1172,7 @@ public class GoblinMongoUtils {
if (spuName != null) { if (spuName != null) {
Query q1 = Query.query(Criteria.where("name").regex(".*" + spuName + ".*")); Query q1 = Query.query(Criteria.where("name").regex(".*" + spuName + ".*"));
q1.fields().include("spuId"); q1.fields().include("spuId");
List<String> spuIds = mongoTemplate.find(q1,GoblinGoodsInfoVo.class,GoblinGoodsInfoVo.class.getSimpleName()).stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList()); List<String> spuIds = mongoTemplate.find(q1, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName()).stream().map(GoblinGoodsInfoVo::getSpuId).collect(Collectors.toList());
criteriaCount = criteriaCount.and("spuId").in(spuIds); criteriaCount = criteriaCount.and("spuId").in(spuIds);
} }
//查询总数量 //查询总数量
...@@ -1620,9 +1621,9 @@ public class GoblinMongoUtils { ...@@ -1620,9 +1621,9 @@ public class GoblinMongoUtils {
criteria.and("name").regex(pattern); criteria.and("name").regex(pattern);
} }
if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) { if (StringUtils.isNotBlank(filterParam.getShelvesStatus())) {
if ("4".equals(filterParam.getShelvesStatus())){ if ("4".equals(filterParam.getShelvesStatus())) {
criteria.and("shelvesStatus").is("3").and("saleStartTime").gte(now()); criteria.and("shelvesStatus").is("3").and("saleStartTime").gte(now());
}else { } else {
criteria.and("shelvesStatus").is(filterParam.getShelvesStatus()); criteria.and("shelvesStatus").is(filterParam.getShelvesStatus());
} }
} }
...@@ -1650,10 +1651,10 @@ public class GoblinMongoUtils { ...@@ -1650,10 +1651,10 @@ public class GoblinMongoUtils {
continue; continue;
} }
GoblinGoodsSkuInfoVo itemVo = redisUtils.getGoodsSkuInfoVo(skuIdItem); GoblinGoodsSkuInfoVo itemVo = redisUtils.getGoodsSkuInfoVo(skuIdItem);
if("4".equals(filterParam.getShelvesStatus())) { if ("4".equals(filterParam.getShelvesStatus())) {
stock += redisUtils.getSkuAllStatusStockStatus4(itemVo); stock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
}else { } else {
stock += redisUtils.getSkuAllStatusStock(itemVo,null); stock += redisUtils.getSkuAllStatusStock(itemVo, null);
} }
} }
mgtGoodsSkuListVo.setSurplusStock(stock); mgtGoodsSkuListVo.setSurplusStock(stock);
...@@ -1697,6 +1698,12 @@ public class GoblinMongoUtils { ...@@ -1697,6 +1698,12 @@ public class GoblinMongoUtils {
mongoTemplate.insert(vo, GoblinListDetailsVo.class.getSimpleName()); mongoTemplate.insert(vo, GoblinListDetailsVo.class.getSimpleName());
} }
public Boolean hasGoblinListDetailsVoByName(String name) {
Criteria criteria = Criteria.where("name").is(name);
Query query = Query.query(criteria);
return mongoTemplate.exists(query, GoblinListDetailsVo.class, GoblinListDetailsVo.class.getSimpleName());
}
public void removeGoblinListDetailsVo(String listId) { public void removeGoblinListDetailsVo(String listId) {
mongoTemplate.remove(Query.query(Criteria.where("listId").is(listId)), GoblinListDetailsVo.class.getSimpleName()); mongoTemplate.remove(Query.query(Criteria.where("listId").is(listId)), GoblinListDetailsVo.class.getSimpleName());
} }
......
...@@ -811,16 +811,17 @@ public class GoblinRedisUtils { ...@@ -811,16 +811,17 @@ public class GoblinRedisUtils {
GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId);
HashMap<String, Object> map = CollectionUtil.mapStringObject(); HashMap<String, Object> map = CollectionUtil.mapStringObject();
if (null == vo.getSaleStartTime() || now.isAfter(vo.getSaleStartTime())) {//普通商品已开售 if (null == vo.getSaleStartTime() || now.isAfter(vo.getSaleStartTime())) {//普通商品已开售
lastStockToLastStock(0, getGoblinListCollect(skuId), null, skuId);
map.put("vo", vo); map.put("vo", vo);
map.put("tagType", null); map.put("tagType", null);
map.put("listId", null); map.put("listId", null);
map.put("whiteType", null); map.put("whiteType", null);
map.put("baseSaleStartTime", vo.getSaleStartTime());
} else {//未开售 } else {//未开售
GoblinListCollectVo collectVo = getCollectByNow(now, skuId); GoblinListCollectVo collectVo = getCollectByNow(now, skuId);
Integer tagType = null; Integer tagType = null;
Integer whiteType = null; Integer whiteType = null;
String listId = null; String listId = null;
LocalDateTime baseSaleStartTime = vo.getSaleStartTime();
if (collectVo != null) { if (collectVo != null) {
vo.setPrice(collectVo.getPrice()); vo.setPrice(collectVo.getPrice());
vo.setPriceV(collectVo.getPriceV()); vo.setPriceV(collectVo.getPriceV());
...@@ -833,11 +834,15 @@ public class GoblinRedisUtils { ...@@ -833,11 +834,15 @@ public class GoblinRedisUtils {
GoblinListCollectVo collectNext = getCollectByNowNext(now, skuId); GoblinListCollectVo collectNext = getCollectByNowNext(now, skuId);
if (collectNext != null) { if (collectNext != null) {
tagType = collectNext.getTagType(); tagType = collectNext.getTagType();
//todo 逻辑修改 开售时间
vo.setSaleStartTime(collectNext.getTimeStart());
vo.setSaleStopTime(collectNext.getTimeEnd());
} }
map.put("vo", vo); map.put("vo", vo);
map.put("tagType", tagType); map.put("tagType", tagType);
map.put("listId", listId); map.put("listId", listId);
map.put("whiteType", whiteType); map.put("whiteType", whiteType);
map.put("baseSaleStartTime", baseSaleStartTime);
} }
return map; return map;
} }
...@@ -862,23 +867,13 @@ public class GoblinRedisUtils { ...@@ -862,23 +867,13 @@ public class GoblinRedisUtils {
} else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) { } else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem; collectVo = collectVoItem;
break; break;
}else if(collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())){ } else if (collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())) {
collectTemp = null; collectTemp = null;
} }
} }
if (collectVo == null) { if (collectVo == null) {
collectVo = collectTemp; collectVo = collectTemp;
} }
if (collectVo == null) {
GoblinListCollectVo collectNext = getCollectByNowNext(now, skuId);
if (collectNext == null) {
lastStockToLastStock(0, collectVos, null, skuId);
} else {
lastStockToLastStock(1, collectVos, collectNext, skuId);
}
} else {
lastStockToLastStock(1, collectVos, collectVo, skuId);
}
return collectVo; return collectVo;
} }
...@@ -889,10 +884,13 @@ public class GoblinRedisUtils { ...@@ -889,10 +884,13 @@ public class GoblinRedisUtils {
* @param skuId * @param skuId
* @return * @return
*/ */
public GoblinListCollectVo goblinNftListStock(LocalDateTime now, String skuId) { public void goblinNftListStock(LocalDateTime now, String skuId,LocalDateTime saleStartTime) {
GoblinListCollectVo collectVo = null; GoblinListCollectVo collectVo = null;
GoblinListCollectVo collectTemp = null; GoblinListCollectVo collectTemp = null;
List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId); List<GoblinListCollectVo> collectVos = getGoblinListCollect(skuId);
if(now.isAfter(saleStartTime)){
lastStockToLastStock(0, collectVos, null, skuId);
}else {
for (int i = 0; i < collectVos.size(); i++) { for (int i = 0; i < collectVos.size(); i++) {
GoblinListCollectVo collectVoItem = collectVos.get(i); GoblinListCollectVo collectVoItem = collectVos.get(i);
if (now.isAfter(collectVoItem.getTimeStart()) && collectVoItem.getTimeEnd() == null) { if (now.isAfter(collectVoItem.getTimeStart()) && collectVoItem.getTimeEnd() == null) {
...@@ -902,7 +900,7 @@ public class GoblinRedisUtils { ...@@ -902,7 +900,7 @@ public class GoblinRedisUtils {
} else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) { } else if (now.isAfter(collectVoItem.getTimeStart()) && now.isBefore(collectVoItem.getTimeEnd())) {
collectVo = collectVoItem; collectVo = collectVoItem;
break; break;
}else if(collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())){ } else if (collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())) {
collectTemp = null; collectTemp = null;
} }
} }
...@@ -919,7 +917,8 @@ public class GoblinRedisUtils { ...@@ -919,7 +917,8 @@ public class GoblinRedisUtils {
} else { } else {
lastStockToLastStock(1, collectVos, collectVo, skuId); lastStockToLastStock(1, collectVos, collectVo, skuId);
} }
return collectVo; }
// return collectVo;
} }
/** /**
...@@ -946,7 +945,7 @@ public class GoblinRedisUtils { ...@@ -946,7 +945,7 @@ public class GoblinRedisUtils {
if (collectNext == null || collectNext.getTimeStart().isAfter(collectNext.getTimeStart())) { if (collectNext == null || collectNext.getTimeStart().isAfter(collectNext.getTimeStart())) {
collectNext = collectVoItem; collectNext = collectVoItem;
} }
}else if(collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())){ } else if (collectVoItem.getTimeEnd() != null && now.isAfter(collectVoItem.getTimeEnd())) {
collectTemp = null; collectTemp = null;
} }
} }
...@@ -970,7 +969,7 @@ public class GoblinRedisUtils { ...@@ -970,7 +969,7 @@ public class GoblinRedisUtils {
if (vo == null && type == 0) {//已开售逻辑 if (vo == null && type == 0) {//已开售逻辑
for (GoblinListCollectVo collectVoItem : collectVos) { for (GoblinListCollectVo collectVoItem : collectVos) {
int lastStock = getSkuStock(collectVoItem.getListId(), skuId); int lastStock = getSkuStock(collectVoItem.getListId(), skuId);
log.debug("all stock = "+lastStock); log.debug("all stock = " + lastStock);
int restStock = decrSkuStock(collectVoItem.getListId(), skuId, lastStock); int restStock = decrSkuStock(collectVoItem.getListId(), skuId, lastStock);
if (restStock < 0) { if (restStock < 0) {
incrSkuStock(collectVoItem.getListId(), skuId, lastStock); incrSkuStock(collectVoItem.getListId(), skuId, lastStock);
...@@ -1015,7 +1014,7 @@ public class GoblinRedisUtils { ...@@ -1015,7 +1014,7 @@ public class GoblinRedisUtils {
for (GoblinListCollectVo itemVo : collectVosList) { for (GoblinListCollectVo itemVo : collectVosList) {
//减少上个时间段sku库存 //减少上个时间段sku库存
int lastStock = getSkuStock(itemVo.getListId(), skuId); int lastStock = getSkuStock(itemVo.getListId(), skuId);
log.debug("temp stock = "+lastStock); log.debug("temp stock = " + lastStock);
int restStock = decrSkuStock(itemVo.getListId(), skuId, lastStock); int restStock = decrSkuStock(itemVo.getListId(), skuId, lastStock);
if (restStock < 0) { if (restStock < 0) {
//库存超过销售量 操作失败回滚库存 //库存超过销售量 操作失败回滚库存
...@@ -1047,7 +1046,9 @@ public class GoblinRedisUtils { ...@@ -1047,7 +1046,9 @@ public class GoblinRedisUtils {
if (bResult) { if (bResult) {
return false; return false;
} }
if (whiteType == 0) {//会员 if (whiteType == -1) {
return true;
}else if (whiteType == 0) {//会员
return memberStage != null; return memberStage != null;
} else {//白名单 } else {//白名单
return wResult; return wResult;
...@@ -2002,6 +2003,7 @@ public class GoblinRedisUtils { ...@@ -2002,6 +2003,7 @@ public class GoblinRedisUtils {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_GOODS_LIST_INFO.concat(skuId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_GOODS_LIST_INFO.concat(skuId);
redisUtil.set(redisKey, data); redisUtil.set(redisKey, data);
} }
public GoblinNftGoodsSkuListVo getGoblinNftGoodsListInfoVo(String skuId) { public GoblinNftGoodsSkuListVo getGoblinNftGoodsListInfoVo(String skuId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_GOODS_LIST_INFO.concat(skuId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_GOODS_LIST_INFO.concat(skuId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
...@@ -2036,6 +2038,7 @@ public class GoblinRedisUtils { ...@@ -2036,6 +2038,7 @@ public class GoblinRedisUtils {
return (GoblinUserNftAccInfoVo) obj; return (GoblinUserNftAccInfoVo) obj;
} }
} }
public void setOpenAccountInfo(String userId, GoblinUserNftAccInfoVo nftAccInfoVo) { public void setOpenAccountInfo(String userId, GoblinUserNftAccInfoVo nftAccInfoVo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO.concat(userId); String redisKey = GoblinRedisConst.REDIS_GOBLIN_NFT_NUM_ACCOUNT_INFO.concat(userId);
redisUtil.set(redisKey, nftAccInfoVo); redisUtil.set(redisKey, nftAccInfoVo);
......
...@@ -84,3 +84,4 @@ ...@@ -84,3 +84,4 @@
150005=SKU\u4E0D\u5B58\u5728 150005=SKU\u4E0D\u5B58\u5728
150006=\u9884\u7EA6\u672A\u5F00\u59CB\u6216\u5DF2\u7ED3\u675F 150006=\u9884\u7EA6\u672A\u5F00\u59CB\u6216\u5DF2\u7ED3\u675F
150007=\u8BE5\u5546\u54C1\u9884\u7EA6\u5C1A\u672A\u5F00\u59CB\u6216\u5DF2\u7ECF\u7ED3\u675F\uFF0C\u4E0D\u53EF\u9884\u7EA6 150007=\u8BE5\u5546\u54C1\u9884\u7EA6\u5C1A\u672A\u5F00\u59CB\u6216\u5DF2\u7ECF\u7ED3\u675F\uFF0C\u4E0D\u53EF\u9884\u7EA6
150008=\u52A9\u7406\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5
...@@ -74,11 +74,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -74,11 +74,6 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("您还未开通数字账户~"); return ResponseDto.failure("您还未开通数字账户~");
} }
// 若开启了预约 判断用户是否预约
boolean userAboutAut = nftOrderUtils.getUserAboutAut(payParam.getSkuId(), uid);
if (!userAboutAut) {
return ResponseDto.failure("此数字藏品仅限预约用户购买~");
}
// 基础参数 // 基础参数
String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), ""); String mobile = StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE)), "");
...@@ -91,8 +86,16 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -91,8 +86,16 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
String listId = (String) map.get("listId"); String listId = (String) map.get("listId");
Integer whiteType = (Integer) map.get("whiteType"); Integer whiteType = (Integer) map.get("whiteType");
// 若没有分批购 若开启了预约 判断用户是否预约
if (null == listId) {
boolean userAboutAut = nftOrderUtils.getUserAboutAut(payParam.getSkuId(), uid);
if (!userAboutAut) {
return ResponseDto.failure("此数字藏品仅限预约用户购买~");
}
}
// 分批、提前购黑、白名单 // 分批、提前购黑、白名单
if (null != tagType) { if (null != listId) {
Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType); Boolean listCanBuy = goblinRedisUtils.getListCanBuy(listId, skuId, mobile, uid, whiteType);
if (!listCanBuy) { if (!listCanBuy) {
return ResponseDto.failure("该藏品仅对部分用户开放~"); return ResponseDto.failure("该藏品仅对部分用户开放~");
...@@ -157,11 +160,11 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -157,11 +160,11 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
return ResponseDto.failure("该商品SPU不存在~"); return ResponseDto.failure("该商品SPU不存在~");
} else { } else {
HashMap<String, Object> lotteryDrawMap = lotteryDraw(skuIdList, number, nowTime); HashMap<String, Object> lotteryDrawMap = lotteryDraw(skuIdList, number, nowTime);
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) lotteryDrawMap.get("goodsSkuInfoVo"); if (null == lotteryDrawMap) {
if (null == skuInfoVo) {
goblinRedisUtils.decrSkuCountByUid(uid, skuId, number); goblinRedisUtils.decrSkuCountByUid(uid, skuId, number);
return ResponseDto.failure("盲盒库存不足啦~"); return ResponseDto.failure("盲盒库存不足啦~");
} }
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) lotteryDrawMap.get("goodsSkuInfoVo");
boxSkuId = skuInfoVo.getSkuId(); boxSkuId = skuInfoVo.getSkuId();
stockSkuId = boxSkuId; stockSkuId = boxSkuId;
listId = (String) lotteryDrawMap.get("listId"); listId = (String) lotteryDrawMap.get("listId");
...@@ -344,7 +347,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService { ...@@ -344,7 +347,7 @@ public class GoblinNftOrderServiceImpl implements IGoblinNftOrderService {
GoblinNftOrderPayParam payParam, String storeId, String uid, String spuId, int number, GoblinNftOrderPayParam payParam, String storeId, String uid, String spuId, int number,
String orderId, String orderCode, String orderId, String orderCode,
BigDecimal totalPrice, BigDecimal voucherPrice, BigDecimal storeVoucherPrice, String boxSkuId, String skuTitle BigDecimal totalPrice, BigDecimal voucherPrice, BigDecimal storeVoucherPrice, String boxSkuId, String skuTitle
,int orderType , int orderType
) { ) {
try { try {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
......
...@@ -9,6 +9,7 @@ import com.liquidnet.service.base.constant.MQConst; ...@@ -9,6 +9,7 @@ import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.vo.CandyUseResultVo; import com.liquidnet.service.candy.vo.CandyUseResultVo;
import com.liquidnet.service.goblin.constant.GoblinRedisConst; import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst; import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -179,11 +180,13 @@ public class GoblinNftOrderUtils { ...@@ -179,11 +180,13 @@ public class GoblinNftOrderUtils {
// skuId 是否开启预约 // skuId 是否开启预约
public boolean getValueBySkuId(String skuId) { public boolean getValueBySkuId(String skuId) {
String redisKey = GoblinRedisConst.ANTICIPATE_VALUE_SKUID.concat(skuId); String redisKey = GoblinRedisConst.ANTICIPATE_VALUE_SKUID.concat(skuId);
Object obj = redisUtil.get(redisKey); Object obj = redisUtil.get(redisKey);
if (obj == null) { if (obj == null) {
return false; return false;
} else { } else {
return true; GoblinGoodsAnticipateValueVo anticipateValueVo = (GoblinGoodsAnticipateValueVo)obj;
return anticipateValueVo.getType() != 1;
} }
} }
// 是否预约过 没开启true // 是否预约过 没开启true
......
...@@ -180,7 +180,6 @@ public class GoblinRedisUtils { ...@@ -180,7 +180,6 @@ public class GoblinRedisUtils {
GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId); GoblinGoodsSkuInfoVo vo = getGoodsSkuInfoVo(skuId);
HashMap<String, Object> map = CollectionUtil.mapStringObject(); HashMap<String, Object> map = CollectionUtil.mapStringObject();
if (now.isAfter(vo.getSaleStartTime())) {//普通商品已开售 if (now.isAfter(vo.getSaleStartTime())) {//普通商品已开售
lastStockToLastStock(0, getGoblinListCollect(skuId), null, skuId);
map.put("vo", vo); map.put("vo", vo);
map.put("tagType", null); map.put("tagType", null);
map.put("listId", null); map.put("listId", null);
...@@ -203,6 +202,9 @@ public class GoblinRedisUtils { ...@@ -203,6 +202,9 @@ public class GoblinRedisUtils {
GoblinListCollectVo collectNext = getCollectByNowNext(now, skuId); GoblinListCollectVo collectNext = getCollectByNowNext(now, skuId);
if (collectNext != null) { if (collectNext != null) {
tagType = collectNext.getTagType(); tagType = collectNext.getTagType();
//todo 逻辑修改 开售时间
vo.setSaleStartTime(collectNext.getTimeStart());
vo.setSaleStopTime(collectNext.getTimeEnd());
} }
map.put("vo", vo); map.put("vo", vo);
map.put("tagType", tagType); map.put("tagType", tagType);
...@@ -239,7 +241,6 @@ public class GoblinRedisUtils { ...@@ -239,7 +241,6 @@ public class GoblinRedisUtils {
if (collectVo == null) { if (collectVo == null) {
collectVo = collectTemp; collectVo = collectTemp;
} }
lastStockToLastStock(1, collectVos, collectVo, skuId);
return collectVo; return collectVo;
} }
...@@ -279,75 +280,6 @@ public class GoblinRedisUtils { ...@@ -279,75 +280,6 @@ public class GoblinRedisUtils {
return collectVo; return collectVo;
} }
/**
* 处理上个时间段的库存
*
* @param type 类型[0-开售|1-未开售]
* @param collectVos
* @param vo
* @param skuId
*/
public void lastStockToLastStock(Integer type, List<GoblinListCollectVo> collectVos, GoblinListCollectVo vo, String skuId) {
if (vo == null && type == 0) {//已开售逻辑
for (GoblinListCollectVo collectVoItem : collectVos) {
int lastStock = getSkuStock(collectVoItem.getListId(), skuId);
int restStock = decrSkuStock(collectVoItem.getListId(), skuId, lastStock);
if (restStock < 0) {
incrSkuStock(collectVoItem.getListId(), skuId, lastStock);
} else {
incrSkuStock(null, skuId, lastStock);
}
}
} else if (vo != null && type == 1) {
LocalDateTime st = vo.getTimeStart();
// GoblinListCollectVo collectVo = null;
// GoblinListCollectVo collectTemp = null;
//获取上个分配购的vo
List<GoblinListCollectVo> collectVosList = ObjectUtil.getGoblinListCollectVo();
for (GoblinListCollectVo collectVoItem : collectVos) {
if (st.isAfter(collectVoItem.getTimeStart()) && collectVoItem.getTimeEnd() == null) {
// collectTemp = collectVoItem;
collectVosList.add(collectVoItem);
} else if (collectVoItem.getTimeEnd() != null && st.isAfter(collectVoItem.getTimeEnd())) {
// collectVo = collectVoItem;
collectVosList.add(collectVoItem);
}else if (st.isAfter(collectVoItem.getTimeStart()) && st.isBefore(collectVoItem.getTimeEnd())) {
// collectVo = collectVoItem;
collectVosList.add(collectVoItem);
break;
}
}
// if (collectVo == null) {
// collectVo = collectTemp;
// }
// if (collectVo != null) {
// //减少上个时间段sku库存
// int lastStock = getSkuStock(collectVo.getListId(), skuId);
// int restStock = decrSkuStock(collectVo.getListId(), skuId, lastStock);
// if (restStock < 0) {
// //库存超过销售量 操作失败回滚库存
// incrSkuStock(collectVo.getListId(), skuId, lastStock);
// } else {
// //上个时间段的库存增加到当前时间段
// incrSkuStock(vo.getListId(), skuId, lastStock);
// }
// }
for (GoblinListCollectVo itemVo : collectVosList){
//减少上个时间段sku库存
int lastStock = getSkuStock(itemVo.getListId(), skuId);
int restStock = decrSkuStock(itemVo.getListId(), skuId, lastStock);
if (restStock < 0) {
//库存超过销售量 操作失败回滚库存
incrSkuStock(itemVo.getListId(), skuId, lastStock);
} else {
//上个时间段的库存增加到当前时间段
incrSkuStock(vo.getListId(), skuId, lastStock);
}
}
}
}
/** /**
* 分段购获取 * 分段购获取
* *
...@@ -384,7 +316,9 @@ public class GoblinRedisUtils { ...@@ -384,7 +316,9 @@ public class GoblinRedisUtils {
if (bResult) { if (bResult) {
return false; return false;
} }
if (whiteType == 0) {//会员 if (whiteType == -1) {
return true;
}else if (whiteType == 0) {//会员
return memberStage != null; return memberStage != null;
} else {//白名单 } else {//白名单
return wResult; return wResult;
......
package com.liquidnet.service.platform.service.impl.goblin; package com.liquidnet.service.platform.service.impl.goblin;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.StringUtil; import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo; import com.liquidnet.service.goblin.entity.GoblinGoodsSku;
import com.liquidnet.service.goblin.dto.vo.GoblinNftExCodeVo; import com.liquidnet.service.goblin.entity.GoblinNftExCodeTask;
import com.liquidnet.service.goblin.dto.vo.GoblinNftExSkuVo; import com.liquidnet.service.goblin.entity.GoblinNftExCodeTaskRelation;
import com.liquidnet.service.goblin.entity.*; import com.liquidnet.service.goblin.mapper.GoblinGoodsSkuMapper;
import com.liquidnet.service.goblin.mapper.*; import com.liquidnet.service.goblin.mapper.GoblinNftExCodeTaskMapper;
import com.liquidnet.service.goblin.mapper.GoblinNftExCodeTaskRelationMapper;
import com.liquidnet.service.goblin.param.GoblinNftExSkuParam; import com.liquidnet.service.goblin.param.GoblinNftExSkuParam;
import com.liquidnet.service.goblin.service.IGoblinNftExSkuService; import com.liquidnet.service.goblin.service.IGoblinNftExSkuService;
import com.liquidnet.service.platform.utils.GoblinRedisUtils; import com.liquidnet.service.platform.utils.GoblinRedisUtils;
import com.liquidnet.service.platform.utils.ObjectUtil; import com.liquidnet.service.platform.utils.ObjectUtil;
import com.microsoft.schemas.office.visio.x2012.main.ShapeSheetType;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.util.ArrayList;
import java.util.*; import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Author: wll * @Author: wll
...@@ -124,7 +121,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -124,7 +121,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
} }
//是否购买 //是否购买
if (!goblinGoodsSku.getSkuCanbuy().equals("1")){ if (!goblinGoodsSku.getSkuCanbuy().equals("1")) {
continue; continue;
} }
// 不能购买的 没库存的 概率是0的 过滤 // 不能购买的 没库存的 概率是0的 过滤
...@@ -135,7 +132,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -135,7 +132,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
} }
} }
if (checkNumberSku <= 0){ if (checkNumberSku <= 0) {
return ResponseDto.failure("盲盒下没有可生成兑换码的sku!"); return ResponseDto.failure("盲盒下没有可生成兑换码的sku!");
} }
...@@ -149,7 +146,6 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -149,7 +146,6 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
List<GoblinNftExCodeTask> goblinNftExCodeTasks = ObjectUtil.getGoblinNftExCodeTaskArrayList(); List<GoblinNftExCodeTask> goblinNftExCodeTasks = ObjectUtil.getGoblinNftExCodeTaskArrayList();
// 构建对象 // 构建对象
for (GoblinNftExSkuParam goblinNftExSkuParam : goblinNftExSkuParams) { for (GoblinNftExSkuParam goblinNftExSkuParam : goblinNftExSkuParams) {
...@@ -182,6 +178,10 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -182,6 +178,10 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Integer sNumber = 0; Integer sNumber = 0;
for (String key : skuMap.keySet()) { for (String key : skuMap.keySet()) {
Integer stockNum = skuMap.get(key); Integer stockNum = skuMap.get(key);
log.debug("skuId:" + key + "库存:" + stockNum);
if (stockNum <= 0) {
continue;
}
// 根据sku减库存 // 根据sku减库存
int stock = goblinRedisUtils.decrSkuStock(null, key, stockNum); int stock = goblinRedisUtils.decrSkuStock(null, key, stockNum);
if (stock < 0) { if (stock < 0) {
...@@ -284,28 +284,44 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -284,28 +284,44 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Map<String, Map<String, Object>> mapMap = new HashMap<>(); Map<String, Map<String, Object>> mapMap = new HashMap<>();
Map<String, Object> objectMap = new HashMap<>(); Map<String, Object> objectMap = new HashMap<>();
objectMap.put("hitRatio", 20); objectMap.put("hitRatio", 30);
objectMap.put("stock", 1000); objectMap.put("stock", 900);
mapMap.put("1", objectMap); mapMap.put("1", objectMap);
Map<String, Object> objectMap1 = new HashMap<>(); Map<String, Object> objectMap1 = new HashMap<>();
objectMap1.put("hitRatio", 30); objectMap1.put("hitRatio", 0.3);
objectMap1.put("stock", 4); objectMap1.put("stock", 9);
// mapMap.put("2", objectMap1); mapMap.put("2", objectMap1);
Map<String, Object> objectMap2 = new HashMap<>(); Map<String, Object> objectMap2 = new HashMap<>();
objectMap2.put("hitRatio", 30); objectMap2.put("hitRatio", 23.3);
objectMap2.put("stock", 1000); objectMap2.put("stock", 697);
// mapMap.put("3", objectMap2); mapMap.put("3", objectMap2);
Map<String, Object> objectMap3 = new HashMap<>(); Map<String, Object> objectMap3 = new HashMap<>();
objectMap3.put("hitRatio", 10); objectMap3.put("hitRatio", 2.2);
objectMap3.put("stock", 1000); objectMap3.put("stock", 66);
// mapMap.put("4", objectMap3); mapMap.put("4", objectMap3);
Map<String, Object> objectMap4 = new HashMap<>();
objectMap4.put("hitRatio", 26.7);
objectMap4.put("stock", 797);
mapMap.put("5", objectMap4);
Map<String, Object> objectMap5 = new HashMap<>();
objectMap5.put("hitRatio", 2.2);
objectMap5.put("stock", 66);
mapMap.put("6", objectMap5);
Map<String, Object> objectMap6 = new HashMap<>();
objectMap6.put("hitRatio", 15.3);
objectMap6.put("stock", 458);
mapMap.put("7", objectMap6);
Map<String, Integer> stockMap = new HashMap<>(); Map<String, Integer> stockMap = new HashMap<>();
ArrayList<String> eliminateSkuIdList = CollectionUtil.arrayListString(); ArrayList<String> eliminateSkuIdList = CollectionUtil.arrayListString();
getStock(7, new BigDecimal(20), mapMap, stockMap, 1032, eliminateSkuIdList); getStock(594, new BigDecimal(100), mapMap, stockMap, 2993, eliminateSkuIdList);
for (String key : stockMap.keySet()) { for (String key : stockMap.keySet()) {
System.out.println("skuId" + key + "***********数量" + stockMap.get(key)); System.out.println("skuId" + key + "***********数量" + stockMap.get(key));
} }
...@@ -369,8 +385,9 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService { ...@@ -369,8 +385,9 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
for (int k = 0; k < usNumber; k++) { for (int k = 0; k < usNumber; k++) {
String subKey = ""; String subKey = "";
double maxValue = Double.MAX_VALUE; double maxValue = Double.MAX_VALUE;
for (String key : bigDecimalHashMap.keySet()) { for (String key : bigDecimalHashMap.keySet()) {
if (skuIdList.contains(key)) { if (skuIdList.contains(key) || stockMap.get(key) == 0) {
continue; continue;
} }
Double compare = Double.valueOf(bigDecimalHashMap.get(key).toString()); Double compare = Double.valueOf(bigDecimalHashMap.get(key).toString());
......
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