From d6edde8e74a3917970eec4f87cf3c886fe430307 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Mon, 25 Jan 2021 16:53:36 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E6=9B=B4=E6=96=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=AE=BE=E5=A4=87=E9=80=BB=E8=BE=91=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=94=AF=E6=8C=81=E7=9B=B8=E5=90=8CIP=EF=BC=8C?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E7=AB=AF=E5=8F=A3=EF=BC=8C=E4=B8=8D=E9=80=9A?= =?UTF-8?q?=E5=A4=84=E7=BD=AE=E7=B1=BB=E5=9E=8B=E7=9A=84=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E3=80=82=202.=20=E6=9B=B4=E6=96=B0=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DisposeDeviceManagerImpl.java | 20 ++++++------ .../dispose/mapper/DisposeDeviceMapper.java | 3 +- src/main/resources/mappers/DisposeDevice.xml | 1 + .../UserBusinessControllerTest.java | 3 +- .../dev/manager/DisposeDeviceManagerTest.java | 3 +- .../dev/mapper/DisposeDeviceMapperTest.java | 9 ++++-- .../dispose/test/testcase/qa/v200/P1All.java | 3 +- .../test/testcase/qa/v200/P2DeviceAdd.java | 5 +-- .../testcase/qa/v200/P2DeviceUpgrade.java | 31 ++++++++++--------- 9 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java index 3ec759b5..29f98c37 100644 --- a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java @@ -56,7 +56,8 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager { @Override public MulReturnType addDisposeDevice(DisposeDevice dev) { // 看看系统中有没有存在相同IP+端口地址的设备,有的话返回失败 - DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), dev.getIpPort()); + DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), dev.getIpPort(), + dev.getDeviceType().getValue()); if (tDev != null) { // 如果设备是删除状态,则更新设备信息 @@ -135,20 +136,17 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager { */ @Override public MulReturnType upgradeDisposeDevice(DisposeDevice dev) { - DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), dev.getIpPort()); + DisposeDevice tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), dev.getIpPort(), + dev.getDeviceType().getValue()); // 处理默认端口情况 if (tDev == null) { if (dev.getIpPort() == null || dev.getIpPort().length() == 0) { - // HTTP 默认端口 - if (dev.getUrlType() == HttpType.HTTP) { - tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), - HttpType.getDefaultPort(HttpType.HTTP)); - } else if (dev.getUrlType() == HttpType.HTTPS) { - // HTTPS 默认端口 - tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), - HttpType.getDefaultPort(HttpType.HTTPS)); - } + tDev = disposeDeviceMapper.getDeviceByAddress(dev.getIpAddr(), + dev.getUrlType() == HttpType.HTTP ? + HttpType.getDefaultPort(HttpType.HTTP) : + HttpType.getDefaultPort(HttpType.HTTPS), + dev.getDeviceType().getValue()); } } diff --git a/src/main/java/com/dispose/mapper/DisposeDeviceMapper.java b/src/main/java/com/dispose/mapper/DisposeDeviceMapper.java index 64dee82d..2de7b378 100644 --- a/src/main/java/com/dispose/mapper/DisposeDeviceMapper.java +++ b/src/main/java/com/dispose/mapper/DisposeDeviceMapper.java @@ -83,7 +83,8 @@ public interface DisposeDeviceMapper { * @return the device by address */ DisposeDevice getDeviceByAddress(@Param("ipAddr") String ipAddr, - @Param("ipPort") String ipPort); + @Param("ipPort") String ipPort, + @Param("devType") Integer devType); /** diff --git a/src/main/resources/mappers/DisposeDevice.xml b/src/main/resources/mappers/DisposeDevice.xml index de7b3b0f..8fa31f5a 100644 --- a/src/main/resources/mappers/DisposeDevice.xml +++ b/src/main/resources/mappers/DisposeDevice.xml @@ -70,6 +70,7 @@ LEFT JOIN dispose_capacity c ON d.id = c.deviceId WHERE d.ipAddr = #{ipAddr} AND d.ipPort = #{ipPort} + AND d.deviceType = #{devType}