Browse Source

修改部署内容

dev-jc
yj 2 years ago
parent
commit
ab520ef7c8
  1. 39
      device_cars/pom.xml
  2. 27
      device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java
  3. 2
      device_cars/src/main/java/com/xr/device_car/config/common/LoginConfig.java
  4. 2
      device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java
  5. 3
      device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java
  6. 21
      device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java
  7. 4
      device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java
  8. 59
      device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
  9. 21
      device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java
  10. 9
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java
  11. 57
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
  12. 44
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java
  13. 23
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java
  14. 15
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java
  15. 2
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java
  16. 17
      device_cars/src/main/resources/application-dev.yml
  17. 14
      device_cars/src/main/resources/application-prod.yml
  18. 14
      device_cars/src/main/resources/application-test.yml
  19. 3
      device_cars/src/main/resources/application.yml
  20. 11
      device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml
  21. 2
      device_display/pom.xml
  22. 3
      device_display/src/main/java/com/xr/device_display/modules/analysis/controller/HomePageController.java
  23. 2
      device_display/src/main/java/com/xr/device_display/modules/analysis/controller/MeterReadingRecordController.java
  24. 2
      device_display/src/main/java/com/xr/device_display/modules/analysis/mapper/MeterReadingRecordMapper.java
  25. 2
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/IHomePageService.java
  26. 2
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/IMeterReadingRecordService.java
  27. 70
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/HomePageServiceImpl.java
  28. 19
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/MeterReadingRecordServiceImpl.java
  29. 2
      device_display/src/main/resources/application-dev.yml
  30. 2
      device_display/src/main/resources/application-prod.yml
  31. 2
      device_display/src/main/resources/application-test.yml
  32. 6
      device_display/src/main/resources/application.yml
  33. 35
      device_display/src/main/resources/modules/analysis/MeterReadingRecordMapper.xml
  34. 4
      device_iec104/src/main/java/com/xr/iec104Server/iec104/server/SysDataHandler.java
  35. 2
      device_iec104/src/main/resources/application-dev.yml
  36. 2
      device_iec104/src/main/resources/application-prod.yml
  37. 2
      device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java
  38. 113
      device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/Iec61850Eunm.java
  39. 4
      device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java
  40. 2
      device_iec61850clent/src/main/resources/application-dev.yml
  41. 6
      device_iec61850clent/src/main/resources/application-prod.yml
  42. 14
      device_iec61850clent/src/main/resources/application-test.yml
  43. 2
      device_iec61850clent/src/main/resources/application.yml
  44. 2
      device_iec61850server/src/main/resources/application-dev.yml
  45. 2
      device_iec61850server/src/main/resources/application-prod.yml
  46. 2
      device_iec61850server/src/main/resources/application-test.yml
  47. 2
      device_iec61850server/src/main/resources/application.yml
  48. 2
      device_modbus/src/main/resources/application-dev.yml
  49. 2
      device_modbus/src/main/resources/application-prod.yml
  50. 42
      device_udpclent/pom.xml
  51. 2
      device_udpclent/src/main/java/com/xr/device_udpclent/DeviceUdpclentApplication.java
  52. 15
      device_udpclent/src/main/java/com/xr/device_udpclent/models/service/impl/UdpClientServiceImpl.java
  53. 52
      device_udpclent/src/main/resources/application-dev.yml
  54. 21
      device_udpclent/src/main/resources/application-prod.yml
  55. 13
      device_udpclent/src/main/resources/application.yml
  56. 4
      device_udpserver/src/main/java/com/xr/device_udpserver/common/UdpServerHandler.java
  57. 2
      device_udpserver/src/main/resources/application-dev.yml
  58. 2
      device_udpserver/src/main/resources/application-prod.yml
  59. 6
      drone_data/src/main/java/com/xr/drone/DroneDataApplication.java
  60. 1
      drone_data/src/main/resources/application-dev.yml
  61. 12
      drone_data/src/main/resources/application-prod.yml
  62. 2
      drone_data/src/main/resources/application.yml
  63. 91
      pom.xml

39
device_cars/pom.xml

@ -149,11 +149,6 @@
<artifactId>commons-discovery</artifactId> <artifactId>commons-discovery</artifactId>
<version>0.2</version> <version>0.2</version>
</dependency> </dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
@ -178,7 +173,7 @@
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>${joda.time.version}</version> <version>${joda-time.version}</version>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-sqlmap--> <!-- https://mvnrepository.com/artifact/org.apache.ibatis/ibatis-sqlmap-->
<!-- <dependency>--> <!-- <dependency>-->
@ -361,6 +356,38 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>3.0.10</version>
</dependency>
<!-- 引入easyPOI -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

27
device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java

@ -1,27 +1,41 @@
package com.xr.device_car; package com.xr.device_car;
import cn.hutool.extra.spring.SpringUtil;
import com.xr.device_car.client.config.Iec104Config;
import com.xr.device_car.config.utils.FileUtil;
import com.xr.device_car.config.utils.Files;
import com.xr.device_car.modules.analysis.entity.FocalLengthConfig;
import com.xr.device_car.modules.analysis.service.FocalLengthConfigService;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
import java.io.File;
import java.util.Date;
import java.util.List;
@SpringBootApplication @SpringBootApplication
@EnableScheduling//开启定时任务 @EnableScheduling//开启定时任务
@EnableAsync//开启异步 @EnableAsync//开启异步
@MapperScan("com.xr.device_car.modules.**.mapper") @MapperScan("com.xr.device_car.modules.**.mapper")
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
@Import(SpringUtil.class)
//public class DeviceCarApplication implements CommandLineRunner {
public class DeviceCarApplication{ public class DeviceCarApplication{
@Value("${netty.address}") @Value("${netty.address}")
private String address; private String address;
@ -52,9 +66,12 @@ public class DeviceCarApplication{
// @Async // @Async
// @Override // @Override
// public void run(String... args) throws Exception { // public void run(String... args) throws Exception {
// Iec104Config iec104Config = new Iec104Config(); // FocalLengthConfigService focalLengthConfigService = SpringUtil.getBean(FocalLengthConfigService.class);
// iec104Config.setFrameAmountMax((short) 2); // List<FocalLengthConfig> list=focalLengthConfigService.list();
// iec104Config.setTerminnalAddress((short) 1); // for (FocalLengthConfig config:list){
// Iec104MasterFactory.createTcpClientMaster("192.168.3.10",2404).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run(); // byte[] b=config.getFocalPicture();
// File file = new File("D:\\images\\zhongshan\\"+config.getConfigId()+".jpg");
// FileUtil.readInputStream(file,b);
// }
// } // }
} }

2
device_cars/src/main/java/com/xr/device_car/config/common/LoginConfig.java

@ -38,7 +38,7 @@ public class LoginConfig {
public static final String USER_ROLE_ID="1"; public static final String USER_ROLE_ID="1";
public static final String TIMESTAMP = "timeStamp"; public static final String TIMESTAMP = "time_stamp";
public static final String CryptoKey="ReGlory"; public static final String CryptoKey="ReGlory";
} }

2
device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java

@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement @EnableTransactionManagement
@MapperScan("com.xr.device_car.modules.*.mapper") @MapperScan("com.xr.device_car.analysis.mapper")
@Configuration @Configuration
public class MyBatisPlusConfig { public class MyBatisPlusConfig {

3
device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java

@ -18,7 +18,6 @@ public class WebConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor()) registry.addInterceptor(loginInterceptor())
.addPathPatterns("/**").excludePathPatterns("/user/webLogin") .addPathPatterns("/**").excludePathPatterns("/user/webLogin")
.excludePathPatterns("/user/login","/user/getUserByToken","/deviceCamera/deviceCameraList","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**", .excludePathPatterns("/user/login","/user/getUserByToken","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
"/dataAnalysisCamera/getComer");
} }
} }

21
device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java

@ -14,4 +14,25 @@ public class StaticProperties {
@Value("${upLoad.url}") @Value("${upLoad.url}")
private String url; private String url;
@Value("${python.path}")
private String pythonPath;
@Value("${python.modelPath}")
private String modelPath;
@Value("${minio.url}")
private String minioUrl;
@Value("${minio.accessKey}")
private String minioAccess;
@Value("${minio.secretKey}")
private String minioSecret;
@Value("${udp.server.host}")
private String udpHost;
@Value("${udp.server.port}")
private Integer udpPort;
} }

4
device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java

