Compare commits
69 Commits
master
...
dev.perfec
Author | SHA1 | Date |
---|---|---|
|
c8c16b9c80 | |
|
820039d3fe | |
|
813fcf1b55 | |
|
61f1ea45b2 | |
|
83961147fc | |
|
ad0460a90b | |
|
171df03d7c | |
|
a1ed677f0f | |
|
72ac72330e | |
|
3c2667ec37 | |
|
90e94c2736 | |
|
914b638efd | |
|
27479e2b49 | |
|
1e9c92e4d3 | |
|
2e5cb19f4f | |
|
51ca5ef6f4 | |
|
e2e943749e | |
|
013fe5809d | |
|
7f45b28116 | |
|
d3f2444521 | |
|
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 |
|
@ -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: vehicle
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -6,6 +6,7 @@ import org.springframework.data.redis.core.HashOperations;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.ValueOperations;
|
import org.springframework.data.redis.core.ValueOperations;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -17,6 +18,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
**/
|
**/
|
||||||
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
@SuppressWarnings(value = {"unchecked", "rawtypes"})
|
||||||
@Component
|
@Component
|
||||||
|
//@Service
|
||||||
public class RedisService {
|
public class RedisService {
|
||||||
@Autowired
|
@Autowired
|
||||||
public RedisTemplate redisTemplate;
|
public RedisTemplate redisTemplate;
|
||||||
|
|
|
@ -63,4 +63,5 @@ public class LoginUser implements Serializable {
|
||||||
*/
|
*/
|
||||||
private SysUser sysUser;
|
private SysUser sysUser;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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: vehicle
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:Custom
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 19:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "custom")
|
||||||
|
public class Custom {
|
||||||
|
@TableId(value = "c_id", type = IdType.AUTO)
|
||||||
|
private Integer cId;
|
||||||
|
@Excel(name = "值")
|
||||||
|
private String customName;
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.annotation.Excel.ColumnType;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:Fault
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/18 11:04
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "fault")
|
||||||
|
public class Fault extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增主键
|
||||||
|
*/
|
||||||
|
@Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 车辆故障编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆故障编码")
|
||||||
|
private String faultCode;
|
||||||
|
/**
|
||||||
|
* 车辆故障名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆故障名称")
|
||||||
|
private String faultName;
|
||||||
|
/**
|
||||||
|
* 车辆故障类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "辆故障类型")
|
||||||
|
private String faultType;
|
||||||
|
/**
|
||||||
|
* 故障VIN编码
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障VIN编码")
|
||||||
|
private String carVin;
|
||||||
|
/**
|
||||||
|
* 车辆故障标签
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆故障标签")
|
||||||
|
private String faultLabel;
|
||||||
|
/**
|
||||||
|
* 车辆故障位
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆故障位")
|
||||||
|
private String faultBit;
|
||||||
|
/**
|
||||||
|
* 车辆故障值
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆故障值")
|
||||||
|
private String faultValue;
|
||||||
|
/**
|
||||||
|
* 故障级别
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障级别")
|
||||||
|
private String faultWarn;
|
||||||
|
/**
|
||||||
|
* 报警状态(Y.是,N.否)
|
||||||
|
*/
|
||||||
|
@Excel(name = "报警状态(Y.是,N.否)")
|
||||||
|
private String warnStatus;
|
||||||
|
/**
|
||||||
|
* 故障描述信息
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障描述信息")
|
||||||
|
private String faultDesc;
|
||||||
|
/**
|
||||||
|
* 启用状态(1.待处理 2.处理中 3.已处理 4.忽略)
|
||||||
|
*/
|
||||||
|
@Excel(name = "启用状态(1.待处理 2.处理中 3.已处理 4.忽略)")
|
||||||
|
private String state;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:FaultConstant
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/19 14:33
|
||||||
|
*/
|
||||||
|
public class FaultConstant {
|
||||||
|
/**
|
||||||
|
* 故障信息存储
|
||||||
|
*/
|
||||||
|
public static final String FAULT_INFO_PREFIX = "fault:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障信息集合
|
||||||
|
*/
|
||||||
|
public static final String FAULT_LIST = "fault_list";
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain.vo
|
||||||
|
* @Filename:FaultInfo
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 20:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName(value = "fault_info", autoResultMap = true)
|
||||||
|
public class FaultInfo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障类型")
|
||||||
|
private String faultType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障组
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障组")
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障位
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障位")
|
||||||
|
private Integer faultBit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障值
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障值")
|
||||||
|
private String faultValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障标签
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障标签")
|
||||||
|
private String faultTab;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否警告
|
||||||
|
*/
|
||||||
|
@Excel(name = "是否警告")
|
||||||
|
private Long isWarning;
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:FaultLog
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 20:11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "fault_log", autoResultMap = true)
|
||||||
|
public class FaultLog{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障码
|
||||||
|
*/
|
||||||
|
@Excel(name = "故障码")
|
||||||
|
private String faultCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
@Excel(name = "车辆VIN")
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始报警时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "开始报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss")
|
||||||
|
private Date warningTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束报警时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:dd:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "结束报警时间", width = 30, dateFormat = "yyyy-MM-dd HH:dd:ss")
|
||||||
|
private Date normalTime;
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:Custom
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "rule")
|
||||||
|
public class Rule {
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Excel(name = "messageId")
|
||||||
|
private Long messageId;
|
||||||
|
|
||||||
|
@Excel(name = "carId")
|
||||||
|
private Integer carId;
|
||||||
|
|
||||||
|
@Excel(name = "cId")
|
||||||
|
private Integer cId;
|
||||||
|
|
||||||
|
@Excel(name = "tId")
|
||||||
|
private Integer tId;
|
||||||
|
|
||||||
|
@Excel(name = "ruleValue")
|
||||||
|
private Integer ruleValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:Type
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/22 10:03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "type")
|
||||||
|
public class Type {
|
||||||
|
@TableId(value = "t_id", type = IdType.AUTO)
|
||||||
|
private Integer tId;
|
||||||
|
private String typeName;
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.domain.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.domain
|
||||||
|
* @Filename:Custom
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName(value = "rule")
|
||||||
|
public class RuleVo {
|
||||||
|
|
||||||
|
@Excel(name = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Excel(name = "比较类型")
|
||||||
|
private Integer cId;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "messageId")
|
||||||
|
private Long messageId;
|
||||||
|
|
||||||
|
@Excel(name = "标签")
|
||||||
|
private String messageLabel;
|
||||||
|
|
||||||
|
|
||||||
|
@Excel(name = "车辆id")
|
||||||
|
private Integer carId;
|
||||||
|
|
||||||
|
@Excel(name = "车辆故障类型id")
|
||||||
|
private Integer tId;
|
||||||
|
|
||||||
|
@Excel(name = "参数值")
|
||||||
|
private Integer ruleValue;
|
||||||
|
|
||||||
|
@Excel(name = "标准")
|
||||||
|
private String customName;
|
||||||
|
|
||||||
|
@Excel(name = "故障类型name")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
@Excel(name = "车辆类型name")
|
||||||
|
private String carName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<artifactId>cloud-modules-enterprise-server</artifactId>
|
<artifactId>cloud-modules-enterprise-server</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
|
|
||||||
<!--企业业务平台-->
|
<!--企业业务平台-->
|
||||||
<description>
|
<description>
|
||||||
cloud-modules-enterprise-server 企业业务平台
|
cloud-modules-enterprise-server 企业业务平台
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
import com.muyu.enterprise.service.FaultService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.muyu.domain.Fault;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.controller
|
||||||
|
* @Filename:FaultController
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/17 11:08
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "故障管理列", description = "故障管理列")
|
||||||
|
@RequestMapping("/fault")
|
||||||
|
public class FaultController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultService faultService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("fault:fault:list")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<TableDataInfo<Fault>> list(Fault fault) {
|
||||||
|
startPage();
|
||||||
|
List<Fault> list = faultService.pageQuery(fault);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@RequiresPermissions("fault:fault:export")
|
||||||
|
public void export(HttpServletResponse response, Fault fault) {
|
||||||
|
List<Fault> list = faultService.pageQuery(fault);
|
||||||
|
ExcelUtil<Fault> util = new ExcelUtil<Fault>(Fault.class);
|
||||||
|
util.exportExcel(response, list, "车辆故障管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆故障管理详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<String> getConfigKey (@PathVariable("id") String id) {
|
||||||
|
return success(faultService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@RequiresPermissions("fault:fault:add")
|
||||||
|
public Result add(@RequestBody Fault fault) {
|
||||||
|
faultService.save(fault);
|
||||||
|
return Result.success(null,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
@RequiresPermissions("fault:fault:edit")
|
||||||
|
public Result edit(@RequestBody Fault fault) {
|
||||||
|
faultService.updateById(fault);
|
||||||
|
return Result.success(null,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@RequiresPermissions("fault:fault:remove")
|
||||||
|
public Result remove(@PathVariable("id") Long[] id) {
|
||||||
|
return Result.success(faultService.removeBatchByIds(Arrays.asList(id)), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.service.FaultInfoService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.muyu.domain.FaultInfo;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.controller
|
||||||
|
* @Filename:FaultController
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/17 11:08
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "故障管理列", description = "故障管理列")
|
||||||
|
@RequestMapping("/info")
|
||||||
|
public class FaultInfoController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultInfoService service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("fault:fault:list")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<TableDataInfo<FaultInfo>> list(FaultInfo faultInfo) {
|
||||||
|
startPage();
|
||||||
|
List<FaultInfo> list = service.pageQuery(faultInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@RequiresPermissions("fault:fault:export")
|
||||||
|
public void export(HttpServletResponse response, FaultInfo fault) {
|
||||||
|
List<FaultInfo> list = service.pageQuery(fault);
|
||||||
|
ExcelUtil<FaultInfo> util = new ExcelUtil<FaultInfo>(FaultInfo.class);
|
||||||
|
util.exportExcel(response, list, "车辆故障管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆故障管理详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<String> getConfigKey (@PathVariable("id") String id) {
|
||||||
|
return success(service.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@RequiresPermissions("fault:info:add")
|
||||||
|
public Result add(@RequestBody FaultInfo fault) {
|
||||||
|
service.save(fault);
|
||||||
|
return Result.success(null, "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
@RequiresPermissions("fault:info:edit")
|
||||||
|
public Result edit(@RequestBody FaultInfo fault) {
|
||||||
|
service.updateById(fault);
|
||||||
|
return Result.success(null, "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@RequiresPermissions("fault:info:remove")
|
||||||
|
public Result remove(@PathVariable("id") Long[] id) {
|
||||||
|
return Result.success(service.removeBatchByIds(Arrays.asList(id)), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.enterprise.service.FaultLogService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.muyu.domain.FaultLog;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.controller
|
||||||
|
* @Filename:FaultLogController
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 20:20
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/log")
|
||||||
|
public class FaultLogController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private FaultLogService faultLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("fault:log:list")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<TableDataInfo<FaultLog>> list(FaultLog fault) {
|
||||||
|
startPage();
|
||||||
|
List<FaultLog> list = faultLogService.pageQuery(fault);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@RequiresPermissions("fault:log:export")
|
||||||
|
public void export(HttpServletResponse response, FaultLog fault) {
|
||||||
|
List<FaultLog> list = faultLogService.pageQuery(fault);
|
||||||
|
ExcelUtil<FaultLog> util = new ExcelUtil<FaultLog>(FaultLog.class);
|
||||||
|
util.exportExcel(response, list, "车辆故障管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆故障管理详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<String> getConfigKey (@PathVariable("id") String id) {
|
||||||
|
return success(faultLogService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@RequiresPermissions("fault:log:add")
|
||||||
|
public Result add(@RequestBody FaultLog fault) {
|
||||||
|
faultLogService.save(fault);
|
||||||
|
return Result.success(null, "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
@RequiresPermissions("fault:log:edit")
|
||||||
|
public Result edit(@RequestBody FaultLog fault) {
|
||||||
|
faultLogService.updateById(fault);
|
||||||
|
return Result.success(null, "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@RequiresPermissions("fault:log:remove")
|
||||||
|
public Result remove(@PathVariable("id") Long[] id) {
|
||||||
|
return Result.success(faultLogService.removeBatchByIds(Arrays.asList(id)), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增故障日志
|
||||||
|
*/
|
||||||
|
@PostMapping("/addLog")
|
||||||
|
public Result addLog(@RequestBody FaultLog log){
|
||||||
|
faultLogService.insertFaultLog(log);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结束时间
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateLog")
|
||||||
|
public Result updateLog(@RequestBody FaultLog log){
|
||||||
|
faultLogService.updateFaultLogByStatus(log);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.muyu.domain.*;
|
||||||
|
import com.muyu.domain.vo.RuleVo;
|
||||||
|
import com.muyu.enterprise.service.RuleService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.controller
|
||||||
|
* @Filename:RuleController
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:42
|
||||||
|
*/
|
||||||
|
@Log4j2
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "规则", description = "故障管理列")
|
||||||
|
@RequestMapping("/rules")
|
||||||
|
public class RuleController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RuleService ruleService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("fault:rules:list")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<TableDataInfo<RuleVo>> list(RuleVo fault) {
|
||||||
|
startPage();
|
||||||
|
List<RuleVo> list = ruleService.pageQueryRule(fault);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@RequiresPermissions("fault:rules:export")
|
||||||
|
public void export(HttpServletResponse response, Rule fault) {
|
||||||
|
List<Rule> list = ruleService.pageQuery(fault);
|
||||||
|
ExcelUtil<Rule> util = new ExcelUtil<Rule>(Rule.class);
|
||||||
|
util.exportExcel(response, list, "车辆故障管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆故障管理详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<String> getConfigKey(@PathVariable("id") String id) {
|
||||||
|
return success(ruleService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
@RequiresPermissions("fault:rules:add")
|
||||||
|
public Result add(@RequestBody Rule fault) {
|
||||||
|
return Result.success(ruleService.insertFault(fault), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
@RequiresPermissions("fault:rules:edit")
|
||||||
|
public Result edit(@RequestBody Rule fault) {
|
||||||
|
return Result.success(ruleService.updateFault(fault), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆故障管理
|
||||||
|
*/
|
||||||
|
@Log(title = "车辆故障管理删除", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@RequiresPermissions("fault:rules:remove")
|
||||||
|
public Result remove(@PathVariable("id") Long[] id) {
|
||||||
|
return Result.success(ruleService.removeBatchByIds(Arrays.asList(id)), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/custom")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<List<Custom>> custom(Custom fault) {
|
||||||
|
return ruleService.pageQueryList(fault);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/car")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<List<Vehicle>> car(Vehicle fault) {
|
||||||
|
return ruleService.pageQueryCar(fault);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/type")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<List<Type>> type(Type fault) {
|
||||||
|
return ruleService.pageQueryType(fault);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/MessageValue")
|
||||||
|
@Operation(summary = "查询集合", description = "查询车辆故障管理列表")
|
||||||
|
public Result<List<MessageValue>> MessageValue(MessageValue fault) {
|
||||||
|
return ruleService.pageQueryMessageValue(fault);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询电子围栏(终版)
|
* 查询电子围栏(终版)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
import com.muyu.domain.FaultInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.mapper
|
||||||
|
* @Filename:FaultInfoMapper
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/19 22:19
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FaultInfoMapper extends BaseMapper<FaultInfo> {
|
||||||
|
|
||||||
|
int insertFaultinfo(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
|
||||||
|
int updateFaultinfo(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.domain.FaultLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.mapper
|
||||||
|
* @Filename:FaultLogMapper
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 21:15
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FaultLogMapper extends BaseMapper<FaultLog> {
|
||||||
|
|
||||||
|
Long selectFaultId(FaultLog log);
|
||||||
|
|
||||||
|
|
||||||
|
int updateFaultLogByTime(FaultLog log);
|
||||||
|
|
||||||
|
|
||||||
|
void insertBatchFaultLog(@Param("logs") List<FaultLog> logs);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.domain.Fault;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.mapper
|
||||||
|
* @Filename:FaultMapper
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/18 11:16
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FaultMapper extends BaseMapper<Fault> {
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.muyu.enterprise.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.domain.*;
|
||||||
|
import com.muyu.domain.vo.RuleVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.mapper
|
||||||
|
* @Filename:RuleMapper
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:50
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RuleMapper extends BaseMapper<Rule> {
|
||||||
|
int insertFault(Rule faultInfo);
|
||||||
|
|
||||||
|
int updateFault(Rule faultInfo);
|
||||||
|
|
||||||
|
|
||||||
|
List<RuleVo> pageQueryRule(RuleVo fault);
|
||||||
|
|
||||||
|
List<Custom> pageQueryList(Custom fault);
|
||||||
|
|
||||||
|
List<Vehicle> pageQueryCar(Vehicle fault);
|
||||||
|
List<Type> pageQueryType(Type fault);
|
||||||
|
|
||||||
|
List<MessageValue> pageQueryMessageValue(MessageValue fault);
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询电子围栏(终版)
|
* 查询电子围栏(终版)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.FaultInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:IFaultInfoService
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/19 22:15
|
||||||
|
*/
|
||||||
|
public interface FaultInfoService extends IService<FaultInfo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理
|
||||||
|
*
|
||||||
|
* @param faultInfo 车辆故障管理主键
|
||||||
|
* @return 车辆故障管理
|
||||||
|
*/
|
||||||
|
List<FaultInfo> pageQuery(FaultInfo faultInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.FaultLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:IFaultLogService
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 20:26
|
||||||
|
*/
|
||||||
|
public interface FaultLogService extends IService<FaultLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param fault
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<FaultLog> pageQuery(FaultLog fault);
|
||||||
|
|
||||||
|
|
||||||
|
public int insertFaultLog(FaultLog log);
|
||||||
|
|
||||||
|
|
||||||
|
public int updateFaultLogByStatus(FaultLog log);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.domain.Fault;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:IFaultService
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/18 11:12
|
||||||
|
*/
|
||||||
|
public interface FaultService extends IService<Fault> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理主键
|
||||||
|
* @return 车辆故障管理
|
||||||
|
*/
|
||||||
|
List<Fault> pageQuery(Fault fault);
|
||||||
|
|
||||||
|
}
|
|
@ -19,7 +19,5 @@ public interface IFencegroupService extends IService<FenceGroup> {
|
||||||
|
|
||||||
void addGroup(FenceGroupAddReq addReq);
|
void addGroup(FenceGroupAddReq addReq);
|
||||||
|
|
||||||
// List<FenceGroup> haveFence(HaveFence haveFence);
|
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.domain.*;
|
||||||
|
import com.muyu.domain.vo.RuleVo;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:RuleService
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:47
|
||||||
|
*/
|
||||||
|
public interface RuleService extends IService<Rule> {
|
||||||
|
/**
|
||||||
|
* 查询车辆故障管理
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理主键
|
||||||
|
* @return 车辆故障管理
|
||||||
|
*/
|
||||||
|
List<Rule> pageQuery(Rule fault);
|
||||||
|
List<RuleVo> pageQueryRule(RuleVo fault);
|
||||||
|
/**
|
||||||
|
* 新增车辆故障管理
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertFault(Rule fault);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆故障管理
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFault(Rule fault);
|
||||||
|
|
||||||
|
Result<List<Custom>> pageQueryList(Custom fault);
|
||||||
|
|
||||||
|
Result<List<Vehicle>> pageQueryCar(Vehicle fault);
|
||||||
|
Result<List<Type>> pageQueryType(Type fault);
|
||||||
|
|
||||||
|
|
||||||
|
Result<List<MessageValue>> pageQueryMessageValue(MessageValue fault);
|
||||||
|
|
||||||
|
}
|
|
@ -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) {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
|
||||||
|
import com.muyu.domain.FaultInfo;
|
||||||
|
import com.muyu.enterprise.mapper.FaultInfoMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service.impl
|
||||||
|
* @Filename:IFaultInfoServiceImpl
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/19 22:16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaultInfoServiceImpl extends ServiceImpl<FaultInfoMapper, FaultInfo> implements FaultInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultInfoMapper faultInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param faultInfo 车辆故障管理主键
|
||||||
|
* @return fault
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<FaultInfo> pageQuery(FaultInfo faultInfo) {
|
||||||
|
LambdaQueryWrapper<FaultInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultInfo.getFaultCode())) {
|
||||||
|
queryWrapper.like(FaultInfo::getFaultCode, faultInfo.getFaultCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultInfo.getFaultType())) {
|
||||||
|
queryWrapper.like(FaultInfo::getFaultType, faultInfo.getFaultType());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultInfo.getGroupName())) {
|
||||||
|
queryWrapper.like(FaultInfo::getGroupName, faultInfo.getGroupName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
|
||||||
|
import com.muyu.domain.FaultLog;
|
||||||
|
import com.muyu.enterprise.mapper.FaultLogMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:IFaultLogServiceImpl
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/16 20:37
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements FaultLogService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultLogMapper faultLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultLog> pageQuery(FaultLog fault) {
|
||||||
|
LambdaQueryWrapper<FaultLog> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(fault.getFaultCode())) {
|
||||||
|
queryWrapper.like(FaultLog::getFaultCode, fault.getFaultCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(fault.getVin())) {
|
||||||
|
queryWrapper.like(FaultLog::getVin, fault.getVin());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 时间区间查询
|
||||||
|
if (fault.getWarningTime() != null ) {
|
||||||
|
queryWrapper.gt(FaultLog::getWarningTime, fault.getWarningTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (fault.getNormalTime() != null ) {
|
||||||
|
queryWrapper.lt(FaultLog::getNormalTime, fault.getNormalTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
* @param log
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertFaultLog(FaultLog log) {
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*修改
|
||||||
|
* @param log
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateFaultLogByStatus(FaultLog log) {
|
||||||
|
log.setId(faultLogMapper.selectFaultId(log));
|
||||||
|
return faultLogMapper.updateFaultLogByTime(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
import com.muyu.domain.Fault;
|
||||||
|
import com.muyu.enterprise.mapper.FaultMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:IFaultServiceImpl
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/18 11:14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaultServiceImpl extends ServiceImpl<FaultMapper, Fault> implements FaultService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FaultMapper faultMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理主键
|
||||||
|
* @return fault
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Fault> pageQuery(Fault fault) {
|
||||||
|
LambdaQueryWrapper<Fault> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(fault.getFaultCode())) {
|
||||||
|
queryWrapper.like(Fault::getFaultCode, fault.getFaultCode());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(fault.getFaultType())) {
|
||||||
|
queryWrapper.like(Fault::getFaultType, fault.getFaultType());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(fault.getFaultName())) {
|
||||||
|
queryWrapper.like(Fault::getFaultName, fault.getFaultName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Object beginTime = fault.getParams().get("beginTime");
|
||||||
|
if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate) {
|
||||||
|
queryWrapper.gt(BaseEntity::getCreateTime, beginDate);
|
||||||
|
}
|
||||||
|
Object endTime = fault.getParams().get("endTime");
|
||||||
|
if (Objects.nonNull(endTime) && endTime instanceof Date endDate) {
|
||||||
|
queryWrapper.lt(BaseEntity::getCreateTime, endDate);
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
|
||||||
|
import com.muyu.domain.*;
|
||||||
|
import com.muyu.domain.vo.RuleVo;
|
||||||
|
import com.muyu.enterprise.mapper.RuleMapper;
|
||||||
|
import com.muyu.enterprise.service.RuleService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:ChenYan
|
||||||
|
* @Project:2112-car-cloud-server
|
||||||
|
* @Package:com.muyu.fault.service
|
||||||
|
* @Filename:RuleServiceImpl
|
||||||
|
* @Description TODO
|
||||||
|
* @Date:2024/9/21 18:49
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class RuleServiceImpl extends ServiceImpl<RuleMapper, Rule> implements RuleService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RuleMapper ruleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param fault 车辆故障管理主键
|
||||||
|
* @return fault
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Rule> pageQuery(Rule fault) {
|
||||||
|
LambdaQueryWrapper<Rule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (fault.getRuleValue()!=null) {
|
||||||
|
queryWrapper.like(Rule::getRuleValue, fault.getRuleValue());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RuleVo> pageQueryRule(RuleVo fault) {
|
||||||
|
List<RuleVo>list=ruleMapper.pageQueryRule(fault);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉框
|
||||||
|
* @param fault
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result<List<Custom>> pageQueryList(Custom fault) {
|
||||||
|
List<Custom>list=ruleMapper.pageQueryList(fault);
|
||||||
|
return Result.success(list,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<Vehicle>> pageQueryCar(Vehicle fault) {
|
||||||
|
List<Vehicle>list=ruleMapper.pageQueryCar(fault);
|
||||||
|
return Result.success(list,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<Type>> pageQueryType(Type fault) {
|
||||||
|
List<Type>list=ruleMapper.pageQueryType(fault);
|
||||||
|
return Result.success(list,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<MessageValue>> pageQueryMessageValue(MessageValue fault) {
|
||||||
|
List<MessageValue>list=ruleMapper.pageQueryMessageValue(fault);
|
||||||
|
return Result.success(list,"成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 车辆故障管理insertFault
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertFault(Rule faultInfo) {
|
||||||
|
int i = ruleMapper.insertFault(faultInfo);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆故障管理updateFault
|
||||||
|
* @param faultInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateFault(Rule faultInfo) {
|
||||||
|
int i = ruleMapper.updateFault(faultInfo);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,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: vehicle
|
||||||
# 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:
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.enterprise.mapper.FaultLogMapper">
|
||||||
|
|
||||||
|
<insert id="insertBatchFaultLog">
|
||||||
|
insert into faultlog (fault_code, vin, warning_time)
|
||||||
|
values
|
||||||
|
<foreach collection="logs" item="temp" separator=",">
|
||||||
|
(#{temp.faultCode},#{temp.vin},#{temp.warningTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFaultLogByTime">
|
||||||
|
update faultlog
|
||||||
|
set normal_time = #{normalTime}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectFaultId" resultType="java.lang.Long">
|
||||||
|
select max(id)
|
||||||
|
from faultlog
|
||||||
|
where fault_code = #{faultCode}
|
||||||
|
and vin = #{vin}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.enterprise.mapper.RuleMapper">
|
||||||
|
<insert id="insertFault">
|
||||||
|
INSERT INTO `vehicle-basic`.`rule` ( `message_id`, `car_id`, `c_id`, `t_id`, `rule_value`)
|
||||||
|
VALUES ( #{messageId}, #{carId}, #{cId}, #{tId}, #{ruleValue})
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateFault">
|
||||||
|
UPDATE `rule`
|
||||||
|
SET `message_id`=#{messageId},
|
||||||
|
`car_id` = #{carId},
|
||||||
|
`c_id` = #{cId},
|
||||||
|
`t_id` = #{tId},
|
||||||
|
`rule_value` = #{ruleValue}
|
||||||
|
WHERE `id` = #{id};
|
||||||
|
|
||||||
|
</update>
|
||||||
|
<select id="pageQueryRule" resultType="com.muyu.domain.vo.RuleVo">
|
||||||
|
SELECT
|
||||||
|
rule.id,
|
||||||
|
rule.car_id,
|
||||||
|
rule.c_id,
|
||||||
|
rule.t_id,
|
||||||
|
rule.message_id,
|
||||||
|
rule_value,
|
||||||
|
custom_name AS customName,
|
||||||
|
type_name AS typeName,
|
||||||
|
car.car_name AS carName,
|
||||||
|
message_value.message_label AS messageLabel
|
||||||
|
FROM
|
||||||
|
rule
|
||||||
|
LEFT JOIN custom ON rule.c_id = custom.c_id
|
||||||
|
LEFT JOIN type ON rule.t_id = type.t_id
|
||||||
|
LEFT JOIN car ON rule.car_id = car.car_id
|
||||||
|
LEFT JOIN message_value ON rule.message_id = message_value.message_id
|
||||||
|
</select>
|
||||||
|
<select id="pageQueryList" resultType="com.muyu.domain.Custom">
|
||||||
|
select * from custom
|
||||||
|
</select>
|
||||||
|
<select id="pageQueryCar" resultType="com.muyu.domain.Vehicle">
|
||||||
|
select * from vehicle
|
||||||
|
</select>
|
||||||
|
<select id="pageQueryType" resultType="com.muyu.domain.Type">
|
||||||
|
select * from type
|
||||||
|
</select>
|
||||||
|
<select id="pageQueryMessageValue" resultType="com.muyu.domain.MessageValue">
|
||||||
|
select * from message_value
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -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: vehicle
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -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: vehicle
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -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: vehicle
|
||||||
|
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -20,6 +20,26 @@ public class VehicleProcessingApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(VehicleProcessingApplication.class, args);
|
SpringApplication.run(VehicleProcessingApplication.class, args);
|
||||||
|
System.out.println(" _ooOoo_\n" +
|
||||||
|
" o8888888o\n" +
|
||||||
|
" 88\" . \"88\n" +
|
||||||
|
" (| -_- |)\n" +
|
||||||
|
" O\\ = /O\n" +
|
||||||
|
" ____/`---'\\____\n" +
|
||||||
|
" .' \\\\| |// `.\n" +
|
||||||
|
" / \\\\||| : |||// \\\n" +
|
||||||
|
" / _||||| -:- |||||- \\\n" +
|
||||||
|
" | | \\\\\\ - /// | |\n" +
|
||||||
|
" | \\_| ''\\---/'' | |\n" +
|
||||||
|
" \\ .-\\__ `-` ___/-. /\n" +
|
||||||
|
" ___`. .' /--.--\\ `. . __\n" +
|
||||||
|
" .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" +
|
||||||
|
" | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" +
|
||||||
|
" \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" +
|
||||||
|
" ======`-.____`-.___\\_____/___.-`____.-'======\n" +
|
||||||
|
" `=---='\n" +
|
||||||
|
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
|
||||||
|
" // 佛祖保佑 永不宕机 永无BUG //");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 com.alibaba.fastjson.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,35 @@
|
||||||
|
package com.muyu.processing.basic;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.context.ApplicationEventPublisherAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 策略发送事件
|
||||||
|
* @Author:杨鹏
|
||||||
|
* @Package:com.muyu.processing.basic
|
||||||
|
* @Project:car-cloud-server
|
||||||
|
* @name:EventPublisher
|
||||||
|
* @Date:2024/9/29 22:31
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class EventPublisher implements ApplicationEventPublisherAware {
|
||||||
|
|
||||||
|
private ApplicationEventPublisher publisher;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher){
|
||||||
|
this.publisher = applicationEventPublisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送事件
|
||||||
|
* @param jsonObject 数据
|
||||||
|
*/
|
||||||
|
public void eventPublish(JSONObject jsonObject){
|
||||||
|
EventCustom eventCustom = new EventCustom(this, jsonObject);
|
||||||
|
publisher.publishEvent(eventCustom);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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,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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,12 +1,11 @@
|
||||||
package com.muyu.processing.consumer;
|
package com.muyu.processing.consumer;
|
||||||
|
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
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.processing.basic.EventPublisher;
|
||||||
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 +16,12 @@ 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;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* kafka消费者
|
||||||
* @Author:杨鹏
|
* @Author:杨鹏
|
||||||
* @Package:com.muyu.processing.consumer
|
* @Package:com.muyu.processing.consumer
|
||||||
* @Project:car-cloud-server
|
* @Project:car-cloud-server
|
||||||
|
@ -29,36 +32,53 @@ import java.util.Collection;
|
||||||
@Component
|
@Component
|
||||||
public class KafkaConsumerService implements InitializingBean {
|
public class KafkaConsumerService implements InitializingBean {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅的Topic
|
||||||
|
*/
|
||||||
|
private static final String TIPSY = "tipsy";
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private KafkaConsumer kafkaConsumer;
|
private KafkaConsumer kafkaConsumer;
|
||||||
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private EventInterface eventInterface;
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线程池
|
||||||
|
*/
|
||||||
|
private final ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
|
||||||
Thread thread = new Thread(() -> {
|
Thread thread = new Thread(() -> {
|
||||||
log.info("启动线程监听Topic: {}", "zeshi");
|
log.info("启动线程监听Topic: {}", TIPSY);
|
||||||
|
// 延迟1秒
|
||||||
ThreadUtil.sleep(1000);
|
ThreadUtil.sleep(1000);
|
||||||
Collection<String> topics = Lists.newArrayList("zeshi");
|
// 订阅主题
|
||||||
|
Collection<String> topics = Lists.newArrayList(TIPSY);
|
||||||
kafkaConsumer.subscribe(topics);
|
kafkaConsumer.subscribe(topics);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
// 轮询消费消息
|
||||||
ConsumerRecords<String, String> consumerRecords = kafkaConsumer.poll(Duration.ofMillis(1000));
|
ConsumerRecords<String, String> consumerRecords = kafkaConsumer.poll(Duration.ofMillis(1000));
|
||||||
for (ConsumerRecord consumerRecord : consumerRecords) {
|
consumerRecords.forEach(record -> executorService.execute(() -> publish(record)));
|
||||||
//从ConsumerRecord中获取消费数据
|
|
||||||
String originalMsg = (String) consumerRecord.value();
|
|
||||||
log.info("从Kafka中消费的原始数据: " + originalMsg);
|
|
||||||
//把消费数据转换为JSON对象
|
|
||||||
JSONObject jsonObject = JSON.parseObject(originalMsg);
|
|
||||||
log.info("消费数据转换为JSON对象: " + jsonObject);
|
|
||||||
log.info("消费数据转换为JSON对象: " + jsonObject.toString());
|
|
||||||
// eventInterface.handle(jsonObject);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void publish(ConsumerRecord consumerRecord) {
|
||||||
|
//从ConsumerRecord中获取消费数据
|
||||||
|
String originalMsg = (String) consumerRecord.value();
|
||||||
|
log.info("从Kafka中消费的原始数据: " + originalMsg);
|
||||||
|
//把消费数据转换为JSON对象
|
||||||
|
JSONObject jsonObject = JSON.parseObject(originalMsg);
|
||||||
|
// 发布事件
|
||||||
|
eventPublisher.eventPublish(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.muyu.processing.consumer;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下线监听队列名称
|
||||||
|
*/
|
||||||
|
private static final String OFFLINE_MONITORING = "MQ_OFFLINE_MONITORING";
|
||||||
|
/**
|
||||||
|
* 下线监听交换机名称
|
||||||
|
*/
|
||||||
|
private static final String OFFLINE_EXCHANGE = "OFFLINE_EXCHANGE";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收消息
|
||||||
|
* @param vin 车辆vin
|
||||||
|
*/
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(value = OFFLINE_MONITORING, declare = "true"),
|
||||||
|
exchange = @Exchange(value = OFFLINE_EXCHANGE, type = "fanout")))
|
||||||
|
public void online(String vin){
|
||||||
|
log.info("清除缓存中的数据,车辆vin: {}", vin);
|
||||||
|
// 清除缓存
|
||||||
|
cacheUtil.remove(vin);
|
||||||
|
log.info("vin码为: {}de本地缓存清除成功",vin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.muyu.processing.consumer;
|
||||||
|
|
||||||
|
import com.muyu.domain.Fence;
|
||||||
|
import com.muyu.domain.Vehicle;
|
||||||
|
import com.muyu.domain.WarnRule;
|
||||||
|
import com.muyu.domain.resp.VehicleManageResp;
|
||||||
|
import com.muyu.domain.resp.WarnRuleResp;
|
||||||
|
import com.muyu.enterprise.cache.*;
|
||||||
|
import com.muyu.processing.utils.CacheUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上线监听队列名称
|
||||||
|
*/
|
||||||
|
private static final String ON_LINE_MONITORING = "MQ_ON_LINE_MONITORING";
|
||||||
|
/**
|
||||||
|
* 上线监听交换机名称
|
||||||
|
*/
|
||||||
|
private static final String ONLINE_EXCHANGE = "ONLINE_EXCHANGE";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VehicleCacheService vehicleCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AllVehicleCacheService allVehicleCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FaultCacheService faultCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FenceCahceService fenceCahceService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WarnRuleCacheService warnRuleCacheService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WarnStrategyCacheService warnStrategyCacheService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上线监听车辆网关中车辆上线时
|
||||||
|
*/
|
||||||
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
|
value = @Queue(value = ON_LINE_MONITORING, declare = "true"),
|
||||||
|
exchange = @Exchange(value = ONLINE_EXCHANGE, type = "fanout")))
|
||||||
|
public void online(String vin){
|
||||||
|
log.info("添加本地缓存,车辆vin: {}", vin);
|
||||||
|
// 获取redis中的数据
|
||||||
|
Fence fence = fenceCahceService.get(vin);
|
||||||
|
Object breakdown = faultCacheService.get(vin);
|
||||||
|
Vehicle vehicle = vehicleCacheService.get(vin);
|
||||||
|
WarnRule warnRule = warnRuleCacheService.get(vin);
|
||||||
|
WarnRuleResp warnStrategy = warnStrategyCacheService.get(vin);
|
||||||
|
VehicleManageResp vehicleManageResp = allVehicleCacheService.get(vin);
|
||||||
|
// 封装从redis中获得的数据
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("fence",fence);
|
||||||
|
map.put("breakdown",breakdown);
|
||||||
|
map.put("vehicle",vehicle);
|
||||||
|
map.put("warnRule",warnRule);
|
||||||
|
map.put("warnStrategy",warnStrategy);
|
||||||
|
map.put("vehicleManageResp",vehicleManageResp);
|
||||||
|
// 添加到本地缓存中
|
||||||
|
cacheUtil.put(vin,map);
|
||||||
|
log.info("vin码为: {}, 数据为: {}, 已完成本地缓存",vin,map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue