| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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); |
| | |
| | | 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"); |
| | |
| | | |
| | | 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); |
| | |
| | | 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")); |
| | |
| | | fakeStatus.put("currentCode", JSON.toJSONString(point)); |
| | | fakeStatus.put("deviceStatus", 0);//设备忙碌 |
| | | fakeStatusMap.put(key, fakeStatus); |
| | | Thread.sleep(2000); |
| | | startTime = System.currentTimeMillis(); |
| | | } |
| | | redisUtil.del(first); |
| | | } |