| | |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Validator; |
| | | import java.util.*; |
| | |
| | | return DeviceConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验机场是否已关联相机 |
| | | * |
| | | * @param camera 相机 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public ArdCamera checkAirportHasCamera(ArdCamera camera) { |
| | | ArdCamera info = ardCameraMapper.checkAirportHasCamera(camera); |
| | | if (StringUtils.isNotNull(info)&& !info.getId().equals(camera.getId())) { |
| | | return info; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 同步通道 |
| | |
| | | // SDK 登录成功后写入 Redis |
| | | redisService.setCacheObject(getCacheKey(camera.getId()), camera); |
| | | } |
| | | |
| | | /** |
| | | * 同步设备通道与本地通道库信息 |
| | | * |
| | | * @author 刘苏义 |
| | | * @date 2024/8/22 14:37 |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ?") |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void syncChannel() { |
| | | try { |
| | | log.debug("定时执行同步通道任务"); |
| | |
| | | log.error("定时执行同步通道任务异常:{}", ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 定时执行登录失败相机重新登录 |
| | | * |
| | | * @author 刘苏义 |
| | | * @date 2024/8/22 14:37 |
| | | */ |
| | | @Scheduled(cron = "0/30 * * * * ?") |
| | | @Scheduled(fixedDelay = 30000) |
| | | public void failedReconnect() { |
| | | try { |
| | | log.debug("定时执行失败相机重连任务"); |
| | |
| | | * 刘苏义 |
| | | * 2023/10/8 14:54:41 |
| | | */ |
| | | @Scheduled(cron = "0/10 * * * * ?") |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void cameraState() { |
| | | try { |
| | | log.debug("定时执行同步相机在线状态任务"); |