排行榜金额字段格式化

This commit is contained in:
tianfeng 2025-12-04 10:46:27 +08:00
parent fe55cdb0c7
commit 0a3e88dc08
5 changed files with 12 additions and 11 deletions

View File

@ -16,6 +16,7 @@ import com.red.circle.other.infra.database.mongo.entity.activity.WeekKingQueenCo
import com.red.circle.other.infra.gateway.RankingActivityGateway;
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;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -141,7 +142,7 @@ public class RankingListQryExe {
} else {
// 用户不在榜单中显示为0
rankInfo.setRank(0);
rankInfo.setQuantity(0L);
rankInfo.setQuantity("0");
rankInfo.setIsRanked(false);
}
@ -152,7 +153,7 @@ public class RankingListQryExe {
cmd.getCycleKey()
);
userRecord.ifPresent(rankingActivityRecord -> rankInfo.setQuantity(rankingActivityRecord.getQuantity()));
userRecord.ifPresent(rankingActivityRecord -> rankInfo.setQuantity(NumUtils.formatLong(rankingActivityRecord.getQuantity())));
return rankInfo;
@ -184,7 +185,7 @@ public class RankingListQryExe {
UserRankInfoCO rankInfo = new UserRankInfoCO();
rankInfo.setUserId(cmd.getReqUserId());
rankInfo.setRank(0);
rankInfo.setQuantity(0L);
rankInfo.setQuantity("0");
rankInfo.setIsRanked(false);
return rankInfo;
}
@ -204,7 +205,7 @@ public class RankingListQryExe {
UserRankInfoCO rankInfo = new UserRankInfoCO();
rankInfo.setUserId(record.getUserId());
rankInfo.setRank(rank);
rankInfo.setQuantity(record.getQuantity());
rankInfo.setQuantity(NumUtils.formatLong(record.getQuantity()));
rankInfo.setIsRanked(rank <= cmd.getTopN());
return rankInfo;

View File

@ -6,6 +6,7 @@ import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivity
import com.red.circle.other.infra.gateway.RankingActivityGateway;
import com.red.circle.other.domain.ranking.RankingActivityType;
import com.red.circle.other.domain.ranking.RankingCycleType;
import com.red.circle.tool.core.num.NumUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -43,7 +44,7 @@ public class UserRankQryExe {
if (userRecord.isEmpty()) {
// 用户未参与
rankInfo.setRank(0);
rankInfo.setQuantity(0L);
rankInfo.setQuantity("0");
rankInfo.setIsRanked(false);
return rankInfo;
}
@ -61,7 +62,7 @@ public class UserRankQryExe {
);
rankInfo.setRank(rank);
rankInfo.setQuantity(record.getQuantity());
rankInfo.setQuantity(NumUtils.formatLong(record.getQuantity()));
rankInfo.setIsRanked(rank > 0);
return rankInfo;

View File

@ -2,6 +2,7 @@ package com.red.circle.other.app.convertor.user;
import com.red.circle.other.app.dto.clientobject.activity.RankingActivityRecordCO;
import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord;
import com.red.circle.tool.core.num.NumUtils;
import org.springframework.stereotype.Component;
/**
@ -21,7 +22,7 @@ public class RankingActivityConvertor {
RankingActivityRecordCO co = new RankingActivityRecordCO();
co.setUserId(record.getUserId());
co.setUserSex(record.getUserSex());
co.setQuantity(record.getQuantity());
co.setQuantity(NumUtils.formatLong(record.getQuantity()));
co.setExtData(record.getExtData());
// 设置活动类型信息

View File

@ -50,8 +50,7 @@ public class RankingActivityRecordCO implements Serializable {
/**
* 统计数值
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long quantity;
private String quantity;
/**
* 活动类型编码

View File

@ -44,8 +44,7 @@ public class UserRankInfoCO implements Serializable {
/**
* 统计数值
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long quantity;
private String quantity;
/**
* 是否已上榜