| | |
| | | import com.ard.common.utils.spring.SpringUtils; |
| | | import com.ard.common.utils.uuid.IdUtils; |
| | | import com.ard.device.camera.domain.ArdCamera; |
| | | import com.ard.device.camera.domain.CameraCmd; |
| | | import com.ard.device.camera.mapper.ArdCameraMapper; |
| | | import com.ard.device.camera.service.IArdCameraService; |
| | | import com.ard.device.channel.domain.ArdChannel; |
| | | import com.ard.device.channel.service.IArdChannelService; |
| | | import com.ard.device.component.sdk.common.GlobalVariable; |
| | | import com.ard.device.component.sdk.event.LoginEvent; |
| | | import com.ard.device.component.sdk.service.CameraSDKService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.context.event.EventListener; |
| | | 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.*; |
| | |
| | | |
| | | @Resource |
| | | protected Validator validator; |
| | | |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) { |
| | |
| | | ardCamera.setUpdateBy(SecurityUtils.getUsername()); |
| | | int res = ardCameraMapper.updateArdCamera(ardCamera); |
| | | if (res > 0) { |
| | | cameraSDKService.logout(ardCamera.getId());//sdk注销 |
| | | cameraSDKService.logout(ardCamera);//sdk注销 |
| | | cameraSDKService.login(ardCamera);//sdk登录获取通道信息 |
| | | } |
| | | return res; |
| | |
| | | //删除当前相机的所有通道 |
| | | ardChannelService.deleteArdChannelByDeviceId(id); |
| | | //sdk注销 |
| | | cameraSDKService.logout(id); |
| | | cameraSDKService.logout(camera); |
| | | } |
| | | } |
| | | return ardCameraMapper.deleteArdCameraByIds(ids); |
| | |
| | | //删除当前相机的所有通道 |
| | | ardChannelService.deleteArdChannelByDeviceId(id); |
| | | //sdk注销 |
| | | cameraSDKService.logout(id); |
| | | cameraSDKService.logout(ArdCamera.builder().id(id).build()); |
| | | } |
| | | return i; |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 同步通道 |