diff --git a/cloud-auth/src/main/resources/bootstrap.yml b/cloud-auth/src/main/resources/bootstrap.yml index f9be2d5..eeaceee 100644 --- a/cloud-auth/src/main/resources/bootstrap.yml +++ b/cloud-auth/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 9500 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev # Spring spring: application: diff --git a/cloud-gateway/src/main/resources/bootstrap.yml b/cloud-gateway/src/main/resources/bootstrap.yml index 929b21f..d315c84 100644 --- a/cloud-gateway/src/main/resources/bootstrap.yml +++ b/cloud-gateway/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 8080 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev # Spring spring: diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml index d3be51b..cdd9c03 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/pom.xml @@ -83,6 +83,34 @@ cloud-common-api-doc + + + com.aliyun + ecs20140526 + 5.1.8 + + + com.aliyun + tea-openapi + 0.3.2 + + + com.aliyun + tea-console + 0.0.1 + + + com.aliyun + tea-util + 0.2.21 + + + com.aliyun + cloudapi20160714 + 3.10.1 + + + com.muyu diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnLogsController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnLogsController.java index 43c91e1..d2ebcfe 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnLogsController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnLogsController.java @@ -7,6 +7,7 @@ import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.enterprise.domain.WarnLogs; import com.muyu.enterprise.service.IWarnLogsService; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -23,6 +24,7 @@ import java.util.List; */ @RestController @RequestMapping("/logs") +@Tag(name = "车辆预警日志",description = "用来记录车辆预警的日志") public class WarnLogsController extends BaseController { @Resource diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnRuleController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnRuleController.java index 3918766..16021da 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnRuleController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnRuleController.java @@ -8,6 +8,7 @@ import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.enterprise.domain.WarnRule; import com.muyu.enterprise.service.IWarnRuleService; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -24,6 +25,7 @@ import java.util.List; */ @RestController @RequestMapping("/rule") +@Tag(name = "车辆预警规则",description = "用来客户添加或者修改规则") public class WarnRuleController extends BaseController { @Resource diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java index 900a267..0a4a5c3 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/java/com/muyu/enterprise/controller/WarnStrategyController.java @@ -7,6 +7,7 @@ import com.muyu.common.core.web.page.TableDataInfo; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.enterprise.domain.resp.WarnStrategy; import com.muyu.enterprise.service.IWarnStrategyService; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -23,6 +24,7 @@ import java.util.List; */ @RestController @RequestMapping("/strategy") +@Tag(name = "故障策略",description = "故障策略对应车辆类型用来客户选择") public class WarnStrategyController extends BaseController { @Resource diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/bootstrap.yml index 17007ea..2ab3074 100644 --- a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 10066 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev spring: application: diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warm/CarTypeMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml similarity index 100% rename from cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warm/CarTypeMapper.xml rename to cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/CarTypeMapper.xml diff --git a/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warm/WarnStrategyMapper.xml b/cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/WarnStrategyMapper.xml similarity index 100% rename from cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warm/WarnStrategyMapper.xml rename to cloud-modules/cloud-modules-enterprise/cloud-modules-enterprise-server/src/main/resources/mapper/warn/WarnStrategyMapper.xml diff --git a/cloud-modules/cloud-modules-file/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-file/src/main/resources/bootstrap.yml index 45a2bda..b471a18 100644 --- a/cloud-modules/cloud-modules-file/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-file/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 9300 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev # Spring spring: diff --git a/cloud-modules/cloud-modules-gen/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-gen/src/main/resources/bootstrap.yml index d820ac6..7e3624f 100644 --- a/cloud-modules/cloud-modules-gen/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-gen/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 9202 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev # Spring spring: diff --git a/cloud-modules/cloud-modules-system/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-system/src/main/resources/bootstrap.yml index 4d1adbc..44cf5e2 100644 --- a/cloud-modules/cloud-modules-system/src/main/resources/bootstrap.yml +++ b/cloud-modules/cloud-modules-system/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 9701 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev spring: application: diff --git a/cloud-modules/cloud-modules-vehicle-gateway/pom.xml b/cloud-modules/cloud-modules-vehicle-gateway/pom.xml new file mode 100644 index 0000000..3f4f80f --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/pom.xml @@ -0,0 +1,128 @@ + + + + com.muyu + cloud-modules + 3.6.3 + + 3.6.3 + 4.0.0 + + cloud-modules-vehicle-gateway + + + cloud-modules-vehicle-gateway系统模块 + + + + + + + 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 + + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.5 + + + + + com.muyu + cloud-common-log + + + + + com.muyu + cloud-common-api-doc + + + + + com.aliyun + ecs20140526 + 5.1.8 + + + com.aliyun + tea-openapi + 0.3.2 + + + com.aliyun + tea-console + 0.0.1 + + + com.aliyun + tea-util + 0.2.21 + + + com.aliyun + cloudapi20160714 + 3.10.1 + + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/CloudVehicleGatewayApplication.java b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/CloudVehicleGatewayApplication.java new file mode 100644 index 0000000..586e625 --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/CloudVehicleGatewayApplication.java @@ -0,0 +1,20 @@ +package com.muyu; + +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 +@EnableMyFeignClients +@SpringBootApplication +public class CloudVehicleGatewayApplication { + public static void main (String[] args) { + SpringApplication.run(CloudVehicleGatewayApplication.class, args); + } + } diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/controller/VehicleGatewayController.java b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/controller/VehicleGatewayController.java new file mode 100644 index 0000000..4099fa5 --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/controller/VehicleGatewayController.java @@ -0,0 +1,84 @@ +package com.muyu.vehiclegateway.controller; + +import io.swagger.v3.oas.annotations.tags.Tag; +import org.eclipse.paho.client.mqttv3.*; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @ClassName VehicleGatewayController + * @Description 描述 + * @Author YiBo.Liu + * @Date 2024/9/27 20:02 + */ +@RequestMapping("/vehicleGateway") +@RestController +@Tag(name = "车辆网关",description = "车辆网关管理负载中心") +public class VehicleGatewayController { + + + /** + * 用于链接MQtt获取车联信息 + */ + @PostMapping("/MqttPublishSample") + public static void MqttPublishSample(){ + //定义MQTT主题 + String topic = "vehicle"; + //定义要发布的消息内容 + String content = "Message from MqttPublishSample"; + //定义消息服务质量(qos)等级 + int qos = 2; + //定义MQTT代理服务器地址 + String broker = "tcp://106.15.136.7:1883"; + //定义客户端标识符 + String clientId = "JavaSample"; + //创建MemoryPersistence对象,用于消息的内存持久性 + MemoryPersistence persistence = new MemoryPersistence(); + + try{ + //创建MqttClient实例,连接到MQTT代理服务器 + MqttClient sampleClient = new MqttClient(broker,clientId); + + //创建MqttConnectOptions对象,用于配置连接选项 + MqttConnectOptions connOpts = new MqttConnectOptions(); + //设置CleanSession为true,标识每个连接都是一个全新的会话 + connOpts.setCleanSession(true); + //打印连接信息 + System.out.println("Connecting to broker: " + broker); + + sampleClient.connect(connOpts); + sampleClient.subscribe(topic,0); + sampleClient.setCallback(new MqttCallback() { + + //连接报错 + @Override + public void connectionLost(Throwable throwable) { + + } + //接收到消息 + @Override + public void messageArrived(String s, MqttMessage mqttMessage) throws Exception { + System.out.println(new String(mqttMessage.getPayload())); + } + //消费完成 + @Override + public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { + + } + }); + } catch(MqttException me) { + System.out.println("reason "+me.getReasonCode()); + System.out.println("msg "+me.getMessage()); + System.out.println("loc "+me.getLocalizedMessage()); + System.out.println("cause "+me.getCause()); + System.out.println("excep "+me); + me.printStackTrace(); + + } + + } + + +} diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/CreateClient.java b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/CreateClient.java new file mode 100644 index 0000000..ce9eac3 --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/CreateClient.java @@ -0,0 +1,36 @@ +package com.muyu.vehiclegateway.instance; + +import com.aliyun.ecs20140526.Client; +import com.aliyun.teaopenapi.models.Config; +import org.springframework.stereotype.Component; + +/** + * @ClassName CreateClient + * @Description 初始化账号 + * @Author YiBo.Liu + * @Date 2024/9/29 10:00 + */ +@Component +public class CreateClient { + + /** + * description : + *

