From fbb5a1b76d7fc16c3f3463294e489aad6b7d2ad2 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Thu, 25 Apr 2024 18:46:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A4=E6=8D=A2=E6=9C=BA?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E7=8A=B6=E6=80=81=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcSwitchController.java | 4 +++- .../mapper/business/DcSwitchMapper.xml | 20 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java b/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java index 71d5fd56..78830c9d 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java @@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.io.IOException; import java.net.InetAddress; +import java.util.Date; import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -71,7 +72,7 @@ public class DcSwitchController extends BaseController { ExecutorService executor = Executors.newFixedThreadPool(100); List collect = switchList.stream() .filter(dcSwitch -> { - return dcSwitch.getAncestors().split(",").length > 1; + return dcSwitch.getParentId() != null; }).collect(Collectors.toList()); CountDownLatch latch = new CountDownLatch(collect.size()); collect.forEach(dcSwitch -> { @@ -85,6 +86,7 @@ public class DcSwitchController extends BaseController { // 失败 dcSwitch.setNetWorkStatus(0); } + dcSwitch.setUpdateTime(new Date()); } catch (IOException e) { e.getMessage(); } finally { diff --git a/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml b/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml index 8f3e77be..caac9b35 100644 --- a/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml @@ -45,11 +45,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update dc_switch set netWork_status = - - when #{item.switchId} then #{item.netWorkStatus} - + update dc_switch + + + + when switch_id=#{item.switchId} + then #{item.netWorkStatus} + + + + + when switch_id=#{item.switchId} + then #{item.updateTime} + + + where switch_id in