Compare commits
119 Commits
master
...
dev.entOpe
Author | SHA1 | Date |
---|---|---|
|
dff832de52 | |
|
e3709fbcbb | |
|
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,45 @@
|
||||||
|
package com.muyu.common.cache.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键基础
|
||||||
|
* @ClassName PrimaryKeyBasic
|
||||||
|
* @Description PrimaryKeyBasic:类的描述
|
||||||
|
* @Date 2024/9/30 0:15
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
public interface PrimaryKeyBasic <K>{
|
||||||
|
/**
|
||||||
|
* key 前缀
|
||||||
|
*/
|
||||||
|
public String keyPre();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
* @param key 缓存键
|
||||||
|
* @return 装修键
|
||||||
|
*/
|
||||||
|
public default String encode(K key){
|
||||||
|
return keyPre() + key.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解码 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,8 @@ 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,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,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
|
|
@ -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,22 @@
|
||||||
|
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,118 @@
|
||||||
|
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,47 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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,303 @@
|
||||||
|
package com.muyu.common.swagger.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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,20 @@
|
||||||
|
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/");
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取企业信息
|
* 获取企业信息
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
<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>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-common</artifactId>
|
<artifactId>cloud-common</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:
|
||||||
|
|
|
@ -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,44 +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_car_message")
|
|
||||||
public class CarMessage {
|
|
||||||
/**
|
|
||||||
* 报文表
|
|
||||||
*/
|
|
||||||
@TableId(value = "message_id",type = IdType.AUTO)
|
|
||||||
private Long messageId;
|
|
||||||
/**
|
|
||||||
* 车辆报文类别
|
|
||||||
*/
|
|
||||||
private String messageType;
|
|
||||||
/**
|
|
||||||
* 开始位下标
|
|
||||||
*/
|
|
||||||
private Integer messageStartIndex;
|
|
||||||
/**
|
|
||||||
* 结束位下标
|
|
||||||
*/
|
|
||||||
private Integer messageEndIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模版id
|
|
||||||
*/
|
|
||||||
private Long templateId;
|
|
||||||
/**
|
|
||||||
* 报文标签
|
|
||||||
*/
|
|
||||||
private String messageLabel;
|
|
||||||
|
|
||||||
}
|
|
|
@ -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,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,29 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis企业业务层
|
||||||
|
* @ClassName CarCompanyCacheService
|
||||||
|
* @Description CarCompanyCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "CarCompany:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("CarCompany:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarFaultRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis故障业务层
|
||||||
|
* @ClassName CarFaultCacheService
|
||||||
|
* @Description CarFaultCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
public class CarFaultCacheService extends CacheAbsBasic<String, CarFaultRule> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "carFaultRule:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("carFaultRule:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis报文业务层
|
||||||
|
* @ClassName CarManageCacheService
|
||||||
|
* @Description CarManageCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "CarManage:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("CarManage:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis车辆管理业务层
|
||||||
|
* @ClassName CarMessageCacheService
|
||||||
|
* @Description CarMessageCacheService:类的描述
|
||||||
|
* @Date 2024/9/30 11:42
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "carMessage:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public String encode(String key) {
|
||||||
|
// return super.encode(key);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("carMessage:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
|
import com.muyu.enterprise.domain.CarTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis报文模版业务层
|
||||||
|
* @ClassName CarTemplateCacheService
|
||||||
|
* @Description CarTemplateCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "carTemplate:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("carTemplate:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
|
import com.muyu.enterprise.domain.WarnRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* redis车辆预警业务层
|
||||||
|
* @ClassName CarWarnCacheService
|
||||||
|
* @Description CarWarnCacheService:类的描述
|
||||||
|
* @Date 2024/10/3 15:22
|
||||||
|
* @author MingWei.Zong
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CarWarnCacheService extends CacheAbsBasic<String, WarnRule> {
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "warnRule:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("warnRule:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
|
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 "electronicFence:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("electronicFence:info:","");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
com.muyu.enterprise.cache.CarCompanyCacheService
|
||||||
|
com.muyu.enterprise.cache.CarFaultCacheService
|
||||||
|
com.muyu.enterprise.cache.CarManageCacheService
|
||||||
|
com.muyu.enterprise.cache.CarMessageCacheService
|
||||||
|
com.muyu.enterprise.cache.CarTemplateCacheService
|
||||||
|
com.muyu.enterprise.cache.CarWarnCacheService
|
||||||
|
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<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>
|
|
@ -1,26 +1,35 @@
|
||||||
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 CarCompany
|
||||||
|
* @Description 企业表
|
||||||
|
* @author MingWei.Zong
|
||||||
|
* @Date 2024/9/28 16:52
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Builder
|
@Builder
|
||||||
@TableName(value = "t_company")
|
@TableName(value = "car_company")
|
||||||
|
@Tag(name = "企业表")
|
||||||
public class CarCompany {
|
public class CarCompany {
|
||||||
/**
|
/**
|
||||||
* 企业表
|
* 企业表
|
||||||
*/
|
*/
|
||||||
@TableId(value = "company_id",type = IdType.AUTO)
|
@TableId(value = "enterprise_id",type = IdType.AUTO)
|
||||||
private Long companyId;
|
private Long enterpriseId;
|
||||||
/**
|
/**
|
||||||
* 企业名称
|
* 企业名称
|
||||||
*/
|
*/
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
}
|
}
|
|
@ -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,216 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 故障规则测试类(故障)
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain.faultrule
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:PureElectricCar
|
||||||
|
* @Date:2024/9/20 20:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@Tag(name = "故障规则测试类")
|
||||||
|
public class CarFaultRule {
|
||||||
|
/**
|
||||||
|
* VIN码
|
||||||
|
*/
|
||||||
|
private String vin;
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private long timestamp;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private double longitude;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private double latitude;
|
||||||
|
/**
|
||||||
|
* 车速
|
||||||
|
*/
|
||||||
|
private double speed;
|
||||||
|
/**
|
||||||
|
* 总里程
|
||||||
|
*/
|
||||||
|
private long TM;
|
||||||
|
/**
|
||||||
|
* 总电压
|
||||||
|
*/
|
||||||
|
private double TV;
|
||||||
|
/**
|
||||||
|
* 总电流
|
||||||
|
*/
|
||||||
|
private double CC;
|
||||||
|
/**
|
||||||
|
* 绝缘电阻
|
||||||
|
*/
|
||||||
|
private double IR;
|
||||||
|
/**
|
||||||
|
* 档位
|
||||||
|
*/
|
||||||
|
private String GP;
|
||||||
|
/**
|
||||||
|
* 加速踏板行程值
|
||||||
|
*/
|
||||||
|
private double APTV;
|
||||||
|
/**
|
||||||
|
* 制动踏板行程值
|
||||||
|
*/
|
||||||
|
private double BPTV;
|
||||||
|
/**
|
||||||
|
* 燃料消耗率
|
||||||
|
*/
|
||||||
|
private double SFC;
|
||||||
|
/**
|
||||||
|
* 电机控制器温度
|
||||||
|
*/
|
||||||
|
private double MCT;
|
||||||
|
/**
|
||||||
|
* 电机转速
|
||||||
|
*/
|
||||||
|
private int MS;
|
||||||
|
/**
|
||||||
|
* 电机转矩
|
||||||
|
*/
|
||||||
|
private double MTO;
|
||||||
|
/**
|
||||||
|
* 电机温度
|
||||||
|
*/
|
||||||
|
private double MTE;
|
||||||
|
/**
|
||||||
|
* 电机电压
|
||||||
|
*/
|
||||||
|
private double MV;
|
||||||
|
/**
|
||||||
|
* 电机电流
|
||||||
|
*/
|
||||||
|
private double MC;
|
||||||
|
/**
|
||||||
|
* 动力电池剩余电量SOC
|
||||||
|
*/
|
||||||
|
private double PBRSOC;
|
||||||
|
/**
|
||||||
|
* 当前状态允许的最大反馈功率
|
||||||
|
*/
|
||||||
|
private double MACSFP;
|
||||||
|
/**
|
||||||
|
* 当前状态允许最大放电功率
|
||||||
|
*/
|
||||||
|
private double CSATMDP;
|
||||||
|
/**
|
||||||
|
* BMS自检计数器
|
||||||
|
*/
|
||||||
|
private int BMS;
|
||||||
|
/**
|
||||||
|
* 动力电池充放电电流
|
||||||
|
*/
|
||||||
|
private double CADC;
|
||||||
|
/**
|
||||||
|
* 动力电池负载端总电压V3
|
||||||
|
*/
|
||||||
|
private double PBLETVV3;
|
||||||
|
/**
|
||||||
|
* 单次最大电压
|
||||||
|
*/
|
||||||
|
private double SMV;
|
||||||
|
/**
|
||||||
|
* 单体电池最低电压
|
||||||
|
*/
|
||||||
|
private double MVOAB;
|
||||||
|
/**
|
||||||
|
* 单体电池最高温度
|
||||||
|
*/
|
||||||
|
private double MAXBT;
|
||||||
|
/**
|
||||||
|
* 单体电池最低温度
|
||||||
|
*/
|
||||||
|
private double MINBT;
|
||||||
|
/**
|
||||||
|
* 动力电池可用容量
|
||||||
|
*/
|
||||||
|
private double PBAC;
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
private String VS;
|
||||||
|
/**
|
||||||
|
* 充电状态
|
||||||
|
*/
|
||||||
|
private String CS;
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
private String RS;
|
||||||
|
/**
|
||||||
|
* SOC
|
||||||
|
*/
|
||||||
|
private double SOC;
|
||||||
|
/**
|
||||||
|
* 可充电储能装置工作状态
|
||||||
|
*/
|
||||||
|
private String RESDWC;
|
||||||
|
/**
|
||||||
|
* EAS
|
||||||
|
*/
|
||||||
|
private String EAS;
|
||||||
|
/**
|
||||||
|
* PTC
|
||||||
|
*/
|
||||||
|
private String PTC;
|
||||||
|
/**
|
||||||
|
* EPS
|
||||||
|
*/
|
||||||
|
private String EPS;
|
||||||
|
/**
|
||||||
|
* ABS
|
||||||
|
*/
|
||||||
|
private String ABS;
|
||||||
|
/**
|
||||||
|
* MCU
|
||||||
|
*/
|
||||||
|
private String MCU;
|
||||||
|
/**
|
||||||
|
* 动力电池加热状态
|
||||||
|
*/
|
||||||
|
private String PBHS;
|
||||||
|
/**
|
||||||
|
* 动力电池当前状态
|
||||||
|
*/
|
||||||
|
private String PBCS;
|
||||||
|
/**
|
||||||
|
* 动力电池保温状态
|
||||||
|
*/
|
||||||
|
private String PBIS;
|
||||||
|
/**
|
||||||
|
* DCDC
|
||||||
|
*/
|
||||||
|
private String DCDC;
|
||||||
|
/**
|
||||||
|
* CHG
|
||||||
|
*/
|
||||||
|
private String CHG;
|
||||||
|
/**
|
||||||
|
* 校验位
|
||||||
|
*/
|
||||||
|
private byte CHB;
|
||||||
|
/**
|
||||||
|
* 截止位
|
||||||
|
*/
|
||||||
|
private byte CUB;
|
||||||
|
/**
|
||||||
|
* 起始位
|
||||||
|
*/
|
||||||
|
private byte SOH;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,23 +1,31 @@
|
||||||
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 com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
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;
|
||||||
|
|
||||||
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
|
||||||
|
@Tag(name = "车辆表")
|
||||||
@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;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版表
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.23
|
||||||
|
* @Description CarTemplate:报文模版表
|
||||||
|
*/
|
||||||
@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,32 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障查询信息结果返回对象
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:Vehicle
|
||||||
|
* @Date:2024/9/20 20:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@Tag(name = "故障查询信息结果返回对象")
|
||||||
|
public class Cheak {
|
||||||
|
/**
|
||||||
|
* 车辆VIN 唯一标识
|
||||||
|
*/
|
||||||
|
private String VIN;
|
||||||
|
/**
|
||||||
|
* 故障信息
|
||||||
|
*/
|
||||||
|
private String faultmessage;
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.FaultConditionUpdReq;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障规则
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FaultCondition
|
||||||
|
* @Date:2024/9/21 19:51
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "fault_condition",autoResultMap = true)
|
||||||
|
@Tag(name = "故障规则")
|
||||||
|
public class FaultCondition {
|
||||||
|
/**
|
||||||
|
* 故障规则表Id
|
||||||
|
*/
|
||||||
|
@TableId(value = "fault_condition_id",type = IdType.AUTO)
|
||||||
|
private long faultConditionId;
|
||||||
|
/**
|
||||||
|
* 车辆类型Id
|
||||||
|
*/
|
||||||
|
private long carTypeId;
|
||||||
|
/**
|
||||||
|
*故障名称Id
|
||||||
|
*/
|
||||||
|
private long messageId;
|
||||||
|
/**
|
||||||
|
* 故障条件
|
||||||
|
*/
|
||||||
|
private String faultConditionIdentification;
|
||||||
|
/**
|
||||||
|
* 故障规则参数
|
||||||
|
*/
|
||||||
|
private BigDecimal faultConditionParameter;
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultCondition faultConditionadd(FaultConditionAddReq faultConditionAddReq){
|
||||||
|
return FaultCondition.builder()
|
||||||
|
.carTypeId(faultConditionAddReq.getCarTypeId())
|
||||||
|
.messageId(faultConditionAddReq.getMessageId())
|
||||||
|
.faultConditionIdentification(faultConditionAddReq.getFaultConditionIdentification())
|
||||||
|
.faultConditionParameter(faultConditionAddReq.getFaultConditionParameter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FaultCondition faultConditionupd(FaultConditionUpdReq faultConditionUpdReq, Supplier<Long> idSupplier){
|
||||||
|
return FaultCondition.builder()
|
||||||
|
.faultConditionId(faultConditionUpdReq.getFaultConditionId())
|
||||||
|
.carTypeId(faultConditionUpdReq.getCarTypeId())
|
||||||
|
.messageId(faultConditionUpdReq.getMessageId())
|
||||||
|
.faultConditionIdentification(faultConditionUpdReq.getFaultConditionIdentification())
|
||||||
|
.faultConditionParameter(faultConditionUpdReq.getFaultConditionParameter())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
package com.muyu.enterprise.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
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;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障标签
|
||||||
|
* @Author:chenruijia
|
||||||
|
* @Package:com.muyu.cloud.faultmanage.domain
|
||||||
|
* @Project:cloud-faultmanage
|
||||||
|
* @name:FaultLabel
|
||||||
|
* @Date:2024/9/17 15:06
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "car_message_type",autoResultMap = true)
|
||||||
|
@Tag(name = "故障标签")
|
||||||
|
public class FaultLabel {
|
||||||
|
/**
|
||||||
|
*自增主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_type_id",type = IdType.AUTO)
|
||||||
|
private long messageTypeId;
|
||||||
|
/**
|
||||||
|
*报文编码
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_code")
|
||||||
|
private String messageTypeCode;
|
||||||
|
/**
|
||||||
|
*报文名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_name")
|
||||||
|
private String messageTypeName;
|
||||||
|
/**
|
||||||
|
*报文所属类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "message_type")
|
||||||
|
private String messageTypeBelongs;
|
||||||
|
|
||||||
|
private String messageClass;
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel addfaultLabel(FaultLabel faultLabel){
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(0)
|
||||||
|
.messageTypeId(faultLabel.getMessageTypeId())
|
||||||
|
.messageTypeCode(faultLabel.getMessageTypeCode())
|
||||||
|
.messageTypeName(faultLabel.getMessageTypeName())
|
||||||
|
.messageTypeBelongs(faultLabel.getMessageTypeBelongs())
|
||||||
|
.messageClass(faultLabel.getMessageClass())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static FaultLabel selectFaultLabel(FaultLabel faultLabel) {
|
||||||
|
return FaultLabel.builder()
|
||||||
|
.messageTypeId(faultLabel.messageTypeId)
|
||||||
|
.messageTypeCode(faultLabel.messageTypeCode)
|
||||||
|
.messageTypeName(faultLabel.messageTypeName)
|
||||||
|
.messageTypeBelongs(faultLabel.messageTypeBelongs)
|
||||||
|
.messageClass(faultLabel.messageClass)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
|
@ -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;
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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 com.muyu.enterprise.domain.req.car.MessageTemplateAddReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageTemplate
|
||||||
|
* @Date:2024/9/26 20:27
|
||||||
|
* @Description: 报文模版
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "message_template", autoResultMap = true)
|
||||||
|
public class MessageTemplate extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文模版主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_template_id", type = IdType.AUTO)
|
||||||
|
private String messageTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版名称
|
||||||
|
*/
|
||||||
|
private String messageTemplateName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版描述
|
||||||
|
*/
|
||||||
|
private String messageTemplateDescribe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版添加数据转换
|
||||||
|
* @param messageTemplateAddReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static MessageTemplate addBuild(MessageTemplateAddReq messageTemplateAddReq){
|
||||||
|
return MessageTemplate.builder()
|
||||||
|
.messageTemplateName(messageTemplateAddReq.getMessageTemplateName())
|
||||||
|
.messageTemplateDescribe(messageTemplateAddReq.getMessageTemplateDescribe())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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 com.muyu.enterprise.domain.req.car.MessageValueAddReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:MessageValue
|
||||||
|
* @Date:2024/9/26 20:29
|
||||||
|
*
|
||||||
|
* 报文类型对象 message_type
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类型实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "message_value", autoResultMap = true)
|
||||||
|
public class MessageValue extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 报文数据主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "message_id", type = IdType.AUTO)
|
||||||
|
private Long messageId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模版主键
|
||||||
|
*/
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文类别
|
||||||
|
*/
|
||||||
|
private String messageType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文编码
|
||||||
|
*/
|
||||||
|
private String messageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文标签
|
||||||
|
*/
|
||||||
|
private String messageLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 起始下标
|
||||||
|
*/
|
||||||
|
private Integer messageStartIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终止下标
|
||||||
|
*/
|
||||||
|
private Integer messageEndIndex;
|
||||||
|
|
||||||
|
public static MessageValue addBuild(MessageValueAddReq messageValueAddReq){
|
||||||
|
return MessageValue.builder()
|
||||||
|
.templateId(messageValueAddReq.getTemplateId())
|
||||||
|
.messageType(messageValueAddReq.getMessageType())
|
||||||
|
.messageCode(messageValueAddReq.getMessageCode())
|
||||||
|
.messageLabel(messageValueAddReq.getMessageLabel())
|
||||||
|
.messageStartIndex(messageValueAddReq.getMessageStartIndex())
|
||||||
|
.messageEndIndex(messageValueAddReq.getMessageEndIndex())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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 com.muyu.common.core.annotation.Excel.ColumnType;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.car.VehicleUpdReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆信息实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:Vehicle
|
||||||
|
* @Date:2024/9/26 20:30
|
||||||
|
* @Description: 车辆信息实体类
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "vehicle", autoResultMap = true)
|
||||||
|
public class Vehicle extends BaseEntity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车辆主键
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆主键", cellType = ColumnType.NUMERIC)
|
||||||
|
@TableId(value = "vehicle_id", type = IdType.AUTO)
|
||||||
|
private Long vehicleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌号
|
||||||
|
*/
|
||||||
|
@Excel(name = "车牌号")
|
||||||
|
private String licenceNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆颜色
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆颜色")
|
||||||
|
private String vehicleColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型外键
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆类型外键")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆品牌")
|
||||||
|
private String vehicleBrand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆型号")
|
||||||
|
private String vehicleModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆行驶证
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆行驶证")
|
||||||
|
private String vehicleLicense;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行驶证到期日期
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date vehicleLicenseDueDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆状态")
|
||||||
|
private String vehicleStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆所属企业外键
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏外键
|
||||||
|
*/
|
||||||
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
||||||
|
return Vehicle.builder()
|
||||||
|
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
||||||
|
.vehicleColor(vehicleAddReq.getVehicleColor())
|
||||||
|
.vehicleVin(vehicleAddReq.getVehicleVin())
|
||||||
|
.vehicleTypeId(vehicleAddReq.getVehicleTypeId())
|
||||||
|
.vehicleBrand(vehicleAddReq.getVehicleBrand())
|
||||||
|
.vehicleModel(vehicleAddReq.getVehicleModel())
|
||||||
|
.vehicleLicense(vehicleAddReq.getVehicleLicense())
|
||||||
|
.vehicleLicenseDueDate(vehicleAddReq.getVehicleLicenseDueDate())
|
||||||
|
.vehicleStatus(vehicleAddReq.getVehicleStatus())
|
||||||
|
.companyId(vehicleAddReq.getCompanyId())
|
||||||
|
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vehicle updBuild(VehicleUpdReq vehicleUpdReq, Supplier<Long> idSupplier){
|
||||||
|
return Vehicle.builder()
|
||||||
|
.vehicleId(idSupplier.get())
|
||||||
|
.licenceNumber(vehicleUpdReq.getLicenceNumber())
|
||||||
|
.vehicleColor(vehicleUpdReq.getVehicleColor())
|
||||||
|
.vehicleVin(vehicleUpdReq.getVehicleVin())
|
||||||
|
.vehicleTypeId(vehicleUpdReq.getVehicleTypeId())
|
||||||
|
.vehicleBrand(vehicleUpdReq.getVehicleBrand())
|
||||||
|
.vehicleModel(vehicleUpdReq.getVehicleModel())
|
||||||
|
.vehicleLicense(vehicleUpdReq.getVehicleLicense())
|
||||||
|
.vehicleLicenseDueDate(vehicleUpdReq.getVehicleLicenseDueDate())
|
||||||
|
.vehicleStatus(vehicleUpdReq.getVehicleStatus())
|
||||||
|
.companyId(vehicleUpdReq.getCompanyId())
|
||||||
|
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.muyu.enterprise.domain.car;
|
||||||
|
|
||||||
|
|
||||||
|
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 com.muyu.common.core.annotation.Excel.ColumnType;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型实体类
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.car.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:VehicleType
|
||||||
|
* @Date:2024/9/26 20:31
|
||||||
|
* @Description: 车辆类型实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "vehicle_type", autoResultMap = true)
|
||||||
|
public class VehicleType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 车辆类型主键
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TableId(value = "vehicle_type_id", type = IdType.AUTO)
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型名称
|
||||||
|
*/
|
||||||
|
private String vehicleTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版外键
|
||||||
|
*/
|
||||||
|
private Long messageTemplateId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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 com.muyu.enterprise.domain.req.ElectroicFenceAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectroicFenceUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceResp;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.fence.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ElectronicFence
|
||||||
|
* @Date:2024/9/17 16:34
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "electronic_fence",autoResultMap = true)
|
||||||
|
public class ElectronicFence extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏类型
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String fenceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*经纬度信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String longitudeLatitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏状态(正常,停用)
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 电子围栏的开始时间
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
// private Date startTime;
|
||||||
|
// /**
|
||||||
|
// * 电子围栏的结束时间
|
||||||
|
// */
|
||||||
|
// private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String fenceDesc;
|
||||||
|
|
||||||
|
public static ElectronicFenceResp bullerResp(ElectronicFence electronicFence){
|
||||||
|
|
||||||
|
return ElectronicFenceResp.builder()
|
||||||
|
.id(electronicFence.getId())
|
||||||
|
.name(electronicFence.getName())
|
||||||
|
.status(electronicFence.getStatus())
|
||||||
|
.fenceType(electronicFence.getFenceType())
|
||||||
|
.longitudeLatitude(electronicFence.getLongitudeLatitude())
|
||||||
|
.desc(electronicFence.getFenceDesc())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ElectronicFence buildElectroicAdd(ElectroicFenceAddReq electroicFenceAddReq){
|
||||||
|
|
||||||
|
return ElectronicFence.builder()
|
||||||
|
.name(electroicFenceAddReq.getName())
|
||||||
|
.fenceDesc(electroicFenceAddReq.getFenceDesc())
|
||||||
|
.status(electroicFenceAddReq.getStatus())
|
||||||
|
.longitudeLatitude(electroicFenceAddReq.getLongitudeLatitude())
|
||||||
|
.fenceType(electroicFenceAddReq.getFenceType())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ElectronicFence buildByElectronicUpd(ElectroicFenceUpdReq electroicFenceUpdReq, Supplier<Long> longSupplier){
|
||||||
|
|
||||||
|
return ElectronicFence.builder()
|
||||||
|
.id(longSupplier.get())
|
||||||
|
.name(electroicFenceUpdReq.getName())
|
||||||
|
.status(electroicFenceUpdReq.getStatus())
|
||||||
|
.fenceDesc(electroicFenceUpdReq.getFenceDesc())
|
||||||
|
.longitudeLatitude(electroicFenceUpdReq.getLongitudeLatitude())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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 com.muyu.enterprise.domain.req.ElectronicFenceGroupAddReq;
|
||||||
|
import com.muyu.enterprise.domain.req.ElectronicFenceGroupUpdReq;
|
||||||
|
import com.muyu.enterprise.domain.resp.ElectronicFenceGroupResp;
|
||||||
|
import com.muyu.enterprise.domain.resp.GroupFenceListresp;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.fence.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:ElectronicFenceGroup
|
||||||
|
* @Date:2024/9/18 11:14
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName(value = "electronic_fence_group",autoResultMap = true)
|
||||||
|
public class ElectronicFenceGroup extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 围栏组优先级
|
||||||
|
*/
|
||||||
|
private Integer priority;
|
||||||
|
/**
|
||||||
|
* 围栏组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
/**
|
||||||
|
* 围栏组类型
|
||||||
|
*/
|
||||||
|
private String groupType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
public static GroupFenceListresp buildGroupFence(ElectronicFenceGroup electronicFenceGroup){
|
||||||
|
|
||||||
|
return GroupFenceListresp.builder()
|
||||||
|
.id(electronicFenceGroup.getId())
|
||||||
|
.groupName(electronicFenceGroup.groupName)
|
||||||
|
.priority(electronicFenceGroup.getPriority())
|
||||||
|
.status(electronicFenceGroup.getStatus())
|
||||||
|
.groupType(electronicFenceGroup.groupType)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static ElectronicFenceGroupResp buildElectronicFenceGroupResp (ElectronicFenceGroup electronicFenceGroup){
|
||||||
|
|
||||||
|
return ElectronicFenceGroupResp.builder()
|
||||||
|
.id(electronicFenceGroup.getId())
|
||||||
|
.groupName(electronicFenceGroup.groupName)
|
||||||
|
.priority(electronicFenceGroup.getPriority())
|
||||||
|
.status(electronicFenceGroup.getStatus())
|
||||||
|
.groupType(electronicFenceGroup.groupType)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ElectronicFenceGroup buildByAdd(ElectronicFenceGroupAddReq addReq){
|
||||||
|
|
||||||
|
|
||||||
|
return ElectronicFenceGroup.builder()
|
||||||
|
.groupName(addReq.getGroupName())
|
||||||
|
.groupType(addReq.getGroupType())
|
||||||
|
.status(addReq.getStatus())
|
||||||
|
.priority(addReq.getPriority())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ElectronicFenceGroup buildByUpd(ElectronicFenceGroupUpdReq updReq, Supplier<Long> ids){
|
||||||
|
|
||||||
|
|
||||||
|
return ElectronicFenceGroup.builder()
|
||||||
|
.id(ids.get())
|
||||||
|
.groupName(updReq.getGroupName())
|
||||||
|
.groupType(updReq.getGroupType())
|
||||||
|
.status(updReq.getStatus())
|
||||||
|
.priority(updReq.getPriority())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.enterprise.domain.dateBase;
|
||||||
|
|
||||||
|
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.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:李庆帅
|
||||||
|
* @Package:com.muyu.fence.domain
|
||||||
|
* @Project:cloud-server
|
||||||
|
* @name:FenceGroupMid
|
||||||
|
* @Date:2024/9/19 21:01
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 链表实体类
|
||||||
|
*/
|
||||||
|
@Tag(name = "围栏组连接表")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "fence_group_mid",autoResultMap = true)
|
||||||
|
public class FenceGroupMid {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中间表的自增
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
private Long groupId;
|
||||||
|
private Long fenceId;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.enterprise.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 Long enterpriseId;
|
||||||
|
/**
|
||||||
|
* 车辆配置
|
||||||
|
*/
|
||||||
|
private Long configId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||||
|
*/
|
||||||
|
private Integer carStatus;
|
||||||
|
/**
|
||||||
|
* 车辆品牌
|
||||||
|
*/
|
||||||
|
private String carModel;
|
||||||
|
/**
|
||||||
|
* 车辆型号
|
||||||
|
*/
|
||||||
|
private String carBrand;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue