1.feat(): 添加:
a.添加了自定义的一个预警类 b.添加了远调的代码,连同熔断 2.fix(): 修复了: a.修改了redis在列表通过vin码存储 b.修改了redis的存储类型 c.优化了一些代码 更新时间10081949dev.entBusiness
parent
4f52c6c4ac
commit
4ca2fd7e7e
|
@ -1,5 +1,7 @@
|
||||||
package com.muyu.common.cache.config;
|
package com.muyu.common.cache.config;
|
||||||
|
|
||||||
|
import com.muyu.common.core.text.StrFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键基础
|
* 主键基础
|
||||||
* @ClassName PrimaryKeyBasic
|
* @ClassName PrimaryKeyBasic
|
||||||
|
@ -13,13 +15,18 @@ public interface PrimaryKeyBasic <K>{
|
||||||
*/
|
*/
|
||||||
public String keyPre();
|
public String keyPre();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* key 后缀
|
||||||
|
*/
|
||||||
|
public String keyPost();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码
|
* 编码
|
||||||
* @param key 缓存键
|
* @param key 缓存键
|
||||||
* @return 装修键
|
* @return 装修键
|
||||||
*/
|
*/
|
||||||
public default String encode(K key){
|
public default String encode(K key){
|
||||||
return keyPre() + key.toString();
|
return StrFormatter.format("{}:vin{}:{}", keyPre(), key.toString(), keyPost());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
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:","");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -16,13 +16,18 @@ import com.muyu.enterprise.domain.SysCarFault;
|
||||||
public class CarFaultCacheService extends CacheAbsBasic<String, SysCarFault> {
|
public class CarFaultCacheService extends CacheAbsBasic<String, SysCarFault> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "sysCarFault:info:";
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "fault";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("faultType:info:","");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,33 @@
|
||||||
package com.muyu.enterprise.cache;
|
package com.muyu.enterprise.cache;
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis报文业务层
|
* redis车辆业务层
|
||||||
* @ClassName CarManageCacheService
|
* @ClassName CarManageCacheService
|
||||||
* @Description CarManageCacheService:类的描述
|
* @Description CarManageCacheService:类的描述
|
||||||
* @Date 2024/10/3 15:22
|
* @Date 2024/10/3 15:22
|
||||||
* @author MingWei.Zong(微醺)
|
* @author MingWei.Zong(微醺)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CarManageCacheService extends CacheAbsBasic<String, List<CarManage>> {
|
public class CarManageCacheService extends CacheAbsBasic<String, List<CarVO>> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "carManage:info:";
|
return "vehicleDeterminationStandard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "carManage";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("carManage:info:","");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.muyu.enterprise.cache;
|
|
||||||
|
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
|
||||||
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:","");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.cache;
|
||||||
import com.muyu.common.cache.config.CacheAbsBasic;
|
import com.muyu.common.cache.config.CacheAbsBasic;
|
||||||
import com.muyu.enterprise.domain.CarCompany;
|
import com.muyu.enterprise.domain.CarCompany;
|
||||||
import com.muyu.enterprise.domain.CarTemplate;
|
import com.muyu.enterprise.domain.CarTemplate;
|
||||||
|
import com.muyu.enterprise.domain.vo.CarTemplateVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis报文模版业务层
|
* redis报文模版业务层
|
||||||
|
@ -12,17 +13,21 @@ import com.muyu.enterprise.domain.CarTemplate;
|
||||||
* @author MingWei.Zong(微醺)
|
* @author MingWei.Zong(微醺)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplate> {
|
public class CarTemplateCacheService extends CacheAbsBasic<String, CarTemplateVO> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "carTemplate:info:";
|
return "vehicleDeterminationStandard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "messageTemplate";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("carTemplate:info:","");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,18 @@ import com.muyu.enterprise.domain.vo.WarnVo;
|
||||||
public class CarWarnCacheService extends CacheAbsBasic<String, WarnVo> {
|
public class CarWarnCacheService extends CacheAbsBasic<String, WarnVo> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "warnStrategy:info:";
|
return "vehicleDeterminationStandard";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "warn";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("warnStrategy:info:","");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,14 +15,18 @@ import com.muyu.enterprise.domain.dateBase.ElectronicFence;
|
||||||
public class ElectronicFenceCacheService extends CacheAbsBasic<String, ElectronicFence> {
|
public class ElectronicFenceCacheService extends CacheAbsBasic<String, ElectronicFence> {
|
||||||
@Override
|
@Override
|
||||||
public String keyPre() {
|
public String keyPre() {
|
||||||
return "electronicFence:info:";
|
return "vehicleDeterminationStandard";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String keyPost() {
|
||||||
|
return "electronicFence";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String decode(String key) {
|
public String decode(String key) {
|
||||||
return key.replace("electronicFence:info:","");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
com.muyu.enterprise.cache.CarCompanyCacheService
|
|
||||||
com.muyu.enterprise.cache.CarFaultCacheService
|
com.muyu.enterprise.cache.CarFaultCacheService
|
||||||
com.muyu.enterprise.cache.CarManageCacheService
|
|
||||||
com.muyu.enterprise.cache.CarMessageCacheService
|
|
||||||
com.muyu.enterprise.cache.CarTemplateCacheService
|
com.muyu.enterprise.cache.CarTemplateCacheService
|
||||||
com.muyu.enterprise.cache.CarWarnCacheService
|
com.muyu.enterprise.cache.CarWarnCacheService
|
||||||
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
com.muyu.enterprise.cache.ElectronicFenceCacheService
|
||||||
|
com.muyu.enterprise.cache.CarManageCacheService
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class CarType {
|
||||||
* 车辆类型id
|
* 车辆类型id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "car_type_id",type = IdType.AUTO)
|
@TableId(value = "car_type_id",type = IdType.AUTO)
|
||||||
private Integer carTypeId;
|
private long carTypeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆类型名称
|
* 车辆类型名称
|
||||||
|
@ -38,7 +38,7 @@ public class CarType {
|
||||||
/**
|
/**
|
||||||
* 模板id
|
* 模板id
|
||||||
*/
|
*/
|
||||||
private Integer templateId;
|
private long templateId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.muyu.enterprise.domain.vo;
|
||||||
|
/**
|
||||||
|
* 控制层
|
||||||
|
* 业务实现层
|
||||||
|
* @ClassName CarTemplateVO
|
||||||
|
* @PATH com.muyu.enterprise.domain.vo:类的路径
|
||||||
|
* @Date 2024/10/9 20:42
|
||||||
|
* @author MingWei.Zong(微醺)
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName(value = "car_template",autoResultMap = true)
|
||||||
|
public class CarTemplateVO {
|
||||||
|
/**
|
||||||
|
* 报文模版表
|
||||||
|
*/
|
||||||
|
@TableId(value = "template_id",type = IdType.AUTO)
|
||||||
|
private Long templateId;
|
||||||
|
/**
|
||||||
|
* 报文模版名称
|
||||||
|
*/
|
||||||
|
private String templateName;
|
||||||
|
/**
|
||||||
|
* 报文模版描述
|
||||||
|
*/
|
||||||
|
private String templateDescribe;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报文表
|
||||||
|
*/
|
||||||
|
private Long messageId;
|
||||||
|
/**
|
||||||
|
* 车辆报文类别
|
||||||
|
*/
|
||||||
|
private String messageType;
|
||||||
|
/**
|
||||||
|
* 开始位下标
|
||||||
|
*/
|
||||||
|
private Integer messageStartIndex;
|
||||||
|
/**
|
||||||
|
* 结束位下标
|
||||||
|
*/
|
||||||
|
private Integer messageEndIndex;
|
||||||
|
/**
|
||||||
|
* 报文标签
|
||||||
|
*/
|
||||||
|
private String messageLabel;
|
||||||
|
}
|
|
@ -18,26 +18,6 @@ import org.springframework.web.client.RestTemplate;
|
||||||
public class CloudEnterpriseApplication {
|
public class CloudEnterpriseApplication {
|
||||||
public static void main (String[] args) {
|
public static void main (String[] args) {
|
||||||
SpringApplication.run(CloudEnterpriseApplication.class, args);
|
SpringApplication.run(CloudEnterpriseApplication.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 //");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//实现远程调用
|
//实现远程调用
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
package com.muyu.enterprise.controller;
|
package com.muyu.enterprise.controller;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
import com.muyu.enterprise.cache.CarManageCacheService;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.CarMessage;
|
|
||||||
import com.muyu.enterprise.domain.dto.CarDTO;
|
import com.muyu.enterprise.domain.dto.CarDTO;
|
||||||
import com.muyu.enterprise.domain.vo.CarVO;
|
import com.muyu.enterprise.domain.vo.CarVO;
|
||||||
import com.muyu.enterprise.service.CarCompanyService;
|
import com.muyu.enterprise.service.CarCompanyService;
|
||||||
import com.muyu.enterprise.service.CarManageService;
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
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.common.core.web.page.TableDataInfo;
|
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
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.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -100,7 +94,8 @@ public class CarManageController extends BaseController {
|
||||||
// 随机生成VIN码
|
// 随机生成VIN码
|
||||||
String key2 = RandomUtil.randomNumbers(17);
|
String key2 = RandomUtil.randomNumbers(17);
|
||||||
carVO.setCarVin(key2);
|
carVO.setCarVin(key2);
|
||||||
carManageService.insertCar(carVO);
|
// carVO
|
||||||
|
// carManageService.insertCar();
|
||||||
return Result.success("添加成功");
|
return Result.success("添加成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ 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;
|
||||||
|
@ -28,7 +26,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 CarMessageCacheService carMessageCacheService;
|
||||||
private final CarMessageService sysCarMessageService;
|
private final CarMessageService sysCarMessageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarMessageService carMessageService;
|
private CarMessageService carMessageService;
|
||||||
|
@ -70,7 +68,7 @@ public class CarMessageController extends BaseController {
|
||||||
public Result insertMessage(@RequestBody CarMessage carMessage){
|
public Result insertMessage(@RequestBody CarMessage carMessage){
|
||||||
sysCarMessageService.save(carMessage);
|
sysCarMessageService.save(carMessage);
|
||||||
//报文 redis
|
//报文 redis
|
||||||
carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
|
// carMessageCacheService.put(carMessage.getMessageType(),new CarMessage());
|
||||||
return Result.success("添加成功");
|
return Result.success("添加成功");
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,10 +45,20 @@ public class CarTypeController {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/catTypeId")
|
@PostMapping("/catTypeId")
|
||||||
private Result<CarType> catTypeId(@RequestParam("catTypeId") Integer catTypeId) {
|
private Result<CarType> catTypeId(@RequestParam("catTypeId") Long catTypeId) {
|
||||||
CarType carType = carTypeService.findById(catTypeId);
|
CarType carType = carTypeService.findById(catTypeId);
|
||||||
return Result.success(carType);
|
return Result.success(carType);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 通过报文模版id查询车辆类型表
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/selectCarTemplateByTemplateId")
|
||||||
|
private Result<CarType> selectCarTemplateByTemplateId(@RequestParam("templateId") Long templateId) {
|
||||||
|
CarType carType = carTypeService.SelectCarTemplateByTemplateId(templateId);
|
||||||
|
return Result.success(carType);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Param;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CarTypeMapper extends BaseMapper<CarType> {
|
public interface CarTypeMapper extends BaseMapper<CarType> {
|
||||||
CarType findById(@Param("catTypeId") Integer catTypeId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,12 @@ import com.muyu.enterprise.domain.CarType;
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
public interface CarTypeService extends IService<CarType> {
|
public interface CarTypeService extends IService<CarType> {
|
||||||
CarType findById(Integer catTypeId);
|
CarType findById(long catTypeId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过报文模版id查询车辆类型表
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CarType SelectCarTemplateByTemplateId(Long templateId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
|
SysEnt data = remoteEntService.getById(carVO.getEnterpriseId()).getData();
|
||||||
carVO.setName(data.getName());
|
carVO.setName(data.getName());
|
||||||
// 存到 redis
|
// 存到 redis
|
||||||
carManageCacheService.put(carVO.getCarVin(),list);
|
carManageCacheService.put(carVO.getCarVin(),carVOS);
|
||||||
});
|
});
|
||||||
return carVOS;
|
return carVOS;
|
||||||
}
|
}
|
||||||
|
@ -102,8 +102,9 @@ public class CarManageServiceImpl extends ServiceImpl<CarManageMapper, CarManage
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertCar(CarManage carVO) {
|
public void insertCar(CarManage carVO) {
|
||||||
ArrayList<CarManage> carVOS = new ArrayList<>();
|
CarVO carVO1 = BeanUtil.copyProperties(carVO, CarVO.class);
|
||||||
carVOS.add(carVO);
|
List<CarVO> carVOS = new ArrayList<>();
|
||||||
|
carVOS.add(carVO1);
|
||||||
save(carVO);
|
save(carVO);
|
||||||
// 存到缓存中去
|
// 存到缓存中去
|
||||||
carManageCacheService.put(carVO.getCarVin(),carVOS);
|
carManageCacheService.put(carVO.getCarVin(),carVOS);
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.enterprise.cache.CarTemplateCacheService;
|
||||||
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.CarTemplate;
|
import com.muyu.enterprise.domain.CarTemplate;
|
||||||
|
import com.muyu.enterprise.domain.CarType;
|
||||||
|
import com.muyu.enterprise.mapper.CarManageMapper;
|
||||||
import com.muyu.enterprise.mapper.CarTemplateMapper;
|
import com.muyu.enterprise.mapper.CarTemplateMapper;
|
||||||
|
import com.muyu.enterprise.service.CarManageService;
|
||||||
import com.muyu.enterprise.service.CarTemplateService;
|
import com.muyu.enterprise.service.CarTemplateService;
|
||||||
|
import com.muyu.enterprise.service.CarTypeService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@ -16,8 +23,15 @@ import java.util.List;
|
||||||
* @Date 2024/9/28 16:52
|
* @Date 2024/9/28 16:52
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Log4j2
|
||||||
public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTemplate> implements CarTemplateService {
|
public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTemplate> implements CarTemplateService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarTemplateCacheService carTemplateCacheService;
|
||||||
|
@Autowired
|
||||||
|
private CarManageService carManageService;
|
||||||
|
@Autowired
|
||||||
|
private CarTypeService carTypeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarTemplateMapper sysCarTemplateMapper;
|
private CarTemplateMapper sysCarTemplateMapper;
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +50,14 @@ public class CarTemplateServiceImpl extends ServiceImpl<CarTemplateMapper, CarTe
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CarTemplate selectTemplateByTemplateId(Long templateId) {
|
public CarTemplate selectTemplateByTemplateId(Long templateId) {
|
||||||
return sysCarTemplateMapper.selectById(templateId);
|
// 通过id查询报文信息
|
||||||
|
CarTemplate carTemplate = sysCarTemplateMapper.selectById(templateId);
|
||||||
|
// 获取到车辆的 vin 用于存储 redis 1.通过报文模版id 获取车辆类型 id
|
||||||
|
CarType carType = carTypeService.SelectCarTemplateByTemplateId(templateId);
|
||||||
|
// 通过 车辆类型ID 获取 车辆信息
|
||||||
|
CarManage carManage = carManageService.carManageShowByCarTypeId(carType.getCarTypeId());
|
||||||
|
// 将报文信息存储到 redis
|
||||||
|
carTemplateCacheService.put(carManage.getCarVin(),carTemplate);
|
||||||
|
return carTemplate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,17 @@ public class CarTypeTypeServiceImpl
|
||||||
private CarTypeMapper carTypeMapper;
|
private CarTypeMapper carTypeMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CarType findById(Integer catTypeId) {
|
public CarType findById(long catTypeId) {
|
||||||
CarType carType= carTypeMapper.findById(catTypeId);
|
return getById(catTypeId);
|
||||||
return carType;
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 通过报文模版id查询车辆类型表
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CarType SelectCarTemplateByTemplateId(Long templateId) {
|
||||||
|
return getById(templateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,10 @@ package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.enterprise.cache.CarFaultCacheService;
|
||||||
import com.muyu.enterprise.domain.SysCarFault;
|
import com.muyu.enterprise.domain.SysCarFault;
|
||||||
import com.muyu.enterprise.service.SysCarFaultService;
|
import com.muyu.enterprise.service.SysCarFaultService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.muyu.enterprise.mapper.SysCarFaultMapper;
|
import com.muyu.enterprise.mapper.SysCarFaultMapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
@ -23,6 +25,9 @@ public class SysCarFaultServiceImpl
|
||||||
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
extends ServiceImpl<SysCarFaultMapper, SysCarFault>
|
||||||
implements SysCarFaultService {
|
implements SysCarFaultService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CarFaultCacheService carFaultCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精确查询车辆故障
|
* 精确查询车辆故障
|
||||||
*
|
*
|
||||||
|
@ -58,7 +63,7 @@ public class SysCarFaultServiceImpl
|
||||||
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()),
|
||||||
SysCarFault::getFaultWarn, sysCarFault.getFaultWarn());
|
SysCarFault::getFaultWarn, sysCarFault.getFaultWarn());
|
||||||
|
|
||||||
|
// carFaultCacheService.put();
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package com.muyu.enterprise.service.impl;
|
package com.muyu.enterprise.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
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.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
|
||||||
import com.muyu.enterprise.cache.CarWarnCacheService;
|
import com.muyu.enterprise.cache.CarWarnCacheService;
|
||||||
import com.muyu.enterprise.domain.CarManage;
|
import com.muyu.enterprise.domain.CarManage;
|
||||||
import com.muyu.enterprise.domain.WarnRule;
|
import com.muyu.enterprise.domain.WarnRule;
|
||||||
|
|
|
@ -3,7 +3,5 @@
|
||||||
|
|
||||||
<mapper namespace="com.muyu.enterprise.mapper.CarTypeMapper">
|
<mapper namespace="com.muyu.enterprise.mapper.CarTypeMapper">
|
||||||
|
|
||||||
<select id="findById" resultType="com.muyu.enterprise.domain.CarType">
|
|
||||||
select * from t_car_type where t_car_type.car_type_id = #{catTypeId}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.muyu.event.process.consumer;
|
package com.muyu.event.process.consumer;
|
||||||
|
|
||||||
import com.muyu.enterprise.cache.CarFaultCacheService;
|
import com.muyu.enterprise.cache.CarFaultCacheService;
|
||||||
import com.muyu.enterprise.cache.CarManageCacheService;
|
|
||||||
import com.muyu.enterprise.cache.CarWarnCacheService;
|
import com.muyu.enterprise.cache.CarWarnCacheService;
|
||||||
import com.muyu.enterprise.cache.ElectronicFenceCacheService;
|
import com.muyu.enterprise.cache.ElectronicFenceCacheService;
|
||||||
import com.muyu.event.process.constant.CacheHandlerConstants;
|
import com.muyu.event.process.constant.CacheHandlerConstants;
|
||||||
|
@ -13,7 +12,6 @@ import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -35,7 +33,7 @@ public class GoOnlineConsumer {
|
||||||
/**
|
/**
|
||||||
* 车辆管理缓存服务
|
* 车辆管理缓存服务
|
||||||
*/
|
*/
|
||||||
private final CarManageCacheService carManageCacheService;
|
// private final CarManageCacheService carManageCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆故障缓存服务
|
* 车辆故障缓存服务
|
||||||
|
@ -66,7 +64,7 @@ public class GoOnlineConsumer {
|
||||||
public void online(String vin) {
|
public void online(String vin) {
|
||||||
log.info("车辆vin码:{},该车辆已上线", vin);
|
log.info("车辆vin码:{},该车辆已上线", vin);
|
||||||
cacheUtil.put(vin, new HashMap<String, Object>() {{
|
cacheUtil.put(vin, new HashMap<String, Object>() {{
|
||||||
put(CacheHandlerConstants.CAR_MANAGE_KEY, carManageCacheService.get(vin));
|
// put(CacheHandlerConstants.CAR_MANAGE_KEY, carManageCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.FAULT_RULE_KEY, carFaultCacheService.get(vin));
|
put(CacheHandlerConstants.FAULT_RULE_KEY, carFaultCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.ELECTRONIC_FENCE_KEY, electronicFenceCacheService.get(vin));
|
put(CacheHandlerConstants.ELECTRONIC_FENCE_KEY, electronicFenceCacheService.get(vin));
|
||||||
put(CacheHandlerConstants.WARN_RULE_KEY, carWarnCacheService.get(vin));
|
put(CacheHandlerConstants.WARN_RULE_KEY, carWarnCacheService.get(vin));
|
||||||
|
|
Loading…
Reference in New Issue