From 4affbdf8938d321c0926bc2b1832dfc81c317ffa Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Thu, 08 Jan 2026 18:49:30 +0800
Subject: [PATCH] ipo

---
 trading-order-service/src/main/java/com/yami/trading/service/ipo/impl/UserPromiseRecordServiceImpl.java |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/trading-order-service/src/main/java/com/yami/trading/service/ipo/impl/UserPromiseRecordServiceImpl.java b/trading-order-service/src/main/java/com/yami/trading/service/ipo/impl/UserPromiseRecordServiceImpl.java
index 16f306b..b308da9 100644
--- a/trading-order-service/src/main/java/com/yami/trading/service/ipo/impl/UserPromiseRecordServiceImpl.java
+++ b/trading-order-service/src/main/java/com/yami/trading/service/ipo/impl/UserPromiseRecordServiceImpl.java
@@ -85,7 +85,7 @@
         if (newSharesConfig==null){
             throw new YamiShopBindException("现股已被删除");
         }
-         applyNewSharesOrderService.updateById(applyNewSharesOrder);
+         //applyNewSharesOrderService.updateById(applyNewSharesOrder);
          List<UserPromiseRecord> userPromiseRecords= findByOrderNo(orderNo);
          for (UserPromiseRecord u:userPromiseRecords){
             if ( u.getStatus()==1){
@@ -96,12 +96,21 @@
              throw new YamiShopBindException("未提交认缴记录");
          }
 
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(userPromiseRecords.get(0).getCreateTime());
-        calendar.add(Calendar.DAY_OF_YEAR,newSharesConfig.getLockDay());
-        if (System.currentTimeMillis() < calendar.getTimeInMillis()){
-               throw new YamiShopBindException("新股锁定中无法卖出");
-        }
+         if (newSharesConfig.getLockDay() > 0) {
+             if (applyNewSharesOrder.getUnLock() == null || applyNewSharesOrder.getUnLock() == 0) {
+                 Calendar calendar = Calendar.getInstance();
+                 calendar.setTime(userPromiseRecords.get(0).getCreateTime());
+                 calendar.add(Calendar.DAY_OF_YEAR,newSharesConfig.getLockDay());
+                 if (System.currentTimeMillis() < calendar.getTimeInMillis()){
+                     throw new YamiShopBindException("新股锁定中无法卖出");
+                 }
+             }
+         } else { //未设置周期 未解锁不能卖出
+             if (applyNewSharesOrder.getUnLock() == null || applyNewSharesOrder.getUnLock() == 0) {
+                 throw new YamiShopBindException("新股锁定中无法卖出");
+             }
+         }
+
          BigDecimal usdt=new BigDecimal("0");
          if (CollectionUtil.isNotEmpty(userPromiseRecords)){
              List<Realtime> realtimes = dataService.realtime(userPromiseRecords.get(0).getProductCode());
@@ -113,6 +122,7 @@
                      throw new YamiShopBindException("现股已卖出");
                  }
                  Realtime realtime= realtimes.get(0);
+                 applyNewSharesOrder.setSellPrice(BigDecimal.valueOf(realtime.getClose()));
                  usdt = userPromiseRecord.getDeductNumber().multiply(BigDecimal.valueOf(realtime.getClose()));
                  userPromiseRecord.setShowFlag(1);
              }
@@ -120,10 +130,12 @@
         else {
              throw new YamiShopBindException("认缴记录不存在!");
          }
+        applyNewSharesOrder.setSell(1);
+        applyNewSharesOrderService.updateById(applyNewSharesOrder);
         updateBatchById(userPromiseRecords);
         walletService.updateMoney("USDT",userId, usdt, BigDecimal.ZERO,
                 Constants.MONEYLOG_CATEGORY_IPO_SEll, Constants.WALLET, Constants.MONEYLOG_CATEGORY_IPO_SEll, applyNewSharesOrder.getSymbolName()+
-                        "新股卖出新增USDT"+usdt.doubleValue());
+                        "新股卖出"+applyNewSharesOrder.getOrderNo() + ":新增USDT" + usdt.doubleValue());
 
 //        BigDecimal initMarketValue = order.getWinningNumber().multiply(order.getSubPrice());
 //        if (CollectionUtil.isNotEmpty(realtimes)) {

--
Gitblit v1.9.3