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