package com.ard.device.channel.service.impl; import com.ard.common.constant.CacheConstants; import com.ard.common.constant.UserConstants; import com.ard.common.core.redis.RedisCache; import com.ard.common.utils.uuid.IdUtils; import com.ard.device.camera.domain.ArdCamera; import com.ard.device.camera.service.IArdCameraService; import com.ard.device.channel.domain.ArdChannel; import com.ard.device.channel.mapper.ArdChannelMapper; import com.ard.device.channel.service.IArdChannelService; import com.ard.vtdu.config.MediamtxConfig; import com.ard.vtdu.domain.ArdVtdu; import com.ard.vtdu.service.IArdVtduService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; /** * 通道管理Service业务层处理 * * @author ard * @date 2023-08-19 */ @Slf4j @Service public class ArdChannelServiceImpl implements IArdChannelService { @Resource private ArdChannelMapper ardChannelMapper; /** * 查询通道管理 * * @param id 通道管理主键 * @return 通道管理 */ @Override public ArdChannel selectArdChannelById(String id) { return ardChannelMapper.selectArdChannelById(id); } /** * 查询通道管理列表 * * @param ardChannel 通道管理 * @return 通道管理 */ @Override public List selectArdChannelList(ArdChannel ardChannel) { return ardChannelMapper.selectArdChannelList(ardChannel); } /** * 新增通道管理 * * @param ardChannel 通道管理 * @return 结果 */ @Override public int insertArdChannel(ArdChannel ardChannel) { ardChannel.setId(IdUtils.simpleUUID()); return ardChannelMapper.insertArdChannel(ardChannel); } /** * 修改通道管理 * * @param ardChannel 通道管理 * @return 结果 */ @Override public int updateArdChannel(ArdChannel ardChannel) { return ardChannelMapper.updateArdChannel(ardChannel); } /** * 批量删除通道管理 * * @param ids 需要删除的通道管理主键 * @return 结果 */ @Override public int deleteArdChannelByIds(String[] ids) { return ardChannelMapper.deleteArdChannelByIds(ids); } /** * 删除通道管理信息 * * @param id 通道管理主键 * @return 结果 */ @Override public int deleteArdChannelById(String id) { return ardChannelMapper.deleteArdChannelById(id); } /** * 清空通道 * * @author 刘苏义 * @date 2024/8/10 11:18 */ @Override public int clearArdChannel() { return ardChannelMapper.clearArdChannel(); } /** * 删除通道管理信息 * * @param deviceId 所属设备ID * @return 结果 */ @Override public int deleteArdChannelByDeviceId(String deviceId) { return ardChannelMapper.deleteArdChannelByDeviceId(deviceId); } /** * 校验相机通道是否唯一 * * @param channel 通道信息 * @return 结果 */ @Override public boolean checkArdChannelUnique(ArdChannel channel) { ArdChannel info = ardChannelMapper.checkArdChannelUnique(channel); if (info != null && !Objects.equals(info.getId(), channel.getId())) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; } }