From d4da001ed4dbebed683c9f0f1e06a4d8f4d12eaf Mon Sep 17 00:00:00 2001
From: zy <zy@123>
Date: 星期四, 31 七月 2025 15:50:24 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java | 67 +++++++++++++++++++++++++++------
1 files changed, 54 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java b/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
index 5a58ada..3aa424b 100644
--- a/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
+++ b/src/main/java/com/zy/core/thread/fake/FakeNyShuttleThread.java
@@ -267,8 +267,13 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- //delay
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
fakeStatus.put("hasLift", true);
fakeStatus.put("deviceStatus", 1);//璁惧绌洪棽
fakeStatusMap.put(key, fakeStatus);
@@ -276,8 +281,13 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- //delay
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
fakeStatus.put("hasLift", false);
fakeStatus.put("deviceStatus", 1);//璁惧绌洪棽
fakeStatusMap.put(key, fakeStatus);
@@ -285,16 +295,24 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- //delay
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
fakeStatus.put("hasCharge", true);
Integer batteryPower = Integer.parseInt(fakeStatus.getString("batteryPower"));
while (true) {
- Thread.sleep(10000);
+ if((System.currentTimeMillis() - startTime) < 1000 * 10) {
+ continue;
+ }
batteryPower = batteryPower + 1;
fakeStatus.put("batteryPower", batteryPower);
fakeStatusMap.put(key, fakeStatus);
+ startTime = System.currentTimeMillis();
if (batteryPower >= 100) {
break;
}
@@ -306,8 +324,13 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- //delay
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
fakeStatus.put("hasCharge", false);
fakeStatus.put("deviceStatus", 1);//璁惧绌洪棽
fakeStatusMap.put(key, fakeStatus);
@@ -315,8 +338,13 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- //delay
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
JSONObject body = command.getJSONObject("commandBody");
String currentCode = fakeStatus.getString("currentCode");
@@ -348,7 +376,13 @@
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- Thread.sleep(2000);
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 2) {
+ continue;
+ }
+ break;
+ }
while (true) {
Set<String> searchKeys = redisUtil.searchKeys(baseCommandKey);
@@ -379,6 +413,13 @@
break;
}
+ while (true) {
+ if((System.currentTimeMillis() - startTime) < 1000 * 1) {
+ continue;
+ }
+ break;
+ }
+
String currentCode = fakeStatus.getString("currentCode");
JSONObject point = JSON.parseObject(currentCode);
point.put("x", path.getInteger("xp"));
@@ -387,7 +428,7 @@
fakeStatus.put("currentCode", JSON.toJSONString(point));
fakeStatus.put("deviceStatus", 0);//璁惧蹇欑
fakeStatusMap.put(key, fakeStatus);
- Thread.sleep(2000);
+ startTime = System.currentTimeMillis();
}
redisUtil.del(first);
}
--
Gitblit v1.9.1