parent
1aef6bf19e
commit
c34b9ecb3d
|
@ -2,6 +2,7 @@ package com.dispose.manager.impl;
|
||||||
|
|
||||||
import com.dispose.common.ErrorCode;
|
import com.dispose.common.ErrorCode;
|
||||||
import com.dispose.common.Helper;
|
import com.dispose.common.Helper;
|
||||||
|
import com.dispose.common.HttpType;
|
||||||
import com.dispose.common.IpAddrType;
|
import com.dispose.common.IpAddrType;
|
||||||
import com.dispose.common.ObjectStatus;
|
import com.dispose.common.ObjectStatus;
|
||||||
import com.dispose.manager.DisposeDeviceManager;
|
import com.dispose.manager.DisposeDeviceManager;
|
||||||
|
@ -55,6 +56,16 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MulReturnType<ErrorCode, Long> addDisposeDevice(DisposeDevice dev) {
|
public MulReturnType<ErrorCode, Long> addDisposeDevice(DisposeDevice dev) {
|
||||||
|
List<DisposeDevice> tmpDev = disposeDeviceMapper.getDeviceByIpAndType(dev.getIpAddr(),
|
||||||
|
dev.getDeviceType().getValue());
|
||||||
|
|
||||||
|
for (DisposeDevice v : tmpDev) {
|
||||||
|
if (dev.getIpPort().equals(HttpType.getDefaultPort(v.getUrlType())) || dev.getIpPort()
|
||||||
|
.equals(v.getIpPort())) {
|
||||||
|
return new MulReturnType<>(ErrorCode.ERR_DEVICEEXISTS, v.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 看看系统中有没有存在相同IP+端口地址的设备,有的话返回失败
|
// 看看系统中有没有存在相同IP+端口地址的设备,有的话返回失败
|
||||||
DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddrAndType(dev.getIpAddr(), dev.getIpPort(),
|
DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddrAndType(dev.getIpAddr(), dev.getIpPort(),
|
||||||
dev.getDeviceType().getValue());
|
dev.getDeviceType().getValue());
|
||||||
|
|
|
@ -797,7 +797,8 @@ public class P2DeviceAdd {
|
||||||
Assert.assertNotNull(k.getDevId());
|
Assert.assertNotNull(k.getDevId());
|
||||||
});
|
});
|
||||||
|
|
||||||
DisposeDevice dev = c.getDisposeDeviceMapper().getDeviceByAddrAndType("10.88.77.15", "", DisposeDeviceType.DPTECH_UMC
|
DisposeDevice dev = c.getDisposeDeviceMapper().getDeviceByAddrAndType("10.88.77.15", "80",
|
||||||
|
DisposeDeviceType.DPTECH_UMC
|
||||||
.getValue());
|
.getValue());
|
||||||
Assert.assertNotNull(dev);
|
Assert.assertNotNull(dev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue