第一期合并初始化
parent
9eb03b9a2a
commit
530d08e5b5
|
@ -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>
|
|
@ -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>
|
|
@ -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.*;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @ Tool:IntelliJ IDEA
|
||||||
|
// * @ Author:CHX
|
||||||
|
// * @ Date:2024-09-18-15:00
|
||||||
|
// * @ Version:1.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;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -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
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:10
|
||||||
|
* @ Version:1.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;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.breakdown.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:31
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class MessageMap {
|
||||||
|
private String key;
|
||||||
|
private String value;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-18-14:51
|
||||||
|
* @ Version:1.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 String senderId;
|
||||||
|
@Excel(name = "接收者ID")
|
||||||
|
private String receiverId;
|
||||||
|
@Excel(name = "消息内容")
|
||||||
|
private String content;
|
||||||
|
@Excel(name = "发送时间")
|
||||||
|
private Date createTime;
|
||||||
|
@Excel(name = "消息状态")
|
||||||
|
private String status;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:35
|
||||||
|
* @ Version:1.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;
|
||||||
|
}
|
|
@ -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>
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
<?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>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:00
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:故障启动类
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class BreakDownApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(BreakDownApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:41
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:mybatisplus配置类
|
||||||
|
* @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;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
|
@ -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模式的交换机
|
||||||
|
}
|
|
@ -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模式的交换机
|
||||||
|
}
|
|
@ -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模式的交换机
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:13
|
||||||
|
* @ Version:1.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.breakdown.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-18-12:01
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:站内信控制层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/stationMessage")
|
||||||
|
public class StationMessageController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private StationMessageService stationMessageService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前用户id获取站内信列表
|
||||||
|
* @param receiverId 当前用户id
|
||||||
|
* @return 站内信列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getMessageList")
|
||||||
|
public Result<List<Messages>> list(@RequestParam("receiverId") String receiverId){
|
||||||
|
List<Messages> list = stationMessageService.list(new LambdaQueryWrapper<>() {{
|
||||||
|
eq(Messages::getReceiverId, receiverId);
|
||||||
|
}});
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:41
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:报文模版控制层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class SysCarMessageController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private SysCarMessageService sysCarMessageService;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:14
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:故障管理持久层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BreakDownMapper extends MPJBaseMapper<BreakDown> {
|
||||||
|
|
||||||
|
}
|
|
@ -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>{
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-18-14:57
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:站内信持久层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface StationMessageMapper extends MPJBaseMapper<Messages> {
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.breakdown.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.breakdown.domain.SysCarMessage;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:54
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysCarMessageMapper extends MPJBaseMapper<SysCarMessage> {
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:31
|
||||||
|
* @ Version:1.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);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.breakdown.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.breakdown.domain.Messages;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-18-14:56
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
public interface StationMessageService extends IService<Messages> {
|
||||||
|
|
||||||
|
List<Messages> getMessageList(String receiverId);
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.breakdown.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.breakdown.domain.SysCarMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:42
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
public interface SysCarMessageService extends IService<SysCarMessage> {
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-17-15:31
|
||||||
|
* @ Version:1.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) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
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.Messages;
|
||||||
|
import com.muyu.breakdown.mapper.StationMessageMapper;
|
||||||
|
import com.muyu.breakdown.service.StationMessageService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-18-14:56
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:站内信业务实现层
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StationMessageServiceImpl
|
||||||
|
extends ServiceImpl<StationMessageMapper, Messages>
|
||||||
|
implements StationMessageService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StationMessageMapper stationMessageMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Messages> getMessageList(String receiverId) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ Tool:IntelliJ IDEA
|
||||||
|
* @ Author:CHX
|
||||||
|
* @ Date:2024-09-20-15:42
|
||||||
|
* @ Version:1.0
|
||||||
|
* @ Description:
|
||||||
|
* @author Lenovo
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysCarMessageServiceImpl extends ServiceImpl<SysCarMessageMapper, SysCarMessage> implements SysCarMessageService {
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,60 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9702
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 127.0.0.1:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: one
|
||||||
|
# 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
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.carrail;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@MapperScan("com.muyu.carrail.mapper")
|
||||||
|
@SpringBootApplication
|
||||||
|
public class CloudCarRailApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
SpringApplication.run(CloudCarRailApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.muyu.carrail.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import com.muyu.carrail.domain.SysCorpuscle;
|
||||||
|
import com.muyu.carrail.service.ISysCorpuscleService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/carRail")
|
||||||
|
public class SysCorpuscleController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ISysCorpuscleService sysCorpuscleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("carRail:carRail:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<SysCorpuscle>> list(SysCorpuscle sysCorpuscle)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysCorpuscle> list = sysCorpuscleService.selectSysCorpuscleList(sysCorpuscle);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("carRail:corpuscle:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysCorpuscle sysCorpuscle)
|
||||||
|
{
|
||||||
|
|
||||||
|
return toAjax(sysCorpuscleService.save(sysCorpuscle));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("carRail:corpuscle:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysCorpuscle sysCorpuscle)
|
||||||
|
{
|
||||||
|
|
||||||
|
return toAjax(sysCorpuscleService.updateById(sysCorpuscle));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子围栏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("carRail:corpuscle:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
sysCorpuscleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.muyu.carrail.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.carrail.domain.SysFence;
|
||||||
|
import com.muyu.carrail.service.ISysFenceService;
|
||||||
|
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 org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fence")
|
||||||
|
public class SysFenceController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private ISysFenceService sysFenceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<SysFence>> list(SysFence sysFence)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysFence> list = sysFenceService.selectSysFenceList(sysFence);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出围栏组列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysFence sysFence)
|
||||||
|
{
|
||||||
|
List<SysFence> list = sysFenceService.selectSysFenceList(sysFence);
|
||||||
|
ExcelUtil<SysFence> util = new ExcelUtil<SysFence>(SysFence.class);
|
||||||
|
util.exportExcel(response, list, "围栏组数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取围栏组详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<SysFence>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(sysFenceService.selectSysFenceById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增围栏组
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody SysFence sysFence)
|
||||||
|
{
|
||||||
|
|
||||||
|
return toAjax(sysFenceService.save(sysFence));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改围栏组
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody SysFence sysFence)
|
||||||
|
{
|
||||||
|
|
||||||
|
return toAjax(sysFenceService.updateById(sysFence));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除围栏组
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("fence:fence:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
sysFenceService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.muyu.carrail.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_corpuscle_fence
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_corpuscle_fence")
|
||||||
|
public class SysCorpuscle{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 围栏编码 */
|
||||||
|
@Excel(name = "围栏编码")
|
||||||
|
private String fenceCode;
|
||||||
|
|
||||||
|
/** 围栏名称 */
|
||||||
|
@Excel(name = "围栏名称")
|
||||||
|
private String fenceName;
|
||||||
|
|
||||||
|
/** 围栏类型(1.驶入 2.驶出) */
|
||||||
|
@Excel(name = "围栏类型(1.驶入 2.驶出)")
|
||||||
|
private Long fenceType;
|
||||||
|
|
||||||
|
/** 围栏位置 */
|
||||||
|
@Excel(name = "围栏位置")
|
||||||
|
private String fencePosition;
|
||||||
|
|
||||||
|
/** 启用状态(1.启用 2.停用) */
|
||||||
|
@Excel(name = "启用状态(1.启用 2.停用)")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("fenceCode", getFenceCode())
|
||||||
|
.append("fenceName", getFenceName())
|
||||||
|
.append("fenceType", getFenceType())
|
||||||
|
.append("fencePosition", getFencePosition())
|
||||||
|
.append("state", getState())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package com.muyu.carrail.domain;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组对象 sys_fence_group
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_fence_group")
|
||||||
|
public class SysFence{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 围栏组编码 */
|
||||||
|
@Excel(name = "围栏组编码")
|
||||||
|
private String groupCode;
|
||||||
|
|
||||||
|
/** 围栏组名称 */
|
||||||
|
@Excel(name = "围栏组名称")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/** 围栏组类型 */
|
||||||
|
@Excel(name = "围栏组类型")
|
||||||
|
private String groupType;
|
||||||
|
|
||||||
|
/** 启用状态 */
|
||||||
|
@Excel(name = "启用状态")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
/** 创建人 */
|
||||||
|
@Excel(name = "创建人")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@Excel(name = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新人 */
|
||||||
|
@Excel(name = "更新人")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@Excel(name = "更新时间")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 启用状态 */
|
||||||
|
@Excel(name = "启用状态")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// /** sysfindname */
|
||||||
|
// @Excel(name = "电子围栏集群")
|
||||||
|
// private String sysfindname;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("groupCode", getGroupCode())
|
||||||
|
.append("groupName", getGroupName())
|
||||||
|
.append("groupType", getGroupType())
|
||||||
|
.append("state", getState())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
// .append("sysfindname", getSysfindname())
|
||||||
|
.append("remark", getRemark())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.carrail.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.carrail.domain.SysCorpuscle;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface SysCorpuscleMapper extends BaseMapper<SysCorpuscle>{
|
||||||
|
|
||||||
|
List<SysCorpuscle> selectCarRail(SysCorpuscle sysCorpuscle);
|
||||||
|
|
||||||
|
boolean addCarRail(SysCorpuscle sysCorpuscle);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.carrail.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.carrail.domain.SysFence;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
public interface SysFenceMapper extends BaseMapper<SysFence>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.muyu.carrail.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.carrail.domain.SysCorpuscle;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
public interface ISysCorpuscleService extends IService<SysCorpuscle> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询电子围栏列表
|
||||||
|
*
|
||||||
|
* @param sysCorpuscle 电子围栏
|
||||||
|
* @return 电子围栏集合
|
||||||
|
*/
|
||||||
|
public List<SysCorpuscle> selectSysCorpuscleList(SysCorpuscle sysCorpuscle);
|
||||||
|
|
||||||
|
|
||||||
|
boolean checkIdUnique(SysCorpuscle sysCorpuscle);
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.carrail.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.carrail.domain.SysFence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
public interface ISysFenceService extends IService<SysFence> {
|
||||||
|
/**
|
||||||
|
* 精确查询围栏组
|
||||||
|
*
|
||||||
|
* @param id 围栏组主键
|
||||||
|
* @return 围栏组
|
||||||
|
*/
|
||||||
|
public SysFence selectSysFenceById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询围栏组列表
|
||||||
|
*
|
||||||
|
* @param sysFence 围栏组
|
||||||
|
* @return 围栏组集合
|
||||||
|
*/
|
||||||
|
public List<SysFence> selectSysFenceList(SysFence sysFence);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 围栏组 id是否唯一
|
||||||
|
* @param sysFence 围栏组
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(SysFence sysFence);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.muyu.carrail.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.carrail.mapper.SysCorpuscleMapper;
|
||||||
|
import com.muyu.carrail.domain.SysCorpuscle;
|
||||||
|
import com.muyu.carrail.service.ISysCorpuscleService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysCorpuscleServiceImpl
|
||||||
|
extends ServiceImpl<SysCorpuscleMapper, SysCorpuscle>
|
||||||
|
implements ISysCorpuscleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询电子围栏
|
||||||
|
*
|
||||||
|
* @param id 电子围栏主键
|
||||||
|
* @return 电子围栏
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
SysCorpuscleMapper sysCorpuscleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysCorpuscle> selectSysCorpuscleList(SysCorpuscle sysCorpuscle) {
|
||||||
|
return sysCorpuscleMapper.selectCarRail(sysCorpuscle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkIdUnique(SysCorpuscle sysCorpuscle) {
|
||||||
|
return sysCorpuscleMapper.addCarRail(sysCorpuscle);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.carrail.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.muyu.carrail.domain.SysCorpuscle;
|
||||||
|
import com.muyu.carrail.domain.SysFence;
|
||||||
|
import com.muyu.carrail.mapper.SysFenceMapper;
|
||||||
|
import com.muyu.carrail.service.ISysFenceService;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysFenceServiceImpl
|
||||||
|
extends ServiceImpl<SysFenceMapper, SysFence>
|
||||||
|
implements ISysFenceService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysFence selectSysFenceById(Long id) {
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(SysFence::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysFence> selectSysFenceList(SysFence sysFence) {
|
||||||
|
LambdaQueryWrapper<SysFence> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(sysFence.getGroupCode())){
|
||||||
|
queryWrapper.eq(SysFence::getGroupCode, sysFence.getGroupCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysFence.getGroupName())){
|
||||||
|
queryWrapper.like(SysFence::getGroupName, sysFence.getGroupName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysFence.getGroupType())){
|
||||||
|
queryWrapper.eq(SysFence::getGroupType, sysFence.getGroupType());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(sysFence.getState())){
|
||||||
|
queryWrapper.eq(SysFence::getState, sysFence.getState());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(SysFence sysFence) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 10011
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 127.0.0.1:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: public
|
||||||
|
# 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}
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.carrail.mapper: DEBUG
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?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.carrail.mapper.SysFenceMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.carrail.domain.SysFence" id="SysFenceResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="groupCode" column="group_code" />
|
||||||
|
<result property="groupName" column="group_name" />
|
||||||
|
<result property="groupType" column="group_type" />
|
||||||
|
<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="sysfindname" column="sysfindname" />-->
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysFenceVo">
|
||||||
|
select id, group_code, group_name, group_type, state, create_by, create_time, update_by, update_time, remark from sys_fence_group
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysFenceList" parameterType="com.muyu.carrail.domain.SysFence" resultMap="SysFenceResult">
|
||||||
|
<include refid="selectSysFenceVo"/>
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="groupCode != null and groupCode != ''"> and group_code = #{groupCode}</if>
|
||||||
|
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||||
|
<if test="groupType != null and groupType != ''"> and group_type = #{groupType}</if>
|
||||||
|
<if test="state != null and state != ''"> and state = #{state}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysFenceById" parameterType="Long" resultMap="SysFenceResult">
|
||||||
|
<include refid="selectSysFenceVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="deleteSysFenceById" parameterType="Long">
|
||||||
|
delete from sys_fence_group where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysFenceByIds" parameterType="String">
|
||||||
|
delete from sys_fence_group where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?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.carrail.mapper.SysCorpuscleMapper">
|
||||||
|
<insert id="addCarRail">
|
||||||
|
insert into sys_corpuscle_fence(fence_code,fence_name,fence_type,fence_position,state)
|
||||||
|
values(#{fenceCode},#{fenceName},#{fenceType},#{fencePosition},#{state})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectCarRail" resultType="com.muyu.carrail.domain.SysCorpuscle">
|
||||||
|
select * from sys_corpuscle_fence
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,91 @@
|
||||||
|
<?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">
|
||||||
|
<parent>
|
||||||
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-rail</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 接口模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.zhangyi.rail;
|
||||||
|
|
||||||
|
public class CloudRailApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.zhangyi.rail.controller;
|
||||||
|
|
||||||
|
public class RailController {
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.zhangyi.rail.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.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("sys_corpuscle_fence")
|
||||||
|
public class SysFenceRail {
|
||||||
|
private static final long seriaversionUID =1L;
|
||||||
|
/** 自增主键 */
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 围栏编码 */
|
||||||
|
@Excel(name="围栏编码")
|
||||||
|
private String fenceCode;
|
||||||
|
/**围栏名称**/
|
||||||
|
@Excel(name = "围栏名称")
|
||||||
|
private String fenceName;
|
||||||
|
|
||||||
|
/**围栏类型**/
|
||||||
|
@Excel(name = "围栏类型")
|
||||||
|
private Long fenceType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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-warn</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-warn-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>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,138 @@
|
||||||
|
<?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-warn</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-warn-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>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 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-common-core</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
|
<artifactId>xstream</artifactId>
|
||||||
|
<version>1.4.20</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.34</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- DOM4J是 dom4j.org 出品的一个开源XML解析包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dom4j</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>2.0.43</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>com.github.yulichang</groupId>-->
|
||||||
|
<!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>-->
|
||||||
|
<!-- <version>1.4.11</version>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.muyu.warning.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志对象 warn_logs
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("warn_logs")
|
||||||
|
public class WarnLogs {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 预警日志id */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆vin码 */
|
||||||
|
@Excel(name = "车辆vin码")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/** 规则id */
|
||||||
|
@Excel(name = "规则id")
|
||||||
|
private Long warnRuleId;
|
||||||
|
|
||||||
|
/** 开始时间 */
|
||||||
|
@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;
|
||||||
|
|
||||||
|
/** 最大值 */
|
||||||
|
@Excel(name = "最大值")
|
||||||
|
private Long maxValue;
|
||||||
|
|
||||||
|
/** 最小值 */
|
||||||
|
@Excel(name = "最小值")
|
||||||
|
private Long minValue;
|
||||||
|
|
||||||
|
/** 平均值 */
|
||||||
|
@Excel(name = "平均值")
|
||||||
|
private Long avgValue;
|
||||||
|
|
||||||
|
/** 中位数 */
|
||||||
|
@Excel(name = "中位数")
|
||||||
|
private Long medianValue;
|
||||||
|
|
||||||
|
/** 是否发送预警 */
|
||||||
|
@Excel(name = "是否发送预警")
|
||||||
|
private Long status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("vin", getVin())
|
||||||
|
.append("warnRuleId", getWarnRuleId())
|
||||||
|
.append("startTime", getStartTime())
|
||||||
|
.append("endTime", getEndTime())
|
||||||
|
.append("maxValue", getMaxValue())
|
||||||
|
.append("minValue", getMinValue())
|
||||||
|
.append("avgValue", getAvgValue())
|
||||||
|
.append("medianValue", getMedianValue())
|
||||||
|
.append("status", getStatus())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.muyu.warning.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则对象 warn_rule
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("warn_rule")
|
||||||
|
public class WarnRule{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 规则id */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则名称 */
|
||||||
|
@Excel(name = "规则名称")
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Excel(name = "策略id")
|
||||||
|
private Long strategyId;
|
||||||
|
|
||||||
|
/** 报文数据类型id */
|
||||||
|
@Excel(name = "报文数据类型id")
|
||||||
|
private Long msgTypeId;
|
||||||
|
|
||||||
|
/** 滑窗时间 */
|
||||||
|
@Excel(name = "滑窗时间")
|
||||||
|
private Long slideTime;
|
||||||
|
|
||||||
|
/** 滑窗频率 */
|
||||||
|
@Excel(name = "滑窗频率")
|
||||||
|
private Long slideFrequency;
|
||||||
|
|
||||||
|
/** 最大值 */
|
||||||
|
@Excel(name = "最大值")
|
||||||
|
private Long maxValue;
|
||||||
|
|
||||||
|
/** 最小值 */
|
||||||
|
@Excel(name = "最小值")
|
||||||
|
private Long minValue;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("ruleName", getRuleName())
|
||||||
|
.append("strategyId", getStrategyId())
|
||||||
|
.append("msgTypeId", getMsgTypeId())
|
||||||
|
.append("slideTime", getSlideTime())
|
||||||
|
.append("slideFrequency", getSlideFrequency())
|
||||||
|
.append("maxValue", getMaxValue())
|
||||||
|
.append("minValue", getMinValue())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.warning.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WarnRule
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/22 11:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class WarnRuleDTO {
|
||||||
|
/** 规则id */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 规则名称 */
|
||||||
|
@Excel(name = "规则名称")
|
||||||
|
private String ruleName;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Excel(name = "策略id")
|
||||||
|
private Long strategyId;
|
||||||
|
|
||||||
|
/** 报文数据类型id */
|
||||||
|
@Excel(name = "报文数据类型id")
|
||||||
|
private Long msgTypeId;
|
||||||
|
|
||||||
|
/** 滑窗时间 */
|
||||||
|
@Excel(name = "滑窗时间")
|
||||||
|
private Long slideTime;
|
||||||
|
|
||||||
|
/** 滑窗频率 */
|
||||||
|
@Excel(name = "滑窗频率")
|
||||||
|
private Long slideFrequency;
|
||||||
|
|
||||||
|
/** 最大值 */
|
||||||
|
@Excel(name = "最大值")
|
||||||
|
private Long maxValue;
|
||||||
|
|
||||||
|
/** 最小值 */
|
||||||
|
@Excel(name = "最小值")
|
||||||
|
private Long minValue;
|
||||||
|
|
||||||
|
/** 车辆类型id */
|
||||||
|
@Excel(name = "车辆类型id")
|
||||||
|
private Long carTypeId;
|
||||||
|
|
||||||
|
/** 策略名称 */
|
||||||
|
@Excel(name = "策略名称")
|
||||||
|
private String strategyName;
|
||||||
|
|
||||||
|
/** 报文模版id */
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Long msgId;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.warning.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略对象 warn_strategy
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("warn_strategy")
|
||||||
|
public class WarnStrategy{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆类型id */
|
||||||
|
@Excel(name = "车辆类型id")
|
||||||
|
private Long carTypeId;
|
||||||
|
|
||||||
|
/** 策略名称 */
|
||||||
|
@Excel(name = "策略名称")
|
||||||
|
private String strategyName;
|
||||||
|
|
||||||
|
/** 报文模版id */
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Long msgId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("carTypeId", getCarTypeId())
|
||||||
|
.append("strategyName", getStrategyName())
|
||||||
|
.append("msgId", getMsgId())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.warning.wx;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 24415
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AccessToken {
|
||||||
|
|
||||||
|
|
||||||
|
private String access_token;
|
||||||
|
|
||||||
|
private Long expires_in;
|
||||||
|
|
||||||
|
public void setExpiresTime(Long expiresIn) {
|
||||||
|
this.expires_in = System.currentTimeMillis() + expiresIn * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.warning.wx;
|
||||||
|
|
||||||
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Chen
|
||||||
|
* @name:Message
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@XStreamAlias("xml")
|
||||||
|
public class Message {
|
||||||
|
@XStreamAlias("ToUserName")
|
||||||
|
private String toUserName;
|
||||||
|
|
||||||
|
@XStreamAlias("FromUserName")
|
||||||
|
private String fromUserName;
|
||||||
|
|
||||||
|
@XStreamAlias("CreateTime")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@XStreamAlias("MsgType")
|
||||||
|
private String msgType;
|
||||||
|
|
||||||
|
@XStreamAlias("Content")
|
||||||
|
private String content;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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-warn</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-warn-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>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?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-warn</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-warn-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>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-warn-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>-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||||
|
<version>1.4.11</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
|
<artifactId>xstream</artifactId>
|
||||||
|
<version>1.4.20</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.34</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<version>3.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- DOM4J是 dom4j.org 出品的一个开源XML解析包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dom4j</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>2.0.43</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.warning;
|
||||||
|
|
||||||
|
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 Chen
|
||||||
|
* @name:WxApplication
|
||||||
|
* @Date:2024/9/16 20:39
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
//@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class WarnApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(WarnApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.muyu.warning.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
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.warning.domain.WarnLogs;
|
||||||
|
import com.muyu.warning.service.IWarnLogsService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/logs")
|
||||||
|
public class WarnLogsController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private IWarnLogsService warnLogsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnLogs>> list(WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WarnLogs> list = warnLogsService.selectWarnLogsList(warnLogs);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
List<WarnLogs> list = warnLogsService.selectWarnLogsList(warnLogs);
|
||||||
|
ExcelUtil<WarnLogs> util = new ExcelUtil<WarnLogs>(WarnLogs.class);
|
||||||
|
util.exportExcel(response, list, "预警日志数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警日志详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnLogs>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnLogsService.selectWarnLogsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
if (warnLogsService.checkIdUnique(warnLogs)) {
|
||||||
|
return error("新增 预警日志 '" + warnLogs + "'失败,预警日志已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnLogsService.save(warnLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
if (!warnLogsService.checkIdUnique(warnLogs)) {
|
||||||
|
return error("修改 预警日志 '" + warnLogs + "'失败,预警日志不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnLogsService.updateById(warnLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:logs:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
warnLogsService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.muyu.warning.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import com.muyu.warning.domain.WarnStrategy;
|
||||||
|
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.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.service.IWarnRuleService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rule")
|
||||||
|
public class WarnRuleController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private IWarnRuleService warnRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnRuleDTO>> list(WarnRuleDTO warnRuleDTO) {
|
||||||
|
startPage();
|
||||||
|
List<WarnRuleDTO> list = warnRuleService.selectWarnRuleList(warnRuleDTO);
|
||||||
|
// MPJLambdaQueryWrapper<WarnRule> objectMPJLambdaQueryWrapper = new MPJLambdaQueryWrapper<>()
|
||||||
|
// .selectAll(WarnRule.class)
|
||||||
|
// .select(WarnStrategy::getStrategyName)
|
||||||
|
// .leftJoin(WarnStrategy.class, WarnStrategy::getId, WarnRule::getStrategyId)
|
||||||
|
// .stringQuery();
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WarnRuleDTO warnRuleDTO) {
|
||||||
|
List<WarnRuleDTO> list = warnRuleService.selectWarnRuleList(warnRuleDTO);
|
||||||
|
ExcelUtil<WarnRuleDTO> util = new ExcelUtil<WarnRuleDTO>(WarnRuleDTO.class);
|
||||||
|
util.exportExcel(response, list, "预警规则数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警规则详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnRule>> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(warnRuleService.selectWarnRuleById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnRuleDTO warnRuleDTO) {
|
||||||
|
if (warnRuleService.checkIdUnique(warnRuleDTO)) {
|
||||||
|
return error("新增 预警规则 '" + warnRuleDTO + "'失败,预警规则已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnRuleService.save(warnRuleDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnRuleDTO warnRuleDTO) {
|
||||||
|
if (!warnRuleService.checkIdUnique(warnRuleDTO)) {
|
||||||
|
return error("修改 预警规则 '" + warnRuleDTO + "'失败,预警规则不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnRuleService.updateById(warnRuleDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids) {
|
||||||
|
warnRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.muyu.warning.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import com.muyu.warning.service.IWarRulesService;
|
||||||
|
import lombok.val;
|
||||||
|
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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WarnRulesController
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/23 21:07
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rules")
|
||||||
|
public class WarnRulesController {
|
||||||
|
@Autowired
|
||||||
|
private IWarRulesService warnRulesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联查策略规则 联查
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<WarnRuleDTO>> list() {
|
||||||
|
List<WarnRuleDTO> list = warnRulesService.selectWarnRulesList();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联查
|
||||||
|
*
|
||||||
|
* @param warnRuleDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/listAll")
|
||||||
|
public Result<List<WarnRuleDTO>> listAll(WarnRuleDTO warnRuleDTO) {
|
||||||
|
List<WarnRuleDTO> list = warnRulesService.selectWarnRulesListAll(warnRuleDTO);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.muyu.warning.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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.warning.domain.WarnStrategy;
|
||||||
|
import com.muyu.warning.service.IWarnStrategyService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Controller
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/strategy")
|
||||||
|
public class WarnStrategyController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private IWarnStrategyService warnStrategyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnStrategy>> list(WarnStrategy warnStrategy) {
|
||||||
|
startPage();
|
||||||
|
List<WarnStrategy> list = warnStrategyService.selectWarnStrategyList(warnStrategy);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警策略列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WarnStrategy warnStrategy) {
|
||||||
|
List<WarnStrategy> list = warnStrategyService.selectWarnStrategyList(warnStrategy);
|
||||||
|
ExcelUtil<WarnStrategy> util = new ExcelUtil<WarnStrategy>(WarnStrategy.class);
|
||||||
|
util.exportExcel(response, list, "预警策略数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警策略详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnStrategy>> getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(warnStrategyService.selectWarnStrategyById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnStrategy warnStrategy) {
|
||||||
|
if (warnStrategyService.checkIdUnique(warnStrategy)) {
|
||||||
|
return error("新增 预警策略 '" + warnStrategy + "'失败,预警策略已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnStrategyService.save(warnStrategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnStrategy warnStrategy) {
|
||||||
|
if (!warnStrategyService.checkIdUnique(warnStrategy)) {
|
||||||
|
return error("修改 预警策略 '" + warnStrategy + "'失败,预警策略不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnStrategyService.updateById(warnStrategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("warning:strategy:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids) {
|
||||||
|
warnStrategyService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
package com.muyu.warning.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.warning.wx.Message;
|
||||||
|
import com.muyu.warning.message.Article;
|
||||||
|
import com.muyu.warning.message.NewMessage;
|
||||||
|
import com.muyu.warning.util.TokenUtil;
|
||||||
|
import com.thoughtworks.xstream.XStream;
|
||||||
|
import io.micrometer.common.util.StringUtils;
|
||||||
|
import jakarta.servlet.ServletInputStream;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.dom4j.io.SAXReader;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Chen
|
||||||
|
* @name:GetWxController
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class WxTestController {
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/")
|
||||||
|
public String receiveMessage(HttpServletRequest request) {
|
||||||
|
ServletInputStream inputStream = null;
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
try {
|
||||||
|
inputStream = request.getInputStream();
|
||||||
|
SAXReader saxReader = new SAXReader();
|
||||||
|
//读取request输入流,获得Document对象
|
||||||
|
Document document = saxReader.read(inputStream);
|
||||||
|
//获得root结点
|
||||||
|
Element rootElement = document.getRootElement();
|
||||||
|
//获取所有的子节点
|
||||||
|
List<Element> elements = rootElement.elements();
|
||||||
|
for (Element element : elements) {
|
||||||
|
map.put(element.getName(), element.getStringValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
System.out.println(map);
|
||||||
|
//回复消息
|
||||||
|
String message = "";
|
||||||
|
if ("图文".equals(map.get("Content"))) {
|
||||||
|
message = getReplyNewsMessage(map);
|
||||||
|
} else {
|
||||||
|
message = getReplyMessage(map);
|
||||||
|
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得回复的消息内容
|
||||||
|
*
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getReplyMessage(HashMap<String, String> map) {
|
||||||
|
Message message = new Message();
|
||||||
|
message.setToUserName(map.get("FromUserName"));
|
||||||
|
message.setFromUserName(map.get("ToUserName"));
|
||||||
|
// message.setMsgType(map.get("MsgType"));
|
||||||
|
message.setMsgType("text");
|
||||||
|
message.setCreateTime(System.currentTimeMillis() / 1000);
|
||||||
|
message.setContent("自动回复:您好");
|
||||||
|
//XStream将java对象转换为xml字符串
|
||||||
|
XStream xStream = new XStream();
|
||||||
|
xStream.processAnnotations(Message.class);
|
||||||
|
String xml = xStream.toXML(message);
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/")
|
||||||
|
public String check(@RequestParam("signature") String signature, @RequestParam("timestamp") String timestamp,
|
||||||
|
@RequestParam("nonce") String nonce, @RequestParam("echostr") String echostr) {
|
||||||
|
|
||||||
|
//1.将token、timestamp、nonce三个参数进行字典排序
|
||||||
|
String token = "asdasd";
|
||||||
|
List<String> list = Arrays.asList(token, timestamp, nonce);
|
||||||
|
//排序
|
||||||
|
Collections.sort(list);
|
||||||
|
//2.将三个参数字符串拼接成一个字符串进行sha1加密
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (String s : list) {
|
||||||
|
stringBuilder.append(s);
|
||||||
|
}
|
||||||
|
//加密
|
||||||
|
try {
|
||||||
|
MessageDigest instance = MessageDigest.getInstance("sha1");
|
||||||
|
//使用sha1进行加密,获得byte数组
|
||||||
|
byte[] digest = instance.digest(stringBuilder.toString().getBytes());
|
||||||
|
StringBuilder sum = new StringBuilder();
|
||||||
|
for (byte b : digest) {
|
||||||
|
sum.append(Integer.toHexString((b >> 4) & 15));
|
||||||
|
sum.append(Integer.toHexString(b & 15));
|
||||||
|
}
|
||||||
|
//3.开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
|
||||||
|
if (!StringUtils.isEmpty(signature) && signature.equals(sum.toString())) {
|
||||||
|
return echostr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/test")
|
||||||
|
public void test() {
|
||||||
|
String accessToken = TokenUtil.getAccessToken();
|
||||||
|
System.out.println(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getReplyNewsMessage(Map<String, String> map) {
|
||||||
|
NewMessage newsMessage = new NewMessage();
|
||||||
|
newsMessage.setToUserName(map.get("FromUserName"));
|
||||||
|
newsMessage.setFromUserName(map.get("ToUserName"));
|
||||||
|
newsMessage.setMsgType("news");
|
||||||
|
newsMessage.setCreateTime(System.currentTimeMillis() / 1000);
|
||||||
|
newsMessage.setArticleCount(1);
|
||||||
|
List<Article> articles = new ArrayList<>();
|
||||||
|
Article article = new Article();
|
||||||
|
article.setTitle("oneone哦恩恩");
|
||||||
|
article.setDescription("详细描述--------------信息");
|
||||||
|
article.setUrl("https://www.baidu.com");
|
||||||
|
article.setPicUrl("http://mmbiz.qpic.cn/mmbiz_jpg/RiaWwmABEMmkFKQMeQZLLYaxknlzE9CxSozVSH42iaXiaQcia5hPPUicuNYbS8dG99zsMZ1ic266ialM42Mbn8SkN54kA/0");
|
||||||
|
articles.add(article);
|
||||||
|
newsMessage.setArticles(articles);
|
||||||
|
//XStream将java对象转换为xml字符串
|
||||||
|
XStream xStream = new XStream();
|
||||||
|
xStream.processAnnotations(NewMessage.class);
|
||||||
|
String xml = xStream.toXML(newsMessage);
|
||||||
|
return xml;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.warning.mapper;
|
||||||
|
|
||||||
|
import com.muyu.warning.domain.WarnLogs;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnLogsMapper extends BaseMapper<WarnLogs>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.warning.mapper;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnRuleMapper extends BaseMapper<WarnRuleDTO> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.warning.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WarnRulesMapper
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/23 21:07
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnRulesMapper extends BaseMapper<WarnRuleDTO> {
|
||||||
|
@Select("select r.*,s.id,s.strategy_name FROM warn_rule r left join warn_strategy s on r.strategy_id=s.id where r.strategy_id = #{s.id}")
|
||||||
|
List<WarnRuleDTO> selectWarnRulesListAll(WarnRuleDTO warnRuleDTO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.warning.mapper;
|
||||||
|
|
||||||
|
import com.muyu.warning.domain.WarnStrategy;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnStrategyMapper extends BaseMapper<WarnStrategy>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.warning.message;
|
||||||
|
|
||||||
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Article
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/18 19:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@XStreamAlias("item")
|
||||||
|
public class Article {
|
||||||
|
@XStreamAlias("Title")
|
||||||
|
private String title;
|
||||||
|
@XStreamAlias("Description")
|
||||||
|
private String description;
|
||||||
|
@XStreamAlias("PicUrl")
|
||||||
|
private String picUrl;
|
||||||
|
@XStreamAlias("Url")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.warning.message;
|
||||||
|
|
||||||
|
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName NewMessage
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/18 19:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@XStreamAlias("xml")
|
||||||
|
public class NewMessage {
|
||||||
|
@XStreamAlias("ToUserName")
|
||||||
|
private String toUserName;
|
||||||
|
@XStreamAlias("FromUserName")
|
||||||
|
private String fromUserName;
|
||||||
|
@XStreamAlias("CreateTime")
|
||||||
|
private long createTime;
|
||||||
|
@XStreamAlias("MsgType")
|
||||||
|
private String msgType;
|
||||||
|
@XStreamAlias("ArticleCount")
|
||||||
|
private int articleCount;
|
||||||
|
@XStreamAlias("Articles")
|
||||||
|
private List<Article> articles;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.muyu.warning.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IWarRulesService extends IService<WarnRuleDTO> {
|
||||||
|
List<WarnRuleDTO> selectWarnRulesList();
|
||||||
|
//联查
|
||||||
|
List<WarnRuleDTO> selectWarnRulesListAll(WarnRuleDTO warnRuleDTO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.warning.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.warning.domain.WarnLogs;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface IWarnLogsService extends IService<WarnLogs> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警日志
|
||||||
|
*
|
||||||
|
* @param id 预警日志主键
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
public WarnLogs selectWarnLogsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*
|
||||||
|
* @param warnLogs 预警日志
|
||||||
|
* @return 预警日志集合
|
||||||
|
*/
|
||||||
|
public List<WarnLogs> selectWarnLogsList(WarnLogs warnLogs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 预警日志 id是否唯一
|
||||||
|
* @param warnLogs 预警日志
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(WarnLogs warnLogs);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.warning.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.github.yulichang.base.MPJBaseService;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface IWarnRuleService extends IService<WarnRuleDTO> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
public WarnRuleDTO selectWarnRuleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRuleDTO 预警规则
|
||||||
|
* @return 预警规则集合
|
||||||
|
*/
|
||||||
|
public List<WarnRuleDTO> selectWarnRuleList(WarnRuleDTO warnRuleDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 预警规则 id是否唯一
|
||||||
|
* @param warnRuleDTO 预警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(WarnRuleDTO warnRuleDTO);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.warning.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.warning.domain.WarnStrategy;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface IWarnStrategyService extends IService<WarnStrategy> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警策略
|
||||||
|
*
|
||||||
|
* @param id 预警策略主键
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
public WarnStrategy selectWarnStrategyById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*
|
||||||
|
* @param warnStrategy 预警策略
|
||||||
|
* @return 预警策略集合
|
||||||
|
*/
|
||||||
|
public List<WarnStrategy> selectWarnStrategyList(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 预警策略 id是否唯一
|
||||||
|
* @param warnStrategy 预警策略
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.muyu.warning.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.warning.mapper.WarnLogsMapper;
|
||||||
|
import com.muyu.warning.domain.WarnLogs;
|
||||||
|
import com.muyu.warning.service.IWarnLogsService;
|
||||||
|
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-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnLogsServiceImpl
|
||||||
|
extends ServiceImpl<WarnLogsMapper, WarnLogs>
|
||||||
|
implements IWarnLogsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警日志
|
||||||
|
*
|
||||||
|
* @param id 预警日志主键
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnLogs selectWarnLogsById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnLogs> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(WarnLogs::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*
|
||||||
|
* @param warnLogs 预警日志
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnLogs> selectWarnLogsList(WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnLogs> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(warnLogs.getVin())){
|
||||||
|
queryWrapper.eq(WarnLogs::getVin, warnLogs.getVin());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getWarnRuleId())){
|
||||||
|
queryWrapper.eq(WarnLogs::getWarnRuleId, warnLogs.getWarnRuleId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getStartTime())){
|
||||||
|
queryWrapper.eq(WarnLogs::getStartTime, warnLogs.getStartTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getEndTime())){
|
||||||
|
queryWrapper.eq(WarnLogs::getEndTime, warnLogs.getEndTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getMaxValue())){
|
||||||
|
queryWrapper.eq(WarnLogs::getMaxValue, warnLogs.getMaxValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getMinValue())){
|
||||||
|
queryWrapper.eq(WarnLogs::getMinValue, warnLogs.getMinValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getAvgValue())){
|
||||||
|
queryWrapper.eq(WarnLogs::getAvgValue, warnLogs.getAvgValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getMedianValue())){
|
||||||
|
queryWrapper.eq(WarnLogs::getMedianValue, warnLogs.getMedianValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnLogs.getStatus())){
|
||||||
|
queryWrapper.eq(WarnLogs::getStatus, warnLogs.getStatus());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param warnLogs 预警日志
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(WarnLogs warnLogs) {
|
||||||
|
LambdaQueryWrapper<WarnLogs> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WarnLogs::getId, warnLogs.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.muyu.warning.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import com.muyu.warning.mapper.WarnRuleMapper;
|
||||||
|
import com.muyu.warning.service.IWarnRuleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnRuleServiceImpl
|
||||||
|
extends ServiceImpl<WarnRuleMapper, WarnRuleDTO>
|
||||||
|
implements IWarnRuleService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnRuleDTO selectWarnRuleById(Long id) {
|
||||||
|
LambdaQueryWrapper<WarnRuleDTO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRuleDTO 预警规则
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnRuleDTO> selectWarnRuleList(WarnRuleDTO warnRuleDTO) {
|
||||||
|
|
||||||
|
// MPJLambdaWrapper<WarnRule> queryWrapper = new MPJLambdaWrapper<WarnRule>()
|
||||||
|
// .selectAll(WarnRule.class)
|
||||||
|
// .select(WarnStrategy::getStrategyName)
|
||||||
|
// .selectAs(WarnStrategy::getStrategyName, WarnRule::getStrategyName);
|
||||||
|
// List<WarnRule> list = warnRuleMapper.selectJoinList(WarnRule.class, queryWrapper);
|
||||||
|
// return list;
|
||||||
|
// MPJLambdaWrapper<WarnRule> wrapper = JoinWrappers.lambda(WarnRule.class)
|
||||||
|
// .selectAll(WarnRule.class)
|
||||||
|
// .select(WarnStrategy::getStrategyName)
|
||||||
|
// .leftJoin(WarnStrategy.class, WarnStrategy::getId, WarnRule::getId);
|
||||||
|
// return warnRuleMapper.selectJoinList(WarnRule.class, wrapper);
|
||||||
|
// MPJQueryWrapper<WarnRule> queryWrapper = new MPJQueryWrapper<>();
|
||||||
|
// if (StringUtils.isNotEmpty(warnRule.getRuleName())) {
|
||||||
|
//// queryWrapper.like(WarnRule::getRuleName, warnRule.getRuleName());
|
||||||
|
// queryWrapper.like("rule_name", warnRule.getRuleName());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
LambdaQueryWrapper<WarnRuleDTO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getStrategyId())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getStrategyId, warnRuleDTO.getStrategyId());
|
||||||
|
// queryWrapper.eq("strategy_id", warnRule.getStrategyId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getMsgTypeId())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getMsgTypeId, warnRuleDTO.getMsgTypeId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getSlideTime())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getSlideTime, warnRuleDTO.getSlideTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getSlideFrequency())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getSlideFrequency, warnRuleDTO.getSlideFrequency());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getMaxValue())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getMaxValue, warnRuleDTO.getMaxValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRuleDTO.getMinValue())) {
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getMinValue, warnRuleDTO.getMinValue());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
*
|
||||||
|
* @param warnRuleDTO 预警规则
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(WarnRuleDTO warnRuleDTO) {
|
||||||
|
LambdaQueryWrapper<WarnRuleDTO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WarnRuleDTO::getId, warnRuleDTO.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.muyu.warning.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.warning.domain.WarnRule;
|
||||||
|
import com.muyu.warning.domain.WarnRuleDTO;
|
||||||
|
import com.muyu.warning.domain.WarnStrategy;
|
||||||
|
import com.muyu.warning.mapper.WarnRulesMapper;
|
||||||
|
import com.muyu.warning.service.IWarRulesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName WarnRulesServiceImpl
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/23 22:02
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnRulesServiceImpl
|
||||||
|
extends ServiceImpl <WarnRulesMapper, WarnRuleDTO>
|
||||||
|
implements IWarRulesService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WarnRulesMapper warnRulesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WarnRuleDTO> selectWarnRulesList() {
|
||||||
|
MPJLambdaWrapper<WarnRuleDTO> wrapper = new MPJLambdaWrapper<WarnRuleDTO>()
|
||||||
|
.selectAll(WarnRule.class)
|
||||||
|
.selectAs(WarnStrategy::getStrategyName, WarnRuleDTO::getStrategyName)
|
||||||
|
.leftJoin(WarnStrategy.class, WarnStrategy::getId, WarnRule::getStrategyId);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 双表查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnRuleDTO> selectWarnRulesListAll(WarnRuleDTO warnRuleDTO) {
|
||||||
|
List<WarnRuleDTO> list = warnRulesMapper.selectWarnRulesListAll(warnRuleDTO);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.warning.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.warning.mapper.WarnStrategyMapper;
|
||||||
|
import com.muyu.warning.domain.WarnStrategy;
|
||||||
|
import com.muyu.warning.service.IWarnStrategyService;
|
||||||
|
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-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnStrategyServiceImpl
|
||||||
|
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||||
|
implements IWarnStrategyService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警策略
|
||||||
|
*
|
||||||
|
* @param id 预警策略主键
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnStrategy selectWarnStrategyById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnStrategy> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(WarnStrategy::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*
|
||||||
|
* @param warnStrategy 预警策略
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnStrategy> selectWarnStrategyList(WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnStrategy> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotNull(warnStrategy.getCarTypeId())){
|
||||||
|
queryWrapper.eq(WarnStrategy::getCarTypeId, warnStrategy.getCarTypeId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnStrategy.getStrategyName())){
|
||||||
|
queryWrapper.like(WarnStrategy::getStrategyName, warnStrategy.getStrategyName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnStrategy.getMsgId())){
|
||||||
|
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategy.getMsgId());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param warnStrategy 预警策略
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(WarnStrategy warnStrategy) {
|
||||||
|
LambdaQueryWrapper<WarnStrategy> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WarnStrategy::getId, warnStrategy.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.warning.util;
|
||||||
|
|
||||||
|
import okhttp3.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class OkHttpUtils {
|
||||||
|
|
||||||
|
private static final OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
|
public static String sendGetRequest(String urlString) {
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(urlString)
|
||||||
|
.build();
|
||||||
|
try (Response response = client.newCall(request).execute()) {
|
||||||
|
return response.body().string();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String sendPostRequest(String urlString, String params) {
|
||||||
|
RequestBody requestBody = RequestBody.create(params, MediaType.parse("application/json; charset=utf-8"));
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(urlString)
|
||||||
|
.post(requestBody)
|
||||||
|
.build();
|
||||||
|
try (Response response = client.newCall(request).execute()) {
|
||||||
|
return response.body().string();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.warning.util;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.muyu.warning.wx.AccessToken;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Chen //redisService.setCacheObject("WECHAT_TOKEN",wechatToken.getAccessToken(),wechatToken.getExpiresIn(), TimeUnit.SECONDS);
|
||||||
|
* @name:TokenUtil
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class TokenUtil {
|
||||||
|
private final static String APP_ID = "wx591e88abd208c297";
|
||||||
|
|
||||||
|
private final static String APP_SECRET = "64d92a751ef24acc8d37b2e6d7672491";
|
||||||
|
|
||||||
|
private static AccessToken accessToken = new AccessToken();
|
||||||
|
|
||||||
|
|
||||||
|
public static void getToken() {
|
||||||
|
String url = String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", APP_ID, APP_SECRET);
|
||||||
|
String request = OkHttpUtils.sendGetRequest(url);
|
||||||
|
AccessToken wechatToken = JSON.parseObject(request, AccessToken.class);
|
||||||
|
if (wechatToken != null) {
|
||||||
|
accessToken.setExpiresTime(wechatToken.getExpires_in());
|
||||||
|
accessToken.setAccess_token(wechatToken.getAccess_token());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAccessToken() {
|
||||||
|
getToken();
|
||||||
|
return accessToken.getAccess_token();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 10003
|
||||||
|
|
||||||
|
# nacos线上地址
|
||||||
|
nacos:
|
||||||
|
addr: 127.0.0.1:8848
|
||||||
|
user-name: nacos
|
||||||
|
password: nacos
|
||||||
|
namespace: one
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: cloud-warn
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# 命名空间
|
||||||
|
namespace: ${nacos.namespace}
|
||||||
|
config:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: ${nacos.addr}
|
||||||
|
# 命名空间
|
||||||
|
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}
|
||||||
|
# engine配置
|
||||||
|
- engine-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
com.muyu.system.mapper: DEBUG
|
|
@ -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-warn"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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>
|
|
@ -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-warn"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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>
|
|
@ -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-warn"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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>
|
|
@ -0,0 +1,96 @@
|
||||||
|
<?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.warning.mapper.WarnLogsMapper">
|
||||||
|
|
||||||
|
<resultMap type="WarnLogs" id="WarnLogsResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="vin" column="vin" />
|
||||||
|
<result property="warnRuleId" column="warn_rule_id" />
|
||||||
|
<result property="startTime" column="start_time" />
|
||||||
|
<result property="endTime" column="end_time" />
|
||||||
|
<result property="maxValue" column="max_value" />
|
||||||
|
<result property="minValue" column="min_value" />
|
||||||
|
<result property="avgValue" column="avg_value" />
|
||||||
|
<result property="medianValue" column="median_value" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectWarnLogsVo">
|
||||||
|
select id, vin, warn_rule_id, start_time, end_time, max_value, min_value, avg_value, median_value, status from warn_logs
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectWarnLogsList" parameterType="WarnLogs" resultMap="WarnLogsResult">
|
||||||
|
<include refid="selectWarnLogsVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="vin != null and vin != ''"> and vin = #{vin}</if>
|
||||||
|
<if test="warnRuleId != null "> and warn_rule_id = #{warnRuleId}</if>
|
||||||
|
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||||
|
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||||
|
<if test="maxValue != null "> and max_value = #{maxValue}</if>
|
||||||
|
<if test="minValue != null "> and min_value = #{minValue}</if>
|
||||||
|
<if test="avgValue != null "> and avg_value = #{avgValue}</if>
|
||||||
|
<if test="medianValue != null "> and median_value = #{medianValue}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWarnLogsById" parameterType="Long" resultMap="WarnLogsResult">
|
||||||
|
<include refid="selectWarnLogsVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertWarnLogs" parameterType="WarnLogs" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into warn_logs
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="vin != null">vin,</if>
|
||||||
|
<if test="warnRuleId != null">warn_rule_id,</if>
|
||||||
|
<if test="startTime != null">start_time,</if>
|
||||||
|
<if test="endTime != null">end_time,</if>
|
||||||
|
<if test="maxValue != null">max_value,</if>
|
||||||
|
<if test="minValue != null">min_value,</if>
|
||||||
|
<if test="avgValue != null">avg_value,</if>
|
||||||
|
<if test="medianValue != null">median_value,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="vin != null">#{vin},</if>
|
||||||
|
<if test="warnRuleId != null">#{warnRuleId},</if>
|
||||||
|
<if test="startTime != null">#{startTime},</if>
|
||||||
|
<if test="endTime != null">#{endTime},</if>
|
||||||
|
<if test="maxValue != null">#{maxValue},</if>
|
||||||
|
<if test="minValue != null">#{minValue},</if>
|
||||||
|
<if test="avgValue != null">#{avgValue},</if>
|
||||||
|
<if test="medianValue != null">#{medianValue},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateWarnLogs" parameterType="WarnLogs">
|
||||||
|
update warn_logs
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="vin != null">vin = #{vin},</if>
|
||||||
|
<if test="warnRuleId != null">warn_rule_id = #{warnRuleId},</if>
|
||||||
|
<if test="startTime != null">start_time = #{startTime},</if>
|
||||||
|
<if test="endTime != null">end_time = #{endTime},</if>
|
||||||
|
<if test="maxValue != null">max_value = #{maxValue},</if>
|
||||||
|
<if test="minValue != null">min_value = #{minValue},</if>
|
||||||
|
<if test="avgValue != null">avg_value = #{avgValue},</if>
|
||||||
|
<if test="medianValue != null">median_value = #{medianValue},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteWarnLogsById" parameterType="Long">
|
||||||
|
delete from warn_logs where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteWarnLogsByIds" parameterType="String">
|
||||||
|
delete from warn_logs where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,86 @@
|
||||||
|
<?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.warning.mapper.WarnRuleMapper">
|
||||||
|
|
||||||
|
<resultMap type="WarnRule" id="WarnRuleResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="ruleName" column="rule_name" />
|
||||||
|
<result property="strategyId" column="strategy_id" />
|
||||||
|
<result property="msgTypeId" column="msg_type_id" />
|
||||||
|
<result property="slideTime" column="slide_time" />
|
||||||
|
<result property="slideFrequency" column="slide_frequency" />
|
||||||
|
<result property="maxValue" column="max_value" />
|
||||||
|
<result property="minValue" column="min_value" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectWarnRuleVo">
|
||||||
|
select id, rule_name, strategy_id, msg_type_id, slide_time, slide_frequency, max_value, min_value from warn_rule
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectWarnRuleList" parameterType="WarnRule" resultMap="WarnRuleResult">
|
||||||
|
<include refid="selectWarnRuleVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="ruleName != null and ruleName != ''"> and rule_name like concat('%', #{ruleName}, '%')</if>
|
||||||
|
<if test="strategyId != null "> and strategy_id = #{strategyId}</if>
|
||||||
|
<if test="msgTypeId != null "> and msg_type_id = #{msgTypeId}</if>
|
||||||
|
<if test="slideTime != null "> and slide_time = #{slideTime}</if>
|
||||||
|
<if test="slideFrequency != null "> and slide_frequency = #{slideFrequency}</if>
|
||||||
|
<if test="maxValue != null "> and max_value = #{maxValue}</if>
|
||||||
|
<if test="minValue != null "> and min_value = #{minValue}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWarnRuleById" parameterType="Long" resultMap="WarnRuleResult">
|
||||||
|
<include refid="selectWarnRuleVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertWarnRule" parameterType="WarnRule" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into warn_rule
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ruleName != null">rule_name,</if>
|
||||||
|
<if test="strategyId != null">strategy_id,</if>
|
||||||
|
<if test="msgTypeId != null">msg_type_id,</if>
|
||||||
|
<if test="slideTime != null">slide_time,</if>
|
||||||
|
<if test="slideFrequency != null">slide_frequency,</if>
|
||||||
|
<if test="maxValue != null">max_value,</if>
|
||||||
|
<if test="minValue != null">min_value,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="ruleName != null">#{ruleName},</if>
|
||||||
|
<if test="strategyId != null">#{strategyId},</if>
|
||||||
|
<if test="msgTypeId != null">#{msgTypeId},</if>
|
||||||
|
<if test="slideTime != null">#{slideTime},</if>
|
||||||
|
<if test="slideFrequency != null">#{slideFrequency},</if>
|
||||||
|
<if test="maxValue != null">#{maxValue},</if>
|
||||||
|
<if test="minValue != null">#{minValue},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateWarnRule" parameterType="WarnRule">
|
||||||
|
update warn_rule
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="ruleName != null">rule_name = #{ruleName},</if>
|
||||||
|
<if test="strategyId != null">strategy_id = #{strategyId},</if>
|
||||||
|
<if test="msgTypeId != null">msg_type_id = #{msgTypeId},</if>
|
||||||
|
<if test="slideTime != null">slide_time = #{slideTime},</if>
|
||||||
|
<if test="slideFrequency != null">slide_frequency = #{slideFrequency},</if>
|
||||||
|
<if test="maxValue != null">max_value = #{maxValue},</if>
|
||||||
|
<if test="minValue != null">min_value = #{minValue},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteWarnRuleById" parameterType="Long">
|
||||||
|
delete from warn_rule where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteWarnRuleByIds" parameterType="String">
|
||||||
|
delete from warn_rule where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?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.warning.mapper.WarnRulesMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectWarnRulesListAll" resultType="com.muyu.warning.domain.WarnRuleDTO"></select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?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.warning.mapper.WarnStrategyMapper">
|
||||||
|
|
||||||
|
<resultMap type="WarnStrategy" id="WarnStrategyResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="carTypeId" column="car_type_id" />
|
||||||
|
<result property="strategyName" column="strategy_name" />
|
||||||
|
<result property="msgId" column="msg_id" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectWarnStrategyVo">
|
||||||
|
select id, car_type_id, strategy_name, msg_id from warn_strategy
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectWarnStrategyList" parameterType="WarnStrategy" resultMap="WarnStrategyResult">
|
||||||
|
<include refid="selectWarnStrategyVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="carTypeId != null "> and car_type_id = #{carTypeId}</if>
|
||||||
|
<if test="strategyName != null and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
|
||||||
|
<if test="msgId != null "> and msg_id = #{msgId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWarnStrategyById" parameterType="Long" resultMap="WarnStrategyResult">
|
||||||
|
<include refid="selectWarnStrategyVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertWarnStrategy" parameterType="WarnStrategy" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into warn_strategy
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="carTypeId != null">car_type_id,</if>
|
||||||
|
<if test="strategyName != null">strategy_name,</if>
|
||||||
|
<if test="msgId != null">msg_id,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="carTypeId != null">#{carTypeId},</if>
|
||||||
|
<if test="strategyName != null">#{strategyName},</if>
|
||||||
|
<if test="msgId != null">#{msgId},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateWarnStrategy" parameterType="WarnStrategy">
|
||||||
|
update warn_strategy
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="carTypeId != null">car_type_id = #{carTypeId},</if>
|
||||||
|
<if test="strategyName != null">strategy_name = #{strategyName},</if>
|
||||||
|
<if test="msgId != null">msg_id = #{msgId},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteWarnStrategyById" parameterType="Long">
|
||||||
|
delete from warn_strategy where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteWarnStrategyByIds" parameterType="String">
|
||||||
|
delete from warn_strategy where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -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-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>cloud-warn-common</module>
|
||||||
|
<module>cloud-warn-client</module>
|
||||||
|
<module>cloud-warn-remote</module>
|
||||||
|
<module>cloud-warn-server</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>
|
Loading…
Reference in New Issue