From 4ca2fd7e7e08da7a65231cc20e151fc2f60e776b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E9=86=BA?= <14463847+zmw770157181@user.noreply.gitee.com> Date: Thu, 10 Oct 2024 11:22:59 +0800 Subject: [PATCH] =?UTF-8?q?1.feat():=20=E6=B7=BB=E5=8A=A0:=20a.=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E8=87=AA=E5=AE=9A=E4=B9=89=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A2=84=E8=AD=A6=E7=B1=BB=20b.=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E8=BF=9C=E8=B0=83=E7=9A=84=E4=BB=A3=E7=A0=81,?= =?UTF-8?q?=E8=BF=9E=E5=90=8C=E7=86=94=E6=96=AD=202.fix():=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86:=20a.=E4=BF=AE=E6=94=B9=E4=BA=86redis?= =?UTF-8?q?=E5=9C=A8=E5=88=97=E8=A1=A8=E9=80=9A=E8=BF=87vin=E7=A0=81?= =?UTF-8?q?=E5=AD=98=E5=82=A8=20b.=E4=BF=AE=E6=94=B9=E4=BA=86redis?= =?UTF-8?q?=E7=9A=84=E5=AD=98=E5=82=A8=E7=B1=BB=E5=9E=8B=20c.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E4=B8=80=E4=BA=9B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新时间10081949 --- .../common/cache/config/PrimaryKeyBasic.java | 9 ++- .../cache/CarCompanyCacheService.java | 29 --------- .../cache/CarFaultCacheService.java | 9 ++- .../cache/CarManageCacheService.java | 13 ++-- .../cache/CarMessageCacheService.java | 30 --------- .../cache/CarTemplateCacheService.java | 11 +++- .../enterprise/cache/CarWarnCacheService.java | 9 ++- .../cache/ElectronicFenceCacheService.java | 8 ++- ...ot.autoconfigure.AutoConfiguration.imports | 4 +- .../com/muyu/enterprise/domain/CarType.java | 4 +- .../enterprise/domain/vo/CarTemplateVO.java | 61 +++++++++++++++++++ .../CloudEnterpriseApplication.java | 20 ------ .../controller/CarManageController.java | 9 +-- .../controller/CarMessageController.java | 6 +- .../controller/CarTypeController.java | 12 +++- .../muyu/enterprise/mapper/CarTypeMapper.java | 2 +- .../enterprise/service/CarTypeService.java | 8 ++- .../service/impl/CarManageServiceImpl.java | 7 ++- .../service/impl/CarTemplateServiceImpl.java | 24 +++++++- .../service/impl/CarTypeTypeServiceImpl.java | 15 ++++- .../service/impl/SysCarFaultServiceImpl.java | 7 ++- .../service/impl/WarnStrategyServiceImpl.java | 2 - .../resources/mapper/warn/CarTypeMapper.xml | 4 +- .../process/consumer/GoOnlineConsumer.java | 6 +- 24 files changed, 179 insertions(+), 130 deletions(-) delete mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarCompanyCacheService.java delete mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarMessageCacheService.java create mode 100644 cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/vo/CarTemplateVO.java diff --git a/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java index 895cd76..49f9143 100644 --- a/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java +++ b/cloud-common/cloud-common-cache/src/main/java/com/muyu/common/cache/config/PrimaryKeyBasic.java @@ -1,5 +1,7 @@ package com.muyu.common.cache.config; +import com.muyu.common.core.text.StrFormatter; + /** * 主键基础 * @ClassName PrimaryKeyBasic @@ -13,13 +15,18 @@ public interface PrimaryKeyBasic { */ public String keyPre(); + /** + * key 后缀 + */ + public String keyPost(); + /** * 编码 * @param key 缓存键 * @return 装修键 */ public default String encode(K key){ - return keyPre() + key.toString(); + return StrFormatter.format("{}:vin{}:{}", keyPre(), key.toString(), keyPost()); } /** diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarCompanyCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarCompanyCacheService.java deleted file mode 100644 index 90de672..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarCompanyCacheService.java +++ /dev/null @@ -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 { - @Override - public String keyPre() { - return "CarCompany:info:"; - } - - - - @Override - public String decode(String key) { - return key.replace("CarCompany:info:",""); - } - - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarFaultCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarFaultCacheService.java index 9c65e34..862463f 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarFaultCacheService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarFaultCacheService.java @@ -16,13 +16,18 @@ import com.muyu.enterprise.domain.SysCarFault; public class CarFaultCacheService extends CacheAbsBasic { @Override public String keyPre() { - return "sysCarFault:info:"; + return "vehicleDeterminationStandard"; + } + + @Override + public String keyPost() { + return "fault"; } @Override public String decode(String key) { - return key.replace("faultType:info:",""); + return ""; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java index 9ffad3c..37a8b6f 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarManageCacheService.java @@ -1,30 +1,33 @@ package com.muyu.enterprise.cache; import com.muyu.common.cache.config.CacheAbsBasic; -import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.vo.CarVO; import java.util.List; /** - * redis报文业务层 + * redis车辆业务层 * @ClassName CarManageCacheService * @Description CarManageCacheService:类的描述 * @Date 2024/10/3 15:22 * @author MingWei.Zong(微醺) */ -public class CarManageCacheService extends CacheAbsBasic> { +public class CarManageCacheService extends CacheAbsBasic> { @Override public String keyPre() { - return "carManage:info:"; + return "vehicleDeterminationStandard"; } + @Override + public String keyPost() { + return "carManage"; + } @Override public String decode(String key) { - return key.replace("carManage:info:",""); + return ""; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarMessageCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarMessageCacheService.java deleted file mode 100644 index 4ca55ab..0000000 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarMessageCacheService.java +++ /dev/null @@ -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 { - @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:",""); - } - - -} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarTemplateCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarTemplateCacheService.java index 07b4099..9ffdb6a 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarTemplateCacheService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarTemplateCacheService.java @@ -3,6 +3,7 @@ package com.muyu.enterprise.cache; import com.muyu.common.cache.config.CacheAbsBasic; import com.muyu.enterprise.domain.CarCompany; import com.muyu.enterprise.domain.CarTemplate; +import com.muyu.enterprise.domain.vo.CarTemplateVO; /** * redis报文模版业务层 @@ -12,17 +13,21 @@ import com.muyu.enterprise.domain.CarTemplate; * @author MingWei.Zong(微醺) */ -public class CarTemplateCacheService extends CacheAbsBasic { +public class CarTemplateCacheService extends CacheAbsBasic { @Override public String keyPre() { - return "carTemplate:info:"; + return "vehicleDeterminationStandard"; } + @Override + public String keyPost() { + return "messageTemplate"; + } @Override public String decode(String key) { - return key.replace("carTemplate:info:",""); + return ""; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarWarnCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarWarnCacheService.java index 9fbb308..e8f4826 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarWarnCacheService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/CarWarnCacheService.java @@ -15,13 +15,18 @@ import com.muyu.enterprise.domain.vo.WarnVo; public class CarWarnCacheService extends CacheAbsBasic { @Override public String keyPre() { - return "warnStrategy:info:"; + return "vehicleDeterminationStandard"; + } + + @Override + public String keyPost() { + return "warn"; } @Override public String decode(String key) { - return key.replace("warnStrategy:info:",""); + return ""; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/ElectronicFenceCacheService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/ElectronicFenceCacheService.java index 576d4c4..3d895aa 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/ElectronicFenceCacheService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/java/com/muyu/enterprise/cache/ElectronicFenceCacheService.java @@ -15,14 +15,18 @@ import com.muyu.enterprise.domain.dateBase.ElectronicFence; public class ElectronicFenceCacheService extends CacheAbsBasic { @Override public String keyPre() { - return "electronicFence:info:"; + return "vehicleDeterminationStandard"; } + @Override + public String keyPost() { + return "electronicFence"; + } @Override public String decode(String key) { - return key.replace("electronicFence:info:",""); + return ""; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 7c16588..3987169 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,7 +1,5 @@ -com.muyu.enterprise.cache.CarCompanyCacheService com.muyu.enterprise.cache.CarFaultCacheService -com.muyu.enterprise.cache.CarManageCacheService -com.muyu.enterprise.cache.CarMessageCacheService com.muyu.enterprise.cache.CarTemplateCacheService com.muyu.enterprise.cache.CarWarnCacheService com.muyu.enterprise.cache.ElectronicFenceCacheService +com.muyu.enterprise.cache.CarManageCacheService diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/CarType.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/CarType.java index 45d4678..29d9dbe 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/CarType.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/CarType.java @@ -28,7 +28,7 @@ public class CarType { * 车辆类型id */ @TableId(value = "car_type_id",type = IdType.AUTO) - private Integer carTypeId; + private long carTypeId; /** * 车辆类型名称 @@ -38,7 +38,7 @@ public class CarType { /** * 模板id */ - private Integer templateId; + private long templateId; } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/vo/CarTemplateVO.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/vo/CarTemplateVO.java new file mode 100644 index 0000000..6853cbf --- /dev/null +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-common/src/main/java/com/muyu/enterprise/domain/vo/CarTemplateVO.java @@ -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; +} diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java index 63d94e6..b0aaafa 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/CloudEnterpriseApplication.java @@ -18,26 +18,6 @@ import org.springframework.web.client.RestTemplate; public class CloudEnterpriseApplication { public static void main (String[] 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 //"); } //实现远程调用 diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java index 38120ba..2953282 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarManageController.java @@ -1,23 +1,17 @@ package com.muyu.enterprise.controller; -import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.RandomUtil; -import com.muyu.common.core.utils.StringUtils; import com.muyu.enterprise.cache.CarManageCacheService; import com.muyu.enterprise.domain.CarManage; -import com.muyu.enterprise.domain.CarMessage; import com.muyu.enterprise.domain.dto.CarDTO; import com.muyu.enterprise.domain.vo.CarVO; import com.muyu.enterprise.service.CarCompanyService; import com.muyu.enterprise.service.CarManageService; import com.muyu.common.core.domain.Result; import com.muyu.common.core.web.controller.BaseController; -import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.utils.SecurityUtils; -import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -100,7 +94,8 @@ public class CarManageController extends BaseController { // 随机生成VIN码 String key2 = RandomUtil.randomNumbers(17); carVO.setCarVin(key2); - carManageService.insertCar(carVO); +// carVO +// carManageService.insertCar(); return Result.success("添加成功"); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java index 3c9905a..aeb8882 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarMessageController.java @@ -3,8 +3,6 @@ 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; @@ -28,7 +26,7 @@ import java.util.List; @Tag(name = "报文",description = "报文模块") public class CarMessageController extends BaseController { - private final CarMessageCacheService carMessageCacheService; +// private final CarMessageCacheService carMessageCacheService; private final CarMessageService sysCarMessageService; @Autowired private CarMessageService carMessageService; @@ -70,7 +68,7 @@ public class CarMessageController extends BaseController { public Result insertMessage(@RequestBody CarMessage carMessage){ sysCarMessageService.save(carMessage); //报文 redis - carMessageCacheService.put(carMessage.getMessageType(),new CarMessage()); +// carMessageCacheService.put(carMessage.getMessageType(),new CarMessage()); return Result.success("添加成功"); } /** diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java index aaf5004..8702bc4 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/CarTypeController.java @@ -45,10 +45,20 @@ public class CarTypeController { * @return */ @PostMapping("/catTypeId") - private Result catTypeId(@RequestParam("catTypeId") Integer catTypeId) { + private Result catTypeId(@RequestParam("catTypeId") Long catTypeId) { CarType carType = carTypeService.findById(catTypeId); return Result.success(carType); } + /** + * 通过报文模版id查询车辆类型表 + * @param templateId + * @return + */ + @PostMapping("/selectCarTemplateByTemplateId") + private Result selectCarTemplateByTemplateId(@RequestParam("templateId") Long templateId) { + CarType carType = carTypeService.SelectCarTemplateByTemplateId(templateId); + return Result.success(carType); + } } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/CarTypeMapper.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/CarTypeMapper.java index fb24474..09b9be9 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/CarTypeMapper.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/mapper/CarTypeMapper.java @@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Param; */ @Mapper public interface CarTypeMapper extends BaseMapper { - CarType findById(@Param("catTypeId") Integer catTypeId); + } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/CarTypeService.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/CarTypeService.java index 2140dc4..8859e91 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/CarTypeService.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/CarTypeService.java @@ -10,6 +10,12 @@ import com.muyu.enterprise.domain.CarType; * @Date 2024/9/28 16:52 */ public interface CarTypeService extends IService { - CarType findById(Integer catTypeId); + CarType findById(long catTypeId); + /** + * 通过报文模版id查询车辆类型表 + * @param templateId + * @return + */ + CarType SelectCarTemplateByTemplateId(Long templateId); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarManageServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarManageServiceImpl.java index 2d84cf6..44ba31b 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarManageServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarManageServiceImpl.java @@ -74,7 +74,7 @@ public class CarManageServiceImpl extends ServiceImpl carVOS = new ArrayList<>(); - carVOS.add(carVO); + CarVO carVO1 = BeanUtil.copyProperties(carVO, CarVO.class); + List carVOS = new ArrayList<>(); + carVOS.add(carVO1); save(carVO); // 存到缓存中去 carManageCacheService.put(carVO.getCarVin(),carVOS); diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarTemplateServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarTemplateServiceImpl.java index c80931d..e48a8d4 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarTemplateServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/CarTemplateServiceImpl.java @@ -1,9 +1,16 @@ package com.muyu.enterprise.service.impl; 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.CarType; +import com.muyu.enterprise.mapper.CarManageMapper; import com.muyu.enterprise.mapper.CarTemplateMapper; +import com.muyu.enterprise.service.CarManageService; 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.stereotype.Service; @@ -16,8 +23,15 @@ import java.util.List; * @Date 2024/9/28 16:52 */ @Service +@Log4j2 public class CarTemplateServiceImpl extends ServiceImpl implements CarTemplateService { + @Autowired + private CarTemplateCacheService carTemplateCacheService; + @Autowired + private CarManageService carManageService; + @Autowired + private CarTypeService carTypeService; @Autowired private CarTemplateMapper sysCarTemplateMapper; /** @@ -36,6 +50,14 @@ public class CarTemplateServiceImpl extends ServiceImpl implements SysCarFaultService { + @Autowired + private CarFaultCacheService carFaultCacheService; + /** * 精确查询车辆故障 * @@ -58,7 +63,7 @@ public class SysCarFaultServiceImpl queryWrapper.eq(StringUtils.isNotEmpty(sysCarFault.getFaultWarn()), SysCarFault::getFaultWarn, sysCarFault.getFaultWarn()); - +// carFaultCacheService.put(); return this.list(queryWrapper); } diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/WarnStrategyServiceImpl.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/WarnStrategyServiceImpl.java index 0482168..0bc471d 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/WarnStrategyServiceImpl.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/service/impl/WarnStrategyServiceImpl.java @@ -1,10 +1,8 @@ package com.muyu.enterprise.service.impl; -import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.common.core.utils.StringUtils; -import com.muyu.enterprise.cache.CarManageCacheService; import com.muyu.enterprise.cache.CarWarnCacheService; import com.muyu.enterprise.domain.CarManage; import com.muyu.enterprise.domain.WarnRule; diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml index 2e4a8ea..f59991f 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml @@ -3,7 +3,5 @@ - + diff --git a/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOnlineConsumer.java b/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOnlineConsumer.java index ff0e571..7af69de 100644 --- a/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOnlineConsumer.java +++ b/cloud-modules/cloud-modules-event-process/src/main/java/com/muyu/event/process/consumer/GoOnlineConsumer.java @@ -1,7 +1,6 @@ package com.muyu.event.process.consumer; import com.muyu.enterprise.cache.CarFaultCacheService; -import com.muyu.enterprise.cache.CarManageCacheService; import com.muyu.enterprise.cache.CarWarnCacheService; import com.muyu.enterprise.cache.ElectronicFenceCacheService; 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.QueueBinding; import org.springframework.amqp.rabbit.annotation.RabbitListener; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; 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) { log.info("车辆vin码:{},该车辆已上线", vin); cacheUtil.put(vin, new HashMap() {{ - 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.ELECTRONIC_FENCE_KEY, electronicFenceCacheService.get(vin)); put(CacheHandlerConstants.WARN_RULE_KEY, carWarnCacheService.get(vin));