Compare commits

..

No commits in common. "0960e8f9fbf2654bf9640947bc5a12935a01204e" and "05b2baf32e9d2feda0fc8a9e68d991ae443608bb" have entirely different histories.

17 changed files with 73 additions and 161 deletions

View File

@ -17,11 +17,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -2,7 +2,6 @@ package com.couplet.analyze.msg.model;
import com.couplet.analyze.common.contents.AnalyzeEventContents; import com.couplet.analyze.common.contents.AnalyzeEventContents;
import com.couplet.analyze.common.event.AnalyzeEventCache; import com.couplet.analyze.common.event.AnalyzeEventCache;
import com.couplet.analyze.common.event.AnalyzeEventCache;
import com.couplet.analyze.msg.domain.CoupletMsgData; import com.couplet.analyze.msg.domain.CoupletMsgData;
import com.couplet.analyze.msg.service.IncidentService; import com.couplet.analyze.msg.service.IncidentService;
import com.couplet.common.core.exception.vehicle.VehicleException; import com.couplet.common.core.exception.vehicle.VehicleException;

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -28,6 +28,4 @@ public interface FenAndLogoMapper extends BaseMapper<Fence> {
* @param aLong * @param aLong
*/ */
List<Fence> queryByFenceAndLogoIds(FenceAndLogeRequest aLong); List<Fence> queryByFenceAndLogoIds(FenceAndLogeRequest aLong);
List<Fence> findFencesByLogoId(@Param("logoId") Long logoId);
} }

View File

@ -28,9 +28,4 @@ public interface FenAndLogoService extends IService<Fence> {
*/ */
List<Fence> queryByFenceAndLogoIds(FenceAndLogeRequest request); List<Fence> queryByFenceAndLogoIds(FenceAndLogeRequest request);
/*
* idid
* */
List<Fence> findFencesByLogoId(Long logoId);
} }

View File

@ -47,14 +47,4 @@ public class FenAndLogoServiceImpl extends ServiceImpl<FenAndLogoMapper, Fence>
return fenAndLogoMapper.queryByFenceAndLogoIds(request); return fenAndLogoMapper.queryByFenceAndLogoIds(request);
} }
/*
* id
* */
@Override
public List<Fence> findFencesByLogoId(Long logoId) {
return fenAndLogoMapper.findFencesByLogoId(logoId);
}
} }

View File

@ -11,7 +11,7 @@ import com.couplet.common.domain.request.FenceRequest;
import com.couplet.common.domain.request.FenceUpdateRequest; import com.couplet.common.domain.request.FenceUpdateRequest;
import com.couplet.common.redis.service.RedisService; import com.couplet.common.redis.service.RedisService;
import com.couplet.common.security.utils.SecurityUtils; import com.couplet.common.security.utils.SecurityUtils;
//import com.couplet.mq.remote.RemoteFenceService; import com.couplet.mq.remote.RemoteFenceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -47,8 +47,8 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
/** /**
* *
*/ */
// @Autowired @Autowired
// private RemoteFenceService remoteFenceService; private RemoteFenceService remoteFenceService;
@Override @Override
public List<Fence> pageQuery(FenceConfig fenceConfig) { public List<Fence> pageQuery(FenceConfig fenceConfig) {
@ -67,7 +67,7 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
*/ */
redisTemplate.opsForValue().set("changeFenceStatus", JSON.toJSONString(fenceUpdateRequest), 10, TimeUnit.MINUTES); redisTemplate.opsForValue().set("changeFenceStatus", JSON.toJSONString(fenceUpdateRequest), 10, TimeUnit.MINUTES);
// remoteFenceService.fenceQueue(fenceUpdateRequest); remoteFenceService.fenceQueue(fenceUpdateRequest);
} }
@Override @Override

View File

