diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java index 2011b6a..247ebaa 100644 --- a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/analyze/msg/model/ModelMessage.java @@ -3,10 +3,15 @@ package com.couplet.analyze.msg.model; import com.couplet.analyze.msg.service.CoupletMsgService; import lombok.extern.slf4j.Slf4j; import org.eclipse.paho.client.mqttv3.MqttClient; +import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import static com.couplet.analyze.msg.contents.MsgContent.BROKER_URL; +import static com.couplet.analyze.msg.contents.MsgContent.CLIENT_ID; + + /** * @author DongXiaoDong * @version 1.0 @@ -19,8 +24,14 @@ public class ModelMessage { @Scheduled(cron = "0/5 * * * * ?") public void startMsg() { -// try { -// new MqttClient() -// } + try { + MqttClient mqttClient = new MqttClient(BROKER_URL, CLIENT_ID); + + MqttConnectOptions options = new MqttConnectOptions(); + + options.setCleanSession(true); + } catch (Exception e) { + throw new RuntimeException(e); + } } } diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..8303ef3 --- /dev/null +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/bootstrap.yml @@ -0,0 +1,35 @@ +# Tomcat +server: + port: 9223 + +# Spring +spring: + application: + # 应用名称 + name: couplet-msg + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 121.89.211.230:8848 + namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15 + config: + # 配置中心地址 + server-addr: 121.89.211.230:8848 + namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + main: + allow-bean-definition-overriding: true +logging: + level: + com.couplet.msg.mapper: DEBUG +mybatis-plus: + configuration: + map-underscore-to-camel-case: true diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/mapper/trouble/SysTroubleMapper.xml b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/mapper/trouble/SysTroubleMapper.xml new file mode 100644 index 0000000..18090c0 --- /dev/null +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/resources/mapper/trouble/SysTroubleMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + select t.*,g.grade_name,y.type_name from couplet_trouble_code t + LEFT JOIN couplet_trouble_grade g on t.grade_id = g.grade_id + LEFT JOIN couplet_trouble_type y on t.type_id= y.type_id + + + + + + +