From 3a35e98f09c9320f8e1586d091b1c80c6c505610 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Thu, 12 Mar 2026 16:41:04 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/service/impl/UserServiceImpl.java | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/UserServiceImpl.java b/src/main/java/com/nq/service/impl/UserServiceImpl.java
index b647890..5950649 100644
--- a/src/main/java/com/nq/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -1831,11 +1831,23 @@
userInfoVO.setAllFreezAmt(positionVO.getAllFreezAmt());
BigDecimal allProfitAndLose = positionVO.getAllProfitAndLose();
BigDecimal profitAndLose = this.userPositionMapper.CountPositionAllProfitAndLoseByUserId(user.getId());
- userInfoVO.setAllProfitAndLose(allProfitAndLose.add(profitAndLose));
-
-// BigDecimal userAllAmt = user.getUserAmt();
BigDecimal userAllAmt = user.getEnableAmt();
- userAllAmt = userAllAmt.add(allProfitAndLose);
+
+
+ // 初始化总盈亏为0
+ BigDecimal totalProfitAndLose = BigDecimal.ZERO;
+
+ // 累加各个盈亏(安全处理null值)
+ if (allProfitAndLose != null) {
+ totalProfitAndLose = totalProfitAndLose.add(allProfitAndLose);
+ }
+ if (profitAndLose != null) {
+ totalProfitAndLose = totalProfitAndLose.add(profitAndLose);
+ }
+ userInfoVO.setAllProfitAndLose(totalProfitAndLose);
+ if(null != allProfitAndLose){
+ userAllAmt = userAllAmt.add(allProfitAndLose);
+ }
userInfoVO.setEnableIndexAmt(user.getEnableIndexAmt());
--
Gitblit v1.9.3