parent
a229006c89
commit
f81d701acb
|
@ -24,6 +24,48 @@ public abstract class CacheAbsBasic<K,V> implements CacheBasic<K,V> {
|
|||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存中车辆的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public V getManage(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据存入缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void putManage(K key, V value) {
|
||||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取缓存中故障的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public V getFault(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据存入故障缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void putFault(K key, V value) {
|
||||
redisService.setCacheObject(encode(key),value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public V get(K key) {
|
||||
return redisService.getCacheObject(encode(key));
|
||||
|
|
|
@ -11,6 +11,36 @@ import java.awt.image.Kernel;
|
|||
*/
|
||||
|
||||
public interface CacheBasic<K,V> extends PrimaryKeyBasic<K>{
|
||||
|
||||
/**
|
||||
* 将数据存入车辆缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
void putManage(K key,V value);
|
||||
|
||||
/**
|
||||
* 获取缓存中故障的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
V getFault(K key);
|
||||
|
||||
/**
|
||||
* 将数据存入故障缓存
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
void putFault(K key,V value);
|
||||
|
||||
/**
|
||||
* 获取缓存中车辆的数据
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
V getManage(K key);
|
||||
|
||||
|
||||
void put(K key,V value);
|
||||
|
||||
V get(K key);
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
|
||||
/**
|
||||
* redis企业业务层
|
||||
* @ClassName CarCompanyCacheService
|
||||
* @Description CarCompanyCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarCompanyCacheService extends CacheAbsBasic<String, CarCompany> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "CarCompany:info:";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("CarCompany:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.FaultType;
|
||||
|
||||
/**
|
||||
* redis故障业务层
|
||||
* @ClassName CarFaultCacheService
|
||||
* @Description CarFaultCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarFaultCacheService extends CacheAbsBasic<String, FaultType> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "faultType:info:";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("faultType:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,11 +4,10 @@ import com.muyu.common.cache.config.CacheAbsBasic;
|
|||
import com.muyu.enterprise.domain.CarManage;
|
||||
|
||||
/**
|
||||
* 控制层
|
||||
* 业务实现层
|
||||
* @ClassName VehicleCacheService
|
||||
* @Description VehicleCacheService:类的描述
|
||||
* @Date 2024/9/30 11:42
|
||||
* redis报文业务层
|
||||
* @ClassName CarManageCacheService
|
||||
* @Description CarManageCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
|
@ -18,13 +17,12 @@ public class CarManageCacheService extends CacheAbsBasic<String, CarManage> {
|
|||
return "carManage:info:";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String encode(String key) {
|
||||
// return super.encode(key);
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carManage:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarManage;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
|
||||
/**
|
||||
* redis车辆管理业务层
|
||||
* @ClassName CarMessageCacheService
|
||||
* @Description CarMessageCacheService:类的描述
|
||||
* @Date 2024/9/30 11:42
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarMessageCacheService extends CacheAbsBasic<String, CarMessage> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carMessage:info:";
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String encode(String key) {
|
||||
// return super.encode(key);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carMessage:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.CarTemplate;
|
||||
|
||||
/**
|
||||
* redis报文模版业务层
|
||||
* @ClassName CarTemplateCacheService
|
||||
* @Description CarTemplateCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "carTemplate:info:";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("carTemplate:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.muyu.enterprise.cache;
|
||||
|
||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||
import com.muyu.enterprise.domain.CarCompany;
|
||||
import com.muyu.enterprise.domain.WarnRule;
|
||||
|
||||
/**
|
||||
* redis车辆预警业务层
|
||||
* @ClassName CarWarnCacheService
|
||||
* @Description CarWarnCacheService:类的描述
|
||||
* @Date 2024/10/3 15:22
|
||||
* @author MingWei.Zong
|
||||
*/
|
||||
|
||||
public class CarWarnCacheService extends CacheAbsBasic<String, WarnRule> {
|
||||
@Override
|
||||
public String keyPre() {
|
||||
return "warnRule:info:";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decode(String key) {
|
||||
return key.replace("warnRule:info:","");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ public class CarDTO {
|
|||
/**
|
||||
* 车辆配置
|
||||
*/
|
||||
private Integer configId;
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 在线状态 1.无信号 2.行驶中 3.已停止
|
||||
|
|
|
@ -47,7 +47,7 @@ public class CarManageController extends BaseController {
|
|||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("carListShow2")
|
||||
@PostMapping("/carListShow2")
|
||||
public Result<List<CarVO>> carListShow2(@RequestBody CarDTO carDTO){
|
||||
startPage();
|
||||
return Result.success(sysCarService.carListShow2(carDTO));
|
||||
|
@ -58,8 +58,8 @@ public class CarManageController extends BaseController {
|
|||
* @param carDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarListShow")
|
||||
public Result<List<CarVO>> CarListShow(@RequestBody CarDTO carDTO){
|
||||
@PostMapping("/carListShow")
|
||||
public Result<List<CarVO>> carListShow(@RequestBody CarDTO carDTO){
|
||||
return Result.success(sysCarService.CarListShow(carDTO));
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ public class CarManageController extends BaseController {
|
|||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("CarManageShowByCarId")
|
||||
public Result CarManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
@PostMapping("carManageShowByCarId")
|
||||
public Result carManageShowByCarId(@RequestParam("carId") Long carId){
|
||||
return Result.success(sysCarService.getById(carId));
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class CarManageController extends BaseController {
|
|||
carVO.setCarVin(key2);
|
||||
sysCarService.save(carVO);
|
||||
// 存到缓存中去
|
||||
carManageCacheService.put(carVO.getCarVin(),new CarManage());
|
||||
carManageCacheService.putManage(carVO.getCarVin(),new CarManage());
|
||||
return Result.success("车辆添加成功");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.muyu.enterprise.controller;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||
import com.muyu.enterprise.cache.CarMessageCacheService;
|
||||
import com.muyu.enterprise.domain.CarMessage;
|
||||
import com.muyu.enterprise.service.CarMessageService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -26,6 +28,7 @@ import java.util.List;
|
|||
@Tag(name = "报文",description = "报文模块")
|
||||
public class CarMessageController extends BaseController {
|
||||
|
||||
private final CarMessageCacheService carMessageCacheService;
|
||||
private final CarMessageService sysCarMessageService;
|
||||
|
||||
/**
|
||||
|
@ -64,6 +67,8 @@ public class CarMessageController extends BaseController {
|
|||
@PostMapping("insertMessage")
|
||||
public Result insertMessage(@RequestBody CarMessage carMessage){
|
||||
sysCarMessageService.save(carMessage);
|
||||
//报文 redis
|
||||
carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
|
||||
return Result.success("添加成功");
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
|||
* @Date 2024/9/28 16:52
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("carMessageType")
|
||||
@RequestMapping("/carMessageType")
|
||||
/** 构造必备注解 只有用 final 修饰 才会被构造注入 */
|
||||
@RequiredArgsConstructor //制动构造注入 默认无参 Lombook包下
|
||||
@Tag(name = "报文类型" ,description = "报文类型")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.enterprise.cache.CarFaultCacheService;
|
||||
import com.muyu.enterprise.domain.FaultType;
|
||||
import com.muyu.enterprise.service.FaultTypeService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -19,6 +20,8 @@ import java.util.List;
|
|||
@RequestMapping("/type")
|
||||
@Tag(name = "故障类型",description = "对故障类型的定义")
|
||||
public class FaultTypeController {
|
||||
@Autowired
|
||||
private CarFaultCacheService carFaultCacheService;
|
||||
@Autowired
|
||||
private FaultTypeService faultTypeService;
|
||||
|
||||
|
|
|
@ -54,9 +54,8 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
|||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getConfigId() > 0, CarManage::getConfigId, carManage.getConfigId())
|
||||
.eq(carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
.list();
|
||||
// List<CarManage> list = list();
|
||||
|
||||
|
@ -90,11 +89,11 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
|||
.eq(carManage.getCarVin() != null && carManage.getCarVin() != "", CarManage::getCarVin, carManage.getCarVin())
|
||||
.eq(carManage.getCarModel() != null && carManage.getCarModel() != "", CarManage::getCarModel, carManage.getCarModel())
|
||||
.eq(carManage.getCarBrand() != null && carManage.getCarBrand() != "", CarManage::getCarBrand, carManage.getCarBrand())
|
||||
.eq(carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getConfigId() > 0, CarManage::getConfigId, carManage.getConfigId())
|
||||
.eq(carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
.eq(carManage.getCarStatus() != null && carManage.getCarStatus() > 0, CarManage::getCarStatus, carManage.getCarStatus())
|
||||
.eq(carManage.getCompanyId() != null && carManage.getCompanyId() > 0, CarManage::getCompanyId, carManage.getCompanyId())
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
Loading…
Reference in New Issue