Compare commits
No commits in common. "54a49a3481fe1d09b67415d95c9e16a26e50b5bf" and "5c2fbb91ddb5788cb2f44e4aa204a1d3078aa87b" have entirely different histories.
54a49a3481
...
5c2fbb91dd
|
@ -1,10 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.springframework.beans.factory.annotation.Autowired" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
|
|
Binary file not shown.
95
pom.xml
95
pom.xml
|
@ -13,74 +13,20 @@
|
|||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mybatisplus.version>3.5.1</mybatisplus.version>
|
||||
<freemaker.version>2.3.31</freemaker.version>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<relativePath />
|
||||
<version>2.7.15</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!--kafka-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
<version>2.8.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
<version>2.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--阿里云-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ecs20140526</artifactId>
|
||||
<version>5.1.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>0.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-openapi</artifactId>
|
||||
<version>0.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-console</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>openapiutil</artifactId>
|
||||
<version>0.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>tea-util</artifactId>
|
||||
<version>0.2.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>ecs20140526</artifactId>
|
||||
<version>5.1.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -147,43 +93,6 @@
|
|||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--redis-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
<version>2.7.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.7.13</version>
|
||||
</dependency>
|
||||
<!-- MQTT-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
//// This file is auto-generated, don't edit it. Thanks.
|
||||
//package com.muyu;
|
||||
//
|
||||
//import com.aliyun.ecs20140526.models.RunInstancesResponse;
|
||||
//import com.aliyun.tea.*;
|
||||
//
|
||||
//public class Sample {
|
||||
//
|
||||
// /**
|
||||
// * 使用AK&SK初始化账号Client
|
||||
// * @return Client
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static com.aliyun.ecs20140526.Client createClient() throws Exception {
|
||||
// // 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||
// // 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
||||
// com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||
// .setAccessKeyId("LTAI5tBnh5t91qYtNK53Zf3M")
|
||||
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||
// .setAccessKeySecret("DNTCIVeIWuWVZkwHVYOlqXF42RH8ja");
|
||||
// // Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
||||
// config.endpoint = "ecs-cn-hangzhou.aliyuncs.com";
|
||||
// return new com.aliyun.ecs20140526.Client(config);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static void main(String[] args_) throws Exception {
|
||||
// java.util.List<String> args = java.util.Arrays.asList(args_);
|
||||
// com.aliyun.ecs20140526.Client client = Sample.createClient();
|
||||
// com.aliyun.ecs20140526.models.RunInstancesRequest.RunInstancesRequestSystemDisk systemDisk = new com.aliyun.ecs20140526.models.RunInstancesRequest.RunInstancesRequestSystemDisk()
|
||||
// .setSize("20");
|
||||
// com.aliyun.ecs20140526.models.RunInstancesRequest runInstancesRequest = new com.aliyun.ecs20140526.models.RunInstancesRequest()
|
||||
// .setRegionId("cn-hangzhou")
|
||||
// .setInstanceType("ecs.e-c1m2.xlarge")
|
||||
// .setLaunchTemplateId("lt-bp13nqg5cfc8ju0nkhgt")
|
||||
// .setImageId("m-bp1d61lpyg1wospcguj4")
|
||||
// .setVSwitchId("vsw-bp1pp6pd19ko18jzgmjpz")
|
||||
// .setUniqueSuffix(true)
|
||||
// .setInternetChargeType("PayByTraffic")
|
||||
// .setSystemDisk(systemDisk)
|
||||
// .setSecurityGroupIds(java.util.Arrays.asList(
|
||||
// "sg-bp16xo23jf7ppzgrsiqt"
|
||||
// ));
|
||||
// com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
// try {
|
||||
// // 复制代码运行请自行打印 API 的返回值
|
||||
// RunInstancesResponse runInstancesResponse = client.runInstancesWithOptions(runInstancesRequest, runtime);
|
||||
// System.out.println("--------------------查询实例--------------------");
|
||||
// //打印响应结果
|
||||
// System.out.println(com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(runInstancesResponse)));
|
||||
//
|
||||
// } catch (TeaException error) {
|
||||
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// // 错误 message
|
||||
// System.out.println(error.getMessage());
|
||||
// // 诊断地址
|
||||
// System.out.println(error.getData().get("Recommend"));
|
||||
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
// } catch (Exception _error) {
|
||||
// TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// // 错误 message
|
||||
// System.out.println(error.getMessage());
|
||||
// // 诊断地址
|
||||
// System.out.println(error.getData().get("Recommend"));
|
||||
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,60 +0,0 @@
|
|||
//// This file is auto-generated, don't edit it. Thanks.
|
||||
//package com.muyu;
|
||||
//
|
||||
//import com.aliyun.ecs20140526.models.DescribeInstanceStatusResponse;
|
||||
//import com.aliyun.ecs20140526.models.DescribeInstancesResponse;
|
||||
//import com.aliyun.tea.*;
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//
|
||||
//@Log4j2
|
||||
//public class Sample1 {
|
||||
//
|
||||
// /**
|
||||
// * 使用AK&SK初始化账号Client
|
||||
// * @return Client
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public static com.aliyun.ecs20140526.Client createClient() throws Exception {
|
||||
// // 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||
// // 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
||||
// com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||
// .setAccessKeyId(System.getenv("LTAI5t9jSmMArEckX7ZxbVAE"))
|
||||
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||
// .setAccessKeySecret(System.getenv("1EtjgU7DnKkiVBE7rHLYDwkwgf7lI6"));
|
||||
// // Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
||||
// config.endpoint = "ecs.cn-shanghai.aliyuncs.com";
|
||||
// return new com.aliyun.ecs20140526.Client(config);
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args_) throws Exception {
|
||||
// java.util.List<String> args = java.util.Arrays.asList(args_);
|
||||
// com.aliyun.ecs20140526.Client client = Sample.createClient();
|
||||
// com.aliyun.ecs20140526.models.DescribeInstanceStatusRequest describeInstanceStatusRequest = new com.aliyun.ecs20140526.models.DescribeInstanceStatusRequest()
|
||||
// .setRegionId("cn-shanghai")
|
||||
// .setInstanceId(java.util.Arrays.asList(
|
||||
// "i-uf65ppbzjylqikhn2euq"
|
||||
// ));
|
||||
// com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||
// try {
|
||||
// // 复制代码运行请自行打印 API 的返回值
|
||||
// DescribeInstanceStatusResponse describeInstanceStatusResponse = client.describeInstanceStatusWithOptions(describeInstanceStatusRequest, runtime);
|
||||
// System.out.println(com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(describeInstanceStatusResponse)));
|
||||
// } catch (TeaException error) {
|
||||
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// // 错误 message
|
||||
// System.out.println(error.getMessage());
|
||||
// // 诊断地址
|
||||
// System.out.println(error.getData().get("Recommend"));
|
||||
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
// } catch (Exception _error) {
|
||||
// TeaException error = new TeaException(_error.getMessage(), _error);
|
||||
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||
// // 错误 message
|
||||
// System.out.println(error.getMessage());
|
||||
// // 诊断地址
|
||||
// System.out.println(error.getData().get("Recommend"));
|
||||
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @date 2023/11/9
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan(value = "com.muyu.**.mapper")
|
||||
@MapperScan(value = "com.muyu.mapper")
|
||||
public class VehicleSimulationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common;
|
||||
package com.muyu.common;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common;
|
||||
package com.muyu.common;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common;
|
||||
package com.muyu.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common;
|
||||
package com.muyu.common;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common.pool;
|
||||
package com.muyu.common.pool;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.common.pool;
|
||||
package com.muyu.common.pool;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.web.config;
|
||||
package com.muyu.config;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.common.Result;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.config;
|
||||
package com.muyu.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.config;
|
||||
package com.muyu.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.controller;
|
||||
package com.muyu.controller;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
@Log4j2
|
||||
@Controller
|
||||
public class IndexController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public String hello(){
|
||||
log.debug("重定向到 - /static/index 页面");
|
|
@ -1,9 +1,9 @@
|
|||
package com.muyu.web.controller;
|
||||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.domain.req.VehicleCreateAddReq;
|
||||
import com.muyu.web.service.VehicleService;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.VehicleCreateAddReq;
|
||||
import com.muyu.service.VehicleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
package com.muyu.web.controller;
|
||||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.web.common.PageList;
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.req.CheckPositionReq;
|
||||
import com.muyu.web.domain.req.GearReq;
|
||||
import com.muyu.web.domain.req.MsgReq;
|
||||
import com.muyu.web.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.web.domain.resp.VehicleInstanceResp;
|
||||
import com.muyu.web.service.VehicleInstanceService;
|
||||
import com.muyu.common.PageList;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.domain.req.CheckPositionReq;
|
||||
import com.muyu.domain.req.GearReq;
|
||||
import com.muyu.domain.req.MsgReq;
|
||||
import com.muyu.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.domain.resp.VehicleInstanceResp;
|
||||
import com.muyu.service.VehicleInstanceService;
|
||||
import com.muyu.vehicle.core.LocalContainer;
|
||||
import com.muyu.vehicle.model.VehicleData;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -49,13 +50,12 @@ public class VehicleInstanceController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 关闭车辆连接
|
||||
* 车辆连接初始化
|
||||
* @param vin vin
|
||||
* @return 初始化
|
||||
*/
|
||||
@PostMapping("/client/init/{vin}")
|
||||
public Result<String> vehicleClientInit(@PathVariable("vin") String vin){
|
||||
System.out.println("车辆连接初始化"+vin);
|
||||
this.vehicleInstanceService.vehicleClientInit(vin);
|
||||
return Result.success();
|
||||
}
|
||||
|
@ -116,6 +116,4 @@ public class VehicleInstanceController {
|
|||
this.vehicleInstanceService.editStatus(vin, statusKey, statusValue);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package com.muyu.web.controller;
|
||||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.PositionRouteInfo;
|
||||
import com.muyu.web.service.PositionRouteService;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
import com.muyu.service.PositionRouteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@ -1,8 +1,8 @@
|
|||
package com.muyu.web.controller;
|
||||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.web.service.VehicleUnifiedService;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.service.VehicleUnifiedService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.common.Result;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 车辆上线默认类
|
||||
* @Date 2023-11-30 下午 02:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/verify")
|
||||
public class VerifyController {
|
||||
|
||||
/**
|
||||
* 新增车辆默认上线主题
|
||||
* @return 默认返回test
|
||||
*/
|
||||
@PostMapping("/vehicleConnection")
|
||||
public Result<String> vehicleConnection(){
|
||||
return Result.success("test");
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package com.muyu;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* API 相关 createApiInfo
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/5/24 15:36
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class createApiInfo {
|
||||
/**
|
||||
* 接口名称
|
||||
*/
|
||||
private String Action;
|
||||
/**
|
||||
* 接口版本
|
||||
*/
|
||||
private String Version;
|
||||
/**
|
||||
* 接口协议
|
||||
*/
|
||||
private String Protocol;
|
||||
|
||||
/**
|
||||
* 接口 HTTP 方法
|
||||
*/
|
||||
private String Method;
|
||||
|
||||
private String AuthType;
|
||||
private String Style;
|
||||
/**
|
||||
* 接口 PATH
|
||||
*/
|
||||
private String Pathname;
|
||||
// 接口请求体内容格式
|
||||
private String ReqBodyType;
|
||||
// 接口响应体内容格式
|
||||
private String BodyType;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain;
|
||||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
@ -1,9 +1,9 @@
|
|||
package com.muyu.web.domain;
|
||||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.muyu.web.utils.VehicleUtils;
|
||||
import com.muyu.utils.VehicleUtils;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import com.muyu.vehicle.model.VehicleData;
|
||||
import lombok.AllArgsConstructor;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.model;
|
||||
package com.muyu.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.model;
|
||||
package com.muyu.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.req;
|
||||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.req;
|
||||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.req;
|
||||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.req;
|
||||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.req;
|
||||
package com.muyu.domain.req;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.resp;
|
||||
package com.muyu.domain.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.domain.resp;
|
||||
package com.muyu.domain.resp;
|
||||
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import lombok.AllArgsConstructor;
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.web.mapper;
|
||||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.web.domain.PositionRouteInfo;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.web.mapper;
|
||||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* <p>
|
|
@ -1,8 +1,8 @@
|
|||
package com.muyu.web.service;
|
||||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.web.domain.PositionRouteInfo;
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
package com.muyu.web.service;
|
||||
package com.muyu.service;
|
||||
|
||||
import com.muyu.web.common.PageList;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.domain.req.CheckPositionReq;
|
||||
import com.muyu.web.domain.req.GearReq;
|
||||
import com.muyu.web.domain.req.MsgReq;
|
||||
import com.muyu.web.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.web.domain.resp.VehicleInstanceResp;
|
||||
import com.muyu.common.PageList;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.req.CheckPositionReq;
|
||||
import com.muyu.domain.req.GearReq;
|
||||
import com.muyu.domain.req.MsgReq;
|
||||
import com.muyu.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.domain.resp.VehicleInstanceResp;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
|
@ -70,5 +71,4 @@ public interface VehicleInstanceService {
|
|||
*/
|
||||
void editStatus (String vin, String statusKey, Integer statusValue);
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.web.service;
|
||||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* <p>
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.web.service;
|
||||
package com.muyu.service;
|
||||
|
||||
import com.muyu.web.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
|
@ -1,12 +1,12 @@
|
|||
package com.muyu.web.service.impl;
|
||||
package com.muyu.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.web.domain.PositionRouteInfo;
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.web.mapper.PositionRouteMapper;
|
||||
import com.muyu.web.service.PositionRouteService;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
import com.muyu.mapper.PositionRouteMapper;
|
||||
import com.muyu.service.PositionRouteService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
|
@ -1,12 +1,12 @@
|
|||
package com.muyu.web.service.impl;
|
||||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.mapper.VehicleMapper;
|
||||
import com.muyu.web.service.VehicleInstanceService;
|
||||
import com.muyu.web.service.VehicleService;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.mapper.VehicleMapper;
|
||||
import com.muyu.service.VehicleInstanceService;
|
||||
import com.muyu.service.VehicleService;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import com.muyu.vehicle.core.LocalContainer;
|
||||
import lombok.extern.log4j.Log4j2;
|
|
@ -1,36 +1,41 @@
|
|||
package com.muyu.web.service.impl;
|
||||
package com.muyu.service.impl;
|
||||
|
||||
import com.muyu.web.common.PageList;
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.domain.model.MqttServerModel;
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.web.domain.req.CheckPositionReq;
|
||||
import com.muyu.web.domain.req.GearReq;
|
||||
import com.muyu.web.domain.req.MsgReq;
|
||||
import com.muyu.web.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.web.domain.resp.VehicleInstanceResp;
|
||||
import com.muyu.web.service.PositionRouteService;
|
||||
import com.muyu.web.service.VehicleInstanceService;
|
||||
import com.muyu.web.utils.MD5Util;
|
||||
import com.muyu.web.utils.ReflectUtils;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.muyu.common.PageList;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.common.pool.FixedThreadPool;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
import com.muyu.domain.model.TaskModel;
|
||||
import com.muyu.domain.req.CheckPositionReq;
|
||||
import com.muyu.domain.req.GearReq;
|
||||
import com.muyu.domain.req.MsgReq;
|
||||
import com.muyu.domain.req.VehicleInstanceListReq;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.domain.resp.VehicleInstanceResp;
|
||||
import com.muyu.service.PositionRouteService;
|
||||
import com.muyu.service.VehicleInstanceService;
|
||||
import com.muyu.utils.MD5Util;
|
||||
import com.muyu.utils.ReflectUtils;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import com.muyu.vehicle.api.ClientAdmin;
|
||||
import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
||||
import com.muyu.web.domain.car.Car;
|
||||
import com.muyu.vehicle.core.LocalContainer;
|
||||
import com.muyu.vehicle.model.VehicleData;
|
||||
import com.muyu.vehicle.model.properties.MqttProperties;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +46,6 @@ import java.util.stream.Stream;
|
|||
*/
|
||||
@Log4j2
|
||||
@Service
|
||||
@Repository
|
||||
public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
||||
|
||||
@Autowired
|
||||
|
@ -50,10 +54,8 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
@Autowired
|
||||
private ClientAdmin clientAdmin;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String,Object>redisTemplate;
|
||||
|
||||
|
||||
@Value("${mqtt.server.host}")
|
||||
private String broker;
|
||||
|
||||
/**
|
||||
* 根据车辆生成车辆实例
|
||||
|
@ -120,27 +122,20 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
.userName(MD5Util.encrypted(vin+timestamp))
|
||||
.nonce(MD5Util.encrypted(UUID.randomUUID().toString().replace("-", "")))
|
||||
.build();
|
||||
Result<MqttServerModel> result = clientAdmin.vehicleConnection(connectionReq);
|
||||
Result<String> result = clientAdmin.vehicleConnection(connectionReq);
|
||||
if (result.getCode() != 200){
|
||||
log.error("车辆:[{}],申请上线异常:[{}]", vin, result.getMsg());
|
||||
throw new RuntimeException("远程服务器没有【"+vin+"】车辆");
|
||||
}
|
||||
MqttServerModel mqttServerModel = result.getData();
|
||||
MqttProperties mqttProperties = MqttProperties.builder()
|
||||
.broker(mqttServerModel.getBroker())
|
||||
.topic(mqttServerModel.getTopic())
|
||||
.broker(broker)
|
||||
.topic(result.getData())
|
||||
.clientId(vin)
|
||||
.username(connectionReq.getUserName())
|
||||
.password(vin + connectionReq.getTimestamp() + connectionReq.getNonce())
|
||||
.build();
|
||||
vehicleInstance.setMqttProperties(mqttProperties);
|
||||
vehicleInstance.initClient();
|
||||
Car build = Car.builder()
|
||||
.vin(vin)
|
||||
.ip(mqttServerModel.getBroker().substring(6,20))
|
||||
.timestamp(timestamp)
|
||||
.userName(mqttProperties.getUsername())
|
||||
.build();
|
||||
|
||||
log.info("vin[{}],上线成功", vin);
|
||||
}
|
||||
|
@ -216,7 +211,6 @@ public class VehicleInstanceServiceImpl implements VehicleInstanceService {
|
|||
ReflectUtils.invokeSetter(vehicleData, statusKey, statusValue);
|
||||
}
|
||||
|
||||
|
||||
// private final AtomicBoolean unifiedStatus = new AtomicBoolean(Boolean.TRUE);
|
||||
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package com.muyu.web.service.impl;
|
||||
package com.muyu.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.muyu.web.common.pool.FixedThreadPool;
|
||||
import com.muyu.web.domain.PositionRouteInfo;
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.web.domain.model.TaskModel;
|
||||
import com.muyu.web.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.web.service.PositionRouteService;
|
||||
import com.muyu.web.service.VehicleInstanceService;
|
||||
import com.muyu.web.service.VehicleUnifiedService;
|
||||
import com.muyu.common.pool.FixedThreadPool;
|
||||
import com.muyu.domain.PositionRouteInfo;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
import com.muyu.domain.model.TaskModel;
|
||||
import com.muyu.domain.resp.UnifiedTaskResp;
|
||||
import com.muyu.service.PositionRouteService;
|
||||
import com.muyu.service.VehicleInstanceService;
|
||||
import com.muyu.service.VehicleUnifiedService;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import com.muyu.vehicle.core.LocalContainer;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -55,10 +55,9 @@ public class VehicleUnifiedServiceImpl implements VehicleUnifiedService {
|
|||
.stream()
|
||||
.map(VehicleInstance::getVin)
|
||||
.toList();
|
||||
taskModel.submit("一键上线", vinList.size());
|
||||
new Thread(() -> {
|
||||
int vinSize = 0, executionSize = 15;
|
||||
do {
|
||||
do {
|
||||
int startIndex = vinSize++ * executionSize;
|
||||
// 进行分页开启车辆
|
||||
List<String> executionVinList = vinList.stream()
|
||||
|
@ -95,7 +94,6 @@ public class VehicleUnifiedServiceImpl implements VehicleUnifiedService {
|
|||
break;
|
||||
}
|
||||
}while (true);
|
||||
taskModel.down();
|
||||
}).start();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.utils;
|
||||
package com.muyu.utils;
|
||||
|
||||
/**
|
||||
* 校验位计算
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.utils;
|
||||
|
||||
public class ConversionUtil {
|
||||
|
||||
/**
|
||||
* 字符串转化成为16进制字符串
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static String strToSixteen(String s) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int length = s.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int ch = s.charAt(i);
|
||||
String s4 = Integer.toHexString(ch);
|
||||
sb.append(s4 + " ");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.utils;
|
||||
package com.muyu.utils;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.utils;
|
||||
package com.muyu.utils;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.muyu.web.utils;
|
||||
package com.muyu.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.web.utils;
|
||||
package com.muyu.utils;
|
||||
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.common.SystemConstant;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
|
@ -1,215 +0,0 @@
|
|||
package com.muyu.vehicle;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 报文对象 MessageData
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/7 17:15
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class MessageData {
|
||||
|
||||
|
||||
/**
|
||||
*vin
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
*时间戳
|
||||
*/
|
||||
private String timestamp;
|
||||
/**
|
||||
*经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
*维度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
*车速
|
||||
*/
|
||||
private String speed;
|
||||
/**
|
||||
*总里程
|
||||
*/
|
||||
private String mileage;
|
||||
/**
|
||||
*总电压
|
||||
*/
|
||||
private String dischargeVoltage;
|
||||
/**
|
||||
*总电流
|
||||
*/
|
||||
private String dischargeCurrent;
|
||||
/**
|
||||
*绝缘电阻
|
||||
*/
|
||||
private String insulationResistance;
|
||||
/**
|
||||
*档位
|
||||
*/
|
||||
private String gear;
|
||||
/**
|
||||
*加速踏板行程值
|
||||
*/
|
||||
private String accelerationPedal;
|
||||
/**
|
||||
*制动踏板行程值
|
||||
*/
|
||||
private String brakePedal;
|
||||
/**
|
||||
*燃料消耗率
|
||||
*/
|
||||
private String fuelConsumption;
|
||||
/**
|
||||
*电机控制器温度
|
||||
*/
|
||||
private String motorControllerTemperature;
|
||||
/**
|
||||
*电机转速
|
||||
*/
|
||||
private String motorSpeed;
|
||||
/**
|
||||
*电机转矩
|
||||
*/
|
||||
private String motorTorque;
|
||||
/**
|
||||
*电机温度
|
||||
*/
|
||||
private String motorTemperature;
|
||||
/**
|
||||
*电机电压
|
||||
*/
|
||||
private String motorVoltage;
|
||||
/**
|
||||
*电机电流
|
||||
*/
|
||||
private String motorCurrent;
|
||||
/**
|
||||
*动力电池剩余电量SOC
|
||||
*/
|
||||
private String powerBattery;
|
||||
/**
|
||||
*当前状态允许的最大反馈功率
|
||||
*/
|
||||
private String maxFeedbackPower;
|
||||
/**
|
||||
*当前状态允许最大放电功率
|
||||
*/
|
||||
private String maxDischargePower;
|
||||
/**
|
||||
*BMS自检计数器
|
||||
*/
|
||||
private String bmsSelfCheck;
|
||||
/**
|
||||
*动力电池充放电电流
|
||||
*/
|
||||
private String powerBatteryCurrent;
|
||||
/**
|
||||
*动力电池负载端总电压V3
|
||||
*/
|
||||
private String powerBatteryV3;
|
||||
/**
|
||||
*单次最大电压
|
||||
*/
|
||||
private String maxVoltage;
|
||||
/**
|
||||
*单体电池最低电压
|
||||
*/
|
||||
private String minVoltage;
|
||||
/**
|
||||
*单体电池最高温度
|
||||
*/
|
||||
private String maxTemperature;
|
||||
/**
|
||||
*单体电池最低温度
|
||||
*/
|
||||
private String minTemperature;
|
||||
/**
|
||||
*动力电池可用容量
|
||||
*/
|
||||
private String availableCapacity;
|
||||
/**
|
||||
*车辆状态
|
||||
*/
|
||||
private String vehicleStatus;
|
||||
/**
|
||||
*充电状态
|
||||
*/
|
||||
private String chargeStatus;
|
||||
/**
|
||||
*运行状态
|
||||
*/
|
||||
private String runStatus;
|
||||
/**
|
||||
*SOC
|
||||
*/
|
||||
private String soc;
|
||||
/**
|
||||
*可充电储能装置工作状态
|
||||
*/
|
||||
private String chargeWorkStatus;
|
||||
/**
|
||||
*驱动电机状态
|
||||
*/
|
||||
private String driveMotorStatus;
|
||||
/**
|
||||
*定位是否有效
|
||||
*/
|
||||
private String location;
|
||||
/**
|
||||
*EAS
|
||||
*/
|
||||
private String eas;
|
||||
/**
|
||||
*PTC
|
||||
*/
|
||||
private String ptc;
|
||||
/**
|
||||
*EPS
|
||||
*/
|
||||
private String eps;
|
||||
/**
|
||||
*ABS
|
||||
*/
|
||||
private String abs;
|
||||
/**
|
||||
*MCU
|
||||
*/
|
||||
private String mcu;
|
||||
/**
|
||||
*动力电池加热状态
|
||||
*/
|
||||
private String powerBatteryHeating;
|
||||
/**
|
||||
*动力电池当前状态
|
||||
*/
|
||||
private String powerBatteryCurrentStatus;
|
||||
/**
|
||||
*动力电池保温状态
|
||||
*/
|
||||
private String powerBatteryHeat;
|
||||
/**
|
||||
*DCDC
|
||||
*/
|
||||
private String dcdc;
|
||||
/**
|
||||
*CHG
|
||||
*/
|
||||
private String chg;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,484 +0,0 @@
|
|||
package com.muyu.vehicle;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author 牧鱼
|
||||
* @Classname VehicleData
|
||||
* @Description 车辆模拟数据对象
|
||||
* @Date 2021/8/5
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VehicleData {
|
||||
/**
|
||||
* VIN
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
* 行驶路线
|
||||
*/
|
||||
private String drivingRoute;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private String latitude;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
private String speed;
|
||||
|
||||
/**
|
||||
* 里程
|
||||
*/
|
||||
private String mileage;
|
||||
|
||||
/**
|
||||
* 总电压
|
||||
*/
|
||||
private String voltage;
|
||||
|
||||
/**
|
||||
* 总电流
|
||||
*/
|
||||
private String current;
|
||||
|
||||
/**
|
||||
* 绝缘电阻
|
||||
*/
|
||||
private String resistance;
|
||||
|
||||
/**
|
||||
* 档位
|
||||
*/
|
||||
private String gear;
|
||||
|
||||
/**
|
||||
* 加速踏板行程值
|
||||
*/
|
||||
private String accelerationPedal;
|
||||
|
||||
/**
|
||||
* 制动踏板行程值
|
||||
*/
|
||||
private String brakePedal;
|
||||
|
||||
/**
|
||||
* 燃料消耗率
|
||||
*/
|
||||
private String fuelConsumptionRate;
|
||||
|
||||
/**
|
||||
* 电机控制器温度
|
||||
*/
|
||||
private String motorControllerTemperature;
|
||||
|
||||
/**
|
||||
* 电机转速
|
||||
*/
|
||||
private String motorSpeed;
|
||||
|
||||
/**
|
||||
* 电机转矩
|
||||
*/
|
||||
private String motorTorque;
|
||||
|
||||
/**
|
||||
* 电机温度
|
||||
*/
|
||||
private String motorTemperature;
|
||||
|
||||
/**
|
||||
* 电机电压
|
||||
*/
|
||||
private String motorVoltage;
|
||||
|
||||
/**
|
||||
* 电机电流
|
||||
*/
|
||||
private String motorCurrent;
|
||||
|
||||
/**
|
||||
* 动力电池剩余电量SOC
|
||||
*/
|
||||
private String remainingBattery;
|
||||
|
||||
/**
|
||||
* 当前状态允许的最大反馈功率
|
||||
*/
|
||||
private String maximumFeedbackPower;
|
||||
|
||||
/**
|
||||
* 当前状态允许最大放电功率
|
||||
*/
|
||||
private String maximumDischargePower;
|
||||
|
||||
/**
|
||||
* BMS自检计数器
|
||||
*/
|
||||
private String selfCheckCounter;
|
||||
|
||||
/**
|
||||
* 动力电池充放电电流
|
||||
*/
|
||||
private String totalBatteryCurrent;
|
||||
|
||||
/**
|
||||
* 动力电池负载端总电压V3
|
||||
*/
|
||||
private String totalBatteryVoltage;
|
||||
|
||||
/**
|
||||
* 单次最大电压
|
||||
*/
|
||||
private String singleBatteryMaxVoltage;
|
||||
|
||||
/**
|
||||
* 单体电池最低电压
|
||||
*/
|
||||
private String singleBatteryMinVoltage;
|
||||
|
||||
/**
|
||||
* 单体电池最高温度
|
||||
*/
|
||||
private String singleBatteryMaxTemperature;
|
||||
|
||||
/**
|
||||
* 单体电池最低温度
|
||||
*/
|
||||
private String singleBatteryMinTemperature;
|
||||
|
||||
/**
|
||||
* 动力电池可用容量
|
||||
*/
|
||||
private String availableBatteryCapacity;
|
||||
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private int vehicleStatus;
|
||||
|
||||
/**
|
||||
* 充电状态
|
||||
*/
|
||||
private int chargingStatus;
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
private int operatingStatus;
|
||||
|
||||
/**
|
||||
* SOC
|
||||
*/
|
||||
private int socStatus;
|
||||
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
private int chargingEnergyStorageStatus;
|
||||
|
||||
/**
|
||||
* 驱动电机状态
|
||||
*/
|
||||
private int driveMotorStatus;
|
||||
|
||||
/**
|
||||
* 定位是否有效
|
||||
*/
|
||||
private int positionStatus;
|
||||
|
||||
/**
|
||||
* EAS(汽车防盗系统)状态
|
||||
*/
|
||||
private int easStatus;
|
||||
|
||||
/**
|
||||
* PTC(电动加热器)状态
|
||||
*/
|
||||
private int ptcStatus;
|
||||
|
||||
/**
|
||||
* EPS(电动助力系统)状态
|
||||
*/
|
||||
private int epsStatus;
|
||||
|
||||
/**
|
||||
* ABS(防抱死)状态
|
||||
*/
|
||||
private int absStatus;
|
||||
|
||||
/**
|
||||
* MCU(电机/逆变器)状态
|
||||
*/
|
||||
private int mcuStatus;
|
||||
|
||||
/**
|
||||
* 动力电池加热状态
|
||||
*/
|
||||
private int heatingStatus;
|
||||
|
||||
/**
|
||||
* 动力电池当前状态
|
||||
*/
|
||||
private int batteryStatus;
|
||||
|
||||
/**
|
||||
* 动力电池保温状态
|
||||
*/
|
||||
private int batteryInsulationStatus;
|
||||
|
||||
/**
|
||||
* DCDC(电力交换系统)状态
|
||||
*/
|
||||
private int dcdcStatus;
|
||||
|
||||
/**
|
||||
* CHG(充电机)状态
|
||||
*/
|
||||
private int chgStatus;
|
||||
|
||||
/**
|
||||
* 车辆状态 报文
|
||||
*/
|
||||
private String vehicleStatusMsg;
|
||||
/**
|
||||
* 智能硬件 报文
|
||||
*/
|
||||
private String smartHardwareMsg;
|
||||
/**
|
||||
* 电池报文
|
||||
*/
|
||||
private String batteryMsg;
|
||||
|
||||
public String getMsg(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
//第一位VIN
|
||||
sb.append(vin);
|
||||
//第二位经度 longitude latitude
|
||||
sb.append(getValue(longitude ,11));
|
||||
//第三位维度 longitude latitude
|
||||
sb.append(getValue(latitude ,10));
|
||||
//车速
|
||||
sb.append(getValue(speed,6));
|
||||
//总里程
|
||||
sb.append(getValue(mileage,11));
|
||||
// 总电压
|
||||
sb.append(getValue(voltage,6));
|
||||
//总电流
|
||||
sb.append(getValue(current,5));
|
||||
//绝缘电阻 79 - 87
|
||||
sb.append(getValue(resistance,9));
|
||||
//档位
|
||||
sb.append(gear);
|
||||
// 加速踏板行程值
|
||||
sb.append(getValue(accelerationPedal,2));
|
||||
// 制动踏板行程值
|
||||
sb.append(getValue(brakePedal,2));
|
||||
// 燃料消耗率
|
||||
sb.append(getValue(fuelConsumptionRate,5));
|
||||
//电机控制器温度
|
||||
sb.append(getValue(motorControllerTemperature,6));
|
||||
//电机转速
|
||||
sb.append(getValue(motorSpeed,5));
|
||||
//点击转矩
|
||||
sb.append(getValue(motorTorque,4));
|
||||
//电机温度
|
||||
sb.append(getValue(motorTemperature,6));
|
||||
//电机电压
|
||||
sb.append(getValue(motorVoltage,5));
|
||||
//电机电流
|
||||
sb.append(getValue(motorCurrent,8));
|
||||
//动力电池剩余电量SOC
|
||||
sb.append(getValue(remainingBattery,6));
|
||||
//当前状态允许的最大反馈功率
|
||||
sb.append(getValue(maximumFeedbackPower,6));
|
||||
//当前状态允许最大放电功率
|
||||
sb.append(getValue(maximumDischargePower,6));
|
||||
//BMS自检计数器
|
||||
sb.append(getValue(selfCheckCounter,2));
|
||||
//动力电池充放电电流
|
||||
sb.append(getValue(totalBatteryCurrent,5));
|
||||
//动力电池负载端总电压V3
|
||||
sb.append(getValue(totalBatteryVoltage,6));
|
||||
//单次最大电压
|
||||
sb.append(getValue(singleBatteryMaxVoltage,4));
|
||||
//单体电池最低电压
|
||||
sb.append(getValue(singleBatteryMinVoltage,4));
|
||||
//单体电池最高温度
|
||||
sb.append(getValue(singleBatteryMaxTemperature,6));
|
||||
//单体电池最低温度
|
||||
sb.append(getValue(singleBatteryMinTemperature,6));
|
||||
//动力电池可用容量
|
||||
sb.append(getValue(availableBatteryCapacity,6));
|
||||
//车辆状态
|
||||
sb.append(vehicleStatus);
|
||||
//充电状态
|
||||
sb.append(chargingStatus);
|
||||
//运行状态
|
||||
sb.append(operatingStatus);
|
||||
//SOC
|
||||
sb.append(socStatus);
|
||||
//可充电储能装置工作状态
|
||||
sb.append(chargingEnergyStorageStatus);
|
||||
//驱动电机状态
|
||||
sb.append(driveMotorStatus);
|
||||
//定位是否有效
|
||||
sb.append(positionStatus);
|
||||
//EAS
|
||||
sb.append(easStatus);
|
||||
//PTC
|
||||
sb.append(ptcStatus);
|
||||
//EPS
|
||||
sb.append(epsStatus);
|
||||
//ABS
|
||||
sb.append(absStatus);
|
||||
//MCU
|
||||
sb.append(mcuStatus);
|
||||
//动力电池加热状态
|
||||
sb.append(heatingStatus);
|
||||
//动力电池当前状态
|
||||
sb.append(batteryStatus);
|
||||
//动力电池保温状态
|
||||
sb.append(batteryInsulationStatus);
|
||||
//DCDC
|
||||
sb.append(dcdcStatus);
|
||||
//CHG
|
||||
sb.append(chgStatus);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getValue(String val , int valLength){
|
||||
int length = val.length();
|
||||
if (length > valLength){
|
||||
return val.substring( 0 , valLength);
|
||||
}
|
||||
val = val + "0".repeat(valLength - length);
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
VIN
|
||||
vin;
|
||||
行驶路线
|
||||
drivingRoute;
|
||||
经度
|
||||
longitude;
|
||||
维度
|
||||
latitude;
|
||||
速度
|
||||
speed;
|
||||
里程
|
||||
mileage;
|
||||
总电压
|
||||
voltage;
|
||||
总电流
|
||||
current;
|
||||
绝缘电阻
|
||||
resistance;
|
||||
档位
|
||||
gear;
|
||||
加速踏板行程值
|
||||
accelerationPedal;
|
||||
制动踏板行程值
|
||||
brakePedal;
|
||||
燃料消耗率
|
||||
fuelConsumptionRate;
|
||||
*/
|
||||
|
||||
/**
|
||||
电机控制器温度
|
||||
motorControllerTemperature;
|
||||
电机转速
|
||||
motorSpeed;
|
||||
电机转矩
|
||||
motorTorque;
|
||||
电机温度
|
||||
motorTemperature;
|
||||
电机电压
|
||||
motorVoltage;
|
||||
电机电流
|
||||
motorCurrent;
|
||||
*/
|
||||
|
||||
/**
|
||||
动力电池剩余电量SOC
|
||||
remainingBattery;
|
||||
当前状态允许的最大反馈功率
|
||||
maximumFeedbackPower;
|
||||
当前状态允许最大放电功率
|
||||
maximumDischargePower;
|
||||
BMS自检计数器
|
||||
selfCheckCounter;
|
||||
动力电池充放电电流
|
||||
totalBatteryCurrent;
|
||||
动力电池负载端总电压V3
|
||||
totalBatteryVoltage;
|
||||
单次最大电压
|
||||
singleBatteryMaxVoltage;
|
||||
单体电池最低电压
|
||||
singleBatteryMinVoltage;
|
||||
单体电池最高温度
|
||||
singleBatteryMaxTemperature;
|
||||
单体电池最低温度
|
||||
singleBatteryMinTemperature;
|
||||
动力电池可用容量
|
||||
availableBatteryCapacity;
|
||||
*/
|
||||
|
||||
/**
|
||||
车辆状态
|
||||
vehicleStatus;
|
||||
充电状态
|
||||
chargingStatus;
|
||||
运行状态
|
||||
operatingStatus;
|
||||
SOC
|
||||
socStatus;
|
||||
可充电储能装置工作状态
|
||||
chargingEnergyStorageStatus;
|
||||
驱动电机状态
|
||||
driveMotorStatus;
|
||||
定位是否有效
|
||||
positionStatus;
|
||||
*/
|
||||
|
||||
/**
|
||||
EAS(汽车防盗系统)状态
|
||||
easStatus;
|
||||
PTC(电动加热器)状态
|
||||
ptcStatus;
|
||||
EPS(电动助力系统)状态
|
||||
epsStatus;
|
||||
ABS(防抱死)状态
|
||||
absStatus;
|
||||
MCU(电机/逆变器)状态
|
||||
mcuStatus;
|
||||
*/
|
||||
|
||||
/**
|
||||
动力电池加热状态
|
||||
heatingStatus;
|
||||
动力电池当前状态
|
||||
batteryStatus;
|
||||
动力电池保温状态
|
||||
batteryInsulationStatus;
|
||||
DCDC(电力交换系统)状态
|
||||
dcdcStatus;
|
||||
CHG(充电机)状态
|
||||
chgStatus;
|
||||
*/
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package com.muyu.vehicle;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.muyu.web.common.SystemConstant;
|
||||
import com.muyu.web.common.pool.ScheduledThreadPool;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.domain.model.PositionModel;
|
||||
import com.muyu.web.utils.CalculateCheckDigit;
|
||||
import com.muyu.web.utils.ConversionUtil;
|
||||
import com.muyu.web.utils.VehicleUtils;
|
||||
import com.muyu.common.SystemConstant;
|
||||
import com.muyu.common.pool.ScheduledThreadPool;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.domain.model.PositionModel;
|
||||
import com.muyu.utils.CalculateCheckDigit;
|
||||
import com.muyu.utils.ConversionUtil;
|
||||
import com.muyu.utils.VehicleUtils;
|
||||
import com.muyu.vehicle.model.VehicleData;
|
||||
import com.muyu.vehicle.model.properties.MqttProperties;
|
||||
import com.muyu.vehicle.thread.VehicleThread;
|
||||
|
@ -29,7 +29,7 @@ import java.util.Objects;
|
|||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import static com.muyu.web.common.SystemConstant.*;
|
||||
import static com.muyu.common.SystemConstant.*;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
|
@ -137,12 +137,10 @@ public class VehicleInstance {
|
|||
options.setKeepAliveInterval(20);
|
||||
// 连接
|
||||
client.connect(options);
|
||||
|
||||
log.debug("车辆:[{}] 客户端初始化成功连接配置:{}", getVin(),
|
||||
JSONObject.toJSONString(this.mqttProperties));
|
||||
} catch (MqttException e) {
|
||||
log.error("车辆:[{}] 客户端初始化异常", getVin(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,9 +197,6 @@ public class VehicleInstance {
|
|||
if (this.positionCode == null){
|
||||
throw new RuntimeException("车辆["+getVin()+"]为选中路径");
|
||||
}
|
||||
if (!isOnline()){
|
||||
throw new RuntimeException("车辆["+getVin()+"]未和服务器建立链接");
|
||||
}
|
||||
VehicleThread vehicleThread = new VehicleThread();
|
||||
vehicleThread.setVehicleInstance(this);
|
||||
this.setVehicleThread(vehicleThread);
|
||||
|
|
|
@ -3,8 +3,7 @@ package com.muyu.vehicle.api;
|
|||
import com.dtflys.forest.annotation.BaseRequest;
|
||||
import com.dtflys.forest.annotation.JSONBody;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.model.MqttServerModel;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
||||
|
||||
/**
|
||||
|
@ -18,5 +17,5 @@ import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
|||
public interface ClientAdmin {
|
||||
|
||||
@Post("${adminTopicUri}")
|
||||
public Result<MqttServerModel> vehicleConnection(@JSONBody VehicleConnectionReq vehicleConnectionReq);
|
||||
public Result<String> vehicleConnection(@JSONBody VehicleConnectionReq vehicleConnectionReq);
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package com.muyu.vehicle.core;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
* @version 1.0
|
||||
* @description 配置
|
||||
* @date 2023/11/9
|
||||
*/
|
||||
public class Config {
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package com.muyu.vehicle.core;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.muyu.web.common.pool.FixedThreadPool;
|
||||
import com.muyu.web.common.pool.ScheduledThreadPool;
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.web.service.VehicleInstanceService;
|
||||
import com.muyu.web.service.VehicleService;
|
||||
import com.muyu.common.pool.FixedThreadPool;
|
||||
import com.muyu.common.pool.ScheduledThreadPool;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.service.VehicleInstanceService;
|
||||
import com.muyu.service.VehicleService;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.muyu.vehicle.model;
|
||||
|
||||
|
||||
import com.muyu.web.domain.Vehicle;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.utils.VehicleUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -9,7 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static com.muyu.web.utils.VehicleUtils.genValue;
|
||||
import static com.muyu.utils.VehicleUtils.genValue;
|
||||
|
||||
/**
|
||||
* @author 牧鱼
|
||||
|
@ -295,7 +296,7 @@ public class VehicleData {
|
|||
getValue(resistance, 9) +
|
||||
//档位
|
||||
(gear == null ? "D" : gear) +
|
||||
// 加速踏板行程值91
|
||||
// 加速踏板行程值
|
||||
getValue(accelerationPedal, 2) +
|
||||
// 制动踏板行程值
|
||||
getValue(brakePedal, 2) +
|
||||
|
|
|
@ -43,6 +43,5 @@ public class MqttProperties {
|
|||
* 节点ID
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
private int qos = 0;
|
||||
}
|
||||
|
|
|
@ -2,13 +2,8 @@ package com.muyu.vehicle.thread;
|
|||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import lombok.Data;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
|
||||
@Data
|
||||
@Log4j2
|
||||
public class VehicleThread implements Runnable {
|
||||
|
||||
|
@ -27,8 +22,7 @@ public class VehicleThread implements Runnable {
|
|||
*/
|
||||
private VehicleInstance vehicleInstance;
|
||||
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (!isStop){
|
||||
|
@ -64,7 +58,7 @@ public class VehicleThread implements Runnable {
|
|||
/**
|
||||
* 开始线程
|
||||
*/
|
||||
public void resume(){
|
||||
public void resume() {
|
||||
isPaused = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.muyu.web.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new
|
||||
Jackson2JsonRedisSerializer(Object.class);
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
|
||||
StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||
// key采用String的序列化方式
|
||||
template.setKeySerializer(stringRedisSerializer);
|
||||
// hash的key也采用String的序列化方式
|
||||
template.setHashKeySerializer(stringRedisSerializer);
|
||||
// value序列化方式采用jackson
|
||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
// hash的value序列化方式采用jackson
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
template.afterPropertiesSet();
|
||||
|
||||
return template;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//package com.muyu.config;
|
||||
//
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//import javax.sql.DataSource;
|
||||
//
|
||||
///**
|
||||
// * 第二个数据源 SecondaryDataSourceConfig
|
||||
// *
|
||||
// * @author Yangle
|
||||
// * Date 2024/6/2 22:03
|
||||
// */
|
||||
//@Configuration
|
||||
//public class SecondaryDataSourceConfig {
|
||||
//
|
||||
// @Value("${datasource.secondary.url}")
|
||||
// private String url;
|
||||
//
|
||||
// @Value("${datasource.secondary.username}")
|
||||
// private String username;
|
||||
//
|
||||
// @Value("${datasource.secondary.password}")
|
||||
// private String password;
|
||||
//
|
||||
// @Value("${datasource.secondary.driver-class-name}")
|
||||
// private String driverClassName;
|
||||
//
|
||||
// @Bean(name = "secondaryDataSource")
|
||||
// @ConfigurationProperties(prefix = "datasource.secondary")
|
||||
// public DataSource secondaryDataSource() {
|
||||
// return DataSourceBuilder.create()
|
||||
// .url(url)
|
||||
// .username(username)
|
||||
// .password(password)
|
||||
// .driverClassName(driverClassName)
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -1,29 +0,0 @@
|
|||
package com.muyu.web.controller;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.model.OverviewModel;
|
||||
import com.muyu.web.domain.resp.OverviewResp;
|
||||
import com.muyu.web.service.OverviewService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 车辆模拟系统概述 OverviewController
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/10 14:21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vehicle/overview")
|
||||
public class OverviewController {
|
||||
@Autowired
|
||||
private OverviewService overviewService;
|
||||
|
||||
@GetMapping
|
||||
public Result<OverviewResp> getVehicleList() {
|
||||
OverviewModel overviewModel= overviewService.overview();
|
||||
return Result.success(OverviewResp.modeBuild(overviewModel));
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
package com.muyu.web.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.User;
|
||||
import com.muyu.web.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* com.muyu.controller 测试
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
|
||||
/**
|
||||
* 构造方法注入
|
||||
*/
|
||||
@Autowired
|
||||
UserService userService;
|
||||
|
||||
|
||||
@PostMapping("/login")
|
||||
public Result login(){
|
||||
return Result.success();
|
||||
}
|
||||
@PostMapping("/info")
|
||||
public Result info(){
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/save")
|
||||
public Result save() {
|
||||
User user = new User();
|
||||
user.setId(10);
|
||||
user.setUsername("miaolinlin");
|
||||
user.setPwd("121212");
|
||||
userService.save(user);
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/update")
|
||||
public Result update(Integer id) {
|
||||
User user = new User();
|
||||
user.setId(id);
|
||||
user.setPwd("1111111111");
|
||||
userService.updateById(user);
|
||||
return Result.success("{}");
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result list() {
|
||||
// 返回所有
|
||||
List<User> list = userService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listByContion")
|
||||
public Result listByContion() {
|
||||
/**
|
||||
* 条件查询, 通过QueryWrapper来实现查询的条件:
|
||||
* eq: 代表相等
|
||||
* like: 模糊匹配
|
||||
* orderBy: 排序
|
||||
* in, notin
|
||||
* 大于,小于,between等
|
||||
*/
|
||||
List<User> list = userService.list(new LambdaQueryWrapper<User>()
|
||||
// 查询年龄=11的
|
||||
.eq(User::getUsername, "miao")
|
||||
// 模糊匹配
|
||||
.like(User::getPwd, "%111%")
|
||||
// 排序,按照创建时间
|
||||
.orderByDesc(User::getCreateTime)
|
||||
);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getById")
|
||||
public Result getById(Integer id) {
|
||||
User user = userService.getById(id);
|
||||
return Result.success(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/delete")
|
||||
public Result delete(Integer id) {
|
||||
userService.removeById(id);
|
||||
return Result.success("success");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result page(int pageNum, int pageSize, String name) {
|
||||
IPage<User> page = new Page<>(pageNum, pageSize);
|
||||
|
||||
IPage<User> page1 = userService.page(page, new LambdaQueryWrapper<User>()
|
||||
// 主要演示这里可以加条件。在name不为空的时候执行
|
||||
.like(StringUtils.isNotEmpty(name), User::getUsername, "%" + name + "%"));
|
||||
|
||||
return Result.success(page1);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.muyu.web.controller;
|
||||
|
||||
import com.muyu.web.common.Result;
|
||||
import com.muyu.web.domain.model.MqttServerModel;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: 车辆上线默认类
|
||||
* @Date 2023-11-30 下午 02:59
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/verify")
|
||||
public class VerifyController {
|
||||
|
||||
|
||||
@Value("${mqtt.server.host}")
|
||||
private String broker;
|
||||
|
||||
@Value("${mqtt.server.topic}")
|
||||
private String topic;
|
||||
|
||||
|
||||
/**
|
||||
* 新增车辆默认上线主题
|
||||
* @return 默认返回test
|
||||
*/
|
||||
@PostMapping("/vehicleConnection")
|
||||
public Result<MqttServerModel> vehicleConnection(){
|
||||
return Result.success(
|
||||
MqttServerModel.builder()
|
||||
.broker(broker)
|
||||
.topic(topic)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
package com.muyu.web.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
@TableName("t_user")
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String pwd;
|
||||
|
||||
/**
|
||||
* 创建时间,MyMetaObjectHandler 配合使用,入库的时候自动填充
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 修改时间,MyMetaObjectHandler 配合使用,入库的时候自动填充
|
||||
*/
|
||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User{" +
|
||||
"id=" + id +
|
||||
", username=" + username +
|
||||
", pwd=" + pwd +
|
||||
", createTime=" + createTime +
|
||||
", updateTime=" + updateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.muyu.web.domain.car;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 车辆信息 Car
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/2 21:14
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class Car {
|
||||
|
||||
/**
|
||||
* vin
|
||||
*/
|
||||
@JSONField(name = "vehicleVin")
|
||||
private String vin;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
private String timestamp;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@JSONField(name = "username")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* ip
|
||||
*/
|
||||
private String ip;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
package com.muyu.web.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description: Mqtt服务器模型
|
||||
* @Date 2024-3-26 上午 09:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MqttServerModel {
|
||||
|
||||
/**
|
||||
* MQTT服务节点
|
||||
*/
|
||||
private String broker;
|
||||
|
||||
/**
|
||||
* MQTT订阅主题
|
||||
*/
|
||||
private String topic;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package com.muyu.web.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 概述响应
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/10 14:27
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class OverviewModel {
|
||||
/**
|
||||
* 在线车辆
|
||||
*/
|
||||
private Long online;
|
||||
|
||||
/**
|
||||
* 离线车辆
|
||||
*/
|
||||
private Long offline;
|
||||
|
||||
/**
|
||||
* 暂停车辆
|
||||
*/
|
||||
private Long pause;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package com.muyu.web.domain.resp;
|
||||
|
||||
import com.muyu.web.domain.model.OverviewModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 概述响应
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/10 14:24
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class OverviewResp {
|
||||
/**
|
||||
* 在线车辆
|
||||
*/
|
||||
private Long online;
|
||||
|
||||
/**
|
||||
* 离线车辆
|
||||
*/
|
||||
private Long offline;
|
||||
|
||||
/**
|
||||
* 暂停车辆
|
||||
*/
|
||||
private Long pause;
|
||||
|
||||
public static OverviewResp modeBuild(OverviewModel overviewModel) {
|
||||
return builder().online(overviewModel.getOnline())
|
||||
.offline(overviewModel.getOffline())
|
||||
.pause(overviewModel.getPause())
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.muyu.web.kafka;
|
||||
|
||||
/**
|
||||
* 生产者 PartitionerProducer
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/9 18:41
|
||||
*/
|
||||
public class PartitionerProducer {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.muyu.web.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.web.domain.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
//package com.muyu.mapper;
|
||||
//
|
||||
//import com.muyu.domain.car.Car;
|
||||
//import org.apache.ibatis.annotations.Mapper;
|
||||
//
|
||||
///**
|
||||
// * VehicleInstanceMapper
|
||||
// *
|
||||
// * @author Yangle
|
||||
// * Date 2024/6/2 21:47
|
||||
// */
|
||||
//@Mapper
|
||||
//public interface VehicleInstanceMapper {
|
||||
// void addCar(Car car);
|
||||
//}
|
|
@ -1,68 +0,0 @@
|
|||
package com.muyu.web.mqtt;
|
||||
|
||||
import com.muyu.web.utils.ConversionUtil;
|
||||
import com.muyu.vehicle.MessageData;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.kafka.clients.admin.NewTopic;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.kafka.core.KafkaAdmin;
|
||||
import org.springframework.kafka.core.KafkaTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 回执消息类 MessageCallbackService
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/6 15:08
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class MessageCallbackService implements MqttCallback {
|
||||
|
||||
@Autowired
|
||||
private KafkaTemplate kafkaTemplate;
|
||||
@Autowired
|
||||
private KafkaAdmin kafkaAdmin;
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
System.out.println("connectionLost:"+cause.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception {
|
||||
|
||||
log.info("topic:{}",topic);
|
||||
log.info("Qos:{}",mqttMessage.getQos());
|
||||
log.info("message content:{}",new String(mqttMessage.getPayload()));
|
||||
String s = new String(mqttMessage.getPayload());
|
||||
MessageData main = ConversionUtil.main(s);
|
||||
try {
|
||||
List<NewTopic> newTopicList = createNewTopics(topic, main.getVin(),main);
|
||||
for (NewTopic newTopic : newTopicList) {
|
||||
kafkaAdmin.createOrModifyTopics(newTopic);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
private List<NewTopic> createNewTopics(String topic, String vin, MessageData messageData) {
|
||||
List<NewTopic> newTopics = new ArrayList<>();
|
||||
String topicName = topic + "-" + vin;
|
||||
newTopics.add(new NewTopic(topicName, 8, (short) 1));
|
||||
ProducerRecord<String, Object> stringObjectProducerRecord = new ProducerRecord<>(topicName, messageData.toString());
|
||||
kafkaTemplate.send(stringObjectProducerRecord);
|
||||
return newTopics;
|
||||
}
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
System.out.println("deliveryComplete---------" + token.isComplete());
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.muyu.web.mqtt;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* mqtt配置 MqttFactory
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/6 15:10
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class MqttFactory {
|
||||
|
||||
private final MessageCallbackService messageCallbackService;
|
||||
|
||||
public MqttClient creatClient(MqttProperties mqttProperties) {
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(mqttProperties.getBroker(), mqttProperties.getClientid(), new MemoryPersistence());
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
|
||||
// 连接参数
|
||||
if (mqttProperties.isLong())
|
||||
{
|
||||
options.setUserName(mqttProperties.getUsername());
|
||||
options.setPassword(mqttProperties.getPassword().toCharArray());
|
||||
}
|
||||
options.setConnectionTimeout(60);
|
||||
options.setKeepAliveInterval(60);
|
||||
client.connect(options);
|
||||
client.setCallback(messageCallbackService);
|
||||
client.subscribe(mqttProperties.getTopic(),0);
|
||||
|
||||
} catch (MqttException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.muyu.web.mqtt;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 配置文件 MqttProperties
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/5/29 20:06
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
public class MqttProperties {
|
||||
|
||||
private String broker;
|
||||
private String topic ;
|
||||
private String username;
|
||||
private String password;
|
||||
private String clientid;
|
||||
|
||||
public static MqttProperties configBuild(String ip,String topic){
|
||||
return MqttProperties.builder()
|
||||
.broker("tcp://"+ip+":1883")
|
||||
.topic(topic)
|
||||
.clientid("protocol-parsing")
|
||||
.build();
|
||||
}
|
||||
|
||||
public boolean isLong(){
|
||||
return !StringUtils.isBlank(this.username) && !StringUtils.isBlank(this.password);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.muyu.web.mqtt;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 消费处理器 MsgHandler
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/6 15:15
|
||||
*/
|
||||
@Log4j2
|
||||
@Component
|
||||
public class MsgHandler {
|
||||
@Autowired
|
||||
private MqttFactory mqttFactory;
|
||||
@RabbitListener(queues = "ip")
|
||||
public void msg(String msg){
|
||||
log.info("接收到消息:{}",msg);
|
||||
|
||||
String[] split = msg.split(",");
|
||||
for (String s : split) {
|
||||
MqttProperties mqttProperties = MqttProperties.configBuild(
|
||||
s,
|
||||
"test1"
|
||||
);
|
||||
log.error("接收到消息初始化信息:{}",mqttProperties);
|
||||
MqttClient mqttClient = mqttFactory.creatClient(mqttProperties);
|
||||
log.error("client创建成功:{}",mqttClient.getClientId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.muyu.web.mqtt;
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* RabbitConfig
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/6 15:17
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitConfig {
|
||||
|
||||
@Bean
|
||||
public Queue autoDeleteQueue1() {
|
||||
return new Queue("create.topic", true);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DirectExchange directExchange() {
|
||||
return new DirectExchange("topic.direct");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding binding(DirectExchange directExchange,
|
||||
Queue autoDeleteQueue1 ) {
|
||||
return BindingBuilder.bind(autoDeleteQueue1)
|
||||
.to(directExchange)
|
||||
.with("protocol-parsing");
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.muyu.web.rabbitmq;
|
||||
|
||||
import com.muyu.web.rabbitmq.confilg.RabbitmqConfig;
|
||||
import com.rabbitmq.client.impl.AMQImpl;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 监听车辆上线的信息 SubscriptionHandler
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/6 14:24
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class SubscriptionHandler {
|
||||
|
||||
@RabbitListener(queues = {RabbitmqConfig.QUEUE_INFORM_EMAIL})
|
||||
public void receive_email(Object msg, Message message, AMQImpl.Channel channel){
|
||||
System.out.println("QUEUE_INFORM_EMAIL msg"+msg);
|
||||
}
|
||||
//监听sms队列
|
||||
@RabbitListener(queues = "subscription")
|
||||
public void receiveSms(Message message) {
|
||||
try {
|
||||
log.info("消费者得到的消息: {}" , new String(message.getBody()));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package com.muyu.web.rabbitmq.confilg;
|
||||
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
* rabbitMQ配置 RabbitmqConfig
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/5/28 21:42
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitmqConfig {
|
||||
public static final String QUEUE_INFORM_EMAIL = "queue_inform_email";
|
||||
public static final String QUEUE_INFORM_SMS = "disconnect_connect";
|
||||
public static final String EXCHANGE_TOPICS_INFORM="exchange_topics_inform";
|
||||
public static final String ROUTINGKEY_EMAIL="inform.#.email.#";
|
||||
public static final String ROUTINGKEY_SMS="inform.#.sms.#";
|
||||
|
||||
|
||||
@Bean(EXCHANGE_TOPICS_INFORM)
|
||||
public Exchange EXCHANGE_TOPICS_INFORM(){
|
||||
//durable(true) 持久化,mq重启之后交换机还在
|
||||
return ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build();
|
||||
}
|
||||
|
||||
//声明QUEUE_INFORM_EMAIL队列
|
||||
@Bean(QUEUE_INFORM_EMAIL)
|
||||
public Queue QUEUE_INFORM_EMAIL(){
|
||||
return new Queue(QUEUE_INFORM_EMAIL);
|
||||
}
|
||||
//声明QUEUE_INFORM_SMS队列
|
||||
@Bean(QUEUE_INFORM_SMS)
|
||||
public Queue QUEUE_INFORM_SMS(){
|
||||
return new Queue(QUEUE_INFORM_SMS);
|
||||
}
|
||||
|
||||
//ROUTINGKEY_EMAIL队列绑定交换机,指定routingKey
|
||||
@Bean
|
||||
public Binding BINDING_QUEUE_INFORM_EMAIL(@Qualifier(QUEUE_INFORM_EMAIL) Queue queue,
|
||||
@Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){
|
||||
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_EMAIL).noargs();
|
||||
}
|
||||
//ROUTINGKEY_SMS队列绑定交换机,指定routingKey
|
||||
@Bean
|
||||
public Binding BINDING_ROUTINGKEY_SMS(@Qualifier(QUEUE_INFORM_SMS) Queue queue,
|
||||
@Qualifier(EXCHANGE_TOPICS_INFORM) Exchange exchange){
|
||||
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_SMS).noargs();
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package com.muyu.web.service;
|
||||
|
||||
import com.muyu.web.domain.model.OverviewModel;
|
||||
|
||||
/**
|
||||
* OverviewService
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/10 14:22
|
||||
*/
|
||||
public interface OverviewService {
|
||||
/**
|
||||
* 车辆模拟概述
|
||||
* @return 概述数据模型
|
||||
*/
|
||||
OverviewModel overview();
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.muyu.web.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.web.domain.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package com.muyu.web.service.impl;
|
||||
|
||||
import com.muyu.vehicle.VehicleInstance;
|
||||
import com.muyu.vehicle.core.LocalContainer;
|
||||
import com.muyu.web.domain.model.OverviewModel;
|
||||
import com.muyu.web.service.OverviewService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* OverviewServiceImpl
|
||||
*
|
||||
* @author Yangle
|
||||
* Date 2024/6/10 14:22
|
||||
*/
|
||||
@Service
|
||||
public class OverviewServiceImpl implements OverviewService {
|
||||
|
||||
/**
|
||||
* 车辆模拟概述
|
||||
* @return 概述数据模型
|
||||
*/
|
||||
@Override
|
||||
public OverviewModel overview() {
|
||||
//车辆实侧对象
|
||||
Collection<VehicleInstance> instanceList = LocalContainer.vehicleDataMap.values();
|
||||
return OverviewModel.builder()
|
||||
.online(
|
||||
instanceList.stream()
|
||||
.filter(VehicleInstance::isOnline)
|
||||
.filter(VehicleInstance::isSend)
|
||||
.count()
|
||||
)
|
||||
.offline(
|
||||
instanceList.stream()
|
||||
.filter(VehicleInstance->!VehicleInstance.isOnline())
|
||||
.count()
|
||||
)
|
||||
.pause(
|
||||
instanceList.stream()
|
||||
.filter(VehicleInstance::isOnline)
|
||||
.filter(VehicleInstance->!VehicleInstance.isSend())
|
||||
.count()
|
||||
).build();
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package com.muyu.web.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.web.domain.User;
|
||||
import com.muyu.web.mapper.UserMapper;
|
||||
import com.muyu.web.service.UserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
|
||||
|
||||
}
|
|
@ -1,356 +0,0 @@
|
|||
package com.muyu.web.utils;
|
||||
|
||||
import com.muyu.vehicle.MessageData;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.apache.kafka.clients.KafkaClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
@Log4j2
|
||||
public class ConversionUtil {
|
||||
/**
|
||||
* 字符串转化成为16进制字符串
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static String strToSixteen(String s) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int length = s.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int ch = s.charAt(i);
|
||||
String s4 = Integer.toHexString(ch);
|
||||
sb.append(s4 + " ");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static MessageData main (String args) {
|
||||
// String str = "<?xml version=\"1.0\"?>\n" +
|
||||
// "<monitorRoot type=\"param\"><synchronizeSyptom event=\"0\" initial=\"true\"><Action_ECG><Rhythm>Sinus</Rhythm><HR>80</HR><EMD>No Change</EMD><Conduct>0</Conduct></Action_ECG><Action_Osat value=\"94\" isRelativePercent=\"false\"/><Action_BP isRelativePercent=\"false\"><Shrink value=\"120\"/><Stretch value=\"80\"/></Action_BP><Action_Resp breathType=\"Normal\" value=\"14\" isRelativePercent=\"false\"/><Action_etCO2 value=\"34\" isRelativePercent=\"false\"/><Action_Temperature value=\"35.2\"/><Action_CVP value=\"6.0\"/><Action_PAPDia value=\"10\"/><Action_PAPSys value=\"25\"/><Action_WP value=\"9\"/></synchronizeSyptom></monitorRoot>";
|
||||
// String strToSixteen = strToSixteen(str);
|
||||
// System.out.println(str);
|
||||
// System.out.println(str.length());
|
||||
// System.out.println(strToSixteen);
|
||||
// System.out.println(strToSixteen.replace(" ", "").length());
|
||||
|
||||
// String hexStr = "7E 48 58 49 54 48 58 55 51 52 32 54 55 43 30 58 33 55 31 37 31 37 35 38 39 32 35 37 35 35 31 31 31 36 2e 37 36 34 36 35 30 30 33 39 2e 35 37 34 38 38 30 30 32 37 30 2e 30 30 32 30 2e 33 35 30 30 30 30 30 30 32 37 36 30 30 30 38 30 30 30 30 32 32 30 38 30 30 30 30 30 44 31 30 30 30 39 2e 30 30 30 33 32 30 30 30 30 34 34 37 34 39 37 38 36 30 31 30 39 30 30 30 32 32 32 30 30 35 32 38 34 30 30 30 30 37 35 38 38 34 2e 33 32 30 30 30 30 31 33 30 30 30 30 31 31 34 30 30 30 30 36 39 39 30 30 30 34 30 30 30 33 30 30 30 35 30 30 30 30 30 35 30 30 30 30 30 32 33 30 30 30 30 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 11 7E";
|
||||
String hexStringToString = hexStringToString(args);
|
||||
System.out.println(args);
|
||||
System.out.println(args.length());
|
||||
System.out.println(hexStringToString);
|
||||
System.out.println(hexStringToString.length());
|
||||
//截取第一位和最后两位
|
||||
String substring = hexStringToString.substring(1, hexStringToString.length() - 2);
|
||||
log.error("substring:{}",substring.length());
|
||||
//vin
|
||||
String vin = substring.substring(0,17);
|
||||
// log.error("length:{}",vin.length());
|
||||
// log.error("vin:{}",vin);
|
||||
//时间戳
|
||||
String timestamp = substring.substring(17,30);
|
||||
// log.error("length:{}",timestamp.length());
|
||||
// log.error("timestamp:{}",timestamp);
|
||||
// //经度
|
||||
String longitude = substring.substring(30, 41);
|
||||
// log.error("length:{}",longitude.length());
|
||||
// log.error("longitude:{}",longitude);
|
||||
// //维度
|
||||
String latitude = substring.substring(41, 51);
|
||||
// log.error("length:{}",latitude.length());
|
||||
// log.error("latitude:{}",latitude);
|
||||
// //车速
|
||||
String speed = substring.substring(51, 57);
|
||||
int length = speed.length();
|
||||
// log.error("length:{}",length);
|
||||
// log.info("speed:{}",speed);
|
||||
//总里程
|
||||
String mileage = substring.substring(57, 68);
|
||||
// log.error("length:{}",mileage.length());
|
||||
// log.error("mileage:{}",mileage);
|
||||
|
||||
//总电压
|
||||
String dischargeVoltage = substring.substring(68, 74);
|
||||
// log.error("length:{}",dischargeVoltage.length());
|
||||
// log.error("dischargeVoltage:{}",dischargeVoltage);
|
||||
|
||||
//总电流
|
||||
String dischargeCurrent = substring.substring(74, 79);
|
||||
// log.error("length:{}",dischargeCurrent.length());
|
||||
// log.error("dischargeCurrent:{}",dischargeCurrent);
|
||||
//绝缘电阻
|
||||
String insulationResistance = substring.substring(79, 88);
|
||||
// log.error("length:{}",insulationResistance.length());
|
||||
// log.error("insulationResistance:{}",insulationResistance);
|
||||
// //档位
|
||||
String gear = substring.substring(88, 89);
|
||||
// log.error("length:{}",gear.length());
|
||||
// log.error("gear:{}",gear);
|
||||
|
||||
//加速踏板行程值
|
||||
String accelerationPedal = substring.substring(89, 91);
|
||||
// log.error("length:{}",accelerationPedal.length());
|
||||
// log.error("accelerationPedal:{}",accelerationPedal);
|
||||
|
||||
//制动踏板行程值
|
||||
String brakePedal = substring.substring(91, 93);
|
||||
// log.error("length:{}",brakePedal.length());
|
||||
// log.error("brakePedal:{}",brakePedal);
|
||||
|
||||
//燃料消耗率
|
||||
String fuelConsumption = substring.substring(93, 98);
|
||||
// log.error("length:{}",fuelConsumption.length());
|
||||
// log.error("fuelConsumption:{}",fuelConsumption);
|
||||
////////////////
|
||||
//电机控制器温度
|
||||
String motorControllerTemperature = substring.substring(98, 104);
|
||||
// log.error("length:{}",motorControllerTemperature.length());
|
||||
// log.error("motorControllerTemperature:{}",motorControllerTemperature);
|
||||
|
||||
//电机转速
|
||||
String motorSpeed = substring.substring(104, 109);
|
||||
// log.error("length:{}",motorSpeed.length());
|
||||
// log.error("motorSpeed:{}",motorSpeed);
|
||||
|
||||
//电机转矩
|
||||
String motorTorque = substring.substring(109, 113);
|
||||
// log.error("length:{}",motorTorque.length());
|
||||
// log.error("motorTorque:{}",motorTorque);
|
||||
|
||||
//电机温度
|
||||
String motorTemperature = substring.substring(113, 119);
|
||||
// log.error("length:{}",motorTemperature.length());
|
||||
// log.error("motorTemperature:{}",motorTemperature);
|
||||
|
||||
//电机电压
|
||||
String motorVoltage = substring.substring(119, 124);
|
||||
// log.error("length:{}",motorVoltage.length());
|
||||
// log.error("motorVoltage:{}",motorVoltage);
|
||||
|
||||
//电机电流
|
||||
String motorCurrent = substring.substring(124, 132);
|
||||
// log.error("length:{}",motorCurrent.length());
|
||||
// log.error("motorCurrent:{}",motorCurrent);
|
||||
|
||||
//动力电池剩余电量SOC
|
||||
String powerBattery = substring.substring(132, 138);
|
||||
// log.error("length:{}",powerBattery.length());
|
||||
// log.error("powerBattery:{}",powerBattery);
|
||||
|
||||
//当前状态允许的最大反馈功率
|
||||
String maxFeedbackPower = substring.substring(138, 144);
|
||||
// log.error("length:{}",maxFeedbackPower.length());
|
||||
// log.error("maxFeedbackPower:{}",maxFeedbackPower);
|
||||
|
||||
//当前状态允许最大放电功率
|
||||
String maxDischargePower = substring.substring(144, 150);
|
||||
// log.error("length:{}",maxDischargePower.length());
|
||||
// log.error("maxDischargePower:{}",maxDischargePower);
|
||||
|
||||
//BMS自检计数器
|
||||
String bmsSelfCheck = substring.substring(150, 152);
|
||||
// log.error("length:{}",bmsSelfCheck.length());
|
||||
// log.error("bmsSelfCheck:{}",bmsSelfCheck);
|
||||
|
||||
//动力电池充放电电流
|
||||
String powerBatteryCurrent = substring.substring(152, 157);
|
||||
// log.error("length:{}",powerBatteryCurrent.length());
|
||||
// log.error("powerBatteryCurrent:{}",powerBatteryCurrent);
|
||||
|
||||
//动力电池负载端总电压V3
|
||||
String powerBatteryV3 = substring.substring(157, 163);
|
||||
// log.error("length:{}",powerBatteryV3.length());
|
||||
// log.error("powerBatteryV3:{}",powerBatteryV3);
|
||||
|
||||
//单次最大电压
|
||||
String maxVoltage = substring.substring(163, 167);
|
||||
// log.error("length:{}",maxVoltage.length());
|
||||
// log.error("maxVoltage:{}",maxVoltage);
|
||||
|
||||
//单体电池最低电压
|
||||
String minVoltage = substring.substring(167, 171);
|
||||
// log.error("length:{}",minVoltage.length());
|
||||
// log.error("minVoltage:{}",minVoltage);
|
||||
|
||||
//单体电池最高温度
|
||||
String maxTemperature = substring.substring(171, 177);
|
||||
// log.error("length:{}",maxTemperature.length());
|
||||
// log.error("maxTemperature:{}",maxTemperature);
|
||||
|
||||
//单体电池最低温度
|
||||
String minTemperature = substring.substring(177, 183);
|
||||
// log.error("length:{}",minTemperature.length());
|
||||
// log.error("minTemperature:{}",minTemperature);
|
||||
|
||||
//动力电池可用容量
|
||||
String availableCapacity = substring.substring(183, 189);
|
||||
// log.error("length:{}",availableCapacity.length());
|
||||
// log.error("availableCapacity:{}",availableCapacity);
|
||||
|
||||
//车辆状态
|
||||
String vehicleStatus = substring.substring(189, 190);
|
||||
// log.error("length:{}",vehicleStatus.length());
|
||||
// log.error("vehicleStatus:{}",vehicleStatus);
|
||||
|
||||
//充电状态
|
||||
String chargeStatus = substring.substring(190, 191);
|
||||
// log.error("length:{}",chargeStatus.length());
|
||||
// log.error("chargeStatus:{}",chargeStatus);
|
||||
|
||||
//运行状态
|
||||
String runStatus = substring.substring(191, 192);
|
||||
// log.error("length:{}",runStatus.length());
|
||||
// log.error("runStatus:{}",runStatus);
|
||||
|
||||
//SOC
|
||||
String soc = substring.substring(192, 193);
|
||||
// log.error("length:{}",soc.length());
|
||||
// log.error("soc:{}",soc);
|
||||
|
||||
//可充电储能装置工作状态
|
||||
String chargeWorkStatus = substring.substring(193, 194);
|
||||
// log.error("length:{}",chargeWorkStatus.length());
|
||||
// log.error("chargeWorkStatus:{}",chargeWorkStatus);
|
||||
|
||||
//驱动电机状态
|
||||
String driveMotorStatus = substring.substring(194, 195);
|
||||
// log.error("length:{}",driveMotorStatus.length());
|
||||
// log.error("driveMotorStatus:{}",driveMotorStatus);
|
||||
|
||||
//定位是否有效
|
||||
String location = substring.substring(195, 196);
|
||||
// log.error("length:{}",location.length());
|
||||
// log.error("location:{}",location);
|
||||
|
||||
//EAS
|
||||
String eas = substring.substring(196, 197);
|
||||
// log.error("length:{}",eas.length());
|
||||
// log.error("eas:{}",eas);
|
||||
|
||||
//PTC
|
||||
String ptc = substring.substring(197, 198);
|
||||
// log.error("length:{}",ptc.length());
|
||||
// log.error("ptc:{}",ptc);
|
||||
|
||||
//EPS
|
||||
String eps = substring.substring(198, 199);
|
||||
// log.error("length:{}",eps.length());
|
||||
// log.error("eps:{}",eps);
|
||||
|
||||
//ABS
|
||||
String abs = substring.substring(199, 200);
|
||||
// log.error("length:{}",abs.length());
|
||||
// log.error("abs:{}",abs);
|
||||
|
||||
//MCU
|
||||
String mcu = substring.substring(200, 201);
|
||||
// log.error("length:{}",mcu.length());
|
||||
// log.error("mcu:{}",mcu);
|
||||
|
||||
//动力电池加热状态
|
||||
String powerBatteryHeating = substring.substring(201, 202);
|
||||
// log.error("length:{}",powerBatteryHeating.length());
|
||||
// log.error("powerBatteryHeating:{}",powerBatteryHeating);
|
||||
|
||||
//动力电池当前状态
|
||||
String powerBatteryCurrentStatus = substring.substring(202, 203);
|
||||
// log.error("length:{}",powerBatteryCurrentStatus.length());
|
||||
// log.error("powerBatteryCurrentStatus:{}",powerBatteryCurrentStatus);
|
||||
|
||||
//动力电池保温状态
|
||||
String powerBatteryHeat = substring.substring(203, 204);
|
||||
// log.error("length:{}",powerBatteryHeat.length());
|
||||
// log.error("powerBatteryHeat:{}",powerBatteryHeat);
|
||||
|
||||
//DCDC
|
||||
String dcdc = substring.substring(204, 205);
|
||||
// log.error("length:{}",dcdc.length());
|
||||
// log.error("dcdc:{}",dcdc);
|
||||
|
||||
//CHG
|
||||
String chg = substring.substring(205, 206);
|
||||
// log.error("length:{}",chg.length());
|
||||
// log.error("chg:{}",chg);
|
||||
|
||||
MessageData build = MessageData.builder()
|
||||
.vin(vin)
|
||||
.timestamp(timestamp)
|
||||
.longitude(longitude)
|
||||
.latitude(latitude)
|
||||
.speed(speed)
|
||||
.mileage(mileage)
|
||||
.dischargeVoltage(dischargeVoltage)
|
||||
.dischargeCurrent(dischargeCurrent)
|
||||
.insulationResistance(insulationResistance)
|
||||
.gear(gear)
|
||||
.accelerationPedal(accelerationPedal)
|
||||
.brakePedal(brakePedal)
|
||||
.fuelConsumption(fuelConsumption)
|
||||
.motorControllerTemperature(motorControllerTemperature)
|
||||
.motorSpeed(motorSpeed)
|
||||
.motorTorque(motorTorque)
|
||||
.motorTemperature(motorTemperature)
|
||||
.motorVoltage(motorVoltage)
|
||||
.motorCurrent(motorCurrent)
|
||||
.powerBattery(powerBattery)
|
||||
.maxFeedbackPower(maxFeedbackPower)
|
||||
.maxDischargePower(maxDischargePower)
|
||||
.bmsSelfCheck(bmsSelfCheck)
|
||||
.powerBatteryCurrent(powerBatteryCurrent)
|
||||
.powerBatteryV3(powerBatteryV3)
|
||||
.maxVoltage(maxVoltage)
|
||||
.minVoltage(minVoltage)
|
||||
.maxTemperature(maxTemperature)
|
||||
.minTemperature(minTemperature)
|
||||
.availableCapacity(availableCapacity)
|
||||
.vehicleStatus(vehicleStatus)
|
||||
.chargeStatus(chargeStatus)
|
||||
.runStatus(runStatus)
|
||||
.soc(soc)
|
||||
.chargeWorkStatus(chargeWorkStatus)
|
||||
.driveMotorStatus(driveMotorStatus)
|
||||
.location(location)
|
||||
.eas(eas)
|
||||
.ptc(ptc)
|
||||
.eps(eps)
|
||||
.abs(abs)
|
||||
.mcu(mcu)
|
||||
.powerBatteryHeating(powerBatteryHeating)
|
||||
.powerBatteryCurrentStatus(powerBatteryCurrentStatus)
|
||||
.powerBatteryHeat(powerBatteryHeat)
|
||||
.dcdc(dcdc)
|
||||
.chg(chg)
|
||||
.build();
|
||||
log.error("报文解析:{}",build);
|
||||
|
||||
System.out.println(hexStringToString.length());
|
||||
return build;
|
||||
}
|
||||
|
||||
/**
|
||||
* 16进制转换成为string类型字符串
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static String hexStringToString(String s) {
|
||||
if (s == null || s.equals("")) {
|
||||
return null;
|
||||
}
|
||||
s = s.replace(" ", "");
|
||||
byte[] baKeyword = new byte[s.length() / 2];
|
||||
for (int i = 0; i < baKeyword.length; i++) {
|
||||
try {
|
||||
baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
s = new String(baKeyword, StandardCharsets.UTF_8);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
|
@ -3,25 +3,14 @@ server:
|
|||
spring:
|
||||
mvc:
|
||||
static-path-pattern: /static/**
|
||||
redis:
|
||||
host: 115.159.211.196
|
||||
port: 6379
|
||||
password: yl030509
|
||||
rabbitmq:
|
||||
host: 115.159.211.196
|
||||
port: 5672
|
||||
|
||||
datasource:
|
||||
username: muyu
|
||||
password: 123456
|
||||
# 如果需要数据本地化,则改成 file 方式
|
||||
# jdbc:h2:mem:testDB;DB_CLOSE_DELAY=-1
|
||||
url: jdbc:h2:file:./db/vehicleSimulationDataBaseFile;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1
|
||||
url: jdbc:h2:file:~/vehicle/db;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1
|
||||
driver-class-name: org.h2.Driver
|
||||
# secondary:
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://115.159.211.196:3306/zncar?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||
# username: root
|
||||
# password: yl@123
|
||||
h2:
|
||||
# 开启这个配置就可以通过 web 页面访问了,例如:http://localhost:8080/springboot-h2/h2-console
|
||||
console:
|
||||
|
@ -93,19 +82,11 @@ forest:
|
|||
adminHost: ${mqtt.admin.host}
|
||||
adminTopicUri: ${mqtt.admin.topic-uri}
|
||||
log-enabled: false
|
||||
kafka:
|
||||
bootstrap-servers: 127.0.0.1:9092
|
||||
producer:
|
||||
acks: all
|
||||
retries: 0
|
||||
batch-size: 16384
|
||||
key-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
value-serializer: org.apache.kafka.common.serialization.StringSerializer
|
||||
|
||||
# 服务器配置
|
||||
mqtt:
|
||||
server:
|
||||
host: tcp://47.102.213.144:1883
|
||||
topic: test1
|
||||
host: tcp://fluxmq.muyu.icu:1883
|
||||
admin:
|
||||
host: http://127.0.0.1:${server.port}
|
||||
topic-uri: /verify/vehicleConnection
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<!--<?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.muyu.mapper.VehicleInstanceMapper">-->
|
||||
|
||||
|
||||
<!-- <insert id="addCar">-->
|
||||
<!-- insert into vehicle_instance-->
|
||||
<!-- (vin,timestamp,user_name,nonce)-->
|
||||
<!-- values-->
|
||||
<!-- (#{vin},#{timestamp},#{userName},#{nonce})-->
|
||||
<!-- </insert>-->
|
||||
<!--</mapper>-->
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
.dashboard-container[data-v-492ff9f3]{margin:30px}.dashboard-text[data-v-492ff9f3]{font-size:46px;line-height:60px;text-align:center;font-weight:900;font-family:cursive}.el-divider[data-v-492ff9f3]{background-color:#575757;position:relative}
|
|
@ -1 +0,0 @@
|
|||
.app-container[data-v-5503ff78]{padding:10px 5px 0 10px;background-color:#f4f4f5}.el-row[data-v-5503ff78]{&:last-child{margin-bottom:0}}.bg-purple[data-v-5503ff78]{background:#f4f4f5}.grid-content[data-v-5503ff78]{border-radius:4px;overflow-x:hidden;overflow-y:auto}.grid-content[data-v-5503ff78]::-webkit-scrollbar{width:4px}.grid-content[data-v-5503ff78]::-webkit-scrollbar-thumb{border-radius:10px;background:rgba(0,0,0,.2)}.grid-content[data-v-5503ff78]::-webkit-scrollbar-track{border-radius:0;background:rgba(0,0,0,.1)}.vehicleDiv[data-v-5503ff78]{height:50px;margin:0 0 10px 0}.contentMain[data-v-5503ff78]{margin-top:10px}.vehicleDataTab[data-v-5503ff78]{width:100%;overflow-y:auto;overflow-x:hidden}.vehicleDataTab[data-v-5503ff78]::-webkit-scrollbar{width:4px}.vehicleDataTab[data-v-5503ff78]::-webkit-scrollbar-thumb{border-radius:10px;background:rgba(0,0,0,.2)}.vehicleDataTab[data-v-5503ff78]::-webkit-scrollbar-track{border-radius:0;background:rgba(0,0,0,.1)}.el-form-item__label[data-v-5503ff78]{padding:0}.el-form-item[data-v-5503ff78]{margin-bottom:5px}
|
|
@ -1 +1 @@
|
|||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>车辆</title><link href=/static/css/app.63269458.css rel=preload as=style><link href=/static/css/chunk-elementUI.c1c3b808.css rel=preload as=style><link href=/static/css/chunk-libs.3dfb7769.css rel=preload as=style><link href=/static/js/app.4b247cb1.js rel=preload as=script><link href=/static/js/chunk-elementUI.2491fb2f.js rel=preload as=script><link href=/static/js/chunk-libs.2ec7c235.js rel=preload as=script><link href=/static/css/chunk-elementUI.c1c3b808.css rel=stylesheet><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.63269458.css rel=stylesheet></head><body><noscript><strong>We're sorry but 车辆 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(e){function t(t){for(var r,o,u=t[0],i=t[1],f=t[2],l=0,s=[];l<u.length;l++)o=u[l],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&s.push(a[o][0]),a[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);d&&d(t);while(s.length)s.shift()();return c.push.apply(c,f||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,o=1;o<n.length;o++){var u=n[o];0!==a[u]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=n[0]))}return e}var r={},o={runtime:0},a={runtime:0},c=[];function u(e){return i.p+"static/js/"+({}[e]||e)+"."+{"chunk-019c66da":"ded8571e","chunk-6f60c8f1":"f16bf298","chunk-4a014042":"2fe4ac72","chunk-cd3ab578":"ba31bb9e","chunk-22cea610":"fd8494c8","chunk-510f32e7":"792568de"}[e]+".js"}function i(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.e=function(e){var t=[],n={"chunk-4a014042":1,"chunk-cd3ab578":1,"chunk-22cea610":1,"chunk-510f32e7":1};o[e]?t.push(o[e]):0!==o[e]&&n[e]&&t.push(o[e]=new Promise((function(t,n){for(var r="static/css/"+({}[e]||e)+"."+{"chunk-019c66da":"31d6cfe0","chunk-6f60c8f1":"31d6cfe0","chunk-4a014042":"3328abfd","chunk-cd3ab578":"5a7a63c7","chunk-22cea610":"3c7f5ad9","chunk-510f32e7":"1510e3c5"}[e]+".css",a=i.p+r,c=document.getElementsByTagName("link"),u=0;u<c.length;u++){var f=c[u],l=f.getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(l===r||l===a))return t()}var s=document.getElementsByTagName("style");for(u=0;u<s.length;u++){f=s[u],l=f.getAttribute("data-href");if(l===r||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var r=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+r+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=r,delete o[e],d.parentNode.removeChild(d),n(c)},d.href=a;var h=document.getElementsByTagName("head")[0];h.appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var c=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=c);var f,l=document.createElement("script");l.charset="utf-8",l.timeout=120,i.nc&&l.setAttribute("nonce",i.nc),l.src=u(e);var s=new Error;f=function(t){l.onerror=l.onload=null,clearTimeout(d);var n=a[e];if(0!==n){if(n){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",s.name="ChunkLoadError",s.type=r,s.request=o,n[1](s)}a[e]=void 0}};var d=setTimeout((function(){f({type:"timeout",target:l})}),12e4);l.onerror=l.onload=f,document.head.appendChild(l)}return Promise.all(t)},i.m=e,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var f=window["webpackJsonp"]=window["webpackJsonp"]||[],l=f.push.bind(f);f.push=t,f=f.slice();for(var s=0;s<f.length;s++)t(f[s]);var d=l;n()})([]);</script><script src=/static/js/chunk-elementUI.2491fb2f.js></script><script src=/static/js/chunk-libs.2ec7c235.js></script><script src=/static/js/app.4b247cb1.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/favicon.ico><title>车辆</title><link href=/static/css/app.949a0224.css rel=preload as=style><link href=/static/css/chunk-elementUI.c1c3b808.css rel=preload as=style><link href=/static/css/chunk-libs.3dfb7769.css rel=preload as=style><link href=/static/js/app.967d9126.js rel=preload as=script><link href=/static/js/chunk-elementUI.2491fb2f.js rel=preload as=script><link href=/static/js/chunk-libs.2ec7c235.js rel=preload as=script><link href=/static/css/chunk-elementUI.c1c3b808.css rel=stylesheet><link href=/static/css/chunk-libs.3dfb7769.css rel=stylesheet><link href=/static/css/app.949a0224.css rel=stylesheet></head><body><noscript><strong>We're sorry but 车辆 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script>(function(e){function t(t){for(var n,o,c=t[0],i=t[1],l=t[2],f=0,d=[];f<c.length;f++)o=c[f],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);s&&s(t);while(d.length)d.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==a[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={runtime:0},a={runtime:0},u=[];function c(e){return i.p+"static/js/"+({}[e]||e)+"."+{"chunk-019c66da":"ded8571e","chunk-cefe5306":"756dde8f","chunk-22cea610":"a50359dd","chunk-510f32e7":"18a692c7","chunk-630a64ed":"8295bd3f"}[e]+".js"}function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r={"chunk-cefe5306":1,"chunk-22cea610":1,"chunk-510f32e7":1,"chunk-630a64ed":1};o[e]?t.push(o[e]):0!==o[e]&&r[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{"chunk-019c66da":"31d6cfe0","chunk-cefe5306":"0a41cd80","chunk-22cea610":"3c7f5ad9","chunk-510f32e7":"1510e3c5","chunk-630a64ed":"9a9361c6"}[e]+".css",a=i.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var l=u[c],f=l.getAttribute("data-href")||l.getAttribute("href");if("stylesheet"===l.rel&&(f===n||f===a))return t()}var d=document.getElementsByTagName("style");for(c=0;c<d.length;c++){l=d[c],f=l.getAttribute("data-href");if(f===n||f===a)return t()}var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onload=t,s.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],s.parentNode.removeChild(s),r(u)},s.href=a;var h=document.getElementsByTagName("head")[0];h.appendChild(s)})).then((function(){o[e]=0})));var n=a[e];if(0!==n)if(n)t.push(n[2]);else{var u=new Promise((function(t,r){n=a[e]=[t,r]}));t.push(n[2]=u);var l,f=document.createElement("script");f.charset="utf-8",f.timeout=120,i.nc&&f.setAttribute("nonce",i.nc),f.src=c(e);var d=new Error;l=function(t){f.onerror=f.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;d.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",d.name="ChunkLoadError",d.type=n,d.request=o,r[1](d)}a[e]=void 0}};var s=setTimeout((function(){l({type:"timeout",target:f})}),12e4);f.onerror=f.onload=l,document.head.appendChild(f)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var l=window["webpackJsonp"]=window["webpackJsonp"]||[],f=l.push.bind(l);l.push=t,l=l.slice();for(var d=0;d<l.length;d++)t(l[d]);var s=f;r()})([]);</script><script src=/static/js/chunk-elementUI.2491fb2f.js></script><script src=/static/js/chunk-libs.2ec7c235.js></script><script src=/static/js/app.967d9126.js></script></body></html>
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-22cea610"],{"26fc":function(t,s,a){t.exports=a.p+"static/img/404_cloud.0f4bc32b.png"},"8cdb":function(t,s,a){"use strict";a.r(s);var e=function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"wscn-http404-container"},[a("div",{staticClass:"wscn-http404"},[t._m(0),a("div",{staticClass:"bullshit"},[a("div",{staticClass:"bullshit__oops"},[t._v("OOPS!")]),t._m(1),a("div",{staticClass:"bullshit__headline"},[t._v(t._s(t.message))]),a("div",{staticClass:"bullshit__info"},[t._v("Please check that the URL you entered is correct, or click the button below to return to the homepage.")]),a("a",{staticClass:"bullshit__return-home",attrs:{href:""}},[t._v("Back to home")])])])])},c=[function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"pic-404"},[e("img",{staticClass:"pic-404__parent",attrs:{src:a("a36b"),alt:"404"}}),e("img",{staticClass:"pic-404__child left",attrs:{src:a("26fc"),alt:"404"}}),e("img",{staticClass:"pic-404__child mid",attrs:{src:a("26fc"),alt:"404"}}),e("img",{staticClass:"pic-404__child right",attrs:{src:a("26fc"),alt:"404"}})])},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"bullshit__info"},[t._v("All rights reserved "),a("a",{staticStyle:{color:"#20a0ff"},attrs:{href:"https://wallstreetcn.com",target:"_blank"}},[t._v("wallstreetcn")])])}],i={name:"Page404",computed:{message:function(){return"The webmaster said that you can not enter this page..."}}},l=i,n=(a("dd53"),a("2877")),r=Object(n["a"])(l,e,c,!1,null,"c095f994",null);s["default"]=r.exports},a36b:function(t,s,a){t.exports=a.p+"static/img/404.a57b6f31.png"},b0a8:function(t,s,a){},dd53:function(t,s,a){"use strict";a("b0a8")}}]);
|
|
@ -1 +0,0 @@
|
|||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-4a014042"],{7015:function(e,t,a){},8931:function(e,t,a){"use strict";a("7015")},9406:function(e,t,a){"use strict";a.r(t);var i=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"dashboard-container"},[a("div",{staticClass:"dashboard-text"},[e._v(e._s(e.name))]),a("el-divider"),a("div",{style:{width:e.vehicleStatusWidth+"%",height:e.vehicleStatusHeight+"px",margin:"0 auto"},attrs:{id:"vehicleStatus"}})],1)},n=[],o=a("5530"),r=a("2f62"),s=a("313e"),c=a("b775");function u(){return Object(c["a"])({url:"/vehicle/overview",method:"get"})}var l={name:"Dashboard",data:function(){return{vehicleStatusChart:null,vehicleStatusWidth:50,vehicleStatusHeight:window.innerHeight-300,dataMap:{online:0,offline:2,pause:0}}},computed:Object(o["a"])({},Object(r["b"])(["name"])),watch:{dataMap:function(){this.initVehicleStatus()}},created:function(){setInterval(this.getVehicleOverview,5e3)},mounted:function(){this.vehicleStatusChart=s["a"](document.getElementById("vehicleStatus")),this.initVehicleStatus(),window.addEventListener("resize",this.initVehicleStatus)},methods:{getVehicleOverview:function(){var e=this;u().then((function(t){e.dataMap=t.data}))},initVehicleStatus:function(){this.vehicleStatusChart.setOption({title:{text:"系统模拟车辆状态统计一览",left:"center",textStyle:{fontWeight:1e3,fontSize:26}},tooltip:{trigger:"item"},legend:{top:"5%",left:"center"},series:[{type:"pie",radius:["40%","70%"],avoidLabelOverlap:!1,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:10},label:{show:!0},emphasis:{label:{show:!0,fontSize:40,fontWeight:"bold"}},labelLine:{show:!0},data:[{value:this.dataMap.pause,name:"暂停车辆"},{value:this.dataMap.online,name:"在线车辆"},{value:this.dataMap.offline,name:"离线车辆"}]}]})}}},h=l,d=(a("8931"),a("2877")),f=Object(d["a"])(h,i,n,!1,null,"492ff9f3",null);t["default"]=f.exports},b775:function(e,t,a){"use strict";a("d3b7");var i=a("bc3a"),n=a.n(i),o=a("5c96"),r=a("4360"),s=a("5f87"),c=n.a.create({baseURL:"/",timeout:5e3});c.interceptors.request.use((function(e){return r["a"].getters.token&&(e.headers["X-Token"]=Object(s["a"])()),e}),(function(e){return console.log(e),Promise.reject(e)})),c.interceptors.response.use((function(e){var t=e.data;return 200!==t.code?(Object(o["Message"])({message:t.msg||"Error",type:"error",duration:5e3}),50008!==t.code&&50012!==t.code&&50014!==t.code||o["MessageBox"].confirm("You have been logged out, you can cancel to stay on this page, or log in again","Confirm logout",{confirmButtonText:"Re-Login",cancelButtonText:"Cancel",type:"warning"}).then((function(){r["a"].dispatch("user/resetToken").then((function(){location.reload()}))})),Promise.reject(new Error(t.msg||"Error"))):t}),(function(e){return console.log("err"+e),Object(o["Message"])({message:e.message,type:"error",duration:5e3}),Promise.reject(e)})),t["a"]=c}}]);
|
|
@ -1 +0,0 @@
|
|||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-510f32e7"],{3985:function(e,t,n){},"92f2":function(e,t,n){},"9ed6":function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"login-container"},[n("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.loginRules,"auto-complete":"on","label-position":"left"}},[n("div",{staticClass:"title-container"},[n("h3",{staticClass:"title"},[e._v("车辆模拟")])]),n("el-form-item",{attrs:{prop:"username"}},[n("span",{staticClass:"svg-container"},[n("svg-icon",{attrs:{"icon-class":"user"}})],1),n("el-input",{ref:"username",attrs:{placeholder:"Username",name:"username",type:"text",tabindex:"1","auto-complete":"on",readonly:""},model:{value:e.loginForm.username,callback:function(t){e.$set(e.loginForm,"username",t)},expression:"loginForm.username"}})],1),n("el-form-item",{attrs:{prop:"password"}},[n("span",{staticClass:"svg-container"},[n("svg-icon",{attrs:{"icon-class":"password"}})],1),n("el-input",{ref:"password",attrs:{type:"text",placeholder:"Password",name:"password",tabindex:"2","auto-complete":"on"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin(t)}},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}})],1),n("el-button",{staticStyle:{width:"100%","margin-bottom":"30px"},attrs:{loading:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin(t)}}},[e._v("进入")])],1)],1)},o=[],s={name:"Login",data:function(){return{loginForm:{username:"你永远是最棒的",password:"加油,一切都是值得的"},loginRules:{username:[{required:!0,trigger:"blur"}],password:[{required:!0,trigger:"blur"}]},loading:!1,passwordType:"password",redirect:void 0}},watch:{$route:{handler:function(e){this.redirect=e.query&&e.query.redirect},immediate:!0}},methods:{handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return console.log("error submit!!"),!1;e.loading=!0,e.$store.dispatch("user/login",e.loginForm).then((function(){e.$router.push({path:e.redirect||"/"}),e.loading=!1})).catch((function(){e.loading=!1})),e.$router.push({path:e.redirect||"/"})}))}}},a=s,i=(n("d1bd"),n("f8c5"),n("2877")),l=Object(i["a"])(a,r,o,!1,null,"5d9ae9a2",null);t["default"]=l.exports},d1bd:function(e,t,n){"use strict";n("92f2")},f8c5:function(e,t,n){"use strict";n("3985")}}]);
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,34 +1,34 @@
|
|||
//package com;
|
||||
//
|
||||
//import com.muyu.VehicleSimulationApplication;
|
||||
//import com.muyu.common.Result;
|
||||
//import com.muyu.vehicle.api.ClientAdmin;
|
||||
//import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.boot.test.context.SpringBootTest;
|
||||
//
|
||||
///**
|
||||
// * @author DongZl
|
||||
// * @description:
|
||||
// * @Date 2023-11-28 上午 10:36
|
||||
// */
|
||||
//@SpringBootTest(classes = VehicleSimulationApplication.class)
|
||||
//public class AdminTest {
|
||||
//
|
||||
// @Autowired
|
||||
// private ClientAdmin clientAdmin;
|
||||
//
|
||||
// @Test
|
||||
// public void vehicleConnTest(){
|
||||
// Result<String> result = clientAdmin.vehicleConnection(
|
||||
// VehicleConnectionReq.builder()
|
||||
// .vin("VIN1234567894")
|
||||
// .timestamp(String.valueOf(System.currentTimeMillis()))
|
||||
// .userName("156841600")
|
||||
// .nonce("134812")
|
||||
// .build()
|
||||
// );
|
||||
// System.out.println(result);
|
||||
// }
|
||||
//}
|
||||
package com;
|
||||
|
||||
import com.muyu.VehicleSimulationApplication;
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.vehicle.api.ClientAdmin;
|
||||
import com.muyu.vehicle.api.req.VehicleConnectionReq;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
/**
|
||||
* @author DongZl
|
||||
* @description:
|
||||
* @Date 2023-11-28 上午 10:36
|
||||
*/
|
||||
@SpringBootTest(classes = VehicleSimulationApplication.class)
|
||||
public class AdminTest {
|
||||
|
||||
@Autowired
|
||||
private ClientAdmin clientAdmin;
|
||||
|
||||
@Test
|
||||
public void vehicleConnTest(){
|
||||
Result<String> result = clientAdmin.vehicleConnection(
|
||||
VehicleConnectionReq.builder()
|
||||
.vin("VIN1234567894")
|
||||
.timestamp(String.valueOf(System.currentTimeMillis()))
|
||||
.userName("156841600")
|
||||
.nonce("134812")
|
||||
.build()
|
||||
);
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue