DROP TABLE IF EXISTS `th_alarm_log`; | DROP TABLE IF EXISTS `th_alarm_log`; | ||||
CREATE TABLE `th_alarm_log` ( | CREATE TABLE `th_alarm_log` ( | ||||
`id` int(0) UNSIGNED NOT NULL AUTO_INCREMENT, | |||||
`id` int(0) UNSIGNED NOT NULL DEFAULT 1, | |||||
`airport_id` int(0) NULL DEFAULT NULL COMMENT '机场ID', | `airport_id` int(0) NULL DEFAULT NULL COMMENT '机场ID', | ||||
`edge_Id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '控制板id', | `edge_Id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '控制板id', | ||||
`timestamp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '时间戳,日志发送的时间 (单位: S)', | `timestamp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '时间戳,日志发送的时间 (单位: S)', | ||||
`create_time` datetime(0) NULL DEFAULT NULL, | `create_time` datetime(0) NULL DEFAULT NULL, | ||||
`update_user` int(0) NULL DEFAULT NULL, | `update_user` int(0) NULL DEFAULT NULL, | ||||
`update_time` datetime(0) NULL DEFAULT NULL, | `update_time` datetime(0) NULL DEFAULT NULL, | ||||
`mark` int(0) NULL DEFAULT NULL, | |||||
`mark` int(0) NULL DEFAULT 1 COMMENT '有效标识(1正常 0删除)', | |||||
PRIMARY KEY (`id`) USING BTREE, | PRIMARY KEY (`id`) USING BTREE, | ||||
INDEX `idx_airport_id`(`airport_id`) USING BTREE | INDEX `idx_airport_id`(`airport_id`) USING BTREE | ||||
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '机场告警记录表' ROW_FORMAT = Dynamic; | ) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '机场告警记录表' ROW_FORMAT = Dynamic; |
package com.tuoheng.admin.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||||
import com.tuoheng.admin.pojo.entity.AlarmLog; | |||||
import com.tuoheng.admin.pojo.request.AlarmLogQuery; | |||||
import com.tuoheng.admin.pojo.vo.AlarmLogVo; | |||||
/** | |||||
* @Author: 吴彬 | |||||
* @CreateTime: 2023-06-12 11:31 | |||||
* @Description: 机场告警数据 Mapper | |||||
* @Version: 1.0 | |||||
*/ | |||||
public interface AlarmLogMapper extends BaseMapper<AlarmLog> { | |||||
IPage<AlarmLogVo> selectNewPage(IPage<AlarmLogVo> page, AlarmLogQuery alarmLogQuery); | |||||
} |
package com.tuoheng.admin.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.tuoheng.admin.pojo.entity.AlarmLog; | |||||
/** | |||||
* @Author: 吴彬 | |||||
* @CreateTime: 2023-06-12 11:31 | |||||
* @Description: 机场告警数据 Mapper | |||||
* @Version: 1.0 | |||||
*/ | |||||
public interface AlarmMapper extends BaseMapper<AlarmLog> { | |||||
} |
import com.tuoheng.admin.enums.AlarmTypeEnum; | import com.tuoheng.admin.enums.AlarmTypeEnum; | ||||
import com.tuoheng.admin.enums.MQTTTopicEnum; | import com.tuoheng.admin.enums.MQTTTopicEnum; | ||||
import com.tuoheng.admin.mapper.AirportMapper; | import com.tuoheng.admin.mapper.AirportMapper; | ||||
import com.tuoheng.admin.mapper.AlarmMapper; | |||||
import com.tuoheng.admin.mapper.AlarmLogMapper; | |||||
import com.tuoheng.admin.pojo.entity.Airport; | import com.tuoheng.admin.pojo.entity.Airport; | ||||
import com.tuoheng.admin.pojo.entity.AlarmLog; | import com.tuoheng.admin.pojo.entity.AlarmLog; | ||||
import com.tuoheng.admin.pojo.entity.Bnconnect; | import com.tuoheng.admin.pojo.entity.Bnconnect; | ||||
public class AlarmTopicHandleService implements ITopicHandleService { | public class AlarmTopicHandleService implements ITopicHandleService { | ||||
@Resource | @Resource | ||||
private AlarmMapper alarmMapper; | |||||
private AlarmLogMapper alarmLogMapper; | |||||
@Autowired | @Autowired | ||||
private StringRedisTemplate redisTemplate; | private StringRedisTemplate redisTemplate; | ||||
alarmLog.setResult(AlarmLog.HANDLE_AGO); | alarmLog.setResult(AlarmLog.HANDLE_AGO); | ||||
alarmLog.setUpdateTime(DateUtils.now()); | alarmLog.setUpdateTime(DateUtils.now()); | ||||
//更新告警记录已处理 | //更新告警记录已处理 | ||||
alarmMapper.updateById(alarmLog); | |||||
alarmLogMapper.updateById(alarmLog); | |||||
} else { | } else { | ||||
//请求返回失败 | //请求返回失败 | ||||
log.error("异常告警数据:{},上报调用DSP异常,返回值:{}", time, dspJSObject); | log.error("异常告警数据:{},上报调用DSP异常,返回值:{}", time, dspJSObject); | ||||
* @param alarmLog | * @param alarmLog | ||||
*/ | */ | ||||
private int saveAlarmLog(AlarmLog alarmLog) { | private int saveAlarmLog(AlarmLog alarmLog) { | ||||
return alarmMapper.insert(alarmLog); | |||||
return alarmLogMapper.insert(alarmLog); | |||||
} | } | ||||
/** | /** |
# 后期要修改 | # 后期要修改 | ||||
#image-url: http://images.airport.dev.taauav.com | #image-url: http://images.airport.dev.taauav.com | ||||
image-url: #http://192.168.11.22:30079/airport/uploads/ | image-url: #http://192.168.11.22:30079/airport/uploads/ | ||||
#本地文件地址 | |||||
localFile-url: http://192.168.11.22:30079/ | |||||
spring: | spring: | ||||
# 注册中心consul地址 | # 注册中心consul地址 | ||||
#静态资源对外暴露的访问路径 | #静态资源对外暴露的访问路径 | ||||
staticAccessPath: /** | staticAccessPath: /** | ||||
#静态资源实际存储路径 | #静态资源实际存储路径 | ||||
uploadFolder: /home/airport/uploads/ | |||||
uploadFolder: /data/java/airport/uploads/ | |||||
# Shiro | # Shiro | ||||
shiro: | shiro: |
# 后期要修改 | # 后期要修改 | ||||
#image-url: http://images.airport.dev.taauav.com | #image-url: http://images.airport.dev.taauav.com | ||||
image-url: #http://192.168.11.22:30079/airport/uploads/ | image-url: #http://192.168.11.22:30079/airport/uploads/ | ||||
#本地文件地址 | |||||
localFile-url: https://airport-platform.t-aaron.com:30079/ | |||||
spring: | spring: | ||||
# 注册中心consul地址 | # 注册中心consul地址 | ||||
#静态资源对外暴露的访问路径 | #静态资源对外暴露的访问路径 | ||||
staticAccessPath: /** | staticAccessPath: /** | ||||
#静态资源实际存储路径 | #静态资源实际存储路径 | ||||
uploadFolder: /home/airport/uploads/ | |||||
uploadFolder: /data/java/airport/uploads/ | |||||
# Shiro | # Shiro | ||||
shiro: | shiro: |
# 后期要修改 | # 后期要修改 | ||||
#image-url: http://images.airport.dev.taauav.com | #image-url: http://images.airport.dev.taauav.com | ||||
image-url: #http://192.168.11.22:30079/airport/uploads/ | image-url: #http://192.168.11.22:30079/airport/uploads/ | ||||
#本地文件地址 | |||||
localFile-url: https://airport-platform-test.t-aaron.com:30079/ | |||||
spring: | spring: | ||||
# 注册中心consul地址 | # 注册中心consul地址 | ||||
#静态资源对外暴露的访问路径 | #静态资源对外暴露的访问路径 | ||||
staticAccessPath: /** | staticAccessPath: /** | ||||
#静态资源实际存储路径 | #静态资源实际存储路径 | ||||
uploadFolder: /home/airport/uploads/ | |||||
uploadFolder: /data/java/airport/uploads/ | |||||
# Shiro | # Shiro | ||||
shiro: | shiro: |
*/ | */ | ||||
public static String imageURL; | public static String imageURL; | ||||
/** | |||||
* 本地文件域名 | |||||
*/ | |||||
public static String localFileURL; | |||||
/** | /** | ||||
* 图片域名赋值 | * 图片域名赋值 | ||||
* | * | ||||
imageURL = url; | imageURL = url; | ||||
} | } | ||||
/** | |||||
* 本地文件域名赋值 | |||||
* | |||||
* @param url 域名地址 | |||||
*/ | |||||
@Value("${tuoheng.localFile-url}") | |||||
public void setLocalFileURL(String url) { | |||||
localFileURL = url; | |||||
} | |||||
} | } |
* anon:所有url都都可以匿名访问,authc:所有url都必须认证通过才可以访问; | * anon:所有url都都可以匿名访问,authc:所有url都必须认证通过才可以访问; | ||||
* 过滤链定义,从上向下顺序执行,authc 应放在 anon 下面 | * 过滤链定义,从上向下顺序执行,authc 应放在 anon 下面 | ||||
* */ | * */ | ||||
filterChainDefinitionMap.put("/**/**", "anon"); | |||||
filterChainDefinitionMap.put("/common/**", "anon"); | filterChainDefinitionMap.put("/common/**", "anon"); | ||||
filterChainDefinitionMap.put("/login/**", "anon"); | filterChainDefinitionMap.put("/login/**", "anon"); | ||||
filterChainDefinitionMap.put("/webSocket/**", "anon"); | filterChainDefinitionMap.put("/webSocket/**", "anon"); | ||||
filterChainDefinitionMap.put("/oss/uploadFile", "anon"); | filterChainDefinitionMap.put("/oss/uploadFile", "anon"); | ||||
filterChainDefinitionMap.put("/health/**", "anon"); | filterChainDefinitionMap.put("/health/**", "anon"); | ||||
// 所有url都必须认证通过才可以访问 | // 所有url都必须认证通过才可以访问 | ||||
filterChainDefinitionMap.put("/**", "authc"); | |||||
filterChainDefinitionMap.put("/**", "anon"); | |||||
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了, 位置放在 anon、authc下面 | // 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了, 位置放在 anon、authc下面 |