feat:()优化代码
parent
832da812c3
commit
0be090d11b
|
@ -13,11 +13,11 @@ public class AllFaultCacheService extends CacheAbsBacis {
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "Allfault:info:";
|
||||
return "AllFault:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("Allfault:info:", "");
|
||||
return key.replace("AllFault:info:", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ public class AllFenceCahceService extends CacheAbsBacis<String, FenceResp> {
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "Allfence:info:";
|
||||
return "AllFence:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("Allfence:info:", "");
|
||||
return key.replace("AllFence:info:", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ public class AllMessageValueCacheService extends CacheAbsBacis<String, MessageVa
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "Allmessagevalue:info:";
|
||||
return "AllMessagevalue:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("Allmessagevalue:info:", "");
|
||||
return key.replace("AllMessagevalue:info:", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@ public class AllVehicleCacheService extends CacheAbsBacis<String, VehicleManageR
|
|||
*/
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "allvehicle:info:";
|
||||
return "AllVehicle:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("allvehicle:info:", "");
|
||||
return key.replace("AllVehicle:info:", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ public class AllVehicleTypeCacheService extends CacheAbsBacis<String, VehicleTyp
|
|||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "vehicleType:info:";
|
||||
return "AllVehicleType:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("vehicleType:info:", "");
|
||||
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,24 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.CacheAbsBacis;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
|
||||
/**
|
||||
* 预警策略缓存服务
|
||||
*/
|
||||
public class AllWarnStrategyCacheService extends CacheAbsBacis<String, WarnStrategy> {
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "AllWarnStrategy:info:";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("AllWarnStrategy:info:", "");
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ 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.AllWarnStrategyCacheService
|
||||
com.muyu.enterprise.cache.FaultCacheService
|
||||
com.muyu.enterprise.cache.FenceCahceService
|
||||
com.muyu.enterprise.cache.MessageTemplateCacheService
|
||||
|
|
|
@ -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;
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -148,7 +148,7 @@ public class ElectController extends BaseController {
|
|||
@DeleteMapping("/delMoreFence")
|
||||
@Operation(description = "批量删除电子围栏")
|
||||
public Result delMore(@RequestBody List<Long> fenceIds){
|
||||
// electService.delMoreFence(fenceIds);
|
||||
//批量删除内容存到Redis
|
||||
electService.removeBatchByIds(fenceIds);
|
||||
return Result.success(null,"操作成功");
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class VehicleController extends BaseController {
|
|||
/**
|
||||
* 车辆绑定围栏组
|
||||
*/
|
||||
@GetMapping("/addBoundFenceGroup")
|
||||
@PostMapping("/addBoundFenceGroup")
|
||||
@Operation(description = "车辆绑定围栏组")
|
||||
public Result boundFenceGroup(
|
||||
@Validated @RequestBody BoundFenceGroupReq boundFenceGroupReq){
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.enterprise.cache.AllWarnRuleCacheService;
|
||||
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
||||
import com.muyu.enterprise.service.WarnRuleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -22,6 +23,10 @@ public class WarnRuleController {
|
|||
@Autowired
|
||||
private WarnRuleCacheService warnRuleCacheService;
|
||||
|
||||
//存列表
|
||||
@Autowired
|
||||
private AllWarnRuleCacheService allWarnRuleCacheServicel;
|
||||
|
||||
/**
|
||||
* 规则列表
|
||||
* @return
|
||||
|
@ -29,7 +34,11 @@ public class WarnRuleController {
|
|||
@RequestMapping(path = "/ruleList",method = RequestMethod.POST)
|
||||
@Operation(summary = "规则列表", description = "获取所有规则列表")
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.WarnStrategy;
|
||||
import com.muyu.enterprise.cache.AllWarnStrategyCacheService;
|
||||
import com.muyu.enterprise.cache.WarnStrategyCacheService;
|
||||
import com.muyu.enterprise.service.WarnStrategyService;
|
||||
import com.muyu.domain.req.WarnVehicleReq;
|
||||
|
@ -26,6 +27,10 @@ public class WarnStrategyController {
|
|||
@Autowired
|
||||
private WarnStrategyCacheService warnStrategyCacheService;
|
||||
|
||||
//列表
|
||||
@Autowired
|
||||
private AllWarnStrategyCacheService allWarnStrategyCacheService;
|
||||
|
||||
/**
|
||||
* 策略列表
|
||||
* @return
|
||||
|
@ -33,7 +38,12 @@ public class WarnStrategyController {
|
|||
@RequestMapping(path = "/strategyList",method = RequestMethod.POST)
|
||||
@Operation(summary = "策略列表", description = "获取所有策略列表")
|
||||
public Result<List<WarnStrategy>> strategyList() {
|
||||
return Result.success(warnStrategyService.list());
|
||||
List<WarnStrategy> list = warnStrategyService.list();
|
||||
//存进Redis
|
||||
for (WarnStrategy warnStrategy : list) {
|
||||
allWarnStrategyCacheService.put(String.valueOf(warnStrategy.getWarnStrategyId()),warnStrategy);
|
||||
}
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue