From 9b96b21235ee41b47bfdeaa745ee2e56a119e09e Mon Sep 17 00:00:00 2001
From: peternameyakj <908253177@qq.com>
Date: Sun, 14 Jul 2024 17:54:42 +0800
Subject: [PATCH] 部分平仓

---
 src/main/java/com/nq/controller/protol/UserController.java |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/nq/controller/protol/UserController.java b/src/main/java/com/nq/controller/protol/UserController.java
index 6c4315c..469ae58 100644
--- a/src/main/java/com/nq/controller/protol/UserController.java
+++ b/src/main/java/com/nq/controller/protol/UserController.java
@@ -23,6 +23,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -60,10 +61,11 @@
     @Autowired
     IUserRechargeService iUserRechargeService;
 
-
-
     @Autowired
     IApplyLeverServices iApplyLeverServices;
+
+    @Autowired
+    private ISiteVipRobService iSiteVipRobService;
 
     private static final ThreadLocal<Boolean> orderCreated = ThreadLocal.withInitial(() -> false);
     private final Lock lock = new ReentrantLock();
@@ -112,6 +114,7 @@
                               @RequestParam("buyNum") Integer buyNum,
                               @RequestParam("buyType") Integer buyType,
                               @RequestParam("lever") Integer lever,
+                              @RequestParam("password") String password,
                               @RequestParam(value = "profitTarget",required = false)
                                   BigDecimal profitTarget,@RequestParam(value = "stopLoss",required = false) BigDecimal stopLoss, HttpServletRequest request) {
         buyLock.lock();
@@ -120,13 +123,23 @@
                 return ServerResponse.createByErrorMsg("当前下单人数过多,请稍后重试", request);
             }
             buyOrderCreated.set(true);
-            return this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopLoss, request);
+            return this.iUserPositionService.buy(stockId, buyNum, buyType, lever,profitTarget,stopLoss, password,request,null);
         } catch (Exception e) {
             return ServerResponse.createByErrorMsg("订单异常,请稍后重试", request);
         }  finally{
             buyLock.unlock();
             buyOrderCreated.set(false);
         }
+    }
+    @GetMapping("checkStockVip.do")
+    @ResponseBody
+    public ServerResponse checkStockVip(@RequestParam("stockId") Integer stockId,
+                                        @RequestParam("buyNum") Integer buyNum,
+                                        @RequestParam("buyType") Integer buyType,
+                                        @RequestParam("lever") Integer lever,
+                                        @RequestParam(value = "profitTarget",required = false) BigDecimal profitTarget,
+                                        @RequestParam(value = "stopLoss",required = false) BigDecimal stopLoss, HttpServletRequest request){
+        return ServerResponse.createBySuccess(iUserPositionService.checkStockVip(stockId,buyNum,buyType,lever,profitTarget,stopLoss,request));
     }
     //修改涨跌板
     @RequestMapping({"updateProfitTarget.do"})
@@ -143,8 +156,8 @@
     //用户平仓操作
     @RequestMapping({"sell.do"})
     @ResponseBody
-    public ServerResponse sell(HttpServletRequest request, @RequestParam("positionSn") String positionSn) {
-            return this.iUserPositionService.sell(positionSn, 1,request);
+    public ServerResponse sell(HttpServletRequest request, @RequestParam("positionSn") String positionSn, @RequestParam("closeNumber") Integer closeNumber) {
+            return this.iUserPositionService.sell(positionSn,closeNumber, 1,request);
     }
 
 

--
Gitblit v1.9.3