sqlserver
修改密码漏洞修复完成 5 months ago
parent d00c46707a
commit 4481a91709

@ -2,6 +2,7 @@ package com.rehome.mqttclienttemperature;
import com.rehome.mqttclienttemperature.service.TemperatureService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.util.Map;
@Slf4j
@EnableJpaAuditing
@EnableScheduling
@EnableAsync
@ -47,17 +48,17 @@ public class AdminClientTemperatureApplication implements CommandLineRunner, App
//在这里可以调用applicationContext了
Map<String, Object> controllers = applicationContext.getBeansWithAnnotation(RequestMapping.class);
for (Map.Entry<String, Object> entry : controllers.entrySet()) {
System.out.println("------------------------");
System.out.println(entry.getKey());//demo1Controller
log.info("------------------------");
log.info(entry.getKey());//demo1Controller
}
try {
if (temperatureService != null) {
System.out.println("------------------------");
System.out.println("TemperatureController is not empty");
log.info("------------------------");
log.info("TemperatureController is not empty");
MqttRSAClient client = new MqttRSAClient();
client.start(temperatureService);
}else {
System.out.println("temperatureService is empty");
log.info("temperatureService is empty");
}
} catch (Exception ex) {
ex.printStackTrace();

@ -4,6 +4,7 @@ package com.rehome.mqttclienttemperature;
import com.rehome.mqttclienttemperature.service.TemperatureService;
import com.rehome.mqttclienttemperature.utils.MqttSSLSocketFactory;
import com.rehome.mqttclienttemperature.utils.UUIDUtil;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
@ -14,7 +15,7 @@ import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
// Xiaomi_8B2C
@Slf4j
public class MqttRSAClient {
/**
* ip
@ -93,7 +94,7 @@ public class MqttRSAClient {
@Override
public void connectionLost(Throwable throwable) {
System.out.println("connectionLost");
log.info("connectionLost");
try {
mqttClient.reconnect();
} catch (MqttException e) {
@ -104,15 +105,15 @@ public class MqttRSAClient {
@Override
public void messageArrived(String s, MqttMessage mqttMessage) {
String strData = new String(mqttMessage.getPayload());
System.out.println("topic:"+s);
System.out.println("Qos:"+mqttMessage.getQos());
System.out.println("message RSA:"+strData);
log.info("topic:"+s);
log.info("Qos:"+mqttMessage.getQos());
log.info("message RSA:"+strData);
temperatureService.saveTemperature(strData,s);
}
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
System.out.println("deliveryComplete---------"+ iMqttDeliveryToken.isComplete());
log.info("deliveryComplete---------"+ iMqttDeliveryToken.isComplete());
}
@Override
@ -128,17 +129,17 @@ public class MqttRSAClient {
timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
System.out.println("-------设定要指定任务--------");
log.info("-------设定要指定任务--------");
try {
//判断拦截状态,这里注意一下,如果没有这个判断,是非常坑的
if (!mqttClient.isConnected()) {
System.out.println("***** 没有连接到服务器 *****");
System.out.println("***** client to connect *****");
log.info("***** 没有连接到服务器 *****");
log.info("***** client to connect *****");
// 重新连接
mqttClient.connect(options);
}
if (mqttClient.isConnected()) {//连接成功,跳出连接
System.out.println("***** connect success *****");
log.info("***** connect success *****");
}
} catch (MqttException e1) {
e1.printStackTrace();

@ -6,6 +6,8 @@ server:
logging:
level:
root: INFO
file:
path: /root/temperature
spring:
datasource:

Loading…
Cancel
Save