Browse Source

清洗数据增加重试

yumeng 5 tháng trước cách đây
mục cha
commit
cfe8ed9a17

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KwaiJSTController.java

@@ -32,7 +32,7 @@ public class KwaiJSTController {
 
     @PostMapping(value = "/test")
     public void test(@RequestBody JSONObject requestJson) {
-        kwaiJSTService.costDetail("BH-JSTZ-TGCF-7Z", 2, null);
+        kwaiJSTService.costDetail("BH-JSTZ-TGCF-7Z", 2, null,0);
     }
 
     @PostMapping(value = "/costDetail")
@@ -61,7 +61,7 @@ public class KwaiJSTController {
                 @Override
                 public void run() {
                     try {
-                        kwaiJSTService.costDetail(skuId, dataType, date);
+                        kwaiJSTService.costDetail(skuId, dataType, date,0);
                     } catch (Exception e) {
                         e.printStackTrace();
                     }

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKwaiJSTService.java

@@ -11,7 +11,7 @@ public interface IKwaiJSTService {
 
     void queryAndInsertPurchase(String dates);
 
-    JSONObject costDetail(String skuNick, Integer dataType,Long date);
+    JSONObject costDetail(String skuNick, Integer dataType,Long date,Integer count);
 
     List<JSONObject> getSkuDataList(Long date);
 

+ 5 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KwaiJSTServiceImpl.java

@@ -237,7 +237,7 @@ public class KwaiJSTServiceImpl implements IKwaiJSTService {
 
 
     @Override
-    public JSONObject costDetail(String skuNick, Integer dataType, Long date) {
+    public JSONObject costDetail(String skuNick, Integer dataType, Long date, Integer count) {
         JSONObject returnJSon = new JSONObject();
 
         try {
@@ -344,7 +344,10 @@ public class KwaiJSTServiceImpl implements IKwaiJSTService {
             log.info("{},suk数据处理完成", skuNick);
         } catch (Exception e) {
             e.printStackTrace();
-            this.send("快手小店成本数据清洗失败,请处理,序号:1");
+            this.send("快手小店成本数据清洗失败,请处理,序号:1,失败次数:" + count + "sukId:" + skuNick + "  ," + e.getMessage());
+            if (count <= 3) {
+                costDetail(skuNick,dataType, date,count + 1);
+            }
         }
 
         return returnJSon;