Browse Source

恢复genData功能

FutureYu 1 year ago
parent
commit
2b322cc943

+ 1 - 1
insert-app/src/main/java/db/controller/ProbeController.java

@@ -61,7 +61,7 @@ public class ProbeController {
         log.info("==> [api模拟插入随机数据] 收到请求");
 
         long startTime = System.currentTimeMillis();
-        // probeService.genData(dataCount);
+         probeService.genData(dataCount);
         long endTime = System.currentTimeMillis();
 
         String res = String.format("已模拟插入随机数据%d条", dataCount);

+ 9 - 9
insert-app/src/main/java/db/service/ProbeService.java

@@ -29,8 +29,8 @@ public class ProbeService {
     @Autowired
     private NettyServer server;
 
-    // @Autowired
-    // private PackageHandler packageHandler;
+     @Autowired
+     private PackageHandler packageHandler;
 
     public Map<Short, Probe> getProbes() {
         return probes;
@@ -181,11 +181,11 @@ public class ProbeService {
     }
 
 
-    // public void genData(Integer dataCount) {
-    //     DataGenerator dataGenerator = new DataGenerator();
-    //     List<DataResponsePackage> packages = dataGenerator.generate(dataCount);
-    //     for (DataResponsePackage dataPackage: packages) {
-    //         packageHandler.handleDataResponsePackage(dataPackage);
-    //     }
-    // }
+     public void genData(Integer dataCount) {
+         DataGenerator dataGenerator = new DataGenerator();
+         List<DataResponsePackage> packages = dataGenerator.generate(dataCount);
+         for (DataResponsePackage dataPackage: packages) {
+             packageHandler.handleDataResponsePackage(dataPackage);
+         }
+     }
 }