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

Commit 41cf4fdd authored by 胡佳晨's avatar 胡佳晨

修改 分批购 获取当前时间段 和 下一个时间段的bug

parent 50dd4151
...@@ -809,6 +809,7 @@ public class GoblinRedisUtils { ...@@ -809,6 +809,7 @@ public class GoblinRedisUtils {
* @return * @return
*/ */
public HashMap<String, Object> getGoodsSkuInfoVo(LocalDateTime now, String skuId) { public HashMap<String, Object> getGoodsSkuInfoVo(LocalDateTime now, String skuId) {
now = LocalDateTime.of(2022,5,18,16,17,0);
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())) {//普通商品已开售
...@@ -931,6 +932,7 @@ public class GoblinRedisUtils { ...@@ -931,6 +932,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("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);
...@@ -939,7 +941,7 @@ public class GoblinRedisUtils { ...@@ -939,7 +941,7 @@ public class GoblinRedisUtils {
} }
} }
} else if (vo != null && type == 1) { } else if (vo != null && type == 1) {
LocalDateTime st = vo.getTimeStart().minusSeconds(1); LocalDateTime st = vo.getTimeStart();
// GoblinListCollectVo collectVo = null; // GoblinListCollectVo collectVo = null;
// GoblinListCollectVo collectTemp = null; // GoblinListCollectVo collectTemp = null;
//获取上个分配购的vo //获取上个分配购的vo
...@@ -975,6 +977,7 @@ public class GoblinRedisUtils { ...@@ -975,6 +977,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("stock = "+lastStock);
int restStock = decrSkuStock(itemVo.getListId(), skuId, lastStock); int restStock = decrSkuStock(itemVo.getListId(), skuId, lastStock);
if (restStock < 0) { if (restStock < 0) {
//库存超过销售量 操作失败回滚库存 //库存超过销售量 操作失败回滚库存
......
...@@ -298,7 +298,7 @@ public class GoblinRedisUtils { ...@@ -298,7 +298,7 @@ public class GoblinRedisUtils {
} }
} }
} else if (vo != null && type == 1) { } else if (vo != null && type == 1) {
LocalDateTime st = vo.getTimeStart().minusSeconds(1); LocalDateTime st = vo.getTimeStart();
// GoblinListCollectVo collectVo = null; // GoblinListCollectVo collectVo = null;
// GoblinListCollectVo collectTemp = null; // GoblinListCollectVo collectTemp = null;
//获取上个分配购的vo //获取上个分配购的vo
......
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