From 6b8ab82d1d7fb9d44d85eeb1dfd2e36d3c28c9cf Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 10 六月 2019 11:30:21 +0800 Subject: [PATCH] 客服消息修改,新版大淘客数据添加 --- fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java | 24 +++++++++++------------- 1 files changed, 11 insertions(+), 13 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java index 0f21e08..6fd7720 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java @@ -34,14 +34,15 @@ @Override public void startSyncGoods() { LogHelper.test("澶ф窐瀹㈠悓姝ュ紑濮�"); - DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll(null); - while (!StringUtil.isNullOrEmpty(result.getPageId())) { + DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll("1"); + int page=0; + while (result.getGoodsList() != null && result.getGoodsList().size() > 0) { + System.out.println(page++); for (DaTaoKeDetailV2 v2 : result.getGoodsList()) daTaoKeGoodsDetailV2Dao.save(v2); result = DaTaoKeApiUtil.listAll(result.getPageId()); - try { - Thread.sleep(200); + Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } @@ -50,14 +51,14 @@ @Override public void updateData() { - DaTaoKeGoodsResult result = DaTaoKeApiUtil.getUpdateGoodsList(null, null, null); - while (!StringUtil.isNullOrEmpty(result.getPageId())) { + DaTaoKeGoodsResult result = DaTaoKeApiUtil.getUpdateGoodsList("1", null, null); + while (result.getGoodsList() != null && result.getGoodsList().size() > 0) { for (DaTaoKeDetailV2 v2 : result.getGoodsList()) { v2.setUpdateTime(new Date()); daTaoKeGoodsDetailV2Dao.updateSelective(v2); } try { - Thread.sleep(200); + Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } @@ -67,19 +68,16 @@ @Override public void deleteInvalid() { - String startTime = null; - DaTaoKeDetailV2 latest = daTaoKeGoodsDetailV2Dao.selectLatest(); - if (latest != null) { - startTime = TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss"); - } + String startTime = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd 00:00:00"); DaTaoKeGoodsResult result = DaTaoKeApiUtil.getInvalidGoodsList(null, startTime, null); - while (!StringUtil.isNullOrEmpty(result.getPageId())) { + while (result.getGoodsList() != null && result.getGoodsList().size() > 0) { for (DaTaoKeDetailV2 v2 : result.getGoodsList()) { v2.setUpdateTime(new Date()); daTaoKeGoodsDetailV2Dao.delete(v2.getId()); } result = DaTaoKeApiUtil.getInvalidGoodsList(result.getPageId(), startTime, null); + System.out.println(result); try { Thread.sleep(200); } catch (InterruptedException e) { -- Gitblit v1.8.0