From 833e554722e9c2f286fdcbaa5339bfc36bda6102 Mon Sep 17 00:00:00 2001 From: yuan <1363654894@qq.com> Date: Mon, 23 Sep 2024 10:59:43 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E8=BF=9E=E6=8E=A5=E8=BD=A6=E8=BE=86?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8E=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++ cloud-common/pom.xml | 1 + .../warn/controller/WarnRuleController.java | 16 +++++- .../controller/WarnStrategyController.java | 9 +++- .../com/muyu/warn/domain/car/CarMessage.java | 48 +++++++++++++++++ .../muyu/warn/domain/car/CarMessageType.java | 36 +++++++++++++ .../com/muyu/warn/domain/car/CartType.java | 32 +++++++++++ .../warn/domain/car/resp/CarMessageResp.java | 54 +++++++++++++++++++ .../com/muyu/warn/mapper/WarnRuleMapper.java | 6 +++ .../muyu/warn/mapper/WarnStrategyMapper.java | 4 ++ .../muyu/warn/service/WarnRuleService.java | 8 +++ .../warn/service/WarnStrategyService.java | 2 + .../service/impl/WarnRuleServiceImpl.java | 10 ++++ .../service/impl/WarnStrategyServiceImpl.java | 9 ++++ .../resources/mapper/warn/WarnRuleMapper.xml | 22 ++++++++ .../mapper/warn/WarnStrategyMapper.xml | 14 +++++ cloud-modules/pom.xml | 1 + 17 files changed, 273 insertions(+), 2 deletions(-) create mode 100644 cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessage.java create mode 100644 cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessageType.java create mode 100644 cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CartType.java create mode 100644 cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/resp/CarMessageResp.java create mode 100644 cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnRuleMapper.xml create mode 100644 cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnStrategyMapper.xml diff --git a/.gitignore b/.gitignore index 9405b2d..9534fd1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ out ###################################################################### # IDE + + ### STS ### .apt_generated .classpath @@ -26,6 +28,7 @@ logs *.iws *.iml *.ipr +*.yml ### JRebel ### rebel.xml diff --git a/cloud-common/pom.xml b/cloud-common/pom.xml index a7a40be..79c42b6 100644 --- a/cloud-common/pom.xml +++ b/cloud-common/pom.xml @@ -21,6 +21,7 @@ cloud-common-xxl cloud-common-rabbit cloud-common-saas + cloud-common-wechat cloud-common diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnRuleController.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnRuleController.java index 844b28d..061b7d0 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnRuleController.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnRuleController.java @@ -5,8 +5,9 @@ import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.annotation.RequiresPermissions; -import com.muyu.common.security.utils.SecurityUtils; import com.muyu.warn.domain.WarnRule; +import com.muyu.warn.domain.car.CarMessageType; +import com.muyu.warn.domain.car.resp.CarMessageResp; import com.muyu.warn.service.WarnRuleService; import jakarta.servlet.http.HttpServletResponse; import org.springframework.validation.annotation.Validated; @@ -103,4 +104,17 @@ public class WarnRuleController extends BaseController warnRuleService.removeBatchByIds(Arrays.asList(ids)); return success(); } + + /** + * 获取车辆类型报文 + */ + @RequiresPermissions("platform:rule:msg") + @GetMapping("/msg/{id}") + public Result> findByMsg(@PathVariable("id") Long id) + { + return success(warnRuleService.findByMsg(id)); + } + + + } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnStrategyController.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnStrategyController.java index 9515767..06374a3 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnStrategyController.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/controller/WarnStrategyController.java @@ -5,7 +5,7 @@ import com.muyu.common.core.utils.poi.ExcelUtil; import com.muyu.common.core.web.controller.BaseController; import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.annotation.RequiresPermissions; -import com.muyu.common.security.utils.SecurityUtils; +import com.muyu.warn.domain.car.CartType; import com.muyu.warn.domain.WarnStrategy; import com.muyu.warn.service.WarnStrategyService; import jakarta.servlet.http.HttpServletResponse; @@ -103,4 +103,11 @@ public class WarnStrategyController extends BaseController warnStrategyService.removeBatchByIds(Arrays.asList(ids)); return success(); } + + @RequiresPermissions("platform:strategy:cartype") + @PostMapping("/findByCarType") + public Result> findByCarType(){ + return Result.success(warnStrategyService.findByCarType()); + } + } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessage.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessage.java new file mode 100644 index 0000000..37e2e0d --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessage.java @@ -0,0 +1,48 @@ +package com.muyu.warn.domain.car; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:蓬叁 + * @Package:com.muyu.warn.domain.car + * @Project:cloud-server-8 + * @name:CarMessageType + * @Date:2024/9/22 下午3:08 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CarMessage { + + /** + * 自增主键 + */ + private Integer carMessageId ; + /** + * 车辆类型外键 + */ + private Integer carMessageCarype ; + /** + * 车辆报文外键 + */ + private Integer carMessageType ; + /** + * 开始位下标 + */ + private Integer carMessageStartIndex ; + /** + * 结束位下标 + */ + private Integer carMessageEndIndex ; + /** + * 报文数据类型 (固定值 区间随机值) + */ + private String messageTypeClass ; + /** + * 报文是否开启故障检测(0默认未开启 1开启) + */ + private Integer carMessageState ; + +} diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessageType.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessageType.java new file mode 100644 index 0000000..be27361 --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CarMessageType.java @@ -0,0 +1,36 @@ +package com.muyu.warn.domain.car; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:蓬叁 + * @Package:com.muyu.warn.domain.car + * @Project:cloud-server-8 + * @name:CarMessage + * @Date:2024/9/22 下午3:07 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CarMessageType { + + /** + * 自增主键 + */ + private Integer messageTypeId ; + /** + * 报文编码 + */ + private String messageTypeCode ; + /** + * 报文名称 + */ + private String messageTypeName ; + /** + * 报文所属类别 + */ + private String messageTypeBelongs ; + +} diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CartType.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CartType.java new file mode 100644 index 0000000..c1dd738 --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/CartType.java @@ -0,0 +1,32 @@ +package com.muyu.warn.domain.car; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:蓬叁 + * @Package:com.muyu.warn.domain + * @Project:cloud-server-8 + * @name:CartType + * @Date:2024/9/21 下午7:38 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CartType { + + /** + * 车辆类型ID + */ + private String carTypeId ; + /** + * 车辆类型名 + */ + private String carTypeName ; + /** + * 车辆规则外键ID + */ + private String carTypeRules ; + +} diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/resp/CarMessageResp.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/resp/CarMessageResp.java new file mode 100644 index 0000000..3699372 --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/domain/car/resp/CarMessageResp.java @@ -0,0 +1,54 @@ +package com.muyu.warn.domain.car.resp; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author:蓬叁 + * @Package:com.muyu.warn.domain.car + * @Project:cloud-server-8 + * @name:resp + * @Date:2024/9/22 下午7:12 + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class CarMessageResp { + + /** + * 自增主键 + */ + private Integer carMessageId ; + /** + * 车辆类型外键 + */ + private Integer carMessageCartype ; + /** + * 车辆报文外键 + */ + private Integer carMessageType ; + /** + * 报文名称 + */ + private String messageTypeName ; + /** + * 开始位下标 + */ + private Integer carMessageStartIndex ; + /** + * 结束位下标 + */ + private Integer carMessageEndIndex ; + /** + * 报文数据类型 (固定值 区间随机值) + */ + private String messageTypeClass ; + /** + * 报文是否开启故障检测(0默认未开启 1开启) + */ + private Integer carMessageState ; + +} diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnRuleMapper.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnRuleMapper.java index a975a63..ca41119 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnRuleMapper.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnRuleMapper.java @@ -2,7 +2,12 @@ package com.muyu.warn.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.muyu.warn.domain.WarnRule; +import com.muyu.warn.domain.car.CarMessageType; +import com.muyu.warn.domain.car.resp.CarMessageResp; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @Author:蓬叁 @@ -14,4 +19,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WarnRuleMapper extends BaseMapper { + List findByMsg(@Param("id") Long id); } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnStrategyMapper.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnStrategyMapper.java index bb7fb53..e367f9f 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnStrategyMapper.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/mapper/WarnStrategyMapper.java @@ -1,9 +1,12 @@ package com.muyu.warn.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.warn.domain.car.CartType; import com.muyu.warn.domain.WarnStrategy; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * @Author:蓬叁 * @Package:com.muyu.warn.controller @@ -14,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface WarnStrategyMapper extends BaseMapper { + List findByCarType(); } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnRuleService.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnRuleService.java index 88351e5..e75fefd 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnRuleService.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnRuleService.java @@ -2,6 +2,8 @@ package com.muyu.warn.service; import com.baomidou.mybatisplus.extension.service.IService; import com.muyu.warn.domain.WarnRule; +import com.muyu.warn.domain.car.CarMessageType; +import com.muyu.warn.domain.car.resp.CarMessageResp; import java.util.List; @@ -36,4 +38,10 @@ public interface WarnRuleService extends IService { */ Boolean checkIdUnique(WarnRule warnRule); + /** + * 获取车辆类型报文 + * @param id + * @return + */ + List findByMsg(Long id); } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnStrategyService.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnStrategyService.java index 0aa6963..053adde 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnStrategyService.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/WarnStrategyService.java @@ -1,6 +1,7 @@ package com.muyu.warn.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.muyu.warn.domain.car.CartType; import com.muyu.warn.domain.WarnStrategy; import java.util.List; @@ -36,4 +37,5 @@ public interface WarnStrategyService extends IService { */ Boolean checkIdUnique(WarnStrategy warnStrategy); + List findByCarType(); } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnRuleServiceImpl.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnRuleServiceImpl.java index 9466bbd..ce9fa76 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnRuleServiceImpl.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnRuleServiceImpl.java @@ -4,8 +4,11 @@ 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.warn.domain.WarnRule; +import com.muyu.warn.domain.car.CarMessageType; +import com.muyu.warn.domain.car.resp.CarMessageResp; import com.muyu.warn.mapper.WarnRuleMapper; import com.muyu.warn.service.WarnRuleService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -23,6 +26,8 @@ public class WarnRuleServiceImpl extends ServiceImpl implements WarnRuleService { + @Autowired private WarnRuleMapper warnRuleMapper; + /** * 精确查询预警规则 * @@ -85,4 +90,9 @@ public class WarnRuleServiceImpl return this.count(queryWrapper) > 0; } + @Override + public List findByMsg(Long id) { + return warnRuleMapper.findByMsg(id); + } + } diff --git a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnStrategyServiceImpl.java b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnStrategyServiceImpl.java index 28d67e1..9e81a67 100644 --- a/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnStrategyServiceImpl.java +++ b/cloud-modules/cloud-modules-warn/src/main/java/com/muyu/warn/service/impl/WarnStrategyServiceImpl.java @@ -3,9 +3,11 @@ package com.muyu.warn.service.impl; 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.warn.domain.car.CartType; import com.muyu.warn.domain.WarnStrategy; import com.muyu.warn.mapper.WarnStrategyMapper; import com.muyu.warn.service.WarnStrategyService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -23,6 +25,8 @@ public class WarnStrategyServiceImpl extends ServiceImpl implements WarnStrategyService { + @Autowired private WarnStrategyMapper warnStrategyMapper; + /** * 精确查询预警策略 * @@ -73,4 +77,9 @@ public class WarnStrategyServiceImpl return this.count(queryWrapper) > 0; } + @Override + public List findByCarType() { + return warnStrategyMapper.findByCarType(); + } + } diff --git a/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnRuleMapper.xml b/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnRuleMapper.xml new file mode 100644 index 0000000..8ff36c0 --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnRuleMapper.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnStrategyMapper.xml b/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnStrategyMapper.xml new file mode 100644 index 0000000..0be349d --- /dev/null +++ b/cloud-modules/cloud-modules-warn/src/main/resources/mapper/warn/WarnStrategyMapper.xml @@ -0,0 +1,14 @@ + + + + + diff --git a/cloud-modules/pom.xml b/cloud-modules/pom.xml index aaf18a0..acb1449 100644 --- a/cloud-modules/pom.xml +++ b/cloud-modules/pom.xml @@ -13,6 +13,7 @@ cloud-modules-gen cloud-modules-file cloud-modules-warn + cloud-test cloud-modules