Compare commits

...

70 Commits

Author SHA1 Message Date
玉安君 682dd2f6e0 feat commit
网关负载功能
2024-04-20 09:36:24 +08:00
玉安君 a3059cbbf7 feat commit
网关负载功能
2024-04-19 20:20:36 +08:00
玉安君 3857e3a875 feat commit
网关负载功能
2024-04-18 21:38:49 +08:00
玉安君 4d1cb943ac Merge remote-tracking branch 'origin/master' 2024-04-16 20:39:10 +08:00
玉安君 e6100a1318 feat commit
网关负载功能
2024-04-16 20:38:55 +08:00
xiaoSu 9c8131232b redis存储车辆所使用数据 2024-04-15 20:38:58 +08:00
玉安君 ac3aa82ef4 feat commit
网关节点上线,车辆上线,负载均衡功能
公共发邮件接口模块创建任务(yyh)
2024-04-12 11:43:48 +08:00
玉安君 e5be107d55 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/ZhilianBusinessApplication.java
2024-04-12 11:42:25 +08:00
玉安君 6454d72b8d feat commit
网关节点上线,车辆上线,负载均衡功能
公共发邮件接口模块创建任务(yyh)
2024-04-12 11:41:59 +08:00
xiaoSu 0463fde303 redis存储车辆所使用数据 2024-04-11 16:15:43 +08:00
xiaoSu b8de8285b7 Merge branch 'master' of https://gitea.qinmian.online/first-dev/smart-cloud-server
# Conflicts:
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/MarkersFenceServiceImpl.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/VehicleMarkersServiceImpl.java
2024-04-11 15:27:43 +08:00
JangCan 08acad4531 feat
故障日志存储redis,mysql的优化
2024-04-11 10:28:35 +08:00
JangCan a144a4d96a feat
故障日志存储redis,mysql
2024-04-10 22:40:27 +08:00
JangCan a796863e54 Merge remote-tracking branch 'origin/master' 2024-04-10 22:37:51 +08:00
YuanYh 13960a292f 故障日志更新 2024-04-10 20:42:48 +08:00
YuanYh 6fab49598e Merge remote-tracking branch 'origin/master' 2024-04-10 20:41:26 +08:00
YuanYh 46639b77a0 故障日志更新 2024-04-10 20:41:16 +08:00
JangCan 00b4350289 feat
解析故障日志添加,测试添加
2024-04-10 11:33:34 +08:00
xiaoSu 66ca1afa4a Merge remote-tracking branch 'origin/master' 2024-04-10 11:24:05 +08:00
xiaoSu 4e4e80f64d 部分注释添加 2024-04-10 11:23:42 +08:00
xiaoSu 3c1b9cef33 Merge branch 'master' of https://gitea.qinmian.online/first-dev/smart-cloud-server
# Conflicts:
#	zhilian-common/zhilian-common-business/src/main/java/com/zhilian/business/remote/RemoteVehicleService.java
#	zhilian-common/zhilian-common-business/src/main/java/com/zhilian/business/remote/factory/RemoteVehicleFallbackFactory.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/controller/VehicleMarkersController.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/controller/VehicleTypeController.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/mapper/VehicleTypeMapper.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/VehicleMarkersService.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/MarkersFenceServiceImpl.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/VehicleMarkersServiceImpl.java
#	zhilian-modules/zhilian-business/src/main/java/com/zhilian/business/service/impl/VehicleServiceImpl.java
2024-04-10 10:50:16 +08:00
JangCan 02f71d7baf feat
文件修改
2024-04-10 10:30:02 +08:00
xiaoSu 2c2854506e Merge branch 'master' of https://gitea.qinmian.online/first-dev/smart-cloud-server 2024-04-10 10:29:21 +08:00
玉安君 5505c3c45f Merge remote-tracking branch 'origin/server_2024_4_2_yuanyonghao' 2024-04-10 10:28:27 +08:00
YuanYh 9433dcb66d 故障日志更新 2024-04-10 09:26:26 +08:00
xiaoSu 55d398940f 修改BUG 2024-04-09 22:33:03 +08:00
JangCan d45da7b47f feat
事件errorCar
2024-04-09 21:46:51 +08:00
JangCan 672a340cdf feat
事件geofence
2024-04-09 21:37:14 +08:00
JangCan 9478ae16c5 feat
事件
2024-04-09 21:14:09 +08:00
玉安君 7abd6f6523 merge
合并故障管理功能
2024-04-09 16:21:12 +08:00
YuanYh 50767b8b9a 代码更新 2024-04-09 15:09:14 +08:00
玉安君 7ca3d4dede feat commit
围栏管理事件伪代码
2024-04-08 20:00:17 +08:00
YuanYh 31155a12a6 代码更新 2024-04-08 17:23:41 +08:00
JangCan 4ccc21132c Merge remote-tracking branch 'origin/master' 2024-04-08 15:56:02 +08:00
JangCan 75c0653091 feat commit
接收kafka
2024-04-08 15:55:03 +08:00
玉安君 4664426562 commit
合并提交
2024-04-08 15:50:37 +08:00
YuanYh 59b796f962 故障码业务实现 4 2024-04-08 15:42:40 +08:00
xiaoSu 82cad8d974 部分注释添加 2024-04-08 15:38:55 +08:00
xiaoSu e4bfdc56c8 提供车辆信息查询与车辆状态更新接口 2024-04-08 15:25:11 +08:00
JangCan 08a8480ab5 feat commit
存储事件、故障事件
2024-04-08 15:01:31 +08:00
玉安君 c99d1e0e89 commit
合并提交
2024-04-08 10:35:25 +08:00
玉安君 dc3bf42273 Merge remote-tracking branch 'origin/server_2024_4_2_jiangcan'
# Conflicts:
#	zhilian-modules/zhilian-resolver/src/main/java/com/zhilian/resolver/ZhilianResolverApplication.java
2024-04-08 10:33:51 +08:00
JangCan 5dea92f527 feat commit
存储事件、故障事件测试成功
2024-04-08 10:25:14 +08:00
xiaoSu 053d348800 Merge pull request 'server_2024_4_2_suzejing' (#8) from server_2024_4_2_suzejing into master
Reviewed-on: #8
2024-04-08 10:08:50 +08:00
xiaoSu ae34564232 多对多 2024-04-08 10:06:40 +08:00
YuanYh 447986b5ac 故障码业务实现 3 2024-04-07 22:39:34 +08:00
YuanYh 6a9e8c3097 故障码业务实现 2 2024-04-07 15:54:35 +08:00
YuanYh 5a964fa9f5 故障码业务实现 2024-04-07 15:43:38 +08:00
xiaoSu 86d2643da9 车辆管理+车辆标识 2024-04-06 16:56:37 +08:00
JangCan 987f20b27c feat commit
存储事件、故障时间测试成功
2024-04-04 16:07:26 +08:00
玉安君 5d5537cb37 fix commit
修复了部分不规范的代码
2024-04-02 15:14:59 +08:00
half-a-me a9afd4d5bd Merge pull request 'server_2024_3_26_jiangcan' (#7) from server_2024_3_26_jiangcan into master
Reviewed-on: #7
2024-04-02 15:09:14 +08:00
JangCan 4d6da881ff jc报文vehiclesStatus字段数据异常问题解决 2024-04-02 15:01:54 +08:00
half-a-me 5ecb8b24fb Merge pull request 'server_2024_3_26_suzejing' (#6) from server_2024_3_26_suzejing into master
Reviewed-on: #6
2024-04-02 14:59:53 +08:00
xiaoSu 4353fb41a6 电子围栏后台功能开发结束 2024-04-02 14:58:53 +08:00
JangCan bd85703b70 jc获取报文数据同步数据库,vehiclesStatus字段数据有异常 2024-04-02 08:42:15 +08:00
xiaoSu 8e21d94c24 电子围栏后台功能开发结束 2024-04-01 19:59:23 +08:00
half-a-me 6d61391895 Merge pull request 'server_2024_3_26' (#5) from server_2024_3_26 into master
Reviewed-on: #5
2024-04-01 19:55:40 +08:00
half-a-me b69f010915 Merge pull request 'server_2024_3_26_liyuan' (#4) from server_2024_3_26_liyuan into server_2024_3_26
Reviewed-on: #4
2024-04-01 19:54:37 +08:00
玉安君 5b2adca1e4 feat commit
注册节点注册功能
2024-04-01 19:33:58 +08:00
JangCan 3222b3ed2e demo获取报文 2024-03-30 08:29:32 +08:00
玉安君 bda7de379f fix commit
修改了部分代码的代码规范,修复了管理企业功能的已知bug
2024-03-29 20:23:26 +08:00
xiaoSu 0b60c3ef68 电子围栏CRUD 2024-03-29 20:01:31 +08:00
half-a-me 93504ed9d9 Merge pull request 'server_2024_3_26' (#3) from server_2024_3_26 into master
Reviewed-on: #3
2024-03-29 15:07:58 +08:00
half-a-me 53725b10ba Merge pull request 'server_2024_3_26_liyuan' (#2) from server_2024_3_26_liyuan into server_2024_3_26
Reviewed-on: #2
2024-03-28 22:40:08 +08:00
玉安君 0ad5f18336 feat commit
入驻企业权限控制,入驻企业的企业管理功能,用户管理功能
2024-03-28 22:27:18 +08:00
JangCan 43a410eb35 规范代码,注解、类名命名规范 2024-03-28 22:18:21 +08:00
JangCan 5b00ec421a jc报文表实现预加载,同步es成功 2024-03-27 23:26:23 +08:00
玉安君 a78b4f3fc1 feat commit
企业入驻功能
2024-03-27 22:33:15 +08:00
玉安君 979074fc11 feat commit
创建车联网基本框架
2024-03-26 19:04:34 +08:00
203 changed files with 11202 additions and 117 deletions

View File

@ -20,6 +20,10 @@ com.zhilian
│ └── zhilian-gen // 代码生成 [9202]
│ └── zhilian-job // 定时任务 [9203]
│ └── zhilian-file // 文件服务 [9300]
│ └── zhilian-online // 车辆网关服务 [9901]
│ └── zhilian-resolver // 报文处理服务 [9902]
│ └── zhilian-business // 业务服务 [9903]
│ └── zhilian-manager // 管理服务 [9904]
├── zhilian-visual // 图形化管理模块
│ └── zhilian-visual-monitor // 监控中心 [9100]
├──pom.xml // 公共依赖

159
pom.xml
View File

@ -36,6 +36,9 @@
<poi.version>4.1.2</poi.version>
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.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>
<!-- 依赖声明 -->
@ -207,7 +210,71 @@
<version>${zhilian.version}</version>
</dependency>
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-resolver</artifactId>
<version>${zhilian.version}</version>
</dependency>
<!-- 智联业务模块 -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-business</artifactId>
<version>${zhilian.version}</version>
</dependency>
<!-- 智联管理模块 -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-manager</artifactId>
<version>${zhilian.version}</version>
</dependency>
<!-- 智联车辆网关模块 -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-online</artifactId>
<version>${zhilian.version}</version>
</dependency>
<!-- 智联处理模块 -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-resolver</artifactId>
<version>${zhilian.version}</version>
</dependency>
<!--mqtt版本管理-->
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>${mqttv3.version}</version>
</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>
</dependencyManagement>
<modules>
@ -261,57 +328,57 @@
</executions>
</plugin>
<!-- 要将源码放上去,需要加入这个插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-source-plugin</artifactId>-->
<!-- <version>3.0.1</version>-->
<!-- <configuration>-->
<!-- <attach>true</attach>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>compile</phase>-->
<!-- <goals>-->
<!-- <goal>jar</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<repository>
<id>releases</id>
<name>releases</name>
<url>http://nexus.zhilian.com:8081/repository/maven-releases/</url>
</repository>
</distributionManagement>
<!-- <distributionManagement>-->
<!-- <repository>-->
<!-- <id>releases</id>-->
<!-- <name>releases</name>-->
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-releases/</url>-->
<!-- </repository>-->
<!-- </distributionManagement>-->
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://nexus.zhilian.com:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<!-- <repositories>-->
<!-- <repository>-->
<!-- <id>public</id>-->
<!-- <name>aliyun nexus</name>-->
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- </repository>-->
<!-- </repositories>-->
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://nexus.zhilian.com:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- <pluginRepositories>-->
<!-- <pluginRepository>-->
<!-- <id>public</id>-->
<!-- <name>aliyun nexus</name>-->
<!-- <url>http://nexus.zhilian.com:8081/repository/maven-public/</url>-->
<!-- <releases>-->
<!-- <enabled>true</enabled>-->
<!-- </releases>-->
<!-- <snapshots>-->
<!-- <enabled>false</enabled>-->
<!-- </snapshots>-->
<!-- </pluginRepository>-->
<!-- </pluginRepositories>-->
</project>

View File

@ -18,6 +18,9 @@
<module>zhilian-common-datascope</module>
<module>zhilian-common-datasource</module>
<module>zhilian-common-system</module>
<module>zhilian-common-resolver</module>
<module>zhilian-common-business</module>
<module>zhilian-common-event</module>
</modules>
<artifactId>zhilian-common</artifactId>

View File

@ -0,0 +1,28 @@
<?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>

View File

@ -0,0 +1,43 @@
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;
}

View File

@ -0,0 +1,32 @@
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;
}

View File

@ -0,0 +1,113 @@
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();
}
}

View File

@ -0,0 +1,64 @@
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.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName Fence
* @Description
* @Author ZeJinG.Su
* @Date 15:28 2024/4/8
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("business_fence")
public class Fence extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
@TableId(value = "fence_id", type = IdType.AUTO)
private Long fenceId;
/**
*
*/
@Excel(name = "电子围栏名称")
@TableField("fence_name")
private String fenceName;
/**
*
*/
@Excel(name = "电子围栏类型编号")
@TableField("fence_type_id")
private Long fenceTypeId;
/**
*
*/
@Excel(name = "电子围栏状态")
@TableField("fence_state")
private Long fenceState;
/**
*
*/
@Excel(name = "电子围栏经纬度信息")
@TableField("fence_message")
private String fenceMessage;
@TableField(exist = false)
List<Markers> markersList;
}

View File

@ -0,0 +1,35 @@
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;
}

View File

@ -0,0 +1,71 @@
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;
}

