From 316b618e24bd87fa6256b19ca343c802b503588b Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Mon, 27 Oct 2025 21:21:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=87=91=E9=A2=9D=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/vo/DistributionCenterTopVO.java | 25 ++++++++++--------- .../impl/MkDistributionUserServiceImpl.java | 25 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/cash-common/cash-common-service/src/main/java/com/czg/market/vo/DistributionCenterTopVO.java b/cash-common/cash-common-service/src/main/java/com/czg/market/vo/DistributionCenterTopVO.java index a0287a99..75f78fbf 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/market/vo/DistributionCenterTopVO.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/market/vo/DistributionCenterTopVO.java @@ -13,28 +13,29 @@ public class DistributionCenterTopVO { /** * 总收益 */ - private String totalIncome; + private Double totalIncome; /** * 待入账 */ - private String pendingIncome; + private Double pendingIncome; /** * 已提现 */ - private String cashOutAmount; + private Double cashOutAmount; - public String getTotalIncome() { - return totalIncome == null ? "0" : totalIncome; - } - public String getPendingIncome() { - return pendingIncome == null ? "0" : pendingIncome; + public Double getTotalIncome() { + return totalIncome == null ? 0.0 : totalIncome; } - public String getCashOutAmount() { - return cashOutAmount == null ? "0" : cashOutAmount; + public Double getPendingIncome() { + return pendingIncome == null ? 0.0 : pendingIncome; } - public String getUnCashOutAmount() { - return new BigDecimal(getTotalIncome()).subtract(new BigDecimal(getPendingIncome())).subtract(new BigDecimal(getCashOutAmount())).toString(); + public Double getCashOutAmount() { + return cashOutAmount == null ? 0.0 : cashOutAmount; + } + + public Double getUnCashOutAmount() { + return getTotalIncome() - getPendingIncome() - getCashOutAmount(); } } diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkDistributionUserServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkDistributionUserServiceImpl.java index 6cf6329e..ad437478 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkDistributionUserServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkDistributionUserServiceImpl.java @@ -92,20 +92,21 @@ public class MkDistributionUserServiceImpl extends ServiceImpl centerUser(Long userId) { -// QueryWrapper totalIncomeSumQueryWrapper = new QueryWrapper(); -// totalIncomeSumQueryWrapper.select("sum(total_income) as totalIncome,sum(pending_income) as pendingIncome,sum(withdrawn_income) as cashOutAmount"); -// totalIncomeSumQueryWrapper.eq(MkDistributionUser::getUserId, userId); -// totalIncomeSumQueryWrapper.eq(MkDistributionUser::getIsDel, 0); -// DistributionCenterTopVO centerTopVO = getObjAs(totalIncomeSumQueryWrapper, DistributionCenterTopVO.class); + DistributionCenterTopVO centerTopVO = null; + try { + QueryWrapper totalIncomeSumQueryWrapper = new QueryWrapper(); + totalIncomeSumQueryWrapper.select("sum(total_income) as totalIncome,sum(pending_income) as pendingIncome,sum(withdrawn_income) as cashOutAmount"); + totalIncomeSumQueryWrapper.eq(MkDistributionUser::getUserId, userId); + totalIncomeSumQueryWrapper.eq(MkDistributionUser::getIsDel, 0); + centerTopVO = getObjAs(totalIncomeSumQueryWrapper, DistributionCenterTopVO.class); + }catch (Exception e){ + log.error("查询用户中心数据失败", e); + } // 封装顶部收益数据 Map result = new HashMap<>(5); -// result.put("totalIncome", centerTopVO == null ? BigDecimal.ZERO : centerTopVO.getTotalIncome()); -// result.put("pendingIncome", centerTopVO == null ? BigDecimal.ZERO : centerTopVO.getPendingIncome()); -// result.put("cashOutAmount", centerTopVO == null ? BigDecimal.ZERO : centerTopVO.getUnCashOutAmount()); - - result.put("totalIncome", 0); - result.put("pendingIncome", 0); - result.put("cashOutAmount", 0); + result.put("totalIncome", centerTopVO == null ? 0.0 : centerTopVO.getTotalIncome()); + result.put("pendingIncome", centerTopVO == null ? 0.0 : centerTopVO.getPendingIncome()); + result.put("cashOutAmount", centerTopVO == null ? 0.0 : centerTopVO.getCashOutAmount()); result.put("activates", activates(userId, 1, 5)); result.put("unActivates", unActivates(userId, 1, 3));