Compare commits
130 Commits
master
...
dev.entBus
Author | SHA1 | Date |
---|---|---|
|
e559fbe869 | |
|
bc56698b2f | |
|
38ff70f541 | |
|
4ca2fd7e7e | |
|
4f52c6c4ac | |
|
0534db9f37 | |
|
4c6ce87e8c | |
|
7207dcc01c | |
|
b74b18a615 | |
|
ec41019824 | |
|
b491045ebf | |
|
580172aa76 | |
|
3202af6ebb | |
|
c08a1376d6 | |
|
9bb39ec32a | |
|
6e0ed3b883 | |
|
94d04e3a35 | |
|
a9bfdc1670 | |
|
111129e777 | |
|
0bafed3671 | |
|
0db37dc190 | |
|
293e58809c | |
|
22e068cfc5 | |
|
9f0f373594 | |
|
a2f2d2ec52 | |
|
26c0d3d4c8 | |
|
7fa71097fd | |
|
e018d60115 | |
|
20977536e3 | |
|
222b2ad30f | |
|
c0a9b1a1dd | |
|
eef7d19aeb | |
|
19f67a389c | |
|
f7f54bf0c1 | |
|
a1894bb013 | |
|
ca8bd65148 | |
|
a0c2d916f2 | |
|
8888b7430c | |
|
a8222a4c88 | |
|
98fa19923d | |
|
3378b4c216 | |
|
688527037d | |
|
d896e9b26d | |
|
f81d701acb | |
|
3fb0158cfa | |
|
5d66ce181f | |
|
46689d02e1 | |
|
576befa0ee | |
|
6f95055a6b | |
|
17245c91b3 | |
|
ff3f1e8ac2 | |
|
147dbe2c99 | |
|
a229006c89 | |
|
b9529234e9 | |
|
0ed0f872e9 | |
|
7e2ad67a64 | |
|
c67d648a8a | |
|
5203c69a90 | |
|
3ebd1d2c39 | |
|
0c7795ea71 | |
|
b9f3cac204 | |
|
add31c49fa | |
|
7100bf71bf | |
|
a7b8987be4 | |
|
497de4ade9 | |
|
940e41b297 | |
|
514c94b398 | |
|
7e02675028 | |
|
22675757b3 | |
|
6594363a91 | |
|
517c18f215 | |
|
e2d710fbb6 | |
|
9f01b76182 | |
|
fedc3c4ea7 | |
|
423836afb7 | |
|
cb79600bc0 | |
|
a18ba509d8 | |
|
5979dbea8f | |
|
782f31446b | |
|
47567ff055 | |
|
1378aeeb06 | |
|
51cfc6ab2d | |
|
681c88db28 | |
|
2d0f557398 | |
|
9c059750b6 | |
|
38a096ea72 | |
|
a51f80aa00 | |
|
c8fd288cc4 | |
|
26d3ffda93 | |
|
cd46940e70 | |
|
b70a552b6a | |
|
13bf016452 | |
|
1131fbe0f1 | |
|
2d25fd9a04 | |
|
d054119692 | |
|
af712e3937 | |
|
97ab01bd2a | |
|
40d0dde1f9 | |
|
2c3197fac9 | |
|
e9a19e94e9 | |
|
06815c8552 | |
|
49d6651df2 | |
|
ec676ca227 | |
|
411a454c1b | |
|
b0672dbd60 | |
|
2fc56d44c9 | |
|
0febb2cb21 | |
|
5012e3c895 | |
|
de23d2e383 | |
|
0b297a028f | |
|
f19b18d273 | |
|
aa1d518628 | |
|
c9d25d1ebc | |
|
63cbc37084 | |
|
c123bb91c4 | |
|
4476a8c1ae | |
|
a2f0c48e98 | |
|
94e0bef9ab | |
|
1f7202c496 | |
|
c101b474da | |
|
9d3e62e0c2 | |
|
5cd6840e2a | |
|
82d99ce0f2 | |
|
2ed82cdd80 | |
|
c8cd62c1be | |
|
9f40bbaaf6 | |
|
ecf2c96c80 | |
|
882819a6e0 | |
|
9e6ca8a8ff | |
|
2ad4794e78 |
|
@ -26,6 +26,7 @@ logs
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
*.yml
|
||||||
|
|
||||||
### JRebel ###
|
### JRebel ###
|
||||||
rebel.xml
|
rebel.xml
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.muyu.auth.controller;
|
package com.muyu.auth.controller;
|
||||||
|
|
||||||
import com.muyu.auth.form.LoginBody;
|
import com.muyu.common.system.domain.form.LoginBody;
|
||||||
import com.muyu.auth.form.RegisterBody;
|
import com.muyu.common.system.domain.form.RegisterBody;
|
||||||
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;
|
||||||
|
@ -66,7 +66,7 @@ public class TokenController {
|
||||||
@PostMapping("register")
|
@PostMapping("register")
|
||||||
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
public Result<?> register (@RequestBody RegisterBody registerBody) {
|
||||||
// 用户注册
|
// 用户注册
|
||||||
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
|
sysLoginService.register(registerBody);
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.muyu.auth.form;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户注册对象
|
|
||||||
*
|
|
||||||
* @author muyu
|
|
||||||
*/
|
|
||||||
public class RegisterBody extends LoginBody {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.auth.service;
|
package com.muyu.auth.service;
|
||||||
|
|
||||||
|
import com.muyu.common.system.domain.form.RegisterBody;
|
||||||
import com.muyu.common.core.constant.CacheConstants;
|
import com.muyu.common.core.constant.CacheConstants;
|
||||||
import com.muyu.common.core.constant.Constants;
|
import com.muyu.common.core.constant.Constants;
|
||||||
import com.muyu.common.core.constant.SecurityConstants;
|
import com.muyu.common.core.constant.SecurityConstants;
|
||||||
|
@ -75,19 +76,18 @@ public class SysLoginService {
|
||||||
if (Result.FAIL == userResult.getCode()) {
|
if (Result.FAIL == userResult.getCode()) {
|
||||||
throw new ServiceException(userResult.getMsg());
|
throw new ServiceException(userResult.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginUser userInfo = userResult.getData();
|
LoginUser userInfo = userResult.getData();
|
||||||
SysUser user = userResult.getData().getSysUser();
|
SysUser user = userResult.getData().getSysUser();
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if(UserStatus.DELETED.getCode().equals(user.getDelFlag())){
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
recordLogService.recordLogininfor(username,Constants.LOGIN_FAIL,"对不起,您的账号已被删除");
|
||||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
throw new ServiceException("对不起,您的账号:" + username + " 已被删除 ");
|
||||||
}
|
}
|
||||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
if(UserStatus.DISABLE.getCode().equals(user.getStatus())){
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
recordLogService.recordLogininfor(username,Constants.LOGIN_FAIL,"用户已停用,请联系管理官");
|
||||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||||
}
|
}
|
||||||
passwordService.validate(user, password);
|
passwordService.validate(user,password);
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
recordLogService.recordLogininfor(username,Constants.LOGIN_SUCCESS,"登录成功");
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,22 @@ public class SysLoginService {
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
*/
|
*/
|
||||||
public void register (String username, String password) {
|
public void register (RegisterBody registerBody) {
|
||||||
|
//获取用户名密码
|
||||||
|
String username = registerBody.getUsername();
|
||||||
|
String password = registerBody.getPassword();
|
||||||
|
if(StringUtils.isEmpty(registerBody.getEntName())) {
|
||||||
|
throw new ServiceException("企业名称不能为空");
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(registerBody.getLeader())) {
|
||||||
|
throw new ServiceException("负责人不能为空");
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(registerBody.getPhone())) {
|
||||||
|
throw new ServiceException("手机号不能为空");
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(registerBody.getEmail())) {
|
||||||
|
throw new ServiceException("邮箱不能为空");
|
||||||
|
}
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
if (StringUtils.isAnyBlank(username, password)) {
|
if (StringUtils.isAnyBlank(username, password)) {
|
||||||
throw new ServiceException("用户/密码必须填写");
|
throw new ServiceException("用户/密码必须填写");
|
||||||
|
@ -112,16 +127,16 @@ public class SysLoginService {
|
||||||
throw new ServiceException("密码长度必须在5到20个字符之间");
|
throw new ServiceException("密码长度必须在5到20个字符之间");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注册用户信息
|
//注册用户信息
|
||||||
SysUser sysUser = new SysUser();
|
SysUser sysUser = new SysUser();
|
||||||
sysUser.setUserName(username);
|
sysUser.setUserName(username);
|
||||||
sysUser.setNickName(username);
|
sysUser.setNickName(username);
|
||||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
Result<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
|
Result<Boolean> registerResult = remoteUserService.registerUserInfo(registerBody, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (Result.FAIL == registerResult.getCode()) {
|
if (Result.FAIL == registerResult.getCode()) {
|
||||||
throw new ServiceException(registerResult.getMsg());
|
throw new ServiceException(registerResult.getMsg());
|
||||||
}
|
}
|
||||||
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
|
|
||||||
|
recordLogService.recordLogininfor(username,Constants.REGISTER,"注册成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: xzr
|
namespace: dev
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-cache</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-cache redis缓存架构
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- redis 缓存模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.common.cache.config;
|
||||||
|
/**
|
||||||
|
* 抽象缓存层
|
||||||
|
* @ClassName CacheAbsBasic
|
||||||
|
* @Description CacheAbsBasic:类的描述
|
||||||
|
* @Date 2024/9/30 1:39
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.muyu.common.redis.service.RedisService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class CacheAbsBasic<K,V> implements CacheBasic<K,V> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void put(K key, V value) {
|
||||||
|
redisService.setCacheObject(encode(key),value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public V get(K key) {
|
||||||
|
return redisService.getCacheObject(encode(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(K key) {
|
||||||
|
redisService.deleteObject(encode(key));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.muyu.common.cache.config;
|
||||||
|
|
||||||
|
import java.awt.image.Kernel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存基础
|
||||||
|
* @ClassName CacheBasic
|
||||||
|
* @Description CacheBasic:类的描述
|
||||||
|
* @Date 2024/9/30 1:36
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface CacheBasic<K,V> extends PrimaryKeyBasic<K>{
|
||||||
|
|
||||||
|
void put(K key,V value);
|
||||||
|
|
||||||
|
V get(K key);
|
||||||
|
|
||||||
|
void remove(K key);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.common.cache.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.text.StrFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键基础
|
||||||
|
* @ClassName PrimaryKeyBasic
|
||||||
|
* @Description PrimaryKeyBasic:类的描述
|
||||||
|
* @Date 2024/9/30 0:15
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
public interface PrimaryKeyBasic <K>{
|
||||||
|
/**
|
||||||
|
* key 前缀
|
||||||
|
*/
|
||||||
|
public String keyPre();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key 后缀
|
||||||
|
*/
|
||||||
|
public String keyPost();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
* @param key 缓存键
|
||||||
|
* @return 装修键
|
||||||
|
*/
|
||||||
|
public default String encode(K key){
|
||||||
|
return StrFormatter.format("{}:vin{}:{}", keyPre(), key.toString(), keyPost());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解码 Key
|
||||||
|
* @param key 解码后的key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public K decode(String key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.common.core.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* kafka常量信息
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.common.core.constant
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:KafkaConstants
|
||||||
|
* @Date:2024/9/29 16:41
|
||||||
|
*/
|
||||||
|
public class KafkaConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议解析报文传递数据(队列名称)
|
||||||
|
*/
|
||||||
|
public final static String MESSAGE_PARSING = "MessageParsing";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.common.core.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis常量信息
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.common.core.constant
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:RedisConstants
|
||||||
|
* @Date:2024/9/29 17:28
|
||||||
|
*/
|
||||||
|
public class RedisConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redisKey(协议解析报文传递)
|
||||||
|
*/
|
||||||
|
public final static String MESSAGE_TEMPLATE = "messageTemplate";
|
||||||
|
}
|
|
@ -20,4 +20,9 @@ public class ServiceNameConstants {
|
||||||
* 文件服务的serviceid
|
* 文件服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SERVICE = "cloud-file";
|
public static final String FILE_SERVICE = "cloud-file";
|
||||||
|
/**
|
||||||
|
* 企业平台服务的serviceid
|
||||||
|
*/
|
||||||
|
public static final String ENTERPRISE_SERVICE = "cloud-enterprise";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.muyu.common.core.handler;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||||
|
import com.muyu.common.core.context.SecurityContextHolder;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.ibatis.reflection.MetaObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/26 16:43
|
||||||
|
* @Description 填充公共字段
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||||
|
|
||||||
|
|
||||||
|
public MyMetaObjectHandler () {
|
||||||
|
log.info("元数据填充初始化成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时触发
|
||||||
|
* @param metaObject 元数据对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void insertFill(MetaObject metaObject) {
|
||||||
|
String[] setterNames = metaObject.getSetterNames();
|
||||||
|
Set<String> setterNamesSet = Arrays.stream(setterNames).collect(Collectors.toSet());
|
||||||
|
if (setterNamesSet.contains("createBy")){
|
||||||
|
if (metaObject.getValue("createBy") == null) {
|
||||||
|
this.setFieldValByName("createBy", SecurityContextHolder.getUserName(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (setterNamesSet.contains("createTime")){
|
||||||
|
if (metaObject.getValue("createTime") == null) {
|
||||||
|
this.setFieldValByName("createTime", new Date(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时触发
|
||||||
|
* @param metaObject 元数据对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateFill(MetaObject metaObject) {
|
||||||
|
String[] setterNames = metaObject.getSetterNames();
|
||||||
|
Set<String> setterNamesSet = Arrays.stream(setterNames).collect(Collectors.toSet());
|
||||||
|
if (setterNamesSet.contains("updateBy")){
|
||||||
|
if (metaObject.getValue("updateBy") == null) {
|
||||||
|
this.setFieldValByName("updateBy", SecurityContextHolder.getUserName(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (setterNamesSet.contains("updateTime")){
|
||||||
|
if (metaObject.getValue("updateTime") == null) {
|
||||||
|
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-datascope</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-datascope权限范围
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- MuYu Common Security -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.common.datascope.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤注解
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface DataScope {
|
||||||
|
/**
|
||||||
|
* 部门表的别名
|
||||||
|
*/
|
||||||
|
public String deptAlias () default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户表的别名
|
||||||
|
*/
|
||||||
|
public String userAlias () default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||||
|
*/
|
||||||
|
public String permission () default "";
|
||||||
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
package com.muyu.common.datascope.aspect;
|
||||||
|
|
||||||
|
import com.muyu.common.core.context.SecurityContextHolder;
|
||||||
|
import com.muyu.common.core.text.Convert;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.common.datascope.annotation.DataScope;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.SysRole;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据过滤处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class DataScopeAspect {
|
||||||
|
/**
|
||||||
|
* 全部数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_ALL = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_CUSTOM = "2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_DEPT = "3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门及以下数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅本人数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_SELF = "5";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据权限过滤关键字
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE = "dataScope";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据范围过滤
|
||||||
|
*
|
||||||
|
* @param joinPoint 切点
|
||||||
|
* @param user 用户
|
||||||
|
* @param deptAlias 部门别名
|
||||||
|
* @param userAlias 用户别名
|
||||||
|
* @param permission 权限字符
|
||||||
|
*/
|
||||||
|
public static void dataScopeFilter (JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission) {
|
||||||
|
StringBuilder sqlString = new StringBuilder();
|
||||||
|
List<String> conditions = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (SysRole role : user.getRoles()) {
|
||||||
|
String dataScope = role.getDataScope();
|
||||||
|
if (!DATA_SCOPE_CUSTOM.equals(dataScope) && conditions.contains(dataScope)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(permission) && StringUtils.isNotEmpty(role.getPermissions())
|
||||||
|
&& !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (DATA_SCOPE_ALL.equals(dataScope)) {
|
||||||
|
sqlString = new StringBuilder();
|
||||||
|
conditions.add(dataScope);
|
||||||
|
break;
|
||||||
|
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
|
||||||
|
sqlString.append(StringUtils.format(
|
||||||
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
||||||
|
role.getRoleId()));
|
||||||
|
} else if (DATA_SCOPE_DEPT.equals(dataScope)) {
|
||||||
|
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
||||||
|
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) {
|
||||||
|
sqlString.append(StringUtils.format(
|
||||||
|
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
|
||||||
|
deptAlias, user.getDeptId(), user.getDeptId()));
|
||||||
|
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
|
||||||
|
if (StringUtils.isNotBlank(userAlias)) {
|
||||||
|
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
||||||
|
} else {
|
||||||
|
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||||
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conditions.add(dataScope);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多角色情况下,所有角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据
|
||||||
|
if (StringUtils.isEmpty(conditions)) {
|
||||||
|
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(sqlString.toString())) {
|
||||||
|
Object params = joinPoint.getArgs()[0];
|
||||||
|
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||||
|
BaseEntity baseEntity = (BaseEntity) params;
|
||||||
|
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before("@annotation(controllerDataScope)")
|
||||||
|
public void doBefore (JoinPoint point, DataScope controllerDataScope) throws Throwable {
|
||||||
|
clearDataScope(point);
|
||||||
|
handleDataScope(point, controllerDataScope);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void handleDataScope (final JoinPoint joinPoint, DataScope controllerDataScope) {
|
||||||
|
// 获取当前的用户
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
if (StringUtils.isNotNull(loginUser)) {
|
||||||
|
SysUser currentUser = loginUser.getSysUser();
|
||||||
|
// 如果是超级管理员,则不过滤数据
|
||||||
|
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) {
|
||||||
|
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission());
|
||||||
|
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
|
||||||
|
controllerDataScope.userAlias(), permission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接权限sql前先清空params.dataScope参数防止注入
|
||||||
|
*/
|
||||||
|
private void clearDataScope (final JoinPoint joinPoint) {
|
||||||
|
Object params = joinPoint.getArgs()[0];
|
||||||
|
if (StringUtils.isNotNull(params) && params instanceof BaseEntity) {
|
||||||
|
BaseEntity baseEntity = (BaseEntity) params;
|
||||||
|
baseEntity.getParams().put(DATA_SCOPE, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
com.muyu.common.datascope.aspect.DataScopeAspect
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?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-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-kafka</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-kafka模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<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>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- kafka客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.kafka</groupId>
|
||||||
|
<artifactId>kafka-clients</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,102 @@
|
||||||
|
package com.muyu.common.kafka.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.text.StrFormatter;
|
||||||
|
import com.muyu.common.kafka.constant.KafkaConfigConstants;
|
||||||
|
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
||||||
|
import org.apache.kafka.common.serialization.Deserializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringDeserializer;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/28 20:32
|
||||||
|
* @Description Kafka消费者配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class KafkaConsumerConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端IP
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.bootstrap-servers-ip}")
|
||||||
|
private String bootstrapServersIP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端口号
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.bootstrap-servers-port}")
|
||||||
|
private String bootstrapServersPort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启消费者偏移量
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.enable-auto-commit}")
|
||||||
|
private Boolean enableAutoCommit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动提交时间间隔
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.auto-commit-interval}")
|
||||||
|
private Integer autoCommitInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动重置偏移量
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.auto-offset-reset}")
|
||||||
|
private String autoOffsetReset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求阻塞的最大时间
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.fetch-max-wait}")
|
||||||
|
private Integer fetchMaxWait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求应答的最小字节数
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.fetch-min-size}")
|
||||||
|
private Integer fetchMinSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳间隔时间
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.heartbeat-interval}")
|
||||||
|
private Integer heartbeatInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一次调用poll返回的最大记录条数
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.max-poll-records}")
|
||||||
|
private Integer maxPollRecords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定消费组
|
||||||
|
*/
|
||||||
|
@Value("${kafka.consumer.group-id}")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kafka消费者初始化配置
|
||||||
|
* @return Kafka消费者实例
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public KafkaConsumer<String, String> kafkaConsumer() {
|
||||||
|
HashMap<String, Object> configs = new HashMap<>();
|
||||||
|
configs.put(KafkaConfigConstants.BOOTSTRAP_SERVERS,
|
||||||
|
StrFormatter.format("{}:{}", bootstrapServersIP, bootstrapServersPort));
|
||||||
|
configs.put(KafkaConfigConstants.ENABLE_AUTO_COMMIT, enableAutoCommit);
|
||||||
|
configs.put(KafkaConfigConstants.AUTO_COMMIT_INTERVAL, autoCommitInterval);
|
||||||
|
configs.put(KafkaConfigConstants.AUTO_OFFSET_RESET, autoOffsetReset);
|
||||||
|
configs.put(KafkaConfigConstants.FETCH_MAX_WAIT, fetchMaxWait);
|
||||||
|
configs.put(KafkaConfigConstants.FETCH_MIN_SIZE, fetchMinSize);
|
||||||
|
configs.put(KafkaConfigConstants.HEARTBEAT_INTERVAL, heartbeatInterval);
|
||||||
|
configs.put(KafkaConfigConstants.MAX_POLL_RECORDS, maxPollRecords);
|
||||||
|
configs.put(KafkaConfigConstants.GROUP_ID, groupId);
|
||||||
|
Deserializer<String> keyDeserializer = new StringDeserializer();
|
||||||
|
Deserializer<String> valueDeserializer = new StringDeserializer();
|
||||||
|
return new KafkaConsumer<>(configs, keyDeserializer, valueDeserializer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.common.kafka.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.text.StrFormatter;
|
||||||
|
import com.muyu.common.kafka.constant.KafkaConfigConstants;
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.common.serialization.Serializer;
|
||||||
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/28 16:35
|
||||||
|
* @Description Kafka生产者配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class KafkaProducerConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端IP
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.bootstrap-servers-ip}")
|
||||||
|
private String bootstrapServersIP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端口号
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.bootstrap-servers-port}")
|
||||||
|
private String bootstrapServersPort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重试次数
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.retries}")
|
||||||
|
private Integer retries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认批量大小
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.batch-size}")
|
||||||
|
private Integer batchSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总内存字节数
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.buffer-memory}")
|
||||||
|
private Integer bufferMemory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 偏移量
|
||||||
|
*/
|
||||||
|
@Value("${kafka.producer.acks}")
|
||||||
|
private String acks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kafka生产者初始化配置
|
||||||
|
* @return kafka生产者实例
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public KafkaProducer<String, String> kafkaProducer() {
|
||||||
|
HashMap<String, Object> configs = new HashMap<>();
|
||||||
|
configs.put(KafkaConfigConstants.BOOTSTRAP_SERVERS,
|
||||||
|
StrFormatter.format("{}:{}", bootstrapServersIP, bootstrapServersPort));
|
||||||
|
configs.put(KafkaConfigConstants.RETRIES, retries);
|
||||||
|
configs.put(KafkaConfigConstants.BATCH_SIZE, batchSize);
|
||||||
|
configs.put(KafkaConfigConstants.BUFFER_MEMORY, bufferMemory);
|
||||||
|
configs.put(KafkaConfigConstants.ACKS, acks);
|
||||||
|
Serializer<String> keySerializer = new StringSerializer();
|
||||||
|
Serializer<String> valueSerializer = new StringSerializer();
|
||||||
|
return new KafkaProducer<>(configs, keySerializer, valueSerializer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.common.kafka.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/28 20:07
|
||||||
|
* @Description Kafka配置通用常量
|
||||||
|
*/
|
||||||
|
public class KafkaConfigConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务端ip+端口号
|
||||||
|
*/
|
||||||
|
public static final String BOOTSTRAP_SERVERS = "bootstrap.servers";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重试次数
|
||||||
|
*/
|
||||||
|
public static final String RETRIES = "retries";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认批量大小
|
||||||
|
*/
|
||||||
|
public static final String BATCH_SIZE = "batch.size";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总内存字节数
|
||||||
|
*/
|
||||||
|
public static final String BUFFER_MEMORY = "buffer-memory";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 偏移量
|
||||||
|
*/
|
||||||
|
public static final String ACKS = "acks";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启消费者偏移量
|
||||||
|
*/
|
||||||
|
public static final String ENABLE_AUTO_COMMIT = "enable.auto.commit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动提交时间间隔
|
||||||
|
*/
|
||||||
|
public static final String AUTO_COMMIT_INTERVAL = "auto.commit.interval";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动重置偏移量
|
||||||
|
*/
|
||||||
|
public static final String AUTO_OFFSET_RESET = "auto.offset.reset";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求阻塞的最大时间
|
||||||
|
*/
|
||||||
|
public static final String FETCH_MAX_WAIT = "fetch.max.wait";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求应答的最小字节数
|
||||||
|
*/
|
||||||
|
public static final String FETCH_MIN_SIZE = "fetch.min.size";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心跳间隔时间
|
||||||
|
*/
|
||||||
|
public static final String HEARTBEAT_INTERVAL = "heartbeat-interval";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一次调用poll返回的最大记录条数
|
||||||
|
*/
|
||||||
|
public static final String MAX_POLL_RECORDS = "max.poll.records";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定消费组
|
||||||
|
*/
|
||||||
|
public static final String GROUP_ID = "group.id";
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
com.muyu.common.kafka.config.KafkaProducerConfig
|
||||||
|
com.muyu.common.kafka.config.KafkaConsumerConfig
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?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-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-mqtt</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-mqtt消息队列遥测传输协议
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<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>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muyu.common.mqtt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mqtt连接配置
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.common.mqtt
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MQTTConnect
|
||||||
|
* @Date:2024/10/2 9:40
|
||||||
|
*/
|
||||||
|
public class MQTTConnect
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* String topic = "vehicle";
|
||||||
|
* String broker = "tcp://106.15.136.7:1883";
|
||||||
|
* String clientId = "JavaSample";
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义主题字符串,用于MQTT消息交换的频道
|
||||||
|
*/
|
||||||
|
public static final String TOPIC="vehicle";
|
||||||
|
/**
|
||||||
|
*定义代理服务器的连接字符串,格式通常为协议名称,IP地址和端口号
|
||||||
|
*/
|
||||||
|
public static final String BROKER="tcp://106.15.136.7:1883";
|
||||||
|
/**
|
||||||
|
*定义客户端ID,用于在MQTT代理服务器中标识客户端
|
||||||
|
*/
|
||||||
|
public static final String CLIENT_ID ="JavaSample";
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.muyu.common.rabbit.callback;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/10/2 9:26
|
||||||
|
* @Description 消息发送到broker确认回调
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ConfirmCallback implements RabbitTemplate.ConfirmCallback {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
this.rabbitTemplate.setConfirmCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调确认方法(消息发送之后 消息无论发送成功还是失败都会执行这个回调方法)
|
||||||
|
* @param correlationData 回调的相关数据
|
||||||
|
* @param ack 确认结果(true表示消息已经被broker接收,false表示消息未被broker接收)
|
||||||
|
* @param cause 失败原因(当ack为false时,表示拒绝接收消息的原因;当ack为true时,该值为空)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||||
|
if (ack) {
|
||||||
|
log.info("消息发送到broker成功!");
|
||||||
|
} else {
|
||||||
|
log.info("消息发送到broker失败,失败原因:{}", cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.common.rabbit.callback;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.ReturnedMessage;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/10/2 9:33
|
||||||
|
* @Description 消息发送失败时回调
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class ReturnsCallback implements RabbitTemplate.ReturnsCallback {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送到队列失败时执行
|
||||||
|
* @param returnedMessage 返回的消息和元数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
log.info("消息:{}被交换机:{}回退!回退原因:{}", returnedMessage.getMessage().toString(),
|
||||||
|
returnedMessage.getExchange(), returnedMessage.getReplyText());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.muyu.common.rabbit.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/10/2 16:41
|
||||||
|
* @Description RabbitMQ连接和管理功能配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitAdminConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitMQ服务器的主机地址
|
||||||
|
*/
|
||||||
|
@Value("${spring.rabbitmq.host}")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitMQ的用户名
|
||||||
|
*/
|
||||||
|
@Value("${spring.rabbitmq.username}")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitMQ的密码
|
||||||
|
*/
|
||||||
|
@Value("${spring.rabbitmq.password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RabbitMQ的虚拟主机
|
||||||
|
*/
|
||||||
|
@Value("${spring.rabbitmq.virtualhost}")
|
||||||
|
private String virtualhost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建并初始化RabbitAdmin实例
|
||||||
|
*
|
||||||
|
* @return RabbitAdmin 实例
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RabbitAdmin rabbitAdmin() {
|
||||||
|
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory());
|
||||||
|
rabbitAdmin.setAutoStartup(true);
|
||||||
|
return rabbitAdmin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建RabbitMQ连接工厂
|
||||||
|
*
|
||||||
|
* @return ConnectionFactory 实例
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public ConnectionFactory connectionFactory() {
|
||||||
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
|
||||||
|
connectionFactory.setAddresses(host);
|
||||||
|
connectionFactory.setUsername(username);
|
||||||
|
connectionFactory.setPassword(password);
|
||||||
|
connectionFactory.setVirtualHost(virtualhost);
|
||||||
|
|
||||||
|
// 配置发送确认回调时,次配置必须配置,否则即使在RabbitTemplate配置了ConfirmCallback也不会生效
|
||||||
|
connectionFactory.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED);
|
||||||
|
connectionFactory.setPublisherReturns(true);
|
||||||
|
return connectionFactory;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,28 +1,41 @@
|
||||||
package com.muyu.common.rabbit;
|
package com.muyu.common.rabbit.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer;
|
||||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/10/2 10:06
|
||||||
|
* @Description rabbitMQ的监听器配置
|
||||||
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer {
|
public class RabbitListenerConfig implements RabbitListenerConfigurer {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
// 设置为信任所有类型的反序列化,确保消息能够正确反序列化
|
||||||
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
//以下配置RabbitMQ消息服务
|
/**
|
||||||
|
* RabbitMQ连接工厂,用于创建连接
|
||||||
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
public ConnectionFactory connectionFactory;
|
public ConnectionFactory connectionFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MessageConverter jsonMessageConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理器方法工厂
|
* 创建处理器方法工厂的bean
|
||||||
* @return
|
*
|
||||||
|
* @return DefaultMessageHandlerMethodFactory 实例,用于处理消息的转换和方法调用
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public DefaultMessageHandlerMethodFactory handlerMethodFactory() {
|
public DefaultMessageHandlerMethodFactory handlerMethodFactory() {
|
||||||
|
@ -32,8 +45,14 @@ public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置RabbitMQ监听器的消息处理方法工厂。
|
||||||
|
*
|
||||||
|
* @param rabbitListenerEndpointRegistrar 实例,用于注册监听器的配置
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void configureRabbitListeners(RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar) {
|
public void configureRabbitListeners(RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar) {
|
||||||
|
// 注册自定义的消息处理方法工厂
|
||||||
rabbitListenerEndpointRegistrar.setMessageHandlerMethodFactory(handlerMethodFactory());
|
rabbitListenerEndpointRegistrar.setMessageHandlerMethodFactory(handlerMethodFactory());
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
package com.muyu.common.rabbit.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/10/2 9:17
|
||||||
|
* @Description rabbitMQ消息转换器配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitMQMessageConverterConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息转换配置
|
||||||
|
*
|
||||||
|
* @return 消息转换器
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public MessageConverter jsonMessageConverter() {
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1 +1,3 @@
|
||||||
com.muyu.common.rabbit.RabbitListenerConfigurer
|
com.muyu.common.rabbit.config.RabbitAdminConfig
|
||||||
|
com.muyu.common.rabbit.config.RabbitListenerConfig
|
||||||
|
com.muyu.common.rabbit.config.RabbitMQMessageConverterConfig
|
|
@ -29,6 +29,12 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-security</artifactId>
|
<artifactId>cloud-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 公共核心依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ManyDataSource implements ApplicationRunner {
|
||||||
RemoteUserService remoteUserService = SpringUtils.getBean(RemoteUserService.class);
|
RemoteUserService remoteUserService = SpringUtils.getBean(RemoteUserService.class);
|
||||||
Result<List<SysUser>> entListResult = remoteUserService.entList();
|
Result<List<SysUser>> entListResult = remoteUserService.entList();
|
||||||
if (entListResult==null){
|
if (entListResult==null){
|
||||||
throw new SaaSException("saas远调数据源错误");
|
throw new SaaSException("saas远调数据源异常");
|
||||||
}
|
}
|
||||||
List<SysUser> data = entListResult.getData();
|
List<SysUser> data = entListResult.getData();
|
||||||
if (entListResult.getCode() == Result.SUCCESS && data != null){
|
if (entListResult.getCode() == Result.SUCCESS && data != null){
|
||||||
|
@ -91,21 +91,19 @@ public class ManyDataSource implements ApplicationRunner {
|
||||||
@Bean
|
@Bean
|
||||||
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||||
List<EntInfo> entInfoList = dataSourceInfoList();
|
List<EntInfo> entInfoList = dataSourceInfoList();
|
||||||
if(StringUtils.isEmpty(entInfoList)){
|
if (StringUtils.isNotEmpty(entInfoList)) {
|
||||||
throw new SaaSException("数据源信息列表为空或为null");
|
throw new SaaSException("数据元信息列表为空或为null");
|
||||||
}
|
}
|
||||||
Map<Object, Object> dataSourceMap = dataSourceInfoList().stream()
|
Map<Object,Object> dataSourceMap = dataSourceInfoList().stream()
|
||||||
.map(entInfo -> DataSourceInfo.hostAndPortBuild(
|
.map(entInfo -> DataSourceInfo.hostAndPortBuild(
|
||||||
entInfo.getEntCode(),
|
entInfo.getEntCode(),
|
||||||
entInfo.getIp(),
|
entInfo.getIp(),
|
||||||
entInfo.getPort()
|
entInfo.getPort()
|
||||||
)
|
|
||||||
)
|
)
|
||||||
.collect(Collectors.toMap(
|
).collect(Collectors.toMap(
|
||||||
dataSourceInfo -> dataSourceInfo.getKey(),
|
dataSourceInfo -> dataSourceInfo.getKey(),
|
||||||
dataSourceInfo -> druidDataSourceFactory.create(dataSourceInfo)
|
dataSourceInfo -> druidDataSourceFactory.create(dataSourceInfo)
|
||||||
));
|
));
|
||||||
|
|
||||||
//设置动态数据源
|
//设置动态数据源
|
||||||
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||||
dynamicDataSource.setTargetDataSources(dataSourceMap);
|
dynamicDataSource.setTargetDataSources(dataSourceMap);
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package com.muyu.cloud.common.many.datasource.constents;
|
package com.muyu.cloud.common.many.datasource.constents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: zi run
|
* 数据源常量
|
||||||
* @Date 2024/9/20 14:52
|
* @Author chenruijia
|
||||||
|
* @Date 2024/9/29 17:52
|
||||||
* @Description 数据源常量
|
* @Description 数据源常量
|
||||||
*/
|
*/
|
||||||
public class DatasourceContent {
|
public class DatasourceContent {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 数据源实体类
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
* @Date 2024/9/20 14:52
|
* @Date 2024/9/20 14:52
|
||||||
* @Description 数据源实体类
|
* @Description 数据源实体类
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Druid工厂
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
* @Date 2024/9/20 14:52
|
* @Date 2024/9/20 14:52
|
||||||
* @Description Druid工厂
|
* @Description Druid工厂
|
||||||
|
|
|
@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 数据源切换处理
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
* @Date 2024/9/20 14:52
|
* @Date 2024/9/20 14:52
|
||||||
* @Description 数据源切换处理
|
* @Description 数据源切换处理
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.web.method.HandlerMethod;
|
import org.springframework.web.method.HandlerMethod;
|
||||||
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>cloud-common-swagger</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-swagger api接口文档
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- SpringBoot Web -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.common.swagger.annotation;
|
||||||
|
|
||||||
|
import com.muyu.common.swagger.config.SwaggerAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口文档
|
||||||
|
* @ClassName EnableCustomSwagger2
|
||||||
|
* @Description EnableCustomSwagger2:类的描述
|
||||||
|
* @Date 2024/10/6 22:16
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
@Inherited
|
||||||
|
@Import({SwaggerAutoConfiguration.class})
|
||||||
|
public @interface EnableCustomSwagger2 {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
package com.muyu.common.swagger.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.*;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
|
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模块
|
||||||
|
* @ClassName SwaggerAutoConfiguration
|
||||||
|
* @Description SwaggerAutoConfiguration:类的描述
|
||||||
|
* @Date 2024/10/6 22:16
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableSwagger2
|
||||||
|
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||||
|
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
|
||||||
|
@Import({SwaggerBeanPostProcessor.class, SwaggerWebConfiguration.class})
|
||||||
|
public class SwaggerAutoConfiguration {
|
||||||
|
/**
|
||||||
|
* 默认的排除路径,排除Spring Boot默认的错误处理路径和端点
|
||||||
|
*/
|
||||||
|
private static final List<String> DEFAULT_EXCLUDE_PATH = Arrays.asList("/error", "/actuator/**");
|
||||||
|
|
||||||
|
private static final String BASE_PATH = "/**";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Docket api (SwaggerProperties swaggerProperties) {
|
||||||
|
// base-path处理
|
||||||
|
if (swaggerProperties.getBasePath().isEmpty()) {
|
||||||
|
swaggerProperties.getBasePath().add(BASE_PATH);
|
||||||
|
}
|
||||||
|
// noinspection unchecked
|
||||||
|
List<Predicate<String>> basePath = new ArrayList<Predicate<String>>();
|
||||||
|
swaggerProperties.getBasePath().forEach(path -> basePath.add(PathSelectors.ant(path)));
|
||||||
|
|
||||||
|
// exclude-path处理
|
||||||
|
if (swaggerProperties.getExcludePath().isEmpty()) {
|
||||||
|
swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Predicate<String>> excludePath = new ArrayList<>();
|
||||||
|
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
|
||||||
|
|
||||||
|
ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).host(swaggerProperties.getHost())
|
||||||
|
.apiInfo(apiInfo(swaggerProperties)).select()
|
||||||
|
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()));
|
||||||
|
|
||||||
|
swaggerProperties.getBasePath().forEach(p -> builder.paths(PathSelectors.ant(p)));
|
||||||
|
swaggerProperties.getExcludePath().forEach(p -> builder.paths(PathSelectors.ant(p).negate()));
|
||||||
|
|
||||||
|
return builder.build().securitySchemes(securitySchemes()).securityContexts(securityContexts()).pathMapping("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||||
|
*/
|
||||||
|
private List<SecurityScheme> securitySchemes () {
|
||||||
|
List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
||||||
|
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||||
|
return apiKeyList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全上下文
|
||||||
|
*/
|
||||||
|
private List<SecurityContext> securityContexts () {
|
||||||
|
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||||
|
securityContexts.add(
|
||||||
|
SecurityContext.builder()
|
||||||
|
.securityReferences(defaultAuth())
|
||||||
|
.operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
||||||
|
.build());
|
||||||
|
return securityContexts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的全局鉴权策略
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<SecurityReference> defaultAuth () {
|
||||||
|
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||||
|
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||||
|
authorizationScopes[0] = authorizationScope;
|
||||||
|
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||||
|
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||||
|
return securityReferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiInfo apiInfo (SwaggerProperties swaggerProperties) {
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
.title(swaggerProperties.getTitle())
|
||||||
|
.description(swaggerProperties.getDescription())
|
||||||
|
.license(swaggerProperties.getLicense())
|
||||||
|
.licenseUrl(swaggerProperties.getLicenseUrl())
|
||||||
|
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
||||||
|
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
|
||||||
|
.version(swaggerProperties.getVersion())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.muyu.common.swagger.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
|
import org.springframework.util.ReflectionUtils;
|
||||||
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
|
||||||
|
import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
|
||||||
|
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BEAN
|
||||||
|
* @ClassName SwaggerBeanPostProcessor
|
||||||
|
* @Description SwaggerBeanPostProcessor:类的描述
|
||||||
|
* @Date 2024/10/6 22:16
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
public class SwaggerBeanPostProcessor implements BeanPostProcessor {
|
||||||
|
@Override
|
||||||
|
public Object postProcessAfterInitialization (Object bean, String beanName) throws BeansException {
|
||||||
|
if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
|
||||||
|
customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings (List<T> mappings) {
|
||||||
|
List<T> copy = mappings.stream().filter(mapping -> mapping.getPatternParser() == null)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
mappings.clear();
|
||||||
|
mappings.addAll(copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private List<RequestMappingInfoHandlerMapping> getHandlerMappings (Object bean) {
|
||||||
|
try {
|
||||||
|
Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings");
|
||||||
|
field.setAccessible(true);
|
||||||
|
return (List<RequestMappingInfoHandlerMapping>) field.get(bean);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,304 @@
|
||||||
|
package com.muyu.common.swagger.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SWAGGER
|
||||||
|
* @ClassName SwaggerProperties
|
||||||
|
* @Description SwaggerProperties:类的描述
|
||||||
|
* @Date 2024/10/6 22:16
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
@ConfigurationProperties("swagger")
|
||||||
|
public class SwaggerProperties {
|
||||||
|
/**
|
||||||
|
* 是否开启swagger
|
||||||
|
*/
|
||||||
|
private Boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger会解析的包路径
|
||||||
|
**/
|
||||||
|
private String basePackage = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* swagger会解析的url规则
|
||||||
|
**/
|
||||||
|
private List<String> basePath = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在basePath基础上需要排除的url规则
|
||||||
|
**/
|
||||||
|
private List<String> excludePath = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
**/
|
||||||
|
private String title = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
**/
|
||||||
|
private String description = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本
|
||||||
|
**/
|
||||||
|
private String version = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 许可证
|
||||||
|
**/
|
||||||
|
private String license = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 许可证URL
|
||||||
|
**/
|
||||||
|
private String licenseUrl = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务条款URL
|
||||||
|
**/
|
||||||
|
private String termsOfServiceUrl = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* host信息
|
||||||
|
**/
|
||||||
|
private String host = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人信息
|
||||||
|
*/
|
||||||
|
private Contact contact = new Contact();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局统一鉴权配置
|
||||||
|
**/
|
||||||
|
private Authorization authorization = new Authorization();
|
||||||
|
|
||||||
|
public Boolean getEnabled () {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled (Boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBasePackage () {
|
||||||
|
return basePackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBasePackage (String basePackage) {
|
||||||
|
this.basePackage = basePackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getBasePath () {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBasePath (List<String> basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getExcludePath () {
|
||||||
|
return excludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExcludePath (List<String> excludePath) {
|
||||||
|
this.excludePath = excludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle () {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle (String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription () {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription (String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion () {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion (String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicense () {
|
||||||
|
return license;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicense (String license) {
|
||||||
|
this.license = license;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLicenseUrl () {
|
||||||
|
return licenseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseUrl (String licenseUrl) {
|
||||||
|
this.licenseUrl = licenseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTermsOfServiceUrl () {
|
||||||
|
return termsOfServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTermsOfServiceUrl (String termsOfServiceUrl) {
|
||||||
|
this.termsOfServiceUrl = termsOfServiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost () {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost (String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact getContact () {
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContact (Contact contact) {
|
||||||
|
this.contact = contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Authorization getAuthorization () {
|
||||||
|
return authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthorization (Authorization authorization) {
|
||||||
|
this.authorization = authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Contact {
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
**/
|
||||||
|
private String name = "";
|
||||||
|
/**
|
||||||
|
* 联系人url
|
||||||
|
**/
|
||||||
|
private String url = "";
|
||||||
|
/**
|
||||||
|
* 联系人email
|
||||||
|
**/
|
||||||
|
private String email = "";
|
||||||
|
|
||||||
|
public String getName () {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName (String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl () {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl (String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail () {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail (String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Authorization {
|
||||||
|
/**
|
||||||
|
* 鉴权策略ID,需要和SecurityReferences ID保持一致
|
||||||
|
*/
|
||||||
|
private String name = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要开启鉴权URL的正则
|
||||||
|
*/
|
||||||
|
private String authRegex = "^.*$";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鉴权作用域列表
|
||||||
|
*/
|
||||||
|
private List<AuthorizationScope> authorizationScopeList = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<String> tokenUrlList = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getName () {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName (String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthRegex () {
|
||||||
|
return authRegex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthRegex (String authRegex) {
|
||||||
|
this.authRegex = authRegex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AuthorizationScope> getAuthorizationScopeList () {
|
||||||
|
return authorizationScopeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthorizationScopeList (List<AuthorizationScope> authorizationScopeList) {
|
||||||
|
this.authorizationScopeList = authorizationScopeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getTokenUrlList () {
|
||||||
|
return tokenUrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenUrlList (List<String> tokenUrlList) {
|
||||||
|
this.tokenUrlList = tokenUrlList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AuthorizationScope {
|
||||||
|
/**
|
||||||
|
* 作用域名称
|
||||||
|
*/
|
||||||
|
private String scope = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作用域描述
|
||||||
|
*/
|
||||||
|
private String description = "";
|
||||||
|
|
||||||
|
public String getScope () {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope (String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription () {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription (String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.common.swagger.config;
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前台页面
|
||||||
|
* @ClassName SwaggerWebConfiguration
|
||||||
|
* @Description SwaggerWebConfiguration:类的描述
|
||||||
|
* @Date 2024/10/6 22:16
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
public class SwaggerWebConfiguration implements WebMvcConfigurer {
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers (ResourceHandlerRegistry registry) {
|
||||||
|
/** swagger-ui 地址 */
|
||||||
|
registry.addResourceHandler("/swagger-ui/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.car.domain;
|
package com.muyu.common.system.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;
|
||||||
|
@ -9,15 +9,23 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.skywalking.apm.toolkit.trace.Tag;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆表--实体类
|
||||||
|
* @ClassName CarManage
|
||||||
|
* @Description 车辆表
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@TableName(value = "t_car")
|
@TableName(value = "car_manage",autoResultMap = true)
|
||||||
public class SysCar {
|
public class CarManage {
|
||||||
/**
|
/**
|
||||||
* 车辆表
|
* 车辆表
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +38,7 @@ public class SysCar {
|
||||||
/**
|
/**
|
||||||
* 车牌号
|
* 车牌号
|
||||||
*/
|
*/
|
||||||
private String carCoed;
|
private String carCode;
|
||||||
/**
|
/**
|
||||||
* 车牌颜色 1.白色 2.绿色 3.黑色 4.银色 5.红色
|
* 车牌颜色 1.白色 2.绿色 3.黑色 4.银色 5.红色
|
||||||
*/
|
*/
|
||||||
|
@ -40,21 +48,13 @@ public class SysCar {
|
||||||
*/
|
*/
|
||||||
private String carVin;
|
private String carVin;
|
||||||
/**
|
/**
|
||||||
* 车主
|
* 驾驶员
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private long userId;
|
||||||
/**
|
/**
|
||||||
* 车辆配置
|
* 车辆配置
|
||||||
*/
|
*/
|
||||||
private Long typeId;
|
private long configId;
|
||||||
|
|
||||||
/** 车辆品牌 */
|
|
||||||
@Excel(name = "车辆品牌")
|
|
||||||
private String carBrand;
|
|
||||||
|
|
||||||
/** 车辆型号 */
|
|
||||||
@Excel(name = "车辆型号")
|
|
||||||
private String carModel;
|
|
||||||
/**
|
/**
|
||||||
* 年审日期
|
* 年审日期
|
||||||
*/
|
*/
|
||||||
|
@ -83,16 +83,34 @@ public class SysCar {
|
||||||
* 当前档位
|
* 当前档位
|
||||||
*/
|
*/
|
||||||
private Integer carGears;
|
private Integer carGears;
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
private String carModel;
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
private String carBrand;
|
||||||
|
|
||||||
/** 最后一次连线时间 */
|
/** 最后一次连线时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date carLastJoinTime;
|
private Date carLastJoinTime;
|
||||||
|
|
||||||
/** 最后一次离线时间 */
|
/** 最后一次离线时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date carLastOfflineTime;
|
private Date carLastOfflineTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汽车所属企业id
|
||||||
|
*/
|
||||||
|
private Long enterpriseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汽车类型id
|
||||||
|
*/
|
||||||
|
private Long CarTypeId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -64,6 +64,11 @@ public class SysDept extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业ID
|
||||||
|
*/
|
||||||
|
private Long entId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门状态:0正常,1停用
|
* 部门状态:0正常,1停用
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.common.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业表
|
||||||
|
* @Author: zi run
|
||||||
|
* @Date 2024/9/25 22:38
|
||||||
|
* @Description 企业表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "sys_ent", autoResultMap = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class SysEnt extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业编码
|
||||||
|
*/
|
||||||
|
private String entCode;
|
||||||
|
/**
|
||||||
|
* 企业状态
|
||||||
|
*/
|
||||||
|
private Integer entStatus;
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.auth.form;
|
package com.muyu.common.system.domain.form;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登录对象
|
* 用户登录对象
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.common.system.domain.form;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户注册对象
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class RegisterBody extends LoginBody {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称
|
||||||
|
*/
|
||||||
|
private String entName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
private String leader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import com.muyu.common.system.remote.factory.RemoteEntFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业服务
|
||||||
|
* @ClassName RemoteEntService
|
||||||
|
* @PATH com.muyu.common.system.remote:类的路径
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/10/8 10:59
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
path = "/ent",
|
||||||
|
contextId = "remoteEntService",
|
||||||
|
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||||
|
fallbackFactory = RemoteEntFallbackFactory.class
|
||||||
|
)
|
||||||
|
public interface RemoteEntService {
|
||||||
|
/**
|
||||||
|
* 根据ID获取企业信息
|
||||||
|
* @param entId 企业ID
|
||||||
|
* @return 响应结果
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getById/{entId}")
|
||||||
|
Result<SysEnt> getById(@PathVariable(value = "entId") Long entId);
|
||||||
|
// @GetMapping(value = "/{entId}")
|
||||||
|
// Result<EntResp> getById(@PathVariable(value = "entId") Long entId);
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.constant.SecurityConstants;
|
||||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.system.domain.SysUser;
|
import com.muyu.common.system.domain.SysUser;
|
||||||
|
import com.muyu.common.system.domain.form.RegisterBody;
|
||||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
@ -38,7 +39,7 @@ public interface RemoteUserService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/user/register")
|
@PostMapping("/user/register")
|
||||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public Result<Boolean> registerUserInfo (@RequestBody RegisterBody registerBody, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取企业信息
|
* 获取企业信息
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.common.system.remote;
|
||||||
|
|
||||||
|
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.domain.CarManage;
|
||||||
|
import com.muyu.common.system.domain.SysEnt;
|
||||||
|
import com.muyu.common.system.remote.factory.RemoteEntFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警服务
|
||||||
|
* @ClassName RemoteWarnService
|
||||||
|
* @PATH com.muyu.common.system.remote:类的路径
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/10/8 10:59
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
path = "/strategy",
|
||||||
|
contextId = "remoteWarnService",
|
||||||
|
value = ServiceNameConstants.ENTERPRISE_SERVICE,
|
||||||
|
fallbackFactory = RemoteEntFallbackFactory.class
|
||||||
|
)
|
||||||
|
public interface RemoteWarnService {
|
||||||
|
/**
|
||||||
|
* 通过 carTypeId 查询车辆信息
|
||||||
|
* @param carTypeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("carManageShowByCarTypeId")
|
||||||
|
public Result<CarManage> carManageShowByCarTypeId(@RequestParam("carTypeId") Long carTypeId);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.remote.RemoteEntService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业服务降级处理
|
||||||
|
* @ClassName RemoteEntFallbackFactory
|
||||||
|
* @PATH com.muyu.common.system.remote.factory:类的路径
|
||||||
|
* @Date 2024/10/8 10:59
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteEntFallbackFactory implements FallbackFactory<RemoteEntService> {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteEntFallbackFactory.class);
|
||||||
|
@Override
|
||||||
|
public RemoteEntService create(Throwable throwable) {
|
||||||
|
log.error("企业服务调用失败:{}", throwable.getMessage());
|
||||||
|
return new RemoteEntService() {
|
||||||
|
@Override
|
||||||
|
public Result getById(Long entId) {
|
||||||
|
return Result.error("查询企业失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.muyu.common.system.remote.factory;
|
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.system.domain.form.RegisterBody;
|
||||||
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;
|
||||||
|
@ -30,7 +31,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
public Result<Boolean> registerUserInfo (RegisterBody registerBody, String source) {
|
||||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.common.system.remote.factory;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.system.remote.RemoteEntService;
|
||||||
|
import com.muyu.common.system.remote.RemoteWarnService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警服务降级处理--通过预警中车辆类型ID查询车辆信息
|
||||||
|
* @ClassName RemoteWarnFallbackFactory
|
||||||
|
* @PATH com.muyu.common.system.remote.factory:类的路径
|
||||||
|
* @Date 2024/10/8 10:59
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteWarnFallbackFactory implements FallbackFactory<RemoteWarnService> {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(RemoteWarnFallbackFactory.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteWarnService create(Throwable throwable) {
|
||||||
|
log.error("通过预警中车辆类型ID查询车辆信息服务调用失败:{}", throwable.getMessage());
|
||||||
|
return new RemoteWarnService() {
|
||||||
|
@Override
|
||||||
|
public Result carManageShowByCarTypeId(Long carTypeId) {
|
||||||
|
return Result.error("通过预警中车辆类型ID查询车辆信息失败:" + throwable.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
|
||||||
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
|
||||||
|
com.muyu.common.system.remote.factory.RemoteEntFallbackFactory
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
<module>cloud-common-system</module>
|
<module>cloud-common-system</module>
|
||||||
<module>cloud-common-xxl</module>
|
<module>cloud-common-xxl</module>
|
||||||
<module>cloud-common-rabbit</module>
|
<module>cloud-common-rabbit</module>
|
||||||
|
<module>cloud-common-kafka</module>
|
||||||
|
<module>cloud-common-cache</module>
|
||||||
|
<module>cloud-common-swagger</module>
|
||||||
|
<module>cloud-common-mqtt</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-common</artifactId>
|
<artifactId>cloud-common</artifactId>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringCloud Gateway -->
|
<!-- SpringCloud Gateway -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 106.15.136.7:8848
|
addr: 106.15.136.7:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: xzr
|
namespace: dev
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
@ -60,4 +60,4 @@ spring:
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
data-type: json
|
data-type: json
|
||||||
rule-type: gw-flow
|
rule-type: gw-flow
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.muyu;
|
|
||||||
|
|
||||||
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.EnableMyFeignClients;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统模块
|
|
||||||
*
|
|
||||||
* @author muyu
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableMyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class CloudCarApplication {
|
|
||||||
public static void main (String[] args) {
|
|
||||||
SpringApplication.run(CloudCarApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.muyu.car.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
import com.muyu.car.service.SysCarCompanyService;
|
|
||||||
import com.muyu.car.service.SysCarService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数配置 信息操作处理
|
|
||||||
*
|
|
||||||
* @author muyu
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/company")
|
|
||||||
@Tag(name = "SysCarCompanyController", description = "系统参数配置")
|
|
||||||
public class SysCarCompanyController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarCompanyService sysCarCompanyService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询企业表
|
|
||||||
*/
|
|
||||||
@PostMapping("selectCompany")
|
|
||||||
public Result selectCompany(){
|
|
||||||
return Result.success(sysCarCompanyService.list());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
package com.muyu.car.controller;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
import com.muyu.car.service.SysCarCompanyService;
|
|
||||||
import com.muyu.car.service.SysCarService;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.apache.catalina.security.SecurityUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 参数配置 信息操作处理
|
|
||||||
*
|
|
||||||
* @author muyu
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/manage")
|
|
||||||
@Tag(name = "SysCarController", description = "系统参数配置")
|
|
||||||
public class SysCarController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarCompanyService sysCarCompanyService;
|
|
||||||
@Autowired
|
|
||||||
private SysCarService sysCarService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表2
|
|
||||||
* @param carDTO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("CarListShow")
|
|
||||||
public Result<List<CarVO>> CarListShow(@RequestBody CarDTO carDTO){
|
|
||||||
return Result.success(sysCarService.CarListShow(carDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
* @param carId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("CarListShowByCarId")
|
|
||||||
public Result<List<CarVO>> CarListShowByCarId(@RequestParam("carId") Long carId){
|
|
||||||
return Result.success(sysCarService.CarListShowByCarId(carId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表1
|
|
||||||
* @param carVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("CarList")
|
|
||||||
@Operation(summary = "查询列表",description = "车辆管理列表")
|
|
||||||
public Result<TableDataInfo<CarVO>> CarList(@RequestBody CarVO carVO){
|
|
||||||
startPage();
|
|
||||||
return getDataTable(sysCarService.carList(carVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆添加
|
|
||||||
* @param carVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("insertCar")
|
|
||||||
public Result insertCar(@RequestBody CarVO carVO){
|
|
||||||
String key = RandomUtil.randomNumbers(9);
|
|
||||||
// 随机生成车架号
|
|
||||||
carVO.setCarFrame(key);
|
|
||||||
// 随机生成VIN码
|
|
||||||
String key2 = RandomUtil.randomNumbers(17);
|
|
||||||
carVO.setCarVin(key2);
|
|
||||||
sysCarService.insertCar(carVO);
|
|
||||||
return Result.success("车辆添加成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆修改
|
|
||||||
* @param carVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("updataCar")
|
|
||||||
public Result updataCar(@RequestBody CarVO carVO){
|
|
||||||
//
|
|
||||||
carVO.setUserId(SecurityUtils.getUserId());
|
|
||||||
sysCarService.updateById(carVO);
|
|
||||||
return Result.success("车辆修改成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆删除
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("deleteCar")
|
|
||||||
public Result deleteCar(@RequestParam("ids") List<Long> ids){
|
|
||||||
sysCarService.deleteCar(ids);
|
|
||||||
return Result.success("车辆删除成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.muyu.car.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
@TableName(value = "t_company")
|
|
||||||
public class CarCompany {
|
|
||||||
/**
|
|
||||||
* 企业表
|
|
||||||
*/
|
|
||||||
@TableId(value = "company_id",type = IdType.AUTO)
|
|
||||||
private Long companyId;
|
|
||||||
/**
|
|
||||||
* 企业名称
|
|
||||||
*/
|
|
||||||
private String companyName;
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package com.muyu.car.domain.dto;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class CarDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VIN码
|
|
||||||
*/
|
|
||||||
private String carVin;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆型号
|
|
||||||
*/
|
|
||||||
private String typeName;
|
|
||||||
/**
|
|
||||||
* 能源类型 1.电动 2.纯油 3.混动
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer energyType;
|
|
||||||
/**
|
|
||||||
* 档的类型 1.手动 2.自动
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Integer gearType;
|
|
||||||
|
|
||||||
private Integer pageNum = 1;
|
|
||||||
private Integer pageSize = 3;
|
|
||||||
|
|
||||||
/** 最后一次连线时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date carLastJoinTime;
|
|
||||||
|
|
||||||
/** 最后一次离线时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date carLastOfflineTime;
|
|
||||||
/**
|
|
||||||
* 在线状态 1.无信号 2.行驶中 3.已停止
|
|
||||||
*/
|
|
||||||
private Integer carStatus;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 企业名称
|
|
||||||
*/
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String companyName;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.muyu.car.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.car.domain.CarCompany;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置mybatis配置
|
|
||||||
* @Date 2023-11-13 上午 10:05
|
|
||||||
*/
|
|
||||||
public interface SysCarCompanyMapper extends BaseMapper<CarCompany> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.muyu.car.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.car.domain.SysCar;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置mybatis配置
|
|
||||||
* @Date 2023-11-13 上午 10:05
|
|
||||||
*/
|
|
||||||
public interface SysCarMapper extends BaseMapper<CarVO> {
|
|
||||||
/**
|
|
||||||
* 车辆列表
|
|
||||||
* @param queryWrapper
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> carList(LambdaQueryWrapper<CarVO> queryWrapper);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表2
|
|
||||||
* @param carDTO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> CarListShow(CarDTO carDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
* @param carId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> CarListShowByCarId(@Param("carId") Long carId);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.muyu.car.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.car.domain.CarMessage;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysCarMessageMapper extends BaseMapper<CarMessage> {
|
|
||||||
/**
|
|
||||||
* 查询所有报文信息
|
|
||||||
* @param templateId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarMessage> selectMessageShow(Long templateId);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.muyu.car.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.car.domain.CarMessage;
|
|
||||||
import com.muyu.car.domain.CarTemplate;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface SysCarTemplateMapper extends BaseMapper<CarTemplate> {
|
|
||||||
/**
|
|
||||||
* 查询所有报文信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarTemplate> selectTemplateShow();
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.muyu.car.service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.car.domain.CarCompany;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置plus业务层
|
|
||||||
* @Date 2023-11-13 上午 10:06
|
|
||||||
*/
|
|
||||||
public interface SysCarCompanyService extends IService<CarCompany> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询企业表
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//List<CarCompany> selectCompany();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.muyu.car.service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.car.domain.CarCompany;
|
|
||||||
import com.muyu.car.domain.SysCar;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置plus业务层
|
|
||||||
* @Date 2023-11-13 上午 10:06
|
|
||||||
*/
|
|
||||||
public interface SysCarService extends IService<CarVO> {
|
|
||||||
/**
|
|
||||||
* 车辆列表
|
|
||||||
* @param carVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> carList(CarVO carVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆添加
|
|
||||||
* @param carVO
|
|
||||||
*/
|
|
||||||
void insertCar(CarVO carVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆删除
|
|
||||||
* @param ids
|
|
||||||
*/
|
|
||||||
void deleteCar(List<Long> ids);
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 车辆修改
|
|
||||||
// * @param carVO
|
|
||||||
// */
|
|
||||||
// void updataCar(CarVO carVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表2
|
|
||||||
* @param carDTO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> CarListShow(CarDTO carDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
* @param carId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<CarVO> CarListShowByCarId(Long carId);
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.muyu.car.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.car.domain.CarCompany;
|
|
||||||
import com.muyu.car.mapper.SysCarCompanyMapper;
|
|
||||||
import com.muyu.car.service.SysCarCompanyService;
|
|
||||||
import com.muyu.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置plus业务实现层
|
|
||||||
* @Date 2023-11-13 上午 10:06
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SysCarCompanyServiceImpl extends ServiceImpl<SysCarCompanyMapper, CarCompany>
|
|
||||||
implements SysCarCompanyService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
@Autowired
|
|
||||||
private SysCarCompanyMapper sysCarCompanyMapper;
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public List<CarCompany> selectCompany() {
|
|
||||||
// return sysCarCompanyMapper.;
|
|
||||||
// }
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.muyu.car.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.car.domain.CarMessage;
|
|
||||||
import com.muyu.car.mapper.SysCarMessageMapper;
|
|
||||||
import com.muyu.car.service.SysCarMessageService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysCarMessageServiceImpl extends ServiceImpl<SysCarMessageMapper, CarMessage> implements SysCarMessageService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarMessageMapper sysCarMessageMapper;
|
|
||||||
/**
|
|
||||||
* 查询所有报文信息
|
|
||||||
* @param templateId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<CarMessage> selectMessageShow(Long templateId) {
|
|
||||||
return sysCarMessageMapper.selectMessageShow(templateId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询报文信息
|
|
||||||
* @param messageId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CarMessage selectMessageByMessageId(Long messageId) {
|
|
||||||
return sysCarMessageMapper.selectById(messageId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,128 +0,0 @@
|
||||||
package com.muyu.car.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.car.domain.CarCompany;
|
|
||||||
import com.muyu.car.domain.SysCar;
|
|
||||||
import com.muyu.car.domain.dto.CarDTO;
|
|
||||||
import com.muyu.car.domain.vo.CarVO;
|
|
||||||
import com.muyu.car.mapper.SysCarMapper;
|
|
||||||
import com.muyu.car.service.SysCarService;
|
|
||||||
import com.muyu.common.redis.service.RedisService;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zmw
|
|
||||||
* @description: 配置plus业务实现层
|
|
||||||
* @Date 2023-11-13 上午 10:06
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SysCarServiceImpl extends ServiceImpl<SysCarMapper, CarVO>
|
|
||||||
implements SysCarService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
@Autowired
|
|
||||||
private SysCarMapper carMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表
|
|
||||||
* @param carVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<CarVO> carList(CarVO carVO) {
|
|
||||||
|
|
||||||
// MPJLambdaWrapper<CarVO> queryWrapper = new MPJLambdaWrapper<>();
|
|
||||||
// carMapper.selectJoinList(CarVO.class,
|
|
||||||
// queryWrapper.selectAll(CarVO.class)// 主表查询所有
|
|
||||||
// .select(Type::getTypeName)// 获取附表的字段
|
|
||||||
// .select(Type::getEnergyType)
|
|
||||||
// .select(Type::getGearType)
|
|
||||||
// .leftJoin(Type.class,Type::getTypeId,Car::getTypeId)// 左链接
|
|
||||||
// );
|
|
||||||
// // vin码--精确
|
|
||||||
// if(StringUtils.isNotEmpty(carVO.getCarVin())){
|
|
||||||
// queryWrapper.eq(CarVO::getCarVin,carVO.getCarVin());
|
|
||||||
// }
|
|
||||||
// // 车辆型号
|
|
||||||
// if(StringUtils.isNotEmpty(carVO.getTypeName())){
|
|
||||||
// queryWrapper.like(CarVO::getTypeName,carVO.getTypeName());
|
|
||||||
// }
|
|
||||||
// // 能源类型 1.电动 2.纯油 3.混动
|
|
||||||
// if(carVO.getEnergyType()>0){
|
|
||||||
// queryWrapper.eq(CarVO::getEnergyType,carVO.getEnergyType());
|
|
||||||
// }
|
|
||||||
// // 档的类型 1.手动 2.自动
|
|
||||||
// if(carVO.getGearType()>0){
|
|
||||||
// queryWrapper.eq(CarVO::getGearType,carVO.getGearType());
|
|
||||||
// }
|
|
||||||
// // 自定义列表查询
|
|
||||||
//// @Select("")
|
|
||||||
//// this.list(queryWrapper);
|
|
||||||
// // mybatis列表查询
|
|
||||||
// //return carMapper.carList(queryWrapper);
|
|
||||||
// // 单表的列表查询
|
|
||||||
// this.list(
|
|
||||||
// new LambdaQueryWrapper<CarVO>()
|
|
||||||
// .eq(StringUtils.isNotEmpty(carVO.getCarVin()),CarVO::getCarVin,carVO.getCarVin())
|
|
||||||
// .eq(carVO.getEnergyType()>0,CarVO::getEnergyType,carVO.getEnergyType())
|
|
||||||
// .eq(carVO.getGearType()>0,CarVO::getGearType,carVO.getGearType())
|
|
||||||
// .like(StringUtils.isNotEmpty(carVO.getTypeName()),CarVO::getTypeName,carVO.getTypeName())
|
|
||||||
// );
|
|
||||||
// return this.list(queryWrapper);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆添加
|
|
||||||
* @param carVO
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void insertCar(CarVO carVO) {
|
|
||||||
carMapper.insert(carVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 车辆修改
|
|
||||||
// * @param carVO
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public void updataCar(CarVO carVO) {
|
|
||||||
// carMapper.updateById(carVO);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆列表2
|
|
||||||
* @param carDTO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<CarVO> CarListShow(CarDTO carDTO) {
|
|
||||||
return carMapper.CarListShow(carDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询
|
|
||||||
* @param carId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<CarVO> CarListShowByCarId(Long carId) {
|
|
||||||
return carMapper.CarListShowByCarId(carId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆删除
|
|
||||||
* @param ids
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void deleteCar(List<Long> ids) {
|
|
||||||
carMapper.deleteBatchIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.muyu.car.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.car.domain.CarMessage;
|
|
||||||
import com.muyu.car.domain.CarTemplate;
|
|
||||||
import com.muyu.car.mapper.SysCarMessageMapper;
|
|
||||||
import com.muyu.car.mapper.SysCarTemplateMapper;
|
|
||||||
import com.muyu.car.service.SysCarMessageService;
|
|
||||||
import com.muyu.car.service.SysCarTemplateService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class SysCarTemplateServiceImpl extends ServiceImpl<SysCarTemplateMapper, CarTemplate> implements SysCarTemplateService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysCarTemplateMapper sysCarTemplateMapper;
|
|
||||||
/**
|
|
||||||
* 查询所有报文信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<CarTemplate> selectTemplateShow() {
|
|
||||||
return sysCarTemplateMapper.selectTemplateShow();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过id查询报文信息
|
|
||||||
* @param templateId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CarTemplate selectTemplateByTemplateId(Long templateId) {
|
|
||||||
return sysCarTemplateMapper.selectById(templateId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,78 +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.car.mapper.SysCarMapper">
|
|
||||||
|
|
||||||
<!-- 车辆列表 -->
|
|
||||||
<select id="carList" resultType="com.muyu.car.domain.vo.CarVO">
|
|
||||||
SELECT
|
|
||||||
tc.*,
|
|
||||||
tt.energy_type,
|
|
||||||
tt.gear_type,
|
|
||||||
tt.type_name
|
|
||||||
FROM
|
|
||||||
`t_car` tc
|
|
||||||
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
|
|
||||||
<where>
|
|
||||||
<if test="carVin != null and carVin != ''">
|
|
||||||
and tc.car_vin = #{carVin}
|
|
||||||
</if>
|
|
||||||
<if test="typeName != null and typeName != ''">
|
|
||||||
and tt.type_name like concat('%',#{typeName},'%')
|
|
||||||
</if>
|
|
||||||
<if test="energyType != null and energyType > 0 ">
|
|
||||||
and tt.energy_type = #{energyType}
|
|
||||||
</if>
|
|
||||||
<if test="gearType != null and gearType > 0 ">
|
|
||||||
and tt.gear_type = #{gearType}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="CarListShow" resultType="com.muyu.car.domain.vo.CarVO">
|
|
||||||
SELECT
|
|
||||||
tc.*,
|
|
||||||
tt.energy_type,
|
|
||||||
tt.gear_type,
|
|
||||||
tt.type_name
|
|
||||||
FROM
|
|
||||||
`t_car` tc
|
|
||||||
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
|
|
||||||
<where>
|
|
||||||
<if test="carVin != null and carVin != ''">
|
|
||||||
and tc.car_vin = #{carVin}
|
|
||||||
</if>
|
|
||||||
<if test="carLastJoinTime != null and carLastJoinTime != ''">
|
|
||||||
and tc.car_last_join_time = #{carLastJoinTime}
|
|
||||||
</if>
|
|
||||||
<if test="carLastOfflineTime != null and carLastOfflineTime != ''">
|
|
||||||
and tc.car_last_offline_time = #{carVin}
|
|
||||||
</if>
|
|
||||||
<if test="typeName != null and typeName != ''">
|
|
||||||
and tt.type_name like concat('%',#{typeName},'%')
|
|
||||||
</if>
|
|
||||||
<if test="energyType != null and energyType > 0 ">
|
|
||||||
and tt.energy_type = #{energyType}
|
|
||||||
</if>
|
|
||||||
<if test="gearType != null and gearType > 0 ">
|
|
||||||
and tt.gear_type = #{gearType}
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 通过id查询 -->
|
|
||||||
<select id="CarListShowByCarId" resultType="com.muyu.car.domain.vo.CarVO">
|
|
||||||
SELECT
|
|
||||||
tc.*,
|
|
||||||
tt.energy_type,
|
|
||||||
tt.gear_type,
|
|
||||||
tt.type_name
|
|
||||||
FROM
|
|
||||||
`t_car` tc
|
|
||||||
LEFT JOIN `t_type` tt ON tc.type_id = tt.type_id
|
|
||||||
where tc.car_id = #{carId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,20 +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.car.mapper.SysCarMessageMapper">
|
|
||||||
|
|
||||||
<!-- 查询所有报文信息 -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 查询所有报文信息 -->
|
|
||||||
<select id="selectMessageShow" resultType="com.muyu.car.domain.CarMessage">
|
|
||||||
SELECT
|
|
||||||
tcm.*
|
|
||||||
FROM
|
|
||||||
`t_car_message` tcm
|
|
||||||
WHERE
|
|
||||||
tcm.template_id = #{templateId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,13 +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.car.mapper.SysCarTemplateMapper">
|
|
||||||
|
|
||||||
<!-- 查询所有报文信息 -->
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectTemplateShow" resultType="com.muyu.car.domain.CarTemplate">
|
|
||||||
select * from `t_template`
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?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-enterprise</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-enterprise-cache</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>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-modules-enterprise-cache redis 缓存平台
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-cache</artifactId>
|
||||||
|
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.SysCarFault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis故障业务层
|
||||||
|
* @ClassName CarFaultCacheService
|
||||||
|
* @Description CarFaultCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarFaultCacheService extends CacheAbsBasic<String, SysCarFault> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "fault";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis车辆业务层
|
||||||
|
* @ClassName CarManageCacheService
|
||||||
|
* @Description CarManageCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarManageCacheService extends CacheAbsBasic<String, List<CarVO>> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "carManage";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.vo.CarTemplateVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis报文模版业务层
|
||||||
|
* @ClassName CarTemplateCacheService
|
||||||
|
* @Description CarTemplateCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplateVO> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "messageTemplate";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.WarnStrategy;
|
||||||
|
import com.muyu.enterprise.domain.vo.WarnVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis车辆预警业务层
|
||||||
|
* @ClassName CarWarnCacheService
|
||||||
|
* @Description CarWarnCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarWarnCacheService extends CacheAbsBasic<String, WarnVo> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "warn";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis电子围栏业务层
|
||||||
|
* @ClassName ElectronicFenceCacheService
|
||||||
|
* @Description ElectronicFenceCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ElectronicFenceCacheService extends CacheAbsBasic<String, ElectronicFence> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "electronicFence";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
com.muyu.enterprise.cache.CarFaultCacheService
|
||||||
|
com.muyu.enterprise.cache.CarTemplateCacheService
|
||||||
|
com.muyu.enterprise.cache.CarWarnCacheService
|
||||||
|
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
||||||
|
com.muyu.enterprise.cache.CarManageCacheService
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?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-enterprise</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-modules-enterprise-common企业业务平台服务
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<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>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--swagger3依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆配置表--实体类
|
||||||
|
* @ClassName CarConfig
|
||||||
|
* @Description 车辆配置表
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "车辆配置表")
|
||||||
|
@TableName(value = "car_config")
|
||||||
|
public class CarConfig {
|
||||||
|
/**
|
||||||
|
* 车辆配置类
|
||||||
|
*/
|
||||||
|
@TableId(value = "config_id",type = IdType.AUTO)
|
||||||
|
private Long configId;
|
||||||
|
/**
|
||||||
|
* 车辆配置
|
||||||
|
*/
|
||||||
|
private String configName;
|
||||||
|
/**
|
||||||
|
* 能源类型 1.电动 2.纯油 3.混动
|
||||||
|
*/
|
||||||
|
private Integer energyType;
|
||||||
|
/**
|
||||||
|
* 档的类型 1.手动 2.自动
|
||||||
|
*/
|
||||||
|
private Integer gearType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
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 io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* 车辆表--实体类
|
||||||
|
* @ClassName CarManage
|
||||||
|
* @Description 车辆表
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "车辆表")
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "car_manage",autoResultMap = true)
|
||||||
|
public class CarManage {
|
||||||
|
/**
|
||||||
|
* 车辆表
|
||||||
|
*/
|
||||||
|
@TableId(value = "car_id",type = IdType.AUTO)
|
||||||
|
private Long carId;
|
||||||
|
/**
|
||||||
|
* 车架号
|
||||||
|
*/
|
||||||
|
private String carFrame;
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
private String carCode;
|
||||||
|
/**
|
||||||
|
* 车牌颜色 1.白色 2.绿色 3.黑色 4.银色 5.红色
|
||||||
|
*/
|
||||||
|
private Integer carColor;
|
||||||
|
/**
|
||||||
|
* VIN码
|
||||||
|
*/
|
||||||
|
private String carVin;
|
||||||
|
/**
|
||||||
|
* 驾驶员
|
||||||
|
*/
|
||||||
|
private long userId;
|
||||||
|
/**
|
||||||
|
* 车辆配置
|
||||||
|
*/
|
||||||
|
private long configId;
|
||||||
|
/**
|
||||||
|
* 年审日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date audditTime;
|
||||||
|
/**
|
||||||
|
* 行驶证到期日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date licenseTime;
|
||||||
|
/**
|
||||||
|
* 保险到期日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date insuranceTime;
|
||||||
|
/**
|
||||||
|
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||||
|
*/
|
||||||
|
private Integer carStatus;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createdTime;
|
||||||
|
/**
|
||||||
|
* 当前档位
|
||||||
|
*/
|
||||||
|
private Integer carGears;
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
private String carModel;
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
private String carBrand;
|
||||||
|
|
||||||
|
/** 最后一次连线时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date carLastJoinTime;
|
||||||
|
|
||||||
|
/** 最后一次离线时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date carLastOfflineTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汽车所属企业id
|
||||||
|
*/
|
||||||
|
private Long enterpriseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汽车类型id
|
||||||
|
*/
|
||||||
|
private Long CarTypeId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.warn.domain;
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -8,22 +10,24 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 报文表--实体类
|
||||||
* @ClassName CarMessage
|
* @ClassName CarMessage
|
||||||
* @Description 描述
|
* @Description 报文表
|
||||||
* @Author YiBo.Liu
|
* @author MingWei.Zong(微醺)
|
||||||
* @Date 2024/9/22 22:24
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@Tag(name = "报文表")
|
@Tag(name = "报文表")
|
||||||
@TableName(value = "t_car_message")
|
@TableName(value = "car_message")
|
||||||
public class CarMessage {
|
public class CarMessage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报文表
|
* 报文表
|
||||||
*/
|
*/
|
||||||
|
@TableId(value = "message_id" ,type = IdType.AUTO)
|
||||||
private Long messageId;
|
private Long messageId;
|
||||||
/**
|
/**
|
||||||
* 车辆报文类别
|
* 车辆报文类别
|
|
@ -1,18 +1,26 @@
|
||||||
package com.muyu.car.domain;
|
package com.muyu.enterprise.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 io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
/**
|
||||||
|
* 报文类型表--实体类
|
||||||
|
* @ClassName CarMessageType
|
||||||
|
* @Description 报文类型表
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@TableName(value = "t_message_type")
|
@TableName(value = "car_message_type")
|
||||||
|
@Tag(name = "报文类型表")
|
||||||
public class CarMessageType {
|
public class CarMessageType {
|
||||||
/**
|
/**
|
||||||
* 报文
|
* 报文
|
|
@ -1,18 +1,26 @@
|
||||||
package com.muyu.car.domain;
|
package com.muyu.enterprise.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 io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
/**
|
||||||
|
* 报文模版表--实体类
|
||||||
|
* @ClassName CarTemplate
|
||||||
|
* @Description 报文模版表
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@TableName(value = "t_template")
|
@TableName(value = "car_template")
|
||||||
|
@Tag(name = "报文模版表")
|
||||||
public class CarTemplate {
|
public class CarTemplate {
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.warn.domain;
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -8,23 +10,25 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 车辆类型表--实体类
|
||||||
* @ClassName CarType
|
* @ClassName CarType
|
||||||
* @Description 描述
|
* @Description 车辆类型表
|
||||||
* @Author YiBo.Liu
|
* @author YiBo.Liu
|
||||||
* @Date 2024/9/22 16:53
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@Tag(name = "车辆类型表")
|
@Tag(name = "车辆类型表")
|
||||||
@TableName(value = "t_car_type")
|
@TableName(value = "car_type")
|
||||||
public class CarType {
|
public class CarType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型id
|
* 车辆类型id
|
||||||
*/
|
*/
|
||||||
private Integer carTypeId;
|
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||||
|
private long carTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型名称
|
* 车辆类型名称
|
||||||
|
@ -34,7 +38,7 @@ public class CarType {
|
||||||
/**
|
/**
|
||||||
* 模板id
|
* 模板id
|
||||||
*/
|
*/
|
||||||
private Integer templateId;
|
private long templateId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
/**
|
||||||
|
* 故障日志
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description FaultLog:故障日志
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "fault_log",autoResultMap = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Tag(name = "故障日志")
|
||||||
|
public class FaultLog extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 日志ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_log_id", type= IdType.AUTO)
|
||||||
|
@Schema(defaultValue = "日志ID",type = "Long",description = "日志ID")
|
||||||
|
private Long faultLogId;
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "故障码",type = "String",description = "故障码")
|
||||||
|
private String faultLogCodes;
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN")
|
||||||
|
private String faultLogVin;
|
||||||
|
/**
|
||||||
|
* 开始报警时间
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "开始报警时间",type = "Date",description = "开始报警时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultLogStartTime;
|
||||||
|
/**
|
||||||
|
* 结束报警时间
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "结束报警时间",type = "Date",description = "结束报警时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultLogEndTime;
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站内信
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description FaultMessage:站内信
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "fault_message",autoResultMap = true)
|
||||||
|
@Tag(name = "站内信")
|
||||||
|
public class FaultMessage {
|
||||||
|
/**
|
||||||
|
* 站内信ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_message_id", type= IdType.AUTO)
|
||||||
|
@Schema(defaultValue = "站内信ID",type = "Long",description = "站内信ID")
|
||||||
|
private Long faultMessageId;
|
||||||
|
/**
|
||||||
|
* 消息发送人
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "消息发送人",type = "String",description = "消息发送人")
|
||||||
|
private String faultMessageSendName;
|
||||||
|
/**
|
||||||
|
* 消息接收人
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "消息接收人",type = "String",description = "消息发送人")
|
||||||
|
private String faultMessageRemoveName;
|
||||||
|
/**
|
||||||
|
* 消息内容
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "消息内容",type = "String",description = "消息内容")
|
||||||
|
private String faultMessageContent;
|
||||||
|
/**
|
||||||
|
* 发送时间
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "发送时间",type = "Date",description = "发送时间")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date faultMessageSendTime;
|
||||||
|
/**
|
||||||
|
* 消息状态(1:未读,2:已读)
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "消息状态",type = "Integer",description = "消息状态(1:未读,2:已读)")
|
||||||
|
private Integer faultMessageState;
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description FaultRule:故障规则
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "fault_rule",autoResultMap = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Tag(name = "故障规则")
|
||||||
|
public class FaultRule extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 故障规则ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_rule_id", type= IdType.AUTO)
|
||||||
|
@Schema(defaultValue = "故障规则ID",type = "Long",description = "故障规则ID")
|
||||||
|
private Long faultRuleId;
|
||||||
|
/**
|
||||||
|
* 车辆类型ID
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "车辆类型ID",type = "Integer",description = "车辆类型ID")
|
||||||
|
private Integer carTypeId;
|
||||||
|
/**
|
||||||
|
* 故障名称ID
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "故障名称ID",type = "Integer",description = "故障名称ID")
|
||||||
|
private Integer faultId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "故障条件",type = "String",description = "故障条件")
|
||||||
|
private String faultConditions;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "故障规则参数",type = "String",description = "故障规则参数")
|
||||||
|
private String ruleParameters;
|
||||||
|
/**
|
||||||
|
* 车辆类型名称
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "车辆类型名称",type = "String",description = "车辆类型名称")
|
||||||
|
private String carTypeName;
|
||||||
|
/**
|
||||||
|
* 故障名称
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "故障名称",type = "String",description = "故障名称")
|
||||||
|
private String faultName;
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN")
|
||||||
|
private String carVin;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,26 +1,32 @@
|
||||||
package com.muyu.fault.common;
|
package com.muyu.enterprise.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.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
/**
|
||||||
|
* 故障等级
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description FaultSeverity:故障等级
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName(value = "fault_severity",autoResultMap = true)
|
@TableName(value = "fault_severity",autoResultMap = true)
|
||||||
|
@Tag(name = "故障等级")
|
||||||
public class FaultSeverity extends BaseEntity {
|
public class FaultSeverity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 等级ID
|
* 等级ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "id", type= IdType.AUTO)
|
@TableId(value = "fault_severity_id", type= IdType.AUTO)
|
||||||
@Schema(defaultValue = "等级ID",type = "Long",description = "等级ID")
|
@Schema(defaultValue = "等级ID",type = "Long",description = "等级ID")
|
||||||
private Long faultSeverityId;
|
private Long faultSeverityId;
|
||||||
/**
|
/**
|
|
@ -1,24 +1,31 @@
|
||||||
package com.muyu.fault.common;
|
package com.muyu.enterprise.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 io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
/**
|
||||||
|
* 故障类型
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description FaultType:故障类型
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName(value = "falut_type",autoResultMap = true)
|
@TableName(value = "fault_type",autoResultMap = true)
|
||||||
public class FalutType {
|
@Tag(name = "故障类型")
|
||||||
|
public class FaultType{
|
||||||
/**
|
/**
|
||||||
* 故障类型ID
|
* 故障类型ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "faultTypeId", type= IdType.AUTO)
|
@TableId(value = "fault_type_id", type= IdType.AUTO)
|
||||||
@Schema(defaultValue = "故障类型ID",type = "Long",description = "故障类型ID")
|
@Schema(defaultValue = "故障类型ID",type = "Long",description = "故障类型ID")
|
||||||
private Long faultTypeId;
|
private Long faultTypeId;
|
||||||
/**
|
/**
|
|
@ -1,21 +1,31 @@
|
||||||
package com.muyu.fault.common;
|
package com.muyu.enterprise.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 io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障表
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description SysCarFault:故障表
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName(value = "sys_car_fault", autoResultMap = true)
|
@TableName(value = "sys_car_fault", autoResultMap = true)
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Tag(name = "故障表")
|
||||||
public class SysCarFault extends BaseEntity {
|
public class SysCarFault extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 自增主键
|
* 自增主键
|
||||||
|
@ -29,10 +39,15 @@ public class SysCarFault extends BaseEntity {
|
||||||
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
@Schema(defaultValue = "车辆故障编码",type = "String",description = "车辆故障编码")
|
||||||
private String faultCode;
|
private String faultCode;
|
||||||
/**
|
/**
|
||||||
* 车辆故障类型
|
* 车辆故障类型ID
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "车辆故障类型",type = "String",description = "车辆故障类型")
|
@Schema(defaultValue = "车辆故障类型ID",type = "Integer",description = "车辆故障类型ID")
|
||||||
private String faultType;
|
private Integer faultTypeId;
|
||||||
|
/**
|
||||||
|
* 车辆故障规则ID
|
||||||
|
*/
|
||||||
|
@Schema(defaultValue = "车辆故障规则ID",type = "Integer",description = "车辆故障规则ID")
|
||||||
|
public Integer faultRuleId;
|
||||||
/**
|
/**
|
||||||
* 故障VIN编码
|
* 故障VIN编码
|
||||||
*/
|
*/
|
||||||
|
@ -71,6 +86,6 @@ public class SysCarFault extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
||||||
*/
|
*/
|
||||||
@Schema(defaultValue = "启用状态",type = "String",description = "启用状态")
|
@Schema(defaultValue = "启用状态",type = "String",description = "启用状态(1.待处理 2.处理中 3.已处理 4.忽略)")
|
||||||
private String state;
|
private String state;
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.warn.domain;
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 描述
|
||||||
* @ClassName Template
|
* @ClassName Template
|
||||||
* @Description 描述
|
* @Description 描述
|
||||||
* @Author YiBo.Liu
|
* @Author YiBo.Liu
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.many.datasource.domain;
|
package com.muyu.enterprise.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;
|
||||||
|
@ -9,6 +9,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 测试用户实体类
|
||||||
* @Author: zi run
|
* @Author: zi run
|
||||||
* @Date 2024/9/21 0:07
|
* @Date 2024/9/21 0:07
|
||||||
* @Description 测试用户实体类
|
* @Description 测试用户实体类
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.warn.domain;
|
package com.muyu.enterprise.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;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu.warn.domain;
|
package com.muyu.enterprise.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;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue