feat: batch query wealthLevel and set to userBaseInfo in pageFreight
This commit is contained in:
parent
a2f94f029c
commit
0dee3e6ca9
@ -11,6 +11,7 @@ import com.red.circle.other.app.dto.clientobject.user.UserFreightBalanceCO;
|
|||||||
import com.red.circle.other.app.service.sys.AppConfigService;
|
import com.red.circle.other.app.service.sys.AppConfigService;
|
||||||
import com.red.circle.other.app.service.user.UserFreightBalanceRestService;
|
import com.red.circle.other.app.service.user.UserFreightBalanceRestService;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
|
import com.red.circle.other.domain.model.user.UserConsumptionLevel;
|
||||||
import com.red.circle.other.domain.model.user.UserProfile;
|
import com.red.circle.other.domain.model.user.UserProfile;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.user.region.SysRegionConfig;
|
import com.red.circle.other.infra.database.mongo.entity.user.region.SysRegionConfig;
|
||||||
import com.red.circle.other.infra.database.mongo.service.user.region.SysRegionConfigService;
|
import com.red.circle.other.infra.database.mongo.service.user.region.SysRegionConfigService;
|
||||||
@ -103,6 +104,8 @@ public class UserFreightBalanceRestServiceImpl implements UserFreightBalanceRest
|
|||||||
Map<Long, UserProfileDTO> userBaseInfoMap = ResponseAssert.requiredSuccess(userProfileClient.mapByUserIds(pagedUserIds));
|
Map<Long, UserProfileDTO> userBaseInfoMap = ResponseAssert.requiredSuccess(userProfileClient.mapByUserIds(pagedUserIds));
|
||||||
Map<Long, Long> transactionCountMap = freightGoldClient.mapTransactionCountByUserIds(pagedUserIds).getBody();
|
Map<Long, Long> transactionCountMap = freightGoldClient.mapTransactionCountByUserIds(pagedUserIds).getBody();
|
||||||
Map<Long, Boolean> followMap = userProfileGateway.mapIsFollow(reqUserId, pagedUserIds);
|
Map<Long, Boolean> followMap = userProfileGateway.mapIsFollow(reqUserId, pagedUserIds);
|
||||||
|
Map<Long, UserConsumptionLevel> consumptionLevelMap = userProfileGateway.getUserConsumptionLevel(
|
||||||
|
appExtCommand.getReqSysOriginPlatformEnum(), pagedUserIds);
|
||||||
|
|
||||||
AppCountryCodeCO appCountryCode = appConfigService.getAppCountryCode();
|
AppCountryCodeCO appCountryCode = appConfigService.getAppCountryCode();
|
||||||
Map<String, String> countryFlagMap = buildCountryFlagMap(appCountryCode);
|
Map<String, String> countryFlagMap = buildCountryFlagMap(appCountryCode);
|
||||||
@ -120,6 +123,14 @@ public class UserFreightBalanceRestServiceImpl implements UserFreightBalanceRest
|
|||||||
co.setIsFollow(Boolean.TRUE.equals(followMap.get(dto.getUserId())));
|
co.setIsFollow(Boolean.TRUE.equals(followMap.get(dto.getUserId())));
|
||||||
co.setUserBaseInfo(userBaseInfoMap.get(dto.getUserId()));
|
co.setUserBaseInfo(userBaseInfoMap.get(dto.getUserId()));
|
||||||
|
|
||||||
|
UserProfileDTO userBaseInfo = co.getUserBaseInfo();
|
||||||
|
if (userBaseInfo != null) {
|
||||||
|
UserConsumptionLevel level = consumptionLevelMap.get(dto.getUserId());
|
||||||
|
if (level != null) {
|
||||||
|
userBaseInfo.setWealthLevel(level.getWealthLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dto.getCreateTime() != null) {
|
if (dto.getCreateTime() != null) {
|
||||||
long days = ChronoUnit.DAYS.between(dto.getCreateTime().toLocalDateTime(), LocalDateTime.now());
|
long days = ChronoUnit.DAYS.between(dto.getCreateTime().toLocalDateTime(), LocalDateTime.now());
|
||||||
co.setBecomeDays((int) days);
|
co.setBecomeDays((int) days);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user