View File

@ -0,0 +1,29 @@
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;
}

View File

@ -0,0 +1,37 @@
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;
}
}

View File

@ -0,0 +1,38 @@
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;
}
}

View File

@ -0,0 +1,8 @@
package com.zhilian.business.domain.vo;
import lombok.Data;
@Data
public class MarkersVo {
}

View File

@ -0,0 +1,37 @@
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;
}

View File

@ -0,0 +1,27 @@
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);
}

View File

@ -0,0 +1,7 @@
package com.zhilian.business.remote;
import org.springframework.stereotype.Component;
@Component
public interface RemoteFenceService {
}

View File

@ -0,0 +1,32 @@
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);
}

View File

@ -0,0 +1,38 @@
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("故障日志服务调用失败");
// }
// };
}
}

View File

@ -0,0 +1,8 @@
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 {
}

View File

@ -0,0 +1,31 @@
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());
}
};
}
}

View File

@ -0,0 +1,3 @@
com.zhilian.business.remote.factory.RemoteBreakFallbackFactory
com.zhilian.business.remote.factory.RemoteFenceFallbackFactory
com.zhilian.business.remote.factory.RemoteVehicleFallbackFactory

View File

@ -11,6 +11,12 @@ public class SecurityConstants {
*/
public static final String DETAILS_USER_ID = "user_id";
/**
* ID
*/
public static final String COMPANY_SIGN = "company_sign";
/**
*
*/

View File

@ -20,4 +20,13 @@ public class ServiceNameConstants {
* serviceid
*/
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";
}

View File

@ -61,6 +61,14 @@ public class SecurityContextHolder {
set(SecurityConstants.DETAILS_USERNAME, username);
}
public static String getCompanySign () {
return get(SecurityConstants.COMPANY_SIGN);
}
public static void setCompanySign (String companySign) {
set(SecurityConstants.COMPANY_SIGN, companySign);
}
public static String getUserKey () {
return get(SecurityConstants.USER_KEY);
}

View File

@ -8,6 +8,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
*

View File

@ -109,6 +109,25 @@ public class JwtUtils {
return getValue(claims, SecurityConstants.DETAILS_USERNAME);
}
/**
*
* @param token
* @return
*/
public static String getCompanySign (String token) {
Claims claims = parseToken(token);
return getValue(claims, SecurityConstants.COMPANY_SIGN);
}
/**
*
* @param claims
* @return
*/
public static String getCompanySign (Claims claims) {
return getValue(claims, SecurityConstants.COMPANY_SIGN);
}
/**
*
*

View File

@ -0,0 +1,35 @@
package com.zhilian.common.core.web.page;
import com.zhilian.common.core.domain.Result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author DongZl
* @description:
*/
@Data
public class PageResult<T> implements Serializable {
/**
*
*/
private long total;
/**
*
*/
private List<T> list;
public PageResult() {
}
public PageResult(long total, List<T> list) {
this.total = total;
this.list = list;
}
public static <T> PageResult<T> toPageResult(long total, List<T> list){
return new PageResult(total , list);
}
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
return Result.success(PageResult.toPageResult(total,list));
}
}

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.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>

