Compare commits

...

4 Commits

Author SHA1 Message Date
法外狂徒张三 2a2f70cc31 Merge remote-tracking branch 'dev.car/dev.car' into dev
# Conflicts:
#	cloud-auth/src/main/resources/bootstrap.yml
#	cloud-gateway/src/main/resources/bootstrap.yml
#	cloud-modules/cloud-modules-file/src/main/resources/bootstrap.yml
#	cloud-modules/cloud-modules-gen/src/main/java/com/muyu/gen/controller/GenController.java
#	cloud-modules/cloud-modules-gen/src/main/resources/bootstrap.yml
#	cloud-modules/cloud-modules-system/src/main/resources/bootstrap.yml
#	cloud-modules/pom.xml
#	cloud-visual/cloud-visual-monitor/src/main/resources/bootstrap.yml
2024-09-25 19:47:09 +08:00
法外狂徒张三 db2b868195 初始化 2024-09-25 19:23:04 +08:00
法外狂徒张三 d44049758d 车务管理第一版 2024-09-25 19:12:24 +08:00
法外狂徒张三 0a3cfa13da 车务管理第一版 2024-09-22 21:04:52 +08:00
78 changed files with 4162 additions and 166 deletions

View File

@ -4,10 +4,10 @@ server:
# nacos线上地址
nacos:
addr: 47.116.173.119:8848
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: one-saas
namespace: wyh
# Spring
spring:
application:
@ -21,27 +21,27 @@ spring:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# # 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}
# # nacos用户名
# username: ${nacos.user-name}
# # nacos密码
# password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统共享配置
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -1,13 +1,13 @@
# Tomcat
server:
port: 8080
port: 8081
# nacos线上地址
nacos:
addr: 47.116.173.119:8848
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: one-saas
namespace: wyh
# Spring
spring:
@ -41,10 +41,10 @@ spring:
file-extension: yml
# 共享配置
shared-configs:
# 系统环境Config共享配置
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 系统共享配置
- 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

View File

@ -0,0 +1,27 @@
<?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-breakdown</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-breakdown-client</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-breakdown-common</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,26 @@
<?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-breakdown</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-breakdown-common</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,93 @@
//package com.muyu.breakdown.DTO;
//
//
//import com.muyu.breakdown.domain.Messages;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.sql.*;
//import java.util.*;
//
///**
// * @ ToolIntelliJ IDEA
// * @ AuthorCHX
// * @ Date2024-09-18-15:00
// * @ Version1.0
// * @ Description数据库连接层
// * @author Lenovo
// */
//@Component
//public class MessageDTO {
// private static final String DB_URL = "jdbc:mysql://106.54.193.225:3306/one";
// private static final String USER = "root";
// private static final String PASSWORD = "bawei2112A";
//
// // 2. 建立数据库连接
// Connection connection;
// // 构造函数,初始化数据库连接
// // 保存消息到数据库
// public void saveMessage(Messages message) {
// String sql = "INSERT INTO sys_messages (sender_id, receiver_id, content) VALUES (?, ?, ?)";
// try {
// Class.forName("com.mysql.cj.jdbc.Driver");
// } catch (ClassNotFoundException e) {
// throw new RuntimeException(e);
// }
// try {
// connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
// preparedStatement.setInt(1, message.getSenderId());
// preparedStatement.setInt(2, message.getReceiverId());
// preparedStatement.setString(3, message.getContent());
// // 执行添加操作
// preparedStatement.executeUpdate();
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// try {
// connection.close();
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// }
//
// // 获取所有消息
// public List<Messages> getAllMessages(int receiverId){
// String sql = "SELECT * FROM sys_messages WHERE receiver_id = ?";
// try {
// Class.forName("com.mysql.cj.jdbc.Driver");
// } catch (ClassNotFoundException e) {
// throw new RuntimeException(e);
// }
// List<Messages> messages = new ArrayList<>();
// try {
// connection = DriverManager.getConnection(DB_URL, USER, PASSWORD);
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
// preparedStatement.setInt(1, receiverId);
// // 执行查询操作
// ResultSet rs = preparedStatement.executeQuery();
// while (rs.next()) {
// Messages message = new Messages(rs.getInt("sender_id"), receiverId, rs.getString("content"));
//
// // 添加到消息列表
// messages.add(message);
// }
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// try {
// connection.close();
// } catch (SQLException e) {
// throw new RuntimeException(e);
// }
// // 返回消息列表
// return messages;
// }
//
//}

View File

@ -0,0 +1,74 @@
package com.muyu.breakdown.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @author Lenovo
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:10
* @ Version1.0
* @ Description
*/
@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_car_fault")
public class BreakDown extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id", type = IdType.AUTO)
@Excel(name = "主键")
private Long id;
/**
*
*/
@Excel(name = "故障码")
private String faultCode;
/**
*
*/
@Excel(name = "故障类型")
private String faultType;
/**
*
*/
@Excel(name = "故障标签")
private String faultLabel;
/**
*
*/
@Excel(name = "故障位")
private String faultBit;
/**
*
*/
@Excel(name = "故障值")
private String faultValue;
/**
*
*/
@Excel(name = "故障级别")
private String faultWarn;
/**
* Y.N.
*/
@Excel(name = "报警状态")
private String faultStatus;
}

View File

@ -0,0 +1,55 @@
package com.muyu.breakdown.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* fault_log
*
* @author muyu
* @date 2024-09-20
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Setter
@Getter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("fault_log")
public class FaultLog extends BaseEntity{
private static final long serialVersionUID = 1L;
/** id */
@TableId( type = IdType.AUTO)
private Long id;
/** 故障码 */
@Excel(name = "故障码")
private String faultCode;
/** 车辆VIN */
@Excel(name = "车辆VIN")
private String carVin;
/** 开始报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束报警时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
}

View File

@ -0,0 +1,23 @@
package com.muyu.breakdown.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:31
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class MessageMap {
private String key;
private String value;
}

View File

@ -0,0 +1,52 @@
package com.muyu.breakdown.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-18-14:51
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_messages")
public class Messages {
@TableId(value = "id", type = IdType.AUTO)
@Excel(name = "消息ID")
private Long id;
@Excel(name = "发送者ID")
private Integer senderId;
@Excel(name = "接收者ID")
private Integer receiverId;
@Excel(name = "消息内容")
private String content;
@Excel(name = "发送时间")
private Date createTime;
@Excel(name = "消息状态")
private String status;
public Messages(int senderId, int receiverId, String content) {
this.senderId = senderId;
this.receiverId = receiverId;
this.content = content;
}
public Messages(Integer senderId, Integer receiverId, String content, Date createTime) {
this.senderId = senderId;
this.receiverId = receiverId;
this.content = content;
this.createTime = createTime;
}
}

View File

@ -0,0 +1,43 @@
package com.muyu.breakdown.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:35
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName("sys_car_message")
public class SysCarMessage {
/**
* id
*/
private Integer id;
/**
*
*/
private String modelCode;
/**
*
*/
private String messageTypeCode;
/**
*
*/
private String messageStartIndex;
/**
*
*/
private String messageEndIndex;
}

View File

@ -0,0 +1,27 @@
<?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-breakdown</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-breakdown-remote</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-breakdown-common</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,97 @@
<?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-breakdown</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-breakdown-server</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>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- MuYu Common DataSource -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-datasource</artifactId>
</dependency>
<!-- MuYu Common DataScope -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-log</artifactId>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-api-doc</artifactId>
</dependency>
<!-- XllJob定时任务 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-xxl</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-rabbit</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-breakdown-common</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join</artifactId>
<version>1.2.4</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,23 @@
package com.muyu;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:00
* @ Version1.0
* @ Description
* @author Lenovo
*/
@EnableCustomConfig
@EnableMyFeignClients
@SpringBootApplication
public class BreakDownApplication {
public static void main(String[] args) {
SpringApplication.run(BreakDownApplication.class, args);
}
}

View File

@ -0,0 +1,37 @@
package com.muyu.breakdown.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:41
* @ Version1.0
* @ Descriptionmybatisplus
* @author Lenovo
*/
//@Configuration
//public class MybatisPlusConfig {
// /**
// * 添加分页插件
// */
// @Bean
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// // 如果配置多个插件, 切记分页最后添加
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
// return interceptor;
// }
// @Bean
// public MybatisConfiguration mybatisConfiguration(){
// MybatisConfiguration configuration = new MybatisConfiguration();
// return configuration;
// }
//
//}

View File

@ -0,0 +1,56 @@
package com.muyu.breakdown.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
*
* */
@Configuration
public class RabbitMQConfig {
// 1.生命注册fanout模式的交换机
@Bean
public FanoutExchange fanoutExchange(){
//1.fanout模式的路由名称 2.是否持久化 3. 是否自动删除
return new FanoutExchange("fanout",true,false);
}
// 2.生命队列 sms.fanout.queue email.fanout.queue,duanxin.fanout.queue
@Bean
public Queue duanxinQueue(){
return new Queue("duanxin",true);
}
@Bean
public Queue emailQueue(){
return new Queue("email",false);
}
@Bean
public Queue smsQueue(){
return new Queue("sms",false);
}
// 3.完成绑定关系(队列和交换机完成绑定关系
@Bean
public Binding duanxinExchange(){
return BindingBuilder.bind(duanxinQueue()).to(fanoutExchange());
}
@Bean
public Binding emailExchange(){
return BindingBuilder.bind(emailQueue()).to(fanoutExchange());
}
@Bean
public Binding smsExchange(){
return BindingBuilder.bind(smsQueue()).to(fanoutExchange());
}
// 4.生命注册fanout模式的交换机
}

View File

@ -0,0 +1,62 @@
package com.muyu.breakdown.config;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
/**
*
* */
@Configuration
public class RabbitMQDirectConfig {
/**
* fanout Direct Binding
* */
// 1.生命注册fanout模式的交换机
@Bean
public DirectExchange directExchange(){
//1.fanout模式的路由名称 2.是否持久化 3. 是否自动删除
return new DirectExchange("direct",true,false);
}
// 2.生命队列 sms.fanout.queue email.fanout.queue,duanxin.fanout.queue
@Bean
public Queue directduanxinQueue(){
HashMap<String, Object> map = new HashMap<>();
map.put("x-delayed-letter-exchange","direct");
map.put("x-delayed-routing-key","directduanxin");
map.put("x-message-ttl",10000);
return QueueBuilder.durable("directduanxin").withArguments(map).build();
}
@Bean
public Queue directemailQueue(){
return new Queue("directemail",false);
}
@Bean
public Queue directsmsQueue(){
return new Queue("directsms",false);
}
// 3.完成绑定关系(队列和交换机完成绑定关系
@Bean
public Binding directduanxinExchange(){
return BindingBuilder.bind(directduanxinQueue()).to(directExchange()).with("directduanxin");
}
@Bean
public Binding directemailExchange(){
return BindingBuilder.bind(directemailQueue()).to(directExchange()).with("directemail");
}
@Bean
public Binding directsmsExchange(){
return BindingBuilder.bind(directsmsQueue()).to(directExchange()).with("directsms");
}
// 4.生命注册fanout模式的交换机
}

View File

@ -0,0 +1,59 @@
package com.muyu.breakdown.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
*
* */
@Configuration
public class RabbitMQTopicConfig {
/**
* fanout Direct Binding
* */
// 1.生命注册fanout模式的交换机
@Bean
public TopicExchange topicExchange(){
//1.fanout模式的路由名称 2.是否持久化 3. 是否自动删除
return new TopicExchange("topic",true,false);
}
// 2.生命队列 sms.fanout.queue email.fanout.queue,duanxin.fanout.queue
@Bean
public Queue topicduanxinQueue(){
return new Queue("topicduanxin.test.one",true);
}
@Bean
public Queue topicemailQueue(){
return new Queue("topicemail.test.two",false);
}
@Bean
public Queue topicsmsQueue(){
return new Queue("topicsms.test.three",false);
}
// 3.完成绑定关系(队列和交换机完成绑定关系
@Bean
public Binding topicduanxinExchange(){
return BindingBuilder.bind(topicduanxinQueue()).to(topicExchange()).with("topic.#");
}
@Bean
public Binding topicemailExchange(){
return BindingBuilder.bind(topicemailQueue()).to(topicExchange()).with("topic.*");
}
@Bean
public Binding topicsmsExchange(){
return BindingBuilder.bind(topicsmsQueue()).to(topicExchange()).with("topic.test.#");
}
// 4.生命注册fanout模式的交换机
}

View File

@ -0,0 +1,115 @@
package com.muyu.breakdown.controller;
import com.muyu.breakdown.domain.BreakDown;
import com.muyu.breakdown.domain.MessageMap;
import com.muyu.breakdown.service.BreakDownService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.security.utils.SecurityUtils;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:13
* @ Version1.0
* @ Description
* @author Lenovo
*/
@RestController
@RequestMapping("/breakdown")
public class BreakDownController extends BaseController {
@Autowired
private BreakDownService breakDownService;
/**
*
*/
@RequiresPermissions("breakdown:breakdown:list")
@GetMapping("/list")
public Result<TableDataInfo<BreakDown>> list(BreakDown breakDown)
{
startPage();
List<BreakDown> list = breakDownService.selectBreakDownList(breakDown);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("breakdown:breakdown:export")
@PostMapping("/export")
public void export(HttpServletResponse response, BreakDown breakDown)
{
List<BreakDown> list = breakDownService.selectBreakDownList(breakDown);
ExcelUtil<BreakDown> util = new ExcelUtil<BreakDown>(BreakDown.class);
util.exportExcel(response, list, "车辆故障数据");
}
/**
*
*/
@RequiresPermissions("breakdown:breakdown:query")
@GetMapping(value = "/{id}")
public Result<List<BreakDown>> getInfo(@PathVariable("id") Long id)
{
return success(breakDownService.selectBreakDownById(id));
}
/**
*
*/
@RequiresPermissions("breakdown:breakdown:add")
@PostMapping
public Result<Integer> add(
@Validated @RequestBody BreakDown breakDown)
{
if (breakDownService.checkIdUnique(breakDown)) {
return error("新增 车辆故障 '" + breakDown + "'失败,车辆故障已存在");
}
breakDown.setCreateBy(SecurityUtils.getUsername());
return toAjax(breakDownService.save(breakDown));
}
/**
*
*/
@RequiresPermissions("breakdown:breakdown:edit")
@PutMapping
public Result<Integer> edit(
@Validated @RequestBody BreakDown breakDown)
{
if (!breakDownService.checkIdUnique(breakDown)) {
return error("修改 车辆故障 '" + breakDown + "'失败,车辆故障不存在");
}
breakDown.setUpdateBy(SecurityUtils.getUsername());
return toAjax(breakDownService.updateById(breakDown));
}
/**
*
*/
@RequiresPermissions("breakdown:breakdown:remove")
@DeleteMapping("/{ids}")
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
{
breakDownService.removeBatchByIds(Arrays.asList(ids));
return success();
}
public Result getMessages(MessageMap messageMap) {
Map<String,String> messages =breakDownService.getMessages(messageMap);
return Result.success(messages);
}
}

View File

@ -0,0 +1,113 @@
package com.muyu.breakdown.controller;
import java.util.Arrays;
import java.util.List;
import com.muyu.breakdown.domain.FaultLog;
import com.muyu.breakdown.service.IFaultLogService;
import jakarta.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.validation.annotation.Validated;
import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author muyu
* @date 2024-09-20
*/
@RestController
@RequestMapping("/log")
public class FaultLogController extends BaseController
{
@Resource
private IFaultLogService faultLogService;
/**
*
*/
@RequiresPermissions("platform:log:list")
@GetMapping("/list")
public Result<TableDataInfo<FaultLog>> list(FaultLog faultLog)
{
startPage();
List<FaultLog> list = faultLogService.selectFaultLogList(faultLog);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("platform:log:export")
@PostMapping("/export")
public void export(HttpServletResponse response, FaultLog faultLog)
{
List<FaultLog> list = faultLogService.selectFaultLogList(faultLog);
ExcelUtil<FaultLog> util = new ExcelUtil<FaultLog>(FaultLog.class);
util.exportExcel(response, list, "故障日志数据");
}
/**
*
*/
@RequiresPermissions("platform:log:query")
@GetMapping(value = "/{id}")
public Result<List<FaultLog>> getInfo(@PathVariable("id") Long id)
{
return success(faultLogService.selectFaultLogById(id));
}
/**
*
*/
@RequiresPermissions("platform:log:add")
@PostMapping
public Result<Integer> add(
@Validated @RequestBody FaultLog faultLog)
{
if (faultLogService.checkIdUnique(faultLog)) {
return error("新增 故障日志 '" + faultLog + "'失败,故障日志已存在");
}
faultLog.setCreateBy(SecurityUtils.getUsername());
return toAjax(faultLogService.save(faultLog));
}
/**
*
*/
@RequiresPermissions("platform:log:edit")
@PutMapping
public Result<Integer> edit(
@Validated @RequestBody FaultLog faultLog)
{
if (!faultLogService.checkIdUnique(faultLog)) {
return error("修改 故障日志 '" + faultLog + "'失败,故障日志不存在");
}
faultLog.setUpdateBy(SecurityUtils.getUsername());
return toAjax(faultLogService.updateById(faultLog));
}
/**
*
*/
@RequiresPermissions("platform:log:remove")
@DeleteMapping("/{ids}")
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
{
faultLogService.removeBatchByIds(Arrays.asList(ids));
return success();
}
}

View File

@ -0,0 +1,29 @@
package com.muyu.breakdown.controller;
import com.muyu.breakdown.domain.Messages;
import com.muyu.breakdown.service.BreakDownService;
import com.muyu.breakdown.service.StationMessageService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-18-12:01
* @ Version1.0
* @ Description
* @author Lenovo
*/
@RestController
@RequestMapping("/stationMessage")
public class StationMessageController extends BaseController {
@Autowired
private StationMessageService stationMessageService;
}

View File

@ -0,0 +1,20 @@
package com.muyu.breakdown.controller;
import com.muyu.breakdown.service.SysCarMessageService;
import com.muyu.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:41
* @ Version1.0
* @ Description
* @author Lenovo
*/
@RestController
public class SysCarMessageController extends BaseController {
@Autowired
private SysCarMessageService sysCarMessageService;
}

View File

@ -0,0 +1,18 @@
package com.muyu.breakdown.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.breakdown.domain.BreakDown;
import org.apache.ibatis.annotations.Mapper;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:14
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface BreakDownMapper extends MPJBaseMapper<BreakDown> {
}

View File

@ -0,0 +1,17 @@
package com.muyu.breakdown.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.breakdown.domain.FaultLog;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author muyu
* @date 2024-09-20
*/
@Mapper
public interface FaultLogMapper extends BaseMapper<FaultLog>{
}

View File

@ -0,0 +1,18 @@
package com.muyu.breakdown.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.breakdown.domain.Messages;
import org.apache.ibatis.annotations.Mapper;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-18-14:57
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface StationMessageMapper extends MPJBaseMapper<Messages> {
}

View File

@ -0,0 +1,18 @@
package com.muyu.breakdown.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.muyu.breakdown.domain.SysCarMessage;
import org.apache.ibatis.annotations.Mapper;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:54
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Mapper
public interface SysCarMessageMapper extends MPJBaseMapper<SysCarMessage> {
}

View File

@ -0,0 +1,43 @@
package com.muyu.breakdown.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.breakdown.domain.BreakDown;
import com.muyu.breakdown.domain.MessageMap;
import java.util.List;
import java.util.Map;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:31
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface BreakDownService extends IService<BreakDown> {
/**
*
*
* @param id
* @return
*/
public BreakDown selectBreakDownById(Long id);
/**
*
*
* @param breakDown
* @return
*/
public List<BreakDown> selectBreakDownList(BreakDown breakDown);
/**
* id
* @param breakDown
* @return
*/
Boolean checkIdUnique(BreakDown breakDown);
Map<String, String> getMessages(MessageMap messageMap);
}

View File

@ -0,0 +1,37 @@
package com.muyu.breakdown.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.breakdown.domain.FaultLog;
/**
* Service
*
* @author muyu
* @date 2024-09-20
*/
public interface IFaultLogService extends IService<FaultLog> {
/**
*
*
* @param id
* @return
*/
public FaultLog selectFaultLogById(Long id);
/**
*
*
* @param faultLog
* @return
*/
public List<FaultLog> selectFaultLogList(FaultLog faultLog);
/**
* id
* @param faultLog
* @return
*/
Boolean checkIdUnique(FaultLog faultLog);
}

View File

@ -0,0 +1,18 @@
package com.muyu.breakdown.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.breakdown.domain.Messages;
import java.util.List;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-18-14:56
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface StationMessageService extends IService<Messages> {
}

View File

@ -0,0 +1,15 @@
package com.muyu.breakdown.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.breakdown.domain.SysCarMessage;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:42
* @ Version1.0
* @ Description
* @author Lenovo
*/
public interface SysCarMessageService extends IService<SysCarMessage> {
}

View File

@ -0,0 +1,97 @@
package com.muyu.breakdown.service.impl;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.muyu.breakdown.domain.BreakDown;
import com.muyu.breakdown.domain.MessageMap;
import com.muyu.breakdown.domain.SysCarMessage;
import com.muyu.breakdown.mapper.BreakDownMapper;
import com.muyu.breakdown.service.BreakDownService;
import com.muyu.breakdown.service.SysCarMessageService;
import com.muyu.common.core.utils.StringUtils;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-17-15:31
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class BreakDownServiceImpl extends ServiceImpl<BreakDownMapper, BreakDown> implements BreakDownService {
@Autowired
private SysCarMessageService sysCarMessageService;
@Autowired
private RabbitTemplate rabbitTemplate;
/**
*
*
* @param id
* @return
*/
@Override
public BreakDown selectBreakDownById(Long id)
{
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(id, "id不可为空");
queryWrapper.eq(BreakDown::getId, id);
return this.getOne(queryWrapper);
}
/**
*
*
* @param breakDown
* @return
*/
@Override
public List<BreakDown> selectBreakDownList(BreakDown breakDown)
{
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(breakDown.getFaultCode())){
queryWrapper.eq(BreakDown::getFaultCode, breakDown.getFaultCode());
}
if (StringUtils.isNotEmpty(breakDown.getFaultType())){
queryWrapper.eq(BreakDown::getFaultType, breakDown.getFaultType());
}
return this.list(queryWrapper);
}
/**
*
* @param breakDown
* @return
*/
@Override
public Boolean checkIdUnique(BreakDown breakDown) {
LambdaQueryWrapper<BreakDown> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BreakDown::getId, breakDown.getId());
return this.count(queryWrapper) > 0;
}
@Override
public Map<String, String> getMessages(MessageMap messageMap) {
return null;
}
// @RabbitListener(queues = "car.message.queue")
// private void sendMessage(String message) {
//
// }
}

