Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
5b9f43ab6d | |
|
c3c4b9f7f6 |
|
@ -19,6 +19,7 @@ out
|
||||||
.project
|
.project
|
||||||
.settings
|
.settings
|
||||||
.springBeans
|
.springBeans
|
||||||
|
*.yml
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -57,10 +57,6 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.muyu.auth.controller;
|
package com.muyu.auth.controller;
|
||||||
|
|
||||||
import com.muyu.auth.form.Firm;
|
|
||||||
import com.muyu.auth.form.LoginBody;
|
import com.muyu.auth.form.LoginBody;
|
||||||
import com.muyu.auth.form.RegisterBody;
|
import com.muyu.auth.form.RegisterBody;
|
||||||
import com.muyu.auth.service.SysFirmService;
|
|
||||||
import com.muyu.auth.service.SysLoginService;
|
import com.muyu.auth.service.SysLoginService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.JwtUtils;
|
import com.muyu.common.core.utils.JwtUtils;
|
||||||
|
@ -32,22 +30,11 @@ public class TokenController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysLoginService sysLoginService;
|
private SysLoginService sysLoginService;
|
||||||
@Autowired
|
|
||||||
private SysFirmService sysFirmService;
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public Result<?> login (@RequestBody LoginBody form) {
|
public Result<?> login (@RequestBody LoginBody form) {
|
||||||
//查询用户公司是否存在
|
|
||||||
Firm firm = sysFirmService.findFirmByName(form.getFirmName());
|
|
||||||
|
|
||||||
//不能存在提示
|
|
||||||
if (firm.getDatabaseName()==null){
|
|
||||||
return Result.error(null,"公司不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户登录
|
// 用户登录
|
||||||
LoginUser userInfo = sysLoginService.login(firm.getDatabaseName(),form.getUsername(), form.getPassword());
|
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
return Result.success(tokenService.createToken(userInfo));
|
return Result.success(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.muyu.auth.form;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class Firm {
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String firmName;
|
|
||||||
|
|
||||||
private String databaseName;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +1,11 @@
|
||||||
package com.muyu.auth.form;
|
package com.muyu.auth.form;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
|
||||||
public class LoginBody {
|
public class LoginBody {
|
||||||
|
|
||||||
/**
|
|
||||||
* 公司名称
|
|
||||||
*/
|
|
||||||
private String firmName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名
|
* 用户名
|
||||||
*/
|
*/
|
||||||
|
@ -28,5 +17,19 @@ public class LoginBody {
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
|
||||||
|
public String getUsername () {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername (String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword () {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword (String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
package com.muyu.auth.service;
|
|
||||||
|
|
||||||
import com.muyu.auth.form.Firm;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.Statement;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class SysFirmService {
|
|
||||||
|
|
||||||
static final String USER="root";
|
|
||||||
static final String PASSWORD="Lw030106";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
|
|
||||||
public Firm findFirmByName(String firmName){
|
|
||||||
Firm firm = new Firm();
|
|
||||||
try {
|
|
||||||
// Class.forName("com.mysql.cj.jdbc.Driver");
|
|
||||||
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
|
|
||||||
Connection connection= DriverManager.getConnection("jdbc:mysql://47.101.53.251:3306/datasource?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&useSSL=false",USER,PASSWORD);
|
|
||||||
String sql="select * from `datasource` where firm_name = '"+firmName+"'";
|
|
||||||
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
|
||||||
|
|
||||||
|
|
||||||
while (rs.next()){
|
|
||||||
firm.setId(rs.getInt("id"));
|
|
||||||
firm.setFirmName(rs.getString("firm_name"));
|
|
||||||
firm.setDatabaseName(rs.getString("database_name"));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
//数据源不为空
|
|
||||||
if (firm!=null){
|
|
||||||
redisTemplate.opsForValue().set("datasource",firm.getDatabaseName());
|
|
||||||
}
|
|
||||||
return firm;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -12,7 +12,6 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.ip.IpUtils;
|
import com.muyu.common.core.utils.ip.IpUtils;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.Firm;
|
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -41,7 +40,7 @@ public class SysLoginService {
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
public LoginUser login (String databaseName,String username, String password) {
|
public LoginUser login (String username, String password) {
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
if (StringUtils.isAnyBlank(username, password)) {
|
if (StringUtils.isAnyBlank(username, password)) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
|
||||||
|
@ -65,14 +64,8 @@ public class SysLoginService {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "很遗憾,访问IP已被列入系统黑名单");
|
||||||
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
throw new ServiceException("很遗憾,访问IP已被列入系统黑名单");
|
||||||
}
|
}
|
||||||
|
|
||||||
Firm firm = new Firm();
|
|
||||||
firm.setDatabaseName(databaseName);
|
|
||||||
firm.setUserName(username);
|
|
||||||
|
|
||||||
|
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
Result<LoginUser> userResult = remoteUserService.getUserInfo(firm, SecurityConstants.INNER);
|
Result<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||||
|
|
|
@ -29,10 +29,8 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-security</artifactId>
|
<artifactId>cloud-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -6,20 +6,17 @@ import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||||
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
||||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||||
import com.muyu.cloud.common.many.datasource.init.InitDataSource;
|
|
||||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||||
import com.muyu.cloud.common.saas.domain.Datasource;
|
|
||||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.SpringUtils;
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
|
import com.muyu.common.system.domain.Datasource;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.common.system.remote.RemoteSaaSService;
|
import com.muyu.common.system.remote.RemoteSaaSService;
|
||||||
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
|
@ -41,14 +38,9 @@ import java.util.Map;
|
||||||
@Component
|
@Component
|
||||||
@AutoConfiguration(before = {MybatisPlusAutoConfiguration.class, MybatisAutoConfiguration.class})
|
@AutoConfiguration(before = {MybatisPlusAutoConfiguration.class, MybatisAutoConfiguration.class})
|
||||||
public class ManyDataSource implements ApplicationRunner{
|
public class ManyDataSource implements ApplicationRunner{
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private InitDataSource initDataSource;
|
|
||||||
|
|
||||||
|
|
||||||
private List<EntInfo> dataSourceInfoList(){
|
private List<EntInfo> dataSourceInfoList(){
|
||||||
RemoteSaaSService remoteSaaSService = SpringUtils.getBean(RemoteSaaSService.class);
|
RemoteSaaSService remoteSaaSService = SpringUtils.getBean(RemoteSaaSService.class);
|
||||||
Result<List<Datasource>> tableDataInfoResult = initDataSource.initDatasource();
|
Result<List<Datasource>> tableDataInfoResult = remoteSaaSService.findDatabaseList();
|
||||||
if (tableDataInfoResult==null){
|
if (tableDataInfoResult==null){
|
||||||
throw new SaaSException("saas远调数据源错误");
|
throw new SaaSException("saas远调数据源错误");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package com.muyu.cloud.common.many.datasource.init;
|
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.cloud.common.saas.domain.Datasource;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.system.domain.Firm;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Log4j2
|
|
||||||
public class InitDataSource {
|
|
||||||
|
|
||||||
public static final String USER="root";
|
|
||||||
public static final String PASSWORD="Lw030106";
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@Primary
|
|
||||||
public Result<List<Datasource>> initDatasource(){
|
|
||||||
ArrayList<Datasource> list = new ArrayList<>();
|
|
||||||
|
|
||||||
try {
|
|
||||||
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
|
|
||||||
Connection connection= DriverManager.getConnection("jdbc:mysql://47.101.53.251:3306/datasource?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&useSSL=false",USER,PASSWORD);
|
|
||||||
String sql="select * from `datasource` ";
|
|
||||||
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
|
||||||
|
|
||||||
while (rs.next()){
|
|
||||||
Datasource datasource = new Datasource();
|
|
||||||
datasource.setId(rs.getInt("id"));
|
|
||||||
datasource.setFirmName(rs.getString("firm_name"));
|
|
||||||
datasource.setDatabaseName(rs.getString("database_name"));
|
|
||||||
list.add(datasource);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return Result.success(list);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.muyu.common.system.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class Firm {
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String firmName;
|
|
||||||
|
|
||||||
private String databaseName;
|
|
||||||
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.common.system.domain.Firm;
|
|
||||||
import com.muyu.common.system.domain.SysFirmUser;
|
import com.muyu.common.system.domain.SysFirmUser;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
import com.muyu.common.system.remote.RemoteUserService;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
@ -27,10 +26,8 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
public RemoteUserService create (Throwable throwable) {
|
public RemoteUserService create (Throwable throwable) {
|
||||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||||
return new RemoteUserService() {
|
return new RemoteUserService() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<LoginUser> getUserInfo(Firm firm, String source) {
|
public Result<LoginUser> getUserInfo (String username, String source) {
|
||||||
return Result.error("获取用户失败:" + throwable.getMessage());
|
return Result.error("获取用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
<?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-modules</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>cloud-data</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>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
|
||||||
<version>4.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.kafka</groupId>
|
|
||||||
<artifactId>spring-kafka</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>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-modules-car</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-modules-fence</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.paho</groupId>
|
|
||||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
|
||||||
<version>1.1.0</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>
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.muyu.data;
|
|
||||||
|
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableMyFeignClients
|
|
||||||
@EnableFeignClients
|
|
||||||
public class DataApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(DataApplication.class,args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,129 +0,0 @@
|
||||||
package com.muyu.data.config;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.SpringBootConfiguration;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
|
||||||
import org.springframework.kafka.config.KafkaListenerContainerFactory;
|
|
||||||
import org.springframework.kafka.core.ConsumerFactory;
|
|
||||||
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
|
||||||
import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
|
|
||||||
import org.springframework.kafka.listener.ContainerProperties;
|
|
||||||
import org.springframework.kafka.support.serializer.JsonDeserializer;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 徐一杰
|
|
||||||
* @date 2022/10/31 18:05
|
|
||||||
* kafka配置,也可以写在yml,这个文件会覆盖yml
|
|
||||||
*/
|
|
||||||
@SpringBootConfiguration
|
|
||||||
public class KafkaConsumerConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置 Kafka的 主机地址
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.consumer.bootstrap-servers}")
|
|
||||||
private String bootstrapServers;
|
|
||||||
/**
|
|
||||||
* 配置分分组
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.consumer.group-id}")
|
|
||||||
private String groupId;
|
|
||||||
/**
|
|
||||||
* 是否自动提交 偏移量
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.consumer.enable-auto-commit}")
|
|
||||||
private boolean enableAutoCommit;
|
|
||||||
/**
|
|
||||||
* 消费者与Kafka的心跳续约的会话超时时间
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.properties.session.timeout.ms}")
|
|
||||||
private String sessionTimeout;
|
|
||||||
/**
|
|
||||||
* 两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.properties.max.poll.interval.ms}")
|
|
||||||
private String maxPollIntervalTime;
|
|
||||||
|
|
||||||
@Value("${spring.kafka.consumer.max-poll-records}")
|
|
||||||
private String maxPollRecords;
|
|
||||||
|
|
||||||
@Value("${spring.kafka.consumer.auto-offset-reset}")
|
|
||||||
private String autoOffsetReset;
|
|
||||||
|
|
||||||
@Value("${spring.kafka.listener.concurrency}")
|
|
||||||
private Integer concurrency;
|
|
||||||
|
|
||||||
@Value("${spring.kafka.listener.missing-topics-fatal}")
|
|
||||||
private boolean missingTopicsFatal;
|
|
||||||
|
|
||||||
@Value("${spring.kafka.listener.poll-timeout}")
|
|
||||||
private long pollTimeout;
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Map<String, Object> consumerConfigs() {
|
|
||||||
Map<String, Object> propsMap = new HashMap<>(16);
|
|
||||||
propsMap.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
|
|
||||||
propsMap.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
|
|
||||||
//是否自动提交偏移量,默认值是true,为了避免出现重复数据和数据丢失,可以把它设置为false,然后手动提交偏移量
|
|
||||||
propsMap.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, enableAutoCommit);
|
|
||||||
//自动提交的时间间隔,自动提交开启时生效
|
|
||||||
propsMap.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "2000");
|
|
||||||
//该属性指定了消费者在读取一个没有偏移量的分区或者偏移量无效的情况下该作何处理:
|
|
||||||
//earliest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费分区的记录
|
|
||||||
//latest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下的数据(在消费者启动之后生成的记录)
|
|
||||||
//none:当各分区都存在已提交的offset时,从提交的offset开始消费;只要有一个分区不存在已提交的offset,则抛出异常
|
|
||||||
propsMap.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, autoOffsetReset);
|
|
||||||
//两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
|
||||||
propsMap.put(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, maxPollIntervalTime);
|
|
||||||
//这个参数定义了poll方法最多可以拉取多少条消息,默认值为500。如果在拉取消息的时候新消息不足500条,那有多少返回多少;如果超过500条,每次只返回500。
|
|
||||||
//这个默认值在有些场景下太大,有些场景很难保证能够在5min内处理完500条消息,
|
|
||||||
//如果消费者无法在5分钟内处理完500条消息的话就会触发reBalance,
|
|
||||||
//然后这批消息会被分配到另一个消费者中,还是会处理不完,这样这批消息就永远也处理不完。
|
|
||||||
//要避免出现上述问题,提前评估好处理一条消息最长需要多少时间,然后覆盖默认的max.poll.records参数
|
|
||||||
//注:需要开启BatchListener批量监听才会生效,如果不开启BatchListener则不会出现reBalance情况
|
|
||||||
propsMap.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, maxPollRecords);
|
|
||||||
//当broker多久没有收到consumer的心跳请求后就触发reBalance,默认值是10s
|
|
||||||
propsMap.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, sessionTimeout);
|
|
||||||
//序列化(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
|
||||||
propsMap.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
|
|
||||||
propsMap.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
|
|
||||||
return propsMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public ConsumerFactory<Object, Object> consumerFactory() {
|
|
||||||
// 配置消费者的 Json 反序列化的可信赖包,反序列化实体类需要
|
|
||||||
try (JsonDeserializer<Object> deserializer = new JsonDeserializer<>()) {
|
|
||||||
deserializer.trustedPackages("*");
|
|
||||||
return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new JsonDeserializer<>(), deserializer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* kafka监听容器工厂 负责 从 Kafka的主题中 取出消息进行消费 可以设置消费者的配置
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Object, Object>> kafkaListenerContainerFactory() {
|
|
||||||
ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
|
|
||||||
factory.setConsumerFactory(consumerFactory());
|
|
||||||
//在侦听器容器中运行的线程数,一般设置为 机器数*分区数
|
|
||||||
factory.setConcurrency(concurrency);
|
|
||||||
// 消费监听接口监听的主题不存在时,默认会报错,所以设置为false忽略错误
|
|
||||||
factory.setMissingTopicsFatal(missingTopicsFatal);
|
|
||||||
// 自动提交关闭,需要设置手动消息确认
|
|
||||||
factory.getContainerProperties().setAckMode(ContainerProperties.AckMode.MANUAL_IMMEDIATE);
|
|
||||||
factory.getContainerProperties().setPollTimeout(pollTimeout);
|
|
||||||
// 设置为批量监听,需要用List接收
|
|
||||||
// factory.setBatchListener(true);
|
|
||||||
return factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,127 +0,0 @@
|
||||||
package com.muyu.data.config;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
|
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
|
||||||
import org.springframework.kafka.core.ProducerFactory;
|
|
||||||
import org.springframework.kafka.transaction.KafkaTransactionManager;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主题生产者的配置类
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class KafkaProviderConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* kafka 的主机地址
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.bootstrap-servers}")
|
|
||||||
private String bootstrapServers;
|
|
||||||
/**
|
|
||||||
* 配置 Kafka的事务
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.transaction-id-prefix}")
|
|
||||||
private String transactionIdPrefix;
|
|
||||||
/**
|
|
||||||
* 发送确认机制
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.acks}")
|
|
||||||
private String acks;
|
|
||||||
/**
|
|
||||||
* 发送重试
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.retries}")
|
|
||||||
private String retries;
|
|
||||||
/**
|
|
||||||
* 发送消息的批次大小
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.batch-size}")
|
|
||||||
private String batchSize;
|
|
||||||
/**
|
|
||||||
* 消息的缓冲区内存大小
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.buffer-memory}")
|
|
||||||
private String bufferMemory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置 健的序列化方式
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.key-serializer}")
|
|
||||||
private String keySerializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置 值的序列化方式
|
|
||||||
*/
|
|
||||||
@Value("${spring.kafka.producer.value-serializer}")
|
|
||||||
private String valueSerializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建 map 配置消息生产者对象的配置
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public Map<String, Object> producerConfigs() {
|
|
||||||
Map<String, Object> props = new HashMap<>(16);
|
|
||||||
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
|
|
||||||
//acks=0 : 生产者在成功写入消息之前不会等待任何来自服务器的响应。
|
|
||||||
//acks=1 : 只要集群的首领节点收到消息,生产者就会收到一个来自服务器成功响应。
|
|
||||||
//acks=all :只有当所有参与复制的节点全部收到消息时,生产者才会收到一个来自服务器的成功响应。
|
|
||||||
//开启事务必须设为all
|
|
||||||
props.put(ProducerConfig.ACKS_CONFIG, acks);
|
|
||||||
//发生错误后,消息重发的次数,开启事务必须大于0
|
|
||||||
props.put(ProducerConfig.RETRIES_CONFIG, retries);
|
|
||||||
//当多个消息发送到相同分区时,生产者会将消息打包到一起,以减少请求交互. 而不是一条条发送
|
|
||||||
//批次的大小可以通过batch.size 参数设置.默认是16KB
|
|
||||||
//较小的批次大小有可能降低吞吐量(批次大小为0则完全禁用批处理)。
|
|
||||||
//比如说,kafka里的消息5秒钟Batch才凑满了16KB,才能发送出去。那这些消息的延迟就是5秒钟
|
|
||||||
//实测batchSize这个参数没有用
|
|
||||||
props.put(ProducerConfig.BATCH_SIZE_CONFIG, batchSize);
|
|
||||||
//有的时刻消息比较少,过了很久,比如5min也没有凑够16KB,这样延时就很大,所以需要一个参数. 再设置一个时间,到了这个时间,
|
|
||||||
//即使数据没达到16KB,也将这个批次发送出去
|
|
||||||
props.put(ProducerConfig.LINGER_MS_CONFIG, "5000");
|
|
||||||
//生产者内存缓冲区的大小
|
|
||||||
props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, bufferMemory);
|
|
||||||
//反序列化,和生产者的序列化方式对应
|
|
||||||
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, keySerializer);
|
|
||||||
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, valueSerializer);
|
|
||||||
return props;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建 主题生产者工厂
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public ProducerFactory<Object, Object> producerFactory() {
|
|
||||||
DefaultKafkaProducerFactory<Object, Object> factory = new DefaultKafkaProducerFactory<>(producerConfigs());
|
|
||||||
//开启事务,会导致 LINGER_MS_CONFIG 配置失效
|
|
||||||
factory.setTransactionIdPrefix(transactionIdPrefix);
|
|
||||||
return factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配置 Kafka的事务管理器
|
|
||||||
* @param producerFactory
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public KafkaTransactionManager<Object, Object> kafkaTransactionManager(ProducerFactory<Object, Object> producerFactory) {
|
|
||||||
return new KafkaTransactionManager<>(producerFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建 KafkaTemplate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public KafkaTemplate<Object, Object> kafkaTemplate() {
|
|
||||||
return new KafkaTemplate<>(producerFactory());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
package com.muyu.data.config;
|
|
||||||
|
|
||||||
import jakarta.annotation.Nullable;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
|
||||||
import org.apache.kafka.clients.producer.RecordMetadata;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.kafka.core.KafkaTemplate;
|
|
||||||
import org.springframework.kafka.support.ProducerListener;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class KafkaSendResultHandler implements ProducerListener<Object,Object> {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private KafkaTemplate<Object,Object> kafkaTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* bean 初始化方法
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void init(){
|
|
||||||
this.kafkaTemplate.setProducerListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 消息发送到Kafka成功的回调
|
|
||||||
* @param producerRecord
|
|
||||||
* @param recordMetadata
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ProducerRecord producerRecord, RecordMetadata recordMetadata){
|
|
||||||
System.out.println("信息发送成功:"+ producerRecord.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 息发送到 Kafka 失败的回调
|
|
||||||
* @param producerRecord the failed record
|
|
||||||
* @param recordMetadata The metadata for the record that was sent (i.e. the partition
|
|
||||||
* and offset). If an error occurred, metadata will contain only valid topic and maybe
|
|
||||||
* the partition. If the partition is not provided in the ProducerRecord and an error
|
|
||||||
* occurs before partition is assigned, then the partition will be set to
|
|
||||||
* RecordMetadata.UNKNOWN_PARTITION.
|
|
||||||
* @param exception the exception thrown
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onError(ProducerRecord producerRecord, @Nullable RecordMetadata recordMetadata,
|
|
||||||
Exception exception){
|
|
||||||
System.out.println("消息发送失败: "+ producerRecord.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.muyu.data.config;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.NonNull;
|
|
||||||
import org.apache.kafka.clients.consumer.Consumer;
|
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
|
||||||
import org.springframework.kafka.listener.KafkaListenerErrorHandler;
|
|
||||||
import org.springframework.kafka.listener.ListenerExecutionFailedException;
|
|
||||||
import org.springframework.kafka.support.Acknowledgment;
|
|
||||||
import org.springframework.messaging.Message;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MyKafkaListenerErrorHandler implements KafkaListenerErrorHandler {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public Object handleError(@NonNull Message<?> message,
|
|
||||||
ListenerExecutionFailedException exception) {
|
|
||||||
return new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public Object handleError(@NonNull Message<?> message,
|
|
||||||
@NonNull ListenerExecutionFailedException exception,
|
|
||||||
Consumer<?, ?> consumer) {
|
|
||||||
System.out.println("消息详情:"+ message);
|
|
||||||
System.out.println("异常信息:"+ exception);
|
|
||||||
System.out.println("消费者详情:" +consumer.groupMetadata());
|
|
||||||
System.out.println("监听主题:"+ consumer.listTopics());
|
|
||||||
return KafkaListenerErrorHandler.super.handleError(message, exception, consumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.muyu.data.controller;
|
|
||||||
|
|
||||||
import com.muyu.data.service.DataService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("data")
|
|
||||||
public class DataController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DataService dataService;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package com.muyu.data.domian;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@TableName("event")
|
|
||||||
public class Event {
|
|
||||||
|
|
||||||
@TableId(value ="event_id" )
|
|
||||||
@Excel(name = "事件id")
|
|
||||||
private Integer eventId;
|
|
||||||
|
|
||||||
@Excel(name = "事件名称")
|
|
||||||
private String eventName;
|
|
||||||
|
|
||||||
@Excel(name = "车辆vin")
|
|
||||||
private String carVin;
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.muyu.data.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface DataMapper {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu.data.remote;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.domain.req.SysCarReq;
|
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@FeignClient(name = "cloud-car")
|
|
||||||
public interface RemoteCarService {
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/car/selectSysCarVoList")
|
|
||||||
public Result<List<SysCarVo>> selectSysCarVoList(
|
|
||||||
@RequestBody SysCarReq sysCarReq);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.muyu.data.remote;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.fence.domain.req.ElectronicFenceGroupListReq;
|
|
||||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@FeignClient(name = "cloud-fence")
|
|
||||||
public interface RemoteFenceService {
|
|
||||||
|
|
||||||
@PostMapping("/fence/selectGroupList")
|
|
||||||
public Result<List<GroupFenceListresp>> selectGroupList(
|
|
||||||
@RequestBody ElectronicFenceGroupListReq req);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.muyu.data.service;
|
|
||||||
|
|
||||||
public interface DataService {
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.muyu.data.service.impl;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class DataServiceImpl {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
package com.muyu.data.util;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.data.remote.RemoteCarService;
|
|
||||||
import com.muyu.data.remote.RemoteFenceService;
|
|
||||||
import com.muyu.domain.resp.SysCarVo;
|
|
||||||
import com.muyu.fence.domain.resp.GroupFenceListresp;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class InitDataRedis implements ApplicationRunner {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisTemplate redisTemplate;
|
|
||||||
@Autowired
|
|
||||||
private RemoteCarService remoteCarService;
|
|
||||||
@Autowired
|
|
||||||
private RemoteFenceService remoteFenceService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
|
||||||
|
|
||||||
//查询数控库中的车辆列表基本信息
|
|
||||||
Result<List<SysCarVo>> sysCarVoListResult = remoteCarService.selectSysCarVoList(null);
|
|
||||||
List<SysCarVo> sysCarVoList = sysCarVoListResult.getData();
|
|
||||||
//将全部信息存入redis中
|
|
||||||
for (SysCarVo sysCarVo : sysCarVoList) {
|
|
||||||
String carVin = sysCarVo.getCarVin();
|
|
||||||
redisTemplate.opsForValue().set("four:car:"+carVin,sysCarVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询车辆围栏组列表信息
|
|
||||||
Result<List<GroupFenceListresp>> groupListResult = remoteFenceService.selectGroupList(null);
|
|
||||||
List<GroupFenceListresp> groupFenceList = groupListResult.getData();
|
|
||||||
//将去全部信息存入redis中
|
|
||||||
for (GroupFenceListresp groupFenceListresp : groupFenceList) {
|
|
||||||
Long id = groupFenceListresp.getId();
|
|
||||||
redisTemplate.opsForValue().set("four:fenceGroup:"+id,groupFenceListresp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package com.muyu.data.util;
|
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|
||||||
|
|
||||||
public class Receive {
|
|
||||||
|
|
||||||
public static MqttClient mqttClient= null;
|
|
||||||
private static MemoryPersistence memoryPersistence=null;
|
|
||||||
private static MqttConnectOptions mqttConnectOptions=null;
|
|
||||||
|
|
||||||
private static String ClientName="";
|
|
||||||
|
|
||||||
private static String IP="";
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void start(String clientId){
|
|
||||||
//初始化连接设置对象
|
|
||||||
mqttConnectOptions = new MqttConnectOptions();
|
|
||||||
//设置是否情
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.muyu.data.util;
|
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
|
||||||
|
|
||||||
public class ReceiveTwo {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String topic = "vehicle";
|
|
||||||
String broker = "tcp://47.101.53.251:1883";
|
|
||||||
String clientId="lw";
|
|
||||||
|
|
||||||
try {
|
|
||||||
MqttClient mqttClient= new MqttClient(broker,clientId);
|
|
||||||
MqttConnectOptions connectOptions=new MqttConnectOptions();
|
|
||||||
connectOptions.setCleanSession(true);
|
|
||||||
System.out.println("Connecting to broker:" + broker);
|
|
||||||
mqttClient.connect(connectOptions);
|
|
||||||
System.out.println("已连接");
|
|
||||||
mqttClient.setCallback(new MqttCallback(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionLost(Throwable throwable) {
|
|
||||||
System.out.println("Connect lost!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
|
||||||
System.out.println("Message arrived. topic:"+topic);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mqttClient.subscribe(topic);
|
|
||||||
System.out.println("Subscribed to topic " + topic);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
System.out.println("reason "+e.getReasonCode());
|
|
||||||
System.out.println("msg " +e.getMessage());
|
|
||||||
System.out.println("loc " +e.getLocalizedMessage());
|
|
||||||
System.out.println("cause "+e.getCause());
|
|
||||||
System.out.println("excep "+e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 10003
|
|
||||||
# nacos线上地址
|
|
||||||
nacos:
|
|
||||||
addr: 47.101.53.251:8848
|
|
||||||
user-name: nacos
|
|
||||||
password: nacos
|
|
||||||
namespace: four
|
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
amqp:
|
|
||||||
deserialization:
|
|
||||||
trust:
|
|
||||||
all: true
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: cloud-data
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: ${nacos.addr}
|
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
|
||||||
namespace: ${nacos.namespace}
|
|
||||||
config:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: ${nacos.addr}
|
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
|
||||||
namespace: ${nacos.namespace}
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
# 系统共享配置
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
# 系统环境Config共享配置
|
|
||||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
# xxl-job 配置文件
|
|
||||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
# rabbit 配置文件
|
|
||||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
com.muyu.fence.mapper: DEBUG
|
|
|
@ -1,74 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/cloud-data"/>
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.muyu" level="info"/>
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn"/>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info"/>
|
|
||||||
<appender-ref ref="file_error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/cloud-data"/>
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
||||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
|
||||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
||||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
|
||||||
<Pattern>${log.sky.pattern}</Pattern>
|
|
||||||
</layout>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="GRPC_LOG"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.muyu" level="info"/>
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn"/>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info"/>
|
|
||||||
<appender-ref ref="file_error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
||||||
<!-- 日志存放路径 -->
|
|
||||||
<property name="log.path" value="logs/cloud-data"/>
|
|
||||||
<!-- 日志输出格式 -->
|
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
||||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
||||||
|
|
||||||
<!-- 控制台输出 -->
|
|
||||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 系统日志输出 -->
|
|
||||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/info.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>INFO</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.path}/error.log</file>
|
|
||||||
<!-- 循环政策:基于时间创建日志文件 -->
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- 日志文件名格式 -->
|
|
||||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
|
||||||
<!-- 日志最大的历史 60天 -->
|
|
||||||
<maxHistory>60</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>${log.pattern}</pattern>
|
|
||||||
</encoder>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
||||||
<!-- 过滤的级别 -->
|
|
||||||
<level>ERROR</level>
|
|
||||||
<!-- 匹配时的操作:接收(记录) -->
|
|
||||||
<onMatch>ACCEPT</onMatch>
|
|
||||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
|
||||||
<onMismatch>DENY</onMismatch>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- 使用gRpc将日志发送到skywalking服务端 -->
|
|
||||||
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
|
|
||||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
|
|
||||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
|
|
||||||
<Pattern>${log.sky.pattern}</Pattern>
|
|
||||||
</layout>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="GRPC_LOG"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!-- 系统模块日志级别控制 -->
|
|
||||||
<logger name="com.muyu" level="info"/>
|
|
||||||
<!-- Spring日志级别控制 -->
|
|
||||||
<logger name="org.springframework" level="warn"/>
|
|
||||||
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="console"/>
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<!--系统操作日志-->
|
|
||||||
<root level="info">
|
|
||||||
<appender-ref ref="file_info"/>
|
|
||||||
<appender-ref ref="file_error"/>
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
|
@ -42,8 +42,6 @@ public class SysCarFaultController extends BaseController
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出车辆故障管理列表
|
* 导出车辆故障管理列表
|
||||||
*/
|
*/
|
||||||
|
@ -74,13 +72,9 @@ public class SysCarFaultController extends BaseController
|
||||||
public Result<Integer> add(
|
public Result<Integer> add(
|
||||||
@Validated @RequestBody SysCarFault sysCarFault)
|
@Validated @RequestBody SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
//判断故障码是否重复
|
if (sysCarFaultService.checkIdUnique(sysCarFault)) {
|
||||||
SysCarFault selectFaultByFaultCode = sysCarFaultService.selectFaultByFaultCode(sysCarFault.getFaultCode());
|
return error("新增 车辆故障管理 ,失败,车辆故障码已存在");
|
||||||
if (selectFaultByFaultCode!=null){
|
|
||||||
return error("新增车辆故障 ,故障码已存在");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
sysCarFault.setCreateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(sysCarFaultService.save(sysCarFault));
|
return toAjax(sysCarFaultService.save(sysCarFault));
|
||||||
}
|
}
|
||||||
|
@ -94,7 +88,9 @@ public class SysCarFaultController extends BaseController
|
||||||
public Result<Integer> edit(
|
public Result<Integer> edit(
|
||||||
@Validated @RequestBody SysCarFault sysCarFault)
|
@Validated @RequestBody SysCarFault sysCarFault)
|
||||||
{
|
{
|
||||||
|
if (!sysCarFaultService.checkIdUnique(sysCarFault)) {
|
||||||
|
return error("修改 车辆故障管理 '" + sysCarFault + "'失败,车辆故障管理不存在");
|
||||||
|
}
|
||||||
sysCarFault.setUpdateBy(SecurityUtils.getUsername());
|
sysCarFault.setUpdateBy(SecurityUtils.getUsername());
|
||||||
return toAjax(sysCarFaultService.updateById(sysCarFault));
|
return toAjax(sysCarFaultService.updateById(sysCarFault));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.muyu.breakdown.controller;
|
package com.muyu.breakdown.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import com.muyu.breakdown.domain.SysCarFaultMessage;
|
import com.muyu.breakdown.domain.SysCarFaultMessage;
|
||||||
import com.muyu.breakdown.service.SysCarFaultMessageService;
|
import com.muyu.breakdown.service.SysCarFaultMessageService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
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;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -24,10 +25,6 @@ public class SysCarFaultMessageController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysCarFaultMessageService service;
|
private SysCarFaultMessageService service;
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有故障信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<SysCarFaultMessage>> list(){
|
public Result<TableDataInfo<SysCarFaultMessage>> list(){
|
||||||
startPage();
|
startPage();
|
||||||
|
@ -35,11 +32,6 @@ public class SysCarFaultMessageController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询状态为1的故障信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
|
|
||||||
@GetMapping("/listStatusOne")
|
@GetMapping("/listStatusOne")
|
||||||
public Result<TableDataInfo<SysCarFaultMessage>>listStatusOne(){
|
public Result<TableDataInfo<SysCarFaultMessage>>listStatusOne(){
|
||||||
startPage();
|
startPage();
|
||||||
|
@ -47,27 +39,10 @@ public class SysCarFaultMessageController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询状态为2的故障信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/listStatusTwo")
|
@GetMapping("/listStatusTwo")
|
||||||
public Result<TableDataInfo<SysCarFaultMessage>>listStatusTwo(){
|
public Result<TableDataInfo<SysCarFaultMessage>>listStatusTwo(){
|
||||||
startPage();
|
startPage();
|
||||||
List<SysCarFaultMessage> list = service.listStatusTwo();
|
List<SysCarFaultMessage> list = service.listStatusTwo();
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 修改未读站内信息为已读
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PutMapping("/updateStatusById/{id}")
|
|
||||||
public Result updateStatusById(@PathVariable("id")Long id){
|
|
||||||
UpdateWrapper<SysCarFaultMessage> wrapper = new UpdateWrapper<>();
|
|
||||||
wrapper.eq("id",id);
|
|
||||||
wrapper.set("status",1);
|
|
||||||
boolean update = service.update(wrapper);
|
|
||||||
return Result.success(update);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
package com.muyu.breakdown.controller;
|
package com.muyu.breakdown.controller;
|
||||||
|
|
||||||
import cn.hutool.http.server.HttpServerResponse;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import com.muyu.breakdown.domain.SysCarFaultLog;
|
import com.muyu.breakdown.domain.SysCarFaultLog;
|
||||||
import com.muyu.breakdown.service.SysCarFaultLogService;
|
import com.muyu.breakdown.service.SysCarFaultLogService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,28 +59,4 @@ public class sysCarFaultLogController extends BaseController {
|
||||||
return toAjax(service.save(sysCarFaultLog));
|
return toAjax(service.save(sysCarFaultLog));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, SysCarFaultLog sysCarFaultLog){
|
|
||||||
List<SysCarFaultLog> list = service.selectSysCarFaultLogList(sysCarFaultLog);
|
|
||||||
ExcelUtil<SysCarFaultLog> util = new ExcelUtil<SysCarFaultLog>(SysCarFaultLog.class);
|
|
||||||
util.exportExcel(response,list,"车辆故障记录数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改为忽略
|
|
||||||
* @param idsStr
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PutMapping("/updateStatusById/{ids}")
|
|
||||||
public Result updateStatusById(@PathVariable("ids")String idsStr){
|
|
||||||
Long[] ids = Arrays.stream(idsStr.split(","))
|
|
||||||
.map(Long::valueOf)
|
|
||||||
.toArray(Long[]::new);
|
|
||||||
UpdateWrapper<SysCarFaultLog> wrapper = new UpdateWrapper<>();
|
|
||||||
wrapper.in("id",ids).set("status",3);
|
|
||||||
boolean update = service.update(null, wrapper);
|
|
||||||
return Result.success(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,6 @@ public class SysCarFault extends BaseEntity{
|
||||||
@Excel(name = "是否警告(0.开启 1.禁止)")
|
@Excel(name = "是否警告(0.开启 1.禁止)")
|
||||||
private Integer warnStatus;
|
private Integer warnStatus;
|
||||||
|
|
||||||
/**车辆类型 */
|
|
||||||
@Excel(name = "车辆类型")
|
|
||||||
private Integer carTypeId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu.breakdown.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
@ -29,28 +28,19 @@ public class SysCarFaultLog extends BaseEntity {
|
||||||
/** 参数主键 */
|
/** 参数主键 */
|
||||||
@TableId( type = IdType.AUTO)
|
@TableId( type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 故障码编码 */
|
/** 故障码编码 */
|
||||||
|
|
||||||
private Integer sysCarFaultId;
|
private Integer sysCarFaultId;
|
||||||
@Excel(name = "故障码编码")
|
|
||||||
private String faultCode;
|
|
||||||
|
|
||||||
/**记录时间*/
|
/**记录时间*/
|
||||||
@Excel(name = "记录时间")
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/** 结束时间*/
|
/** 结束时间*/
|
||||||
@Excel(name = "结束时间")
|
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
/** VIN码 */
|
/** VIN码 */
|
||||||
@Excel(name = "VIN码")
|
|
||||||
private String vin;
|
private String vin;
|
||||||
|
|
||||||
/** 处理状态 1-解决 2-处理中 3-忽略 */
|
/** 处理状态 1-解决 2-处理中 3-忽略 */
|
||||||
@Excel(name = "处理状态 1-解决 2-处理中 3-忽略")
|
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
package com.muyu.breakdown.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassDescription:
|
|
||||||
* @JdkVersion: 1.8
|
|
||||||
* @Author: YZL
|
|
||||||
* @Created: 2024/9/26 19:54
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@TableName("sys_car_enterprise")
|
|
||||||
public class sysCarEnterprise extends BaseEntity {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 企业id*/
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 企业名称*/
|
|
||||||
@Excel(name = "企业名称")
|
|
||||||
private String enterpriseName;
|
|
||||||
/** 用户姓名 */
|
|
||||||
@Excel(name = "用户姓名")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Excel(name = "用户职位")
|
|
||||||
private String position;
|
|
||||||
|
|
||||||
@Excel(name = "公司所在省")
|
|
||||||
private String province;
|
|
||||||
|
|
||||||
@Excel(name = "公司所在市")
|
|
||||||
private String city;
|
|
||||||
|
|
||||||
@Excel(name = "公司所在县/区")
|
|
||||||
private String county;
|
|
||||||
|
|
||||||
@Excel(name = "公司详细地址")
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
@Excel(name = "统一社会信用代码")
|
|
||||||
private String creditCode;
|
|
||||||
|
|
||||||
@Excel(name = "营业执照")
|
|
||||||
private String businessLicense;
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,9 +3,6 @@ package com.muyu.breakdown.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.breakdown.domain.SysCarFault;
|
import com.muyu.breakdown.domain.SysCarFault;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassDescription: 车辆故障管理Mapper接口
|
* @ClassDescription: 车辆故障管理Mapper接口
|
||||||
|
@ -16,18 +13,4 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysCarFaultMapper extends BaseMapper<SysCarFault>{
|
public interface SysCarFaultMapper extends BaseMapper<SysCarFault>{
|
||||||
|
|
||||||
//根据添加的故障码进行查询
|
|
||||||
@Select("select fault_code from sys_car_fault where fault_code=#{faultCode}")
|
|
||||||
SysCarFault selectFaultByFaultCode(String faultCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障码信息
|
|
||||||
* @param ids 故障码信息主键
|
|
||||||
* @return 故障码信息
|
|
||||||
*/
|
|
||||||
public List<SysCarFault> selectSysCarFaultIds(String[] ids);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,14 +28,12 @@ public interface SysCarFaultService extends IService<SysCarFault> {
|
||||||
*/
|
*/
|
||||||
List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault);
|
List<SysCarFault> selectSysCarFaultList(SysCarFault sysCarFault);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断 车辆故障管理 faultCode(故障码)是否唯一
|
* 判断 车辆故障管理 id是否唯一
|
||||||
* @param faultCode 车辆故障管理
|
* @param sysCarFault 车辆故障管理
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
Boolean checkIdUnique(SysCarFault sysCarFault);
|
||||||
SysCarFault selectFaultByFaultCode(String faultCode);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,30 +20,17 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class SysCarFaultMessageServiceImpl extends ServiceImpl<SysCarFaultMessageMapper, SysCarFaultMessage> implements SysCarFaultMessageService {
|
public class SysCarFaultMessageServiceImpl extends ServiceImpl<SysCarFaultMessageMapper, SysCarFaultMessage> implements SysCarFaultMessageService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障消息列表
|
|
||||||
* @param sysCarFaultMessage
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultMessage> selectSysCarFaultMessageList(SysCarFaultMessage sysCarFaultMessage) {
|
public List<SysCarFaultMessage> selectSysCarFaultMessageList(SysCarFaultMessage sysCarFaultMessage) {
|
||||||
LambdaQueryWrapper<SysCarFaultMessage> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysCarFaultMessage> wrapper = new LambdaQueryWrapper<>();
|
||||||
return baseMapper.selectList(wrapper);
|
return baseMapper.selectList(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障消息列表中状态为1的故障消息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultMessage> listStatusOnt( ) {
|
public List<SysCarFaultMessage> listStatusOnt( ) {
|
||||||
return baseMapper.listStatusOnt();
|
return baseMapper.listStatusOnt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障消息列表中状态为2的故障消息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultMessage> listStatusTwo( ) {
|
public List<SysCarFaultMessage> listStatusTwo( ) {
|
||||||
return baseMapper.listStatusTwo();
|
return baseMapper.listStatusTwo();
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.muyu.breakdown.domain.SysCarFault;
|
||||||
import com.muyu.breakdown.mapper.SysCarFaultMapper;
|
import com.muyu.breakdown.mapper.SysCarFaultMapper;
|
||||||
import com.muyu.breakdown.service.SysCarFaultService;
|
import com.muyu.breakdown.service.SysCarFaultService;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
@ -23,9 +22,6 @@ public class SysCarFaultServiceImpl
|
||||||
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
||||||
implements SysCarFaultService {
|
implements SysCarFaultService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarFaultMapper mapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确查询车辆故障管理
|
* 精确查询车辆故障管理
|
||||||
*
|
*
|
||||||
|
@ -61,29 +57,25 @@ public class SysCarFaultServiceImpl
|
||||||
if (sysCarFault.getFaultRank()!=null){
|
if (sysCarFault.getFaultRank()!=null){
|
||||||
queryWrapper.eq(SysCarFault::getFaultRank, sysCarFault.getFaultRank());
|
queryWrapper.eq(SysCarFault::getFaultRank, sysCarFault.getFaultRank());
|
||||||
}
|
}
|
||||||
//故障码类型
|
|
||||||
if (sysCarFault.getTypeId()!=null){
|
if (sysCarFault.getTypeId()!=null){
|
||||||
queryWrapper.eq(SysCarFault::getTypeId,sysCarFault.getTypeId());
|
queryWrapper.eq(SysCarFault::getTypeId,sysCarFault.getTypeId());
|
||||||
}
|
}
|
||||||
//车辆类型查询
|
|
||||||
if (sysCarFault.getCarTypeId()!=null){
|
|
||||||
queryWrapper.eq(SysCarFault::getCarTypeId,sysCarFault.getTypeId());
|
|
||||||
}
|
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 唯一 判断
|
* 唯一 判断
|
||||||
* @param faultCode 车辆故障管理
|
* @param sysCarFault 车辆故障管理
|
||||||
* @return 车辆故障管理
|
* @return 车辆故障管理
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysCarFault selectFaultByFaultCode(String faultCode) {
|
public Boolean checkIdUnique(SysCarFault sysCarFault) {
|
||||||
return mapper.selectFaultByFaultCode(faultCode);
|
LambdaQueryWrapper<SysCarFault> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysCarFault::getId, sysCarFault.getId());
|
||||||
|
queryWrapper.eq(SysCarFault::getFaultCode,sysCarFault.getFaultCode());
|
||||||
|
return this.count(queryWrapper) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.muyu.breakdown.service.impl;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.breakdown.domain.SysCarFault;
|
|
||||||
import com.muyu.breakdown.domain.SysCarFaultLog;
|
import com.muyu.breakdown.domain.SysCarFaultLog;
|
||||||
import com.muyu.breakdown.domain.SysCarFaultLog;
|
import com.muyu.breakdown.domain.SysCarFaultLog;
|
||||||
import com.muyu.breakdown.mapper.SysCarFaultLogMapper;
|
import com.muyu.breakdown.mapper.SysCarFaultLogMapper;
|
||||||
|
@ -27,13 +26,17 @@ import java.util.List;
|
||||||
public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper, SysCarFaultLog> implements SysCarFaultLogService {
|
public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper, SysCarFaultLog> implements SysCarFaultLogService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarFaultLogMapper sysCarFaultLogMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultLog> selectSysCarFaultLogList(SysCarFaultLog sysCarFaultLog) {
|
public List<SysCarFaultLog> selectSysCarFaultLogList(SysCarFaultLog sysCarFaultLog) {
|
||||||
|
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
return sysCarFaultLogMapper.selectSysCarFaultLogList(sysCarFaultLog);
|
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
|
||||||
|
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
|
||||||
|
}
|
||||||
|
if (sysCarFaultLog.getStatus()!=null){
|
||||||
|
wrapper.eq(SysCarFaultLog::getStatus,sysCarFaultLog.getStatus());
|
||||||
|
}
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,8 +46,12 @@ public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultLog> listStatusIgnore(SysCarFaultLog sysCarFaultLog) {
|
public List<SysCarFaultLog> listStatusIgnore(SysCarFaultLog sysCarFaultLog) {
|
||||||
|
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
return sysCarFaultLogMapper.listStatusIgnore(sysCarFaultLog);
|
wrapper.eq(SysCarFaultLog::getStatus,3);
|
||||||
|
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
|
||||||
|
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
|
||||||
|
}
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,16 +61,24 @@ public class sysCarFaultLogServiceImpl extends ServiceImpl<SysCarFaultLogMapper,
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultLog> listStatusProcess(SysCarFaultLog sysCarFaultLog) {
|
public List<SysCarFaultLog> listStatusProcess(SysCarFaultLog sysCarFaultLog) {
|
||||||
|
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
return sysCarFaultLogMapper.listStatusProcess(sysCarFaultLog);
|
wrapper.eq(SysCarFaultLog::getStatus,2);
|
||||||
|
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
|
||||||
|
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
|
||||||
|
}
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
//只展示已解决的数据
|
//只展示已解决的数据
|
||||||
@Override
|
@Override
|
||||||
public List<SysCarFaultLog> listStatusSolve(SysCarFaultLog sysCarFaultLog) {
|
public List<SysCarFaultLog> listStatusSolve(SysCarFaultLog sysCarFaultLog) {
|
||||||
return sysCarFaultLogMapper.listStatusSolve(sysCarFaultLog);
|
LambdaQueryWrapper<SysCarFaultLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysCarFaultLog::getStatus,1);
|
||||||
|
if (StringUtils.isNotEmpty(sysCarFaultLog.getVin())){
|
||||||
|
wrapper.eq(SysCarFaultLog::getVin,sysCarFaultLog.getVin());
|
||||||
|
}
|
||||||
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +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.breakdown.mapper.SysCarFaultLogMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.muyu.breakdown.domain.SysCarFaultLog" id="SysCarFaultLogResult">
|
|
||||||
<result property="id" column="id" />
|
|
||||||
<result property="sysCarFaultId" column="sys_car_fault_id"/>
|
|
||||||
<result property="faultCode" column="fault_code"/>
|
|
||||||
<result property="vin" column="vin"/>
|
|
||||||
<result property="status" column="status" />
|
|
||||||
<result property="remark" column="remark" />
|
|
||||||
<result property="createBy" column="create_by" />
|
|
||||||
<result property="createTime" column="create_time" />
|
|
||||||
<result property="updateBy" column="update_by" />
|
|
||||||
<result property="updateTime" column="update_time" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectSysCarFaultLogVo">
|
|
||||||
SELECT fault.fault_code,log.update_time,log.create_time,log.vin,log.status FROM sys_car_fault_log log LEFT JOIN sys_car_fault fault on log.sys_car_fault_id=fault.id
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectSysCarFaultLogList" parameterType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
|
|
||||||
<include refid="selectSysCarFaultLogVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="faultCode != null and faultCode != ''"> and fault.fault_code = #{faultCode}</if>
|
|
||||||
<if test="vin != null and vin != ''"> and log.vin = #{vin}</if>
|
|
||||||
<if test="status != null "> and log.status = #{status}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="listStatusSolve" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
|
|
||||||
<include refid="selectSysCarFaultLogVo" />
|
|
||||||
<where>
|
|
||||||
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
|
|
||||||
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
|
|
||||||
and log.status=1
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="listStatusProcess" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
|
|
||||||
<include refid="selectSysCarFaultLogVo" />
|
|
||||||
<where>
|
|
||||||
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
|
|
||||||
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
|
|
||||||
and log.status=2
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="listStatusIgnore" resultType="com.muyu.breakdown.domain.SysCarFaultLog" resultMap="SysCarFaultLogResult">
|
|
||||||
<include refid="selectSysCarFaultLogVo" />
|
|
||||||
<where>
|
|
||||||
<if test="faultCode!=null and faultCode!=''">and fault.fault_code=#{faultCode}</if>
|
|
||||||
<if test="vin!=null and vin!=''">and log.vin=#{vin}</if>
|
|
||||||
and log.status=3
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<delete id="deleteSysCarFaultByIds" parameterType="String">
|
|
||||||
delete from sys_car_fault where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -23,11 +23,10 @@
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="carTypeId" column="car_type_id"/>
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSysCarFaultVo">
|
<sql id="selectSysCarFaultVo">
|
||||||
select id, fault_code, fault_name, type_id, fault_label, fault_bit, fault_value, fault_rank, fault_desc, fault_min_threshold, fault_max_threshold, status, warn_status, remark, create_by, create_time, update_by, update_time,car_type_id from sys_car_fault
|
select id, fault_code, fault_name, type_id, fault_label, fault_bit, fault_value, fault_rank, fault_desc, fault_min_threshold, fault_max_threshold, status, warn_status, remark, create_by, create_time, update_by, update_time from sys_car_fault
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSysCarFaultList" parameterType="com.muyu.breakdown.domain.SysCarFault" resultMap="SysCarFaultResult">
|
<select id="selectSysCarFaultList" parameterType="com.muyu.breakdown.domain.SysCarFault" resultMap="SysCarFaultResult">
|
||||||
|
@ -43,13 +42,6 @@
|
||||||
<include refid="selectSysCarFaultVo"/>
|
<include refid="selectSysCarFaultVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectSysCarFaultIds" resultMap="SysCarFaultResult">
|
|
||||||
<include refid="selectSysCarFaultVo"/>
|
|
||||||
where id in
|
|
||||||
<foreach collection="array" item="id" index="index" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertSysCarFault" parameterType="com.muyu.breakdown.domain.SysCarFault" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertSysCarFault" parameterType="com.muyu.breakdown.domain.SysCarFault" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into sys_car_fault
|
insert into sys_car_fault
|
||||||
|
@ -71,7 +63,6 @@
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="carTypeId !=null">car_type_id</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="faultCode != null and faultCode != ''">#{faultCode},</if>
|
<if test="faultCode != null and faultCode != ''">#{faultCode},</if>
|
||||||
|
@ -91,7 +82,6 @@
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="carTypeId != null">#{catTypeId}</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -115,7 +105,6 @@
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="carTypeId !=null">car_type_id=#{catTypeId}</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
|
@ -80,11 +80,6 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-saas</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,5 @@ public class SysCar extends BaseEntity {
|
||||||
private String carBatteryManufacturer;
|
private String carBatteryManufacturer;
|
||||||
private String carBatteryModel;
|
private String carBatteryModel;
|
||||||
private Long strategyId;
|
private Long strategyId;
|
||||||
private Long groupId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,7 @@ public class SysCarVo extends SysCar {
|
||||||
@Excel(name = "车辆类型名称")
|
@Excel(name = "车辆类型名称")
|
||||||
private String typeName;
|
private String typeName;
|
||||||
@Excel(name = "策略名称")
|
@Excel(name = "策略名称")
|
||||||
private String strategyName;
|
private Long strategyName;
|
||||||
@Excel(name = "围栏组名称")
|
|
||||||
private String groupName;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,4 @@ public interface SysCarMapper extends BaseMapper<SysCar> {
|
||||||
|
|
||||||
List<SysCarFaultLogVo> findFenceByCarVin(@Param("carVin") String carVin);
|
List<SysCarFaultLogVo> findFenceByCarVin(@Param("carVin") String carVin);
|
||||||
|
|
||||||
//修改车辆
|
|
||||||
Integer updSysCarById(SysCar sysCar);
|
|
||||||
|
|
||||||
//添加车辆信息
|
|
||||||
Integer addSysCar(SysCar sysCar);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class SysCarServiceImpl extends ServiceImpl<SysCarMapper,SysCar> impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addSysCar(SysCar sysCar) {
|
public int addSysCar(SysCar sysCar) {
|
||||||
return sysCarMapper.addSysCar(sysCar);
|
return sysCarMapper.insert(sysCar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,7 +40,7 @@ public class SysCarServiceImpl extends ServiceImpl<SysCarMapper,SysCar> impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateSysCar(SysCar sysCar) {
|
public int updateSysCar(SysCar sysCar) {
|
||||||
return sysCarMapper.updSysCarById(sysCar);
|
return sysCarMapper.updateById(sysCar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.53.251:8848
|
addr: 47.101.53.251:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: yzl
|
namespace: lgy
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -3,36 +3,11 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.muyu.mapper.SysCarMapper">
|
<mapper namespace="com.muyu.mapper.SysCarMapper">
|
||||||
<insert id="addSysCar">
|
|
||||||
INSERT INTO `four`.`sys_car`
|
|
||||||
( `car_vin`, `car_type_id`, `state`, `car_motor_manufacturer`, `car_motor_model`,
|
|
||||||
`car_battery_manufacturer`, `car_battery_model`, `strategy_id`,`group_id`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`,)
|
|
||||||
VALUES (#{carVin}, #{carTypeId}, '1', #{carMotorManufacturer}, #{carMotorModel},
|
|
||||||
#{carBatteryManufacturer}, #{carBatteryModel}, #{strategyId},#{groupId},#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark})
|
|
||||||
</insert>
|
|
||||||
<update id="updSysCarById">
|
|
||||||
UPDATE `four`.`sys_car`
|
|
||||||
SET `car_vin` = #{carVin},
|
|
||||||
`car_type_id` = #{carTypeId},
|
|
||||||
`state` = #{state},
|
|
||||||
`car_motor_manufacturer` = #{carMotorManufacturer},
|
|
||||||
`car_motor_model` = #{carMotorModel},
|
|
||||||
`car_battery_manufacturer` = #{carBatteryManufacturer},
|
|
||||||
`car_battery_model` = #{carBatteryModel},
|
|
||||||
`strategy_id` = #{strategyId},
|
|
||||||
`group_id`=#{groupId}
|
|
||||||
`create_by` = #{createBy},
|
|
||||||
`create_time` = #{createTime},
|
|
||||||
`update_by` = #{updateBy},
|
|
||||||
`update_time` = #{updateTime},
|
|
||||||
`remark` = #{remark} WHERE `id` = #{id}
|
|
||||||
</update>
|
|
||||||
<select id="selectSysCarVoList" resultType="com.muyu.domain.resp.SysCarVo">
|
<select id="selectSysCarVoList" resultType="com.muyu.domain.resp.SysCarVo">
|
||||||
SELECT * ,car_type.type_name,warn_strategy.strategy_name,electronic_fence_group.group_name
|
SELECT * ,car_type.type_name,warn_strategy.strategy_name
|
||||||
FROM `sys_car`
|
FROM `sys_car`
|
||||||
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
|
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
|
||||||
LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
|
LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
|
||||||
LEFT JOIN electronic_fence_group ON sys_car.group_id=electronic_fence_group.id
|
|
||||||
<where>
|
<where>
|
||||||
<if test="carVin!=null and carVin!=''">
|
<if test="carVin!=null and carVin!=''">
|
||||||
sys_car.car_vin=#{carVin}
|
sys_car.car_vin=#{carVin}
|
||||||
|
@ -57,11 +32,10 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="selectSysCarVoById" resultType="com.muyu.domain.resp.SysCarVo">
|
<select id="selectSysCarVoById" resultType="com.muyu.domain.resp.SysCarVo">
|
||||||
SELECT * ,car_type.type_name,warn_strategy.strategy_name,electronic_fence_group.group_name
|
SELECT * ,car_type.type_name,warn_strategy.strategy_name
|
||||||
FROM `sys_car`
|
FROM `sys_car`
|
||||||
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
|
LEFT JOIN car_type ON sys_car.car_type_id=car_type.id
|
||||||
LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
|
LEFT JOIN warn_strategy ON sys_car.strategy_id=warn_strategy.id
|
||||||
LEFT JOIN electronic_fence_group ON sys_car.group_id=electronic_fence_group.id
|
|
||||||
where sys_car.id=#{id}
|
where sys_car.id=#{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo">
|
<select id="findFenceByCarVin" resultType="com.muyu.domain.resp.SysCarFaultLogVo">
|
||||||
|
|
|
@ -82,12 +82,6 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-rabbit</artifactId>
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-common-saas</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
package com.muyu.fence;
|
package com.muyu.fence;
|
||||||
|
|
||||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统模块
|
* 系统模块
|
||||||
|
@ -17,12 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
//@EnableCustomSwagger2
|
//@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication
|
||||||
DataSourceAutoConfiguration.class,
|
|
||||||
DruidDataSourceAutoConfigure.class,
|
|
||||||
DynamicDataSourceAutoConfiguration.class
|
|
||||||
})
|
|
||||||
|
|
||||||
public class CloudElectronicFenceApplication {
|
public class CloudElectronicFenceApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudElectronicFenceApplication.class, args);
|
SpringApplication.run(CloudElectronicFenceApplication.class, args);
|
||||||
|
|
|
@ -20,8 +20,6 @@ import java.util.Date;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class ElectroicFenceListReq {
|
public class ElectroicFenceListReq {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 围栏名称
|
* 围栏名称
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,7 +6,7 @@ nacos:
|
||||||
addr: 47.101.53.251:8848
|
addr: 47.101.53.251:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: yzl
|
namespace: lgy
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -59,18 +59,6 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
|
||||||
<version>1.2.23</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
|
||||||
<version>4.3.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,15 @@
|
||||||
package com.muyu.file;
|
package com.muyu.file;
|
||||||
|
|
||||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件服务
|
* 文件服务
|
||||||
*
|
*
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication(exclude = {
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||||
DataSourceAutoConfiguration.class,
|
|
||||||
DruidDataSourceAutoConfigure.class,
|
|
||||||
DynamicDataSourceAutoConfiguration.class
|
|
||||||
})
|
|
||||||
@EnableFeignClients
|
|
||||||
public class CloudFileApplication {
|
public class CloudFileApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudFileApplication.class, args);
|
SpringApplication.run(CloudFileApplication.class, args);
|
||||||
|
|
|
@ -78,8 +78,6 @@
|
||||||
<artifactId>cloud-common-xxl</artifactId>
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.muyu.system;
|
package com.muyu.system;
|
||||||
|
|
||||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
@ -18,7 +17,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class CloudSystemApplication {
|
public class CloudSystemApplication {
|
||||||
public static void main(String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudSystemApplication.class, args);
|
SpringApplication.run(CloudSystemApplication.class, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.service.TokenService;
|
import com.muyu.common.security.service.TokenService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.Firm;
|
|
||||||
import com.muyu.common.system.remote.RemoteFileService;
|
import com.muyu.common.system.remote.RemoteFileService;
|
||||||
import com.muyu.common.system.domain.SysFile;
|
import com.muyu.common.system.domain.SysFile;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
@ -45,7 +44,7 @@ public class SysProfileController extends BaseController {
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public Result profile () {
|
public Result profile () {
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
SysUser user = userService.selectUserByName(username);
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
return Result.success(
|
return Result.success(
|
||||||
ProfileResp.builder()
|
ProfileResp.builder()
|
||||||
.roleGroup( userService.selectUserRoleGroup(username) )
|
.roleGroup( userService.selectUserRoleGroup(username) )
|
||||||
|
@ -88,8 +87,7 @@ public class SysProfileController extends BaseController {
|
||||||
@PutMapping("/updatePwd")
|
@PutMapping("/updatePwd")
|
||||||
public Result updatePwd (String oldPassword, String newPassword) {
|
public Result updatePwd (String oldPassword, String newPassword) {
|
||||||
String username = SecurityUtils.getUsername();
|
String username = SecurityUtils.getUsername();
|
||||||
|
SysUser user = userService.selectUserByUserName(username);
|
||||||
SysUser user = userService.selectUserByName(username);
|
|
||||||
String password = user.getPassword();
|
String password = user.getPassword();
|
||||||
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
|
||||||
return error("修改密码失败,旧密码错误");
|
return error("修改密码失败,旧密码错误");
|
||||||
|
|
|
@ -10,7 +10,10 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.InnerAuth;
|
import com.muyu.common.security.annotation.InnerAuth;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.*;
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysRole;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.system.domain.resp.AuthRoleResp;
|
import com.muyu.system.domain.resp.AuthRoleResp;
|
||||||
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
import com.muyu.system.domain.resp.UserDetailInfoResp;
|
||||||
import com.muyu.system.domain.resp.UserInfoResp;
|
import com.muyu.system.domain.resp.UserInfoResp;
|
||||||
|
@ -100,9 +103,9 @@ public class SysUserController extends BaseController {
|
||||||
* 获取当前用户信息
|
* 获取当前用户信息
|
||||||
*/
|
*/
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
@PostMapping("/info")
|
@GetMapping("/info/{username}")
|
||||||
public Result<LoginUser> info (@RequestBody Firm firm) {
|
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||||
SysUser sysUser = userService.selectUserByUserName(firm);
|
SysUser sysUser = userService.selectUserByUserName(username);
|
||||||
if (StringUtils.isNull(sysUser)) {
|
if (StringUtils.isNull(sysUser)) {
|
||||||
return Result.error("用户名或密码错误");
|
return Result.error("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.bean.BeanValidators;
|
import com.muyu.common.core.utils.bean.BeanValidators;
|
||||||
import com.muyu.common.datascope.annotation.DataScope;
|
import com.muyu.common.datascope.annotation.DataScope;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.Firm;
|
|
||||||
import com.muyu.common.system.domain.SysDept;
|
|
||||||
import com.muyu.common.system.domain.SysRole;
|
import com.muyu.common.system.domain.SysRole;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.domain.SysPost;
|
import com.muyu.system.domain.SysPost;
|
||||||
|
@ -26,7 +24,6 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -96,112 +93,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户
|
* 通过用户名查询用户
|
||||||
*
|
*
|
||||||
* @param
|
* @param userName 用户名
|
||||||
*
|
*
|
||||||
* @return 用户对象信息
|
* @return 用户对象信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysUser selectUserByUserName (Firm firm) {
|
public SysUser selectUserByUserName (String userName) {
|
||||||
String databaseName = firm.getDatabaseName();
|
return userMapper.selectUserByUserName(userName);
|
||||||
String userName = firm.getUserName();
|
|
||||||
|
|
||||||
String user="root";
|
|
||||||
String password="Lw030106";
|
|
||||||
SysUser sysUser=new SysUser();
|
|
||||||
|
|
||||||
try {
|
|
||||||
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
|
|
||||||
Connection connection = DriverManager.getConnection("jdbc:mysql://47.101.53.251:3306/"+databaseName+"?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&useSSL=false", user, password);
|
|
||||||
String sql="select u.user_id,\n" +
|
|
||||||
" u.dept_id,\n" +
|
|
||||||
" u.user_name,\n" +
|
|
||||||
" u.nick_name,\n" +
|
|
||||||
" u.email,\n" +
|
|
||||||
" u.avatar,\n" +
|
|
||||||
" u.phonenumber,\n" +
|
|
||||||
" u.password,\n" +
|
|
||||||
" u.sex,\n" +
|
|
||||||
" u.status,\n" +
|
|
||||||
" u.database_name,\n" +
|
|
||||||
" u.del_flag,\n" +
|
|
||||||
" u.login_ip,\n" +
|
|
||||||
" u.login_date,\n" +
|
|
||||||
" u.create_by,\n" +
|
|
||||||
" u.create_time,\n" +
|
|
||||||
" u.remark,\n" +
|
|
||||||
" d.dept_id,\n" +
|
|
||||||
" d.parent_id,\n" +
|
|
||||||
" d.ancestors,\n" +
|
|
||||||
" d.dept_name,\n" +
|
|
||||||
" d.order_num,\n" +
|
|
||||||
" d.leader,\n" +
|
|
||||||
" d.status as dept_status,\n" +
|
|
||||||
" r.role_id,\n" +
|
|
||||||
" r.role_name,\n" +
|
|
||||||
" r.role_key,\n" +
|
|
||||||
" r.role_sort,\n" +
|
|
||||||
" r.data_scope,\n" +
|
|
||||||
" r.status as role_status " +
|
|
||||||
" from sys_user u\n" +
|
|
||||||
" left join sys_dept d on u.dept_id = d.dept_id\n" +
|
|
||||||
" left join sys_user_role ur on u.user_id = ur.user_id\n" +
|
|
||||||
" left join sys_role r on r.role_id = ur.role_id" +
|
|
||||||
" where u.del_flag = '0' and u.user_name = '"+userName+"'";
|
|
||||||
|
|
||||||
Statement stmt = connection.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
|
||||||
|
|
||||||
while (rs.next()){
|
|
||||||
sysUser.setUserId(rs.getLong("user_id"));
|
|
||||||
sysUser.setDeptId(rs.getLong("dept_id"));
|
|
||||||
sysUser.setUserName(rs.getString("user_name"));
|
|
||||||
sysUser.setNickName(rs.getString("nick_name"));
|
|
||||||
sysUser.setEmail(rs.getString("email"));
|
|
||||||
sysUser.setAvatar(rs.getString("avatar"));
|
|
||||||
sysUser.setPhonenumber(rs.getString("phonenumber"));
|
|
||||||
sysUser.setPassword(rs.getString("password"));
|
|
||||||
sysUser.setSex(rs.getString("sex"));
|
|
||||||
sysUser.setStatus(rs.getString("status"));
|
|
||||||
sysUser.setDatabaseName(rs.getString("database_name"));
|
|
||||||
sysUser.setDelFlag(rs.getString("del_flag"));
|
|
||||||
sysUser.setLoginIp(rs.getString("login_ip"));
|
|
||||||
sysUser.setLoginDate(rs.getDate("login_date"));
|
|
||||||
sysUser.setCreateBy(rs.getString("create_by"));
|
|
||||||
sysUser.setCreateTime(rs.getDate("create_time"));
|
|
||||||
|
|
||||||
|
|
||||||
SysDept sysDept = new SysDept();
|
|
||||||
|
|
||||||
sysDept.setDeptId(rs.getLong("dept_id"));
|
|
||||||
sysDept.setParentId(rs.getLong("parent_id"));
|
|
||||||
sysDept.setAncestors(rs.getString("ancestors"));
|
|
||||||
sysDept.setDeptName(rs.getString("dept_name"));
|
|
||||||
sysDept.setOrderNum(rs.getInt("order_num"));
|
|
||||||
sysDept.setLeader(rs.getString("leader"));
|
|
||||||
sysDept.setStatus(rs.getString("dept_status"));
|
|
||||||
sysUser.setDept(sysDept);
|
|
||||||
|
|
||||||
SysRole sysRole = new SysRole();
|
|
||||||
|
|
||||||
sysRole.setRoleId(rs.getLong("role_id"));
|
|
||||||
sysRole.setRoleName(rs.getString("role_name"));
|
|
||||||
sysRole.setRoleKey(rs.getString("role_key"));
|
|
||||||
sysRole.setRoleSort(rs.getInt("role_sort"));
|
|
||||||
sysRole.setDataScope(rs.getString("data_scope"));
|
|
||||||
sysRole.setStatus(rs.getString("role_status"));
|
|
||||||
|
|
||||||
ArrayList<SysRole> sysRoles = new ArrayList<>();
|
|
||||||
sysRoles.add(sysRole);
|
|
||||||
sysUser.setRoles(sysRoles);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return sysUser;
|
|
||||||
// return userMapper.selectUserByUserName(userName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -608,9 +506,4 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
return userMapper.selectCompanyList();
|
return userMapper.selectCompanyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysUser selectUserByName(String username) {
|
|
||||||
return userMapper.selectUserByUserName(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,6 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
|
||||||
<!--mqtt依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.integration</groupId>
|
|
||||||
<artifactId>spring-integration-mqtt</artifactId>
|
|
||||||
<version>6.2.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.template.controller;
|
|
||||||
|
|
||||||
import com.template.service.MqttService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.controller
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:MqttController
|
|
||||||
* @Date:2024/9/26 15:44
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/mqtt")
|
|
||||||
public class MqttController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MqttService mqttService;
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/connectionMqtt")
|
|
||||||
public void connectionMqtt(@RequestParam("message") String message) throws MqttException {
|
|
||||||
mqttService.connectionMqtt(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.template.controller;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.controller
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ServiceController
|
||||||
|
* @Date:2024/9/22 22:12
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
public class ServiceController {
|
||||||
|
|
||||||
|
private final String IOTDB_DRIVER="org.apache.iotdb.jdbc.IoTDBDriver";
|
||||||
|
private static final String url="jdbc:iotdb://47.116.173.119:6667/";
|
||||||
|
private static final String userName="root";
|
||||||
|
private static final String passWord="root";
|
||||||
|
|
||||||
|
public void ToIoTDB(String url, String userName, String passWord){
|
||||||
|
log.info("Connecting to IoTDB");
|
||||||
|
log.info("地址是:"+url);
|
||||||
|
log.info("用户名是:"+userName);
|
||||||
|
log.info("密码是:"+passWord);
|
||||||
|
log.info("红红火火恍恍惚惚");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try{
|
||||||
|
Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
|
||||||
|
DriverManager.getConnection(url,userName,passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createConnection() throws ClassNotFoundException, SQLException {
|
||||||
|
|
||||||
|
try{
|
||||||
|
Class.forName(IOTDB_DRIVER);
|
||||||
|
DriverManager.getConnection(url,userName,passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
|
@ -46,7 +45,7 @@ public class TemplateController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/messageParsing")
|
@PostMapping("/messageParsing")
|
||||||
public Result messageParsing(@RequestParam("templateMessage") String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException, ExecutionException, InterruptedException {
|
public Result messageParsing(@RequestParam("templateMessage") String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException {
|
||||||
templateService.messageParsing(templateMessage);
|
templateService.messageParsing(templateMessage);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.template.domain.resp;
|
|
||||||
|
|
||||||
import com.template.domain.CarType;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.domain.resp
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:CarTypeResp
|
|
||||||
* @Date:2024/9/25 22:09
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class CarTypeResp extends CarType{
|
|
||||||
|
|
||||||
private String templateName;
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,12 +2,9 @@ package com.template.mapper;
|
||||||
|
|
||||||
import com.template.domain.CarType;
|
import com.template.domain.CarType;
|
||||||
import com.template.domain.SysCar;
|
import com.template.domain.SysCar;
|
||||||
import com.template.domain.resp.CarTypeResp;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
* @Package:com.template.mapper
|
* @Package:com.template.mapper
|
||||||
|
@ -22,5 +19,4 @@ public interface CarMapper {
|
||||||
|
|
||||||
CarType carMapper(@Param("carTypeId") Long carTypeId);
|
CarType carMapper(@Param("carTypeId") Long carTypeId);
|
||||||
|
|
||||||
List<CarTypeResp> findAllCars();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.template.mapper;
|
package com.template.mapper;
|
||||||
|
|
||||||
import com.template.domain.MessageTemplateType;
|
|
||||||
import com.template.domain.Template;
|
import com.template.domain.Template;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
@ -21,6 +20,4 @@ public interface TemplateMapper {
|
||||||
|
|
||||||
Template findTemplateByName(@Param("typeName") String typeName);
|
Template findTemplateByName(@Param("typeName") String typeName);
|
||||||
|
|
||||||
List<MessageTemplateType> findTemplateById(@Param("templateId") Integer templateId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,6 @@ package com.template.service;
|
||||||
|
|
||||||
import com.template.domain.CarType;
|
import com.template.domain.CarType;
|
||||||
import com.template.domain.SysCar;
|
import com.template.domain.SysCar;
|
||||||
import com.template.domain.resp.CarTypeResp;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
|
@ -18,7 +15,4 @@ public interface CarService {
|
||||||
|
|
||||||
CarType findCarTypeById(Long carTypeId);
|
CarType findCarTypeById(Long carTypeId);
|
||||||
|
|
||||||
List<CarTypeResp> findAllCars();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.template.service;
|
|
||||||
|
|
||||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.service
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:MqttService
|
|
||||||
* @Date:2024/9/26 15:57
|
|
||||||
*/
|
|
||||||
public interface MqttService {
|
|
||||||
|
|
||||||
void connectionMqtt(String message) throws MqttException;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +1,11 @@
|
||||||
package com.template.service;
|
package com.template.service;
|
||||||
|
|
||||||
import com.template.domain.MessageTemplateType;
|
|
||||||
import com.template.domain.Template;
|
import com.template.domain.Template;
|
||||||
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
||||||
import org.apache.iotdb.rpc.StatementExecutionException;
|
import org.apache.iotdb.rpc.StatementExecutionException;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
|
@ -20,8 +18,6 @@ public interface TemplateService {
|
||||||
List<Template> templateList();
|
List<Template> templateList();
|
||||||
|
|
||||||
|
|
||||||
void messageParsing(String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException, ExecutionException, InterruptedException;
|
void messageParsing(String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException;
|
||||||
|
|
||||||
List<MessageTemplateType> findTemplateById(Integer templateId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,11 @@ package com.template.service.impl;
|
||||||
|
|
||||||
import com.template.domain.CarType;
|
import com.template.domain.CarType;
|
||||||
import com.template.domain.SysCar;
|
import com.template.domain.SysCar;
|
||||||
import com.template.domain.resp.CarTypeResp;
|
|
||||||
import com.template.mapper.CarMapper;
|
import com.template.mapper.CarMapper;
|
||||||
import com.template.service.CarService;
|
import com.template.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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
* @Package:com.template.service.impl
|
* @Package:com.template.service.impl
|
||||||
|
@ -34,10 +31,4 @@ public class CarServiceImpl implements CarService {
|
||||||
return carMapper.carMapper(carTypeId);
|
return carMapper.carMapper(carTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<CarTypeResp> findAllCars() {
|
|
||||||
return carMapper.findAllCars();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.template.service.impl;
|
|
||||||
|
|
||||||
import com.template.service.MqttService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
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.MqttMessage;
|
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.service.impl
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:MqttServiceImpl
|
|
||||||
* @Date:2024/9/26 15:58
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
@Service
|
|
||||||
public class MqttServiceImpl implements MqttService{
|
|
||||||
|
|
||||||
String topic = "vehicle";
|
|
||||||
String content = "Message from MqttPublishSample";
|
|
||||||
int qos = 2;
|
|
||||||
String broker = "tcp://47.101.53.251:1883";
|
|
||||||
String clientId = "javaLxy";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionMqtt(String message) throws MqttException {
|
|
||||||
|
|
||||||
MqttClient mqttClient = new MqttClient(broker, clientId);
|
|
||||||
MqttConnectOptions connectOptions = new MqttConnectOptions();
|
|
||||||
//清理缓存
|
|
||||||
connectOptions.setCleanSession(true);
|
|
||||||
//连接
|
|
||||||
mqttClient.connect(connectOptions);
|
|
||||||
|
|
||||||
MqttMessage mqttMessage = new MqttMessage(message.getBytes());
|
|
||||||
|
|
||||||
mqttMessage.setQos(qos);
|
|
||||||
|
|
||||||
mqttClient.publish(topic, mqttMessage);
|
|
||||||
|
|
||||||
log.info("发送成功");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +1,24 @@
|
||||||
package com.template.service.impl;
|
package com.template.service.impl;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.template.domain.*;
|
import com.template.domain.*;
|
||||||
import com.template.mapper.TemplateMapper;
|
import com.template.mapper.TemplateMapper;
|
||||||
import com.template.service.CarService;
|
import com.template.service.CarService;
|
||||||
import com.template.service.MessageTemplateTypeService;
|
import com.template.service.MessageTemplateTypeService;
|
||||||
import com.template.service.TemplateService;
|
import com.template.service.TemplateService;
|
||||||
|
import com.template.util.ToIoTDB;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
||||||
import org.apache.iotdb.rpc.StatementExecutionException;
|
import org.apache.iotdb.rpc.StatementExecutionException;
|
||||||
|
import org.apache.iotdb.session.Session;
|
||||||
|
import org.apache.iotdb.session.SessionDataSet;
|
||||||
|
import org.apache.iotdb.session.util.Version;
|
||||||
|
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
/**
|
/**
|
||||||
* @Author:liuxinyue
|
* @Author:liuxinyue
|
||||||
* @Package:com.template.service.impl
|
* @Package:com.template.service.impl
|
||||||
|
@ -27,7 +31,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
public class TemplateServiceImpl implements TemplateService{
|
public class TemplateServiceImpl implements TemplateService{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private static TemplateMapper templateMapper;
|
private TemplateMapper templateMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarService carService;
|
private CarService carService;
|
||||||
|
@ -36,7 +40,7 @@ public class TemplateServiceImpl implements TemplateService{
|
||||||
private MessageTemplateTypeService messageTemplateTypeService;
|
private MessageTemplateTypeService messageTemplateTypeService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate redisTemplate;
|
private ToIoTDB toIoTDB;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Template> templateList() {
|
public List<Template> templateList() {
|
||||||
|
@ -44,50 +48,102 @@ public class TemplateServiceImpl implements TemplateService{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void messageParsing(String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException, ExecutionException, InterruptedException {
|
public void messageParsing(String templateMessage) throws SQLException, IoTDBConnectionException, ClassNotFoundException, StatementExecutionException {
|
||||||
|
//给一个JSON对象
|
||||||
List<MessageTemplateType> templateList = templateMapper.findTemplateById(1);
|
JSONObject jsonObject = new JSONObject();
|
||||||
String[] split = templateMessage.split(" ");
|
//先截取出VIN码 然后根据VIN码查询这个车属于什么类型
|
||||||
String[] strings = new String[split.length];
|
if(templateMessage.length()<18){
|
||||||
|
throw new RuntimeException("The vehicle message is incorrect");
|
||||||
List<CompletableFuture<String>> futures = new ArrayList<>();
|
|
||||||
for (MessageTemplateType templateType : templateList) {
|
|
||||||
|
|
||||||
futures.add(CompletableFuture.supplyAsync(() -> {
|
|
||||||
int startIndex = Integer.parseInt(String.valueOf(templateType.getStartIndex())) - 1;
|
|
||||||
int endIndex = Integer.parseInt(String.valueOf(templateType.getEndIndex()));
|
|
||||||
StringBuilder hexBuilder = new StringBuilder();
|
|
||||||
for (int j = startIndex; j < endIndex; j++) {
|
|
||||||
hexBuilder.append(split[j]);
|
|
||||||
}
|
|
||||||
// 创建16进制的对象
|
|
||||||
String hex = hexBuilder.toString();
|
|
||||||
// 转橙字符数组
|
|
||||||
char[] result = new char[hex.length() / 2];
|
|
||||||
for (int x = 0; x < hex.length(); x += 2) {
|
|
||||||
// 先转十进制
|
|
||||||
int high = Character.digit(hex.charAt(x), 16);
|
|
||||||
// 转二进制
|
|
||||||
int low = Character.digit(hex.charAt(x + 1), 16);
|
|
||||||
// 转字符
|
|
||||||
result[x / 2] = (char) ((high << 4) + low);
|
|
||||||
}
|
|
||||||
return new String(result);
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
//将报文进行切割
|
||||||
for (int i = 0; i < futures.size(); i++) {
|
String[] hexArray = templateMessage.split(" ");
|
||||||
strings[i] = futures.get(i).get();
|
StringBuilder result = new StringBuilder();
|
||||||
|
for (String hex : hexArray) {
|
||||||
|
int decimal = Integer.parseInt(hex, 16);
|
||||||
|
result.append((char) decimal);
|
||||||
}
|
}
|
||||||
|
//取出VIN码
|
||||||
|
String carVin = result.substring(0, 18-1);
|
||||||
|
log.info("carVin码为:"+carVin);
|
||||||
|
//根据VIN码获取车辆信息
|
||||||
|
SysCar carByVin = carService.findCarByVin(carVin);
|
||||||
|
if(carByVin==null){
|
||||||
|
throw new RuntimeException("Check this car!!");
|
||||||
|
}else{
|
||||||
|
//根据车辆类型ID获取车辆类型名称
|
||||||
|
CarType carTypeById = carService.findCarTypeById(carByVin.getCarTypeId());
|
||||||
|
//查询报文模版
|
||||||
|
Template templateDate=templateMapper.findTemplateByName(carTypeById.getTypeName());
|
||||||
|
//根据报文模版的ID查询对应的模版
|
||||||
|
List<MessageTemplateType> messageByTemplateName = messageTemplateTypeService.findMessageByTemplateName(templateDate.getTemplateId());
|
||||||
|
//将模版里面有的配置进行循环
|
||||||
|
for (MessageTemplateType messageTemplateType : messageByTemplateName) {
|
||||||
|
//开始位置
|
||||||
|
Integer startIndex = messageTemplateType.getStartIndex();
|
||||||
|
//结束位置
|
||||||
|
Integer endIndex = messageTemplateType.getEndIndex();
|
||||||
|
//将每个解析后的字段都存入到JSON对象中
|
||||||
|
jsonObject.put(messageTemplateType.getMessageField(), result.substring(startIndex, endIndex-1));
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈");
|
log.info("解析后的报文是:"+jsonObject);
|
||||||
log.info("结果是:"+strings);
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MessageTemplateType> findTemplateById(Integer templateId) {
|
|
||||||
return templateMapper.findTemplateById(templateId);
|
public void insertIoTDB(JSONObject jsonObject) throws SQLException, ClassNotFoundException, IoTDBConnectionException, StatementExecutionException {
|
||||||
|
|
||||||
|
System.out.println("Hello IoTDB Java Example");
|
||||||
|
//初始化与连接
|
||||||
|
Session session = new Session.Builder()
|
||||||
|
.host("47.116.173.119")
|
||||||
|
.port(6667)
|
||||||
|
.username("root")
|
||||||
|
.password("root")
|
||||||
|
.version(Version.V_0_12)
|
||||||
|
.build();
|
||||||
|
//开启Session RPC不压缩
|
||||||
|
session.open(false);
|
||||||
|
session.open(false);
|
||||||
|
log.info("写入数据");
|
||||||
|
//写入数据
|
||||||
|
List<Object> values = new ArrayList<>();
|
||||||
|
values.add(jsonObject);
|
||||||
|
insertRecord(session, (List<Object>) jsonObject);
|
||||||
|
//添加sql语句
|
||||||
|
String sql="INSERT INTO template (vinCode, ' or timeStamp' or longItude, latitude, speedVehicle, totalMileage, totalVoltage) VALUES(0, 0, 0, 0, 0, 0, 0)";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void insertRecord(Session session,List<Object> values) throws SQLException, ClassNotFoundException, IoTDBConnectionException, StatementExecutionException {
|
||||||
|
|
||||||
|
List<String> strings = new ArrayList<>();
|
||||||
|
|
||||||
|
List<TSDataType> objects = new ArrayList<>();
|
||||||
|
|
||||||
|
strings.add("status");
|
||||||
|
|
||||||
|
objects.add(TSDataType.INT32);
|
||||||
|
|
||||||
|
session.insertRecord("root.test.test",System.currentTimeMillis(),strings,objects,values);
|
||||||
|
|
||||||
|
System.out.println("----------------写入数据成功----------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void queryRecord(Session session) throws IoTDBConnectionException, StatementExecutionException {
|
||||||
|
|
||||||
|
System.out.println("----------------查询数据开始----------------");
|
||||||
|
|
||||||
|
try(SessionDataSet sessionDataSet = session.executeLastDataQuery(Collections.singletonList("select status from root.test.test"))){
|
||||||
|
System.out.println(sessionDataSet.getColumnNames());
|
||||||
|
sessionDataSet.setFetchSize(1024);
|
||||||
|
while(sessionDataSet.hasNext()){
|
||||||
|
System.out.println(sessionDataSet.hasNext());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("----------------查询数据结束----------------");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.template.util;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.template.domain.MessageTemplateType;
|
|
||||||
import com.template.service.TemplateService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
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.web.bind.annotation.GetMapping;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.util
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:Callback
|
|
||||||
* @Date:2024/9/26 15:23
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
public class Callback implements MqttCallback{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private static TemplateService templateService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionLost(Throwable throwable) {
|
|
||||||
log.error(throwable.getMessage(),throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
|
||||||
log.info("收到了来自:"+s+"的消息:{}",new String(mqttMessage.getPayload()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
|
||||||
log.info("发布消息成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.template.util;
|
||||||
|
import java.sql.Connection;
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.util
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:IOTDBConnectionTets
|
||||||
|
* @Date:2024/9/24 10:34
|
||||||
|
*/
|
||||||
|
public class IOTDBConnectionTets {
|
||||||
|
|
||||||
|
private static final String url = "jdbc:iotdb://47.116.173.119:6667/";
|
||||||
|
private static final String username = "root";
|
||||||
|
private static final String password = "root";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Connection conn = new IOTdbJDBCUtils(url, username, password).getConnection();
|
||||||
|
System.out.println(conn != null ? "打开连接成功!" : "打开连接失败!");
|
||||||
|
IOTdbJDBCUtils.close(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.template.util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.util
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:IOTdbJDBCUtils
|
||||||
|
* @Date:2024/9/24 10:18
|
||||||
|
*/
|
||||||
|
public class IOTdbJDBCUtils {
|
||||||
|
private static final String driver = "org.apache.iotdb.jdbc.IoTDBDriver";
|
||||||
|
private final String url;
|
||||||
|
private final String username;
|
||||||
|
private final String password;
|
||||||
|
|
||||||
|
public IOTdbJDBCUtils(String url, String username, String password) {
|
||||||
|
this.url = url;
|
||||||
|
this.username = username;
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
Class.forName(driver);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
System.out.println("当前加载的驱动不存在........,请检查后重试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Connection getConnection() {
|
||||||
|
Connection connection = null;
|
||||||
|
try {
|
||||||
|
connection = DriverManager.getConnection(url, username, password);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void close(Connection conn) {
|
||||||
|
if (conn != null) {
|
||||||
|
try {
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,179 +0,0 @@
|
||||||
package com.template.util;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
|
||||||
import org.eclipse.paho.client.mqttv3.internal.wire.MqttReceivedMessage;
|
|
||||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.util
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:MqttClient
|
|
||||||
* @Date:2024/9/26 16:05
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
public class MyMqttClient {
|
|
||||||
|
|
||||||
public static MqttClient mqttClient=null;
|
|
||||||
|
|
||||||
private static MemoryPersistence memoryPersistence=null;
|
|
||||||
|
|
||||||
private static MqttConnectOptions mqttConnectOptions=null;
|
|
||||||
|
|
||||||
private static String ClientName="";
|
|
||||||
|
|
||||||
private static String IP="";
|
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
start(ClientName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void start(String clientId){
|
|
||||||
//初始化连接设置对象
|
|
||||||
mqttConnectOptions = new MqttConnectOptions();
|
|
||||||
//设置是否清空session
|
|
||||||
mqttConnectOptions.setCleanSession(true);
|
|
||||||
//设置连接超时时间
|
|
||||||
mqttConnectOptions.setConnectionTimeout(10);
|
|
||||||
//设置持久化方式
|
|
||||||
memoryPersistence = new MemoryPersistence();
|
|
||||||
|
|
||||||
if(null!=clientId){
|
|
||||||
try {
|
|
||||||
mqttClient = new MqttClient("tcp://"+IP+":1883", clientId,memoryPersistence);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
log.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("连接状态:"+mqttClient.isConnected());
|
|
||||||
|
|
||||||
//设置连接和回调
|
|
||||||
if(null!=mqttClient){
|
|
||||||
if(!mqttClient.isConnected()){
|
|
||||||
//创建回调函数对象
|
|
||||||
Callback mqttReceiveCallBack = new Callback();
|
|
||||||
//客户端添加回调函数
|
|
||||||
mqttClient.setCallback(mqttReceiveCallBack);
|
|
||||||
try {
|
|
||||||
log.info("连接");
|
|
||||||
mqttClient.connect(mqttConnectOptions);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("mqttClient为空");
|
|
||||||
}
|
|
||||||
log.info("连接状态:"+mqttClient.isConnected());
|
|
||||||
}
|
|
||||||
|
|
||||||
//关闭连接
|
|
||||||
public void closeConnect(){
|
|
||||||
//关闭存储方式
|
|
||||||
if(null!=memoryPersistence){
|
|
||||||
try {
|
|
||||||
memoryPersistence.close();
|
|
||||||
} catch (MqttPersistenceException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("memoryPersistence为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
//关闭连接
|
|
||||||
if(null!=mqttClient){
|
|
||||||
if(mqttClient.isConnected()){
|
|
||||||
try {
|
|
||||||
mqttClient.disconnect();
|
|
||||||
mqttClient.close();
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("mqttClient未连接");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("mqttClient为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//发布消息
|
|
||||||
public static void publish(String topic, String message,int ops){
|
|
||||||
if(null!=mqttClient && mqttClient.isConnected()){
|
|
||||||
log.info("发布消息:"+mqttClient.isConnected());
|
|
||||||
log.info("id:"+mqttClient.getClientId());
|
|
||||||
MqttMessage mqttMessage = new MqttMessage();
|
|
||||||
mqttMessage.setQos(ops);
|
|
||||||
mqttMessage.setPayload(message.getBytes());
|
|
||||||
|
|
||||||
MqttTopic topic1 = mqttClient.getTopic(topic);
|
|
||||||
|
|
||||||
if(null!=topic1){
|
|
||||||
try {
|
|
||||||
MqttDeliveryToken publish = topic1.publish(mqttMessage);
|
|
||||||
if(!publish.isComplete()){
|
|
||||||
log.info("消息发布成功");
|
|
||||||
}
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
reConnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新连接
|
|
||||||
public static void reConnect() {
|
|
||||||
if(null != mqttClient) {
|
|
||||||
if(!mqttClient.isConnected()) {
|
|
||||||
if(null != mqttConnectOptions) {
|
|
||||||
try {
|
|
||||||
mqttClient.connect(mqttConnectOptions);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
log.info("mqttConnectOptions是空的");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
log.info("mqttClient没有连接");
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
start(ClientName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//订阅主题
|
|
||||||
public static void subTopic(String topic){
|
|
||||||
if(null!=mqttClient && mqttClient.isConnected()){
|
|
||||||
try {
|
|
||||||
mqttClient.subscribe(topic,1);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("mqttClient是错误的");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//清空主题
|
|
||||||
public void cleanTopic(String topic){
|
|
||||||
if(null!=mqttClient && mqttClient.isConnected()){
|
|
||||||
try {
|
|
||||||
mqttClient.unsubscribe(topic);
|
|
||||||
} catch (MqttException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
log.info("mqttClient是错误的");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package com.template.util;
|
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.util
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:Receive
|
|
||||||
* @Date:2024/9/27 19:14
|
|
||||||
*/
|
|
||||||
public class Receive {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String topic = "vehicle";
|
|
||||||
String broker = "tcp://47.101.53.251:1883";
|
|
||||||
String clientId = "lxy";
|
|
||||||
|
|
||||||
try (MqttClient sampleClient = new MqttClient(broker, clientId)) {
|
|
||||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
|
||||||
connOpts.setCleanSession(true);
|
|
||||||
System.out.println("Connecting to broker: " + broker);
|
|
||||||
sampleClient.connect(connOpts);
|
|
||||||
|
|
||||||
System.out.println("Connected");
|
|
||||||
|
|
||||||
sampleClient.setCallback(new MqttCallback() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionLost(Throwable cause) {
|
|
||||||
System.out.println("Connection lost!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
|
||||||
System.out.println("Message arrived. Topic: " + topic + " Message: " + new String(message.getPayload()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
|
||||||
// Not used in this example
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sampleClient.subscribe(topic);
|
|
||||||
System.out.println("Subscribed to topic \"" + topic + "\"");
|
|
||||||
} catch (MqttException me) {
|
|
||||||
System.out.println("reason "+me.getReasonCode());
|
|
||||||
System.out.println("msg "+me.getMessage());
|
|
||||||
System.out.println("loc "+me.getLocalizedMessage());
|
|
||||||
System.out.println("cause "+me.getCause());
|
|
||||||
System.out.println("excep "+me);
|
|
||||||
me.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
//package com.template.util;
|
|
||||||
//import com.template.domain.MessageTemplateType;
|
|
||||||
//import com.template.domain.SysCar;
|
|
||||||
//import com.template.domain.Template;
|
|
||||||
//import com.template.domain.resp.CarTypeResp;
|
|
||||||
//import com.template.service.CarService;
|
|
||||||
//import com.template.service.TemplateService;
|
|
||||||
//import lombok.extern.log4j.Log4j2;
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
//import org.springframework.data.redis.core.ListOperations;
|
|
||||||
//import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
//import org.springframework.stereotype.Component;
|
|
||||||
//import javax.annotation.PostConstruct;
|
|
||||||
//import javax.annotation.Resource;
|
|
||||||
//import java.util.List;
|
|
||||||
///**
|
|
||||||
// * @Author:liuxinyue
|
|
||||||
// * @Package:com.template.util
|
|
||||||
// * @Project:cloud-server
|
|
||||||
// * @name:SynchronizingTemplate
|
|
||||||
// * @Date:2024/9/25 20:03 项目一启动 查询数据库 将报文模版存入到Redis
|
|
||||||
// */
|
|
||||||
//@Component
|
|
||||||
//@Log4j2
|
|
||||||
//public class SynchronizingTemplate {
|
|
||||||
//
|
|
||||||
// //调用报文模版列表接口
|
|
||||||
// @Resource
|
|
||||||
// private TemplateService templateService;
|
|
||||||
//
|
|
||||||
// //redis
|
|
||||||
// @Resource
|
|
||||||
// private RedisTemplate redisTemplate;
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private CarService carService;
|
|
||||||
//
|
|
||||||
// @PostConstruct
|
|
||||||
// public void synchronizeTemplate() {
|
|
||||||
// //获取所有报文模版的ID
|
|
||||||
// log.info("获取所有报文模版的ID");
|
|
||||||
// List<Template> templates = templateService.templateList();
|
|
||||||
// templates.forEach(template -> {
|
|
||||||
// Integer templateId = template.getTemplateId(); //报文模版ID
|
|
||||||
// List<MessageTemplateType> list=templateService.findTemplateById(templateId); //根据报文模版ID查询所有的报文模版
|
|
||||||
// ListOperations<String,Object> listOperations = redisTemplate.opsForList(); //将报文信息存储到redis中
|
|
||||||
// redisTemplate.delete(template.getTemplateName());//因为每一次添加缓存的时候不会覆盖之前的数据 所有将数据先清空
|
|
||||||
// List<CarTypeResp> allCars = carService.findAllCars();//查询所有车辆 里面有模版名称
|
|
||||||
// redisTemplate.opsForList().leftPushAll("VehicleType", allCars);//将车辆类型放入列表
|
|
||||||
// listOperations.leftPushAll(template.getTemplateName(), list); //将报文信息存储到redis中
|
|
||||||
// List range = redisTemplate.opsForList().range("VehicleType", 0, -1);
|
|
||||||
// range.forEach(o -> {
|
|
||||||
// log.info("数据为:"+o);
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// listOperations.leftPushAll("CarType", allCars);
|
|
||||||
// listOperations.leftPushAll(template.getTemplateName(), range);
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
//}
|
|
|
@ -1,59 +0,0 @@
|
||||||
package com.template.util;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.util
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:Test
|
|
||||||
* @Date:2024/9/27 11:55
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String topic = "vehicle";
|
|
||||||
String content = "Message from MqttPublishSample";
|
|
||||||
int qos = 2;
|
|
||||||
String broker = "tcp://47.101.53.251:1883";
|
|
||||||
String clientId = "Lxy";
|
|
||||||
|
|
||||||
try {
|
|
||||||
MqttClient sampleClient = new MqttClient(broker, clientId);
|
|
||||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
|
||||||
//是否清空session
|
|
||||||
connOpts.setCleanSession(true);
|
|
||||||
System.out.println("Connecting to broker: "+broker);
|
|
||||||
//连接
|
|
||||||
sampleClient.connect(connOpts);
|
|
||||||
sampleClient.subscribe("vehicle",qos);
|
|
||||||
sampleClient.setCallback(new MqttCallback() {
|
|
||||||
|
|
||||||
//连接丢失(报错)
|
|
||||||
@Override
|
|
||||||
public void connectionLost(Throwable throwable) {
|
|
||||||
log.error("error:"+throwable.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
//消息已经接收到
|
|
||||||
@Override
|
|
||||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
|
||||||
System.out.println(new String(mqttMessage.getPayload()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//交付完成
|
|
||||||
@Override
|
|
||||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch(MqttException me) {
|
|
||||||
System.out.println("reason "+me.getReasonCode());
|
|
||||||
System.out.println("msg "+me.getMessage());
|
|
||||||
System.out.println("loc "+me.getLocalizedMessage());
|
|
||||||
System.out.println("cause "+me.getCause());
|
|
||||||
System.out.println("excep "+me);
|
|
||||||
me.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.template.util;
|
|
||||||
|
|
||||||
import com.template.service.TemplateService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
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 javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author:liuxinyue
|
|
||||||
* @Package:com.template.util
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:Test1
|
|
||||||
* @Date:2024/9/27 22:39
|
|
||||||
*/
|
|
||||||
@Log4j2
|
|
||||||
public class Test1 implements MqttCallback{
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private static TemplateService templateService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionLost(Throwable throwable) {
|
|
||||||
log.error(throwable.getMessage(), throwable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
|
|
||||||
log.info("收到了来自:"+mqttMessage.toString()+"的消息:{}",new String(mqttMessage.getPayload()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
|
||||||
log.info("发布消息成功");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.template.util;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.util
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ToIoTDB 连接IoTDB数据库
|
||||||
|
* @Date:2024/9/20 19:40
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Configuration
|
||||||
|
public class ToIoTDB {
|
||||||
|
|
||||||
|
private final String IOTDB_DRIVER="org.apache.iotdb.jdbc.IoTDBDriver";
|
||||||
|
private static final String url="jdbc:iotdb://47.116.173.119:6667/";
|
||||||
|
private static final String userName="root";
|
||||||
|
private static final String passWord="root";
|
||||||
|
|
||||||
|
public Connection getConnection() throws ClassNotFoundException, SQLException {
|
||||||
|
Connection connection=null;
|
||||||
|
try{
|
||||||
|
Class.forName(IOTDB_DRIVER);
|
||||||
|
connection = DriverManager.getConnection(url, userName, passWord);
|
||||||
|
}catch(SQLException e){
|
||||||
|
log.error("SQLException: " + e.getMessage());
|
||||||
|
log.error("SQLState: " + e.getSQLState());
|
||||||
|
log.error("VendorError: " + e.getErrorCode());
|
||||||
|
}
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.template.util;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liuxinyue
|
||||||
|
* @Package:com.template.util
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ToIoTDBTest
|
||||||
|
* @Date:2024/9/24 10:12
|
||||||
|
*/
|
||||||
|
public class ToIoTDBTest {
|
||||||
|
|
||||||
|
private static final String host = "47.116.173.119";
|
||||||
|
private static final String url = "jdbc:iotdb://" + host + ":6667/";
|
||||||
|
private static final String username = "root";
|
||||||
|
private static final String password = "root";
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) throws SQLException, ClassNotFoundException {
|
||||||
|
|
||||||
|
ToIoTDB toIoTDB = new ToIoTDB();
|
||||||
|
Connection connection = toIoTDB.getConnection();
|
||||||
|
// Connection connection = (Connection) new IOTdbJDBCUtils(url, username, password).getConnection();
|
||||||
|
System.out.println(connection!=null?"打开连接成功!":"打开连接失败!");
|
||||||
|
|
||||||
|
ResultSet rs=null;
|
||||||
|
String storgeGroup="root.test";
|
||||||
|
Statement statement = connection.createStatement();
|
||||||
|
String sql=String.format("set storage group to %s",storgeGroup);
|
||||||
|
statement = connection.createStatement();
|
||||||
|
int i = statement.executeUpdate(sql);
|
||||||
|
System.out.println("当前创建组的结果为:"+i);
|
||||||
|
|
||||||
|
//查看创建的组是否存在
|
||||||
|
sql="SHOW STORAGE GROUPS"; //查看所有的存储组
|
||||||
|
rs= statement.executeQuery(sql);
|
||||||
|
outputResult(rs);
|
||||||
|
|
||||||
|
sql=String.format("show storage group %s",storgeGroup);
|
||||||
|
rs=statement.executeQuery(sql);
|
||||||
|
outputResult(rs);
|
||||||
|
//统计存在的数量
|
||||||
|
sql=String.format("count storage group %s",storgeGroup);
|
||||||
|
rs=statement.executeQuery(sql);
|
||||||
|
outputResult(rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void outputResult(ResultSet resultSet) throws SQLException {
|
||||||
|
if (resultSet != null) {
|
||||||
|
System.out.println("--------------------------");
|
||||||
|
final ResultSetMetaData metaData = resultSet.getMetaData();
|
||||||
|
final int columnCount = metaData.getColumnCount();
|
||||||
|
for (int i = 0; i < columnCount; i++) {
|
||||||
|
System.out.print(metaData.getColumnLabel(i + 1) + ", ");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
for (int i = 1;; i++) {
|
||||||
|
System.out.print(resultSet.getString(i));
|
||||||
|
if (i < columnCount) {
|
||||||
|
System.out.print(", ");
|
||||||
|
} else {
|
||||||
|
System.out.println();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("--------------------------\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -10,14 +10,4 @@
|
||||||
<select id="carMapper" resultType="com.template.domain.CarType">
|
<select id="carMapper" resultType="com.template.domain.CarType">
|
||||||
select * from car_type where id=#{carTypeId}
|
select * from car_type where id=#{carTypeId}
|
||||||
</select>
|
</select>
|
||||||
<select id="findAllCars" resultType="com.template.domain.resp.CarTypeResp">
|
|
||||||
SELECT
|
|
||||||
car_type.*,
|
|
||||||
t_template.template_name
|
|
||||||
FROM
|
|
||||||
car_type
|
|
||||||
LEFT JOIN t_template ON car_type.template_id = t_template.template_id
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -11,13 +11,5 @@
|
||||||
<select id="findTemplateByName" resultType="com.template.domain.Template">
|
<select id="findTemplateByName" resultType="com.template.domain.Template">
|
||||||
select * from t_template where template_name=#{typeName}
|
select * from t_template where template_name=#{typeName}
|
||||||
</select>
|
</select>
|
||||||
<select id="findTemplateById" resultType="com.template.domain.MessageTemplateType">
|
|
||||||
SELECT
|
|
||||||
*
|
|
||||||
FROM
|
|
||||||
message_template_type
|
|
||||||
WHERE
|
|
||||||
template_id = #{templateId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.muyu;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class VehicleGatewayApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(VehicleGatewayApplication.class,args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.muyu.core;
|
|
||||||
|
|
||||||
import com.muyu.domain.VehicleInstance;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public class LocalContainer {
|
|
||||||
private static final Map<String,Map<String, VehicleInstance>> tenantVehicleDataMap
|
|
||||||
=new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取租户ID下车辆
|
|
||||||
*/
|
|
||||||
public static Map<String,VehicleInstance>getVehicleDataMap(String tenantId){
|
|
||||||
return tenantVehicleDataMap.computeIfAbsent(tenantId,k->new ConcurrentHashMap<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.muyu.core;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Log4j2
|
|
||||||
@Configuration
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class VehicleConfiguration {
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
package com.muyu.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mqtt配置类
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class MqttProperties {
|
|
||||||
/**
|
|
||||||
* 节点
|
|
||||||
*/
|
|
||||||
private String broker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主题
|
|
||||||
*/
|
|
||||||
private String topic;
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点ID
|
|
||||||
*/
|
|
||||||
private String clientId;
|
|
||||||
/**
|
|
||||||
* 上报级别
|
|
||||||
*/
|
|
||||||
private int qos=0;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +0,0 @@
|
||||||
package com.muyu.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.muyu.domain.model.ServerConfigModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 服务器配置类
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@TableName(value = "server_config")
|
|
||||||
public class ServerConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主机地址
|
|
||||||
*/
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 端口号
|
|
||||||
*/
|
|
||||||
private String port;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 负载地址
|
|
||||||
*/
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MOTT地址
|
|
||||||
*/
|
|
||||||
private String defaultMqttAddr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MQTT主题
|
|
||||||
*/
|
|
||||||
private String defaultMqttTopic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MOTT交付级别
|
|
||||||
*/
|
|
||||||
private Integer defaultMqttQos;
|
|
||||||
|
|
||||||
|
|
||||||
public static ServerConfig modeBuild(ServerConfigModel serverConfigModel, Supplier<Long> idKey){
|
|
||||||
return builder()
|
|
||||||
.id(idKey.get())
|
|
||||||
.host(serverConfigModel.getHost())
|
|
||||||
.port(serverConfigModel.getPort())
|
|
||||||
.url(serverConfigModel.getUrl())
|
|
||||||
.defaultMqttAddr(serverConfigModel.getDefaultMqttAddr())
|
|
||||||
.defaultMqttTopic(serverConfigModel.getDefaultMqttTopic())
|
|
||||||
.defaultMqttQos(serverConfigModel.getDefaultMqttQos())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.muyu.domain;
|
|
||||||
|
|
||||||
import com.muyu.domain.model.PositionModel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class VehicleInstance {
|
|
||||||
/**
|
|
||||||
* 路线轨迹编码
|
|
||||||
*/
|
|
||||||
private String positionCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 路径队列
|
|
||||||
*/
|
|
||||||
private LinkedBlockingQueue<PositionModel> positionQueue=new LinkedBlockingQueue<>();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.muyu.domain.model;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Mqtt服务器模型
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class MqttServerModel {
|
|
||||||
private static final Logger log=LoggerFactory.getLogger(MqttServerModel.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MQTT服务节点
|
|
||||||
*/
|
|
||||||
private String broker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MQTT订阅主题
|
|
||||||
*/
|
|
||||||
private String topic;
|
|
||||||
|
|
||||||
public String getBroker(){
|
|
||||||
log.info("broker:{}",broker);
|
|
||||||
return broker.contains("tcp://")?broker:"tcp://"+broker+":1883";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.muyu.domain.model;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 位置模型
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PositionModel {
|
|
||||||
/**
|
|
||||||
* 经度
|
|
||||||
*/
|
|
||||||
private String longitude;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 维度
|
|
||||||
*/
|
|
||||||
private String latitude;
|
|
||||||
|
|
||||||
public static PositionModel strBuild (String positionStr) {
|
|
||||||
String[] split = positionStr.split(",");
|
|
||||||
return PositionModel.builder()
|
|
||||||
.longitude(split[0])
|
|
||||||
.latitude(split[1])
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.muyu.domain.model;
|
|
||||||
|
|
||||||
import com.muyu.domain.ServerConfig;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class ServerConfigModel {
|
|
||||||
/**
|
|
||||||
* 主机地址
|
|
||||||
*/
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 端口号
|
|
||||||
*/
|
|
||||||
private String port;
|
|
||||||
/**
|
|
||||||
* 负载地址
|
|
||||||
*/
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MOTT地址
|
|
||||||
*/
|
|
||||||
private String defaultMqttAddr;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MQTT主题
|
|
||||||
*/
|
|
||||||
private String defaultMqttTopic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认MOTT交付级别
|
|
||||||
*/
|
|
||||||
private Integer defaultMqttQos;
|
|
||||||
|
|
||||||
public static ServerConfigModel serverConfigModelBuild(ServerConfig serverConfig){
|
|
||||||
return builder()
|
|
||||||
.host(serverConfig.getHost().trim())
|
|
||||||
.port(serverConfig.getPort())
|
|
||||||
.url(serverConfig.getUrl().trim())
|
|
||||||
.defaultMqttAddr(serverConfig.getDefaultMqttAddr().trim())
|
|
||||||
.defaultMqttTopic(serverConfig.getDefaultMqttTopic().trim())
|
|
||||||
.defaultMqttQos(serverConfig.getDefaultMqttQos())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
Spring Boot Version: ${spring-boot.version}
|
|
||||||
Spring Application Name: ${spring.application.name}
|
|
|
@ -18,6 +18,4 @@ public interface WarnLogsMapper extends BaseMapper<WarnLogs>{
|
||||||
List<WarnLogsResp> selectWarnLogsList();
|
List<WarnLogsResp> selectWarnLogsList();
|
||||||
|
|
||||||
WarnLogsResp selectWarnLogs(@Param("id")Long id);
|
WarnLogsResp selectWarnLogs(@Param("id")Long id);
|
||||||
|
|
||||||
Integer addWarnLog(List<WarnLogs> list);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.muyu.mapper.WarnLogsMapper">
|
<mapper namespace="com.muyu.mapper.WarnLogsMapper">
|
||||||
<insert id="addWarnLog">
|
|
||||||
INSERT INTO warn_logs VALUES
|
|
||||||
<foreach collection="list" item="warnLogs" index="index" separator=",">
|
|
||||||
(#{warnLogs.id})
|
|
||||||
</foreach>
|
|
||||||
</insert>
|
|
||||||
<select id="selectWarnLogsList" resultType="com.muyu.domain.resp.WarnLogsResp">
|
<select id="selectWarnLogsList" resultType="com.muyu.domain.resp.WarnLogsResp">
|
||||||
SELECT
|
SELECT
|
||||||
*,
|
*,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue