|
|
@@ -7,8 +7,10 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
+import com.xunmei.system.api.RemoteProtectionService;
|
|
|
import com.xunmei.system.api.domain.SysDevice;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
+import com.xunmei.system.api.dto.ProtectionDTO;
|
|
|
import com.xunmei.system.mapper.SysOrgMapper;
|
|
|
import com.xunmei.system.vo.area.AccessType;
|
|
|
import com.xunmei.system.vo.area.HostVO;
|
|
|
@@ -42,7 +44,8 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
private ISysOrgService orgService;
|
|
|
@Autowired
|
|
|
private SysOrgMapper sysOrgMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private RemoteProtectionService remoteProtectionService;
|
|
|
@Override
|
|
|
public TableDataInfo<SysDevice> selectPage(SysDevice sysDevice) {
|
|
|
//未删除
|
|
|
@@ -131,7 +134,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
sysDevices.forEach(s -> {
|
|
|
VideoVO videoVO = new VideoVO();
|
|
|
videoVO.setVideoId(s.getId());
|
|
|
- videoVO.setVideoName("通道"+s.getChannel());
|
|
|
+ videoVO.setVideoName(s.getDeviceName());
|
|
|
List<AccessType> accessByVideo = sysDeviceMapper.getAccessByVideo(s.getId(), taskId);
|
|
|
if (accessByVideo.size()>0) {
|
|
|
for (AccessType a:accessByVideo){
|
|
|
@@ -191,7 +194,17 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
sysDevice.setCreateBy(SecurityUtils.getUsername());
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
|
|
|
sysDevice.setOrgName(sysOrg.getShortName());
|
|
|
- return sysDeviceMapper.insert(sysDevice);
|
|
|
+ int insert = sysDeviceMapper.insert(sysDevice);
|
|
|
+ //新增防区只有报警主机
|
|
|
+ if (sysDevice.getDeviceType().equals("1")){
|
|
|
+ ProtectionDTO protectionDTO=new ProtectionDTO();
|
|
|
+ protectionDTO.setName(sysDevice.getDeviceName());
|
|
|
+ protectionDTO.setOrgPath(sysOrg.getPath());
|
|
|
+ protectionDTO.setAllHour(0);
|
|
|
+ protectionDTO.setDeviceId(sysDevice.getId());
|
|
|
+ remoteProtectionService.addByDevice(protectionDTO);
|
|
|
+ }
|
|
|
+ return insert;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -206,6 +219,13 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
|
|
sysDevice.setUpdateBy(SecurityUtils.getUsername());
|
|
|
SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
|
|
|
sysDevice.setOrgName(sysOrg.getShortName());
|
|
|
+ if (sysDevice.getDeviceType().equals("1")){
|
|
|
+ ProtectionDTO protectionDTO=new ProtectionDTO();
|
|
|
+ protectionDTO.setId(sysDevice.getId());
|
|
|
+ protectionDTO.setName(sysDevice.getDeviceName());
|
|
|
+ protectionDTO.setOrgPath(sysOrg.getPath());
|
|
|
+ remoteProtectionService.addByDevice(protectionDTO);
|
|
|
+ }
|
|
|
return sysDeviceMapper.updateById(sysDevice);
|
|
|
}
|
|
|
|