From d2954d1177d4222378ca5f2a4b090b783ce005f5 Mon Sep 17 00:00:00 2001 From: fyj <913944315@qq.com> Date: Tue, 18 Jun 2024 17:26:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=B1=B1=E7=AB=99=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E6=99=BA=E5=B7=A1=E6=9C=80=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../getconfigvalue/StaticProperties.java | 4 +- .../xr/device_car/config/utils/FileUtil.java | 44 ++ .../com/xr/device_car/config/utils/Files.java | 60 ++- .../FocalLengthConfigController.java | 336 ++++++------ .../MeterInitializationController.java | 2 - .../src/main/resources/application-dev.yml | 8 +- .../src/main/resources/application-prod.yml | 8 +- .../src/main/resources/application.yml | 2 +- device_gateway/pom.xml | 10 +- .../Iec61850ClentApplication.java | 8 +- .../common/configvalue/StaticProperties.java | 1 + .../common/util/IEC61850Config.java | 9 + .../iec61850clent/common/util/ModeUtil.java | 2 + .../iec61850clent/common/util/UploadUtil.java | 114 ++++- .../models/entity/DeviceCamera.java | 127 +++++ .../models/entity/ExcelConfig.java | 4 + .../models/entity/FocalLengthConfig.java | 260 ++++++++++ .../iec61850clent/models/entity/Lds5000.java | 4 + .../models/iec61850run/Iec61850Scheduled.java | 301 +++++++++++ .../models/iec61850run/Iec61850clent.java | 44 +- .../models/mapper/DeviceCameraMapper.java | 25 + .../mapper/FocalLengthConfigMapper.java | 20 + .../models/mapper/MeterConfigMapper.java | 2 +- .../models/service/DeviceCameraService.java | 14 + .../service/FocalLengthConfigService.java | 18 + .../service/impl/DeviceCameraServiceImpl.java | 24 + .../impl/FocalLengthConfigServiceImpl.java | 43 ++ .../service/impl/MeterConfigServiceImpl.java | 6 +- .../src/main/resources/IEC61850.xlsx | Bin 14153 -> 15309 bytes .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 4 +- .../src/main/resources/application.yml | 7 +- .../mapper/FocalLengthConfigMapper.xml | 15 + .../resources/mapper/MeterConfigMapper.xml | 2 +- .../models/scheduled/UdpClentScheduled.java | 136 ++--- .../src/main/resources/application.yml | 2 +- drone_data/pom.xml | 10 +- .../drone/aliyun/common/MqttClientTest.java | 4 +- .../src/main/java/com/xr/drone/demo/Demo.java | 126 +++++ .../java/com/xr/drone/demo/SwingDemo.java | 477 ++++++++++++++++++ .../xr/drone/modules/entity/mqtt/MqttTop.java | 12 + .../drone/modules/entity/mqtt/TopDetail.java | 22 + .../modules/service/Impl/MqttServiceImpl.java | 5 + .../src/main/resources/application-prod.yml | 4 +- pom.xml | 1 + 45 files changed, 2043 insertions(+), 286 deletions(-) create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/DeviceCamera.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/FocalLengthConfig.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850Scheduled.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/DeviceCameraMapper.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/FocalLengthConfigMapper.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/DeviceCameraService.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/FocalLengthConfigService.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/DeviceCameraServiceImpl.java create mode 100644 device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/FocalLengthConfigServiceImpl.java create mode 100644 device_iec61850clent/src/main/resources/mapper/FocalLengthConfigMapper.xml create mode 100644 drone_data/src/main/java/com/xr/drone/demo/Demo.java create mode 100644 drone_data/src/main/java/com/xr/drone/demo/SwingDemo.java create mode 100644 drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/MqttTop.java create mode 100644 drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/TopDetail.java diff --git a/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java b/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java index 73239f7..d33a555 100644 --- a/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java +++ b/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java @@ -8,10 +8,10 @@ import org.springframework.stereotype.Component; @Data public class StaticProperties { - @Value("${upLoad.path}") + @Value("${upload.img.path}") private String path; - @Value("${upLoad.url}") + @Value("${upload.img.url}") private String url; @Value("${python.path}") diff --git a/device_cars/src/main/java/com/xr/device_car/config/utils/FileUtil.java b/device_cars/src/main/java/com/xr/device_car/config/utils/FileUtil.java index 3d2ed92..dfea0fd 100644 --- a/device_cars/src/main/java/com/xr/device_car/config/utils/FileUtil.java +++ b/device_cars/src/main/java/com/xr/device_car/config/utils/FileUtil.java @@ -3,6 +3,11 @@ package com.xr.device_car.config.utils; import org.springframework.core.io.ClassPathResource; import java.io.*; +import java.net.URL; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Date; public class FileUtil { @@ -120,6 +125,45 @@ public class FileUtil { } + public static String uploadImage(String clentIp,Integer configId,String fileName) throws Exception { + // 构建完整的路径 + String url = "http://"+clentIp+":8080/tao/snapshot"; + SimpleDateFormat sim=new SimpleDateFormat("yyyy-MM-dd-HH"); + String date = sim.format(new Date()); + String dates[] = date.split("-"); + + String year = dates[0]; + String month = dates[1]; + String day = dates[2]; + String ho = dates[3]; + String fullPath = StaticPropUtil.imagePath+configId + File.separator + year + File.separator + month + File.separator + day + File.separator +ho+File.separator+ fileName+".jpg"; + + // 创建目录结构 + Path directoryPath = Paths.get(StaticPropUtil.imagePath,configId.toString(), year, month, day,ho); + if (!java.nio.file.Files.exists(directoryPath)) { + java.nio.file.Files.createDirectories(directoryPath); + } + + downloadImage(url,fullPath); + + // 构建URL + String url1 = StaticPropUtil.imageUrl+ configId + "/" + year + "/"+ month + "/" + day + "/" +ho+"/"+ fileName+".jpg"; + return url1; + } + + public static void downloadImage(String imageUrl, String destinationPath) throws IOException { + URL url = new URL(imageUrl); + try (InputStream in = url.openStream(); + FileOutputStream out = new FileOutputStream(destinationPath)) { + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = in.read(buffer)) != -1) { + out.write(buffer, 0, bytesRead); + } + } + } + + } diff --git a/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java b/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java index 5f38ef2..01111d0 100644 --- a/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java +++ b/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java @@ -6,6 +6,7 @@ import sun.misc.BASE64Encoder; import javax.imageio.ImageIO; import java.awt.*; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.*; import java.net.Authenticator; @@ -13,6 +14,7 @@ import java.net.PasswordAuthentication; import java.net.URL; import java.net.URLConnection; import java.nio.file.Path; +import java.text.SimpleDateFormat; import java.util.Base64; import java.util.Date; import java.util.Random; @@ -345,32 +347,66 @@ public class Files { return fileName; } - /** - * 给图片化框 - *image 图片 - * */ - public static BufferedImage drawRectangleAndText(BufferedImage image, int x1, int y1, int x2, int y2, String text) { + public static BufferedImage drawRectangleAndText(BufferedImage image, double x1, double y1,double x2, double wid, double hei, String text1, String text2) { // 创建一个Graphics2D对象 Graphics2D g2d = image.createGraphics(); + // 设置抗锯齿 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + // 创建一个Rectangle2D.Double对象 + Rectangle2D.Double rect = new Rectangle2D.Double(x1, y1, wid, hei); + // 绘制红色框 g2d.setColor(Color.RED); - g2d.drawRect(x1, y1, x2 - x1, y2 - y1); + g2d.draw(rect); + // 设置粗线条 + g2d.setStroke(new BasicStroke(3.0f * 30)); // 设置线条宽度为3.0f // 设置字体和颜色 - g2d.setFont(new Font("Arial", Font.BOLD, 12)); - g2d.setColor(Color.RED); + g2d.setFont(new Font("微软雅黑", Font.BOLD, 38)); // 使用支持中文的字体,增加字体大小 + // 获取当前时间 + String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); // 获取文本的宽度和高度 FontMetrics fm = g2d.getFontMetrics(); - int textWidth = fm.stringWidth(text); - int textHeight = fm.getHeight(); - // 绘制文本 - g2d.drawString(text, x2 - textWidth - 5, y1 + textHeight - 5); + // 绘制当前时间的背景矩形 + int padding = 20; + int currentTimeWidth = fm.stringWidth(currentTime); + int currentTimeHeight = fm.getHeight(); + int rectPadding = 5; // 背景矩形内边距 + g2d.setColor(new Color(0, 0, 0, 50)); // 黑色半透明背景 + g2d.fillRect(padding, padding, currentTimeWidth + 2 * rectPadding, currentTimeHeight + 2 * rectPadding); + + // 绘制当前时间在左上角,内边距为20px + g2d.setColor(Color.WHITE); + int currentTimeX = padding + rectPadding + (currentTimeWidth + rectPadding - currentTimeWidth) / 2; + int currentTimeY = padding + rectPadding + fm.getAscent(); + g2d.drawString(currentTime, currentTimeX, currentTimeY); + + // 绘制文本2的背景矩形 + int text2Width = fm.stringWidth(text2); + int text2Height = fm.getHeight(); + g2d.setColor(new Color(0, 0, 0, 50)); // 黑色半透明背景 + g2d.fillRect(padding, padding + currentTimeHeight + rectPadding * 2, text2Width + 2 * rectPadding, text2Height + 2 * rectPadding); + + // 绘制文本2在时间的下面,内边距为20px + g2d.setColor(Color.WHITE); + int text2X = padding + rectPadding + (text2Width + rectPadding - text2Width) / 2; + int text2Y = padding + currentTimeHeight + rectPadding * 3 + fm.getAscent(); + g2d.drawString(text2, text2X, text2Y); + + // 计算文本1的右上角位置 + int text1Width = fm.stringWidth(text1); + int text1X = (int) (x1 + wid); // 框的右上角位置 + int text1Y = (int) (y1 + fm.getAscent()); // 框的右上角紧挨着框 + g2d.setColor(Color.RED); + + g2d.drawString(text1, text1X, text1Y); + // 释放资源 g2d.dispose(); diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java index caa0f06..6867836 100644 --- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java +++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java @@ -69,172 +69,172 @@ public class FocalLengthConfigController { focalLengthConfig.setUpdateUser(userInfo.getUserName()); focalLengthConfig.setUpdateTime(new Date()); focalLengthConfigService.updateById(focalLengthConfig); - MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId()) ; - DeviceCamera device=deviceCameraService.getById(meterConfig.getCameraId()); - QueryWrapper query=new QueryWrapper<>(); - query.eq("camera_id",meterConfig.getCameraId()); - List list=meterConfigService.list(query); - List meters=list.stream().map(n->n.getId()).collect(Collectors.toList()); - QueryWrapper query1=new QueryWrapper<>(); - query1.in("config_id",meters); - List lists=focalLengthConfigService.list(query1); - - if(focalLengthConfig.getRotate() == null){ - focalLengthConfig.setRotate(0); - } - BufferedImage bufferedImage=Files.bytesTobufferedImage(config.getFocalPicture()); - int width=bufferedImage.getWidth(); - int height=bufferedImage.getHeight(); - File file = new File("D:\\images\\path\\config"); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - DecimalFormat df = new DecimalFormat("#0.00000"); - if(file.exists()){ - file.delete(); - } - String deviceType=""; - if(device.getDeviceType().equals("1")){ - deviceType="usb"; - }else if(device.getDeviceType().equals("2")){ - deviceType="mipi"; - }else{ - return Result.OK("保存成功!"); - } - file.createNewFile(); - StringBuffer stringBuffer = new StringBuffer(); - stringBuffer.append("{\n"); - stringBuffer.append("\t\"device_id\": \"" + meterConfig.getCameraId() + "\",\n"); - stringBuffer.append("\t\"device_name\": \""+device.getDeviceModel()+"\",\n"); - stringBuffer.append("\t\"camera_type\": \""+deviceType+"\",\n");//mipi设设一体 usb usb摄像头 - stringBuffer.append("\t\"interval\": 60,\n"); - stringBuffer.append("\t\"warmup\": 150,\n");//对焦时间 - stringBuffer.append("\t\"http\": {\n");//url - stringBuffer.append("\t\t\"url\": \"http://192.168.1.252:8081/dataAnalysisCamera/getComer\"\n"); - stringBuffer.append("\t},\n"); - //stringBuffer.append("\t\"url\": null,\n"); - stringBuffer.append("\t\"meters\": [\n"); - int i=0; - int j=0; - for (FocalLengthConfig config1 : lists) { - String meterType=config1.getConfigType(); - String algorithm="CrocodileCircle"; - if(meterType.equals("1")){ - meterType="crocodile"; - }else if(meterType.equals("2")){ - meterType="floatocr"; - }else if(meterType.equals("3")){ - meterType="swmet"; - }else if(meterType.equals("5")){ - meterType = "crocodile_non_scale"; - }else if(meterType.equals("4")){ - meterType = "crocodile_watershed"; - } - if(config1.getAlgorithm() ==null || config1.getAlgorithm()==0){ - algorithm="CrocodileCircle"; - }else{ - algorithm="CrocodileEllipse"; - } - double x=config1.getCopperX()/width; - double y=config1.getCopperY()/height; - double x2=config1.getCopperX2()/width; - double y2=config1.getCopperY2()/height; - String xx=df.format(x); - String yy=df.format(y); - String xx2=df.format(x2); - String yy2= df.format(y2); - if(i>0){ - stringBuffer.append("\n"); - } - i++; - stringBuffer.append("\t\t{\n\t\t\t\"id\": "+ config1.getId() +",\n"); - stringBuffer.append("\t\t\t\"crocodile_algo\":\"" + algorithm + "\",\n"); - stringBuffer.append("\t\t\t\"meter_id\": \"" + config1.getConfigId() + "\",\n"); - stringBuffer.append("\t\t\t\"meter_type\": \"" + meterType + "\",\n"); - stringBuffer.append("\t\t\t\"bbox\": [" + xx + "," + yy + "," + xx2 + "," + yy2 + "],\n"); - if (config1.getConfigType().equals("1")) { - List> meterZz=focalLengthConfig.getMeterZz(); - List doubleList=new ArrayList<>(); - for(Map map:meterZz){ - doubleList.add(Double.valueOf(map.get("bfb"))); - doubleList.add(Double.valueOf(map.get("zzwz"))); - } - stringBuffer.append("\t\t\t\"num_needles\": " + focalLengthConfig.getZzsl() + ",\n"); - stringBuffer.append("\t\t\t\"needle_seg\": \"" + focalLengthConfig.getNeedleSeg() + "\",\n"); - stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); - stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); - stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); - stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); - stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); - stringBuffer.append("\t\t\t},\n"); - stringBuffer.append("\t\t\t\"scales\": "+ Arrays.toString(doubleList.toArray())+"\n\t\t},"); - } else if(config1.getConfigType().equals("2")) { - stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); - stringBuffer.append("\t\t\t\t").append("\"type\": \"int32\",\n"); - stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); - stringBuffer.append("\t\t\t\t").append("\"num_register\": 1\n"); - stringBuffer.append("\t\t\t},\n"); - stringBuffer.append("\t\t\t").append("\"prior\": {\n"); - stringBuffer.append("\t\t\t\t").append("\"invalid_chars\": \""+focalLengthConfig.getInvalidChars()+"\",\n"); - stringBuffer.append("\t\t\t\t").append("\"expected_len\":"+focalLengthConfig.getExpectedLen()+",\n"); - stringBuffer.append("\t\t\t\t\"padding\":\"0\",\n"); - stringBuffer.append("\t\t\t\t\"append_from\":\"head\",\n"); - stringBuffer.append("\t\t\t\t\"shorten_from\":\"tail\"\n"); - stringBuffer.append("\t\t\t},\n"); - stringBuffer.append("\t\t\t\"scales\": [0.0,0.0,1.0,5.0]\n\t\t},"); - } else if(config1.getConfigType().equals("5")){ - String lighting = "uniform"; - if(focalLengthConfig.getGb().equals("1")){ - lighting = "blob"; - } - stringBuffer.append("\t\t\t\"lighting\": \"" + lighting + "\",\n"); - stringBuffer.append("\t\t\t\"blob_gap\": "+ focalLengthConfig.getGbcs() + ",\n"); - stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); - stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); - stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); - stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); - stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); - stringBuffer.append("\t\t\t}\n}\t\t\n"); - }else if(config1.getConfigType().equals("4")){ - stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); - stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); - stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); - stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); - stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); - stringBuffer.append("\t\t\t}\n}\t\t\n"); - } - - j+=10; - } - int rotate = focalLengthConfig.getRotate(); - if(rotate>0){ - rotate = ((~rotate)+1); - }else{ - rotate = Math.abs(rotate); - } - stringBuffer.deleteCharAt(stringBuffer.length() - 1); - stringBuffer.append("\n"); - stringBuffer.append("\t],\n"); - stringBuffer.append("\t\"imaging\": {\n"); - stringBuffer.append("\t\t\"geometry\": {\n"); - stringBuffer.append("\t\t\t\"angle\": "+rotate+",\n"); - stringBuffer.append("\t\t\t\"scale\": 1.0,\n"); - stringBuffer.append("\t\t\t\"x\": 0.5,\n"); - stringBuffer.append("\t\t\t\"y\": 0.5\n"); - stringBuffer.append("\t\t}\n"); - stringBuffer.append("\t},\n"); - stringBuffer.append("\t\"storage\": {\n"); - stringBuffer.append("\t\t\"sdcard\": 30.0\n"); - stringBuffer.append("\t},\n"); - stringBuffer.append("\t\"light\": {\n"); - stringBuffer.append("\t\t\"brightness\": 0.5\n"); - stringBuffer.append("\t}\n"); - stringBuffer.append("}"); - FileWriter writer = new FileWriter(file.getAbsoluteFile()); - BufferedWriter writer1 = new BufferedWriter(writer); - writer1.write(stringBuffer.toString()); - writer1.close(); - AdbUtil.pushConfigFile("D:\\images\\path\\config","/oem/wanwu/data/"); +// MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId()) ; +// DeviceCamera device=deviceCameraService.getById(meterConfig.getCameraId()); +// QueryWrapper query=new QueryWrapper<>(); +// query.eq("camera_id",meterConfig.getCameraId()); +// List list=meterConfigService.list(query); +// List meters=list.stream().map(n->n.getId()).collect(Collectors.toList()); +// QueryWrapper query1=new QueryWrapper<>(); +// query1.in("config_id",meters); +// List lists=focalLengthConfigService.list(query1); +// +// if(focalLengthConfig.getRotate() == null){ +// focalLengthConfig.setRotate(0); +// } +// BufferedImage bufferedImage=Files.bytesTobufferedImage(config.getFocalPicture()); +// int width=bufferedImage.getWidth(); +// int height=bufferedImage.getHeight(); +// File file = new File("D:\\images\\path\\config"); +// if (!file.getParentFile().exists()) { +// file.getParentFile().mkdirs(); +// } +// DecimalFormat df = new DecimalFormat("#0.00000"); +// if(file.exists()){ +// file.delete(); +// } +// String deviceType=""; +// if(device.getDeviceType().equals("1")){ +// deviceType="usb"; +// }else if(device.getDeviceType().equals("2")){ +// deviceType="mipi"; +// }else{ +// return Result.OK("保存成功!"); +// } +// file.createNewFile(); +// StringBuffer stringBuffer = new StringBuffer(); +// stringBuffer.append("{\n"); +// stringBuffer.append("\t\"device_id\": \"" + meterConfig.getCameraId() + "\",\n"); +// stringBuffer.append("\t\"device_name\": \""+device.getDeviceModel()+"\",\n"); +// stringBuffer.append("\t\"camera_type\": \""+deviceType+"\",\n");//mipi设设一体 usb usb摄像头 +// stringBuffer.append("\t\"interval\": 60,\n"); +// stringBuffer.append("\t\"warmup\": 150,\n");//对焦时间 +// stringBuffer.append("\t\"http\": {\n");//url +// stringBuffer.append("\t\t\"url\": \"http://192.168.1.252:8081/dataAnalysisCamera/getComer\"\n"); +// stringBuffer.append("\t},\n"); +// //stringBuffer.append("\t\"url\": null,\n"); +// stringBuffer.append("\t\"meters\": [\n"); +// int i=0; +// int j=0; +// for (FocalLengthConfig config1 : lists) { +// String meterType=config1.getConfigType(); +// String algorithm="CrocodileCircle"; +// if(meterType.equals("1")){ +// meterType="crocodile"; +// }else if(meterType.equals("2")){ +// meterType="floatocr"; +// }else if(meterType.equals("3")){ +// meterType="swmet"; +// }else if(meterType.equals("5")){ +// meterType = "crocodile_non_scale"; +// }else if(meterType.equals("4")){ +// meterType = "crocodile_watershed"; +// } +// if(config1.getAlgorithm() ==null || config1.getAlgorithm()==0){ +// algorithm="CrocodileCircle"; +// }else{ +// algorithm="CrocodileEllipse"; +// } +// double x=config1.getCopperX()/width; +// double y=config1.getCopperY()/height; +// double x2=config1.getCopperX2()/width; +// double y2=config1.getCopperY2()/height; +// String xx=df.format(x); +// String yy=df.format(y); +// String xx2=df.format(x2); +// String yy2= df.format(y2); +// if(i>0){ +// stringBuffer.append("\n"); +// } +// i++; +// stringBuffer.append("\t\t{\n\t\t\t\"id\": "+ config1.getId() +",\n"); +// stringBuffer.append("\t\t\t\"crocodile_algo\":\"" + algorithm + "\",\n"); +// stringBuffer.append("\t\t\t\"meter_id\": \"" + config1.getConfigId() + "\",\n"); +// stringBuffer.append("\t\t\t\"meter_type\": \"" + meterType + "\",\n"); +// stringBuffer.append("\t\t\t\"bbox\": [" + xx + "," + yy + "," + xx2 + "," + yy2 + "],\n"); +// if (config1.getConfigType().equals("1")) { +// List> meterZz=focalLengthConfig.getMeterZz(); +// List doubleList=new ArrayList<>(); +// for(Map map:meterZz){ +// doubleList.add(Double.valueOf(map.get("bfb"))); +// doubleList.add(Double.valueOf(map.get("zzwz"))); +// } +// stringBuffer.append("\t\t\t\"num_needles\": " + focalLengthConfig.getZzsl() + ",\n"); +// stringBuffer.append("\t\t\t\"needle_seg\": \"" + focalLengthConfig.getNeedleSeg() + "\",\n"); +// stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); +// stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); +// stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); +// stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); +// stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); +// stringBuffer.append("\t\t\t},\n"); +// stringBuffer.append("\t\t\t\"scales\": "+ Arrays.toString(doubleList.toArray())+"\n\t\t},"); +// } else if(config1.getConfigType().equals("2")) { +// stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); +// stringBuffer.append("\t\t\t\t").append("\"type\": \"int32\",\n"); +// stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); +// stringBuffer.append("\t\t\t\t").append("\"num_register\": 1\n"); +// stringBuffer.append("\t\t\t},\n"); +// stringBuffer.append("\t\t\t").append("\"prior\": {\n"); +// stringBuffer.append("\t\t\t\t").append("\"invalid_chars\": \""+focalLengthConfig.getInvalidChars()+"\",\n"); +// stringBuffer.append("\t\t\t\t").append("\"expected_len\":"+focalLengthConfig.getExpectedLen()+",\n"); +// stringBuffer.append("\t\t\t\t\"padding\":\"0\",\n"); +// stringBuffer.append("\t\t\t\t\"append_from\":\"head\",\n"); +// stringBuffer.append("\t\t\t\t\"shorten_from\":\"tail\"\n"); +// stringBuffer.append("\t\t\t},\n"); +// stringBuffer.append("\t\t\t\"scales\": [0.0,0.0,1.0,5.0]\n\t\t},"); +// } else if(config1.getConfigType().equals("5")){ +// String lighting = "uniform"; +// if(focalLengthConfig.getGb().equals("1")){ +// lighting = "blob"; +// } +// stringBuffer.append("\t\t\t\"lighting\": \"" + lighting + "\",\n"); +// stringBuffer.append("\t\t\t\"blob_gap\": "+ focalLengthConfig.getGbcs() + ",\n"); +// stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); +// stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); +// stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); +// stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); +// stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); +// stringBuffer.append("\t\t\t}\n}\t\t\n"); +// }else if(config1.getConfigType().equals("4")){ +// stringBuffer.append("\t\t\t").append("\"modbus\": {\n"); +// stringBuffer.append("\t\t\t\t").append("\"type\": \"float\",\n"); +// stringBuffer.append("\t\t\t\t\"register_address\":" + j + ",\n"); +// stringBuffer.append("\t\t\t\t").append("\"num_register\": 2,\n"); +// stringBuffer.append("\t\t\t\t").append("\"multiplier\": 10000.0\n"); +// stringBuffer.append("\t\t\t}\n}\t\t\n"); +// } +// +// j+=10; +// } +// int rotate = focalLengthConfig.getRotate(); +// if(rotate>0){ +// rotate = ((~rotate)+1); +// }else{ +// rotate = Math.abs(rotate); +// } +// stringBuffer.deleteCharAt(stringBuffer.length() - 1); +// stringBuffer.append("\n"); +// stringBuffer.append("\t],\n"); +// stringBuffer.append("\t\"imaging\": {\n"); +// stringBuffer.append("\t\t\"geometry\": {\n"); +// stringBuffer.append("\t\t\t\"angle\": "+rotate+",\n"); +// stringBuffer.append("\t\t\t\"scale\": 1.0,\n"); +// stringBuffer.append("\t\t\t\"x\": 0.5,\n"); +// stringBuffer.append("\t\t\t\"y\": 0.5\n"); +// stringBuffer.append("\t\t}\n"); +// stringBuffer.append("\t},\n"); +// stringBuffer.append("\t\"storage\": {\n"); +// stringBuffer.append("\t\t\"sdcard\": 30.0\n"); +// stringBuffer.append("\t},\n"); +// stringBuffer.append("\t\"light\": {\n"); +// stringBuffer.append("\t\t\"brightness\": 0.5\n"); +// stringBuffer.append("\t}\n"); +// stringBuffer.append("}"); +// FileWriter writer = new FileWriter(file.getAbsoluteFile()); +// BufferedWriter writer1 = new BufferedWriter(writer); +// writer1.write(stringBuffer.toString()); +// writer1.close(); +// AdbUtil.pushConfigFile("D:\\images\\path\\config","/oem/wanwu/data/"); return Result.OK("保存成功!"); } @@ -245,7 +245,9 @@ public class FocalLengthConfigController { DeviceCamera deviceCamera = deviceCameraService.getById(meterConfig.getCameraId()); BufferedImage bufferedImage=null; if(deviceCamera.getDeviceType().equals("1")|| deviceCamera.getDeviceType().equals("2")){ - bufferedImage= AdbUtil.getCamDevice(); + //bufferedImage= AdbUtil.getCamDevice(); + String buffered =FileUtil.uploadImage(deviceCamera.getDeviceIp(),meterConfig.getId(),deviceCamera.getDeviceIp()); + bufferedImage = Files.urlByImage(buffered); } if(deviceCamera.getDeviceType().equals("3") || deviceCamera.getDeviceType().equals("4")){ // 拉取球机 bufferedImage= HkComUtil.getBole(deviceCamera); diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterInitializationController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterInitializationController.java index fcb6e9b..c886595 100644 --- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterInitializationController.java +++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterInitializationController.java @@ -40,8 +40,6 @@ import java.awt.image.BufferedImage; @RequestMapping("/meterInitialization") @RequiredArgsConstructor public class MeterInitializationController { - @Value("${upLoad.file}") - private String uploadDir; private final MeterConfigService meterConfigService; diff --git a/device_cars/src/main/resources/application-dev.yml b/device_cars/src/main/resources/application-dev.yml index df32622..a86a2b4 100644 --- a/device_cars/src/main/resources/application-dev.yml +++ b/device_cars/src/main/resources/application-dev.yml @@ -62,10 +62,10 @@ swagger: analysis: url: http://192.168.1.123:9000/vi/syncrec -upLoad: - path: D:\\images\\images\\ - url: http://localhost:85/upload/ - file: D:\\images\\images\\ +upload: + img: + url: http://192.168.1.83:18081/file/img/zs/ + path: D:\\service\\fileService\\img\\zs\\ python: path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe modelPath: D:\\smartGrid\\smartGrid\\models diff --git a/device_cars/src/main/resources/application-prod.yml b/device_cars/src/main/resources/application-prod.yml index 9ba8158..c5a8db5 100644 --- a/device_cars/src/main/resources/application-prod.yml +++ b/device_cars/src/main/resources/application-prod.yml @@ -62,10 +62,10 @@ swagger: analysis: url: http://192.168.1.123:9000/vi/syncrec -upLoad: - path: D:\\images\\images\\ - url: http://localhost:85/upload/ - file: D:\\images\\images\\ +upload: + img: + url: http://192.168.1.94:18081/file/img/zs/ + path: E:\\service\\fileService\\img\\zs\\ python: path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe modelPath: D:\\smartGrid\\smartGrid\\models diff --git a/device_cars/src/main/resources/application.yml b/device_cars/src/main/resources/application.yml index c854e41..8d7945b 100644 --- a/device_cars/src/main/resources/application.yml +++ b/device_cars/src/main/resources/application.yml @@ -2,7 +2,7 @@ spring: profiles: #active: dev #开发环境 # active: test #测试环境5 - active: prod #生产环境 + active: dev #生产环境 # active: prod #生产环境 application: name: deviceCars diff --git a/device_gateway/pom.xml b/device_gateway/pom.xml index 51fa099..36975dc 100644 --- a/device_gateway/pom.xml +++ b/device_gateway/pom.xml @@ -13,7 +13,7 @@ device-gateway device-gateway - 8 + 1.8 @@ -63,6 +63,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java index 9b0ff9b..978f2b5 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java @@ -1,6 +1,7 @@ package com.xr.iec61850clent; import com.xr.iec61850clent.models.iec61850run.Iec61850clent; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -8,6 +9,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -16,6 +18,8 @@ import java.util.concurrent.Executors; @EnableAsync//开启异步 @EnableDiscoveryClient @EnableFeignClients +@EnableScheduling//开启定时任务 +@MapperScan("com.xr.iec61850clent.models.mapper") public class Iec61850ClentApplication implements CommandLineRunner { public static ExecutorService executor = Executors.newFixedThreadPool(2); @@ -30,8 +34,8 @@ public class Iec61850ClentApplication implements CommandLineRunner { @Override @Async public void run(String[] args){ - Iec61850clent iec61850clent=new Iec61850clent(args,"192.168.1.93",102); - executor.execute(iec61850clent); + //Iec61850clent iec61850clent=new Iec61850clent(args,"192.168.1.93",102); + //executor.execute(iec61850clent); // Iec61850clent iec61850clent1=new Iec61850clent(args,"192.168.1.138",102); // executor.submit(iec61850clent1); } diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/configvalue/StaticProperties.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/configvalue/StaticProperties.java index f216b27..0d0f329 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/configvalue/StaticProperties.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/configvalue/StaticProperties.java @@ -2,6 +2,7 @@ package com.xr.iec61850clent.common.configvalue; import lombok.Data; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; @Component diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/IEC61850Config.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/IEC61850Config.java index 925d529..a913776 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/IEC61850Config.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/IEC61850Config.java @@ -83,6 +83,15 @@ public class IEC61850Config { Cell cell7 = row.getCell(7); cell1.setCellType(Cell.CELL_TYPE_STRING); excelConfig.setMsg(getCellValue(wb, cell7)); + + Cell cell8 = row.getCell(8); + cell1.setCellType(Cell.CELL_TYPE_STRING); + excelConfig.setClientIp(getCellValue(wb,cell8)); + + Cell cell9 = row.getCell(9); + cell1.setCellType(Cell.CELL_TYPE_STRING); + excelConfig.setMeterId(getCellValue(wb,cell9)); + dataList.add(excelConfig); } } catch (Exception e) { diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java index e1d309b..94be39c 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java @@ -32,6 +32,8 @@ public class ModeUtil { lds5000.setClentIp(eunm.getDeviceIp()); lds5000.setNode(node.getReference().toString()); lds5000.setFc(node.getFc().toString()); + lds5000.setMeterId(eunm.getMeterId()); + lds5000.setClientIp(eunm.getClientIp()); List modelNodes=new ArrayList(node.getChildren()); for (ModelNode modelNode:modelNodes){ FcModelNode fcModelNode=(FcModelNode) modelNode; diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/UploadUtil.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/UploadUtil.java index 15dafbd..ce72cd2 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/UploadUtil.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/UploadUtil.java @@ -3,6 +3,8 @@ package com.xr.iec61850clent.common.util; import org.apache.poi.ss.usermodel.Workbook; import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; @@ -38,10 +40,10 @@ public class UploadUtil { String month = dates[1]; String day = dates[2]; String ho = dates[3]; - String fullPath = StaticPropUtil.imgUrl+configId + File.separator + year + File.separator + month + File.separator + day + File.separator +ho+File.separator+ fileName; + String fullPath = StaticPropUtil.imgPath+configId + File.separator + year + File.separator + month + File.separator + day + File.separator +ho+File.separator+ fileName; // 创建目录结构 - Path directoryPath = Paths.get(StaticPropUtil.imgUrl,configId.toString(), year, month, day,ho); + Path directoryPath = Paths.get(StaticPropUtil.imgPath,configId.toString(), year, month, day,ho); if (!java.nio.file.Files.exists(directoryPath)) { java.nio.file.Files.createDirectories(directoryPath); } @@ -53,6 +55,39 @@ public class UploadUtil { return url1; } + public static String uploadImage(BufferedImage buffer,Integer configId,String fileName) throws Exception { + // 构建完整的路径 + SimpleDateFormat sim=new SimpleDateFormat("yyyy-MM-dd-HH"); + String date = sim.format(new Date()); + String dates[] = date.split("-"); + + String year = dates[0]; + String month = dates[1]; + String day = dates[2]; + String ho = dates[3]; + String fullPath = StaticPropUtil.imgPath+configId + File.separator + year + File.separator + month + File.separator + day + File.separator +ho+File.separator+ fileName; + + // 创建目录结构 + Path directoryPath = Paths.get(StaticPropUtil.imgPath,configId.toString(), year, month, day,ho); + if (!java.nio.file.Files.exists(directoryPath)) { + java.nio.file.Files.createDirectories(directoryPath); + } + + downloadImage(buffer,fullPath); + + // 构建URL + String url1 = StaticPropUtil.imgUrl+ configId + "/" + year + "/"+ month + "/" + day + "/" +ho+"/"+ fileName; + return url1; + } + + + public static BufferedImage urlByImage(String url) throws IOException { + URL urlfile = new URL(url); + InputStream is2 = urlfile.openStream(); + BufferedImage uImg= ImageIO.read(is2); + return uImg; + } + public static void delFile(String path,String url,String fileUrl){ String filePath = fileUrl.replace(url,path).replace("/","\\"); File file = new File(filePath); @@ -73,4 +108,79 @@ public class UploadUtil { } } + public static void downloadImage(BufferedImage bufferedImage, String destinationPath) throws IOException { + File file = new File(destinationPath); + ImageIO.write(bufferedImage,"jpg",file); + } + + public static BufferedImage drawRectangleAndText(BufferedImage image, double x1, double y1,double x2, double wid, double hei, String text1, String text2) { + // 创建一个Graphics2D对象 + Graphics2D g2d = image.createGraphics(); + + + // 设置抗锯齿 + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + + // 创建一个Rectangle2D.Double对象 + Rectangle2D.Double rect = new Rectangle2D.Double(x1, y1, wid, hei); + + // 绘制红色框 + g2d.setColor(Color.RED); + g2d.draw(rect); + // 设置粗线条 + g2d.setStroke(new BasicStroke(3.0f * 30)); // 设置线条宽度为3.0f + + // 设置字体和颜色 + g2d.setFont(new Font("微软雅黑", Font.BOLD, 38)); // 使用支持中文的字体,增加字体大小 + + // 获取当前时间 + String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); + // 获取文本的宽度和高度 + FontMetrics fm = g2d.getFontMetrics(); + + // 绘制当前时间的背景矩形 + int padding = 20; + int currentTimeWidth = fm.stringWidth(currentTime); + int currentTimeHeight = fm.getHeight(); + int rectPadding = 5; // 背景矩形内边距 + g2d.setColor(new Color(0, 0, 0, 50)); // 黑色半透明背景 + g2d.fillRect(padding, padding, currentTimeWidth + 2 * rectPadding, currentTimeHeight + 2 * rectPadding); + + // 绘制当前时间在左上角,内边距为20px + g2d.setColor(Color.WHITE); + int currentTimeX = padding + rectPadding + (currentTimeWidth + rectPadding - currentTimeWidth) / 2; + int currentTimeY = padding + rectPadding + fm.getAscent(); + g2d.drawString(currentTime, currentTimeX, currentTimeY); + + // 绘制文本2的背景矩形 + int text2Width = fm.stringWidth(text2); + int text2Height = fm.getHeight(); + g2d.setColor(new Color(0, 0, 0, 50)); // 黑色半透明背景 + g2d.fillRect(padding, padding + currentTimeHeight + rectPadding * 2, text2Width + 2 * rectPadding, text2Height + 2 * rectPadding); + + // 绘制文本2在时间的下面,内边距为20px + g2d.setColor(Color.WHITE); + int text2X = padding + rectPadding + (text2Width + rectPadding - text2Width) / 2; + int text2Y = padding + currentTimeHeight + rectPadding * 3 + fm.getAscent(); + g2d.drawString(text2, text2X, text2Y); + + // 计算文本1的右上角位置 + int text1Width = fm.stringWidth(text1); + int text1X = (int) (x1 + wid); // 框的右上角位置 + int text1Y = (int) (y1 + fm.getAscent()); // 框的右上角紧挨着框 + g2d.setColor(Color.RED); + + g2d.drawString(text1, text1X, text1Y); + + + // 释放资源 + g2d.dispose(); + + return image; + } + + + + } diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/DeviceCamera.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/DeviceCamera.java new file mode 100644 index 0000000..c1f0db7 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/DeviceCamera.java @@ -0,0 +1,127 @@ +package com.xr.iec61850clent.models.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 摄像头管理 + * + * @TableName device_camera + */ +@TableName(value = "device_camera") +@Data +public class DeviceCamera implements Serializable { + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 摄像头编号 + */ + private String deviceNo; + + /** + * 类型(1 usb 2 mipi 3 球机 4 枪机) + */ + private String deviceType; + + /** + * IP + */ + private String deviceIp; + + /** + * 端口 + */ + private String devicePort; + + /** + * 账号 + */ + private String account; + + /** + * 密码 + */ + private String password; + + private String x; + + private String y; + + private String z; + + /** + * 摄像头型号 + */ + private String deviceModel; + + /** + * 安装位置 + */ + private String position; + + /** + * 品牌 + */ + private String brand; + + /** + * 备注 + */ + private String remarks; + + /** + * 状态(0未使用 1已使用) + */ + private String status; + + /** + * 创建人 + */ + private String createUser; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改人 + */ + private String updateUser; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 传输间隔 + */ + private Integer transmissionInterval; + + /** + * 对焦时间 + */ + private Integer warmup; + + @TableField(exist = false) + private List ids; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + /** + * 算法类型 + */ + @TableField(exist = false) + private String algorithmType; +} \ No newline at end of file diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/ExcelConfig.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/ExcelConfig.java index 368b025..60f485d 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/ExcelConfig.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/ExcelConfig.java @@ -21,4 +21,8 @@ public class ExcelConfig { private String msg; + private String meterId; + + private String clientIp; + } diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/FocalLengthConfig.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/FocalLengthConfig.java new file mode 100644 index 0000000..b722199 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/FocalLengthConfig.java @@ -0,0 +1,260 @@ +package com.xr.iec61850clent.models.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * + * @TableName focal_length_config + */ +@TableName(value ="focal_length_config") +@Data +public class FocalLengthConfig implements Serializable { + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 表计配置编号 + */ + private Integer configId; + + /** + * 焦距名称 + */ + private String focalName; + + /** + * 焦距tabs下标 + */ + private String focalIndex; + + /** + * 截图框宽 + */ + private Double copperWid; + + /** + * 截图框高 + */ + private Double copperHei; + + /** + * + */ + private Double copperX; + + /** + * + */ + private Double copperY; + + /** + * + */ + private Double copperX2; + + /** + * + */ + private Double copperY2; + + /** + * clock 1指针表计,2数字表计,3状态类 + */ + private String configType; + + /** + * 表计范围起 + */ + private Double meterMin; + + /** + * + */ + private Double meterMax; + + private Double scale; + + /** + * 旋转角度 + */ + private Integer rotate; + + /** + * 状态类状态数量 + */ + private Integer stateNum; + + /** + * 保存状态类多个状态的结果集 + */ + private String parameter; + + /** + * 解析得测试结果 + */ + private String result; + + /** + * 算法:0圆形表计1扇形表计 + */ + private Integer algorithm; + + /** + * 创建人 + */ + private String createUser; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改人 + */ + private String updateUser; + + @TableField(exist = false) + private String gb; + + @TableField(exist = false) + private String gbcs; + + @TableField(exist = false) + private Integer zzsl; + + @TableField(exist = false) + private String needleSeg; + + @TableField(exist = false) + private String invalidChars; + + @TableField(exist = false) + private Integer expectedLen; + + /** + * 修改时间 + */ + private Date updateTime; + @TableField(exist = false) + private List> meterZz; + + /** + * 焦距图片 + */ + private byte[] focalPicture; + + @TableField(exist = false) + private String basePicture; + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + FocalLengthConfig other = (FocalLengthConfig) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getConfigId() == null ? other.getConfigId() == null : this.getConfigId().equals(other.getConfigId())) + && (this.getFocalName() == null ? other.getFocalName() == null : this.getFocalName().equals(other.getFocalName())) + && (this.getFocalIndex() == null ? other.getFocalIndex() == null : this.getFocalIndex().equals(other.getFocalIndex())) + && (this.getCopperWid() == null ? other.getCopperWid() == null : this.getCopperWid().equals(other.getCopperWid())) + && (this.getCopperHei() == null ? other.getCopperHei() == null : this.getCopperHei().equals(other.getCopperHei())) + && (this.getCopperX() == null ? other.getCopperX() == null : this.getCopperX().equals(other.getCopperX())) + && (this.getCopperY() == null ? other.getCopperY() == null : this.getCopperY().equals(other.getCopperY())) + && (this.getConfigType() == null ? other.getConfigType() == null : this.getConfigType().equals(other.getConfigType())) + && (this.getMeterMin() == null ? other.getMeterMin() == null : this.getMeterMin().equals(other.getMeterMin())) + && (this.getMeterMax() == null ? other.getMeterMax() == null : this.getMeterMax().equals(other.getMeterMax())) + && (this.getRotate() == null ? other.getRotate() == null : this.getRotate().equals(other.getRotate())) + && (this.getStateNum() == null ? other.getStateNum() == null : this.getStateNum().equals(other.getStateNum())) + && (this.getParameter() == null ? other.getParameter() == null : this.getParameter().equals(other.getParameter())) + && (this.getResult() == null ? other.getResult() == null : this.getResult().equals(other.getResult())) + && (this.getAlgorithm() == null ? other.getAlgorithm() == null : this.getAlgorithm().equals(other.getAlgorithm())) + && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser())) + && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) + && (this.getUpdateUser() == null ? other.getUpdateUser() == null : this.getUpdateUser().equals(other.getUpdateUser())) + && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) + && (Arrays.equals(this.getFocalPicture(), other.getFocalPicture())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getConfigId() == null) ? 0 : getConfigId().hashCode()); + result = prime * result + ((getFocalName() == null) ? 0 : getFocalName().hashCode()); + result = prime * result + ((getFocalIndex() == null) ? 0 : getFocalIndex().hashCode()); + result = prime * result + ((getCopperWid() == null) ? 0 : getCopperWid().hashCode()); + result = prime * result + ((getCopperHei() == null) ? 0 : getCopperHei().hashCode()); + result = prime * result + ((getCopperX() == null) ? 0 : getCopperX().hashCode()); + result = prime * result + ((getCopperY() == null) ? 0 : getCopperY().hashCode()); + result = prime * result + ((getConfigType() == null) ? 0 : getConfigType().hashCode()); + result = prime * result + ((getMeterMin() == null) ? 0 : getMeterMin().hashCode()); + result = prime * result + ((getMeterMax() == null) ? 0 : getMeterMax().hashCode()); + result = prime * result + ((getRotate() == null) ? 0 : getRotate().hashCode()); + result = prime * result + ((getStateNum() == null) ? 0 : getStateNum().hashCode()); + result = prime * result + ((getParameter() == null) ? 0 : getParameter().hashCode()); + result = prime * result + ((getResult() == null) ? 0 : getResult().hashCode()); + result = prime * result + ((getAlgorithm() == null) ? 0 : getAlgorithm().hashCode()); + result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode()); + result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); + result = prime * result + ((getUpdateUser() == null) ? 0 : getUpdateUser().hashCode()); + result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); + result = prime * result + (Arrays.hashCode(getFocalPicture())); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", configId=").append(configId); + sb.append(", focalName=").append(focalName); + sb.append(", focalIndex=").append(focalIndex); + sb.append(", copperWid=").append(copperWid); + sb.append(", copperHei=").append(copperHei); + sb.append(", copperX=").append(copperX); + sb.append(", copperY=").append(copperY); + sb.append(", configType=").append(configType); + sb.append(", meterMin=").append(meterMin); + sb.append(", meterMax=").append(meterMax); + sb.append(", rotate=").append(rotate); + sb.append(", stateNum=").append(stateNum); + sb.append(", parameter=").append(parameter); + sb.append(", result=").append(result); + sb.append(", algorithm=").append(algorithm); + sb.append(", createUser=").append(createUser); + sb.append(", createTime=").append(createTime); + sb.append(", updateUser=").append(updateUser); + sb.append(", updateTime=").append(updateTime); + sb.append(", focalPicture=").append(focalPicture); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/Lds5000.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/Lds5000.java index cc43dce..d675e81 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/Lds5000.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/entity/Lds5000.java @@ -63,6 +63,10 @@ public class Lds5000 implements Serializable { */ private String f; + private String meterId; + + private String clientIp; + @TableField(exist = false) private static final long serialVersionUID = 1L; diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850Scheduled.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850Scheduled.java new file mode 100644 index 0000000..f9b09b8 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850Scheduled.java @@ -0,0 +1,301 @@ +package com.xr.iec61850clent.models.iec61850run; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.beanit.iec61850bean.*; +import com.beanit.iec61850bean.internal.cli.*; +import com.xr.iec61850clent.common.util.ModeUtil; +import com.xr.iec61850clent.common.util.SpringUtils; +import com.xr.iec61850clent.common.util.UploadUtil; +import com.xr.iec61850clent.models.entity.*; +import com.xr.iec61850clent.models.service.*; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.*; + +import static java.lang.Thread.sleep; + +@Component +public class Iec61850Scheduled { + + private static final ActionProcessor actionProcessor = new ActionProcessor(new ActionExecutor()); + private static volatile ClientAssociation association; + private static ServerModel serverModel; + private int conner =0; + String[] args = new String[] {"param1", "param2", "param3"}; + + @Scheduled(cron = "0 0/1 * * * ?")//每10分钟执行一次 + public void run(){ + StringCliParameter hostParam = new CliParameterBuilder("-h") .setDescription("要访问的服务器的IP域地址。").buildStringParameter("host","192.168.1.93"); + IntCliParameter portParam = new CliParameterBuilder("-p").setDescription("要连接的端口。").buildIntParameter("port", 102); + StringCliParameter modelFileParam= new CliParameterBuilder("-m").setDescription("要从中读取模型的SCL文件的文件名。如果省略此参数,则在连接后将从服务器设备读取模型。").buildStringParameter("model-file"); + List cliParameters = new ArrayList<>(); + cliParameters.add(hostParam); + cliParameters.add(portParam); + cliParameters.add(modelFileParam); + + CliParser cliParser = + new CliParser( + "iec61850bean-console-client", "用于访问IEC61850 MMS服务器的客户端应用程序。"); + cliParser.addParameters(cliParameters); + +// try { +// cliParser.parseArguments(args); +// } catch (CliParseException e1) { +// System.err.println("分析命令行参数时出错:" + e1.getMessage()); +// System.out.println(cliParser.getUsageString()); +// System.exit(1); +// } + + InetAddress address; + try { + address = InetAddress.getByName(hostParam.getValue()); + } catch (UnknownHostException e) { + System.out.println("未知主机:" + hostParam.getValue()); + return; + } + + ClientSap clientSap = new ClientSap(); + try { + association = clientSap.associate(address, portParam.getValue(), null, new EventListener()); + conner = 0; + } catch (IOException e) { + System.out.println("host"+"第"+(conner+1)+"次无法连接到远程主机。"); + conner++; + try{ + sleep(60000); + }catch (Exception p){ + p.printStackTrace(); + } + run(); + } + + Runtime.getRuntime() + .addShutdownHook( + new Thread() { + @Override + public void run() { + association.close(); + } + }); + + System.out.println("192.168.1.93已成功连接"); + + if (modelFileParam.isSelected()) { + System.out.println("正在从文件中读取模型。。。"); + + try { + serverModel = SclParser.parse(modelFileParam.getValue()).get(0); + } catch (SclParseException e1) { + System.out.println("分析SCL文件时出错: " + e1.getMessage()); + return; + } + + association.setServerModel(serverModel); + + System.out.println("成功读取模型"); + + } else { + System.out.println("正在检索模型。。。"); + + try { + serverModel = association.retrieveModel(); + } catch (ServiceError e) { + System.out.println("服务错误: " + e.getMessage()); + return; + } catch (IOException e) { + System.out.println("致命错误: " + e.getMessage()); + return; + } + + System.out.println("成功读取模型"); + System.out.println(serverModel); + Lds5000Service lds5000Service = SpringUtils.getBean(Lds5000Service.class); + MeterConfigService meterConfigService=SpringUtils.getBean(MeterConfigService.class); + MeterReadingRecordService meterReadingRecordService=SpringUtils.getBean(MeterReadingRecordService.class); + MeterTypeService meterTypeService=SpringUtils.getBean(MeterTypeService.class); + FocalLengthConfigService configService = SpringUtils.getBean(FocalLengthConfigService.class); + DeviceCameraService deviceCameraService = SpringUtils.getBean(DeviceCameraService.class); + try { + DataSet dSet = serverModel.getDataSet("TEMPLATELD0/LLN0.dsMeasureInfo1"); + association.getDataSetValues(dSet); + System.out.println("更新模型成功!"); + System.out.println(Arrays.toString(new Collection[]{serverModel.getDataSets()})); + List dataSets=new ArrayList<>(serverModel.getDataSets()); + for (DataSet dataSet:dataSets){ + List fas=dataSet.getMembers(); + for (FcModelNode node:fas){ + Lds5000 lds5000= ModeUtil.getLdsVlue("192.168.1.93",node); + if(lds5000==null){ + continue; + } + if(lds5000.getClentIp().equals("192.168.1.57")){ + System.out.println("-----------------------"); + } + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("node",lds5000.getNode()); + queryWrapper.eq("clent_ip","192.168.1.93"); + Lds5000 lds=lds5000Service.getOne(queryWrapper); + if (lds != null) { + lds.setUpdateTime(new Date()); + lds.setF(lds5000.getF()); + lds5000Service.updateById(lds); + MeterConfig config=meterConfigService.getById(lds5000.getMeterId()); + QueryWrapper query=new QueryWrapper<>(); + query.eq("config_id",config.getId()); + FocalLengthConfig fa= configService.getOne(query); + if(config!=null){ + String fileName = config.getId()+new Date().getTime()+".jpg"; + String url = "http://"+lds5000.getClientIp()+":8080/tao/snapshot"; + BufferedImage bufferedImage = UploadUtil.urlByImage(url); + MeterType type=meterTypeService.getById(config.getTypeId()); + MeterReadingRecord meterReadingRecord=new MeterReadingRecord(); + meterReadingRecord.setMeterId(config.getId()); + meterReadingRecord.setReadingType(lds5000.getType()); + if(node.getFc().name().equals("MX")){ + String value = "0"; + float f = Float.valueOf(lds5000.getF()); + if(config.getTypeId() == 3 || config.getTypeId() == 5 || config.getTypeId() == 7){//油位计,保留2位小数 + value = String.format("%.2f", f); + } + if(config.getTypeId() == 4 || config.getTypeId() == 11){//开关计数器 + //处理为整数 + int s = (int) f; + value = s+""; + } + if(config.getTypeId() == 8){//档位数据处理 + //处理为整数 + int s = Math.round(f); + if(s>8){ + int t = s-8; + if(t<9){ + value=t+""; + } + if(t == 9){ + value = "9A"; + } + if(t == 10){ + value = "9B"; + } + if(t == 11){ + value = "9C"; + } + if(t>11){ + value = t-2+""; + } + }else { + value=s+""; + } + } + if(config.getTypeId() == 10){//放电计数器 + int s = Math.round(f); + if(s>=10){ + value = 0+""; + } + } + if(config.getIsJz() == 1){ + value = config.getJzVal(); + } + meterReadingRecord.setReadingValue(value); + }else{ + meterReadingRecord.setReadingValue(lds5000.getStVal()); + } + + BufferedImage buffer = UploadUtil.drawRectangleAndText(bufferedImage, + fa.getCopperX(),fa.getCopperY(),fa.getCopperX2(),fa.getCopperWid(),fa.getCopperHei(),meterReadingRecord.getReadingValue(),config.getMeterName()); + String url1 = UploadUtil.uploadImage(buffer,config.getId(),fileName); + meterReadingRecord.setMeterTypeName(type.getTypeAlias()); + meterReadingRecord.setMeterCode(config.getMeterCode()); + meterReadingRecord.setReadingTime(new Date()); + meterReadingRecord.setCreateUser("SYSTEM"); + meterReadingRecord.setCreateTime(new Date()); + meterReadingRecord.setReadingUrl(url1); + meterReadingRecord.setMeterTypeId(config.getTypeId()); + meterReadingRecord.setOwningInterval(config.getOwningInterval()); + if(config.getIsJz()!=1){ + meterReadingRecordService.save(meterReadingRecord); + } + //abnormalReadingJudgment(meterReadingRecord); + } + }else{ + lds5000.setCreateTime(new Date()); + lds5000Service.save(lds5000); + } + } + } + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("is_jz",1); + queryWrapper.eq("status",1); + List meterConfigs = meterConfigService.list(queryWrapper); + for (MeterConfig config:meterConfigs){ + DeviceCamera camera = deviceCameraService.getById(config.getCameraId()); + String fileName = config.getId()+new Date().getTime()+".jpg"; + MeterReadingRecord meterReadingRecord=new MeterReadingRecord(); + meterReadingRecord.setMeterId(config.getId()); + meterReadingRecord.setReadingType(config.getTypeId()); + meterReadingRecord.setReadingTime(new Date()); + meterReadingRecord.setReadingType(2); + meterReadingRecord.setReadingValue(config.getJzVal()); + meterReadingRecord.setMeterTypeName(""); + meterReadingRecord.setMeterCode(config.getMeterCode()); + meterReadingRecord.setReadingTime(new Date()); + meterReadingRecord.setCreateUser("SYSTEM"); + meterReadingRecord.setCreateTime(new Date()); + QueryWrapper query=new QueryWrapper<>(); + query.eq("config_id",config.getId()); + FocalLengthConfig fa= configService.getOne(query); + String url2 = "http://"+camera.getDeviceIp()+":8080/tao/snapshot"; + BufferedImage bufferedImage = UploadUtil.urlByImage(url2); + BufferedImage buffer = UploadUtil.drawRectangleAndText(bufferedImage, + fa.getCopperX(),fa.getCopperY(),fa.getCopperX2(),fa.getCopperWid(),fa.getCopperHei(),meterReadingRecord.getReadingValue(),config.getMeterName()); + String url1 = UploadUtil.uploadImage(buffer,config.getId(),fileName); + meterReadingRecord.setReadingUrl(url1); + meterReadingRecord.setMeterTypeId(config.getTypeId()); + meterReadingRecord.setOwningInterval(config.getOwningInterval()); + meterReadingRecordService.save(meterReadingRecord); + } + } catch (Exception e) { + e.printStackTrace(); + } + association.close(); + } + } + + private static class ActionExecutor implements ActionListener { + @Override + public void actionCalled(String actionKey) throws ActionException { + } + @Override + public void quit() { + System.out.println("** 正在关闭连接。"); + association.close(); + } + } + + private static class EventListener implements ClientEventListener { + + @Override + public void newReport(Report report) { + System.out.println("\n----------------"); + System.out.println("收到的报告: "); + System.err.println(report); + System.out.println("------------------"); + } + + @Override + public void associationClosed(IOException e) { + System.out.print("接收到连接关闭信号。原因: "); + if (!e.getMessage().isEmpty()) { + System.out.println(e.getMessage()); + } else { + System.out.println("unknown"); + } + actionProcessor.close(); + } + } + +} diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850clent.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850clent.java index 396f23f..8bf150d 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850clent.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/iec61850run/Iec61850clent.java @@ -14,9 +14,11 @@ import com.xr.iec61850clent.models.entity.*; import com.xr.iec61850clent.models.service.*; import lombok.Data; +import java.awt.image.BufferedImage; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; +import java.nio.file.Files; import java.time.LocalDateTime; import java.util.*; @@ -131,6 +133,8 @@ public class Iec61850clent extends Thread{ MeterConfigService meterConfigService=SpringUtils.getBean(MeterConfigService.class); MeterReadingRecordService meterReadingRecordService=SpringUtils.getBean(MeterReadingRecordService.class); MeterTypeService meterTypeService=SpringUtils.getBean(MeterTypeService.class); + FocalLengthConfigService configService = SpringUtils.getBean(FocalLengthConfigService.class); + DeviceCameraService deviceCameraService = SpringUtils.getBean(DeviceCameraService.class); while (true){ try { DataSet dSet = serverModel.getDataSet("TEMPLATELD0/LLN0.dsMeasureInfo1"); @@ -153,10 +157,14 @@ public class Iec61850clent extends Thread{ lds.setUpdateTime(new Date()); lds.setF(lds5000.getF()); lds5000Service.updateById(lds); - MeterConfig config=meterConfigService.selectNoJzConfig(lds.getId()); + MeterConfig config=meterConfigService.getById(lds5000.getMeterId()); + QueryWrapper query=new QueryWrapper<>(); + query.eq("config_id",config.getId()); + FocalLengthConfig fa= configService.getOne(query); if(config!=null){ String fileName = config.getId()+new Date().getTime()+".jpg"; - String url= UploadUtil.uploadImage(config.getDeviceIp(),config.getId(),fileName); + String url = "http://"+lds5000.getClientIp()+":8080/tao/snapshot"; + BufferedImage bufferedImage = UploadUtil.urlByImage(url); MeterType type=meterTypeService.getById(config.getTypeId()); MeterReadingRecord meterReadingRecord=new MeterReadingRecord(); meterReadingRecord.setMeterId(config.getId()); @@ -174,9 +182,12 @@ public class Iec61850clent extends Thread{ } if(config.getTypeId() == 8){//档位数据处理 //处理为整数 - int s = (int) f; - if(s>7){ - int t = s-7; + int s = Math.round(f); + if(s>8){ + int t = s-8; + if(t<9){ + value=t+""; + } if(t == 9){ value = "9A"; } @@ -206,12 +217,16 @@ public class Iec61850clent extends Thread{ }else{ meterReadingRecord.setReadingValue(lds5000.getStVal()); } + + BufferedImage buffer = UploadUtil.drawRectangleAndText(bufferedImage, + fa.getCopperX(),fa.getCopperY(),fa.getCopperX2(),fa.getCopperWid(),fa.getCopperHei(),meterReadingRecord.getReadingValue(),config.getMeterName()); + String url1 = UploadUtil.uploadImage(buffer,config.getId(),fileName); meterReadingRecord.setMeterTypeName(type.getTypeAlias()); meterReadingRecord.setMeterCode(config.getMeterCode()); meterReadingRecord.setReadingTime(new Date()); meterReadingRecord.setCreateUser("SYSTEM"); meterReadingRecord.setCreateTime(new Date()); - meterReadingRecord.setReadingUrl(url); + meterReadingRecord.setReadingUrl(url1); meterReadingRecord.setMeterTypeId(config.getTypeId()); meterReadingRecord.setOwningInterval(config.getOwningInterval()); if(config.getIsJz()!=1){ @@ -225,10 +240,13 @@ public class Iec61850clent extends Thread{ } } } - List meterConfigs=meterConfigService.selectJzConfig(); + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("is_jz",1); + queryWrapper.eq("status",1); + List meterConfigs = meterConfigService.list(queryWrapper); for (MeterConfig config:meterConfigs){ + DeviceCamera camera = deviceCameraService.getById(config.getCameraId()); String fileName = config.getId()+new Date().getTime()+".jpg"; - String url= UploadUtil.uploadImage(config.getDeviceIp(),config.getId(),fileName); MeterReadingRecord meterReadingRecord=new MeterReadingRecord(); meterReadingRecord.setMeterId(config.getId()); meterReadingRecord.setReadingType(config.getTypeId()); @@ -240,7 +258,15 @@ public class Iec61850clent extends Thread{ meterReadingRecord.setReadingTime(new Date()); meterReadingRecord.setCreateUser("SYSTEM"); meterReadingRecord.setCreateTime(new Date()); - meterReadingRecord.setReadingUrl(url); + QueryWrapper query=new QueryWrapper<>(); + query.eq("config_id",config.getId()); + FocalLengthConfig fa= configService.getOne(query); + String url2 = "http://"+camera.getDeviceIp()+":8080/tao/snapshot"; + BufferedImage bufferedImage = UploadUtil.urlByImage(url2); + BufferedImage buffer = UploadUtil.drawRectangleAndText(bufferedImage, + fa.getCopperX(),fa.getCopperY(),fa.getCopperX2(),fa.getCopperWid(),fa.getCopperHei(),meterReadingRecord.getReadingValue(),config.getMeterName()); + String url1 = UploadUtil.uploadImage(buffer,config.getId(),fileName); + meterReadingRecord.setReadingUrl(url1); meterReadingRecord.setMeterTypeId(config.getTypeId()); meterReadingRecord.setOwningInterval(config.getOwningInterval()); meterReadingRecordService.save(meterReadingRecord); diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/DeviceCameraMapper.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/DeviceCameraMapper.java new file mode 100644 index 0000000..db3ffe4 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/DeviceCameraMapper.java @@ -0,0 +1,25 @@ +package com.xr.iec61850clent.models.mapper; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.xr.iec61850clent.models.entity.DeviceCamera; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** +* @author admin +* @description 针对表【device_camera(摄像头管理)】的数据库操作Mapper +* @createDate 2023-02-21 11:22:23 +* @Entity com.xr.device_car.modules.analysis.entity.DeviceCamera +*/ +@DS("db2") +@Mapper +public interface DeviceCameraMapper extends BaseMapper { +} + + + + diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/FocalLengthConfigMapper.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/FocalLengthConfigMapper.java new file mode 100644 index 0000000..ae6a3fc --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/FocalLengthConfigMapper.java @@ -0,0 +1,20 @@ +package com.xr.iec61850clent.models.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.xr.iec61850clent.models.entity.FocalLengthConfig; +import org.apache.ibatis.annotations.Mapper; + +/** +* @author asus +* @description 针对表【focal_length_config】的数据库操作Mapper +* @createDate 2023-03-08 17:05:15 +* @Entity com.xr.device_car.modules.analysis.entity.FocalLengthConfig +*/ +@Mapper +public interface FocalLengthConfigMapper extends BaseMapper { + +} + + + + diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/MeterConfigMapper.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/MeterConfigMapper.java index 36e5ca7..2073c48 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/MeterConfigMapper.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/mapper/MeterConfigMapper.java @@ -12,7 +12,7 @@ import java.util.List; @Mapper public interface MeterConfigMapper extends BaseMapper { - List selectJzConfig(); + List selectConfig(); MeterConfig selectNoJzConfig(Integer ids5000Id); diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/DeviceCameraService.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/DeviceCameraService.java new file mode 100644 index 0000000..11fa190 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/DeviceCameraService.java @@ -0,0 +1,14 @@ +package com.xr.iec61850clent.models.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.xr.iec61850clent.models.entity.DeviceCamera; + +import java.util.List; + +/** +* @author admin +* @description 针对表【device_camera(摄像头管理)】的数据库操作Service +* @createDate 2023-02-21 11:22:23 +*/ +public interface DeviceCameraService extends IService { +} diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/FocalLengthConfigService.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/FocalLengthConfigService.java new file mode 100644 index 0000000..04189bd --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/FocalLengthConfigService.java @@ -0,0 +1,18 @@ +package com.xr.iec61850clent.models.service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.xr.iec61850clent.models.entity.FocalLengthConfig; + +import java.util.List; + +/** +* @author asus +* @description 针对表【focal_length_config】的数据库操作Service +* @createDate 2023-03-08 17:05:15 +*/ +public interface FocalLengthConfigService extends IService { + + List getImgFocalList(QueryWrapper queryWrappe); + +} diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/DeviceCameraServiceImpl.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/DeviceCameraServiceImpl.java new file mode 100644 index 0000000..9031b7d --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/DeviceCameraServiceImpl.java @@ -0,0 +1,24 @@ +package com.xr.iec61850clent.models.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.xr.iec61850clent.models.entity.DeviceCamera; +import com.xr.iec61850clent.models.mapper.DeviceCameraMapper; +import com.xr.iec61850clent.models.service.DeviceCameraService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author admin + * @description 针对表【device_camera(摄像头管理)】的数据库操作Service实现 + * @createDate 2023-02-21 11:22:23 + */ +@Service +@DS("db2") +public class DeviceCameraServiceImpl extends ServiceImpl implements DeviceCameraService { +} + + + + diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/FocalLengthConfigServiceImpl.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/FocalLengthConfigServiceImpl.java new file mode 100644 index 0000000..89a6f10 --- /dev/null +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/FocalLengthConfigServiceImpl.java @@ -0,0 +1,43 @@ +package com.xr.iec61850clent.models.service.impl; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.xr.iec61850clent.models.entity.FocalLengthConfig; +import com.xr.iec61850clent.models.mapper.FocalLengthConfigMapper; +import com.xr.iec61850clent.models.service.FocalLengthConfigService; +import org.springframework.stereotype.Service; + +import java.util.Base64; +import java.util.List; + +/** +* @author asus +* @description 针对表【focal_length_config】的数据库操作Service实现 +* @createDate 2023-03-08 17:05:15 +*/ +@Service +@DS("db2") +public class FocalLengthConfigServiceImpl extends ServiceImpl + implements FocalLengthConfigService { + + @Override + public List getImgFocalList(QueryWrapper queryWrappe) { + List list = ((FocalLengthConfigMapper)this.baseMapper).selectList(queryWrappe); + for(FocalLengthConfig config:list){ + if(config.getFocalPicture()!=null){ + String base64 = Base64.getEncoder().encodeToString(config.getFocalPicture()); + if(base64.contains("data:image/jpg;base64,")){ + config.setBasePicture(base64); + }else{ + config.setBasePicture("data:image/jpg;base64,"+base64); + } + } + } + return list; + } +} + + + + diff --git a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/MeterConfigServiceImpl.java b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/MeterConfigServiceImpl.java index c70637d..13fca70 100644 --- a/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/MeterConfigServiceImpl.java +++ b/device_iec61850clent/src/main/java/com/xr/iec61850clent/models/service/impl/MeterConfigServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xr.iec61850clent.models.entity.MeterConfig; import com.xr.iec61850clent.models.mapper.MeterConfigMapper; import com.xr.iec61850clent.models.service.MeterConfigService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -17,9 +18,12 @@ import java.util.List; public class MeterConfigServiceImpl extends ServiceImpl implements MeterConfigService{ + @Autowired + private MeterConfigMapper mapper; + @Override public List selectJzConfig() { - return ((MeterConfigMapper)this.baseMapper).selectJzConfig(); + return mapper.selectConfig(); } @Override diff --git a/device_iec61850clent/src/main/resources/IEC61850.xlsx b/device_iec61850clent/src/main/resources/IEC61850.xlsx index fa770a2b18fb20854ea88085fb97a70783026885..6de85d60e237b9b0c2d3507024bfcf12d4f73b58 100644 GIT binary patch delta 10547 zcmZ{~2RxPU|37Y1W{4wui$b<+BAd({J1b;ok6ZR$$0kxnwq#^eR<`VULI@%0*yDd6 z(&ydx@%ukqkMlU^KG*BM?(6k>KA*4WecYez``s(DP=SHdmR@mG6clYV6qFk%C@AI* zX6nukjxJng4$c;w9(K=y6W~gpxQV*pnCGDh`vTVcpKeU!W&Zfw)*8O3FK@5^PC;HH&|M%^SxYQ`G#>Vr~%bm(GpO~f(LG`fI6<1YHw zs5oJruXW$DmdGF(FTyzGZ)4>iR%m0#p~+xguW}bs(Kva7FiARop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ec61850clent/src/main/resources/application-dev.yml b/device_iec61850clent/src/main/resources/application-dev.yml index c9d2327..507aa08 100644 --- a/device_iec61850clent/src/main/resources/application-dev.yml +++ b/device_iec61850clent/src/main/resources/application-dev.yml @@ -82,5 +82,5 @@ device: upload: img: - url: http://192.168.1.83:18081/file/img/zs/ + url: http://localhost:18081/file/img/zs/ path: D:\\service\\fileService\\img\\zs\\ \ No newline at end of file diff --git a/device_iec61850clent/src/main/resources/application-prod.yml b/device_iec61850clent/src/main/resources/application-prod.yml index c59bee5..317334c 100644 --- a/device_iec61850clent/src/main/resources/application-prod.yml +++ b/device_iec61850clent/src/main/resources/application-prod.yml @@ -77,9 +77,11 @@ eureka: enabled: true service-url: defaultZone: http://localhost:8084/eureka + device: deviceId: 3 + upload: img: url: http://192.168.1.94:18081/file/img/zs/ - path: D:\\service\\fileService\\img\\zs\\ \ No newline at end of file + path: E:\\service\\fileService\\img\\zs\\ \ No newline at end of file diff --git a/device_iec61850clent/src/main/resources/application.yml b/device_iec61850clent/src/main/resources/application.yml index d378267..c2e7b9c 100644 --- a/device_iec61850clent/src/main/resources/application.yml +++ b/device_iec61850clent/src/main/resources/application.yml @@ -7,7 +7,7 @@ spring: application: name: deviceIec61850clent mybatis-plus: - mapper-locations: classpath:mappers/**/*Mapper.xml + mapper-locations: classpath:mapper/*Mapper.xml type-aliases-package: com.xr.iec61850clent # 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射 configuration: @@ -25,3 +25,8 @@ logging: boot: autoconfigure: logging: debug + level: + org: + apache: + ibatis: DEBUG + com.xr.iec61850clent.models.mapper: DEBUG diff --git a/device_iec61850clent/src/main/resources/mapper/FocalLengthConfigMapper.xml b/device_iec61850clent/src/main/resources/mapper/FocalLengthConfigMapper.xml new file mode 100644 index 0000000..4fb88f0 --- /dev/null +++ b/device_iec61850clent/src/main/resources/mapper/FocalLengthConfigMapper.xml @@ -0,0 +1,15 @@ + + + + + id,config_id,focal_name, + focal_index,copper_wid,copper_hei, + copper_x,copper_y,config_type, + meter_min,meter_max,rotate, + state_num,parameter,result,scale, + algorithm,create_user,create_time, + update_user,update_time,focal_picture + + diff --git a/device_iec61850clent/src/main/resources/mapper/MeterConfigMapper.xml b/device_iec61850clent/src/main/resources/mapper/MeterConfigMapper.xml index 37bbcbc..dbfade3 100644 --- a/device_iec61850clent/src/main/resources/mapper/MeterConfigMapper.xml +++ b/device_iec61850clent/src/main/resources/mapper/MeterConfigMapper.xml @@ -34,7 +34,7 @@ - select a.*,b.device_ip from meter_config a left join device_camera b on a.camera_id = b.id where a.is_jz=1 diff --git a/device_udpclent/src/main/java/com/xr/device_udpclent/models/scheduled/UdpClentScheduled.java b/device_udpclent/src/main/java/com/xr/device_udpclent/models/scheduled/UdpClentScheduled.java index 10b1f2b..3a15938 100644 --- a/device_udpclent/src/main/java/com/xr/device_udpclent/models/scheduled/UdpClentScheduled.java +++ b/device_udpclent/src/main/java/com/xr/device_udpclent/models/scheduled/UdpClentScheduled.java @@ -43,7 +43,7 @@ public class UdpClentScheduled { private MeterConfigService meterConfigService; - @Scheduled(cron = "0 0/3 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") //定时发送监测数据 public void udpTask(){ if(meterReadingRecordService == null){ @@ -51,74 +51,74 @@ public class UdpClentScheduled { } List list = meterReadingRecordService.selectMaxReading(); for (MeterReadingRecord record:list){ - QueryWrapper wrapper=new QueryWrapper<>(); - wrapper.eq("config_id",record.getMeterId()); - List configs=focalLengthConfigService.list(wrapper); - if(configs.size()>0){ - FocalLengthConfig config = configs.get(0); - MeterConfig meterConfig=meterConfigService.getById(config.getConfigId()); - BufferedImage image = Files.bytesTobufferedImage(config.getFocalPicture()); - if(image!=null && config.getCopperX()!=null){ - image = Files.drawRectangleAndText(image,config.getCopperX(),config.getCopperY(),config.getCopperX2(),config.getCopperWid(),config.getCopperHei(),record.getReadingValue(),meterConfig.getMeterName()); - try { - Files.delFile(record.getReadingUrl()); - String url = Files.uploadImage(image,record.getMeterId()); - record.setReadingUrl(url); - meterReadingRecordService.updateById(record); - }catch (Exception e){ - e.printStackTrace(); - } - } - } -// ByteBuf buf = Unpooled.buffer(); -// ByteBuf checksumBuffer = Unpooled.buffer(Long.BYTES); -// buf.writeBytes(new byte[]{(byte) 0xEB, (byte) 0x90,(byte) 0xEB, (byte) 0x90,(byte)0x78}); -// buf.writeShortLE(3); -// buf.writeShort(record.getMeterId()); -// buf.writeByte(2); -// String s="在线监测#"+record.getReadingUrl(); -// byte [] sx; -// try { -// sx = s.getBytes("GB2312"); -// } catch (UnsupportedEncodingException e) { -// throw new RuntimeException(e); -// } -// buf.writeByte(sx.length); -// buf.writeBytes(sx); -// byte [] sz; -// try { -// sz = record.getReadingValue().getBytes("GB2312"); -// } catch (UnsupportedEncodingException e) { -// throw new RuntimeException(e); -// } -// buf.writeByte(sz.length); -// buf.writeBytes(sz); -// buf.writeBytes(generateCP56Time2a()); -// -// // 计算要校验的部分的开始索引和结束索引 -// byte c = 0; -// int startIndex = 5; // 从第6位开始,索引是5(因为索引从0开始) -// int endIndex = buf.readableBytes() - 1; // 到倒数第二位结束 -// // 截取并处理指定范围内的字节 -// if (startIndex <= endIndex) { -// // 临时存放截取的字节 -// byte[] slice = new byte[endIndex - startIndex + 1]; -// // 从ByteBuf中获取数据 -// buf.getBytes(startIndex, slice); -// c=checksum8(slice); -// // 更新Checksum对象 -// //checksum.update(slice, 0, slice.length); -// } -// buf.writeByte(c); -// // 将checksumBuffer追加到buffer末尾 -// buf.writeBytes(checksumBuffer); -// System.out.println(EnumUtil.byteBufTo16Str(buf)); -// udpClientService.sendData(buf); -// try { -// Thread.sleep(100); -// } catch (InterruptedException e) { -// throw new RuntimeException(e); +// QueryWrapper wrapper=new QueryWrapper<>(); +// wrapper.eq("config_id",record.getMeterId()); +// List configs=focalLengthConfigService.list(wrapper); +// if(configs.size()>0){ +// FocalLengthConfig config = configs.get(0); +// MeterConfig meterConfig=meterConfigService.getById(config.getConfigId()); +// BufferedImage image = Files.bytesTobufferedImage(config.getFocalPicture()); +// if(image!=null && config.getCopperX()!=null){ +// image = Files.drawRectangleAndText(image,config.getCopperX(),config.getCopperY(),config.getCopperX2(),config.getCopperWid(),config.getCopperHei(),record.getReadingValue(),meterConfig.getMeterName()); +// try { +// Files.delFile(record.getReadingUrl()); +// String url = Files.uploadImage(image,record.getMeterId()); +// record.setReadingUrl(url); +// meterReadingRecordService.updateById(record); +// }catch (Exception e){ +// e.printStackTrace(); +// } +// } // } + ByteBuf buf = Unpooled.buffer(); + ByteBuf checksumBuffer = Unpooled.buffer(Long.BYTES); + buf.writeBytes(new byte[]{(byte) 0xEB, (byte) 0x90,(byte) 0xEB, (byte) 0x90,(byte)0x78}); + buf.writeShortLE(3); + buf.writeShort(record.getMeterId()); + buf.writeByte(2); + String s="在线监测#"+record.getReadingUrl(); + byte [] sx; + try { + sx = s.getBytes("GB2312"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + buf.writeByte(sx.length); + buf.writeBytes(sx); + byte [] sz; + try { + sz = record.getReadingValue().getBytes("GB2312"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + buf.writeByte(sz.length); + buf.writeBytes(sz); + buf.writeBytes(generateCP56Time2a()); + + // 计算要校验的部分的开始索引和结束索引 + byte c = 0; + int startIndex = 5; // 从第6位开始,索引是5(因为索引从0开始) + int endIndex = buf.readableBytes() - 1; // 到倒数第二位结束 + // 截取并处理指定范围内的字节 + if (startIndex <= endIndex) { + // 临时存放截取的字节 + byte[] slice = new byte[endIndex - startIndex + 1]; + // 从ByteBuf中获取数据 + buf.getBytes(startIndex, slice); + c=checksum8(slice); + // 更新Checksum对象 + //checksum.update(slice, 0, slice.length); + } + buf.writeByte(c); + // 将checksumBuffer追加到buffer末尾 + buf.writeBytes(checksumBuffer); + System.out.println(EnumUtil.byteBufTo16Str(buf)); + udpClientService.sendData(buf); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } } diff --git a/device_udpclent/src/main/resources/application.yml b/device_udpclent/src/main/resources/application.yml index 19a3b56..9fd79d5 100644 --- a/device_udpclent/src/main/resources/application.yml +++ b/device_udpclent/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - active: dev #开发环境 + active: prod #开发环境 # active: test #测试环境5 #active: prod #生产环境 application: diff --git a/drone_data/pom.xml b/drone_data/pom.xml index e7d6dbe..758fffd 100644 --- a/drone_data/pom.xml +++ b/drone_data/pom.xml @@ -13,7 +13,7 @@ drone_data Demo project for Spring Boot - 17 + 8 @@ -118,6 +118,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + diff --git a/drone_data/src/main/java/com/xr/drone/aliyun/common/MqttClientTest.java b/drone_data/src/main/java/com/xr/drone/aliyun/common/MqttClientTest.java index 363f2b3..fcd3025 100644 --- a/drone_data/src/main/java/com/xr/drone/aliyun/common/MqttClientTest.java +++ b/drone_data/src/main/java/com/xr/drone/aliyun/common/MqttClientTest.java @@ -5,7 +5,7 @@ import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; public class MqttClientTest { - public static void main(String[] args) { + public static void main(String[] args) throws MqttException { // EMQX服务器地址 String broker = "tcp://broker.emqx.io:1883"; String clientId = "JavaClient"; @@ -51,7 +51,7 @@ public class MqttClientTest { mqttClient.disconnect(); System.out.println("Disconnected"); - } catch (MqttException | InterruptedException me) { + } catch (Exception me) { me.printStackTrace(); } diff --git a/drone_data/src/main/java/com/xr/drone/demo/Demo.java b/drone_data/src/main/java/com/xr/drone/demo/Demo.java new file mode 100644 index 0000000..e69efde --- /dev/null +++ b/drone_data/src/main/java/com/xr/drone/demo/Demo.java @@ -0,0 +1,126 @@ +package com.xr.drone.demo; + +import java.io.IOException; +import java.text.SimpleDateFormat; + +import com.jnrsmcu.sdk.netdevice.IDataListener; +import com.jnrsmcu.sdk.netdevice.LoginData; +import com.jnrsmcu.sdk.netdevice.NodeData; +import com.jnrsmcu.sdk.netdevice.ParamData; +import com.jnrsmcu.sdk.netdevice.ParamIdsData; +import com.jnrsmcu.sdk.netdevice.ParamItem; +import com.jnrsmcu.sdk.netdevice.RSServer; +import com.jnrsmcu.sdk.netdevice.RealTimeData; +import com.jnrsmcu.sdk.netdevice.StoreData; +import com.jnrsmcu.sdk.netdevice.TelecontrolAck; +import com.jnrsmcu.sdk.netdevice.TimmingAck; +import com.jnrsmcu.sdk.netdevice.TransDataAck; +import com.jnrsmcu.sdk.netdevice.WriteParamAck; + +public class Demo { + + public static void main(String[] args) throws IOException, + InterruptedException { + //RSServer rsServer = RSServer.Initiate(2404);// 初始化 + RSServer rsServer = RSServer.Initiate(2404,"C:\\Users\\PC\\Desktop\\JavaSDKV2.2.2\\param.dat"); + rsServer.addDataListener(new IDataListener() {// 添加监听 + @Override + public void receiveTimmingAck(TimmingAck data) {// 校时指令应答处理 + System.out.println("校时应答->设备编号:" + data.getDeviceId() + + "\t执行结果:" + data.getStatus()); + } + + @Override + public void receiveTelecontrolAck(TelecontrolAck data) {// 遥控指令应答处理 + System.out.println("遥控应答->设备编号:" + data.getDeviceId() + + "\t继电器编号:" + data.getRelayId() + "\t执行结果:" + + data.getStatus()); + } + + @Override + public void receiveStoreData(StoreData data) {// 已存储数据接收处理 + // 遍历节点数据。数据包括网络设备的数据以及各个节点数据。温湿度数据存放在节点数据中 + for (NodeData nd : data.getNodeList()) { + SimpleDateFormat sdf = new SimpleDateFormat( + "yy-MM-dd HH:mm:ss"); + String str = sdf.format(nd.getRecordTime()); + System.out.println("存储数据->设备地址:" + data.getDeviceId() + + "\t节点:" + nd.getNodeId() + "\t温度:" + nd.getTem() + + "\t湿度:" + nd.getHum() + "\t存储时间:" + str); + } + + } + + @Override + public void receiveRealtimeData(RealTimeData data) {// 实时数据接收处理 + // 遍历节点数据。数据包括网络设备的数据以及各个节点数据。温湿度数据存放在节点数据中 + for (NodeData nd : data.getNodeList()) { + System.out.println("实时数据->设备地址:" + data.getDeviceId() + + "\t节点:" + nd.getNodeId() + "\t温度:" + nd.getTem() + + "\t湿度:" + nd.getHum() + "\t经度:" + data.getLng() + + "\t纬度:" + data.getLat() + "\t坐标类型:" + + data.getCoordinateType() + "\t继电器状态:" + + data.getRelayStatus()); + } + + } + + @Override + public void receiveLoginData(LoginData data) {// 登录数据接收处理 + System.out.println("登录->设备地址:" + data.getDeviceId()); + + } + + @Override + public void receiveParamIds(ParamIdsData data) { + String str = "设备参数编号列表->设备编号:" + data.getDeviceId() + + "\t参数总数量:" + data.getTotalCount() + "\t本帧参数数量:" + + data.getCount() + "\r\n"; + for (int paramId : data.getPararmIdList())// 遍历设备中参数id编号 + { + str += paramId + ","; + } + System.out.println(str); + + } + + @Override + public void receiveParam(ParamData data) { + String str = "设备参数->设备编号:" + data.getDeviceId() + "\r\n"; + + for (ParamItem pararm : data.getParameterList()) { + str += "参数编号:" + + pararm.getParamId() + + "\t参数描述:" + + pararm.getDescription() + + "\t参数值:" + + (pararm.getValueDescription() == null ? pararm + .getValue() : pararm.getValueDescription() + .get(pararm.getValue())) + "\r\n"; + } + System.out.println(str); + + } + + @Override + public void receiveWriteParamAck(WriteParamAck data) { + String str = "下载设备参数->设备编号:" + data.getDeviceId() + "\t参数数量:" + + data.getCount() + "\t" + + (data.isSuccess() ? "下载成功" : "下载失败"); + System.out.println(str); + + } + + @Override + public void receiveTransDataAck(TransDataAck data) { + String str = "数据透传->设备编号:" + data.getDeviceId() + "\t响应结果:" + + data.getData() + "\r\n字节数:" + data.getTransDataLen(); + System.out.println(str); + + } + }); + rsServer.start(); + + } + +} diff --git a/drone_data/src/main/java/com/xr/drone/demo/SwingDemo.java b/drone_data/src/main/java/com/xr/drone/demo/SwingDemo.java new file mode 100644 index 0000000..410d291 --- /dev/null +++ b/drone_data/src/main/java/com/xr/drone/demo/SwingDemo.java @@ -0,0 +1,477 @@ +package com.xr.drone.demo; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; + +import com.jnrsmcu.sdk.netdevice.IDataListener; +import com.jnrsmcu.sdk.netdevice.LoginData; +import com.jnrsmcu.sdk.netdevice.NodeData; +import com.jnrsmcu.sdk.netdevice.ParamData; +import com.jnrsmcu.sdk.netdevice.ParamIdsData; +import com.jnrsmcu.sdk.netdevice.ParamItem; +import com.jnrsmcu.sdk.netdevice.RSServer; +import com.jnrsmcu.sdk.netdevice.RealTimeData; +import com.jnrsmcu.sdk.netdevice.StoreData; +import com.jnrsmcu.sdk.netdevice.TelecontrolAck; +import com.jnrsmcu.sdk.netdevice.TimmingAck; +import com.jnrsmcu.sdk.netdevice.TransDataAck; +import com.jnrsmcu.sdk.netdevice.WriteParamAck; + +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; +import javax.swing.JPanel; +import javax.swing.border.LineBorder; + +import java.awt.Color; + +import javax.swing.border.TitledBorder; +import javax.swing.LayoutStyle.ComponentPlacement; + +public class SwingDemo extends JFrame { + + /** + * + */ + private static final long serialVersionUID = -7855826301914463533L; + private JTextField txtPort; + private JScrollPane scrollPane; + private JTextArea textArea; + private JButton btnStart; + private JButton btnStop; + private JCheckBox chkRelay0; + private JCheckBox chkRelay1; + private JCheckBox chkRelay2; + private JCheckBox chkRelay3; + private JCheckBox chkRelay4; + private JCheckBox chkRelay5; + private JCheckBox chkRelay6; + private JCheckBox chkRelay7; + private JButton btnTimming; + private JButton btnCallStore; + private RSServer rsServer;// 定义监听服务对象 + private IDataListener listener = new IDataListener() { + + @Override + public void receiveTimmingAck(TimmingAck data) {// 校时指令应答处理 + textArea.append("校时应答->设备编号:" + data.getDeviceId() + "\t执行结果:" + + data.getStatus() + "\r\n"); + } + + @Override + public void receiveTelecontrolAck(TelecontrolAck data) {// 遥控指令应答处理 + textArea.append("遥控应答->设备编号:" + data.getDeviceId() + "\t继电器编号:" + + data.getRelayId() + "\t执行结果:" + data.getStatus() + "\r\n"); + } + + @Override + public void receiveStoreData(StoreData data) {// 已存储数据接收处理 + // 遍历节点数据。数据包括网络设备的数据以及各个节点数据。温湿度数据存放在节点数据中 + for (NodeData nd : data.getNodeList()) { + SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); + String str = sdf.format(nd.getRecordTime()); + + textArea.append("存储数据->设备地址:" + data.getDeviceId() + "\t节点:" + + nd.getNodeId() + "\t温度:" + nd.getTem() + "\t湿度:" + + nd.getHum() + "\t存储时间:" + str+"\t坐标类型:"+nd.getCoordinateType()+"\t经度:"+nd.getLng()+"\t纬度:"+nd.getLat() + "\r\n"); + + + + } + + } + + @Override + public void receiveRealtimeData(RealTimeData data) {// 实时数据接收处理 + // 遍历节点数据。数据包括网络设备的数据以及各个节点数据。温湿度数据存放在节点数据中 + for (NodeData nd : data.getNodeList()) { + textArea.append("实时数据->设备地址:" + data.getDeviceId() + "\t节点:" + + nd.getNodeId() + "\t温度:" + nd.getTem() + "\t湿度:" + + nd.getHum() + "\t经度:" + data.getLng() + "\t纬度:" + + data.getLat() + "\t坐标类型:" + data.getCoordinateType() + + "\t继电器状态" + data.getRelayStatus() + "\t浮点型数据:" + + nd.getFloatValue() + "\t32位有符号数据:" + + nd.getSignedInt32Value() + "\t32位无符号数据:" + + nd.getUnSignedInt32Value() + "\r\n"); + } + + } + + @Override + public void receiveLoginData(LoginData data) {// 登录数据接收处理 + textArea.append("登录->设备地址:" + data.getDeviceId() + "\r\n"); + + } + + @Override + public void receiveParamIds(ParamIdsData data) { + String str = "设备参数编号列表->设备编号:" + data.getDeviceId() + "\t参数总数量:" + + data.getTotalCount() + "\t本帧参数数量:" + data.getCount() + + "\r\n"; + for (int paramId : data.getPararmIdList())// 遍历设备中参数id编号 + { + str += paramId + ","; + } + textArea.append(str + "\r\n"); + + } + + @Override + public void receiveParam(ParamData data) { + String str = "设备参数->设备编号:" + data.getDeviceId() + "\r\n"; + + for (ParamItem pararm : data.getParameterList()) { + str += "参数编号:" + + pararm.getParamId() + + "\t参数描述:" + + pararm.getDescription() + + "\t参数值:" + + (pararm.getValueDescription() == null ? pararm + .getValue() : pararm.getValueDescription().get( + pararm.getValue())) + "\r\n"; + } + textArea.append(str + "\r\n"); + + } + + @Override + public void receiveWriteParamAck(WriteParamAck data) { + String str = "下载设备参数->设备编号:" + data.getDeviceId() + "\t参数数量:" + + data.getCount() + "\t" + + (data.isSuccess() ? "下载成功" : "下载失败"); + textArea.append(str + "\r\n"); + + } + + @Override + public void receiveTransDataAck(TransDataAck data) { + String str = "数据透传->设备编号:" + data.getDeviceId() + "\t响应结果:" + + data.getData() + "\r\n字节数:" + data.getTransDataLen(); + textArea.append(str + "\r\n"); + + } + }; + + private JTextField txtDeviceId; + private JTextField txtParamIds; + private JTextField txtParamId; + private JTextField txtParamVal; + private JPanel panel_2; + private JLabel label_4; + private JTextField txtTransData; + private JButton btnTrans; + + public SwingDemo() { + setTitle("Demo"); + setResizable(false); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setSize(653, 710); + setLocationRelativeTo(null); + + JLabel lblNewLabel = new JLabel("\u7AEF\u53E3:"); + lblNewLabel.setBounds(10, 10, 40, 15); + + txtPort = new JTextField(); + txtPort.setBounds(45, 7, 66, 21); + txtPort.setText("2404"); + txtPort.setColumns(10); + + btnStart = new JButton("\u542F\u52A8"); + btnStart.setBounds(135, 6, 85, 23); + btnStart.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + btnStart.setEnabled(false); + new Thread(new Runnable() { + + @Override + public void run() { + + rsServer = RSServer.Initiate(Integer.parseInt(txtPort + .getText()),"C:\\Users\\PC\\Desktop\\JavaSDKV2.2.2\\param.dat");// 初始化 + + rsServer.addDataListener(listener);// 添加数据监听事件 + try { + rsServer.start(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }// 启动监听服务 + } + }).start(); + } + + }); + + btnStop = new JButton("\u505C\u6B62"); + btnStop.setBounds(237, 6, 85, 23); + btnStop.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + btnStart.setEnabled(true); + rsServer.stop(); + } + }); + + scrollPane = new JScrollPane(); + scrollPane.setBounds(10, 400, 624, 275); + + textArea = new JTextArea(); + scrollPane.setViewportView(textArea); + + JLabel label = new JLabel("\u8BBE\u5907\u5730\u5740:"); + label.setBounds(10, 48, 66, 15); + + txtDeviceId = new JTextField(); + txtDeviceId.setBounds(75, 45, 84, 21); + txtDeviceId.setText("10000000"); + txtDeviceId.setColumns(10); + + btnTimming = new JButton("\u6821\u65F6"); + btnTimming.setBounds(336, 6, 85, 23); + btnTimming.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int deviceId = Integer.parseInt(txtDeviceId.getText()); + rsServer.timming(deviceId); + } + }); + + btnCallStore = new JButton("\u53EC\u5524\u6570\u636E"); + btnCallStore.setBounds(428, 6, 90, 23); + btnCallStore.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + int deviceId = Integer.parseInt(txtDeviceId.getText()); + + rsServer.callStoreData(deviceId); + } + }); + + JPanel panel = new JPanel(); + panel.setBounds(10, 84, 624, 57); + panel.setBorder(new TitledBorder(null, + "\u7EE7\u7535\u5668\u63A7\u5236", TitledBorder.LEADING, + TitledBorder.TOP, null, null)); + + JPanel panel_1 = new JPanel(); + panel_1.setBounds(10, 147, 624, 112); + panel_1.setBorder(new TitledBorder(null, "\u8BBE\u5907\u53C2\u6570", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + + panel_2 = new JPanel(); + panel_2.setBounds(10, 269, 624, 113); + panel_2.setBorder(new TitledBorder(null, "\u6570\u636E\u900F\u4F20", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setLayout(null); + + label_4 = new JLabel( + "\u900F\u4F20\u6570\u636E\uFF0C16\u8FDB\u5236\u5B57\u7B26\u4E32"); + label_4.setBounds(10, 23, 419, 15); + panel_2.add(label_4); + + txtTransData = new JTextField(); + txtTransData.setBounds(10, 48, 604, 21); + panel_2.add(txtTransData); + txtTransData.setColumns(10); + + btnTrans = new JButton("\u6570\u636E\u900F\u4F20"); + btnTrans.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int deviceId = Integer.parseInt(txtDeviceId.getText()); + + rsServer.trans(deviceId, txtTransData.getText()); + } + }); + btnTrans.setBounds(10, 79, 93, 23); + panel_2.add(btnTrans); + panel_1.setLayout(null); + + JLabel label_1 = new JLabel( + "\u53C2\u6570\u7F16\u53F7\uFF0C\u7528\u4E8E\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570\uFF08\u591A\u4E2A\u7F16\u53F7\u7528\u82F1\u6587,\u5206\u9694\uFF09"); + label_1.setBounds(10, 22, 421, 15); + panel_1.add(label_1); + + txtParamIds = new JTextField(); + txtParamIds.setText("1,2,3,4,5,6,7,8,9,10"); + txtParamIds.setBounds(10, 47, 421, 21); + panel_1.add(txtParamIds); + txtParamIds.setColumns(10); + + JLabel label_2 = new JLabel("\u53C2\u6570\u7F16\u53F7"); + label_2.setBounds(10, 78, 54, 15); + panel_1.add(label_2); + + txtParamId = new JTextField(); + txtParamId.setBounds(68, 75, 66, 21); + panel_1.add(txtParamId); + txtParamId.setColumns(10); + + JLabel label_3 = new JLabel("\u53C2\u6570\u503C"); + label_3.setBounds(144, 78, 54, 15); + panel_1.add(label_3); + + txtParamVal = new JTextField(); + txtParamVal.setBounds(202, 75, 66, 21); + panel_1.add(txtParamVal); + txtParamVal.setColumns(10); + + JButton btnReadParametersList = new JButton( + "\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570\u5217\u8868"); + btnReadParametersList.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int deviceId = Integer.parseInt(txtDeviceId.getText()); + rsServer.callParamList(deviceId);// 发送召唤设备参数列表指令 + } + }); + btnReadParametersList.setBounds(460, 18, 142, 23); + panel_1.add(btnReadParametersList); + + JButton btnReadParameters = new JButton( + "\u8BFB\u53D6\u8BBE\u5907\u53C2\u6570"); + btnReadParameters.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + int deviceId = Integer.parseInt(txtDeviceId.getText()); + List ids = new ArrayList(); + String[] idArray = txtParamIds.getText().split(","); + for (String str : idArray) { + try { + ids.add(Integer.parseInt(str)); + } catch (Exception e) { + } + } + if (ids.size() >= 115) { + + JOptionPane.showMessageDialog(null, "一次读取参数数量不能超过115个", + "提示", JOptionPane.INFORMATION_MESSAGE); + return; + } + rsServer.callParam(deviceId, ids); + + } + }); + btnReadParameters.setBounds(460, 46, 142, 23); + panel_1.add(btnReadParameters); + + JButton btnWriteParameters = new JButton( + "\u4E0B\u8F7D\u8BBE\u5907\u53C2\u6570"); + btnWriteParameters.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + + int deviceId = Integer.parseInt(txtDeviceId.getText()); + List parameters = new ArrayList(); + + try { + + parameters.add(ParamItem.New( + Integer.parseInt(txtParamId.getText()), + txtParamVal.getText())); + } catch (Exception ex) { + JOptionPane.showMessageDialog(null, ex.getMessage(), "提示", + JOptionPane.INFORMATION_MESSAGE); + return; + } + if (parameters.size() > 115) { + + JOptionPane.showMessageDialog(null, "一次性下发参数数量不能超过115个", + "提示", JOptionPane.INFORMATION_MESSAGE); + return; + } + rsServer.writeParam(deviceId, parameters); + } + }); + btnWriteParameters.setBounds(460, 74, 142, 23); + panel_1.add(btnWriteParameters); + + chkRelay0 = new JCheckBox("\u7EE7\u7535\u56680"); + panel.add(chkRelay0); + + chkRelay1 = new JCheckBox("\u7EE7\u7535\u56681"); + panel.add(chkRelay1); + + chkRelay2 = new JCheckBox("\u7EE7\u7535\u56682"); + panel.add(chkRelay2); + + chkRelay3 = new JCheckBox("\u7EE7\u7535\u56683"); + panel.add(chkRelay3); + + chkRelay4 = new JCheckBox("\u7EE7\u7535\u56684"); + panel.add(chkRelay4); + + chkRelay5 = new JCheckBox("\u7EE7\u7535\u56685"); + panel.add(chkRelay5); + + chkRelay6 = new JCheckBox("\u7EE7\u7535\u56686"); + panel.add(chkRelay6); + + chkRelay7 = new JCheckBox("\u7EE7\u7535\u56687"); + panel.add(chkRelay7); + chkRelay7.addItemListener(new ChkItemListener(7)); + chkRelay6.addItemListener(new ChkItemListener(6)); + chkRelay5.addItemListener(new ChkItemListener(5)); + chkRelay4.addItemListener(new ChkItemListener(4)); + chkRelay3.addItemListener(new ChkItemListener(3)); + chkRelay2.addItemListener(new ChkItemListener(2)); + chkRelay1.addItemListener(new ChkItemListener(1)); + chkRelay0.addItemListener(new ChkItemListener(0)); + getContentPane().setLayout(null); + getContentPane().add(txtPort); + getContentPane().add(lblNewLabel); + getContentPane().add(btnStart); + getContentPane().add(btnStop); + getContentPane().add(btnTimming); + getContentPane().add(btnCallStore); + getContentPane().add(txtDeviceId); + getContentPane().add(label); + getContentPane().add(panel_1); + getContentPane().add(panel); + getContentPane().add(panel_2); + getContentPane().add(scrollPane); + } + + class ChkItemListener implements ItemListener { + + private int relayId = 0; + + public ChkItemListener(int relayId) { + this.relayId = relayId; + } + + @Override + public void itemStateChanged(ItemEvent e) { + JCheckBox jcb = (JCheckBox) e.getItem(); + int deviceId = Integer.parseInt(txtDeviceId.getText()); + if (jcb.isSelected()) { + + try { + rsServer.telecontrol(deviceId, relayId, 0, 0); + } catch (Exception e1) { + e1.printStackTrace(); + } + + } else { + try { + rsServer.telecontrol(deviceId, relayId, 1, 0); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + } + } + + public static void main(String[] args) { + new SwingDemo().setVisible(true); + + } +} diff --git a/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/MqttTop.java b/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/MqttTop.java new file mode 100644 index 0000000..9f6fb75 --- /dev/null +++ b/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/MqttTop.java @@ -0,0 +1,12 @@ +package com.xr.drone.modules.entity.mqtt; + +import lombok.Data; + +@Data +public class MqttTop { + + private String ts; + + private TopDetail topDetail; + +} diff --git a/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/TopDetail.java b/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/TopDetail.java new file mode 100644 index 0000000..7e8375a --- /dev/null +++ b/drone_data/src/main/java/com/xr/drone/modules/entity/mqtt/TopDetail.java @@ -0,0 +1,22 @@ +package com.xr.drone.modules.entity.mqtt; + +import lombok.Data; + +@Data +public class TopDetail { + + private String devName; + + private String devMac; + + private String battery; + + private String snapType; + + private String localtime; + + private String imageSize; + + private String image; + +} diff --git a/drone_data/src/main/java/com/xr/drone/modules/service/Impl/MqttServiceImpl.java b/drone_data/src/main/java/com/xr/drone/modules/service/Impl/MqttServiceImpl.java index c27af72..bf66a01 100644 --- a/drone_data/src/main/java/com/xr/drone/modules/service/Impl/MqttServiceImpl.java +++ b/drone_data/src/main/java/com/xr/drone/modules/service/Impl/MqttServiceImpl.java @@ -1,5 +1,8 @@ package com.xr.drone.modules.service.Impl; +import com.alibaba.fastjson.JSONObject; +import com.xr.drone.modules.entity.mqtt.MqttTop; +import com.xr.drone.modules.entity.mqtt.TopDetail; import com.xr.drone.modules.service.MqttService; import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; import org.eclipse.paho.client.mqttv3.MqttCallback; @@ -16,6 +19,8 @@ public class MqttServiceImpl implements MqttService, MqttCallback { System.out.println("接收消息主题 : " + topic); System.out.println("接收消息Qos : " + message.getQos()); String res = new String(message.getPayload()); + MqttTop mqttTop = JSONObject.parseObject(res,MqttTop.class); + TopDetail detail = mqttTop.getTopDetail(); System.out.println("接收消息内容 : " + res); } diff --git a/drone_data/src/main/resources/application-prod.yml b/drone_data/src/main/resources/application-prod.yml index bea89ab..37c3796 100644 --- a/drone_data/src/main/resources/application-prod.yml +++ b/drone_data/src/main/resources/application-prod.yml @@ -34,11 +34,11 @@ spring: mqtt: username: admin password: admin123 - url: tcp://116.196.120.81:1883 + url: tcp://localhost:1883 client: id: 456787654345 default: - topic: /sys/helloword + topic: X1SensingCam/Snapshot mqtt: connection: timeout: 30000 diff --git a/pom.xml b/pom.xml index 6cff70e..de6c445 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ 4.1.42.Final 3.9 2.10 + 1.8