old mode 100644
new mode 100755
 |  |  | 
 |  |  | package com.genersoft.iot.vmp.service.impl; | 
 |  |  |  | 
 |  |  | import com.baomidou.dynamic.datasource.annotation.DS; | 
 |  |  | import com.genersoft.iot.vmp.common.InviteInfo; | 
 |  |  | import com.genersoft.iot.vmp.common.InviteSessionType; | 
 |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
 |  |  | 
 |  |  | import org.slf4j.LoggerFactory; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.util.ObjectUtils; | 
 |  |  |  | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.HashMap; | 
 |  |  | 
 |  |  |  * @author lin | 
 |  |  |  */ | 
 |  |  | @Service | 
 |  |  | @DS("master") | 
 |  |  | public class DeviceChannelServiceImpl implements IDeviceChannelService { | 
 |  |  |  | 
 |  |  |     private final static Logger logger = LoggerFactory.getLogger(DeviceChannelServiceImpl.class); | 
 |  |  | 
 |  |  |             if (device == null) { | 
 |  |  |                 device = deviceMapper.getDeviceByDeviceId(deviceChannel.getDeviceId()); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             if ("WGS84".equals(device.getGeoCoordSys())) { | 
 |  |  |                 deviceChannel.setLongitudeWgs84(deviceChannel.getLongitude()); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             int limitCount = 300; | 
 |  |  |             int limitCount = 50; | 
 |  |  |             if (addChannels.size() > 0) { | 
 |  |  |                 if (addChannels.size() > limitCount) { | 
 |  |  |                     for (int i = 0; i < addChannels.size(); i += limitCount) { | 
 |  |  | 
 |  |  |             deviceChannel.setUpdateTime(now); | 
 |  |  |             result.add(updateGps(deviceChannel, device)); | 
 |  |  |         }); | 
 |  |  |         int limitCount = 300; | 
 |  |  |         int limitCount = 50; | 
 |  |  |         if (result.size() > limitCount) { | 
 |  |  |             for (int i = 0; i < result.size(); i += limitCount) { | 
 |  |  |                 int toIndex = i + limitCount; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void batchUpdateChannel(List<DeviceChannel> channels) { | 
 |  |  |         String now = DateUtil.getNow(); | 
 |  |  |         for (DeviceChannel channel : channels) { | 
 |  |  |             channel.setUpdateTime(now); | 
 |  |  |         } | 
 |  |  |         channelMapper.batchUpdate(channels); | 
 |  |  |         for (DeviceChannel channel : channels) { | 
 |  |  |             if (channel.getParentId() != null) { | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void updateChannelStreamIdentification(DeviceChannel channel) { | 
 |  |  |         assert !ObjectUtils.isEmpty(channel.getDeviceId()); | 
 |  |  |         assert !ObjectUtils.isEmpty(channel.getStreamIdentification()); | 
 |  |  |         if (ObjectUtils.isEmpty(channel.getStreamIdentification())) { | 
 |  |  |             logger.info("[重置通道码流类型] 设备: {}, 码流: {}", channel.getDeviceId(), channel.getStreamIdentification()); | 
 |  |  |         }else { | 
 |  |  |             logger.info("[更新通道码流类型] 设备: {}, 通道:{}, 码流: {}", channel.getDeviceId(), channel.getChannelId(), | 
 |  |  |                     channel.getStreamIdentification()); | 
 |  |  |         } | 
 |  |  |         channelMapper.updateChannelStreamIdentification(channel); | 
 |  |  |     } | 
 |  |  | } |