View File

@ -0,0 +1,78 @@
package com.muyu.breakdown.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.breakdown.domain.FaultLog;
import com.muyu.breakdown.mapper.FaultLogMapper;
import com.muyu.breakdown.service.IFaultLogService;
import com.muyu.common.core.utils.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-09-20
*/
@Service
public class FaultLogServiceImpl
extends ServiceImpl<FaultLogMapper, FaultLog>
implements IFaultLogService {
/**
*
*
* @param id
* @return
*/
@Override
public FaultLog selectFaultLogById(Long id)
{
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(id, "id不可为空");
queryWrapper.eq(FaultLog::getId, id);
return this.getOne(queryWrapper);
}
/**
*
*
* @param faultLog
* @return
*/
@Override
public List<FaultLog> selectFaultLogList(FaultLog faultLog)
{
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(faultLog.getFaultCode())){
queryWrapper.eq(FaultLog::getFaultCode, faultLog.getFaultCode());
}
if (StringUtils.isNotEmpty(faultLog.getCarVin())){
queryWrapper.eq(FaultLog::getCarVin, faultLog.getCarVin());
}
if (faultLog.getStartTime()!=null){
queryWrapper.eq(FaultLog::getStartTime, faultLog.getStartTime());
}
if (faultLog.getEndTime()!=null){
queryWrapper.eq(FaultLog::getEndTime, faultLog.getEndTime());
}
return this.list(queryWrapper);
}
/**
*
* @param faultLog
* @return
*/
@Override
public Boolean checkIdUnique(FaultLog faultLog) {
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(FaultLog::getId, faultLog.getId());
return this.count(queryWrapper) > 0;
}
}

View File

@ -0,0 +1,23 @@
package com.muyu.breakdown.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.breakdown.domain.Messages;
import com.muyu.breakdown.mapper.StationMessageMapper;
import com.muyu.breakdown.service.StationMessageService;
import org.springframework.stereotype.Service;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-18-14:56
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class StationMessageServiceImpl
extends ServiceImpl<StationMessageMapper, Messages>
implements StationMessageService {
}

View File

