Browse Source

qxm-接口同步拉取仓管数据,分页问题,已修复

qxm 3 years ago
parent
commit
18ae1a54e0

+ 16 - 3
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/AnalysisDiyCustomerComponent.java

@@ -130,7 +130,13 @@ public class AnalysisDiyCustomerComponent {
         JSONObject fjson = JSONObject.parseObject(financeJson);
         Integer fcount = fjson.getInteger("count");
         if(fcount>100){
-            for (int i = 1; i < Math.floor(fcount/100); i++) {
+            int co = 0;
+            if (fcount%100 != 0){
+                co = (fcount/100) +2;
+            }else{
+                co = (fcount/100) +1;
+            }
+            for (int i = 1; i < co; i++) {
                 try {
                     fjson = JSONObject.parseObject(HttpUtils.sendSSLGet(customerAccessTokenUtil.getUrl(UrlType.FINANCE,i+"")));
                 } catch (Exception e) {
@@ -163,9 +169,16 @@ public class AnalysisDiyCustomerComponent {
         }
 
         JSONObject wjson = JSONObject.parseObject(warehouseJson);
-        Integer wcount = fjson.getInteger("count");
+        Integer wcount = wjson.getInteger("count");
         if(wcount>100){
-            for (int i = 1; i < Math.floor(wcount/100); i++) {
+            int co = 0;
+            if (wcount%100 != 0){
+                co = (wcount/100) +2;
+            }else{
+                co = (wcount/100) +1;
+            }
+
+            for (int i = 1; i < co; i++) {
                 try {
                     wjson = JSONObject.parseObject(HttpUtils.sendSSLGet(customerAccessTokenUtil.getUrl(UrlType.WAREHOUSE,i+"")));
                 } catch (Exception e) {