国王皇后增加模板id, 消息修复

This commit is contained in:
tianfeng 2025-11-05 20:03:14 +08:00
parent 89fd614569
commit 607ac75210
9 changed files with 39 additions and 38 deletions

View File

@ -36,4 +36,6 @@ public enum GiftSpecialEnum {
* svip礼物.
*/
SVIP_GIFT
}

View File

@ -118,8 +118,8 @@ public class WeekKingQueenController extends BaseController {
* 获取有效活动
*/
@GetMapping("/effective")
public ActivityConfigVO getEffective(@Validated AppExtCommand cmd) {
return weekKingQueenService.getEffectiveActivity(cmd);
public ActivityConfigVO getEffective(AppExtCommand cmd, @RequestParam(required = false) String templateId) {
return weekKingQueenService.getEffectiveActivity(cmd, templateId);
}
/**

View File

@ -36,9 +36,13 @@ public class WeekKingQueenActivityExe {
private final BadgeSourceClient badgeSourceClient;
private final PropsActivityRewardConfigClient propsActivityRewardConfigClient;
public ActivityConfigVO getEffectiveActivity(AppExtCommand cmd) {
public ActivityConfigVO getEffectiveActivity(AppExtCommand cmd, String templateId) {
ActivityConfigBackQryCmd query = new ActivityConfigBackQryCmd();
query.setSysOrigin(cmd.getReqSysOrigin().getOrigin());
if (StringUtils.isNotBlank(templateId)) {
query.setTemplateId(Long.parseLong(templateId));
}
ActivityConfigDTO activityConfigDTO = ResponseAssert.requiredSuccess(sysActivityConfigClient.effectiveActivityConf(query));
if (activityConfigDTO == null) {

View File

@ -157,27 +157,15 @@ public class PropCouponGrantCmdExe {
* 发送单个通知
*/
private void sendNotification(PropCoupon propCoupon, UserProfileDTO user, PropCouponType couponType) {
officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder()
.toAccount(user.getId())
.noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
.content(String.format("You have received a %s ticket", couponType.name()))
.expand(buildNotificationData(propCoupon))
.build()
);
officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder()
.toAccount(user.getId())
.noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
.content("You have received a Coupon. Please check it.")
.build()
);
log.info("发送道具券赠送通知, userId:{}, couponNo:{}, couponType:{}",
user.getId(), propCoupon.getCouponNo(), couponType.getDesc());
}
/**
* 构建通知数据
*/
private String buildNotificationData(PropCoupon propCoupon) {
return String.format("couponNo=%s&couponType=%s&propName=%s&validDays=%d",
propCoupon.getCouponNo(),
propCoupon.getCouponType().getDesc(),
propCoupon.getPropName(),
propCoupon.getValidDays());
log.info("发送道具券赠送通知, receiverId:{}, couponNo:{}, couponType:{}",
user.getId(), propCoupon.getCouponNo(), propCoupon.getCouponType().getDesc());
}
}

View File

@ -1,5 +1,8 @@
package com.red.circle.other.app.command.propcoupon;
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateCustomizeCmd;
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.other.app.dto.cmd.PropCouponSendCmd;
import com.red.circle.other.domain.gateway.PropCouponGateway;
@ -33,6 +36,7 @@ public class PropCouponSendCmdExe {
private final PropCouponGateway propCouponGateway;
private final UserProfileClient userProfileClient;
private final PropCouponUseRecordDAO propCouponUseRecordDAO;
private final OfficialNoticeClient officialNoticeClient;
/**
* 执行赠送道具券
@ -123,16 +127,14 @@ public class PropCouponSendCmdExe {
* 发送系统消息通知接收人
*/
private void sendNotification(PropCoupon propCoupon, UserProfileDTO receiver) {
// TODO: 发送系统通知
// 示例代码需要根据实际项目调整:
// officialNoticeClient.send(
// NoticeExtTemplateCustomizeCmd.builder()
// .toAccount(receiver.getId())
// .noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
// .content("您收到了一张" + propCoupon.getCouponType().getDesc() + "道具券")
// .expand(buildNotificationData(propCoupon))
// .build()
// );
officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder()
.toAccount(receiver.getId())
.noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
.content("You have received a Coupon. Please check it.")
.expand(buildNotificationData(propCoupon))
.build()
);
log.info("发送道具券赠送通知, receiverId:{}, couponNo:{}, couponType:{}",
receiver.getId(), propCoupon.getCouponNo(), propCoupon.getCouponType().getDesc());

View File

@ -36,7 +36,7 @@ import java.util.Objects;
* @author pengliang on 2022/7/26
*/
@Slf4j
@Service("DIAMOND_COUNT_LISTENER")
//@Service("DIAMOND_COUNT_LISTENER")
@RequiredArgsConstructor
public class DiamondCountStrategy implements GiftStrategy {
@ -53,6 +53,7 @@ public class DiamondCountStrategy implements GiftStrategy {
@Override
public void processor(OfflineProcessGiftEvent event) {
log.warn("【钻石统计】入参---{}", JSON.toJSONString(event));
GiftGiveRunningWater runningWater = null;
try {
runningWater = giftGiveRunningWaterService.getByIdPrimary(event.getRunningWaterId());

View File

@ -33,8 +33,8 @@ public class WeekKingQueenServiceImpl implements WeekKingQueenService {
}
@Override
public ActivityConfigVO getEffectiveActivity(AppExtCommand cmd) {
return weekKingQueenActivityExe.getEffectiveActivity(cmd);
public ActivityConfigVO getEffectiveActivity(AppExtCommand cmd, String templateId) {
return weekKingQueenActivityExe.getEffectiveActivity(cmd, templateId);
}
@Override

View File

@ -19,7 +19,7 @@ public interface WeekKingQueenService {
PageResult<UserRankCO> listRanking(WeekKingQueenRankingQueryCmd cmd);
ActivityConfigVO getEffectiveActivity(AppExtCommand cmd);
ActivityConfigVO getEffectiveActivity(AppExtCommand cmd, String templateId);
String countDown();

View File

@ -225,7 +225,11 @@ public class ActivityConfigServiceImpl implements ActivityConfigService {
@Override
public ActivityConfig getEffectiveActivityConf(ActivityConfigBackQryCmd query) {
Criteria criteria = Criteria.where("sysOrigin").is(query.getSysOrigin());
criteria.and("showcase").is(true);
criteria.and("endTime").gt(TimestampUtils.now());
if (query.getTemplateId() != null) {
criteria.and("templateId").is(query.getTemplateId());
}
return mongoTemplate.findOne(Query.query(criteria)
.with(Sort.by(Sort.Order.desc("id")))