Browse Source

代码优化

dzk 1 năm trước cách đây
mục cha
commit
6fccad072f

+ 6 - 6
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/WdRedisStoreage.java

@@ -127,13 +127,14 @@ public class WdRedisStoreage {
 
             if (cursor != null) {
                 for (WdInfo wdInfo : cursor) {
-                    //打印进度条
-                    Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', (int) (50 * (cursor.getCurrentIndex() + 1) / total)), cursor.getCurrentIndex() + 1, total);
-
                     RedisUtils.getClient().getGeo(wdInfo.getAddrCode().substring(0, 4)).add(wdInfo.getLng().doubleValue(), wdInfo.getLat().doubleValue(), wdInfo.getWdId());
 
                     //存入已处理网点的时间
                     RedisUtils.setCacheObject(RedisContant.WD_TAG_LASTTIME, DateUtil.formatDateTime(wdInfo.getCollectTime()));
+
+                    //打印进度条
+                    //Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', (int) (50 * (cursor.getCurrentIndex() + 1) / total)), cursor.getCurrentIndex() + 1, total);
+                    Console.print("{}当前进度:{}/{}", '\r', cursor.getCurrentIndex() + 1, total);
                 }
                 if (cursor.isConsumed()) {
                     Console.log("----查询sql匹配中的数据已经消费完毕!");
@@ -187,10 +188,9 @@ public class WdRedisStoreage {
 
             if (cursor != null) {
                 for (WdInfo wdInfo : cursor) {
-                    //打印进度条
-                    Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', (int) (50 * (cursor.getCurrentIndex() + 1) / total)), cursor.getCurrentIndex() + 1, total);
-
                     wdTagAnalyse(wdInfo);
+                    //打印进度条
+                    Console.print("{}当前进度:{}/{}", '\r', cursor.getCurrentIndex() + 1, total);
                 }
                 if (cursor.isConsumed()) {
                     Console.log("----查询sql匹配中的数据已经消费完毕!");

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/AttentionPoolStat.java

@@ -45,7 +45,7 @@ public class AttentionPoolStat {
             statisticsDao.insert(statistics);
 
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * (i + 1) / ins.size()), (i + 1), ins.size());
+            Console.print("{}当前进度:{}/{}", '\r',  (i + 1), ins.size());
         }
     }
 }

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandBusinessStat.java

@@ -27,7 +27,7 @@ public class BrandBusinessStat {
             BrandBusiness business = brandBusinesses.get(i);
             brandBusinessDao.insert(business);
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+            Console.print("{}当前进度:{}/{}", '\r',  i, total);
         }
     }
 }

+ 2 - 2
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandCityStat.java

@@ -44,7 +44,7 @@ public class BrandCityStat {
             List<BrandCity> cities = brandCityDao.searchByBrandIdOrderByCity(brand.getBrandId(), month);
             if (cities.isEmpty()) {
                 //打印进度条
-                Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+                Console.print("{}当前进度:{}/{}", '\r', i, total);
                 continue;
             }
             for (BrandCity city : cities) {
@@ -54,7 +54,7 @@ public class BrandCityStat {
             }
             brandCityDao.insertAll(cities);
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+            Console.print("{}当前进度:{}/{}", '\r', i, total);
         }
     }
 }

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandCityTierStat.java

@@ -122,7 +122,7 @@ public class BrandCityTierStat {
                 tierMapper.insert(new BrandCityTier(brandId, tier, total));
             }
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * (i + 1) / totalBrand), (i + 1), totalBrand);
+            Console.print("{}当前进度:{}/{}", '\r', (i + 1), totalBrand);
         }
     }
 }

+ 2 - 2
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandProvinceStat.java

@@ -40,7 +40,7 @@ public class BrandProvinceStat {
             List<BrandProvince> provinces = brandProvinceDao.searchByBrandIdOrderByProvince(brand.getBrandId(), month);
             if (provinces.isEmpty()) {
                 //打印进度条
-                Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+                Console.print("{}当前进度:{}/{}", '\r',  i, total);
                 continue;
             }
             for (BrandProvince city : provinces) {
@@ -50,7 +50,7 @@ public class BrandProvinceStat {
             }
             brandProvinceDao.insertAll(provinces);
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+            Console.print("{}当前进度:{}/{}", '\r',  i, total);
         }
     }
 }

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandStat.java

@@ -77,7 +77,7 @@ public class BrandStat {
             statistics.setUpdateTime(DateUtil.date());
             index += brandStatisticsDao.insert(statistics);
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * index / total), index, total);
+            Console.print("{}当前进度:{}/{}", '\r', index, total);
         }
     }
 }

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/BrandZoneStat.java

@@ -49,7 +49,7 @@ public class BrandZoneStat {
 
             i += brandZoneDao.insert(zone);
             //打印进度条
-            Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+            Console.print("{}当前进度:{}/{}", '\r', i, total);
         }
     }
 }

+ 1 - 1
ruoyi-demo/src/main/java/com/ruoyi/demo/utils/statistics/StoreWdOpcloseStat.java

@@ -53,7 +53,7 @@ public class StoreWdOpcloseStat {
                 storeWd.setEndTime(maxTime);
                 i += storeWdOpcloseDao.insert(storeWd);
                 //打印进度条
-                Console.print("{}当前进度:{} {}/{}", '\r', StrUtil.repeat('#', 50 * i / total), i, total);
+                Console.print("{}当前进度:{}/{}", '\r', i, total);
             }
         }