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/domain/model/SisAcDevice.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/model/SisAcDevice.java index 22088fbb..4d13565b 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/model/SisAcDevice.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/model/SisAcDevice.java @@ -10,4 +10,44 @@ public class SisAcDevice extends SisDeviceManage { private Long acId; + /** + * 设备通道编号 + */ + private String channelNo; + + /** + * 通道状态.0-离线;1-在线 + */ + private Integer channelState; + + /** + * nvr 设备厂商编号 + */ + private String nvrFactoryNo; + + /** + * nvr设备ip + */ + private String nvrIp; + + /** + * nvr 端口 + */ + private Integer nvrPort; + + /** + * nvr 账号 + */ + private String nvrAccount; + + /** + * nvr 密码 + */ + private String nvrPwd; + + /** + * nvr 通道编号 + */ + private String nvrChannelNo; + } 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/SisAccessControlServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java index 9cbe0b2a..79d435f0 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisAccessControlServiceImpl.java @@ -142,7 +142,6 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { SisAccessControl update = MapstructUtils.convert(bo, SisAccessControl.class); boolean b = baseMapper.updateById(update) > 0; if (bo.getBindDeviceId() != null) { - // 检验设备是否存在 SisDeviceManageVo sisDeviceManageVo = sisDeviceManageService.queryById(bo.getBindDeviceId()); Assert.isTrue(sisDeviceManageVo != null, "设备-{}信息不存在.", bo.getBindDeviceId()); @@ -158,6 +157,9 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { // 重新构建绑定关系 Boolean insert = sisDeviceBindRefService.insert(sisDeviceBindRef); Assert.isTrue(insert, "写入设备关联表失败!"); + } else { + // 删除设备绑定关系 + sisDeviceBindRefService.deleteByBindId(bo.getId()); } if (CollUtil.isNotEmpty(bo.getDevicePoint())) { @@ -178,6 +180,10 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService { // 构建新的关联关系 Boolean b2 = sisAcDeviceRefService.batchInsert(refs); log.info("门禁-监控设备关联关系构建完成, result={}", b2); + } else { + // 删除监控点管理 + Boolean b1 = sisAcDeviceRefService.deleteByAcId(bo.getId()); + log.info("门禁-监控关联关系删除完成, result={}, acId={}", b1, bo.getId()); } return b; } 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-modules/Sis/src/main/resources/mapper/sis/SisAcDeviceRefMapper.xml b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisAcDeviceRefMapper.xml index 9119e40f..d533b0fa 100644 --- a/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisAcDeviceRefMapper.xml +++ b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisAcDeviceRefMapper.xml @@ -7,10 +7,19 @@