初始化
commit
71fa076269
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
|
@ -0,0 +1,8 @@
|
|||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,66 @@
|
|||
<?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>
|
||||
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>VehicleSimulation</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<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>
|
||||
<mysql.version>8.0.28</mysql.version>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.15</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus 所需依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>${mybatisplus.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 使用h2内存数据库 -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
* @version 1.0
|
||||
* @description 车辆模拟启动类
|
||||
* @date 2023/11/9
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@MapperScan(value = "com.muyu.mapper")
|
||||
public class VehicleSimulationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(VehicleSimulationApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.muyu.common;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class HttpStatus {
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 对象创建成功
|
||||
*/
|
||||
public static final int CREATED = 201;
|
||||
|
||||
/**
|
||||
* 请求已经被接受
|
||||
*/
|
||||
public static final int ACCEPTED = 202;
|
||||
|
||||
/**
|
||||
* 操作已经执行成功,但是没有返回数据
|
||||
*/
|
||||
public static final int NO_CONTENT = 204;
|
||||
|
||||
/**
|
||||
* 资源已被移除
|
||||
*/
|
||||
public static final int MOVED_PERM = 301;
|
||||
|
||||
/**
|
||||
* 重定向
|
||||
*/
|
||||
public static final int SEE_OTHER = 303;
|
||||
|
||||
/**
|
||||
* 资源没有被修改
|
||||
*/
|
||||
public static final int NOT_MODIFIED = 304;
|
||||
|
||||
/**
|
||||
* 参数列表错误(缺少,格式不匹配)
|
||||
*/
|
||||
public static final int BAD_REQUEST = 400;
|
||||
|
||||
/**
|
||||
* 未授权
|
||||
*/
|
||||
public static final int UNAUTHORIZED = 401;
|
||||
|
||||
/**
|
||||
* 访问受限,授权过期
|
||||
*/
|
||||
public static final int FORBIDDEN = 403;
|
||||
|
||||
/**
|
||||
* 资源,服务未找到
|
||||
*/
|
||||
public static final int NOT_FOUND = 404;
|
||||
|
||||
/**
|
||||
* 不允许的http方法
|
||||
*/
|
||||
public static final int BAD_METHOD = 405;
|
||||
|
||||
/**
|
||||
* 资源冲突,或者资源被锁
|
||||
*/
|
||||
public static final int CONFLICT = 409;
|
||||
|
||||
/**
|
||||
* 不支持的数据,媒体类型
|
||||
*/
|
||||
public static final int UNSUPPORTED_TYPE = 415;
|
||||
|
||||
/**
|
||||
* 系统内部错误
|
||||
*/
|
||||
public static final int ERROR = 500;
|
||||
|
||||
/**
|
||||
* 接口未实现
|
||||
*/
|
||||
public static final int NOT_IMPLEMENTED = 501;
|
||||
|
||||
/**
|
||||
* 系统警告消息
|
||||
*/
|
||||
public static final int WARN = 601;
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
package com.muyu.common;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class Result<T> implements Serializable {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final int SUCCESS = HttpStatus.SUCCESS;
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final int FAIL = HttpStatus.ERROR;
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 系统警告消息
|
||||
*/
|
||||
private static final int WARN = HttpStatus.WARN;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> Result<T> success () {
|
||||
return restResult(null, SUCCESS, "操作成功");
|
||||
}
|
||||
|
||||
public static <T> Result<T> success (T data) {
|
||||
return restResult(data, SUCCESS, "操作成功");
|
||||
}
|
||||
|
||||
public static <T> Result<T> success (T data, String msg) {
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error () {
|
||||
return restResult(null, FAIL, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> Result<T> error (String msg) {
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error (T data) {
|
||||
return restResult(data, FAIL, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> Result<T> error (T data, String msg) {
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error (int code, String msg) {
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> warn () {
|
||||
return restResult(null, WARN, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> Result<T> warn (String msg) {
|
||||
return restResult(null, WARN, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> warn (T data) {
|
||||
return restResult(data, WARN, "操作失败");
|
||||
}
|
||||
|
||||
public static <T> Result<T> warn (T data, String msg) {
|
||||
return restResult(data, WARN, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> warn (int code, String msg) {
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> Result<T> restResult (T data, int code, String msg) {
|
||||
Result<T> apiResult = new Result<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public static <T> Boolean isError (Result<T> ret) {
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
public static <T> Boolean isSuccess (Result<T> ret) {
|
||||
return Result.SUCCESS == ret.getCode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 填充公共字段
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
log.info("start insert fill...");
|
||||
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
log.info("start update fill...");
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* mybatisplus 配置
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
/**
|
||||
* 老版本,目前已失效
|
||||
* @return
|
||||
*/
|
||||
/**@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
return paginationInterceptor;
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* 新的分页插件,一缓和二缓遵循mybatis的规则,
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
|
||||
return interceptor;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.muyu.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.common.Result;
|
||||
import com.muyu.domain.User;
|
||||
import com.muyu.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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.muyu.controller;
|
||||
|
||||
import com.muyu.common.Result;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.service.VehicleService;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
* @version 1.0
|
||||
* @description 用户控制层
|
||||
* @date 2023/11/9
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class VehicleController {
|
||||
|
||||
@Autowired
|
||||
private VehicleService vehicleService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public Result<List<Vehicle>> list(){
|
||||
return Result.success(vehicleService.list());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.muyu.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 +
|
||||
"}";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
* @version 1.0
|
||||
* @description 车辆信息
|
||||
* @date 2023/11/9
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("vehicle")
|
||||
public class Vehicle {
|
||||
|
||||
@TableId(value = "vin")
|
||||
private String vin;
|
||||
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.User;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.Vehicle;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
public interface VehicleService extends IService<Vehicle> {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.User;
|
||||
import com.muyu.mapper.UserMapper;
|
||||
import com.muyu.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 {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.muyu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.Vehicle;
|
||||
import com.muyu.mapper.VehicleMapper;
|
||||
import com.muyu.service.VehicleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Leo825
|
||||
* @since 2022-07-05
|
||||
*/
|
||||
@Service
|
||||
public class VechileServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
||||
|
||||
}
|
|
@ -0,0 +1,484 @@
|
|||
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;
|
||||
*/
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.vehicle.core;
|
||||
|
||||
/**
|
||||
* @author DongZeLiang
|
||||
* @version 1.0
|
||||
* @description 配置
|
||||
* @date 2023/11/9
|
||||
*/
|
||||
public class Config {
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
server:
|
||||
port: 81
|
||||
servlet:
|
||||
context-path: /vehicle
|
||||
spring:
|
||||
datasource:
|
||||
username: muyu
|
||||
password: 123456
|
||||
# 如果需要数据本地化,则改成 file 方式
|
||||
# jdbc:h2:mem:testDB;DB_CLOSE_DELAY=-1
|
||||
url: jdbc:h2:file:~/vehicle/db;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1
|
||||
driver-class-name: org.h2.Driver
|
||||
# 开启这个配置就可以通过 web 页面访问了,例如:http://localhost:8080/springboot-h2/h2-console
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
settings:
|
||||
# 开启h2 console 跟踪 方便调试 默认 false
|
||||
trace: true
|
||||
# 允许console 远程访问 默认false
|
||||
web-allow-others: true
|
||||
# h2 访问路径上下文
|
||||
path: /h2-console
|
||||
sql:
|
||||
init:
|
||||
schema-locations: classpath:schema.sql
|
||||
data-locations: classpath:data.sql
|
||||
mode: always
|
||||
continue-on-error: true
|
||||
|
||||
|
||||
# mybatis-plus 配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/com.muyu.mapper/**/*.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.dmo.entity
|
||||
global-config:
|
||||
#数据库相关配置
|
||||
db-config:
|
||||
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
|
||||
id-type: AUTO
|
||||
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
|
||||
field-strategy: NOT_NULL
|
||||
#驼峰下划线转换
|
||||
column-underline: true
|
||||
logic-delete-value: -1
|
||||
logic-not-delete-value: 0
|
||||
banner: false
|
||||
#原生配置
|
||||
configuration:
|
||||
# 打印sql
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
call-setters-on-nulls: true
|
||||
jdbc-type-for-null: 'null'
|
||||
|
||||
# 日志输出配置
|
||||
logging:
|
||||
level:
|
||||
root: INFO
|
||||
org:
|
||||
springframework:
|
||||
security: WARN
|
||||
web: ERROR
|
||||
file:
|
||||
path: ./logs
|
||||
name: './logs/springboot-h2.log'
|
||||
pattern:
|
||||
file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n'
|
||||
console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n'
|
|
@ -0,0 +1,4 @@
|
|||
insert into t_user(id, username, pwd, create_time, update_time) values (0,'zhhangsan','1222', {ts '2022-07-27 18:47:52.69'}, {ts '2022-07-27 18:47:52.69'})
|
||||
|
||||
|
||||
insert into vehicle(id,vin, create_time) values (1,'vin123456789123456',{ts '2022-07-27 18:47:52.69'})
|
|
@ -0,0 +1,13 @@
|
|||
create table if not exists t_user (
|
||||
`id` int primary key not null ,
|
||||
`username` char (50) not null,
|
||||
`pwd` char(50) not null,
|
||||
`create_time` datetime not null,
|
||||
`update_time` datetime
|
||||
) ;
|
||||
|
||||
create table if not exists vehicle (
|
||||
`id` int primary key not null ,
|
||||
`vin` char (50) not null,
|
||||
`create_time` datetime not null
|
||||
) ;
|
Loading…
Reference in New Issue