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; + } }