From 0060647f1beded30115a0fea0a8c28073d8de6fc Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Mon, 5 Feb 2024 17:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=B9=E6=8D=AE=E6=A1=A9?= =?UTF-8?q?=E5=8F=B7=E8=8C=83=E5=9B=B4=E6=9F=A5=E8=AF=A2=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E6=96=B0=E5=A2=9E=E6=9D=A1=E4=BB=B6=20?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BroadcastController.java | 2 +- .../CodeScanningAlarmController.java | 2 +- .../controller/DcDeviceController.java | 2 +- .../NonAutomaticWarningController.java | 12 ++++++---- .../zc/business/service/IDcDeviceService.java | 2 +- .../service/impl/DcDeviceServiceImpl.java | 23 +++++++++++++++---- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java index bd387b4e..5c594912 100644 --- a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java @@ -24,7 +24,7 @@ import static com.ruoyi.common.constant.Constants.HTTP; /** * License * - * @author Athena-xiepufeng + * @author Athena-zhaoxianglong */ @Api(tags = "广播接口") @RestController diff --git a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java index 4b1edea2..92d6df7d 100644 --- a/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java +++ b/zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java @@ -18,7 +18,7 @@ import java.util.Objects; /** * License * - * @author Athena-xiepufeng + * @author Athena-zhaoxianglong */ @Api(tags = "扫码报警") @RestController diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index af4114a7..2b408d49 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -93,7 +93,7 @@ public class DcDeviceController extends BaseController { @ApiOperation("无分页根据设备桩号查询设备列表") @PreAuthorize("@ss.hasPermi('iot:device:query')") @PostMapping("pileNumberQuery") - public AjaxResult devicePileNumberQueryDevice(@RequestBody Map parameter) { + public AjaxResult devicePileNumberQueryDevice(@RequestBody Map parameter) { return AjaxResult.success(dcDeviceService.devicePileNumberQueryDevice(parameter)); } diff --git a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java index 3f395bab..6aa9461d 100644 --- a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java @@ -29,7 +29,7 @@ import java.util.Objects; /** * License * - * @author Athena-xiepufeng + * @author Athena-zhaoxianglong */ @Api(tags = "非机预警接口") @RestController @@ -102,7 +102,12 @@ public class NonAutomaticWarningController extends BaseController { client.setCallback(new MqttCallback() { public void connectionLost(Throwable cause) { - System.out.println("connectionLost"); + System.out.println("断开连接"); + //try { + // eventSubscription(); + //} catch (Exception e) { + // throw new RuntimeException(e); + //} } public void messageArrived(String topic, MqttMessage message) { @@ -195,9 +200,6 @@ public class NonAutomaticWarningController extends BaseController { dcWarning.setStakeMark("k190+495"); } dcWarning.setWarningTitle(crossingName+srcName); - //设置事件Id UUID无下划线格式32 - String uuid = IdUtils.fastSimpleUUID(); - dcWarning.setId(uuid); dcWarning.setWarningSource(6); dcWarning.setWarningState(1); dcWarningService.insertDcWarning(dcWarning); diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java index 2e4b12b3..8bd23a34 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java @@ -76,5 +76,5 @@ public interface IDcDeviceService extends IService { Long statisticalAnomalyDevice(); - List devicePileNumberQueryDevice(Map parameter); + List devicePileNumberQueryDevice(Map parameter); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index 3f4a497a..c0ce1a20 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -298,14 +298,18 @@ public class DcDeviceServiceImpl extends ServiceImpl i } @Override - public List devicePileNumberQueryDevice(Map parameter) { + public List devicePileNumberQueryDevice(Map parameter) { ArrayList dcDevices = new ArrayList<>(); - Integer startStakeMark = Integer.parseInt(String.valueOf(parameter.get("startStakeMark").get(0)) + String.valueOf(parameter.get("startStakeMark").get(1))); - Integer endStakeMark = Integer.parseInt(String.valueOf(parameter.get("endStakeMark").get(0)) + String.valueOf(parameter.get("endStakeMark").get(1))); + List startStakeMarks = castList(parameter.get("startStakeMark"), String.class); + List endStakeMarks = castList(parameter.get("endStakeMark"), String.class); + String deviceType = String.valueOf(parameter.get("deviceType")); + Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1)); + Integer endStakeMark = Integer.parseInt(endStakeMarks.get(0) + endStakeMarks.get(1)); LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); ArrayList integers = new ArrayList<>(); integers.add(6); - lambdaQueryWrapper.notIn(DcDevice::getDeviceType,integers); + lambdaQueryWrapper.notIn(DcDevice::getDeviceType, integers); + lambdaQueryWrapper.eq(DcDevice::getDeviceType, deviceType); List list = list(lambdaQueryWrapper); for (DcDevice dcDevice : list) { String stakeMark = dcDevice.getStakeMark(); @@ -336,5 +340,16 @@ public class DcDeviceServiceImpl extends ServiceImpl i return dcDevices; } + + public static List castList(Object obj, Class clazz) { + List result = new ArrayList(); + if (obj instanceof List) { + for (Object o : (List) obj) { + result.add(clazz.cast(o)); + } + return result; + } + return null; + } }