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

Commit 2d366b3c authored by 胡佳晨's avatar 胡佳晨

erp 添加订单

parent cc290cf3
...@@ -392,6 +392,9 @@ public class GoblinRedisConst { ...@@ -392,6 +392,9 @@ public class GoblinRedisConst {
public static final String NFT_TRANSFER_CONF_AGAIN = PREFIX.concat("nft_trans_conf_again"); public static final String NFT_TRANSFER_CONF_AGAIN = PREFIX.concat("nft_trans_conf_again");
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
public static final String ERP_GOBLIN_GOODS_LIST = PREFIX.concat("erp:push:order:");
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
......
...@@ -768,10 +768,48 @@ public abstract class AbstractRedisUtil { ...@@ -768,10 +768,48 @@ public abstract class AbstractRedisUtil {
this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).delete(key); this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).delete(key);
} }
/**
* list 末尾添加
* @param key
*/
public long rightPush(String key,Object value) {
key = this.fillingKey(key);
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().rightPush(key,value);
}
/**
* list 头部获取
* @param key
*/
public Object rightPop(String key) {
key = this.fillingKey(key);
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().rightPop(key);
}
/**
* list 头部获取
* @param key
*/
public Object leftPop(String key) {
key = this.fillingKey(key);
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().leftPop(key);
}
/**
* list 长度
* @param key
*/
public long listSize(String key) {
key = this.fillingKey(key);
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().size(key);
}
public static void main(String[] args) { public static void main(String[] args) {
String[] keys = { String[] keys = {
"kylin:order:id:302739831268147207565446" "test:goblin:erp:push:order:0",
"test:goblin:erp:push:order:1",
"test:goblin:erp:push:order:2",
}; };
for (String key : keys) { for (String key : keys) {
long value = key.hashCode(); long value = key.hashCode();
......
...@@ -817,6 +817,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -817,6 +817,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log.error("订单号为 {} 的订单正在退款 或者已退款", syncOrderParam.getOrderCode()); log.error("订单号为 {} 的订单正在退款 或者已退款", syncOrderParam.getOrderCode());
} else if (syncOrderParam.getStatus().equals(1) && orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_0.getValue()) { } else if (syncOrderParam.getStatus().equals(1) && orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_0.getValue()) {
log.error("订单号为 {} 的订单正常流程", syncOrderParam.getOrderCode()); log.error("订单号为 {} 的订单正常流程", syncOrderParam.getOrderCode());
orderUtils.addErpPush(orderVo.getOrderId(),orderVo.getErpHosting());
storeOrder.setPaymentType(syncOrderParam.getPaymentType()); storeOrder.setPaymentType(syncOrderParam.getPaymentType());
storeOrder.setPaymentId(syncOrderParam.getPaymentId()); storeOrder.setPaymentId(syncOrderParam.getPaymentId());
storeOrder.setPayCode(syncOrderParam.getCode()); storeOrder.setPayCode(syncOrderParam.getCode());
......
...@@ -551,4 +551,23 @@ public class GoblinOrderUtils { ...@@ -551,4 +551,23 @@ public class GoblinOrderUtils {
public boolean noZhengzaiOrder(String uid) { public boolean noZhengzaiOrder(String uid) {
return !uid.equals("zhengzai"); return !uid.equals("zhengzai");
} }
public void addErpPush(String orderId, int erpHosting) {
int contentSize = 5;
int redisSize = 255;
if (erpHosting == 0) {
} else {
for (int i = 0; i < redisSize; i++) {
// log.error("i:{},add:{}",i,orderId);
boolean isFull = redisUtils.erpAddPush(i, orderId) > contentSize;
if (isFull) {
redisUtils.erpPopPush(i);
// log.error("i:{},remove:{}",i,redisUtils.erpPopPush(i));
} else {
break;
}
}
}
}
} }
...@@ -734,4 +734,23 @@ public class GoblinRedisUtils { ...@@ -734,4 +734,23 @@ public class GoblinRedisUtils {
return BigDecimal.valueOf((int) obj); return BigDecimal.valueOf((int) obj);
} }
} }
//添加erp订单
public int erpAddPush(int index,String orderId) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
return (int) redisUtil.rightPush(rdk,orderId);
}
//添加erp订单
public String erpPopPush(int index) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
return (String) redisUtil.rightPop(rdk);
}
//获取erp订单长度
public int erpPushSize(int index) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index+"");
return (int) redisUtil.listSize(rdk);
}
} }
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