feat():指标预警初始化
parent
a4bef49f4a
commit
53bab33a66
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -11,7 +12,7 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName(value = "car_type",autoResultMap = true)
|
@TableName(value = "car_type",autoResultMap = true)
|
||||||
public class CarType {
|
public class CarType {
|
||||||
@TableId(value = "id")
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
private Long messageId;
|
private Long messageId;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
@ -14,7 +15,7 @@ import lombok.NoArgsConstructor;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName(value = "sys_car",autoResultMap = true)
|
@TableName(value = "sys_car",autoResultMap = true)
|
||||||
public class SysCar extends BaseEntity {
|
public class SysCar extends BaseEntity {
|
||||||
@TableId(value = "id")
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
private String carVin;
|
private String carVin;
|
||||||
private Long carTypeId;
|
private Long carTypeId;
|
||||||
|
@ -25,14 +26,4 @@ public class SysCar extends BaseEntity {
|
||||||
private String carBatteryManufacturer;
|
private String carBatteryManufacturer;
|
||||||
private String carBatteryModel;
|
private String carBatteryModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain;
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
@ -13,7 +15,7 @@ import java.util.Date;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName(value = "sys_car_log",autoResultMap = true)
|
@TableName(value = "sys_car_log",autoResultMap = true)
|
||||||
public class SysCarLog {
|
public class SysCarLog {
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
private String id;
|
private String id;
|
||||||
private String carVin;
|
private String carVin;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
|
|
@ -11,8 +11,11 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class SysCarReq {
|
public class SysCarReq {
|
||||||
private String carVin;
|
private String carVin;
|
||||||
|
private String state;
|
||||||
private String carMotorManufacturer;
|
private String carMotorManufacturer;
|
||||||
private String carMotorModel;
|
private String carMotorModel;
|
||||||
private String carBatteryManufacturer;
|
private String carBatteryManufacturer;
|
||||||
private String carBatteryModel;
|
private String carBatteryModel;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
<?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>
|
||||||
|
|
||||||
|
<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>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 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>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableFeignClients
|
||||||
|
@MapperScan(value = "com.muyu.mapper")
|
||||||
|
public class WarnCarApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(WarnCarApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.muyu.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.service.WarnLogsService;
|
||||||
|
|
||||||
|
|
||||||
|
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.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.domain.WarnLogs ;
|
||||||
|
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 sx
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/logs")
|
||||||
|
public class WarnLogsController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private WarnLogsService warnLogsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnLogs>> list(@RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
List<WarnLogs> list = warnLogsService.selectWarnLogsList(warnLogs);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警日志详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "selectWarnLogsById/{id}")
|
||||||
|
public Result<List<WarnLogs>> selectWarnLogsById(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnLogsService.selectWarnLogsById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警日志
|
||||||
|
*/
|
||||||
|
@PostMapping("/addWarnLogs")
|
||||||
|
public Result<Integer> addWarnLogs(@RequestBody WarnLogs warnLogs)
|
||||||
|
{
|
||||||
|
int i = warnLogsService.addWarnLogs(warnLogs);
|
||||||
|
return i>0?Result.success():Result.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.muyu.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import com.muyu.service.WarnRuleService;
|
||||||
|
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.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Controller
|
||||||
|
*
|
||||||
|
* @author sx
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rule")
|
||||||
|
public class WarnRuleController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private WarnRuleService warnRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result list(@RequestBody WarnRule warnRule)
|
||||||
|
{
|
||||||
|
List<WarnRule> list = warnRuleService.selectWarnRuleList(warnRule);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警规则详细信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping(value = "selectById/{id}")
|
||||||
|
public Result<List<WarnRule>> selectById(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnRuleService.selectWarnRuleById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警规则
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PostMapping("/addWarnRule")
|
||||||
|
public Result<Integer> addWarnRule(@RequestBody WarnRule warnRule)
|
||||||
|
{
|
||||||
|
int i = warnRuleService.addWarnRule(warnRule);
|
||||||
|
return i>0?Result.success():Result.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警规则
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> updWarnRule(@RequestBody WarnRule warnRule)
|
||||||
|
{
|
||||||
|
int i = warnRuleService.updWarnRule(warnRule);
|
||||||
|
return i>0?Result.success():Result.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警规则
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
warnRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.muyu.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.domain.req.WarnStrategyReq;
|
||||||
|
import com.muyu.service.WarnStrategyService;
|
||||||
|
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.domain.WarnStrategy;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Controller
|
||||||
|
*
|
||||||
|
* @author sx
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/strategy")
|
||||||
|
public class WarnStrategyController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private WarnStrategyService warnStrategyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<WarnStrategy>> list(@RequestBody WarnStrategyReq warnStrategyReq)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<WarnStrategy> list = warnStrategyService.selectWarnStrategyList(warnStrategyReq);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警策略详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping( "selectById/{id}")
|
||||||
|
public Result selectById(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(warnStrategyService.selectWarnStrategyById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增预警策略
|
||||||
|
*/
|
||||||
|
@PostMapping("/addWarnStrategy")
|
||||||
|
public Result addWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
Integer i = warnStrategyService.addWarnStrategy(warnStrategy);
|
||||||
|
if (i>0){
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
return Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改预警策略
|
||||||
|
*/
|
||||||
|
@PostMapping("/updWarnStrategy")
|
||||||
|
public Result updWarnStrategy(@RequestBody WarnStrategy warnStrategy)
|
||||||
|
{
|
||||||
|
Integer i = warnStrategyService.updWarnStrategy(warnStrategy);
|
||||||
|
if (i>0){
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
return Result.error("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除预警策略
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
warnStrategyService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.muyu.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
|
||||||
|
@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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.muyu.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
|
||||||
|
@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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.*;
|
||||||
|
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
|
||||||
|
@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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略对象 warn_strategy
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WarnStrategyReq {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 车辆类型id */
|
||||||
|
@Excel(name = "车辆类型id")
|
||||||
|
private Long carTypeId;
|
||||||
|
|
||||||
|
/** 策略名称 */
|
||||||
|
@Excel(name = "策略名称")
|
||||||
|
private String strategyName;
|
||||||
|
|
||||||
|
/** 报文模版id */
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Long msgId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.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.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.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,16 @@
|
||||||
|
package com.muyu.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WarnStrategyMapper extends BaseMapper<WarnStrategy> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.domain.WarnLogs ;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警日志Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface WarnLogsService extends IService<WarnLogs> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警日志
|
||||||
|
*
|
||||||
|
* @param id 预警日志主键
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
public WarnLogs selectWarnLogsById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*
|
||||||
|
* @param warnLogs 预警日志
|
||||||
|
* @return 预警日志集合
|
||||||
|
*/
|
||||||
|
public List<WarnLogs> selectWarnLogsList(WarnLogs warnLogs);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
Integer addWarnLogs(WarnLogs warnLogs);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface WarnRuleService extends IService<WarnRule> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
public WarnRule selectWarnRuleById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 预警规则集合
|
||||||
|
*/
|
||||||
|
public List<WarnRule> selectWarnRuleList(WarnRule warnRule);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
Integer addWarnRule(WarnRule warnRule);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
Integer updWarnRule(WarnRule warnRule);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.muyu.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.req.WarnStrategyReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
public interface WarnStrategyService extends IService<WarnStrategy> {
|
||||||
|
/**
|
||||||
|
* 精确查询预警策略
|
||||||
|
*
|
||||||
|
* @param id 预警策略主键
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
public WarnStrategy selectWarnStrategyById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*
|
||||||
|
* @param warnStrategy 预警策略
|
||||||
|
* @return 预警策略集合
|
||||||
|
*/
|
||||||
|
public List<WarnStrategy> selectWarnStrategyList(WarnStrategyReq warnStrategyReq);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
Integer updWarnStrategy(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
Integer addWarnStrategy(WarnStrategy warnStrategy);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.mapper.WarnLogsMapper;
|
||||||
|
import com.muyu.service.WarnLogsService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.domain.WarnLogs ;
|
||||||
|
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-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnLogsServiceImpl
|
||||||
|
extends ServiceImpl<WarnLogsMapper, WarnLogs>
|
||||||
|
implements WarnLogsService {
|
||||||
|
@Autowired
|
||||||
|
private WarnLogsMapper warnLogsMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警日志
|
||||||
|
*
|
||||||
|
* @param id 预警日志主键
|
||||||
|
* @return 预警日志
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnLogs selectWarnLogsById(Long id)
|
||||||
|
{
|
||||||
|
return warnLogsMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警日志列表
|
||||||
|
*
|
||||||
|
* @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());
|
||||||
|
}
|
||||||
|
return warnLogsMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer addWarnLogs(WarnLogs warnLogs) {
|
||||||
|
return warnLogsMapper.insert(warnLogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.muyu.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.mapper.WarnRuleMapper;
|
||||||
|
import com.muyu.service.WarnRuleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.domain.WarnRule ;
|
||||||
|
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-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnRuleServiceImpl
|
||||||
|
extends ServiceImpl<WarnRuleMapper, WarnRule>
|
||||||
|
implements WarnRuleService {
|
||||||
|
@Autowired
|
||||||
|
private WarnRuleMapper warnRuleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警规则
|
||||||
|
*
|
||||||
|
* @param id 预警规则主键
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnRule selectWarnRuleById(Long id)
|
||||||
|
{
|
||||||
|
return warnRuleMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警规则列表
|
||||||
|
*
|
||||||
|
* @param warnRule 预警规则
|
||||||
|
* @return 预警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnRule> selectWarnRuleList(WarnRule warnRule)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return warnRuleMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer addWarnRule(WarnRule warnRule) {
|
||||||
|
return warnRuleMapper.insert(warnRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer updWarnRule(WarnRule warnRule) {
|
||||||
|
LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return warnRuleMapper.update(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.muyu.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
|
||||||
|
import com.muyu.domain.req.WarnStrategyReq;
|
||||||
|
import com.muyu.mapper.WarnLogsMapper;
|
||||||
|
import com.muyu.mapper.WarnStrategyMapper;
|
||||||
|
import com.muyu.service.WarnStrategyService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-09-20
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarnStrategyServiceImpl
|
||||||
|
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||||
|
implements WarnStrategyService {
|
||||||
|
@Autowired
|
||||||
|
private WarnStrategyMapper warnStrategyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询预警策略
|
||||||
|
*
|
||||||
|
* @param id 预警策略主键
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WarnStrategy selectWarnStrategyById(Long id)
|
||||||
|
{
|
||||||
|
return warnStrategyMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询预警策略列表
|
||||||
|
*
|
||||||
|
* @param warnStrategyReq 预警策略
|
||||||
|
* @return 预警策略
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WarnStrategy> selectWarnStrategyList(WarnStrategyReq warnStrategyReq)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<WarnStrategy> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (warnStrategyReq.getCarTypeId()!=null){
|
||||||
|
queryWrapper.eq(WarnStrategy::getCarTypeId, warnStrategyReq.getCarTypeId());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(warnStrategyReq.getStrategyName())){
|
||||||
|
queryWrapper.like(WarnStrategy::getStrategyName, warnStrategyReq.getStrategyName());
|
||||||
|
}
|
||||||
|
if (warnStrategyReq.getMsgId()!=null){
|
||||||
|
queryWrapper.eq(WarnStrategy::getMsgId, warnStrategyReq.getMsgId());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
|
public Integer updWarnStrategy(WarnStrategy warnStrategy){
|
||||||
|
QueryWrapper<WarnStrategy> wrapper = new QueryWrapper<>(warnStrategy);
|
||||||
|
return warnStrategyMapper.update(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
public Integer addWarnStrategy(WarnStrategy warnStrategy){
|
||||||
|
return warnStrategyMapper.insert(warnStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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-car"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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-car"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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-car"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<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>
|
|
@ -16,6 +16,7 @@
|
||||||
<module>cloud-modules-template</module>
|
<module>cloud-modules-template</module>
|
||||||
<module>cloud-modules-fence</module>
|
<module>cloud-modules-fence</module>
|
||||||
<module>cloud-car</module>
|
<module>cloud-car</module>
|
||||||
|
<module>cloud-modules-warn</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue