diff --git a/riis-system/src/main/java/com/yfd/platform/component/iec104/client/IEC104ClientRunner.java b/riis-system/src/main/java/com/yfd/platform/component/iec104/client/IEC104ClientRunner.java index 632c098..1bc92b7 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/iec104/client/IEC104ClientRunner.java +++ b/riis-system/src/main/java/com/yfd/platform/component/iec104/client/IEC104ClientRunner.java @@ -61,7 +61,7 @@ public class IEC104ClientRunner implements ApplicationRunner { GatewayDevice::getIpAddr, GatewayDevice::getIecAddr); queryWrapper.orderByAsc(GatewayDevice::getDeviceCode); List list = gatewayDeviceMapper.selectList(queryWrapper); - if (list.size() > 0) { + if (!list.isEmpty()) { for (GatewayDevice gatewayDevice : list) { Iec104Config iec104Config = new Iec104Config(); iec104Config.setFrameAmountMax((short) 10); diff --git a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850ClientListener.java b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850ClientListener.java index 2ce7abe..52341be 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850ClientListener.java +++ b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850ClientListener.java @@ -1,6 +1,10 @@ package com.yfd.platform.component.iec61850.client; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.beanit.iec61850bean.*; +import com.yfd.platform.component.WebSocketServer; +import com.yfd.platform.modules.auxcontrol.domain.DeviceSignal; import com.yfd.platform.modules.auxcontrol.mapper.DeviceSignalMapper; import com.yfd.platform.modules.auxcontrol.service.IDeviceWorkDataService; import com.yfd.platform.modules.patroltask.service.IAlarmLogService; @@ -44,6 +48,7 @@ public class IEC61850ClientListener extends Thread implements ClientEventListene alarmLogService.doAlaramRecord("IEC61850", "yc", null, node_name, node_value); } else if ("ST".equals(value.getFc().name())) { + //遥信 状态值 String node_name = value.getChild("stVal").toString().split(":")[0].replace(".stVal", ""); BdaBoolean state = (BdaBoolean) value.getChild("stVal"); @@ -55,6 +60,12 @@ public class IEC61850ClientListener extends Thread implements ClientEventListene deviceSignalMapper.updateDeviceSignalValue_yx(node_name, node_value, datestr); //执行报警处理:生成设备自身报警记录(status=1) alarmLogService.doAlaramRecord("IEC61850", "yx", null, node_name, node_value); + DeviceSignal deviceSignal = + deviceSignalMapper.selectOne(new LambdaQueryWrapper().eq(DeviceSignal::getYxAddr, node_name).last("limit 1")); + if (deviceSignal != null) { + WebSocketServer.sendInfo("auxcontrol_" + deviceSignal.getSignalId(), node_value); + } + } } } diff --git a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java index 286e6df..6ecdc65 100644 --- a/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java +++ b/riis-system/src/main/java/com/yfd/platform/component/iec61850/client/IEC61850Service.java @@ -44,7 +44,6 @@ public class IEC61850Service { clientSap.setTSelRemote(new byte[]{0, 1}); clientSap.setTSelLocal(new byte[]{0, 0}); clientSap.setApTitleCalled(new int[]{1, 1, 999, 1}); - ClientAssociation clientAssociation = null; try { clientAssociation = clientSap.associate(InetAddress.getByName(gatewayDevice.getIpAddr()), 102, null, @@ -77,6 +76,7 @@ public class IEC61850Service { //sendCommand("", "a397bf1d4042ae948d248b1f1856937e", "yk", "true"); //sendCommand("", "a397bf1d4042ae948d248b1f1856937e", "yt", "25.6"); } catch (ServiceError | IOException e) { + e.printStackTrace(); log.info("未能关联或检索设备的模型 {}: {}", gatewayDevice.getDeviceCode(), e.getMessage()); } return true; @@ -103,10 +103,10 @@ public class IEC61850Service { */ public boolean sendCommand(String systemcode, String signalid, String type, String deviceType, String value) throws IOException, ServiceError { -// value = getControlValue(deviceType, value); -// if (StrUtil.isBlank(value)) { -// return false; -// } + value = getControlValue(deviceType, value); + if (StrUtil.isBlank(value)) { + return false; + } DeviceSignal deviceSignal = deviceSignalService.getById(signalid); //辅控系统下属网关机状态监控 if (StrUtil.isNotEmpty(systemcode) && "10".equals(systemcode)) { @@ -193,13 +193,13 @@ public class IEC61850Service { public String getControlValue(String type, String value) { if ("7".equals(type)) { - return value.equals("1") ? "false" : "true"; + return value.equals("1") ? "0" : "1"; } if ("14".equals(type)) { - return value.equals("1") ? "false" : "true"; + return value.equals("1") ? "0" : "1"; } if ("20".equals(type)) { - return value.equals("1") ? "false" : "true"; + return value.equals("1") ? "0" : "1"; } return null; } diff --git a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java index cfc6718..106e7bf 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/algorithm/controller/AlgorithmArrangeController.java @@ -431,17 +431,23 @@ public class AlgorithmArrangeController { @GetMapping("/viewFile") @ApiOperation("预览方案图片") - public void serveVideo(String id, String type, HttpServletResponse response) { + public void serveVideo(String id, String type, HttpServletResponse response) throws IOException { AlgorithmArrange algorithmArrange = algorithmArrangeService.getById(id); if (algorithmArrange == null) { + response.sendError(HttpServletResponse.SC_NOT_FOUND, "布点数据不存在"); return; } + String filePath = null; if ("1".equals(type) && StrUtil.isNotBlank(algorithmArrange.getImageUrl())) { - FileUtil.serveVideo(httpServerConfig.getPlanFilePath(), algorithmArrange.getImageUrl(), response); + filePath = algorithmArrange.getImageUrl(); + } else if ("2".equals(type) && StrUtil.isNotBlank(algorithmArrange.getArrangeImageUrl())) { + filePath = algorithmArrange.getArrangeImageUrl(); } - if ("2".equals(type) && StrUtil.isNotBlank(algorithmArrange.getArrangeImageUrl())) { - FileUtil.serveVideo(httpServerConfig.getPlanFilePath(), algorithmArrange.getArrangeImageUrl(), response); + if (filePath == null) { + response.sendError(HttpServletResponse.SC_NOT_FOUND, "文件路径无效"); + return; } + FileUtil.serveVideo(httpServerConfig.getPlanFilePath(), filePath, response); } private List> getMapData() { diff --git a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java index c2fefb2..4cf7109 100644 --- a/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java +++ b/riis-system/src/main/java/com/yfd/platform/modules/patroltask/controller/AnalyseCallController.java @@ -77,7 +77,6 @@ public class AnalyseCallController { @Resource private ISubstationDeviceService substationDeviceService; - @PostMapping("/picAnalyseRetNotify") @ApiOperation("智能分析识别通知") public Object picAnalyseRetNotify(@RequestBody String params) { @@ -94,9 +93,9 @@ public class AnalyseCallController { alarmLogService.updateTaskResult(jsonObject); } else { SubstationDevice substationDevice = substationDeviceService.getById(requestId); - if(ObjUtil.isNotEmpty(substationDevice)){ + if (ObjUtil.isNotEmpty(substationDevice)) { alarmLogService.updateDeviceResult(jsonObject); - }else{ + } else { alarmLogService.createAlarm(jsonObject); } } @@ -106,7 +105,8 @@ public class AnalyseCallController { } } catch (Exception e) { e.printStackTrace(); - log.error(e.getMessage());; + log.error(e.getMessage()); + ; result.put("code", "500"); } return result; @@ -155,7 +155,7 @@ public class AnalyseCallController { inputStream = new FileInputStream(new File(originfilename)); //set the content type and header response.setContentType("image/jpeg"); - if("mp4".equals(suffix)){ + if ("mp4".equals(suffix)) { response.setContentType("video/mp4"); } response.setHeader("Content-Disposition", "attachment; filename=" + filename); @@ -183,6 +183,9 @@ public class AnalyseCallController { } String originfilename = ""; + if (StrUtil.isBlank(filename)) { + return; + } if (StrUtil.isNotEmpty(type) && type.equals("alarm")) {//报警显示不同目录 originfilename = Config.getAlarmFilePath() + filename; } else { @@ -206,7 +209,7 @@ public class AnalyseCallController { @GetMapping("/playAudioFile") @ApiOperation("在线在线播放音频文件") @ResponseBody - public void playAudioFile(HttpServletResponse response, String filename,String type) throws IOException { + public void playAudioFile(HttpServletResponse response, String filename, String type) throws IOException { OsInfo osInfo = new OsInfo(); boolean isLinux = osInfo.isLinux(); filename = URLDecoder.decode(filename, "utf-8"); @@ -243,7 +246,7 @@ public class AnalyseCallController { substationPatroldeviceService.getDockInfoBySn(substationPatroldevice.getInternationalId()); if (dockInfoBySn.size() > 0) { Map map = dockInfoBySn.get(0); - url = "rtmp://"+Config.getPatrolIp()+":1935" + map.get("dronePushUrl").toString(); + url = "rtmp://" + Config.getPatrolIp() + ":1935" + map.get("dronePushUrl").toString(); } } if ("dali".equals(substationPatroldevice.getManufacturer())) { @@ -287,13 +290,14 @@ public class AnalyseCallController { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.eq(AlgorithmModel::getId, requestId).set(AlgorithmModel::getRunstate, "1"); algorithmModelService.update(updateWrapper); -// AlgorithmModel algorithmModel = algorithmModelService.getById(requestId); -// JSONObject jsonObject1 = new JSONObject(); -// jsonObject1.putOnce("sectionId", algorithmModel.getSectionId()); -// jsonObject1.putOnce("stationId", algorithmModel.getStationId()); -// jsonObject1.putOnce("version", algorithmModel.getVersion()); -// String token = getToken(); -// httpUtil.sendHeaderHttpPost("json", algorithmServerConfig.getServerIp(), algorithmServerConfig.getHttpPort(), "", token, -// "recogApi/updateAlgorithmVersion", jsonObject1, null); + // AlgorithmModel algorithmModel = algorithmModelService.getById(requestId); + // JSONObject jsonObject1 = new JSONObject(); + // jsonObject1.putOnce("sectionId", algorithmModel.getSectionId()); + // jsonObject1.putOnce("stationId", algorithmModel.getStationId()); + // jsonObject1.putOnce("version", algorithmModel.getVersion()); + // String token = getToken(); + // httpUtil.sendHeaderHttpPost("json", algorithmServerConfig.getServerIp(), algorithmServerConfig + // .getHttpPort(), "", token, + // "recogApi/updateAlgorithmVersion", jsonObject1, null); } }