Merge branch 'server_five_dongxiaodong' of https://gitea.qinmian.online/five-groups/five-groups-couplet into server_five_xiaoyao

server_five_liuyunhu
lijiayao 2024-04-02 18:28:31 +08:00
commit aaa5d4f868
3 changed files with 90 additions and 3 deletions

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.couplet.trouble.mapper.SysTroubleMapper">
<resultMap type="com.couplet.trouble.domain.CoupletTroubleCode" id="SysTroubleResult">
<id property="troubleId" column="trouble_id"/>
<result property="troubleCode" column="trouble_code"/>
<result property="troubleValue" column="trouble_value"/>
<result property="troublePosition" column="trouble_position"/>
<result property="troubleTag" column="trouble_tag"/>
<result property="typeId" column="type_id"/>
<result property="gradeId" column="grade_id"/>
</resultMap>
<sql id="selectTroubleVo">
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
</sql>
<select id="selectTroubleList" parameterType="com.couplet.trouble.mapper.SysTroubleMapper" resultMap="SysTroubleResult">
<include refid="selectTroubleVo"/>
<where>
<if test="troubleCode != null and troubleCode != ''">
AND trouble_code = #{troubleCode}
</if>
<if test="troublePosition != null and troublePosition != ''">
AND trouble_position like concat('%', #{troublePosition}, '%')
</if>
</where>
</select>
<select id="selectTroubleListByType" resultType="com.couplet.trouble.domain.CoupletTroubleType">
select * from couplet_trouble_type
</select>
<select id="selectTroubleListByGrade" resultType="com.couplet.trouble.domain.CoupletTroubleGrade">
select * from couplet_trouble_grade
</select>
</mapper>