|  | @@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.constant.ErrorMsgConstants;
 | 
	
		
			
				|  |  | +import com.xunmei.common.core.constant.HttpStatus;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.iot.domain.*;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
 | 
	
		
			
				|  |  |  import com.xunmei.common.core.domain.mediator.domain.IotAlarmSystemField;
 | 
	
	
		
			
				|  | @@ -90,7 +92,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      private IWebsocketNoticeLogService websocketNoticeLogService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public void changeSubSystemStatus(WebsocketExecuteReq req) {
 | 
	
		
			
				|  |  | +    public JSONObject changeSubSystemStatus(WebsocketExecuteReq req) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              LogUtils.STATUS_INFO_DEFENCEAREA.info("【报警主机布撤防状态变更事件】【token:{}】【msgId:{}】【接收参数:{}】", req.getServerInfo().getIotCode(), req.getId(), JSON.toJSONString(req));
 | 
	
		
			
				|  |  |              if (req.getData() != null) {
 | 
	
	
		
			
				|  | @@ -126,15 +128,15 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      this.saveProtectionLog(subsystem);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            return WebsocketResult.getSuccessPayload();
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
		
			
				|  |  | -            e.printStackTrace();
 | 
	
		
			
				|  |  |              LogUtils.STATUS_INFO_DEFENCEAREA.error("处理报警主机布撤防状态改变事件出错", e);
 | 
	
		
			
				|  |  | -            throw new RuntimeException(e);
 | 
	
		
			
				|  |  | +            return WebsocketResult.getResPayload(HttpStatus.ERROR, e.getMessage());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public void changeAlarmHostSensorStatus(WebsocketExecuteReq req) {
 | 
	
		
			
				|  |  | +    public JSONObject changeAlarmHostSensorStatus(WebsocketExecuteReq req) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              LogUtils.STATUS_INFO_STATUS_SENSOR.info("【报警主机传感器状态事件】【token:{}】【msgId:{}】【接收参数:{}】", req.getServerInfo().getIotCode(), req.getId(), JSON.toJSONString(req));
 | 
	
		
			
				|  |  |              if (req.getData() != null) {
 | 
	
	
		
			
				|  | @@ -152,10 +154,10 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      defenceArea.setUpdateTime(LocalDateTime.now());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      IotAlarmDefenceAreaData defenceAreaData = defenceAreaDataService.findByAreaId(defenceArea.getId());
 | 
	
		
			
				|  |  | -                    if (null != defenceAreaData){
 | 
	
		
			
				|  |  | +                    if (null != defenceAreaData) {
 | 
	
		
			
				|  |  |                          defenceAreaData.setDefenceAreaStatus(defenceArea.getState());
 | 
	
		
			
				|  |  |                          defenceAreaData.setUpdateTime(LocalDateTime.now());
 | 
	
		
			
				|  |  | -                    }else {
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  |                          defenceAreaData = new IotAlarmDefenceAreaData();
 | 
	
		
			
				|  |  |                          defenceAreaData.setId(IDHelper.id());
 | 
	
		
			
				|  |  |                          defenceAreaData.setAlarmHostCode(defenceArea.getAlarmHostCode());
 | 
	
	
		
			
				|  | @@ -192,16 +194,19 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      defenceAreaDataService.saveOrUpdate(defenceAreaData);
 | 
	
		
			
				|  |  |                      defenceAreDataLogService.save(dataLog);
 | 
	
		
			
				|  |  |                      defenceAreaService.updateById(defenceArea);
 | 
	
		
			
				|  |  | -                }else {
 | 
	
		
			
				|  |  | -                    LogUtils.STATUS_INFO_STATUS_SENSOR.info("【报警主机传感器状态事件,未找到对应传感器】【token:{}】【设备名称:{}】【子系统id:{}】【传感器index:{}】",
 | 
	
		
			
				|  |  | -                            req.getServerInfo().getIotCode(), req.getDeviceName(),subSystemId,inputIndex);
 | 
	
		
			
				|  |  | +                    return WebsocketResult.getSuccessPayload();
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    String str = "【报警主机传感器状态事件,未找到对应传感器】【token:%s】【设备名称:%s】【子系统id:%s】【传感器index:%s】";
 | 
	
		
			
				|  |  | +                    String logMsg = String.format(str, req.getServerInfo().getIotCode(), req.getDeviceName(), subSystemId, inputIndex);
 | 
	
		
			
				|  |  | +                    LogUtils.STATUS_INFO_STATUS_SENSOR.info(logMsg);
 | 
	
		
			
				|  |  | +                    return WebsocketResult.getResPayload(HttpStatus.ERROR, logMsg);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
		
			
				|  |  | -            e.printStackTrace();
 | 
	
		
			
				|  |  |              LogUtils.STATUS_INFO_STATUS_SENSOR.error("处理报警主机传感器状态事件出错", e);
 | 
	
		
			
				|  |  | -            throw new RuntimeException(e);
 | 
	
		
			
				|  |  | +            return WebsocketResult.getResPayload(HttpStatus.ERROR, e.getMessage());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        return WebsocketResult.getSuccessPayload();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -244,7 +249,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void breakerControlByOrgId(Long orgId,String command) {
 | 
	
		
			
				|  |  | +    public void breakerControlByOrgId(Long orgId, String command) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              QueryWrapper<IotDeviceInfo> wrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  |              wrapper.lambda()
 | 
	
	
		
			
				|  | @@ -270,10 +275,10 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                          throw new RuntimeException();
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }else {
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  |                  LogUtils.DEVICE_CONTROL_LOG.error("通断电控制,组织机构:{} 下未找到控制设备", orgId);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }catch (Exception e){
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  |              e.printStackTrace();
 | 
	
		
			
				|  |  |              LogUtils.DEVICE_CONTROL_LOG.error("通断电控制", e);
 | 
	
		
			
				|  |  |              throw new RuntimeException(e);
 | 
	
	
		
			
				|  | @@ -281,7 +286,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void breakerControlByDeviceId(Serializable id,String command) {
 | 
	
		
			
				|  |  | +    public void breakerControlByDeviceId(Serializable id, String command) {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              IotDeviceInfo deviceInfo = iIotDeviceInfoService.getById(id);
 | 
	
		
			
				|  |  |              if (deviceInfo != null) {
 | 
	
	
		
			
				|  | @@ -299,10 +304,10 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      LogUtils.DEVICE_CONTROL_LOG.error("通断电控制,指令下发iot服务失败");
 | 
	
		
			
				|  |  |                      throw new RuntimeException();
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }else {
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  |                  LogUtils.DEVICE_CONTROL_LOG.error("通断电控制,未找到控制设备:{}", id);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -        }catch (Exception e){
 | 
	
		
			
				|  |  | +        } catch (Exception e) {
 | 
	
		
			
				|  |  |              e.printStackTrace();
 | 
	
		
			
				|  |  |              LogUtils.DEVICE_CONTROL_LOG.error("通断电控制", e);
 | 
	
		
			
				|  |  |              throw new RuntimeException(e);
 | 
	
	
		
			
				|  | @@ -335,18 +340,18 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public Object execute(WebsocketExecuteReq req) {
 | 
	
		
			
				|  |  | -        try {
 | 
	
		
			
				|  |  | -            if (WebSocketConstants.SENSOR_STATUS.equals(req.getEvent())) {
 | 
	
		
			
				|  |  | -                //changeAlarmHostSensorStatus(req);
 | 
	
		
			
				|  |  | -                changeAlarmHostInputStatus(req);
 | 
	
		
			
				|  |  | -            } else if (WebSocketConstants.SUB_SYSTEM_STATUS.equals(req.getEvent())) {
 | 
	
		
			
				|  |  | -                changeSubSystemStatus(req);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        } catch (Exception e) {
 | 
	
		
			
				|  |  | -            e.printStackTrace();
 | 
	
		
			
				|  |  | -            throw new RuntimeException(e);
 | 
	
		
			
				|  |  | +        final String event = req.getEvent();
 | 
	
		
			
				|  |  | +        JSONObject jsb;
 | 
	
		
			
				|  |  | +        switch (event) {
 | 
	
		
			
				|  |  | +            case WebSocketConstants.SENSOR_STATUS:
 | 
	
		
			
				|  |  | +                jsb = changeAlarmHostSensorStatus(req);
 | 
	
		
			
				|  |  | +                return WebsocketResult.reply(req, jsb);
 | 
	
		
			
				|  |  | +            case WebSocketConstants.SUB_SYSTEM_STATUS:
 | 
	
		
			
				|  |  | +                jsb = changeSubSystemStatus(req);
 | 
	
		
			
				|  |  | +                return WebsocketResult.reply(req, jsb);
 | 
	
		
			
				|  |  | +            default:
 | 
	
		
			
				|  |  | +                return WebsocketResult.replyError(req, ErrorMsgConstants.ERROR_ROUTE);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        return null;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -357,25 +362,25 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |              if (req.getData() != null) {
 | 
	
		
			
				|  |  |                  String productName = req.getProductName();
 | 
	
		
			
				|  |  |                  String deviceName = req.getDeviceName();
 | 
	
		
			
				|  |  | -                AlarmHostSensorVO resParam = JSONObject.parseObject(req.getData().toString(),AlarmHostSensorVO.class);
 | 
	
		
			
				|  |  | +                AlarmHostSensorVO resParam = JSONObject.parseObject(req.getData().toString(), AlarmHostSensorVO.class);
 | 
	
		
			
				|  |  |                  String index = resParam.getIndex();
 | 
	
		
			
				|  |  | -                if(resParam == null){
 | 
	
		
			
				|  |  | -                    LogUtils.STATUS_INFO_STATUS_SENSOR.error("报警主机传感器状态事件:产品名称={},设备名称={},设备状态为空", productName,deviceName);
 | 
	
		
			
				|  |  | +                if (resParam == null) {
 | 
	
		
			
				|  |  | +                    LogUtils.STATUS_INFO_STATUS_SENSOR.error("报警主机传感器状态事件:产品名称={},设备名称={},设备状态为空", productName, deviceName);
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if (StringUtils.isBlank(index)){
 | 
	
		
			
				|  |  | -                    LogUtils.STATUS_INFO_STATUS_SENSOR.error("报警主机传感器状态事件:产品名称={},设备名称={},index为空", productName,deviceName);
 | 
	
		
			
				|  |  | +                if (StringUtils.isBlank(index)) {
 | 
	
		
			
				|  |  | +                    LogUtils.STATUS_INFO_STATUS_SENSOR.error("报警主机传感器状态事件:产品名称={},设备名称={},index为空", productName, deviceName);
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -                if(resParam.getStatus().equals(IotInputStatusEnum.ACTIVITY.getState())){
 | 
	
		
			
				|  |  | -                    LogUtils.STATUS_INFO_STATUS_SENSOR.debug("报警主机传感器状态事件:产品名称={},设备名称={},index={},活动状态丢弃", productName,deviceName,index);
 | 
	
		
			
				|  |  | +                if (resParam.getStatus().equals(IotInputStatusEnum.ACTIVITY.getState())) {
 | 
	
		
			
				|  |  | +                    LogUtils.STATUS_INFO_STATUS_SENSOR.debug("报警主机传感器状态事件:产品名称={},设备名称={},index={},活动状态丢弃", productName, deviceName, index);
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  | -                    this.saveInputStatus(req.getServerInfo().getIotCode(),productName, deviceName, resParam);
 | 
	
		
			
				|  |  | -                }catch (Exception e){
 | 
	
		
			
				|  |  | -                    LogUtils.STATUS_INFO_STATUS_SENSOR.info("报警主机传感器状态事件: 处理出现异常{}",e);
 | 
	
		
			
				|  |  | +                    this.saveInputStatus(req.getServerInfo().getIotCode(), productName, deviceName, resParam);
 | 
	
		
			
				|  |  | +                } catch (Exception e) {
 | 
	
		
			
				|  |  | +                    LogUtils.STATUS_INFO_STATUS_SENSOR.info("报警主机传感器状态事件: 处理出现异常{}", e);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
	
		
			
				|  | @@ -386,7 +391,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional
 | 
	
		
			
				|  |  | -    public void saveInputStatus(String token,String productName,String deviceName,AlarmHostSensorVO vo) throws Exception {
 | 
	
		
			
				|  |  | +    public void saveInputStatus(String token, String productName, String deviceName, AlarmHostSensorVO vo) throws Exception {
 | 
	
		
			
				|  |  |          String subsystemId = vo.getSubsystemId();
 | 
	
		
			
				|  |  |          String moduleAddress = vo.getModuleAddress();
 | 
	
		
			
				|  |  |          String index = vo.getIndex();
 | 
	
	
		
			
				|  | @@ -395,30 +400,30 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String limitOne = "limit 1";
 | 
	
		
			
				|  |  |          //todo:
 | 
	
		
			
				|  |  | -        final IotAlarmDefenceArea input = this.selectByTypeAndCode(token, DeviceTypeEnum.ALARM_HOST_INPUT.getCode(), productName, deviceName,moduleAddress,index);
 | 
	
		
			
				|  |  | +        final IotAlarmDefenceArea input = this.selectByTypeAndCode(token, DeviceTypeEnum.ALARM_HOST_INPUT.getCode(), productName, deviceName, moduleAddress, index);
 | 
	
		
			
				|  |  |          if (input == null) {
 | 
	
		
			
				|  |  | -            LogUtils.STATUS_INFO_STATUS_SENSOR.error("接收报警主机传感器状态事件:未查询到报警主机传感器信息,token:{},alarmHostId:{},zoneId:{},inputIndex:{}",token,deviceName,subsystemId,index);
 | 
	
		
			
				|  |  | +            LogUtils.STATUS_INFO_STATUS_SENSOR.error("接收报警主机传感器状态事件:未查询到报警主机传感器信息,token:{},alarmHostId:{},zoneId:{},inputIndex:{}", token, deviceName, subsystemId, index);
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          String sensorType = "AlarmHostInput_" + input.getSensorType();
 | 
	
		
			
				|  |  |          Long vipDeviceCode = input.getId();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          QueryWrapper<IotAlarmSystemField> fieldWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  | -        fieldWrapper.eq("product_type",sensorType);
 | 
	
		
			
				|  |  | -        fieldWrapper.eq("enable",1);
 | 
	
		
			
				|  |  | +        fieldWrapper.eq("product_type", sensorType);
 | 
	
		
			
				|  |  | +        fieldWrapper.eq("enable", 1);
 | 
	
		
			
				|  |  |          List<IotAlarmSystemField> fieldList = alarmSystemFieldMapper.selectList(fieldWrapper);
 | 
	
		
			
				|  |  |          IotPropertiesRes resParam = new IotPropertiesRes();
 | 
	
		
			
				|  |  |          resParam.setPropertyName("status");
 | 
	
		
			
				|  |  |          resParam.setPropertyValue(val);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          JSONArray arr = this.dealStatusData(resParam, fieldList);
 | 
	
		
			
				|  |  | -        if(arr == null || arr.isEmpty()){
 | 
	
		
			
				|  |  | +        if (arr == null || arr.isEmpty()) {
 | 
	
		
			
				|  |  |              LogUtils.STATUS_INFO_STATUS_SENSOR.debug("接收报警主机传感器状态事件: 匹配表iotAlarmSystemField属性失败,productName={},deviceName={}", sensorType, vipDeviceCode);
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Date now = new Date();
 | 
	
		
			
				|  |  | -        Long id= IDHelper.id();
 | 
	
		
			
				|  |  | +        Long id = IDHelper.id();
 | 
	
		
			
				|  |  |          String arrInfo = JSON.toJSONString(arr);
 | 
	
		
			
				|  |  |          String displayName = input.getDefenceAreaName();
 | 
	
		
			
				|  |  |          IotAlarmSystemField field = fieldList.get(0);
 | 
	
	
		
			
				|  | @@ -457,14 +462,14 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |              iotDeviceStatusMapper.updateById(status);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          IotDeviceStatusLog log = new IotDeviceStatusLog();
 | 
	
		
			
				|  |  | -        BeanUtils.copyProperties(status,log);
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(status, log);
 | 
	
		
			
				|  |  |          log.setDeviceStatusId(status.getId());
 | 
	
		
			
				|  |  |          log.setCreateTime(now);
 | 
	
		
			
				|  |  |          log.setId(null);
 | 
	
		
			
				|  |  |          iotDeviceStatusLogMapper.insert(log);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          boolean isAlarm = false;
 | 
	
		
			
				|  |  | -        if(val.equals(IotInputStatusEnum.ALARM.getState())){
 | 
	
		
			
				|  |  | +        if (val.equals(IotInputStatusEnum.ALARM.getState())) {
 | 
	
		
			
				|  |  |              isAlarm = true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          String infos = status.getInfo();
 | 
	
	
		
			
				|  | @@ -472,9 +477,9 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String sensorValue = dataMap.get(field.getProductPropertyDisplayName());
 | 
	
		
			
				|  |  |          if (StringUtils.isBlank(sensorValue)) {
 | 
	
		
			
				|  |  | -            return ;
 | 
	
		
			
				|  |  | +            return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        IotAlarmData alarmData =this.builderAlarm(sensorValue,field,status);
 | 
	
		
			
				|  |  | +        IotAlarmData alarmData = this.builderAlarm(sensorValue, field, status);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          QueryWrapper<IotAlarmData> queryWrapper = new QueryWrapper<>();
 | 
	
		
			
				|  |  |          queryWrapper.lambda().eq(IotAlarmData::getDeviceId, vipDeviceCode).isNull(IotAlarmData::getEndTime);
 | 
	
	
		
			
				|  | @@ -492,8 +497,8 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |              dataList.add(alarmData);
 | 
	
		
			
				|  |  |              //todo 产生告警通知
 | 
	
		
			
				|  |  |              IotDeviceInfo deviceInfo = changeToDeviceInfo(input);
 | 
	
		
			
				|  |  | -            websocketNoticeLogService.noticeAlarm(deviceInfo,alarmData,true);
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | +            websocketNoticeLogService.noticeAlarm(deviceInfo, alarmData, true);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              // 本次上传的设备状态数据 没有生成告警
 | 
	
		
			
				|  |  |              if (!isAlarm) {
 | 
	
		
			
				|  |  |                  //报警恢复
 | 
	
	
		
			
				|  | @@ -505,7 +510,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                              iotAlarmDataMapper.updateById(oldAlarm);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                              IotDeviceInfo deviceInfo = changeToDeviceInfo(input);
 | 
	
		
			
				|  |  | -                            websocketNoticeLogService.endNoticeAlarm(deviceInfo,oldAlarm);
 | 
	
		
			
				|  |  | +                            websocketNoticeLogService.endNoticeAlarm(deviceInfo, oldAlarm);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          IotAlarmData iotAlarmData = alarms.get(0);
 | 
	
	
		
			
				|  | @@ -514,7 +519,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                          //结束告警通知 , 只有6种传感器需要走这个逻辑
 | 
	
		
			
				|  |  |                          IotDeviceInfo deviceInfo = changeToDeviceInfo(input);
 | 
	
		
			
				|  |  | -                        websocketNoticeLogService.endNoticeAlarm(deviceInfo,iotAlarmData);
 | 
	
		
			
				|  |  | +                        websocketNoticeLogService.endNoticeAlarm(deviceInfo, iotAlarmData);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -524,7 +529,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      status.setState(0);
 | 
	
		
			
				|  |  |                      iotDeviceStatusMapper.updateById(status);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }else{
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  |                  //告警持续无操作
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -532,17 +537,17 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      //分析状态数据
 | 
	
		
			
				|  |  | -    private  JSONArray dealStatusData(IotPropertiesRes datum, List<IotAlarmSystemField> fieldList) {
 | 
	
		
			
				|  |  | +    private JSONArray dealStatusData(IotPropertiesRes datum, List<IotAlarmSystemField> fieldList) {
 | 
	
		
			
				|  |  |          JSONArray array = new JSONArray();
 | 
	
		
			
				|  |  |          JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |          String val = datum.getPropertyValue();
 | 
	
		
			
				|  |  | -        if(StringUtils.isBlank(val)){
 | 
	
		
			
				|  |  | +        if (StringUtils.isBlank(val)) {
 | 
	
		
			
				|  |  |              return array;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          IotAlarmSystemField bean = null;
 | 
	
		
			
				|  |  | -        for(IotAlarmSystemField field:fieldList){
 | 
	
		
			
				|  |  | -            if(datum.getPropertyName().equals(field.getProductProperty())){
 | 
	
		
			
				|  |  | +        for (IotAlarmSystemField field : fieldList) {
 | 
	
		
			
				|  |  | +            if (datum.getPropertyName().equals(field.getProductProperty())) {
 | 
	
		
			
				|  |  |                  bean = field;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -618,7 +623,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |          return iotAlarmData;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    private IotAlarmDefenceArea selectByTypeAndCode(String token, String deviceType, String product, String deviceCode,String moduleAddress,String index) {
 | 
	
		
			
				|  |  | +    private IotAlarmDefenceArea selectByTypeAndCode(String token, String deviceType, String product, String deviceCode, String moduleAddress, String index) {
 | 
	
		
			
				|  |  |          /**
 | 
	
		
			
				|  |  |           * RedisUtils,加入缓存机制
 | 
	
		
			
				|  |  |           */
 | 
	
	
		
			
				|  | @@ -631,7 +636,7 @@ public class IotAlarmHostServiceImpl implements IIotAlarmHostService, RouterServ
 | 
	
		
			
				|  |  |                      .eq(IotAlarmDefenceArea::getAlarmHostCode, deviceCode)
 | 
	
		
			
				|  |  |                      .eq(IotAlarmDefenceArea::getModuleAddress, moduleAddress)
 | 
	
		
			
				|  |  |                      .eq(IotAlarmDefenceArea::getDefenceAreaIndex, index)
 | 
	
		
			
				|  |  | -                    .eq(IotAlarmDefenceArea::getDeleted,0)
 | 
	
		
			
				|  |  | +                    .eq(IotAlarmDefenceArea::getDeleted, 0)
 | 
	
		
			
				|  |  |                      .last("limit 1");
 | 
	
		
			
				|  |  |              IotAlarmDefenceArea one = iotAlarmDefenceAreaMapper.selectOne(qw);
 | 
	
		
			
				|  |  |              if (one != null) {
 |