Browse Source

修改部署内容

dev-sn
yj 2 years ago
parent
commit
36acefa5ba
  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. 3
      device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java
  5. 21
      device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java
  6. 4
      device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java
  7. 59
      device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
  8. 21
      device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java
  9. 9
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java
  10. 55
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
  11. 38
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java
  12. 23
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java
  13. 15
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java
  14. 2
      device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java
  15. 17
      device_cars/src/main/resources/application-dev.yml
  16. 14
      device_cars/src/main/resources/application-prod.yml
  17. 14
      device_cars/src/main/resources/application-test.yml
  18. 1
      device_cars/src/main/resources/application.yml
  19. 11
      device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml
  20. 2
      device_display/pom.xml
  21. 2
      device_display/src/main/java/com/xr/device_display/config/common/SecurityConfig.java
  22. 2
      device_display/src/main/java/com/xr/device_display/config/utils/CodeGenUtil.java
  23. 9
      device_display/src/main/java/com/xr/device_display/modules/analysis/controller/MeterReadingRecordController.java
  24. 21
      device_display/src/main/java/com/xr/device_display/modules/analysis/controller/ReferenceDataController.java
  25. 3
      device_display/src/main/java/com/xr/device_display/modules/analysis/entity/MeterConfig.java
  26. 4
      device_display/src/main/java/com/xr/device_display/modules/analysis/entity/MeterReadingRecord.java
  27. 50
      device_display/src/main/java/com/xr/device_display/modules/analysis/entity/ReferenceData.java
  28. 2
      device_display/src/main/java/com/xr/device_display/modules/analysis/mapper/MeterConfigMapper.java
  29. 16
      device_display/src/main/java/com/xr/device_display/modules/analysis/mapper/ReferenceDataMapper.java
  30. 6
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/IMeterReadingRecordService.java
  31. 16
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/IReferenceDataService.java
  32. 189
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/MeterReadingRecordServiceImpl.java
  33. 20
      device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/ReferenceDataServiceImpl.java
  34. 2
      device_display/src/main/resources/application-prod.yml
  35. 2
      device_display/src/main/resources/application-test.yml
  36. 4
      device_display/src/main/resources/application.yml
  37. 57
      device_display/src/main/resources/modules/analysis/MeterConfigMapper.xml
  38. 14
      device_display/src/main/resources/modules/analysis/ReferenceDataMapper.xml
  39. 4
      device_iec104/src/main/java/com/xr/iec104Server/iec104/server/SysDataHandler.java
  40. 2
      device_iec104/src/main/resources/application-dev.yml
  41. 2
      device_iec104/src/main/resources/application-prod.yml
  42. 2
      device_iec61850clent/src/main/java/com/xr/iec61850clent/Iec61850ClentApplication.java
  43. 4
      device_iec61850clent/src/main/java/com/xr/iec61850clent/common/util/ModeUtil.java
  44. 2
      device_iec61850clent/src/main/resources/application-dev.yml
  45. 6
      device_iec61850clent/src/main/resources/application-prod.yml
  46. 2
      device_iec61850clent/src/main/resources/application-test.yml
  47. 2
      device_iec61850clent/src/main/resources/application.yml
  48. 2
      device_iec61850server/src/main/resources/application-dev.yml
  49. 2
      device_iec61850server/src/main/resources/application-prod.yml
  50. 2
      device_iec61850server/src/main/resources/application-test.yml
  51. 2
      device_iec61850server/src/main/resources/application.yml
  52. 2
      device_modbus/src/main/java/com/xr/clent/tool/ModbusUtils.java
  53. 2
      device_modbus/src/main/resources/application-dev.yml
  54. 2
      device_modbus/src/main/resources/application-prod.yml
  55. 42
      device_udpclent/pom.xml
  56. 2
      device_udpclent/src/main/java/com/xr/device_udpclent/DeviceUdpclentApplication.java
  57. 15
      device_udpclent/src/main/java/com/xr/device_udpclent/models/service/impl/UdpClientServiceImpl.java
  58. 52
      device_udpclent/src/main/resources/application-dev.yml
  59. 21
      device_udpclent/src/main/resources/application-prod.yml
  60. 13
      device_udpclent/src/main/resources/application.yml
  61. 4
      device_udpserver/src/main/java/com/xr/device_udpserver/common/UdpServerHandler.java
  62. 2
      device_udpserver/src/main/resources/application-dev.yml
  63. 2
      device_udpserver/src/main/resources/application-prod.yml
  64. 91
      pom.xml

39
device_cars/pom.xml

