|
@@ -458,6 +458,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
}
|
|
|
if ("miaogousi".equals(ownershipId)) {
|
|
|
int mgs = supplyChainMapper.updateMgsOrder(oid, cpsOrderStatus);
|
|
@@ -480,6 +484,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
}
|
|
|
if ("rocket".equals(ownershipId)) {
|
|
|
int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
|
|
@@ -502,6 +510,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
}
|
|
|
if ("yufu".equals(ownershipId)) {
|
|
|
int yufu = supplyChainMapper.updateYufuOrder(oid, cpsOrderStatus);
|
|
@@ -516,6 +528,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (mgs > 0) {
|
|
|
return mgs;
|
|
|
}
|
|
|
+ int yufu = supplyChainMapper.updateYufuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yufu > 0) {
|
|
|
+ return yufu;
|
|
|
+ }
|
|
|
int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
|
|
|
if (rocket > 0) {
|
|
|
return rocket;
|
|
@@ -540,6 +556,16 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (mgs > 0) {
|
|
|
return mgs;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("yuxiu".equals(ownershipId)) {
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrder(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
int yufu = supplyChainMapper.updateYufuOrder(oid, cpsOrderStatus);
|
|
|
if (yufu > 0) {
|
|
|
return yufu;
|
|
@@ -549,6 +575,18 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
return rocket;
|
|
|
}
|
|
|
|
|
|
+ int rocket = supplyChainMapper.updateRocketOrder(oid, cpsOrderStatus);
|
|
|
+ if (rocket > 0) {
|
|
|
+ return rocket;
|
|
|
+ }
|
|
|
+ int ruixuan = supplyChainMapper.updateRuixuanOrder(oid, cpsOrderStatus);
|
|
|
+ if (ruixuan > 0) {
|
|
|
+ return ruixuan;
|
|
|
+ }
|
|
|
+ int mgs = supplyChainMapper.updateMgsOrder(oid, cpsOrderStatus);
|
|
|
+ if (mgs > 0) {
|
|
|
+ return mgs;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@@ -573,6 +611,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yufu > 0) {
|
|
|
return yufu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
int yuxiu = supplyChainMapper.updateYuXiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
@@ -596,6 +638,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yufu > 0) {
|
|
|
return yufu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
int yuxiu = supplyChainMapper.updateYuXiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
@@ -618,6 +664,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (yufu > 0) {
|
|
|
return yufu;
|
|
|
}
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
int yuxiu = supplyChainMapper.updateYuXiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
if (yuxiu > 0) {
|
|
|
return yuxiu;
|
|
@@ -625,6 +675,32 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
}
|
|
|
|
|
|
if ("yufu".equals(ownershipId)) {
|
|
|
+ int yufu = supplyChainMapper.updateYufuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yufu > 0) {
|
|
|
+ return yufu;
|
|
|
+ }
|
|
|
+ int rocket = supplyChainMapper.updateRocketOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (rocket > 0) {
|
|
|
+ return rocket;
|
|
|
+ }
|
|
|
+ int ruixuan = supplyChainMapper.updateRuiXuanOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (ruixuan > 0) {
|
|
|
+ return ruixuan;
|
|
|
+ }
|
|
|
+ int mgs = supplyChainMapper.updateMgsOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (mgs > 0) {
|
|
|
+ return mgs;
|
|
|
+ }
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("yuxiu".equals(ownershipId)) {
|
|
|
+ int yuxiu = supplyChainMapper.updateYuxiuOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
+ if (yuxiu > 0) {
|
|
|
+ return yuxiu;
|
|
|
+ }
|
|
|
int rocket = supplyChainMapper.updateRocketOrderRegimentalSettleAmount(oid, cpsOrderStatus);
|
|
|
if (rocket > 0) {
|
|
|
return rocket;
|
|
@@ -701,24 +777,30 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
for (KuaishouAccessToken accessToken : tokens) {
|
|
|
getInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> mgsTokens = accessTokenService.getMgsTokenInfos();
|
|
|
for (KuaishouAccessToken accessToken : mgsTokens) {
|
|
|
getMgsInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
|
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> rocketTokens = accessTokenService.getRocketTokenInfos();
|
|
|
for (KuaishouAccessToken accessToken : rocketTokens) {
|
|
|
getRocketInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
|
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> yufuTokens = accessTokenService.getYufuTokenInfos();
|
|
|
for (KuaishouAccessToken accessToken : yufuTokens) {
|
|
|
getYufuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
|
|
|
|
+ Thread.sleep(30000);
|
|
|
+ List<KuaishouAccessToken> yuxiuTokens = accessTokenService.getYuxiuTokenInfos();
|
|
|
+ for (KuaishouAccessToken accessToken : yuxiuTokens) {
|
|
|
+ getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void getInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Integer counts) throws InterruptedException {
|
|
@@ -726,6 +808,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
List<Long> mgsList = new ArrayList<>();
|
|
|
List<Long> rocketList = new ArrayList<>();
|
|
|
List<Long> yufuList = new ArrayList<>();
|
|
|
+ List<Long> yuxiuList = new ArrayList<>();
|
|
|
String appKey = accessToken.getAppKey();
|
|
|
String signSecret = accessToken.getSignSecret();
|
|
|
if (Check.isNull(signSecret) || Check.isNull(appKey)) {
|
|
@@ -791,6 +874,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if ("yufu".equals(ownership)) {
|
|
|
yufuList.add(info.getLong("oid"));
|
|
|
}
|
|
|
+ if ("yuxiu".equals(ownership)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -817,6 +903,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (!Check.isNull(yufuList)) {
|
|
|
supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
|
|
|
}
|
|
|
+ if (!Check.isNull(yuxiuList)) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
|
|
|
+ }
|
|
|
if (!"nomore".equals(pcursor)) {
|
|
|
getInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
@@ -827,6 +916,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
List<Long> mgsList = new ArrayList<>();
|
|
|
List<Long> rocketList = new ArrayList<>();
|
|
|
List<Long> yufuList = new ArrayList<>();
|
|
|
+ List<Long> yuxiuList = new ArrayList<>();
|
|
|
|
|
|
String appKey = accessToken.getAppKey();
|
|
|
String signSecret = accessToken.getSignSecret();
|
|
@@ -892,6 +982,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if ("yufu".equals(ownership)) {
|
|
|
yufuList.add(info.getLong("oid"));
|
|
|
}
|
|
|
+ if ("yuxiu".equals(ownership)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -912,10 +1005,12 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (!Check.isNull(rocketList)) {
|
|
|
supplyChainMapper.updateRocketKuaishouSupplyChain(rocketList);
|
|
|
}
|
|
|
-
|
|
|
if (!Check.isNull(yufuList)) {
|
|
|
supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
|
|
|
}
|
|
|
+ if (!Check.isNull(yuxiuList)) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
|
|
|
+ }
|
|
|
if (!"nomore".equals(pcursor)) {
|
|
|
getMgsInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
@@ -926,6 +1021,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
List<Long> mgsList = new ArrayList<>();
|
|
|
List<Long> rocketList = new ArrayList<>();
|
|
|
List<Long> yufuList = new ArrayList<>();
|
|
|
+ List<Long> yuxiuList = new ArrayList<>();
|
|
|
|
|
|
String appKey = accessToken.getAppKey();
|
|
|
String signSecret = accessToken.getSignSecret();
|
|
@@ -990,6 +1086,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if ("yufu".equals(ownership)) {
|
|
|
yufuList.add(info.getLong("oid"));
|
|
|
}
|
|
|
+ if ("yuxiu".equals(ownership)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1012,6 +1111,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (!Check.isNull(yufuList)) {
|
|
|
supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
|
|
|
}
|
|
|
+ if (!Check.isNull(yuxiuList)) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
|
|
|
+ }
|
|
|
if (!"nomore".equals(pcursor)) {
|
|
|
getRocketInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
@@ -1023,6 +1125,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
List<Long> mgsList = new ArrayList<>();
|
|
|
List<Long> rocketList = new ArrayList<>();
|
|
|
List<Long> yufuList = new ArrayList<>();
|
|
|
+ List<Long> yuxiuList = new ArrayList<>();
|
|
|
String appKey = accessToken.getAppKey();
|
|
|
String signSecret = accessToken.getSignSecret();
|
|
|
if (Check.isNull(signSecret) || Check.isNull(appKey)) {
|
|
@@ -1086,6 +1189,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if ("yufu".equals(ownership)) {
|
|
|
yufuList.add(info.getLong("oid"));
|
|
|
}
|
|
|
+ if ("yuxiu".equals(ownership)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1093,7 +1199,7 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
log.error("===yufu查询分销团长订单列表(open.distribution.cps.leader.order.cursor.list)失败,信息:{}", obj.getString("error_msg"));
|
|
|
log.error("yufu游标:{},执行次数:{}", pcursor, counts);
|
|
|
if (counts <= 3) {
|
|
|
- getRocketInfo(accessToken, beginTime, endTime, url, pcursor, counts + 1);
|
|
|
+ getYufuInfo(accessToken, beginTime, endTime, url, pcursor, counts + 1);
|
|
|
}
|
|
|
}
|
|
|
if (!Check.isNull(ruixuanList)) {
|
|
@@ -1108,11 +1214,116 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
if (!Check.isNull(yufuList)) {
|
|
|
supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
|
|
|
}
|
|
|
+ if (!Check.isNull(yuxiuList)) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
|
|
|
+ }
|
|
|
if (!"nomore".equals(pcursor)) {
|
|
|
getYufuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void getYuxiuInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Integer counts) throws InterruptedException {
|
|
|
+ List<Long> ruixuanList = new ArrayList<>();
|
|
|
+ List<Long> mgsList = new ArrayList<>();
|
|
|
+ List<Long> rocketList = new ArrayList<>();
|
|
|
+ List<Long> yufuList = new ArrayList<>();
|
|
|
+ List<Long> yuxiuList = new ArrayList<>();
|
|
|
+ String appKey = accessToken.getAppKey();
|
|
|
+ String signSecret = accessToken.getSignSecret();
|
|
|
+ if (Check.isNull(signSecret) || Check.isNull(appKey)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
|
|
|
+ OpenDistributionCpsLeaderOrderCursorListRequest request = new OpenDistributionCpsLeaderOrderCursorListRequest();
|
|
|
+ request.setAccessToken(accessToken.getAccessToken());
|
|
|
+ request.setApiMethodVersion(1L);
|
|
|
+
|
|
|
+ //排序类型 [1:按指定查询类型降序] [2:按指定查询类型升序]
|
|
|
+ request.setSortType(1);
|
|
|
+ //查询类型 [1:按分销订单创建时间查询] [2:按分销订单更新时间查询][4:按订单实际创建时间查询]
|
|
|
+ request.setQueryType(2);
|
|
|
+ //分销订单状态 [0:全部订单] [30:已付款] [50:已收货] [60:已结算] [80:已失效]
|
|
|
+ request.setCpsOrderStatus(0);
|
|
|
+ request.setDistributorId(0l);
|
|
|
+ request.setBeginTime(beginTime);
|
|
|
+ request.setEndTime(endTime);
|
|
|
+ request.setPcursor(pcursor);
|
|
|
+ request.setPageize(100);
|
|
|
+ request.setFundType(1);
|
|
|
+
|
|
|
+ OpenDistributionCpsLeaderOrderCursorListResponse response = null;
|
|
|
+ try {
|
|
|
+ response = client.execute(request);
|
|
|
+ } catch (KsMerchantApiException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ JSONObject obj = JSONObject.parseObject(GsonUtils.toJSON(response));
|
|
|
+ String code = obj.getString("code");
|
|
|
+ if ("1".equals(code)) {
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
+ pcursor = data.getString("pcursor");
|
|
|
+ JSONArray orderView = data.getJSONArray("orderView");
|
|
|
+ for (int i = 0; i < orderView.size(); i++) {
|
|
|
+ JSONObject info = orderView.getJSONObject(i);
|
|
|
+ Integer sendStatus = info.getInteger("sendStatus");
|
|
|
+ if (Check.isNotNull(sendStatus) && sendStatus == 1) {
|
|
|
+ JSONArray cpsOrderProductView = info.getJSONArray("cpsOrderProductView");
|
|
|
+ JSONObject itemJson = cpsOrderProductView.getJSONObject(0);
|
|
|
+ Long itemId = itemJson.getLong("itemId");
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
+ criteria = Criteria.where("_id").is(itemId);
|
|
|
+ Query query = new Query(criteria);
|
|
|
+ ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
|
|
|
+ if (Check.isNull(itemCheck)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ if (!Check.isNull(itemCheck)) {
|
|
|
+ String ownership = itemCheck.getOwnership();
|
|
|
+ if ("ruixuan".equals(ownership)) {
|
|
|
+ ruixuanList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ if ("miaogousi".equals(ownership)) {
|
|
|
+ mgsList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ if ("rocket".equals(ownership)) {
|
|
|
+ rocketList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ if ("yufu".equals(ownership)) {
|
|
|
+ yufuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ if ("yuxiu".equals(ownership)) {
|
|
|
+ yuxiuList.add(info.getLong("oid"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.error("===yuxiu查询分销团长订单列表(open.distribution.cps.leader.order.cursor.list)失败,信息:{}", obj.getString("error_msg"));
|
|
|
+ log.error("yuxiu游标:{},执行次数:{}", pcursor, counts);
|
|
|
+ if (counts <= 3) {
|
|
|
+ getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, counts + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!Check.isNull(yuxiuList)) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaishouSupplyChain(yuxiuList);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(ruixuanList)) {
|
|
|
+ supplyChainMapper.updateKuaishouSupplyChain(ruixuanList);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(mgsList)) {
|
|
|
+ supplyChainMapper.updateMgsKuaishouSupplyChain(mgsList);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(rocketList)) {
|
|
|
+ supplyChainMapper.updateRocketKuaishouSupplyChain(rocketList);
|
|
|
+ }
|
|
|
+ if (!Check.isNull(yufuList)) {
|
|
|
+ supplyChainMapper.updateYufuKuaishouSupplyChain(yufuList);
|
|
|
+ }
|
|
|
+ if (!"nomore".equals(pcursor)) {
|
|
|
+ getYuxiuInfo(accessToken, beginTime, endTime, url, pcursor, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private KuaishouSupplyChain organizeData(JSONObject jsonObject, Map<Long, Long> itemMap) {
|
|
|
KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
|
|
|
supplyChain.setOid(jsonObject.getLong("oid"));
|
|
@@ -1173,21 +1384,27 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
for (KuaishouAccessToken mgsToken : mgsTokens) {
|
|
|
getMgsInfoKuaishouActivityInfo(mgsToken, url);
|
|
|
}
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> rocketTokens = accessTokenService.getRocketTokenInfos();
|
|
|
for (KuaishouAccessToken token : rocketTokens) {
|
|
|
getRocketInfoKuaishouActivityInfo(token, url);
|
|
|
}
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> tokens = accessTokenService.getTokenInfos();
|
|
|
for (KuaishouAccessToken accessToken : tokens) {
|
|
|
getInfoKuaishouActivityInfo(accessToken, url);
|
|
|
}
|
|
|
- Thread.sleep(60000);
|
|
|
+ Thread.sleep(30000);
|
|
|
List<KuaishouAccessToken> yufutokens = accessTokenService.getYufuTokenInfos();
|
|
|
for (KuaishouAccessToken accessToken : yufutokens) {
|
|
|
getYufuInfoKuaishouActivityInfo(accessToken, url);
|
|
|
}
|
|
|
+
|
|
|
+ Thread.sleep(30000);
|
|
|
+ List<KuaishouAccessToken> yuxiutokens = accessTokenService.getYuxiuTokenInfos();
|
|
|
+ for (KuaishouAccessToken accessToken : yuxiutokens) {
|
|
|
+ getYuxiuInfoKuaishouActivityInfo(accessToken, url);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1228,6 +1445,15 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Thread.sleep(30000);
|
|
|
+ List<Long> yuxiuActivityIds = supplyChainMapper.getYuxiuKuaishouActivityInfoList();
|
|
|
+ List<KuaishouAccessToken> yuxiutokens = accessTokenService.getYuxiuTokenInfos();
|
|
|
+ for (KuaishouAccessToken accessToken : yuxiutokens) {
|
|
|
+ for (Long activityId : yuxiuActivityIds) {
|
|
|
+ getKuaishouActivityOpenItemList(accessToken, url, activityId, 1, "yuxiu");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1404,6 +1630,8 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
supplyChainMapper.replaceRocketKuaiShouActivityOpenItemList(list);
|
|
|
} else if ("yufu".equals(dbtype)) {
|
|
|
supplyChainMapper.replaceYufuKuaiShouActivityOpenItemList(list);
|
|
|
+ } else if ("yuxiu".equals(dbtype)) {
|
|
|
+ supplyChainMapper.replaceYuxiuKuaiShouActivityOpenItemList(list);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1468,6 +1696,10 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
for (KuaiShouActivityOpenItemList kuaiShouActivityOpenItemList : list) {
|
|
|
supplyChainMapper.updateYufuKuaiShouActivityOpenItemList(kuaiShouActivityOpenItemList);
|
|
|
}
|
|
|
+ } else if ("yuxiu".equals(dbtype)) {
|
|
|
+ for (KuaiShouActivityOpenItemList kuaiShouActivityOpenItemList : list) {
|
|
|
+ supplyChainMapper.updateYuxiuKuaiShouActivityOpenItemList(kuaiShouActivityOpenItemList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -1618,5 +1850,46 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
|
|
|
supplyChainMapper.replaceYufuKuaishouActivityInfo(list);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void getYuxiuInfoKuaishouActivityInfo(KuaishouAccessToken accessToken, String url) {
|
|
|
+ List<KuaiShouActivityInfo> list = new ArrayList<>();
|
|
|
+ String appKey = accessToken.getAppKey();
|
|
|
+ String signSecret = accessToken.getSignSecret();
|
|
|
+ if (Check.isNull(signSecret) || Check.isNull(appKey)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ AccessTokenKsMerchantClient client = new AccessTokenKsMerchantClient(url, appKey, signSecret);
|
|
|
+ OpenDistributionInvestmentActivityOpenListRequest request = new OpenDistributionInvestmentActivityOpenListRequest();
|
|
|
+
|
|
|
+ request.setAccessToken(accessToken.getAccessToken());
|
|
|
+ request.setApiMethodVersion(1L);
|
|
|
+
|
|
|
+ //每页活动数量
|
|
|
+ request.setLimit(5000);
|
|
|
+ OpenDistributionInvestmentActivityOpenListResponse response = null;
|
|
|
+ try {
|
|
|
+ response = client.execute(request);
|
|
|
+ } catch (KsMerchantApiException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ JSONObject obj = JSONObject.parseObject(GsonUtils.toJSON(response));
|
|
|
+ String code = obj.getString("code");
|
|
|
+ if ("1".equals(code)) {
|
|
|
+ JSONObject data = obj.getJSONObject("data");
|
|
|
+ JSONArray result = data.getJSONArray("result");
|
|
|
+ for (int i = 0; i < result.size(); i++) {
|
|
|
+ JSONObject info = result.getJSONObject(i);
|
|
|
+ KuaiShouActivityInfo activityInfo = organizeKuaishouActivityInfo(info);
|
|
|
+ list.add(activityInfo);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.error("===Yuxiu团长查询招商活动列表(open.distribution.investment.activity.open.list)失败,信息:{}", obj.getString("msg"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Check.isNotNull(list) && list.size() > 0) {
|
|
|
+ supplyChainMapper.replaceYuxiuKuaishouActivityInfo(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|