Showing
1 changed file
with
7 additions
and
13 deletions
| @@ -59,18 +59,6 @@ public class ShzzDevicePullService { | @@ -59,18 +59,6 @@ public class ShzzDevicePullService { | ||
| 59 | private RedisTemplate<String, String> redisTemplate; | 59 | private RedisTemplate<String, String> redisTemplate; |
| 60 | 60 | ||
| 61 | public void pullDeviceAndPushToIot() { | 61 | public void pullDeviceAndPushToIot() { |
| 62 | - LocalTime currentTime = LocalTime.now(); | ||
| 63 | - LocalTime startTime = LocalTime.of(8, 0, 0); // 08:00:00 | ||
| 64 | - LocalTime endTime = LocalTime.of(18, 0, 0); // 18:00:00 | ||
| 65 | - | ||
| 66 | - boolean isWithinRange = | ||
| 67 | - !currentTime.isBefore(startTime) && | ||
| 68 | - currentTime.isBefore(endTime); | ||
| 69 | - | ||
| 70 | - if (!isWithinRange) { | ||
| 71 | - return; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | JSONArray deviceInfoList = getDeviceInfo(); | 62 | JSONArray deviceInfoList = getDeviceInfo(); |
| 75 | List<QxDeviceInfo> qxDeviceInfos = new ArrayList<>(); | 63 | List<QxDeviceInfo> qxDeviceInfos = new ArrayList<>(); |
| 76 | List<QxDeviceInfoDetail> qxAddDeviceInfoDetails = new ArrayList<>(); | 64 | List<QxDeviceInfoDetail> qxAddDeviceInfoDetails = new ArrayList<>(); |
| @@ -189,11 +177,17 @@ public class ShzzDevicePullService { | @@ -189,11 +177,17 @@ public class ShzzDevicePullService { | ||
| 189 | "模切机2", "模切机3", "模切机4", "模切机5"); | 177 | "模切机2", "模切机3", "模切机4", "模切机5"); |
| 190 | JSONArray jsonArray = new JSONArray(); | 178 | JSONArray jsonArray = new JSONArray(); |
| 191 | List<JSONObject> jsonObjectList = new ArrayList<>(38); | 179 | List<JSONObject> jsonObjectList = new ArrayList<>(38); |
| 180 | + LocalTime currentTime = LocalTime.now(); | ||
| 181 | + LocalTime startTime = LocalTime.of(8, 0, 0); // 08:00:00 | ||
| 182 | + LocalTime endTime = LocalTime.of(18, 0, 0); // 18:00:00 | ||
| 183 | + boolean isWithinRange = | ||
| 184 | + !currentTime.isBefore(startTime) && | ||
| 185 | + currentTime.isBefore(endTime); | ||
| 192 | for (int index = 0; index < deviceNameList.size(); index++) { | 186 | for (int index = 0; index < deviceNameList.size(); index++) { |
| 193 | Map<String, Object> map = new HashMap<>(3); | 187 | Map<String, Object> map = new HashMap<>(3); |
| 194 | map.put("deviceName", deviceNameList.get(index)); | 188 | map.put("deviceName", deviceNameList.get(index)); |
| 195 | map.put("dtuSn", "SGH20250123" + String.format("%03d", index)); | 189 | map.put("dtuSn", "SGH20250123" + String.format("%03d", index)); |
| 196 | - map.put("lampState", 3); | 190 | + map.put("lampState", isWithinRange ? 3 : 0); |
| 197 | if (index < 11) { | 191 | if (index < 11) { |
| 198 | map.put("production", 130D); | 192 | map.put("production", 130D); |
| 199 | } else if (index == 11) { | 193 | } else if (index == 11) { |