@ -149,6 +149,11 @@
<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>
@ -173,7 +178,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>-->
@ -356,38 +361,6 @@
<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,41 +1,27 @@
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;
@ -66,12 +52,9 @@ public class DeviceCarApplication{
// @Async // @Async
// @Override // @Override
// public void run(String... args) throws Exception { // public void run(String... args) throws Exception {
// FocalLengthConfigService focalLengthConfigService = SpringUtil.getBean(FocalLengthConfigService.class); // Iec104Config iec104Config = new Iec104Config();
// List<FocalLengthConfig> list=focalLengthConfigService.list(); // iec104Config.setFrameAmountMax((short) 2);
// for (FocalLengthConfig config:list){ // iec104Config.setTerminnalAddress((short) 1);
// byte[] b=config.getFocalPicture(); // Iec104MasterFactory.createTcpClientMaster("192.168.3.10",2404).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run();
// 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 = "time_stamp"; public static final String TIMESTAMP = "timeStamp";
public static final String CryptoKey="ReGlory"; public static final String CryptoKey="ReGlory";
} }

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

@ -18,6 +18,7 @@ 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","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**"); .excludePathPatterns("/user/login","/user/getUserByToken","/deviceCamera/deviceCameraList","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**",
"/dataAnalysisCamera/getComer");
} }
} }

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

@ -14,25 +14,4 @@ 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_initialization"); "meter_reading");
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_zs?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?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,15 +8,9 @@ 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 {
@ -97,30 +91,6 @@ 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);
@ -293,35 +263,6 @@ 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,30 +8,9 @@ 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,15 +80,6 @@ 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);

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

@ -3,24 +3,22 @@ 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.*; import com.xr.device_car.config.utils.AdbUtil;
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;
@ -44,9 +42,6 @@ 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;
@ -100,10 +95,8 @@ public class FocalLengthConfigController {
String deviceType=""; String deviceType="";
if(device.getDeviceType().equals("1")){ if(device.getDeviceType().equals("1")){
deviceType="usb"; deviceType="usb";
}else if(device.getDeviceType().equals("2")){
deviceType="mipi";
}else{ }else{
return Result.OK("保存成功!"); deviceType="mipi";
} }
file.createNewFile(); file.createNewFile();
StringBuffer stringBuffer = new StringBuffer(); StringBuffer stringBuffer = new StringBuffer();
@ -212,15 +205,14 @@ 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=null; BufferedImage bufferedImage= AdbUtil.getCamDevice();
if(deviceCamera.getDeviceType().equals("1")|| deviceCamera.getDeviceType().equals("2")){ // if(deviceCamera.getDeviceType().equals("1")){
bufferedImage= AdbUtil.getCamDevice(); // bufferedImage=taskScheduler.getImgBySerial(deviceCamera);
} // }else{
if(deviceCamera.getDeviceType().equals("3") || deviceCamera.getDeviceType().equals("4")){ // 拉取球机 // bufferedImage=taskScheduler.getImgByInternet(deviceCamera);
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());
@ -366,27 +358,4 @@ 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);
}
} }

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

@ -6,14 +6,12 @@ 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;
@ -34,7 +32,6 @@ 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;
@ -49,7 +46,17 @@ public class MeterConfigController {
private final IScheduleSettingService scheduleSettingService; private final IScheduleSettingService scheduleSettingService;
private final UdpClientService udpClientService; @Autowired
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){
@ -61,11 +68,8 @@ 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.getDeviceType())){ if(StringUtils.isNotEmpty(meterConfig.getDeviceName())){
query.like("a.device_type",meterConfig.getDeviceType()); query.like("a.device_name",meterConfig.getDeviceName());
}
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());
@ -253,20 +257,4 @@ 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 3 球机 4 枪机) * 类型(1 usb 2 mipi)
*/ */
@ExcelProperty(value = "类型") @ExcelProperty(value = "类型")
private String deviceType; private String deviceType;
@ -54,22 +54,6 @@ 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;
/** /**
* 摄像头型号 * 摄像头型号
*/ */
@ -140,9 +124,4 @@ 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;
/** /**
* 算法类型 1usb2mipi 3内部算法 * 焦距类型 1定焦2变焦
*/ */
private String algorithmType; private String focalLength;
/** /**
* 执行间隔时间 * 执行间隔时间
@ -123,11 +123,6 @@ public class MeterConfig implements Serializable {
*/ */
private String remarks; private String remarks;
/**
* 初始化状态
*/
private String initStatus;
/** /**
* 创建人 * 创建人
*/ */
@ -181,7 +176,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.getAlgorithmType() == null ? other.getAlgorithmType() == null : this.getAlgorithmType().equals(other.getAlgorithmType())) && (this.getFocalLength() == null ? other.getFocalLength() == null : this.getFocalLength().equals(other.getFocalLength()))
&& (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()))
@ -208,7 +203,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 + ((getAlgorithmType() == null) ? 0 : getAlgorithmType().hashCode()); result = prime * result + ((getFocalLength() == null) ? 0 : getFocalLength().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());
@ -238,7 +233,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(", algorithmType=").append(algorithmType); sb.append(", focalLength=").append(focalLength);
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,8 +34,6 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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,12 +63,9 @@ analysis:
url: http://192.168.1.123:9000/vi/syncrec url: http://192.168.1.123:9000/vi/syncrec
upLoad: upLoad:
path: D:\\images\\images\\ path: D:\\device_car\\analysis\\upload\\
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
@ -84,11 +81,3 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis?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,22 +65,12 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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,20 +65,10 @@ 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

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

@ -79,4 +79,3 @@ hystrix:
# 熔断器超时时间,默认:1000/毫秒 # 熔断器超时时间,默认:1000/毫秒
timeoutInMilliseconds: 20000 timeoutInMilliseconds: 20000

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

@ -17,13 +17,12 @@
<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="algorithmType" column="algorithm_type" jdbcType="VARCHAR"/> <result property="focalLength" column="focal_length" 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"/>
@ -39,14 +38,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.algorithm_type,a.interval_time,a.focal_number, a.focal_length,a.interval_time,a.focal_number,
a.parameter_config,a.remarks,a.init_status,a.create_user, a.parameter_config,a.remarks,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" resultType="com.xr.device_car.modules.analysis.entity.MeterConfig"> <select id="selectConfigByPage" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
b.device_type cameraType,b.position cameraName,c.type_alias,b.device_ip ip from meter_config a b.device_type,b.position,c.type_alias,b.device_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>

2
device_display/src/main/java/com/xr/device_display/config/common/SecurityConfig.java

@ -108,7 +108,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 过滤请求 // 过滤请求
.authorizeRequests() .authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage","/getInfo","/dataAnalysisCamera/getDataAnalysisList","/meterBigScreen/**").permitAll() .antMatchers("/login", "/register", "/captchaImage","/getInfo","/dataAnalysisCamera/getDataAnalysisList","/meterBigScreen/**","/meterReadingRecord/insertAnalogData1","/meterReadingRecord/insertAnalogData15").permitAll()
// 静态资源,可匿名访问 // 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

2
device_display/src/main/java/com/xr/device_display/config/utils/CodeGenUtil.java

@ -32,7 +32,7 @@ public class CodeGenUtil {
CodeGenUtil codeGenUtil = new CodeGenUtil(); CodeGenUtil codeGenUtil = new CodeGenUtil();
boolean b = codeGenUtil.generateByTables(dataSourceConfig, "com.xr.device_display.modules.analysis", boolean b = codeGenUtil.generateByTables(dataSourceConfig, "com.xr.device_display.modules.analysis",
"gaoby", "device_display", "gaoby", "device_display",
"lds5000"); "reference_data");
System.out.println(b); System.out.println(b);
} }

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

@ -62,5 +62,14 @@ public class MeterReadingRecordController extends BaseController {
util.exportExcel(response, recordList, "历史数据"); util.exportExcel(response, recordList, "历史数据");
} }
@PostMapping(value = "/insertAnalogData1")
public void insertAnalogData1(){
meterReadingRecordService.insertAnalogData1();
}
@PostMapping(value = "/insertAnalogData15")
public void insertAnalogData15(){
meterReadingRecordService.insertAnalogData15();
}
} }

21
device_display/src/main/java/com/xr/device_display/modules/analysis/controller/ReferenceDataController.java

@ -0,0 +1,21 @@
package com.xr.device_display.modules.analysis.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author gaoby
* @since 2024-01-29
*/
@RestController
@RequestMapping("/reference-data")
public class ReferenceDataController {
}

3
device_display/src/main/java/com/xr/device_display/modules/analysis/entity/MeterConfig.java