View File

@ -0,0 +1,18 @@
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);
}
}

View File

@ -0,0 +1,4 @@
package com.zhilian.common.event;
public interface VehicleEventConstants {
}

View File

@ -1,14 +1,13 @@
package com.zhilian.common.redis.service;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* spring redis
@ -27,7 +26,7 @@ public class RedisService {
* @param key
* @param value
*/
public <T> void setCacheObject (final String key, final T value) {
public <T> void setCacheObject(final String key, final T value) {
redisTemplate.opsForValue().set(key, value);
}
@ -39,7 +38,7 @@ public class RedisService {
* @param timeout
* @param timeUnit
*/
public <T> void setCacheObject (final String key, final T value, final Long timeout, final TimeUnit timeUnit) {
public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) {
redisTemplate.opsForValue().set(key, value, timeout, timeUnit);
}
@ -48,10 +47,9 @@ public class RedisService {
*
* @param key Redis
* @param timeout
*
* @return true=false=
*/
public boolean expire (final String key, final long timeout) {
public boolean expire(final String key, final long timeout) {
return expire(key, timeout, TimeUnit.SECONDS);
}
@ -61,10 +59,9 @@ public class RedisService {
* @param key Redis
* @param timeout
* @param unit
*
* @return true=false=
*/
public boolean expire (final String key, final long timeout, final TimeUnit unit) {
public boolean expire(final String key, final long timeout, final TimeUnit unit) {
return redisTemplate.expire(key, timeout, unit);
}
@ -72,10 +69,9 @@ public class RedisService {
*
*
* @param key Redis
*
* @return
*/
public long getExpire (final String key) {
public long getExpire(final String key) {
return redisTemplate.getExpire(key);
}
@ -83,10 +79,9 @@ public class RedisService {
* key
*
* @param key
*
* @return true false
*/
public Boolean hasKey (String key) {
public Boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
@ -94,10 +89,9 @@ public class RedisService {
*
*
* @param key
*
* @return
*/
public <T> T getCacheObject (final String key) {
public <T> T getCacheObject(final String key) {
ValueOperations<String, T> operation = redisTemplate.opsForValue();
return operation.get(key);
}
@ -107,7 +101,7 @@ public class RedisService {
*
* @param key
*/
public boolean deleteObject (final String key) {
public boolean deleteObject(final String key) {
return redisTemplate.delete(key);
}
@ -115,10 +109,9 @@ public class RedisService {
*
*
* @param collection
*
* @return
*/
public boolean deleteObject (final Collection collection) {
public boolean deleteObject(final Collection collection) {
return redisTemplate.delete(collection) > 0;
}
@ -127,10 +120,9 @@ public class RedisService {
*
* @param key
* @param dataList List
*
* @return
*/
public <T> long setCacheList (final String key, final List<T> dataList) {
public <T> long setCacheList(final String key, final List<T> dataList) {
Long count = redisTemplate.opsForList().rightPushAll(key, dataList);
return count == null ? 0 : count;
}
@ -139,10 +131,9 @@ public class RedisService {
* list
*
* @param key
*
* @return
*/
public <T> List<T> getCacheList (final String key) {
public <T> List<T> getCacheList(final String key) {
return redisTemplate.opsForList().range(key, 0, -1);
}
@ -151,10 +142,9 @@ public class RedisService {
*
* @param key
* @param dataSet
*
* @return
*/
public <T> BoundSetOperations<String, T> setCacheSet (final String key, final Set<T> dataSet) {
public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) {
BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key);
Iterator<T> it = dataSet.iterator();
while (it.hasNext()) {
@ -163,14 +153,26 @@ public class RedisService {
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
*
* @param key
*
* @return
*/
public <T> Set<T> getCacheSet (final String key) {
public <T> Set<T> getCacheSet(final String key) {
return redisTemplate.opsForSet().members(key);
}
@ -180,7 +182,7 @@ public class RedisService {
* @param key
* @param dataMap
*/
public <T> void setCacheMap (final String key, final Map<String, T> dataMap) {
public <T> void setCacheMap(final String key, final Map<String, T> dataMap) {
if (dataMap != null) {
redisTemplate.opsForHash().putAll(key, dataMap);
}
@ -190,10 +192,9 @@ public class RedisService {
* Map
*
* @param key
*
* @return
*/
public <T> Map<String, T> getCacheMap (final String key) {
public <T> Map<String, T> getCacheMap(final String key) {
return redisTemplate.opsForHash().entries(key);
}
@ -204,7 +205,7 @@ public class RedisService {
* @param hKey Hash
* @param value
*/
public <T> void setCacheMapValue (final String key, final String hKey, final T value) {
public <T> void setCacheMapValue(final String key, final String hKey, final T value) {
redisTemplate.opsForHash().put(key, hKey, value);
}
@ -213,10 +214,9 @@ public class RedisService {
*
* @param key Redis
* @param hKey Hash
*
* @return Hash
*/
public <T> T getCacheMapValue (final String key, final String hKey) {
public <T> T getCacheMapValue(final String key, final String hKey) {
HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash();
return opsForHash.get(key, hKey);
}
@ -226,10 +226,9 @@ public class RedisService {
*
* @param key Redis
* @param hKeys Hash
*
* @return Hash
*/
public <T> List<T> getMultiCacheMapValue (final String key, final Collection<Object> hKeys) {
public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) {
return redisTemplate.opsForHash().multiGet(key, hKeys);
}
@ -238,21 +237,202 @@ public class RedisService {
*
* @param key Redis
* @param hKey Hash
*
* @return
*/
public boolean deleteCacheMapValue (final String key, final String hKey) {
public boolean deleteCacheMapValue(final String key, final String hKey) {
return redisTemplate.opsForHash().delete(key, hKey) > 0;
}
/**
* Zset
*
* @param zkey ZSet
* @param value
* @param score
*/
public <T> void setCacheZsetValue(final String zkey, final T value, final Double score) {
redisTemplate.opsForZSet().add(zkey, value, score);
}
/**
* Zset
*
* @param zkey zSet
* @param map => T Double
*/
public <T> void setCacheZsetBatchValue(final String zkey, final Map<T, Double> map) {
Set<DefaultTypedTuple> collect = map.entrySet().stream()
.map(item -> {
return new DefaultTypedTuple(item.getKey(), item.getValue());
})
.collect(Collectors.toSet());
redisTemplate.opsForZSet().add(zkey, collect);
}
/**
* Zset
*
* @param zkey
* @return size
*/
public Long getCacheZsetSize(String zkey) {
return redisTemplate.opsForZSet().size(zkey);
}
/**
*
*
* @param zkey
* @param value
* @param <T>
* @return score
*/
public <T> Double getCacheZsetScore(final String zkey, final T value) {
return redisTemplate.opsForZSet().score(zkey, value);
}
/**
*
*
* @param zkey
* @param start
* @param end
* @return
*/
public <T> Set<Double> getCacheZsetScoreBatch(final String zkey, final Long start, final Long end) {
return redisTemplate.opsForZSet().range(zkey, start, end);
}
/**
*
*
* @param zkey
* @param start
* @param end
* @return
*/
public <T> Set<HashMap<Object, Double>> getCacheZsetScoreWithDataBatch(final String zkey, final Long start, final Long end) {
Set<ZSetOperations.TypedTuple<Object>> rangeSet = redisTemplate.opsForZSet().range(zkey, start, end);
Set<HashMap<Object, Double>> collect = rangeSet.stream().
map(item -> {
HashMap<Object, Double> objectDoubleHashMap = new HashMap<Object, Double>();
objectDoubleHashMap.put(item.getValue(), item.getScore());
return objectDoubleHashMap;
})
.collect(Collectors.toSet());
return collect;
}
/**
* ,delta,
*
* @param zkey
* @param value
* @param delta
* @param <T>
*/
public <T> Double incrementScore(final String zkey, final T value, final Double delta) {
return redisTemplate.opsForZSet().incrementScore(zkey, value, delta);
}
/**
*
*
* @param zkey
* @param values
* @param <T>
* @return
*/
public <T> Long removeCacheZsetBatch(final String zkey, final T... values) {
return redisTemplate.opsForZSet().remove(zkey, values);
}
/**
* ,
*
* @param zkey
* @param start
* @param end
* @return
*/
public Set<Double> reverseRange(final String zkey, final Long start, final Long end) {
return redisTemplate.opsForZSet().reverseRange(zkey, start, end);
}
/**
*
*
* @param zkey
* @param min
* @param max
* @return
*/
public Set<Double> rangeByScore(final String zkey, final Double min, final Double max) {
return redisTemplate.opsForZSet().rangeByScore(zkey, min, max);
}
/**
*
*
* @param zkey
* @return
*/
public ZSetOperations.TypedTuple getCacheZsetMin(final String zkey) {
ZSetOperations.TypedTuple typedTuple = redisTemplate.opsForZSet().popMin(zkey);
return typedTuple;
}
/**
*
*
* @param pattern
*
* @return
*/
public Collection<String> keys (final String pattern) {
public Collection<String> keys(final String 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: Listvalue
* @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);
}
}

View File

@ -0,0 +1,32 @@
<?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-resolver</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>
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-redis</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,12 @@
package com.zhilian.common.resolver.constants;
/**
* @ClassName MqttConnectConstants
* @Description Mqtt
* @Author Can.J
* @Date 2024/4/4 10:13
*/
public class MqttConnectConstants {
public static final String BROKER_URL = "tcp://111.229.33.194:1883";
public static final String CLIENT_ID = "mqttx_53f082e9";
}

View File

@ -0,0 +1,25 @@
package com.zhilian.common.resolver.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName EnhancedServicesType
* @Description
* @Author Can.J
* @Date 2024/4/4 11:20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EnhancedServicesType {
/**
* id
*/
private Long id;
/**
*
*/
private String enhancedServicesName;
}

View File

@ -0,0 +1,263 @@
package com.zhilian.common.resolver.domain;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName ResolverReportData
* @Description
* @Author Can.J
* @Date 2024/4/1 11:49
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
public class ResolverReportData {
/**
* id
*/
private Long id;
/**
* VIN
*/
private String vin;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
*
*/
private String longitude;
/**
*
*/
private String latitude;
/**
*
*/
private String speed;
/**
*
*/
private BigDecimal mileage;
/**
*
*/
private String voltage;
/**
*
*/
private String current;
/**
*
*/
private String resistance;
/**
* P: D
*/
private String gear;
/**
*
*/
private String accelerationPedal;
/**
*
*/
private String brakePedal;
/**
*
*/
private String fuelConsumptionRate;
/**
*
*/
private String motorControllerTemperature;
/**
*
*/
private String motorSpeed;
/**
*
*/
private String motorTorque;
/**
*
*/
private String motorTemperature;
/**
*
*/
private String motorVoltage;
/**
*
*/
private String motorCurrent;
/**
* SOC
*/
private BigDecimal remainingBattery;
/**
*
*/
private String maximumFeedbackPower;
/**
*
*/
private String maximumDischargePower;
/**
* BMS
*/
private String selfCheckCounter;
/**
*
*/
private String totalBatteryCurrent;
/**
* V3
*/
private String totalBatteryVoltage;
/**
*
*/
private String singleBatteryMaxVoltage;
/**
*
*/
private String singleBatteryMinVoltage;
/**
*
*/
private String singleBatteryMaxTemperature;
/**
*
*/
private String singleBatteryMinTemperature;
/**
*
*/
private String availableBatteryCapacity;
/**
* 1 0
*/
private int vehicleStatus;
/**
* 1 0
*/
private int chargingStatus;
/**
* 1 0
*/
private int operatingStatus;
/**
* SOC 1 0
*/
private int socStatus;
/**
* 1 0
*/
private int chargingEnergyStorageStatus;
/**
* 1 0
*/
private int driveMotorStatus;
/**
* 1 0
*/
private int positionStatus;
/**
* EAS() 1 0
*/
private int easStatus;
/**
* PTC() 1 0
*/
private int ptcStatus;
/**
* EPS() 1 0
*/
private int epsStatus;
/**
* ABS() 1 0
*/
private int absStatus;
/**
* MCU(/) 1 0
*/
private int mcuStatus;
/**
* 1 0
*/
private int heatingStatus;
/**
* 1 0
*/
private int batteryStatus;
/**
* 1 0
*/
private int batteryInsulationStatus;
/**
* DCDC() 1 0
*/
private int dcdcStatus;
/**
* CHG() 1 0
*/
private int chgStatus;
}

View File

@ -0,0 +1,115 @@
package com.zhilian.common.resolver.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhilian.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName ResolverReportInfo
* @Description
* @Author Can.J
* @Date 2024/3/26 21:47
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("resolver_report_info")
public class ResolverReportInfo extends BaseEntity {
/**
* id
*/
private Long reportId;
/**
*
*/
private String vin;
/**
* 线
*/
private Date onlineTime;
/**
* 线
*/
private Date downLineTime;
/**
*
*/
private String longitude;
/**
*
*/
private String latitude;
/**
*
*/
private BigDecimal remainingBattery;
/**
*
*/
private BigDecimal batteryLevel;
/**
*
*/
private BigDecimal totalMileage;
/**
* 线: 1线 0:线
*/
private int isOnline;
/**
*
*/
private Date createTime;
/**
* : 1 0:
*/
private int isBreakDown;
/**
* : 1 0:
*/
private int isSolve;
/**
* 1 0:
*/
private int isDelay;
/**
* : 1 0:
*/
private int isRepeat;
/**
* : 1 0:
*/
private int status;
/**
* id
*/
private Long companyId;
/**
* 1 0:
*/
private Integer isDelete;
private String createBy;
private String remark;
}

View File

@ -0,0 +1,33 @@
package com.zhilian.common.resolver.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName SysUserEnhancedServices
* @Description (-)
* @Author Can.J
* @Date 2024/4/4 11:23
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysUserEnhancedServices {
private Long useId;
private Long enhancedServicesId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private String updateTime;
private String createBy;
private String updateBy;
private int isDelete;
private String remark;
}

View File

@ -0,0 +1,21 @@
package com.zhilian.common.resolver.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName RealTimeTrajectoryRequest
* @Description
* @Author Can.J
* @Date 2024/4/6 16:21
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RealTimeTrajectoryRequest {
private Long userId;
/**
* vin
*/
private String vin;
}

View File

@ -0,0 +1,26 @@
package com.zhilian.common.resolver.domain.req;
import lombok.Data;
/**
* @ClassName ReportByEsReq
* @Description es
* @Author Can.J
* @Date 2024/3/27 23:47
*/
@Data
public class ReportByEsReq {
/**
*
*/
private Integer pageNum=1;
/**
*
*/
private Integer pageSize=3;
/**
*
*/
private String vin;
}

View File

@ -0,0 +1,106 @@
package com.zhilian.common.resolver.domain.resp;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @ClassName ReportByEsResp
* @Description ES
* @Author Can.J
* @Date 2024/3/27 23:48
*/
@Data
public class ReportByEsResp {
/**
* id
*/
private Long reportId;
/**
*
*/
private String vin;
/**
* 线
*/
private Date onlineTime;
/**
* 线
*/
private Date downLineTime;
/**
*
*/
private String longitude;
/**
*
*/
private String latitude;
/**
*
*/
private BigDecimal remainingBattery;
/**
*
*/
private BigDecimal batteryLevel;
/**
*
*/
private BigDecimal totalMileage;
/**
* 线: 1线 0:线
*/
private int isOnline;
/**
*
*/
private Date createTime;
/**
* : 1 0:
*/
private int isBreakDown;
/**
* : 1 0:
*/
private int isSolve;
/**
* 1 0:
*/
private int isDelay;
/**
* : 1 0:
*/
private int isRepeat;
/**
* : 1 0:
*/
private int status;
/**
* id
*/
private Long companyId;
/**
* 1 0:
*/
private Integer isDelete;
private String createBy;
private String remark;
}

View File

@ -0,0 +1 @@
#com.zhilian.common.system.remote.factory.RemoteUserFallbackFactory

View File

@ -29,6 +29,7 @@ public class HeaderInterceptor implements AsyncHandlerInterceptor {
SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID));
SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME));
SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY));
SecurityContextHolder.setCompanySign(ServletUtils.getHeader(request, SecurityConstants.COMPANY_SIGN));
String token = SecurityUtils.getToken();
if (StringUtils.isNotEmpty(token)) {

View File

@ -44,9 +44,11 @@ public class TokenService {
String token = IdUtils.fastUUID();
Long userId = loginUser.getSysUser().getUserId();
String userName = loginUser.getSysUser().getUserName();
String companySign = loginUser.getSysUser().getDept().getCompanySign();
loginUser.setToken(token);
loginUser.setUserid(userId);
loginUser.setUsername(userName);
loginUser.setCompanySign(companySign);
loginUser.setIpaddr(IpUtils.getIpAddr());
refreshToken(loginUser);
@ -55,6 +57,7 @@ public class TokenService {
claimsMap.put(SecurityConstants.USER_KEY, token);
claimsMap.put(SecurityConstants.DETAILS_USER_ID, userId);
claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName);
claimsMap.put(SecurityConstants.COMPANY_SIGN,companySign);
// 接口返回信息
Map<String, Object> rspMap = new HashMap<String, Object>();

View File

@ -3,9 +3,12 @@ package com.zhilian.common.security.utils;
import com.zhilian.common.core.constant.SecurityConstants;
import com.zhilian.common.core.constant.TokenConstants;
import com.zhilian.common.core.context.SecurityContextHolder;
import com.zhilian.common.core.utils.JwtUtils;
import com.zhilian.common.core.utils.ServletUtils;
import com.zhilian.common.core.utils.StringUtils;
import com.zhilian.common.system.domain.LoginUser;
import io.jsonwebtoken.Claims;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import javax.servlet.http.HttpServletRequest;
@ -30,6 +33,13 @@ public class SecurityUtils {
return SecurityContextHolder.getUserName();
}
/**
*
*/
public static String getCompanySign () {
return SecurityContextHolder.getCompanySign();
}
/**
* key
*/

View File

@ -27,6 +27,11 @@ public class LoginUser implements Serializable {
*/
private String username;
/**
*
*/
private String companySign;
/**
*
*/
@ -128,4 +133,12 @@ public class LoginUser implements Serializable {
public void setSysUser (SysUser sysUser) {
this.sysUser = sysUser;
}
public String getCompanySign() {
return companySign;
}
public void setCompanySign(String companySign) {
this.companySign = companySign;
}
}

View File

@ -44,6 +44,12 @@ public class SysDept extends BaseEntity {
*/
private String ancestors;
/**
*
*/
private String companySign;
/**
*
*/

View File

@ -45,6 +45,11 @@ public class SysUser extends BaseEntity {
@Excel(name = "部门编号", type = Type.IMPORT)
private Long deptId;
// /**
// * 企业标识
// */
// private String companySign;
/**
*
*/

View File

@ -12,7 +12,6 @@ import org.springframework.web.multipart.MultipartFile;
/**
*
*
* @author zhilian
*/
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)

View File

@ -66,11 +66,13 @@ public class AuthFilter implements GlobalFilter, Ordered {
if (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username)) {
return unauthorizedResponse(exchange, "令牌验证失败");
}
String companySign = JwtUtils.getCompanySign(claims);
// 设置用户信息到请求
addHeader(mutate, SecurityConstants.USER_KEY, userkey);
addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid);
addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username);
addHeader(mutate, SecurityConstants.COMPANY_SIGN, companySign);
// 内部请求来源参数清除
removeHeader(mutate, SecurityConstants.FROM_SOURCE);
return chain.filter(exchange.mutate().request(mutate.build()).build());

View File

@ -38,3 +38,4 @@ spring:
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow

View File

@ -13,6 +13,11 @@
<module>zhilian-gen</module>
<module>zhilian-job</module>
<module>zhilian-file</module>
<module>zhilian-online</module>
<module>zhilian-resolver</module>
<module>zhilian-business</module>
<module>zhilian-manager</module>
<module>zhilian-message</module>
</modules>
<artifactId>zhilian-modules</artifactId>

View File

@ -0,0 +1,115 @@
<?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-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>
<description>
zhilian-business 业务模块
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Apache Velocity -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- zhilian Common Log -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-business</artifactId>
</dependency>
<!-- zhilian Common Swagger -->
<dependency>
<groupId>com.zhilian</groupId>
<artifactId>zhilian-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,42 @@
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();
}
}

View File

@ -0,0 +1,102 @@
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;
}
}

View File

@ -0,0 +1,82 @@
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);
}
}

View File

@ -0,0 +1,116 @@
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;
}
}

View File

@ -0,0 +1,95 @@
package com.zhilian.business.controller;
import com.zhilian.business.domain.Fence;
import com.zhilian.common.core.domain.Result;
import com.zhilian.common.core.web.controller.BaseController;
import com.zhilian.business.service.FenceService;
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 FenceController
* @Description
* @Author ZeJinG.Su
* @Date 14:37 2024/3/29
*/
@RestController
@RequestMapping("fence")
public class FenceController extends BaseController {
@Autowired
private FenceService fenceService;
/**
*
* @param fence
* @return
*/
@PostMapping("/list")
public Result<TableDataInfo<Fence>> fenceList(@RequestBody Fence fence) {
startPage();
List<Fence> result = fenceService.fenceList(fence);
return getDataTable(result);
}
/**
* redis
*/
public void fenceRedisData() {
fenceService.fenceRedisData();
}
/**
*
* @param fence
* @return
*/
@PostMapping("/fenceAdd")
public Result fenceAdd(@RequestBody Fence fence) {
fence.setUpdateBy(SecurityUtils.getUsername());
fence.setUpdateTime(new Date());
return toAjax(fenceService.saveFence(fence));
}
/**
*
* @param fence
* @return
*/
@PostMapping("/fenceUpdate")
public Result fenceUpdate(@RequestBody Fence fence) {
fence.setUpdateBy(SecurityUtils.getUsername());
fence.setUpdateTime(new Date());
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));
}
/**
*
* @param
* @return
*/
@PostMapping("/fenceDelete/{fenceId}")
public Result fenceDelete(@PathVariable Long fenceId) {
return toAjax(fenceService.removeByFence(fenceId));
}
}

View File

@ -0,0 +1,119 @@
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);
}
}

View File

@ -0,0 +1,29 @@
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());
}
}

View File

@ -0,0 +1,148 @@
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));
}
}

View File

@ -0,0 +1,24 @@
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());
}
}

View File

@ -0,0 +1,25 @@
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);
}
}

View File

@ -0,0 +1,44 @@
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;
}

View File

@ -0,0 +1,32 @@
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;
}

View File

@ -0,0 +1,33 @@
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;
}

View File

@ -0,0 +1,112 @@
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();
}
}

View File

@ -0,0 +1,22 @@
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;
}

