Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
# Conflicts: # ruoyi-modules/Sis/src/main/java/org/dromara/sis/config/RocketMQClusterConfig.java # ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/consumer/MeterRecordConsumer.java # ruoyi-modules/Sis/src/main/java/org/dromara/sis/rocketmq/producer/ProducerService.java
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
//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;
|
||||
//// }
|
||||
//
|
||||
//}
|
@@ -42,44 +42,44 @@ public class SisVisitorController {
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AccessRecordFindRes> list(QueryDto dto) {
|
||||
|
||||
// TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
// List<AccessRecordFindRes> accessRecordFindResList = new ArrayList<>();
|
||||
// AccessRecordFindRes accessRecordFindRes = new AccessRecordFindRes();
|
||||
// accessRecordFindRes.setDeviceName("4#岗亭09");
|
||||
// accessRecordFindRes.setDoorName("4#岗亭09");
|
||||
// accessRecordFindRes.setDeviceType(1102);
|
||||
// accessRecordFindRes.setReaderName("");
|
||||
// accessRecordFindRes.setGatewayType(1);
|
||||
// accessRecordFindRes.setCustomerName("德隆吴鹏");
|
||||
// accessRecordFindRes.setOrganFullPath("主楼11楼");
|
||||
// accessRecordFindRes.setPictureUrl("https://bpic.588ku.com/back_list_pic/23/04/21/ef5e2a3dd5cfc336fdcf2fd000474f0f.jpg");
|
||||
// accessRecordFindRes.setCardType(34);
|
||||
// accessRecordFindRes.setRecordType(2);
|
||||
// accessRecordFindRes.setActionTime(new Date());
|
||||
// accessRecordFindResList.add(accessRecordFindRes);
|
||||
// tableDataInfo.setRows(accessRecordFindResList);
|
||||
// tableDataInfo.setTotal(1);
|
||||
// tableDataInfo.setCode(200);
|
||||
// return tableDataInfo;
|
||||
|
||||
dto.setPageIndex(1);
|
||||
dto.setMaxResultCount(20);
|
||||
|
||||
// 10秒内
|
||||
String starTime = DateUtil.format(DateUtil.offset(new Date(), DateField.SECOND, -10), "yyyy-MM-dd HH:mm:ss");
|
||||
String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
AccessRecordFindReq lift = new AccessRecordFindReq();
|
||||
lift.setStartTime(starTime);
|
||||
lift.setEndTime(endTime);
|
||||
lift.setRecordType(2);
|
||||
// 9号电梯
|
||||
lift.setDeviceId(550757939925061L);
|
||||
dto.setQueryDto(lift);
|
||||
// TableDataInfo<AccessRecordFindRes> nineLiftList = e8PlatformApi.getPageAccessRecordList(dto);
|
||||
TableDataInfo<AccessRecordFindRes> pageAccessRecordList = new TableDataInfo();
|
||||
|
||||
return e8PlatformApi.getPageAccessRecordList(dto);
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
List<AccessRecordFindRes> accessRecordFindResList = new ArrayList<>();
|
||||
AccessRecordFindRes accessRecordFindRes = new AccessRecordFindRes();
|
||||
accessRecordFindRes.setDeviceName("4#岗亭09");
|
||||
accessRecordFindRes.setDoorName("4#岗亭09");
|
||||
accessRecordFindRes.setDeviceType(1102);
|
||||
accessRecordFindRes.setReaderName("");
|
||||
accessRecordFindRes.setGatewayType(1);
|
||||
accessRecordFindRes.setCustomerName("德隆吴鹏");
|
||||
accessRecordFindRes.setOrganFullPath("主楼11楼");
|
||||
accessRecordFindRes.setPictureUrl("https://bpic.588ku.com/back_list_pic/23/04/21/ef5e2a3dd5cfc336fdcf2fd000474f0f.jpg");
|
||||
accessRecordFindRes.setCardType(34);
|
||||
accessRecordFindRes.setRecordType(2);
|
||||
accessRecordFindRes.setActionTime(new Date());
|
||||
accessRecordFindResList.add(accessRecordFindRes);
|
||||
tableDataInfo.setRows(accessRecordFindResList);
|
||||
tableDataInfo.setTotal(1);
|
||||
tableDataInfo.setCode(200);
|
||||
return tableDataInfo;
|
||||
//
|
||||
// dto.setPageIndex(1);
|
||||
// dto.setMaxResultCount(20);
|
||||
//
|
||||
// // 10秒内
|
||||
// String starTime = DateUtil.format(DateUtil.offset(new Date(), DateField.SECOND, -10), "yyyy-MM-dd HH:mm:ss");
|
||||
// String endTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
//
|
||||
// AccessRecordFindReq lift = new AccessRecordFindReq();
|
||||
// lift.setStartTime(starTime);
|
||||
// lift.setEndTime(endTime);
|
||||
// lift.setRecordType(2);
|
||||
// // 9号电梯
|
||||
// lift.setDeviceId(550757939925061L);
|
||||
// dto.setQueryDto(lift);
|
||||
//// TableDataInfo<AccessRecordFindRes> nineLiftList = e8PlatformApi.getPageAccessRecordList(dto);
|
||||
// TableDataInfo<AccessRecordFindRes> pageAccessRecordList = new TableDataInfo();
|
||||
//
|
||||
// return e8PlatformApi.getPageAccessRecordList(dto);
|
||||
//如果pageAccessRecordList报错就捕获并封装
|
||||
}
|
||||
}
|
||||
|
@@ -1,44 +0,0 @@
|
||||
//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<MessageExt> {
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
@@ -1,65 +0,0 @@
|
||||
//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);
|
||||
//// }
|
||||
//// }
|
||||
//}
|
Reference in New Issue
Block a user