| | |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.HexUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.druid.support.json.JSONUtils; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.pagehelper.Page; |
| | | import com.github.pagehelper.PageHelper; |
| | |
| | | newPoleMap.forEach( |
| | | commend -> { |
| | | //开关灯时间 |
| | | String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder(); |
| | | if (newLightTask.getControlOrder() != null) { |
| | | //控灯时间 |
| | | s = s + newLightTask.getControlOrder(); |
| | | } |
| | | // 更新系统定时 |
| | | commend.setSysScheduled(s); |
| | | // String s = newLightTask.getOpenOrder() + newLightTask.getCloseOrder(); |
| | | // if (newLightTask.getControlOrder() != null) { |
| | | // //控灯时间 |
| | | // s = s + newLightTask.getControlOrder(); |
| | | // } |
| | | // // 更新系统定时 |
| | | // commend.setSysScheduled(s); |
| | | if (commend.getIssueStatus() == 0) { |
| | | //下发成功 更新系统定时和硬件定时 |
| | | commend.setDeviceScheduled(s); |
| | | commend.setDeviceScheduled(JSONObject.toJSONString(newLightTask)); |
| | | } else { |
| | | //下发失败 更新系统定时 保留硬件定时 硬件定时 |
| | | // commend.setSysScheduled(s); |
| | | oldLightTaskStatusAndPoles.forEach(task -> { |
| | | if (task.getLightAddress().equals(commend.getLightAddress()) && task.getDeviceCode().equals(commend.getDeviceCode())) { |
| | | //同一个灯头 |
| | | commend.setDeviceScheduled(task.getDeviceScheduled()); |
| | | LightTask oldTask = getById(task.getTaskId()); |
| | | commend.setDeviceScheduled(JSONObject.toJSONString(oldTask)); |
| | | } |
| | | }); |
| | | |