火箭消息处理
This commit is contained in:
parent
5fa644d9f3
commit
c76526d3c0
@ -30,6 +30,11 @@ public enum OfflineStatisticsGiftEventType {
|
||||
/**
|
||||
* 钻石统计.
|
||||
*/
|
||||
DIAMOND_COUNT
|
||||
DIAMOND_COUNT,
|
||||
|
||||
/**
|
||||
* 火箭统计
|
||||
*/
|
||||
ROCKET_COUNT,
|
||||
|
||||
}
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
package com.red.circle.other.app.listener;
|
||||
|
||||
import com.red.circle.other.app.dto.cmd.RocketEnergyAddCmd;
|
||||
import com.red.circle.other.app.service.RocketService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 礼物送出事件监听器 - 触发火箭能量增加
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-01-15
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class GiftSendRocketListener {
|
||||
|
||||
private final RocketService rocketService;
|
||||
|
||||
/**
|
||||
* 监听礼物送出事件
|
||||
* 注意:需要项目中实际的GiftSendEvent类,这里使用占位符
|
||||
*/
|
||||
// @Async("rocketExecutor")
|
||||
// @EventListener
|
||||
public void onGiftSend(Object event) {
|
||||
// TODO: 替换为实际的GiftSendEvent类型
|
||||
// 示例代码,需要根据实际事件结构调整
|
||||
|
||||
/*
|
||||
try {
|
||||
// 1. 从事件中提取数据
|
||||
Long roomId = event.getRoomId();
|
||||
Long userId = event.getUserId();
|
||||
Long giftGoldValue = event.getGiftGoldValue();
|
||||
Boolean isLucky = event.getIsLuckyGift();
|
||||
String giftOrderId = event.getGiftOrderId();
|
||||
|
||||
// 2. 构建命令
|
||||
RocketEnergyAddCmd cmd = new RocketEnergyAddCmd();
|
||||
cmd.setRoomId(roomId);
|
||||
cmd.setUserId(userId);
|
||||
cmd.setGiftGoldValue(giftGoldValue);
|
||||
cmd.setIsLucky(isLucky != null && isLucky);
|
||||
cmd.setBizNo("GIFT_" + giftOrderId);
|
||||
|
||||
// 3. 执行能量增加
|
||||
rocketService.addEnergy(cmd);
|
||||
|
||||
log.info("礼物事件触发火箭能量增加成功: roomId={}, userId={}, energy={}",
|
||||
roomId, userId, giftGoldValue);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("礼物事件触发火箭能量增加失败", e);
|
||||
}
|
||||
*/
|
||||
|
||||
log.warn("GiftSendRocketListener: 需要接入实际的礼物送出事件");
|
||||
}
|
||||
|
||||
/**
|
||||
* 说明:
|
||||
* 1. 需要在项目中找到实际的礼物送出事件类(可能在live-service或other-service中)
|
||||
* 2. 替换方法参数中的 Object 为实际的事件类型
|
||||
* 3. 根据实际事件结构提取 roomId、userId、giftGoldValue 等字段
|
||||
* 4. 确保事件中包含 isLuckyGift 字段或通过其他方式判断是否幸运礼物
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.red.circle.other.app.listener.gift.strategy;
|
||||
|
||||
import com.red.circle.mq.business.model.event.gift.OfflineProcessGiftEvent;
|
||||
import com.red.circle.other.app.service.RocketService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 火箭统计相关
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-01-15
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("ROCKET_COUNT_LISTENER")
|
||||
@RequiredArgsConstructor
|
||||
public class GiftSendRocketListener implements GiftStrategy {
|
||||
|
||||
private final RocketService rocketService;
|
||||
|
||||
|
||||
@Override
|
||||
public void processor(OfflineProcessGiftEvent event) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,7 +1,16 @@
|
||||
package com.red.circle.other.app.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||
import com.red.circle.external.inner.endpoint.message.ImGroupClient;
|
||||
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
|
||||
import com.red.circle.external.inner.model.cmd.message.BroadcastGroupMsgBodyCmd;
|
||||
import com.red.circle.external.inner.model.cmd.message.CustomGroupMsgBodyCmd;
|
||||
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd;
|
||||
import com.red.circle.external.inner.model.enums.message.GroupMessageTypeEnum;
|
||||
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
||||
import com.red.circle.other.app.dto.clientobject.RocketStatusCO;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -17,8 +26,7 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class RocketImPushManager {
|
||||
|
||||
// TODO: 注入实际的IM推送服务
|
||||
// private final ImPushService imPushService;
|
||||
private final ImGroupClient imGroupClient;
|
||||
|
||||
/**
|
||||
* 推送能量更新消息
|
||||
@ -28,8 +36,11 @@ public class RocketImPushManager {
|
||||
// 构建消息
|
||||
ImMessage message = buildEnergyUpdateMessage(status);
|
||||
|
||||
// TODO: 调用实际的IM推送服务
|
||||
// imPushService.pushToRoom(roomId, message);
|
||||
imGroupClient.sendCustomMessage(String.valueOf(roomId),
|
||||
CustomGroupMsgBodyCmd.builder()
|
||||
.type(GroupMessageTypeEnum.GAME_LUCKY_GIFT)
|
||||
.data(message)
|
||||
.build());
|
||||
|
||||
log.info("推送火箭能量更新消息成功: roomId={}, level={}, energy={}/{}",
|
||||
roomId, status.getLevel(), status.getCurrentEnergy(), status.getMaxEnergy());
|
||||
@ -47,8 +58,13 @@ public class RocketImPushManager {
|
||||
// 构建消息
|
||||
ImMessage message = buildLaunchMessage(status);
|
||||
|
||||
// TODO: 调用实际的IM推送服务
|
||||
// imPushService.pushToRoom(roomId, message);
|
||||
imGroupClient.sendMessageBroadcast(
|
||||
BroadcastGroupMsgBodyCmd.builder()
|
||||
.toPlatform(SysOriginPlatformEnum.LIKEI)
|
||||
.type(GroupMessageTypeEnum.GAME_LUCKY_GIFT)
|
||||
.data(message)
|
||||
.build()
|
||||
);
|
||||
|
||||
log.info("推送火箭发射消息成功: roomId={}, level={}", roomId, status.getLevel());
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ public class UserDataViolationTest {
|
||||
@Test
|
||||
public void batchBanUsers() {
|
||||
// TODO: 修改为你实际的文件路径
|
||||
String inputFilePath = "C:\\Users\\Administrator\\Documents\\DataGripSql\\11.11同设备指纹用户统计英文版 - 副本.xlsx";
|
||||
String inputFilePath = "C:\\Users\\Administrator\\Documents\\DataGripSql\\11.11同设备指纹用户统计英文版.xlsx";
|
||||
String outputFilePath = "D:\\ban_results_" + System.currentTimeMillis() + ".xlsx";
|
||||
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user