View File

@ -0,0 +1,28 @@
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;
}

View File

@ -0,0 +1,32 @@
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);
}

View File

@ -0,0 +1,27 @@
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);
}

View File

@ -0,0 +1,69 @@
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();
}

View File

@ -0,0 +1,12 @@
package com.zhilian.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhilian.business.domain.Fence;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@Mapper
@Component
public interface FenceMapper extends BaseMapper<Fence> {
}

View File

@ -0,0 +1,14 @@
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);
}

View File

@ -0,0 +1,11 @@
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> {
}

View File

@ -0,0 +1,17 @@
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();
}

View File

@ -0,0 +1,11 @@
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> {
}

View File

@ -0,0 +1,13 @@
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> {
}

View File

@ -0,0 +1,29 @@
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);
}

View File

@ -0,0 +1,21 @@
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);
}

View File

@ -0,0 +1,18 @@
package com.zhilian.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhilian.business.domain.Fence;
import java.util.List;
public interface FenceService extends IService<Fence> {
List<Fence> fenceList(Fence fence);
void fenceRedisData();
boolean saveFence(Fence fence);
boolean updateByMap(Fence fence);
boolean removeByFence(Long fenceId);
}

View File

@ -0,0 +1,67 @@
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();
}

View File

@ -0,0 +1,12 @@
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);
}

View File

@ -0,0 +1,13 @@
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();
}

View File

@ -0,0 +1,16 @@
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);
}

View File

@ -0,0 +1,20 @@
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();
}

View File

@ -0,0 +1,14 @@
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();
}

View File

@ -0,0 +1,96 @@
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;
}
}

View File

@ -0,0 +1,51 @@
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);
}
}

View File

@ -0,0 +1,101 @@
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();
}
}

View File

@ -0,0 +1,114 @@
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.zhilian.business.domain.Fence;
import com.zhilian.business.domain.middle.MarkersFence;
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.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.ArrayList;
import java.util.List;
@Service
public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements FenceService {
@Autowired
private RedisService redisService;
@Autowired
private MarkersFenceMapper markersFenceMapper;
private static final String FENCE_INFO_KEY = "fence_info:";
//电子围栏信息查询
@Override
public List<Fence> fenceList(Fence fence) {
if (fence.getFenceName() == null && fence.getFenceTypeId() == null && fence.getFenceState() == null) {
return this.list();
}
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
// 模糊条件 - 电子围栏名称
if (StringUtils.isNotEmpty(fence.getFenceName())) {
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;
}
}

View File

@ -0,0 +1,39 @@
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);
}
}

View File

@ -0,0 +1,43 @@
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;
}
}

View File

@ -0,0 +1,74 @@
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);
}
}

View File

@ -0,0 +1,109 @@
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;
}
}

View File

@ -0,0 +1,26 @@
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();
}
}

View File

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

View File

@ -0,0 +1,25 @@
# Tomcat
server:
port: 9903
# Spring
spring:
application:
# 应用名称
name: zhilian-business
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 10.10.25.2:8848
config:
# 配置中心地址
server-addr: 10.10.25.2:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

Some files were not shown because too many files have changed in this diff Show More