From 6c2ff98b5ea856724c540ebbbf8c5f5269c93728 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 27 Nov 2025 20:14:27 +0800 Subject: [PATCH] =?UTF-8?q?BD=E5=9B=A2=E9=98=9Fmore=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BC=93=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bd/query/BdTeamMemberDetailQryExe.java | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamMemberDetailQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamMemberDetailQryExe.java index c25572aa..a6141a30 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamMemberDetailQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/bd/query/BdTeamMemberDetailQryExe.java @@ -1,10 +1,13 @@ package com.red.circle.other.app.command.bd.query; +import com.alibaba.fastjson.JSON; +import com.red.circle.component.redis.service.RedisService; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.BdIncomeDetailCO; import com.red.circle.other.app.dto.clientobject.BdIncomeDetailMemberCO; import com.red.circle.other.app.dto.clientobject.BdTeamMemberDetailCO; +import com.red.circle.other.app.dto.clientobject.BdTeamOverviewCO; import com.red.circle.other.app.dto.cmd.BdTeamMemberDetailQueryCmd; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.infra.database.mongo.dto.team.TeamBillMemberTarget; @@ -30,6 +33,7 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.*; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; /** @@ -49,6 +53,7 @@ public class BdTeamMemberDetailQryExe { private final UserProfileGateway userProfileGateway; private final UserProfileAppConvertor userProfileAppConvertor; private final TeamProfileService teamProfileService; + private final RedisService redisService; /** * 执行查询 @@ -57,15 +62,29 @@ public class BdTeamMemberDetailQryExe { String type = cmd.getType(); Long targetId = cmd.getTargetId(); - if ("AGENCY".equals(type)) { - // Agency视角:查询单个team的数据 - return queryAgencyDetail(targetId); - } else if ("BD".equals(type)) { - // BD视角:查询该BD下所有team的汇总数据 - return queryBdDetail(targetId); + // 缓存查询 + String cacheKey = "bdteam:detail:" + type + ":" + targetId; + BdTeamMemberDetailCO cached = redisService.getStringToObject(cacheKey, BdTeamMemberDetailCO.class); + if (cached != null) { + return cached; } - return new BdTeamMemberDetailCO(); + // 查询数据 + BdTeamMemberDetailCO result; + if ("AGENCY".equals(type)) { + // Agency视角:查询单个team的数据 + result = queryAgencyDetail(targetId); + } else if ("BD".equals(type)) { + // BD视角:查询该BD下所有team的汇总数据 + result = queryBdDetail(targetId); + } else { + result = new BdTeamMemberDetailCO(); + } + + // 缓存结果(1分钟) + redisService.setString(cacheKey, JSON.toJSONString(result), 1, TimeUnit.MINUTES); + + return result; } /**