使用AK&SK初始化账号Client

+ * @return Client + * + * @throws Exception + */ + public static Client createClient() throws Exception { + // 工程代码泄露可能会导致 AccessKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考。 + // 建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378657.html。 + Config config = new Config() + // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。 + .setAccessKeyId("LTAI5tLZdFdgNAXQyvs4nGGT") + // 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。 + .setAccessKeySecret("cpG2Yq7G4s7veCidc2y5bUeJQwI3lI"); + // Endpoint 请参考 https://api.aliyun.com/product/Ecs + config.endpoint = "ecs.cn-shanghai.aliyuncs.com"; + return new Client(config); + } + +} diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/DelInstance.java b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/DelInstance.java new file mode 100644 index 0000000..8013bbd --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/DelInstance.java @@ -0,0 +1,103 @@ +// This file is auto-generated, don't edit it. Thanks. +package com.muyu.vehiclegateway.instance; + +import com.aliyun.ecs20140526.Client; +import com.aliyun.ecs20140526.models.DeleteInstancesRequest; +import com.aliyun.ecs20140526.models.DescribeInstancesRequest; +import com.aliyun.ecs20140526.models.DescribeInstancesResponse; +import com.aliyun.ecs20140526.models.DescribeInstancesResponseBody; +import com.aliyun.tea.*; +import com.aliyun.teautil.Common; +import com.aliyun.teautil.models.RuntimeOptions; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; + +/** + * @ClassName GenerateInstance + * @Description 描述 + * @Author YiBo.Liu + * @Date 2024/9/28 19:39 + */ +@Log4j2 +@Component +@Tag(name = "停止程序时删除ECS服务器实例") +public class DelInstance implements DisposableBean { + + public static void delInstance() throws Exception { + + // 创建ECS客户端对象,用于后续调用ECS相关API + Client client = CreateClient.createClient(); + + DescribeInstancesRequest describeInstancesRequest = new DescribeInstancesRequest() + .setRegionId("cn-shanghai"); + + //创建运行时选择对象,用于配置运行时的选项参数 + RuntimeOptions runtimeOptions = new RuntimeOptions(); + + //获取实例列表 + DescribeInstancesResponse describeInstancesResponse = client.describeInstancesWithOptions(describeInstancesRequest, runtimeOptions); + + //提取实例ID集合 + ArrayList list = new ArrayList<>(); + + DescribeInstancesResponseBody body = describeInstancesResponse.getBody(); + + for (DescribeInstancesResponseBody.DescribeInstancesResponseBodyInstancesInstance instance : body.getInstances().getInstance()) { + list.add(instance.getInstanceId()); + } + + for (String string : list) { + log.info("实例id:"+string); + } + + // 创建删除实例请求对象,并设置请求参数 + DeleteInstancesRequest deleteInstancesRequest = new DeleteInstancesRequest() + // 设置地域ID,指定删除实例的地域 + .setRegionId("cn-shanghai") + // 设置DryRun为true,用于验证请求是否可以成功,但不实际执行删除操作 + .setDryRun(false) + // 设置Force为true,表示即使实例有正在运行的任务,也强制删除实例 + .setForce(true) + // 设置TerminateSubscription为true,表示删除按订阅付费的实例时终止订阅 + .setTerminateSubscription(true) + .setInstanceId(list); + + System.out.println("删除ECS实例成功"); + // 创建运行时选项对象,用于配置运行时的选项参数 + RuntimeOptions runtime = new RuntimeOptions(); + try { + // 复制代码运行请自行打印 API 的返回值 + client.deleteInstancesWithOptions(deleteInstancesRequest, runtime); + } catch (TeaException error) { + // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 + // 错误 message + System.out.println(error.getMessage()); + // 诊断地址 + System.out.println(error.getData().get("Recommend")); + Common.assertAsString(error.message); + } catch (Exception _error) { + TeaException error = new TeaException(_error.getMessage(), _error); + // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 + // 错误 message + log.info("错误:"+error.getMessage()); + // 诊断地址 + log.info("错误:"+error.getData().get("Recommend")); + Common.assertAsString(error.message); + } + } + + + @Override + public void destroy() throws Exception { + System.out.println("删除中======================="); + delInstance(); + + + } +} + + diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/GenerateInstance.java b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/GenerateInstance.java new file mode 100644 index 0000000..729271b --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/java/com/muyu/vehiclegateway/instance/GenerateInstance.java @@ -0,0 +1,93 @@ +package com.muyu.vehiclegateway.instance; + +import com.aliyun.ecs20140526.Client; +import com.aliyun.ecs20140526.models.RunInstancesRequest; +import com.aliyun.tea.TeaException; +import com.aliyun.teautil.Common; +import com.aliyun.teautil.models.RuntimeOptions; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.log4j.Log4j2; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +/** + * @ClassName GenerateInstance + * @Description 描述 + * @Author YiBo.Liu + * @Date 2024/9/28 19:39 + */ +@Component +@Log4j2 +@Tag(name = "程序启动创建ECS服务器实例") +public class GenerateInstance implements ApplicationRunner { + + /** + * 启动自动创建实例 + * @throws Exception + */ + public static void generateInstance() throws Exception { + + // 创建ECS客户端对象,用于后续调用ECS相关API + Client client = CreateClient.createClient(); + + RunInstancesRequest.RunInstancesRequestSystemDisk systemDisk = new RunInstancesRequest.RunInstancesRequestSystemDisk() + .setSize("40") + .setCategory("cloud_essd"); + RunInstancesRequest runInstancesRequest = new RunInstancesRequest() + // 设置地域ID + .setRegionId("cn-shanghai") + // 设置镜像ID + .setImageId("m-uf64hrlxa0rbmyd7ovvq") + // 设置实例类型 + .setInstanceType("ecs.t6-c1m1.large") + // 设置安全组ID + .setSecurityGroupId("sg-uf6f6dvazjqv127a4yyt") + // 设置虚拟交换机ID + .setVSwitchId("vsw-uf6htez4ox9k2c4cs8505") + // 设置实例名称 + .setInstanceName("server-mqtt") + // 设置实例付费类型为后付费按量付费 + .setInstanceChargeType("PostPaid") + // 设置互联网最大出带宽为1 Mbps + .setInternetMaxBandwidthOut(1) + // 设置系统盘配置 + .setSystemDisk(systemDisk) + // 设置主机名 + .setHostName("root") + // 设置实例密码 + .setPassword("Six@211206") + // 设置创建实例的数量 + .setAmount(1); + + RuntimeOptions runtime = new RuntimeOptions(); + try { + // 复制代码运行请自行打印 API 的返回值 + client.runInstancesWithOptions(runInstancesRequest, runtime); + } catch (TeaException error) { + // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 + // 错误 message + System.out.println(error.getMessage()); + // 诊断地址 + System.out.println(error.getData().get("Recommend")); + Common.assertAsString(error.message); + } catch (Exception _error) { + TeaException error = new TeaException(_error.getMessage(), _error); + // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 + // 错误 message + System.out.println(error.getMessage()); + // 诊断地址 + System.out.println(error.getData().get("Recommend")); + Common.assertAsString(error.message); + } + } + + @Override + public void run(ApplicationArguments args) throws Exception { + generateInstance(); + System.out.println("创建实例成功"); + } + + + +} diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/banner.txt b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..26e2e1b --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/bootstrap.yml @@ -0,0 +1,46 @@ +# Tomcat +server: + port: 10099 + +# nacos线上地址 +nacos: + addr: 106.15.136.7:8848 + user-name: nacos + password: nacos + namespace: dev + +spring: + application: + # 应用名称 + name: cloud-vehicle-gateway + 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} diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/dev.xml b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/dev.xml new file mode 100644 index 0000000..03a6f37 --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/dev.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/prod.xml b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/prod.xml new file mode 100644 index 0000000..0d5066f --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/prod.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + ${log.sky.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + + + ERROR + + ACCEPT + + DENY + + + + + + + + ${log.sky.pattern} + + + + + + + + + + + + + + + + + + + + diff --git a/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/test.xml b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/test.xml new file mode 100644 index 0000000..0d5066f --- /dev/null +++ b/cloud-modules/cloud-modules-vehicle-gateway/src/main/resources/logback/test.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + ${log.sky.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + + + ERROR + + ACCEPT + + DENY + + + + + + + + ${log.sky.pattern} + + + + + + + + + + + + + + + + + + + + diff --git a/cloud-modules/pom.xml b/cloud-modules/pom.xml index 3daec94..b64b4ee 100644 --- a/cloud-modules/pom.xml +++ b/cloud-modules/pom.xml @@ -15,6 +15,7 @@ cloud-modules-enterprise cloud-weixin-mp cloud-modules-protocol-analysis + cloud-modules-vehicle-gateway cloud-modules diff --git a/cloud-visual/cloud-visual-monitor/src/main/resources/bootstrap.yml b/cloud-visual/cloud-visual-monitor/src/main/resources/bootstrap.yml index cbbe784..da1f316 100644 --- a/cloud-visual/cloud-visual-monitor/src/main/resources/bootstrap.yml +++ b/cloud-visual/cloud-visual-monitor/src/main/resources/bootstrap.yml @@ -2,11 +2,12 @@ server: port: 9100 +# nacos线上地址 nacos: addr: 106.15.136.7:8848 user-name: nacos password: nacos - namespace: lqs + namespace: dev # Spring spring: