Showing
1 changed file
with
7 additions
and
13 deletions
| ... | ... | @@ -59,18 +59,6 @@ public class ShzzDevicePullService { |
| 59 | 59 | private RedisTemplate<String, String> redisTemplate; |
| 60 | 60 | |
| 61 | 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 | 62 | JSONArray deviceInfoList = getDeviceInfo(); |
| 75 | 63 | List<QxDeviceInfo> qxDeviceInfos = new ArrayList<>(); |
| 76 | 64 | List<QxDeviceInfoDetail> qxAddDeviceInfoDetails = new ArrayList<>(); |
| ... | ... | @@ -189,11 +177,17 @@ public class ShzzDevicePullService { |
| 189 | 177 | "模切机2", "模切机3", "模切机4", "模切机5"); |
| 190 | 178 | JSONArray jsonArray = new JSONArray(); |
| 191 | 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 | 186 | for (int index = 0; index < deviceNameList.size(); index++) { |
| 193 | 187 | Map<String, Object> map = new HashMap<>(3); |
| 194 | 188 | map.put("deviceName", deviceNameList.get(index)); |
| 195 | 189 | map.put("dtuSn", "SGH20250123" + String.format("%03d", index)); |
| 196 | - map.put("lampState", 3); | |
| 190 | + map.put("lampState", isWithinRange ? 3 : 0); | |
| 197 | 191 | if (index < 11) { |
| 198 | 192 | map.put("production", 130D); |
| 199 | 193 | } else if (index == 11) { | ... | ... |