@ -0,0 +1,19 @@
package com.muyu.breakdown.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.breakdown.domain.SysCarMessage;
import com.muyu.breakdown.mapper.SysCarMessageMapper;
import com.muyu.breakdown.service.SysCarMessageService;
import org.springframework.stereotype.Service;
/**
* @ ToolIntelliJ IDEA
* @ AuthorCHX
* @ Date2024-09-20-15:42
* @ Version1.0
* @ Description
* @author Lenovo
*/
@Service
public class SysCarMessageServiceImpl extends ServiceImpl<SysCarMessageMapper, SysCarMessage> implements SysCarMessageService {
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,60 @@
# Tomcat
server:
port: 9702
# nacos线上地址
nacos:
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: wyh
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
# Spring
spring:
amqp:
deserialization:
trust:
all: true
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: cloud-breakdown
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.breakdown.mapper: DEBUG

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-breakdown"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-breakdown"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.sky.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 使用gRpc将日志发送到skywalking服务端 -->
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<Pattern>${log.sky.pattern}</Pattern>
</layout>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="GRPC_LOG"/>
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-breakdown"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.sky.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 使用gRpc将日志发送到skywalking服务端 -->
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<Pattern>${log.sky.pattern}</Pattern>
</layout>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="GRPC_LOG"/>
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-breakdown</artifactId>
<packaging>pom</packaging>
<modules>
<module>cloud-breakdown-common</module>
<module>cloud-breakdown-server</module>
<module>cloud-breakdown-remote</module>
<module>cloud-breakdown-client</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-modules</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-modules-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>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- MuYu Common DataSource -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-datasource</artifactId>
</dependency>
<!-- MuYu Common DataScope -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-datascope</artifactId>
</dependency>
<!-- MuYu Common Log -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-log</artifactId>
</dependency>
<!-- 接口模块 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-api-doc</artifactId>
</dependency>
<!-- XllJob定时任务 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-xxl</artifactId>
</dependency>
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.70</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,21 @@
package com.muyu.car;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author muyu
*/
@EnableCustomConfig
//@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
public class CloudCarApplication {
public static void main (String[] args) {
SpringApplication.run(CloudCarApplication.class, args);
}
}

View File

@ -0,0 +1,10 @@
package com.muyu.car.constant;
public class RedisConstant {
public static final String MESSAGE_DETAIL = "messageDetail";
public static final String VEHICLE_ENTERPRISE = "vehicleEnterprise";
public static final String INDEX_WARNING = "indexWarning";
}

View File

@ -0,0 +1,131 @@
package com.muyu.car.controller;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.car.domain.SysCar;
import com.muyu.car.service.ISysCarService;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.validation.annotation.Validated;
import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author muyu
* @date 2024-09-17
*/
@RestController
@RequestMapping("/car")
public class SysCarController extends BaseController
{
@Autowired
private ISysCarService sysCarService;
/**
*
*/
@RequiresPermissions("car:car:list")
@GetMapping("/list")
public Result<TableDataInfo<SysCar>> list(SysCar sysCar)
{
startPage();
List<SysCar> list = sysCarService.selectSysCarList(sysCar);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("car:car:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysCar sysCar)
{
List<SysCar> list = sysCarService.selectSysCarList(sysCar);
ExcelUtil<SysCar> util = new ExcelUtil<SysCar>(SysCar.class);
util.exportExcel(response, list, "车辆基础信息数据");
}
/**
*
*/
@RequiresPermissions("car:car:query")
@GetMapping(value = "/{id}")
public Result<List<SysCar>> getInfo(@PathVariable("id") Long id)
{
return success(sysCarService.selectSysCarById(id));
}
/**
*
*/
@RequiresPermissions("car:car:add")
@PostMapping
public Result<Integer> add(
@Validated @RequestBody SysCar sysCar)
{
// 获取当前时间(没有时区)
LocalDateTime now = LocalDateTime.now();
// 假设我们使用系统默认时区
ZoneId zoneId = ZoneId.systemDefault();
// 将LocalDateTime转换为ZonedDateTime添加了时区信息
ZonedDateTime zdt = now.atZone(zoneId);
// 将ZonedDateTime转换为InstantUTC时间线上的点
Instant instant = zdt.toInstant();
// 将Instant转换为Date
Date date = Date.from(instant);
sysCar.setCarLastJoinTime(date);
if (sysCarService.checkIdUnique(sysCar)) {
return error("新增 车辆基础信息 '" + sysCar + "'失败,车辆基础信息已存在");
}
return toAjax(sysCarService.save(sysCar));
}
/**
*
*/
@RequiresPermissions("car:car:edit")
@PutMapping
public Result<Integer> edit(
@Validated @RequestBody SysCar sysCar)
{
if (!sysCarService.checkIdUnique(sysCar)) {
return error("修改 车辆基础信息 '" + sysCar + "'失败,车辆基础信息不存在");
}
return toAjax(sysCarService.updateById(sysCar));
}
/**
*
*/
@RequiresPermissions("car:car:remove")
@DeleteMapping("/{ids}")
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
{
sysCarService.removeBatchByIds(Arrays.asList(ids));
return success();
}
}

View File

@ -0,0 +1,178 @@
package com.muyu.car.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import com.muyu.car.domain.SysCarMessage;
import com.muyu.car.domain.SysMessageType;
import com.muyu.car.domain.VO.SysMessageVO;
import com.muyu.car.service.ISysCarMessageService;
import jakarta.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.validation.annotation.Validated;
import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author muyu
* @date 2024-09-18
*/
@RestController
@RequestMapping("/messageInfo")
public class SysCarMessageController extends BaseController
{
@Resource
private ISysCarMessageService sysCarMessageService;
@Autowired
private HttpSession session;
static String TEST = "7E 56 45 48 49 43 4C 45 5F 4D 53 47 3A 56 49 4E 31 32 B6 A1 C0 F2 B3 E5 D9 A8 C1 B2 E3 F4 A6 D7 C9 F1 E0 A3 B5 C8 D4 E2 A1 F5 B6 C7 E8 D9 A0 E3 B2 C4 F5 D6 A8 C0 E1 F2 B7 D8 A4 E3 C2 B1 A5 D9 F6 C8 E7 A0 B2 C3 D1 F4 E5 A9 3F 2A 7B D9 1E C8 4D A3 6F 5B 9A 0C 3E 7D F2 8B 46 1A 5E 9F 2D 73 8C 4A B1 6C 5D E2 7E C4 39 0B AD 7C 1F 0E 3C 68 92 B4 5A 7F 6E 81 0D 4B A5 E3 F9 2E 8A 37 6D 14 5C 73 8E D2 04 9B 3A 6C F1 70 BF 29 5F 8C 43 61 24 5D 7A 9C 0A D5 1B 3D 6E F4 78 3E 5B";
@RequiresPermissions("message:message:test")
@GetMapping("/test")
public Result test() throws InterruptedException, ExecutionException {
List<SysCarMessage> list = (List<SysCarMessage>) session.getAttribute("list");
// 检查 list 是否为空
if (list == null || list.isEmpty()) {
return Result.success(new String[0]); // 或者返回一个适当的错误消息
}
String[] test = TEST.split(" ");
String[] results = new String[list.size()];
List<CompletableFuture<String>> futures = new ArrayList<>();
for (SysCarMessage carMessage : list) {
futures.add(CompletableFuture.supplyAsync(() -> {
int startIndex = Integer.parseInt(carMessage.getMessageStartIndex()) - 1;
int endIndex = Integer.parseInt(carMessage.getMessageEndIndex());
StringBuilder hexBuilder = new StringBuilder();
for (int j = startIndex; j < endIndex; j++) {
hexBuilder.append(test[j]);
}
String hex = hexBuilder.toString();
char[] result = new char[hex.length() / 2];
for (int x = 0; x < hex.length(); x += 2) {
int high = Character.digit(hex.charAt(x), 16);
int low = Character.digit(hex.charAt(x + 1), 16);
result[x / 2] = (char) ((high << 4) + low);
}
return new String(result);
}));
}
for (int i = 0; i < futures.size(); i++) {
results[i] = futures.get(i).get();
}
return Result.success(results);
}
/**
*
*/
@RequiresPermissions("message:message:list")
@GetMapping("/list")
public Result<List<SysCarMessage>> list(SysCarMessage sysCarMessage)
{
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
session.setAttribute("list", list);
return Result.success(list);
}
@RequiresPermissions("message:message:dobList")
@GetMapping("/dobList")
public Result<List<SysMessageVO>> dobList(SysMessageVO sysMessageVO)
{
List<SysMessageVO> list = sysCarMessageService.dobList(sysMessageVO);
return Result.success(list);
}
/**
*
*/
@RequiresPermissions("message:message:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysCarMessage sysCarMessage)
{
List<SysCarMessage> list = sysCarMessageService.selectSysCarMessageList(sysCarMessage);
ExcelUtil<SysCarMessage> util = new ExcelUtil<SysCarMessage>(SysCarMessage.class);
util.exportExcel(response, list, "车辆报文记录数据");
}
/**
*
*/
@RequiresPermissions("message:message:query")
@GetMapping(value = "/{id}")
public Result<List<SysCarMessage>> getInfo(@PathVariable("id") Long id)
{
return success(sysCarMessageService.selectSysCarMessageById(id));
}
/**
*
*/
@RequiresPermissions("message:message:add")
@PostMapping
public Result<Integer> add(
@Validated @RequestBody SysCarMessage sysCarMessage)
{
if (sysCarMessageService.checkIdUnique(sysCarMessage)) {
return error("新增 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录已存在");
}
return toAjax(sysCarMessageService.save(sysCarMessage));
}
/**
*
*/
@RequiresPermissions("message:message:edit")
@PutMapping
public Result<Integer> edit(
@Validated @RequestBody SysCarMessage sysCarMessage)
{
if (!sysCarMessageService.checkIdUnique(sysCarMessage)) {
return error("修改 车辆报文记录 '" + sysCarMessage + "'失败,车辆报文记录不存在");
}
return toAjax(sysCarMessageService.updateById(sysCarMessage));
}
/**
*
*/
@RequiresPermissions("message:message:remove")
@DeleteMapping("/{ids}")
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
{
sysCarMessageService.removeBatchByIds(Arrays.asList(ids));
return success();
}
}

View File

@ -0,0 +1,116 @@
package com.muyu.car.controller;
import java.util.Arrays;
import java.util.List;
import com.muyu.car.domain.SysMessageType;
import com.muyu.car.service.ISysMessageTypeService;
import jakarta.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.security.utils.SecurityUtils;
import org.springframework.validation.annotation.Validated;
import com.muyu.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author muyu
* @date 2024-09-18
*/
@RestController
@RequestMapping("/messageType")
public class SysMessageTypeController extends BaseController
{
@Resource
private ISysMessageTypeService sysMessageTypeService;
/**
*
*/
@RequiresPermissions("message:messageType:list")
@GetMapping("/list")
public Result<List<SysMessageType>> list(SysMessageType sysMessageType)
{
List<SysMessageType> list = sysMessageTypeService.selectSysMessageTypeList(sysMessageType);
return Result.success(list);
}
/**
*
*/
@RequiresPermissions("message:messageType:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysMessageType sysMessageType)
{
List<SysMessageType> list = sysMessageTypeService.selectSysMessageTypeList(sysMessageType);
ExcelUtil<SysMessageType> util = new ExcelUtil<SysMessageType>(SysMessageType.class);
util.exportExcel(response, list, "车辆报文类型数据");
}
/**
*
*/
@RequiresPermissions("message:messageType:query")
@GetMapping(value = "/{messageCode}")
public Result<List<SysMessageType>> getInfo(@PathVariable("messageCode") String[] messageCodes)
{
SysMessageType[] list = new SysMessageType[messageCodes.length]; // 确保数组大小
for (int i = 0; i < messageCodes.length; i++) {
list[i] = sysMessageTypeService.selectSysMessageTypeByMessageCode(messageCodes[i]);
}
return success(list);
}
/**
*
*/
@RequiresPermissions("message:messageType:add")
@PostMapping
public Result<Integer> add(
@Validated @RequestBody SysMessageType sysMessageType)
{
if (sysMessageTypeService.checkIdUnique(sysMessageType)) {
return error("新增 车辆报文类型 '" + sysMessageType + "'失败,车辆报文类型已存在");
}
return toAjax(sysMessageTypeService.save(sysMessageType));
}
/**
*
*/
@RequiresPermissions("message:messageType:edit")
@PutMapping
public Result<Integer> edit(
@Validated @RequestBody SysMessageType sysMessageType)
{
if (!sysMessageTypeService.checkIdUnique(sysMessageType)) {
return error("修改 车辆报文类型 '" + sysMessageType + "'失败,车辆报文类型不存在");
}
return toAjax(sysMessageTypeService.updateById(sysMessageType));
}
/**
*
*/
@RequiresPermissions("message:messageType:remove")
@DeleteMapping("/{ids}")
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
{
sysMessageTypeService.removeBatchByIds(Arrays.asList(ids));
return success();
}
}

View File

@ -0,0 +1,86 @@
package com.muyu.car.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* sys_car
*
* @author muyu
* @date 2024-09-17
*/
@Data
@Setter
@Getter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_car")
public class SysCar {
private static final long serialVersionUID = 1L;
/** 自增主键 */
@TableId( type = IdType.AUTO)
private Long id;
/** 车辆VIN码 */
@Excel(name = "车辆VIN码")
private String carVin;
/** 车辆车牌号 */
@Excel(name = "车辆车牌号")
private String carPlate;
/** 车辆品牌 */
@Excel(name = "车辆品牌")
private String carBrand;
/** 车辆型号 */
@Excel(name = "车辆型号")
private String carModel;
/** 车辆车型(如客车,卡车,公交车等) */
@Excel(name = "车辆车型(如客车,卡车,公交车等)")
private String carType;
/** 最后一次连线时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后一次连线时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date carLastJoinTime;
/** 最后一次离线时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后一次离线时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date carLastOfflineTime;
/** 启用状态(1.在线 2.离线 3.已断开 4.待连接 5.维修中 */
@Excel(name = "启用状态(1.在线 2.离线 3.已断开 4.待连接 5.维修中")
private String state;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("carVin", getCarVin())
.append("carPlate", getCarPlate())
.append("carBrand", getCarBrand())
.append("carModel", getCarModel())
.append("carType", getCarType())
.append("carLastJoinTime", getCarLastJoinTime())
.append("carLastOfflineTime", getCarLastOfflineTime())
.append("state", getState())
.toString();
}
}

View File

@ -0,0 +1,66 @@
package com.muyu.car.domain;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* sys_car_message
*
* @author muyu
* @date 2024-09-18
*/
@Data
@Setter
@Getter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_car_message")
public class SysCarMessage {
private static final long serialVersionUID = 1L;
/** 自增主键 */
@TableId( type = IdType.AUTO)
private Long id;
/** 车辆型号编码 */
@Excel(name = "车辆型号编码")
private String modelCode;
/** 车辆报文类型编码 */
@Excel(name = "i")
private String messageTypeCode;
/** 开始位下标 */
@Excel(name = "开始位下标")
private String messageStartIndex;
/** 结束位下标 */
@Excel(name = "结束位下标")
private String messageEndIndex;
/** 报文分类 */
@Excel(name = "报文分类")
private String messageType;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("modelCode", getModelCode())
.append("messageTypeCode", getMessageTypeCode())
.append("messageStartIndex", getMessageStartIndex())
.append("messageEndIndex", getMessageEndIndex())
.append("messageType", getMessageType())
.toString();
}
}

View File

@ -0,0 +1,59 @@
package com.muyu.car.domain;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* sys_message_type
*
* @author muyu
* @date 2024-09-18
*/
@Data
@Setter
@Getter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_message_type")
public class SysMessageType {
private static final long serialVersionUID = 1L;
/** 自增主键 */
@TableId( type = IdType.AUTO)
private Long id;
/** 报文编码 */
@Excel(name = "报文编码")
private String messageCode;
/** 报文名称 */
@Excel(name = "报文名称")
private String messageName;
/** 报文分类 */
@Excel(name = "报文分类")
private String messageType;
@Excel(name = "报文字段类型")
private String messageClass;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("messageCode", getMessageCode())
.append("messageName", getMessageName())
.append("messageType", getMessageType())
.toString();
}
}

View File

@ -0,0 +1,26 @@
package com.muyu.car.domain.VO;
import com.muyu.common.core.annotation.Excel;
import lombok.*;
/**
* sys_message_type
*
* @author muyu
* @date 2024-09-18
*/
@Data
public class SysMessageVO {
private static final long serialVersionUID = 1L;
private Long id;
private String modelCode;
private String messageTypeCode;
private String messageStartIndex;
private String messageEndIndex;
private String messageType;
private String messageName;
}

View File

@ -0,0 +1,205 @@
package com.muyu.car.domain;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class VehicleMessage extends BaseEntity {
/**
* VIN
*/
private String carVin;
/**
*
*/
private Long startTime;
/**
*
*/
private String longitude;
/**
*
*/
private String latitude;
/**
*
*/
private String speed;
/**
*
*/
private String totalMileage;
/**
*
*/
private String totalVoltage;
/**
*
*/
private String combinedCurrent;
/**
*
*/
private String insulationResistance;
/**
*
*/
private String gearPosition;
/**
*
*/
private String acceleratorPedalTravelValue;
/**
*
*/
private String brakePedalTravelValue;
/**
*
*/
private String specificFuelConsumption;
/**
*
*/
private String motorControllerTemperature;
/**
*
*/
private String motorSpeed;
/**
*
*/
private String motorTorque;
/**
*
*/
private String motorTemperature;
/**
*
*/
private String motorVoltage;
/**
*
*/
private String motorCurrent;
/**
* SOC
*/
private String powerBatteryRemainingSOC;
/**
*
*/
private String maximumPower;
/**
*
*/
private String maximumDischargePower;
/**
* BMS
*/
private String BMSSelfCheckCounter;
/**
*
*/
private String electricCurrent;
/**
* V3
*/
private String totalVoltageV3;
/**
*
*/
private String singleMaximumVoltage;
/**
*
*/
private String minimumVoltageOfABattery;
/**
*
*/
private String maximumBatteryTemperature;
/**
*
*/
private String minimumBatteryTemperature;
/**
*
*/
private String powerBatteryAvailableCapacity;
/**
*
*/
private String vehicleStatus;
/**
*
*/
private String chargingState;
/**
*
*/
private String runningState;
/**
* SOC
*/
private String SOC;
/**
*
*/
private String workStatus;
/**
*
*/
private String driveMotorCondition;
/**
*
*/
private String orientation;
/**
* EAS
*/
private String eas;
/**
* PTC
*/
private String ptc;
/**
* EPS
*/
private String eps;
/**
* ABS
*/
private String abs;
/**
* MCU
*/
private String mcu;
/**
*
*/
private String heatingState;
/**
*
*/
private String currentStatus;
/**
*
*/
private String insulationState;
/**
* DCDC
*/
private String dcdc;
/**
* CHG
*/
private String chg;
}

View File

@ -0,0 +1,16 @@
package com.muyu.car.mapper;
import java.util.List;
import com.muyu.car.domain.SysCar;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author muyu
* @date 2024-09-17
*/
public interface SysCarMapper extends BaseMapper<SysCar>{
}

View File

@ -0,0 +1,19 @@
package com.muyu.car.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.car.domain.SysCarMessage;
import com.muyu.car.domain.VO.SysMessageVO;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author muyu
* @date 2024-09-18
*/
@Mapper
public interface SysCarMessageMapper extends BaseMapper<SysCarMessage>{
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
}

View File

@ -0,0 +1,18 @@
package com.muyu.car.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.car.domain.SysMessageType;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper
*
* @author muyu
* @date 2024-09-18
*/
@Mapper
public interface SysMessageTypeMapper extends BaseMapper<SysMessageType>{
}

View File

@ -0,0 +1,157 @@
package com.muyu.car.redis;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.car.constant.RedisConstant;
import com.muyu.car.domain.VehicleMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
@Component
public class RedisInitialize {
@Autowired
private RedisTemplate<String,String>redisTemplate;
@PostConstruct
public void a() {
new Thread(()->{
try {
Thread.sleep(1000);
}catch (Exception exception){
throw new RuntimeException(exception);
}
});
VehicleMessage message1 = new VehicleMessage();
message1.setStartTime(System.currentTimeMillis());
message1.setSpeed("50");
message1.setLongitude("126.397428");
message1.setLatitude("37.90923");
message1.setTotalMileage("1010");
message1.setTotalVoltage("22.5");
message1.setAcceleratorPedalTravelValue("1.5");
message1.setBrakePedalTravelValue("1.2");
message1.setSpecificFuelConsumption("1.8");
message1.setMotorControllerTemperature("59");
message1.setMotorSpeed("850");
message1.setMotorTorque("110");
message1.setMotorTemperature("53");
message1.setMotorVoltage("12.5");
message1.setMotorCurrent("1.1");
message1.setPowerBatteryRemainingSOC("88");
message1.setMaximumPower("999");
message1.setMaximumDischargePower("950");
message1.setDcdc("2");
message1.setChg("2");
message1.setBMSSelfCheckCounter("2");
message1.setElectricCurrent("2.3");
message1.setTotalVoltageV3("13.1");
message1.setSingleMaximumVoltage("14.1");
message1.setMinimumVoltageOfABattery("12.2");
message1.setMaximumBatteryTemperature("85");
message1.setMinimumBatteryTemperature("51");
message1.setPowerBatteryAvailableCapacity("560");
message1.setCombinedCurrent("1.1");
message1.setRunningState("2");
message1.setWorkStatus("2");
message1.setDriveMotorCondition("1");
message1.setVehicleStatus("1");
message1.setChargingState("1");
message1.setHeatingState("1");
message1.setCarVin("1HGCM826X3A004352");
redisTemplate.opsForValue().set(RedisConstant.VEHICLE_ENTERPRISE + message1.getCarVin(), JSON.toJSONString(message1));
}
@PostConstruct
public void initialize() {
//
// new Thread(() -> {
// try {
// Thread.sleep(500);
// } catch (InterruptedException e) {
// throw new RuntimeException(e);
// }
// List<VehicleMessageMiddle> vehicleMessageMiddleList = vehicleMessageMiddleService.list();
// vehicleMessageMiddleList.forEach(vehicleMessageMiddle -> {
// List<MessageDetail> messageDetailList = messageDetailService.list(new LambdaQueryWrapper<>() {{
// in(MessageDetail::getId, Arrays.asList(vehicleMessageMiddle.getMessageIds().split(",")));
// }});
// String jsonString = JSON.toJSONString(messageDetailList);
// redisTemplate.opsForHash().put(RedisConstant.MESSAGE_DETAIL, vehicleMessageMiddle.getCarVin(), jsonString);
// });
// });
// MessageDetail messageDetail = new MessageDetail();
// messageDetail.setKeyCode("1");
// messageDetail.setLabel("测试");
// messageDetail.setStartBit(0);
// messageDetail.setStopBit(8);
// messageDetail.setType("1");
// List<VehicleMessageMiddle> list = vehicleMessageMiddleService.list();
// list.forEach(vehicleMessageMiddle -> {
// List<MessageDetail> messageDetailList = messageDetailService.list(new LambdaQueryWrapper<>() {{
// in(MessageDetail::getId, Arrays.asList(vehicleMessageMiddle.getMessageIds().split(",")));
// });
// String jsonString = JSON.toJSONString(messageDetailList);
// redisTemplate.opsForHash().put(RedisConstant.VEHICLE_ENTERPRISE, message1.getCarVin(), String.valueOf(jsonString));
new Thread(()->{
try {
Thread.sleep(500);
}catch (Exception exception){
throw new RuntimeException(exception);
}
});
VehicleMessage message1 = new VehicleMessage();
message1.setStartTime(System.currentTimeMillis());
message1.setSpeed("50");
message1.setLongitude("116.397428");
message1.setLatitude("39.90923");
message1.setTotalMileage("1000");
message1.setTotalVoltage("12.5");
message1.setAcceleratorPedalTravelValue("0.5");
message1.setBrakePedalTravelValue("0.2");
message1.setSpecificFuelConsumption("0.8");
message1.setMotorControllerTemperature("60");
message1.setMotorSpeed("800");
message1.setMotorTorque("100");
message1.setMotorTemperature("70");
message1.setMotorVoltage("12.6");
message1.setMotorCurrent("1.2");
message1.setPowerBatteryRemainingSOC("80");
message1.setMaximumPower("1000");
message1.setMaximumDischargePower("900");
message1.setDcdc("1");
message1.setChg("1");
message1.setBMSSelfCheckCounter("1");
message1.setElectricCurrent("2.5");
message1.setTotalVoltageV3("13.5");
message1.setSingleMaximumVoltage("14.5");
message1.setMinimumVoltageOfABattery("12.0");
message1.setMaximumBatteryTemperature("80");
message1.setMinimumBatteryTemperature("50");
message1.setPowerBatteryAvailableCapacity("800");
message1.setCombinedCurrent("1.5");
message1.setRunningState("1");
message1.setWorkStatus("1");
message1.setDriveMotorCondition("1");
message1.setVehicleStatus("1");
message1.setChargingState("1");
message1.setHeatingState("1");
message1.setCarVin("1HGCM826X3A004352");
redisTemplate.opsForValue().set(RedisConstant.VEHICLE_ENTERPRISE + message1.getCarVin(), JSON.toJSONString(message1));
}
}

View File

@ -0,0 +1,41 @@
package com.muyu.car.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.car.domain.SysCarMessage;
import com.muyu.car.domain.VO.SysMessageVO;
/**
* Service
*
* @author muyu
* @date 2024-09-18
*/
public interface ISysCarMessageService extends IService<SysCarMessage> {
List<SysMessageVO>dobList(SysMessageVO sysMessageVO);
/**
*
*
* @param id
* @return
*/
public SysCarMessage selectSysCarMessageById(Long id);
/**
*
*
* @param sysCarMessage
* @return
*/
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage);
/**
* id
* @param sysCarMessage
* @return
*/
Boolean checkIdUnique(SysCarMessage sysCarMessage);
}

View File

@ -0,0 +1,37 @@
package com.muyu.car.service;
import java.util.List;
import com.muyu.car.domain.SysCar;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* Service
*
* @author muyu
* @date 2024-09-17
*/
public interface ISysCarService extends IService<SysCar> {
/**
*
*
* @param id
* @return
*/
public SysCar selectSysCarById(Long id);
/**
*
*
* @param sysCar
* @return
*/
public List<SysCar> selectSysCarList(SysCar sysCar);
/**
* id
* @param sysCar
* @return
*/
Boolean checkIdUnique(SysCar sysCar);
}

View File

@ -0,0 +1,38 @@
package com.muyu.car.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.car.domain.SysMessageType;
/**
* Service
*
* @author muyu
* @date 2024-09-18
*/
public interface ISysMessageTypeService extends IService<SysMessageType> {
/**
*
*
* @param messageCode
* @return
*/
public SysMessageType selectSysMessageTypeByMessageCode(String messageCode);
/**
*
*
* @param sysMessageType
* @return
*/
public List<SysMessageType> selectSysMessageTypeList(SysMessageType sysMessageType);
/**
* id
* @param sysMessageType
* @return
*/
Boolean checkIdUnique(SysMessageType sysMessageType);
}

View File

@ -0,0 +1,81 @@
package com.muyu.car.service.impl;
import java.util.List;
import com.muyu.car.domain.SysCarMessage;
import com.muyu.car.domain.VO.SysMessageVO;
import com.muyu.car.mapper.SysCarMessageMapper;
import com.muyu.car.service.ISysCarMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import org.springframework.util.Assert;
/**
* Service
*
* @author muyu
* @date 2024-09-18
*/
@Service
public class SysCarMessageServiceImpl
extends ServiceImpl<SysCarMessageMapper, SysCarMessage>
implements ISysCarMessageService {
@Autowired
private SysCarMessageMapper mapper;
@Override
public List<SysMessageVO> dobList(SysMessageVO sysMessageVO) {
return mapper.dobList(sysMessageVO);
}
/**
*
*
* @param id
* @return
*/
@Override
public SysCarMessage selectSysCarMessageById(Long id)
{
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(id, "id不可为空");
queryWrapper.eq(SysCarMessage::getId, id);
return this.getOne(queryWrapper);
}
/**
*
*
* @param sysCarMessage
* @return
*/
@Override
public List<SysCarMessage> selectSysCarMessageList(SysCarMessage sysCarMessage)
{
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCarMessage.getModelCode())){
queryWrapper.eq(SysCarMessage::getModelCode, sysCarMessage.getModelCode());
}
if (StringUtils.isNotEmpty(sysCarMessage.getMessageType())){
queryWrapper.eq(SysCarMessage::getMessageType, sysCarMessage.getMessageType());
}
return this.list(queryWrapper);
}
/**
*
* @param sysCarMessage
* @return
*/
@Override
public Boolean checkIdUnique(SysCarMessage sysCarMessage) {
LambdaQueryWrapper<SysCarMessage> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysCarMessage::getId, sysCarMessage.getId());
return this.count(queryWrapper) > 0;
}
}