@ -4,15 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.couplet.business.server.mapper.VehicleMapper; import com.couplet.business.server.mapper.VehicleMapper;
import com.couplet.business.server.service.FenAndLogoService;
import com.couplet.business.server.service.VehicleAndLogoService; import com.couplet.business.server.service.VehicleAndLogoService;
import com.couplet.business.server.service.VehicleService; import com.couplet.business.server.service.VehicleService;
import com.couplet.business.server.service.VehicleTypeService; import com.couplet.business.server.service.VehicleTypeService;
import com.couplet.common.core.domain.Result; import com.couplet.common.core.domain.Result;
import com.couplet.common.core.utils.StringUtils; import com.couplet.common.core.utils.StringUtils;
import com.couplet.common.core.utils.uuid.UUID; import com.couplet.common.core.utils.uuid.UUID;
import com.couplet.common.domain.Fence;
import com.couplet.common.domain.Vehicle; import com.couplet.common.domain.Vehicle;
import com.couplet.common.domain.VehicleMiddle;
import com.couplet.common.domain.VehicleType; import com.couplet.common.domain.VehicleType;
import com.couplet.common.domain.request.VehicleEditParams; import com.couplet.common.domain.request.VehicleEditParams;
import com.couplet.common.domain.request.VehicleInsertParams; import com.couplet.common.domain.request.VehicleInsertParams;
@ -22,11 +21,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* @ProjectName: five-groups-couplet * @ProjectName: five-groups-couplet
@ -56,9 +52,6 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
@Autowired @Autowired
private VehicleAndLogoService vehicleAndLogoService; private VehicleAndLogoService vehicleAndLogoService;
@Autowired
private FenAndLogoService fenAndLogoService;
/* /*
* @Author: LiuYunHu * @Author: LiuYunHu
* @Date: 2024/3/26 22:11 * @Date: 2024/3/26 22:11
@ -126,9 +119,6 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
Result.error(result); Result.error(result);
} }
//刷新set缓存
reCache();
result = "删除成功!"; result = "删除成功!";
return result; return result;
@ -142,7 +132,6 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
* @Return: java.lang.String * @Return: java.lang.String
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class)
public String editById(VehicleEditParams editParams) { public String editById(VehicleEditParams editParams) {
String result = ""; String result = "";
@ -186,8 +175,16 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
vehicleAndLogoService.vehicleBindLogo(editParams.getVehicleId(), editParams.getLogoIds()); vehicleAndLogoService.vehicleBindLogo(editParams.getVehicleId(), editParams.getLogoIds());
//刷新set缓存 // //mq
reCache(); // List<Long> logoList = getBindLogoById(editParams.getVehicleId());
// if (0 != logoList.size()) {
// String ids = "";
// for (Long l : logoList) {
// ids = "," + l;
// }
// ids = ids.substring(1);
// remoteFenceService.vehicleQueue(editParams.getVehicleId() + "-" + ids);
// }
result = "编辑成功!"; result = "编辑成功!";
@ -203,7 +200,6 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
* @Return: java.lang.String * @Return: java.lang.String
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class)
public String insert(VehicleInsertParams insertParams) { public String insert(VehicleInsertParams insertParams) {
String result = ""; String result = "";
@ -258,9 +254,16 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
//执行添加电子围栏 //执行添加电子围栏
int i = vehicleAndLogoService.vehicleBindLogo(vehicle.getVehicleId(), insertParams.getLogoIds()); int i = vehicleAndLogoService.vehicleBindLogo(vehicle.getVehicleId(), insertParams.getLogoIds());
//
//刷新set缓存 // List<Long> logoList = getBindLogoById(vehicle.getVehicleId());
reCache(); // if (0 != logoList.size()) {
// String ids = "";
// for (Long l : logoList) {
// ids = "," + l;
// }
// ids = ids.substring(1);
// remoteFenceService.vehicleQueue(vehicle.getVehicleId() + "-" + ids);
// }
result = "新增成功!"; result = "新增成功!";
@ -301,19 +304,14 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
} }
@Override @Override
public List<Vehicle> vehicleAll() { public List<Vehicle> vehicleAll() {
return vehicleMapper.vehicleAll(); return vehicleMapper.vehicleAll();
} }
/* //通过vin修改车辆上下线的状态
* @Author: LiuYunHu
* @Date: 2024/4/8 14:11
* @Description: vin线
* @Param: [vin, status]
* @Return: java.lang.Integer
**/
@Override @Override
public Integer onOrOutLineByVIN(String vin, int status) { public Integer onOrOutLineByVIN(String vin, int status) {
@ -322,16 +320,9 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
@Override @Override
public Integer addVehicle(Long userId, List<Long> vehicleIds) { public Integer addVehicle(Long userId, List<Long> vehicleIds) {
return vehicleMapper.addVehicle(userId, vehicleIds); return vehicleMapper.addVehicle(userId,vehicleIds);
} }
/*
* @Author: LiuYunHu
* @Date: 2024/4/8 14:11
* @Description: vinplusList
* @Param: [vin]
* @Return: java.util.List<com.couplet.common.domain.Vehicle>
**/
@Override @Override
public List<Vehicle> findByVIN(String vin) { public List<Vehicle> findByVIN(String vin) {
@ -347,31 +338,32 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
} }
/*
* @Author: LiuYunHu @Scheduled(cron = "0/1 * * * * *")
* @Date: 2024/4/8 14:12 public void aa() {
* @Description: 线 System.out.println("********************************************************");
* @Param: [] }
* @Return: void
**/ //判断车辆是否下线
@Scheduled(cron = "0/1 * * * * *") @Scheduled(cron = "0/1 * * * * *")
public void downLine() { public void downLine() {
log.info("定时器启动"); log.info("定时器启动");
//先查询车辆列表 //先查询车辆列表
List<Vehicle> list = this.list(new VehicleListParams(null, null, null, null)); List<Vehicle> list = this.list(new VehicleListParams(null, null, null, null));
list.forEach(vehicle -> { list.forEach(vehicle -> {
try { try {
//只针对已经上线的车辆 //只针对已经上线的车辆
if (redis.hasKey("已上线的车辆vin:" + vehicle.getVin())) { if (redis.hasKey(vehicle.getVin())) {
//如果vin的缓存 时间还剩一秒,则判断为已经下线 //如果vin的缓存 时间还剩一秒,则判断为已经下线
if (redis.getExpire("已上线的车辆vin:" + vehicle.getVin()) <= 3) { if (redis.getExpire(vehicle.getVin()) <= 3) {
log.info(vehicle.getVin() + "的车辆已经下线"); log.info(vehicle.getVin() + "的车辆已经下线");
//执行修改下线状态的方法 //执行修改下线状态的方法
// Integer i = this.onOrOutLineByVIN(vehicle.getVin() + "," + 0); // Integer i = this.onOrOutLineByVIN(vehicle.getVin() + "," + 0);
Integer i = this.onOrOutLineByVIN(vehicle.getVin(), 0); Integer i = this.onOrOutLineByVIN(vehicle.getVin() , 0);
if (0 == i) { if (0 == i) {
log.error("下线状态修改失败"); log.error("下线状态修改失败");
@ -388,47 +380,4 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> impl
} }
/*
* @Author: LiuYunHu
* @Date: 2024/4/8 14:14
* @Description:
* @Param: []
* @Return: void
**/
@Scheduled(cron = "0/3 * * * * *")
public void reCache() {
//刷新缓存执行开始
//先获取所有车辆的信息
List<Vehicle> list = list(new VehicleListParams());
list.forEach(vehicle -> {
//通过车辆的id获取对应的标识集合
List<Long> bindLogoById = getBindLogoById(vehicle.getVehicleId());
//遍历标识集合
bindLogoById.forEach(logoId -> {
//存标识id 的set
HashSet<Long> logos = new HashSet<>();
logos.add(logoId);
//存入redis
redis.setCacheSet("车辆vin和标识:" + vehicle.getVin(), logos);
redis.expire("车辆vin和标识:" + vehicle.getVin(), 2, TimeUnit.MINUTES);
//通过标识id获取标识绑定的电子围栏集合
List<Fence> fences = fenAndLogoService.findFencesByLogoId(logoId);
//遍历电子围栏集合
fences.forEach(fence -> {
HashSet<Fence> fanceSet = new HashSet<>();
fanceSet.add(fence);
//存入redis
redis.setCacheSet("车辆vin和电子围栏:" + vehicle.getVin(), fanceSet);
redis.expire("车辆vin和电子围栏:" + vehicle.getVin(), 2, TimeUnit.MINUTES);
});
});
});
}
} }

View File

@ -10,15 +10,15 @@
<result property="fenceDescription" column="fence_description"/> <result property="fenceDescription" column="fence_description"/>
<result property="fenceLongitudeLatitude" column="fence_longitude_latitude"/> <result property="fenceLongitudeLatitude" column="fence_longitude_latitude"/>
<result property="fenceState" column="fence_state"/> <result property="fenceState" column="fence_state"/>
<result property="createName" column="create_name"/> <result property="createName" column="create_name" />
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time" />
<result property="isDelete" column="is_delete"/> <result property="isDelete" column="is_delete" />
<result property="maintainerName" column="maintainer_name"/> <result property="maintainerName" column="maintainer_name" />
<result property="fenceCondition" column="fence_condition"/> <result property="fenceCondition" column="fence_condition" />
</resultMap> </resultMap>
<resultMap id="logoMap" type="com.couplet.common.domain.Logo"> <resultMap id="logoMap" type="com.couplet.common.domain.Logo">
<id property="logoId" column="logo_id"/> <id property="logoId" column="logo_id"/>
<result property="logoName" column="logo_name"/> <result property="logoName" column="logo_name" />
</resultMap> </resultMap>
<insert id="addBach"> <insert id="addBach">
@ -36,19 +36,11 @@
fence_longitude_latitude, fence_longitude_latitude,
logo_name logo_name
FROM couplet_fences_and_logo a FROM couplet_fences_and_logo a
INNER JOIN couplet_fence_info f on a.fences_id = f.fence_id INNER JOIN couplet_fence_info f on a.fences_id=f.fence_id
INNER JOIN couplet_logo_info l on l.logo_id = a.logo_id INNER JOIN couplet_logo_info l on l.logo_id=a.logo_id
left JOIN couplet_vehicle_and_logo c on l.logo_id = c.logo_id left JOIN couplet_vehicle_and_logo c on l.logo_id=c.logo_id
WHERE l.logo_id = #{logoIds} WHERE l.logo_id=#{logoIds} and c.vehicle_id=#{id}
and c.vehicle_id = #{id}
</select> </select>
<select id="findFencesByLogoId" resultType="com.couplet.common.domain.Fence">
SELECT fi.*
FROM `couplet_fences_and_logo` fal
right JOIN couplet_fence_info fi on fal.fences_id = fi.fence_id
WHERE fal.logo_id = #{logoId}
</select>
</mapper> </mapper>

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -17,11 +17,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置
@ -35,15 +33,15 @@ logging:
com.couplet.system.mapper: DEBUG com.couplet.system.mapper: DEBUG
# 订阅端配置 # 订阅端配置
#mqtt: mqtt:
# server: server:
# broker: tcp://8.130.181.16:1883 broker: tcp://8.130.181.16:1883
## broker: tcp://115.159.47.13:1883 # broker: tcp://115.159.47.13:1883
# username: username:
# password: password:
# clientid: mqttx clientid: mqttx
# qos: 0 qos: 0
# topic: test topic: test
# RabbitMQ配置 # RabbitMQ配置
mq: mq:

View File

@ -11,11 +11,11 @@
<artifactId>couplet-modules-online</artifactId> <artifactId>couplet-modules-online</artifactId>
<!-- <properties>--> <!-- <properties>-->
<!-- <maven.compiler.source>17</maven.compiler.source>--> <!-- <maven.compiler.source>17</maven.compiler.source>-->
<!-- <maven.compiler.target>17</maven.compiler.target>--> <!-- <maven.compiler.target>17</maven.compiler.target>-->
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>--> <!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<!-- </properties>--> <!-- </properties>-->
<description> <description>
couplet-modules-online车辆上线的模块 couplet-modules-online车辆上线的模块
@ -91,7 +91,7 @@
<version>1.2.5</version> <version>1.2.5</version>
</dependency> </dependency>
<!-- 注入车辆服务,调用接口--> <!-- 注入车辆服务,调用接口-->
<dependency> <dependency>
<groupId>com.couplet</groupId> <groupId>com.couplet</groupId>
<artifactId>couplet-common-business</artifactId> <artifactId>couplet-common-business</artifactId>
@ -99,6 +99,10 @@
<!-- Kafka依赖--> <!-- Kafka依赖-->
<!-- <dependency>-->
<!-- <groupId>org.springframework.kafka</groupId>-->
<!-- <artifactId>spring-kafka</artifactId>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>org.apache.kafka</groupId> <groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId> <artifactId>kafka-clients</artifactId>

View File

@ -11,6 +11,7 @@ import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@ -183,7 +184,7 @@ public class MqttMonitor {
//调取接口通过vin查询车辆 //调取接口通过vin查询车辆
List<Vehicle> vehicles = remoteVehicleService.findByVIN(start17).getData(); List<Vehicle> vehicles = remoteVehicleService.findByVIN(start17).getData();
// System.out.println("**************" + vehicles); System.out.println("**************" + vehicles);
//如果不存在这个车 //如果不存在这个车
@ -197,7 +198,7 @@ public class MqttMonitor {
log.info("远程调用查询到的车辆数据:" + vehicle); log.info("远程调用查询到的车辆数据:" + vehicle);
//上线车辆存入redis 6秒 用于判断车辆是否下线,还要写定时器,定时查询 //上线车辆存入redis 6秒 用于判断车辆是否下线,还要写定时器,定时查询
redis.setCacheObject("已上线的车辆vin:"+start17, start17, 6L, TimeUnit.SECONDS); redis.setCacheObject(start17, start17, 6L, TimeUnit.SECONDS);
log.info("vin码为" + start17 + "的车辆属于本系统,允许上线!"); log.info("vin码为" + start17 + "的车辆属于本系统,允许上线!");
@ -206,7 +207,7 @@ public class MqttMonitor {
Integer i = remoteVehicleService.onOrOutLineByVIN(start17 + "," + 1); Integer i = remoteVehicleService.onOrOutLineByVIN(start17 + "," + 1);
//上线成功 //上线成功
if (0 != i) { if (0 != i) {
// log.info("上线成功!"); log.info("上线成功!");
try { try {
produceMessage(message); produceMessage(message);
} catch (Exception e) { } catch (Exception e) {
@ -238,7 +239,7 @@ public class MqttMonitor {
//发送消息 //发送消息
kafkaProducer.send(new ProducerRecord<>(TOPIC_NAME, message)); kafkaProducer.send(new ProducerRecord<>(TOPIC_NAME, message));
// System.out.println("发送消息:" + message); System.out.println("发送消息:" + message);
} catch (Exception e) { } catch (Exception e) {
log.error("消息发送失败:" + e.getMessage()); log.error("消息发送失败:" + e.getMessage());

View File

@ -15,11 +15,9 @@ spring:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 121.89.211.230:8848 server-addr: 121.89.211.230:8848
namespace: 172469
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置