Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
c77054b3fd | |
|
77c475723d |
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
|
@ -164,15 +164,6 @@
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>3.5.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.yulichang</groupId>
|
|
||||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
|
||||||
<version>1.4.11</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-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>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>3.5.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.yulichang</groupId>
|
|
||||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
|
||||||
<version>1.4.11</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,83 +0,0 @@
|
||||||
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.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Lenovo
|
|
||||||
* @ Tool:IntelliJ IDEA
|
|
||||||
* @ Author:CHX
|
|
||||||
* @ Date:2024-09-17-15:10
|
|
||||||
* @ Version:1.0
|
|
||||||
* @ Description:故障实体类
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
@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;
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
*/
|
|
||||||
@Excel(name = "车辆VIN")
|
|
||||||
private String carVin;
|
|
||||||
/**
|
|
||||||
* 故障标签
|
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
/**
|
|
||||||
* 故障描述信息
|
|
||||||
*/
|
|
||||||
@Excel(name = "故障描述信息")
|
|
||||||
private String faultDesc;
|
|
||||||
/**
|
|
||||||
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
|
||||||
*/
|
|
||||||
@Excel(name = "启用状态")
|
|
||||||
private String state;
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.breakdown.controller;
|
|
||||||
|
|
||||||
import com.muyu.breakdown.service.BreakDownService;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ 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;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
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> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.muyu.breakdown.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.breakdown.domain.BreakDown;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ Tool:IntelliJ IDEA
|
|
||||||
* @ Author:CHX
|
|
||||||
* @ Date:2024-09-17-15:31
|
|
||||||
* @ Version:1.0
|
|
||||||
* @ Description:故障管理业务层
|
|
||||||
* @author Lenovo
|
|
||||||
*/
|
|
||||||
public interface BreakDownService extends IService<BreakDown> {
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.muyu.breakdown.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.breakdown.domain.BreakDown;
|
|
||||||
import com.muyu.breakdown.mapper.BreakDownMapper;
|
|
||||||
import com.muyu.breakdown.service.BreakDownService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ 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 {
|
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-breakdown</artifactId>
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-breakdown-client</artifactId>
|
<artifactId>cloud-warn-client</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
@ -17,11 +17,4 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-breakdown-common</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
|
@ -5,18 +5,21 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-breakdown</artifactId>
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-breakdown-server</artifactId>
|
<artifactId>cloud-warn-common</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -84,9 +87,48 @@
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-breakdown-common</artifactId>
|
<artifactId>cloud-common-core</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
</project>
|
|
@ -0,0 +1,91 @@
|
||||||
|
package com.muyu.platform.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志对象 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,77 @@
|
||||||
|
package com.muyu.platform.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则对象 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,57 @@
|
||||||
|
package com.muyu.platform.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略对象 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.platform.domain.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.platform.domain.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;
|
||||||
|
}
|
|
@ -5,11 +5,11 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-breakdown</artifactId>
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-breakdown-remote</artifactId>
|
<artifactId>cloud-warn-remote</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
@ -17,11 +17,4 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.muyu</groupId>
|
|
||||||
<artifactId>cloud-breakdown-common</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?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.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>
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muyu;
|
package com.muyu.platform;
|
||||||
|
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
@ -6,18 +6,16 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ Tool:IntelliJ IDEA
|
* @Author Chen
|
||||||
* @ Author:CHX
|
* @name:WxApplication
|
||||||
* @ Date:2024-09-17-15:00
|
* @Date:2024/9/16 20:39
|
||||||
* @ Version:1.0
|
|
||||||
* @ Description:故障启动类
|
|
||||||
* @author Lenovo
|
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
|
//@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class BreakDownApplication {
|
public class WarnApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(BreakDownApplication.class, args);
|
SpringApplication.run(WarnApplication.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.muyu.platform.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.platform.domain.WarnLogs;
|
||||||
|
import com.muyu.platform.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 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("/logs")
|
||||||
|
public class WarnLogsController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private IWarnLogsService warnLogsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:logs:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnLogs>> list(WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WarnLogs> list = warnLogsService.selectWarnLogsList(warnLogs);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警日志列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform: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("platform:logs:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnLogs>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnLogsService.selectWarnLogsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:logs:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
if (warnLogsService.checkIdUnique(warnLogs)) {
|
||||||
|
return error("新增 预警日志 '" + warnLogs + "'失败,预警日志已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnLogsService.save(warnLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:logs:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
if (!warnLogsService.checkIdUnique(warnLogs)) {
|
||||||
|
return error("修改 预警日志 '" + warnLogs + "'失败,预警日志不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnLogsService.updateById(warnLogs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警日志
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:logs:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
warnLogsService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.muyu.platform.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.platform.domain.WarnRule;
|
||||||
|
import com.muyu.platform.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 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("/rule")
|
||||||
|
public class WarnRuleController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private IWarnRuleService warnRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnRule>> list(WarnRule warnRule)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WarnRule> list = warnRuleService.selectWarnRuleList(warnRule);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WarnRule warnRule)
|
||||||
|
{
|
||||||
|
List<WarnRule> list = warnRuleService.selectWarnRuleList(warnRule);
|
||||||
|
ExcelUtil<WarnRule> util = new ExcelUtil<WarnRule>(WarnRule.class);
|
||||||
|
util.exportExcel(response, list, "预警规则数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警规则详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnRule>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnRuleService.selectWarnRuleById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnRule warnRule)
|
||||||
|
{
|
||||||
|
if (warnRuleService.checkIdUnique(warnRule)) {
|
||||||
|
return error("新增 预警规则 '" + warnRule + "'失败,预警规则已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnRuleService.save(warnRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnRule warnRule)
|
||||||
|
{
|
||||||
|
if (!warnRuleService.checkIdUnique(warnRule)) {
|
||||||
|
return error("修改 预警规则 '" + warnRule + "'失败,预警规则不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnRuleService.updateById(warnRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:rule:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
warnRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.muyu.platform.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.platform.domain.WarnStrategy;
|
||||||
|
import com.muyu.platform.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 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("/strategy")
|
||||||
|
public class WarnStrategyController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private IWarnStrategyService warnStrategyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:strategy:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnStrategy>> list(WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WarnStrategy> list = warnStrategyService.selectWarnStrategyList(warnStrategy);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出预警策略列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform: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("platform:strategy:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<WarnStrategy>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnStrategyService.selectWarnStrategyById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:strategy:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
if (warnStrategyService.checkIdUnique(warnStrategy)) {
|
||||||
|
return error("新增 预警策略 '" + warnStrategy + "'失败,预警策略已存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnStrategyService.save(warnStrategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform:strategy:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
if (!warnStrategyService.checkIdUnique(warnStrategy)) {
|
||||||
|
return error("修改 预警策略 '" + warnStrategy + "'失败,预警策略不存在");
|
||||||
|
}
|
||||||
|
return toAjax(warnStrategyService.updateById(warnStrategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警策略
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("platform: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.platform.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.platform.domain.wx.Message;
|
||||||
|
import com.muyu.platform.message.Article;
|
||||||
|
import com.muyu.platform.message.NewMessage;
|
||||||
|
import com.muyu.platform.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,17 @@
|
||||||
|
package com.muyu.platform.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.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,17 @@
|
||||||
|
package com.muyu.platform.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.domain.WarnRule;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnRuleMapper extends BaseMapper<WarnRule>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.platform.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.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.platform.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.platform.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,37 @@
|
||||||
|
package com.muyu.platform.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.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,37 @@
|
||||||
|
package com.muyu.platform.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.domain.WarnRule;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface IWarnRuleService extends IService<WarnRule> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
public WarnRule selectWarnRuleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 预警规则集合
|
||||||
|
*/
|
||||||
|
public List<WarnRule> selectWarnRuleList(WarnRule warnRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 预警规则 id是否唯一
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(WarnRule warnRule);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.platform.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.platform.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.platform.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.platform.mapper.WarnLogsMapper;
|
||||||
|
import com.muyu.platform.domain.WarnLogs;
|
||||||
|
import com.muyu.platform.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,87 @@
|
||||||
|
package com.muyu.platform.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.platform.mapper.WarnRuleMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.platform.domain.WarnRule;
|
||||||
|
import com.muyu.platform.service.IWarnRuleService;
|
||||||
|
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 WarnRuleServiceImpl
|
||||||
|
extends ServiceImpl<WarnRuleMapper, WarnRule>
|
||||||
|
implements IWarnRuleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnRule selectWarnRuleById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(WarnRule::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnRule> selectWarnRuleList(WarnRule warnRule)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(warnRule.getRuleName())){
|
||||||
|
queryWrapper.like(WarnRule::getRuleName, warnRule.getRuleName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getStrategyId())){
|
||||||
|
queryWrapper.eq(WarnRule::getStrategyId, warnRule.getStrategyId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getMsgTypeId())){
|
||||||
|
queryWrapper.eq(WarnRule::getMsgTypeId, warnRule.getMsgTypeId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getSlideTime())){
|
||||||
|
queryWrapper.eq(WarnRule::getSlideTime, warnRule.getSlideTime());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getSlideFrequency())){
|
||||||
|
queryWrapper.eq(WarnRule::getSlideFrequency, warnRule.getSlideFrequency());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getMaxValue())){
|
||||||
|
queryWrapper.eq(WarnRule::getMaxValue, warnRule.getMaxValue());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(warnRule.getMinValue())){
|
||||||
|
queryWrapper.eq(WarnRule::getMinValue, warnRule.getMinValue());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(WarnRule warnRule) {
|
||||||
|
LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WarnRule::getId, warnRule.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.muyu.platform.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.platform.mapper.WarnStrategyMapper;
|
||||||
|
import com.muyu.platform.domain.WarnStrategy;
|
||||||
|
import com.muyu.platform.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.platform.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.platform.util;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.muyu.platform.domain.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,10 @@
|
||||||
|
package com.muyu.warn.controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Controller
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/17 17:42
|
||||||
|
*/
|
||||||
|
public class Controller {
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.warn.mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName A
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Chen
|
||||||
|
* @Date 2024/9/17 17:42
|
||||||
|
*/
|
||||||
|
public interface A {
|
||||||
|
}
|
|
@ -1,25 +1,21 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9701
|
port: 10003
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
amqp:
|
|
||||||
deserialization:
|
|
||||||
trust:
|
|
||||||
all: true
|
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: cloud-breakdown
|
name: cloud-warn
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
|
@ -28,19 +24,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: ${nacos.addr}
|
server-addr: ${nacos.addr}
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
# 命名空间
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
config:
|
config:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: ${nacos.addr}
|
server-addr: ${nacos.addr}
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
# 命名空间
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
|
@ -53,8 +41,8 @@ spring:
|
||||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
# xxl-job 配置文件
|
# xxl-job 配置文件
|
||||||
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
# rabbit 配置文件
|
# engine配置
|
||||||
- application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- engine-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
com.muyu.system.mapper: DEBUG
|
com.muyu.system.mapper: DEBUG
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-breakdown"/>
|
<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.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-breakdown"/>
|
<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.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"/>
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-breakdown"/>
|
<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.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"/>
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
@ -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.platform.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.platform.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,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.platform.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>
|
|
@ -9,13 +9,13 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-breakdown</artifactId>
|
<artifactId>cloud-modules-warn</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>cloud-breakdown-common</module>
|
<module>cloud-warn-common</module>
|
||||||
<module>cloud-breakdown-server</module>
|
<module>cloud-warn-client</module>
|
||||||
<module>cloud-breakdown-remote</module>
|
<module>cloud-warn-remote</module>
|
||||||
<module>cloud-breakdown-client</module>
|
<module>cloud-warn-server</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -23,5 +23,4 @@
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -12,7 +12,7 @@
|
||||||
<module>cloud-modules-system</module>
|
<module>cloud-modules-system</module>
|
||||||
<module>cloud-modules-gen</module>
|
<module>cloud-modules-gen</module>
|
||||||
<module>cloud-modules-file</module>
|
<module>cloud-modules-file</module>
|
||||||
<module>cloud-breakdown</module>
|
<module>cloud-modules-warn</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
|
|
@ -4,7 +4,7 @@ server:
|
||||||
|
|
||||||
# nacos线上地址
|
# nacos线上地址
|
||||||
nacos:
|
nacos:
|
||||||
addr: 47.116.173.119:8848
|
addr: 106.54.193.225:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: one
|
namespace: one
|
||||||
|
|
Loading…
Reference in New Issue