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

Commit f5cd1eb9 authored by 胡佳晨's avatar 胡佳晨

取消 向待支付redis添加消息

增加 待支付发送队列
parent 51252913
......@@ -545,10 +545,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log.info("复制vo:" + (System.currentTimeMillis() - time2) + "ms");
time2 = System.currentTimeMillis();
//redis 添加未支付列表
int randomKey = redisUtils.addUnPayOrder(orderVo.getOrderId());
//待支付发送队列
queueUtils.sendMsgByRedisGoblinStock(orderVo.getMasterOrderCode(), storeOrder.getCreatedAt());
//redis 赋值
orderVo.setRandomKey(randomKey);
orderVo.setOrderAttrVo(orderAttrVo);
orderVo.setOrderSkuVoIds(goblinOrderSkuIdList);
orderVo.setCreatedAt(getNowTime());
......@@ -802,8 +801,6 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo.setOrderSkuVoIds(skuList);
redisUtils.setGoblinOrder(orderId, orderVo);
redisUtils.setOffCode(orderVo.getWriteOffCode(), orderVo.getMasterOrderCode());
//删除未支付订单
redisUtils.removeGoblinOrder(orderVo.getRandomKey() + "", orderId);
//mongo
mongoUtils.updateGoblinStoreOrderVo(orderId, orderVo);
//mysql
......
......@@ -234,48 +234,6 @@ public class GoblinRedisUtils {
}
}
// 获取 未支付订单id列表
public List<String> getUnPayOrder(String randomKey) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_UN_PAY.concat(randomKey);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return CollectionUtil.arrayListString();
} else {
return (List<String>) obj;
}
}
// 添加 未支付订单id列表 返回 radomKey
public int addUnPayOrder(String orderId) {
int randomKey = RandomUtil.getRandomInt(0, randomMax);
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_UN_PAY.concat(randomKey + "");
List<String> list = getUnPayOrder(randomKey + "");
list.add(orderId);
redisUtil.set(redisKey, list);
return randomKey;
}
// 删除 未支付订单id列表
public void removeGoblinOrder(String randomKey, String orderId) {
if (randomKey == null) {
for (int i = 0; i < randomMax; i++) {
randomKey = i + "";
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_UN_PAY.concat(randomKey);
List<String> list = getUnPayOrder(randomKey);
if (list.contains(orderId)) {
list.remove(orderId);
redisUtil.set(redisKey, list);
break;
}
}
} else {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_UN_PAY.concat(randomKey + "");
List<String> list = getUnPayOrder(randomKey);
list.remove(orderId);
redisUtil.set(redisKey, list);
}
}
// 获取 订单id列表
public List<String> getOrderList(String uid) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_LIST.concat(uid);
......
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