diff --git a/device_cars/pom.xml b/device_cars/pom.xml
index 78f0fb7..530a228 100644
--- a/device_cars/pom.xml
+++ b/device_cars/pom.xml
@@ -149,11 +149,6 @@
commons-discovery
0.2
-
- wsdl4j
- wsdl4j
- 1.6.3
-
org.junit.jupiter
junit-jupiter-api
@@ -178,7 +173,7 @@
joda-time
joda-time
- ${joda.time.version}
+ ${joda-time.version}
@@ -361,6 +356,38 @@
org.springframework.cloud
spring-cloud-starter-openfeign
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.1
+
+
+ org.dom4j
+ dom4j
+ 2.1.3
+
+
+ io.minio
+ minio
+ 3.0.10
+
+
+
+ com.alibaba
+ easyexcel
+ 3.3.2
+
diff --git a/device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java b/device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java
index 271de88..aee30f6 100644
--- a/device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java
+++ b/device_cars/src/main/java/com/xr/device_car/DeviceCarApplication.java
@@ -1,27 +1,41 @@
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.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
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.EnableScheduling;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
+import java.io.File;
+import java.util.Date;
+import java.util.List;
+
@SpringBootApplication
@EnableScheduling//开启定时任务
@EnableAsync//开启异步
@MapperScan("com.xr.device_car.modules.**.mapper")
@EnableDiscoveryClient
@EnableFeignClients
+@Import(SpringUtil.class)
+//public class DeviceCarApplication implements CommandLineRunner {
public class DeviceCarApplication{
-
@Value("${netty.address}")
private String address;
@@ -52,9 +66,12 @@ public class DeviceCarApplication{
// @Async
// @Override
// public void run(String... args) throws Exception {
-// Iec104Config iec104Config = new Iec104Config();
-// iec104Config.setFrameAmountMax((short) 2);
-// iec104Config.setTerminnalAddress((short) 1);
-// Iec104MasterFactory.createTcpClientMaster("192.168.3.10",2404).setDataHandler(new MasterSysDataHandler()).setConfig(iec104Config).run();
+// FocalLengthConfigService focalLengthConfigService = SpringUtil.getBean(FocalLengthConfigService.class);
+// List list=focalLengthConfigService.list();
+// for (FocalLengthConfig config:list){
+// byte[] b=config.getFocalPicture();
+// File file = new File("D:\\images\\zhongshan\\"+config.getConfigId()+".jpg");
+// FileUtil.readInputStream(file,b);
+// }
// }
}
diff --git a/device_cars/src/main/java/com/xr/device_car/config/common/LoginConfig.java b/device_cars/src/main/java/com/xr/device_car/config/common/LoginConfig.java
index e952c5a..346a927 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/common/LoginConfig.java
+++ b/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 TIMESTAMP = "timeStamp";
+ public static final String TIMESTAMP = "time_stamp";
public static final String CryptoKey="ReGlory";
}
diff --git a/device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java b/device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java
index 2ef4e9e..1b840f0 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/common/MyBatisPlusConfig.java
@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
-@MapperScan("com.xr.device_car.modules.*.mapper")
+@MapperScan("com.xr.device_car.analysis.mapper")
@Configuration
public class MyBatisPlusConfig {
diff --git a/device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java b/device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java
index 27cde3f..97c5953 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/common/WebConfig.java
@@ -18,7 +18,6 @@ public class WebConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor())
.addPathPatterns("/**").excludePathPatterns("/user/webLogin")
- .excludePathPatterns("/user/login","/user/getUserByToken","/deviceCamera/deviceCameraList","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**",
- "/dataAnalysisCamera/getComer");
+ .excludePathPatterns("/user/login","/user/getUserByToken","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
}
}
\ No newline at end of file
diff --git a/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java b/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java
index 36aba31..73239f7 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/getconfigvalue/StaticProperties.java
@@ -14,4 +14,25 @@ public class StaticProperties {
@Value("${upLoad.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;
+
}
diff --git a/device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java b/device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java
index 9c8e7eb..4ac5cbc 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/utils/CodeGenUtil.java
@@ -30,7 +30,7 @@ public class CodeGenUtil {
CodeGenUtil codeGenUtil = new CodeGenUtil();
boolean b = codeGenUtil.generateByTables(dataSourceConfig, "com.xr.device_car.modules.analysis",
"gaoby", "device_cars",
- "meter_reading");
+ "meter_initialization");
System.out.println(b);
}
@@ -162,7 +162,7 @@ public class CodeGenUtil {
* @return 数据源配置 DataSourceConfig
*/
private static DataSourceConfig getDataSourceConfig() {
- String dbUrl = "jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false";
+ String dbUrl = "jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false";
return new DataSourceConfig()
.setDbType(DbType.MYSQL)
.setUrl(dbUrl)
diff --git a/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java b/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
index 9ec0767..0a310fb 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/utils/Files.java
@@ -8,9 +8,15 @@ import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.URLConnection;
+import java.nio.file.Path;
import java.util.Base64;
+import java.util.Date;
+import java.util.Random;
+import java.util.UUID;
public class Files {
@@ -91,6 +97,30 @@ public class Files {
BufferedImage bimg= ImageIO.read(is2);
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 {
URL urlfile = new URL(url);
@@ -263,6 +293,35 @@ public class Files {
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;
+
+ }
diff --git a/device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java b/device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java
index 6392613..b138ba2 100644
--- a/device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java
+++ b/device_cars/src/main/java/com/xr/device_car/config/utils/StaticPropUtil.java
@@ -8,9 +8,30 @@ public class StaticPropUtil {
public static String imageUrl;
+ public static String 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){
imagePath = dingProperties.getPath();
imageUrl = dingProperties.getUrl();
+ pythonPath=dingProperties.getPythonPath();
+ modelPath=dingProperties.getModelPath();
+ minioUrl=dingProperties.getMinioUrl();
+ minioAccess=dingProperties.getMinioAccess();
+ minioSecret=dingProperties.getMinioSecret();
+ udpHost=dingProperties.getUdpHost();
+ udpPort=dingProperties.getUdpPort();
}
}
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java
index 1fa145d..90df665 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java
+++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/DeviceCameraController.java
@@ -80,6 +80,15 @@ public class DeviceCameraController {
if (StringUtils.isNotBlank(deviceCamera.getDeviceIp())) {
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 deviceCameraList = deviceCameraService.page(pg, wrapper);
System.out.println(deviceCameraList);
return Result.OK(deviceCameraList);
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
index 393ab5f..07c5922 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
+++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/FocalLengthConfigController.java
@@ -3,22 +3,24 @@ package com.xr.device_car.modules.analysis.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xr.device_car.config.common.Result;
-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.config.utils.*;
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.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.service.DeviceCameraService;
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.MeterTypeService;
import com.xr.device_car.modules.system.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
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.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@@ -42,6 +44,9 @@ public class FocalLengthConfigController {
private MeterConfigService meterConfigService;
@Autowired
private DeviceCameraService deviceCameraService;
+ @Autowired
+ private MeterTypeService meterTypeService;
+
@Autowired
private TaskScheduler taskScheduler;
@@ -95,8 +100,10 @@ public class FocalLengthConfigController {
String deviceType="";
if(device.getDeviceType().equals("1")){
deviceType="usb";
- }else{
+ }else if(device.getDeviceType().equals("2")){
deviceType="mipi";
+ }else{
+ return Result.OK("保存成功!");
}
file.createNewFile();
StringBuffer stringBuffer = new StringBuffer();
@@ -205,14 +212,15 @@ public class FocalLengthConfigController {
@RequestMapping("/addFocalLength")
public Result> addFocalLength(FocalLengthConfig focalLengthConfig) throws Exception {
UserInfo userInfo= UserUtils.currentUser();
-// MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId());
-// DeviceCamera deviceCamera = deviceCameraService.getById(meterConfig.getCameraId());
- BufferedImage bufferedImage= AdbUtil.getCamDevice();
-// if(deviceCamera.getDeviceType().equals("1")){
-// bufferedImage=taskScheduler.getImgBySerial(deviceCamera);
-// }else{
-// bufferedImage=taskScheduler.getImgByInternet(deviceCamera);
-// }
+ MeterConfig meterConfig=meterConfigService.getById(focalLengthConfig.getConfigId());
+ DeviceCamera deviceCamera = deviceCameraService.getById(meterConfig.getCameraId());
+ BufferedImage bufferedImage=null;
+ if(deviceCamera.getDeviceType().equals("1")|| deviceCamera.getDeviceType().equals("2")){
+ bufferedImage= AdbUtil.getCamDevice();
+ }
+ if(deviceCamera.getDeviceType().equals("3") || deviceCamera.getDeviceType().equals("4")){ // 拉取球机
+ bufferedImage= HkComUtil.getBole(deviceCamera);
+ }
byte [] bytes= Files.bufferedImageToByte(bufferedImage);
focalLengthConfig.setFocalPicture(bytes);
focalLengthConfig.setCreateTime(new Date());
@@ -336,7 +344,7 @@ public class FocalLengthConfigController {
if(!file.getParentFile().exists()){
file.getParentFile().mkdirs();
}
- return Result.OK(AdbUtil.readLog("D:\\images\\log\\log","D:\\images\\log","/userdata/logs/log"));
+ return Result.OK(AdbUtil.readConfig("D:\\images\\log\\log","D:\\images\\log","/userdata/logs/log"));
}catch (Exception e){
e.printStackTrace();
return Result.error(e.getMessage());
@@ -358,4 +366,27 @@ public class FocalLengthConfigController {
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);
+ }
+
}
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java
index d66f181..a370df7 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java
+++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/MeterConfigController.java
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.modules.analysis.entity.*;
import com.xr.device_car.modules.analysis.scheduled.TaskScheduler;
import com.xr.device_car.modules.analysis.service.*;
import com.xr.device_car.modules.analysis.vo.MeterMaxMinSaveVo;
import com.xr.device_car.modules.system.entity.UserInfo;
+import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -32,6 +34,7 @@ import java.util.List;
@RestController
@RequestMapping("analysis/meterConfig")
+@RequiredArgsConstructor
public class MeterConfigController {
private final MeterConfigService meterConfigService;
@@ -46,17 +49,7 @@ public class MeterConfigController {
private final IScheduleSettingService scheduleSettingService;
- @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;
- }
+ private final UdpClientService udpClientService;
@RequestMapping("/getMeterConfigPage")
public IPage getMeterConfigPage(MeterConfig meterConfig, HttpServletRequest req){
@@ -68,8 +61,11 @@ public class MeterConfigController {
if(StringUtils.isNotEmpty(meterConfig.getDeviceType())){
query.like("a.device_type",meterConfig.getDeviceType());
}
- if(StringUtils.isNotEmpty(meterConfig.getDeviceName())){
- query.like("a.device_name",meterConfig.getDeviceName());
+ if(StringUtils.isNotEmpty(meterConfig.getDeviceType())){
+ query.like("a.device_type",meterConfig.getDeviceType());
+ }
+ if(StringUtils.isNotEmpty(meterConfig.getAlgorithmType())){
+ query.like("a.algorithm_type",meterConfig.getAlgorithmType());
}
if(StringUtils.isNotEmpty(meterConfig.getTypeId())){
query.eq("a.type_id",meterConfig.getTypeId());
@@ -101,12 +97,12 @@ public class MeterConfigController {
meterConfig.setUpdateTime(new Date());
ids.add(meterConfig.getId());
meterConfigService.saveOrUpdate(meterConfig);
- /*if (meterConfig.getStatus()==1){
+ if (meterConfig.getStatus()==1){
// 删除原有任务
scheduleSettingService.meterStart(ids,0);
// 新增并启用新任务
scheduleSettingService.meterStart(ids,1);
- }*/
+ }
}else{
meterConfig.setCreateUser(userInfo.getUserName());
@@ -150,7 +146,7 @@ public class MeterConfigController {
UpdateWrapper updateWrapper=new UpdateWrapper<>();
updateWrapper.in("id",ids).set("status",status);
meterConfigService.update(null,updateWrapper);
- /*scheduleSettingService.meterStart(ids,Integer.valueOf(status));*/
+ scheduleSettingService.meterStart(ids,Integer.valueOf(status));
return Result.OK(status.equals("1")?"启动":"停止"+"成功!");
}
@RequestMapping("/saveCamera")
@@ -257,4 +253,20 @@ public class MeterConfigController {
}
+ //同步配置文件到udp主机
+ @RequestMapping("/sendSynchronizationUdp")
+ public Result> sendSynchronizationUdp(){
+ try{
+ QueryWrapper query=new QueryWrapper<>();
+ query.eq("status",1);
+ List list = meterConfigService.list(query);
+ String sendMsg = UdbConfig.getUdbConfig(list);
+ udpClientService.sendData(sendMsg);
+ }catch (Exception e){
+ e.printStackTrace();
+ return Result.OK("同步失败!");
+ }
+ return Result.OK("同步成功!");
+ }
+
}
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java
index e42d303..32577bc 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/DeviceCamera.java
+++ b/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;
/**
- * 类型(1 usb 2 mipi)
+ * 类型(1 usb 2 mipi 3 球机 4 枪机)
*/
@ExcelProperty(value = "类型")
private String deviceType;
@@ -54,6 +54,22 @@ public class DeviceCamera implements Serializable {
@ExcelProperty(value = "端口")
private String devicePort;
+ /**
+ * 账号
+ */
+ private String account;
+
+ /**
+ * 密码
+ */
+ private String password;
+
+ private String x;
+
+ private String y;
+
+ private String z;
+
/**
* 摄像头型号
*/
@@ -124,4 +140,9 @@ public class DeviceCamera implements Serializable {
@TableField(exist = false)
private static final long serialVersionUID = 1L;
+ /**
+ * 算法类型
+ */
+ @TableField(exist = false)
+ private String algorithmType;
}
\ No newline at end of file
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java
index fc6b77c..5c8b1a4 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterConfig.java
+++ b/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;
/**
- * 焦距类型 1定焦2变焦
+ * 算法类型 1usb2mipi 3内部算法
*/
- private String focalLength;
+ private String algorithmType;
/**
* 执行间隔时间
@@ -123,6 +123,11 @@ public class MeterConfig implements Serializable {
*/
private String remarks;
+ /**
+ * 初始化状态
+ */
+ private String initStatus;
+
/**
* 创建人
*/
@@ -176,7 +181,7 @@ public class MeterConfig implements Serializable {
&& (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getFirstTime() == null ? other.getFirstTime() == null : this.getFirstTime().equals(other.getFirstTime()))
- && (this.getFocalLength() == null ? other.getFocalLength() == null : this.getFocalLength().equals(other.getFocalLength()))
+ && (this.getAlgorithmType() == null ? other.getAlgorithmType() == null : this.getAlgorithmType().equals(other.getAlgorithmType()))
&& (this.getIntervalTime() == null ? other.getIntervalTime() == null : this.getIntervalTime().equals(other.getIntervalTime()))
&& (this.getFocalNumber() == null ? other.getFocalNumber() == null : this.getFocalNumber().equals(other.getFocalNumber()))
&& (this.getParameterConfig() == null ? other.getParameterConfig() == null : this.getParameterConfig().equals(other.getParameterConfig()))
@@ -203,7 +208,7 @@ public class MeterConfig implements Serializable {
result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getFirstTime() == null) ? 0 : getFirstTime().hashCode());
- result = prime * result + ((getFocalLength() == null) ? 0 : getFocalLength().hashCode());
+ result = prime * result + ((getAlgorithmType() == null) ? 0 : getAlgorithmType().hashCode());
result = prime * result + ((getIntervalTime() == null) ? 0 : getIntervalTime().hashCode());
result = prime * result + ((getFocalNumber() == null) ? 0 : getFocalNumber().hashCode());
result = prime * result + ((getParameterConfig() == null) ? 0 : getParameterConfig().hashCode());
@@ -233,7 +238,7 @@ public class MeterConfig implements Serializable {
sb.append(", typeId=").append(typeId);
sb.append(", status=").append(status);
sb.append(", firstTime=").append(firstTime);
- sb.append(", focalLength=").append(focalLength);
+ sb.append(", algorithmType=").append(algorithmType);
sb.append(", intervalTime=").append(intervalTime);
sb.append(", focalNumber=").append(focalNumber);
sb.append(", parameterConfig=").append(parameterConfig);
diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java
index a8956b8..727fd88 100644
--- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java
+++ b/device_cars/src/main/java/com/xr/device_car/modules/analysis/entity/MeterReadingRecord.java
@@ -34,6 +34,8 @@ public class MeterReadingRecord implements Serializable {
private String readingType;
+
+ private String dataType;
/**
* 表计类型id
*/
diff --git a/device_cars/src/main/resources/application-dev.yml b/device_cars/src/main/resources/application-dev.yml
index 7b8e680..6788324 100644
--- a/device_cars/src/main/resources/application-dev.yml
+++ b/device_cars/src/main/resources/application-dev.yml
@@ -19,7 +19,7 @@ spring:
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
- url: jdbc:mysql://116.196.120.81:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
+ url: jdbc:mysql://116.196.120.81:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 5ea47c0bdd7146ebbd53020eca@672307
#Hikari连接池配置
@@ -63,9 +63,12 @@ analysis:
url: http://192.168.1.123:9000/vi/syncrec
upLoad:
- path: D:\\device_car\\analysis\\upload\\
+ path: D:\\images\\images\\
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:
address: 192.168.3.20
port: 2404
@@ -80,4 +83,12 @@ eureka:
healthcheck:
enabled: true
service-url:
- defaultZone: http://localhost:8084/eureka
\ No newline at end of file
+ defaultZone: http://localhost:8084/eureka
+minio:
+ url: http://192.168.1.210:9000
+ accessKey: minioadmin
+ secretKey: minioadmin
+udp:
+ server:
+ host: localhost
+ port: 9300
\ No newline at end of file
diff --git a/device_cars/src/main/resources/application-prod.yml b/device_cars/src/main/resources/application-prod.yml
index 5b13550..c805c60 100644
--- a/device_cars/src/main/resources/application-prod.yml
+++ b/device_cars/src/main/resources/application-prod.yml
@@ -19,7 +19,7 @@ spring:
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
- url: jdbc:mysql://192.168.1.252:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
+ url: jdbc:mysql://192.168.1.252:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
#Hikari连接池配置
@@ -65,12 +65,22 @@ analysis:
upLoad:
path: /home/project/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:
address: 192.168.1.252
port: 2405
data:
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:
instance:
instance-id: ${spring.cloud.client.ip-address}:${server.port}
diff --git a/device_cars/src/main/resources/application-test.yml b/device_cars/src/main/resources/application-test.yml
index 6122d38..95a1939 100644
--- a/device_cars/src/main/resources/application-test.yml
+++ b/device_cars/src/main/resources/application-test.yml
@@ -19,7 +19,7 @@ spring:
db2:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
- url: jdbc:mysql://localhost:3306/image_analysis?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
+ url: jdbc:mysql://localhost:3306/image_analysis_zs?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
#Hikari连接池配置
@@ -65,10 +65,20 @@ analysis:
upLoad:
path: D:\\device_car\\analysis\\upload\\
url: http://localhost:85/upload/
-
+python:
+ path: C:\\Users\\admin\\Anaconda3\\envs\\myconda310\\python.exe
+ modelPath: D:\\smartGrid\\smartGrid\\models
netty:
address: 192.168.3.20
port: 2404
+minio:
+ url: http://192.168.1.210:9000
+ accessKey: minioadmin
+ secretKey: minioadmin
+udp:
+ server:
+ host: localhost
+ port: 9300
data:
pathUrl: http://192.168.1.82:8081/api/dataAnalysisCamera/getComer
#pathUrl: http://192.168.1.44:8081/api/dataAnalysisCamera/getComer
diff --git a/device_cars/src/main/resources/application.yml b/device_cars/src/main/resources/application.yml
index bef4943..8d7945b 100644
--- a/device_cars/src/main/resources/application.yml
+++ b/device_cars/src/main/resources/application.yml
@@ -2,7 +2,7 @@ spring:
profiles:
#active: dev #开发环境
# active: test #测试环境5
- active: test #生产环境
+ active: dev #生产环境
# active: prod #生产环境
application:
name: deviceCars
@@ -79,3 +79,4 @@ hystrix:
# 熔断器超时时间,默认:1000/毫秒
timeoutInMilliseconds: 20000
+
diff --git a/device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml b/device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml
index 678e454..8dc1a49 100644
--- a/device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml
+++ b/device_cars/src/main/resources/modules/analysis/MeterConfigMapper.xml
@@ -17,12 +17,13 @@
-
+
+
@@ -38,14 +39,14 @@
a.identification_interval,a.device_name,a.device_type,
a.meter_code,a.meter_name,a.camera_id,
a.type_id,a.status,a.first_time,
- a.focal_length,a.interval_time,a.focal_number,
- a.parameter_config,a.remarks,a.create_user,
+ a.algorithm_type,a.interval_time,a.focal_number,
+ a.parameter_config,a.remarks,a.init_status,a.create_user,
a.create_time,a.update_user,a.update_time,
-