@ -105,6 +105,9 @@ public class MeterConfig implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String deviceIp; private String deviceIp;
@TableField(exist = false)
private String readingValue;
/** /**
* 状态(0停用1启用) * 状态(0停用1启用)

4
device_display/src/main/java/com/xr/device_display/modules/analysis/entity/MeterReadingRecord.java

@ -80,7 +80,7 @@ public class MeterReadingRecord implements Serializable {
* 电压等级 * 电压等级
*/ */
@TableField(exist = false) @TableField(exist = false)
@Excel(name = "电压等级") // @Excel(name = "电压等级")
private String voltageClass; private String voltageClass;
/** /**
@ -102,7 +102,7 @@ public class MeterReadingRecord implements Serializable {
/** /**
* 读数类型 * 读数类型
*/ */
@Excel(name = "读数类型") // @Excel(name = "读数类型")
private Integer readingType; private Integer readingType;
/** /**

50
device_display/src/main/java/com/xr/device_display/modules/analysis/entity/ReferenceData.java

@ -0,0 +1,50 @@
package com.xr.device_display.modules.analysis.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author gaoby
* @since 2024-01-29
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class ReferenceData implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 表计id
*/
private Integer meterId;
/**
* 表计类型id
*/
private Integer meterTypeId;
/**
* 表计类型名称
*/
private String meterTypeName;
/**
* 读数值
*/
private String readingValue;
}

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

@ -23,4 +23,6 @@ public interface MeterConfigMapper extends BaseMapper<MeterConfig> {
List<MeterConfig> getMeterConfigPage(@Param("vo") MeterConfigQueryVo vo); List<MeterConfig> getMeterConfigPage(@Param("vo") MeterConfigQueryVo vo);
List<MeterConfig> getMeterMessage();
} }

16
device_display/src/main/java/com/xr/device_display/modules/analysis/mapper/ReferenceDataMapper.java

@ -0,0 +1,16 @@
package com.xr.device_display.modules.analysis.mapper;
import com.xr.device_display.modules.analysis.entity.ReferenceData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author gaoby
* @since 2024-01-29
*/
public interface ReferenceDataMapper extends BaseMapper<ReferenceData> {
}

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

@ -26,4 +26,10 @@ public interface IMeterReadingRecordService extends IService<MeterReadingRecord>
List<PresentReadingQueryDto> getPresentReadingPage(MeterReadingRecordQueryVo vo); List<PresentReadingQueryDto> getPresentReadingPage(MeterReadingRecordQueryVo vo);
AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo); AjaxResult getSevenDaysReading(MeterReadingRecordQueryVo vo);
void insertAnalogData1();
void insertAnalogData15();
} }

16
device_display/src/main/java/com/xr/device_display/modules/analysis/service/IReferenceDataService.java

@ -0,0 +1,16 @@
package com.xr.device_display.modules.analysis.service;
import com.xr.device_display.modules.analysis.entity.ReferenceData;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author gaoby
* @since 2024-01-29
*/
public interface IReferenceDataService extends IService<ReferenceData> {
}

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

