Compare commits
No commits in common. "master" and "server_2024_4_2_jiangcan" have entirely different histories.
master
...
server_202
116
pom.xml
116
pom.xml
|
@ -37,8 +37,6 @@
|
||||||
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
|
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
|
||||||
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
||||||
<mqttv3.version>1.2.5</mqttv3.version>
|
<mqttv3.version>1.2.5</mqttv3.version>
|
||||||
<spring-kafka.version>2.8.0</spring-kafka.version>
|
|
||||||
<aliyun.ecs.version>3.1.12</aliyun.ecs.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
|
@ -252,29 +250,7 @@
|
||||||
<version>${mqttv3.version}</version>
|
<version>${mqttv3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- kafka-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.kafka</groupId>
|
|
||||||
<artifactId>spring-kafka</artifactId>
|
|
||||||
<version>${spring-kafka.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-business</artifactId>
|
|
||||||
<version>${zhilian.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 阿里云ESC服务版本控制-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>ecs20140526</artifactId>
|
|
||||||
<version>${aliyun.ecs.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@ -328,57 +304,57 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- 要将源码放上去,需要加入这个插件 -->
|
<!-- 要将源码放上去,需要加入这个插件 -->
|
||||||
<!-- <plugin>-->
|
<plugin>
|
||||||
<!-- <groupId>org.apache.maven.plugins</groupId>-->
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<!-- <artifactId>maven-source-plugin</artifactId>-->
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<!-- <version>3.0.1</version>-->
|
<version>3.0.1</version>
|
||||||
<!-- <configuration>-->
|
<configuration>
|
||||||
<!-- <attach>true</attach>-->
|
<attach>true</attach>
|
||||||
<!-- </configuration>-->
|
</configuration>
|
||||||
<!-- <executions>-->
|
<executions>
|
||||||
<!-- <execution>-->
|
<execution>
|
||||||
<!-- <phase>compile</phase>-->
|
<phase>compile</phase>
|
||||||
<!-- <goals>-->
|
<goals>
|
||||||
<!-- <goal>jar</goal>-->
|
<goal>jar</goal>
|
||||||
<!-- </goals>-->
|
</goals>
|
||||||
<!-- </execution>-->
|
</execution>
|
||||||
<!-- </executions>-->
|
</executions>
|
||||||
<!-- </plugin>-->
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<!-- <distributionManagement>-->
|
<distributionManagement>
|
||||||
<!-- <repository>-->
|
<repository>
|
||||||
<!-- <id>releases</id>-->
|
<id>releases</id>
|
||||||
<!-- <name>releases</name>-->
|
<name>releases</name>
|
||||||
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-releases/</url>-->
|
<url>http://nexus.zhilian.com:8081/repository/maven-releases/</url>
|
||||||
<!-- </repository>-->
|
</repository>
|
||||||
<!-- </distributionManagement>-->
|
</distributionManagement>
|
||||||
|
|
||||||
<!-- <repositories>-->
|
<repositories>
|
||||||
<!-- <repository>-->
|
<repository>
|
||||||
<!-- <id>public</id>-->
|
<id>public</id>
|
||||||
<!-- <name>aliyun nexus</name>-->
|
<name>aliyun nexus</name>
|
||||||
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-public/</url>-->
|
<url>http://nexus.zhilian.com:8081/repository/maven-public/</url>
|
||||||
<!-- <releases>-->
|
<releases>
|
||||||
<!-- <enabled>true</enabled>-->
|
<enabled>true</enabled>
|
||||||
<!-- </releases>-->
|
</releases>
|
||||||
<!-- </repository>-->
|
</repository>
|
||||||
<!-- </repositories>-->
|
</repositories>
|
||||||
|
|
||||||
<!-- <pluginRepositories>-->
|
<pluginRepositories>
|
||||||
<!-- <pluginRepository>-->
|
<pluginRepository>
|
||||||
<!-- <id>public</id>-->
|
<id>public</id>
|
||||||
<!-- <name>aliyun nexus</name>-->
|
<name>aliyun nexus</name>
|
||||||
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-public/</url>-->
|
<url>http://nexus.zhilian.com:8081/repository/maven-public/</url>
|
||||||
<!-- <releases>-->
|
<releases>
|
||||||
<!-- <enabled>true</enabled>-->
|
<enabled>true</enabled>
|
||||||
<!-- </releases>-->
|
</releases>
|
||||||
<!-- <snapshots>-->
|
<snapshots>
|
||||||
<!-- <enabled>false</enabled>-->
|
<enabled>false</enabled>
|
||||||
<!-- </snapshots>-->
|
</snapshots>
|
||||||
<!-- </pluginRepository>-->
|
</pluginRepository>
|
||||||
<!-- </pluginRepositories>-->
|
</pluginRepositories>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
<module>zhilian-common-datasource</module>
|
<module>zhilian-common-datasource</module>
|
||||||
<module>zhilian-common-system</module>
|
<module>zhilian-common-system</module>
|
||||||
<module>zhilian-common-resolver</module>
|
<module>zhilian-common-resolver</module>
|
||||||
<module>zhilian-common-business</module>
|
|
||||||
<module>zhilian-common-event</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>zhilian-common</artifactId>
|
<artifactId>zhilian-common</artifactId>
|
||||||
|
|
|
@ -1,28 +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.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>zhilian-common-business</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>
|
|
||||||
<!-- zhilian Common Core-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,43 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName Break
|
|
||||||
* @Description 故障实体类
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:40
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Break {
|
|
||||||
/**
|
|
||||||
* 故障id
|
|
||||||
**/
|
|
||||||
private Integer breakId;
|
|
||||||
/**
|
|
||||||
* 故障码
|
|
||||||
**/
|
|
||||||
private String breakCode;
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
**/
|
|
||||||
private String breakVin;
|
|
||||||
/**
|
|
||||||
* 开始报警时间
|
|
||||||
**/
|
|
||||||
private Date breakDate;
|
|
||||||
/**
|
|
||||||
* 结束报警时间
|
|
||||||
**/
|
|
||||||
private Date breakTime;
|
|
||||||
/**
|
|
||||||
* 故障类型
|
|
||||||
**/
|
|
||||||
private String breakType;
|
|
||||||
/**
|
|
||||||
* 故障状态 是否警告
|
|
||||||
**/
|
|
||||||
private Integer breakState;
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLog
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 15:07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class BreakLog {
|
|
||||||
|
|
||||||
/** 故障日志id */
|
|
||||||
private Integer breakLogId;
|
|
||||||
/** 故障码 */
|
|
||||||
private String breakCode;
|
|
||||||
/** 车辆VIN */
|
|
||||||
private String breakVin;
|
|
||||||
/** 故障类型 */
|
|
||||||
private String breakType;
|
|
||||||
/** 结束报警时间 */
|
|
||||||
private Date breakTime;
|
|
||||||
/** 开始报警时间 */
|
|
||||||
private Date breakDate;
|
|
||||||
/** 是否报警 */
|
|
||||||
private String breakState;
|
|
||||||
/** 逻辑删除 */
|
|
||||||
private Integer breakDel;
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障对象 business_break
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class BusinessBreak extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** id */
|
|
||||||
private Long breakId;
|
|
||||||
|
|
||||||
/** 故障码 */
|
|
||||||
@Excel(name = "故障码")
|
|
||||||
private String breakCode;
|
|
||||||
|
|
||||||
/** 车辆VIN */
|
|
||||||
@Excel(name = "车辆VIN")
|
|
||||||
private String breakVin;
|
|
||||||
|
|
||||||
/** 结束报警时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date breakTime;
|
|
||||||
|
|
||||||
/** 故障类型 */
|
|
||||||
@Excel(name = "故障类型")
|
|
||||||
private String breakType;
|
|
||||||
|
|
||||||
/** 开始报警时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date breakDate;
|
|
||||||
|
|
||||||
/** 是否警告 */
|
|
||||||
@Excel(name = "是否警告")
|
|
||||||
private String breakState;
|
|
||||||
|
|
||||||
public void setBreakId(Long breakId)
|
|
||||||
{
|
|
||||||
this.breakId = breakId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getBreakId()
|
|
||||||
{
|
|
||||||
return breakId;
|
|
||||||
}
|
|
||||||
public void setBreakCode(String breakCode)
|
|
||||||
{
|
|
||||||
this.breakCode = breakCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakCode()
|
|
||||||
{
|
|
||||||
return breakCode;
|
|
||||||
}
|
|
||||||
public void setBreakVin(String breakVin)
|
|
||||||
{
|
|
||||||
this.breakVin = breakVin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakVin()
|
|
||||||
{
|
|
||||||
return breakVin;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setBreakType(String breakType)
|
|
||||||
{
|
|
||||||
this.breakType = breakType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakType()
|
|
||||||
{
|
|
||||||
return breakType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBreakState(String breakState)
|
|
||||||
{
|
|
||||||
this.breakState = breakState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakState()
|
|
||||||
{
|
|
||||||
return breakState;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("breakId", getBreakId())
|
|
||||||
.append("breakCode", getBreakCode())
|
|
||||||
.append("breakVin", getBreakVin())
|
|
||||||
.append("breakTime", getBreakTime())
|
|
||||||
.append("breakType", getBreakType())
|
|
||||||
.append("breakDate", getBreakDate())
|
|
||||||
.append("breakState", getBreakState())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("business_markers")
|
|
||||||
public class Markers extends BaseEntity {
|
|
||||||
|
|
||||||
@TableId(value = "markers_id", type = IdType.AUTO)
|
|
||||||
@Excel(name = "标识编号")
|
|
||||||
private Long markersId;
|
|
||||||
|
|
||||||
@TableField("markers_name")
|
|
||||||
@Excel(name = "标识名称")
|
|
||||||
private String markersName;
|
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
List<Long> fenceIds;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,71 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆信息对象 business_vehicle
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@TableName("business_vehicle")
|
|
||||||
public class Vehicle extends BaseEntity {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆ID
|
|
||||||
*/
|
|
||||||
@Excel(name = "车辆ID",cellType = Excel.ColumnType.NUMERIC)
|
|
||||||
@TableId(value = "vehicle_id",type = IdType.AUTO)
|
|
||||||
private Long vehicleId;
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
*/
|
|
||||||
@TableField("vehicle_vin")
|
|
||||||
private String vehicleVIN;
|
|
||||||
/**
|
|
||||||
* 车辆类型编号
|
|
||||||
*/
|
|
||||||
private Long vehicleTypeId;
|
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private Long vehicleTypeName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 电机厂商
|
|
||||||
*/
|
|
||||||
private String vehicleMotor;
|
|
||||||
/**
|
|
||||||
* 电池厂商
|
|
||||||
*/
|
|
||||||
private String vehicleBattery;
|
|
||||||
/**
|
|
||||||
* 电机ID
|
|
||||||
*/
|
|
||||||
private String motorId;
|
|
||||||
/**
|
|
||||||
* 电池ID
|
|
||||||
*/
|
|
||||||
private String batteryId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆状态
|
|
||||||
*/
|
|
||||||
private Long vehicleState;
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
private List<Long> markersIds;
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
|
||||||
@TableName(value = "business_vehicle_type")
|
|
||||||
public class VehicleType {
|
|
||||||
|
|
||||||
@TableId(value = "vehicle_type_id", type = IdType.AUTO)
|
|
||||||
@Excel(name = "车型ID")
|
|
||||||
private Long vehicleTypeId;
|
|
||||||
|
|
||||||
@Excel(name = "车型名称")
|
|
||||||
@TableField(value = "vehicle_type_name")
|
|
||||||
private String vehicleTypeName;
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.zhilian.business.domain.middle;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@TableName("business_markers_fence")
|
|
||||||
public class MarkersFence {
|
|
||||||
/**
|
|
||||||
* 车辆标识编号
|
|
||||||
*/
|
|
||||||
@TableId(value = "markers_id",type = IdType.INPUT)
|
|
||||||
private Long markerId;
|
|
||||||
@TableField(value = "fence_id",insertStrategy = FieldStrategy.IGNORED)
|
|
||||||
private Long fenceId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Long getMarkerId() {
|
|
||||||
return markerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMarkerId(Long markerId) {
|
|
||||||
this.markerId = markerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getFenceId() {
|
|
||||||
return fenceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFenceId(Long fenceId) {
|
|
||||||
this.fenceId = fenceId;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.zhilian.business.domain.middle;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
@TableName("business_vehicle_markers")
|
|
||||||
public class VehicleMarkers {
|
|
||||||
/**
|
|
||||||
* 车辆编号
|
|
||||||
*/
|
|
||||||
@TableId(value = "vehicle_id",type = IdType.INPUT)
|
|
||||||
private Long vehicleId;
|
|
||||||
/**
|
|
||||||
* 车辆标识编号
|
|
||||||
*/
|
|
||||||
@TableField(value = "markers_id",insertStrategy = FieldStrategy.IGNORED)
|
|
||||||
private Long markersId;
|
|
||||||
|
|
||||||
public Long getVehicleId() {
|
|
||||||
return vehicleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVehicleId(Long vehicleId) {
|
|
||||||
this.vehicleId = vehicleId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getMarkersId() {
|
|
||||||
return markersId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMarkersId(Long markersId) {
|
|
||||||
this.markersId = markersId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.zhilian.business.domain.vo;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class MarkersVo {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
package com.zhilian.business.domain.vo;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class VehicleVo {
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
*/
|
|
||||||
private String vehicleVIN;
|
|
||||||
/**
|
|
||||||
* 车辆类型编号
|
|
||||||
*/
|
|
||||||
private Long vehicleTypeId;
|
|
||||||
/**
|
|
||||||
* 电子围栏编号
|
|
||||||
*/
|
|
||||||
private Long fenceId;
|
|
||||||
/**
|
|
||||||
* 电机厂商
|
|
||||||
*/
|
|
||||||
private String motorBusiness;
|
|
||||||
/**
|
|
||||||
* 电池厂商
|
|
||||||
*/
|
|
||||||
private String batteryBusiness;
|
|
||||||
/**
|
|
||||||
* 电机ID
|
|
||||||
*/
|
|
||||||
private String motorID;
|
|
||||||
/**
|
|
||||||
* 电池ID
|
|
||||||
*/
|
|
||||||
private String batteryID;
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.zhilian.business.remote;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Break;
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.remote.factory.RemoteBreakFallbackFactory;
|
|
||||||
import com.zhilian.common.core.constant.ServiceNameConstants;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import lombok.extern.java.Log;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
@FeignClient(contextId = "remoteBreakService", value = ServiceNameConstants.BUSINESS_SERVICE, fallbackFactory = RemoteBreakFallbackFactory.class)
|
|
||||||
public interface RemoteBreakService {
|
|
||||||
/**
|
|
||||||
* 新增故障
|
|
||||||
*/
|
|
||||||
@PostMapping("logAdd")
|
|
||||||
public Result logAdd(@RequestBody BreakLog breakLog);
|
|
||||||
|
|
||||||
@GetMapping("/checkIfBreakLogExists/{breakCode}/{breakVin}")
|
|
||||||
public ResponseEntity<Boolean> checkIfBreakLogExists(@PathVariable("breakCode") String breakCode, @PathVariable("breakVin") String breakVin);
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
package com.zhilian.business.remote;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public interface RemoteFenceService {
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.zhilian.business.remote;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory;
|
|
||||||
import com.zhilian.common.core.constant.ServiceNameConstants;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
@FeignClient(contextId = "remoteVehicleService", value = ServiceNameConstants.VIEHICLE_SERVICE, fallbackFactory = RemoteVehicleFallbackFactory.class)
|
|
||||||
public interface RemoteVehicleService {
|
|
||||||
// @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
||||||
// public Result<SysFile> upload (@RequestPart(value = "file") MultipartFile file);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据VIN获取车辆信息
|
|
||||||
* @param vehicleVIN
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicle/getMarkersByVIN/{vehicleVIN}")
|
|
||||||
public Result<Vehicle> getVehicleByVIN(@PathVariable("vehicleVIN") String vehicleVIN);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新车辆状态
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicle/updateState")
|
|
||||||
public Result updateState(@RequestBody Vehicle vehicle);
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.zhilian.business.remote.factory;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.remote.RemoteBreakService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class RemoteBreakFallbackFactory implements FallbackFactory<RemoteBreakService> {
|
|
||||||
@Override
|
|
||||||
public RemoteBreakService create(Throwable cause) {
|
|
||||||
return new RemoteBreakService() {
|
|
||||||
@Override
|
|
||||||
public Result logAdd(BreakLog breakLog) {
|
|
||||||
log.error("故障日志服务调用失败");
|
|
||||||
return Result.error(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResponseEntity<Boolean> checkIfBreakLogExists(String breakCode, String breakVin) {
|
|
||||||
log.error("根据VIN和故障码查询服务调用失败");
|
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// return new RemoteBreakService() {
|
|
||||||
// @Override
|
|
||||||
// public Result add(BusinessBreak businessBreak) {
|
|
||||||
// log.error("故障日志服务调用失败");
|
|
||||||
// return Result.error("故障日志服务调用失败");
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.zhilian.business.remote.factory;
|
|
||||||
|
|
||||||
import com.zhilian.common.core.constant.ServiceNameConstants;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
|
|
||||||
//@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
|
||||||
public class RemoteFenceFallbackFactory {
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.zhilian.business.remote.factory;
|
|
||||||
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.remote.RemoteVehicleService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class RemoteVehicleFallbackFactory implements FallbackFactory<RemoteVehicleService> {
|
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(RemoteVehicleFallbackFactory.class);
|
|
||||||
@Override
|
|
||||||
public RemoteVehicleService create(Throwable throwable) {
|
|
||||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
|
||||||
return new RemoteVehicleService() {
|
|
||||||
@Override
|
|
||||||
public Result<Vehicle> getVehicleByVIN(String vehicleVIN) {
|
|
||||||
return Result.error("获取车辆信息失败:" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result updateState(Vehicle vehicle) {
|
|
||||||
return Result.error("更新车辆状态失败:" + throwable.getMessage());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
|
|
||||||
com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
|
|
||||||
com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory
|
|
|
@ -20,13 +20,4 @@ public class ServiceNameConstants {
|
||||||
* 文件服务的serviceid
|
* 文件服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String FILE_SERVICE = "zhilian-file";
|
public static final String FILE_SERVICE = "zhilian-file";
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务服务的serviceid
|
|
||||||
*/
|
|
||||||
public static final String BUSINESS_SERVICE = "zhilian-business";
|
|
||||||
/**
|
|
||||||
* 车辆服务的serviceid
|
|
||||||
*/
|
|
||||||
public static final String VIEHICLE_SERVICE = "zhilian-vehicle";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 响应信息主体
|
* 响应信息主体
|
||||||
|
|
|
@ -1,27 +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.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>zhilian-common-event</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.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-redis</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.zhilian.common.event;
|
|
||||||
|
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class VehicleEventCache {
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
|
|
||||||
public String encode(String vin){
|
|
||||||
return "event:arr"+vin;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEvent(String vin ,String eventName){
|
|
||||||
redisService.setCacheSet(encode(vin),eventName);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
package com.zhilian.common.event;
|
|
||||||
|
|
||||||
public interface VehicleEventConstants {
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
com.zhilian.common.event.VehicleEventCache
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zhilian.common.redis.service;
|
package com.zhilian.common.redis.service;
|
||||||
|
|
||||||
|
import io.lettuce.core.output.DoubleListOutput;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.*;
|
import org.springframework.data.redis.core.*;
|
||||||
|
@ -153,19 +154,6 @@ public class RedisService {
|
||||||
return setOperation;
|
return setOperation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 缓存Set
|
|
||||||
*
|
|
||||||
* @param key 缓存键值
|
|
||||||
* @param setValue 缓存的数据
|
|
||||||
* @return 缓存数据的对象
|
|
||||||
*/
|
|
||||||
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final T setValue) {
|
|
||||||
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
|
|
||||||
setOperation.add(setValue);
|
|
||||||
return setOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的set
|
* 获得缓存的set
|
||||||
*
|
*
|
||||||
|
@ -271,7 +259,6 @@ public class RedisService {
|
||||||
redisTemplate.opsForZSet().add(zkey, collect);
|
redisTemplate.opsForZSet().add(zkey, collect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取Zset集合大小
|
* 获取Zset集合大小
|
||||||
*
|
*
|
||||||
|
@ -308,7 +295,6 @@ public class RedisService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 范围查询集合携带分数
|
* 范围查询集合携带分数
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @param start
|
* @param start
|
||||||
* @param end
|
* @param end
|
||||||
|
@ -327,62 +313,57 @@ public class RedisService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改对应键值分数,delta为正数则增加,为负数则减少
|
* 增加分数
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @param value
|
* @param value
|
||||||
* @param delta
|
* @param delta
|
||||||
* @param <T>
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public <T> Double incrementScore(final String zkey, final T value, final Double delta) {
|
public <T> Double incrementScore(final String zkey, final T value, final Double delta){
|
||||||
return redisTemplate.opsForZSet().incrementScore(zkey, value, delta);
|
return redisTemplate.opsForZSet().incrementScore(zkey,value,delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除元素
|
* 删除元素
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @param values
|
* @param values
|
||||||
* @param <T>
|
|
||||||
* @return
|
* @return
|
||||||
|
* @param <T>
|
||||||
*/
|
*/
|
||||||
public <T> Long removeCacheZsetBatch(final String zkey, final T... values) {
|
public <T> Long removeCacheZsetBatch(final String zkey,final T... values){
|
||||||
return redisTemplate.opsForZSet().remove(zkey, values);
|
return redisTemplate.opsForZSet().remove(zkey,values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序并限制结果集大小,按降序返回有序集合的部分元素,支持指定索引范围。
|
* 排序并限制结果集大小,按降序返回有序集合的部分元素,支持指定索引范围。
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @param start
|
* @param start
|
||||||
* @param end
|
* @param end
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Double> reverseRange(final String zkey, final Long start, final Long end) {
|
public Set<Double> reverseRange(final String zkey,final Long start,final Long end){
|
||||||
return redisTemplate.opsForZSet().reverseRange(zkey, start, end);
|
return redisTemplate.opsForZSet().reverseRange(zkey,start,end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按分数范围查询
|
* 按分数范围查询
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @param min
|
* @param min
|
||||||
* @param max
|
* @param max
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<Double> rangeByScore(final String zkey, final Double min, final Double max) {
|
public Set<Double> rangeByScore(final String zkey,final Double min,final Double max){
|
||||||
return redisTemplate.opsForZSet().rangeByScore(zkey, min, max);
|
return redisTemplate.opsForZSet().rangeByScore(zkey,min,max);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最小值
|
* 获取最小值
|
||||||
*
|
|
||||||
* @param zkey
|
* @param zkey
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ZSetOperations.TypedTuple getCacheZsetMin(final String zkey) {
|
public Map<Object, Double> getCacheZsetMin(final String zkey){
|
||||||
ZSetOperations.TypedTuple typedTuple = redisTemplate.opsForZSet().popMin(zkey);
|
ZSetOperations.TypedTuple typedTuple = redisTemplate.opsForZSet().popMin(zkey);
|
||||||
return typedTuple;
|
return new HashMap<Object,Double>(){{put(typedTuple.getValue(),typedTuple.getScore());}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -395,44 +376,4 @@ public class RedisService {
|
||||||
public Collection<String> keys(final String pattern) {
|
public Collection<String> keys(final String pattern) {
|
||||||
return redisTemplate.keys(pattern);
|
return redisTemplate.keys(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCacheSet(final String key) {
|
|
||||||
SetOperations setOperations = redisTemplate.opsForSet();
|
|
||||||
setOperations.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T> void deleteCacheSetValue(final String key, final T value) {
|
|
||||||
SetOperations setOperations = redisTemplate.opsForSet();
|
|
||||||
setOperations.remove(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public <T> void deleteCacheZsetValue(final String key, final T value) {
|
|
||||||
ZSetOperations zSetOperations = redisTemplate.opsForZSet();
|
|
||||||
zSetOperations.remove(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 根据下标获取List中value
|
|
||||||
* @author: LiYuan
|
|
||||||
* @param: key ,index 下标
|
|
||||||
* @return: value
|
|
||||||
**/
|
|
||||||
public <T> T getcacheListValue(final String key, final Long index) {
|
|
||||||
ListOperations listOperations = redisTemplate.opsForList();
|
|
||||||
|
|
||||||
return (T) listOperations.index(key, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description: 增加String类型中缓存值
|
|
||||||
* @author: LiYuan
|
|
||||||
* @param: key,number
|
|
||||||
* @return: Long 增加后的值
|
|
||||||
**/
|
|
||||||
public Long increment(final String key,final Long number) {
|
|
||||||
ValueOperations valueOperations = redisTemplate.opsForValue();
|
|
||||||
return valueOperations.increment(key,number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件服务
|
* 文件服务
|
||||||
|
*
|
||||||
* @author zhilian
|
* @author zhilian
|
||||||
*/
|
*/
|
||||||
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -34,8 +36,8 @@ spring:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
dataId: sentinel-zhilian-gateway
|
dataId: sentinel-zhilian-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
rule-type: gw-flow
|
rule-type: gw-flow
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
<module>zhilian-resolver</module>
|
<module>zhilian-resolver</module>
|
||||||
<module>zhilian-business</module>
|
<module>zhilian-business</module>
|
||||||
<module>zhilian-manager</module>
|
<module>zhilian-manager</module>
|
||||||
<module>zhilian-message</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>zhilian-modules</artifactId>
|
<artifactId>zhilian-modules</artifactId>
|
||||||
|
|
|
@ -73,12 +73,6 @@
|
||||||
<artifactId>zhilian-common-log</artifactId>
|
<artifactId>zhilian-common-log</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-business</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- zhilian Common Swagger -->
|
<!-- zhilian Common Swagger -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zhilian</groupId>
|
<groupId>com.zhilian</groupId>
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
package com.zhilian.business;
|
|
||||||
|
|
||||||
import com.zhilian.business.controller.FenceController;
|
|
||||||
import com.zhilian.business.controller.VehicleController;
|
|
||||||
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
|
||||||
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BelongsProject: smart-cloud-server
|
|
||||||
* @BelongsPackage: com.zhilian.business
|
|
||||||
* @Description 启动类
|
|
||||||
* @Author: LiYuan
|
|
||||||
* @CreateTime: 2024-03-31 10:13
|
|
||||||
* @Description: 业务模块启动类
|
|
||||||
* @Version: 1.0
|
|
||||||
*/
|
|
||||||
@EnableCustomConfig
|
|
||||||
@EnableCustomSwagger2
|
|
||||||
@EnableMyFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class ZhiLianBusinessApplication implements ApplicationRunner {
|
|
||||||
@Autowired
|
|
||||||
private VehicleController vehicleController;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FenceController fenceController;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(ZhiLianBusinessApplication.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
|
||||||
fenceController.fenceRedisData();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.zhilian.business;
|
||||||
|
|
||||||
|
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: smart-cloud-server
|
||||||
|
* @BelongsPackage: com.zhilian.business
|
||||||
|
* @Author: LiYuan
|
||||||
|
* @CreateTime: 2024-03-31 10:13
|
||||||
|
* @Description: TODO
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableCustomSwagger2
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ZhilianBusinessApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ZhilianBusinessApplication.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,102 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Break;
|
|
||||||
import com.zhilian.business.domain.BreakVo;
|
|
||||||
import com.zhilian.business.service.BreakService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.page.PageResult;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakController
|
|
||||||
* @Description 故障业务实现
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:40
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
public class BreakController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BreakService breakService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description // 故障列表
|
|
||||||
* @Date 2024/4/4
|
|
||||||
* @param breakVo
|
|
||||||
* @return com.zhilian.common.core.domain.Result<com.zhilian.common.core.web.page.PageResult<com.zhilian.business.domain.Break>>
|
|
||||||
**/
|
|
||||||
@PostMapping("breakList")
|
|
||||||
public Result<PageResult<Break>> breakList(@RequestBody BreakVo breakVo) {
|
|
||||||
PageResult<Break> pageResult = breakService.breakList(breakVo);
|
|
||||||
return Result.success(pageResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description // 故障添加
|
|
||||||
* @Date 2024/4/4
|
|
||||||
* @param break1
|
|
||||||
* @return com.zhilian.common.core.domain.Result
|
|
||||||
**/
|
|
||||||
@PostMapping("breakAdd")
|
|
||||||
public Result breakAdd(@RequestBody Break break1) {
|
|
||||||
int i = breakService.breakAdd(break1);
|
|
||||||
Result<Integer> success = Result.success(i);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description // 故障修改
|
|
||||||
* @Date 2024/4/4
|
|
||||||
* @param break1
|
|
||||||
* @return com.zhilian.common.core.domain.Result
|
|
||||||
**/
|
|
||||||
@PostMapping("breakUpd")
|
|
||||||
public Result breadUpd(@RequestBody Break break1) {
|
|
||||||
int i = breakService.breakUpd(break1);
|
|
||||||
Result<Integer> success = Result.success(i);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description // 故障删除
|
|
||||||
* @Date 2024/4/4
|
|
||||||
* @param breakId
|
|
||||||
* @return com.zhilian.common.core.domain.Result
|
|
||||||
**/
|
|
||||||
@PostMapping("breakDel/{breakId}")
|
|
||||||
public Result delFirm(@PathVariable Integer breakId){
|
|
||||||
int i = breakService.breakDel(breakId);
|
|
||||||
Result<Integer> success = Result.success(i);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.service.BreakLogService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLogController
|
|
||||||
* @Description 故障日志业务实现
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 20:48
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
public class BreakLogController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BreakLogService breakLogService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description //故障日志列表
|
|
||||||
* @Date 2024/4/10
|
|
||||||
* @return com.zhilian.common.core.domain.Result<java.util.List<com.zhilian.business.domain.BreakLog>>
|
|
||||||
**/
|
|
||||||
@PostMapping("log")
|
|
||||||
public Result<List<BreakLog>> breakLog() {
|
|
||||||
List<BreakLog> list = breakLogService.breakLog();
|
|
||||||
Result<List<BreakLog>> success = Result.success(list);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description //故障日志添加
|
|
||||||
* @Date 2024/4/10
|
|
||||||
* @param breakLog
|
|
||||||
* @return com.zhilian.common.core.domain.Result
|
|
||||||
**/
|
|
||||||
@PostMapping("logAdd")
|
|
||||||
public Result logAdd(@RequestBody BreakLog breakLog){
|
|
||||||
int i = breakLogService.logAdd(breakLog);
|
|
||||||
Result<Integer> success = Result.success(i);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description // 故障日志修改
|
|
||||||
* @Date 2024/4/10
|
|
||||||
* @param breakLog
|
|
||||||
* @return com.zhilian.common.core.domain.Result
|
|
||||||
**/
|
|
||||||
@PostMapping("updLog")
|
|
||||||
public Result updLog(@RequestBody BreakLog breakLog){
|
|
||||||
int i = breakLogService.updLog(breakLog);
|
|
||||||
Result<Integer> success = Result.success(i);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("logDel/{breakLogId}")
|
|
||||||
public Result logDel(@PathVariable Integer breakLogId){
|
|
||||||
int del = breakLogService.logDel(breakLogId);
|
|
||||||
Result<Integer> success = Result.success(del);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据故障码和vin判断数据库中是否有数据
|
|
||||||
* @param breakCode
|
|
||||||
* @param breakVin
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/checkIfBreakLogExists/{breakCode}/{breakVin}")
|
|
||||||
public ResponseEntity <Boolean> checkIfBreakLogExists(@PathVariable("breakCode") String breakCode,@PathVariable("breakVin") String breakVin){
|
|
||||||
boolean exists =breakLogService.checkIfBreakLogExists(breakCode,breakVin);
|
|
||||||
return ResponseEntity.ok(exists);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,116 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.request.BreakReq;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.zhilian.common.log.annotation.Log;
|
|
||||||
import com.zhilian.common.log.enums.BusinessType;
|
|
||||||
import com.zhilian.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.service.IBusinessBreakService;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.utils.poi.ExcelUtil;
|
|
||||||
import com.zhilian.common.core.web.page.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障Controller
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/break")
|
|
||||||
public class BusinessBreakController extends BaseController{
|
|
||||||
@Autowired
|
|
||||||
private IBusinessBreakService businessBreakService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障列表
|
|
||||||
*/
|
|
||||||
// @RequiresPermissions("business:break:list")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public Result<TableDataInfo<BusinessBreak>> list(BreakReq breakReq)
|
|
||||||
{
|
|
||||||
startPage();
|
|
||||||
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(breakReq);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出故障列表
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("business:break:export")
|
|
||||||
@Log(title = "故障", businessType = BusinessType.EXPORT)
|
|
||||||
@PostMapping("/export")
|
|
||||||
public void export(HttpServletResponse response, BreakReq breakReq)
|
|
||||||
{
|
|
||||||
List<BusinessBreak> list = businessBreakService.selectBusinessBreakList(breakReq);
|
|
||||||
ExcelUtil<BusinessBreak> util = new ExcelUtil<BusinessBreak>(BusinessBreak.class);
|
|
||||||
util.exportExcel(response, list, "故障数据");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取故障详细信息
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("business:break:query")
|
|
||||||
@GetMapping(value = "/{breakId}")
|
|
||||||
public Result getInfo(@PathVariable("breakId") Long breakId)
|
|
||||||
{
|
|
||||||
return success(businessBreakService.selectBusinessBreakByBreakId(breakId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增故障
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("business:break:add")
|
|
||||||
@Log(title = "故障", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public Result add(@RequestBody BusinessBreak businessBreak)
|
|
||||||
{
|
|
||||||
return toAjax(businessBreakService.insertBusinessBreak(businessBreak));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改故障
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("business:break:edit")
|
|
||||||
@Log(title = "故障", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public Result edit(@RequestBody BusinessBreak businessBreak)
|
|
||||||
{
|
|
||||||
return toAjax(businessBreakService.updateBusinessBreak(businessBreak));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除故障
|
|
||||||
*/
|
|
||||||
@RequiresPermissions("business:break:remove")
|
|
||||||
@Log(title = "故障", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{breakIds}")
|
|
||||||
public Result remove(@PathVariable Long[] breakIds)
|
|
||||||
{
|
|
||||||
return toAjax(businessBreakService.deleteBusinessBreakByBreakIds(breakIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障日志
|
|
||||||
*/
|
|
||||||
@PostMapping("breakLog")
|
|
||||||
public Result<List<BreakLog>> breakLog(){
|
|
||||||
List<BreakLog> list = businessBreakService.breakLog();
|
|
||||||
Result<List<BreakLog>> success = Result.success(list);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +1,16 @@
|
||||||
package com.zhilian.business.controller;
|
package com.zhilian.business.controller;
|
||||||
|
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.zhilian.common.core.domain.Result;
|
import com.zhilian.common.core.domain.Result;
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
import com.zhilian.common.core.web.controller.BaseController;
|
||||||
|
import com.zhilian.business.domain.Fence;
|
||||||
|
import com.zhilian.business.domain.FenceVo;
|
||||||
import com.zhilian.business.service.FenceService;
|
import com.zhilian.business.service.FenceService;
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
|
||||||
import com.zhilian.common.security.utils.SecurityUtils;
|
import com.zhilian.common.security.utils.SecurityUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName FenceController
|
* @ClassName FenceController
|
||||||
* @Description 电子围栏控制层
|
* @Description 电子围栏控制层
|
||||||
|
@ -25,23 +24,11 @@ public class FenceController extends BaseController {
|
||||||
private FenceService fenceService;
|
private FenceService fenceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子围栏列表
|
* TODO: 围栏管理
|
||||||
* @param fence
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public Result<TableDataInfo<Fence>> fenceList(@RequestBody Fence fence) {
|
public Result<PageInfo<Fence>> fenceList(@RequestBody FenceVo fenceVo) {
|
||||||
startPage();
|
return success(fenceService.fenceList(fenceVo));
|
||||||
List<Fence> result = fenceService.fenceList(fence);
|
|
||||||
return getDataTable(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加所有围栏信息进入redis
|
|
||||||
*/
|
|
||||||
public void fenceRedisData() {
|
|
||||||
fenceService.fenceRedisData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,34 +38,24 @@ public class FenceController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/fenceAdd")
|
@PostMapping("/fenceAdd")
|
||||||
public Result fenceAdd(@RequestBody Fence fence) {
|
public Result fenceAdd(@RequestBody Fence fence) {
|
||||||
fence.setUpdateBy(SecurityUtils.getUsername());
|
boolean i = fenceService.save(fence);
|
||||||
fence.setUpdateTime(new Date());
|
return toAjax(i);
|
||||||
return toAjax(fenceService.saveFence(fence));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @PostMapping("insertFence")
|
||||||
|
// public Result insertFence(@RequestBody Fence fence) {
|
||||||
|
// Result result = fenceService.insertFence(fence);
|
||||||
|
// return Result.success();
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改围栏信息
|
* 修改电子围栏
|
||||||
* @param fence
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
|
// @RequiresPermissions("system:config:fenceAdd")
|
||||||
@PostMapping("/fenceUpdate")
|
@PostMapping("/fenceUpdate")
|
||||||
public Result fenceUpdate(@RequestBody Fence fence) {
|
public Result fenceUpdate(@RequestBody Fence fence) {
|
||||||
fence.setUpdateBy(SecurityUtils.getUsername());
|
boolean i = fenceService.updateById(fence);
|
||||||
fence.setUpdateTime(new Date());
|
return toAjax(i);
|
||||||
return toAjax(fenceService.updateById(fence));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改电子围栏地图
|
|
||||||
* @param fence
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/fenceUpdateMap")
|
|
||||||
public Result fenceUpdateMap(@RequestBody Fence fence) {
|
|
||||||
fence.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
fence.setUpdateTime(new Date());
|
|
||||||
return toAjax(fenceService.updateByMap(fence));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,9 +64,9 @@ public class FenceController extends BaseController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/fenceDelete/{fenceId}")
|
@PostMapping("/fenceDelete/{fenceId}")
|
||||||
public Result fenceDelete(@PathVariable Long fenceId) {
|
public Result fenceDelete(@PathVariable String fenceId) {
|
||||||
return toAjax(fenceService.removeByFence(fenceId));
|
boolean i = fenceService.removeById(fenceId);
|
||||||
|
return toAjax(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,119 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import com.zhilian.business.service.MarkersFenceService;
|
|
||||||
import com.zhilian.business.service.MarkersService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
|
||||||
import com.zhilian.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
/**
|
|
||||||
* @ClassName MarkersController
|
|
||||||
* @Description 车辆标识控制层
|
|
||||||
* @Author ZeJinG.Su
|
|
||||||
* @Date 15:31 2024/4/8
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/markers")
|
|
||||||
public class MarkersController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private MarkersService markersService;
|
|
||||||
@Autowired
|
|
||||||
private MarkersFenceService markersFenceService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆标识列表
|
|
||||||
* @param markers
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("list")
|
|
||||||
public Result<TableDataInfo<Markers>> list(@RequestBody Markers markers) {
|
|
||||||
startPage();
|
|
||||||
List<Markers> result = markersService.selectMarkersList(markers);
|
|
||||||
return getDataTable(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆标识全部数据
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("markersVehicle")
|
|
||||||
public Result<List<Markers>> markersVehicle() {
|
|
||||||
List<Markers> listMarkers = markersService.listMarkers();
|
|
||||||
return Result.success(listMarkers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增车辆标识
|
|
||||||
* @param markers
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("insert")
|
|
||||||
public Result insert(@RequestBody Markers markers){
|
|
||||||
return toAjax(markersService.save(markers));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改车辆标识
|
|
||||||
* @param markers
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("update")
|
|
||||||
public Result update(@RequestBody Markers markers) {
|
|
||||||
markers.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
markers.setUpdateTime(new Date());
|
|
||||||
markersFenceService.removeAllFence(markers);
|
|
||||||
|
|
||||||
//修改原表数据
|
|
||||||
boolean update =markersService.updateById(markers);
|
|
||||||
|
|
||||||
//重新添加中间表数据
|
|
||||||
markersFenceService.insert(markers);
|
|
||||||
|
|
||||||
return toAjax(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除车辆标识
|
|
||||||
* @param markersId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("delete/{markersId}")
|
|
||||||
public Result delete(@PathVariable Long markersId) {
|
|
||||||
markersFenceList(markersId).forEach(markersFence -> {
|
|
||||||
markersFenceService.removeById(markersId);
|
|
||||||
});
|
|
||||||
return toAjax(markersService.removeById(markersId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定电子围栏
|
|
||||||
* @param markers
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("insertMarkersFence")
|
|
||||||
public Result insertMarkersFenceMarkers(@RequestBody Markers markers){
|
|
||||||
boolean insert = markersFenceService.insert(markers);
|
|
||||||
return toAjax(insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询标识与电子围栏中间表信息
|
|
||||||
* @param markersId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("markersFenceList/{markersId}")
|
|
||||||
public List<MarkersFence> markersFenceList(@PathVariable Long markersId){
|
|
||||||
LambdaQueryWrapper<MarkersFence> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(MarkersFence::getMarkerId, markersId);
|
|
||||||
return markersFenceService.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import com.zhilian.business.service.MarkersFenceService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
/**
|
|
||||||
* @ClassName MarkersFenceController
|
|
||||||
* @Description 标识与围栏中间表控制层
|
|
||||||
* @Author ZeJinG.Su
|
|
||||||
* @Date 15:31 2024/4/8
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/markersFence")
|
|
||||||
public class MarkersFenceController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private MarkersFenceService markersFenceService;
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
|
||||||
public Result<List<MarkersFence>> markersFenceList() {
|
|
||||||
return Result.success(markersFenceService.list());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.VehicleFence;
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
import com.zhilian.business.service.MarkersService;
|
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
|
||||||
import com.zhilian.business.service.VehicleService;
|
|
||||||
import com.zhilian.business.service.VehicleTypeService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import com.zhilian.common.core.web.page.TableDataInfo;
|
|
||||||
import com.zhilian.common.security.utils.SecurityUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/vehicle")
|
|
||||||
public class VehicleController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private VehicleService vehicleService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VehicleMarkersService vehicleMarkersService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VehicleTypeService vehicleTypeService;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MarkersService markersService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆列表
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/list")
|
|
||||||
public Result<TableDataInfo<Vehicle>> list(@RequestBody Vehicle vehicle) {
|
|
||||||
startPage();
|
|
||||||
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/vehicleSelectAllData")
|
|
||||||
public List<VehicleFence> vehicleSelectAllData(){
|
|
||||||
List<VehicleFence> selectSelectAllData = vehicleService.selectSelectAllData();
|
|
||||||
return selectSelectAllData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增车辆
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicleInsert")
|
|
||||||
public Result vehicleInsert(@RequestBody Vehicle vehicle){
|
|
||||||
vehicle.setCreateBy(SecurityUtils.getUsername());
|
|
||||||
vehicle.setCreateTime(new Date());
|
|
||||||
return toAjax(vehicleService.save(vehicle));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改车辆
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicleUpdate")
|
|
||||||
public Result vehicleUpdate(@RequestBody Vehicle vehicle){
|
|
||||||
vehicle.setUpdateBy(SecurityUtils.getUsername());
|
|
||||||
vehicle.setUpdateTime(new Date());
|
|
||||||
|
|
||||||
//删除中间表全部关联数据
|
|
||||||
vehicleMarkersService.removeAllVehicle(vehicle);
|
|
||||||
|
|
||||||
//修改原表数据
|
|
||||||
boolean update =vehicleService.updateById(vehicle);
|
|
||||||
|
|
||||||
//重新添加中间表数据
|
|
||||||
vehicleMarkersService.insert(vehicle);
|
|
||||||
|
|
||||||
//判断添加完成后的标识与围栏是否绑定事件 如果没有绑定全部删除围栏事件 然后进行给予绑定
|
|
||||||
vehicleService.selectRedisData(vehicle);
|
|
||||||
return toAjax(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据车辆ID查询车辆与围栏中间表
|
|
||||||
* @param vehicleId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/getVehicleMarkers/{vehicleId}")
|
|
||||||
public List<VehicleMarkers> getVehicleMarkers(@PathVariable Long vehicleId){
|
|
||||||
LambdaQueryWrapper<VehicleMarkers> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(VehicleMarkers::getVehicleId, vehicleId);
|
|
||||||
return vehicleMarkersService.list(queryWrapper);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除车辆
|
|
||||||
* @param vehicleId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicleDelete/{vehicleId}")
|
|
||||||
public Result vehicleDelete(@PathVariable Long vehicleId){
|
|
||||||
getVehicleMarkers(vehicleId).forEach(vehicleMarkers -> {
|
|
||||||
vehicleMarkersService.removeById(vehicleId);
|
|
||||||
});
|
|
||||||
return toAjax(vehicleService.removeById(vehicleId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆绑定围栏
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/vehicleInsertMarkers")
|
|
||||||
public Result vehicleInsertMarkers(@RequestBody Vehicle vehicle){
|
|
||||||
boolean insert = vehicleMarkersService.insert(vehicle);
|
|
||||||
return toAjax(insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据VIN查询车辆信息
|
|
||||||
* @param vehicleVIN
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/getMarkersByVIN/{vehicleVIN}")
|
|
||||||
public Result<Vehicle> getVehicleByVIN(@PathVariable("vehicleVIN") String vehicleVIN) {
|
|
||||||
Vehicle vehicle = vehicleService.getVehicleByVIN(vehicleVIN);
|
|
||||||
// vehicleMarkersService.getById(vehicle.getVehicleId());
|
|
||||||
return Result.success(vehicle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据车辆VIN修改车辆状态
|
|
||||||
* @param vehicle
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/updateState")
|
|
||||||
public Result updateState(@RequestBody Vehicle vehicle) {
|
|
||||||
return toAjax(vehicleService.updateState(vehicle));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/vehicleMarkers")
|
|
||||||
public class VehicleMarkersController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private VehicleMarkersService vehicleMarkersService;
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
|
||||||
public Result<List<VehicleMarkers>> vehicleMarkersList() {
|
|
||||||
return Result.success(vehicleMarkersService.list());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.zhilian.business.controller;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.VehicleType;
|
|
||||||
import com.zhilian.business.service.VehicleTypeService;
|
|
||||||
import com.zhilian.common.core.domain.Result;
|
|
||||||
import com.zhilian.common.core.web.controller.BaseController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("vehicleType")
|
|
||||||
public class VehicleTypeController extends BaseController {
|
|
||||||
@Autowired
|
|
||||||
private VehicleTypeService vehicleTypeService;
|
|
||||||
|
|
||||||
@GetMapping("list")
|
|
||||||
public Result<List<VehicleType>> list(){
|
|
||||||
List<VehicleType> list = vehicleTypeService.listVehicleType();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName Break
|
|
||||||
* @Description 故障实体类
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:40
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Break {
|
|
||||||
/**
|
|
||||||
* 故障id
|
|
||||||
**/
|
|
||||||
private Integer breakId;
|
|
||||||
/**
|
|
||||||
* 故障码
|
|
||||||
**/
|
|
||||||
private String breakCode;
|
|
||||||
/**
|
|
||||||
* 车辆VIN
|
|
||||||
**/
|
|
||||||
private String breakVin;
|
|
||||||
/**
|
|
||||||
* 开始报警时间
|
|
||||||
**/
|
|
||||||
private Date breakDate;
|
|
||||||
/**
|
|
||||||
* 结束报警时间
|
|
||||||
**/
|
|
||||||
private Date breakTime;
|
|
||||||
/**
|
|
||||||
* 故障类型
|
|
||||||
**/
|
|
||||||
private String breakType;
|
|
||||||
/**
|
|
||||||
* 故障状态 是否警告
|
|
||||||
**/
|
|
||||||
private Integer breakState;
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import com.zhilian.common.core.web.page.PageResult;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLog
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 15:07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class BreakLog {
|
|
||||||
|
|
||||||
/** 故障日志id */
|
|
||||||
private Integer breakLogId;
|
|
||||||
/** 故障码 */
|
|
||||||
private String breakCode;
|
|
||||||
/** 车辆VIN */
|
|
||||||
private String breakVin;
|
|
||||||
/** 故障类型 */
|
|
||||||
private String breakType;
|
|
||||||
/** 结束报警时间 */
|
|
||||||
private String breakTime;
|
|
||||||
/** 开始报警时间 */
|
|
||||||
private String breakDate;
|
|
||||||
/** 故障状态 */
|
|
||||||
private String breakState;
|
|
||||||
/** 逻辑删除 */
|
|
||||||
private Integer breakDel;
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakVo
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:51
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class BreakVo {
|
|
||||||
/**
|
|
||||||
* 故障id
|
|
||||||
**/
|
|
||||||
private Integer breakId;
|
|
||||||
/**
|
|
||||||
* 车辆VIN码
|
|
||||||
**/
|
|
||||||
private String breakVin;
|
|
||||||
/**
|
|
||||||
* 故障状态
|
|
||||||
**/
|
|
||||||
private Integer breakState;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页
|
|
||||||
**/
|
|
||||||
private Integer pageNum = 1;
|
|
||||||
private Integer pageSize = 3;
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.zhilian.common.core.annotation.Excel;
|
|
||||||
import com.zhilian.common.core.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障对象 business_break
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class BusinessBreak extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** id */
|
|
||||||
private Long breakId;
|
|
||||||
|
|
||||||
/** 故障码 */
|
|
||||||
@Excel(name = "故障码")
|
|
||||||
private String breakCode;
|
|
||||||
|
|
||||||
/** 车辆VIN */
|
|
||||||
@Excel(name = "车辆VIN")
|
|
||||||
private String breakVin;
|
|
||||||
|
|
||||||
/** 结束报警时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private String breakTime;
|
|
||||||
|
|
||||||
/** 故障类型 */
|
|
||||||
@Excel(name = "故障类型")
|
|
||||||
private String breakType;
|
|
||||||
|
|
||||||
/** 开始报警时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private String breakDate;
|
|
||||||
|
|
||||||
/** 是否警告 */
|
|
||||||
@Excel(name = "是否警告")
|
|
||||||
private String breakState;
|
|
||||||
|
|
||||||
public void setBreakId(Long breakId)
|
|
||||||
{
|
|
||||||
this.breakId = breakId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getBreakId()
|
|
||||||
{
|
|
||||||
return breakId;
|
|
||||||
}
|
|
||||||
public void setBreakCode(String breakCode)
|
|
||||||
{
|
|
||||||
this.breakCode = breakCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakCode()
|
|
||||||
{
|
|
||||||
return breakCode;
|
|
||||||
}
|
|
||||||
public void setBreakVin(String breakVin)
|
|
||||||
{
|
|
||||||
this.breakVin = breakVin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakVin()
|
|
||||||
{
|
|
||||||
return breakVin;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setBreakType(String breakType)
|
|
||||||
{
|
|
||||||
this.breakType = breakType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakType()
|
|
||||||
{
|
|
||||||
return breakType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBreakState(String breakState)
|
|
||||||
{
|
|
||||||
this.breakState = breakState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBreakState()
|
|
||||||
{
|
|
||||||
return breakState;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("breakId", getBreakId())
|
|
||||||
.append("breakCode", getBreakCode())
|
|
||||||
.append("breakVin", getBreakVin())
|
|
||||||
.append("breakTime", getBreakTime())
|
|
||||||
.append("breakType", getBreakType())
|
|
||||||
.append("breakDate", getBreakDate())
|
|
||||||
.append("breakState", getBreakState())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,15 +12,6 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName Fence
|
|
||||||
* @Description 电子围栏实体类
|
|
||||||
* @Author ZeJinG.Su
|
|
||||||
* @Date 15:28 2024/4/8
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -59,6 +50,6 @@ public class Fence extends BaseEntity {
|
||||||
@Excel(name = "电子围栏经纬度信息")
|
@Excel(name = "电子围栏经纬度信息")
|
||||||
@TableField("fence_message")
|
@TableField("fence_message")
|
||||||
private String fenceMessage;
|
private String fenceMessage;
|
||||||
@TableField(exist = false)
|
|
||||||
List<Markers> markersList;
|
|
||||||
}
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.zhilian.business.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName FenceResp //类名称
|
||||||
|
* @Author: yannan //作者
|
||||||
|
* @CreateDate: 2024/3/26 20:03 //创建时间
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class FenceVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
private String fenceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏类型
|
||||||
|
*/
|
||||||
|
private Long fenceTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏状态
|
||||||
|
*/
|
||||||
|
private Long fenceState;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*/
|
||||||
|
private Integer pageNum=1;
|
||||||
|
private Integer pageSize=5;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
package com.zhilian.business.domain;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
|
||||||
@SuperBuilder
|
|
||||||
public class VehicleFence {
|
|
||||||
private Long vehicleId;
|
|
||||||
private String vehicleVIN;
|
|
||||||
private String fences;
|
|
||||||
|
|
||||||
private List<String> fenceIds;
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.zhilian.business.domain.request;
|
|
||||||
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakReq
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 15:28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class BreakReq {
|
|
||||||
/** 故障id */
|
|
||||||
private Integer breakId;
|
|
||||||
/** 故障码 */
|
|
||||||
private String breakCode;
|
|
||||||
/** 车辆VIN */
|
|
||||||
private String breakVin;
|
|
||||||
/** 故障类型 */
|
|
||||||
private String breakType;
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.zhilian.business.domain.request;
|
||||||
|
|
||||||
|
import com.zhilian.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class FenceRequest extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
/**
|
||||||
|
* 电子围栏名称
|
||||||
|
*/
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 电子围栏类型编号
|
||||||
|
*/
|
||||||
|
private Long fenceTypeId;
|
||||||
|
/**
|
||||||
|
* 电子围栏状态
|
||||||
|
*/
|
||||||
|
private Long fenceState;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,32 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLogMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 20:49
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BreakLogMapper {
|
|
||||||
List<BreakLog> breakLog();
|
|
||||||
|
|
||||||
int logAdd(BreakLog breakLog);
|
|
||||||
|
|
||||||
int updLog(BreakLog breakLog);
|
|
||||||
|
|
||||||
int logDel(Integer breakLogId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据故障码和vin判断数据库中是否有数据
|
|
||||||
* @param breakCode
|
|
||||||
* @param breakVin
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
BreakLog findByBreakCodeAndBreakVin(@Param("breakCode") String breakCode, @Param("breakVin") String breakVin);
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Break;
|
|
||||||
import com.zhilian.business.domain.BreakVo;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakMapper
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:59
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BreakMapper {
|
|
||||||
List<Break> breakList(BreakVo breakVo);
|
|
||||||
|
|
||||||
int breakAdd(Break break1);
|
|
||||||
|
|
||||||
int breakUpd(Break break1);
|
|
||||||
|
|
||||||
int breakDel(Integer breakId);
|
|
||||||
|
|
||||||
Integer addBreak(String breakCode, String breakVin, Date breakTime, Date breakDate, String breakType, Integer breakState);
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.domain.request.BreakReq;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障Mapper接口
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BusinessBreakMapper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询故障
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 故障
|
|
||||||
*/
|
|
||||||
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障列表
|
|
||||||
*
|
|
||||||
* @param breakReq 故障
|
|
||||||
* @return 故障集合
|
|
||||||
*/
|
|
||||||
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertBusinessBreak(BusinessBreak businessBreak);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateBusinessBreak(BusinessBreak businessBreak);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除故障
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBusinessBreakByBreakId(Long breakId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除故障
|
|
||||||
*
|
|
||||||
* @param breakIds 需要删除的数据主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
|
|
||||||
|
|
||||||
List<BreakLog> breakLog();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,12 +1,15 @@
|
||||||
package com.zhilian.business.mapper;
|
package com.zhilian.business.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.zhilian.business.domain.Fence;
|
||||||
|
import com.zhilian.business.domain.FenceVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
@Component
|
||||||
public interface FenceMapper extends BaseMapper<Fence> {
|
public interface FenceMapper extends BaseMapper<Fence> {
|
||||||
|
List<Fence> fenceList(FenceVo fenceVo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface MarkersFenceMapper extends BaseMapper<MarkersFence> {
|
|
||||||
boolean deleteBatchFenceIds(List<Long> longs);
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface MarkersMapper extends BaseMapper<Markers> {
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.VehicleFence;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
|
||||||
|
|
||||||
List<VehicleFence> selectListAll();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface VehicleMarkersMapper extends BaseMapper<VehicleMarkers> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.zhilian.business.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.VehicleType;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface VehicleTypeMapper extends BaseMapper<VehicleType> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLogService
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 20:49
|
|
||||||
*/
|
|
||||||
public interface BreakLogService {
|
|
||||||
List<BreakLog> breakLog();
|
|
||||||
|
|
||||||
int logAdd(BreakLog breakLog);
|
|
||||||
|
|
||||||
int updLog(BreakLog breakLog);
|
|
||||||
|
|
||||||
int logDel(Integer breakLogId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据故障码和vin判断数据库中是否有数据
|
|
||||||
* @param breakCode
|
|
||||||
* @param breakVin
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean checkIfBreakLogExists(String breakCode, String breakVin);
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Break;
|
|
||||||
import com.zhilian.business.domain.BreakVo;
|
|
||||||
import com.zhilian.common.core.web.page.PageResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakService
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:54
|
|
||||||
*/
|
|
||||||
public interface BreakService {
|
|
||||||
PageResult<Break> breakList(BreakVo breakVo);
|
|
||||||
|
|
||||||
int breakAdd(Break break1);
|
|
||||||
|
|
||||||
int breakUpd(Break break1);
|
|
||||||
|
|
||||||
int breakDel(Integer breakId);
|
|
||||||
}
|
|
|
@ -1,18 +1,14 @@
|
||||||
package com.zhilian.business.service;
|
package com.zhilian.business.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.zhilian.business.domain.Fence;
|
||||||
|
import com.zhilian.business.domain.FenceVo;
|
||||||
import java.util.List;
|
import com.zhilian.common.core.domain.Result;
|
||||||
|
|
||||||
public interface FenceService extends IService<Fence> {
|
public interface FenceService extends IService<Fence> {
|
||||||
List<Fence> fenceList(Fence fence);
|
PageInfo<Fence> fenceList(FenceVo fenceVo);
|
||||||
|
|
||||||
void fenceRedisData();
|
|
||||||
|
|
||||||
boolean saveFence(Fence fence);
|
// Result insertFence(Fence fence);
|
||||||
|
|
||||||
boolean updateByMap(Fence fence);
|
|
||||||
|
|
||||||
boolean removeByFence(Long fenceId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.domain.request.BreakReq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障Service接口
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
public interface IBusinessBreakService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* 查询故障
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 故障
|
|
||||||
*/
|
|
||||||
public BusinessBreak selectBusinessBreakByBreakId(Long breakId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障列表
|
|
||||||
*
|
|
||||||
* @param breakReq 故障
|
|
||||||
* @return 故障集合
|
|
||||||
*/
|
|
||||||
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int insertBusinessBreak(BusinessBreak businessBreak);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int updateBusinessBreak(BusinessBreak businessBreak);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除故障
|
|
||||||
*
|
|
||||||
* @param breakIds 需要删除的故障主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBusinessBreakByBreakIds(Long[] breakIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除故障信息
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
public int deleteBusinessBreakByBreakId(Long breakId);
|
|
||||||
|
|
||||||
List<BreakLog> breakLog();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
|
|
||||||
public interface MarkersFenceService extends IService<MarkersFence> {
|
|
||||||
boolean insert(Markers markers);
|
|
||||||
|
|
||||||
void removeAllFence(Markers markers);
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MarkersService extends IService<Markers> {
|
|
||||||
List<Markers> selectMarkersList(Markers markers);
|
|
||||||
|
|
||||||
List<Markers> listMarkers();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public interface VehicleMarkersService extends IService<VehicleMarkers> {
|
|
||||||
|
|
||||||
boolean insert(Vehicle vehicle);
|
|
||||||
|
|
||||||
void removeAllVehicle(Vehicle vehicle);
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.VehicleFence;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface VehicleService extends IService<Vehicle> {
|
|
||||||
|
|
||||||
List<Vehicle> selectVehicleList(Vehicle vehicle);
|
|
||||||
|
|
||||||
Vehicle getVehicleByVIN(String vehicleVIN);
|
|
||||||
|
|
||||||
boolean updateState(Vehicle vehicle);
|
|
||||||
|
|
||||||
void selectRedisData(Vehicle vehicle);
|
|
||||||
|
|
||||||
List<VehicleFence> selectSelectAllData();
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zhilian.business.service;
|
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zhilian.business.domain.VehicleType;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface VehicleTypeService extends IService<VehicleType> {
|
|
||||||
|
|
||||||
List<VehicleType> listVehicleType();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.mapper.BreakLogMapper;
|
|
||||||
import com.zhilian.business.service.BreakLogService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakLogServiceImpl
|
|
||||||
* @Description 定时扫描故障状态
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/8 20:49
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Log4j2
|
|
||||||
public class BreakLogServiceImpl implements BreakLogService {
|
|
||||||
@Autowired
|
|
||||||
private BreakLogMapper breakLogMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate<String ,String> redisTemplate;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BreakLog> breakLog() {
|
|
||||||
BreakLog breakLog = new BreakLog();
|
|
||||||
// 10秒
|
|
||||||
final long timeInterval = 10000;
|
|
||||||
Runnable runnable = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (true){
|
|
||||||
breakLogMapper.breakLog();
|
|
||||||
log.info("扫描故障状态");
|
|
||||||
String breakState = breakLog.getBreakState();
|
|
||||||
if (breakState != null){
|
|
||||||
// 判断故障状态
|
|
||||||
if (breakLog.getBreakState().equals("0")){
|
|
||||||
log.info("正常");
|
|
||||||
}else if (breakLog.getBreakState().equals("1")){
|
|
||||||
log.info("故障");
|
|
||||||
}else {
|
|
||||||
log.info("未知");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(timeInterval);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// 开启线程
|
|
||||||
Thread thread = new Thread(runnable);
|
|
||||||
thread.start();
|
|
||||||
// 返回故障日志
|
|
||||||
return breakLogMapper.breakLog();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int logAdd(BreakLog breakLog) {
|
|
||||||
return breakLogMapper.logAdd(breakLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updLog(BreakLog breakLog) {
|
|
||||||
return breakLogMapper.updLog(breakLog);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int logDel(Integer breakLogId) {
|
|
||||||
return breakLogMapper.logDel(breakLogId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据故障码和vin判断数据库中是否有数据
|
|
||||||
* @param breakCode
|
|
||||||
* @param breakVin
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean checkIfBreakLogExists(String breakCode, String breakVin) {
|
|
||||||
BreakLog breakLog =breakLogMapper.findByBreakCodeAndBreakVin(breakCode,breakVin);
|
|
||||||
return breakLog!=null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import com.zhilian.business.domain.Break;
|
|
||||||
import com.zhilian.business.domain.BreakVo;
|
|
||||||
import com.zhilian.business.mapper.BreakMapper;
|
|
||||||
import com.zhilian.business.service.BreakService;
|
|
||||||
import com.zhilian.common.core.web.page.PageResult;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName BreakServiceImpl
|
|
||||||
* @Description TODO
|
|
||||||
* @Author YuanYongH
|
|
||||||
* @Date 2024/4/4 9:54
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BreakServiceImpl implements BreakService {
|
|
||||||
@Autowired
|
|
||||||
private BreakMapper breakMapper;
|
|
||||||
@Override
|
|
||||||
public PageResult<Break> breakList(BreakVo breakVo) {
|
|
||||||
PageHelper.startPage(breakVo.getPageNum(),breakVo.getPageSize());
|
|
||||||
List<Break> list = breakMapper.breakList(breakVo);
|
|
||||||
PageInfo<Break> info = new PageInfo<>(list);
|
|
||||||
return PageResult.toResult(info.getTotal(),list).getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int breakAdd(Break break1) {
|
|
||||||
int i = breakMapper.breakAdd(break1);
|
|
||||||
if (i>0){
|
|
||||||
breakMapper.addBreak(break1.getBreakCode(),break1.getBreakVin(),break1.getBreakTime(),break1.getBreakDate(),break1.getBreakType(),break1.getBreakState());
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int breakUpd(Break break1) {
|
|
||||||
return breakMapper.breakUpd(break1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int breakDel(Integer breakId) {
|
|
||||||
return breakMapper.breakDel(breakId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.zhilian.business.domain.BreakLog;
|
|
||||||
import com.zhilian.business.domain.request.BreakReq;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.zhilian.business.mapper.BusinessBreakMapper;
|
|
||||||
import com.zhilian.business.domain.BusinessBreak;
|
|
||||||
import com.zhilian.business.service.IBusinessBreakService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 故障Service业务层处理
|
|
||||||
*
|
|
||||||
* @author Yy
|
|
||||||
* @date 2024-04-07
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BusinessBreakServiceImpl implements IBusinessBreakService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private BusinessBreakMapper businessBreakMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 故障
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BusinessBreak selectBusinessBreakByBreakId(Long breakId)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.selectBusinessBreakByBreakId(breakId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询故障列表
|
|
||||||
*
|
|
||||||
* @param breakReq 故障
|
|
||||||
* @return 故障
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<BusinessBreak> selectBusinessBreakList(BreakReq breakReq)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.selectBusinessBreakList(breakReq);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertBusinessBreak(BusinessBreak businessBreak)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.insertBusinessBreak(businessBreak);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改故障
|
|
||||||
*
|
|
||||||
* @param businessBreak 故障
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateBusinessBreak(BusinessBreak businessBreak)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.updateBusinessBreak(businessBreak);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除故障
|
|
||||||
*
|
|
||||||
* @param breakIds 需要删除的故障主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBusinessBreakByBreakIds(Long[] breakIds)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.deleteBusinessBreakByBreakIds(breakIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除故障信息
|
|
||||||
*
|
|
||||||
* @param breakId 故障主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBusinessBreakByBreakId(Long breakId)
|
|
||||||
{
|
|
||||||
return businessBreakMapper.deleteBusinessBreakByBreakId(breakId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<BreakLog> breakLog() {
|
|
||||||
return businessBreakMapper.breakLog();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,114 +1,38 @@
|
||||||
package com.zhilian.business.service.impl;
|
package com.zhilian.business.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.zhilian.business.domain.Fence;
|
import com.zhilian.business.domain.Fence;
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
import com.zhilian.business.domain.FenceVo;
|
||||||
import com.zhilian.business.mapper.FenceMapper;
|
import com.zhilian.business.mapper.FenceMapper;
|
||||||
import com.zhilian.business.mapper.MarkersFenceMapper;
|
|
||||||
import com.zhilian.business.mapper.MarkersMapper;
|
|
||||||
import com.zhilian.business.service.FenceService;
|
import com.zhilian.business.service.FenceService;
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
import com.zhilian.common.core.domain.Result;
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private FenceMapper fenceMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MarkersFenceMapper markersFenceMapper;
|
|
||||||
|
|
||||||
private static final String FENCE_INFO_KEY = "fence_info:";
|
|
||||||
//电子围栏信息查询
|
|
||||||
@Override
|
@Override
|
||||||
public List<Fence> fenceList(Fence fence) {
|
public PageInfo<Fence> fenceList(FenceVo fenceVo) {
|
||||||
if (fence.getFenceName() == null && fence.getFenceTypeId() == null && fence.getFenceState() == null) {
|
|
||||||
return this.list();
|
PageHelper.startPage(fenceVo.getPageNum(),fenceVo.getPageSize());
|
||||||
}
|
|
||||||
|
List<Fence> list=fenceMapper.fenceList(fenceVo);
|
||||||
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
|
PageInfo info = new PageInfo(list);
|
||||||
// 模糊条件 - 电子围栏名称
|
|
||||||
if (StringUtils.isNotEmpty(fence.getFenceName())) {
|
return info;
|
||||||
queryWrapper.like(Fence::getFenceName, fence.getFenceName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 精确查询 - 查询类型
|
|
||||||
if (fence.getFenceTypeId() != null) {
|
|
||||||
queryWrapper.eq(Fence::getFenceTypeId, fence.getFenceTypeId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 模糊查询 - 状态
|
|
||||||
if (fence.getFenceState() != null) {
|
|
||||||
queryWrapper.eq(Fence::getFenceState, fence.getFenceState());
|
|
||||||
}
|
|
||||||
if(!redisService.hasKey(FENCE_INFO_KEY)){
|
|
||||||
fenceRedisData();
|
|
||||||
}
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
//缓存电子围栏信息
|
|
||||||
@Override
|
|
||||||
public void fenceRedisData() {
|
|
||||||
List<Fence> list = this.list();
|
|
||||||
for (Fence fence : list) {
|
|
||||||
if(!redisService.hasKey(FENCE_INFO_KEY+fence.getFenceId())){
|
|
||||||
redisService.setCacheSet(FENCE_INFO_KEY+fence.getFenceId(),fence.getFenceMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//删除电子围栏全部数据
|
|
||||||
private void fenceRedisDelete(){
|
|
||||||
List<Fence> list = this.list();
|
|
||||||
for (Fence fence : list) {
|
|
||||||
redisService.deleteObject(FENCE_INFO_KEY+fence.getFenceId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//添加电子围栏信息
|
|
||||||
@Override
|
|
||||||
public boolean saveFence(Fence fence) {
|
|
||||||
boolean save = this.save(fence);
|
|
||||||
return save;
|
|
||||||
}
|
|
||||||
//绑定经纬度地图
|
|
||||||
@Override
|
|
||||||
public boolean updateByMap(Fence fence) {
|
|
||||||
boolean updateByMap = this.updateById(fence);
|
|
||||||
if(redisService.hasKey(FENCE_INFO_KEY+fence.getFenceId())){
|
|
||||||
redisService.deleteObject(FENCE_INFO_KEY+fence.getFenceId());
|
|
||||||
}
|
|
||||||
redisService.setCacheSet(FENCE_INFO_KEY+fence.getFenceId(),fence.getFenceMessage());
|
|
||||||
return updateByMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//删除电子围栏
|
|
||||||
@Override
|
|
||||||
public boolean removeByFence(Long fenceId) {
|
|
||||||
boolean remove = this.removeById(fenceId);
|
|
||||||
if(redisService.hasKey(FENCE_INFO_KEY+fenceId)){
|
|
||||||
redisService.deleteObject(FENCE_INFO_KEY+fenceId);
|
|
||||||
}
|
|
||||||
QueryWrapper<MarkersFence> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.eq("fence_id", fenceId);
|
|
||||||
List<MarkersFence> markersFences = markersFenceMapper.selectList(queryWrapper);
|
|
||||||
List<Long> longs = new ArrayList<>();
|
|
||||||
markersFences.stream().forEach(markersFence -> {
|
|
||||||
longs.add(markersFence.getMarkerId());
|
|
||||||
});
|
|
||||||
markersFenceMapper.deleteBatchFenceIds(longs);
|
|
||||||
return remove;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Result insertFence(Fence fence) {
|
||||||
|
// boolean save = this.save(fence);
|
||||||
|
// return Result.success(save);
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.domain.middle.MarkersFence;
|
|
||||||
import com.zhilian.business.service.FenceService;
|
|
||||||
import com.zhilian.business.mapper.MarkersFenceMapper;
|
|
||||||
import com.zhilian.business.service.MarkersFenceService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MarkersFenceServiceImpl extends ServiceImpl<MarkersFenceMapper, MarkersFence> implements MarkersFenceService {
|
|
||||||
@Autowired
|
|
||||||
private MarkersFenceMapper markersFenceMapper;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean insert(Markers markers) {
|
|
||||||
ArrayList<MarkersFence> markersFences = new ArrayList<>();
|
|
||||||
markers.getFenceIds().forEach(fenceId -> {
|
|
||||||
MarkersFence markersFence = new MarkersFence();
|
|
||||||
markersFence.setMarkerId(markers.getMarkersId());
|
|
||||||
markersFence.setFenceId(fenceId);
|
|
||||||
markersFences.add(markersFence);
|
|
||||||
});
|
|
||||||
return this.saveBatch(markersFences);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeAllFence(Markers markers) {
|
|
||||||
List<MarkersFence> list = this.list(new LambdaQueryWrapper<MarkersFence>().eq(MarkersFence::getMarkerId, markers.getMarkersId()));
|
|
||||||
this.removeBatchByIds(list);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zhilian.business.domain.Markers;
|
|
||||||
import com.zhilian.business.mapper.MarkersMapper;
|
|
||||||
import com.zhilian.business.service.MarkersService;
|
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MarkersServiceImpl extends ServiceImpl<MarkersMapper, Markers> implements MarkersService {
|
|
||||||
@Autowired
|
|
||||||
RedisService service;
|
|
||||||
@Override
|
|
||||||
public List<Markers> selectMarkersList(Markers markers) {
|
|
||||||
LambdaQueryWrapper<Markers> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
//模糊查询 查询标识名称
|
|
||||||
queryWrapper.like(StringUtils.isNotEmpty(markers.getMarkersName()), Markers::getMarkersName, markers.getMarkersName());
|
|
||||||
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询全部标识信息
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<Markers> listMarkers() {
|
|
||||||
if(service.hasKey("markers")){
|
|
||||||
List<Markers> markers = service.getCacheList("markers");
|
|
||||||
return markers;
|
|
||||||
}
|
|
||||||
List<Markers> list = this.list();
|
|
||||||
service.setCacheList("markers",list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.middle.VehicleMarkers;
|
|
||||||
import com.zhilian.business.mapper.*;
|
|
||||||
import com.zhilian.business.service.VehicleMarkersService;
|
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class VehicleMarkersServiceImpl extends ServiceImpl<VehicleMarkersMapper, VehicleMarkers> implements VehicleMarkersService {
|
|
||||||
// @Autowired
|
|
||||||
// private VehicleMapper vehicleMapper;
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private VehicleMarkersMapper vehicleMarkersMapper;
|
|
||||||
//
|
|
||||||
// @Autowired
|
|
||||||
// private RedisService redisService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MarkersMapper markersMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MarkersFenceMapper markersFenceMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FenceMapper fenceMapper;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor=Exception.class)
|
|
||||||
@Override
|
|
||||||
public boolean insert(Vehicle vehicle) {
|
|
||||||
ArrayList<VehicleMarkers> list = new ArrayList<>();
|
|
||||||
vehicle.getMarkersIds().forEach(markerId -> {
|
|
||||||
VehicleMarkers vehicleMarkers = new VehicleMarkers();
|
|
||||||
vehicleMarkers.setVehicleId(vehicle.getVehicleId());
|
|
||||||
vehicleMarkers.setMarkersId(markerId);
|
|
||||||
list.add(vehicleMarkers);
|
|
||||||
});
|
|
||||||
return this.saveBatch(list);
|
|
||||||
|
|
||||||
// String vehicleVIN = vehicle.getVehicleVIN();
|
|
||||||
// //标识
|
|
||||||
// List<Markers> markers = markersMapper.selectBatchIds(vehicle.getMarkersIds());
|
|
||||||
// //中间表
|
|
||||||
// List<MarkersFence> markersFences = markersFenceMapper.selectBatchIds(markers);
|
|
||||||
// //围栏
|
|
||||||
// List<Long> fenceIds = markersFences.stream().map(MarkersFence::getFenceId).collect(Collectors.toList());
|
|
||||||
// List<Fence> fences = fenceMapper.selectBatchIds(fenceIds);
|
|
||||||
//
|
|
||||||
// System.out.println("**********************"+fences);
|
|
||||||
// List<MarkersFence> markersFences = markersFenceMapper.selectList(new LambdaQueryWrapper<MarkersFence>().in(MarkersFence::getMarkersId, vehicle.getMarkersIds()));
|
|
||||||
// List<Fence> fences = fenceMapper.selectBatchIds(markersFences.stream().map(MarkersFence::getFenceId).distinct().toArray(Long[]::new));
|
|
||||||
// markersFences.forEach(markersFence -> {
|
|
||||||
// markersFence.setFence(fences.stream().filter(fence -> fence.getFenceId().equals(markersFence.getFenceId())).findFirst().get());
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// redisService.set(vehicle.getVehicleId(), markersFences);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeAllVehicle(Vehicle vehicle) {
|
|
||||||
List<VehicleMarkers> list = this.list(new LambdaQueryWrapper<VehicleMarkers>().eq(VehicleMarkers::getVehicleId, vehicle.getVehicleId()));
|
|
||||||
this.removeByIds(list);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zhilian.business.domain.Vehicle;
|
|
||||||
import com.zhilian.business.domain.VehicleFence;
|
|
||||||
import com.zhilian.business.mapper.*;
|
|
||||||
import com.zhilian.business.service.VehicleService;
|
|
||||||
import com.zhilian.common.core.utils.StringUtils;
|
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Log4j2
|
|
||||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
|
||||||
@Autowired
|
|
||||||
private VehicleMapper vehicleMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
|
|
||||||
private final String VEHICLE_PEOPLE_KEY = "vehicle_fence:";
|
|
||||||
@Override
|
|
||||||
public List<Vehicle> selectVehicleList(Vehicle vehicle) {
|
|
||||||
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
//模糊条件 查询VIN
|
|
||||||
if (StringUtils.isNotEmpty(vehicle.getVehicleVIN())) {
|
|
||||||
queryWrapper.like(Vehicle::getVehicleVIN, vehicle.getVehicleVIN());
|
|
||||||
}
|
|
||||||
// 精确查询 - 查询类型
|
|
||||||
if (vehicle.getVehicleTypeId() != null) {
|
|
||||||
queryWrapper.eq(Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId());
|
|
||||||
}
|
|
||||||
//模糊查询 车辆电机厂商
|
|
||||||
if (StringUtils.isNotEmpty(vehicle.getMotorId())) {
|
|
||||||
queryWrapper.like(Vehicle::getMotorId, vehicle.getMotorId());
|
|
||||||
}
|
|
||||||
//模糊查询 车辆电池厂商
|
|
||||||
if (StringUtils.isNotEmpty(vehicle.getBatteryId())) {
|
|
||||||
queryWrapper.like(Vehicle::getBatteryId, vehicle.getBatteryId());
|
|
||||||
}
|
|
||||||
//模糊查询 车辆电机ID
|
|
||||||
if (StringUtils.isNotEmpty(vehicle.getVehicleMotor())) {
|
|
||||||
queryWrapper.like(Vehicle::getVehicleMotor, vehicle.getVehicleMotor());
|
|
||||||
}
|
|
||||||
//模糊查询 车辆电池ID
|
|
||||||
if (StringUtils.isNotEmpty(vehicle.getVehicleBattery())) {
|
|
||||||
queryWrapper.like(Vehicle::getVehicleBattery, vehicle.getVehicleBattery());
|
|
||||||
}
|
|
||||||
//精确查询 车辆状态
|
|
||||||
if (vehicle.getVehicleState() != null) {
|
|
||||||
queryWrapper.eq(Vehicle::getVehicleState, vehicle.getVehicleState());
|
|
||||||
}
|
|
||||||
|
|
||||||
// queryWrapper.like(StringUtils.isNotEmpty(vehicle.getVehicleVIN()), Vehicle::getVehicleVIN, vehicle.getVehicleVIN())
|
|
||||||
// .eq(vehicle.getVehicleTypeId() != null, Vehicle::getVehicleTypeId, vehicle.getVehicleTypeId())
|
|
||||||
// .like(StringUtils.isNotEmpty(vehicle.getMotorID()), Vehicle::getMotorID, vehicle.getMotorID())
|
|
||||||
// .like(StringUtils.isNotEmpty(vehicle.getBatteryID()), Vehicle::getBatteryID, vehicle.getBatteryID())
|
|
||||||
// .like(StringUtils.isNotEmpty(vehicle.getMotorBusiness()), Vehicle::getMotorBusiness, vehicle.getMotorBusiness())
|
|
||||||
// .like(StringUtils.isNotEmpty(vehicle.getBatteryBusiness()), Vehicle::getBatteryBusiness, vehicle.getBatteryBusiness())
|
|
||||||
// .eq(vehicle.getVehicleState() != null, Vehicle::getVehicleState, vehicle.getVehicleState());
|
|
||||||
return this.list(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Vehicle getVehicleByVIN(String vehicleVIN) {
|
|
||||||
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(Vehicle::getVehicleVIN, vehicleVIN);
|
|
||||||
return vehicleMapper.selectOne(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateState(Vehicle vehicle) {
|
|
||||||
int update = vehicleMapper.update(vehicle, new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVehicleVIN, vehicle.getVehicleVIN()));
|
|
||||||
if(update==0){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectRedisData(Vehicle vehicle) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VehicleFence> selectSelectAllData() {
|
|
||||||
List<VehicleFence> vehicleMarkersFence = vehicleMapper.selectListAll();
|
|
||||||
for (VehicleFence vehicleFence : vehicleMarkersFence) {
|
|
||||||
String[] fenceIdsArray = vehicleFence.getFences().split(",");
|
|
||||||
ArrayList<String> fenceIdsArrayList = new ArrayList<>(Arrays.asList( fenceIdsArray));
|
|
||||||
vehicleFence.setFenceIds(fenceIdsArrayList);
|
|
||||||
}
|
|
||||||
for (VehicleFence vehicleFence : vehicleMarkersFence) {
|
|
||||||
redisService.setCacheList(VEHICLE_PEOPLE_KEY + vehicleFence.getVehicleVIN(), vehicleFence.getFenceIds());
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info(vehicleMarkersFence);
|
|
||||||
return vehicleMarkersFence;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.zhilian.business.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zhilian.business.domain.VehicleType;
|
|
||||||
import com.zhilian.business.mapper.VehicleTypeMapper;
|
|
||||||
import com.zhilian.business.service.VehicleTypeService;
|
|
||||||
import com.zhilian.common.redis.service.RedisService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
@Service
|
|
||||||
public class VehicleTypeServiceImpl extends ServiceImpl<VehicleTypeMapper, VehicleType> implements VehicleTypeService {
|
|
||||||
@Autowired
|
|
||||||
private RedisService redisService;
|
|
||||||
@Override
|
|
||||||
public List<VehicleType> listVehicleType() {
|
|
||||||
if(redisService.hasKey("vehicleType")){
|
|
||||||
List<VehicleType> vehicleType = redisService.getCacheList("vehicleType");
|
|
||||||
return vehicleType;
|
|
||||||
}
|
|
||||||
List<VehicleType> list = this.list();
|
|
||||||
redisService.setCacheList("vehicleType",list);
|
|
||||||
return this.list();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +1,2 @@
|
||||||
Spring Boot Version: ${spring-boot.version}
|
Spring Boot Version: ${spring-boot.version}
|
||||||
Spring Application Name: ${spring.application.name}
|
Spring Application Name: ${spring.application.name}
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?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.zhilian.business.mapper.BreakLogMapper">
|
|
||||||
|
|
||||||
<!-- 查询-->
|
|
||||||
<resultMap type="com.zhilian.business.domain.BreakLog" id="BaseResultMap">
|
|
||||||
<result property="breakLogId" column="break_log_id"/>
|
|
||||||
<result property="breakCode" column="break_code"/>
|
|
||||||
<result property="breakVin" column="break_vin"/>
|
|
||||||
<result property="breakType" column="break_time"/>
|
|
||||||
<result property="breakTime" column="break_type"/>
|
|
||||||
<result property="breakDate" column="break_date"/>
|
|
||||||
<result property="breakState" column="break_state"/>
|
|
||||||
<result property="breakDel" column="break_del"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<insert id="logAdd">
|
|
||||||
|
|
||||||
INSERT INTO `zhilian-business`.`business_break_log`
|
|
||||||
( `break_code`, `break_vin`, `break_time`, `break_type`, `break_date`, `break_state`,`break_del`)
|
|
||||||
VALUES
|
|
||||||
(#{breakCode}, #{breakVin},#{breakTime}, #{breakType},DATE_ADD(NOW(),INTERVAL 8 HOUR), #{breakState},0);
|
|
||||||
</insert>
|
|
||||||
<update id="updLog">
|
|
||||||
UPDATE `zhilian-business`.`business_break_log`
|
|
||||||
SET `break_code` = #{breakCode}, `break_vin` = #{breakVin}, `break_time` = NOW(), `break_type` = #{breakType}, `break_date` = NOW(), `break_state` = #{breakState}, `break_del` = #{breakDel}
|
|
||||||
WHERE `break_log_id` = #{breakLogId};
|
|
||||||
|
|
||||||
</update>
|
|
||||||
<update id="logDel">
|
|
||||||
UPDATE `zhilian-business`.`business_break_log`
|
|
||||||
SET break_del = 1
|
|
||||||
WHERE break_log_id = #{breakLogId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
|
|
||||||
select * from business_break_log where break_del = 0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据故障码和vin判断数据库中是否有数据-->
|
|
||||||
<select id="findByBreakCodeAndBreakVin" resultMap="BaseResultMap">
|
|
||||||
select * from business_break_log where break_code =#{breakCode} and break_vin =#{breakVin} and break_del =0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,22 +0,0 @@
|
||||||
<?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.zhilian.business.mapper.BreakMapper">
|
|
||||||
<insert id="breakAdd">
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
<insert id="addBreak">
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="breakUpd">
|
|
||||||
|
|
||||||
</update>
|
|
||||||
<update id="breakDel">
|
|
||||||
delete from business_breakdown where break_id = #{breakId}
|
|
||||||
</update>
|
|
||||||
<select id="breakList" resultType="com.zhilian.business.domain.Break">
|
|
||||||
select * from business_break
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,81 +0,0 @@
|
||||||
<?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.zhilian.business.mapper.BusinessBreakMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.zhilian.business.domain.BusinessBreak" id="BusinessBreakResult">
|
|
||||||
<result property="breakId" column="break_id" />
|
|
||||||
<result property="breakCode" column="break_code" />
|
|
||||||
<result property="breakVin" column="break_vin" />
|
|
||||||
<result property="breakTime" column="break_time" />
|
|
||||||
<result property="breakType" column="break_type" />
|
|
||||||
<result property="breakDate" column="break_date" />
|
|
||||||
<result property="breakState" column="break_state" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectBusinessBreakVo">
|
|
||||||
select break_id, break_code, break_vin, break_time, break_type, break_date, break_state from business_break
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectBusinessBreakList" parameterType="com.zhilian.business.domain.BusinessBreak" resultMap="BusinessBreakResult">
|
|
||||||
<include refid="selectBusinessBreakVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="breakCode != null and breakCode != ''"> and break_code = #{breakCode}</if>
|
|
||||||
<if test="breakVin != null and breakVin != ''"> and break_vin = #{breakVin}</if>
|
|
||||||
<if test="breakType != null and breakType != ''"> and break_type = #{breakType}</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectBusinessBreakByBreakId" parameterType="Long" resultMap="BusinessBreakResult">
|
|
||||||
<include refid="selectBusinessBreakVo"/>
|
|
||||||
where break_id = #{breakId}
|
|
||||||
</select>
|
|
||||||
<select id="breakLog" resultType="com.zhilian.business.domain.BreakLog">
|
|
||||||
select * from business_break_log
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<insert id="insertBusinessBreak" parameterType="com.zhilian.business.domain.BusinessBreak" useGeneratedKeys="true" keyProperty="breakId">
|
|
||||||
insert into business_break
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="breakCode != null">break_code,</if>
|
|
||||||
<if test="breakVin != null">break_vin,</if>
|
|
||||||
<if test="breakTime != null">break_time,</if>
|
|
||||||
<if test="breakType != null">break_type,</if>
|
|
||||||
<if test="breakDate != null">break_date,</if>
|
|
||||||
<if test="breakState != null">break_state,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="breakCode != null">#{breakCode},</if>
|
|
||||||
<if test="breakVin != null">#{breakVin},</if>
|
|
||||||
<if test="breakTime != null">#{breakTime},</if>
|
|
||||||
<if test="breakType != null">#{breakType},</if>
|
|
||||||
<if test="breakDate != null">#{breakDate},</if>
|
|
||||||
<if test="breakState != null">#{breakState},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateBusinessBreak" parameterType="com.zhilian.business.domain.BusinessBreak">
|
|
||||||
update business_break
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="breakCode != null">break_code = #{breakCode},</if>
|
|
||||||
<if test="breakVin != null">break_vin = #{breakVin},</if>
|
|
||||||
<if test="breakTime != null">break_time = #{breakTime},</if>
|
|
||||||
<if test="breakType != null">break_type = #{breakType},</if>
|
|
||||||
<if test="breakDate != null">break_date = #{breakDate},</if>
|
|
||||||
<if test="breakState != null">break_state = #{breakState},</if>
|
|
||||||
</trim>
|
|
||||||
where break_id = #{breakId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteBusinessBreakByBreakId" parameterType="Long">
|
|
||||||
delete from business_break where break_id = #{breakId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteBusinessBreakByBreakIds" parameterType="String">
|
|
||||||
delete from business_break where break_id in
|
|
||||||
<foreach item="breakId" collection="array" open="(" separator="," close=")">
|
|
||||||
#{breakId}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?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.zhilian.business.mapper.FenceMapper">
|
||||||
|
<!-- <resultMap type="com.zhilian.business.domain.Fence" id="FenceResult">-->
|
||||||
|
<!-- <id property="fenceId" column="fence_id"/>-->
|
||||||
|
<!-- <result property="fenceName" column="fence_name"/>-->
|
||||||
|
<!-- <result property="fenceTypeId" column="fence_type_id"/>-->
|
||||||
|
<!-- <result property="fenceState" column="fence_state"/>-->
|
||||||
|
<!-- <result property="fenceMessage" column="fence_message"/>-->
|
||||||
|
<!-- <result property="createBy" column="create_by"/>-->
|
||||||
|
<!-- <result property="createTime" column="create_time"/>-->
|
||||||
|
<!-- <result property="updateBy" column="update_by"/>-->
|
||||||
|
<!-- <result property="updateTime" column="update_time"/>-->
|
||||||
|
<!-- <result property="remark" column="remark"/>-->
|
||||||
|
<!-- </resultMap>-->
|
||||||
|
<select id="fenceList" resultType="com.zhilian.business.domain.Fence">
|
||||||
|
select * from business_fence
|
||||||
|
<where>
|
||||||
|
<if test="fenceName!=null and fenceName!=''">
|
||||||
|
and fence_name like concat('%',#{fenceName},'%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="fenceTypeId!=null">
|
||||||
|
and fence_type_id=#{fenceTypeId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="fenceState!=null">
|
||||||
|
and fence_state=#{fenceState}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<!-- <sql id="selectFenceVo">-->
|
||||||
|
<!-- select fence_id,-->
|
||||||
|
<!-- fence_name,-->
|
||||||
|
<!-- fence_type_id,-->
|
||||||
|
<!-- fence_state,-->
|
||||||
|
<!-- fence_message,-->
|
||||||
|
<!-- create_by,-->
|
||||||
|
<!-- create_time,-->
|
||||||
|
<!-- update_by,-->
|
||||||
|
<!-- update_time,-->
|
||||||
|
<!-- remark-->
|
||||||
|
<!-- from business_fence-->
|
||||||
|
<!-- </sql>-->
|
||||||
|
|
||||||
|
<!-- <select id="fenceList" parameterType="com.zhilian.business.domain.Fence">-->
|
||||||
|
<!-- <include refid="selectFenceVo"/>-->
|
||||||
|
<!-- <where>-->
|
||||||
|
<!-- <if test="fenceName != null and fenceName != ''">-->
|
||||||
|
<!-- AND fence_name like concat('%', #{fenceName}, '%')-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- <if test="fenceTypeId != null">-->
|
||||||
|
<!-- AND fenceTypeId = #{fenceTypeId}-->
|
||||||
|
<!-- </if>-->
|
||||||
|
<!-- </where>-->
|
||||||
|
<!-- </select>-->
|
||||||
|
</mapper>
|
|
@ -1,24 +0,0 @@
|
||||||
<?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.zhilian.business.mapper.VehicleMapper">
|
|
||||||
|
|
||||||
|
|
||||||
<select id="selectListAll" resultType="com.zhilian.business.domain.VehicleFence">
|
|
||||||
SELECT
|
|
||||||
BV.vehicle_id,
|
|
||||||
BV.vehicle_vin,
|
|
||||||
GROUP_CONCAT(BF.fence_id) AS fenceIds
|
|
||||||
FROM
|
|
||||||
business_vehicle AS BV
|
|
||||||
JOIN
|
|
||||||
business_vehicle_markers AS BVM ON BV.vehicle_id = BVM.vehicle_id
|
|
||||||
JOIN
|
|
||||||
business_markers_fence AS BMF ON BVM.markers_id = BMF.markers_id
|
|
||||||
JOIN
|
|
||||||
business_fence AS BF ON BMF.fence_id = BF.fence_id
|
|
||||||
GROUP BY
|
|
||||||
BV.vehicle_id, BV.vehicle_vin
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @BelongsPackage: com.zhilian.manager
|
* @BelongsPackage: com.zhilian.manager
|
||||||
* @Author: LiYuan
|
* @Author: LiYuan
|
||||||
* @CreateTime: 2024-03-31 10:17
|
* @CreateTime: 2024-03-31 10:17
|
||||||
* @Description: 管理模块启动类
|
* @Description: TODO
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 10.10.25.2:8848
|
server-addr: 10.10.25.2:8848
|
||||||
|
namespace: 9d9e22dc-ff70-42c5-adac-fa69e6d62dbe
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -1,27 +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.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-modules</artifactId>
|
|
||||||
<version>3.6.3</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>zhilian-message</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.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -92,24 +92,6 @@
|
||||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- kafka配置-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.kafka</groupId>
|
|
||||||
<artifactId>spring-kafka</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 业务系统远程调用-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zhilian</groupId>
|
|
||||||
<artifactId>zhilian-common-business</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 阿里云Ecs服务依赖(openAPI)-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.aliyun</groupId>
|
|
||||||
<artifactId>ecs20140526</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.zhilian.online.Timer;
|
|
||||||
|
|
||||||
import com.zhilian.online.uitls.AliyunOpenAPIUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BelongsProject: smart-cloud-server
|
|
||||||
* @BelongsPackage: com.zhilian.online.Timer
|
|
||||||
* @Author: LiYuan
|
|
||||||
* @CreateTime: 2024-04-17 21:53
|
|
||||||
* @Description: 收集节点监视者
|
|
||||||
* @Option: 监视节点负载量来决定是否需要扩容
|
|
||||||
* @Version: 1.0
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class LoadObserver {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 阿里云api接口类
|
|
||||||
*/
|
|
||||||
@Autowired
|
|
||||||
private AliyunOpenAPIUtils aliyunOpenAPIUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监视负载量是否需要扩容
|
|
||||||
*/
|
|
||||||
@Scheduled(cron = "0/10 * * * * ?")
|
|
||||||
public void addInstance(){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 监视负载量是否需要缩容
|
|
||||||
*/
|
|
||||||
@Scheduled(cron = "0/10 * * * * ?")
|
|
||||||
public void ReduceInstance(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,19 +3,8 @@ package com.zhilian.online;
|
||||||
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
import com.zhilian.common.security.annotation.EnableCustomConfig;
|
||||||
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
import com.zhilian.common.security.annotation.EnableMyFeignClients;
|
||||||
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
import com.zhilian.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
import com.zhilian.online.controller.OnlineLoadCenterController;
|
|
||||||
import com.zhilian.online.domain.EcsInstance;
|
|
||||||
import com.zhilian.online.domain.req.EcsCreateReq;
|
|
||||||
import com.zhilian.online.uitls.AliyunOpenAPIUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.ApplicationArguments;
|
|
||||||
import org.springframework.boot.ApplicationRunner;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import com.aliyun.ecs20140526.models.RunInstancesRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version:
|
* @version:
|
||||||
|
@ -27,45 +16,8 @@ import java.util.List;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@Slf4j
|
public class ZhiLianOnlineApplication {
|
||||||
public class ZhiLianOnlineApplication implements ApplicationRunner {
|
|
||||||
@Autowired
|
|
||||||
private AliyunOpenAPIUtils aliyunOpenAPIUtils;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ZhiLianOnlineApplication.class, args);
|
SpringApplication.run(ZhiLianOnlineApplication.class,args);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
|
||||||
log.info("项目启动,调用创建实例方法");
|
|
||||||
RunInstancesRequest.RunInstancesRequestSystemDisk systemDisk = new RunInstancesRequest.RunInstancesRequestSystemDisk();
|
|
||||||
systemDisk = systemDisk.setSize("20").setCategory("cloud_efficiency");
|
|
||||||
EcsCreateReq ecs = EcsCreateReq.builder()
|
|
||||||
.regionId("cn-zhangjiakou")
|
|
||||||
.imageId("m-8vbfx0e48cekro0f13bx")
|
|
||||||
.instanceType("ecs.t6-c1m1.large")
|
|
||||||
.securityGroupId("sg-8vb49jd1c1lsa3akwo02")
|
|
||||||
.vSwitchId("vsw-8vb0krtyfdmb27nhcmzc2")
|
|
||||||
.instanceName("gather-node")
|
|
||||||
.internetMaxBandwidthIn(80)
|
|
||||||
.internetMaxBandwidthOut(10)
|
|
||||||
.uniqueSuffix(true)
|
|
||||||
.password("142730.Ly")
|
|
||||||
.zoneId("cn-zhangjiakou-c")
|
|
||||||
.internetChargeType("PayByTraffic")
|
|
||||||
.systemDiskSize("20")
|
|
||||||
.systemDickCategory("cloud_efficiency")
|
|
||||||
.amount(1)
|
|
||||||
.minAmount(1)
|
|
||||||
.periodUnit("Week")
|
|
||||||
.period(1)
|
|
||||||
.instanceChargeType("PostPaid")
|
|
||||||
// .privateIpAddress("10.10.27.1")
|
|
||||||
.build();
|
|
||||||
List<String> instance = aliyunOpenAPIUtils.createInstance(ecs);
|
|
||||||
|
|
||||||
List<EcsInstance> ecsInstances = aliyunOpenAPIUtils.queryEcsInstances(instance);
|
|
||||||
log.info("创建的实例信息为{}" , ecsInstances);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package com.zhilian.online;
|
||||||
|
|
||||||
|
public class aa {
|
||||||
|
}
|
|
@ -1,70 +0,0 @@
|
||||||
package com.zhilian.online.config;
|
|
||||||
|
|
||||||
import com.aliyun.ecs20140526.Client;
|
|
||||||
import com.aliyun.teaopenapi.models.Config;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import com.aliyun.ecs20140526.Client;
|
|
||||||
import com.aliyun.teaopenapi.models.Config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BelongsProject: smart-cloud-server
|
|
||||||
* @BelongsPackage: com.zhilian.online.config
|
|
||||||
* @Author: LiYuan
|
|
||||||
* @CreateTime: 2024-04-12 14:43
|
|
||||||
* @Description: 阿里云Ecs服务账号配置
|
|
||||||
* @Version: 1.0
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
@ConfigurationProperties("aliyun.ecs")
|
|
||||||
@Data
|
|
||||||
@Slf4j
|
|
||||||
public class AliyunEcsConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 令牌账号
|
|
||||||
*/
|
|
||||||
private String accessKeyId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 令牌密码
|
|
||||||
*/
|
|
||||||
private String accessKeySecret;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 阿里云端点地址
|
|
||||||
*/
|
|
||||||
private String endpoint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 地域
|
|
||||||
*/
|
|
||||||
private String regionId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用AK&SK初始化账号Client
|
|
||||||
* @return Client
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Bean()
|
|
||||||
public Client createClient() throws Exception {
|
|
||||||
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
|
||||||
// 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
|
||||||
Config config = new Config()
|
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
|
||||||
.setAccessKeyId(accessKeyId)
|
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
|
||||||
.setAccessKeySecret(accessKeySecret)
|
|
||||||
.setRegionId(regionId);
|
|
||||||
// Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
|
||||||
config.endpoint = endpoint;
|
|
||||||
Client aliyunClient = new Client(config);
|
|
||||||
return aliyunClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,164 +0,0 @@
|
||||||
//package com.zhilian.online.config;
|
|
||||||
//
|
|
||||||
//import com.fasterxml.jackson.databind.JsonDeserializer;
|
|
||||||
//import org.apache.kafka.clients.consumer.ConsumerConfig;
|
|
||||||
//import org.springframework.beans.factory.annotation.Value;
|
|
||||||
//import org.springframework.context.annotation.Bean;
|
|
||||||
//import org.springframework.context.annotation.Configuration;
|
|
||||||
//import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
|
|
||||||
//import org.springframework.kafka.config.KafkaListenerContainerFactory;
|
|
||||||
//import org.springframework.kafka.core.ConsumerFactory;
|
|
||||||
//import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
|
|
||||||
//import org.springframework.kafka.listener.ConcurrentMessageListenerContainer;
|
|
||||||
//import org.springframework.kafka.listener.ContainerProperties;
|
|
||||||
//
|
|
||||||
//import java.util.HashMap;
|
|
||||||
//import java.util.Map;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @BelongsProject: smart-cloud-server
|
|
||||||
// * @BelongsPackage: com.zhilian.online.config
|
|
||||||
// * @Author: LiYuan
|
|
||||||
// * @CreateTime: 2024-04-02 20:01
|
|
||||||
// * @Description: kafka消费者配置类
|
|
||||||
// * @Version: 1.0
|
|
||||||
// */
|
|
||||||
//@Configuration
|
|
||||||
//public class KafkaConsumerConfig {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * kafka服务器地址
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.bootstrap-servers}")
|
|
||||||
// private String bootstrapServers;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 消费者组
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.group-id}")
|
|
||||||
// private String groupId;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 是否自动提交
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.enable-auto-commit}")
|
|
||||||
// private boolean enableAutoCommit;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * session超时时间
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.session.timeout.ms}")
|
|
||||||
// private String sessionTimeout;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 最大拉取时间
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.max.poll.interval.ms}")
|
|
||||||
// private String maxPollIntervalTime;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 每次拉取最大条数
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.max-poll-records}")
|
|
||||||
// private String maxPollRecords;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 自动提交偏移量
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.consumer.auto-offset-reset}")
|
|
||||||
// private String autoOffsetReset;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 监听器并发度
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.listener.concurrency}")
|
|
||||||
// private Integer concurrency;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 监听器是否忽略不存在的topic
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.listener.missing-topics-fatal}")
|
|
||||||
// private boolean missingTopicsFatal;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 监听器拉取超时时间
|
|
||||||
// */
|
|
||||||
// @Value("${spring.kafka.listener.poll-timeout}")
|
|
||||||
// private long pollTimeout;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 配置消费者
|
|
||||||
// * @return props
|
|
||||||
// */
|
|
||||||
// @Bean
|
|
||||||
// public Map<String, Object> consumerConfigs() {
|
|
||||||
// Map<String, Object> props = new HashMap<>();
|
|
||||||
//
|
|
||||||
// // 服务器地址
|
|
||||||
// props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
|
|
||||||
//
|
|
||||||
// // 消费者组
|
|
||||||
// props.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
|
|
||||||
//
|
|
||||||
// // 是否自动提交
|
|
||||||
// props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, enableAutoCommit);
|
|
||||||
//
|
|
||||||
// // 自动提交时间偏移量
|
|
||||||
// props.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "2000");
|
|
||||||
//
|
|
||||||
// //该属性指定了消费者在读取一个没有偏移量的分区或者偏移量无效的情况下该作何处理:
|
|
||||||
// //earliest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费分区的记录
|
|
||||||
// //latest:当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下的数据(在消费者启动之后生成的记录)
|
|
||||||
// //none:当各分区都存在已提交的offset时,从提交的offset开始消费;只要有一个分区不存在已提交的offset,则抛出异常
|
|
||||||
// props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, autoOffsetReset);
|
|
||||||
//
|
|
||||||
// //两次poll之间的最大间隔,默认值为5分钟。如果超过这个间隔会触发reBalance
|
|
||||||
// props.put(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG, maxPollIntervalTime);
|
|
||||||
//
|
|
||||||
// //这个参数定义了poll方法最多可以拉取多少条消息,默认值为500。如果在拉取消息的时候新消息不足500条,那有多少返回多少;如果超过500条,每次只返回500。
|
|
||||||
// //这个默认值在有些场景下太大,有些场景很难保证能够在5min内处理完500条消息,
|
|
||||||
// //如果消费者无法在5分钟内处理完500条消息的话就会触发reBalance,
|
|
||||||
// //然后这批消息会被分配到另一个消费者中,还是会处理不完,这样这批消息就永远也处理不完。
|
|
||||||
// //要避免出现上述问题,提前评估好处理一条消息最长需要多少时间,然后覆盖默认的max.poll.records参数
|
|
||||||
// //注:需要开启BatchListener批量监听才会生效,如果不开启BatchListener则不会出现reBalance情况
|
|
||||||
// props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,maxPollRecords);
|
|
||||||
//
|
|
||||||
// //当broker多久没有收到consumer的心跳请求后就触发reBalance,默认值是10s
|
|
||||||
// props.put(ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, sessionTimeout);
|
|
||||||
//
|
|
||||||
// //序列化(建议使用Json,这种序列化方式可以无需额外配置传输实体类)
|
|
||||||
// props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
|
|
||||||
// props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
|
|
||||||
//
|
|
||||||
// return props;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Bean
|
|
||||||
// public ConsumerFactory<Object,Object> consumerFactory(){
|
|
||||||
// //配置消费者的反序列化
|
|
||||||
// return new DefaultKafkaConsumerFactory<>(consumerConfigs(),
|
|
||||||
// new org.springframework.kafka.support.serializer.JsonDeserializer<>(),
|
|
||||||
// new org.springframework.kafka.support.serializer.JsonDeserializer<>().trustedPackages("*"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Bean
|
|
||||||
// public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<Object,Object>> kafkaListenerContainerFactory(){
|
|
||||||
// ConcurrentKafkaListenerContainerFactory<Object, Object> factory =
|
|
||||||
// new ConcurrentKafkaListenerContainerFactory<>();
|
|
||||||
// factory.setConsumerFactory(consumerFactory());
|
|
||||||
// //在侦听器容器中运行的线程数,一般设置为 机器数*分区数
|
|
||||||
// factory.setConcurrency(concurrency);
|
|
||||||
// //消费监听接口监听的主题不存在时,默认会报错,所以设置为false忽略错误
|
|
||||||
// factory.setMissingTopicsFatal(missingTopicsFatal);
|
|
||||||
// //自动提交关闭,需要设置手动消息确认
|
|
||||||
// factory.getContainerProperties().setAckMode(ContainerProperties.AckMode.MANUAL_IMMEDIATE);
|
|
||||||
// factory.getContainerProperties().setPollTimeout(pollTimeout);
|
|
||||||
// //设置为批量监听,需要用List接收
|
|
||||||
// //factory.setBatchListener(true);
|
|
||||||
// return factory;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue