diff --git a/.gitea/workflows/master.yml b/.gitea/workflows/master.yml index 52fde7ea..68acf51b 100644 --- a/.gitea/workflows/master.yml +++ b/.gitea/workflows/master.yml @@ -15,7 +15,7 @@ jobs: - name: 拉取代码 uses: http://git.missmoc.top/mocheng/checkout@v4 with: - fetch-depth: 1 + fetch-depth: 0 - name: 使用Maven构建项目 run: | @@ -87,8 +87,8 @@ jobs: echo "===== 清理操作 =====" docker system prune -f echo "===== 所有操作完成 ====" - + - name: 重启服务 run: | kubectl rollout restart deployment sis -n smartparks - kubectl rollout restart deployment property -n smartparks \ No newline at end of file + kubectl rollout restart deployment property -n smartparks diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/config/RocketMQClusterConfig.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/config/RocketMQClusterConfig.java new file mode 100644 index 00000000..3ece5107 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/config/RocketMQClusterConfig.java @@ -0,0 +1,75 @@ +//package org.dromara.sis.config; +// +//import org.apache.rocketmq.client.producer.DefaultMQProducer; +//import org.apache.rocketmq.spring.core.RocketMQTemplate; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.beans.factory.annotation.Value; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +// +///** +// * @author lsm +// * @apiNote RocketMQClusterConfig +// * @since 2025/8/26 +// */ +//@Configuration +//public class RocketMQClusterConfig { +// +// // 从配置文件中读取 cluster 的配置 +// @Value("${rocketmq.cluster1.name-server}") +// private String nameServer1; +// +// @Value("${rocketmq.cluster1.producer.group}") +// private String producerGroup1; +// +// // 为第一个集群创建生产者实例 +// @Bean({"clusterProducerOne"}) +// public DefaultMQProducer clusterProducerOne() throws Exception { +// DefaultMQProducer producer = new DefaultMQProducer(producerGroup1); +// producer.setNamesrvAddr(nameServer1); +// // 设置发送超时时间 +// producer.setSendMsgTimeout(5000); +// // 设置重试次数 +// producer.setRetryTimesWhenSendFailed(2); +// producer.setRetryTimesWhenSendAsyncFailed(2); +// return producer; +// } +// +// // 使用上面的生产者实例创建 RocketMQTemplate +// @Bean("rocketMQTemplateClusterOne") +// public RocketMQTemplate rocketMQTemplateClusterOne(@Qualifier("clusterProducerOne") DefaultMQProducer producer) { +// RocketMQTemplate template = new RocketMQTemplate(); +// template.setProducer(producer); +// return template; +// } +// +// +// // 从配置文件中读取 cluster 的配置 +//// @Value("${rocketmq.cluster2.name-server}") +//// private String nameServer2; +//// +//// @Value("${rocketmq.cluster2.producer.group}") +//// private String producerGroup2; +//// +//// // 为第二个集群创建生产者实例 +//// @Bean({"clusterProducerTwo"}) +//// public DefaultMQProducer clusterProducerTwo() throws Exception { +//// DefaultMQProducer producer = new DefaultMQProducer(producerGroup2); +//// producer.setNamesrvAddr(nameServer2); +//// // 设置发送超时时间 +//// producer.setSendMsgTimeout(5000); +//// // 设置重试次数 +//// producer.setRetryTimesWhenSendFailed(2); +//// producer.setRetryTimesWhenSendAsyncFailed(2); +//// return producer; +//// } +//// +//// // 使用上面的生产者实例创建 RocketMQTemplate +//// @Bean("rocketMQTemplateClusterTwo") +//// public RocketMQTemplate rocketMQTemplateClusterTwo(@Qualifier("clusterProducerTwo") DefaultMQProducer producer) { +//// RocketMQTemplate template = new RocketMQTemplate(); +//// template.setProducer(producer); +//// return template; +//// } +// +//} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/consumer/MeterRecordConsumer.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/consumer/MeterRecordConsumer.java new file mode 100644 index 00000000..3a0a80d0 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/consumer/MeterRecordConsumer.java @@ -0,0 +1,44 @@ +//package org.dromara.sis.rocketmq.consumer; +// +//import lombok.RequiredArgsConstructor; +//import lombok.extern.slf4j.Slf4j; +//import org.apache.rocketmq.common.message.MessageExt; +//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +//import org.apache.rocketmq.spring.core.RocketMQListener; +//import org.dromara.sis.rocketmq.RocketMqConstants; +//import org.dromara.sis.rocketmq.producer.ProducerService; +//import org.springframework.stereotype.Component; +// +///** +// * @author lsm +// * @apiNote MeterRecordConsumer +// * @since 2025/8/25 +// */ +//@Slf4j +//@Component +//@RequiredArgsConstructor +//@RocketMQMessageListener( +// topic = RocketMqConstants.TOPIC, +// consumerGroup = RocketMqConstants.METER_GROUP, +// selectorExpression = RocketMqConstants.METER_RECORD, +// nameServer = "${rocketmq.cluster1.name-server}" +//) +//public class MeterRecordConsumer implements RocketMQListener { +// +// private final ProducerService producerService; +// +// @Override +// public void onMessage(MessageExt ext) { +// try { +// if (ext.getBody() == null) { +// log.info("仪表上报消息数据,不转发!"); +// } else { +// producerService.defaultSend(RocketMqConstants.TOPIC, RocketMqConstants.METER_RECORD, new String(ext.getBody())); +// log.info("转发仪表上报数据处理成功"); +// } +// } catch (Exception e) { +// log.error("转发仪表上报数据处理失败,", e); +// } +// +// } +//} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/producer/ProducerService.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/producer/ProducerService.java new file mode 100644 index 00000000..aa14c739 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/producer/ProducerService.java @@ -0,0 +1,65 @@ +//package org.dromara.sis.rocketmq.producer; +// +//import lombok.extern.slf4j.Slf4j; +//import org.apache.rocketmq.common.message.Message; +//import org.apache.rocketmq.spring.core.RocketMQTemplate; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.beans.factory.annotation.Qualifier; +//import org.springframework.stereotype.Component; +// +///** +// * @author lsm +// * @apiNote ProducerService +// * @since 2025/8/26 +// */ +//@Slf4j +//@Component +//public class ProducerService { +// +// @Autowired +// @Qualifier("rocketMQTemplateClusterOne") +// private RocketMQTemplate rocketMQTemplateClusterOne; +// +//// @Autowired +//// @Qualifier("rocketMQTemplateClusterTwo") +//// private RocketMQTemplate rocketMQTemplateClusterTwo; +// +// /** +// * 向mq写入消息 +// * +// * @param topic 消息topic +// * @param tag 消息tag +// * @param msg 消息 +// */ +// public void defaultSend(String topic, String tag, String msg) { +// try { +// String destination = topic + ":" + tag; +// // 使用 RocketMQTemplate 的同步发送方法 +// rocketMQTemplateClusterOne.syncSend(destination, msg); +// +// log.info("发送RocketMQOne消息成功, nameServer:{}", rocketMQTemplateClusterOne.getProducer().getNamesrvAddr()); +// } catch (Exception e) { +// log.error("发送RocketMQOne消息失败", e); +// } +// } +// +// +// /** +// * 向mq写入消息 +// * +// * @param topic 消息topic +// * @param tag 消息tag +// * @param msg 消息 +// */ +//// public void clusterSend(String topic, String tag, String msg) { +//// try { +//// String destination = topic + ":" + tag; +//// // 使用 RocketMQTemplate 的同步发送方法 +//// rocketMQTemplateClusterTwo.syncSend(destination, msg); +//// +//// log.info("发送RocketMQTwo消息成功, nameServer:{}", rocketMQTemplateClusterTwo.getProducer().getNamesrvAddr()); +//// } catch (Exception e) { +//// log.error("发送RocketMQTwo消息失败", e); +//// } +//// } +//} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/ZeroSensationPassageServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/ZeroSensationPassageServiceImpl.java index 22281ef9..aeb09875 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/ZeroSensationPassageServiceImpl.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/ZeroSensationPassageServiceImpl.java @@ -63,7 +63,7 @@ public class ZeroSensationPassageServiceImpl implements IZeroSensationPassageSer if (result.getCode() != 200) { log.info("华为盒子比对失败,msg={}", result.getMessage()); // 产生告警数据 -// alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "人脸比对失败", smallImg, bigImg); + alarmEventsService.createAlarmRecord(deviceIp, 1, 1, "人脸比对失败", smallImg, bigImg); return; } log.info("人脸比对执行完成,耗时:{}ms", interval.intervalMs()); diff --git a/ruoyi-visual/ruoyi-nacos/src/main/resources/application.properties b/ruoyi-visual/ruoyi-nacos/src/main/resources/application.properties index 4385908f..ef3ece6a 100644 --- a/ruoyi-visual/ruoyi-nacos/src/main/resources/application.properties +++ b/ruoyi-visual/ruoyi-nacos/src/main/resources/application.properties @@ -40,9 +40,9 @@ spring.sql.init.platform=mysql db.num=1 ### Connect URL of DB: -db.url.0=jdbc:mysql://113.249.101.254:18000/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true +db.url.0=jdbc:mysql://10.20.1.65:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true db.user.0=root -db.password.0=by@2025?? +db.password.0=By@2025! ### the maximum retry times for push nacos.config.push.maxRetryTime=50