@ -10,24 +10,19 @@ import com.github.pagehelper.PageHelper;
import com.xr.device_display.config.common.AjaxResult; import com.xr.device_display.config.common.AjaxResult;
import com.xr.device_display.config.utils.StringUtils; import com.xr.device_display.config.utils.StringUtils;
import com.xr.device_display.modules.analysis.dto.PresentReadingQueryDto; import com.xr.device_display.modules.analysis.dto.PresentReadingQueryDto;
import com.xr.device_display.modules.analysis.entity.Lds5000; import com.xr.device_display.modules.analysis.entity.*;
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.MeterReadingRecord;
import com.xr.device_display.modules.analysis.mapper.MeterAbnormalRecordMapper; import com.xr.device_display.modules.analysis.mapper.MeterAbnormalRecordMapper;
import com.xr.device_display.modules.analysis.mapper.MeterConfigMapper;
import com.xr.device_display.modules.analysis.mapper.MeterReadingRecordMapper; import com.xr.device_display.modules.analysis.mapper.MeterReadingRecordMapper;
import com.xr.device_display.modules.analysis.service.ILds5000Service; import com.xr.device_display.modules.analysis.service.*;
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.IMeterReadingRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xr.device_display.modules.analysis.vo.MeterReadingRecordQueryVo; import com.xr.device_display.modules.analysis.vo.MeterReadingRecordQueryVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate; import java.time.*;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -58,6 +53,15 @@ public class MeterReadingRecordServiceImpl extends ServiceImpl<MeterReadingRecor
@Autowired @Autowired
private ILds5000Service lds5000Service; private ILds5000Service lds5000Service;
@Autowired
private IMeterTypeService meterTypeService;
@Autowired
private IReferenceDataService referenceDataService;
@Autowired
private MeterConfigMapper meterConfigMapper;
@Override @Override
public List<MeterReadingRecord> getMeterReadingRecordList(MeterReadingRecordQueryVo vo) { public List<MeterReadingRecord> getMeterReadingRecordList(MeterReadingRecordQueryVo vo) {
if (CollUtil.isNotEmpty(vo.getAllTime())) { if (CollUtil.isNotEmpty(vo.getAllTime())) {
@ -121,14 +125,12 @@ public class MeterReadingRecordServiceImpl extends ServiceImpl<MeterReadingRecor
// 获取当前日期 // 获取当前日期
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
// 获取第二天日期
LocalDate nextDay = currentDate.plusDays(1);
// 构建查询条件:在过去7天内的记录 // 构建查询条件:在过去7天内的记录
LocalDate sevenDaysAgo = currentDate.minusDays(days); LocalDate sevenDaysAgo = currentDate.minusDays(days);
LambdaQueryWrapper<MeterReadingRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MeterReadingRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(MeterReadingRecord::getMeterCode, meterCode); lambdaQueryWrapper.eq(MeterReadingRecord::getMeterCode, meterCode);
lambdaQueryWrapper.between(MeterReadingRecord::getReadingTime, sevenDaysAgo, nextDay); lambdaQueryWrapper.between(MeterReadingRecord::getReadingTime, sevenDaysAgo, currentDate);
lambdaQueryWrapper.orderByAsc(MeterReadingRecord::getReadingTime); lambdaQueryWrapper.orderByAsc(MeterReadingRecord::getReadingTime);
// 查询记录 // 查询记录
@ -173,6 +175,165 @@ public class MeterReadingRecordServiceImpl extends ServiceImpl<MeterReadingRecor
return ajaxResult; return ajaxResult;
} }
private Map<Integer, List<MeterConfig>> getMeterMessage() {
// 从表计类型表获取所有在启用的表计类型
LambdaQueryWrapper<MeterType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(MeterType::getStatus, 1);
List<MeterType> meterTypeList = meterTypeService.list(queryWrapper);
Map<Integer, String> typeMap = meterTypeList.stream().collect(Collectors.toMap(MeterType::getId, MeterType::getTypeAlias));
// List<Integer> typeIdList = meterTypeList.stream().map(MeterType::getId).collect(Collectors.toList());
// 获取表计信息
List<MeterConfig> configList = meterConfigMapper.getMeterMessage();
// 将表计根据类型分组
Map<Integer, List<MeterConfig>> idMeterConfigMap = new HashMap<>();
typeMap.forEach((k, v) -> {
List<MeterConfig> typeMeterConfig = new ArrayList<>();
configList.forEach(config -> {
if (config.getTypeId().equals(k)) {
config.setMeterTypeName(v);
typeMeterConfig.add(config);
}
});
idMeterConfigMap.put(k, typeMeterConfig);
});
return idMeterConfigMap;
}
private Map<Integer,String> readingMap(){
List<ReferenceData> referenceDataList = referenceDataService.list();
Map<Integer, String> readingMap = referenceDataList.stream().collect(Collectors.toMap(ReferenceData::getMeterId, ReferenceData::getReadingValue));
return readingMap;
}
// 插入模拟数据 一天一条
@Override
@Transactional
public void insertAnalogData1() {
Map<Integer, List<MeterConfig>> idMeterConfigMap = getMeterMessage();
// Map<Integer,String> readingMap = readingMap();
// 获取所有参考数据
// 设置起始日期为 2023年10月25日
LocalDate startDate = LocalDate.of(2023, 10, 25);
// 设置结束日期为 2024年1月14日
LocalDate endDate = LocalDate.of(2024, 1, 14);
// 批量插入数据
while (!startDate.isAfter(endDate)) {
LocalDate finalStartDate = startDate;
List<MeterReadingRecord> records = idMeterConfigMap.values().stream()
.filter(Objects::nonNull)
.flatMap(List::stream)
.map(meterConfig -> {
MeterReadingRecord meterReadingRecord = new MeterReadingRecord();
meterReadingRecord.setMeterId(meterConfig.getId());
meterReadingRecord.setMeterCode(meterConfig.getMeterCode());
meterReadingRecord.setMeterTypeId(meterConfig.getTypeId());
meterReadingRecord.setMeterTypeName(meterConfig.getMeterTypeName());
meterReadingRecord.setOwningInterval(meterConfig.getOwningInterval());
meterReadingRecord.setReadingType(2);
meterReadingRecord.setCreateUser("SYSTEM");
// 设置每天的日期和时分秒
LocalDateTime createTime = LocalDateTime.of(finalStartDate, LocalTime.of(23, 45, 57));
meterReadingRecord.setCreateTime(createTime);
Date readingTime = Date.from(createTime.atZone(ZoneId.systemDefault()).toInstant());
meterReadingRecord.setReadingTime(readingTime);
// getLatestReading(meterConfig.getId())
meterReadingRecord.setReadingValue(meterConfig.getReadingValue());
return meterReadingRecord;
})
.collect(Collectors.toList());
saveBatch(records);
// 递增日期,准备下一轮循环
startDate = startDate.plusDays(1);
}
}
// 插入模拟数据15分钟一条
@Transactional
public void insertAnalogData15() {
Map<Integer, List<MeterConfig>> idMeterConfigMap = getMeterMessage();
// Map<Integer,String> readingMap = readingMap();
// 设置起始日期
LocalDate startDate = LocalDate.of(2024, 1, 15);
// 设置结束日期
LocalDate endDate = LocalDate.of(2024, 1, 29);
// 设置每隔15分钟插入一条记录
Duration duration = Duration.ofMinutes(15);
LocalDateTime currentTime = LocalDateTime.of(startDate, LocalTime.of(7, 32, 57));
// 批量插入数据
while (!currentTime.isAfter(LocalDateTime.of(endDate, LocalTime.of(7, 32, 57)))) {
LocalDate finalStartDate = startDate;
LocalDateTime finalCurrentTime = currentTime;
idMeterConfigMap.forEach((key, value) -> {
if (value != null) {
List<MeterConfig> meterConfigs = value;
List<MeterReadingRecord> records = meterConfigs.stream()
.map(meterConfig -> {
MeterReadingRecord meterReadingRecord = new MeterReadingRecord();
meterReadingRecord.setMeterId(meterConfig.getId());
meterReadingRecord.setMeterCode(meterConfig.getMeterCode());
meterReadingRecord.setMeterTypeId(meterConfig.getTypeId());
meterReadingRecord.setMeterTypeName(meterConfig.getMeterTypeName());
meterReadingRecord.setOwningInterval(meterConfig.getOwningInterval());
meterReadingRecord.setReadingType(2);
meterReadingRecord.setCreateUser("SYSTEM");
// 设置每隔15分钟的日期和时分秒
LocalDateTime createTime = finalCurrentTime.plus(duration);
meterReadingRecord.setCreateTime(createTime);
Date readingTime = Date.from(createTime.atZone(ZoneId.systemDefault()).toInstant());
meterReadingRecord.setReadingTime(readingTime);
meterReadingRecord.setReadingValue(meterConfig.getReadingValue());
return meterReadingRecord;
})
.collect(Collectors.toList());
// 执行批量插入操作
saveBatch(records);
}
});
// 增加15分钟
currentTime = currentTime.plus(duration);
}
}
// 定时插入模拟数据15分钟一条
@Scheduled(fixedRate = 900000)
public void timedInsertionAnalogData15() {
Map<Integer, List<MeterConfig>> idMeterConfigMap = getMeterMessage();
// Map<Integer, String> readingMap = readingMap();
List<MeterReadingRecord> records = new ArrayList<>();
idMeterConfigMap.forEach((key, value) -> {
if (value != null) {
List<MeterConfig> meterConfigs = value;
meterConfigs.forEach(meterConfig -> {
MeterReadingRecord meterReadingRecord = new MeterReadingRecord();
meterReadingRecord.setMeterId(meterConfig.getId());
meterReadingRecord.setMeterCode(meterConfig.getMeterCode());
meterReadingRecord.setMeterTypeId(meterConfig.getTypeId());
meterReadingRecord.setMeterTypeName(meterConfig.getMeterTypeName());
meterReadingRecord.setOwningInterval(meterConfig.getOwningInterval());
meterReadingRecord.setReadingType(2);
meterReadingRecord.setCreateUser("SYSTEM");
// 设置每隔15分钟的日期和时分秒
LocalDateTime createTime = LocalDateTime.now();
Date readingTime = Date.from(createTime.atZone(ZoneId.systemDefault()).toInstant());
meterReadingRecord.setCreateTime(createTime);
meterReadingRecord.setReadingTime(readingTime);
meterReadingRecord.setReadingValue(meterConfig.getReadingValue());
// 添加到批量插入的列表
records.add(meterReadingRecord);
});
}
});
// 执行批量插入操作
saveBatch(records);
}
private LocalDate dateToLocalDate(Date date) { private LocalDate dateToLocalDate(Date date) {

20
device_display/src/main/java/com/xr/device_display/modules/analysis/service/impl/ReferenceDataServiceImpl.java

@ -0,0 +1,20 @@
package com.xr.device_display.modules.analysis.service.impl;
import com.xr.device_display.modules.analysis.entity.ReferenceData;
import com.xr.device_display.modules.analysis.mapper.ReferenceDataMapper;
import com.xr.device_display.modules.analysis.service.IReferenceDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author gaoby
* @since 2024-01-29
*/
@Service
public class ReferenceDataServiceImpl extends ServiceImpl<ReferenceDataMapper, ReferenceData> implements IReferenceDataService {
}

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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
#Hikari连接池配置 #Hikari连接池配置

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

@ -22,8 +22,8 @@ spring:
basename: i18n/messages basename: i18n/messages
profiles: profiles:
# active: prod #开发环境 # active: prod #开发环境
active: dev #测试环境5 # active: dev #测试环境5
#active: prod #生产环境 active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境
application: application:
name: deviceDisplay name: deviceDisplay

57
device_display/src/main/resources/modules/analysis/MeterConfigMapper.xml

@ -4,35 +4,43 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xr.device_display.modules.analysis.entity.MeterConfig"> <resultMap id="BaseResultMap" type="com.xr.device_display.modules.analysis.entity.MeterConfig">
<id column="id" property="id" /> <id column="id" property="id"/>
<result column="ids5000_id" property="ids5000Id"/> <result column="ids5000_id" property="ids5000Id"/>
<result column="voltage_class" property="voltageClass" /> <result column="voltage_class" property="voltageClass"/>
<result column="owning_interval" property="owningInterval" /> <result column="owning_interval" property="owningInterval"/>
<result column="identification_interval" property="identificationInterval" /> <result column="identification_interval" property="identificationInterval"/>
<result column="device_name" property="deviceName" /> <result column="device_name" property="deviceName"/>
<result column="location_x" property="locationX"/> <result column="location_x" property="locationX"/>
<result column="location_y" property="locationY"/> <result column="location_y" property="locationY"/>
<result column="device_type" property="deviceType" /> <result column="device_type" property="deviceType"/>
<result column="meter_code" property="meterCode" /> <result column="meter_code" property="meterCode"/>
<result column="meter_name" property="meterName" /> <result column="meter_name" property="meterName"/>
<result column="camera_id" property="cameraId" /> <result column="camera_id" property="cameraId"/>
<result column="warning_max" property="warningMax" /> <result column="warning_max" property="warningMax"/>
<result column="warning_min" property="warningMin" /> <result column="warning_min" property="warningMin"/>
<result column="type_id" property="typeId" /> <result column="type_id" property="typeId"/>
<result column="status" property="status" /> <result column="status" property="status"/>
<result column="first_time" property="firstTime" /> <result column="first_time" property="firstTime"/>
<result column="focal_length" property="focalLength" /> <result column="focal_length" property="focalLength"/>
<result column="interval_type" property="intervalType" /> <result column="interval_type" property="intervalType"/>
<result column="interval_time" property="intervalTime" /> <result column="interval_time" property="intervalTime"/>
<result column="focal_number" property="focalNumber" /> <result column="focal_number" property="focalNumber"/>
<result column="parameter_config" property="parameterConfig" /> <result column="parameter_config" property="parameterConfig"/>
<result column="remarks" property="remarks" /> <result column="remarks" property="remarks"/>
<result column="create_user" property="createUser" /> <result column="create_user" property="createUser"/>
<result column="create_time" property="createTime" /> <result column="create_time" property="createTime"/>
<result column="update_user" property="updateUser" /> <result column="update_user" property="updateUser"/>
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime"/>
</resultMap> </resultMap>
<select id="getMeterMessage" resultType="com.xr.device_display.modules.analysis.entity.MeterConfig">
SELECT *
FROM reference_data AS rd
LEFT JOIN meter_config as mc
ON rd.meter_id = mc.id
</select>
<select id="getMeterConfigPage" parameterType="com.xr.device_display.modules.analysis.vo.MeterConfigQueryVo" <select id="getMeterConfigPage" parameterType="com.xr.device_display.modules.analysis.vo.MeterConfigQueryVo"
resultType="com.xr.device_display.modules.analysis.entity.MeterConfig"> resultType="com.xr.device_display.modules.analysis.entity.MeterConfig">
SELECT SELECT
@ -90,6 +98,7 @@
</where> </where>
</select> </select>
</mapper> </mapper>

14
device_display/src/main/resources/modules/analysis/ReferenceDataMapper.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xr.device_display.modules.analysis.mapper.ReferenceDataMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.xr.device_display.modules.analysis.entity.ReferenceData">
<id column="id" property="id" />
<result column="meter_id" property="meterId" />
<result column="meter_type_id" property="meterTypeId" />
<result column="meter_type_name" property="meterTypeName" />
<result column="reading_value" property="readingValue" />
</resultMap>
</mapper>

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(1000); Thread.sleep(3000);
//发送总召唤数据 //发送总召唤数据
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(1000); Thread.sleep(3000);
//发送结束总召唤指令 //发送结束总召唤指令
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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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.83",102); Iec61850clent iec61850clent=new Iec61850clent(args,"192.168.1.137",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);

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

@ -2,7 +2,6 @@ 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;
@ -16,9 +15,8 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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.93:3306/device_system?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252: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.93:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis?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.93:3306/modbusrtu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false 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
# db1: # db1:

2
device_iec61850clent/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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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_iec61850clent/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring: spring:
profiles: profiles:
active: prod #开发环境 active: dev #开发环境
# 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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: dev #开发环境 active: test #开发环境
# active: test #测试环境5 # active: test #测试环境5
#active: prod #生产环境 #active: prod #生产环境
# active: prod #生产环境 # active: prod #生产环境

2
device_modbus/src/main/java/com/xr/clent/tool/ModbusUtils.java

@ -215,7 +215,7 @@ public class ModbusUtils {
public static void main(String[] args) { public static void main(String[] args) {
try{ try{
ModbusMaster modbusMaster= ModbusUtils.getMaster("192.168.1.37",1502); ModbusMaster modbusMaster= ModbusUtils.getMaster("192.168.1.84",1502);
while (true){ while (true){
Number n = ModbusUtils.readHoldingRegister(modbusMaster, 1, 0, 4); Number n = ModbusUtils.readHoldingRegister(modbusMaster, 1, 0, 4);
System.out.println(n); System.out.println(n);

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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://localhost:3306/image_analysis?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,39 +96,10 @@
<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>org.apache.httpcomponents</groupId> <groupId>io.netty</groupId>
<artifactId>httpclient</artifactId> <artifactId>netty-all</artifactId>
<version>4.5</version> <version>4.1.65.Final</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>
@ -141,13 +112,6 @@
<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,11 +5,9 @@ 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,7 +1,5 @@
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;
@ -11,7 +9,6 @@ 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 {
@ -22,25 +19,13 @@ 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,7 +17,13 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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连接池配置
@ -43,32 +49,20 @@ spring:
timeout-seconds: 1000 timeout-seconds: 1000
config: config:
enabled: false enabled: false
stream: # redis 相关
kafka: redis:
binder: host: ${REDIS_URL:localhost}
brokers: localhost:9092 #Kafka的消息中间件服务器 port: ${REDIS_PORT:6379}
zk-nodes: localhost:2181 #Zookeeper的节点,如果集群,后面加,号分隔 password: ${REDIS_PWD:111111}
auto-create-topics: false #如果设置为false,就不会自动创建Topic 有可能你Topic还没创建就直接调用了。 timeout: 10000
# kafka: jedis:
# bootstrap-servers: localhost:9092 pool:
# consumer: max-active: 1000
# group-id: ai-consumer-group max-wait: -1ms
#kafka: max-idle: 10
# topic: ai-topic min-idle: 5
# # 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:mapper/*Mapper.xml mapper-locations: classpath:mappers/**/*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:
@ -90,12 +84,6 @@ 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,7 +17,13 @@ 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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis?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连接池配置
@ -56,7 +62,7 @@ spring:
max-idle: 10 max-idle: 10
min-idle: 5 min-idle: 5
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*Mapper.xml mapper-locations: classpath:mappers/*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:
@ -74,16 +80,7 @@ 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,6 +5,19 @@ 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,10 +23,8 @@ 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 = msg+":已收到"; String replyMessage = "Hello, client!";
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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://116.196.120.81:3306/image_analysis?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_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root username: root
password: 123456 password: 123456
db3: db3:

91
pom.xml

@ -22,13 +22,38 @@
</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>
@ -37,10 +62,12 @@
<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>
<lombok.version>1.18.12</lombok.version> <mybatisplus.version>3.4.1</mybatisplus.version>
<netty.version>4.1.42.Final</netty.version> <gson.version>2.8.5</gson.version>
<poi.version>3.9</poi.version> <joda.time.version>2.9.9</joda.time.version>
<joda-time.version>2.10</joda-time.version> <commons.io.version>2.5</commons.io.version>
<jeecgboot.version>3.0</jeecgboot.version>
<swagger.version>3.0.0</swagger.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -157,7 +184,6 @@
<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>
<!--测试依赖 --> <!--测试依赖 -->
@ -203,20 +229,61 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
<version>${netty.version}</version> <version>4.1.42.Final</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>${poi.version}</version> <version>3.9</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