|  | @@ -1,6 +1,5 @@
 | 
	
		
			
				|  |  |  package com.xunmei.system.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.io.File;
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -10,11 +9,17 @@ import com.xunmei.common.core.utils.DateUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.common.security.utils.SecurityUtils;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysDevice;
 | 
	
		
			
				|  |  |  import com.xunmei.system.api.domain.SysOrg;
 | 
	
		
			
				|  |  | +import com.xunmei.system.mapper.SysOrgMapper;
 | 
	
		
			
				|  |  | +import com.xunmei.system.vo.area.AccessType;
 | 
	
		
			
				|  |  | +import com.xunmei.system.vo.area.HostVO;
 | 
	
		
			
				|  |  | +import com.xunmei.system.vo.area.VideoVO;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import com.xunmei.system.service.ISysOrgService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.Arrays;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
	
		
			
				|  | @@ -35,6 +40,8 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
 | 
	
		
			
				|  |  |      private SysDeviceMapper sysDeviceMapper;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ISysOrgService orgService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysOrgMapper sysOrgMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public TableDataInfo<SysDevice> selectPage(SysDevice sysDevice) {
 | 
	
	
		
			
				|  | @@ -104,6 +111,100 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
 | 
	
		
			
				|  |  |          return hostByOrgId;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +/*    @Override
 | 
	
		
			
				|  |  | +    public List<HostVO> getHostVideoByOrgId(Long orgId) {
 | 
	
		
			
				|  |  | +        List<HostVO> hostVOS = new ArrayList<>();
 | 
	
		
			
				|  |  | +        //查询所有视频主机
 | 
	
		
			
				|  |  | +        List<SysDevice> hostByOrgId = sysDeviceMapper.getHostByOrgId(orgId);
 | 
	
		
			
				|  |  | +        hostByOrgId.forEach(h -> {
 | 
	
		
			
				|  |  | +            HostVO hostVO = new HostVO();
 | 
	
		
			
				|  |  | +            hostVO.setHostId(h.getId());
 | 
	
		
			
				|  |  | +            hostVO.setHostName(h.getDeviceName());
 | 
	
		
			
				|  |  | +            QueryWrapper queryWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  | +            queryWrapper.eq("del_flag", "0");
 | 
	
		
			
				|  |  | +            queryWrapper.eq("host_id", h.getId());
 | 
	
		
			
				|  |  | +            //查询视频
 | 
	
		
			
				|  |  | +            List<SysDevice> sysDevices = baseMapper.selectList(queryWrapper);
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(sysDevices)) {
 | 
	
		
			
				|  |  | +                List<VideoVO> videoVOS = new ArrayList<>();
 | 
	
		
			
				|  |  | +                sysDevices.forEach(s -> {
 | 
	
		
			
				|  |  | +                    VideoVO videoVO = new VideoVO();
 | 
	
		
			
				|  |  | +                    videoVO.setVideoId(s.getId());
 | 
	
		
			
				|  |  | +                    videoVO.setVideoName(s.getDeviceName());
 | 
	
		
			
				|  |  | +                    List<Map> accessByVideo = sysDeviceMapper.getAccessByVideo(orgId, s.getId());
 | 
	
		
			
				|  |  | +                    if (CollectionUtils.isNotEmpty(accessByVideo)) {
 | 
	
		
			
				|  |  | +                        accessByVideo.forEach(a -> {
 | 
	
		
			
				|  |  | +                            String situation = a.get("situation").toString();
 | 
	
		
			
				|  |  | +                            int num = Integer.parseInt(a.get("num").toString());
 | 
	
		
			
				|  |  | +                            videoVO.setType(1);
 | 
	
		
			
				|  |  | +                            if (situation.equals("1") && num > 0) {
 | 
	
		
			
				|  |  | +                                videoVO.setType(2);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        videoVO.setType(0);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    videoVOS.add(videoVO);
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +                hostVO.setDeviceVOS(videoVOS);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            hostVOS.add(hostVO);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return hostVOS;
 | 
	
		
			
				|  |  | +    }*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public List<HostVO> getHostVideoByTaskId(Long taskId) {
 | 
	
		
			
				|  |  | +        List<HostVO> hostVOS = new ArrayList<>();
 | 
	
		
			
				|  |  | +        Long orgIdByTaskId = sysOrgMapper.getOrgIdByTaskId(taskId);
 | 
	
		
			
				|  |  | +        List<SysDevice> hostByOrgId = sysDeviceMapper.getHostByOrgId(orgIdByTaskId);
 | 
	
		
			
				|  |  | +        hostByOrgId.forEach(h -> {
 | 
	
		
			
				|  |  | +            HostVO hostVO = new HostVO();
 | 
	
		
			
				|  |  | +            hostVO.setHostId(h.getId());
 | 
	
		
			
				|  |  | +            hostVO.setHostName(h.getDeviceName());
 | 
	
		
			
				|  |  | +            QueryWrapper queryWrapper = new QueryWrapper();
 | 
	
		
			
				|  |  | +            queryWrapper.eq("del_flag", "0");
 | 
	
		
			
				|  |  | +            queryWrapper.eq("host_id", h.getId());
 | 
	
		
			
				|  |  | +            //查询视频
 | 
	
		
			
				|  |  | +            List<SysDevice> sysDevices = baseMapper.selectList(queryWrapper);
 | 
	
		
			
				|  |  | +            if (CollectionUtils.isNotEmpty(sysDevices)) {
 | 
	
		
			
				|  |  | +                List<VideoVO> videoVOS = new ArrayList<>();
 | 
	
		
			
				|  |  | +                sysDevices.forEach(s -> {
 | 
	
		
			
				|  |  | +                    VideoVO videoVO = new VideoVO();
 | 
	
		
			
				|  |  | +                    videoVO.setVideoId(s.getId());
 | 
	
		
			
				|  |  | +                    videoVO.setVideoName(s.getDeviceName());
 | 
	
		
			
				|  |  | +                    List<AccessType> accessByVideo = sysDeviceMapper.getAccessByVideo(s.getId(), taskId);
 | 
	
		
			
				|  |  | +                    if (accessByVideo.size()>0) {
 | 
	
		
			
				|  |  | +                        for (AccessType a:accessByVideo){
 | 
	
		
			
				|  |  | +                            String situation = a.getSituation();
 | 
	
		
			
				|  |  | +                            int num = a.getNum();
 | 
	
		
			
				|  |  | +                            videoVO.setType(1);
 | 
	
		
			
				|  |  | +                            if (situation.equals("1") && num > 0) {
 | 
	
		
			
				|  |  | +                                videoVO.setType(2);
 | 
	
		
			
				|  |  | +                                break;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                  /*      accessByVideo.forEach(a -> {
 | 
	
		
			
				|  |  | +                            String situation = a.getSituation();
 | 
	
		
			
				|  |  | +                            int num = a.getNum();
 | 
	
		
			
				|  |  | +                            videoVO.setType(1);
 | 
	
		
			
				|  |  | +                            if (situation.equals("1") && num > 0) {
 | 
	
		
			
				|  |  | +                                videoVO.setType(2);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        });*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        videoVO.setType(0);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    videoVOS.add(videoVO);
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +                hostVO.setDeviceVOS(videoVOS);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            hostVOS.add(hostVO);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return hostVOS;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 查询【请填写功能名称】列表
 | 
	
		
			
				|  |  |       *
 |