From a66b2a41f265cc9526781e39c1d6c6d5f5d7c013 Mon Sep 17 00:00:00 2001
From: peter <14100000001@qq.com>
Date: Thu, 01 Jan 2026 02:29:08 +0800
Subject: [PATCH] 新增港股

---
 src/main/java/com/nq/service/impl/UserServiceImpl.java |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserServiceImpl.java b/src/main/java/com/nq/service/impl/UserServiceImpl.java
index 5cbab4a..f90f3ef 100644
--- a/src/main/java/com/nq/service/impl/UserServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserServiceImpl.java
@@ -1842,10 +1842,12 @@
 
         PositionVO positionVO = this.iUserPositionService.findUserPositionAllProfitAndLose(user.getId());
         userInfoVO.setAllFreezAmt(positionVO.getAllFreezAmt());
+        userInfoVO.setAllFreezAmtHk(positionVO.getAllFreezAmtHk());
         BigDecimal allProfitAndLose = positionVO.getAllProfitAndLose();
+        BigDecimal allProfitAndLosehk = positionVO.getAllProfitAndLoseHk();
         userInfoVO.setAllProfitAndLose(allProfitAndLose);
+        userInfoVO.setAllProfitAndLoseHk(allProfitAndLosehk);
 
-//        BigDecimal userAllAmt = user.getUserAmt();
         BigDecimal userAllAmt = user.getEnableAmt();
         userAllAmt = userAllAmt.add(allProfitAndLose);
 
@@ -1856,13 +1858,21 @@
 
         BigDecimal historyProfitLoss = new BigDecimal(0);
         BigDecimal buyAmtAutual = new BigDecimal(0);
+        BigDecimal historyProfitLossHk = new BigDecimal(0);
+        BigDecimal buyAmtAutualHk = new BigDecimal(0);
         List<UserPosition> userPositionscc = this.userPositionMapper.findMyPositionByCodeAndSpell(user.getId(), "", "", 0);
 
         if (userPositionscc.size() > 0) {
             for (UserPosition position : userPositionscc) {
-                buyAmtAutual = buyAmtAutual.add(position.getBuyOrderPrice()
-                        .multiply(new BigDecimal(position.getOrderNum()))
-                        .divide(new BigDecimal(position.getOrderLever()), 2, RoundingMode.HALF_UP));
+                if(StockType.HK.getCode().equals(position.getStockType())){
+                    buyAmtAutualHk = buyAmtAutualHk.add(position.getBuyOrderPrice()
+                            .multiply(new BigDecimal(position.getOrderNum()))
+                            .divide(new BigDecimal(position.getOrderLever()), 2, RoundingMode.HALF_UP));
+                }else {
+                    buyAmtAutual = buyAmtAutual.add(position.getBuyOrderPrice()
+                            .multiply(new BigDecimal(position.getOrderNum()))
+                            .divide(new BigDecimal(position.getOrderLever()), 2, RoundingMode.HALF_UP));
+                }
             }
         }
         userInfoVO.setBuyAmtAutual(buyAmtAutual);
@@ -1873,11 +1883,18 @@
 
         if (userPositions.size() > 0) {
             for (UserPosition position : userPositions) {
-                UserPositionVO userPositionVO = assembleUserPositionVO(position);
-                historyProfitLoss = historyProfitLoss.add(userPositionVO.getAllProfitAndLose());
+                if(StockType.HK.getCode().equals(position.getStockType())){
+                    UserPositionVO userPositionVO = assembleUserPositionVO(position);
+                    historyProfitLossHk = historyProfitLossHk.add(userPositionVO.getAllProfitAndLose());
+                }else {
+                    UserPositionVO userPositionVO = assembleUserPositionVO(position);
+                    historyProfitLoss = historyProfitLoss.add(userPositionVO.getAllProfitAndLose());
+                }
+
             }
         }
         userInfoVO.setHistoryProfitLoss(historyProfitLoss);
+        userInfoVO.setHistoryProfitLossHk(historyProfitLossHk);
         userInfoVO.setDjzj(user.getDjzj());
         return userInfoVO;
     }

--
Gitblit v1.9.3