View File

@ -0,0 +1,90 @@
package com.muyu.car.service.impl;
import java.util.List;
import com.muyu.common.core.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.muyu.car.mapper.SysCarMapper;
import com.muyu.car.domain.SysCar;
import com.muyu.car.service.ISysCarService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import org.springframework.util.Assert;
/**
* Service
*
* @author muyu
* @date 2024-09-17
*/
@Service
public class SysCarServiceImpl
extends ServiceImpl<SysCarMapper, SysCar>
implements ISysCarService {
/**
*
*
* @param id
* @return
*/
@Override
public SysCar selectSysCarById(Long id)
{
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(id, "id不可为空");
queryWrapper.eq(SysCar::getId, id);
return this.getOne(queryWrapper);
}
/**
*
*
* @param sysCar
* @return
*/
@Override
public List<SysCar> selectSysCarList(SysCar sysCar)
{
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysCar.getCarVin())){
queryWrapper.eq(SysCar::getCarVin, sysCar.getCarVin());
}
if (StringUtils.isNotEmpty(sysCar.getCarPlate())){
queryWrapper.eq(SysCar::getCarPlate, sysCar.getCarPlate());
}
if (StringUtils.isNotEmpty(sysCar.getCarBrand())){
queryWrapper.eq(SysCar::getCarBrand, sysCar.getCarBrand());
}
if (StringUtils.isNotEmpty(sysCar.getCarModel())){
queryWrapper.eq(SysCar::getCarModel, sysCar.getCarModel());
}
if (StringUtils.isNotEmpty(sysCar.getCarType())){
queryWrapper.eq(SysCar::getCarType, sysCar.getCarType());
}
if (sysCar.getCarLastJoinTime()!= null){
queryWrapper.eq(SysCar::getCarLastJoinTime, sysCar.getCarLastJoinTime());
}
if (sysCar.getCarLastOfflineTime()!= null){
queryWrapper.eq(SysCar::getCarLastOfflineTime, sysCar.getCarLastOfflineTime());
}
if (StringUtils.isNotEmpty(sysCar.getState())){
queryWrapper.eq(SysCar::getState, sysCar.getState());
}
return this.list(queryWrapper);
}
/**
*
* @param sysCar
* @return
*/
@Override
public Boolean checkIdUnique(SysCar sysCar) {
LambdaQueryWrapper<SysCar> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysCar::getId, sysCar.getId());
return this.count(queryWrapper) > 0;
}
}

