feat():车辆网关模块
parent
027e3df9d0
commit
a2d580cdc3
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.gateway.demo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Student
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/25 22:08
|
||||||
|
*/
|
||||||
|
public class Student {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String studentName;
|
||||||
|
|
||||||
|
private String studentSex;
|
||||||
|
|
||||||
|
public Integer getId(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id){
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudentName(){
|
||||||
|
return studentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudentName(String studentName){
|
||||||
|
this.studentName= studentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudentSex(){
|
||||||
|
return studentSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudentSex(String studentSex){
|
||||||
|
this.studentSex = studentSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Student(Integer id, String studentName, String studentSex) {
|
||||||
|
this.id = id;
|
||||||
|
this.studentName = studentName;
|
||||||
|
this.studentSex = studentSex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Student{" +
|
||||||
|
"id=" + id +
|
||||||
|
", studentName='" + studentName + '\'' +
|
||||||
|
", studentSex='" + studentSex + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.gateway.demo;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Text
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/25 22:17
|
||||||
|
*/
|
||||||
|
public class Text {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
Student student = new Student(1,"小红","男");
|
||||||
|
Student student1 = new Student(2,"小绿","女");
|
||||||
|
Student student2 = new Student(3,"小蓝","男");
|
||||||
|
Student student3 = new Student(4, "小黄", "女");
|
||||||
|
Student student4 = new Student(5,"小紫","男");
|
||||||
|
Student student5 = new Student(6, "小黑", "男");
|
||||||
|
|
||||||
|
List<Student> studentList = new ArrayList<>();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
LinkedList<Student> students = new LinkedList<>();
|
||||||
|
students.add(student);
|
||||||
|
students.add(student1);
|
||||||
|
students.add(student2);
|
||||||
|
students.add(student3);
|
||||||
|
students.add(student4);
|
||||||
|
students.add(student5);
|
||||||
|
System.out.println("linkedList:"+students);
|
||||||
|
|
||||||
|
studentList.add(student);
|
||||||
|
studentList.add(student1);
|
||||||
|
studentList.add(student2);
|
||||||
|
studentList.add(student3);
|
||||||
|
studentList.add(student4);
|
||||||
|
studentList.add(student5);
|
||||||
|
map.put("嘻嘻",student);
|
||||||
|
map.put("哈哈",student1);
|
||||||
|
map.put("不嘻嘻",student2);
|
||||||
|
map.put("不哈哈",student3);
|
||||||
|
map.put("拉拉",student4);
|
||||||
|
map.put("月亮",student5);
|
||||||
|
map.put("不拉拉",studentList);
|
||||||
|
|
||||||
|
System.out.println(map);
|
||||||
|
|
||||||
|
System.out.println(student);
|
||||||
|
System.out.println(student1);
|
||||||
|
System.out.println(student2);
|
||||||
|
System.out.println(student3);
|
||||||
|
System.out.println(student4);
|
||||||
|
System.out.println(student5);
|
||||||
|
|
||||||
|
System.out.println(studentList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-server</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-car-gateway</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringBoot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common DataScope -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MuYu Common Log -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MQTT客户端依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.5</version>
|
||||||
|
</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-console</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>tea-util</artifactId>
|
||||||
|
<version>0.2.21</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- mqtt3 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.paho</groupId>
|
||||||
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
|
<version>1.2.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SpringBoot
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 19:57
|
||||||
|
*/
|
||||||
|
public class SpringBoot {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.cache;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ExpiryTime
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 23:47
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ExpiryTime {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间单位(秒) 默认30分钟
|
||||||
|
*/
|
||||||
|
@Builder.Default
|
||||||
|
private long expiryTime = 30*60;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新时间单位(秒) 默认15分钟
|
||||||
|
*/
|
||||||
|
@Builder.Default
|
||||||
|
private long refreshTime = 15*60;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package com.muyu.handle;
|
||||||
|
|
||||||
|
import com.muyu.properties.ServerConfigProperties;
|
||||||
|
import com.muyu.system.context.SystemUserContext;
|
||||||
|
import com.muyu.system.domain.LoginUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SystemHandler
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 23:44
|
||||||
|
*/
|
||||||
|
public class SystemHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取登录用户信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static LoginUserInfo getUserInfo(){
|
||||||
|
return SystemUserContext.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取用户key
|
||||||
|
*/
|
||||||
|
private static String getUserKey(){
|
||||||
|
return getUserInfo().getUserKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆用户ID
|
||||||
|
* @return 登录用户ID
|
||||||
|
*/
|
||||||
|
public static Long getUserId(){
|
||||||
|
return getUserInfo().getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取服务器配置
|
||||||
|
* @return 当前用户服务器配置
|
||||||
|
*/
|
||||||
|
public static ServerConfigProperties getServerConfig(){
|
||||||
|
return SystemUserContext.get().getServerConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储当前服务器配置
|
||||||
|
*/
|
||||||
|
public static void setServerConfig(ServerConfigProperties serverConfig){
|
||||||
|
SystemUserContext.get().setServerConfig(serverConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取负载地址
|
||||||
|
* @return 负载地址
|
||||||
|
*/
|
||||||
|
public static String getLoadReqUrl(){
|
||||||
|
return getServerConfig().getLoadReqUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取租户ID
|
||||||
|
* @return 租户ID
|
||||||
|
*/
|
||||||
|
public static String getTenantId () {
|
||||||
|
return getUserInfo().getTenantId();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.muyu.properties;
|
||||||
|
|
||||||
|
import com.muyu.web.domain.ServerConfig;
|
||||||
|
import com.muyu.web.domain.model.ServerConfigModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigProperties
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 23:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ServerConfigProperties {
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
/**
|
||||||
|
* 负载地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
/**
|
||||||
|
* 负载请求格式化地址
|
||||||
|
*/
|
||||||
|
private String loadReqUrl;
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String mqttAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String mqttTopic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT交付级别
|
||||||
|
*/
|
||||||
|
private Integer mqttQos;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模型构建配置
|
||||||
|
* @param serverConfigModel 配置模型对象
|
||||||
|
* @return 配置对象
|
||||||
|
*/
|
||||||
|
public static ServerConfigProperties modelToProperties(ServerConfigModel serverConfigModel){
|
||||||
|
return ServerConfigProperties.builder()
|
||||||
|
.host(serverConfigModel.getHost())
|
||||||
|
.port(serverConfigModel.getPort())
|
||||||
|
.uri(serverConfigModel.getUri())
|
||||||
|
.mqttAddr(serverConfigModel.getDefaultMattAddr())
|
||||||
|
.mqttTopic(serverConfigModel.getDefaultMqttTopic())
|
||||||
|
.mqttQos(serverConfigModel.getDefaultMqttQos())
|
||||||
|
.loadReqUrl(
|
||||||
|
String.format(
|
||||||
|
"http://%s:%s%s",
|
||||||
|
serverConfigModel.getHost(),
|
||||||
|
serverConfigModel.getPort(),
|
||||||
|
serverConfigModel.getUri().startsWith("/") ? serverConfigModel.getUri() : "/" + serverConfigModel.getUri()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 模型构建配置
|
||||||
|
* @param serverConfig 配置对象
|
||||||
|
* @return 配置对象
|
||||||
|
*/
|
||||||
|
public static ServerConfigProperties configToProperties(ServerConfig serverConfig ) {
|
||||||
|
|
||||||
|
return ServerConfigProperties.builder()
|
||||||
|
.host(serverConfig.getHost())
|
||||||
|
.port(serverConfig.getPort())
|
||||||
|
.uri(serverConfig.getUri())
|
||||||
|
.mqttAddr(serverConfig.getDefaultMqttAddr())
|
||||||
|
.mqttTopic(serverConfig.getDefaultMaTopic())
|
||||||
|
.mqttQos(serverConfig.getDefaultMqttQos())
|
||||||
|
.loadReqUrl(
|
||||||
|
String.format(
|
||||||
|
"http://%s:%s%s",
|
||||||
|
serverConfig.getHost(),
|
||||||
|
serverConfig.getPort(),
|
||||||
|
serverConfig.getUri().startsWith("/") ? serverConfig.getUri() : "/" + serverConfig.getUri()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.system.context;
|
||||||
|
|
||||||
|
import com.muyu.system.domain.LoginUserInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SystemUserContext
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 23:59
|
||||||
|
*/
|
||||||
|
public class SystemUserContext {
|
||||||
|
|
||||||
|
private static final ThreadLocal<LoginUserInfo> basicContextLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
|
public static LoginUserInfo get(){
|
||||||
|
return basicContextLocal.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(LoginUserInfo loginUserInfo){
|
||||||
|
basicContextLocal.set(loginUserInfo);
|
||||||
|
}
|
||||||
|
public static void remove(){
|
||||||
|
basicContextLocal.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import com.muyu.cache.ExpiryTime;
|
||||||
|
import com.muyu.properties.ServerConfigProperties;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName LoginUserInfo
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 23:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class LoginUserInfo extends ExpiryTime {
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户token
|
||||||
|
*/
|
||||||
|
private String userKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
/**
|
||||||
|
* 服务配置
|
||||||
|
*/
|
||||||
|
private ServerConfigProperties serverConfig;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.muyu.utils;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.uuid.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName IdUtils
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 20:23
|
||||||
|
*/
|
||||||
|
public class IdUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机UUID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String randomUUID(){
|
||||||
|
return UUID.randomUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简化的UUID,去掉了横线
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String simpleUUID(){
|
||||||
|
return UUID.randomUUID().toString(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String fastUUID(){
|
||||||
|
return UUID.fastUUID().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String fastSimpleUUID(){
|
||||||
|
return UUID.fastUUID().toString(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.muyu.vehicle.api;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ClientAdmin
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:08
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface ClientAdmin {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.vehicle.api;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SimpleInterceptor
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:11
|
||||||
|
// */
|
||||||
|
//@Log4j2
|
||||||
|
//@Component
|
||||||
|
//public class SimpleInterceptor<T> implements Interceptor<T> {
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private HttpServletRequest request;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public boolean beforeExecute( r)
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.muyu.vehicle.api.req;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName VehicleConnectionReq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 20:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VehicleConnectionReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vin
|
||||||
|
*/
|
||||||
|
@JSONField(name = "vehicleVin")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private String timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@JSONField(name = "userName")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机字符串
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.web.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.web.domain.model.ServerConfigModel;
|
||||||
|
import com.muyu.web.domain.resp.ServerConfigResp;
|
||||||
|
import com.muyu.web.service.ServerConfigService;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigController
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:24
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicle/server/config")
|
||||||
|
@Log4j2
|
||||||
|
public class ServerConfigController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfigService serverConfigService;
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public Result<ServerConfigResp> get(){
|
||||||
|
ServerConfigModel serverConfigModel = serverConfigService.get();
|
||||||
|
return Result.success(ServerConfigResp.modelBuild(serverConfigModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.muyu.web.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServcerConfig
|
||||||
|
* @Description 服务器配置
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 20:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ServerConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "tenant_id",fill = FieldFill.INSERT)
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负载地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String defaultMqttAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String defaultMqTopic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT交付级别
|
||||||
|
*/
|
||||||
|
private Integer defaultMqttQos;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.muyu.web.domain.model;
|
||||||
|
|
||||||
|
import com.muyu.properties.ServerConfigProperties;
|
||||||
|
import com.muyu.web.domain.ServerConfig;
|
||||||
|
import com.muyu.web.domain.req.ServerConfigEditReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigModel
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ServerConfigModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负载地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String defaultMqttAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String defaultMqttTopic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT交付级别
|
||||||
|
*/
|
||||||
|
private Integer defaultMqttQos;
|
||||||
|
|
||||||
|
public static ServerConfigModel serverConfigBuild (ServerConfig serverConfig) {
|
||||||
|
return builder()
|
||||||
|
.host(serverConfig.getHost().trim())
|
||||||
|
.port(serverConfig.getPort())
|
||||||
|
.uri(serverConfig.getUri().trim())
|
||||||
|
.defaultMqttAddr(serverConfig.getDefaultMqttAddr().trim())
|
||||||
|
.defaultMqttTopic(serverConfig.getDefaultMqTopic().trim())
|
||||||
|
.defaultMqttQos(serverConfig.getDefaultMqttQos())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServerConfigModel editReqBuild (ServerConfigEditReq serverConfigReq) {
|
||||||
|
return builder()
|
||||||
|
.host(serverConfigReq.getHost().trim())
|
||||||
|
.port(serverConfigReq.getPort())
|
||||||
|
.uri(serverConfigReq.getUri().trim())
|
||||||
|
.defaultMqttAddr(serverConfigReq.getDefaultMqttAddr().trim())
|
||||||
|
.defaultMqttTopic(serverConfigReq.getDefaultMqttTopic().trim())
|
||||||
|
.defaultMqttQos(serverConfigReq.getDefaultMqttQos())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ServerConfigModel serverConfigPropertiesBuild (ServerConfigProperties serverConfigProperties) {
|
||||||
|
return builder()
|
||||||
|
.host(serverConfigProperties.getHost().trim())
|
||||||
|
.port(serverConfigProperties.getPort())
|
||||||
|
.uri(serverConfigProperties.getUri().trim())
|
||||||
|
.defaultMqttAddr(serverConfigProperties.getMqttAddr().trim())
|
||||||
|
.defaultMqttTopic(serverConfigProperties.getMqttTopic().trim())
|
||||||
|
.defaultMqttQos(serverConfigProperties.getMqttQos())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.muyu.web.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigEditReq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/27 0:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ServerConfigEditReq {
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
/**
|
||||||
|
* 负载地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String defaultMqttAddr;
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String defaultMqttTopic;
|
||||||
|
/**
|
||||||
|
* 默认MQTT交付级别
|
||||||
|
*/
|
||||||
|
private Integer defaultMqttQos;
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.muyu.web.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.web.domain.model.ServerConfigModel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigResp
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:45
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ServerConfigResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 端口号
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负载地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String defaultMqttAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String defaultMqttTopic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认MQTT交付级别
|
||||||
|
*/
|
||||||
|
private Integer defaultMqttQos;
|
||||||
|
|
||||||
|
|
||||||
|
public static ServerConfigResp modelBuild(ServerConfigModel serverConfigModel) {
|
||||||
|
return builder()
|
||||||
|
.host(serverConfigModel.getHost())
|
||||||
|
.port(serverConfigModel.getPort())
|
||||||
|
.uri(serverConfigModel.getUri())
|
||||||
|
.defaultMqttAddr(serverConfigModel.getDefaultMqttTopic())
|
||||||
|
.defaultMqttTopic(serverConfigModel.getDefaultMqttTopic())
|
||||||
|
.defaultMqttQos(serverConfigModel.getDefaultMqttQos())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.muyu.web.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.web.domain.ServerConfig;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ServerConfigMapper extends BaseMapper<ServerConfig> {
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.web.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.web.domain.ServerConfig;
|
||||||
|
import com.muyu.web.domain.model.ServerConfigModel;
|
||||||
|
|
||||||
|
public interface ServerConfigService extends IService<ServerConfig> {
|
||||||
|
ServerConfigModel get();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.web.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.handle.SystemHandler;
|
||||||
|
import com.muyu.web.domain.ServerConfig;
|
||||||
|
import com.muyu.web.domain.model.ServerConfigModel;
|
||||||
|
import com.muyu.web.mapper.ServerConfigMapper;
|
||||||
|
import com.muyu.web.service.ServerConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ServerConfigServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
* @Author YiBo.Liu
|
||||||
|
* @Date 2024/9/26 22:27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ServerConfigServiceImpl
|
||||||
|
extends ServiceImpl<ServerConfigMapper, ServerConfig>
|
||||||
|
implements ServerConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ServerConfigMapper serverConfigMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置模型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerConfigModel get() {
|
||||||
|
return ServerConfigModel.serverConfigPropertiesBuild(SystemHandler.getServerConfig());
|
||||||
|
}
|
||||||
|
}
|
|
@ -73,12 +73,6 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
<version>3.3.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -4,10 +4,9 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.warn.domain.Car;
|
import com.muyu.warn.domain.Car;
|
||||||
import com.muyu.warn.service.CarService;
|
import com.muyu.warn.service.CarService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import java.util.List;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName CarController
|
* @ClassName CarController
|
||||||
|
@ -34,5 +33,11 @@ public class CarController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/selectCar")
|
||||||
|
private Result<List<Car>> selectCar(@RequestBody Car car) {
|
||||||
|
List<Car> cars = carService.selectCar(car);
|
||||||
|
return Result.success(cars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,8 @@ import com.muyu.warn.domain.Resp.StrategyRespList;
|
||||||
import com.muyu.warn.domain.Resp.WarnStrategyList;
|
import com.muyu.warn.domain.Resp.WarnStrategyList;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.warn.domain.WarnStrategy;
|
import com.muyu.warn.domain.WarnStrategy;
|
||||||
import com.muyu.warn.service.IWarnStrategyService;
|
import com.muyu.warn.service.IWarnStrategyService;
|
||||||
|
@ -132,4 +126,20 @@ public class WarnStrategyController extends BaseController
|
||||||
List<StrategyRespList> list = warnStrategyService.strategyRespList(warnStrategy);
|
List<StrategyRespList> list = warnStrategyService.strategyRespList(warnStrategy);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过报文id查询策略
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/byTemplateId")
|
||||||
|
public Result<List<WarnStrategy>> byTemplateId(@RequestParam("templateId") Long templateId){
|
||||||
|
return Result.success(warnStrategyService.byTemplateId(templateId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findbyId")
|
||||||
|
public Result<WarnStrategy> findById(@RequestParam("id") Long id){
|
||||||
|
return Result.success(warnStrategyService.findById(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@ import com.muyu.warn.domain.Car;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CarMapper extends BaseMapper<Car> {
|
public interface CarMapper extends BaseMapper<Car> {
|
||||||
Car findByVin(@Param("vin") String vin);
|
Car findByVin(@Param("vin") String vin);
|
||||||
|
|
||||||
|
List<Car> selectCar(Car car);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.warn.domain.Resp.WarnStrategyList;
|
||||||
import com.muyu.warn.domain.WarnStrategy;
|
import com.muyu.warn.domain.WarnStrategy;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -20,4 +21,8 @@ public interface WarnStrategyMapper extends BaseMapper<WarnStrategy>{
|
||||||
List<WarnStrategyList> strategyList(WarnStrategy warnStrategy);
|
List<WarnStrategyList> strategyList(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
|
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
List<WarnStrategy> byTemplateId(@Param("templateId") Long templateId);
|
||||||
|
|
||||||
|
WarnStrategy findById(@Param("id") Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.warn.domain.Car;
|
import com.muyu.warn.domain.Car;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public interface CarService extends IService<Car> {
|
public interface CarService extends IService<Car> {
|
||||||
Car findByVin(String vin);
|
Car findByVin(String vin);
|
||||||
|
|
||||||
|
List<Car> selectCar(Car car);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,4 +51,15 @@ public interface IWarnStrategyService extends IService<WarnStrategy> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
|
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据报文id查询列表
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<WarnStrategy> byTemplateId(Long templateId);
|
||||||
|
|
||||||
|
WarnStrategy findById(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import com.muyu.warn.service.CarService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName CarServiceImpl
|
* @ClassName CarServiceImpl
|
||||||
* @Description 描述
|
* @Description 描述
|
||||||
|
@ -30,4 +32,10 @@ public class CarServiceImpl
|
||||||
public Car findByVin(String vin) {
|
public Car findByVin(String vin) {
|
||||||
return carMapper.findByVin(vin);
|
return carMapper.findByVin(vin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Car> selectCar(Car car) {
|
||||||
|
List<Car> list = carMapper.selectCar(car);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,16 @@ public class WarnStrategyServiceImpl
|
||||||
return warnStrategyMapper.strategyRespList(warnStrategy);
|
return warnStrategyMapper.strategyRespList(warnStrategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WarnStrategy> byTemplateId(Long templateId) {
|
||||||
|
List<WarnStrategy> list = warnStrategyMapper.byTemplateId(templateId);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WarnStrategy findById(Long id) {
|
||||||
|
WarnStrategy warnStrategy = warnStrategyMapper.findById(id);
|
||||||
|
return warnStrategy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,27 @@
|
||||||
<select id="findByVin" resultType="com.muyu.warn.domain.Car">
|
<select id="findByVin" resultType="com.muyu.warn.domain.Car">
|
||||||
select * from t_car where car_vin = #{vin}
|
select * from t_car where car_vin = #{vin}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectCar" resultType="com.muyu.warn.domain.Car">
|
||||||
|
select * from t_Car
|
||||||
|
<where>
|
||||||
|
<if test="carId!='' ">
|
||||||
|
and car_id = #{carId}
|
||||||
|
</if>
|
||||||
|
<if test="carFrame!='' and carFrame!=null">
|
||||||
|
and car_frame like ("%",#{carFrame},"%")
|
||||||
|
</if>
|
||||||
|
<if test="carCoed!='' and carCoed!=null ">
|
||||||
|
and car_Coed like ("%",#{carCoed},"%")
|
||||||
|
</if>
|
||||||
|
<if test="carVin!='' and carVin!=null ">
|
||||||
|
and car_vin = #{carVin}
|
||||||
|
</if>
|
||||||
|
<if test="carColor!='' and carColor!=null ">
|
||||||
|
and car_color like ("%",#{carColor},"%")
|
||||||
|
</if>
|
||||||
|
<if test="carStatus!='' and carStatus!=null ">
|
||||||
|
and car_status = #{carStatus}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -31,4 +31,11 @@
|
||||||
LEFT JOIN t_car_type c ON c.car_type_id = s.car_type_id
|
LEFT JOIN t_car_type c ON c.car_type_id = s.car_type_id
|
||||||
LEFT JOIN t_template t ON t.template_id = s.template_id
|
LEFT JOIN t_template t ON t.template_id = s.template_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="byTemplateId" resultType="com.muyu.warn.domain.WarnStrategy">
|
||||||
|
select * from warn_strategy where template_id = #{templateId}
|
||||||
|
</select>
|
||||||
|
<select id="findById" resultType="com.muyu.warn.domain.WarnStrategy">
|
||||||
|
select * from warn_strategy where id = #{id}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
1
pom.xml
1
pom.xml
|
@ -284,6 +284,7 @@
|
||||||
<module>cloud-common</module>
|
<module>cloud-common</module>
|
||||||
<module>cloud-weixin-mp</module>
|
<module>cloud-weixin-mp</module>
|
||||||
<module>cloud-warn</module>
|
<module>cloud-warn</module>
|
||||||
|
<module>cloud-modules/cloud-modules-car-gateway</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue