diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java index 7d8499be..e0a17b31 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.command.activity.query; +import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.other.app.convertor.user.RankingActivityConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.activity.RankingActivityRecordCO; @@ -14,6 +15,8 @@ import com.red.circle.other.domain.ranking.RankingDimension; import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord; import com.red.circle.other.infra.database.mongo.entity.activity.WeekKingQueenCount; import com.red.circle.other.infra.gateway.RankingActivityGateway; +import com.red.circle.other.inner.endpoint.sys.SysActivityConfigClient; +import com.red.circle.other.inner.model.dto.sys.ActivityConfigDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.num.NumUtils; @@ -42,12 +45,18 @@ public class RankingListQryExe { private final RankingActivityConvertor convertor; private final UserProfileGateway userProfileGateway; private final UserProfileAppConvertor userProfileAppConvertor; + private final SysActivityConfigClient sysActivityConfigClient; public RankingListCO execute(RankingListQueryCmd cmd) { // 获取枚举 RankingActivityType activityType = RankingActivityType.getByCode(cmd.getActivityType()); RankingCycleType cycleType = cmd.getCycleType() != null ? RankingCycleType.getByCode(cmd.getCycleType()) : RankingCycleType.WEEKLY; + ActivityConfigDTO activityConfigDTO = ResponseAssert.requiredSuccess(sysActivityConfigClient.effectiveActivityByTemplate(-1L, activityType.name())); + if (activityConfigDTO != null && cycleType == RankingCycleType.WEEKLY && activityConfigDTO.status() == 2) { + cmd.setCycleKey( ZonedDateTimeAsiaRiyadhUtils.getLastWeekMonday().format(DateTimeFormatter.ofPattern("yyyyMMdd")) ); + } + // 查询排行榜列表 List records = rankingActivityGateway.getRankingList( cmd.getReqSysOrigin().getOrigin(), diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenActivityExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenActivityExe.java index a3d6a3a6..a1db6c98 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenActivityExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenActivityExe.java @@ -43,7 +43,7 @@ public class WeekKingQueenActivityExe { query.setTemplateId(Long.parseLong(templateId)); } - ActivityConfigDTO activityConfigDTO = ResponseAssert.requiredSuccess(sysActivityConfigClient.effectiveActivityConf(query)); + ActivityConfigDTO activityConfigDTO = ResponseAssert.requiredSuccess(sysActivityConfigClient.effectiveActivityByTemplate(query.getTemplateId(), "")); if (activityConfigDTO == null) { return null; diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java index c4e2e2c1..d05c1799 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/sys/impl/ActivityConfigServiceImpl.java @@ -240,9 +240,17 @@ public class ActivityConfigServiceImpl implements ActivityConfigService { } public ActivityConfig getShowcaseActivityConf(Long templateId, String activityType) { + if (activityType.isBlank() && (templateId == null || templateId <= 0)) { + return null; + } + Criteria criteria = Criteria.where("showcase").is(true); - criteria.and("templateId").is(templateId); - criteria.and("activityType").is(activityType); + if (templateId != null && templateId > 0) { + criteria.and("templateId").is(templateId); + } + if (!activityType.isBlank()) { + criteria.and("activityType").is(activityType); + } return mongoTemplate.findOne(Query.query(criteria) .with(Sort.by(Sort.Order.desc("id")))