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

Commit 7c1c6494 authored by 胡佳晨's avatar 胡佳晨

修改 优先购/分批购 库存回滚逻辑

从 上个时间段内返回时间段内 改为 如果当前时间段不存在 则返回 下个时间段内
parent b634b1be
...@@ -27,4 +27,10 @@ public class GoblinNftJobController { ...@@ -27,4 +27,10 @@ public class GoblinNftJobController {
return goblinNftJobService.goodsList(); return goblinNftJobService.goodsList();
} }
@GetMapping("goblinNftListStock")
@ApiOperation("处理[未开售/开售]五分钟内的nft[优先购/分批购]库存job ")
public ResponseDto<Boolean> goblinNftListStock() {
return goblinNftJobService.goblinNftListStock();
}
} }
...@@ -36,8 +36,6 @@ public class GoblinNftJobServiceImpl { ...@@ -36,8 +36,6 @@ public class GoblinNftJobServiceImpl {
@Autowired @Autowired
GoblinMongoUtils mongoUtils; GoblinMongoUtils mongoUtils;
@Autowired @Autowired
RedisUtil redisUtil;
@Autowired
private GoblinOrderUtils goblinOrderUtils; private GoblinOrderUtils goblinOrderUtils;
@Autowired @Autowired
GoblinCouponService goblinCouponService; GoblinCouponService goblinCouponService;
...@@ -141,4 +139,33 @@ public class GoblinNftJobServiceImpl { ...@@ -141,4 +139,33 @@ public class GoblinNftJobServiceImpl {
return ResponseDto.success(); return ResponseDto.success();
} }
/**
* 处理[未开售/开售]五分钟内的nft[优先购/分批购]库存job
*
* @return
*/
public ResponseDto<Boolean> goblinNftListStock() {
LocalDateTime now = LocalDateTime.now();
try {
// mongo初始条件
Query query1 = Query.query(
Criteria.where("skuType").is(1).and("delFlg").is("0")
.and("status").is("3").and("shelvesStatus").is("3")
.and("skuAppear").is("0")
.orOperator(Criteria.where("unbox").is("0").and("upchain").is(1), Criteria.where("unbox").is("1"))
);
query1.addCriteria(Criteria.where("saleStartTime").gt(now.minusMinutes(10)));
// 查询 未开售 和 开售五分钟内的skuId
List<GoblinNftGoodsSkuListJobVo> notStartSkuInfoVos = mongoTemplate.find(query1, GoblinNftGoodsSkuListJobVo.class, GoblinGoodsSkuInfoVo.class.getSimpleName());
for (GoblinNftGoodsSkuListJobVo item : notStartSkuInfoVos) {
goblinRedisUtils.getCollectByNow(now, item.getSkuId());
}
} catch (Exception e) {
e.printStackTrace();
return ResponseDto.failure();
}
return ResponseDto.success();
}
} }
...@@ -868,7 +868,16 @@ public class GoblinRedisUtils { ...@@ -868,7 +868,16 @@ public class GoblinRedisUtils {
if (collectVo == null) { if (collectVo == null) {
collectVo = collectTemp; collectVo = collectTemp;
} }
lastStockToLastStock(1, collectVos, collectVo, skuId); 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;
} }
......
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