2021与蓝度共同重构项目,服务端
fix
zhanzhiqin
2022-09-22 4b753c6327941dd988e9ca534cf81ae1d368286a
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightTaskService.java
@@ -6,6 +6,8 @@
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;
@@ -143,23 +145,24 @@
        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));
                            }
                        });