View File

@ -0,0 +1,72 @@
package com.muyu.car.service.impl;
import java.util.List;
import com.muyu.car.domain.SysMessageType;
import com.muyu.car.mapper.SysMessageTypeMapper;
import com.muyu.car.service.ISysMessageTypeService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import org.springframework.util.Assert;
/**
* Service
*
* @author muyu
* @date 2024-09-18
*/
@Service
public class SysMessageTypeServiceImpl
extends ServiceImpl<SysMessageTypeMapper, SysMessageType>
implements ISysMessageTypeService {
/**
*
*
* @param id
* @return
*/
@Override
public SysMessageType selectSysMessageTypeByMessageCode(String messageCode)
{
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(messageCode, "messageCode不可为空");
queryWrapper.eq(SysMessageType::getMessageCode, messageCode);
return this.getOne(queryWrapper);
}
/**
*
*
* @param sysMessageType
* @return
*/
@Override
public List<SysMessageType> selectSysMessageTypeList(SysMessageType sysMessageType)
{
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(sysMessageType.getMessageName())){
queryWrapper.like(SysMessageType::getMessageName, sysMessageType.getMessageName());
}
if (StringUtils.isNotEmpty(sysMessageType.getMessageType())){
queryWrapper.eq(SysMessageType::getMessageType, sysMessageType.getMessageType());
}
return this.list(queryWrapper);
}
/**
*
* @param sysMessageType
* @return
*/
@Override
public Boolean checkIdUnique(SysMessageType sysMessageType) {
LambdaQueryWrapper<SysMessageType> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysMessageType::getId, sysMessageType.getId());
return this.count(queryWrapper) > 0;
}
}

