feat():缓存各个模块对象
parent
476d6ae0b7
commit
370a91773e
|
@ -8,6 +8,9 @@ package com.muyu.cache;/**
|
|||
import com.muyu.common.redis.service.RedisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static cn.hutool.core.lang.ansi.AnsiEncoder.encode;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuping
|
||||
* @package com.muyu.cache
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.CarType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 车辆类型缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 16:31:44
|
||||
*/
|
||||
@Component
|
||||
public class CarTypeCacheService extends CacheAbsBasic<String, CarType> {
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carType:";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码key
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.DataType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 数据类型缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 10:57:24
|
||||
*/
|
||||
@Component
|
||||
public class DataTypeCacheService extends CacheAbsBasic<String, DataType> {
|
||||
/**
|
||||
* key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "DataType";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ package com.muyu.cache;
|
|||
import com.muyu.common.domain.database.ElectronicFence;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 电子围栏缓存
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.MessageTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 报文缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 11:01:13
|
||||
*/
|
||||
@Component
|
||||
public class MessageTemplateCacheService extends CacheAbsBasic<String, MessageTemplate>{
|
||||
/**
|
||||
* key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "message_template";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.MessageTemplateType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 报文模版类型缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 11:04:43
|
||||
*/
|
||||
@Component
|
||||
public class MessageTemplateTypeCacheService extends CacheAbsBasic<String, MessageTemplateType>{
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "messageTemplateType";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.SysCar;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 车辆缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 16:35:14
|
||||
*/
|
||||
@Component
|
||||
public class SysCarCacheService extends CacheAbsBasic<String, SysCar>{
|
||||
/**
|
||||
* key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "car:";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.Template;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 报文模版缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 18:21:46
|
||||
*/
|
||||
@Component
|
||||
public class TemplateCacheService extends CacheAbsBasic<String, Template>{
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "template";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.WarnRule;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 预警规则缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 16:37:09
|
||||
*/
|
||||
@Component
|
||||
public class WarnRuleCacheService extends CacheAbsBasic<String, WarnRule>{
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warnRule";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.cache;
|
||||
|
||||
import com.muyu.common.domain.WarnStrategy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Author YuPing
|
||||
* @Description 预警策略缓存
|
||||
* @Version 1.0
|
||||
* @Data 2024-09-30 16:38:35
|
||||
*/
|
||||
@Component
|
||||
public class WarnStrategyCacheService extends CacheAbsBasic<String, WarnStrategy> {
|
||||
/**
|
||||
* 缓存key前缀
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warnStrategy";
|
||||
}
|
||||
|
||||
/**
|
||||
* 解码key
|
||||
* @param key 编码key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace(keyPre(), "");
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.muyu.server.mapper;
|
|||
|
||||
import com.muyu.common.domain.Enterprise;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -26,5 +27,5 @@ public interface EnterpriseDao {
|
|||
|
||||
|
||||
//删除企业信息
|
||||
public int deleteByIds(Integer[] ids);
|
||||
public int deleteByIds(@Param("ids") Integer[] ids);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -53,9 +54,12 @@ public class ElectronicFenceServiceImpl extends ServiceImpl<ElectronicFenceMappe
|
|||
List<ElectronicFence> list = this.list(queryWrapper);
|
||||
|
||||
list.forEach(electronicFence -> {
|
||||
electronicFenceCacheService.put(electronicFence.getId().toString(),electronicFence);
|
||||
electronicFenceCacheService.put(electronicFence.getId().toString(), electronicFence);
|
||||
});
|
||||
|
||||
ElectronicFence electronicFence = electronicFenceCacheService.get("electronicFence");
|
||||
log.info("electronicFenceCacheService.get(electronicFence) = {}",electronicFence);
|
||||
|
||||
return list.stream().map(ElectronicFence::bullerResp).toList();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue