Compare commits

..

8 Commits

Author SHA1 Message Date
Aaaaaaaa 4a8406d4b7 修改位置 2024-09-29 18:38:49 +08:00
Aaaaaaaa ebf78f9b14 修改位置 2024-09-29 10:36:36 +08:00
Aaaaaaaa dd08255e8d Kafka生产者 2024-09-29 10:24:50 +08:00
Aaaaaaaa 3bff2fa630 MQTT传输 接收者 2024-09-29 10:19:43 +08:00
Aaaaaaaa 824c2118dd 报文解析 2024-09-29 08:44:27 +08:00
Aaaaaaaa d3810706f5 报文解析 2024-09-29 08:32:58 +08:00
Aaaaaaaa ad84ffb8c2 报文解析 2024-09-28 16:29:34 +08:00
Aaaaaaaa fa64eefa03 报文分类管理 2024-09-27 12:27:29 +08:00
1884 changed files with 1853 additions and 199439 deletions

3
.gitignore vendored
View File

@ -12,8 +12,6 @@ out
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
@ -28,7 +26,6 @@ logs
*.iws
*.iml
*.ipr
*.yml
### JRebel ###
rebel.xml

View File

@ -66,7 +66,7 @@ public class TokenController {
@PostMapping("register")
public Result<?> register (@RequestBody RegisterBody registerBody) {
// 用户注册
sysLoginService.register(registerBody);
sysLoginService.register(registerBody.getUsername(), registerBody.getPassword());
return Result.success();
}
}

View File

@ -6,7 +6,6 @@ package com.muyu.auth.form;
* @author muyu
*/
public class LoginBody {
/**
*
*/
@ -17,8 +16,6 @@ public class LoginBody {
*/
private String password;
public String getUsername () {
return username;
}

View File

@ -1,39 +1,10 @@
package com.muyu.auth.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*
* @author muyu
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class RegisterBody extends LoginBody {
/**
*
*/
private String firmName;
/**
*
*/
private String email;
/**
*
*/
private String phonenumber;
/**
*
*/
private String nickName;
}

View File

@ -1,6 +1,5 @@
package com.muyu.auth.service;
import com.muyu.auth.form.RegisterBody;
import com.muyu.common.core.constant.CacheConstants;
import com.muyu.common.core.constant.Constants;
import com.muyu.common.core.constant.SecurityConstants;
@ -13,8 +12,6 @@ import com.muyu.common.core.utils.StringUtils;
import com.muyu.common.core.utils.ip.IpUtils;
import com.muyu.common.redis.service.RedisService;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.common.system.domain.Firm;
import com.muyu.common.system.remote.RemoteFirmService;
import com.muyu.common.system.remote.RemoteUserService;
import com.muyu.common.system.domain.SysUser;
import com.muyu.common.system.domain.LoginUser;
@ -31,9 +28,6 @@ public class SysLoginService {
@Autowired
private RemoteUserService remoteUserService;
@Autowired
private RemoteFirmService remoteFirmService;
@Autowired
private SysPasswordService passwordService;
@ -104,47 +98,31 @@ public class SysLoginService {
/**
*
*/
public void register (RegisterBody registerBody) {
public void register (String username, String password) {
// 用户名或密码为空 错误
if (StringUtils.isAnyBlank(registerBody.getUsername(), registerBody.getPassword())) {
if (StringUtils.isAnyBlank(username, password)) {
throw new ServiceException("用户/密码必须填写");
}
if (registerBody.getUsername().length() < UserConstants.USERNAME_MIN_LENGTH
|| registerBody.getUsername().length() > UserConstants.USERNAME_MAX_LENGTH) {
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
throw new ServiceException("账户长度必须在2到20个字符之间");
}
if (registerBody.getPassword().length() < UserConstants.PASSWORD_MIN_LENGTH
|| registerBody.getPassword().length() > UserConstants.PASSWORD_MAX_LENGTH) {
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
throw new ServiceException("密码长度必须在5到20个字符之间");
}
String firmName = registerBody.getFirmName();
Result<Firm> byFirmName = remoteFirmService.findByFirmName(firmName);
Firm data = byFirmName.getData();
if (null != data){
throw new ServiceException("公司名称已经存在");
}
// 注册用户信息
SysUser sysUser = new SysUser();
//公司账号
sysUser.setUserName(registerBody.getUsername());
//公司邮箱
sysUser.setEmail(registerBody.getEmail());
//公司号码
sysUser.setPhonenumber(registerBody.getPhonenumber());
//密码
sysUser.setPassword(SecurityUtils.encryptPassword(registerBody.getPassword()));
//公司注册人名称
sysUser.setNickName(registerBody.getNickName());
//企业名称
sysUser.setFirmName(registerBody.getFirmName());
sysUser.setUserName(username);
sysUser.setNickName(username);
sysUser.setPassword(SecurityUtils.encryptPassword(password));
Result<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
if (Result.FAIL == registerResult.getCode()) {
throw new ServiceException(registerResult.getMsg());
}
recordLogService.recordLogininfor(registerBody.getUsername(), Constants.REGISTER, "注册成功");
recordLogService.recordLogininfor(username, Constants.REGISTER, "注册成功");
}
}

View File

@ -1,47 +0,0 @@
# Tomcat
server:
port: 9500
# nacos线上地址
nacos:
addr: 159.75.188.178:8848
user-name: nacos
password: nacos
namespace: xxy
# Spring
spring:
application:
# 应用名称
name: cloud-auth
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
config:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
# 系统共享配置
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -16,11 +16,6 @@ public class SecurityConstants {
*/
public static final String DETAILS_FIRM_ID = "firm_id";
/**
* ID
*/
public static final String DETAILS_DEPT_ID = "dept_id";
/**
*
*/
@ -56,5 +51,5 @@ public class SecurityConstants {
*/
public static final String ROLE_PERMISSION = "role_permission";
public static final String SAAS_KEY = "ent-code";
public static final String SAAS_KEY = "ent_code";
}

View File

@ -151,16 +151,6 @@ public class JwtUtils {
return getValue(claims, SecurityConstants.DETAILS_USERNAME);
}
/**
* SAAS
*
* @param claims
* @return SAAS
*/
public static String getSaaSKey(Claims claims) {
return getValue(claims, SecurityConstants.SAAS_KEY);
}
/**
*
*
@ -172,13 +162,4 @@ public class JwtUtils {
public static String getValue (Claims claims, String key) {
return Convert.toStr(claims.get(key), "");
}
/**
*
* @param claims
* @return
*/
public static String getDeptId(Claims claims) {
return getValue(claims, SecurityConstants.DETAILS_DEPT_ID);
}
}

View File

@ -501,5 +501,4 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
}
return sb.toString();
}
}

View File

@ -18,16 +18,18 @@
</properties>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-redis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.0.0</version>
</dependency>
<!-- 项目公共核心 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,9 +1,14 @@
package com.muyu.common.kafka.constants;
/**
* @Author:
* @date: 2024/7/10
* @Description: kafka
* @Version 1.0.0
*/
public class KafkaConstants {
public final static String KafkaTopic = "carJsons";
public final static String KafkaTopic = "kafka_topic";
// public final static String KafkaGrop = "kafka_grop";
public final static String KafkaGrop = "kafka_grop";
}

View File

@ -1,76 +0,0 @@
package com.muyu.kafkaconfig;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
/**
* @Author
* @Packagecom.muyu.carData.config.kafkaconfig
* @Projectcloud-server-8
* @nameKafkaConfig
* @Date2024/9/28 12:19
*/
@Configuration
public class KafkaConfig {
@Bean
public KafkaProducer kafkaProducer(){
HashMap<String, Object> configs = new HashMap<>();
configs.put("bootstrap.servers","60.204.221.52:9092");
configs.put("retries",2);
configs.put("batch.size",16384);
//生产者可用于缓冲等待发送到服务器的记录的总内存字节数
configs.put("buffer-memory",3554432);
/**
* ,
*acks=0,0,producer.(socket)
* .,,(retries)(),-1.
*acks=1,1,leader,followerproducer.,
* follower,leader,.
*/
configs.put("acks","-1");
//指定key使用的序列化类
StringSerializer keySerializer = new StringSerializer();
//指定value使用的序列化类
StringSerializer valueSerializer = new StringSerializer();
//创建kafka生产者
return new KafkaProducer(configs, keySerializer, valueSerializer);
}
@Bean
public KafkaConsumer kafkaConsumer(){
HashMap<String, Object> configs = new HashMap<>();
configs.put("bootstrap.servers","60.204.221.52:9092");
//开启consumer的偏移量offset自动提交到kafka
configs.put("enable.auto.commit",true);
//偏移量自动提交的时间间隔,单位毫秒
configs.put("auto.commit.interval",5000);
//在Kafka中没有初始化偏移量或者当前偏移量不存在情况
//earliest, 在偏移量无效的情况下, 自动重置为最早的偏移量
//latest, 在偏移量无效的情况下, 自动重置为最新的偏移量
//none, 在偏移量无效的情况下, 抛出异常.
configs.put("auto.offset.reset","latest");
//请求阻塞的最大时间(毫秒)
configs.put("fetch.max.wait",500);
//请求应答的最小字节数
configs.put("fetch.min.size",1);
//心跳间隔时间(毫秒)
configs.put("heartbeat-interval",3000);
//一次调用poll返回的最大记录条数
configs.put("max.poll.records",500);
//指定消费组
configs.put("group.id","firstGroup");
//指定key使用的反序列化类
StringDeserializer keyDeserializer = new StringDeserializer();
//指定value使用的反序列化类
StringDeserializer valueDeserializer = new StringDeserializer();
//创建kafka消费者
return new KafkaConsumer(configs,keyDeserializer,valueDeserializer);
}
}

View File

@ -1 +1,2 @@
com.muyu.kafkaconfig.KafkaConfig
com.muyu.common.kafka.config.KafkaConsumerConfig
com.muyu.common.kafka.config.KafkaProviderConfig

View File

@ -20,7 +20,10 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author: DongZeLiang
@ -63,7 +66,7 @@ public class ManyDataSource implements ApplicationRunner{
public DynamicDataSource dynamicDataSource(DruidDataSourceFactory druidDataSourceFactory) {
// 企业列表 企业CODE端口IP
Map<Object, Object> dataSourceMap = new HashMap<>();
Objects.requireNonNull(dataSourceInfoList())
dataSourceInfoList()
.stream()
.map(entInfo -> DataSourceInfo.hostAndPortBuild(entInfo.getEntCode(), entInfo.getIp(), entInfo.getPort()))
.forEach(dataSourceInfo -> {

View File

@ -11,7 +11,7 @@ public class DatasourceContent {
public final static String USER_NAME = "root";
public final static String PASSWORD = "bwie-8666";
public final static String PASSWORD = "root";
public final static String IP = "159.75.188.178";

View File

@ -56,7 +56,6 @@ public class TokenService {
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
claimsMap.put(SecurityConstants.SAAS_KEY,loginUser.getSysUser().getDatabaseName());
claimsMap.put(SecurityConstants.DETAILS_DEPT_ID,loginUser.getSysUser().getDeptId());
// 接口返回信息
Map<String, Object> rspMap = new HashMap<String, Object>();

View File

@ -1,35 +0,0 @@
package com.muyu.common.system.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.common.system.domain
* @Projectcloud-server-8
* @nameFirm
* @Date2024/9/25 22:03
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Firm {
/**
*
*/
private Integer firmId;
/**
*
*/
private String firmName;
/**
*
*/
private String databaseName;
}

View File

@ -87,6 +87,7 @@ public class SysUser extends BaseEntity {
* ID
*/
private Integer firmId;
/**
*
*/
@ -144,12 +145,6 @@ public class SysUser extends BaseEntity {
*/
private Long roleId;
/**
*
* @param userId
*/
private String firmName;
public SysUser (Long userId) {
this.userId = userId;
}

View File

@ -1,23 +0,0 @@
package com.muyu.common.system.remote;
import com.muyu.common.core.constant.ServiceNameConstants;
import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.Firm;
import com.muyu.common.system.remote.factory.RemoteFirmFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* @Author
* @Packagecom.muyu.common.system.remote
* @Projectcloud-server-8
* @nameRemoteFirmService
* @Date2024/9/25 22:21
*/
@FeignClient(contextId = "remoteFirmService", value = ServiceNameConstants.SYSTEM_SERVICE,fallbackFactory = RemoteFirmFallbackFactory.class)
public interface RemoteFirmService {
@RequestMapping("/firm/findByFirmName/{firmName}")
public Result<Firm> findByFirmName(@PathVariable("firmName") String firmName);
}

View File

@ -1,29 +0,0 @@
package com.muyu.common.system.remote.factory;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.exception.ServiceException;
import com.muyu.common.system.domain.Firm;
import com.muyu.common.system.remote.RemoteFirmService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* @Author
* @Packagecom.muyu.common.system.remote.factory
* @Projectcloud-server-8
* @nameRemoteFirmFallbackFactory
* @Date2024/9/25 22:22
*/
@Component
public class RemoteFirmFallbackFactory implements FallbackFactory<RemoteFirmService> {
@Override
public RemoteFirmService create(Throwable cause) {
return new RemoteFirmService() {
@Override
public Result<Firm> findByFirmName(String firmName) {
throw new ServiceException(cause.getCause().toString());
}
};
}
}

View File

@ -1,4 +1,3 @@
com.muyu.common.system.remote.factory.RemoteUserFallbackFactory
com.muyu.common.system.remote.factory.RemoteLogFallbackFactory
com.muyu.common.system.remote.factory.RemoteFileFallbackFactory
com.muyu.common.system.remote.factory.RemoteFirmFallbackFactory

View File

@ -1,62 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-common</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-common-wechat</artifactId>
<packaging>jar</packaging>
<name>cloud-common-wechat</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- MuYu Common Core-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-core</artifactId>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>
<!-- 帮助将java对象转换为xml字符串-->
<!-- 依赖冲突会导致InaccessibleObjectException异常更新到适用版本-->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>
<!-- Alibaba Fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,23 +0,0 @@
package com.muyu.common.wechat.domain;
import lombok.Data;
/**
* @author 24415
*/
@Data
public class AccessToken {
private String access_token;
private Long expires_in;
public void setExpiresTime(Long expiresIn) {
this.expires_in = System.currentTimeMillis()+expiresIn*1000;
}
public boolean isExpired(Long expiresIn){
long now = System.currentTimeMillis();
return now>expiresIn;
}
}

View File

@ -1,38 +0,0 @@
package com.muyu.common.wechat.domain;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.wxapplication.massage
* @ProjectWXApplication
* @nameArticles
* @Date2024/9/18 10:14
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@XStreamAlias("item")
public class Articles {
// <Articles>
// <item>
// <Title><![CDATA[title1]]></Title>
// <Description><![CDATA[description1]]></Description>
// <PicUrl><![CDATA[picurl]]></PicUrl>
// <Url><![CDATA[url]]></Url>
// </item>
// </Articles>
@XStreamAlias("Title")
private String title ;
@XStreamAlias("Description")
private String description ;
@XStreamAlias("PicUrl")
private String picUrl ;
@XStreamAlias("Url")
private String url ;
}

View File

@ -1,50 +0,0 @@
package com.muyu.common.wechat.domain;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author
* @Packagecom.muyu.wxapplication.massage
* @ProjectWXApplication
* @nameImageText
* @Date2024/9/18 9:27
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@XStreamAlias("xml")
public class NewsMessage {
// <ToUserName><![CDATA[toUser]]></ToUserName>
// <FromUserName><![CDATA[fromUser]]></FromUserName>
// <CreateTime>12345678</CreateTime>
// <MsgType><![CDATA[news]]></MsgType>
// <ArticleCount>1</ArticleCount>
// <Articles>
// <item>
// <Title><![CDATA[title1]]></Title>
// <Description><![CDATA[description1]]></Description>
// <PicUrl><![CDATA[picurl]]></PicUrl>
// <Url><![CDATA[url]]></Url>
// </item>
// </Articles>
@XStreamAlias("ToUserName")
private String toUserName ;
@XStreamAlias("FromUserName")
private String fromUserName ;
@XStreamAlias("CreateTime")
private long createTime ;
@XStreamAlias("MsgType")
private String msgType ;
@XStreamAlias("ArticleCount")
private Integer articleCount ;
@XStreamAlias("Articles")
private List<Articles> articles ;
}

View File

@ -1,40 +0,0 @@
package com.muyu.common.wechat.domain;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.wxapplication.massage
* @ProjectWXApplication
* @nameTextMessage
* @Date2024/9/18 11:33
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@XStreamAlias("xml")
public class TextMessage {
//起一个别名 因为我们微信返回信息与java代码格式规范发生冲突
//微信格式 ToUserName
//JAVA格式 toUserName
@XStreamAlias("ToUserName")
private String toUserName;
@XStreamAlias("FromUserName")
private String fromUserName;
@XStreamAlias("CreateTime")
private long createTime;
@XStreamAlias("MsgType")
private String msgType;
@XStreamAlias("Content")
private String content;
}
// <ToUserName><![CDATA[toUser]]></ToUserName>
// <FromUserName><![CDATA[fromUser]]></FromUserName>
// <CreateTime>12345678</CreateTime>
// <MsgType><![CDATA[text]]></MsgType>
// <Content><![CDATA[你好]]></Content>

View File

@ -1,38 +0,0 @@
package com.muyu;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -21,7 +21,6 @@
<module>cloud-common-xxl</module>
<module>cloud-common-rabbit</module>
<module>cloud-common-saas</module>
<module>cloud-common-wechat</module>
<module>cloud-common-kafka</module>
</modules>

View File

@ -66,15 +66,11 @@ public class AuthFilter implements GlobalFilter, Ordered {
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
return unauthorizedResponse(exchange, "令牌验证失败");
}
String saaSKey = JwtUtils.getSaaSKey(claims);
String deptId = JwtUtils.getDeptId(claims);
// 设置用户信息到请求
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
addHeader(mutate, SecurityConstants.SAAS_KEY,saaSKey);
addHeader(mutate,SecurityConstants.DETAILS_DEPT_ID,deptId);
// 内部请求来源参数清除
removeHeader(mutate, SecurityConstants.FROM_SOURCE);
return chain.filter(exchange.mutate().request(mutate.build()).build());

View File

@ -1,75 +0,0 @@
# Tomcat
server:
port: 8080
# nacos线上地址
nacos:
addr: 159.75.188.178:8848
user-name: nacos
password: nacos
namespace: xxy
# Spring
spring:
application:
# 应用名称
name: cloud-gateway
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
config:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
# 系统共享配置
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: ${nacos.addr}
dataId: sentinel-cloud-gateway
groupId: DEFAULT_GROUP
namespace: ${nacos.namespace}
data-type: json
rule-type: gw-flow
knife4j:
gateway:
enabled: true
# 指定服务发现的模式聚合微服务文档,并且是默认`default`分组
strategy: discover
discover:
enabled: true
# 指定版本号(Swagger2|OpenAPI3)
version : openapi3
# 需要排除的微服务(eg:网关服务)
excluded-services:
- cloud-monitor

View File

@ -9,19 +9,15 @@
<version>3.6.3</version>
</parent>
<artifactId>cloud-modules-carData</artifactId>
<description>
数据处理模块
</description>
<artifactId>cloud-modules-car</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
@ -70,34 +66,47 @@
<artifactId>cloud-common-log</artifactId>
</dependency>
<!--apache.kafka<-->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.2</version>
</dependency>
<!-- MuYu Common System-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-system</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>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
<artifactId>iotdb-session</artifactId>
<version>0.13.1</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-rabbit</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,26 @@
package com.muyu.car;
import com.muyu.car.service.CarMessageService;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import javax.annotation.Resource;
@EnableCustomConfig
@EnableMyFeignClients
@SpringBootApplication
@EnableCaching
public class CarApplication {
public static void main(String[] args){
SpringApplication.run(CarApplication.class,args);
}
}

View File

@ -0,0 +1,4 @@
package com.muyu.car.config;
public class kafka {
}

View File

@ -1,28 +1,25 @@
package com.muyu.server.controller;
package com.muyu.car.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.domain.req.CarInformationAddReq;
import com.muyu.car.domain.req.CarInformationListReq;
import com.muyu.car.domain.req.CarInformationUpdReq;
import com.muyu.car.service.CarInformationService;
import com.muyu.common.core.domain.Result;
import com.muyu.domain.CarInformation;
import com.muyu.domain.req.CarInformationAddReq;
import com.muyu.domain.req.CarInformationListReq;
import com.muyu.domain.req.CarInformationUpdReq;
import com.muyu.domain.resp.CarInformationResp;
import com.muyu.server.service.CarInformationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.annotation.RequestScope;
import javax.annotation.Resource;
import java.util.List;
/**
*
* @author 17353
*/
@Log4j2
@RestController
@RequestMapping("/carinformation")
@ -31,22 +28,6 @@ public class CarInformationController {
@Resource
private CarInformationService carInformationService;
/**
*
*/
@PostMapping("/selectCarInformation")
@Operation(summary = "查询数据",description = "查询数据")
public Result<List<CarInformation>> selectConnect(){
List<CarInformation> connects = carInformationService.list()
.stream()
.map(CarInformation::carInformationBuilder)
.toList();
return Result.success(
connects, "操作成功"
);
}
/**
*
* --> ----
@ -67,8 +48,8 @@ public class CarInformationController {
*/
@PostMapping("/selectCarInformationList")
@Operation(summary = "企业车辆管理列表")
public Result<Page<CarInformationResp>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
Page<CarInformationResp> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
public Result<PageInfo<CarInformation>> selectCarInformationList(@Validated @RequestBody CarInformationListReq carInformationListReq) {
PageInfo<CarInformation> pageInfo = carInformationService.selectCarInformationList(carInformationListReq);
log.info("企业车辆管理列表查询",carInformationListReq,pageInfo);
return Result.success(pageInfo);
@ -83,9 +64,7 @@ public class CarInformationController {
@PostMapping("/addCarInformation")
@Operation(summary = "企业车辆添加管理")
public Result addCarInformation(@Validated @RequestBody CarInformationAddReq carInformationAddReq){
return carInformationService.addCarInformation(carInformationAddReq)
?Result.success("添加车辆成功")
:Result.error(402,"添加车辆失败");
return carInformationService.addCarInformation(carInformationAddReq);
}
/**
@ -95,12 +74,8 @@ public class CarInformationController {
*/
@GetMapping("/delBycarInformationId/{carInformationId}")
@Operation(summary = "企业车辆删除")
public Result delBycarInformationId(@Validated @RequestParam(name = "carInformationId") Integer carInformationId){
boolean delBycarInformationId = carInformationService.delBycarInformationId(carInformationId);
if (delBycarInformationId){
return Result.success(delBycarInformationId ,"删除车辆成功");
}
return Result.error(402,"删除车辆失败");
public Result delBycarInformationId(@Validated @PathVariable("carInformationId") Integer carInformationId){
return carInformationService.delBycarInformationId(carInformationId);
}
@ -112,14 +87,12 @@ public class CarInformationController {
@PostMapping("/updatecarInformation")
@Operation(summary = "企业车辆修改管理")
public Result updateCarMessage(@Validated @RequestBody CarInformationUpdReq carInformationUpdReq){
boolean updatecarInformation = carInformationService.updatecarInformation(carInformationUpdReq);
Result updatecarInformation = carInformationService.updatecarInformation(carInformationUpdReq);
log.info(updatecarInformation);
System.out.println("我在这个里:"+updatecarInformation);
if(updatecarInformation)
{
return Result.success(carInformationUpdReq,"修改成功");
}
return Result.error( 402,"修改失败");
return Result.success(updatecarInformation,"修改成功");
}
@ -132,11 +105,12 @@ public class CarInformationController {
*/
@GetMapping("/selectCarInformationIdAndLicensePlate")
@Operation(summary = "查询企业车辆 carInformationID 和 carInformationLicensePlate")
public Result<List<CarInformationResp>> selectCarInformationIdAndLicensePlate(){
List<CarInformationResp> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
public Result<List<CarInformation>> selectCarInformationIdAndLicensePlate(){
List<CarInformation> carInformations = carInformationService.selectBycarInformationIDAndLicensePlate();
return Result.success(carInformations);
}
}

View File

@ -0,0 +1,86 @@
package com.muyu.car.controller;
import com.alibaba.fastjson.JSONObject;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.service.CarMessageService;
import com.muyu.common.core.domain.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Log4j2
@RestController
@RequestMapping("/carMessage")
@Tag(name = "信息报文模块" )
public class CarMessageController {
@Resource
private CarMessageService carMessageService;
/**
*
* @param
* @return
*/
@PostMapping("/selectCarMessageList")
@Operation(summary = "报文模板展示列表")
public Result<List<CarMessage>> selectCarMessageList(Integer carMessageCartype){
List<CarMessage> carMessages = carMessageService.selectCarMessageList(carMessageCartype);
return Result.success(carMessages);
}
/**
*
*/
@PostMapping("/insertCarMessage")
@Operation(summary = "添加报文信息")
public Result insertCarMessage(@Validated @RequestBody CarMessage carMessage){
Result carMessage1 = carMessageService.insertCarMessage(carMessage);
return Result.success(carMessage1);
}
/**
*
*
*/
@PostMapping("/delectByCarMessageId")
@Operation(summary = "删除报文信息")
public Result delectByCarMessageId(Integer carMessageId){
Result carMessage1 = carMessageService.delectByCarMessageId(carMessageId);
return Result.success(carMessage1);
}
/**
*
*/
@PostMapping("/updateCarMessage")
@Operation(summary = "修改报文信息")
public Result updateCarMessage(@Validated @RequestBody CarMessage carMessage){
Result updateCarMessage = carMessageService.updateCarMessage(carMessage);
return Result.success(updateCarMessage,"修改成功");
}
/**
*
*/
@PostMapping("/inciseCarMessage")
@Operation(summary = "解析报文处理", description = "解析报文测试")
public Result<JSONObject> inciseCarMessage(@RequestParam(name = "testString") String testString){
JSONObject carMessage = carMessageService.inciseCarMessage(testString);
return Result.success(carMessage);
}
/**
*
*/
}

View File

@ -0,0 +1,57 @@
package com.muyu.car.controller;
import com.muyu.car.domain.Packettemplate;
import com.muyu.car.domain.req.PackettemplateAddReq;
import com.muyu.car.service.PackertemplateService;
import com.muyu.common.core.domain.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@Log4j2
@RequestMapping("/packettemplate")
@RestController
@Tag(name = "报文模板车系分类")
public class PackettemplateController {
@Resource
public PackertemplateService packertemplateService;
/**
*
*/
@PostMapping("/selectAll")
@Operation(summary = "报文车系查询")
public List<Packettemplate> selectAll(){
List<Packettemplate> packettemplates = packertemplateService.selectAll();
log.info(packettemplates);
return packettemplates;
}
/**
*
*/
@PostMapping("/addPackert")
@Operation(summary = "添加分类模板")
public Result addPackert(PackettemplateAddReq packettemplateAddReq){
Result result = packertemplateService.addPackert(packettemplateAddReq);
log.info(result);
return result;
}
}

View File

@ -1,78 +1,62 @@
package com.muyu.domain.resp;
package com.muyu.car.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
*
* @Authoryang
* @Packagecom.muyu.domain.resq
* @Projectcloud-server-8
* @nameCarInformationResp
* @Date2024/9/28 12:08
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆基础信息列表")
public class CarInformationResp {
@SuperBuilder
@TableName(value = "企业车辆管理实体类",autoResultMap = true)
public class CarInformation {
/**
* ID
*/
@TableId(value = "car_information_id",type = IdType.AUTO)
private Long carInformationId;
/**
* VIN
* ()
*/
// @TableName(value = "car_information_VIN")
@TableField(value = "car_information_VIN")
private String carInformationVin;
private String carInformationVIN;
/**
*
* ()
*/
private String carInformationLicensePlate;
/**
*
*/
private String carInformationColor;
/**
*
*/
private String carInformationDriver;
/**
* ID
*/
private Integer carInformationFence;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
private Date carInformationExamineEnddata;
/**
* ID
*/
private Integer carInformationType;
/**
*
*/
private String carInformationBrand;
/**
* (0 1 )
*
*/
private Integer carInformationFocus;
private String carInformationColor;
/**
*
*/
private String carInformationDriver;
/**
*
* ()
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
private Date carInformationExamineEnddata;
/**
*
@ -94,35 +78,46 @@ public class CarInformationResp {
*/
private String carInformationBatteryModel;
/**
* ID
*/
private Integer carInformationFence;
/**
* ID
*/
private Integer carInformationType;
/**
* (0 1 )
*/
private Integer carInformationFocus;
/**
* (1.线 2.线 3. 4. 5.)
*/
private Integer carInformationState;
//车辆类型表
/**
* ID
*/
@TableField(value = "car_information_type")
private Integer carTypeId;
/**
*
*/
@TableField(exist = false)
private String carTypeName;
/**
* ID
*/
private long carTypeRules;
//电子围栏
/**
*ID
*/
private Integer id;
private Integer fenceid;
/**
*
*/
private String name;
private String fencename;
}

View File

@ -0,0 +1,85 @@
package com.muyu.car.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.models.security.SecurityScheme;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "车辆报文模板实体类",autoResultMap = true)
public class CarMessage {
//报文类型模块表
/**
*
*/
private Long messageTypeId;
/**
*
*/
private String messageTypeCode;
/**
*
*/
private String messageTypeName;
/**
*
*/
private String messageTypeBelongs;
//报文拆分位置主表
/**
*
*/
private Long carMessageId;
/**
*
*/
private Integer carMessageCartype;
/**
*
*/
private Integer carMessageType;
/**
*
*/
private Integer carMessageStartIndex;
/**
*
*/
private Integer carMessageEndIndex;
/**
* ( )
*/
private String messageTypeClass;
/**
* (0 1)
*/
private Integer carMessageState;
/*
private Long messageTypeId ;
private String messageTypeCode ;
private String messageTypeName ;
private String messageTypeBelongs ;
private String messageTypeClass ;
private Long carMessageId ;
private Integer carMessageCartype ;
private Integer carMessageType ;
private Integer carMessageStartIndex ;
private Integer carMessageEndIndex ;
private Integer carMessageState ;
*/
}

View File

@ -0,0 +1,33 @@
package com.muyu.car.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "报文模板分类实体类" , autoResultMap = true)
public class Packettemplate {
/**
* id
*/
private Integer packetTemplateId;
/**
*
*/
private Integer packetTemplateCartype;
/**
*
*/
private Integer packetTemplateCarmessage;
}

View File

@ -1,4 +1,4 @@
package com.muyu.domain.req;
package com.muyu.car.domain.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -8,14 +8,11 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆管理信息添加请求对象")
@Tag(name = "车辆管理信息添加对象")
public class CarInformationAddReq {
/**

View File

@ -1,16 +1,14 @@
package com.muyu.domain.req;
package com.muyu.car.domain.req;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor

View File

@ -1,4 +1,4 @@
package com.muyu.domain.req;
package com.muyu.car.domain.req;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -7,9 +7,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor

View File

@ -0,0 +1,24 @@
package com.muyu.car.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class PackettemplateAddReq {
/**
*
*/
private Integer packetTemplateCartype;
/**
*
*/
private Integer packetTemplateCarmessage;
}

View File

@ -0,0 +1,105 @@
package com.muyu.car.domain.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bouncycastle.crypto.Digest;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Tag(
name = "测试代码行",
description = "车INdsa"
)
public class CarINdsa {
private Long testmessageId;
private String testmessagename;
private Integer testmessagetodo;
private String testmessageagon;
private Integer testmessagetest;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dayend;
private String testmessagehid;
private Integer testmessageyou;
private Digest testmessageertug;
private String testmessagebug;
private Integer testmessagedata;
}

View File

@ -0,0 +1,70 @@
package com.muyu.car.mapper;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.domain.req.CarInformationAddReq;
import com.muyu.car.domain.req.CarInformationListReq;
import com.muyu.car.domain.req.CarInformationUpdReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
@Tag(name = "车辆基础信息表")
public interface CarInformationMapper {
/**
*
* --> ----
* -->(VIN carInformationVIN
* ID carTypeId
* ID carInformationFence
* (1.线 2.线 3. 4. 5.)
* carInformationState
* carInformationMotorManufacturer
* carInformationMotorModel
* carInformationBatteryManufacturer
* carInformationBatteryModel
* )
* --> pageNum pageSize
* @param carInformationListReq
* @return
*/
List<CarInformation> selectCarInformationList(CarInformationListReq carInformationListReq);
/**
*
* @param carInformationAddReq
* @return
*/
Integer addCarInformation(CarInformationAddReq carInformationAddReq);
/**
*
* @param carInformationId
* @return
*/
Integer delBycarInformationId(Integer carInformationId);
/**
*
* @param carInformationUpdReq
* @return
*/
Integer updatecarInformation(CarInformationUpdReq carInformationUpdReq);
/**
* To
* carInformationID carInformationLicensePlate
*
* @return
*/
List<CarInformation> selectBycarInformationIDAndLicensePlate();
}

View File

@ -0,0 +1,56 @@
package com.muyu.car.mapper;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.CarMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface CarMessageMapper {
/**
*
* @param
* @return
*/
List<CarMessage> selectCarMessageList(@Param("carMessageCartype")Integer carMessageCartype);
/**
*
*/
Integer insertCarMessage(CarMessage carMessage);
/**
*
*/
Integer deleteByCarMessageId(Integer carMessageId);
/**
*
*/
Integer updateCarMessage(CarMessage carMessage);
//报文切割
/**
* ID
* @param carInformationVIN
* @return
* VIN
* VINID-->
*/
List<CarInformation> selectcarInformationType(String carInformationVIN);
/**
*VIN
*/
Long selectcarMessageCartype(String carInformationVIN);
}

View File

@ -0,0 +1,25 @@
package com.muyu.car.mapper;
import com.muyu.car.domain.Packettemplate;
import com.muyu.car.domain.req.PackettemplateAddReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
@Tag(name = "保温分类表")
public interface PackettemplateMapper {
/**
*
*/
List<Packettemplate> selectAll();
/**
*
*/
Integer addPackert(PackettemplateAddReq packettemplateAddReq);
}

View File

@ -1,22 +1,15 @@
package com.muyu.server.service;
package com.muyu.car.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.req.CarInformationAddReq;
import com.muyu.car.domain.req.CarInformationListReq;
import com.muyu.car.domain.req.CarInformationUpdReq;
import com.muyu.common.core.domain.Result;
import com.muyu.domain.CarInformation;
import com.muyu.domain.req.CarInformationAddReq;
import com.muyu.domain.req.CarInformationListReq;
import com.muyu.domain.req.CarInformationUpdReq;
import com.muyu.domain.resp.CarInformationResp;
import java.util.List;
/**
*
*/
public interface CarInformationService extends IService<CarInformation> {
public interface CarInformationService {
/**
*
* --> ----
@ -34,7 +27,7 @@ public interface CarInformationService extends IService<CarInformation> {
* @param carInformationListReq
* @return
*/
Page<CarInformationResp> selectCarInformationList(CarInformationListReq carInformationListReq);
PageInfo<CarInformation> selectCarInformationList(CarInformationListReq carInformationListReq);
/**
@ -42,14 +35,14 @@ public interface CarInformationService extends IService<CarInformation> {
* @param carInformationAddReq
* @return
*/
boolean addCarInformation(CarInformationAddReq carInformationAddReq);
Result addCarInformation(CarInformationAddReq carInformationAddReq);
/**
*
* @param carInformationId
* @return
*/
boolean delBycarInformationId(Integer carInformationId);
Result delBycarInformationId(Integer carInformationId);
/**
@ -57,7 +50,7 @@ public interface CarInformationService extends IService<CarInformation> {
* @param carInformationUpdReq
* @return
*/
boolean updatecarInformation(CarInformationUpdReq carInformationUpdReq);
Result updatecarInformation(CarInformationUpdReq carInformationUpdReq);
/**
@ -66,6 +59,6 @@ public interface CarInformationService extends IService<CarInformation> {
*
* @return
*/
List<CarInformationResp> selectBycarInformationIDAndLicensePlate();
List<CarInformation> selectBycarInformationIDAndLicensePlate();
}

View File

@ -0,0 +1,48 @@
package com.muyu.car.service;
import com.alibaba.fastjson.JSONObject;
import com.muyu.car.domain.CarMessage;
import com.muyu.common.core.domain.Result;
import java.util.List;
public interface CarMessageService {
/**
*
* @param
* @return
*/
List<CarMessage> selectCarMessageList(Integer carMessageCartype);
/**
*
*/
Result insertCarMessage(CarMessage carMessage);
/**
*
*/
Result delectByCarMessageId(Integer carMessageId);
/**
*
*/
Result updateCarMessage(CarMessage carMessage);
/**
*
*/
/**
*
*/
JSONObject inciseCarMessage(String testString);
}

View File

@ -0,0 +1,72 @@
package com.muyu.car.service.Impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.domain.req.CarInformationAddReq;
import com.muyu.car.domain.req.CarInformationListReq;
import com.muyu.car.domain.req.CarInformationUpdReq;
import com.muyu.car.mapper.CarInformationMapper;
import com.muyu.car.service.CarInformationService;
import com.muyu.common.core.domain.Result;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.poi.ss.formula.functions.IDStarAlgorithm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class CarInformationServiceImpl implements CarInformationService {
@Resource
private CarInformationMapper carInformationMapper;
@Autowired
private HttpServletResponse response;
@Override
public PageInfo<CarInformation> selectCarInformationList(CarInformationListReq carInformationListReq) {
PageHelper.startPage(carInformationListReq.getPageNum(),carInformationListReq.getPageSize());
List<CarInformation> carInformations = carInformationMapper.selectCarInformationList(carInformationListReq);
PageInfo<CarInformation> pageInfo = new PageInfo<>(carInformations);
return pageInfo;
}
@Override
public Result addCarInformation(CarInformationAddReq carInformationAddReq) {
Integer addCarInformation = carInformationMapper.addCarInformation(carInformationAddReq);
if(addCarInformation > 0){
return Result.success(addCarInformation,"添加车辆成功");
}
return Result.error(402,"添加车辆失败");
}
@Override
public Result delBycarInformationId(Integer carInformationId) {
Integer delBycarInformationId = carInformationMapper.delBycarInformationId(carInformationId);
if (delBycarInformationId > 0){
return Result.success(delBycarInformationId ,"删除车辆成功");
}
return Result.error(402,"删除车辆失败");
}
@Override
public Result updatecarInformation(CarInformationUpdReq carInformationUpdReq) {
Integer updatecarInformation = carInformationMapper.updatecarInformation(carInformationUpdReq);
if(updatecarInformation > 0)
{
return Result.success(carInformationUpdReq,"修改成功");
}
return Result.error( 402,"修改失败");
}
@Override
public List<CarInformation> selectBycarInformationIDAndLicensePlate() {
return carInformationMapper.selectBycarInformationIDAndLicensePlate();
}
}

View File

@ -0,0 +1,132 @@
package com.muyu.car.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.muyu.car.domain.CarInformation;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.mapper.CarInformationMapper;
import com.muyu.car.mapper.CarMessageMapper;
import com.muyu.car.service.CarMessageService;
import com.muyu.common.core.domain.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
@Service
@Log4j2
public class CarMessageServiceImpl implements CarMessageService {
@Resource
private CarMessageMapper carMessageMapper;
@Resource
private CarInformationMapper carInformationMapper;
@Resource
private RedisTemplate<String, Objects> redisTemplate;
@Override
public List<CarMessage> selectCarMessageList(Integer carMessageCartype) {
return carMessageMapper.selectCarMessageList(carMessageCartype);
}
@Override
public Result insertCarMessage(CarMessage carMessage) {
Integer inserted = carMessageMapper.insertCarMessage(carMessage);
if (inserted > 0){
return Result.success(inserted,"添加成功");
}
return Result.error(402,"添加失败");
}
@Override
public Result delectByCarMessageId(Integer carMessageId) {
Integer deleteByCarMessageId = carMessageMapper.deleteByCarMessageId(carMessageId);
if (deleteByCarMessageId >0){
return Result.success(carMessageId ,"删除成功");
}
return Result.error(402,"删除失败");
}
@Override
public Result updateCarMessage(CarMessage carMessage) {
Integer integer = carMessageMapper.updateCarMessage(carMessage);
if(integer > 0)
{
return Result.success(carMessage,"修改成功");
}
return Result.error( 402,"修改失败");
}
@Override
public JSONObject inciseCarMessage(String testString) {
//根据空格拆分切割数据字符串
String[] split = testString.split(" ");
StringBuilder stringBuilder = new StringBuilder();
for (String conversion : split) {
//将16进制字符串转换为对应的10进制
int inciseindex = Integer.parseInt(conversion, 16);
// 将10进制转换为对应的字符
stringBuilder.append((char) inciseindex);
}
//切取车辆VIN
String substring = stringBuilder.substring(1, 18);
log.info("车辆的VIN码:" + substring);
//根据给定的vehicleVin车辆VIN号获取对应的模板车辆分类carMessageCartype
Long selectcared = carMessageMapper.selectcarMessageCartype(substring);
//根据给定的vehicleVin车辆VIN号获取对应的模板信息
// List<CarInformation> carInformations = carMessageMapper.selectcarInformationType(substring);
//创建接受数据的数组
List<CarMessage> carMessagesList ;
try{
String redisKey = "carMessageList" + selectcared;
if (redisTemplate.hasKey(redisKey)){
List<Objects> list = redisTemplate.opsForList().range(redisKey , 0, -1);
carMessagesList =
list.stream().map(objects ->
JSON.parseObject(objects.toString(), CarMessage.class))
.toList();
log.info("Redis缓存查询成功");
}else {
carMessagesList = carMessageMapper.selectCarMessageList(Math.toIntExact(selectcared));
carMessagesList.forEach(
listReq -> redisTemplate.opsForList().rightPushAll(redisKey, (Collection<Objects>) listReq)
);
log.info("数据库查询成功");
}
log.info("获取失败,请重试");
}catch(Exception e){
throw new RuntimeException("获取报文模板失败");
}
//判断报文模板 列表 不为空
if(carMessagesList.isEmpty()){
throw new RuntimeException("报文模版为空");
}
//存储报文模板解析后的数据
JSONObject jsonObject = new JSONObject();
for (CarMessage carMessage : carMessagesList) {
//起始位下标
Integer startIndex = carMessage.getCarMessageStartIndex();
//结束位下标
Integer endIndex = carMessage.getCarMessageEndIndex();
//根据报文模板获取保温截取位置
String value = stringBuilder.substring(startIndex, endIndex);
//存入数据
jsonObject.put(carMessage.getMessageTypeName(), value);
}
return jsonObject;
}
}

View File

@ -0,0 +1,48 @@
package com.muyu.car.service.Impl;
import com.muyu.car.domain.Packettemplate;
import com.muyu.car.domain.req.PackettemplateAddReq;
import com.muyu.car.mapper.PackettemplateMapper;
import com.muyu.car.service.PackertemplateService;
import com.muyu.common.core.domain.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
@Log4j2
public class PackertemplateServiceImpl implements PackertemplateService {
@Resource
private PackettemplateMapper packettemplateMapper;
/**
*
*
* @return
*/
@Override
public List<Packettemplate> selectAll() {
List<Packettemplate> packettemplates = packettemplateMapper.selectAll();
log.info("packettemplates:{}",packettemplates);
return packettemplates;
}
/**
*
*
*
* @param packettemplateAddReq
* @return
*/
@Override
public Result addPackert(PackettemplateAddReq packettemplateAddReq) {
Integer addPackert = packettemplateMapper.addPackert(packettemplateAddReq);
if (addPackert > 0){
return Result.success(packettemplateAddReq , "添加成功");
}
return Result.error(500, "添加失败");
}
}

View File

@ -0,0 +1,24 @@
package com.muyu.car.service;
import com.muyu.car.domain.Packettemplate;
import com.muyu.car.domain.req.PackettemplateAddReq;
import com.muyu.common.core.domain.Result;
import java.util.List;
public interface PackertemplateService {
/**
*
*/
List<Packettemplate> selectAll();
/**
*
*/
Result addPackert(PackettemplateAddReq packettemplateAddReq);
}

View File

@ -0,0 +1,44 @@
package com.muyu.car.test;
import com.alibaba.fastjson.JSONObject;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import java.util.Properties;
import java.util.UUID;
public class Kafka {
public static void main(String[] args) {
//配置kafka生产者
Properties properties = new Properties();
properties.put("bootstrap.servers", "http://60.204.221.52:9092");
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
//创建kafka生产者
Producer<String, String> product = new KafkaProducer<>(properties);
String aa = "2345678";
JSONObject jsonObject = new JSONObject();
jsonObject.put("aa", aa);
String jsonString = jsonObject.toString();
System.out.println("JSON内容是:" + jsonString);
try {
product.send(new ProducerRecord<>("nima", UUID.randomUUID().toString(), jsonString
));
System.out.println("消费的数据内容为:" + jsonString);
} catch (Exception exception) {
exception.printStackTrace();
} finally {
product.close();
}
}
}

View File

@ -0,0 +1,168 @@
package com.muyu.car.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.muyu.car.domain.CarMessage;
import com.muyu.car.mapper.CarMessageMapper;
import com.muyu.car.service.CarMessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.eclipse.paho.client.mqttv3.*;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
@Component
@Slf4j
public class MQTT {
@Resource
private CarMessageService carMessageService;
@Resource
private CarMessageMapper carMessageMapper;
@Resource
private RedisTemplate<String,Objects> redisTemplate;
@Resource
private KafkaProducer<String,String> kafkaProducer;
@PostConstruct
public void test() {
// 设置消息主题
String topic = "vehicle";
// 设置消息内容
String content = "Message from MqttPublishSample";
// 设置消息质量等级
int qos = 2;
// 设置MQTT代理服务器地址
String broker = "tcp://106.15.136.7:1883";
// 设置客户端ID
String clientId = "JavaSample";
try {
// 创建MQTT客户端实例第三个参数为空表示使用默认的持久化策略
MqttClient sampleClient = new MqttClient(broker, clientId);
// 创建连接选项实例
MqttConnectOptions connOpts = new MqttConnectOptions();
// 设置连接选项,表示每次连接时都清除会话信息
connOpts.setCleanSession(true);
// 输出正在连接的代理服务器地址
System.out.println("Connecting to broker: "+broker);
// 连接MQTT代理服务器
sampleClient.connect(connOpts);
// 订阅指定主题
sampleClient.subscribe(topic,0);
// 设置回调函数处理MQTT事件
sampleClient.setCallback(new MqttCallback() {
// 处理连接丢失事件
@Override
public void connectionLost(Throwable throwable) {
}
// 处理消息到达事件
@Override
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
System.out.println(new String(mqttMessage.getPayload()));
String string = new String(mqttMessage.getPayload());
JSONObject object = carMessageService.inciseCarMessage(string);
System.out.println(object);
}
public JSONObject inciseCarMessage(String testString) {
//根据空格拆分切割数据字符串
String[] split = testString.split(" ");
StringBuilder stringBuilder = new StringBuilder();
for (String conversion : split) {
//将16进制字符串转换为对应的10进制
int inciseindex = Integer.parseInt(conversion, 16);
// 将10进制转换为对应的字符
stringBuilder.append((char) inciseindex);
}
//切取车辆VIN
String substring = stringBuilder.substring(1, 18);
log.info("车辆的VIN码:" + substring);
//根据给定的vehicleVin车辆VIN号获取对应的模板车辆分类carMessageCartype
Long selectcared = carMessageMapper.selectcarMessageCartype(substring);
//根据给定的vehicleVin车辆VIN号获取对应的模板信息
// List<CarInformation> carInformations = carMessageMapper.selectcarInformationType(substring);
//创建接受数据的数组
List<CarMessage> carMessagesList ;
try{
String redisKey = "carMessageList" + selectcared;
if (redisTemplate.hasKey(redisKey)){
List<Objects> list = redisTemplate.opsForList().range(redisKey , 0, -1);
carMessagesList =
list.stream().map(objects ->
JSON.parseObject(objects.toString(), CarMessage.class))
.toList();
log.info("Redis缓存查询成功");
}else {
carMessagesList = carMessageMapper.selectCarMessageList(Math.toIntExact(selectcared));
carMessagesList.forEach(
listReq -> redisTemplate.opsForList().rightPushAll(redisKey, (Collection<Objects>) listReq)
);
log.info("数据库查询成功");
}
log.info("获取失败,请重试");
}catch(Exception e){
throw new RuntimeException("获取报文模板失败");
}
//判断报文模板 列表 不为空
if(carMessagesList.isEmpty()){
throw new RuntimeException("报文模版为空");
}
//存储报文模板解析后的数据
JSONObject jsonObject = new JSONObject();
for (CarMessage carMessage : carMessagesList) {
//起始位下标
Integer startIndex = carMessage.getCarMessageStartIndex();
//结束位下标
Integer endIndex = carMessage.getCarMessageEndIndex();
//根据报文模板获取保温截取位置
String value = stringBuilder.substring(startIndex, endIndex);
//存入数据
jsonObject.put(carMessage.getMessageTypeName(), value);
}
return jsonObject;
}
// 处理消息发送完成事件
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
// 输出消息是否成功发送完成
System.out.println("deliveryComplete---------" + iMqttDeliveryToken.isComplete());
}
});
} catch(MqttException me) {
// 输出异常的原因代码
System.out.println("reason "+me.getReasonCode());
// 输出异常的消息
System.out.println("msg "+me.getMessage());
// 输出异常的本地化消息
System.out.println("loc "+me.getLocalizedMessage());
// 输出异常的根源
System.out.println("cause "+me.getCause());
// 输出异常的对象
System.out.println("excep "+me);
// 打印异常的堆栈跟踪信息
me.printStackTrace();
}
}
}

View File

@ -1,6 +1,6 @@
# Tomcat
server:
port: 9701
port: 9717
# nacos线上地址
nacos:
@ -19,7 +19,7 @@ spring:
allow-bean-definition-overriding: true
application:
# 应用名称
name: cloud-system
name: cloud-car
profiles:
# 环境配置
active: dev

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-carData"/>
<property name="log.path" value="logs/cloud-market"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-carData"/>
<property name="log.path" value="logs/cloud-market"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-carData"/>
<property name="log.path" value="logs/cloud-market"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>

View File

@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 1.在mybats的开发中namespace有特殊的意思一定要是对应接口的全限定名通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)-->
<mapper namespace="com.muyu.car.mapper.CarInformationMapper">
<resultMap id="carInformationResult" type="com.muyu.car.domain.CarInformation">
<result column="car_information_id" property="carInformationId"/>
<result column="car_information_VIN" property="carInformationVIN"/>
<result column="car_information_license_plate" property="carInformationLicensePlate"/>
<result column="car_information_brand" property="carInformationBrand"/>
<result column="car_information_color" property="carInformationColor"/>
<result column="car_information_driver" property="carInformationDriver"/>
<result column="car_information_examine_enddata" property="carInformationExamineEnddata"/>
<result column="car_information_motor_manufacturer" property="carInformationMotorManufacturer"/>
<result column="car_information_motor_model" property="carInformationMotorModel"/>
<result column="car_information_battery_manufacturer" property="carInformationBatteryManufacturer"/>
<result column="car_information_battery_model" property="carInformationBatteryModel"/>
<result column="car_information_fence" property="carInformationFence"/>
<result column="car_information_type" property="carInformationType"/>
<result column="car_information_focus" property="carInformationFocus"/>
<result column="car_information_state" property="carInformationState"/>
<result column="car_type_id" property="carTypeId"/>
<result column="car_type_name" property="carTypeName"/>
</resultMap>
<sql id="carinformationSql">
SELECT
car_information_id,
car_information_VIN,
car_information_license_plate,
car_information_brand,
car_information_color,
car_information_driver,
car_information_examine_enddata,
car_information_motor_manufacturer,
car_information_motor_model,
car_information_battery_manufacturer,
car_information_battery_model,
car_information_fence,
car_information_type,
car_information_focus,
car_information_state
FROM `car_information`
</sql>
<select id="selectCarInformationList" resultMap="carInformationResult" >
SELECT
car_information_id , car_information_VIN , car_information_license_plate,
car_information_brand , car_information_color , car_information_driver,
car_information_examine_enddata , car_information_motor_manufacturer , car_information_motor_model,
car_information_battery_manufacturer, car_information_battery_model , car_information_fence,
car_information_type , car_information_focus , car_information_state,
car_type_id , car_type_name ,
id , name
FROM `car_information`
LEFT JOIN `car_type`
ON `car_information`.car_information_type = `car_type`.car_type_id
LEFT JOIN `car_fence`
ON `car_information`.car_information_fence = `car_fence`.id
<where>
<if test= "carInformationVIN != null and carInformationVIN!='' " >
AND `car_information`.car_information_VIN = #{carInformationVIN}
</if>
<if test= "carTypeId != null" >
AND `car_information`. car_information_type = #{carTypeId}
</if>
<if test= "carInformationFence != null" >
AND `car_information`.car_information_fence = #{carInformationFence}
</if>
<if test= "carInformationState != null " >
AND `car_information`.car_information_state = #{carInformationState}
</if>
<if test= "carInformationMotorManufacturer != null and carInformationMotorManufacturer !=''" >
AND instr(`car_information`.car_information_motor_manufacturer , #{carInformationMotorManufacturer})
</if>
<if test= "carInformationMotorModel != null and carInformationMotorModel !='' " >
AND `car_information`.car_information_motor_model = #{carInformationMotorModel}
</if>
<if test= "carInformationBatteryManufacturer != null and carInformationBatteryManufacturer != '' " >
AND instr(`car_information`.car_information_battery_manufacturer , #{carInformationBatteryManufacturer})
</if>
<if test= "carInformationBatteryModel != null and carInformationBatteryModel != '' " >
AND `car_information`.car_information_battery_model = #{carInformationBatteryModel}
</if>
</where>
</select>
<select id="selectBycarInformationIDAndLicensePlate" resultType="com.muyu.car.domain.CarInformation">
SELECT
car_information_id ,
car_information_license_plate
FROM `car_information`
</select>
<insert id="addCarInformation">
INSERT INTO `car_information`
(
<if test= "carInformationVIN != null and carInformationVIN!='' " >car_information_VIN,</if>
<if test= "carInformationLicensePlate != null and carInformationLicensePlate!='' "> car_information_license_plate,</if>
<if test= "carInformationBrand != null and carInformationBrand!='' " >car_information_brand, </if>
<if test= "carInformationColor != null and carInformationColor!='' " > car_information_color, </if>
<if test= "carInformationDriver != null and carInformationDriver!='' " > car_information_driver, </if>
<if test= "carInformationExamineEnddata != null and carInformationExamineEnddata!='' " > car_information_examine_enddata, </if>
<if test= "carInformationMotorManufacturer != null and carInformationMotorManufacturer!='' " >car_information_motor_manufacturer, </if>
<if test= "carInformationMotorModel != null and carInformationMotorModel!='' " >car_information_motor_model, </if>
<if test= "carInformationBatteryManufacturer != null and carInformationBatteryManufacturer!='' " >car_information_battery_manufacturer, </if>
<if test= "carInformationBatteryModel != null and carInformationBatteryModel!='' " >car_information_battery_model, </if>
<if test= "carInformationFence != null " >car_information_fence, </if>
<if test= "carInformationType != null " >car_information_type </if> )
VALUES (
<if test= "carInformationVIN != null and carInformationVIN!='' " >#{carInformationVIN},</if>
<if test= "carInformationLicensePlate != null and carInformationLicensePlate!='' "> #{carInformationLicensePlate},</if>
<if test= "carInformationBrand != null and carInformationBrand!='' " > #{carInformationBrand} , </if>
<if test= "carInformationColor != null and carInformationColor!='' " > #{carInformationColor}, </if>
<if test= "carInformationDriver != null and carInformationDriver!='' " > #{carInformationDriver}, </if>
<if test= "carInformationExamineEnddata != null and carInformationExamineEnddata!='' " > #{carInformationExamineEnddata}, </if>
<if test= "carInformationMotorManufacturer != null and carInformationMotorManufacturer!='' " >#{carInformationMotorManufacturer}, </if>
<if test= "carInformationMotorModel != null and carInformationMotorModel!='' " > #{carInformationMotorModel}, </if>
<if test= "carInformationBatteryManufacturer != null and carInformationBatteryManufacturer!='' " > #{carInformationBatteryManufacturer}, </if>
<if test= "carInformationBatteryModel != null and carInformationBatteryModel!='' " > #{carInformationBatteryModel}, </if>
<if test= "carInformationFence != null " >#{carInformationFence}, </if>
<if test= "carInformationType != null " > #{carInformationType} </if> );
</insert>
<update id="updatecarInformation">
UPDATE `car_information`
SET
<if test="carInformationVIN != null and carInformationVIN != '' ">
` car_information_VIN` = #{carInformationVIN},
</if>
<if test="carInformationLicensePlate != null and carInformationLicensePlate != '' ">
` car_information_license_plate ` = #{carInformationLicensePlate},
</if>
<if test="carInformationBrand != null and carInformationBrand != '' ">
`car_information_brand` = #{carInformationBrand},
</if>
<if test="carInformationColor != null and carInformationColor != '' ">
`car_information_color` = #{carInformationColor},
</if>
<if test="carInformationDriver != null and carInformationDriver != '' ">
`car_information_driver` = #{carInformationDriver},
</if>
<if test="carInformationMotorManufacturer != null and carInformationMotorManufacturer != '' ">
`car_information_motor_manufacturer` = #{carInformationMotorManufacturer},
</if>
<if test="carInformationMotorModel != null and carInformationMotorModel != '' ">
`car_information_motor_model` = #{carInformationMotorModel} ,
</if>
<if test="carInformationBatteryManufacturer != null and carInformationBatteryManufacturer != '' ">
`car_information_battery_manufacturer `= #{carInformationBatteryManufacturer},
</if>
<if test="carInformationBatteryModel != null and carInformationBatteryModel != '' ">
`car_information_battery_model` = #{carInformationBatteryModel},
</if>
<if test="carInformationFence != null">
`car_information_fence` = #{carInformationFence},
</if>
<if test="carInformationType != null">
`car_information_type` = #{carInformationType} ,
</if>
<if test="carInformationFocus != null">
`car_information_focus` = #{carInformationFocus},
</if>
<if test="carInformationState != null">
`car_information_state` = #{carInformationState}
</if>
WHERE `car_information_id` = #{carInformationId}
</update>
<delete id="delBycarInformationId">
DELETE FROM `car_information`
WHERE `car_information`.car_information_id= #{carInformationId}
</delete>
</mapper>

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 1.在mybats的开发中namespace有特殊的意思一定要是对应接口的全限定名通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)-->
<mapper namespace="com.muyu.car.mapper.CarMessageMapper">
<resultMap id="carMessageResult" type="com.muyu.car.domain.CarMessage">
<result property="messageTypeId" column="message_type_id"/>
<result property="messageTypeCode" column="message_type_code"/>
<result property="messageTypeName" column="message_type_name"/>
<result property="messageTypeBelongs" column="message_type_belongs"/>
<result property="messageTypeClass" column="message_type_class"/>
<result property="carMessageId" column="car_message_id"/>
<result property="carMessageCartype" column="car_message_cartype"/>
<result property="carMessageType" column="car_message_type"/>
<result property="carMessageStartIndex" column="car_message_start_index"/>
<result property="carMessageEndIndex" column="car_message_end_index"/>
<result property="carMessageState" column= "car_message_state"/>
</resultMap>
<insert id="insertCarMessage">
INSERT INTO `car_message` (
car_message_cartype,
car_message_type,
car_message_start_index,
car_message_end_index,
message_type_class,
car_message_state
)
VALUES(
#{carMessageCartype},
#{carMessageType},
#{carMessageStartIndex},
#{carMessageEndIndex},
#{messageTypeClass},
#{carMessageState}
)
</insert>
<update id="updateCarMessage">
UPDATE `car_message`
SET
<if test="carMessageCartype != null" >
car_message_cartype = #{carMessageCartype} ,
</if>
<if test="carMessageType != null">
car_message_type = #{carMessageType} ,
</if>
<if test="carMessageStartIndex != null">
car_message_start_index = #{carMessageStartIndex} ,
</if>
<if test="carMessageEndIndex != null">
car_message_end_index = #{carMessageEndIndex} ,
</if>
<if test="messageTypeClass != null and messageTypeClass !=''">
message_type_class = #{messageTypeClass} ,
</if>
<if test="carMessageState != null ">
car_message_state = #{carMessageState}
</if>
</update>
<delete id="deleteByCarMessageId">
DELETE FROM `car_message`
WHERE `car_message`.car_message_id = #{carMessageId}
</delete>
<select id="selectCarMessageList" resultMap="carMessageResult">
SELECT
car_message_id,
car_message_cartype,
car_message_type,
car_message_start_index,
car_message_end_index,
message_type_class,
car_message_state,
message_type_id,
message_type_code,
message_type_name,
message_type_belongs,
car_type_id,
car_type_name
FROM `car_message`
LEFT JOIN `car_message_type`
ON `car_message`.car_message_type = `car_message_type`.message_type_id
LEFT JOIN `car_type`
ON `car_message` .car_message_cartype = `car_type`.car_type_id
WHERE
`car_message`.car_message_cartype = #{carMessageCartype}
</select>
<select id="selectcarInformationType" resultType="com.muyu.car.domain.CarInformation">
SELECT
car_information_VIN,
car_information_type,
car_type_id,
car_type_name,
car_message_id,
car_message_cartype,
car_message_type,
car_message_start_index,
car_message_end_index,
message_type_class,
car_message_state
FROM `car_information`
LEFT JOIN `car_type`
ON `car_information`. car_information_type
=`car_type`. car_type_id
LEFT JOIN `car_message`
ON `car_message`.car_message_cartype
=`car_type`. car_type_id
WHERE
`car_information`.car_information_VIN = #{carInformationVIN}
</select>
<select id="selectcarMessageCartype" resultType="java.lang.Long">
SELECT `car_information`.car_Information_Type
FROM `car_information`
WHERE `car_information`.car_information_VIN = #{carInformationVIN}
</select>
</mapper>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 1.在mybats的开发中namespace有特殊的意思一定要是对应接口的全限定名通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)-->
<mapper namespace="com.muyu.car.mapper.PackettemplateMapper">
<resultMap id="PackertemplateResult" type="com.muyu.car.domain.Packettemplate">
<result property="packetTemplateId" column="packet_template_id"/>
<result property="packetTemplateCartype" column="packet_template_cartype"/>
<result property="packetTemplateCarmessage" column="packet_template_carmessage"/>
</resultMap>
<sql id="packerResult">
select
*
from `packet_template`
</sql>
<insert id="addPackert">
INSERT INTO `packet_template`
( `packet_template_cartype`, `packet_template_carmessage`)
VALUES
( #{packetTemplateCartype}, #{packetTemplateCarmessage});
</insert>
<select id="selectAll" resultType="com.muyu.car.domain.Packettemplate">
<include refid="packerResult"/>
</select>
</mapper>

View File

@ -1,24 +0,0 @@
package com.muyu.carData;
import com.muyu.carData.listener.MyListener;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author
* @Packagecom.muyu.carData
* @Projectcloud-server-8
* @nameCarDataApplication
* @Date2024/9/26 15:33
*/
@SpringBootApplication
@EnableMyFeignClients
public class CarDataApplication {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(CarDataApplication.class);
application.addListeners(new MyListener());
application.run(args);
}
}

View File

@ -1,29 +0,0 @@
package com.muyu.carData.config.cacheconfig;
import com.github.benmanes.caffeine.cache.Expiry;
import org.checkerframework.checker.index.qual.NonNegative;
import java.util.concurrent.TimeUnit;
/**
* @Author
* @Packagecom.muyu.carData.cacheconfig
* @Projectcloud-server-8
* @nameCacheExpiry
* @Date2024/9/26 23:46
*/
public class CacheExpiry implements Expiry<String,ExpiryTime>{
@Override
public long expireAfterCreate(String key, ExpiryTime value, long currentTime) {
return TimeUnit.SECONDS.toNanos(value.getExpiryTime());
}
@Override
public long expireAfterUpdate(String key, ExpiryTime value, long currentTime, @NonNegative long currentDuration) {
return TimeUnit.SECONDS.toNanos(value.getRefreshTime());
}
@Override
public long expireAfterRead(String key, ExpiryTime value, long currentTime, @NonNegative long currentDuration) {
return TimeUnit.SECONDS.toNanos(value.getRefreshTime());
}
}

View File

@ -1,26 +0,0 @@
package com.muyu.carData.config.cacheconfig;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Author
* @Packagecom.muyu.carData.cacheconfig
* @Projectcloud-server-8
* @nameCaffeineConfig
* @Date2024/9/26 23:51
*/
@Configuration
public class CaffeineConfig {
@Bean
public Cache<String, ? extends ExpiryTime> caffeineCache(){
CacheExpiry cacheExpiry = new CacheExpiry();
return Caffeine.newBuilder()
.expireAfter(cacheExpiry)
.initialCapacity(128)
.build();
}
}

View File

@ -1,33 +0,0 @@
package com.muyu.carData.config.cacheconfig;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @Author
* @Packagecom.muyu.carData.cacheconfig
* @Projectcloud-server-8
* @nameExpiryTime
* @Date2024/9/26 23:44
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class ExpiryTime {
/**
* 30
*/
@Builder.Default
private long expiryTime = 30 * 60;
/**
* 15
*/
@Builder.Default
private long refreshTime = 15 * 60;
}

View File

@ -1,86 +0,0 @@
package com.muyu.carData.config.lotdbconfig;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.session.Session;
import org.apache.iotdb.session.pool.SessionPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author
* @Packagecom.muyu.carData.lotdbconfig
* @Projectcloud-server-8
* @nameIotDBSessionConfig
* @Date2024/9/27 12:25
* IotDB线
*/
@Component
@Configuration
public class IotDBSessionConfig {
private static Logger logger = LoggerFactory.getLogger(IotDBSessionConfig.class);
/**
*
*/
@Value("${spring.iotdb.username}")
private String username;
/**
*
*/
@Value("${spring.iotdb.password}")
private String password;
/**
* ip
*/
@Value("${spring.iotdb.ip}")
private String ip;
/**
*
*/
@Value("${spring.iotdb.port}")
private Integer port;
/**
*
*/
@Value("${spring.iotdb.maxSize}")
private Integer maxSize;
/**
*
*/
@Value("${spring.iotdb.fetchSize}")
private int fetchSize;
@Bean
public Session iotSession(){
Session session = new Session(ip, port, username, password);
try {
session.open();
} catch (IoTDBConnectionException e) {
logger.error(String.valueOf(e.getCause()));
}
return session;
}
}

View File

@ -1,56 +0,0 @@
package com.muyu.carData.consumer;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
import com.muyu.carData.pojo.Student;
import lombok.extern.log4j.Log4j2;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.Duration;
import java.util.Collection;
/**
* @Author
* @Packagecom.muyu.carData.consumer
* @Projectcloud-server-8
* @nameMyKafkaConsumer
* @Date2024/9/26 15:42
*/
@Component
@Log4j2
public class MyKafkaConsumer implements InitializingBean {
@Autowired
private KafkaConsumer kafkaConsumer;
private final String topicName = "carJsons";
@Override
public void afterPropertiesSet() throws Exception {
log.info("启动线程开始监听topic:{}",topicName);
Thread thread = new Thread(() -> {
ThreadUtil.sleep(1000);
Collection<String> topics = Lists.newArrayList(topicName);
kafkaConsumer.subscribe(topics);
while (true){
ConsumerRecords<String,String> consumerRecords = kafkaConsumer.poll(Duration.ofMillis(1000));
for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
//从consumerRecord中获取消费数据
String value = consumerRecord.value();
log.info("从Kafka中消费的原始数据===============>>{}",value);
}
}
});
thread.start();
log.info("启动线程结束监听topic:{}",topicName);
}
}

View File

@ -1,44 +0,0 @@
package com.muyu.carData.controller;
import com.github.benmanes.caffeine.cache.Cache;
import com.muyu.carData.config.cacheconfig.CaffeineConfig;
import com.muyu.carData.pojo.Student;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author
* @Packagecom.muyu.carData.controller
* @Projectcloud-server-8
* @nameTestController
* @Date2024/9/26 23:56
*/
@RestController
@RequestMapping("/testCache")
@Log4j2
public class CacheController {
@Autowired
private CaffeineConfig caffeineConfig;
@RequestMapping("/caffeine")
public String caffeine() throws InterruptedException {
Cache<String, Student> stringCache = (Cache<String, Student>) caffeineConfig.caffeineCache();
Student build = Student.builder().id(1)
.name("小马")
.sex("男")
.expiryTime(20 * 60)
.refreshTime(15 * 30)
.build();
stringCache.put("1", build);
Thread.sleep(1000);
//返回缓存的个数
log.info(stringCache.estimatedSize());
//返回缓存的数据
log.info(stringCache.getIfPresent("1"));
return "111";
}
}

View File

@ -1,113 +0,0 @@
package com.muyu.carData.controller;
import com.muyu.carData.config.lotdbconfig.IotDBSessionConfig;
import lombok.extern.log4j.Log4j2;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.session.Session;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.write.record.Tablet;
import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @Author
* @Packagecom.muyu.carData.testcontroller
* @Projectcloud-server-8
* @nameIotDBController
* @Date2024/9/28 23:58
*/
@RequestMapping("/iotdb")
@RestController
@Log4j2
public class IotDBController {
@Autowired
private IotDBSessionConfig iotDBSessionConfig;
/**
*
* @param insertSize
* @param count
* @return
* @throws IoTDBConnectionException
* @throws StatementExecutionException
*/
@GetMapping("/insertData/{insertSize}/{count}")
public String insert(@PathVariable(name = "insertSize") int insertSize,@PathVariable(name = "count") int count) throws IoTDBConnectionException, StatementExecutionException {
Session session = iotDBSessionConfig.iotSession();
//schemaList 属性及类型
List<MeasurementSchema> schemaList = new ArrayList<>();
schemaList.add(new MeasurementSchema("id", TSDataType.INT32));
schemaList.add(new MeasurementSchema("name", TSDataType.TEXT));
schemaList.add(new MeasurementSchema("sex", TSDataType.TEXT));
//tablet 封装数据
Tablet tablet = new Tablet("root.yang.baling", schemaList);
//以当前时间戳作为插入的起始时间戳
long timestamp = System.currentTimeMillis();
long beginTime = System.currentTimeMillis();
for (long row = 0;row < count; row++){
int rowIndex = tablet.rowSize++;
tablet.addTimestamp(rowIndex,timestamp); //批量插入的时间戳是数组形式所以需要使用rowIndex来指定插入的位置
tablet.addValue("id", rowIndex, ((row & 1) == 0 ? 1 : 0));
tablet.addValue("name", rowIndex, "name<=>" + row);
tablet.addValue("sex", rowIndex, "男");
if (tablet.rowSize == insertSize){
long bg = System.currentTimeMillis();
session.insertTablet(tablet);
tablet.reset();
log.info("已经插入了"+(row + 1)+",插入耗时:" + (System.currentTimeMillis() - bg));
}
timestamp++;
}
if (tablet.rowSize != 0){
session.insertTablet(tablet);
log.info("插入完成,耗时:" + (System.currentTimeMillis() - beginTime));
tablet.reset();
}
long endTime = System.currentTimeMillis();
log.info("插入了"+insertSize+"条数据,每次插入"+count+"条数据,总耗时:"+(endTime - beginTime));
return "时序性数据库测试success";
}
/* @GetMapping("/batchInsertRecords/{num}")
public String batchInsertRecords(@PathVariable Integer num){
String deviceId = "root.yang";
//属性(字段)
List<String> schemaList = new ArrayList<>();
schemaList.add("id");
schemaList.add("name");
schemaList.add("age");
ArrayList<TSDataType> tsDataTypes = new ArrayList<>();
tsDataTypes.add(TSDataType.INT32);
tsDataTypes.add(TSDataType.TEXT);
tsDataTypes.add(TSDataType.INT32);
List<Object> value = new ArrayList<>();
value.add(1);
value.add("张腾");
value.add(18);
ArrayList<String> deviceIds = new ArrayList<>();
ArrayList<Long> times = new ArrayList<>();
ArrayList<List<TSDataType>> typeList = new ArrayList<>();
ArrayList<List<Object>> valueList = new ArrayList<>();
for (int i = 0; i < num; i++) {
deviceIds.add()
}
}*/
}

View File

@ -1,45 +0,0 @@
package com.muyu.carData.controller;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.log4j.Log4j2;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Author
* @Packagecom.muyu.carData.testcontroller
* @Projectcloud-server-8
* @nameKafkaProducerController
* @Date2024/9/28 15:10
*/
@RestController
@RequestMapping("/produce")
@Log4j2
public class KafkaProducerController {
@Autowired
private KafkaProducer kafkaProducer;
private final String topicName = "carJsons";
@GetMapping("/producer")
public String produceTest(JSONObject data) {
try {
log.info("Topic:{}", topicName);
log.info("转换为JSON{}",data);
//使用KafkaProducer发送消息
ProducerRecord<String, String> stringProducerRecord = new ProducerRecord(topicName, data);
kafkaProducer.send(stringProducerRecord);
}catch (Exception e){
log.error("Producer写入Topic异常,异常信息是:{}",e.getMessage());
}
return "消息发送成功";
}
}

View File

@ -1,22 +0,0 @@
package com.muyu.carData.event;
import com.alibaba.fastjson.JSONObject;
import org.springframework.context.ApplicationEvent;
/**
* @Author
* @Packagecom.muyu.carData.event
* @Projectcloud-server-8
* @nameEsSaveEvent
* @Date2024/9/29 21:15
*/
public class EsSaveEvent extends ApplicationEvent {
private JSONObject data;
public EsSaveEvent(JSONObject source) {
super(source);
this.data = source;
}
}

View File

@ -1,22 +0,0 @@
package com.muyu.carData.listener;
import com.muyu.carData.event.EsSaveEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
/**
* @Author
* @Packagecom.muyu.carData.listener
* @Projectcloud-server-8
* @nameCustomEventListener
* @Date2024/9/29 23:49
*/
@Component
public class CustomEventListener {
@EventListener
public void handMyEvent(EsSaveEvent event){
//处理事件详情
}
}

View File

@ -1,20 +0,0 @@
package com.muyu.carData.listener;
import com.muyu.carData.event.EsSaveEvent;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.ApplicationListener;
/**
* @Author
* @Packagecom.muyu.carData.listener
* @Projectcloud-server-8
* @nameMyListener
* @Date2024/9/29 21:18
*/
@Log4j2
public class MyListener implements ApplicationListener<EsSaveEvent> {
@Override
public void onApplicationEvent(EsSaveEvent event) {
log.info("监听到自定义事件........");
}
}

View File

@ -1,41 +0,0 @@
package com.muyu.carData.pojo;
import com.muyu.carData.config.cacheconfig.ExpiryTime;
import lombok.*;
import lombok.experimental.SuperBuilder;
/**
* @Author
* @Packagecom.muyu.carData.pojo
* @Projectcloud-server-8
* @nameStudent
* @Date2024/9/27 0:40
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Student extends ExpiryTime{
/**
*
*/
private Integer id;
/**
*
*/
private String name;
/**
*
*/
private String sex;
/**
*
*/
private long time = System.currentTimeMillis();
}

View File

@ -1,29 +0,0 @@
package com.muyu.carData.pulisher;
import com.alibaba.fastjson.JSONObject;
import com.muyu.carData.event.EsSaveEvent;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
/**
* @Author
* @Packagecom.muyu.carData.pulisher
* @Projectcloud-server-8
* @nameCustomEventPublisher
* @Date2024/9/29 23:51
*/
@Log4j2
@Component
@AllArgsConstructor
public class CustomEventPublisher {
private ApplicationEventPublisher applicationEventPublisher;
public void publish(JSONObject data){
EsSaveEvent esSaveEvent = new EsSaveEvent(data);
applicationEventPublisher.publishEvent(esSaveEvent);
log.info("事件发布成功 - 消息是:{}",data);
}
}

View File

@ -1,63 +0,0 @@
# Tomcat
server:
port: 9702
# nacos线上地址
nacos:
addr: 159.75.188.178:8848
user-name: nacos
password: nacos
namespace: eight
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
# Spring
spring:
iotdb:
username: root
password: root
ip: 60.204.221.52
port: 6667
maxSize: 100
fetchSize: 10000
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: cloud-carData
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
config:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
# 系统共享配置
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# xxl-job 配置文件
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# rabbit 配置文件
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.muyu.system.mapper: DEBUG

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules-enterprise</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-modules-enterprise-common</artifactId>
<version>1.0.0</version>
<description>
cloud-modules-enterprise-common 企业业务common
</description>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- MuYu Common Core-->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-core</artifactId>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations-jakarta</artifactId>
<version>2.2.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-system</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,25 +0,0 @@
package com.muyu.domain;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
/**
* ()
*/
@Data
@Tag(name = "连接微信服务器")
public class AccessToken {
private String access_token;
private Long expires_in;
public void setExpiresTime(Long expiresIn) {
this.expires_in = System.currentTimeMillis()+expiresIn*1000;
}
public boolean isExpired(Long expiresIn){
long now = System.currentTimeMillis();
return now>expiresIn;
}
}

View File

@ -1,41 +0,0 @@
package com.muyu.domain;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ()
* @Author
* @Packagecom.muyu.wxapplication.massage
* @ProjectWXApplication
* @nameArticles
* @Date2024/9/18 10:14
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@XStreamAlias("item")
@Tag(name = "发送图文回复消息内容")
public class Articles {
// <Articles>
// <item>
// <Title><![CDATA[title1]]></Title>
// <Description><![CDATA[description1]]></Description>
// <PicUrl><![CDATA[picurl]]></PicUrl>
// <Url><![CDATA[url]]></Url>
// </item>
// </Articles>
@XStreamAlias("Title")
private String title ;
@XStreamAlias("Description")
private String description ;
@XStreamAlias("PicUrl")
private String picUrl ;
@XStreamAlias("Url")
private String url ;
}

View File

@ -1,213 +0,0 @@
package com.muyu.domain;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* ()
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain.faultrule
* @Projectcloud-server-8
* @namePureElectricCar
* @Date2024/9/20 20:22
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Tag(name = "故障规则测试类")
public class CarFaultRule {
/**
* VINVINVIN
*/
private String vin;
/**
*
*/
private long timestamp;
/**
*
*/
private double longitude;
/**
*
*/
private double latitude;
/**
*
*/
private double speed;
/**
*
*/
private Long tm;
/**
*
*/
private double tv;
/**
*
*/
private double cc;
/**
*
*/
private double ir;
/**
*
*/
private String gp;
/**
*
*/
private double aptv;
/**
*
*/
private double bptv;
/**
*
*/
private double sfc;
/**
*
*/
private double mct;
/**
*
*/
private int ms;
/**
*
*/
private double mto;
/**
*
*/
private double mte;
/**
*
*/
private double mv;
/**
*
*/
private double mc;
/**
* SOCSOCSOC
*/
private double pbrsoc;
/**
*
*/
private double macsfp;
/**
*
*/
private double csatmdp;
/**
* BMSBMSBMS
*/
private int bms;
/**
*
*/
private double cadc;
/**
* V3V3V3
*/
private double pbletvv3;
/**
*
*/
private double smv;
/**
*
*/
private double mvoab;
/**
*
*/
private double maxbt;
/**
*
*/
private double minbt;
/**
*
*/
private double pbac;
/**
*
*/
private String vs;
/**
*
*/
private String cs;
/**
*
*/
private String rs;
/**
* SOCSOCSOC
*/
private double soc;
/**
*
*/
private String resdwc;
/**
* EASEASEAS
*/
private String eas;
/**
* PTCPTCPTC
*/
private String ptc;
/**
* EPSEPSEPS
*/
private String eps;
/**
* ABSABSABS
*/
private String abs;
/**
* MCUMCUMCU
*/
private String mcu;
/**
*
*/
private String pbhs;
/**
*
*/
private String pbcs;
/**
*
*/
private String pbis;
/**
* DCDCDCDCDCDC
*/
private String dcdc;
/**
* CHGCHGCHG
*/
private String chg;
/**
*
*/
private byte chb;
/**
*
*/
private byte cub;
}

View File

@ -1,105 +0,0 @@
package com.muyu.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import lombok.experimental.SuperBuilder;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-electronic
* @nameCarFence
* @Date2024/9/17 16:08
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "电子围栏类")
@TableName(value = "car_fence",autoResultMap = true)
public class CarFence {
/**
*
*/
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
/**
*
*/
private String name;
/**
* ID
*/
private Integer clazzId;
/**
*
*/
@TableField(exist = false)
private String clazzName;
/**
* ID
*/
private Integer typeId;
/**
*
*/
@TableField(exist = false)
private String typeName;
/**
*
*/
private String fenceText;
/**
*
*/
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date fenceStart;
/**
*
*/
@DateTimeFormat(fallbackPatterns = "yyyy-MM-dd hh:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
private Date fenceEnd;
/**
*
*/
@DateTimeFormat(fallbackPatterns = "yyyy/MM/dd hh:mm:ss")
@JsonFormat(pattern = "yyyy/MM/dd hh:mm:ss")
private Date fenceCreate;
/**
* ID
*/
private Integer middleId;
/**
*
*/
@TableField(exist = false)
private List<CarFenceGroup> carFenceGroups;
public static CarFence carFenceBuild(CarFence carFence) {
return CarFence.builder()
.id(carFence.getId())
.name(carFence.getName())
.clazzId(carFence.getClazzId())
.typeId(carFence.getTypeId())
.fenceText(carFence.getFenceText())
.fenceStart(carFence.getFenceStart())
.fenceCreate(carFence.getFenceCreate())
.middleId(carFence.getMiddleId())
.build();
}
}

View File

@ -1,40 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-electronic
* @nameCarFenceClazz
* @Date2024/9/17 16:41
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "电子业务类型")
@TableName(value = "car_fence_clazz",autoResultMap = true)
public class CarFenceClazz {
/**
* ID
*/
private Integer clazzId;
/**
*
*/
private String clazzName;
public static CarFenceClazz carFenceClazzBuild(CarFenceClazz carFenceClazz) {
return CarFenceClazz.builder()
.clazzId(carFenceClazz.getClazzId())
.clazzName(carFenceClazz.getClazzName())
.build();
}
}

View File

@ -1,55 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-server-8
* @namecarFenceGroup
* @Date2024/9/22 10:20
*/
//weilabzu
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "电子围栏组类")
@TableName(value = "car_fence_group",autoResultMap = true)
public class CarFenceGroup {
/**
* ID
*/
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
/**
*
*/
private Integer priority;
/**
*
*/
private String status;
/**
*
*/
private String groupType;
public static CarFenceGroup carFenceBuild(CarFenceGroup carFenceGroup) {
return CarFenceGroup.builder()
.id(carFenceGroup.getId())
.priority(carFenceGroup.getPriority())
.status(carFenceGroup.getStatus())
.groupType(carFenceGroup.getGroupType())
.build();
}
}

View File

@ -1,40 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-electronic
* @nameType
* @Date2024/9/17 16:40
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "电子围栏类型")
@TableName(value = "car_fence_type",autoResultMap = true)
public class CarFenceType {
/**
* ID
*/
private Integer typeId;
/**
*
*/
private String typeName;
public static CarFenceType carFenceTypeBuild(CarFenceType carFenceType) {
return CarFenceType.builder()
.typeId(carFenceType.getTypeId())
.typeName(carFenceType.getTypeName())
.build();
}
}

View File

@ -1,150 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.domain.req.CarInformationAddReq;
import com.muyu.domain.req.CarInformationUpdReq;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.function.Supplier;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-server-8
* @nameCarInformation
* @Date2024/9/22 22:18
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Tag(name = "企业车辆管理实体类")
@TableName(value = "car_information",autoResultMap = true)
public class CarInformation {
/**
* ID
*/
@TableId(value = "car_information_id",type = IdType.AUTO)
private Long carInformationId;
/**
* VIN
*/
// @TableName(value = "car_information_VIN")
@TableField(value = "car_information_VIN")
private String carInformationVIN;
/**
*
*/
private String carInformationLicensePlate;
/**
*
*/
private String carInformationColor;
/**
*
*/
private String carInformationDriver;
/**
* ID
*/
@Schema(title = "车辆电子围栏外键ID", type = "Integer")
private Integer carInformationFence;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
private Date carInformationExamineEnddata;
/**
* ID
*/
@Schema(title = "车辆类型外键ID", type = "Integer")
private Integer carInformationType;
/**
*
*/
private String carInformationBrand;
/**
* (0 1 )
*/
private Integer carInformationFocus;
/**
*
*/
private String carInformationMotorManufacturer;
/**
*
*/
private String carInformationMotorModel;
/**
*
*/
private String carInformationBatteryManufacturer;
/**
*
*/
private String carInformationBatteryModel;
/**
* (1.线 2.线 3. 4. 5.)
*/
private Integer carInformationState;
public static CarInformation carInformationBuilder(CarInformation carInformation) {
return CarInformation.builder()
.carInformationId(carInformation.getCarInformationId())
.carInformationLicensePlate(carInformation.getCarInformationLicensePlate())
.build();
}
public static CarInformation carInformationUpdBuilder(CarInformationUpdReq carInformation, Supplier<Long> idSupplier) {
return CarInformation.builder()
.carInformationId(idSupplier.get())
.carInformationBrand(carInformation.getCarInformationBrand())
.carInformationColor(carInformation.getCarInformationColor())
.carInformationDriver(carInformation.getCarInformationDriver())
.carInformationMotorManufacturer(carInformation.getCarInformationMotorManufacturer())
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
.carInformationBatteryManufacturer(carInformation.getCarInformationBatteryManufacturer())
.carInformationBatteryModel(carInformation.getCarInformationBatteryModel())
.carInformationFence(carInformation.getCarInformationFence())
.carInformationType(carInformation.getCarInformationType())
.carInformationFocus(carInformation.getCarInformationFocus())
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
.build();
}
public static CarInformation carInformationAddBuilder(CarInformationAddReq carInformation) {
return CarInformation.builder()
.carInformationVIN(carInformation.getCarInformationVIN())
.carInformationLicensePlate(carInformation.getCarInformationLicensePlate())
.carInformationBrand(carInformation.getCarInformationBrand())
.carInformationColor(carInformation.getCarInformationColor())
.carInformationDriver(carInformation.getCarInformationDriver())
.carInformationMotorManufacturer(carInformation.getCarInformationMotorManufacturer())
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
.carInformationBatteryManufacturer(carInformation.getCarInformationBatteryManufacturer())
.carInformationBatteryModel(carInformation.getCarInformationBatteryModel())
.carInformationFence(carInformation.getCarInformationFence())
.carInformationType(carInformation.getCarInformationType())
.carInformationMotorModel(carInformation.getCarInformationMotorModel())
.build();
}
}

View File

@ -1,135 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.function.Supplier;
/**
*
*
* @author 17353
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆报文模板实体类")
@TableName(value = "car_message", autoResultMap = true)
public class CarMessage {
//报文类型模块表
/**
*
*/
private Long messageTypeId;
/**
*
*/
private String messageTypeCode;
/**
*
*/
private String messageTypeName;
/**
*
*/
private String messageTypeBelongs;
//报文拆分位置主表
/**
*
*/
private Long carMessageId;
/**
*
*/
private Integer carMessageCartype;
/**
*
*/
private Integer carMessageType;
/**
*
*/
private Integer carMessageStartIndex;
/**
*
*/
private Integer carMessageEndIndex;
/**
* ( )
*/
private String messageTypeClass;
/**
* (0 1)
*/
private Integer carMessageState;
private String carMessageName;
/**
*
*
* @param carMessage
* @param supplier
* @return
*/
public static CarMessage carMessageUpdBuilder(CarMessage carMessage, Supplier<Long> supplier) {
return CarMessage.builder()
.messageTypeId(supplier.get())
.messageTypeCode(carMessage.messageTypeCode)
.messageTypeName(carMessage.messageTypeName)
.messageTypeBelongs(carMessage.messageTypeBelongs)
.carMessageId(carMessage.carMessageId)
.carMessageCartype(carMessage.carMessageCartype)
.carMessageType(carMessage.carMessageType)
.carMessageStartIndex(carMessage.carMessageStartIndex)
.carMessageEndIndex(carMessage.carMessageEndIndex)
.messageTypeClass(carMessage.messageTypeClass)
.carMessageState(carMessage.carMessageState)
.build();
}
/**
*
*
* @param carMessage
* @return
*/
public static CarMessage carMessageAddBuilder(CarMessage carMessage) {
return CarMessage.builder()
.messageTypeCode(carMessage.messageTypeCode)
.messageTypeName(carMessage.messageTypeName)
.messageTypeBelongs(carMessage.messageTypeBelongs)
.carMessageId(carMessage.carMessageId)
.carMessageCartype(carMessage.carMessageCartype)
.carMessageType(carMessage.carMessageType)
.carMessageStartIndex(carMessage.carMessageStartIndex)
.carMessageEndIndex(carMessage.carMessageEndIndex)
.messageTypeClass(carMessage.messageTypeClass)
.carMessageState(carMessage.carMessageState)
.build();
}
/*
private Long messageTypeId ;
private String messageTypeCode ;
private String messageTypeName ;
private String messageTypeBelongs ;
private String messageTypeClass ;
private Long carMessageId ;
private Integer carMessageCartype ;
private Integer carMessageType ;
private Integer carMessageStartIndex ;
private Integer carMessageEndIndex ;
private Integer carMessageState ;
*/
}

View File

@ -1,43 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Author
* @Packagecom.muyu.warn.domain.car
* @Projectcloud-server-8
* @nameCarMessage
* @Date2024/9/22 3:07
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Tag(name = "车辆报文所属类型")
@TableName(value = "car_message_type",autoResultMap = true)
public class CarMessageType {
/**
*
*/
private Integer messageTypeId ;
/**
*
*/
private String messageTypeCode ;
/**
*
*/
private String messageTypeName ;
/**
*
*/
private String messageTypeBelongs ;
}

View File

@ -1,54 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-electronic
* @namecarMiddle
* @Date2024/9/20 16:30
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆电子组中间表")
@TableName(value = "car_middle",autoResultMap = true)
public class CarMiddle {
/**
* ID
*/
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
/**
* ID
*/
private Integer fenceGroupId;
/**
* ID
*/
private Long carInformationId;
public CarMiddle(Integer fenceGroupId, Long carInformationId) {
this.fenceGroupId = fenceGroupId;
this.carInformationId = carInformationId;
}
public static CarMiddle carMiddleBuilder(CarMiddle carMiddle) {
return CarMiddle.builder()
.id(carMiddle.getId())
.fenceGroupId(carMiddle.getFenceGroupId())
.carInformationId(carMiddle.getCarInformationId())
.build();
}
}

View File

@ -1,54 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @Authoryang
* @Packagecom.muyu.domain
* @Projectcloud-server-8
* @namecarMiddleGroup
* @Date2024/9/22 10:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "围栏组中间表围栏")
@TableName(value = "car_middle_group",autoResultMap = true)
public class CarMiddleGroup {
/**
* ID
*/
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
/**
* ID
*/
private Integer carFenceId;
/**
*
*/
private Integer fenceGroupId;
public CarMiddleGroup(Integer carFenceId, Integer fenceGroupId) {
this.carFenceId = carFenceId;
this.fenceGroupId = fenceGroupId;
}
public static CarMiddleGroup carMiddleGroupBuilder(CarMiddleGroup carMiddleGroup) {
return CarMiddleGroup.builder()
.id(carMiddleGroup.getId())
.carFenceId(carMiddleGroup.getCarFenceId())
.fenceGroupId(carMiddleGroup.getFenceGroupId())
.build();
}
}

View File

@ -1,39 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-server-8
* @nameCarType
* @Date2024/9/21 19:01
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_type",autoResultMap = true)
@Tag(name ="车辆类型表")
public class CarType {
/**
* ID
*/
private long carTypeId;
/**
*
*/
private String carTypeName;
/**
* ID
*/
private long carTypeRules;
}

View File

@ -1,122 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.domain.req.FaultCodeAddReq;
import com.muyu.domain.req.FaultCodeUpdReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-faultmanage
* @nameFaultCode
* @Date2024/9/17 14:55
*/
/**
*
*
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_faultcode",autoResultMap = true)
@Tag(name = "故障码")
public class FaultCode {
/**
*Id
*/
@TableId(value = "faultcode_id",type = IdType.AUTO)
private long faultcodeId;
/**
*Id
*/
private long messageTypeId;
/**
*
*/
private String faultcodeNumber;
/**
*
*/
private String faultGroup;
/**
*
*/
private String faultBit;
/**
*
*/
private String faultValue;
/**
*
*/
private Integer isWarning;
/**
*
*/
@TableField(exist = false)
private String faulttypeName;
/**
*
*/
@TableField(exist = false)
private String messageTypeName;
/**
*
*/
@TableField(exist = false)
private String messageTypeCode;
/**
*
*/
@TableField(exist = false)
private String messageTypeBelongs;
public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq){
return FaultCode.builder()
.faultcodeId(0)
.messageTypeId(faultCodeAddReq.getMessageTypeId())
.faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
.faultGroup(faultCodeAddReq.getFaultGroup())
.faultBit(faultCodeAddReq.getFaultBit())
.faultValue(faultCodeAddReq.getFaultValue())
.isWarning(faultCodeAddReq.getIsWarning())
.build();
}
public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
return FaultCode.builder()
.faultcodeId(0)
.messageTypeId(faultCodeUpdReq.getMessageTypeId())
.faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
.faultGroup(faultCodeUpdReq.getFaultGroup())
.faultBit(faultCodeUpdReq.getFaultBit())
.faultValue(faultCodeUpdReq.getFaultValue())
.isWarning(faultCodeUpdReq.getIsWarning())
.build();
}
public static FaultCode faultCodeBuilder(FaultCode faultCode) {
return FaultCode.builder()
.faultcodeId(faultCode.getFaultcodeId())
.messageTypeId(faultCode.getMessageTypeId())
.faultcodeNumber(faultCode.getFaultcodeNumber())
.faultGroup(faultCode.faultGroup)
.faultBit(faultCode.faultBit)
.faultValue(faultCode.faultValue)
.isWarning(faultCode.isWarning)
.build();
}
}

View File

@ -1,95 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.domain.req.FaultConditionAddReq;
import com.muyu.domain.req.FaultConditionUpdReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.function.Supplier;
/**
*
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-server-8
* @nameFaultCondition
* @Date2024/9/21 19:51
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_fault_condition",autoResultMap = true)
@Tag(name = "故障规则")
public class FaultCondition {
/**
* Id
*/
@TableId(value = "carcondition_id",type = IdType.AUTO)
private long carconditionId;
/**
* Id
*/
private long carTypeId;
/**
*Id
*/
private long messageTypeId;
/**
*
*/
private String faultconditionIdentification;
/**
*
*/
private BigDecimal faultconditionParameter;
/**
*
*/
@TableField(exist = false)
private String carTypeName;
/**
*
*/
@TableField(exist = false)
private String messageTypeName;
/**
*
*/
@TableField(exist = false)
private String messageTypeCode;
public static FaultCondition faultConditionadd(FaultConditionAddReq faultConditionAddReq){
return FaultCondition.builder()
.carTypeId(faultConditionAddReq.getCarTypeId())
.messageTypeId(faultConditionAddReq.getMessageTypeId())
.faultconditionIdentification(faultConditionAddReq.getFaultconditionIdentification())
.faultconditionParameter(faultConditionAddReq.getFaultconditionParameter())
.build();
}
public static FaultCondition faultConditionupd(FaultConditionUpdReq faultConditionUpdReq, Supplier<Long> idSupplier){
return FaultCondition.builder()
.carconditionId(faultConditionUpdReq.getCarconditionId())
.carTypeId(faultConditionUpdReq.getCarTypeId())
.messageTypeId(faultConditionUpdReq.getMessageTypeId())
.faultconditionIdentification(faultConditionUpdReq.getFaultconditionIdentification())
.faultconditionParameter(faultConditionUpdReq.getFaultconditionParameter())
.build();
}
}

View File

@ -1,62 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.domain.req.FaultCodeAddReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-faultmanage
* @nameFaultLabel
* @Date2024/9/17 15:06
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_fault_label",autoResultMap = true)
@Tag(name = "故障标签")
public class FaultLabel {
/**
*
*/
@TableId(value = "message_type_id",type = IdType.AUTO)
private long messageTypeId;
/**
*
*/
private String messageTypeCode;
/**
*
*/
private String messageTypeName;
/**
*
*/
private String messageTypeBelongs;
public static FaultLabel addfaultLabel(FaultCodeAddReq faultCodeAddReq){
return FaultLabel.builder()
.messageTypeId(0)
.messageTypeId(faultCodeAddReq.getMessageTypeId())
.messageTypeCode(faultCodeAddReq.getMessageTypeCode())
.messageTypeName(faultCodeAddReq.getMessageTypeName())
.messageTypeBelongs(faultCodeAddReq.getMessageTypeBelongs())
.build();
}
}

View File

@ -1,73 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
*
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-server-8
* @nameFaultLog
* @Date2024/9/19 0:42
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_fault_log",autoResultMap = true)
@Tag(name = "故障日志")
public class FaultLog {
/**
* Id
*/
@TableId(value = "log_id",type = IdType.AUTO)
private long logId;
/**
* Id
*/
private long faultcodeId;
/**
* Id
*/
private long carInformationId;
/**
* VIN
*/
private String carVin;
/**
*
*/
private String faultcodeNumber;
/**
* VIN
*/
private String carInformationVIN;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "开始报警时间",defaultValue = "2024-8-9 10:47:57",type = "Date")
private Date startwarningTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "结束报警时间",defaultValue = "2024-8-9 10:47:57",type = "Date")
private Date endwarningTime;
}

View File

@ -1,34 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @Authorweiran
* @Packagecom.muyu.cloud.faultmanage.domain
* @Projectcloud-faultmanage
* @nameFaultType
* @Date2024/9/17 15:03
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_fault_type",autoResultMap = true)
public class FaultType {
/**
*Id
*/
@TableId(value = "faulttype_id",type = IdType.AUTO)
private long faulttypeId;
/**
*
*/
private String faulttypeName;
}

View File

@ -1,40 +0,0 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @Authorweiran
* @Packagecom.muyu.firmmanage.domain
* @Projectcloud-server-8
* @nameFirm
* @Date2024/9/27 12:29
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class Firm {
/**
* ID
*/
@TableId(value = "firm_id")
private Long firmId;
/**
*
*/
@TableField(exist = false)
private String firmName;
/**
*
*/
private String databaseName;
}

View File

@ -1,17 +0,0 @@
package com.muyu.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class KafKaData {
private String key;
private String type;
private String label;
private String value;
}

Some files were not shown because too many files have changed in this diff Show More