View File

@ -0,0 +1,75 @@
package com.muyu.car.util;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.security.KeyPair;
import java.security.KeyStore;
import java.security.Security;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
public class SSLUtils {
public static SSLSocketFactory getSocketFactory(final String caCrtFile,
final String crtFile, final String keyFile, final String password)
throws Exception {
Security.addProvider(new BouncyCastleProvider());
// load CA certificate
X509Certificate caCert = null;
FileInputStream fis = new FileInputStream(caCrtFile);
BufferedInputStream bis = new BufferedInputStream(fis);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
while (bis.available() > 0) {
caCert = (X509Certificate) cf.generateCertificate(bis);
}
// load client certificate
bis = new BufferedInputStream(new FileInputStream(crtFile));
X509Certificate cert = null;
while (bis.available() > 0) {
cert = (X509Certificate) cf.generateCertificate(bis);
}
// load client private key
PEMParser pemParser = new PEMParser(new FileReader(keyFile));
Object object = pemParser.readObject();
JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider("BC");
KeyPair key = converter.getKeyPair((PEMKeyPair) object);
pemParser.close();
// CA certificate is used to authenticate server
KeyStore caKs = KeyStore.getInstance(KeyStore.getDefaultType());
caKs.load(null, null);
caKs.setCertificateEntry("ca-certificate", caCert);
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
tmf.init(caKs);
// client key and certificates are sent to server so it can authenticate
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
ks.setCertificateEntry("certificate", cert);
ks.setKeyEntry("private-key", key.getPrivate(), password.toCharArray(),
new java.security.cert.Certificate[]{cert});
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
.getDefaultAlgorithm());
kmf.init(ks, password.toCharArray());
// finally, create SSL socket factory
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
return context.getSocketFactory();
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,61 @@
# Tomcat
server:
port: 10010
# nacos线上地址
nacos:
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: wyh
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
# Spring
spring:
amqp:
deserialization:
trust:
all: true
main:
allow-bean-definition-overriding: true
application:
# 应用名称
name: cloud-car
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

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.sky.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 使用gRpc将日志发送到skywalking服务端 -->
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<Pattern>${log.sky.pattern}</Pattern>
</layout>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="GRPC_LOG"/>
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-system"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.sky.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 使用gRpc将日志发送到skywalking服务端 -->
<appender name="GRPC_LOG" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<Pattern>${log.sky.pattern}</Pattern>
</layout>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="GRPC_LOG"/>
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.car.mapper.SysCarMapper">
<resultMap type="SysCar" id="SysCarResult">
<result property="id" column="id" />
<result property="carVin" column="car_vin" />
<result property="carPlate" column="car_plate" />
<result property="carBrand" column="car_brand" />
<result property="carModel" column="car_model" />
<result property="carType" column="car_type" />
<result property="carLastJoinTime" column="car_last_join_time" />
<result property="carLastOfflineTime" column="car_last_offline_time" />
<result property="state" column="state" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSysCarVo">
select id, car_vin, car_plate, car_brand, car_model, car_type, car_last_join_time, car_last_offline_time, state, create_by, create_time, update_by, update_time, remark from sys_car
</sql>
<select id="selectSysCarList" parameterType="SysCar" resultMap="SysCarResult">
<include refid="selectSysCarVo"/>
<where>
<if test="carVin != null and carVin != ''"> and car_vin = #{carVin}</if>
<if test="carPlate != null and carPlate != ''"> and car_plate = #{carPlate}</if>
<if test="carBrand != null and carBrand != ''"> and car_brand = #{carBrand}</if>
<if test="carModel != null and carModel != ''"> and car_model = #{carModel}</if>
<if test="carType != null and carType != ''"> and car_type = #{carType}</if>
<if test="carLastJoinTime != null "> and car_last_join_time = #{carLastJoinTime}</if>
<if test="carLastOfflineTime != null "> and car_last_offline_time = #{carLastOfflineTime}</if>
<if test="state != null and state != ''"> and state = #{state}</if>
</where>
</select>
<select id="selectSysCarById" parameterType="Long" resultMap="SysCarResult">
<include refid="selectSysCarVo"/>
where id = #{id}
</select>
<insert id="insertSysCar" parameterType="SysCar" useGeneratedKeys="true" keyProperty="id">
insert into sys_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="carVin != null and carVin != ''">car_vin,</if>
<if test="carPlate != null and carPlate != ''">car_plate,</if>
<if test="carBrand != null">car_brand,</if>
<if test="carModel != null">car_model,</if>
<if test="carType != null">car_type,</if>
<if test="carLastJoinTime != null">car_last_join_time,</if>
<if test="carLastOfflineTime != null">car_last_offline_time,</if>
<if test="state != null">state,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carVin != null and carVin != ''">#{carVin},</if>
<if test="carPlate != null and carPlate != ''">#{carPlate},</if>
<if test="carBrand != null">#{carBrand},</if>
<if test="carModel != null">#{carModel},</if>
<if test="carType != null">#{carType},</if>
<if test="carLastJoinTime != null">#{carLastJoinTime},</if>
<if test="carLastOfflineTime != null">#{carLastOfflineTime},</if>
<if test="state != null">#{state},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSysCar" parameterType="SysCar">
update sys_car
<trim prefix="SET" suffixOverrides=",">
<if test="carVin != null and carVin != ''">car_vin = #{carVin},</if>
<if test="carPlate != null and carPlate != ''">car_plate = #{carPlate},</if>
<if test="carBrand != null">car_brand = #{carBrand},</if>
<if test="carModel != null">car_model = #{carModel},</if>
<if test="carType != null">car_type = #{carType},</if>
<if test="carLastJoinTime != null">car_last_join_time = #{carLastJoinTime},</if>
<if test="carLastOfflineTime != null">car_last_offline_time = #{carLastOfflineTime},</if>
<if test="state != null">state = #{state},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysCarById" parameterType="Long">
delete from sys_car where id = #{id}
</delete>
<delete id="deleteSysCarByIds" parameterType="String">
delete from sys_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.car.mapper.SysCarMessageMapper">
<resultMap type="SysCarMessage" id="SysCarMessageResult">
<result property="id" column="id" />
<result property="modelCode" column="model_code" />
<result property="messageTypeCode" column="message_type_code" />
<result property="messageStartIndex" column="message_start_index" />
<result property="messageEndIndex" column="message_end_index" />
</resultMap>
<sql id="selectSysCarMessageVo">
select id, model_code, message_type_code, message_start_index, message_end_index from sys_car_message
</sql>
<select id="selectSysCarMessageList" parameterType="SysCarMessage" resultMap="SysCarMessageResult">
<include refid="selectSysCarMessageVo"/>
<where>
<if test="modelCode != null and modelCode != ''"> and model_code = #{modelCode}</if>
</where>
</select>
<select id="selectSysCarMessageById" parameterType="Long" resultMap="SysCarMessageResult">
<include refid="selectSysCarMessageVo"/>
where id = #{id}
</select>
<select id="dobList" resultType="com.muyu.car.domain.VO.SysMessageVO">
SELECT sys_car_message.*,sys_message_type.message_name FROM sys_car_message LEFT JOIN sys_message_type ON sys_message_type.message_code=sys_car_message.message_type_code
<where>
<if test="modelCode!=null and modelCode!=''">
sys_car_message.model_code=#{modelCode}
</if>
<if test="messageType!=null and messageType!=''">
sys_car_message.message_type=#{messageType}
</if>
</where>
</select>
<insert id="insertSysCarMessage" parameterType="SysCarMessage" useGeneratedKeys="true" keyProperty="id">
insert into sys_car_message
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelCode != null">model_code,</if>
<if test="messageTypeCode != null">message_type_code,</if>
<if test="messageStartIndex != null">message_start_index,</if>
<if test="messageEndIndex != null">message_end_index,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelCode != null">#{modelCode},</if>
<if test="messageTypeCode != null">#{messageTypeCode},</if>
<if test="messageStartIndex != null">#{messageStartIndex},</if>
<if test="messageEndIndex != null">#{messageEndIndex},</if>
</trim>
</insert>
<update id="updateSysCarMessage" parameterType="SysCarMessage">
update sys_car_message
<trim prefix="SET" suffixOverrides=",">
<if test="modelCode != null">model_code = #{modelCode},</if>
<if test="messageTypeCode != null">message_type_code = #{messageTypeCode},</if>
<if test="messageStartIndex != null">message_start_index = #{messageStartIndex},</if>
<if test="messageEndIndex != null">message_end_index = #{messageEndIndex},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysCarMessageById" parameterType="Long">
delete from sys_car_message where id = #{id}
</delete>
<delete id="deleteSysCarMessageByIds" parameterType="String">
delete from sys_car_message where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.car.mapper.SysMessageTypeMapper">
<resultMap type="SysMessageType" id="SysMessageTypeResult">
<result property="id" column="id" />
<result property="messageCode" column="message_code" />
<result property="messageName" column="message_name" />
<result property="messageType" column="message_type" />
</resultMap>
<sql id="selectSysMessageTypeVo">
select id, message_code, message_name, message_type from sys_message_type
</sql>
<select id="selectSysMessageTypeList" parameterType="SysMessageType" resultMap="SysMessageTypeResult">
<include refid="selectSysMessageTypeVo"/>
<where>
<if test="messageName != null and messageName != ''"> and message_name like concat('%', #{messageName}, '%')</if>
<if test="messageType != null and messageType != ''"> and message_type = #{messageType}</if>
</where>
</select>
<select id="selectSysMessageTypeById" parameterType="Long" resultMap="SysMessageTypeResult">
<include refid="selectSysMessageTypeVo"/>
where id = #{id}
</select>
<insert id="insertSysMessageType" parameterType="SysMessageType" useGeneratedKeys="true" keyProperty="id">
insert into sys_message_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="messageCode != null">message_code,</if>
<if test="messageName != null">message_name,</if>
<if test="messageType != null">message_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="messageCode != null">#{messageCode},</if>
<if test="messageName != null">#{messageName},</if>
<if test="messageType != null">#{messageType},</if>
</trim>
</insert>
<update id="updateSysMessageType" parameterType="SysMessageType">
update sys_message_type
<trim prefix="SET" suffixOverrides=",">
<if test="messageCode != null">message_code = #{messageCode},</if>
<if test="messageName != null">message_name = #{messageName},</if>
<if test="messageType != null">message_type = #{messageType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysMessageTypeById" parameterType="Long">
delete from sys_message_type where id = #{id}
</delete>
<delete id="deleteSysMessageTypeByIds" parameterType="String">
delete from sys_message_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,13 +1,13 @@
# Tomcat
server:
port: 9301
port: 9300
# nacos线上地址
nacos:
addr: 47.116.173.119:8848
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: one-saas
namespace: wyh
# Spring
spring:
@ -22,19 +22,19 @@ spring:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# # 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}
# # nacos用户名
# username: ${nacos.user-name}
# # nacos密码
# password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式

View File

@ -1,20 +1,16 @@
# Tomcat
server:
port: 9709
port: 9202
# nacos线上地址
nacos:
addr: 47.116.173.119:8848
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: one-saas
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
namespace: wyh
# Spring
spring:
amqp:
deserialization:
trust:
all: true
main:
allow-bean-definition-overriding: true
application:
@ -28,19 +24,19 @@ spring:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# # 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}
# # nacos用户名
# username: ${nacos.user-name}
# # nacos密码
# password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
@ -53,8 +49,3 @@ spring:
- 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,31 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-gen" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<property name="log.path" value="logs/cloud-file"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
@ -33,16 +33,16 @@
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
@ -50,25 +50,25 @@
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-gen" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<property name="log.path" value="logs/cloud-file"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
@ -34,16 +34,16 @@
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
@ -51,9 +51,9 @@
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
@ -72,17 +72,17 @@
</root>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/cloud-gen" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<property name="log.path" value="logs/cloud-file"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
@ -34,16 +34,16 @@
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
@ -51,9 +51,9 @@
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
@ -72,17 +72,17 @@
</root>
<!-- 系统模块日志级别控制 -->
<logger name="com.muyu" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<logger name="com.muyu" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -4,10 +4,10 @@ server:
# nacos线上地址
nacos:
addr: 47.116.173.119:8848
addr: 49.235.136.60:8848
user-name: nacos
password: nacos
namespace: one-saas
namespace: wyh
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
# Spring
spring:
@ -28,19 +28,19 @@ spring:
discovery:
# 服务注册地址
server-addr: ${nacos.addr}
# nacos用户名
username: ${nacos.user-name}
# nacos密码
password: ${nacos.password}
# # 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}
# # nacos用户名
# username: ${nacos.user-name}
# # nacos密码
# password: ${nacos.password}
# 命名空间
namespace: ${nacos.namespace}
# 配置文件格式
@ -53,7 +53,8 @@ spring:
- 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

@ -12,7 +12,8 @@
<module>cloud-modules-system</module>
<module>cloud-modules-gen</module>
<module>cloud-modules-file</module>
<module>cloud-modules-system-saas</module>
<module>cloud-modules-car</module>
<module>cloud-breakdown</module>
</modules>
<artifactId>cloud-modules</artifactId>