Compare commits
52 Commits
Author | SHA1 | Date |
---|---|---|
|
a1ed677f0f | |
|
2e5cb19f4f | |
|
51ca5ef6f4 | |
|
2695602972 | |
|
eb5960822e | |
|
620decf638 | |
|
bfa5391ae1 | |
|
3629d522bb | |
|
d2462e6456 | |
|
d2b29e6323 | |
|
afdcc48a42 | |
|
74739614e5 | |
|
dc4f5bbdcb | |
|
9e1f941be5 | |
|
689a630024 | |
|
8ac2d539f4 | |
|
75f8da414d | |
|
6903066127 | |
|
c5de9a5bed | |
|
edb3e74824 | |
|
2430d10401 | |
|
929275fd5a | |
|
802cd54947 | |
|
a00e5345b4 | |
|
3c1b78218e | |
|
849d5328ac | |
|
152296d63a | |
|
30560b90cf | |
|
0be090d11b | |
|
b29363a31a | |
|
3b35565404 | |
|
846a03f75c | |
|
542a656dc6 | |
|
832da812c3 | |
|
a834f9d1bd | |
|
960d68f72e | |
|
2c5387f048 | |
|
f57deada17 | |
|
eade0c66ea | |
|
ef0311d362 | |
|
0a2fc7a9ce | |
|
98560aacdc | |
|
4e1790a47c | |
|
d02813f7e4 | |
|
0e391451b0 | |
|
f56787b5a8 | |
|
7033d0e9dd | |
|
84b54e9116 | |
|
5bb0737c82 | |
|
d1440fb706 | |
|
3ed255fe1e | |
|
1d91e51199 |
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
<artifactId>cloud-common-rabbit</artifactId>
|
<artifactId>cloud-common-rabbit</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
cloud-common-rabbit 模块,提供RabbitMq消息队列的相关配置
|
||||||
|
</description>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
|
|
@ -63,4 +63,5 @@ public class LoginUser implements Serializable {
|
||||||
*/
|
*/
|
||||||
private SysUser sysUser;
|
private SysUser sysUser;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有故障缓存服务
|
||||||
|
*/
|
||||||
|
public class AllFaultCacheService extends CacheAbsBacis {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllFault:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllFault:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.req.FenceReq;
|
||||||
|
import com.muyu.domain.resp.FenceResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有电子围栏缓存
|
||||||
|
*/
|
||||||
|
public class AllFenceCahceService extends CacheAbsBacis<String, FenceResp> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllFence:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllFence:info:", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.MessageTemplate;
|
||||||
|
import com.muyu.domain.MessageValue;
|
||||||
|
import com.muyu.domain.req.MessageValueReq;
|
||||||
|
import com.muyu.domain.resp.MessageValueListResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版缓存
|
||||||
|
*/
|
||||||
|
public class AllMessageValueCacheService extends CacheAbsBacis<String, List<MessageValueListResp>> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllMessagevalue:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllMessagevalue:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.req.VehicleAddReq;
|
||||||
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有车辆缓存
|
||||||
|
*/
|
||||||
|
public class AllVehicleCacheService extends CacheAbsBacis<String, VehicleManageResp> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存key前缀
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllVehicle:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllVehicle:info:", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.VehicleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有车辆类型缓存
|
||||||
|
*/
|
||||||
|
public class AllVehicleTypeCacheService extends CacheAbsBacis<String, VehicleType> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllVehicleType:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllVehicleType:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警规则缓存服务
|
||||||
|
*/
|
||||||
|
public class AllWarnRuleCacheService extends CacheAbsBacis<String, WarnRule> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllWarnRule:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllWarnRule:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
|
import com.muyu.domain.resp.WarnVehicleResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略缓存服务
|
||||||
|
*/
|
||||||
|
public class AllWarnStrategyAndVinCacheService extends CacheAbsBacis<String, WarnStrategyAndVinResp> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllWarnStrategy:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllWarnStrategy:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
|
import com.muyu.domain.resp.WarnVehicleResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警策略缓存服务
|
||||||
|
*/
|
||||||
|
public class AllWarnStrategyCacheService extends CacheAbsBacis<String, WarnVehicleResp> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "AllWarnStrategy:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("AllWarnStrategy:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,9 @@ package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.CacheAbsBacis;
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
import com.muyu.domain.Fence;
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.resp.FenceResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子围栏缓存
|
* 电子围栏缓存
|
||||||
|
@ -21,4 +24,5 @@ public class FenceCahceService extends CacheAbsBacis<String, Fence> {
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("fence:info:", "");
|
return key.replace("fence:info:", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.MessageTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版缓存
|
||||||
|
*/
|
||||||
|
public class MessageTemplateCacheService extends CacheAbsBacis<String, MessageTemplate> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "messageTemplate:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("messageTemplate:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.MessageValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版缓存
|
||||||
|
*/
|
||||||
|
public class MessageValueCacheService extends CacheAbsBacis<String, MessageValue> {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "messagevalue:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("messagevalue:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import com.muyu.common.cache.CacheAbsBacis;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆缓存
|
* 添加车辆缓存
|
||||||
*/
|
*/
|
||||||
public class VehicleCacheService extends CacheAbsBacis<String, Vehicle> {
|
public class VehicleCacheService extends CacheAbsBacis<String, Vehicle> {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
|
import com.muyu.domain.VehicleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型
|
||||||
|
*/
|
||||||
|
public class VehicleTypeCacheService extends CacheAbsBacis<String, VehicleType> {
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPre() {
|
||||||
|
return "vehicleType:info:";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String decode(String key) {
|
||||||
|
return key.replace("vehicleType:info:", "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,11 +14,11 @@ public class WarnRuleCacheService extends CacheAbsBacis<String, WarnRule> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "warn:info:";
|
return "warnRule:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("warn:info:", "");
|
return key.replace("warnRule:info:", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,12 @@ package com.muyu.enterprise.cache;
|
||||||
import com.muyu.common.cache.CacheAbsBacis;
|
import com.muyu.common.cache.CacheAbsBacis;
|
||||||
import com.muyu.domain.WarnRule;
|
import com.muyu.domain.WarnRule;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警规则缓存服务
|
* 预警策略缓存服务
|
||||||
*/
|
*/
|
||||||
public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnStrategy> {
|
public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnRuleResp> {
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
|
||||||
|
@ -15,11 +16,11 @@ public class WarnStrategyCacheService extends CacheAbsBacis<String, WarnStrategy
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "warn:info:";
|
return "warnStrategy:info:";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("warn:info:", "");
|
return key.replace("warnStrategy:info:", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,18 @@
|
||||||
com.muyu.enterprise.cache.VehicleCacheService
|
com.muyu.enterprise.cache.AllFaultCacheService
|
||||||
|
com.muyu.enterprise.cache.AllFenceCahceService
|
||||||
|
com.muyu.enterprise.cache.AllMessageValueCacheService
|
||||||
|
com.muyu.enterprise.cache.AllVehicleCacheService
|
||||||
|
com.muyu.enterprise.cache.AllVehicleTypeCacheService
|
||||||
|
com.muyu.enterprise.cache.AllWarnRuleCacheService
|
||||||
|
com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService
|
||||||
|
com.muyu.enterprise.cache.AllWarnStrategyCacheService
|
||||||
com.muyu.enterprise.cache.FaultCacheService
|
com.muyu.enterprise.cache.FaultCacheService
|
||||||
com.muyu.enterprise.cache.FenceCahceService
|
com.muyu.enterprise.cache.FenceCahceService
|
||||||
|
com.muyu.enterprise.cache.MessageTemplateCacheService
|
||||||
|
com.muyu.enterprise.cache.MessageValueCacheService
|
||||||
|
com.muyu.enterprise.cache.VehicleCacheService
|
||||||
|
com.muyu.enterprise.cache.VehicleTypeCacheService
|
||||||
com.muyu.enterprise.cache.WarnRuleCacheService
|
com.muyu.enterprise.cache.WarnRuleCacheService
|
||||||
com.muyu.enterprise.cache.WarnStrategyCacheService
|
com.muyu.enterprise.cache.WarnStrategyCacheService
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,7 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiDongJia
|
* 报文模版
|
||||||
* @Package: com.muyu.car.domain
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: MessageTemplate
|
|
||||||
* @Date: 2024/9/18 21:11
|
|
||||||
* @Description: 报文模版
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
|
|
|
@ -119,6 +119,10 @@ public class Vehicle extends BaseEntity {
|
||||||
@Schema(type = "Integer",description = "电子围栏外键")
|
@Schema(type = "Integer",description = "电子围栏外键")
|
||||||
private Integer fenceGroupId;
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
private Long warnStrategyId;
|
||||||
|
|
||||||
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
public static Vehicle addBuild(VehicleAddReq vehicleAddReq){
|
||||||
return Vehicle.builder()
|
return Vehicle.builder()
|
||||||
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
.licenceNumber(vehicleAddReq.getLicenceNumber())
|
||||||
|
@ -132,6 +136,7 @@ public class Vehicle extends BaseEntity {
|
||||||
.vehicleStatus(vehicleAddReq.getVehicleStatus())
|
.vehicleStatus(vehicleAddReq.getVehicleStatus())
|
||||||
.companyId(vehicleAddReq.getCompanyId())
|
.companyId(vehicleAddReq.getCompanyId())
|
||||||
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
.fenceGroupId(vehicleAddReq.getFenceGroupId())
|
||||||
|
.warnStrategyId(vehicleAddReq.getWarnStrategyId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +154,7 @@ public class Vehicle extends BaseEntity {
|
||||||
.vehicleStatus(vehicleUpdReq.getVehicleStatus())
|
.vehicleStatus(vehicleUpdReq.getVehicleStatus())
|
||||||
.companyId(vehicleUpdReq.getCompanyId())
|
.companyId(vehicleUpdReq.getCompanyId())
|
||||||
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
.fenceGroupId(vehicleUpdReq.getFenceGroupId())
|
||||||
|
.warnStrategyId(vehicleUpdReq.getWarnStrategyId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@ package com.muyu.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.muyu.common.core.annotation.Excel;
|
|
||||||
import com.muyu.common.core.annotation.Excel.ColumnType;
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
@ -44,7 +41,16 @@ public class VehicleType extends BaseEntity {
|
||||||
* 报文模版外键
|
* 报文模版外键
|
||||||
*/
|
*/
|
||||||
@Schema(type = "Integer",description = "报文模版外键")
|
@Schema(type = "Integer",description = "报文模版外键")
|
||||||
private Integer messageTemplateId;
|
private Long messageTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加车辆类型
|
||||||
|
*/
|
||||||
|
public static VehicleType addBuilder(VehicleType vehicleType) {
|
||||||
|
return VehicleType.builder().
|
||||||
|
vehicleTypeId(vehicleType.getVehicleTypeId()).
|
||||||
|
vehicleTypeName(vehicleType.getVehicleTypeName()).
|
||||||
|
build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,6 @@ public class WarnRule extends BaseEntity{
|
||||||
@Excel(name = "规则名称")
|
@Excel(name = "规则名称")
|
||||||
private String ruleName;
|
private String ruleName;
|
||||||
|
|
||||||
/** 策略id */
|
|
||||||
@Schema(type = "Integer",description = "策略id")
|
|
||||||
@Excel(name = "策略id")
|
|
||||||
private Integer strategyId;
|
|
||||||
|
|
||||||
/** 报文数据类型id */
|
/** 报文数据类型id */
|
||||||
@Schema(type = "Integer",description = "报文数据类型id")
|
@Schema(type = "Integer",description = "报文数据类型id")
|
||||||
@Excel(name = "报文数据类型id")
|
@Excel(name = "报文数据类型id")
|
||||||
|
@ -75,11 +70,18 @@ public class WarnRule extends BaseEntity{
|
||||||
@Excel(name = "最小值")
|
@Excel(name = "最小值")
|
||||||
private Integer minValue;
|
private Integer minValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略外键id
|
||||||
|
*/
|
||||||
|
@Schema(type = "Integer",description = "策略外键id")
|
||||||
|
@Excel(name = "策略外键id")
|
||||||
|
private Integer warnStrategyId;
|
||||||
|
|
||||||
|
|
||||||
public static WarnRule updateBuilder(WarnRule warnRule, Supplier<Long> supplier) {
|
public static WarnRule updateBuilder(WarnRule warnRule, Supplier<Long> supplier) {
|
||||||
return WarnRule.builder()
|
return WarnRule.builder()
|
||||||
.warnRuleId(supplier.get())
|
.warnRuleId(supplier.get())
|
||||||
.ruleName(warnRule.getRuleName())
|
.ruleName(warnRule.getRuleName())
|
||||||
.strategyId(warnRule.getStrategyId())
|
|
||||||
.msgTypeId(warnRule.getMsgTypeId())
|
.msgTypeId(warnRule.getMsgTypeId())
|
||||||
.slideTime(warnRule.getSlideTime())
|
.slideTime(warnRule.getSlideTime())
|
||||||
.slideFrequency(warnRule.getSlideFrequency())
|
.slideFrequency(warnRule.getSlideFrequency())
|
||||||
|
@ -94,7 +96,6 @@ public class WarnRule extends BaseEntity{
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("id", getWarnRuleId())
|
.append("id", getWarnRuleId())
|
||||||
.append("ruleName", getRuleName())
|
.append("ruleName", getRuleName())
|
||||||
.append("strategyId", getStrategyId())
|
|
||||||
.append("msgTypeId", getMsgTypeId())
|
.append("msgTypeId", getMsgTypeId())
|
||||||
.append("slideTime", getSlideTime())
|
.append("slideTime", getSlideTime())
|
||||||
.append("slideFrequency", getSlideFrequency())
|
.append("slideFrequency", getSlideFrequency())
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class WarnStrategy extends BaseEntity{
|
||||||
private Long vehicleTypeId;
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static WarnStrategy updateBuilder(WarnStrategy warnStrategy, Supplier<Long> supplier) {
|
public static WarnStrategy updateBuilder(WarnStrategy warnStrategy, Supplier<Long> supplier) {
|
||||||
return WarnStrategy.builder()
|
return WarnStrategy.builder()
|
||||||
.warnStrategyId(supplier.get())
|
.warnStrategyId(supplier.get())
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定围栏组请求参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Tag(name = "绑定围栏组参数")
|
||||||
|
public class BoundFenceGroupReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆Id
|
||||||
|
*/
|
||||||
|
private Long vehicleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 围栏组Ids
|
||||||
|
*/
|
||||||
|
private Long[] fenceGroupIds;
|
||||||
|
}
|
|
@ -1,55 +0,0 @@
|
||||||
//package com.muyu.domain.req;
|
|
||||||
//
|
|
||||||
//import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
//import com.muyu.domain.Fence;
|
|
||||||
//import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
//import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
//import lombok.AllArgsConstructor;
|
|
||||||
//import lombok.Builder;
|
|
||||||
//import lombok.Data;
|
|
||||||
//import lombok.NoArgsConstructor;
|
|
||||||
//
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
//@Data
|
|
||||||
//@Builder
|
|
||||||
//@AllArgsConstructor
|
|
||||||
//@NoArgsConstructor
|
|
||||||
//@Tag(name = "查看绑定的围栏信息")
|
|
||||||
//public class HaveFence {
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 主键
|
|
||||||
// */
|
|
||||||
// @Schema(type = "Long",description = "主键")
|
|
||||||
// @TableId(value = "id",type = IdType.AUTO)
|
|
||||||
// private Long id;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 围栏名称
|
|
||||||
// */
|
|
||||||
// @Schema(type = "String",description = "围栏名称")
|
|
||||||
// private String fenceName;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 坐标
|
|
||||||
// */
|
|
||||||
// @Schema(type = "String",description = "坐标")
|
|
||||||
// private String coordinates;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 描述
|
|
||||||
// */
|
|
||||||
// @Schema(type = "String",description = "描述")
|
|
||||||
// private String description;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 电子围栏列表
|
|
||||||
// */
|
|
||||||
// @Schema(type = "List<Fence>",description = "电子围栏列表")
|
|
||||||
// List<Fence> fenceList;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain.req;
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -94,4 +96,9 @@ public class VehicleAddReq {
|
||||||
*/
|
*/
|
||||||
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||||
private Integer fenceGroupId;
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long warnStrategyId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.domain.req;
|
package com.muyu.domain.req;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -94,4 +96,11 @@ public class VehicleUpdReq {
|
||||||
*/
|
*/
|
||||||
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
@Schema(title = "电子围栏外键", type = "Integer", defaultValue = "1", description = "电子围栏外键")
|
||||||
private Integer fenceGroupId;
|
private Integer fenceGroupId;
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,7 @@ public class WarnVehicleReq {
|
||||||
@Excel(name = "策略名称")
|
@Excel(name = "策略名称")
|
||||||
private String strategyName;
|
private String strategyName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,12 @@ public class MessageValueListResp {
|
||||||
@Schema(type = "Integer",title = "起始下标")
|
@Schema(type = "Integer",title = "起始下标")
|
||||||
private Integer messageStartIndex;
|
private Integer messageStartIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版外键
|
||||||
|
*/
|
||||||
|
@Schema(type = "Long",description = "报文模版主键")
|
||||||
|
private Long messageTemplateId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终止下标
|
* 终止下标
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "规则列表", description = "规则列表")
|
||||||
|
public class WarnRuleResp {
|
||||||
|
|
||||||
|
/** 策略id */
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
/** 策略名称 */
|
||||||
|
@Schema(type = "String",description = "策略名称")
|
||||||
|
@Excel(name = "策略名称")
|
||||||
|
private String strategyName;
|
||||||
|
|
||||||
|
/** 报文模版id */
|
||||||
|
@Schema(type = "Integer",description = "报文模版id")
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Integer messageTemplateId;
|
||||||
|
|
||||||
|
/** 车辆类型id */
|
||||||
|
@Schema(type = "Long",description = "车辆类型id")
|
||||||
|
@Excel(name = "车辆类型id")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/** 规则集合 */
|
||||||
|
@Schema(type = "List",description = "规则集合")
|
||||||
|
private List<WarnRule> warnRuleList;
|
||||||
|
|
||||||
|
public static WarnRuleResp build(WarnStrategy warnStrategy, List<WarnRule> warnRuleList){
|
||||||
|
return WarnRuleResp.builder()
|
||||||
|
.warnStrategyId(warnStrategy.getWarnStrategyId())
|
||||||
|
.strategyName(warnStrategy.getStrategyName())
|
||||||
|
.messageTemplateId(warnStrategy.getMessageTemplateId())
|
||||||
|
.vehicleTypeId(warnStrategy.getVehicleTypeId())
|
||||||
|
.warnRuleList(warnRuleList)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.domain.resp;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Tag(name = "WarnStrategyAndVin缓存预警信息获取vin")
|
||||||
|
public class WarnStrategyAndVinResp {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Schema(type = "String",description = "车辆VIN")
|
||||||
|
@Excel(name = "车辆VIN")
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略id
|
||||||
|
*/
|
||||||
|
@Schema(type = "Long",description = "策略id")
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long warnStrategyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略名称
|
||||||
|
*/
|
||||||
|
@Schema(type = "String",description = "策略名称")
|
||||||
|
@Excel(name = "策略名称")
|
||||||
|
private String strategyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版id
|
||||||
|
*/
|
||||||
|
@Schema(type = "Integer",description = "报文模版id")
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Integer messageTemplateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆类型id
|
||||||
|
*/
|
||||||
|
@Schema(type = "Long",description = "车辆类型id")
|
||||||
|
@Excel(name = "车辆类型id")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
}
|
|
@ -66,4 +66,13 @@ public class WarnVehicleResp {
|
||||||
@Schema(type = "String",description = "报文模版名称")
|
@Schema(type = "String",description = "报文模版名称")
|
||||||
private String messageTemplateName;
|
private String messageTemplateName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文模版id
|
||||||
|
*/
|
||||||
|
@Schema(type = "Integer",description = "报文模版id")
|
||||||
|
@Excel(name = "报文模版id")
|
||||||
|
private Integer messageTemplateId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.controller;
|
||||||
import com.muyu.common.redis.service.RedisService;
|
import com.muyu.common.redis.service.RedisService;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.enterprise.cache.AllFenceCahceService;
|
||||||
import com.muyu.enterprise.cache.FenceCahceService;
|
import com.muyu.enterprise.cache.FenceCahceService;
|
||||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
import com.muyu.enterprise.service.ElectService;
|
import com.muyu.enterprise.service.ElectService;
|
||||||
|
@ -28,7 +29,9 @@ import java.security.Security;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏信息
|
||||||
|
*/
|
||||||
@RequestMapping("/elect")
|
@RequestMapping("/elect")
|
||||||
@RestController
|
@RestController
|
||||||
@Log4j2
|
@Log4j2
|
||||||
|
@ -43,6 +46,8 @@ public class ElectController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FenceCahceService fenceCahceService;
|
private FenceCahceService fenceCahceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AllFenceCahceService allFenceCahceService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +59,10 @@ public class ElectController extends BaseController {
|
||||||
public Result<TableDataInfo<FenceResp>> showList(@RequestBody @Validated FenceReq req) {
|
public Result<TableDataInfo<FenceResp>> showList(@RequestBody @Validated FenceReq req) {
|
||||||
startPage();
|
startPage();
|
||||||
List<FenceResp> list = electService.selectFenceList(req);
|
List<FenceResp> list = electService.selectFenceList(req);
|
||||||
fenceCahceService.get(String.valueOf(req));
|
//将列表存到Redis
|
||||||
|
for (FenceResp fenceResp : list) {
|
||||||
|
allFenceCahceService.put(fenceResp.getCoordinates(),fenceResp);
|
||||||
|
}
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +148,7 @@ public class ElectController extends BaseController {
|
||||||
@DeleteMapping("/delMoreFence")
|
@DeleteMapping("/delMoreFence")
|
||||||
@Operation(description = "批量删除电子围栏")
|
@Operation(description = "批量删除电子围栏")
|
||||||
public Result delMore(@RequestBody List<Long> fenceIds){
|
public Result delMore(@RequestBody List<Long> fenceIds){
|
||||||
// electService.delMoreFence(fenceIds);
|
//批量删除内容存到Redis
|
||||||
electService.removeBatchByIds(fenceIds);
|
electService.removeBatchByIds(fenceIds);
|
||||||
return Result.success(null,"操作成功");
|
return Result.success(null,"操作成功");
|
||||||
}
|
}
|
||||||
|
@ -155,5 +163,4 @@ public class ElectController extends BaseController {
|
||||||
return Result.success(fences);
|
return Result.success(fences);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.domain.MessageTemplate;
|
import com.muyu.domain.MessageTemplate;
|
||||||
import com.muyu.domain.req.MessageTemplateAddReq;
|
import com.muyu.domain.req.MessageTemplateAddReq;
|
||||||
import com.muyu.domain.resp.MessageTemplateListResp;
|
import com.muyu.domain.resp.MessageTemplateListResp;
|
||||||
|
import com.muyu.enterprise.cache.MessageTemplateCacheService;
|
||||||
import com.muyu.enterprise.service.MessageTemplateService;
|
import com.muyu.enterprise.service.MessageTemplateService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
@ -30,6 +33,11 @@ public class MessageTemplateController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MessageTemplateService messageTemplateService;
|
private MessageTemplateService messageTemplateService;
|
||||||
|
|
||||||
|
//缓存
|
||||||
|
@Autowired
|
||||||
|
private MessageTemplateCacheService templateCacheService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报文模版列表查询
|
* 报文模版列表查询
|
||||||
*1
|
*1
|
||||||
|
@ -55,8 +63,14 @@ public class MessageTemplateController {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/")
|
@PostMapping("/")
|
||||||
public Result<String> save(@RequestBody MessageTemplateAddReq messageTemplateAddReq) {
|
public Result<String> save(@RequestBody MessageTemplateAddReq messageTemplateAddReq) {
|
||||||
messageTemplateService.save(MessageTemplate.addBuild(messageTemplateAddReq));
|
boolean save = messageTemplateService.save(MessageTemplate.addBuild(messageTemplateAddReq));
|
||||||
return Result.success("添加成功");
|
//获取用户信息
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
//获取租户唯一标识
|
||||||
|
String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||||
|
//添加到缓存
|
||||||
|
templateCacheService.put(databaseName+messageTemplateAddReq.getMessageTemplateName(), MessageTemplate.addBuild(messageTemplateAddReq));
|
||||||
|
return Result.success(save? "新增成功" : "新增失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.cache.AllMessageValueCacheService;
|
||||||
import com.muyu.enterprise.service.MessageValueService;
|
import com.muyu.enterprise.service.MessageValueService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.domain.MessageValue;
|
import com.muyu.domain.MessageValue;
|
||||||
|
@ -32,6 +33,11 @@ public class MessageValueController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MessageValueService messageValueService;
|
private MessageValueService messageValueService;
|
||||||
|
|
||||||
|
//存Redis
|
||||||
|
@Autowired
|
||||||
|
private AllMessageValueCacheService allMessageValueCacheService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报文数据列表查询
|
* 报文数据列表查询
|
||||||
*
|
*
|
||||||
|
@ -42,6 +48,9 @@ public class MessageValueController {
|
||||||
@Operation(summary = "报文数据列表", description = "根据报文类别, 报文模版筛选报文数据")
|
@Operation(summary = "报文数据列表", description = "根据报文类别, 报文模版筛选报文数据")
|
||||||
public Result<List<MessageValueListResp>> findAll(@RequestBody MessageValueReq messageValueReq) {
|
public Result<List<MessageValueListResp>> findAll(@RequestBody MessageValueReq messageValueReq) {
|
||||||
List<MessageValueListResp> list = messageValueService.findAll(messageValueReq);
|
List<MessageValueListResp> list = messageValueService.findAll(messageValueReq);
|
||||||
|
// for (MessageValueListResp messageValueListResp : list) {
|
||||||
|
// allMessageValueCacheService.put(String.valueOf(messageValueListResp.getMessageTemplateId()), (List<MessageValueListResp>) messageValueListResp);
|
||||||
|
// }
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +102,7 @@ public class MessageValueController {
|
||||||
@Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
@Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
||||||
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId) {
|
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId) {
|
||||||
List<MessageValueListResp> list = messageValueService.findByTemplateId(templateId);
|
List<MessageValueListResp> list = messageValueService.findByTemplateId(templateId);
|
||||||
|
allMessageValueCacheService.put(String.valueOf(templateId), list);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,14 @@ package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
|
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService;
|
||||||
import com.muyu.enterprise.cache.VehicleCacheService;
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||||
import com.muyu.enterprise.service.VehicleService;
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
@ -14,14 +21,17 @@ import com.muyu.domain.req.VehicleAddReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.req.VehicleUpdReq;
|
import com.muyu.domain.req.VehicleUpdReq;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import com.muyu.enterprise.service.WarnStrategyService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,9 +51,20 @@ public class VehicleController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleService vehicleService;
|
private VehicleService vehicleService;
|
||||||
|
|
||||||
//车辆缓存
|
//添加车辆缓存
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleCacheService vehicleCacheService;
|
private VehicleCacheService vehicleCacheService;
|
||||||
|
//车辆信息
|
||||||
|
@Autowired
|
||||||
|
private AllVehicleCacheService allVehicleCacheService;
|
||||||
|
//缓存策略和vin
|
||||||
|
@Autowired
|
||||||
|
private AllWarnStrategyAndVinCacheService allWarnStrategyAndVinCacheService;
|
||||||
|
//缓存策略
|
||||||
|
@Autowired
|
||||||
|
private WarnStrategyService warnStrategyService;
|
||||||
|
@Autowired
|
||||||
|
private WarnStrategyCacheService warnStrategyCacheService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,6 +77,15 @@ public class VehicleController extends BaseController {
|
||||||
public Result<TableDataInfo<VehicleManageResp>> getVehicleList(@RequestBody VehicleManageReq vehicleManageReq) {
|
public Result<TableDataInfo<VehicleManageResp>> getVehicleList(@RequestBody VehicleManageReq vehicleManageReq) {
|
||||||
startPage();
|
startPage();
|
||||||
List<VehicleManageResp> list = vehicleService.getVehicleList(vehicleManageReq);
|
List<VehicleManageResp> list = vehicleService.getVehicleList(vehicleManageReq);
|
||||||
|
|
||||||
|
List<Vehicle> vehicleList = vehicleService.list();
|
||||||
|
vehicleList.forEach(vehicle -> {
|
||||||
|
vehicleCacheService.put(vehicle.getVehicleVin(), vehicle);
|
||||||
|
if(vehicle.getWarnStrategyId()!=null){
|
||||||
|
WarnRuleResp respList = warnStrategyService.findByWarnStrategyId(vehicle.getWarnStrategyId());
|
||||||
|
warnStrategyCacheService.put(vehicle.getVehicleVin(), respList);
|
||||||
|
}
|
||||||
|
});
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,11 +172,12 @@ public class VehicleController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 车辆绑定围栏组
|
* 车辆绑定围栏组
|
||||||
*/
|
*/
|
||||||
@GetMapping("/addBoundFenceGroup")
|
@PostMapping("/addBoundFenceGroup")
|
||||||
@Operation(description = "车辆绑定围栏组")
|
@Operation(description = "车辆绑定围栏组")
|
||||||
public Result<String> boundFenceGroup(
|
public Result boundFenceGroup(
|
||||||
@Validated @RequestBody BoundMiddle boundMiddle){
|
@Validated @RequestBody BoundFenceGroupReq boundFenceGroupReq){
|
||||||
return null;
|
vehicleService.boundFenceGroup(boundFenceGroupReq);
|
||||||
|
return Result.success("绑定成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,4 +191,5 @@ public class VehicleController extends BaseController {
|
||||||
Long templateId = vehicleService.findByVehicleVin(vehicleVin);
|
Long templateId = vehicleService.findByVehicleVin(vehicleVin);
|
||||||
return Result.success(templateId);
|
return Result.success(templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
import com.muyu.domain.MessageValue;
|
||||||
import com.muyu.domain.VehicleType;
|
import com.muyu.domain.VehicleType;
|
||||||
|
import com.muyu.domain.req.MessageValueAddReq;
|
||||||
|
import com.muyu.domain.req.VehicleAddReq;
|
||||||
|
import com.muyu.enterprise.cache.AllVehicleTypeCacheService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleTypeCacheService;
|
||||||
import com.muyu.enterprise.service.VehicleTypeService;
|
import com.muyu.enterprise.service.VehicleTypeService;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -30,13 +36,47 @@ public class VehicleTypeController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleTypeService vehicleTypeService;
|
private VehicleTypeService vehicleTypeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleTypeCacheService vehicleTypeCacheService;
|
||||||
|
|
||||||
|
//存缓存
|
||||||
|
@Autowired
|
||||||
|
private AllVehicleTypeCacheService allVehicleTypeCacheService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有车辆类型
|
* 查询所有车辆类型
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(path = "/", method = RequestMethod.POST)
|
@RequestMapping(path = "/findAll", method = RequestMethod.POST)
|
||||||
@Operation(summary = "车辆类型列表",description = "车辆类型列表")
|
@Operation(summary = "车辆类型列表",description = "车辆类型列表")
|
||||||
public Result<List<VehicleType>> findAll(){
|
public Result<List<VehicleType>> findAll(){
|
||||||
return Result.success(vehicleTypeService.list());
|
List<VehicleType> list = vehicleTypeService.list();
|
||||||
|
// for (VehicleType vehicleType : list) {
|
||||||
|
// allVehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()),vehicleType);
|
||||||
|
// }
|
||||||
|
list.forEach(vehicleType -> {
|
||||||
|
vehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()), vehicleType);
|
||||||
|
});
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加车辆类型
|
||||||
|
* @param vehicleType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(summary = "添加报文数据", description = "新增报文数据")
|
||||||
|
public Result<String> save(@RequestBody VehicleType vehicleType) {
|
||||||
|
boolean save = vehicleTypeService.save(vehicleType);
|
||||||
|
// //获取用户信息
|
||||||
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
// //获取租户唯一标识
|
||||||
|
// String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||||
|
//存到redis
|
||||||
|
// vehicleTypeCacheService.put(databaseName+vehicleType.getVehicleTypeId(),vehicleType);
|
||||||
|
vehicleTypeCacheService.put(String.valueOf(vehicleType.getVehicleTypeId()),vehicleType);
|
||||||
|
return Result.success(save? "添加成功" : "添加失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.domain.WarnRule;
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.enterprise.cache.AllWarnRuleCacheService;
|
||||||
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
||||||
import com.muyu.enterprise.service.WarnRuleService;
|
import com.muyu.enterprise.service.WarnRuleService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
@ -22,6 +23,10 @@ public class WarnRuleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnRuleCacheService warnRuleCacheService;
|
private WarnRuleCacheService warnRuleCacheService;
|
||||||
|
|
||||||
|
//存列表
|
||||||
|
@Autowired
|
||||||
|
private AllWarnRuleCacheService allWarnRuleCacheServicel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 规则列表
|
* 规则列表
|
||||||
* @return
|
* @return
|
||||||
|
@ -29,7 +34,11 @@ public class WarnRuleController {
|
||||||
@RequestMapping(path = "/ruleList",method = RequestMethod.POST)
|
@RequestMapping(path = "/ruleList",method = RequestMethod.POST)
|
||||||
@Operation(summary = "规则列表", description = "获取所有规则列表")
|
@Operation(summary = "规则列表", description = "获取所有规则列表")
|
||||||
public Result<List<WarnRule>> ruleList(){
|
public Result<List<WarnRule>> ruleList(){
|
||||||
return Result.success(warnRuleService.list());
|
List<WarnRule> list = warnRuleService.list();
|
||||||
|
for (WarnRule warnRule : list) {
|
||||||
|
allWarnRuleCacheServicel.put(warnRule.getRuleName(),warnRule);
|
||||||
|
}
|
||||||
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,4 +92,13 @@ public class WarnRuleController {
|
||||||
return Result.success(warnRuleService.removeById(id));
|
return Result.success(warnRuleService.removeById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据外键id查询集合
|
||||||
|
*/
|
||||||
|
@GetMapping("/getWarnStrategyList/{warnStrategyId}")
|
||||||
|
@Operation(summary = "根据外键id查询集合", description = "根据外键id查询集合")
|
||||||
|
public Result<List<WarnRule>> findByWarnStrategyId(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||||
|
List<WarnRule> list = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,10 @@ import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
|
import com.muyu.enterprise.cache.AllWarnStrategyAndVinCacheService;
|
||||||
|
import com.muyu.enterprise.cache.AllWarnStrategyCacheService;
|
||||||
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||||
import com.muyu.enterprise.service.WarnStrategyService;
|
import com.muyu.enterprise.service.WarnStrategyService;
|
||||||
import com.muyu.domain.req.WarnVehicleReq;
|
import com.muyu.domain.req.WarnVehicleReq;
|
||||||
|
@ -26,14 +30,28 @@ public class WarnStrategyController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnStrategyCacheService warnStrategyCacheService;
|
private WarnStrategyCacheService warnStrategyCacheService;
|
||||||
|
|
||||||
|
//列表
|
||||||
|
@Autowired
|
||||||
|
private AllWarnStrategyCacheService allWarnStrategyCacheService;
|
||||||
|
|
||||||
|
//缓存策略和vin
|
||||||
|
@Autowired
|
||||||
|
private AllWarnStrategyAndVinCacheService allWarnStrategyAndVinCacheService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 策略列表
|
* 策略列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(path = "/strategyList",method = RequestMethod.POST)
|
@RequestMapping(path = "/strategyList",method = RequestMethod.POST)
|
||||||
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
||||||
public Result<List<WarnStrategy>> strategyList() {
|
public Result<List<WarnVehicleResp>> strategyList(@RequestBody @Validated WarnVehicleReq req) {
|
||||||
return Result.success(warnStrategyService.list());
|
List<WarnVehicleResp> list = warnStrategyService.selectList(req);
|
||||||
|
// for (WarnVehicleResp warnVehicleResp : list) {
|
||||||
|
// //存进Redis
|
||||||
|
// allWarnStrategyCacheService.put(String.valueOf(warnVehicleResp.getVehicleVin()), warnVehicleResp);
|
||||||
|
// }
|
||||||
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,17 +65,6 @@ public class WarnStrategyController {
|
||||||
return Result.success(warnStrategyService.getById(id));
|
return Result.success(warnStrategyService.getById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 规则策略双表联查
|
|
||||||
* @param warnVehicleReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(path = "ruleStrategyList",method = RequestMethod.POST)
|
|
||||||
@Operation(summary = "策略规则双表联查", description = "获取所有策略规则双表联查")
|
|
||||||
public Result<List<WarnVehicleResp>> ruleStrategyList(@RequestBody WarnVehicleReq warnVehicleReq){
|
|
||||||
return Result.success(warnStrategyService.ruleStrategyList(warnVehicleReq));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加策略
|
* 添加策略
|
||||||
* @param warnStrategy
|
* @param warnStrategy
|
||||||
|
@ -68,13 +75,13 @@ public class WarnStrategyController {
|
||||||
public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){
|
public Result strategyAdd(@Validated @RequestBody WarnStrategy warnStrategy){
|
||||||
|
|
||||||
boolean save = warnStrategyService.save(warnStrategy);
|
boolean save = warnStrategyService.save(warnStrategy);
|
||||||
//存进Redis
|
// //存进Redis
|
||||||
//获取用户信息
|
// //获取用户信息
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
//获取租户唯一标识
|
// //获取租户唯一标识
|
||||||
String databaseName = loginUser.getSysUser().getDatabaseName();
|
// String databaseName = loginUser.getSysUser().getDatabaseName();
|
||||||
warnStrategyCacheService.put(databaseName+warnStrategy.getWarnStrategyId(),warnStrategy);
|
// warnStrategyCacheService.put(databaseName+warnStrategy.getWarnStrategyId(),warnStrategy);
|
||||||
return Result.success();
|
return Result.success(save);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -99,4 +106,30 @@ public class WarnStrategyController {
|
||||||
public Result strategyDelete(@PathVariable("id") Long id){
|
public Result strategyDelete(@PathVariable("id") Long id){
|
||||||
return Result.success(warnStrategyService.removeById(id));
|
return Result.success(warnStrategyService.removeById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过vin缓存策略信息
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/vinStrategyList/{warnStrategyId}",method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "通过vin缓存策略信息", description = "通过vin缓存策略信息")
|
||||||
|
public Result<List<WarnStrategyAndVinResp>> vinStrategyList(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||||
|
List<WarnStrategyAndVinResp> warnStrategyAndVinResp = warnStrategyService.findById(warnStrategyId);
|
||||||
|
for (WarnStrategyAndVinResp strategyAndVinResp : warnStrategyAndVinResp) {
|
||||||
|
allWarnStrategyAndVinCacheService.put(strategyAndVinResp.getVehicleVin(), (WarnStrategyAndVinResp) warnStrategyAndVinResp);
|
||||||
|
}
|
||||||
|
return Result.success(warnStrategyAndVinResp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// findbyid resp warnrulelist.set
|
||||||
|
/**
|
||||||
|
* 根据resp查询List集合,将rule查询到的集合添加到List集合中
|
||||||
|
* @param warnStrategyId
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/warnRuleRespList",method = RequestMethod.POST)
|
||||||
|
@Operation(summary = "根据resp查询List集合,将rule查询到的集合添加到List集合中", description = "根据resp查询List集合,将rule查询到的集合添加到List集合中")
|
||||||
|
public Result<WarnRuleResp> respStrategyList(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||||
|
WarnRuleResp warnRuleRespList=warnStrategyService.findByWarnStrategyId(warnStrategyId);
|
||||||
|
return Result.success(warnRuleRespList);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,6 @@ public interface ElectMapper extends MPJBaseMapper<Fence> {
|
||||||
@Select("select * from fence where fence_id=#{fenceId}")
|
@Select("select * from fence where fence_id=#{fenceId}")
|
||||||
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 根据id查询车辆
|
|
||||||
// */
|
|
||||||
// Fence boundFence(@Param("fenceId") Long fenceId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询电子围栏(终版)
|
* 查询电子围栏(终版)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,7 +28,16 @@ public interface FencegroupMapper extends MPJBaseMapper<FenceGroup> {
|
||||||
@Select("SELECT g.fence_group_id,g.group_type,g.priority,g.`status`,f.fence_id, group_CONCAT( f.fence_name ) AS fence_name FROM fence_group g LEFT JOIN middle m ON m.fence_group_id = g.fence_group_id LEFT JOIN fence f ON m.fence_id = f.fence_id GROUP BY g.fence_group_id")
|
@Select("SELECT g.fence_group_id,g.group_type,g.priority,g.`status`,f.fence_id, group_CONCAT( f.fence_name ) AS fence_name FROM fence_group g LEFT JOIN middle m ON m.fence_group_id = g.fence_group_id LEFT JOIN fence f ON m.fence_id = f.fence_id GROUP BY g.fence_group_id")
|
||||||
List<FenceGroup> showGroupList(FenceGroupReq req);
|
List<FenceGroup> showGroupList(FenceGroupReq req);
|
||||||
|
|
||||||
@Insert("INSERT INTO `vehicle-basic`.`middle` (`fence_id`, `fence_group_id`) VALUES <foreach collection=\"fenceIds\" item=\"id\" separator=\",\"> (#{id},#{fenceGroupId}) </foreach>")
|
// @Insert("INSERT INTO `vehicle-basic`.`middle` (`fence_id`, `fence_group_id`) VALUES <foreach collection='fenceIds' item='id' separator=','> (#{id},#{fenceGroupId}) </foreach>")
|
||||||
|
// @Insert({ "<script>", "INSERT INTO user_role (user_id, role_id) VALUES ", "<foreach collection='roleIds' item='roleId' separator=','>", "(#{userId}, #{roleId})", "</foreach>", "</script>" })
|
||||||
|
@Insert({
|
||||||
|
"<script>",
|
||||||
|
"INSERT INTO `vehicle-basic`.`middle` (fence_id, fence_group_id) VALUES ",
|
||||||
|
"<foreach collection='fenceIds' item='id' separator=','>",
|
||||||
|
"(#{id}, #{fenceGroupId})",
|
||||||
|
"</foreach>",
|
||||||
|
"</script>"
|
||||||
|
})
|
||||||
void addMiddle(@Param("fenceIds") Integer[] fenceIds,@Param("fenceGroupId") Long fenceGroupId);
|
void addMiddle(@Param("fenceIds") Integer[] fenceIds,@Param("fenceGroupId") Long fenceGroupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.muyu.enterprise.mapper;
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
@ -28,11 +31,6 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
||||||
*/
|
*/
|
||||||
List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
List<VehicleManageResp> findAll(VehicleManageReq vehicleManageReq);
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆绑定围栏组
|
|
||||||
*/
|
|
||||||
void bindFenceGroup(@Param("fenceGroupIds") Integer[] fenceGroupIds, @Param("vehicleId") Long vehicleId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据车辆vin查询模版id
|
* 根据车辆vin查询模版id
|
||||||
* @param vehicleVin
|
* @param vehicleVin
|
||||||
|
@ -40,4 +38,20 @@ public interface VehicleMapper extends MPJBaseMapper<Vehicle> {
|
||||||
*/
|
*/
|
||||||
@Select("SELECT t.message_template_id FROM vehicle v LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id WHERE v.vehicle_vin = #{vehicleVin}")
|
@Select("SELECT t.message_template_id FROM vehicle v LEFT JOIN vehicle_type t ON v.vehicle_type_id = t.vehicle_type_id WHERE v.vehicle_vin = #{vehicleVin}")
|
||||||
Long findByVehicleVin(String vehicleVin);
|
Long findByVehicleVin(String vehicleVin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆绑定围栏组
|
||||||
|
* @param boundFenceGroupReq
|
||||||
|
*/
|
||||||
|
// @Insert("INSERT INTO `vehicle-basic`.`bound_middle` (`fence_group_id`,`vehicle_id`) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id},#{vehicleId}) </foreach>")
|
||||||
|
@Insert({
|
||||||
|
"<script> INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id,vehicle_id) VALUES <foreach collection='fenceGroupIds' item='id' separator=','> (#{id}, #{vehicleId}) </foreach> </script>"
|
||||||
|
// "INSERT INTO `vehicle-basic`.`bound_middle` (fence_group_id, vehicle_id) VALUES <foreach collection=\"fenceGroupIds\" item=\"id\" separator=\",\"> (#{id}, #{vehicleId}) </foreach> "
|
||||||
|
})
|
||||||
|
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
||||||
|
|
||||||
|
@Select("SELECT * FROM bound_middle bm LEFT JOIN vehicle v ON bm.vehicle_id=v.vehicle_id WHERE bm.fence_group_id = #{fenceGroupId}")
|
||||||
|
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,14 @@ package com.muyu.enterprise.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.domain.WarnRule;
|
import com.muyu.domain.WarnRule;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
|
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
|
||||||
|
|
||||||
|
@Select("SELECT * FROM warn_rule WHERE warn_strategy_id=#{warnStrategyId}")
|
||||||
|
List<WarnRule> findBywarnStrategyId(Long warnStrategyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,28 @@ package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface WarnStrategyMapper extends MPJBaseMapper<WarnStrategy> {
|
public interface WarnStrategyMapper extends MPJBaseMapper<WarnStrategy> {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("SELECT vehicle.vehicle_vin, warn_strategy.warn_strategy_id, warn_strategy.vehicle_type_id, warn_strategy.message_template_id FROM vehicle LEFT JOIN warn_strategy ON vehicle.warn_strategy_id = warn_strategy.warn_strategy_id WHERE vehicle.warn_strategy_id = #{warn_strategy_id}")
|
||||||
|
List<WarnStrategyAndVinResp> findById(Long vehicleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表(存Redis)
|
||||||
|
* @param warnStrategyId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Select("select * from warn_strategy where warn_strategy_id = #{warn_strategy_id}")
|
||||||
|
WarnRuleResp findByWarnStrategyId(Long warnStrategyId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,6 @@ public interface ElectService extends IService<Fence> {
|
||||||
*/
|
*/
|
||||||
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
List<Fence> mapShow(@Param("fenceId") Long fenceId);
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 根据id查询车辆
|
|
||||||
// */
|
|
||||||
// Fence boundFence(@Param("fenceId") Long fenceId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询电子围栏(终版)
|
* 查询电子围栏(终版)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,5 @@ public interface IFencegroupService extends IService<FenceGroup> {
|
||||||
|
|
||||||
void addGroup(FenceGroupAddReq addReq);
|
void addGroup(FenceGroupAddReq addReq);
|
||||||
|
|
||||||
// List<FenceGroup> haveFence(HaveFence haveFence);
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.muyu.enterprise.service;
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -31,4 +34,17 @@ public interface VehicleService extends IService<Vehicle> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Long findByVehicleVin(String vehicleVin);
|
Long findByVehicleVin(String vehicleVin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定围栏组
|
||||||
|
*/
|
||||||
|
void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询绑定围栏组信息
|
||||||
|
* @param fenceGroupId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FenceGroup> showBoundFenceGroup(@Param("fenceGroupId") Long fenceGroupId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,15 @@ package com.muyu.enterprise.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.domain.WarnRule;
|
import com.muyu.domain.WarnRule;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface WarnRuleService extends IService<WarnRule> {
|
public interface WarnRuleService extends IService<WarnRule> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据预警策略ID查询预警规则集合
|
||||||
|
* @param warnStrategyId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<WarnRule> findBywarnStrategyId(Long warnStrategyId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,28 @@ package com.muyu.enterprise.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.domain.WarnStrategy;
|
import com.muyu.domain.WarnStrategy;
|
||||||
import com.muyu.domain.req.WarnVehicleReq;
|
import com.muyu.domain.req.WarnVehicleReq;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
import com.muyu.domain.resp.WarnVehicleResp;
|
import com.muyu.domain.resp.WarnVehicleResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface WarnStrategyService extends IService<WarnStrategy> {
|
public interface WarnStrategyService extends IService<WarnStrategy> {
|
||||||
|
|
||||||
List<WarnVehicleResp>ruleStrategyList(WarnVehicleReq warnVehicleReq);
|
// List<WarnVehicleResp>ruleStrategyList(WarnVehicleReq warnVehicleReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预警列表
|
||||||
|
*/
|
||||||
|
List<WarnVehicleResp> selectList(WarnVehicleReq req);
|
||||||
|
|
||||||
|
|
||||||
|
List<WarnStrategyAndVinResp> findById(Long warnStrategyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表(存Redis)
|
||||||
|
* @param warnStrategyId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WarnRuleResp findByWarnStrategyId(Long warnStrategyId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.enterprise.cache.FenceCahceService;
|
||||||
import com.muyu.enterprise.mapper.ElectMapper;
|
import com.muyu.enterprise.mapper.ElectMapper;
|
||||||
import com.muyu.enterprise.mapper.WarnLogsMapper;
|
import com.muyu.enterprise.mapper.WarnLogsMapper;
|
||||||
import com.muyu.enterprise.service.ElectService;
|
import com.muyu.enterprise.service.ElectService;
|
||||||
|
@ -10,6 +11,7 @@ import com.muyu.domain.Fence;
|
||||||
import com.muyu.domain.LanType;
|
import com.muyu.domain.LanType;
|
||||||
import com.muyu.domain.req.FenceReq;
|
import com.muyu.domain.req.FenceReq;
|
||||||
import com.muyu.domain.resp.FenceResp;
|
import com.muyu.domain.resp.FenceResp;
|
||||||
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -23,7 +25,12 @@ public class ElectServiceImpl
|
||||||
@Autowired
|
@Autowired
|
||||||
private ElectMapper electMapper;
|
private ElectMapper electMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnLogsMapper warnLogsMapper;
|
private VehicleService service;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FenceCahceService fenceCahceService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FenceResp> selectFenceList(FenceReq req) {
|
public List<FenceResp> selectFenceList(FenceReq req) {
|
||||||
|
@ -39,15 +46,13 @@ public class ElectServiceImpl
|
||||||
req.getFenceName()
|
req.getFenceName()
|
||||||
);
|
);
|
||||||
List<FenceResp> list = electMapper.selectJoinList(FenceResp.class, wrapper);
|
List<FenceResp> list = electMapper.selectJoinList(FenceResp.class, wrapper);
|
||||||
|
|
||||||
|
String decode = fenceCahceService.decode(String.valueOf(list));
|
||||||
|
|
||||||
|
//将获取到的数据存到Redis
|
||||||
|
// fenceCahceService.put(String.valueOf(decode),d);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public int addFence(Fence fence) {
|
|
||||||
// int i = electMapper.addFence(fence);
|
|
||||||
// return i;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFenceOn(Long fenceId) {
|
public void updateFenceOn(Long fenceId) {
|
||||||
|
@ -65,11 +70,6 @@ public class ElectServiceImpl
|
||||||
return fences;
|
return fences;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public Fence boundFence(Long fenceId) {
|
|
||||||
// Fence fence = electMapper.boundFence(fenceId);
|
|
||||||
// return fence;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Fence> showFenceBound(Long fenceGroupId) {
|
public List<Fence> showFenceBound(Long fenceGroupId) {
|
||||||
|
|
|
@ -41,10 +41,5 @@ public class FencegroupServiceImpl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public List<FenceGroup> haveFence(HaveFence haveFence) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,12 @@ package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.enterprise.mapper.MessageValueMapper;
|
|
||||||
import com.muyu.enterprise.service.MessageValueService;
|
|
||||||
import com.muyu.domain.MessageValue;
|
import com.muyu.domain.MessageValue;
|
||||||
import com.muyu.domain.req.MessageValueReq;
|
import com.muyu.domain.req.MessageValueReq;
|
||||||
import com.muyu.domain.resp.MessageValueListResp;
|
import com.muyu.domain.resp.MessageValueListResp;
|
||||||
|
import com.muyu.enterprise.cache.AllMessageValueCacheService;
|
||||||
|
import com.muyu.enterprise.mapper.MessageValueMapper;
|
||||||
|
import com.muyu.enterprise.service.MessageValueService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -31,6 +32,9 @@ public class MessageValueServiceImpl
|
||||||
@Autowired
|
@Autowired
|
||||||
private MessageValueMapper messageValueMapper;
|
private MessageValueMapper messageValueMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AllMessageValueCacheService allMessageValueCacheService;
|
||||||
|
|
||||||
public MessageValueServiceImpl(MessageValueMapper messageValueMapper) {
|
public MessageValueServiceImpl(MessageValueMapper messageValueMapper) {
|
||||||
this.messageValueMapper = messageValueMapper;
|
this.messageValueMapper = messageValueMapper;
|
||||||
}
|
}
|
||||||
|
@ -63,51 +67,12 @@ public class MessageValueServiceImpl
|
||||||
LambdaQueryWrapper<MessageValue> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MessageValue> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(MessageValue::getTemplateId, templateId);
|
queryWrapper.eq(MessageValue::getTemplateId, templateId);
|
||||||
List<MessageValue> list = this.list(queryWrapper);
|
List<MessageValue> list = this.list(queryWrapper);
|
||||||
return list.stream()
|
List<MessageValueListResp> collect = list.stream()
|
||||||
.map(messageValue -> MessageValueListResp.valueBuild(
|
.map(messageValue -> MessageValueListResp.valueBuild(
|
||||||
messageValue
|
messageValue
|
||||||
)
|
)
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
|
// allMessageValueCacheService.put(String.valueOf(templateId), collect);
|
||||||
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public JSONObject analysis(String testStr) {
|
|
||||||
//
|
|
||||||
// if (testStr.length() < 18){
|
|
||||||
// throw new RuntimeException("报文格式不正确");
|
|
||||||
// }
|
|
||||||
// //根据空格切割数据
|
|
||||||
// String[] hexArray = testStr.split(" ");
|
|
||||||
// StringBuilder result = new StringBuilder();
|
|
||||||
// for (String hex : hexArray) {
|
|
||||||
// int decimal = Integer.parseInt(hex, 16);
|
|
||||||
// result.append((char) decimal);
|
|
||||||
// }
|
|
||||||
// log.info(result);
|
|
||||||
// //取出车辆VIN码
|
|
||||||
// String vehicleVin = result.substring(1, 18);
|
|
||||||
// log.info("车辆VIN:" + vehicleVin);
|
|
||||||
// //根据车辆VIN码, 查找到报文模版id
|
|
||||||
// Long templateId = messageValueMapper.getTemplateId(vehicleVin);
|
|
||||||
// log.info("模版id:" + templateId);
|
|
||||||
// //获取到报文模版的列表
|
|
||||||
// List<MessageValueListResp> templateList = messageValueMapper.getTemplateList(templateId);
|
|
||||||
// //存储报文模板解析后数据
|
|
||||||
// JSONObject jsonObject = new JSONObject();
|
|
||||||
// for (MessageValueListResp messageValue : templateList) {
|
|
||||||
// //起始位下标
|
|
||||||
// Integer startIndex = messageValue.getMessageStartIndex() - 1;
|
|
||||||
// //截止位下标
|
|
||||||
// Integer endIndex = messageValue.getMessageEndIndex();
|
|
||||||
// //根据报文模版截取数据
|
|
||||||
// String value = result.substring(startIndex, endIndex);
|
|
||||||
// //存入数据
|
|
||||||
// jsonObject.put(messageValue.getMessageLabel(), value);
|
|
||||||
// }
|
|
||||||
// for (Map.Entry<String, Object> stringObjectEntry : jsonObject) {
|
|
||||||
// log.info(stringObjectEntry.getKey() + ":" + stringObjectEntry.getValue());
|
|
||||||
// }
|
|
||||||
// return jsonObject;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,19 @@ package com.muyu.enterprise.service.impl;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.domain.FenceGroup;
|
||||||
import com.muyu.domain.Vehicle;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.domain.VehicleType;
|
import com.muyu.domain.VehicleType;
|
||||||
|
import com.muyu.domain.req.BoundFenceGroupReq;
|
||||||
import com.muyu.domain.req.VehicleManageReq;
|
import com.muyu.domain.req.VehicleManageReq;
|
||||||
import com.muyu.domain.resp.VehicleManageResp;
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import com.muyu.enterprise.cache.AllVehicleCacheService;
|
||||||
import com.muyu.enterprise.mapper.VehicleMapper;
|
import com.muyu.enterprise.mapper.VehicleMapper;
|
||||||
import com.muyu.enterprise.service.VehicleService;
|
import com.muyu.enterprise.service.VehicleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,4 +73,16 @@ public class VehicleServiceImpl
|
||||||
return templateId;
|
return templateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void boundFenceGroup(BoundFenceGroupReq boundFenceGroupReq) {
|
||||||
|
vehicleMapper.boundFenceGroup(boundFenceGroupReq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FenceGroup> showBoundFenceGroup(Long fenceGroupId) {
|
||||||
|
List<FenceGroup> fenceGroups = vehicleMapper.showBoundFenceGroup(fenceGroupId);
|
||||||
|
return fenceGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.muyu.domain.WarnRule;
|
import com.muyu.domain.WarnRule;
|
||||||
import com.muyu.enterprise.mapper.WarnRuleMapper;
|
import com.muyu.enterprise.mapper.WarnRuleMapper;
|
||||||
import com.muyu.enterprise.service.WarnRuleService;
|
import com.muyu.enterprise.service.WarnRuleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class WarnRuleServiceImpl extends ServiceImpl<WarnRuleMapper, WarnRule> implements WarnRuleService {
|
public class WarnRuleServiceImpl extends ServiceImpl<WarnRuleMapper, WarnRule> implements WarnRuleService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WarnRuleMapper warnRuleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WarnRule> findBywarnStrategyId(Long warnStrategyId) {
|
||||||
|
List<WarnRule> warnRules = warnRuleMapper.findBywarnStrategyId(warnStrategyId);
|
||||||
|
return warnRules;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,15 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.muyu.domain.MessageTemplate;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||||
|
import com.muyu.enterprise.controller.WarnRuleController;
|
||||||
import com.muyu.enterprise.mapper.WarnStrategyMapper;
|
import com.muyu.enterprise.mapper.WarnStrategyMapper;
|
||||||
|
import com.muyu.enterprise.service.WarnRuleService;
|
||||||
import com.muyu.enterprise.service.WarnStrategyService;
|
import com.muyu.enterprise.service.WarnStrategyService;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.domain.VehicleType;
|
import com.muyu.domain.VehicleType;
|
||||||
|
@ -12,7 +19,10 @@ import com.muyu.domain.resp.WarnVehicleResp;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class WarnStrategyServiceImpl extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
public class WarnStrategyServiceImpl extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||||
|
@ -21,17 +31,40 @@ public class WarnStrategyServiceImpl extends ServiceImpl<WarnStrategyMapper, War
|
||||||
@Autowired
|
@Autowired
|
||||||
private WarnStrategyMapper warnStrategyMapper;
|
private WarnStrategyMapper warnStrategyMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WarnRuleService warnRuleService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WarnVehicleResp> ruleStrategyList(WarnVehicleReq warnVehicleReq) {
|
public List<WarnVehicleResp> selectList(WarnVehicleReq req) {
|
||||||
MPJLambdaWrapper<WarnStrategy> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<WarnStrategy> wrapper = new MPJLambdaWrapper<>();
|
||||||
wrapper.selectAll(WarnStrategy.class)
|
wrapper.selectAll(WarnStrategy.class)
|
||||||
.selectAs(VehicleType::getVehicleTypeName,WarnVehicleResp::getVehicleTypeName)
|
.selectAs(VehicleType::getVehicleTypeName,WarnVehicleResp::getVehicleTypeName)
|
||||||
|
.selectAs(MessageTemplate::getMessageTemplateName,WarnVehicleResp::getMessageTemplateName)
|
||||||
.leftJoin(VehicleType.class, VehicleType::getVehicleTypeId,WarnStrategy::getVehicleTypeId)
|
.leftJoin(VehicleType.class, VehicleType::getVehicleTypeId,WarnStrategy::getVehicleTypeId)
|
||||||
|
.leftJoin(MessageTemplate.class, MessageTemplate::getMessageTemplateId,WarnStrategy::getMessageTemplateId)
|
||||||
.like(
|
.like(
|
||||||
StringUtils.isNotEmpty(warnVehicleReq.getStrategyName()),
|
StringUtils.isNotEmpty(req.getStrategyName()),
|
||||||
WarnStrategy::getStrategyName,warnVehicleReq.getStrategyName()
|
WarnStrategy::getStrategyName,req.getStrategyName()
|
||||||
);
|
);
|
||||||
List<WarnVehicleResp> list = warnStrategyMapper.selectJoinList(WarnVehicleResp.class, wrapper);
|
List<WarnVehicleResp> list = warnStrategyMapper.selectJoinList(WarnVehicleResp.class, wrapper);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WarnStrategyAndVinResp> findById(Long warnStrategyId) {
|
||||||
|
List<WarnStrategyAndVinResp> byId = warnStrategyMapper.findById(warnStrategyId);
|
||||||
|
return byId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WarnRuleResp findByWarnStrategyId(Long warnStrategyId) {
|
||||||
|
|
||||||
|
WarnRuleResp warnRuleResp = warnStrategyMapper.findByWarnStrategyId(warnStrategyId);
|
||||||
|
List<WarnRule> bywarnStrategyId = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||||
|
warnRuleResp.setWarnRuleList(bywarnStrategyId);
|
||||||
|
return warnRuleResp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,25 @@
|
||||||
<artifactId>cloud-common-kafka</artifactId>
|
<artifactId>cloud-common-kafka</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--缓存依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MQ -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 引入Caffeine缓存库-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
|
<artifactId>caffeine</artifactId>
|
||||||
|
<version>3.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.processing.abstraction;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.muyu.processing.interfaces.EventInterface;
|
import com.muyu.processing.interfaces.EventInterface;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件处理抽象类
|
* 事件处理抽象类
|
||||||
|
@ -11,6 +12,7 @@ import com.muyu.processing.interfaces.EventInterface;
|
||||||
* @name:EventProcessor
|
* @name:EventProcessor
|
||||||
* @Date:2024/9/28 20:58
|
* @Date:2024/9/28 20:58
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
public abstract class EventProcessor implements EventInterface {
|
public abstract class EventProcessor implements EventInterface {
|
||||||
|
|
||||||
private EventProcessor eventProcessor;
|
private EventProcessor eventProcessor;
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.processing.basic;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.basic
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:EventCustom
|
||||||
|
* @Date:2024/9/29 21:18
|
||||||
|
*/
|
||||||
|
public class EventCustom extends ApplicationEvent{
|
||||||
|
private JSONObject data;
|
||||||
|
public EventCustom(Object source, JSONObject data) {
|
||||||
|
super(source);
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getData(){
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.processing.basic;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件监听接口
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.basic
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:EventListener
|
||||||
|
* @Date:2024/9/29 22:29
|
||||||
|
*/
|
||||||
|
public interface EventListener extends ApplicationListener<EventCustom> {
|
||||||
|
void onEvent(EventCustom event);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.processing.basic;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.context.ApplicationEventPublisherAware;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略发送事件
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.basic
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:EventPublisher
|
||||||
|
* @Date:2024/9/29 22:31
|
||||||
|
*/
|
||||||
|
public class EventPublisher implements ApplicationEventPublisherAware {
|
||||||
|
|
||||||
|
private ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher){
|
||||||
|
this.publisher = applicationEventPublisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import com.muyu.processing.listener.AddDatabaseListener;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件监听器
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.config
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:AppConfig
|
||||||
|
* @Date:2024/9/29 22:23
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class AppConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public AddDatabaseListener addDatabaseListener(){
|
||||||
|
return new AddDatabaseListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认回调配置
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ConfirmCallbackConfig implements RabbitTemplate.ConfirmCallback {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前bean初始化的时候执行
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
this.rabbitTemplate.setConfirmCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认方法
|
||||||
|
* @param correlationData correlation data for the callback.
|
||||||
|
* @param ack true for ack, false for nack
|
||||||
|
* @param cause An optional cause, for nack, when available, otherwise null.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||||
|
if (ack) {
|
||||||
|
System.out.println("消息发送到 broker 成功");
|
||||||
|
} else {
|
||||||
|
System.out.println("消息发送到 broker 失败,失败的原因:" + cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.iotdb.isession.SessionDataSet;
|
||||||
|
import org.apache.iotdb.rpc.IoTDBConnectionException;
|
||||||
|
import org.apache.iotdb.rpc.StatementExecutionException;
|
||||||
|
import org.apache.iotdb.session.Session;
|
||||||
|
import org.apache.iotdb.tsfile.read.common.Field;
|
||||||
|
import org.apache.iotdb.tsfile.read.common.RowRecord;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iotdb配置类
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.config
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:IotDBConfig
|
||||||
|
* @Date:2024/9/30 15:13
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
@Configuration
|
||||||
|
public class IotDBConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建session
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public static Session session(){
|
||||||
|
Session session = null;
|
||||||
|
try {
|
||||||
|
session = new Session(
|
||||||
|
"47.101.49.53",
|
||||||
|
6667,
|
||||||
|
"root",
|
||||||
|
"root"
|
||||||
|
);
|
||||||
|
session.open(false);
|
||||||
|
session.setFetchSize(100);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
public void execute(String deviceId, Long time, List<String> measurement, List<String> values){
|
||||||
|
if (!CollectionUtils.isEmpty(measurement) && !CollectionUtils.isEmpty(values)){
|
||||||
|
try {
|
||||||
|
session().insertAlignedRecord(deviceId,time,measurement,values);
|
||||||
|
} catch (IoTDBConnectionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (StatementExecutionException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据
|
||||||
|
*/
|
||||||
|
public List<HashMap<String, Object>> executeQuery(String sql){
|
||||||
|
log.info("sql:{}",sql);
|
||||||
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
SessionDataSet sessionDataSet = session().executeQueryStatement(sql);
|
||||||
|
int fetchSize = sessionDataSet.getFetchSize();
|
||||||
|
List<String> columnNames = sessionDataSet.getColumnNames();
|
||||||
|
List<String> columnTypes = sessionDataSet.getColumnTypes();
|
||||||
|
System.out.println(columnNames);
|
||||||
|
System.out.println(columnTypes);
|
||||||
|
if (fetchSize > 0){
|
||||||
|
while (sessionDataSet.hasNext()){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
RowRecord next = sessionDataSet.next();
|
||||||
|
List<Field> fields = next.getFields();
|
||||||
|
// 查询结果第一个为时间戳
|
||||||
|
long timestamp = next.getTimestamp();
|
||||||
|
for (int i = 0; i < fields.size(); i++) {
|
||||||
|
Field field = fields.get(i);
|
||||||
|
String key = field.getStringValue();
|
||||||
|
// 这里的需要按照类型获取
|
||||||
|
Object value = field.getObjectValue(field.getDataType());
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sessionDataSet.closeOperationHandle();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建 RabbitAdmin
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitAdminConfig {
|
||||||
|
|
||||||
|
@Value("${spring.rabbitmq.host}")
|
||||||
|
private String host;
|
||||||
|
@Value("${spring.rabbitmq.username}")
|
||||||
|
private String username;
|
||||||
|
@Value("${spring.rabbitmq.password}")
|
||||||
|
private String password;
|
||||||
|
@Value("${spring.rabbitmq.virtual-host}")
|
||||||
|
private String virtualhost;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ConnectionFactory connectionFactory() {
|
||||||
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
|
||||||
|
connectionFactory.setAddresses(host);
|
||||||
|
connectionFactory.setUsername(username);
|
||||||
|
connectionFactory.setPassword(password);
|
||||||
|
connectionFactory.setVirtualHost(virtualhost);
|
||||||
|
// 配置发送确认回调时,次配置必须配置,否则即使在RabbitTemplate配置了ConfirmCallback也不会生效
|
||||||
|
connectionFactory.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED);
|
||||||
|
connectionFactory.setPublisherReturns(true);
|
||||||
|
return connectionFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rabbitAdmin
|
||||||
|
* @param connectionFactory
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
|
||||||
|
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
|
||||||
|
rabbitAdmin.setAutoStartup(true);
|
||||||
|
return rabbitAdmin;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息转换配置
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitmqConfig {
|
||||||
|
// 消息转换配置
|
||||||
|
@Bean
|
||||||
|
public MessageConverter jsonMessageConverter(){
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.processing.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.core.ReturnedMessage;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送失败返回配置
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ReturnsCallbackConfig implements RabbitTemplate.ReturnsCallback {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前bean初始化的时候执行
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
this.rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息发送达到 queue 失败执行
|
||||||
|
*
|
||||||
|
* @param returnedMessage the returned message and metadata.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
System.out.println("消息" + returnedMessage.getMessage().toString() +
|
||||||
|
"被交换机" + returnedMessage.getExchange() + "回退!"
|
||||||
|
+ "退回原因为:" + returnedMessage.getReplyText());
|
||||||
|
// TODO 回退了所有的信息,可做补偿机制
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,12 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||||
import com.muyu.common.core.constant.KafkaConstants;
|
import com.muyu.common.core.constant.KafkaConstants;
|
||||||
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
import com.muyu.processing.interfaces.EventInterface;
|
import com.muyu.processing.interfaces.EventInterface;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
||||||
|
@ -17,8 +22,10 @@ import org.springframework.stereotype.Component;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* kafka消费者
|
||||||
* @Author:杨鹏
|
* @Author:杨鹏
|
||||||
* @Package:com.muyu.processing.consumer
|
* @Package:com.muyu.processing.consumer
|
||||||
* @Project:car-cloud-server
|
* @Project:car-cloud-server
|
||||||
|
@ -32,6 +39,9 @@ public class KafkaConsumerService implements InitializingBean {
|
||||||
@Resource
|
@Resource
|
||||||
private KafkaConsumer kafkaConsumer;
|
private KafkaConsumer kafkaConsumer;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
// @Resource
|
// @Resource
|
||||||
// private EventInterface eventInterface;
|
// private EventInterface eventInterface;
|
||||||
|
|
||||||
|
@ -53,8 +63,16 @@ public class KafkaConsumerService implements InitializingBean {
|
||||||
JSONObject jsonObject = JSON.parseObject(originalMsg);
|
JSONObject jsonObject = JSON.parseObject(originalMsg);
|
||||||
log.info("消费数据转换为JSON对象: " + jsonObject);
|
log.info("消费数据转换为JSON对象: " + jsonObject);
|
||||||
log.info("消费数据转换为JSON对象: " + jsonObject.toString());
|
log.info("消费数据转换为JSON对象: " + jsonObject.toString());
|
||||||
// eventInterface.handle(jsonObject);
|
|
||||||
|
|
||||||
|
String value = jsonObject.toString();
|
||||||
|
String vin = value.substring(0, 11);
|
||||||
|
Map<String, Object> map = (Map<String, Object>) cacheUtil.get(vin);
|
||||||
|
WarnRule warnRule = (WarnRule) map.get("warnRule");
|
||||||
|
WarnStrategy warnStrategy = (WarnStrategy) map.get("warnStrategy");
|
||||||
|
Vehicle vehicle = (Vehicle) map.get("vehicle");
|
||||||
|
Object breakdown = map.get("breakdown");
|
||||||
|
Fence fence = (Fence) map.get("fence");
|
||||||
|
// eventInterface.handle(jsonObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.processing.consumer;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.cache.FaultCacheService;
|
||||||
|
import com.muyu.enterprise.cache.FenceCahceService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下线监听
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.consumer
|
||||||
|
* @Project:cloud-vehicle
|
||||||
|
* @name:OfflineMonitoringConsumer
|
||||||
|
* @Date:2024/10/4 14:48
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class OfflineMonitoringConsumer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收消息
|
||||||
|
* @param vin 车辆vin
|
||||||
|
*/
|
||||||
|
@RabbitListener(queuesToDeclare = @Queue("offline_monitoring"))
|
||||||
|
public void receive(String vin){
|
||||||
|
log.info("清除缓存中的数据,车辆vin: {}", vin);
|
||||||
|
// 清除缓存
|
||||||
|
cacheUtil.remove(vin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.muyu.processing.consumer;
|
||||||
|
|
||||||
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.domain.WarnStrategy;
|
||||||
|
import com.muyu.enterprise.cache.*;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上线监听
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.consumer
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:MQconsumer
|
||||||
|
* @Date:2024/9/29 17:19
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@Component
|
||||||
|
public class OnLineMonitoringConsumer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VehicleCacheService vehicleCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FaultCacheService faultCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FenceCahceService fenceCahceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WarnRuleCacheService warnRuleCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WarnStrategyCacheService warnStrategyCacheService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上线监听车辆网关中车辆上线时
|
||||||
|
*/
|
||||||
|
@RabbitListener(queuesToDeclare = @Queue("long_time_no_see"))
|
||||||
|
public void receive(String vin, Message message, Channel channel){
|
||||||
|
|
||||||
|
try {
|
||||||
|
log.info("添加本地缓存,车辆vin: {}", vin);
|
||||||
|
WarnRule warnRule = warnRuleCacheService.get(vin);
|
||||||
|
WarnStrategy warnStrategy = warnStrategyCacheService.get(vin);
|
||||||
|
Vehicle vehicle = vehicleCacheService.get(vin);
|
||||||
|
Object breakdown = faultCacheService.get(vin);
|
||||||
|
Fence fence = fenceCahceService.get(vin);
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("warnRule",warnRule);
|
||||||
|
map.put("warnStrategy",warnStrategy);
|
||||||
|
map.put("vehicle",vehicle);
|
||||||
|
map.put("breakdown",breakdown);
|
||||||
|
map.put("fence",fence);
|
||||||
|
cacheUtil.put(vin,map);
|
||||||
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
channel.basicReject(message.getMessageProperties().getDeliveryTag(),true);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.processing.controller;
|
||||||
|
|
||||||
|
import com.muyu.processing.config.IotDBConfig;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iotdb测试
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.controller
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:IotdbController
|
||||||
|
* @Date:2024/10/2 9:39
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("iotdb")
|
||||||
|
public class IotDbController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IotDBConfig iotDBConfig;
|
||||||
|
|
||||||
|
private String json = "{\n" + " \"carVin\": \"VIN123456\",\n" +
|
||||||
|
" \"carName\": \"宝马\",\n" + "}";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加数据
|
||||||
|
*/
|
||||||
|
@GetMapping("add")
|
||||||
|
public void add(){
|
||||||
|
// Map map = JSON.parseObject(json, Map.class);
|
||||||
|
// Set set = map.keySet();
|
||||||
|
ArrayList<String> key = new ArrayList<>();
|
||||||
|
ArrayList<String> value = new ArrayList<>();
|
||||||
|
key.add("car_vin");
|
||||||
|
key.add("car_name");
|
||||||
|
value.add("VIN123456");
|
||||||
|
value.add("宝马");
|
||||||
|
System.out.println(key);
|
||||||
|
System.out.println(value);
|
||||||
|
long l = System.currentTimeMillis();
|
||||||
|
iotDBConfig.execute("root.vehicle", l, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
@GetMapping("findList")
|
||||||
|
public void findList(){
|
||||||
|
String sql = "select * from root.vehicle";
|
||||||
|
List<HashMap<String, Object>> list = iotDBConfig.executeQuery(sql);
|
||||||
|
System.out.println(list);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,14 @@
|
||||||
package com.muyu.processing.controller;
|
package com.muyu.processing.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.muyu.common.core.constant.KafkaConstants;
|
import com.muyu.common.core.constant.KafkaConstants;
|
||||||
|
import com.muyu.common.core.utils.uuid.UUID;
|
||||||
import com.muyu.common.kafka.config.KafkaProducerConfig;
|
import com.muyu.common.kafka.config.KafkaProducerConfig;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.kafka.clients.producer.KafkaProducer;
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
import org.apache.kafka.common.protocol.types.Field;
|
import org.apache.kafka.common.protocol.types.Field;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 消息队列测试-生产者
|
||||||
* @Author:杨鹏
|
* @Author:杨鹏
|
||||||
* @Package:com.muyu.processing.controller
|
* @Package:com.muyu.processing.controller
|
||||||
* @Project:car-cloud-server
|
* @Project:car-cloud-server
|
||||||
|
@ -29,10 +32,44 @@ public class TestKafka {
|
||||||
@Resource
|
@Resource
|
||||||
private KafkaProducer<String, String> kafkaProducer;
|
private KafkaProducer<String, String> kafkaProducer;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送Kafka消息
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
@GetMapping("/send")
|
@GetMapping("/send")
|
||||||
public void sendMsg(){
|
public String sendMsg(){
|
||||||
ProducerRecord<String, String> producerRecord = new ProducerRecord<>("zeshi", "你好啊");
|
JSONObject entries = new JSONObject();
|
||||||
|
entries.set("vin","vin123468");
|
||||||
|
entries.set("name","宝马");
|
||||||
|
String entriesString = entries.toString();
|
||||||
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>("zeshi", entriesString);
|
||||||
kafkaProducer.send(producerRecord);
|
kafkaProducer.send(producerRecord);
|
||||||
|
return "OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送MQ消息
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@GetMapping("/sendMQ")
|
||||||
|
public String sendMQ(){
|
||||||
|
rabbitTemplate.convertAndSend("long_time_no_see","晨哀,好久不见",message -> {
|
||||||
|
message.getMessageProperties().setMessageId(UUID.randomUUID().toString());
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送MQ队列消息
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@GetMapping("/sendDui")
|
||||||
|
public String sedDui() {
|
||||||
|
rabbitTemplate.convertAndSend("myExchange","Im.fine","");
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.processing.interfaces;
|
package com.muyu.processing.interfaces;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.checkerframework.checker.units.qual.C;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 事件处理接口
|
* 事件处理接口
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.processing.listener;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.muyu.processing.basic.EventCustom;
|
||||||
|
import com.muyu.processing.basic.EventListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加数据库事件
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.listener
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:AddDatabaseListener
|
||||||
|
* @Date:2024/9/29 22:25
|
||||||
|
*/
|
||||||
|
public class AddDatabaseListener implements EventListener {
|
||||||
|
@Override
|
||||||
|
public void onEvent(EventCustom event) {
|
||||||
|
JSONObject jsonObject = event.getData();
|
||||||
|
ArrayList<Object> keys = new ArrayList<>();
|
||||||
|
ArrayList<Object> values = new ArrayList<>();
|
||||||
|
jsonObject.forEach((key, value) ->{
|
||||||
|
keys.add(key);
|
||||||
|
values.add(value);
|
||||||
|
});
|
||||||
|
// 添加数据库
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(EventCustom event) {
|
||||||
|
onEvent(event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.processing.utils;
|
||||||
|
|
||||||
|
import com.github.benmanes.caffeine.cache.Cache;
|
||||||
|
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存工具类
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.utils
|
||||||
|
* @Project:cloud-vehicle
|
||||||
|
* @name:CacheUtil
|
||||||
|
* @Date:2024/10/4 15:14
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class CacheUtil<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存对象
|
||||||
|
*/
|
||||||
|
private final Cache<String, T> cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认构建函数
|
||||||
|
*/
|
||||||
|
public CacheUtil(){
|
||||||
|
this.cache = Caffeine.newBuilder()
|
||||||
|
.maximumSize(500L)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得缓存
|
||||||
|
* @param key 键
|
||||||
|
* @return 返回的值
|
||||||
|
*/
|
||||||
|
public T get(String key){
|
||||||
|
return cache.getIfPresent(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加缓存
|
||||||
|
* @param key 键
|
||||||
|
* @param value 值
|
||||||
|
*/
|
||||||
|
public void put(String key, T value){
|
||||||
|
cache.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除缓存
|
||||||
|
* @param key 键
|
||||||
|
*/
|
||||||
|
public void remove(String key){
|
||||||
|
cache.invalidate(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* IotDb测试
|
||||||
* @Author:杨鹏
|
* @Author:杨鹏
|
||||||
* @Package:com.muyu.processing.utils
|
* @Package:com.muyu.processing.utils
|
||||||
* @Project:car-cloud-server
|
* @Project:car-cloud-server
|
||||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.49.53:8848
|
addr: 47.101.49.53:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: seven
|
namespace: dev
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -116,6 +116,12 @@
|
||||||
<artifactId>cloud-common-kafka</artifactId>
|
<artifactId>cloud-common-kafka</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.muyu</groupId>
|
||||||
|
<artifactId>cloud-modules-enterprise-cache</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.muyu.cloud.protocol.parsing.feign;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.domain.resp.MessageValueListResp;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LiDongJia
|
|
||||||
* @Package: com.muyu.cloud.protocol.parsing.feign
|
|
||||||
* @Project: 2112-car-cloud-server
|
|
||||||
* @name: RemoteServiceClient
|
|
||||||
* @Date: 2024/9/28 14:49
|
|
||||||
* @Description: 远程调用接口
|
|
||||||
*/
|
|
||||||
@FeignClient(name = "cloud-car")
|
|
||||||
public interface RemoteServiceClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过车辆vin码查询模板id
|
|
||||||
* @param vehicleVin
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/vehicleManage/findByVehicleVin/{vehicleVin}")
|
|
||||||
@Operation(description = "通过车辆vin码查询模板id")
|
|
||||||
public Result<Long> findByVehicleVin(@PathVariable("vehicleVin") String vehicleVin);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据报文模版id查询报文数据
|
|
||||||
* @param templateId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/messageValue/findByTemplateId/{templateId}")
|
|
||||||
@Operation(summary = "根据报文模版id查询报文数据", description = "根据报文模版id查询报文数据")
|
|
||||||
public Result<List<MessageValueListResp>> findByTemplateId(@PathVariable("templateId") Long templateId);
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.muyu.cloud.protocol.parsing.feign.factory;
|
|
||||||
|
|
||||||
import com.muyu.cloud.protocol.parsing.feign.RemoteServiceClient;
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.domain.resp.MessageValueListResp;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报文模版对象服务降级处理
|
|
||||||
* @Author:李庆帅
|
|
||||||
* @Package:com.muyu.analysis.parsing.remote.factory
|
|
||||||
* @Project:cloud-server
|
|
||||||
* @name:RemoteServiceClientFactory
|
|
||||||
* @Date:2024/9/28 21:16
|
|
||||||
*/
|
|
||||||
public class RemoteServiceClientFactory implements FallbackFactory<RemoteServiceClient>
|
|
||||||
{
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(com.muyu.cloud.protocol.parsing.feign.factory.RemoteServiceClientFactory.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RemoteServiceClient create(Throwable throwable) {
|
|
||||||
log.error("报文模版传参调用失败:{}", throwable.getMessage());
|
|
||||||
return new RemoteServiceClient() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<Long> findByVehicleVin(String vehicleVin) {
|
|
||||||
return Result.success(Long.valueOf(vehicleVin));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<List<MessageValueListResp>> findByTemplateId(Long templateId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,17 @@
|
||||||
package com.muyu.cloud.protocol.parsing.test;
|
package com.muyu.cloud.protocol.parsing.test;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.muyu.domain.Vehicle;
|
||||||
import com.muyu.cloud.protocol.parsing.feign.RemoteServiceClient;
|
import com.muyu.domain.VehicleType;
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.domain.resp.MessageValueListResp;
|
import com.muyu.domain.resp.MessageValueListResp;
|
||||||
|
import com.muyu.enterprise.cache.AllMessageValueCacheService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleCacheService;
|
||||||
|
import com.muyu.enterprise.cache.VehicleTypeCacheService;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.apache.kafka.clients.producer.KafkaProducer;
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
import org.eclipse.paho.client.mqttv3.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
@ -27,17 +28,20 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class ParsingTest {
|
public class ParsingMessage {
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisTemplate<String, Object> redisTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteServiceClient remoteServiceClient;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private KafkaProducer<String, String> kafkaProducer;
|
private KafkaProducer<String, String> kafkaProducer;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleCacheService vehicleCacheService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleTypeCacheService vehicleTypeCacheService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AllMessageValueCacheService allMessageValueCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议解析
|
* 协议解析
|
||||||
*/
|
*/
|
||||||
|
@ -92,32 +96,34 @@ public class ParsingTest {
|
||||||
String vehicleVin = result.substring(1, 18);
|
String vehicleVin = result.substring(1, 18);
|
||||||
log.info("车辆VIN码: " + vehicleVin);
|
log.info("车辆VIN码: " + vehicleVin);
|
||||||
//根据车辆VIN码查询报文模板ID
|
//根据车辆VIN码查询报文模板ID
|
||||||
Result<Long> byVehicleVin = remoteServiceClient.findByVehicleVin(vehicleVin);
|
Vehicle vehicle = vehicleCacheService.get(vehicleVin);
|
||||||
Long templateId = byVehicleVin.getData();
|
Long vehicleTypeId = vehicle.getVehicleTypeId();
|
||||||
List<MessageValueListResp> templateList;
|
VehicleType vehicleType = vehicleTypeCacheService.get(String.valueOf(vehicleTypeId));
|
||||||
//从redis缓存中获取报文模板数据
|
Long templateId = vehicleType.getMessageTemplateId();
|
||||||
try {
|
List<MessageValueListResp> templateList = allMessageValueCacheService.get(String.valueOf(templateId));
|
||||||
String redisKey = "messageTemplate" + templateId;
|
// //从redis缓存中获取报文模板数据
|
||||||
if (redisTemplate.hasKey(redisKey)) {
|
// try {
|
||||||
List<Object> list = redisTemplate.opsForList().range(redisKey, 0, -1);
|
// String redisKey = "messageTemplate" + templateId;
|
||||||
templateList = list.stream()
|
// if (redisTemplate.hasKey(redisKey)) {
|
||||||
.map(obj -> JSON.parseObject(obj.toString(), MessageValueListResp.class))
|
// List<Object> list = redisTemplate.opsForList().range(redisKey, 0, -1);
|
||||||
.toList();
|
// templateList = list.stream()
|
||||||
log.info("Redis缓存查询成功");
|
// .map(obj -> JSON.parseObject(obj.toString(), MessageValueListResp.class))
|
||||||
} else {
|
// .toList();
|
||||||
Result<List<MessageValueListResp>> byTemplateId = remoteServiceClient.findByTemplateId(templateId);
|
// log.info("Redis缓存查询成功");
|
||||||
templateList = byTemplateId.getData();
|
// } else {
|
||||||
templateList.forEach(
|
// Result<List<MessageValueListResp>> byTemplateId = remoteServiceClient.findByTemplateId(templateId);
|
||||||
listResp ->
|
// templateList = byTemplateId.getData();
|
||||||
redisTemplate.opsForList().rightPush(
|
// templateList.forEach(
|
||||||
redisKey, JSON.toJSONString(listResp)
|
// listResp ->
|
||||||
)
|
// redisTemplate.opsForList().rightPush(
|
||||||
);
|
// redisKey, JSON.toJSONString(listResp)
|
||||||
log.info("数据库查询成功");
|
// )
|
||||||
}
|
// );
|
||||||
} catch (Exception e) {
|
// log.info("数据库查询成功");
|
||||||
throw new RuntimeException("获取报文模板失败");
|
// }
|
||||||
}
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException("获取报文模板失败");
|
||||||
|
// }
|
||||||
//判断报文模板列表不为空
|
//判断报文模板列表不为空
|
||||||
if (templateList.isEmpty()) {
|
if (templateList.isEmpty()) {
|
||||||
throw new RuntimeException("报文模版为空");
|
throw new RuntimeException("报文模版为空");
|
|
@ -95,26 +95,31 @@
|
||||||
<version>${mqtt.version}</version>
|
<version>${mqtt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>ecs20140526</artifactId>
|
<artifactId>ecs20140526</artifactId>
|
||||||
<version>5.1.8</version>
|
<version>5.1.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>tea-openapi</artifactId>
|
<artifactId>tea-openapi</artifactId>
|
||||||
<version>0.3.2</version>
|
<version>0.3.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>tea-console</artifactId>
|
<artifactId>tea-console</artifactId>
|
||||||
<version>0.0.1</version>
|
<version>0.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aliyun</groupId>
|
<groupId>com.aliyun</groupId>
|
||||||
<artifactId>tea-util</artifactId>
|
<artifactId>tea-util</artifactId>
|
||||||
<version>0.2.21</version>
|
<version>0.2.21</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun</groupId>
|
||||||
|
<artifactId>darabonba-env</artifactId>
|
||||||
|
<version>0.1.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.nacos.api.model.v2.Result;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.req.VehicleConnectionReq;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.service.VehicleConnectionService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 车辆连接控制器
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleGateway")
|
||||||
|
@Tag(name = "连接车辆控制层")
|
||||||
|
public class VehicleConnectionController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleConnectionService vehicleConnectionService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取http连接的参数
|
||||||
|
* @param vehicleConnectionReq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/receiveMsg/connect")
|
||||||
|
public Result receiveMsg(@RequestBody VehicleConnectionReq vehicleConnectionReq){
|
||||||
|
log.info("=======>"+vehicleConnectionReq);
|
||||||
|
vehicleConnectionService.getConnect(vehicleConnectionReq);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AliInstance {
|
||||||
|
/**
|
||||||
|
* 实例ID
|
||||||
|
*/
|
||||||
|
private String instanceId;
|
||||||
|
/**
|
||||||
|
* 实例IP
|
||||||
|
*/
|
||||||
|
private String ipAddress;
|
||||||
|
/**
|
||||||
|
* 实例状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建实例的数量
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AliServerConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 地域ID
|
||||||
|
*/
|
||||||
|
private String regionId;
|
||||||
|
/**
|
||||||
|
* 镜像ID
|
||||||
|
*/
|
||||||
|
private String imageId;
|
||||||
|
/**
|
||||||
|
* 实例规格
|
||||||
|
*/
|
||||||
|
private String instanceType;
|
||||||
|
/**
|
||||||
|
* 安全组ID
|
||||||
|
*/
|
||||||
|
private String securityGroupId;
|
||||||
|
/**
|
||||||
|
* 虚拟交换机ID
|
||||||
|
*/
|
||||||
|
private String vSwitchId;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆服务器
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ConnectWeight {
|
||||||
|
/**
|
||||||
|
* 车辆服务器ID
|
||||||
|
*/
|
||||||
|
private String carServerId;
|
||||||
|
/**
|
||||||
|
* 权重值
|
||||||
|
*/
|
||||||
|
private Integer weightValue;
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回状态码
|
||||||
|
*/
|
||||||
|
public class HttpStatus {
|
||||||
|
/**
|
||||||
|
* 操作成功
|
||||||
|
*/
|
||||||
|
private static final int SUCCESS = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象创建成功
|
||||||
|
*/
|
||||||
|
public static final int CREATED = 201;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求已经被接受
|
||||||
|
*/
|
||||||
|
public static final int ACCEPTED = 202;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作已经执行成功
|
||||||
|
*/
|
||||||
|
public static final int NO_CONTENT = 204;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源已被修改
|
||||||
|
*/
|
||||||
|
public static final int MOVED_PERM = 301;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重定向
|
||||||
|
*/
|
||||||
|
public static final int SEE_OTHER = 303;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源没有被修改
|
||||||
|
*/
|
||||||
|
public static final int NOT_MODIFIED = 304;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参数列表错误(缺少,格式不匹配)
|
||||||
|
*/
|
||||||
|
public static final int BAD_REQUEST = 400;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未授权
|
||||||
|
*/
|
||||||
|
public static final int UNAUTHORIZED = 401;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问受限,授权过期
|
||||||
|
*/
|
||||||
|
public static final int FORBIDDEN = 403;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源,服务未找到
|
||||||
|
*/
|
||||||
|
public static final int NOT_FOUND = 404;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许的http方法
|
||||||
|
*/
|
||||||
|
public static final int BAD_METHOD = 405;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资源冲突,或者资源被锁
|
||||||
|
*/
|
||||||
|
public static final int CONFLICT = 409;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不支持的数据,媒体类型
|
||||||
|
*/
|
||||||
|
public static final int UNSUPPORTED_TYPE = 415;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统内部错误
|
||||||
|
*/
|
||||||
|
public static final int ERROR = 500;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口未实现
|
||||||
|
*/
|
||||||
|
public static final int NOT_IMPLEMENTED = 501;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统警告消息
|
||||||
|
*/
|
||||||
|
public static final int WARN = 601;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Instance {
|
||||||
|
|
||||||
|
private String instanceId;
|
||||||
|
|
||||||
|
private String ipAddress;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "server_config")
|
||||||
|
public class ServerConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
/**
|
||||||
|
* 主机地址
|
||||||
|
*/
|
||||||
|
private String host;
|
||||||
|
/**
|
||||||
|
* 端口
|
||||||
|
*/
|
||||||
|
private String port;
|
||||||
|
/**
|
||||||
|
* 负载的地址
|
||||||
|
*/
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* 默认MQTT地址
|
||||||
|
*/
|
||||||
|
private String defaultMqttAddr;
|
||||||
|
/**
|
||||||
|
* 默认MQTT主题
|
||||||
|
*/
|
||||||
|
private String defaultMqttTopic;
|
||||||
|
/**
|
||||||
|
* 默认MQTT QOS
|
||||||
|
*/
|
||||||
|
private Integer defaultMqttQos;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆鉴权的参数
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VehicleConnection {
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
private String vehicleVin;
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private String timestamp;
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
/**
|
||||||
|
* 随机数
|
||||||
|
*/
|
||||||
|
private String nonce;
|
||||||
|
/**
|
||||||
|
* 密码
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VinIp {
|
||||||
|
/**
|
||||||
|
* 车辆的vin
|
||||||
|
*/
|
||||||
|
String vin;
|
||||||
|
/**
|
||||||
|
* 车辆的ip
|
||||||
|
*/
|
||||||
|
String ip;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.domain.req;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆获取链接地址
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class VehicleConnectionReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆vin
|
||||||
|
*/
|
||||||
|
private String vehicleVin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳
|
||||||
|
*/
|
||||||
|
private String timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机数
|
||||||
|
*/
|
||||||
|
private String nonce;
|
||||||
|
}
|
|
@ -1,23 +1,36 @@
|
||||||
// This file is auto-generated, don't edit it. Thanks.
|
// This file is auto-generated, don't edit it. Thanks.
|
||||||
package com.muyu.cloud.vehicle.gateway.test.example;
|
package com.muyu.cloud.vehicle.gateway.aliyun.ecs;
|
||||||
|
|
||||||
|
import com.aliyun.ecs20140526.Client;
|
||||||
|
import com.aliyun.ecs20140526.models.DeleteInstancesRequest;
|
||||||
import com.aliyun.ecs20140526.models.DescribeInstancesRequest;
|
import com.aliyun.ecs20140526.models.DescribeInstancesRequest;
|
||||||
import com.aliyun.ecs20140526.models.DescribeInstancesResponse;
|
import com.aliyun.ecs20140526.models.DescribeInstancesResponse;
|
||||||
import com.aliyun.ecs20140526.models.DescribeInstancesResponseBody;
|
import com.aliyun.ecs20140526.models.DescribeInstancesResponseBody;
|
||||||
import com.aliyun.tea.*;
|
import com.aliyun.tea.*;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.aliyun.teautil.Common;
|
||||||
import com.aliyun.teautil.models.RuntimeOptions;
|
import com.aliyun.teautil.models.RuntimeOptions;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.DisposableBean;
|
import org.springframework.beans.factory.DisposableBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.event.ContextClosedEvent;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除实例
|
* 删除实例
|
||||||
*/
|
*/
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Component
|
@Component
|
||||||
public class DelInstance implements DisposableBean{
|
public class DelInstance implements ApplicationListener<ContextClosedEvent> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>description</b> :
|
* <b>description</b> :
|
||||||
|
@ -26,46 +39,48 @@ public class DelInstance implements DisposableBean{
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static com.aliyun.ecs20140526.Client createClient() throws Exception {
|
public static Client createClient() throws Exception {
|
||||||
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||||
// 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
// 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
||||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
Config config = new Config()
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||||
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||||
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
||||||
// Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
// Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
||||||
config.endpoint = "ecs.cn-shanghai.aliyuncs.com";
|
config.endpoint = "ecs.cn-shanghai.aliyuncs.com";
|
||||||
return new com.aliyun.ecs20140526.Client(config);
|
return new Client(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void delInstance() throws Exception{
|
public void delInstance() throws Exception{
|
||||||
//创建ECS客户端对象,用于后续调用ECS相关API
|
//创建ECS客户端对象,用于后续调用ECS相关API
|
||||||
com.aliyun.ecs20140526.Client client = DelInstance.createClient();
|
Client client = DelInstance.createClient();
|
||||||
|
|
||||||
DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest()
|
List<String> list = redisTemplate.opsForList().range("instanceIds",0,-1);
|
||||||
.setRegionId("cn-shanghai");
|
|
||||||
|
|
||||||
//创建运行时选择对象,用于配置运行时的选项参数
|
// DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest()
|
||||||
RuntimeOptions runtimeOptions = new RuntimeOptions();
|
// .setRegionId("cn-shanghai");
|
||||||
|
|
||||||
//获取实例列表
|
// //创建运行时选择对象,用于配置运行时的选项参数
|
||||||
DescribeInstancesResponse describeInstancesResponse = client.describeInstancesWithOptions(describeInstancesRequest, runtimeOptions);
|
// RuntimeOptions runtimeOptions = new RuntimeOptions();
|
||||||
|
//
|
||||||
//提取实例ID集合
|
// //获取实例列表
|
||||||
ArrayList<String> list = new ArrayList<>();
|
// DescribeInstancesResponse describeInstancesResponse = client.describeInstancesWithOptions(describeInstancesRequest, runtimeOptions);
|
||||||
DescribeInstancesResponseBody body = describeInstancesResponse.getBody();
|
//
|
||||||
|
// //提取实例ID集合
|
||||||
for (DescribeInstancesResponseBody.DescribeInstancesResponseBodyInstancesInstance instance : body.getInstances().getInstance()) {
|
// ArrayList<String> list = new ArrayList<>();
|
||||||
list.add(instance.getInstanceId());
|
// DescribeInstancesResponseBody body = describeInstancesResponse.getBody();
|
||||||
}
|
//
|
||||||
|
// for (DescribeInstancesResponseBody.DescribeInstancesResponseBodyInstancesInstance instance : body.getInstances().getInstance()) {
|
||||||
System.out.println("Instance IDs"+list);
|
// list.add(instance.getInstanceId());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// System.out.println("Instance IDs"+list);
|
||||||
|
|
||||||
// 创建删除实例请求对象,并设置请求参数
|
// 创建删除实例请求对象,并设置请求参数
|
||||||
com.aliyun.ecs20140526.models.DeleteInstancesRequest deleteInstancesRequest = new com.aliyun.ecs20140526.models.DeleteInstancesRequest()
|
DeleteInstancesRequest deleteInstancesRequest = new DeleteInstancesRequest()
|
||||||
// 设置地域ID,指定要删除的实例所属的地域ID。
|
// 设置地域ID,指定要删除的实例所属的地域ID。
|
||||||
.setRegionId("cn-shanghai")
|
.setRegionId("cn-shanghai")
|
||||||
//设置DryRun为True,用于验证请求是否可以成功,但不实际执行删除操作
|
//设置DryRun为True,用于验证请求是否可以成功,但不实际执行删除操作
|
||||||
|
@ -77,32 +92,44 @@ public class DelInstance implements DisposableBean{
|
||||||
// 设置实例ID列表,使用参数名称 instanceId,参数类型为数组。
|
// 设置实例ID列表,使用参数名称 instanceId,参数类型为数组。
|
||||||
.setInstanceId(list);
|
.setInstanceId(list);
|
||||||
// 创建运行时选项对象,用于配置运行时的选项参数
|
// 创建运行时选项对象,用于配置运行时的选项参数
|
||||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
RuntimeOptions runtime = new RuntimeOptions();
|
||||||
try{
|
try{
|
||||||
//复制代码运行请自行打印 API 的返回值
|
//复制代码运行请自行打印 API 的返回值
|
||||||
client.deleteInstancesWithOptions(deleteInstancesRequest,runtime);
|
client.deleteInstancesWithOptions(deleteInstancesRequest,runtime);
|
||||||
} catch (TeaException error) {
|
} catch (TeaException error) {
|
||||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||||
// 错误 message
|
// 错误 message
|
||||||
System.out.println(error.getMessage());
|
log.error(error.getMessage());
|
||||||
// 诊断地址
|
// 诊断地址
|
||||||
System.out.println(error.getData().get("Recommend"));
|
log.error(error.getData().get("Recommend"));
|
||||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
Common.assertAsString(error.message);
|
||||||
} catch (Exception _error){
|
} catch (Exception _error){
|
||||||
TeaException error = new TeaException(_error.getMessage(), _error);
|
TeaException error = new TeaException(_error.getMessage(), _error);
|
||||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||||
// 错误 message
|
// 错误 message
|
||||||
System.out.println(error.getMessage());
|
log.error(error.getMessage());
|
||||||
//诊断地址
|
// 诊断地址
|
||||||
System.out.println(error.getData().get("Recommend"));
|
log.error(error.getData().get("Recommend"));
|
||||||
com.aliyun.teautil.Common.assertAsString(error.message);
|
Common.assertAsString(error.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void destroy() throws Exception {
|
||||||
|
// log.info("===============>开始执行删除实例方法");
|
||||||
|
// delInstance();
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() throws Exception {
|
public void onApplicationEvent(ContextClosedEvent event) {
|
||||||
log.info("===============>开始执行删除实例方法");
|
try{
|
||||||
delInstance();
|
log.info("=======>删除实例");
|
||||||
|
delInstance();
|
||||||
|
// redisTemplate.delete("instanceIds");
|
||||||
|
// redisTemplate.delete("instanceList");
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.ecs;
|
||||||
|
|
||||||
|
import com.aliyun.ecs20140526.Client;
|
||||||
|
import com.aliyun.ecs20140526.models.DescribeInstancesRequest;
|
||||||
|
import com.aliyun.ecs20140526.models.DescribeInstancesResponse;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.aliyun.darabonba.env.EnvClient;
|
||||||
|
import com.aliyun.teautil.Common;
|
||||||
|
import com.aliyun.teautil.models.RuntimeOptions;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询一台或多台实例的详细信息
|
||||||
|
*/
|
||||||
|
public class QueryInstance {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b>description</b> :
|
||||||
|
* <p>使用AK&SK初始化账号Client</p>
|
||||||
|
* @return Client
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static Client createClient(String alibabaCloudAccessKeyId, String alibabaCloudAccessKeySecret) throws Exception{
|
||||||
|
Config config = new Config()
|
||||||
|
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
||||||
|
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
||||||
|
config.endpoint = "ecs-cn-hangzhou.aliyuncs.com";
|
||||||
|
return new Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Client createClientWithSTS() throws Exception {
|
||||||
|
Config config = new Config()
|
||||||
|
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
||||||
|
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN")
|
||||||
|
.setSecurityToken("token")
|
||||||
|
.setType("sts");
|
||||||
|
config.endpoint = "ecs-cn-hangzhou.aliyuncs.com";
|
||||||
|
return new Client(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args_) throws Exception{
|
||||||
|
List<String> list = Arrays.asList(args_);
|
||||||
|
|
||||||
|
Client client = QueryInstance.createClient(EnvClient.getEnv("LTAI5t7Fnx2QLTYLSu9357wP"), EnvClient.getEnv("3LOnydNZ25ytsTGczuSygElx0HJ6nN"));
|
||||||
|
DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest()
|
||||||
|
.setRegionId("cn-shanghai")
|
||||||
|
.setInternetChargeType("PayByTraffic")
|
||||||
|
.setInstanceChargeType("PostPaid");
|
||||||
|
RuntimeOptions runtime = new RuntimeOptions();
|
||||||
|
DescribeInstancesResponse resp = client.describeInstancesWithOptions(describeInstancesRequest, runtime);
|
||||||
|
com.aliyun.teaconsole.Client.log(Common.toJSONString(resp));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,25 @@
|
||||||
package com.muyu.cloud.vehicle.gateway.test.example;
|
package com.muyu.cloud.vehicle.gateway.aliyun.ecs;
|
||||||
|
|
||||||
|
|
||||||
|
import com.aliyun.ecs20140526.Client;
|
||||||
|
import com.aliyun.ecs20140526.models.*;
|
||||||
import com.aliyun.tea.*;
|
import com.aliyun.tea.*;
|
||||||
|
import com.aliyun.teaopenapi.models.Config;
|
||||||
|
import com.aliyun.teautil.models.RuntimeOptions;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.Instance;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.apache.logging.log4j.CloseableThreadContext;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.data.redis.core.ListOperations;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量创建ECS实例
|
* 批量创建ECS实例
|
||||||
*/
|
*/
|
||||||
|
@ -14,6 +27,8 @@ import org.springframework.stereotype.Component;
|
||||||
@Component
|
@Component
|
||||||
public class Sample implements ApplicationRunner {
|
public class Sample implements ApplicationRunner {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>description</b> :
|
* <b>description</b> :
|
||||||
* <p>使用AK&SK初始化账号Client</p>
|
* <p>使用AK&SK初始化账号Client</p>
|
||||||
|
@ -21,44 +36,51 @@ public class Sample implements ApplicationRunner {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static com.aliyun.ecs20140526.Client createClient() throws Exception {
|
public static Client createClient() throws Exception {
|
||||||
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
// 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
Config config = new Config()
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||||
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
.setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
||||||
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||||
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
.setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
||||||
// Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
// Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
||||||
config.endpoint = "ecs-cn-hangzhou.aliyuncs.com";
|
config.endpoint = "ecs-cn-hangzhou.aliyuncs.com";
|
||||||
return new com.aliyun.ecs20140526.Client(config);
|
return new Client(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void creatInstance() throws Exception {
|
public void creatInstance() throws Exception {
|
||||||
|
|
||||||
// 将命令行参数转换为字符串列表
|
// 将命令行参数转换为字符串列表
|
||||||
java.util.List<String> args = java.util.Arrays.asList();
|
List<String> args = Arrays.asList();
|
||||||
// 创建阿里云ECS客户端
|
// 创建阿里云ECS客户端
|
||||||
com.aliyun.ecs20140526.Client client = Sample.createClient();
|
Client client = Sample.createClient();
|
||||||
// 配置系统盘参数
|
// 配置系统盘参数
|
||||||
com.aliyun.ecs20140526.models.RunInstancesRequest.RunInstancesRequestSystemDisk systemDisk = new com.aliyun.ecs20140526.models.RunInstancesRequest.RunInstancesRequestSystemDisk()
|
RunInstancesRequest.RunInstancesRequestSystemDisk systemDisk = new RunInstancesRequest.RunInstancesRequestSystemDisk()
|
||||||
.setSize("20")// 设置系统盘大小为40GB
|
.setSize("20")// 设置系统盘大小为40GB
|
||||||
.setCategory("cloud_essd");// 设置系统盘类型为cloud_essd
|
.setCategory("cloud_essd");// 设置系统盘类型为cloud_essd
|
||||||
// 创建创建实例请求对象并设置参数
|
// 创建创建实例请求对象并设置参数
|
||||||
com.aliyun.ecs20140526.models.RunInstancesRequest runInstancesRequest = new com.aliyun.ecs20140526.models.RunInstancesRequest()
|
RunInstancesRequest runInstancesRequest = new RunInstancesRequest()
|
||||||
.setRegionId("cn-shanghai") // 设置地域ID
|
.setRegionId("cn-shanghai") // 设置地域ID
|
||||||
.setImageId("m-uf66taa8r57hvow8cxlj")// 设置镜像ID
|
.setImageId("m-uf66taa8r57ky0pg3e7s")// 设置镜像ID
|
||||||
.setInstanceType("ecs.e-c1m1.large")// 设置实例类型
|
.setInstanceType("ecs.e-c1m1.large")// 设置实例类型
|
||||||
.setSecurityGroupId("sg-uf6hyictocodexptlgiv")// 设置安全组ID
|
.setSecurityGroupId("sg-uf6hyictocodexptlgiv")// 设置安全组ID
|
||||||
.setVSwitchId("vsw-uf6ags5luz17qd6ckn2tb")// 设置虚拟交换机ID
|
.setVSwitchId("vsw-uf6ags5luz17qd6ckn2tb")// 设置虚拟交换机ID
|
||||||
.setInstanceName("launch-advisor-20240928")// 设置实例名称
|
.setInstanceName("launch-advisor-20240929")// 设置实例名称
|
||||||
.setInstanceChargeType("PostPaid")// 设置实例付费类型为后付费按量付费
|
.setInstanceChargeType("PostPaid")// 设置实例付费类型为后付费按量付费
|
||||||
.setSystemDisk(systemDisk)// 设置系统盘配置
|
.setSystemDisk(systemDisk)// 设置系统盘配置
|
||||||
.setHostName("root")// 设置主机名
|
.setHostName("root")// 设置主机名
|
||||||
.setPassword("@ywt021900")// 设置实例密码
|
.setPassword("@ywt021900")// 设置实例密码
|
||||||
.setAmount(2);// 设置创建实例的数量
|
.setAmount(1)// 设置创建实例的数量
|
||||||
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
.setInternetChargeType("PayByTraffic")// 设置互联网计费类型为按流量计费
|
||||||
|
.setInternetMaxBandwidthOut(1);// 设置互联网最大出带宽为1 Mbps
|
||||||
|
RuntimeOptions runtime = new RuntimeOptions();
|
||||||
try {
|
try {
|
||||||
// 复制代码运行请自行打印 API 的返回值
|
// 复制代码运行请自行打印 API 的返回值
|
||||||
client.runInstancesWithOptions(runInstancesRequest, runtime);
|
RunInstancesResponse runInstancesResponse = client.runInstancesWithOptions(runInstancesRequest, runtime);
|
||||||
|
RunInstancesResponseBody body = runInstancesResponse.getBody();
|
||||||
|
ArrayList<String> list = new ArrayList<>(body.getInstanceIdSets().getInstanceIdSet());
|
||||||
|
log.info("实例ID:{}", list);
|
||||||
|
|
||||||
} catch (TeaException error) {
|
} catch (TeaException error) {
|
||||||
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
// 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||||
// 错误 message
|
// 错误 message
|
||||||
|
@ -77,6 +99,13 @@ public class Sample implements ApplicationRunner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private static DescribeInstancesResponse queryInstanceDetails(Client client) {
|
||||||
|
//
|
||||||
|
// //创建查询实例请求对象并设置参数
|
||||||
|
// DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest();
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
log.info("===============>开始批量创建实例");
|
log.info("===============>开始批量创建实例");
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.ecs;//// This file is auto-generated, don't edit it. Thanks.
|
||||||
|
//package com.muyu.cloud.vehicle.gateway.aliyun.ecs;
|
||||||
|
//
|
||||||
|
//import com.aliyun.tea.*;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 启动一台实例
|
||||||
|
// */
|
||||||
|
//public class StartInstance {
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * <b>description</b> :
|
||||||
|
// * <p>使用AK&SK初始化账号Client</p>
|
||||||
|
// * @return Client
|
||||||
|
// *
|
||||||
|
// * @throws Exception
|
||||||
|
// */
|
||||||
|
// public static com.aliyun.ecs20140526.Client createClient() throws Exception {
|
||||||
|
// // 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。
|
||||||
|
// // 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。
|
||||||
|
// com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||||
|
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
||||||
|
// .setAccessKeyId("LTAI5t7Fnx2QLTYLSu9357wP")
|
||||||
|
// // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
||||||
|
// .setAccessKeySecret("3LOnydNZ25ytsTGczuSygElx0HJ6nN");
|
||||||
|
// // Endpoint 请参考 https://api.aliyun.com/product/Ecs
|
||||||
|
// config.endpoint = "ecs.cn-shanghai.aliyuncs.com";
|
||||||
|
// return new com.aliyun.ecs20140526.Client(config);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static void main(String[] args_) throws Exception {
|
||||||
|
// java.util.List<String> args = java.util.Arrays.asList(args_);
|
||||||
|
// com.aliyun.ecs20140526.Client client = StartInstance.createClient();
|
||||||
|
// com.aliyun.ecs20140526.models.StartInstanceRequest startInstanceRequest = new com.aliyun.ecs20140526.models.StartInstanceRequest();
|
||||||
|
// com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||||
|
// try {
|
||||||
|
// // 复制代码运行请自行打印 API 的返回值
|
||||||
|
// client.startInstanceWithOptions(startInstanceRequest, runtime);
|
||||||
|
// } catch (TeaException error) {
|
||||||
|
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||||
|
// // 错误 message
|
||||||
|
// System.out.println(error.getMessage());
|
||||||
|
// // 诊断地址
|
||||||
|
// System.out.println(error.getData().get("Recommend"));
|
||||||
|
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||||
|
// } catch (Exception _error) {
|
||||||
|
// TeaException error = new TeaException(_error.getMessage(), _error);
|
||||||
|
// // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
||||||
|
// // 错误 message
|
||||||
|
// System.out.println(error.getMessage());
|
||||||
|
// // 诊断地址
|
||||||
|
// System.out.println(error.getData().get("Recommend"));
|
||||||
|
// com.aliyun.teautil.Common.assertAsString(error.message);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.mapper;
|
||||||
|
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.VehicleConnection;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.req.VehicleConnectionReq;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface VehicleConnectionMapper {
|
||||||
|
void addConnect(VehicleConnection vehicleConnection);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.service;
|
||||||
|
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.req.VehicleConnectionReq;
|
||||||
|
|
||||||
|
public interface VehicleConnectionService {
|
||||||
|
/**
|
||||||
|
* 获取连接
|
||||||
|
* @param vehicleConnectionReq
|
||||||
|
*/
|
||||||
|
void getConnect(VehicleConnectionReq vehicleConnectionReq);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.aliyun.service.impl;
|
||||||
|
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.VehicleConnection;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.domain.req.VehicleConnectionReq;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.mapper.VehicleConnectionMapper;
|
||||||
|
import com.muyu.cloud.vehicle.gateway.aliyun.service.VehicleConnectionService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@Service
|
||||||
|
public class VehicleConnectionServiceImpl implements VehicleConnectionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleConnectionMapper vehicleConnectionMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getConnect(VehicleConnectionReq vehicleConnectionReq) {
|
||||||
|
log.info("车辆连接请求:{}",vehicleConnectionReq.toString());
|
||||||
|
|
||||||
|
//发送消息
|
||||||
|
rabbitTemplate.convertAndSend("exchange_topics_inform","",vehicleConnectionReq.getVehicleVin());
|
||||||
|
|
||||||
|
VehicleConnection vehicleConnection = new VehicleConnection();
|
||||||
|
vehicleConnection.setVehicleVin(vehicleConnectionReq.getVehicleVin());
|
||||||
|
vehicleConnection.setUsername(vehicleConnectionReq.getUsername());
|
||||||
|
vehicleConnection.setPassword(vehicleConnectionReq.getVehicleVin()+vehicleConnectionReq.getTimestamp()+vehicleConnectionReq.getNonce());
|
||||||
|
vehicleConnectionMapper.addConnect(vehicleConnection);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.config;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.concurrent.Exchanger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rabbitmq配置类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RabbitmqConfig {
|
||||||
|
/**
|
||||||
|
* 日志
|
||||||
|
*/
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(RabbitmqConfig.class);
|
||||||
|
/**
|
||||||
|
* 队列
|
||||||
|
*/
|
||||||
|
private static final String QUEUE_INFORM_EMAIL = "queue_inform_email";
|
||||||
|
/**
|
||||||
|
* 队列
|
||||||
|
*/
|
||||||
|
private static final String QUEUE_INFORM_SMS = "queue_inform_sms";
|
||||||
|
/**
|
||||||
|
* 交换机
|
||||||
|
*/
|
||||||
|
private static final String EXCHANGE_TOPICS_INFORM = "exchange_topics_inform";
|
||||||
|
/**
|
||||||
|
* 路由key
|
||||||
|
*/
|
||||||
|
private static final String ROUTINGKEY_EMAIL = "inform.#.email.#";
|
||||||
|
/**
|
||||||
|
* 路由key
|
||||||
|
*/
|
||||||
|
private static final String ROUTINGKEY_SMS = "inform.#.sms.#";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明交换机,做持久化
|
||||||
|
*/
|
||||||
|
@Bean(EXCHANGE_TOPICS_INFORM)
|
||||||
|
public Exchange exchangeTopicsInform() {
|
||||||
|
try{
|
||||||
|
Exchange exchange = ExchangeBuilder.topicExchange(EXCHANGE_TOPICS_INFORM).durable(true).build();
|
||||||
|
logger.info("创建的交换机为:{}",EXCHANGE_TOPICS_INFORM);
|
||||||
|
return exchange;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("创建该:{} 交换机失败",EXCHANGE_TOPICS_INFORM,e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明QUEUE_INFORM_EMAIL队列
|
||||||
|
*/
|
||||||
|
@Bean(QUEUE_INFORM_EMAIL)
|
||||||
|
public Queue queueInformEmail() {
|
||||||
|
try{
|
||||||
|
Queue queue = new Queue(QUEUE_INFORM_EMAIL);
|
||||||
|
logger.info("创建的队列为:{}",QUEUE_INFORM_EMAIL);
|
||||||
|
return queue;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("创建该:{} 队列失败",QUEUE_INFORM_EMAIL,e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明QUEUE_INFORM_SMS队列
|
||||||
|
*/
|
||||||
|
@Bean(QUEUE_INFORM_SMS)
|
||||||
|
public Queue queueInformSms() {
|
||||||
|
try{
|
||||||
|
Queue queue = new Queue(QUEUE_INFORM_SMS);
|
||||||
|
logger.info("创建的队列为:{}",QUEUE_INFORM_SMS);
|
||||||
|
return queue;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("创建该:{} 队列失败",QUEUE_INFORM_SMS,e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ROUTINGKEY_EMAIL队列绑定交换机,指定routingKey
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Binding bindingExchangeInformEmail(@Qualifier(QUEUE_INFORM_EMAIL)Queue queue,
|
||||||
|
@Qualifier(EXCHANGE_TOPICS_INFORM)Exchange exchange) {
|
||||||
|
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_EMAIL).noargs();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ROUTINGKEY_SMS队列绑定交换机,指定routingKey
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Binding bindingExchangeInformSms(@Qualifier(QUEUE_INFORM_SMS)Queue queue,
|
||||||
|
@Qualifier(EXCHANGE_TOPICS_INFORM)Exchange exchange) {
|
||||||
|
return BindingBuilder.bind(queue).to(exchange).with(ROUTINGKEY_SMS).noargs();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.cloud.vehicle.gateway.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redis配置类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RedisConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RedisTemplate<String,String> redisTemplate(RedisConnectionFactory redisConnectionFactory){
|
||||||
|
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||||
|
|
||||||
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<Object>(Object.class));
|
||||||
|
|
||||||
|
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||||
|
redisTemplate.setHashValueSerializer(new StringRedisSerializer());
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue