Compare commits
66 Commits
3202af6ebb
...
ec41019824
Author | SHA1 | Date |
---|---|---|
|
ec41019824 | |
|
b491045ebf | |
|
580172aa76 | |
|
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 | |
|
22675757b3 | |
|
6594363a91 | |
|
517c18f215 | |
|
423836afb7 | |
|
cb79600bc0 | |
|
782f31446b | |
|
47567ff055 | |
|
2d0f557398 | |
|
cd46940e70 | |
|
e9a19e94e9 |
|
@ -26,6 +26,7 @@ logs
|
|||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
*.yml
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
|
|
@ -76,19 +76,18 @@ public class SysLoginService {
|
|||
if (Result.FAIL == userResult.getCode()) {
|
||||
throw new ServiceException(userResult.getMsg());
|
||||
}
|
||||
|
||||
LoginUser userInfo = userResult.getData();
|
||||
SysUser user = userResult.getData().getSysUser();
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
|
||||
if(UserStatus.DELETED.getCode().equals(user.getDelFlag())){
|
||||
recordLogService.recordLogininfor(username,Constants.LOGIN_FAIL,"对不起,您的账号已被删除");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已被删除 ");
|
||||
}
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||
if(UserStatus.DISABLE.getCode().equals(user.getStatus())){
|
||||
recordLogService.recordLogininfor(username,Constants.LOGIN_FAIL,"用户已停用,请联系管理官");
|
||||
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
|
||||
}
|
||||
passwordService.validate(user, password);
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
|
||||
passwordService.validate(user,password);
|
||||
recordLogService.recordLogininfor(username,Constants.LOGIN_SUCCESS,"登录成功");
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
|
@ -128,16 +127,16 @@ public class SysLoginService {
|
|||
throw new ServiceException("密码长度必须在5到20个字符之间");
|
||||
}
|
||||
|
||||
// 注册用户信息
|
||||
//注册用户信息
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(username);
|
||||
sysUser.setNickName(username);
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
Result<?> registerResult = remoteUserService.registerUserInfo(registerBody, SecurityConstants.INNER);
|
||||
|
||||
Result<Boolean> registerResult = remoteUserService.registerUserInfo(registerBody, SecurityConstants.INNER);
|
||||
if (Result.FAIL == registerResult.getCode()) {
|
||||
throw new ServiceException(registerResult.getMsg());
|
||||
}
|
||||
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
|
||||
|
||||
recordLogService.recordLogininfor(username,Constants.REGISTER,"注册成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
port: 9500
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.15.136.7:8848
|
||||
user-name: nacos
|
||||
|
|
|
@ -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,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.listener.RabbitListenerEndpointRegistrar;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
|
||||
/**
|
||||
* @Author: zi run
|
||||
* @Date 2024/10/2 10:06
|
||||
* @Description rabbitMQ的监听器配置
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer {
|
||||
public class RabbitListenerConfig implements RabbitListenerConfigurer {
|
||||
|
||||
static {
|
||||
// 设置为信任所有类型的反序列化,确保消息能够正确反序列化
|
||||
System.setProperty("spring.amqp.deserialization.trust.all", "true");
|
||||
}
|
||||
|
||||
//以下配置RabbitMQ消息服务
|
||||
/**
|
||||
* RabbitMQ连接工厂,用于创建连接
|
||||
*/
|
||||
@Autowired
|
||||
public ConnectionFactory connectionFactory;
|
||||
|
||||
@Autowired
|
||||
private MessageConverter jsonMessageConverter;
|
||||
|
||||
/**
|
||||
* 处理器方法工厂
|
||||
* @return
|
||||
* 创建处理器方法工厂的bean
|
||||
*
|
||||
* @return DefaultMessageHandlerMethodFactory 实例,用于处理消息的转换和方法调用
|
||||
*/
|
||||
@Bean
|
||||
public DefaultMessageHandlerMethodFactory handlerMethodFactory() {
|
||||
|
@ -32,8 +45,14 @@ public class RabbitListenerConfigurer implements org.springframework.amqp.rabbit
|
|||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置RabbitMQ监听器的消息处理方法工厂。
|
||||
*
|
||||
* @param rabbitListenerEndpointRegistrar 实例,用于注册监听器的配置
|
||||
*/
|
||||
@Override
|
||||
public void configureRabbitListeners(RabbitListenerEndpointRegistrar rabbitListenerEndpointRegistrar) {
|
||||
// 注册自定义的消息处理方法工厂
|
||||
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
|
|
@ -91,21 +91,19 @@ public class ManyDataSource implements ApplicationRunner {
|
|||
@Bean
|
||||
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
|
||||
List<EntInfo> entInfoList = dataSourceInfoList();
|
||||
if(StringUtils.isEmpty(entInfoList)){
|
||||
throw new SaaSException("数据源信息列表为空或为null");
|
||||
if (StringUtils.isNotEmpty(entInfoList)) {
|
||||
throw new SaaSException("数据元信息列表为空或为null");
|
||||
}
|
||||
Map<Object, Object> dataSourceMap = dataSourceInfoList().stream()
|
||||
Map<Object,Object> dataSourceMap = dataSourceInfoList().stream()
|
||||
.map(entInfo -> DataSourceInfo.hostAndPortBuild(
|
||||
entInfo.getEntCode(),
|
||||
entInfo.getIp(),
|
||||
entInfo.getPort()
|
||||
)
|
||||
entInfo.getEntCode(),
|
||||
entInfo.getIp(),
|
||||
entInfo.getPort()
|
||||
)
|
||||
.collect(Collectors.toMap(
|
||||
).collect(Collectors.toMap(
|
||||
dataSourceInfo -> dataSourceInfo.getKey(),
|
||||
dataSourceInfo -> druidDataSourceFactory.create(dataSourceInfo)
|
||||
));
|
||||
|
||||
//设置动态数据源
|
||||
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||
dynamicDataSource.setTargetDataSources(dataSourceMap);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
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 数据源常量
|
||||
*/
|
||||
public class DatasourceContent {
|
||||
|
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 数据源实体类
|
||||
* @Author: zi run
|
||||
* @Date 2024/9/20 14:52
|
||||
* @Description 数据源实体类
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
|
|||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* Druid工厂
|
||||
* @Author: zi run
|
||||
* @Date 2024/9/20 14:52
|
||||
* @Description Druid工厂
|
||||
|
|
|
@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* 数据源切换处理
|
||||
* @Author: zi run
|
||||
* @Date 2024/9/20 14:52
|
||||
* @Description 数据源切换处理
|
||||
|
|
|
@ -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/");
|
||||
}
|
||||
}
|
|
@ -22,6 +22,8 @@
|
|||
<module>cloud-common-xxl</module>
|
||||
<module>cloud-common-rabbit</module>
|
||||
<module>cloud-common-kafka</module>
|
||||
<module>cloud-common-cache</module>
|
||||
<module>cloud-common-swagger</module>
|
||||
<module>cloud-common-mqtt</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Gateway -->
|
||||
<!-- SpringCloud Gateway -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
port: 8080
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.15.136.7:8848
|
||||
user-name: nacos
|
||||
|
|
|
@ -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,27 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.FaultRule;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* redis故障业务层
|
||||
* @ClassName CarFaultCacheService
|
||||
* @Description CarFaultCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
public class CarFaultCacheService extends CacheAbsBasic<String, FaultRule> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "faultRule:info:";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("faultRule: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,27 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
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
|
|
@ -28,22 +28,11 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--swagger3maven依赖-->
|
||||
|
||||
<!--swagger3依赖-->
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
</dependency>
|
||||
<!--mqttv3依赖-->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.2</version>
|
||||
</dependency>
|
||||
<!--mqtt依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-mqtt</artifactId>
|
||||
<version>6.2.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -25,10 +25,11 @@ public class CarCompany {
|
|||
/**
|
||||
* 企业表
|
||||
*/
|
||||
@TableId(value = "company_id",type = IdType.AUTO)
|
||||
private Long companyId;
|
||||
@TableId(value = "enterprise_id",type = IdType.AUTO)
|
||||
private Long enterpriseId;
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
private String companyName;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,20 +29,17 @@ public class CarConfig {
|
|||
@TableId(value = "config_id",type = IdType.AUTO)
|
||||
private Long configId;
|
||||
/**
|
||||
* 车辆配置 1.电动 2.纯油 3.混动
|
||||
* 车辆配置
|
||||
*/
|
||||
private String configName;
|
||||
/**
|
||||
* 能源类型
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
*/
|
||||
private String energyType;
|
||||
private Integer energyType;
|
||||
/**
|
||||
* 档的类型 1.手动 2.自动
|
||||
*/
|
||||
private Integer gearType;
|
||||
/**
|
||||
* 报文id
|
||||
*/
|
||||
private Integer companyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class CarManage {
|
|||
/**
|
||||
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||
*/
|
||||
private Integer carStayus;
|
||||
private Integer carStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
@ -90,7 +90,7 @@ public class CarManage {
|
|||
/**
|
||||
* 车辆型号
|
||||
*/
|
||||
private String cardDrand;
|
||||
private String carBrand;
|
||||
|
||||
/** 最后一次连线时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
@ -105,10 +105,7 @@ public class CarManage {
|
|||
/**
|
||||
* 汽车所属企业id
|
||||
*/
|
||||
private Long companyId;
|
||||
/**
|
||||
* 车辆类型 1.轿车 2.跑车 3.越野 4.客车 5.公交 6.其他
|
||||
*/
|
||||
private Integer carType;
|
||||
private Long enterpriseId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 报文模版表--实体类
|
||||
* @ClassName CarTemplate
|
||||
* @Description 报文模版表
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
* 故障规则
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.23
|
||||
* @Description FaultRule:故障规则
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -12,7 +12,7 @@ import lombok.experimental.SuperBuilder;
|
|||
* 故障规则
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.23
|
||||
* @Description FaultrRule:故障规则
|
||||
* @Description FaultRule:故障规则
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
|
@ -21,7 +21,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@TableName(value = "fault_rule",autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Tag(name = "故障规则")
|
||||
public class FaultrRule extends BaseEntity {
|
||||
public class FaultRule extends BaseEntity {
|
||||
/**
|
||||
* 故障规则ID
|
||||
*/
|
||||
|
@ -29,18 +29,40 @@ public class FaultrRule extends BaseEntity {
|
|||
@Schema(defaultValue = "故障规则ID",type = "Long",description = "故障规则ID")
|
||||
private Long faultRuleId;
|
||||
/**
|
||||
* 故障规则名称
|
||||
* 车辆类型ID
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则名称",type = "String",description = "故障规则名称")
|
||||
private String faultRuleName;
|
||||
@Schema(defaultValue = "车辆类型ID",type = "Integer",description = "车辆类型ID")
|
||||
private Integer carTypeId;
|
||||
/**
|
||||
* 故障名称ID
|
||||
*/
|
||||
@Schema(defaultValue = "故障名称ID",type = "Integer",description = "故障名称ID")
|
||||
private Integer faultId;
|
||||
/**
|
||||
* 故障条件
|
||||
*/
|
||||
@Schema(defaultValue = "故障条件",type = "String",description = "故障条件")
|
||||
private String faultConditions;
|
||||
/**
|
||||
* 故障规则参数
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则参数",type = "String",description = "故障规则参数")
|
||||
private String faultRuleParameter;
|
||||
private String ruleParameters;
|
||||
/**
|
||||
* 故障规则描述
|
||||
* 车辆类型名称
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则描述",type = "String",description = "故障规则描述")
|
||||
private String faultRuleDescription;
|
||||
@Schema(defaultValue = "车辆类型名称",type = "String",description = "车辆类型名称")
|
||||
private String carTypeName;
|
||||
/**
|
||||
* 故障名称
|
||||
*/
|
||||
@Schema(defaultValue = "故障名称",type = "String",description = "故障名称")
|
||||
private String faultName;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
@Schema(defaultValue = "车辆VIN",type = "String",description = "车辆VIN")
|
||||
private String carVin;
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ 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.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -42,6 +43,11 @@ public class SysCarFault extends BaseEntity {
|
|||
*/
|
||||
@Schema(defaultValue = "车辆故障类型ID",type = "Integer",description = "车辆故障类型ID")
|
||||
private Integer faultTypeId;
|
||||
/**
|
||||
* 车辆故障规则ID
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障规则ID",type = "Integer",description = "车辆故障规则ID")
|
||||
public Integer faultRuleId;
|
||||
/**
|
||||
* 故障VIN编码
|
||||
*/
|
||||
|
|
|
@ -19,42 +19,27 @@ public class CarDTO {
|
|||
* VIN码
|
||||
*/
|
||||
private String carVin;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆型号
|
||||
* 车辆企业
|
||||
*/
|
||||
private String typeName;
|
||||
private Long enterpriseId;
|
||||
/**
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
* 车辆配置
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer energyType;
|
||||
/**
|
||||
* 档的类型 1.手动 2.自动
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer gearType;
|
||||
private Long configId;
|
||||
|
||||
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;
|
||||
private String carModel;
|
||||
/**
|
||||
* 车辆型号
|
||||
*/
|
||||
private String carBrand;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package com.muyu.enterprise.domain.resp;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.enterprise.domain.SysCarFault;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 故障返回
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 21:11
|
||||
* @Description FaultResp:故障返回
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "故障返回")
|
||||
public class FaultResp {
|
||||
/**
|
||||
* 车辆故障码
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障码",type = "String",description = "车辆故障码")
|
||||
private String faultCode;
|
||||
/**
|
||||
* 车辆故障那类型ID
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障那类型ID",type = "Integer",description = "车辆故障类型ID")
|
||||
private Integer faultTypeId;
|
||||
/**
|
||||
* 车辆故障规则ID
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障规则ID",type = "Integer",description = "车辆故障规则ID")
|
||||
public Integer faultRuleId;
|
||||
/**
|
||||
* 故障VIN编码
|
||||
*/
|
||||
@Schema(defaultValue = "故障VIN编码",type = "String",description = "故障VIN编码")
|
||||
public String carVin;
|
||||
/**
|
||||
* 车辆故障标签
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障标签",type = "String",description = "车辆故障标签")
|
||||
public String faultLabel;
|
||||
/**
|
||||
* 车辆故障位
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障位",type = "String",description = "车辆故障位")
|
||||
public String faultBit;
|
||||
/**
|
||||
* 车辆故障值
|
||||
*/
|
||||
@Schema(defaultValue = "车辆故障值",type = "String",description = "车辆故障值")
|
||||
public String faultValue;
|
||||
/**
|
||||
* v
|
||||
*/
|
||||
@Schema(defaultValue = "故障级别",type = "String",description = "故障级别")
|
||||
public String faultWarn;
|
||||
/**
|
||||
* 报警状态
|
||||
*/
|
||||
@Schema(defaultValue = "报警状态",type = "String",description = "报警状态")
|
||||
public String warnStatus;
|
||||
/**
|
||||
* 故障描述信息
|
||||
*/
|
||||
@Schema(defaultValue = "故障描述信息",type = "String",description = "故障描述信息")
|
||||
public String faultDesc;
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
@Schema(defaultValue = "启用状态",type = "Integer",description = "启用状态")
|
||||
public Integer state;
|
||||
/**
|
||||
* 故障规则名称
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则名称",type = "String",description = "故障规则名称")
|
||||
public String faultRuleName;
|
||||
/**
|
||||
* 故障规则参数
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则参数",type = "String",description = "故障规则参数")
|
||||
public String faultRuleParameter;
|
||||
/**
|
||||
* 故障规则描述
|
||||
*/
|
||||
@Schema(defaultValue = "故障规则描述",type = "String",description = "故障规则描述")
|
||||
public String faultRuleDescription;
|
||||
}
|
|
@ -31,7 +31,7 @@ public class CarVO {
|
|||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carCoed;
|
||||
private String carCode;
|
||||
/**
|
||||
* 车牌颜色 1.白色 2.绿色 3.黑色 4.银色 5.红色
|
||||
*/
|
||||
|
@ -47,7 +47,7 @@ public class CarVO {
|
|||
/**
|
||||
* 车辆配置
|
||||
*/
|
||||
private Integer typeId;
|
||||
private Long configId;
|
||||
/**
|
||||
* 年审日期
|
||||
*/
|
||||
|
@ -94,16 +94,18 @@ public class CarVO {
|
|||
|
||||
|
||||
/** 所属企业 */
|
||||
private Long companyId;
|
||||
private Long enterpriseId;
|
||||
|
||||
/** 车辆车型(如客车,卡车,公交车等) */
|
||||
private String carType;
|
||||
|
||||
|
||||
// /** 车辆车型(如客车,卡车,公交车等) */
|
||||
// private String carType;
|
||||
|
||||
/**
|
||||
* 车辆型号
|
||||
* 车辆配置
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String typeName;
|
||||
private String configName;
|
||||
|
||||
/**
|
||||
* 能源类型 1.电动 2.纯油 3.混动
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-enterprise-remote</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-remote 企业远程调用模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 企业公共模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,10 +1,9 @@
|
|||
package com.muyu.analysis.parsing.remote;
|
||||
package com.muyu.enterprise.remote;
|
||||
|
||||
import com.muyu.analysis.parsing.remote.factory.RemoteClientServiceFactory;
|
||||
import com.muyu.enterprise.remote.factory.RemoteMessageValueServiceFactory;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -12,34 +11,27 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报文模版远程调用接口
|
||||
* 报文数据服务
|
||||
* @Author:李庆帅
|
||||
* @Package:com.muyu.analysis.parsing.feign
|
||||
* @Project:cloud-server
|
||||
* @name:RemoteServiceClient
|
||||
* @Date:2024/9/28 20:38
|
||||
* ,,value = ServiceNameConstants.ENTERPRISE_SERVICE
|
||||
* ,fallbackFactory= RemoteClientServiceFactory.class
|
||||
*/
|
||||
@FeignClient(name = "cloud-enterprise",value = ServiceNameConstants.ENTERPRISE_SERVICE
|
||||
,fallbackFactory= RemoteClientServiceFactory.class
|
||||
@FeignClient(
|
||||
path = "/messageValue",
|
||||
contextId = "remoteMessageValueService",
|
||||
value = ServiceNameConstants.ENTERPRISE_SERVICE,
|
||||
fallbackFactory= RemoteMessageValueServiceFactory.class
|
||||
)
|
||||
public interface RemoteClientService {
|
||||
/**
|
||||
* 根据报文模版id查询报文数据
|
||||
* @param vehicleVin 请求对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
@GetMapping("/vehicleManage/findByVehicleVin/{vehicleVin}")
|
||||
// @Operation(description = "通过车辆vin码查询模板id")
|
||||
public Result<Long> findByVehicleVin(@PathVariable("vehicleVin") String vehicleVin);
|
||||
public interface RemoteMessageValueService {
|
||||
|
||||
/**
|
||||
* 根据报文模版id查询报文数据
|
||||
* @param templateId 请求对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
@GetMapping("/messageValue/findByTemplateId/{templateId}")
|
||||
@GetMapping("/findByTemplateId/{templateId}")
|
||||
// @Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
||||
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId);
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.enterprise.remote;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.remote.factory.RemoteVehicleServiceFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* 车辆管理服务
|
||||
* @Author:李庆帅
|
||||
* @Package:com.muyu.enterprise.remote
|
||||
* @Project:cloud-server
|
||||
* @name:RemoteVehicleService
|
||||
* @Date:2024/10/7 20:53
|
||||
*/
|
||||
@FeignClient(
|
||||
path = "/vehicleManage",
|
||||
contextId = "remoteVehicleService",
|
||||
value = ServiceNameConstants.ENTERPRISE_SERVICE,
|
||||
fallbackFactory= RemoteVehicleServiceFactory.class
|
||||
)
|
||||
public interface RemoteVehicleService {
|
||||
|
||||
/**
|
||||
* 通过车辆vin码查询模板id
|
||||
* @param vehicleVin 请求对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
@GetMapping("/findByVehicleVin/{vehicleVin}")
|
||||
public Result<Long> findByVehicleVin(@PathVariable("vehicleVin") String vehicleVin);
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.muyu.analysis.parsing.remote.factory;
|
||||
package com.muyu.enterprise.remote.factory;
|
||||
|
||||
import com.muyu.analysis.parsing.remote.RemoteClientService;
|
||||
import com.muyu.enterprise.remote.RemoteMessageValueService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报文模版对象服务降级处理
|
||||
* 报文数据服务降级处理
|
||||
* @Author:李庆帅
|
||||
* @Package:com.muyu.analysis.parsing.remote.factory
|
||||
* @Project:cloud-server
|
||||
|
@ -19,21 +19,15 @@ import java.util.List;
|
|||
* @Date:2024/9/28 21:16
|
||||
*/
|
||||
@Component
|
||||
public class RemoteClientServiceFactory
|
||||
implements FallbackFactory<RemoteClientService>
|
||||
public class RemoteMessageValueServiceFactory
|
||||
implements FallbackFactory<RemoteMessageValueService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteClientServiceFactory.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteMessageValueServiceFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteClientService create(Throwable throwable) {
|
||||
public RemoteMessageValueService create(Throwable throwable) {
|
||||
log.error("报文模版传参调用失败:{}", throwable.getMessage());
|
||||
return new RemoteClientService(){
|
||||
|
||||
@Override
|
||||
public Result<Long> findByVehicleVin(String vehicleVin) {
|
||||
return Result.error("报文模版传参调用失败" + throwable.getMessage());
|
||||
}
|
||||
|
||||
return new RemoteMessageValueService(){
|
||||
@Override
|
||||
public Result<List<MessageValueListResp>> findByTemplateId(Long templateId) {
|
||||
return Result.error("报文模版传参调用失败" + throwable.getMessage());
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.enterprise.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.domain.resp.car.MessageValueListResp;
|
||||
import com.muyu.enterprise.remote.RemoteVehicleService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆管理服务降级处理
|
||||
* @Author:李庆帅
|
||||
* @Package:com.muyu.enterprise.remote.factory
|
||||
* @Project:cloud-server
|
||||
* @name:RemoteVehicleServiceFactory
|
||||
* @Date:2024/10/7 20:57
|
||||
*/
|
||||
@Component
|
||||
public class RemoteVehicleServiceFactory implements FallbackFactory<RemoteVehicleService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteVehicleServiceFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteVehicleService create(Throwable throwable) {
|
||||
return new RemoteVehicleService() {
|
||||
@Override
|
||||
public Result<Long> findByVehicleVin(String vehicleVin) {
|
||||
return Result.error("报文模版传参调用失败" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
com.muyu.enterprise.remote.factory.RemoteVehicleServiceFactory
|
||||
com.muyu.enterprise.remote.factory.RemoteMessageValueServiceFactory
|
|
@ -83,6 +83,18 @@
|
|||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 远程调用 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业业务平台 - 公共依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 系统模块
|
||||
* 企业平台微服务启动类
|
||||
*
|
||||
* @author muyu
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.muyu.enterprise.OpenFen;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 企业远调
|
||||
* @ClassName SysEntOpenFen
|
||||
* @Description SysEntOpenFen:类的描述
|
||||
* @Date 2024/10/7 11:52
|
||||
* @author MingWei.Zong(微醺)
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class SysEntFallbackFactory {
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarCompanyService;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -18,27 +19,33 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
@RequestMapping("/carCompany")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarCompanyController", description = "企业表")
|
||||
public class CarCompanyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CarCompanyService sysCarCompanyService;
|
||||
private final CarCompanyService sysCarCompanyService;
|
||||
|
||||
/**
|
||||
* 查询企业表
|
||||
*/
|
||||
@PostMapping("selectCompany")
|
||||
public Result<List<CarCompany>> selectCompany(){
|
||||
return Result.success(sysCarCompanyService.list());
|
||||
startPage();
|
||||
List<CarCompany> list = sysCarCompanyService.list();
|
||||
list.forEach(carCompany -> {
|
||||
|
||||
});
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID查询企业
|
||||
*/
|
||||
@PostMapping("selectCompanyByCompanyId")
|
||||
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){
|
||||
return Result.success(sysCarCompanyService.getById(companyId));
|
||||
public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("enterpriseId") Long enterpriseId){
|
||||
return Result.success(sysCarCompanyService.selectCompanyByCompanyId(enterpriseId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--控制层
|
||||
* @ClassName CarCompanyController
|
||||
* @Description 车辆配置 Controller 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carConfig")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarConfigController", description = "车辆配置")
|
||||
public class CarConfigController extends BaseController {
|
||||
|
||||
private final CarConfigService carConfigService;
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("selectByConfigId")
|
||||
public Result selectByConfigId(@RequestParam("configId") Long configId){
|
||||
startPage();
|
||||
return Result.success(carConfigService.selectByConfigId(configId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
|
@ -14,6 +15,7 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -28,22 +30,37 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carManage")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarManageController", description = "车辆管理")
|
||||
public class CarManageController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CarCompanyService sysCarCompanyService;
|
||||
@Autowired
|
||||
private CarManageService sysCarService;
|
||||
private final CarManageCacheService carManageCacheService;
|
||||
|
||||
private final CarCompanyService sysCarCompanyService;
|
||||
|
||||
private final CarManageService sysCarService;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆列表2
|
||||
* 车辆列表 单表拼接
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarListShow")
|
||||
public Result<List<CarManage>> CarListShow(@RequestBody CarDTO carDTO){
|
||||
@PostMapping("/carListShow2")
|
||||
public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
|
||||
startPage();
|
||||
// 存到缓存中去
|
||||
return Result.success(sysCarService.carListShow2(carDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆列表 联查
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/carListShow")
|
||||
public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){
|
||||
return Result.success(sysCarService.CarListShow(carDTO));
|
||||
}
|
||||
|
||||
|
@ -52,23 +69,11 @@ public class CarManageController extends BaseController {
|
|||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarManageShowByCarId")
|
||||
public Result CarManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
@PostMapping("carManageShowByCarId")
|
||||
public Result carManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
return Result.success(sysCarService.getById(carId));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 车辆列表1
|
||||
// * @param carVO
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("CarList")
|
||||
// @Operation(summary = "查询列表",description = "车辆管理列表")
|
||||
// public Result<TableDataInfo<CarManage>> CarList(@RequestBody CarVO carVO){
|
||||
// startPage();
|
||||
// return getDataTable(sysCarService.carList(carVO));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 车辆添加
|
||||
|
@ -83,8 +88,8 @@ public class CarManageController extends BaseController {
|
|||
// 随机生成VIN码
|
||||
String key2 = RandomUtil.randomNumbers(17);
|
||||
carVO.setCarVin(key2);
|
||||
sysCarService.save(carVO);
|
||||
return Result.success("车辆添加成功");
|
||||
sysCarService.insertCar(carVO);
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,12 @@ package com.muyu.enterprise.controller;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.cache.CarMessageCacheService;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
import com.muyu.enterprise.service.CarMessageService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -20,10 +23,15 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carMessage")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "报文",description = "报文模块")
|
||||
public class CarMessageController extends BaseController {
|
||||
|
||||
private final CarMessageCacheService carMessageCacheService;
|
||||
private final CarMessageService sysCarMessageService;
|
||||
@Autowired
|
||||
private CarMessageService sysCarMessageService;
|
||||
private CarMessageService carMessageService;
|
||||
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
|
@ -31,6 +39,7 @@ public class CarMessageController extends BaseController {
|
|||
*/
|
||||
@PostMapping("selectMessageShow")
|
||||
public List<CarMessage> selectMessageShow(@RequestParam("templateId") Long templateId){
|
||||
startPage();
|
||||
return sysCarMessageService.selectMessageShow(templateId);
|
||||
}
|
||||
|
||||
|
@ -41,8 +50,7 @@ public class CarMessageController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/selectByTemplateId")
|
||||
private Result<List<CarMessage>> selectByTemplateId(@RequestParam("templateId") Integer templateId) {
|
||||
return Result.success(sysCarMessageService.list
|
||||
(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
|
||||
return Result.success(sysCarMessageService.list(new LambdaQueryWrapper<CarMessage>().eq(CarMessage::getTemplateId, templateId)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,6 +69,8 @@ public class CarMessageController extends BaseController {
|
|||
@PostMapping("insertMessage")
|
||||
public Result insertMessage(@RequestBody CarMessage carMessage){
|
||||
sysCarMessageService.save(carMessage);
|
||||
//报文 redis
|
||||
carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.enterprise.domain.CarMessageType;
|
||||
import com.muyu.enterprise.service.CarMessageTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -20,11 +21,13 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carMessageType")
|
||||
@RequestMapping("/carMessageType")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "报文类型" ,description = "报文类型")
|
||||
public class CarMessageTypeController extends BaseController {
|
||||
@Autowired
|
||||
private CarMessageTypeService sysCarMessageTypeService;
|
||||
|
||||
private final CarMessageTypeService sysCarMessageTypeService;
|
||||
|
||||
/**
|
||||
* 查询报文类型
|
||||
|
@ -32,21 +35,18 @@ public class CarMessageTypeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("messageTypeList")
|
||||
public Result messageTypeList(){
|
||||
sysCarMessageTypeService.messageTypeList();
|
||||
startPage();
|
||||
List<CarMessageType> list = sysCarMessageTypeService.list();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加报文类型
|
||||
* @param carMessageType
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("inserMessageType")
|
||||
public Result inserMessageType(@RequestBody CarMessageType carMessageType){
|
||||
/** id 检验 */
|
||||
if(carMessageType.getMessageTypeId()>0){
|
||||
return Result.error("添加要什么id");
|
||||
}
|
||||
/** token 检验 */
|
||||
if(SecurityUtils.getToken().isEmpty()){
|
||||
return Result.error("token不为空");
|
||||
}
|
||||
/** 报文类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageType())){
|
||||
return Result.error("报文类型不能为空");
|
||||
|
@ -74,13 +74,21 @@ public class CarMessageTypeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("updateMessageType")
|
||||
public Result updateMessageType(@RequestBody CarMessageType carMessageType){
|
||||
/** id */
|
||||
if(carMessageType.getMessageTypeId() < 0 ){
|
||||
return Result.error("修改需要id");
|
||||
/** 报文类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageType())){
|
||||
return Result.error("报文类型不能为空");
|
||||
}
|
||||
/** 报文编号 */
|
||||
/** 报文 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageName())){
|
||||
return Result.error("报文不能为空");
|
||||
}
|
||||
/** 报文编码 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageCode())){
|
||||
return Result.error("");
|
||||
return Result.error("报文编码不能为空");
|
||||
}
|
||||
/** 报文字段类型 */
|
||||
if(StringUtils.isEmpty(carMessageType.getMessageClass())){
|
||||
return Result.error("报文字段类型不能为空");
|
||||
}
|
||||
sysCarMessageTypeService.updateById(carMessageType);
|
||||
return Result.success("修改成功");
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.enterprise.service.CarTemplateService;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -18,10 +19,12 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carTemplate") // 报文模版
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "模版模块",description = "报文模版模块")
|
||||
public class CarTemplateController extends BaseController {
|
||||
@Autowired
|
||||
private CarTemplateService sysCarTemplateService;
|
||||
|
||||
private final CarTemplateService sysCarTemplateService;
|
||||
|
||||
/**
|
||||
* 查询所有模版信息
|
||||
|
@ -29,6 +32,7 @@ public class CarTemplateController extends BaseController {
|
|||
*/
|
||||
@PostMapping("selectTemplateShow")
|
||||
public List<CarTemplate> selectTemplateShow(){
|
||||
startPage();
|
||||
return sysCarTemplateService.selectTemplateShow();
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -4,11 +4,14 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.enterprise.domain.CarType;
|
||||
import com.muyu.enterprise.service.CarTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.muyu.common.core.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 车辆类型控制层
|
||||
* @ClassName CarController
|
||||
|
@ -18,11 +21,12 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/carType")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "CarTypeController",description = "车辆类型")
|
||||
public class CarTypeController {
|
||||
|
||||
@Autowired
|
||||
private CarTypeService carTypeService;
|
||||
private final CarTypeService carTypeService;
|
||||
|
||||
/**
|
||||
* 查询所有规则
|
||||
|
@ -30,6 +34,7 @@ public class CarTypeController {
|
|||
*/
|
||||
@GetMapping("/carTypeList")
|
||||
private Result<List<CarType>> carTypeList() {
|
||||
startPage();
|
||||
List<CarType> carTypeList = carTypeService.list();
|
||||
return Result.success(carTypeList);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.muyu.enterprise.controller;
|
|||
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.domain.FaultrRule;
|
||||
import com.muyu.enterprise.service.FaultrRuleService;
|
||||
import com.muyu.enterprise.domain.FaultRule;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -14,42 +14,44 @@ import java.util.List;
|
|||
* 故障的规则控制层
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 11:58
|
||||
* @Description FaultrRuleController:故障的规则控制层
|
||||
* @Description FaultRuleController:故障的规则控制层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
@Tag(name = "故障的规则",description = "对故障数据规则的判断")
|
||||
public class FaultrRuleController {
|
||||
public class FaultRuleController {
|
||||
|
||||
@Autowired
|
||||
private FaultrRuleService faultrRuleService;
|
||||
private FaultRuleService faultRuleList;
|
||||
|
||||
/**
|
||||
* 查询车辆故障列表
|
||||
*/
|
||||
@RequestMapping(value = "/faultRuleList", method = RequestMethod.GET)
|
||||
public Result<List<FaultrRule>> faultRuleList(FaultrRule faultrRule)
|
||||
public Result<List<FaultRule>> faultRuleList(FaultRule faultRule)
|
||||
{
|
||||
List<FaultrRule> list = faultrRuleService.faultRuleList(faultrRule);
|
||||
List<FaultRule> list = faultRuleList.faultRuleList(faultRule);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆规则
|
||||
* @param faultrRule
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
||||
public Result insertRule(@RequestBody FaultrRule faultrRule){
|
||||
return Result.success(faultrRuleService.save(faultrRule));
|
||||
public Result insertRule(@RequestBody FaultRule faultRule){
|
||||
return Result.success(faultRuleList.save(faultRule));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆规则
|
||||
* @param faultrRule
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
||||
public Result updateRule(@RequestBody FaultrRule faultrRule){
|
||||
return Result.success(faultrRuleService.updateById(faultrRule));
|
||||
public Result updateRule(@RequestBody FaultRule faultRule){
|
||||
return Result.success(faultRuleList.updateById(faultRule));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +61,7 @@ public class FaultrRuleController {
|
|||
*/
|
||||
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
||||
public Result byidRuleId(@PathVariable Long faultRuleId){
|
||||
FaultrRule byid = faultrRuleService.byidRuleId(faultRuleId);
|
||||
FaultRule byid = faultRuleList.byidRuleId(faultRuleId);
|
||||
return Result.success(byid);
|
||||
}
|
||||
|
||||
|
@ -69,7 +71,7 @@ public class FaultrRuleController {
|
|||
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||
{
|
||||
faultrRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||
faultRuleList.removeBatchByIds(Arrays.asList(ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.cache.CarFaultCacheService;
|
||||
import com.muyu.enterprise.domain.FaultType;
|
||||
import com.muyu.enterprise.service.FaultTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -19,6 +20,8 @@ import java.util.List;
|
|||
@RequestMapping("/type")
|
||||
@Tag(name = "故障类型",description = "对故障类型的定义")
|
||||
public class FaultTypeController {
|
||||
@Autowired
|
||||
private CarFaultCacheService carFaultCacheService;
|
||||
@Autowired
|
||||
private FaultTypeService faultTypeService;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.enterprise.domain.WarnLogs;
|
||||
import com.muyu.enterprise.service.IWarnLogsService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -23,6 +24,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/logs")
|
||||
@Tag(name = "车辆预警日志",description = "用来记录车辆预警的日志")
|
||||
public class WarnLogsController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.enterprise.domain.WarnRule;
|
||||
import com.muyu.enterprise.service.IWarnRuleService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -24,6 +25,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
@Tag(name = "车辆预警规则",description = "用来客户添加或者修改规则")
|
||||
public class WarnRuleController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.enterprise.domain.resp.WarnStrategy;
|
||||
import com.muyu.enterprise.service.IWarnStrategyService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -23,6 +24,7 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/strategy")
|
||||
@Tag(name = "故障策略",description = "故障策略对应车辆类型用来客户选择")
|
||||
public class WarnStrategyController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--持久层
|
||||
* @ClassName CarManageMapper
|
||||
* @Description 车辆配置 Mapper 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
|
||||
public interface CarConfigMapper extends MPJBaseMapper<CarConfig> {
|
||||
|
||||
}
|
|
@ -2,9 +2,12 @@ package com.muyu.enterprise.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -16,26 +19,7 @@ import java.util.List;
|
|||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarManageMapper extends MPJBaseMapper<CarManage> {
|
||||
|
||||
public interface CarManageMapper extends BaseMapper<CarManage> {
|
||||
/**
|
||||
* 车辆列表
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,5 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CarMessageMapper extends BaseMapper<CarMessage> {
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
* @param templateId
|
||||
* @return
|
||||
*/
|
||||
List<CarMessage> selectMessageShow(Long templateId);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,5 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface CarTemplateMapper extends BaseMapper<CarTemplate> {
|
||||
/**
|
||||
* 查询所有报文信息
|
||||
* @return
|
||||
*/
|
||||
List<CarTemplate> selectTemplateShow();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.enterprise.domain.FaultrRule;
|
||||
import com.muyu.enterprise.domain.FaultRule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 故障规则持久层
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.17
|
||||
* @Description FaultrRuleMapper:故障规则持久层
|
||||
* @Description FaultRuleMapper:故障规则持久层
|
||||
*/
|
||||
@Mapper
|
||||
public interface FaultrRuleMapper extends BaseMapper<FaultrRule> {
|
||||
public interface FaultRuleMapper extends BaseMapper<FaultRule> {
|
||||
}
|
|
@ -12,5 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
* @Description SysCarFaultMapper:故障管理持久层
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysCarFaultMapper extends BaseMapper<SysCarFault>{
|
||||
public interface SysCarFaultMapper extends BaseMapper<SysCarFault> {
|
||||
}
|
||||
|
|
|
@ -10,11 +10,12 @@ import com.muyu.enterprise.domain.CarCompany;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarCompanyService extends IService<CarCompany> {
|
||||
|
||||
/**
|
||||
* 查询企业表
|
||||
* @param enterpriseId
|
||||
* @return
|
||||
*/
|
||||
//List<CarCompany> selectCompany();
|
||||
CarCompany selectCompanyByCompanyId(Long enterpriseId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.enterprise.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--业务层
|
||||
* @ClassName CarConfigService
|
||||
* @Description 车辆配置 Service 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarConfigService extends IService<CarConfig> {
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
CarConfig selectByConfigId(Long configId);
|
||||
}
|
|
@ -14,37 +14,24 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarManageService extends IService<CarManage> {
|
||||
// /**
|
||||
// * 车辆列表
|
||||
// * @param carVO
|
||||
// * @return
|
||||
// */
|
||||
// List<CarManage> carList(CarVO carVO);
|
||||
//
|
||||
// /**
|
||||
// * 车辆添加
|
||||
// * @param carVO
|
||||
// */
|
||||
// void insertCar(CarVO carVO);
|
||||
//
|
||||
// /**
|
||||
// * 车辆删除
|
||||
// * @param ids
|
||||
// */
|
||||
// void deleteCar(List<Long> ids);
|
||||
//
|
||||
//
|
||||
/**
|
||||
* 车辆列表2
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
List<CarManage> CarListShow(CarDTO carDTO);
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// * @param carId
|
||||
// * @return
|
||||
// */
|
||||
// List<CarVO> CarListShowByCarId(Long carId);
|
||||
List<CarVO> carListShow2(CarDTO carDTO);
|
||||
|
||||
/**
|
||||
* 车辆列表
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
List<CarVO> CarListShow(CarDTO carDTO);
|
||||
|
||||
/**
|
||||
* 车辆添加
|
||||
* @param carVO
|
||||
* @return
|
||||
*/
|
||||
void insertCar(CarManage carVO);
|
||||
}
|
||||
|
|
|
@ -12,5 +12,5 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
public interface CarMessageTypeService extends IService<CarMessageType> {
|
||||
List<CarMessageType> messageTypeList();
|
||||
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 故障日志业务层
|
||||
* @Author: chenruijia
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultLogService:故障日志业务层
|
||||
*/
|
||||
public interface FaultLogService extends IService<FaultLog> {
|
||||
List<FaultLog> faultLogList(FaultLog faultLog);
|
||||
|
||||
|
||||
FaultLog byidId(Long faultLogId);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.enterprise.domain.FaultMessage;
|
|||
import java.util.List;
|
||||
/**
|
||||
* 站内信业务层
|
||||
* @Author: chenruijia
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultMessageService:站内信业务层
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.enterprise.domain.FaultrRule;
|
||||
import com.muyu.enterprise.domain.FaultRule;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
|
@ -10,8 +10,8 @@ import java.util.List;
|
|||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultrRuleService:故障规则业务层
|
||||
*/
|
||||
public interface FaultrRuleService extends IService<FaultrRule> {
|
||||
List<FaultrRule> faultRuleList(FaultrRule faultrRule);
|
||||
public interface FaultRuleService extends IService<FaultRule> {
|
||||
List<FaultRule> faultRuleList(FaultRule faultrRule);
|
||||
|
||||
FaultrRule byidRuleId(Long faultRuleId);
|
||||
FaultRule byidRuleId(Long faultRuleId);
|
||||
}
|
|
@ -6,7 +6,7 @@ import com.muyu.enterprise.domain.FaultType;
|
|||
import java.util.List;
|
||||
/**
|
||||
* 故障类型业务层
|
||||
* @Author: chenruijia
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultTypeService:故障类型业务层
|
||||
*/
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.muyu.enterprise.domain.SysCarFault;
|
|||
import java.util.List;
|
||||
/**
|
||||
* 故障管理业务层
|
||||
* @Author: chenruijia
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description SysCarFaultService:故障管理业务层
|
||||
*/
|
||||
|
|
|
@ -29,11 +29,17 @@ public class CarCompanyServiceImpl extends ServiceImpl<CarCompanyMapper, CarComp
|
|||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private CarCompanyMapper sysCarCompanyMapper;
|
||||
private CarCompanyMapper carCompanyMapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param enterpriseId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarCompany selectCompanyByCompanyId(Long enterpriseId) {
|
||||
return carCompanyMapper.selectById(enterpriseId);
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public List<CarCompany> selectCompany() {
|
||||
// return sysCarCompanyMapper.;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import com.muyu.enterprise.mapper.CarConfigMapper;
|
||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import com.muyu.enterprise.service.CarManageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆配置--业务实现层
|
||||
* @ClassName CarConfigServiceImpl
|
||||
* @Description 车辆配置 ServiceImpl 层
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@Service
|
||||
public class CarConfigServiceImpl extends ServiceImpl<CarConfigMapper, CarConfig>
|
||||
implements CarConfigService {
|
||||
@Autowired
|
||||
private CarConfigMapper carConfigMapper;
|
||||
|
||||
/**
|
||||
* 通过 configId 查询企业
|
||||
* @param configId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CarConfig selectByConfigId(Long configId) {
|
||||
CarConfig carConfig = carConfigMapper.selectById(configId);
|
||||
return carConfig;
|
||||
}
|
||||
}
|
|
@ -2,21 +2,26 @@ package com.muyu.enterprise.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.controller.CarCompanyController;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarConfig;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||
import com.muyu.enterprise.domain.vo.CarVO;
|
||||
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||
import com.muyu.enterprise.service.CarCompanyService;
|
||||
import com.muyu.enterprise.service.CarConfigService;
|
||||
import com.muyu.enterprise.service.CarManageService;
|
||||
import com.muyu.common.redis.service.RedisService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,122 +35,80 @@ import java.util.List;
|
|||
public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage>
|
||||
implements CarManageService {
|
||||
|
||||
// @Autowired
|
||||
// private RedisService redisService;
|
||||
// @Autowired
|
||||
// private CarManageMapper carMapper;
|
||||
// // 企业 service
|
||||
// @Autowired
|
||||
// private CarCompanyService carCompanyService;
|
||||
// /**
|
||||
// * 车辆列表
|
||||
// * @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);
|
||||
//// }
|
||||
//
|
||||
@Autowired
|
||||
private CarCompanyService carCompanyService;
|
||||
@Autowired
|
||||
private CarConfigService carConfigService;
|
||||
@Autowired
|
||||
private CarManageCacheService carManageCacheService;
|
||||
@Autowired
|
||||
private CarManageMapper carManageMapper;
|
||||
|
||||
/**
|
||||
* 车辆列表2
|
||||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CarManage> CarListShow(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
// CarCompanyController carCompanyController = new CarCompanyController();
|
||||
public List<CarVO> carListShow2(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||
return lambdaQuery()
|
||||
.eq(StringUtils.isNotEmpty(carManage.getCarVin()), CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getConfigId() > 0, CarManage::getCarVin, carManage.getConfigId())
|
||||
List<CarManage> list = lambdaQuery()
|
||||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getEnterpriseId() != null && carManage.getEnterpriseId() > 0, CarManage::getEnterpriseId, carManage.getEnterpriseId())
|
||||
.list();
|
||||
// list.forEach(carManage1 -> {
|
||||
// // 获取 企业 id
|
||||
// carCompanyController.selectCompanyByCompanyId(carManage1.getCompanyId());
|
||||
// });
|
||||
//
|
||||
// List<CarCompany> data = carCompanyController.selectCompany().getData();
|
||||
// getById()
|
||||
// List<CarManage> list = list();
|
||||
|
||||
// 把 查询出来的车辆数据 copy 到 CarVO
|
||||
List<CarVO> carVOS = BeanUtil.copyToList(list, CarVO.class);
|
||||
// 遍历赋值
|
||||
carVOS.forEach(carVO -> {
|
||||
// 查询出对象,用于赋值
|
||||
CarConfig carConfig = carConfigService.selectByConfigId(carVO.getConfigId());
|
||||
carVO.setConfigName(carConfig.getConfigName());
|
||||
carVO.setEnergyType(carConfig.getEnergyType());
|
||||
carVO.setGearType(carConfig.getGearType());
|
||||
// 查询出对象,用于赋值
|
||||
CarCompany carCompany = carCompanyService.selectCompanyByCompanyId(carVO.getEnterpriseId());
|
||||
carVO.setCompanyName(carCompany.getCompanyName());
|
||||
// 存到 redis
|
||||
carManageCacheService.put(carVO.getCarVin(),new CarManage());
|
||||
});
|
||||
|
||||
|
||||
return carVOS;
|
||||
}
|
||||
@Override
|
||||
public List<CarVO> CarListShow(CarDTO carDTO) {
|
||||
// 获取 企业
|
||||
CarManage carManage = BeanUtil.copyProperties(carDTO, CarManage.class);
|
||||
return carManageMapper.selectJoinList(CarVO.class, new MPJLambdaWrapper<CarManage>()
|
||||
.selectAll(CarManage.class) // 查询所有车辆表
|
||||
.select(CarCompany::getCompanyName)
|
||||
.select(CarConfig::getConfigName)
|
||||
.select(CarConfig::getGearType)
|
||||
.select(CarConfig::getEnergyType)
|
||||
.leftJoin(CarConfig.class, CarConfig::getConfigId, CarManage::getConfigId)
|
||||
.leftJoin(CarCompany.class, CarCompany::getEnterpriseId, CarManage::getEnterpriseId)
|
||||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getEnterpriseId() != null && carManage.getEnterpriseId() > 0, CarManage::getEnterpriseId, carManage.getEnterpriseId())
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// * @param carId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public CarManage CarListShowByCarId(Long carId) {
|
||||
// return carMapper.CarListShowByCarId(carId);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 车辆删除
|
||||
// * @param ids
|
||||
// */
|
||||
// @Override
|
||||
// public void deleteCar(List<Long> ids) {
|
||||
// carMapper.deleteBatchIds(ids);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void insertCar(CarManage carVO) {
|
||||
save(carVO);
|
||||
// 存到缓存中去
|
||||
carManageCacheService.put(carVO.getCarVin(),new CarManage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
import com.muyu.enterprise.mapper.CarMessageMapper;
|
||||
|
@ -7,6 +8,7 @@ import com.muyu.enterprise.service.CarMessageService;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 车辆报文--业务实现层
|
||||
|
@ -27,7 +29,8 @@ public class CarMessageServiceImpl extends ServiceImpl<CarMessageMapper, CarMess
|
|||
*/
|
||||
@Override
|
||||
public List<CarMessage> selectMessageShow(Long templateId) {
|
||||
return sysCarMessageMapper.selectMessageShow(templateId);
|
||||
return list(new LambdaQueryWrapper<CarMessage>()
|
||||
.eq(CarMessage::getTemplateId,templateId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,8 +18,5 @@ import java.util.List;
|
|||
@Service
|
||||
public class CarMessageTypeServiceImpl extends ServiceImpl<CarMessageTypeMapper, CarMessageType> implements CarMessageTypeService {
|
||||
|
||||
@Override
|
||||
public List<CarMessageType> messageTypeList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
|
|||
*/
|
||||
@Override
|
||||
public List<CarTemplate> selectTemplateShow() {
|
||||
return sysCarTemplateMapper.selectTemplateShow();
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.domain.FaultRule;
|
||||
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 故障规则业务实现层
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultrRuleServiceImpl:故障规则业务实现层
|
||||
*/
|
||||
@Service
|
||||
public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, FaultRule> implements FaultRuleService {
|
||||
|
||||
@Override
|
||||
public List<FaultRule> faultRuleList(FaultRule faultRule) {
|
||||
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(faultRule.getFaultName())) {
|
||||
queryWrapper.eq(FaultRule::getFaultName,faultRule.getFaultName());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(faultRule.getRuleParameters())) {
|
||||
queryWrapper.eq(FaultRule::getRuleParameters,faultRule.getRuleParameters());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaultRule byidRuleId(Long faultRuleId) {
|
||||
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(faultRuleId, "规则ID不可为空");
|
||||
queryWrapper.eq(FaultRule::getFaultRuleId, faultRuleId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.enterprise.domain.FaultrRule;
|
||||
import com.muyu.enterprise.mapper.FaultrRuleMapper;
|
||||
import com.muyu.enterprise.service.FaultrRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 故障规则业务实现层
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.19
|
||||
* @Description FaultrRuleServiceImpl:故障规则业务实现层
|
||||
*/
|
||||
@Service
|
||||
public class FaultrRuleServiceImpl extends ServiceImpl<FaultrRuleMapper, FaultrRule> implements FaultrRuleService {
|
||||
|
||||
@Override
|
||||
public List<FaultrRule> faultRuleList(FaultrRule faultrRule) {
|
||||
LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(faultrRule.getFaultRuleName())) {
|
||||
queryWrapper.eq(FaultrRule::getFaultRuleName,faultrRule.getFaultRuleName());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(faultrRule.getFaultRuleParameter())) {
|
||||
queryWrapper.eq(FaultrRule::getFaultRuleParameter,faultrRule.getFaultRuleParameter());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FaultrRule byidRuleId(Long faultRuleId) {
|
||||
LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(faultRuleId, "规则ID不可为空");
|
||||
queryWrapper.eq(FaultrRule::getFaultRuleId, faultRuleId);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
server:
|
||||
port: 10066
|
||||
|
||||
# nacos线上地址
|
||||
nacos:
|
||||
addr: 106.15.136.7:8848
|
||||
user-name: nacos
|
||||
|
|
|
@ -4,75 +4,5 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarManageMapper">
|
||||
|
||||
<!-- 车辆列表 -->
|
||||
<select id="carList" resultType="com.muyu.enterprise.domain.vo.CarVO">
|
||||
SELECT
|
||||
cman.*,
|
||||
cc.config_name,
|
||||
cc.energy_type,
|
||||
cc.gear_type
|
||||
FROM
|
||||
`car_manage` cman
|
||||
LEFT JOIN `car_config` cc ON cman.config_id = cc.config_id
|
||||
<where>
|
||||
<if test="carVin != null and carVin != ''">
|
||||
and cman.car_vin = #{carVin}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and cc.config_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="energyType != null and energyType > 0 ">
|
||||
and cc.energy_type = #{energyType}
|
||||
</if>
|
||||
<if test="gearType != null and gearType > 0 ">
|
||||
and cc.gear_type = #{gearType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="CarListShow" resultType="com.muyu.enterprise.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.enterprise.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>
|
||||
|
|
|
@ -4,17 +4,4 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarMessageMapper">
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
<select id="selectMessageShow" resultType="com.muyu.enterprise.domain.CarMessage">
|
||||
SELECT
|
||||
tcm.*
|
||||
FROM
|
||||
`t_car_message` tcm
|
||||
WHERE
|
||||
tcm.template_id = #{templateId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -4,10 +4,4 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.enterprise.mapper.CarTemplateMapper">
|
||||
|
||||
<!-- 查询所有报文信息 -->
|
||||
|
||||
|
||||
<select id="selectTemplateShow" resultType="com.muyu.enterprise.domain.CarTemplate">
|
||||
select * from `t_template`
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
<modules>
|
||||
<module>cloud-modules-enterprise-server</module>
|
||||
<module>cloud-modules-enterprise-common</module>
|
||||
<module>cloud-modules-enterprise-cache</module>
|
||||
<module>cloud-modules-enterprise-remote</module>
|
||||
</modules>
|
||||
|
||||
<description>
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cloud-modules-event-process</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-event-process 事件处理
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- IotDB会话 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.iotdb</groupId>
|
||||
<artifactId>iotdb-session</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Caffeine本地缓存 -->
|
||||
<dependency>
|
||||
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||
<artifactId>caffeine</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 接口模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-api-doc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 公共核心模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- kafka模块-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- rabbit模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-rabbit</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 企业缓存模块 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.event.process;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* @Author: zi run
|
||||
* @Date 2024/9/28 22:31
|
||||
* @Description 事件处理微服启动类
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class CloudEventProcessApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CloudEventProcessApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.muyu.event.process.basic;
|
||||
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @Author: zi run
|
||||
* @Date 2024/9/30 15:11
|
||||
* @Description 基础事件
|
||||
*/
|
||||
public class BasicEvent<T> extends ApplicationEvent {
|
||||
|
||||
/**
|
||||
* 事件携带的数据
|
||||
*/
|
||||
private final T data;
|
||||
|
||||
/**
|
||||
* 构造函数,初始化事件源和数据
|
||||
*
|
||||
* @param source 事件源对象
|
||||
* @param data 事件携带的数据
|
||||
*/
|
||||
public BasicEvent(Object source, T data) {
|
||||
super(source);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取事件携带的数据
|
||||
*
|
||||
* @return 事件数据
|
||||
*/
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue