From 0860b74d966e819d1c9629f872a0e510de2265d3 Mon Sep 17 00:00:00 2001 From: hy001 Date: Fri, 24 Apr 2026 14:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/datav/CountryDashboardServiceImpl.java | 12 ++++++++++++ .../clientobject/datav/CountryDashboardMetricCO.java | 2 ++ 2 files changed, 14 insertions(+) diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java index 615a9dfe..343b0576 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java @@ -7,6 +7,7 @@ import com.red.circle.console.infra.database.rds.dao.datav.CountryDashboardDAO; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardMetricDTO; import com.red.circle.console.infra.database.rds.dto.datav.CountryDashboardUserCountryDTO; import java.math.BigDecimal; +import java.math.RoundingMode; import java.sql.Timestamp; import java.time.DayOfWeek; import java.time.LocalDate; @@ -267,6 +268,7 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { row.setLuckyGiftProfit(safe(row.getLuckyGiftTotalFlow()) .subtract(safe(row.getLuckyGiftPayout())) .subtract(safe(row.getLuckyGiftAnchorShare()))); + row.setLuckyGiftProfitRate(percent(row.getLuckyGiftProfit(), row.getLuckyGiftTotalFlow())); row.setGameProfit(safe(row.getGameTotalFlow()).subtract(safe(row.getGamePayout()))); } @@ -302,6 +304,16 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { return value == null ? BigDecimal.ZERO : value; } + private static BigDecimal percent(BigDecimal numerator, BigDecimal denominator) { + BigDecimal safeDenominator = safe(denominator); + if (BigDecimal.ZERO.compareTo(safeDenominator) == 0) { + return BigDecimal.ZERO; + } + return safe(numerator) + .multiply(BigDecimal.valueOf(100)) + .divide(safeDenominator, 4, RoundingMode.HALF_UP); + } + private static long safeLong(Long value) { return value == null ? 0L : value; } diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java index 101b1cc0..d06df8b5 100644 --- a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clientobject/datav/CountryDashboardMetricCO.java @@ -44,6 +44,8 @@ public class CountryDashboardMetricCO implements Serializable { private BigDecimal luckyGiftProfit = BigDecimal.ZERO; + private BigDecimal luckyGiftProfitRate = BigDecimal.ZERO; + private BigDecimal gameTotalFlow = BigDecimal.ZERO; private BigDecimal gamePayout = BigDecimal.ZERO;