From 07888c58174c6209740c5f3677914f6234e4a3e8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 29 Aug 2020 14:46:08 +0800
Subject: [PATCH] modify

---
 src/main/java/com/xcong/excoin/utils/CalculateUtil.java |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/utils/CalculateUtil.java b/src/main/java/com/xcong/excoin/utils/CalculateUtil.java
index 4aa9299..cbba5f0 100644
--- a/src/main/java/com/xcong/excoin/utils/CalculateUtil.java
+++ b/src/main/java/com/xcong/excoin/utils/CalculateUtil.java
@@ -101,32 +101,37 @@
         if (CollUtil.isNotEmpty(holdOrderEntities)) {
             int maxCnt = 0;
             int subCnt = 0;
+            int index = 0;
             BigDecimal openPrice = BigDecimal.ZERO;
             int type = 1;
             BigDecimal feeAmount = BigDecimal.ZERO;
             BigDecimal sku = BigDecimal.ZERO;
 
             for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
-                if (maxCnt == 0) {
-                    maxCnt = holdOrderEntity.getSymbolCntSale();
-                    subCnt = holdOrderEntity.getSymbolCntSale();
-                    type = holdOrderEntity.getOpeningType();
-                    openPrice = holdOrderEntity.getOpeningPrice();
-                }
-
                 if (holdOrderEntity.getSymbolCntSale() >= maxCnt) {
                     int temp = maxCnt;
                     maxCnt = holdOrderEntity.getSymbolCntSale();
                     subCnt = holdOrderEntity.getSymbolCntSale() - temp;
                     openPrice = holdOrderEntity.getOpeningPrice();
                     type = holdOrderEntity.getOpeningType();
+                    index++;
+                    log.info("--{}, {}, {}, {}, {}", maxCnt, subCnt, openPrice, type, index);
+                }
+
+                if (index == 0) {
+                    index ++;
+                    maxCnt = holdOrderEntity.getSymbolCntSale();
+                    subCnt = holdOrderEntity.getSymbolCntSale();
+                    type = holdOrderEntity.getOpeningType();
+                    openPrice = holdOrderEntity.getOpeningPrice();
+                    log.info("---{}, {}, {}, {}, {}", maxCnt, subCnt, type, openPrice, index);
                 }
                 feeAmount = feeAmount.add(holdOrderEntity.getOpeningFeeAmount());
                 sku = holdOrderEntity.getSymbolSku();
             }
             BigDecimal forceSetPrice = BigDecimal.ZERO;
             if (subCnt != 0) {
-                log.info("{}, {}, {}, {}, {}", openPrice, subCnt, sku, type, maxCnt);
+                log.info("--->{}, {}, {}, {}, {}", openPrice, subCnt, sku, type, maxCnt);
                 forceSetPrice = getForceSetPrice(walletContract.getTotalBalance().subtract(feeAmount), openPrice, subCnt, sku, type, memberEntity);
             }
 

--
Gitblit v1.9.1