diff --git a/cloud-modules/cloud-modules-car/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-car/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..f95ea7d --- /dev/null +++ b/cloud-modules/cloud-modules-car/src/main/resources/bootstrap.yml @@ -0,0 +1,60 @@ +# Tomcat +server: + port: 10066 + +# nacos线上地址 +nacos: + addr: 106.15.136.7:8848 + user-name: nacos + password: nacos + namespace: zmw +# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all +# Spring +spring: + amqp: + deserialization: + trust: + all: true + main: + allow-bean-definition-overriding: true + application: + # 应用名称 + name: cloud-car + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + config: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + # 系统共享配置 + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # 系统环境Config共享配置 + - application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # xxl-job 配置文件 + - application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # rabbit 配置文件 + - application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} +logging: + level: + com.muyu.system.mapper: DEBUG diff --git a/cloud-warn/pom.xml b/cloud-warn/pom.xml new file mode 100644 index 0000000..4b6edda --- /dev/null +++ b/cloud-warn/pom.xml @@ -0,0 +1,96 @@ + + + 4.0.0 + + com.muyu + cloud-server + 3.6.3 + + + cloud-warn + + + 17 + 17 + UTF-8 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + com.mysql + mysql-connector-j + + + + + com.muyu + cloud-common-datasource + + + + + com.muyu + cloud-common-datascope + + + + + com.muyu + cloud-common-log + + + + + com.muyu + cloud-common-api-doc + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + diff --git a/cloud-warn/src/main/java/com/muyu/warn/CloudWarnApplication.java b/cloud-warn/src/main/java/com/muyu/warn/CloudWarnApplication.java new file mode 100644 index 0000000..c9a6d4c --- /dev/null +++ b/cloud-warn/src/main/java/com/muyu/warn/CloudWarnApplication.java @@ -0,0 +1,21 @@ +package com.muyu.warn; + +import com.muyu.common.security.annotation.EnableCustomConfig; +import com.muyu.common.security.annotation.EnableMyFeignClients; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 系统模块 + * + * @author muyu + */ +@EnableCustomConfig +//@EnableCustomSwagger2 +@EnableMyFeignClients +@SpringBootApplication +public class CloudWarnApplication { + public static void main (String[] args) { + SpringApplication.run(CloudWarnApplication.class, args); + } +} diff --git a/cloud-warn/src/main/java/com/muyu/warn/controller/CarMessageController.java b/cloud-warn/src/main/java/com/muyu/warn/controller/CarMessageController.java new file mode 100644 index 0000000..f65b305 --- /dev/null +++ b/cloud-warn/src/main/java/com/muyu/warn/controller/CarMessageController.java @@ -0,0 +1,39 @@ +package com.muyu.warn.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.muyu.common.core.domain.Result; +import com.muyu.warn.domain.CarMessage; +import com.muyu.warn.service.CarMessageService; +import com.muyu.warn.service.CarTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @ClassName CarMessageController + * @Description 描述 + * @Author YiBo.Liu + * @Date 2024/9/22 22:28 + */ +@RestController +@RequestMapping("/carMessage") +public class CarMessageController { + @Autowired + private CarMessageService carMessageService; + + /** + * 根据报文模板id查询报文 + * @param templateId + * @return + */ + @GetMapping("/selectByTemplateId") + private Result> selectByTemplateId(@RequestParam("templateId") Integer templateId) { + return Result.success(carMessageService.list + (new LambdaQueryWrapper().eq(CarMessage::getTemplateId, templateId))); + } + +} diff --git a/cloud-warn/src/main/java/com/muyu/warn/controller/CarTypeController.java b/cloud-warn/src/main/java/com/muyu/warn/controller/CarTypeController.java new file mode 100644 index 0000000..a3b82f9 --- /dev/null +++ b/cloud-warn/src/main/java/com/muyu/warn/controller/CarTypeController.java @@ -0,0 +1,47 @@ +package com.muyu.warn.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.muyu.common.core.domain.Result; +import com.muyu.warn.domain.CarType; +import com.muyu.warn.service.CarTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @ClassName CarController + * @Description 车辆类型Controller层 + * @Author YiBo.Liu + * @Date 2024/9/22 16:52 + */ +@RestController +@RequestMapping("/carType") +public class CarTypeController { + + @Autowired + private CarTypeService carTypeService; + + /** + * 查询所有规则 + * @return carTypeList + */ + @GetMapping("/carTypeList") + private Result> carTypeList() { + List carTypeList = carTypeService.list(); + return Result.success(carTypeList); + } + + /** + * 通过id查询类型对象 + * @param catTypeId + * @return + */ + @PostMapping("/catTypeId") + private Result catTypeId(@RequestParam("catTypeId") Integer catTypeId) { + CarType carType = carTypeService.findById(catTypeId); + return Result.success(carType); + } + + +} diff --git a/cloud-warn/src/main/java/com/muyu/warn/controller/TemplateController.java b/cloud-warn/src/main/java/com/muyu/warn/controller/TemplateController.java new file mode 100644 index 0000000..74966f7 --- /dev/null +++ b/cloud-warn/src/main/java/com/muyu/warn/controller/TemplateController.java @@ -0,0 +1,37 @@ +package com.muyu.warn.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.muyu.common.core.domain.Result; +import com.muyu.warn.domain.Template; +import com.muyu.warn.service.TemplateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName Template + * @Description 报文模板 + * @Author YiBo.Liu + * @Date 2024/9/22 18:37 + */ +@RestController +@RequestMapping("/template") +public class TemplateController { + + @Autowired + private TemplateService templateService; + + /** + * 通过报文id查询 + * @param templateId + * @return + */ + @GetMapping("/findByTemplateId") + private Result findByTemplateId(@RequestParam("templateId") Integer templateId) { + return Result.success(templateService.getOne( + new LambdaQueryWrapper