Compare commits
9 Commits
prod
...
4319f97a5c
| Author | SHA1 | Date | |
|---|---|---|---|
| 4319f97a5c | |||
| c04c764ade | |||
| b0751a55cd | |||
| 046e4b2b43 | |||
| c12b165816 | |||
| 2a7c3d42c0 | |||
| 0a94f51e0d | |||
| af8f225384 | |||
| e1cfe7f911 |
@ -10,7 +10,7 @@ spring:
|
||||
username: nacos
|
||||
password: nacos
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
#路由配置
|
||||
gateway:
|
||||
routes:
|
||||
|
||||
@ -310,9 +310,9 @@ public class StationServiceImpl implements StationService {
|
||||
* @param station
|
||||
*/
|
||||
private void updateStationInfo(Station station) {
|
||||
MyAddress address = AddressUntils.getAddress(String.valueOf(station.getLatitude()),String.valueOf(station.getLongitude()));
|
||||
MyAddress address = AbroadAddressUtils.getAddress(String.valueOf(station.getLatitude()),String.valueOf(station.getLongitude()));
|
||||
if (null != address) {
|
||||
String adCode = address.getAdcode();
|
||||
String adCode = address.getCityCode();
|
||||
station.setAdCode(adCode);
|
||||
station.setDistrict(address.getDistrict());
|
||||
station.setCity(address.getCity());
|
||||
@ -320,7 +320,7 @@ public class StationServiceImpl implements StationService {
|
||||
station.setNation(address.getNation());
|
||||
String key = RedisKeyConstant.WEATHER_PROVINCE_CITY + adCode;
|
||||
if (!redisService.hasKey(key)) {
|
||||
WeatherRespVo weatherRespVo = WeatherUntils.getWeatherRespVo(station.getAdCode());
|
||||
WeatherRespVo weatherRespVo = AbroadWeatherUtils.getWeatherRespVo(String.valueOf(station.getLatitude()),String.valueOf(station.getLongitude()));
|
||||
if (weatherRespVo != null) {
|
||||
weatherRespVo.setUpdateTime(System.currentTimeMillis());
|
||||
redisService.set(key, weatherRespVo);
|
||||
|
||||
@ -25,16 +25,11 @@ import io.swagger.annotations.ApiOperation;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
@ -59,6 +54,12 @@ public class AutoDeviceCurveController {
|
||||
@Autowired
|
||||
DeviceTypeColService deviceTypeColService;
|
||||
|
||||
@GetMapping("/time")
|
||||
@TokenIgnore
|
||||
public String checkTime() {
|
||||
return "时区:" + TimeZone.getDefault().getID() +
|
||||
" | 时间:" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").format(new Date());
|
||||
}
|
||||
|
||||
@PostMapping("queryCurve")
|
||||
@ApiOperation(value = "查询两个曲线的差值/查询单条曲线")
|
||||
|
||||
@ -17,11 +17,11 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.236:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: zzkj
|
||||
url: jdbc:mysql://172.31.35.125:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: business_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
initialSize: 5
|
||||
@ -33,7 +33,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 50000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
@ -50,8 +50,8 @@ spring:
|
||||
minio:
|
||||
accessKey: admin
|
||||
secretKey: zzkj@688737
|
||||
endpoint: http://192.168.0.236:9000
|
||||
prefixUrl: http://192.168.0.236:9000
|
||||
endpoint: http://172.31.35.125:9000
|
||||
prefixUrl: http://172.31.35.125:9000
|
||||
|
||||
formula:
|
||||
fieldmap:
|
||||
|
||||
@ -46,6 +46,11 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20231013</version>
|
||||
</dependency>
|
||||
<!--jackson-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
|
||||
@ -25,6 +25,9 @@ public class WeatherRespVo {
|
||||
@ApiModelProperty(value = "天气现象")
|
||||
String skyCon;
|
||||
|
||||
@ApiModelProperty(value = "天气现象编码")
|
||||
int code;
|
||||
|
||||
@ApiModelProperty(value = "风向风速")
|
||||
String speedAndDirection;
|
||||
|
||||
|
||||
@ -0,0 +1,128 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.entity.MyAddress;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.*;
|
||||
|
||||
/**
|
||||
* @author kerwin
|
||||
*
|
||||
* 海外地址反向解析
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class AbroadAddressUtils {
|
||||
|
||||
static String apiKey = "AIzaSyAM4JOtE9yt48f60ATwByB7uWzTIrYSSUg";
|
||||
|
||||
public static MyAddress getAddress(String lat, String lng){
|
||||
// 构建API请求URL
|
||||
String urlString = "https://maps.googleapis.com/maps/api/geocode/json?" +
|
||||
"latlng=" + lat + "," + lng +
|
||||
"&key=" + apiKey;
|
||||
// 发送HTTP请求
|
||||
URL url = null;
|
||||
StringBuilder response = new StringBuilder();
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
// 创建代理(如果不需要代理,可以移除这部分)
|
||||
// Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 4781));
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(10000); // 10秒连接超时
|
||||
conn.setReadTimeout(10000); // 10秒读取超时
|
||||
// 检查响应状态
|
||||
int responseCode = conn.getResponseCode();
|
||||
if (responseCode != 200) {
|
||||
throw new RuntimeException("HTTP请求失败: " + responseCode);
|
||||
}
|
||||
// 读取响应内容
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ProtocolException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
// 解析JSON响应
|
||||
return parseGeocodeResponse(response.toString());
|
||||
}
|
||||
|
||||
private static MyAddress parseGeocodeResponse(String jsonResponse) {
|
||||
JSONObject json = new JSONObject(jsonResponse);
|
||||
String status = json.getString("status");
|
||||
|
||||
if (!"OK".equals(status)) {
|
||||
throw new RuntimeException("地理编码API错误: " + status);
|
||||
}
|
||||
MyAddress address = new MyAddress();
|
||||
|
||||
// 获取第一个结果(最精确的匹配)
|
||||
JSONObject firstResult = json.getJSONArray("results").getJSONObject(0);
|
||||
// 解析地址组件
|
||||
JSONArray components = firstResult.getJSONArray("address_components");
|
||||
for (int i = 0; i < components.length(); i++) {
|
||||
JSONObject component = components.getJSONObject(i);
|
||||
JSONArray types = component.getJSONArray("types");
|
||||
String longName = component.getString("long_name");
|
||||
// 国家信息
|
||||
if (types.toString().contains("country")) {
|
||||
address.setNation(longName);
|
||||
}
|
||||
// 省份/州信息
|
||||
if (types.toString().contains("administrative_area_level_1")) {
|
||||
address.setProvince(longName);
|
||||
}
|
||||
// 城市信息
|
||||
if (types.toString().contains("locality")) {
|
||||
address.setCity(longName);
|
||||
}
|
||||
// 区县信息
|
||||
if (types.toString().contains("sublocality")) {
|
||||
address.setDistrict(longName);
|
||||
}
|
||||
// 邮政编码
|
||||
if (types.toString().contains("postal_code")) {
|
||||
address.setCityCode(longName);
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 示例坐标 - 纽约
|
||||
String latitude = "48.877132";
|
||||
String longitude = "2.356407";
|
||||
|
||||
try {
|
||||
// 获取地址信息
|
||||
MyAddress address = getAddress(latitude, longitude);
|
||||
|
||||
// 打印结果
|
||||
System.out.println("============ 反向地理编码结果 ============");
|
||||
System.out.println("国家: " + address.getNation() );
|
||||
System.out.println("省份/州: " + address.getProvince());
|
||||
System.out.println("城市: " + address.getCity());
|
||||
System.out.println("地区/区县: " + address.getDistrict());
|
||||
System.out.println("邮政编码: " + address.getCityCode());
|
||||
} catch (Exception e) {
|
||||
System.err.println("发生错误: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.ho.common.tools.util;
|
||||
|
||||
import com.ho.common.tools.entity.WeatherRespVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author kerwin
|
||||
*
|
||||
* 获取海外天气
|
||||
*/
|
||||
@Slf4j
|
||||
public class AbroadWeatherUtils {
|
||||
|
||||
static String apiKey = "6358b3081a5849f09ac90138252107";
|
||||
public static void main(String[] args) {
|
||||
String latitude = "40.714224";
|
||||
String longitude = "-73.961452";
|
||||
|
||||
try {
|
||||
System.out.println(getWeatherRespVo(latitude, longitude));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static WeatherRespVo getWeatherRespVo(String lat, String lng) {
|
||||
String urlString = "http://api.weatherapi.com/v1/forecast.json?key="+apiKey+"&q=" + lat + "," + lng +"&days=1";
|
||||
URL url = null;
|
||||
StringBuilder response = new StringBuilder();
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(conn.getInputStream()))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
response.append(line);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return parseWeatherData(response.toString());
|
||||
}
|
||||
|
||||
private static WeatherRespVo parseWeatherData(String jsonResponse) {
|
||||
WeatherRespVo weatherRespVo =new WeatherRespVo();
|
||||
JSONObject root = new JSONObject(jsonResponse);
|
||||
|
||||
// 解析地区信息
|
||||
JSONObject location = root.getJSONObject("location");
|
||||
String area = location.getString("name");
|
||||
weatherRespVo.setCityzh(area);
|
||||
|
||||
// 获取天气预报数据
|
||||
JSONObject forecast = root.getJSONObject("forecast");
|
||||
JSONArray forecastday = forecast.getJSONArray("forecastday");
|
||||
JSONObject day = forecastday.getJSONObject(0).getJSONObject("day");
|
||||
|
||||
// 解析温度数据
|
||||
double maxTemp = day.getDouble("maxtemp_c");
|
||||
weatherRespVo.setMaxTemperature(new BigDecimal(String.valueOf(maxTemp)));
|
||||
double minTemp = day.getDouble("mintemp_c");
|
||||
weatherRespVo.setMinTemperature(new BigDecimal(String.valueOf(minTemp)));
|
||||
String condition = day.getJSONObject("condition").getString("text");
|
||||
weatherRespVo.setSkyCon(condition);
|
||||
int code = day.getJSONObject("condition").getInt("code");
|
||||
weatherRespVo.setCode(code);
|
||||
double maxWindKph = day.getDouble("maxwind_kph");
|
||||
// 获取风向(从最近的小时数据中获取)
|
||||
JSONArray hours = forecastday.getJSONObject(0).getJSONArray("hour");
|
||||
String windDirection = hours.getJSONObject(0).getString("wind_dir");
|
||||
// 组合风向风速信息
|
||||
String windInfo = windDirection + " " + maxWindKph + " km/h";
|
||||
weatherRespVo.setSpeedAndDirection(windInfo);
|
||||
weatherRespVo.setUpdateTime(System.currentTimeMillis());
|
||||
return weatherRespVo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,233 +1,233 @@
|
||||
package com.ho.datacollect.config;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ho.datacollect.util.AnotherMqttConfigUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author wp
|
||||
* @desc: Mqtt配置类
|
||||
* @date 2025/06/11
|
||||
*/
|
||||
@Configuration
|
||||
@Data
|
||||
@ConfigurationProperties("mqtt1")
|
||||
@Slf4j
|
||||
public class AnotherMqttConfig {
|
||||
|
||||
//服务器url
|
||||
@Value("${mqtt1.url}")
|
||||
String url;
|
||||
//超时时间
|
||||
@Value("${mqtt1.timeout}")
|
||||
Integer timeout;
|
||||
//会话保持时间
|
||||
@Value("${mqtt1.keepAlive}")
|
||||
Integer keepAlive;
|
||||
|
||||
@Value("${mqtt1.userName}")
|
||||
String userName;
|
||||
|
||||
@Value("${mqtt1.passWord}")
|
||||
String passWord;
|
||||
|
||||
@Value("${topic.edgeLoginRequest}")
|
||||
String edgeLoginRequest;
|
||||
|
||||
@Value("${topic.edgeReadResponse}")
|
||||
String edgeReadResponse;
|
||||
|
||||
@Value("${topic.edgeWriteResponse}")
|
||||
String edgeWriteResponse;
|
||||
|
||||
@Value("${topic.edgeReportPush}")
|
||||
String edgeReportPush;
|
||||
|
||||
@Value("${topic.edgeControlResponse}")
|
||||
String edgeControlResponse;
|
||||
|
||||
@Autowired
|
||||
AnotherLoginRequestConsumer loginRequestConsumer;
|
||||
|
||||
@Autowired
|
||||
AnotherReadResponseConsumer readResponseConsumer;
|
||||
|
||||
@Autowired
|
||||
AnotherWriteResponseConsumer writeResponseConsumer;
|
||||
|
||||
@Autowired
|
||||
AnotherReportPushConsumer reportPushConsumer;
|
||||
|
||||
@Autowired
|
||||
AnotherControlResponseConsumer controlResponseConsumer;
|
||||
|
||||
//是否自动重连 实际环境要改为true
|
||||
private boolean autoReConnect = true;
|
||||
|
||||
|
||||
//登录验证的监听
|
||||
@Bean(name = "AnotherLoginRequest")
|
||||
public MqttClient initLoginRequest() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" +clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
options.setExecutorServiceTimeout(0);
|
||||
//options.setAutomaticReconnect(autoReConnect);
|
||||
client.setCallback(loginRequestConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("LoginRequestMqttClient建立连接:{}", complete);
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getLoginRequestTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
//读取文件请求的监听
|
||||
@Bean(name = "AnotherReadResponse")
|
||||
public MqttClient initReadRequest() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" +clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
options.setExecutorServiceTimeout(0);
|
||||
//options.setAutomaticReconnect(autoReConnect);
|
||||
client.setCallback(readResponseConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("ReadRequestMqttClient建立连接:{}", complete);
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getReadRequestTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
//写文件响应的监听
|
||||
@Bean(name = "AnotherWriteResponse")
|
||||
public MqttClient initWriteRequest() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" +clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
options.setExecutorServiceTimeout(0);
|
||||
//options.setAutomaticReconnect(autoReConnect);
|
||||
client.setCallback(writeResponseConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("WriteRequestMqttClient建立连接:{}", complete);
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getWriteRequestTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
//报告上传
|
||||
@Bean(name = "AnotherReportPush")
|
||||
public MqttClient initReportPush() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" +clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
options.setExecutorServiceTimeout(0);
|
||||
//options.setAutomaticReconnect(autoReConnect);
|
||||
client.setCallback(reportPushConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("ReportPushMqttClient建立连接:{}", complete);
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getReportPushTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
//远程控制
|
||||
@Bean(name = "AnotherControlResponse")
|
||||
public MqttClient initControlResponse() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" +clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
options.setExecutorServiceTimeout(0);
|
||||
//options.setAutomaticReconnect(autoReConnect);
|
||||
client.setCallback(controlResponseConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("ControlResponseMqttClient建立连接:{}", complete);
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getControlResponseTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
}
|
||||
//package com.ho.datacollect.config;
|
||||
//
|
||||
//import cn.hutool.core.util.IdUtil;
|
||||
//import com.ho.datacollect.util.AnotherMqttConfigUtil;
|
||||
//import lombok.Data;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.eclipse.paho.client.mqttv3.IMqttToken;
|
||||
//import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
//import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
///**
|
||||
// * @author wp
|
||||
// * @desc: Mqtt配置类
|
||||
// * @date 2025/06/11
|
||||
// */
|
||||
//@Configuration
|
||||
//@Data
|
||||
//@ConfigurationProperties("mqtt1")
|
||||
//@Slf4j
|
||||
//public class AnotherMqttConfig {
|
||||
//
|
||||
// //服务器url
|
||||
// @Value("${mqtt1.url}")
|
||||
// String url;
|
||||
// //超时时间
|
||||
// @Value("${mqtt1.timeout}")
|
||||
// Integer timeout;
|
||||
// //会话保持时间
|
||||
// @Value("${mqtt1.keepAlive}")
|
||||
// Integer keepAlive;
|
||||
//
|
||||
// @Value("${mqtt1.userName}")
|
||||
// String userName;
|
||||
//
|
||||
// @Value("${mqtt1.passWord}")
|
||||
// String passWord;
|
||||
//
|
||||
// @Value("${topic.edgeLoginRequest}")
|
||||
// String edgeLoginRequest;
|
||||
//
|
||||
// @Value("${topic.edgeReadResponse}")
|
||||
// String edgeReadResponse;
|
||||
//
|
||||
// @Value("${topic.edgeWriteResponse}")
|
||||
// String edgeWriteResponse;
|
||||
//
|
||||
// @Value("${topic.edgeReportPush}")
|
||||
// String edgeReportPush;
|
||||
//
|
||||
// @Value("${topic.edgeControlResponse}")
|
||||
// String edgeControlResponse;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherLoginRequestConsumer loginRequestConsumer;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherReadResponseConsumer readResponseConsumer;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherWriteResponseConsumer writeResponseConsumer;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherReportPushConsumer reportPushConsumer;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherControlResponseConsumer controlResponseConsumer;
|
||||
//
|
||||
// //是否自动重连 实际环境要改为true
|
||||
// private boolean autoReConnect = true;
|
||||
//
|
||||
//
|
||||
// //登录验证的监听
|
||||
// @Bean(name = "AnotherLoginRequest")
|
||||
// public MqttClient initLoginRequest() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" +clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// options.setExecutorServiceTimeout(0);
|
||||
// //options.setAutomaticReconnect(autoReConnect);
|
||||
// client.setCallback(loginRequestConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("LoginRequestMqttClient建立连接:{}", complete);
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getLoginRequestTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// return client;
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//
|
||||
// //读取文件请求的监听
|
||||
// @Bean(name = "AnotherReadResponse")
|
||||
// public MqttClient initReadRequest() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" +clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// options.setExecutorServiceTimeout(0);
|
||||
// //options.setAutomaticReconnect(autoReConnect);
|
||||
// client.setCallback(readResponseConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("ReadRequestMqttClient建立连接:{}", complete);
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getReadRequestTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//
|
||||
// //写文件响应的监听
|
||||
// @Bean(name = "AnotherWriteResponse")
|
||||
// public MqttClient initWriteRequest() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" +clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// options.setExecutorServiceTimeout(0);
|
||||
// //options.setAutomaticReconnect(autoReConnect);
|
||||
// client.setCallback(writeResponseConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("WriteRequestMqttClient建立连接:{}", complete);
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getWriteRequestTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//
|
||||
// //报告上传
|
||||
// @Bean(name = "AnotherReportPush")
|
||||
// public MqttClient initReportPush() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" +clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// options.setExecutorServiceTimeout(0);
|
||||
// //options.setAutomaticReconnect(autoReConnect);
|
||||
// client.setCallback(reportPushConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("ReportPushMqttClient建立连接:{}", complete);
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getReportPushTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//
|
||||
// //远程控制
|
||||
// @Bean(name = "AnotherControlResponse")
|
||||
// public MqttClient initControlResponse() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" +clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// options.setExecutorServiceTimeout(0);
|
||||
// //options.setAutomaticReconnect(autoReConnect);
|
||||
// client.setCallback(controlResponseConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("ControlResponseMqttClient建立连接:{}", complete);
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getControlResponseTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@ -3,132 +3,9 @@ package com.ho.datacollect.util;
|
||||
public class MqttConfigUtil {
|
||||
|
||||
public static String[] commonTopic = new String[]{
|
||||
"+/device/fa22fd97b39c04c8",
|
||||
"+/device/803274d9432df350",
|
||||
"+/device/e4067161c4ab1929",
|
||||
"+/device/f0e9a01d8b98e820",
|
||||
"+/device/f6c6c5b5dfcc73bb",
|
||||
"+/device/9038222e7fb8789d",
|
||||
"+/device/a707000000000000",
|
||||
"+/device/811b4eb0f8e99c12",
|
||||
"+/device/c2c574a5c691bf69",
|
||||
"+/device/5265899ad223c157",
|
||||
"+/device/517664ba87ac49ec",
|
||||
"+/device/b602b10956119d39",
|
||||
"+/device/4c7dd125b6da91fd",
|
||||
"+/device/581bf6724737da0c",
|
||||
"+/device/8a2396ad453891b1",
|
||||
"+/device/917ca24a9ccdf809",
|
||||
"+/device/a8402702a1d41d88",
|
||||
"+/device/7a5202c7dc74afd6",
|
||||
"+/device/bfe7a19ced50c54d",
|
||||
"+/device/21f835330b485415",
|
||||
"+/device/a978d559eeb0a32e",
|
||||
"+/device/4dddf8b0caae7d8b",
|
||||
"+/device/beff9c2ea2d210c4",
|
||||
"+/device/a5af67550fd4dc50",
|
||||
"+/device/0c3e8eadd58f8a51",
|
||||
"+/device/14ed724c77b73494",
|
||||
"+/device/d12d361c6bfef025",
|
||||
"+/device/781c2bf41a6ffa5a",
|
||||
"+/device/ac10829b20169da0",
|
||||
"+/device/ec939740502f3a66",
|
||||
"+/device/e0c812e00ac4e006",
|
||||
"+/device/0000000000000000",
|
||||
"+/device/5e9b285116453b1a",
|
||||
"+/device/eeb34d0de2b6a953",
|
||||
"+/device/56501a13712f9a6e",
|
||||
"+/device/e8d98e91aaa7b04f",
|
||||
"+/device/6c6978a7fb9a8f6d",
|
||||
"+/device/6803ef0410fb7c02",
|
||||
"+/device/fe828101e353b919",
|
||||
"+/device/42ff4118453e41ca",
|
||||
"+/device/d9f866f14483c92d",
|
||||
"+/device/1deae4a5f1400666",
|
||||
"+/device/a608ea4ffb5221d7",
|
||||
"+/device/bd0ccfe06c1d3596",
|
||||
"+/device/262cdfc279065aa0",
|
||||
"+/device/3df87897c35ae0c5",
|
||||
"+/device/8ca0297304c266b6",
|
||||
"+/device/1200000000000000",
|
||||
"+/device/333470f1dccfb19b",
|
||||
"+/device/02bd28350b1c2619",
|
||||
"+/device/9688431d4f01806e",
|
||||
"+/device/a2f3973e0c3b4835",
|
||||
"+/device/f91779c511763a5b",
|
||||
"+/device/2b8924e509ee8559",
|
||||
"+/device/9e4ee680a26303f7",
|
||||
"+/device/56d9bb7131c724b5",
|
||||
"+/device/9511bebccc477456",
|
||||
"+/device/0a3146610bcc5440",
|
||||
"+/device/e817466c6127ab44",
|
||||
"+/device/99efbb96bc40fd15",
|
||||
"+/device/43687f5b1ebecb64",
|
||||
"+/device/b9e0cdfdd4df7736",
|
||||
"+/device/ed76d5ab39f6c42d",
|
||||
"+/device/63f8d5df0c9d647c",
|
||||
"+/device/98b61a1f166b8419",
|
||||
"+/device/201913c33e0318ee",
|
||||
"+/device/9c74bebb12d05635",
|
||||
"+/device/1f237999be964f42",
|
||||
"+/device/104cebca14ffa98c",
|
||||
"+/device/2d1cab6edbfaeb94",
|
||||
"+/device/c8c30d1decff167d",
|
||||
"+/device/984423fdfda19376",
|
||||
"+/device/18db1248acf66a3e",
|
||||
"+/device/e18710921a53bfff",
|
||||
"+/device/04878a29f87e237d",
|
||||
"+/device/c336512bd77d6cbc",
|
||||
"+/device/01ac2a161029e555",
|
||||
"+/device/4eeccb413407a4e4",
|
||||
"+/device/14e7f5c9b123360d",
|
||||
"+/device/daf25437cbc31a00",
|
||||
"+/device/44dfc09110e1f994",
|
||||
"+/device/2dd522056c132349",
|
||||
"+/device/bd7f78f9d070abe6",
|
||||
"+/device/e932c594ce083810",
|
||||
"+/device/b80c3b7513773c7f",
|
||||
"+/device/7f0d37c30d28ed0f",
|
||||
"+/device/53be81deba3b9c74",
|
||||
"+/device/fe5f56cc9029bf20",
|
||||
"+/device/60723affac3821a5",
|
||||
"+/device/d3e22616db04dc52",
|
||||
"+/device/36c12afabd8fa201",
|
||||
"+/device/71db70b8ce2eb0d1",
|
||||
"+/device/69f319418cfe13a2",
|
||||
"+/device/f043173d1fd8cb0d",
|
||||
"+/device/9b5084678310c4da",
|
||||
"+/device/fa3936fdeb8f8cd1",
|
||||
"+/device/0819c35644808b72",
|
||||
"+/device/40442c5a0a29de37",
|
||||
"+/device/75fa0ee5048bd500",
|
||||
"+/device/39674be356de68ad",
|
||||
"+/device/b490b672a5f76716",
|
||||
"+/device/6a3ba96ed146872b",
|
||||
"+/device/3a785a63862c213d",
|
||||
"+/device/2d29a0fbac938329",
|
||||
"+/device/7d97391a68f8d6af",
|
||||
"+/device/b50a1edd44549876",
|
||||
"+/device/7c31d3c5c077228f",
|
||||
"+/device/99e513be6075f8c6",
|
||||
"+/device/5d4297256f02ebc2",
|
||||
"+/device/67aa37e699e1e08f",
|
||||
"+/device/ea0ebfbfa1487bd2",
|
||||
"+/device/aa8a43d326dddb3f",
|
||||
"+/device/82d40d7dbcfc884e",
|
||||
"+/device/34ee15e05a3133bc",
|
||||
"+/device/ee2508ba91664376",
|
||||
"+/device/48c18f2a756dcc28",
|
||||
"+/device/056d38ac91f61ffd",
|
||||
"+/device/60f2bbbc054bfa03",
|
||||
"+/device/50fdebcf6eb85a49",
|
||||
"+/device/227a752b9bfb6b02",
|
||||
"+/device/d60a05bcd086f160",
|
||||
"+/device/f3c813d5e3d7fd99",
|
||||
"+/device/cd6cb4a64b42bda5",
|
||||
"+/device/436de647bbf01b22",
|
||||
"+/device/e9eee97d793756fa",
|
||||
"+/device/8c062827b5c1548b"
|
||||
"+/device/93372fa4f4c4ebcf",
|
||||
"+/device/5b69426e2ff8e459",
|
||||
"1/device/+"
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -11,9 +11,9 @@ swagger2:
|
||||
|
||||
#mqtt
|
||||
mqtt:
|
||||
url: tcp://123.60.190.77:1883 # hz线上环境MQTT
|
||||
url: tcp://172.31.9.103:1883
|
||||
userName: admin
|
||||
passWord: public
|
||||
passWord: zzkj@688737
|
||||
timeout: 5000
|
||||
keepAlive: 60
|
||||
|
||||
@ -47,11 +47,11 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.236:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: zzkj
|
||||
url: jdbc:mysql://172.31.35.125:3306/business_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: business_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
initialSize: 5
|
||||
@ -63,7 +63,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
@ -76,8 +76,8 @@ spring:
|
||||
minio:
|
||||
accessKey: admin
|
||||
secretKey: zzkj@688737
|
||||
endpoint: http://192.168.0.236:9000
|
||||
prefixUrl: http://192.168.0.236:9000
|
||||
endpoint: http://172.31.35.125:9000
|
||||
prefixUrl: http://172.31.35.125:9000
|
||||
|
||||
#跳过登录:true ,不跳过:false
|
||||
skipLogin: false
|
||||
@ -1,75 +1,75 @@
|
||||
package com.ho.filecenter.config;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ho.filecenter.util.AnotherMqttConfigUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author wp
|
||||
* @desc: Mqtt配置类
|
||||
* @date 2025/06/11
|
||||
*/
|
||||
@Configuration
|
||||
@Data
|
||||
@ConfigurationProperties("mqtt1")
|
||||
@Slf4j
|
||||
public class AnotherMqttConfig {
|
||||
|
||||
//服务器url
|
||||
@Value("${mqtt1.url}")
|
||||
String url;
|
||||
//超时时间
|
||||
@Value("${mqtt1.timeout}")
|
||||
Integer timeout;
|
||||
//会话保持时间
|
||||
@Value("${mqtt1.keepAlive}")
|
||||
Integer keepAlive;
|
||||
|
||||
@Value("${mqtt1.userName}")
|
||||
String userName;
|
||||
|
||||
@Value("${mqtt1.passWord}")
|
||||
String passWord;
|
||||
|
||||
@Autowired
|
||||
AnotherFileEdgeResponseConsumer fileEdgeResponseConsumer;
|
||||
|
||||
//文件响应
|
||||
@Bean(name = "AnotherFileEdgeResponse")
|
||||
public MqttClient initFileResponseClient() {
|
||||
String clientId = IdUtil.simpleUUID();
|
||||
log.info("clientId:" + clientId);
|
||||
MqttClient client =null;
|
||||
try {
|
||||
client = new MqttClient(url, clientId,null);
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(userName);
|
||||
options.setPassword(passWord.toCharArray());
|
||||
options.setCleanSession(true);
|
||||
options.setConnectionTimeout(timeout);
|
||||
options.setKeepAliveInterval(keepAlive);
|
||||
client.setCallback(fileEdgeResponseConsumer);
|
||||
IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
boolean complete = iMqttToken.isComplete();
|
||||
log.info("FileResponseClient建立连接:{}", complete);
|
||||
|
||||
//这里监听的是
|
||||
String[] topic = AnotherMqttConfigUtil.getFileResponseTopic();
|
||||
int[] qos = new int[topic.length];
|
||||
client.subscribe(topic,qos);
|
||||
log.info("已订阅topic:{}", topic);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return client;
|
||||
}
|
||||
}
|
||||
//package com.ho.filecenter.config;
|
||||
//
|
||||
//import cn.hutool.core.util.IdUtil;
|
||||
//import com.ho.filecenter.util.AnotherMqttConfigUtil;
|
||||
//import lombok.Data;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.eclipse.paho.client.mqttv3.IMqttToken;
|
||||
//import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
//import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
///**
|
||||
// * @author wp
|
||||
// * @desc: Mqtt配置类
|
||||
// * @date 2025/06/11
|
||||
// */
|
||||
//@Configuration
|
||||
//@Data
|
||||
//@ConfigurationProperties("mqtt1")
|
||||
//@Slf4j
|
||||
//public class AnotherMqttConfig {
|
||||
//
|
||||
// //服务器url
|
||||
// @Value("${mqtt1.url}")
|
||||
// String url;
|
||||
// //超时时间
|
||||
// @Value("${mqtt1.timeout}")
|
||||
// Integer timeout;
|
||||
// //会话保持时间
|
||||
// @Value("${mqtt1.keepAlive}")
|
||||
// Integer keepAlive;
|
||||
//
|
||||
// @Value("${mqtt1.userName}")
|
||||
// String userName;
|
||||
//
|
||||
// @Value("${mqtt1.passWord}")
|
||||
// String passWord;
|
||||
//
|
||||
// @Autowired
|
||||
// AnotherFileEdgeResponseConsumer fileEdgeResponseConsumer;
|
||||
//
|
||||
// //文件响应
|
||||
// @Bean(name = "AnotherFileEdgeResponse")
|
||||
// public MqttClient initFileResponseClient() {
|
||||
// String clientId = IdUtil.simpleUUID();
|
||||
// log.info("clientId:" + clientId);
|
||||
// MqttClient client =null;
|
||||
// try {
|
||||
// client = new MqttClient(url, clientId,null);
|
||||
// MqttConnectOptions options = new MqttConnectOptions();
|
||||
// options.setUserName(userName);
|
||||
// options.setPassword(passWord.toCharArray());
|
||||
// options.setCleanSession(true);
|
||||
// options.setConnectionTimeout(timeout);
|
||||
// options.setKeepAliveInterval(keepAlive);
|
||||
// client.setCallback(fileEdgeResponseConsumer);
|
||||
// IMqttToken iMqttToken = client.connectWithResult(options);
|
||||
// boolean complete = iMqttToken.isComplete();
|
||||
// log.info("FileResponseClient建立连接:{}", complete);
|
||||
//
|
||||
// //这里监听的是
|
||||
// String[] topic = AnotherMqttConfigUtil.getFileResponseTopic();
|
||||
// int[] qos = new int[topic.length];
|
||||
// client.subscribe(topic,qos);
|
||||
// log.info("已订阅topic:{}", topic);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return client;
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -157,13 +157,13 @@ public class FileController {
|
||||
fileAttributeResp.setList(new ArrayList<>());
|
||||
return DataResult.success(fileAttributeResp);
|
||||
}
|
||||
String serialNo = vo.getSerialNo();
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
// String serialNo = vo.getSerialNo();
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileAttributeResp = fileService.getFileAttribute(vo);
|
||||
}else{
|
||||
fileAttributeResp = anotherFileService.getFileAttribute(vo);
|
||||
}
|
||||
// }else{
|
||||
// fileAttributeResp = anotherFileService.getFileAttribute(vo);
|
||||
// }
|
||||
return DataResult.success(fileAttributeResp);
|
||||
}
|
||||
|
||||
@ -179,13 +179,13 @@ public class FileController {
|
||||
fileDeleteResp.setMsg(msg + CommonConstant.Heartbeat.FAIL);
|
||||
return DataResult.success(fileDeleteResp);
|
||||
}
|
||||
String serialNo = fileDeleteReqVO.getSerialNo();
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
// String serialNo = fileDeleteReqVO.getSerialNo();
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileDeleteResp = fileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||
}else{
|
||||
fileDeleteResp = anotherFileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||
}
|
||||
// }else{
|
||||
// fileDeleteResp = anotherFileService.deleteDeviceFiles(fileDeleteReqVO);
|
||||
// }
|
||||
return DataResult.success(fileDeleteResp);
|
||||
}
|
||||
|
||||
@ -210,12 +210,12 @@ public class FileController {
|
||||
resp.setMsg(CommonConstant.Heartbeat.MSG + serialNo + CommonConstant.Heartbeat.SUCCESS);
|
||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||
log.info("文件上传(向边端上传)开始上传");
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
}else{
|
||||
anotherFileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
}
|
||||
// }else{
|
||||
// anotherFileService.fileUploadForDevice(file, stationId, serialNo, filePath);
|
||||
// }
|
||||
}
|
||||
return DataResult.success(resp);
|
||||
}
|
||||
@ -239,13 +239,13 @@ public class FileController {
|
||||
resp.setHeartbeatStatus(CommonConstant.ONE);
|
||||
log.info("文件下载(从边端下载到云端)开始下载");
|
||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
String serialNo = fileForDeviceReqVO.getSerialNo();
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
// String serialNo = fileForDeviceReqVO.getSerialNo();
|
||||
// List<String> snList = MqttConfigUtil.getSnList();
|
||||
// if(snList.stream().anyMatch(s -> s.contains(serialNo))){
|
||||
fileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
}else{
|
||||
anotherFileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
}
|
||||
// }else{
|
||||
// anotherFileService.downloadFromDevice(fileForDeviceReqVO);
|
||||
// }
|
||||
}
|
||||
return DataResult.success(resp);
|
||||
}
|
||||
|
||||
@ -163,12 +163,7 @@ public class OrderSendController {
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
log.info("指令下发正常开始下发");
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
if(snList.contains(sn)){
|
||||
orderSendService.orderIssued(vo);
|
||||
}else{
|
||||
anotherOrderSendService.orderIssued(vo);
|
||||
}
|
||||
orderSendService.orderIssued(vo);
|
||||
if(vo.getPlanTemId() != null){
|
||||
String hourValue ="";
|
||||
String minuteValue ="";
|
||||
@ -332,14 +327,7 @@ public class OrderSendController {
|
||||
// @LogAnnotation(title = "命令下发曲线", action = "命令下发曲线")
|
||||
@TokenIgnore
|
||||
public DataResult<HeartbeatResp> sendPlanPowerOrder(@RequestBody OrderPlanPowerReq vo) {
|
||||
String sn = vo.getSn();
|
||||
List<String> snList = MqttConfigUtil.getSnList();
|
||||
HeartbeatResp heartbeatResp = null;
|
||||
if(snList.contains(sn)){
|
||||
heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
||||
}else{
|
||||
heartbeatResp = anotherOrderSendService.sendPlanPowerOrder(vo);
|
||||
}
|
||||
HeartbeatResp heartbeatResp = orderSendService.sendPlanPowerOrder(vo);
|
||||
return DataResult.success(heartbeatResp);
|
||||
}
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@ import com.ho.common.tools.entity.MyAddress;
|
||||
import com.ho.common.tools.entity.WeatherRespVo;
|
||||
import com.ho.common.tools.exception.DataResult;
|
||||
import com.ho.common.tools.service.RedisService;
|
||||
import com.ho.common.tools.util.AbroadWeatherUtils;
|
||||
import com.ho.common.tools.util.AddressUntils;
|
||||
import com.ho.common.tools.util.IPUtils;
|
||||
import com.ho.common.tools.util.WeatherUntils;
|
||||
@ -241,7 +242,7 @@ public class WeatherController {
|
||||
continue;
|
||||
}
|
||||
String key = RedisKeyConstant.WEATHER_PROVINCE_CITY + adCode;
|
||||
WeatherRespVo weatherRespVo = WeatherUntils.getWeatherRespVo(station.getAdCode());
|
||||
WeatherRespVo weatherRespVo = AbroadWeatherUtils.getWeatherRespVo(String.valueOf(station.getLatitude()),String.valueOf(station.getLongitude()));
|
||||
weatherRespVo.setUpdateTime(updateTime);
|
||||
redisService.set(key, weatherRespVo);
|
||||
map.put(adCode, adCode);
|
||||
|
||||
@ -6,135 +6,9 @@ import java.util.List;
|
||||
public class MqttConfigUtil {
|
||||
|
||||
public static String[] commonTopic = new String[]{
|
||||
"+/device/fa22fd97b39c04c8",
|
||||
"+/device/803274d9432df350",
|
||||
"+/device/e4067161c4ab1929",
|
||||
"+/device/f0e9a01d8b98e820",
|
||||
"+/device/f6c6c5b5dfcc73bb",
|
||||
"+/device/9038222e7fb8789d",
|
||||
"+/device/a707000000000000",
|
||||
"+/device/811b4eb0f8e99c12",
|
||||
"+/device/c2c574a5c691bf69",
|
||||
"+/device/5265899ad223c157",
|
||||
"+/device/517664ba87ac49ec",
|
||||
"+/device/27d83a2844ff5866",
|
||||
"+/device/77ba753718908d1a",
|
||||
"+/device/b602b10956119d39",
|
||||
"+/device/4c7dd125b6da91fd",
|
||||
"+/device/581bf6724737da0c",
|
||||
"+/device/8a2396ad453891b1",
|
||||
"+/device/917ca24a9ccdf809",
|
||||
"+/device/a8402702a1d41d88",
|
||||
"+/device/7a5202c7dc74afd6",
|
||||
"+/device/bfe7a19ced50c54d",
|
||||
"+/device/21f835330b485415",
|
||||
"+/device/a978d559eeb0a32e",
|
||||
"+/device/4dddf8b0caae7d8b",
|
||||
"+/device/beff9c2ea2d210c4",
|
||||
"+/device/a5af67550fd4dc50",
|
||||
"+/device/0c3e8eadd58f8a51",
|
||||
"+/device/14ed724c77b73494",
|
||||
"+/device/d12d361c6bfef025",
|
||||
"+/device/781c2bf41a6ffa5a",
|
||||
"+/device/ac10829b20169da0",
|
||||
"+/device/ec939740502f3a66",
|
||||
"+/device/e0c812e00ac4e006",
|
||||
"+/device/0000000000000000",
|
||||
"+/device/5e9b285116453b1a",
|
||||
"+/device/eeb34d0de2b6a953",
|
||||
"+/device/56501a13712f9a6e",
|
||||
"+/device/e8d98e91aaa7b04f",
|
||||
"+/device/6c6978a7fb9a8f6d",
|
||||
"+/device/6803ef0410fb7c02",
|
||||
"+/device/fe828101e353b919",
|
||||
"+/device/42ff4118453e41ca",
|
||||
"+/device/d9f866f14483c92d",
|
||||
"+/device/1deae4a5f1400666",
|
||||
"+/device/a608ea4ffb5221d7",
|
||||
"+/device/bd0ccfe06c1d3596",
|
||||
"+/device/262cdfc279065aa0",
|
||||
"+/device/3df87897c35ae0c5",
|
||||
"+/device/8ca0297304c266b6",
|
||||
"+/device/1200000000000000",
|
||||
"+/device/333470f1dccfb19b",
|
||||
"+/device/02bd28350b1c2619",
|
||||
"+/device/9688431d4f01806e",
|
||||
"+/device/a2f3973e0c3b4835",
|
||||
"+/device/f91779c511763a5b",
|
||||
"+/device/2b8924e509ee8559",
|
||||
"+/device/9e4ee680a26303f7",
|
||||
"+/device/56d9bb7131c724b5",
|
||||
"+/device/9511bebccc477456",
|
||||
"+/device/0a3146610bcc5440",
|
||||
"+/device/e817466c6127ab44",
|
||||
"+/device/99efbb96bc40fd15",
|
||||
"+/device/43687f5b1ebecb64",
|
||||
"+/device/b9e0cdfdd4df7736",
|
||||
"+/device/ed76d5ab39f6c42d",
|
||||
"+/device/63f8d5df0c9d647c",
|
||||
"+/device/98b61a1f166b8419",
|
||||
"+/device/201913c33e0318ee",
|
||||
"+/device/9c74bebb12d05635",
|
||||
"+/device/1f237999be964f42",
|
||||
"+/device/104cebca14ffa98c",
|
||||
"+/device/2d1cab6edbfaeb94",
|
||||
"+/device/c8c30d1decff167d",
|
||||
"+/device/984423fdfda19376",
|
||||
"+/device/18db1248acf66a3e",
|
||||
"+/device/e18710921a53bfff",
|
||||
"+/device/04878a29f87e237d",
|
||||
"+/device/c336512bd77d6cbc",
|
||||
"+/device/01ac2a161029e555",
|
||||
"+/device/4eeccb413407a4e4",
|
||||
"+/device/14e7f5c9b123360d",
|
||||
"+/device/daf25437cbc31a00",
|
||||
"+/device/44dfc09110e1f994",
|
||||
"+/device/2dd522056c132349",
|
||||
"+/device/bd7f78f9d070abe6",
|
||||
"+/device/e932c594ce083810",
|
||||
"+/device/b80c3b7513773c7f",
|
||||
"+/device/7f0d37c30d28ed0f",
|
||||
"+/device/53be81deba3b9c74",
|
||||
"+/device/fe5f56cc9029bf20",
|
||||
"+/device/60723affac3821a5",
|
||||
"+/device/d3e22616db04dc52",
|
||||
"+/device/36c12afabd8fa201",
|
||||
"+/device/71db70b8ce2eb0d1",
|
||||
"+/device/69f319418cfe13a2",
|
||||
"+/device/f043173d1fd8cb0d",
|
||||
"+/device/9b5084678310c4da",
|
||||
"+/device/fa3936fdeb8f8cd1",
|
||||
"+/device/0819c35644808b72",
|
||||
"+/device/40442c5a0a29de37",
|
||||
"+/device/75fa0ee5048bd500",
|
||||
"+/device/39674be356de68ad",
|
||||
"+/device/b490b672a5f76716",
|
||||
"+/device/6a3ba96ed146872b",
|
||||
"+/device/3a785a63862c213d",
|
||||
"+/device/2d29a0fbac938329",
|
||||
"+/device/7d97391a68f8d6af",
|
||||
"+/device/b50a1edd44549876",
|
||||
"+/device/7c31d3c5c077228f",
|
||||
"+/device/99e513be6075f8c6",
|
||||
"+/device/5d4297256f02ebc2",
|
||||
"+/device/67aa37e699e1e08f",
|
||||
"+/device/ea0ebfbfa1487bd2",
|
||||
"+/device/aa8a43d326dddb3f",
|
||||
"+/device/82d40d7dbcfc884e",
|
||||
"+/device/34ee15e05a3133bc",
|
||||
"+/device/ee2508ba91664376",
|
||||
"+/device/48c18f2a756dcc28",
|
||||
"+/device/056d38ac91f61ffd",
|
||||
"+/device/60f2bbbc054bfa03",
|
||||
"+/device/50fdebcf6eb85a49",
|
||||
"+/device/227a752b9bfb6b02",
|
||||
"+/device/d60a05bcd086f160",
|
||||
"+/device/f3c813d5e3d7fd99",
|
||||
"+/device/cd6cb4a64b42bda5",
|
||||
"+/device/436de647bbf01b22",
|
||||
"+/device/e9eee97d793756fa",
|
||||
"+/device/8c062827b5c1548b"
|
||||
|
||||
"+/device/93372fa4f4c4ebcf",
|
||||
"+/device/5b69426e2ff8e459",
|
||||
"1/device/+"
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -7,9 +7,9 @@ server:
|
||||
|
||||
#mqtt
|
||||
mqtt:
|
||||
url: tcp://123.60.190.77:1883 # hz线上环境MQTT
|
||||
url: tcp://172.31.9.103:1883
|
||||
userName: admin
|
||||
passWord: public
|
||||
passWord: zzkj@688737
|
||||
timeout: 5000
|
||||
keepAlive: 60
|
||||
|
||||
@ -58,10 +58,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.236:3306/file_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
url: jdbc:mysql://172.31.35.125:3306/file_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
|
||||
username: file_center_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -80,7 +80,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
@ -93,6 +93,6 @@ spring:
|
||||
minio:
|
||||
accessKey: admin
|
||||
secretKey: zzkj@688737
|
||||
endpoint: http://192.168.0.236:9000
|
||||
prefixUrl: http://192.168.0.236:9000
|
||||
endpoint: http://172.31.35.125:9000
|
||||
prefixUrl: http://172.31.35.125:9000
|
||||
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.236:3306/flow_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
url: jdbc:mysql://172.31.35.125:3306/flow_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: flow_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -31,7 +31,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 300000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
@ -11,11 +11,11 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
|
||||
url: jdbc:TAOS-RS://192.168.0.236:6041/test_td_db?user=root&password=taosdata&charset=UTF-8&locale=zh_CN.UTF-8&timezone=UTC-8
|
||||
url: jdbc:TAOS-RS://172.31.35.125:6041/test_td_db?user=root&password=taosdata&charset=UTF-8&locale=zh_CN.UTF-8&timezone=UTC-8
|
||||
username: root
|
||||
password: taosdata
|
||||
druid:
|
||||
@ -29,7 +29,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
|
||||
|
||||
@ -18,10 +18,10 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.0.236:3306/user_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://172.31.35.125:3306/user_center_db?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: user_center_db
|
||||
password: zzkj@688737
|
||||
druid:
|
||||
@ -38,7 +38,7 @@ spring:
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
|
||||
@ -8,7 +8,7 @@ management.health.mail.enabled=false
|
||||
|
||||
spring.application.name=xxl-job-admin
|
||||
###nacos
|
||||
spring.cloud.nacos.discovery.server-addr=192.168.0.142:8848
|
||||
spring.cloud.nacos.discovery.server-addr=172.31.9.103:8848
|
||||
### resources
|
||||
spring.mvc.servlet.load-on-startup=0
|
||||
spring.mvc.static-path-pattern=/static/**
|
||||
@ -26,7 +26,7 @@ mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml
|
||||
#mybatis.type-aliases-package=com.xxl.job.admin.core.model
|
||||
|
||||
### xxl-job, datasource
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.236:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.url=jdbc:mysql://172.31.35.125:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
|
||||
spring.datasource.username=xxl_job
|
||||
spring.datasource.password=zzkj@688737
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<configuration debug="false" scan="true" scanPeriod="1 seconds">
|
||||
|
||||
<contextName>logback</contextName>
|
||||
<property name="log.path" value="/data/applogs/xxl-job/xxl-job-admin.log"/>
|
||||
<property name="log.path" value="/www/zzkjcloud/logs/xxl-job-admin/xxl-job-admin.log"/>
|
||||
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
|
||||
@ -9,12 +9,12 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.0.142:8848
|
||||
server-addr: 172.31.9.103:8848
|
||||
#Redis
|
||||
redis:
|
||||
port: 6379 #端口
|
||||
timeout: 3000ms #连接超时
|
||||
host: 192.168.0.236 #单机
|
||||
host: 172.31.35.125 #单机
|
||||
password: zzkj@688737
|
||||
database: 0
|
||||
lettuce:
|
||||
@ -33,6 +33,6 @@ xxl:
|
||||
address:
|
||||
ip: 127.0.0.1
|
||||
port: 9999
|
||||
logpath: /home/hocloud/logs/xxl-job/
|
||||
logpath: /www/zzkjcloud/logs/xxl-job/
|
||||
logretentiondays: 30
|
||||
|
||||
|
||||
Reference in New Issue
Block a user