|
@@ -51,6 +51,10 @@ public class DataController {
|
|
private Socket client;
|
|
private Socket client;
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 初始化
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@PostConstruct
|
|
@PostConstruct
|
|
private Socket init() {
|
|
private Socket init() {
|
|
// 1 建立连接
|
|
// 1 建立连接
|
|
@@ -72,43 +76,6 @@ public class DataController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- // 返回前端总入口
|
|
|
|
- @GetMapping("data")
|
|
|
|
- @SuppressWarnings({"rawtypes", "unchecked"})
|
|
|
|
- private ResponseEntity getData() {
|
|
|
|
- log.info("run getData");
|
|
|
|
-// List connect = PythonUtils.connect(exePath, command);
|
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
|
- for (int i = 1; i < 99; i++) {
|
|
|
|
- Classroom classroom = new Classroom();
|
|
|
|
- classroom.setId(i);
|
|
|
|
- classroom.setRegion(DataFormatUtils.randomInt(3, 1));
|
|
|
|
- classroom.setStatus(DataFormatUtils.randomInt(2, 0));
|
|
|
|
- classroom.setStorey(DataFormatUtils.randomInt(10, 1));
|
|
|
|
- classroom.setCount(DataFormatUtils.randomInt(50, 20));
|
|
|
|
- list.add(classroom);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- try {
|
|
|
|
- Thread.sleep(9000);
|
|
|
|
- } catch (InterruptedException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- return new ResponseEntity(list, HttpStatus.OK);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 测试算法
|
|
|
|
- */
|
|
|
|
- @GetMapping("p")
|
|
|
|
- @SuppressWarnings({"rawtypes", "unchecked"})
|
|
|
|
- private ResponseEntity getData1() {
|
|
|
|
- log.info("run testPython");
|
|
|
|
- List connect = PythonUtils.connect(exePath, command);
|
|
|
|
- return new ResponseEntity(connect, HttpStatus.OK);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 重启socket客户端
|
|
* 重启socket客户端
|
|
@@ -160,6 +127,46 @@ public class DataController {
|
|
return new ResponseEntity(result, HttpStatus.OK);
|
|
return new ResponseEntity(result, HttpStatus.OK);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // ===================================== 测试用 ========================================================
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 返回前端总入口
|
|
|
|
+ @GetMapping("data")
|
|
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
|
|
+ private ResponseEntity getData() {
|
|
|
|
+ log.info("run getData");
|
|
|
|
+// List connect = PythonUtils.connect(exePath, command);
|
|
|
|
+ List<Object> list = new ArrayList<>();
|
|
|
|
+ for (int i = 1; i < 99; i++) {
|
|
|
|
+ Classroom classroom = new Classroom();
|
|
|
|
+ classroom.setId(i);
|
|
|
|
+ classroom.setRegion(DataFormatUtils.randomInt(3, 1));
|
|
|
|
+ classroom.setStatus(DataFormatUtils.randomInt(2, 0));
|
|
|
|
+ classroom.setStorey(DataFormatUtils.randomInt(10, 1));
|
|
|
|
+ classroom.setCount(DataFormatUtils.randomInt(50, 20));
|
|
|
|
+ list.add(classroom);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Thread.sleep(3000);
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return new ResponseEntity(list, HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 测试算法
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("p")
|
|
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
|
|
+ private ResponseEntity getDataP() {
|
|
|
|
+ log.info("run testPython");
|
|
|
|
+ List connect = PythonUtils.connect(exePath, command);
|
|
|
|
+ return new ResponseEntity(connect, HttpStatus.OK);
|
|
|
|
+ }
|
|
|
|
+
|
|
// test cpp
|
|
// test cpp
|
|
@GetMapping("6")
|
|
@GetMapping("6")
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
@SuppressWarnings({"rawtypes", "unchecked"})
|