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

Commit 59eb7fa6 authored by 胡佳晨's avatar 胡佳晨

配置 文件 构建 订单同步量

同步订单脚本
parent 2d366b3c
......@@ -23,6 +23,7 @@ public class CollectionUtil {
private static final HashSet<String> STRING_ARRAY_SET = new HashSet<>();
private static final ArrayList<Integer> INTEGER_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<Object> OBJECT_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<ArrayList<String>> LIST_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<BigDecimal> BIG_DECIMALS_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<BigDecimal> BIGDECIMAL_ARRAY_LIST = new ArrayList<>();
private static final String[] STRING_ARRAY = new String[]{};
......@@ -32,6 +33,10 @@ public class CollectionUtil {
return STRING_ARRAY.clone();
}
public static ArrayList<List<String>> arrayListListString() {
return (ArrayList<List<String>>) LIST_ARRAY_LIST.clone();
}
public static List<HashMap<String,Object>> listMapStringObject() {
return (List<HashMap<String,Object>>) HASH_MAP_ARRAY_LIST.clone();
}
......
......@@ -804,6 +804,15 @@ public abstract class AbstractRedisUtil {
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().size(key);
}
/**
* list 长度
* @param key
*/
public List<Object> getRange(String key) {
key = this.fillingKey(key);
return this.getRedisConfig().getRedisTemplateByDb(this.getIndex(key)).opsForList().range(key,0,-1);
}
public static void main(String[] args) {
String[] keys = {
......
......@@ -16,18 +16,18 @@ liquidnet:
urlHostAndPort: java-test.mysql.polardb.rds.aliyuncs.com:3306
username: zhengzai
password: Zhengzai@rd2U#
# rabbitmq:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# adam:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# rabbitmq:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
# adam:
# host: rabbitmq.zhengzai.tv
# port: 5672
# username: admin
# password: admin
# virtual-host: liquidnet
knife4j:
disable: false
redis:
......@@ -108,7 +108,7 @@ liquidnet:
url: http://devorder.zhengzai.tv
url-pay:
pay: http://devdragon.zhengzai.tv/dragon/pay/dragonPay
# applePay: http://devorder.zhengzai.tv/order/notify/apple/purchase
# applePay: http://devorder.zhengzai.tv/order/notify/apple/purchase
check: http://devdragon.zhengzai.tv/dragon/pay/checkOrder
localUrl: http://devorder.zhengzai.tv/order/order/syncOrder
goblinUrl: http://devorder.zhengzai.tv/goblin/order/pay/syncOrder
......@@ -160,7 +160,7 @@ liquidnet:
addresses: 39.107.71.112:8090
client:
admin:
# phpPayUrl: http://devorder.zhengzai.tv
# phpPayUrl: http://devorder.zhengzai.tv
phpMallUrl: https://devmall.zhengzai.tv
platformUrl: https://devplatform.zhengzai.tv
h5Url: https://devm.zhengzai.tv
......@@ -257,6 +257,8 @@ liquidnet:
shop_no: mdtk2-test
warehouse_no: mdtk2-test
platform_id: 127
contentSize: 5
redisSize: 255
#application-dev-end
\ No newline at end of file
......@@ -257,5 +257,7 @@ liquidnet:
shop_no: mdtk2-test
warehouse_no: mdtk2-test
platform_id: 127
contentSize: 5
redisSize: 255
#application-test-end
\ No newline at end of file
......@@ -39,6 +39,10 @@ public class GoblinOrderUtils {
private String candyUrl;
@Value("${liquidnet.service.order.url-pay.goblinRefundUrl}")
private String synUrl;
@Value("${liquidnet.erp.wdt.contentSize}")
private int contentSize;
@Value("${liquidnet.erp.wdt.redisSize}")
private int redisSize;
@Autowired
private IDragonOrderRefundsService dragonOrderRefundsService;
......@@ -554,16 +558,12 @@ public class GoblinOrderUtils {
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;
}
......
......@@ -742,15 +742,9 @@ public class GoblinRedisUtils {
return (int) redisUtil.rightPush(rdk,orderId);
}
//添加erp订单
//移除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);
}
}
......@@ -30,6 +30,7 @@ import com.liquidnet.service.platform.utils.QueueUtils;
import com.mongodb.BasicDBObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria;
......@@ -64,6 +65,12 @@ public class WdtServiceImpl implements IGoblinErpService {
MongoConverter mongoConverter;
@Autowired
QueueUtils queueUtils;
@Value("${liquidnet.erp.wdt.contentSize}")
private int contentSize;
@Value("${liquidnet.erp.wdt.redisSize}")
private int redisSize;
@Value("${liquidnet.erp.wdt.store.shop_no}")
private String shopNo;
@Override
public ResponseDto<Boolean> initErpStock(String spuId, int min) {
......@@ -166,9 +173,24 @@ public class WdtServiceImpl implements IGoblinErpService {
@Override
public ResponseDto<Boolean> pushTrade(String orderId) {
public ResponseDto<Boolean> pushTrade(String singleId) {
List<TradeListParam> listOrder = ErpObjectUtil.tradeListParam();
List<List<String>> orderIdList = CollectionUtil.arrayListListString();
// 获取 订单id 数据
if ("".equals(singleId) || null == singleId) {
for (int i = 0; i < redisSize; i++) {
List<String> list = goblinRedisUtils.getRange(i);
orderIdList.add(list);
}
} else {
List<String> a = CollectionUtil.arrayListString();
a.add(singleId);
orderIdList.add(a);
}
//同步订单
for (List<String> b : orderIdList) {
for (String orderId : b) {
TradeListParam tradeListParam = TradeListParam.getNew();
GoblinStoreOrderVo orderVo = goblinRedisUtils.getGoblinOrder(orderId);
List<String> orderSkuIds = orderVo.getOrderSkuVoIds();
......@@ -231,14 +253,14 @@ public class WdtServiceImpl implements IGoblinErpService {
if (erpHosting == 1) {
listOrder.add(tradeListParam);
}
}
//执行同步订单
Map<String, String> param = CollectionUtil.linkMapStringString();
param.put("shop_no", "mdtk2-test");
param.put("shop_no", shopNo);
param.put("trade_list", JSON.toJSONString(listOrder));
String json = erpWdtClient.execute(ErpEnum.WdtAPI.TRADE_PUSH.getUri(), param);
TradePushVo data = JsonUtils.fromJson(json, TradePushVo.class);
}
return ResponseDto.success();
}
}
package com.liquidnet.service.platform.utils;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.liquidnet.common.cache.redis.util.AbstractRedisUtil;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
......@@ -391,6 +389,18 @@ public class GoblinRedisUtils {
}
}
//移除erp订单
public List<String> getRange(int index) {
String rdk = GoblinRedisConst.ERP_GOBLIN_GOODS_LIST.concat(index + "");
List<Object> list = getRedis().getRange(rdk);
List<String> data = CollectionUtil.arrayListString();
for (Object str :list){
data.add((String) str);
}
return data;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
......
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