上饶市公安局wvp平台
zhongrj
2023-06-27 9aad57b02481686e09f2a25c86c15bd70a28764f
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -9,6 +9,9 @@
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.policeBodyCamera.entity.DeviceChannelPoliceCamera;
import com.genersoft.iot.vmp.policeBodyCamera.mapper.DeviceChannelPoliceCameraMapper;
import com.genersoft.iot.vmp.policeBodyCamera.service.DeviceChannelPoliceCameraService;
import com.genersoft.iot.vmp.service.IGbStreamService;
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -102,6 +105,12 @@
   @Autowired
    private MediaServerMapper mediaServerMapper;
   @Autowired
   private DeviceChannelPoliceCameraService deviceChannelPoliceCameraService;
   @Autowired
   private DeviceChannelPoliceCameraMapper deviceChannelPoliceCameraMapper;
   private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -159,6 +168,7 @@
   public synchronized void updateChannel(String deviceId, DeviceChannel channel) {
      String channelId = channel.getChannelId();
      channel.setDeviceId(deviceId);
      //更新通道数据
      StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId);
      if (streamInfo != null) {
         channel.setStreamId(streamInfo.getStream());
@@ -173,6 +183,12 @@
         deviceChannelMapper.update(channel);
      }
      deviceChannelMapper.updateChannelSubCount(deviceId,channel.getParentId());
      System.out.println("设备名称 = " + channel.getName());
      //如果是是执法记录仪
//      if (null!=channel.getName() && channel.getName().contains("执法记录仪")){
//         //更新执法记录仪信息
//         deviceChannelPoliceCameraService.updateChannelPoliceCamera(channel);
//      }
   }
   @Override
@@ -223,9 +239,15 @@
                     toIndex = addChannels.size();
                  }
                  deviceChannelMapper.batchAdd(addChannels.subList(i, toIndex));
                  //执法记录仪数据新增
//                  System.out.println("执法记录仪批量新增 ================= ");
//                  deviceChannelPoliceCameraMapper.batchAdd(addChannels.subList(i, toIndex));
               }
            }else {
               deviceChannelMapper.batchAdd(addChannels);
               //执法记录仪数据新增
//               System.out.println("执法记录仪批量新增 ================= ");
//               deviceChannelPoliceCameraMapper.batchAdd(addChannels);
            }
         }
         if (updateChannels.size() > 0) {
@@ -236,9 +258,15 @@
                     toIndex = updateChannels.size();
                  }
                  deviceChannelMapper.batchUpdate(updateChannels.subList(i, toIndex));
                  //执法记录仪数据修改
//                  System.out.println("执法记录仪批量修改 ================= ");
//                  deviceChannelPoliceCameraMapper.batchUpdate(updateChannels.subList(i, toIndex));
               }
            }else {
               deviceChannelMapper.batchUpdate(updateChannels);
               //执法记录仪数据修改
//               System.out.println("执法记录仪批量修改 ================= ");
//               deviceChannelPoliceCameraMapper.batchUpdate(updateChannels);
            }
         }
      }
@@ -297,9 +325,21 @@
                  if (i + limitCount > channels.size()) {
                     toIndex = channels.size();
                  }
                  //设置创建时间,更新时间
                  for (DeviceChannel channel : channels) {
                     channel.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                     channel.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                  }
//                  System.out.println("==============设备开始更新============ ");
                  result = result || deviceChannelMapper.batchAdd(channels.subList(i, toIndex)) < 0;
               }
            }else {
               //设置创建时间,更新时间
               for (DeviceChannel channel : channels) {
                  channel.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                  channel.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
               }
//               System.out.println("==============设备开始更新============ ");
               result = result || deviceChannelMapper.batchAdd(channels) < 0;
            }
         }
@@ -392,6 +432,12 @@
   @Override
   public int delChannel(String deviceId, String channelId) {
      //查询设备信息
      DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(deviceId, channelId);
//      if (deviceChannel.getName().contains("执法记录仪")){
//         //同时删除执法记录仪信息
//         deviceChannelPoliceCameraService.del(deviceId, channelId);
//      }
      return deviceChannelMapper.del(deviceId, channelId);
   }
@@ -510,6 +556,9 @@
    */
   @Override
   public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
//      if (mobilePosition.getDeviceName().contains("执法记录仪")){
//         deviceChannelPoliceCameraService.insertNewPositionPoliceCamera(mobilePosition);
//      }
      return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
   }