@ -30,7 +30,7 @@ public class CodeGenUtil {
CodeGenUtil codeGenUtil = new CodeGenUtil(); CodeGenUtil codeGenUtil = new CodeGenUtil();
boolean b = codeGenUtil.generateByTables(dataSourceConfig, "com.xr.device_car.modules.analysis", boolean b = codeGenUtil.generateByTables(dataSourceConfig, "com.xr.device_car.modules.analysis",
"gaoby", "device_cars", "gaoby", "device_cars",
"meter_reading"); "meter_initialization");
System.out.println(b); System.out.println(b);
} }
@ -162,7 +162,7 @@ public class CodeGenUtil {
* @return 数据源配置 DataSourceConfig * @return 数据源配置 DataSourceConfig
*/ */
private static DataSourceConfig getDataSourceConfig() { private static DataSourceConfig getDataSourceConfig() {
String dbUrl = "jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false"; String dbUrl = "jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false";
return new DataSourceConfig() return new DataSourceConfig()
.setDbType(DbType.MYSQL) .setDbType(DbType.MYSQL)
.setUrl(dbUrl) .setUrl(dbUrl)

59
device_cars/src/main/java/com/xr/device_car/config/utils/Files.java

@ -8,9 +8,15 @@ import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.file.Path;
import java.util.Base64; import java.util.Base64;
import java.util.Date;
import java.util.Random;
import java.util.UUID;
public class Files { public class Files {
@ -91,6 +97,30 @@ public class Files {
BufferedImage bimg= ImageIO.read(is2); BufferedImage bimg= ImageIO.read(is2);
return bimg; return bimg;
} }
public static BufferedImage urlByImages(String url,String username,String password) throws IOException {
BufferedImage bimg=null;
try {
// 设置身份验证
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
// 创建URL对象并打开连接
URL uri = new URL(url);
URLConnection connection = uri.openConnection();
// 获取输入流
InputStream inputStream = connection.getInputStream();
bimg= ImageIO.read(inputStream);
// 关闭流
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
return bimg;
}
public static BufferedImage urlByImage(String url) throws IOException { public static BufferedImage urlByImage(String url) throws IOException {
URL urlfile = new URL(url); URL urlfile = new URL(url);
@ -263,6 +293,35 @@ public class Files {
return StaticPropUtil.imageUrl+rqImg; return StaticPropUtil.imageUrl+rqImg;
} }
public static File saveImageForPath(BufferedImage bufferedImage,String imgPath) throws Exception{
File file =new File(imgPath);
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}
ImageIO.write(bufferedImage,"jpg",file);
return file;
}
public static String multipartFileToPath(MultipartFile file) throws IOException {
String fileName = StaticPropUtil.imagePath+file.getName();
File file1 = new File(fileName);
file.transferTo(file1);
fileName = fileName.replace("\\","\\\\");
return fileName;
}
public static String base64ToPath(String base64Image)throws IOException {
base64Image = base64Image.replaceFirst("data:image/[^;]+;base64,", "");
byte[] imageBytes = Base64.getDecoder().decode(base64Image);
String fileName = StaticPropUtil.imagePath+ new Date().getTime()+ new Random().nextInt(9000)+1000+".png";
File dest = new File(fileName);
try (FileOutputStream fos = new FileOutputStream(dest)) {
fos.write(imageBytes);
}
fileName = fileName.replace("\\","\\\\");
return fileName;
}

21
device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java

@ -8,9 +8,30 @@ public class StaticPropUtil {
public static String imageUrl; public static String imageUrl;
public static String pythonPath;
public static String modelPath;
public static String minioUrl;
public static String minioAccess;
public static String minioSecret;
public static String udpHost;
public static Integer udpPort;
public static void initDingDingProp(StaticProperties dingProperties){ public static void initDingDingProp(StaticProperties dingProperties){
imagePath = dingProperties.getPath(); imagePath = dingProperties.getPath();
imageUrl = dingProperties.getUrl(); imageUrl = dingProperties.getUrl();
pythonPath=dingProperties.getPythonPath();
modelPath=dingProperties.getModelPath();
minioUrl=dingProperties.getMinioUrl();
minioAccess=dingProperties.getMinioAccess();
minioSecret=dingProperties.getMinioSecret();
udpHost=dingProperties.getUdpHost();
udpPort=dingProperties.getUdpPort();
} }
} }

9
device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java

@ -80,6 +80,15 @@ public class DeviceCameraController {
if (StringUtils.isNotBlank(deviceCamera.getDeviceIp())) { if (StringUtils.isNotBlank(deviceCamera.getDeviceIp())) {
wrapper.like("device_ip", deviceCamera.getDeviceIp()); wrapper.like("device_ip", deviceCamera.getDeviceIp());
} }
// 算法类型
if (StringUtils.isNotBlank(deviceCamera.getAlgorithmType()) && !deviceCamera.getAlgorithmType().equals("")){
if (deviceCamera.getAlgorithmType().equals("3")){
wrapper.in("device_type",3,4);
}else {
wrapper.in("device_type",1,2);
}
}
IPage<DeviceCamera> deviceCameraList = deviceCameraService.page(pg, wrapper); IPage<DeviceCamera> deviceCameraList = deviceCameraService.page(pg, wrapper);
System.out.println(deviceCameraList); System.out.println(deviceCameraList);
return Result.OK(deviceCameraList); return Result.OK(deviceCameraList);

57
device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java

@ -3,22 +3,24 @@ package com.xr.device_car.modules.analysis.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xr.device_car.config.common.Result; import com.xr.device_car.config.common.Result;
import com.xr.device_car.config.utils.AdbUtil; import com.xr.device_car.config.utils.*;
import com.xr.device_car.config.utils.Files;
import com.xr.device_car.config.utils.UserUtils;
import com.xr.device_car.modules.analysis.entity.DeviceCamera; import com.xr.device_car.modules.analysis.entity.DeviceCamera;
import com.xr.device_car.modules.analysis.entity.FocalLengthConfig; import com.xr.device_car.modules.analysis.entity.FocalLengthConfig;
import com.xr.device_car.modules.analysis.entity.MeterConfig; import com.xr.device_car.modules.analysis.entity.MeterConfig;
import com.xr.device_car.modules.analysis.entity.MeterType;
import com.xr.device_car.modules.analysis.scheduled.TaskScheduler; import com.xr.device_car.modules.analysis.scheduled.TaskScheduler;
import com.xr.device_car.modules.analysis.service.DeviceCameraService; import com.xr.device_car.modules.analysis.service.DeviceCameraService;
import com.xr.device_car.modules.analysis.service.FocalLengthConfigService; import com.xr.device_car.modules.analysis.service.FocalLengthConfigService;
import com.xr.device_car.modules.analysis.service.MeterConfigService; import com.xr.device_car.modules.analysis.service.MeterConfigService;
import com.xr.device_car.modules.analysis.service.MeterTypeService;
import com.xr.device_car.modules.system.entity.UserInfo; import com.xr.device_car.modules.system.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -42,6 +44,9 @@ public class FocalLengthConfigController {
private MeterConfigService meterConfigService; private MeterConfigService meterConfigService;
@Autowired @Autowired
private DeviceCameraService deviceCameraService; private DeviceCameraService deviceCameraService;
@Autowired
private MeterTypeService meterTypeService;
@Autowired @Autowired
private TaskScheduler taskScheduler; private TaskScheduler taskScheduler;
@ -95,8 +100,10 @@ public class FocalLengthConfigController {
String deviceType=""; String deviceType="";
if(device.getDeviceType().equals("1")){ if(device.getDeviceType().equals("1")){
deviceType="usb"; deviceType="usb";
}else{ }else if(device.getDeviceType().equals("2")){
deviceType="mipi"; deviceType="mipi";
}else{
return Result.OK("保存成功!");
} }
file.createNewFile(); file.createNewFile();
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
@ -205,14 +212,15 @@ public class FocalLengthConfigController {
@RequestMapping("/addFocalLength") @RequestMapping("/addFocalLength")
public Result<?> addFocalLength(FocalLengthConfig focalLengthConfig) throws Exception { public Result<?> addFocalLength(FocalLengthConfig focalLengthConfig) throws Exception {
UserInfo userInfo= UserUtils.currentUser(); UserInfo userInfo= UserUtils.currentUser();
// MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId()); MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId());
// DeviceCamera deviceCamera = deviceCameraService.getById(meterConfig.getCameraId()); DeviceCamera deviceCamera = deviceCameraService.getById(meterConfig.getCameraId());
BufferedImage bufferedImage= AdbUtil.getCamDevice(); BufferedImage bufferedImage=null;
// if(deviceCamera.getDeviceType().equals("1")){ if(deviceCamera.getDeviceType().equals("1")|| deviceCamera.getDeviceType().equals("2")){
// bufferedImage=taskScheduler.getImgBySerial(deviceCamera); bufferedImage= AdbUtil.getCamDevice();
// }else{ }
// bufferedImage=taskScheduler.getImgByInternet(deviceCamera); if(deviceCamera.getDeviceType().equals("3") || deviceCamera.getDeviceType().equals("4")){ // 拉取球机
// } bufferedImage= HkComUtil.getBole(deviceCamera);
}
byte [] bytes= Files.bufferedImageToByte(bufferedImage); byte [] bytes= Files.bufferedImageToByte(bufferedImage);
focalLengthConfig.setFocalPicture(bytes); focalLengthConfig.setFocalPicture(bytes);
focalLengthConfig.setCreateTime(new Date()); focalLengthConfig.setCreateTime(new Date());
@ -336,7 +344,7 @@ public class FocalLengthConfigController {
if(!file.getParentFile().exists()){ if(!file.getParentFile().exists()){
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
} }
return Result.OK(AdbUtil.readLog("D:\\images\\log\\log","D:\\images\\log","/userdata/logs/log")); return Result.OK(AdbUtil.readConfig("D:\\images\\log\\log","D:\\images\\log","/userdata/logs/log"));
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
return Result.error(e.getMessage()); return Result.error(e.getMessage());
@ -358,4 +366,27 @@ public class FocalLengthConfigController {
return null; return null;
} }
/**
* AI识别测试
* Param file 截图文件
* Param id 表计编号
* */
@RequestMapping("/testRecognition")
public Result<?> testRecognition(@RequestParam("base64Image") String base64Image,@RequestParam("id") Integer id){
Result result = new Result();
String readValue= null;
try{
MeterConfig meter = meterConfigService.getById(id);
MeterType type = meterTypeService.getById(meter.getTypeId());
// String path = Files.multipartFileToPath(file);
String path = Files.base64ToPath(base64Image);
readValue = PythonExecutor.readNumber(id,path,type.getMeterShape());
}catch (Exception e){
e.printStackTrace();
return Result.error(e.getMessage());
}
return result.OK(readValue);
}
} }

44
device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java

@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xr.device_car.config.common.Result; import com.xr.device_car.config.common.Result;
import com.xr.device_car.config.udp.UdbConfig;
import com.xr.device_car.config.utils.*; import com.xr.device_car.config.utils.*;
import com.xr.device_car.modules.analysis.entity.*; import com.xr.device_car.modules.analysis.entity.*;
import com.xr.device_car.modules.analysis.scheduled.TaskScheduler; import com.xr.device_car.modules.analysis.scheduled.TaskScheduler;
import com.xr.device_car.modules.analysis.service.*; import com.xr.device_car.modules.analysis.service.*;
import com.xr.device_car.modules.analysis.vo.MeterMaxMinSaveVo; import com.xr.device_car.modules.analysis.vo.MeterMaxMinSaveVo;
import com.xr.device_car.modules.system.entity.UserInfo; import com.xr.device_car.modules.system.entity.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -32,6 +34,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("analysis/meterConfig") @RequestMapping("analysis/meterConfig")
@RequiredArgsConstructor
public class MeterConfigController { public class MeterConfigController {
private final MeterConfigService meterConfigService; private final MeterConfigService meterConfigService;
@ -46,17 +49,7 @@ public class MeterConfigController {
private final IScheduleSettingService scheduleSettingService; private final IScheduleSettingService scheduleSettingService;
@Autowired private final UdpClientService udpClientService;
public MeterConfigController(MeterConfigService meterConfigService,DeviceCameraService deviceCameraService,
MeterTypeService meterTypeService,FocalLengthConfigService focalLengthConfigService,
TaskScheduler taskScheduler,IScheduleSettingService scheduleSettingService){
this.meterConfigService=meterConfigService;
this.deviceCameraService=deviceCameraService;
this.meterTypeService=meterTypeService;
this.focalLengthConfigService=focalLengthConfigService;
this.taskScheduler=taskScheduler;
this.scheduleSettingService=scheduleSettingService;
}
@RequestMapping("/getMeterConfigPage") @RequestMapping("/getMeterConfigPage")
public IPage<MeterConfig> getMeterConfigPage(MeterConfig meterConfig, HttpServletRequest req){ public IPage<MeterConfig> getMeterConfigPage(MeterConfig meterConfig, HttpServletRequest req){
@ -68,8 +61,11 @@ public class MeterConfigController {
if(StringUtils.isNotEmpty(meterConfig.getDeviceType())){ if(StringUtils.isNotEmpty(meterConfig.getDeviceType())){
query.like("a.device_type",meterConfig.getDeviceType()); query.like("a.device_type",meterConfig.getDeviceType());
} }
if(StringUtils.isNotEmpty(meterConfig.getDeviceName())){ if(StringUtils.isNotEmpty(meterConfig.getDeviceType())){
query.like("a.device_name",meterConfig.getDeviceName()); query.like("a.device_type",meterConfig.getDeviceType());
}
if(StringUtils.isNotEmpty(meterConfig.getAlgorithmType())){
query.like("a.algorithm_type",meterConfig.getAlgorithmType());
} }
if(StringUtils.isNotEmpty(meterConfig.getTypeId())){ if(StringUtils.isNotEmpty(meterConfig.getTypeId())){
query.eq("a.type_id",meterConfig.getTypeId()); query.eq("a.type_id",meterConfig.getTypeId());
@ -101,12 +97,12 @@ public class MeterConfigController {
meterConfig.setUpdateTime(new Date()); meterConfig.setUpdateTime(new Date());
ids.add(meterConfig.getId()); ids.add(meterConfig.getId());
meterConfigService.saveOrUpdate(meterConfig); meterConfigService.saveOrUpdate(meterConfig);
/*if (meterConfig.getStatus()==1){ if (meterConfig.getStatus()==1){
// 删除原有任务 // 删除原有任务
scheduleSettingService.meterStart(ids,0); scheduleSettingService.meterStart(ids,0);
// 新增并启用新任务 // 新增并启用新任务
scheduleSettingService.meterStart(ids,1); scheduleSettingService.meterStart(ids,1);
}*/ }
}else{ }else{
meterConfig.setCreateUser(userInfo.getUserName()); meterConfig.setCreateUser(userInfo.getUserName());
@ -150,7 +146,7 @@ public class MeterConfigController {
UpdateWrapper<MeterConfig> updateWrapper=new UpdateWrapper<>(); UpdateWrapper<MeterConfig> updateWrapper=new UpdateWrapper<>();
updateWrapper.in("id",ids).set("status",status); updateWrapper.in("id",ids).set("status",status);
meterConfigService.update(null,updateWrapper); meterConfigService.update(null,updateWrapper);
/*scheduleSettingService.meterStart(ids,Integer.valueOf(status));*/ scheduleSettingService.meterStart(ids,Integer.valueOf(status));
return Result.OK(status.equals("1")?"启动":"停止"+"成功!"); return Result.OK(status.equals("1")?"启动":"停止"+"成功!");
} }
@RequestMapping("/saveCamera") @RequestMapping("/saveCamera")
@ -257,4 +253,20 @@ public class MeterConfigController {
} }
//同步配置文件到udp主机
@RequestMapping("/sendSynchronizationUdp")
public Result<?> sendSynchronizationUdp(){
try{
QueryWrapper<MeterConfig> query=new QueryWrapper<>();
query.eq("status",1);
List<MeterConfig> list = meterConfigService.list(query);
String sendMsg = UdbConfig.getUdbConfig(list);
udpClientService.sendData(sendMsg);
}catch (Exception e){
e.printStackTrace();
return Result.OK("同步失败!");
}
return Result.OK("同步成功!");
}
} }

23
device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java

@ -37,7 +37,7 @@ public class DeviceCamera implements Serializable {
private String deviceNo; private String deviceNo;
/** /**
* 类型(1 usb 2 mipi) * 类型(1 usb 2 mipi 3 球机 4 枪机)
*/ */
@ExcelProperty(value = "类型") @ExcelProperty(value = "类型")
private String deviceType; private String deviceType;
@ -54,6 +54,22 @@ public class DeviceCamera implements Serializable {
@ExcelProperty(value = "端口") @ExcelProperty(value = "端口")
private String devicePort; private String devicePort;
/**
* 账号
*/
private String account;
/**
* 密码
*/
private String password;
private String x;
private String y;
private String z;
/** /**
* 摄像头型号 * 摄像头型号
*/ */
@ -124,4 +140,9 @@ public class DeviceCamera implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 算法类型
*/
@TableField(exist = false)
private String algorithmType;
} }

15
device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java

@ -84,9 +84,9 @@ public class MeterConfig implements Serializable {
private Date firstTime; private Date firstTime;
/** /**
* 焦距类型 1定焦2变焦 * 算法类型 1usb2mipi 3内部算法
*/ */
private String focalLength; private String algorithmType;
/** /**
* 执行间隔时间 * 执行间隔时间
@ -123,6 +123,11 @@ public class MeterConfig implements Serializable {
*/ */
private String remarks; private String remarks;
/**
* 初始化状态
*/
private String initStatus;
/** /**
* 创建人 * 创建人
*/ */
@ -176,7 +181,7 @@ public class MeterConfig implements Serializable {
&& (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId())) && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getFirstTime() == null ? other.getFirstTime() == null : this.getFirstTime().equals(other.getFirstTime())) && (this.getFirstTime() == null ? other.getFirstTime() == null : this.getFirstTime().equals(other.getFirstTime()))
&& (this.getFocalLength() == null ? other.getFocalLength() == null : this.getFocalLength().equals(other.getFocalLength())) && (this.getAlgorithmType() == null ? other.getAlgorithmType() == null : this.getAlgorithmType().equals(other.getAlgorithmType()))
&& (this.getIntervalTime() == null ? other.getIntervalTime() == null : this.getIntervalTime().equals(other.getIntervalTime())) && (this.getIntervalTime() == null ? other.getIntervalTime() == null : this.getIntervalTime().equals(other.getIntervalTime()))
&& (this.getFocalNumber() == null ? other.getFocalNumber() == null : this.getFocalNumber().equals(other.getFocalNumber())) && (this.getFocalNumber() == null ? other.getFocalNumber() == null : this.getFocalNumber().equals(other.getFocalNumber()))
&& (this.getParameterConfig() == null ? other.getParameterConfig() == null : this.getParameterConfig().equals(other.getParameterConfig())) && (this.getParameterConfig() == null ? other.getParameterConfig() == null : this.getParameterConfig().equals(other.getParameterConfig()))
@ -203,7 +208,7 @@ public class MeterConfig implements Serializable {
result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode()); result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getFirstTime() == null) ? 0 : getFirstTime().hashCode()); result = prime * result + ((getFirstTime() == null) ? 0 : getFirstTime().hashCode());
result = prime * result + ((getFocalLength() == null) ? 0 : getFocalLength().hashCode()); result = prime * result + ((getAlgorithmType() == null) ? 0 : getAlgorithmType().hashCode());
result = prime * result + ((getIntervalTime() == null) ? 0 : getIntervalTime().hashCode()); result = prime * result + ((getIntervalTime() == null) ? 0 : getIntervalTime().hashCode());
result = prime * result + ((getFocalNumber() == null) ? 0 : getFocalNumber().hashCode()); result = prime * result + ((getFocalNumber() == null) ? 0 : getFocalNumber().hashCode());
result = prime * result + ((getParameterConfig() == null) ? 0 : getParameterConfig().hashCode()); result = prime * result + ((getParameterConfig() == null) ? 0 : getParameterConfig().hashCode());
@ -233,7 +238,7 @@ public class MeterConfig implements Serializable {
sb.append(", typeId=").append(typeId); sb.append(", typeId=").append(typeId);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", firstTime=").append(firstTime); sb.append(", firstTime=").append(firstTime);
sb.append(", focalLength=").append(focalLength); sb.append(", algorithmType=").append(algorithmType);
sb.append(", intervalTime=").append(intervalTime); sb.append(", intervalTime=").append(intervalTime);
sb.append(", focalNumber=").append(focalNumber); sb.append(", focalNumber=").append(focalNumber);
sb.append(", parameterConfig=").append(parameterConfig); sb.append(", parameterConfig=").append(parameterConfig);

2
device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java

@ -34,6 +34,8 @@ public class MeterReadingRecord implements Serializable {
private String readingType; private String readingType;
private String dataType;
/** /**
* 表计类型id * 表计类型id
*/ */

17
device_cars/src/main/resources/application-dev.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
#Hikari连接池配置 #Hikari连接池配置
@ -63,9 +63,12 @@ analysis:
url: http://192.168.1.123:9000/vi/syncrec url: http://192.168.1.123:9000/vi/syncrec
upLoad: upLoad:
path: D:\\device_car\\analysis\\upload\\ path: D:\\images\\images\\
url: http://localhost:85/upload/ url: http://localhost:85/upload/
file: D:\\images\\images\\
python:
path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
modelPath: D:\\smartGrid\\smartGrid\\models
netty: netty:
address: 192.168.3.20 address: 192.168.3.20
port: 2404 port: 2404
@ -81,3 +84,11 @@ eureka:
enabled: true enabled: true
service-url: service-url:
defaultZone: http://localhost:8084/eureka defaultZone: http://localhost:8084/eureka
minio:
url: http://192.168.1.210:9000
accessKey: minioadmin
secretKey: minioadmin
udp:
server:
host: localhost
port: 9300

14
device_cars/src/main/resources/application-prod.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置
@ -65,12 +65,22 @@ analysis:
upLoad: upLoad:
path: /home/project/upload path: /home/project/upload
url: http://192.168.1.252:85/upload/ url: http://192.168.1.252:85/upload/
python:
path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
modelPath: D:\\smartGrid\\smartGrid\\models
netty: netty:
address: 192.168.1.252 address: 192.168.1.252
port: 2405 port: 2405
data: data:
pathUrl: http://192.168.1.252:8081/api/dataAnalysisCamera/getComer pathUrl: http://192.168.1.252:8081/api/dataAnalysisCamera/getComer
udp:
server:
host: localhost
port: 9300
minio:
url: http://192.168.1.210:9000
accessKey: minioadmin
secretKey: minioadmin
eureka: eureka:
instance: instance:
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}

14
device_cars/src/main/resources/application-test.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置
@ -65,10 +65,20 @@ analysis:
upLoad: upLoad:
path: D:\\device_car\\analysis\\upload\\ path: D:\\device_car\\analysis\\upload\\
url: http://localhost:85/upload/ url: http://localhost:85/upload/
python:
path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
modelPath: D:\\smartGrid\\smartGrid\\models
netty: netty:
address: 192.168.3.20 address: 192.168.3.20
port: 2404 port: 2404
minio:
url: http://192.168.1.210:9000
accessKey: minioadmin
secretKey: minioadmin
udp:
server:
host: localhost
port: 9300
data: data:
pathUrl: http://192.168.1.82:8081/api/dataAnalysisCamera/getComer pathUrl: http://192.168.1.82:8081/api/dataAnalysisCamera/getComer
#pathUrl: http://192.168.1.44:8081/api/dataAnalysisCamera/getComer #pathUrl: http://192.168.1.44:8081/api/dataAnalysisCamera/getComer

3
device_cars/src/main/resources/application.yml

@ -2,7 +2,7 @@ spring:
profiles: profiles:
#active: dev #开发环境 #active: dev #开发环境
# active: test #测试环境5 # active: test #测试环境5
active: test #生产环境 active: dev #生产环境
# active: prod #生产环境 # active: prod #生产环境
application: application:
name: deviceCars name: deviceCars
@ -79,3 +79,4 @@ hystrix:
# 熔断器超时时间,默认:1000/毫秒 # 熔断器超时时间,默认:1000/毫秒
timeoutInMilliseconds: 20000 timeoutInMilliseconds: 20000

11
device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml

@ -17,12 +17,13 @@
<result property="typeId" column="type_id" jdbcType="INTEGER"/> <result property="typeId" column="type_id" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/> <result property="status" column="status" jdbcType="INTEGER"/>
<result property="firstTime" column="first_time" jdbcType="TIMESTAMP"/> <result property="firstTime" column="first_time" jdbcType="TIMESTAMP"/>
<result property="focalLength" column="focal_length" jdbcType="VARCHAR"/> <result property="algorithmType" column="algorithm_type" jdbcType="VARCHAR"/>
<result property="intervalTime" column="interval_time" jdbcType="INTEGER"/> <result property="intervalTime" column="interval_time" jdbcType="INTEGER"/>
<result property="intervalType" column="interval_type" jdbcType="INTEGER"/> <result property="intervalType" column="interval_type" jdbcType="INTEGER"/>
<result property="focalNumber" column="focal_number" jdbcType="INTEGER"/> <result property="focalNumber" column="focal_number" jdbcType="INTEGER"/>
<result property="parameterConfig" column="parameter_config" jdbcType="VARCHAR"/> <result property="parameterConfig" column="parameter_config" jdbcType="VARCHAR"/>
<result property="remarks" column="remarks" jdbcType="VARCHAR"/> <result property="remarks" column="remarks" jdbcType="VARCHAR"/>
<result property="initStatus" column="init_status" jdbcType="VARCHAR"/>
<result property="createUser" column="create_user" jdbcType="VARCHAR"/> <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateUser" column="update_user" jdbcType="VARCHAR"/> <result property="updateUser" column="update_user" jdbcType="VARCHAR"/>
@ -38,14 +39,14 @@
a.identification_interval,a.device_name,a.device_type, a.identification_interval,a.device_name,a.device_type,
a.meter_code,a.meter_name,a.camera_id, a.meter_code,a.meter_name,a.camera_id,
a.type_id,a.status,a.first_time, a.type_id,a.status,a.first_time,
a.focal_length,a.interval_time,a.focal_number, a.algorithm_type,a.interval_time,a.focal_number,
a.parameter_config,a.remarks,a.create_user, a.parameter_config,a.remarks,a.init_status,a.create_user,
a.create_time,a.update_user,a.update_time, a.create_time,a.update_user,a.update_time,
</sql> </sql>
<select id="selectConfigByPage" resultMap="BaseResultMap"> <select id="selectConfigByPage" resultType="com.xr.device_car.modules.analysis.entity.MeterConfig">
select select
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
b.device_type,b.position,c.type_alias,b.device_ip from meter_config a b.device_type cameraType,b.position cameraName,c.type_alias,b.device_ip ip from meter_config a
left join device_camera b on a.camera_id = b.id left join device_camera b on a.camera_id = b.id
left join meter_type c on a.type_id=c.id left join meter_type c on a.type_id=c.id
${ew.customSqlSegment} ${ew.customSqlSegment}

2
device_display/pom.xml

@ -145,7 +145,7 @@
<dependency> <dependency>
<groupId>joda-time</groupId> <groupId>joda-time</groupId>
<artifactId>joda-time</artifactId> <artifactId>joda-time</artifactId>
<version>${joda.time.version}</version> <version>${joda-time.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>

3
device_display/src/main/java/com/xr/device_display/modules/analysis/controller/HomePageController.java

@ -16,8 +16,7 @@ public class HomePageController {
@GetMapping("/getCardList") @GetMapping("/getCardList")
private AjaxResult getCardList(){ private AjaxResult getCardList(){
// return homePageService.getCardList(); return homePageService.getCardList();
return homePageService.getHistogramList();
} }
} }

2
device_display/src/main/java/com/xr/device_display/modules/analysis/controller/MeterReadingRecordController.java

@ -52,7 +52,7 @@ public class MeterReadingRecordController extends BaseController {
@PostMapping(value = "/getPresentReadingPage") @PostMapping(value = "/getPresentReadingPage")
public TableDataInfo getPresentReadingPage(@RequestBody MeterReadingRecordQueryVo vo){ public TableDataInfo getPresentReadingPage(@RequestBody MeterReadingRecordQueryVo vo){
PageHelper.startPage(vo.getPageNum(), vo.getPageSize()); PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
return getDataTable(meterReadingRecordService.getPresentReadingPageList(vo)); return getDataTable(meterReadingRecordService.getPresentReadingPage(vo));
} }
@PostMapping(value = "/export") @PostMapping(value = "/export")

2
device_display/src/main/java/com/xr/device_display/modules/analysis/mapper/MeterReadingRecordMapper.java

@ -41,8 +41,6 @@ public interface MeterReadingRecordMapper extends BaseMapper<MeterReadingRecord>
List<PresentReadingQueryDto> getPresentReadingPage(@Param("vo") MeterReadingRecordQueryVo vo); List<PresentReadingQueryDto> getPresentReadingPage(@Param("vo") MeterReadingRecordQueryVo vo);
List<PresentReadingQueryDto> getPresentReadingPageList(@Param("vo") MeterReadingRecordQueryVo vo);
// List<MeterReadingRecord> getMeterReadingRecordList(@Param("vo") MeterReadingRecordQueryVo vo); // List<MeterReadingRecord> getMeterReadingRecordList(@Param("vo") MeterReadingRecordQueryVo vo);

2
device_display/src/main/java/com/xr/device_display/modules/analysis/service/IHomePageService.java

@ -8,6 +8,4 @@ import java.util.List;
public interface IHomePageService { public interface IHomePageService {
AjaxResult getCardList(); AjaxResult getCardList();
AjaxResult getHistogramList();
} }

2
device_display/src/main/java/com/xr/device_display/modules/analysis/service/IMeterReadingRecordService.java

@ -25,7 +25,5 @@ public interface IMeterReadingRecordService extends IService<MeterReadingRecord>
List<PresentReadingQueryDto> getPresentReadingPage(MeterReadingRecordQueryVo vo); List<PresentReadingQueryDto> getPresentReadingPage(MeterReadingRecordQueryVo vo);
List<PresentReadingQueryDto> getPresentReadingPageList(MeterReadingRecordQueryVo vo);
AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo); AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo);
} }

70
device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/HomePageServiceImpl.java

@ -5,7 +5,10 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xr.device_display.config.common.AjaxResult; import com.xr.device_display.config.common.AjaxResult;
import com.xr.device_display.modules.analysis.dto.*; import com.xr.device_display.modules.analysis.dto.Card;
import com.xr.device_display.modules.analysis.dto.HomePageCardDto;
import com.xr.device_display.modules.analysis.dto.Series;
import com.xr.device_display.modules.analysis.dto.Title;
import com.xr.device_display.modules.analysis.entity.MeterAbnormalRecord; import com.xr.device_display.modules.analysis.entity.MeterAbnormalRecord;
import com.xr.device_display.modules.analysis.entity.MeterConfig; import com.xr.device_display.modules.analysis.entity.MeterConfig;
import com.xr.device_display.modules.analysis.entity.MeterType; import com.xr.device_display.modules.analysis.entity.MeterType;
@ -13,12 +16,10 @@ import com.xr.device_display.modules.analysis.service.IHomePageService;
import com.xr.device_display.modules.analysis.service.IMeterAbnormalRecordService; import com.xr.device_display.modules.analysis.service.IMeterAbnormalRecordService;
import com.xr.device_display.modules.analysis.service.IMeterConfigService; import com.xr.device_display.modules.analysis.service.IMeterConfigService;
import com.xr.device_display.modules.analysis.service.IMeterTypeService; import com.xr.device_display.modules.analysis.service.IMeterTypeService;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -36,46 +37,6 @@ public class HomePageServiceImpl implements IHomePageService {
@Autowired @Autowired
private IMeterTypeService meterTypeService; private IMeterTypeService meterTypeService;
@Override
public AjaxResult getHistogramList() {
AjaxResult ajax = AjaxResult.success();
// 获取所有在启用的表计类型
Map<Integer, String> typeMap = meterTypeService.list(
Wrappers.<MeterType>lambdaQuery().eq(MeterType::getStatus, 1))
.stream()
.collect(Collectors.toMap(MeterType::getId, MeterType::getMeterType));
// 获取所有启用的表计配置
List<MeterConfig> meterConfigList = meterConfigService.list(
Wrappers.<MeterConfig>lambdaQuery().eq(MeterConfig::getStatus, 1));
// 根据表计类型分组
Map<String, List<MeterConfig>> groupedByTypeName = meterConfigList.stream()
.collect(Collectors.groupingBy(
meterConfig -> typeMap.getOrDefault(meterConfig.getTypeId(), "未知类型"),
Collectors.toList()
));
// 查询未处理的异常表计记录
List<MeterAbnormalRecord> recordList = meterAbnormalRecordService.list(
Wrappers.<MeterAbnormalRecord>lambdaQuery().eq(MeterAbnormalRecord::getProcessingStatus, 0));
List<Integer> meterIdAbnormal = recordList.stream()
.map(MeterAbnormalRecord::getMeterId)
.collect(Collectors.toList());
List<HistogramDto> tableTypeList = new ArrayList<>();
// 根据表计类型分组生成卡片数据
groupedByTypeName.forEach((k, v) -> {
if (!k.equals("水位表")){
HistogramDto histogramDto = generateHistogramDto(k, v, meterIdAbnormal);
tableTypeList.add(histogramDto);
}
});
ajax.put("tableTypeList", tableTypeList);
return ajax;
}
@Override @Override
public AjaxResult getCardList() { public AjaxResult getCardList() {
@ -130,29 +91,6 @@ public class HomePageServiceImpl implements IHomePageService {
return ajax; return ajax;
} }
private HistogramDto generateHistogramDto(String typeName,List<MeterConfig> meterConfigs, List<Integer> meterIdAbnormal){
HistogramDto histogramDto = new HistogramDto();
dataset dataset = new dataset();
List<List<Object>> source = new ArrayList<>();
String[] array = {"product", "表计总数", "正常表计数", "异常表计数"};
List<Object> list = Arrays.asList((Object[]) array);
Long abnormalMeterCount = meterConfigs.stream()
.filter(meterConfig -> meterIdAbnormal.contains(meterConfig.getId()))
.count();
// 总数
Long all = (long) meterConfigs.size();
Long normal = all - abnormalMeterCount;
Object[] array1 = {typeName,all,normal.intValue(),abnormalMeterCount.intValue()};
source.add(list);
source.add(Arrays.asList(array1));
dataset.setSource(source);
histogramDto.setDataset(dataset);
return histogramDto;
}
private HomePageCardDto generateCardDto(String titleText, List<MeterConfig> meterConfigs, List<Integer> meterIdAbnormal) { private HomePageCardDto generateCardDto(String titleText, List<MeterConfig> meterConfigs, List<Integer> meterIdAbnormal) {
HomePageCardDto homePageCardDto = new HomePageCardDto(); HomePageCardDto homePageCardDto = new HomePageCardDto();
List<Card> data = new ArrayList<>(); List<Card> data = new ArrayList<>();

19
device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/MeterReadingRecordServiceImpl.java

@ -114,25 +114,6 @@ public class MeterReadingRecordServiceImpl extends ServiceImpl<MeterReadingRecor
return queryDtoList; return queryDtoList;
} }
@Override
public List<PresentReadingQueryDto> getPresentReadingPageList(MeterReadingRecordQueryVo vo) {
List<PresentReadingQueryDto> queryDtoList = readingRecordMapper.getPresentReadingPageList(vo);
List<MeterAbnormalRecord> abnormalRecordList = abnormalRecordService.list(new LambdaQueryWrapper<MeterAbnormalRecord>().eq(MeterAbnormalRecord::getProcessingStatus, 0));
queryDtoList.forEach(dto -> {
dto.setFlag(0);
if (CollUtil.isNotEmpty(abnormalRecordList)) {
if (abnormalRecordList.stream().filter(m -> m.getMeterId().equals(dto.getId())).findAny().isPresent()) {
dto.setFlag(1);
}
}
});
return queryDtoList;
}
@Override @Override
public AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo) { public AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo) {
String meterCode = vo.getMeterCode(); String meterCode = vo.getMeterCode();

2
device_display/src/main/resources/application-dev.yml

@ -54,7 +54,7 @@ spring:
# 数据库索引 # 数据库索引
database: 2 database: 2
# 密码 # 密码
password: 111111 password:
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
lettuce: lettuce:

2
device_display/src/main/resources/application-prod.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置

2
device_display/src/main/resources/application-test.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置

6
device_display/src/main/resources/application.yml

@ -21,9 +21,9 @@ spring:
# 国际化资源文件路径 # 国际化资源文件路径
basename: i18n/messages basename: i18n/messages
profiles: profiles:
active: dev #开发环境 # active: prod #开发环境
# active: test #测试环境5 active: dev #测试环境5
# active: prod #生产环境 #active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境
application: application:
name: deviceDisplay name: deviceDisplay

35
device_display/src/main/resources/modules/analysis/MeterReadingRecordMapper.xml

@ -118,41 +118,6 @@
</select> </select>
<select id="getPresentReadingPageList"
parameterType="com.xr.device_display.modules.analysis.vo.MeterReadingRecordQueryVo"
resultType="com.xr.device_display.modules.analysis.dto.PresentReadingQueryDto">
SELECT
mc.id,
mrr.meter_code,
mrr.meter_type_name,
mrr.reading_value,
mrr.meter_type_id,
t1.reading_time,
mc.owning_interval,
mc.device_name
FROM
( SELECT meter_id, MAX( reading_time ) AS reading_time FROM meter_reading_record GROUP BY meter_id ) AS t1
LEFT JOIN meter_reading_record AS mrr ON t1.meter_id = mrr.meter_id
AND t1.reading_time = mrr.reading_time
LEFT JOIN meter_config AS mc ON t1.meter_id = mc.id
<where>
AND mc.status = 1
<if test="vo.meterCode != null and vo.meterCode != ''">
AND mrr.meter_code LIKE CONCAT('%',#{vo.meterCode},'%')
</if>
<if test="vo.meterTypeId != null and vo.meterTypeId != ''">
AND mrr.meter_type_id = #{vo.meterTypeId}
</if>
<if test="vo.owningInterval != null and vo.owningInterval !=''">
AND owning_interval LIKE CONCAT('%',#{vo.owningInterval},'%')
</if>
<if test="vo.deviceName != null and vo.deviceName !=''">
AND mc.device_name LIKE CONCAT('%',#{vo.deviceName},'%')
</if>
</where>
ORDER BY mc.id
</select>
<select id="getPresentReadingPage" <select id="getPresentReadingPage"
parameterType="com.xr.device_display.modules.analysis.vo.MeterReadingRecordQueryVo" parameterType="com.xr.device_display.modules.analysis.vo.MeterReadingRecordQueryVo"
resultType="com.xr.device_display.modules.analysis.dto.PresentReadingQueryDto"> resultType="com.xr.device_display.modules.analysis.dto.PresentReadingQueryDto">

4
device_iec104/src/main/java/com/xr/iec104Server/iec104/server/SysDataHandler.java

@ -50,7 +50,7 @@ public class SysDataHandler implements DataHandler {
//回复总召唤确认 //回复总召唤确认
System.out.print("响应总召唤指令:"); System.out.print("响应总召唤指令:");
ctx.writeAndFlush(BasicInstruction104.getYesGeneralCallRuleDetail104()); ctx.writeAndFlush(BasicInstruction104.getYesGeneralCallRuleDetail104());
Thread.sleep(3000); Thread.sleep(1000);
//发送总召唤数据 //发送总召唤数据
QueryWrapper<ForwardChannel> query=new QueryWrapper<>(); QueryWrapper<ForwardChannel> query=new QueryWrapper<>();
query.eq("device_id", StaticPropUtil.deviceId); query.eq("device_id", StaticPropUtil.deviceId);
@ -65,7 +65,7 @@ public class SysDataHandler implements DataHandler {
//发送结束总召唤指令 //发送结束总召唤指令
System.out.print("总召唤遥测数据:"); System.out.print("总召唤遥测数据:");
ctx.writeAndFlush(detail); ctx.writeAndFlush(detail);
Thread.sleep(3000); Thread.sleep(1000);
//发送结束总召唤指令 //发送结束总召唤指令
System.out.print("总召唤结束指令:"); System.out.print("总召唤结束指令:");
ctx.writeAndFlush(BasicInstruction104.getEndGeneralCallRuleDetail104()); ctx.writeAndFlush(BasicInstruction104.getEndGeneralCallRuleDetail104());

2
device_iec104/src/main/resources/application-dev.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
db3: db3:

2
device_iec104/src/main/resources/application-prod.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: root password: root
db3: db3:

2
device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java

@ -30,7 +30,7 @@ public class Iec61850ClentApplication implements CommandLineRunner {
@Override @Override
@Async @Async
public void run(String[] args){ public void run(String[] args){
Iec61850clent iec61850clent=new Iec61850clent(args,"192.168.1.254",102); Iec61850clent iec61850clent=new Iec61850clent(args,"192.168.1.83",102);
executor.execute(iec61850clent); executor.execute(iec61850clent);
// Iec61850clent iec61850clent1=new Iec61850clent(args,"192.168.1.138",102); // Iec61850clent iec61850clent1=new Iec61850clent(args,"192.168.1.138",102);
// executor.submit(iec61850clent1); // executor.submit(iec61850clent1);

113
device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/Iec61850Eunm.java

@ -147,75 +147,50 @@ public enum Iec61850Eunm {
ythdy134("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm81","通信电源_通信中断"), ythdy134("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm81","通信电源_通信中断"),
ythdy135("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm82","UPS电源_通信中断"), ythdy135("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm82","UPS电源_通信中断"),
ythdy136("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm83","事故照明_通信中断"), ythdy136("192.168.2.10","一体化电源","TEMPLATELD0/c12_0GGIO0.Alm83","事故照明_通信中断"),
camera1("192.168.1.137","camera","TEMPLATELD0/c11_0GGIO0.Ang1","192168125~指针表"), camera1("192.168.1.137","camera","TEMPLATELD0/c11_0GGIO0.Ang1","192.168.1.25-指针表"),
camera2("192.168.1.137","camera","TEMPLATELD0/c11_1GGIO0.Ang1","192168126~指针表"), camera2("192.168.1.137","camera","TEMPLATELD0/c11_1GGIO0.Ang1","192.168.1.26-指针表"),
camera3("192.168.1.137","camera","TEMPLATELD0/c11_2GGIO0.Ang1","192168128~指针表"), camera3("192.168.1.137","camera","TEMPLATELD0/c11_2GGIO0.Ang1","192.168.1.28-指针表"),
camera4("192.168.1.137","camera","TEMPLATELD0/c11_3GGIO0.Ang1","192168124~指针表"), camera4("192.168.1.137","camera","TEMPLATELD0/c11_3GGIO0.Ang1","192.168.1.24-指针表"),
camera5("192.168.1.137","camera","TEMPLATELD0/c11_4GGIO0.Ang1","192168123~指针表"), camera5("192.168.1.137","camera","TEMPLATELD0/c11_4GGIO0.Ang1","192.168.1.23-指针表"),
camera6("192.168.1.137","camera","TEMPLATELD0/c11_5GGIO0.Ang1","192168122~指针表"), camera6("192.168.1.137","camera","TEMPLATELD0/c11_5GGIO0.Ang1","192.168.1.22-指针表"),
camera7("192.168.1.137","camera","TEMPLATELD0/c11_6GGIO0.Ang1","192168136~指针"), camera7("192.168.1.137","camera","TEMPLATELD0/c11_6GGIO0.Ang1","192.168.1.36-指针"),
camera8("192.168.1.137","camera","TEMPLATELD0/c11_6GGIO0.Ang2","192168136~数字"), camera8("192.168.1.137","camera","TEMPLATELD0/c11_6GGIO0.Ang2","192.168.1.36-数字"),
camera9("192.168.1.137","camera","TEMPLATELD0/c11_7GGIO0.Ang1","192168135~指针"), camera9("192.168.1.137","camera","TEMPLATELD0/c11_7GGIO0.Ang1","192.168.1.35-指针"),
camera10("192.168.1.137","camera","TEMPLATELD0/c11_7GGIO0.Ang2","192168135~数字"), camera10("192.168.1.137","camera","TEMPLATELD0/c11_7GGIO0.Ang2","192.168.1.35-数字"),
camera11("192.168.1.137","camera","TEMPLATELD0/c11_8GGIO0.Ang1","192168134~指针"), camera11("192.168.1.137","camera","TEMPLATELD0/c11_8GGIO0.Ang1","192.168.1.34-指针"),
camera12("192.168.1.137","camera","TEMPLATELD0/c11_8GGIO0.Ang2","192168134~数字"), camera12("192.168.1.137","camera","TEMPLATELD0/c11_8GGIO0.Ang2","192.168.1.34-数字"),
camera13("192.168.1.137","camera","TEMPLATELD0/c11_9GGIO0.Ang1","192168132~指针表"), camera13("192.168.1.137","camera","TEMPLATELD0/c11_9GGIO0.Ang1","192.168.1.32-指针表"),
camera14("192.168.1.137","camera","TEMPLATELD0/c11_10GGIO0.Ang1","192168131~指针表"), camera14("192.168.1.137","camera","TEMPLATELD0/c11_10GGIO0.Ang1","192.168.1.31-指针表"),
camera15("192.168.1.137","camera","TEMPLATELD0/c11_11GGIO0.Ang1","192168127~指针表"), camera15("192.168.1.137","camera","TEMPLATELD0/c11_11GGIO0.Ang1","192.168.1.27-指针表"),
camera16("192.168.1.137","camera","TEMPLATELD0/c11_12GGIO0.Ang1","192168121~数字表"), camera16("192.168.1.137","camera","TEMPLATELD0/c11_12GGIO0.Ang1","192.168.1.21-遥测0"),
camera17("192.168.1.137","camera","TEMPLATELD0/c11_13GGIO0.Ang1","192168137~数字表"), camera17("192.168.1.137","camera","TEMPLATELD0/c11_12GGIO0.Ang2","192.168.1.21-遥测1"),
camera18("192.168.1.137","camera","TEMPLATELD0/c11_14GGIO0.Ang1","192168129~指针表"), camera18("192.168.1.137","camera","TEMPLATELD0/c11_12GGIO0.Ang3","192.168.1.21-遥测2"),
camera19("192.168.1.137","camera","TEMPLATELD0/c11_15GGIO0.Ang1","192168130~指针表"), camera19("192.168.1.137","camera","TEMPLATELD0/c11_13GGIO0.Ang1","192.168.1.37-数字表"),
camera20("192.168.1.137","camera","TEMPLATELD0/c11_16GGIO0.Ang1","192168143~指针表"), camera20("192.168.1.137","camera","TEMPLATELD0/c11_14GGIO0.Ang1","192.168.1.29-指针表"),
camera21("192.168.1.137","camera","TEMPLATELD0/c11_17GGIO0.Ang1","192168139~指针表"), camera21("192.168.1.137","camera","TEMPLATELD0/c11_15GGIO0.Ang1","192.168.1.30-指针表"),
camera22("192.168.1.137","camera","TEMPLATELD0/c11_18GGIO0.Ang1","192168146~指针"), camera22("192.168.1.137","camera","TEMPLATELD0/c11_16GGIO0.Ang1","192.168.1.43-指针表"),
camera23("192.168.1.137","camera","TEMPLATELD0/c11_18GGIO0.Ang2","192168146~数字"), camera23("192.168.1.137","camera","TEMPLATELD0/c11_17GGIO0.Ang1","192.168.1.39-指针表"),
camera24("192.168.1.137","camera","TEMPLATELD0/c11_19GGIO0.Ang1","192168138~指针表"), camera24("192.168.1.137","camera","TEMPLATELD0/c11_18GGIO0.Ang1","192.168.1.46-指针"),
camera25("192.168.1.137","camera","TEMPLATELD0/c11_20GGIO0.Ang1","192168142~指针表"), camera25("192.168.1.137","camera","TEMPLATELD0/c11_18GGIO0.Ang2","192.168.1.46-数字"),
camera26("192.168.1.137","camera","TEMPLATELD0/c11_21GGIO0.Ang1","19216816~指针表"), camera26("192.168.1.137","camera","TEMPLATELD0/c11_19GGIO0.Ang1","192.168.1.38-指针表"),
camera27("192.168.1.137","camera","TEMPLATELD0/c11_22GGIO0.Ang1","19216817~指针表"), camera27("192.168.1.137","camera","TEMPLATELD0/c11_20GGIO0.Ang1","192.168.1.42-指针表"),
camera28("192.168.1.137","camera","TEMPLATELD0/c11_23GGIO0.Ang1","19216818~指针表"), camera28("192.168.1.137","camera","TEMPLATELD0/c11_21GGIO0.Ang1","192.168.1.6-指针表"),
camera29("192.168.1.137","camera","TEMPLATELD0/c11_24GGIO0.Ang1","19216819~指针表"), camera29("192.168.1.137","camera","TEMPLATELD0/c11_22GGIO0.Ang1","192.168.1.7-指针表"),
camera30("192.168.1.137","camera","TEMPLATELD0/c11_25GGIO0.Ang1","192168140~指针表"), camera30("192.168.1.137","camera","TEMPLATELD0/c11_23GGIO0.Ang1","192.168.1.8-指针表"),
camera31("192.168.1.137","camera","TEMPLATELD0/c11_26GGIO0.Ang1","192168144~指针"), camera31("192.168.1.137","camera","TEMPLATELD0/c11_24GGIO0.Ang1","192.168.1.9-指针表"),
camera32("192.168.1.137","camera","TEMPLATELD0/c11_26GGIO0.Ang2","192168144~数字"), camera32("192.168.1.137","camera","TEMPLATELD0/c11_25GGIO0.Ang1","192.168.1.40-指针表"),
camera33("192.168.1.137","camera","TEMPLATELD0/c11_27GGIO0.Ang1","192168145~指针"), camera33("192.168.1.137","camera","TEMPLATELD0/c27_0GGIO0.Ang1","192.168.3.12-指针表"),
camera34("192.168.1.137","camera","TEMPLATELD0/c11_27GGIO0.Ang2","192168145~数字"), camera34("192.168.1.137","camera","TEMPLATELD0/c27_1GGIO0.Ang1","192.168.3.11-指针表"),
camera35("192.168.1.137","camera","TEMPLATELD0/c11_28GGIO0.Ang1","192168147~数字表"), camera35("192.168.1.137","camera","TEMPLATELD0/c27_2GGIO0.Ang1","192.168.3.14-指针表"),
camera36("192.168.1.137","camera","TEMPLATELD0/c11_29GGIO0.Ang1","192168148~数字表"), camera36("192.168.1.137","camera","TEMPLATELD0/c27_3GGIO0.Ang1","192.168.3.20-指针表"),
camera37("192.168.1.137","camera","TEMPLATELD0/c11_30GGIO0.Ang1","192168150~数字表"), camera37("192.168.1.137","camera","TEMPLATELD0/c27_4GGIO0.Ang1","192.168.3.21-指针表"),
camera38("192.168.1.137","camera","TEMPLATELD0/c11_31GGIO0.Ang1","192168151~数字表"), camera38("192.168.1.137","camera","TEMPLATELD0/c27_5GGIO0.Ang1","192.168.3.13-指针表"),
camera39("192.168.1.137","camera","TEMPLATELD0/c11_32GGIO0.Ang1","192168152~数字表"), camera39("192.168.1.137","camera","TEMPLATELD0/c27_6GGIO0.Ang1","192.168.3.16-指针"),
camera40("192.168.1.137","camera","TEMPLATELD0/c11_33GGIO0.Ang1","192168153~数字表"), camera40("192.168.1.137","camera","TEMPLATELD0/c27_6GGIO0.Ang2","192.168.3.16-数字"),
camera41("192.168.1.137","camera","TEMPLATELD0/c11_34GGIO0.Ang1","192168154~数字表"), camera41("192.168.1.137","camera","TEMPLATELD0/c27_7GGIO0.Ang1","192.168.3.17-指针"),
camera42("192.168.1.137","camera","TEMPLATELD0/c11_35GGIO0.Ang1","192168155~数字表"), camera42("192.168.1.137","camera","TEMPLATELD0/c27_7GGIO0.Ang2","192.168.3.17-数字"),
camera43("192.168.1.137","camera","TEMPLATELD0/c11_36GGIO0.Ang1","192168156~数字表"), camera43("192.168.1.137","camera","TEMPLATELD0/c27_8GGIO0.Ang1","192.168.3.18-指针表"),
camera44("192.168.1.137","camera","TEMPLATELD0/c11_37GGIO0.Ang1","192168157~数字表"), camera44("192.168.1.137","camera","TEMPLATELD0/c27_8GGIO0.Ang2","192.168.3.18-数字表");
camera45("192.168.1.137","camera","TEMPLATELD0/c11_38GGIO0.Ang1","192168160~数字表"),
camera46("192.168.1.137","camera","TEMPLATELD0/c11_39GGIO0.Ang1","192168161~数字表"),
camera47("192.168.1.137","camera","TEMPLATELD0/c11_40GGIO0.Ang1","192168170~数字表"),
camera48("192.168.1.137","camera","TEMPLATELD0/c11_41GGIO0.Ang1","192168171~数字表"),
camera62("192.168.1.137","camera","TEMPLATELD0/c11_42GGIO0.Ang1","192168133~指针表"),
camera63("192.168.1.137","camera","TEMPLATELD0/c11_43GGIO0.Ang1","192168141~指针表"),
camera49("192.168.1.137","camera","TEMPLATELD0/c27_0GGIO0.Ang1","192168312~指针表"),
camera50("192.168.1.137","camera","TEMPLATELD0/c27_1GGIO0.Ang1","192168311~指针表"),
camera51("192.168.1.137","camera","TEMPLATELD0/c27_2GGIO0.Ang1","192168314~指针表"),
camera52("192.168.1.137","camera","TEMPLATELD0/c27_3GGIO0.Ang1","192168320~指针表"),
camera53("192.168.1.137","camera","TEMPLATELD0/c27_4GGIO0.Ang1","192168321~指针表"),
camera54("192.168.1.137","camera","TEMPLATELD0/c27_5GGIO0.Ang1","192168313~指针表"),
camera55("192.168.1.137","camera","TEMPLATELD0/c27_6GGIO0.Ang1","192168316~指针"),
camera56("192.168.1.137","camera","TEMPLATELD0/c27_6GGIO0.Ang2","192168316~数字"),
camera57("192.168.1.137","camera","TEMPLATELD0/c27_7GGIO0.Ang1","192168317~指针"),
camera58("192.168.1.137","camera","TEMPLATELD0/c27_7GGIO0.Ang2","192168317~数字"),
camera59("192.168.1.137","camera","TEMPLATELD0/c27_8GGIO0.Ang1","192168318~指针"),
camera60("192.168.1.137","camera","TEMPLATELD0/c27_8GGIO0.Ang2","192168318~数字"),
camera61("192.168.1.137","camera","TEMPLATELD0/c27_9GGIO0.Ang1","192168315~指针表"),
camera64("192.168.1.137","camera","TEMPLATELD0/c27_10GGIO0.Ang1","192168319~指针表"),
camera65("192.168.1.137","camera","TEMPLATELD0/c27_10GGIO0.Ang2","192168319~数字表"),
camera66("192.168.1.254","camera","TEMPLATELD0/c5_0GGIO0.Ang1","192168110~指针表"),
camera67("192.168.1.254","camera","TEMPLATELD0/c5_1GGIO0.Ang1","192168111~数字表");

4
device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java

@ -2,6 +2,7 @@ package com.xr.iec61850clent.common.util;
import com.beanit.iec61850bean.FcModelNode; import com.beanit.iec61850bean.FcModelNode;
import com.beanit.iec61850bean.ModelNode; import com.beanit.iec61850bean.ModelNode;
import com.xr.iec61850clent.models.entity.ExcelConfig;
import com.xr.iec61850clent.models.entity.Lds5000; import com.xr.iec61850clent.models.entity.Lds5000;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -15,8 +16,9 @@ public class ModeUtil {
public static Lds5000 getLdsVlue(String ip,FcModelNode node){ public static Lds5000 getLdsVlue(String ip,FcModelNode node){
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
ExcelConfig eunm = IEC61850Config.getExcelConfig(ip,node.getReference().toString());
Lds5000 lds5000=null; Lds5000 lds5000=null;
Iec61850Eunm eunm=Iec61850Eunm.getIec61850EunmByIp(ip,node.getReference().toString()); // Iec61850Eunm eunm=Iec61850Eunm.getIec61850EunmByIp(ip,node.getReference().toString());
if(eunm!=null){ if(eunm!=null){
lds5000=new Lds5000(); lds5000=new Lds5000();
if(eunm.getDevice().equals("一体化电源")){ if(eunm.getDevice().equals("一体化电源")){

2
device_iec61850clent/src/main/resources/application-dev.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
db3: db3:

6
device_iec61850clent/src/main/resources/application-prod.yml

@ -11,19 +11,19 @@ spring:
db1: db1:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/device_system?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.93:3306/device_system?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.93:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
db3: db3:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.93:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
# db1: # db1:

14
device_iec61850clent/src/main/resources/application-test.yml

@ -17,15 +17,15 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
db3:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
# db3:
# driver-class-name: com.mysql.cj.jdbc.Driver
# type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:mysql://localhost:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
# username: root
# password: 123456
#Hikari连接池配置 #Hikari连接池配置
hikari: hikari:
#池中维护的最小空闲连接数 #池中维护的最小空闲连接数

2
device_iec61850clent/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: test #开发环境 active: prod #开发环境
# active: test #测试环境5 # active: test #测试环境5
#active: prod #生产环境 #active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境

2
device_iec61850server/src/main/resources/application-dev.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
db3: db3:

2
device_iec61850server/src/main/resources/application-prod.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: root password: root
db3: db3:

2
device_iec61850server/src/main/resources/application-test.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
db3: db3:

2
device_iec61850server/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: test #开发环境 active: dev #开发环境
# active: test #测试环境5 # active: test #测试环境5
#active: prod #生产环境 #active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境

2
device_modbus/src/main/resources/application-dev.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
db3: db3:

2
device_modbus/src/main/resources/application-prod.yml

@ -19,7 +19,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: root password: root
db3: db3:

42
device_udpclent/pom.xml

@ -96,10 +96,39 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.cloud</groupId>-->
<!-- <artifactId>spring-cloud-stream-binder-kafka</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.python</groupId>-->
<!-- <artifactId>jython-slim</artifactId>-->
<!-- <version>2.7.2</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.github.milg0</groupId>-->
<!-- <artifactId>onvif</artifactId>-->
<!-- <version>16.3.16</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>netty-all</artifactId> <artifactId>httpclient</artifactId>
<version>4.1.65.Final</version> <version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -112,6 +141,13 @@
<include>**/*</include> <include>**/*</include>
</includes> </includes>
</resource> </resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>

2
device_udpclent/src/main/java/com/xr/device_udpclent/DeviceUdpclentApplication.java

@ -5,9 +5,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication @SpringBootApplication
@EnableAsync//开启异步 @EnableAsync//开启异步
@EnableScheduling//开启定时任务
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
public class DeviceUdpclentApplication { public class DeviceUdpclentApplication {

15
device_udpclent/src/main/java/com/xr/device_udpclent/models/service/impl/UdpClientServiceImpl.java

@ -1,5 +1,7 @@
package com.xr.device_udpclent.models.service.impl; package com.xr.device_udpclent.models.service.impl;
import com.xr.device_udpclent.models.entity.SendUdpLog;
import com.xr.device_udpclent.models.service.SendUdpLogService;
import com.xr.device_udpclent.models.service.UdpClientService; import com.xr.device_udpclent.models.service.UdpClientService;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import io.netty.channel.socket.DatagramChannel; import io.netty.channel.socket.DatagramChannel;
@ -9,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.Date;
@Service @Service
public class UdpClientServiceImpl implements UdpClientService { public class UdpClientServiceImpl implements UdpClientService {
@ -19,13 +22,25 @@ public class UdpClientServiceImpl implements UdpClientService {
@Autowired @Autowired
private InetSocketAddress udpServerAddress; private InetSocketAddress udpServerAddress;
@Autowired
private SendUdpLogService sendUdpLogService;
@Override @Override
public void sendData(String data) { public void sendData(String data) {
SendUdpLog sendUdbLog=new SendUdpLog();
sendUdbLog.setRequestMsg(data);
sendUdbLog.setRequestTime(new Date());
sendUdbLog.setMessageId(data.split("\t")[0]);
try { try {
udpChannel.writeAndFlush(new DatagramPacket( udpChannel.writeAndFlush(new DatagramPacket(
Unpooled.copiedBuffer(data, CharsetUtil.UTF_8), udpServerAddress)).sync(); Unpooled.copiedBuffer(data, CharsetUtil.UTF_8), udpServerAddress)).sync();
sendUdbLog.setRequestStatus("0");
} catch (Exception e) { } catch (Exception e) {
sendUdbLog.setRequestStatus("1");
sendUdbLog.setResMsg(e.getMessage());
sendUdbLog.setResTime(new Date());
e.printStackTrace(); e.printStackTrace();
} }
sendUdpLogService.save(sendUdbLog);
} }
} }

52
device_udpclent/src/main/resources/application-dev.yml

@ -17,13 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 5ea47c0bdd7146ebbd53020eca@672307
db3:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
#Hikari连接池配置 #Hikari连接池配置
@ -49,20 +43,32 @@ spring:
timeout-seconds: 1000 timeout-seconds: 1000
config: config:
enabled: false enabled: false
# redis 相关 stream:
redis: kafka:
host: ${REDIS_URL:localhost} binder:
port: ${REDIS_PORT:6379} brokers: localhost:9092 #Kafka的消息中间件服务器
password: ${REDIS_PWD:111111} zk-nodes: localhost:2181 #Zookeeper的节点,如果集群,后面加,号分隔
timeout: 10000 auto-create-topics: false #如果设置为false,就不会自动创建Topic 有可能你Topic还没创建就直接调用了。
jedis: # kafka:
pool: # bootstrap-servers: localhost:9092
max-active: 1000 # consumer:
max-wait: -1ms # group-id: ai-consumer-group
max-idle: 10 #kafka:
min-idle: 5 # topic: ai-topic
# # redis 相关
# redis:
# host: ${REDIS_URL:localhost}
# port: ${REDIS_PORT:6379}
# password: ${REDIS_PWD:111111}
# timeout: 10000
# jedis:
# pool:
# max-active: 1000
# max-wait: -1ms
# max-idle: 10
# min-idle: 5
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mappers/**/*Mapper.xml mapper-locations: classpath:mapper/*Mapper.xml
type-aliases-package: com.xr.device_udpclent type-aliases-package: com.xr.device_udpclent
# 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射 # 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射
configuration: configuration:
@ -84,6 +90,12 @@ udp:
server: server:
host: localhost host: localhost
port: 9300 port: 9300
upLoad:
path: D:\\images\\images\\
url: http://localhost:85/upload/
python:
path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
modelPath: D:\\smartGrid\\smartGrid\\models
eureka: eureka:
instance: instance:
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}

21
device_udpclent/src/main/resources/application-prod.yml

@ -17,13 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
db3:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置
@ -62,7 +56,7 @@ spring:
max-idle: 10 max-idle: 10
min-idle: 5 min-idle: 5
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mappers/*Mapper.xml mapper-locations: classpath:mapper/*Mapper.xml
type-aliases-package: com.xr.device_udpclent type-aliases-package: com.xr.device_udpclent
# 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射 # 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射
configuration: configuration:
@ -80,7 +74,16 @@ logging:
boot: boot:
autoconfigure: autoconfigure:
logging: debug logging: debug
udp:
server:
host: localhost
port: 9300
python:
path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
modelPath: D:\\smartGrid\\smartGrid\\models
upLoad:
path: D:\\images\\images\\
url: http://localhost:85/upload/
eureka: eureka:
instance: instance:
instance-id: ${spring.cloud.client.ip-address}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${server.port}

13
device_udpclent/src/main/resources/application.yml

@ -5,19 +5,6 @@ spring:
#active: prod #生产环境 #active: prod #生产环境
application: application:
name: deviceUdpClent name: deviceUdpClent
mybatis-plus:
mapper-locations: classpath:mappers/*Mapper.xml
type-aliases-package: com.xr.udpclent
# 在查询语句的是否,对Map或者是entity进行映射赋值的时候null也进行映射。默认false,不进行映射
configuration:
map-underscore-to-camel-case: true
call-setters-on-nulls: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 设置更新或者修改的时候的策略,不进行校验,否则如果是null则不会进行更新或者插入,当然在@TableField注解进行指定单个字段
global-config:
db-config:
insert-strategy: ignored
update-strategy: ignored
logging: logging:
org: org:
springframework: springframework:

4
device_udpserver/src/main/java/com/xr/device_udpserver/common/UdpServerHandler.java

@ -23,8 +23,10 @@ public class UdpServerHandler extends SimpleChannelInboundHandler<DatagramPacket
String message = new String(data, Charset.forName("UTF-8")); String message = new String(data, Charset.forName("UTF-8"));
System.out.println("Received message from client: " + message); System.out.println("Received message from client: " + message);
String msg = message.split("\t")[0];
// 回复客户端消息 // 回复客户端消息
String replyMessage = "Hello, client!"; String replyMessage = msg+":已收到";
byte[] replyData = replyMessage.getBytes(Charset.forName("UTF-8")); byte[] replyData = replyMessage.getBytes(Charset.forName("UTF-8"));
DatagramPacket replyPacket = new DatagramPacket(Unpooled.copiedBuffer(replyData), packet.sender()); DatagramPacket replyPacket = new DatagramPacket(Unpooled.copiedBuffer(replyData), packet.sender());
ctx.writeAndFlush(replyPacket); ctx.writeAndFlush(replyPacket);

2
device_udpserver/src/main/resources/application-dev.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 5ea47c0bdd7146ebbd53020eca@672307 password: 5ea47c0bdd7146ebbd53020eca@672307
db3: db3:

2
device_udpserver/src/main/resources/application-prod.yml

@ -17,7 +17,7 @@ spring:
db2: db2:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
db3: db3:

6
drone_data/src/main/java/com/xr/drone/DroneDataApplication.java

@ -47,9 +47,9 @@ public class DroneDataApplication implements CommandLineRunner {
@Async @Async
@Override @Override
public void run(String[] args) throws Exception{ public void run(String[] args) throws Exception{
// Thread.sleep(3000); Thread.sleep(3000);
// MqttClent mqttClent=new MqttClent(); MqttClent mqttClent=new MqttClent();
// mqttClent.start(); mqttClent.start();
// MqttConnect mqttConnect = new MqttConnect(mqttConfiguration); // MqttConnect mqttConnect = new MqttConnect(mqttConfiguration);
// mqttConnect.start(); // mqttConnect.start();
} }

1
drone_data/src/main/resources/application-dev.yml

@ -28,6 +28,7 @@ service:
path: http://123.249.26.7/indoorUavFlightControlBackend path: http://123.249.26.7/indoorUavFlightControlBackend
userName: admin userName: admin
password: 888888 password: 888888
shiwai:
spring: spring:
mqtt: mqtt:
username: admin username: admin

12
drone_data/src/main/resources/application-prod.yml

@ -25,9 +25,10 @@ oss:
service: service:
dajiang: http://123.249.26.7 dajiang: http://123.249.26.7
shinei: shinei:
path: http://192.168.1.185/indoorUavFlightControlBackend path: http://192.168.1.2/indoorUavFlightControlBackend
userName: admin userName: admin
password: 888888 password: 888888
shiwai:
spring: spring:
mqtt: mqtt:
@ -44,12 +45,3 @@ mqtt:
keep: keep:
alive: alive:
interval: 20 interval: 20
work:
mqtt:
username: admin
password: public
clientId: publish_client
broker: tcp://localhost:1883
topic: mqtt/test
timeout: 30000
interval: 20

2
drone_data/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: prod #开发环境 active: dev #开发环境
application: application:
name: droneData name: droneData
devtools: devtools:

91
pom.xml

@ -22,38 +22,13 @@
</modules> </modules>
<properties> <properties>
<direwolf.version>1.2.2.0-20200811</direwolf.version>
<spring-boot.version>2.0.8.RELEASE</spring-boot.version> <spring-boot.version>2.0.8.RELEASE</spring-boot.version>
<spring-cloud.version>Finchley.SR4</spring-cloud.version> <spring-cloud.version>Finchley.SR4</spring-cloud.version>
<spring-platform.version>Cairo-SR7</spring-platform.version> <spring-platform.version>Cairo-SR7</spring-platform.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring-boot-admin.version>2.0.5</spring-boot-admin.version> <spring-boot-admin.version>2.0.5</spring-boot-admin.version>
<hutool.version>4.5.0</hutool.version>
<mybatis.version>3.4.4</mybatis.version>
<mybatis-spring.version>2.0.0</mybatis-spring.version>
<oracle.version>11.2.0.4.0-atlassian-hosted</oracle.version>
<ndsjdbc.version>1.0</ndsjdbc.version>
<avtiviti.version>5.22.0</avtiviti.version>
<kaptcha.version>0.0.9</kaptcha.version>
<elastic-job.version>2.0.0</elastic-job.version>
<curator.version>2.10.0</curator.version>
<velocity.version>1.7</velocity.version>
<lcn.version>4.1.0</lcn.version>
<jasypt.version>2.1.0</jasypt.version>
<logstash.version>4.11</logstash.version> <logstash.version>4.11</logstash.version>
<truelicense.version>1.33</truelicense.version> <truelicense.version>1.33</truelicense.version>
<elastic-job-lite.version>2.1.5</elastic-job-lite.version>
<!--<security.oauth.version>2.3.3.RELEASE</security.oauth.version>-->
<jackson.modules>2.9.8</jackson.modules> <jackson.modules>2.9.8</jackson.modules>
<ttl.version>2.10.1</ttl.version>
<!--zipkin2.12.x需要此版本jooq -->
<jooq.version>3.11.9</jooq.version>
<kafka-collector.version>2.4.1</kafka-collector.version>
<zipkin.version>2.12.2</zipkin.version>
<zipkin-storage-mysql.version>2.8.4</zipkin-storage-mysql.version>
<zipkin-storage-elasticsearch.version>2.12.9</zipkin-storage-elasticsearch.version>
<skywalking.version>6.0.0-GA</skywalking.version> <skywalking.version>6.0.0-GA</skywalking.version>
<shiro.version>1.3.2</shiro.version> <shiro.version>1.3.2</shiro.version>
<druid.version>1.1.6</druid.version> <druid.version>1.1.6</druid.version>
@ -62,12 +37,10 @@
<flying-saucer-pdf.version>9.1.5</flying-saucer-pdf.version> <flying-saucer-pdf.version>9.1.5</flying-saucer-pdf.version>
<axis2.version>1.6.1</axis2.version> <axis2.version>1.6.1</axis2.version>
<dependencies.version>0.0.17</dependencies.version> <dependencies.version>0.0.17</dependencies.version>
<mybatisplus.version>3.4.1</mybatisplus.version> <lombok.version>1.18.12</lombok.version>
<gson.version>2.8.5</gson.version> <netty.version>4.1.42.Final</netty.version>
<joda.time.version>2.9.9</joda.time.version> <poi.version>3.9</poi.version>
<commons.io.version>2.5</commons.io.version> <joda-time.version>2.10</joda-time.version>
<jeecgboot.version>3.0</jeecgboot.version>
<swagger.version>3.0.0</swagger.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -184,6 +157,7 @@
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!--测试依赖 --> <!--测试依赖 -->
@ -229,61 +203,20 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>4.1.42.Final</version> <version>${netty.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency> </dependency>
<!-- 新增poi 3.9版本 -->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi</artifactId>-->
<!-- <version>3.9</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>3.9</version> <version>${poi.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<!-- <build>-->
<!-- <finalName>${project.name}</finalName>-->
<!-- <pluginManagement>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <version>${spring-boot.version}</version>-->
<!-- <configuration>-->
<!-- <finalName>${project.build.finalName}</finalName>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </pluginManagement>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <artifactId>maven-compiler-plugin</artifactId>-->
<!-- <version>3.8.0</version>-->
<!-- <configuration>-->
<!-- <target>${maven.compiler.target}</target>-->
<!-- <source>${maven.compiler.source}</source>-->
<!-- <encoding>UTF-8</encoding>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>pl.project13.maven</groupId>-->
<!-- <artifactId>git-commit-id-plugin</artifactId>-->
<!-- <version>2.2.5</version>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project> </project>

Loading…
Cancel
Save