| | |
| | | dealNewData(message); |
| | | } |
| | | |
| | | @Async |
| | | void dealNewData(String message) { |
| | | comPropertyAlarmDao = SpringUtil.getBean(ComPropertyAlarmDao.class); |
| | | JSONObject deviceMess = JSONObject.parseObject(message); |
| | | boolean checkFlag = |
| | | ("trace_call".equals(deviceMess.getString("cmd")) && (StringUtils.isNotEmpty(deviceMess.getString("userid")))); |
| | | if (checkFlag) { |
| | | logger.info("收到设备报警信息:{}", message); |
| | | for (int i = 1; i < 10; i++) { |
| | | if (org.apache.commons.lang.StringUtils.isNotEmpty(deviceMess.getString("num" + i))) { |
| | | ComPropertyAlarm comPropertyAlarm = new ComPropertyAlarm(); |
| | | comPropertyAlarm.setSerialNo(deviceMess.getString("userid")); |
| | | comPropertyAlarm.setReceiveNo(deviceMess.getString("num" + i)); |
| | | comPropertyAlarm.setStatus(0); |
| | | // 10位的秒级别的时间戳 |
| | | Date createDate = new Date(deviceMess.getLong("ts" + i) * 1000); |
| | | //对应的就是时间戳对应的Date |
| | | comPropertyAlarm.setCreateTime(createDate); |
| | | comPropertyAlarm.setType(1); |
| | | comPropertyAlarmDao.insert(comPropertyAlarm); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Deprecated |
| | | @Async |
| | | void dealNewData(String message) { |