From e32adda91bdd41ac8f5cb9e1f7377e5f72f29886 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Wed, 18 Sep 2024 18:28:06 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java |   19 +
 src/main/resources/mapper/UserPositionMapper.xml                     |  110 +--------
 src/main/java/com/nq/service/impl/StockDzServiceImpl.java            |    9 
 src/main/java/com/nq/dao/UserPositionMapper.java                     |    2 
 src/main/java/com/nq/pojo/StockSubscribe.java                        |    4 
 src/main/java/com/nq/pojo/UserPosition.java                          |  467 ------------------------------------------
 src/main/java/com/nq/service/impl/UserPositionServiceImpl.java       |    9 
 src/main/java/com/nq/controller/UserPositionCheckDzController.java   |    1 
 8 files changed, 50 insertions(+), 571 deletions(-)

diff --git a/src/main/java/com/nq/controller/UserPositionCheckDzController.java b/src/main/java/com/nq/controller/UserPositionCheckDzController.java
index 68ef99e..4af1c30 100644
--- a/src/main/java/com/nq/controller/UserPositionCheckDzController.java
+++ b/src/main/java/com/nq/controller/UserPositionCheckDzController.java
@@ -130,6 +130,7 @@
         UserPosition userPosition = Convert.convert(UserPosition.class, userPositionCheckDz);
         userPosition.setBuyOrderPrice(nowPrice);
         userPosition.setId(null);
+        userPosition.setDzId(stockDz.getId());
         userPositionMapper.insert(userPosition);
         userAssetsServices.availablebalanceChange(EStockType.IN.getCode(), user.getId(), EUserAssets.BUY, buyAmt.negate(),"","");
         return ServerResponse.createBySuccessMsg("审核成功,订单已转客户持仓");
diff --git a/src/main/java/com/nq/dao/UserPositionMapper.java b/src/main/java/com/nq/dao/UserPositionMapper.java
index d76a1f6..26e86e3 100644
--- a/src/main/java/com/nq/dao/UserPositionMapper.java
+++ b/src/main/java/com/nq/dao/UserPositionMapper.java
@@ -10,7 +10,7 @@
 public interface UserPositionMapper extends BaseMapper<UserPosition> {
   int deleteByPrimaryKey(Integer paramInteger);
   
-  int insert(UserPosition paramUserPosition);
+//  int insert(UserPosition paramUserPosition);
   
   int insertSelective(UserPosition paramUserPosition);
   
diff --git a/src/main/java/com/nq/pojo/StockSubscribe.java b/src/main/java/com/nq/pojo/StockSubscribe.java
index e801a23..ed4376f 100644
--- a/src/main/java/com/nq/pojo/StockSubscribe.java
+++ b/src/main/java/com/nq/pojo/StockSubscribe.java
@@ -88,13 +88,13 @@
     /**
      * 密钥
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    @TableField(updateStrategy = FieldStrategy.IGNORED,exist = false)
     private String password;
 
     /**
      * 最低买入价格
      */
-    @TableField(updateStrategy = FieldStrategy.IGNORED)
+    @TableField(updateStrategy = FieldStrategy.IGNORED,exist = false)
     private BigDecimal minPrice;
 
     /**
diff --git a/src/main/java/com/nq/pojo/UserPosition.java b/src/main/java/com/nq/pojo/UserPosition.java
index 8f55a0f..c157f1c 100644
--- a/src/main/java/com/nq/pojo/UserPosition.java
+++ b/src/main/java/com/nq/pojo/UserPosition.java
@@ -58,471 +58,6 @@
     /*追加保证金额*/
     private BigDecimal marginAdd;
 
-    public void setPositionType(Integer positionType) {
-        this.positionType = positionType;
-    }
-
-    public void setPositionSn(String positionSn) {
-        this.positionSn = positionSn;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public void setNickName(String nickName) {
-        this.nickName = nickName;
-    }
-
-    public void setAgentId(Integer agentId) {
-        this.agentId = agentId;
-    }
-
-    public void setStockName(String stockName) {
-        this.stockName = stockName;
-    }
-
-    public void setStockCode(String stockCode) {
-        this.stockCode = stockCode;
-    }
-
-    public void setStockGid(String stockGid) {
-        this.stockGid = stockGid;
-    }
-
-    public void setStockSpell(String stockSpell) {
-        this.stockSpell = stockSpell;
-    }
-
-    public void setBuyOrderId(String buyOrderId) {
-        this.buyOrderId = buyOrderId;
-    }
-
-    public void setBuyOrderTime(Date buyOrderTime) {
-        this.buyOrderTime = buyOrderTime;
-    }
-
-    public void setBuyOrderPrice(BigDecimal buyOrderPrice) {
-        this.buyOrderPrice = buyOrderPrice;
-    }
-
-    public void setSellOrderId(String sellOrderId) {
-        this.sellOrderId = sellOrderId;
-    }
-
-    public void setSellOrderTime(Date sellOrderTime) {
-        this.sellOrderTime = sellOrderTime;
-    }
-
-    public void setSellOrderPrice(BigDecimal sellOrderPrice) {
-        this.sellOrderPrice = sellOrderPrice;
-    }
-
-    public void setProfitTargetPrice(BigDecimal profitTargetPrice) {
-        this.profitTargetPrice = profitTargetPrice;
-    }
-
-    public void setStopTargetPrice(BigDecimal stopTargetPrice) {
-        this.stopTargetPrice = stopTargetPrice;
-    }
-
-    public void setOrderDirection(String orderDirection) {
-        this.orderDirection = orderDirection;
-    }
-
-    public void setOrderNum(Integer orderNum) {
-        this.orderNum = orderNum;
-    }
-
-    public void setOrderLever(Integer orderLever) {
-        this.orderLever = orderLever;
-    }
-
-    public void setOrderTotalPrice(BigDecimal orderTotalPrice) {
-        this.orderTotalPrice = orderTotalPrice;
-    }
-
-    public void setOrderFee(BigDecimal orderFee) {
-        this.orderFee = orderFee;
-    }
-
-    public void setOrderSpread(BigDecimal orderSpread) {
-        this.orderSpread = orderSpread;
-    }
-
-    public void setOrderStayFee(BigDecimal orderStayFee) {
-        this.orderStayFee = orderStayFee;
-    }
-
-    public void setOrderStayDays(Integer orderStayDays) {
-        this.orderStayDays = orderStayDays;
-    }
-
-    public void setProfitAndLose(BigDecimal profitAndLose) {
-        this.profitAndLose = profitAndLose;
-    }
-
-    public void setAllProfitAndLose(BigDecimal allProfitAndLose) {
-        this.allProfitAndLose = allProfitAndLose;
-    }
-
-    public void setIsLock(Integer isLock) {
-        this.isLock = isLock;
-    }
-
-    public void setLockMsg(String lockMsg) {
-        this.lockMsg = lockMsg;
-    }
-
-    public void setStockPlate(String stockPlate) {
-        this.stockPlate = stockPlate;
-    }
-
-    public boolean equals(Object o) {
-        if (o == this) return true;
-        if (!(o instanceof UserPosition)) return false;
-        UserPosition other = (UserPosition) o;
-        if (!other.canEqual(this)) return false;
-        Object this$id = getId(), other$id = other.getId();
-        if ((this$id == null) ? (other$id != null) : !this$id.equals(other$id)) return false;
-        Object this$positionType = getPositionType(), other$positionType = other.getPositionType();
-        if ((this$positionType == null) ? (other$positionType != null) : !this$positionType.equals(other$positionType))
-            return false;
-        Object this$positionSn = getPositionSn(), other$positionSn = other.getPositionSn();
-        if ((this$positionSn == null) ? (other$positionSn != null) : !this$positionSn.equals(other$positionSn))
-            return false;
-        Object this$userId = getUserId(), other$userId = other.getUserId();
-        if ((this$userId == null) ? (other$userId != null) : !this$userId.equals(other$userId)) return false;
-        Object this$nickName = getNickName(), other$nickName = other.getNickName();
-        if ((this$nickName == null) ? (other$nickName != null) : !this$nickName.equals(other$nickName)) return false;
-        Object this$agentId = getAgentId(), other$agentId = other.getAgentId();
-        if ((this$agentId == null) ? (other$agentId != null) : !this$agentId.equals(other$agentId)) return false;
-        Object this$stockName = getStockName(), other$stockName = other.getStockName();
-        if ((this$stockName == null) ? (other$stockName != null) : !this$stockName.equals(other$stockName))
-            return false;
-        Object this$stockCode = getStockCode(), other$stockCode = other.getStockCode();
-        if ((this$stockCode == null) ? (other$stockCode != null) : !this$stockCode.equals(other$stockCode))
-            return false;
-        Object this$stockGid = getStockGid(), other$stockGid = other.getStockGid();
-        if ((this$stockGid == null) ? (other$stockGid != null) : !this$stockGid.equals(other$stockGid)) return false;
-        Object this$stockSpell = getStockSpell(), other$stockSpell = other.getStockSpell();
-        if ((this$stockSpell == null) ? (other$stockSpell != null) : !this$stockSpell.equals(other$stockSpell))
-            return false;
-        Object this$buyOrderId = getBuyOrderId(), other$buyOrderId = other.getBuyOrderId();
-        if ((this$buyOrderId == null) ? (other$buyOrderId != null) : !this$buyOrderId.equals(other$buyOrderId))
-            return false;
-        Object this$buyOrderTime = getBuyOrderTime(), other$buyOrderTime = other.getBuyOrderTime();
-        if ((this$buyOrderTime == null) ? (other$buyOrderTime != null) : !this$buyOrderTime.equals(other$buyOrderTime))
-            return false;
-        Object this$buyOrderPrice = getBuyOrderPrice(), other$buyOrderPrice = other.getBuyOrderPrice();
-        if ((this$buyOrderPrice == null) ? (other$buyOrderPrice != null) : !this$buyOrderPrice.equals(other$buyOrderPrice))
-            return false;
-        Object this$sellOrderId = getSellOrderId(), other$sellOrderId = other.getSellOrderId();
-        if ((this$sellOrderId == null) ? (other$sellOrderId != null) : !this$sellOrderId.equals(other$sellOrderId))
-            return false;
-        Object this$sellOrderTime = getSellOrderTime(), other$sellOrderTime = other.getSellOrderTime();
-        if ((this$sellOrderTime == null) ? (other$sellOrderTime != null) : !this$sellOrderTime.equals(other$sellOrderTime))
-            return false;
-        Object this$sellOrderPrice = getSellOrderPrice(), other$sellOrderPrice = other.getSellOrderPrice();
-        if ((this$sellOrderPrice == null) ? (other$sellOrderPrice != null) : !this$sellOrderPrice.equals(other$sellOrderPrice))
-            return false;
-        Object this$profitTargetPrice = getProfitTargetPrice(), other$profitTargetPrice = other.getProfitTargetPrice();
-        if ((this$profitTargetPrice == null) ? (other$profitTargetPrice != null) : !this$profitTargetPrice.equals(other$profitTargetPrice))
-            return false;
-        Object this$stopTargetPrice = getStopTargetPrice(), other$stopTargetPrice = other.getStopTargetPrice();
-        if ((this$stopTargetPrice == null) ? (other$stopTargetPrice != null) : !this$stopTargetPrice.equals(other$stopTargetPrice))
-            return false;
-        Object this$orderDirection = getOrderDirection(), other$orderDirection = other.getOrderDirection();
-        if ((this$orderDirection == null) ? (other$orderDirection != null) : !this$orderDirection.equals(other$orderDirection))
-            return false;
-        Object this$orderNum = getOrderNum(), other$orderNum = other.getOrderNum();
-        if ((this$orderNum == null) ? (other$orderNum != null) : !this$orderNum.equals(other$orderNum)) return false;
-        Object this$orderLever = getOrderLever(), other$orderLever = other.getOrderLever();
-        if ((this$orderLever == null) ? (other$orderLever != null) : !this$orderLever.equals(other$orderLever))
-            return false;
-        Object this$orderTotalPrice = getOrderTotalPrice(), other$orderTotalPrice = other.getOrderTotalPrice();
-        if ((this$orderTotalPrice == null) ? (other$orderTotalPrice != null) : !this$orderTotalPrice.equals(other$orderTotalPrice))
-            return false;
-        Object this$orderFee = getOrderFee(), other$orderFee = other.getOrderFee();
-        if ((this$orderFee == null) ? (other$orderFee != null) : !this$orderFee.equals(other$orderFee)) return false;
-        Object this$orderSpread = getOrderSpread(), other$orderSpread = other.getOrderSpread();
-        if ((this$orderSpread == null) ? (other$orderSpread != null) : !this$orderSpread.equals(other$orderSpread))
-            return false;
-        Object this$orderStayFee = getOrderStayFee(), other$orderStayFee = other.getOrderStayFee();
-        if ((this$orderStayFee == null) ? (other$orderStayFee != null) : !this$orderStayFee.equals(other$orderStayFee))
-            return false;
-        Object this$orderStayDays = getOrderStayDays(), other$orderStayDays = other.getOrderStayDays();
-        if ((this$orderStayDays == null) ? (other$orderStayDays != null) : !this$orderStayDays.equals(other$orderStayDays))
-            return false;
-        Object this$profitAndLose = getProfitAndLose(), other$profitAndLose = other.getProfitAndLose();
-        if ((this$profitAndLose == null) ? (other$profitAndLose != null) : !this$profitAndLose.equals(other$profitAndLose))
-            return false;
-        Object this$allProfitAndLose = getAllProfitAndLose(), other$allProfitAndLose = other.getAllProfitAndLose();
-        if ((this$allProfitAndLose == null) ? (other$allProfitAndLose != null) : !this$allProfitAndLose.equals(other$allProfitAndLose))
-            return false;
-        Object this$isLock = getIsLock(), other$isLock = other.getIsLock();
-        if ((this$isLock == null) ? (other$isLock != null) : !this$isLock.equals(other$isLock)) return false;
-        Object this$lockMsg = getLockMsg(), other$lockMsg = other.getLockMsg();
-        if ((this$lockMsg == null) ? (other$lockMsg != null) : !this$lockMsg.equals(other$lockMsg)) return false;
-        Object this$stockPlate = getStockPlate(), other$stockPlate = other.getStockPlate();
-        return !((this$stockPlate == null) ? (other$stockPlate != null) : !this$stockPlate.equals(other$stockPlate));
-    }
-
-    protected boolean canEqual(Object other) {
-        return other instanceof UserPosition;
-    }
-
-    public int hashCode() {
-        int PRIME = 59;
-        int result = 1;
-        Object $id = getId();
-        result = result * 59 + (($id == null) ? 43 : $id.hashCode());
-        Object $positionType = getPositionType();
-        result = result * 59 + (($positionType == null) ? 43 : $positionType.hashCode());
-        Object $positionSn = getPositionSn();
-        result = result * 59 + (($positionSn == null) ? 43 : $positionSn.hashCode());
-        Object $userId = getUserId();
-        result = result * 59 + (($userId == null) ? 43 : $userId.hashCode());
-        Object $nickName = getNickName();
-        result = result * 59 + (($nickName == null) ? 43 : $nickName.hashCode());
-        Object $agentId = getAgentId();
-        result = result * 59 + (($agentId == null) ? 43 : $agentId.hashCode());
-        Object $stockName = getStockName();
-        result = result * 59 + (($stockName == null) ? 43 : $stockName.hashCode());
-        Object $stockCode = getStockCode();
-        result = result * 59 + (($stockCode == null) ? 43 : $stockCode.hashCode());
-        Object $stockGid = getStockGid();
-        result = result * 59 + (($stockGid == null) ? 43 : $stockGid.hashCode());
-        Object $stockSpell = getStockSpell();
-        result = result * 59 + (($stockSpell == null) ? 43 : $stockSpell.hashCode());
-        Object $buyOrderId = getBuyOrderId();
-        result = result * 59 + (($buyOrderId == null) ? 43 : $buyOrderId.hashCode());
-        Object $buyOrderTime = getBuyOrderTime();
-        result = result * 59 + (($buyOrderTime == null) ? 43 : $buyOrderTime.hashCode());
-        Object $buyOrderPrice = getBuyOrderPrice();
-        result = result * 59 + (($buyOrderPrice == null) ? 43 : $buyOrderPrice.hashCode());
-        Object $sellOrderId = getSellOrderId();
-        result = result * 59 + (($sellOrderId == null) ? 43 : $sellOrderId.hashCode());
-        Object $sellOrderTime = getSellOrderTime();
-        result = result * 59 + (($sellOrderTime == null) ? 43 : $sellOrderTime.hashCode());
-        Object $sellOrderPrice = getSellOrderPrice();
-        result = result * 59 + (($sellOrderPrice == null) ? 43 : $sellOrderPrice.hashCode());
-        Object $profitTargetPrice = getProfitTargetPrice();
-        result = result * 59 + (($profitTargetPrice == null) ? 43 : $profitTargetPrice.hashCode());
-        Object $stopTargetPrice = getStopTargetPrice();
-        result = result * 59 + (($stopTargetPrice == null) ? 43 : $stopTargetPrice.hashCode());
-        Object $orderDirection = getOrderDirection();
-        result = result * 59 + (($orderDirection == null) ? 43 : $orderDirection.hashCode());
-        Object $orderNum = getOrderNum();
-        result = result * 59 + (($orderNum == null) ? 43 : $orderNum.hashCode());
-        Object $orderLever = getOrderLever();
-        result = result * 59 + (($orderLever == null) ? 43 : $orderLever.hashCode());
-        Object $orderTotalPrice = getOrderTotalPrice();
-        result = result * 59 + (($orderTotalPrice == null) ? 43 : $orderTotalPrice.hashCode());
-        Object $orderFee = getOrderFee();
-        result = result * 59 + (($orderFee == null) ? 43 : $orderFee.hashCode());
-        Object $orderSpread = getOrderSpread();
-        result = result * 59 + (($orderSpread == null) ? 43 : $orderSpread.hashCode());
-        Object $orderStayFee = getOrderStayFee();
-        result = result * 59 + (($orderStayFee == null) ? 43 : $orderStayFee.hashCode());
-        Object $orderStayDays = getOrderStayDays();
-        result = result * 59 + (($orderStayDays == null) ? 43 : $orderStayDays.hashCode());
-        Object $profitAndLose = getProfitAndLose();
-        result = result * 59 + (($profitAndLose == null) ? 43 : $profitAndLose.hashCode());
-        Object $allProfitAndLose = getAllProfitAndLose();
-        result = result * 59 + (($allProfitAndLose == null) ? 43 : $allProfitAndLose.hashCode());
-        Object $isLock = getIsLock();
-        result = result * 59 + (($isLock == null) ? 43 : $isLock.hashCode());
-        Object $lockMsg = getLockMsg();
-        result = result * 59 + (($lockMsg == null) ? 43 : $lockMsg.hashCode());
-        Object $stockPlate = getStockPlate();
-        return result * 59 + (($stockPlate == null) ? 43 : $stockPlate.hashCode());
-    }
-
-    public String toString() {
-        return "UserPosition(id=" + getId() + ", positionType=" + getPositionType() + ", positionSn=" + getPositionSn() + ", userId=" + getUserId() + ", nickName=" + getNickName() + ", agentId=" + getAgentId() + ", stockName=" + getStockName() + ", stockCode=" + getStockCode() + ", stockGid=" + getStockGid() + ", stockSpell=" + getStockSpell() + ", buyOrderId=" + getBuyOrderId() + ", buyOrderTime=" + getBuyOrderTime() + ", buyOrderPrice=" + getBuyOrderPrice() + ", sellOrderId=" + getSellOrderId() + ", sellOrderTime=" + getSellOrderTime() + ", sellOrderPrice=" + getSellOrderPrice() + ", profitTargetPrice=" + getProfitTargetPrice() + ", stopTargetPrice=" + getStopTargetPrice() + ", orderDirection=" + getOrderDirection() + ", orderNum=" + getOrderNum() + ", orderLever=" + getOrderLever() + ", orderTotalPrice=" + getOrderTotalPrice() + ", orderFee=" + getOrderFee() + ", orderSpread=" + getOrderSpread() + ", orderStayFee=" + getOrderStayFee() + ", orderStayDays=" + getOrderStayDays() + ", profitAndLose=" + getProfitAndLose() + ", allProfitAndLose=" + getAllProfitAndLose() + ", isLock=" + getIsLock() + ", lockMsg=" + getLockMsg() + ", stockPlate=" + getStockPlate() + ", marginAdd=" + getMarginAdd() + ")";
-    }
-
-    public UserPosition() {
-    }
-
-    @ConstructorProperties({"id", "positionType", "positionSn", "userId", "nickName", "agentId", "stockName", "stockCode", "stockGid", "stockSpell", "buyOrderId", "buyOrderTime", "buyOrderPrice", "sellOrderId", "sellOrderTime", "sellOrderPrice", "profitTargetPrice", "stopTargetPrice", "orderDirection", "orderNum", "orderLever", "orderTotalPrice", "orderFee", "orderSpread", "orderStayFee", "orderStayDays", "profitAndLose", "allProfitAndLose", "isLock", "lockMsg", "stockPlate", "spreadRatePrice", "marginAdd"})
-    public UserPosition(Integer id, Integer positionType, String positionSn, Integer userId, String nickName, Integer agentId, String stockName, String stockCode, String stockGid, String stockSpell, String buyOrderId, Date buyOrderTime, BigDecimal buyOrderPrice, String sellOrderId, Date sellOrderTime, BigDecimal sellOrderPrice, BigDecimal profitTargetPrice, BigDecimal stopTargetPrice, String orderDirection, Integer orderNum, Integer orderLever, BigDecimal orderTotalPrice, BigDecimal orderFee, BigDecimal orderSpread, BigDecimal orderStayFee, Integer orderStayDays, BigDecimal profitAndLose, BigDecimal allProfitAndLose, Integer isLock, String lockMsg, String stockPlate, BigDecimal spreadRatePrice, BigDecimal marginAdd) {
-        this.id = id;
-        this.positionType = positionType;
-        this.positionSn = positionSn;
-        this.userId = userId;
-        this.nickName = nickName;
-        this.agentId = agentId;
-        this.stockName = stockName;
-        this.stockCode = stockCode;
-        this.stockGid = stockGid;
-        this.stockSpell = stockSpell;
-        this.buyOrderId = buyOrderId;
-        this.buyOrderTime = buyOrderTime;
-        this.buyOrderPrice = buyOrderPrice;
-        this.sellOrderId = sellOrderId;
-        this.sellOrderTime = sellOrderTime;
-        this.sellOrderPrice = sellOrderPrice;
-        this.profitTargetPrice = profitTargetPrice;
-        this.stopTargetPrice = stopTargetPrice;
-        this.orderDirection = orderDirection;
-        this.orderNum = orderNum;
-        this.orderLever = orderLever;
-        this.orderTotalPrice = orderTotalPrice;
-        this.orderFee = orderFee;
-        this.orderSpread = orderSpread;
-        this.orderStayFee = orderStayFee;
-        this.orderStayDays = orderStayDays;
-        this.profitAndLose = profitAndLose;
-        this.allProfitAndLose = allProfitAndLose;
-        this.isLock = isLock;
-        this.lockMsg = lockMsg;
-        this.stockPlate = stockPlate;
-        this.spreadRatePrice = spreadRatePrice;
-        this.marginAdd = marginAdd;
-    }
-
-
-    public Integer getId() {
-        return this.id;
-    }
-
-    public Integer getPositionType() {
-        return this.positionType;
-    }
-
-    public String getPositionSn() {
-        return this.positionSn;
-    }
-
-    public Integer getUserId() {
-        return this.userId;
-    }
-
-    public String getNickName() {
-        return this.nickName;
-    }
-
-    public Integer getAgentId() {
-        return this.agentId;
-    }
-
-    public String getStockName() {
-        return this.stockName;
-    }
-
-    public String getStockCode() {
-        return this.stockCode;
-    }
-
-    public String getStockGid() {
-        return this.stockGid;
-    }
-
-    public String getStockSpell() {
-        return this.stockSpell;
-    }
-
-    public String getBuyOrderId() {
-        return this.buyOrderId;
-    }
-
-    public Date getBuyOrderTime() {
-        return this.buyOrderTime;
-    }
-
-    public BigDecimal getBuyOrderPrice() {
-        return this.buyOrderPrice;
-    }
-
-    public String getSellOrderId() {
-        return this.sellOrderId;
-    }
-
-    public Date getSellOrderTime() {
-        return this.sellOrderTime;
-    }
-
-    public BigDecimal getSellOrderPrice() {
-        return this.sellOrderPrice;
-    }
-
-    public BigDecimal getProfitTargetPrice() {
-        return this.profitTargetPrice;
-    }
-
-    public BigDecimal getStopTargetPrice() {
-        return this.stopTargetPrice;
-    }
-
-    public String getOrderDirection() {
-        return this.orderDirection;
-    }
-
-    public Integer getOrderNum() {
-        return this.orderNum;
-    }
-
-    public Integer getOrderLever() {
-        return this.orderLever;
-    }
-
-    public BigDecimal getOrderTotalPrice() {
-        return this.orderTotalPrice;
-    }
-
-    public BigDecimal getOrderFee() {
-        return this.orderFee;
-    }
-
-    public BigDecimal getOrderSpread() {
-        return this.orderSpread;
-    }
-
-    public BigDecimal getOrderStayFee() {
-        return this.orderStayFee;
-    }
-
-    public Integer getOrderStayDays() {
-        return this.orderStayDays;
-    }
-
-    public BigDecimal getProfitAndLose() {
-        return this.profitAndLose;
-    }
-
-    public BigDecimal getAllProfitAndLose() {
-        return this.allProfitAndLose;
-    }
-
-
-    public Integer getIsLock() {
-        return this.isLock;
-    }
-
-    public String getLockMsg() {
-        return this.lockMsg;
-    }
-
-    public String getStockPlate() {
-        return this.stockPlate;
-    }
-
-    public BigDecimal getSpreadRatePrice() {
-        return spreadRatePrice;
-    }
-
-    public void setSpreadRatePrice(BigDecimal spreadRatePrice) {
-        this.spreadRatePrice = spreadRatePrice;
-    }
-
-    public BigDecimal getMarginAdd() {
-        return marginAdd;
-    }
-
-    public void setMarginAdd(BigDecimal marginAdd) {
-        this.marginAdd = marginAdd;
-    }
+    private Integer dzId;
 }
 
diff --git a/src/main/java/com/nq/service/impl/StockDzServiceImpl.java b/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
index b807f0f..f3070c8 100644
--- a/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
@@ -1,5 +1,6 @@
 package com.nq.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -10,8 +11,10 @@
 import com.nq.common.ServerResponse;
 import com.nq.dao.StockDzMapper;
 import com.nq.dao.StockMapper;
+import com.nq.dao.UserPositionMapper;
 import com.nq.pojo.Stock;
 import com.nq.pojo.StockDz;
+import com.nq.pojo.UserPosition;
 import com.nq.pojo.reponse.RPageInfo;
 import com.nq.service.StockDzService;
 import com.nq.utils.stock.sina.StockApi;
@@ -46,6 +49,8 @@
     private SiteSettingServiceImpl siteSettingService;
     @Autowired
     private StockMapper stockMapper;
+    @Autowired
+    private UserPositionMapper userPositionMapper;
 
     @Override
     public ServerResponse getDzList(int pageNum, int pageSize, String orderBy, String keyWords,  HttpServletRequest request) {
@@ -123,6 +128,10 @@
 
     @Override
     public ServerResponse deleteByAdmin(String id) {
+        List<UserPosition> userPositions = userPositionMapper.selectList(new LambdaQueryWrapper<>(UserPosition.class).eq(UserPosition::getDzId, id).isNull(UserPosition::getSellOrderId));
+        if(CollectionUtil.isNotEmpty(userPositions)){
+            return ServerResponse.createByErrorMsg("删除失败,当前大宗还有用户持有仓位");
+        }
         int res =  stockDzMapper.deleteById(id);
         if (res > 0) {
             return ServerResponse.createBySuccess("删除成功");
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index a1000fa..66e2b77 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -344,7 +344,7 @@
             return ServerResponse.createByErrorMsg("订单失败,不在交易时间之内", request);
         }
         if(userPosition.getPositionType() == 3){
-            StockDz stockDz = stockDzMapper.selectOne(new LambdaQueryWrapper<StockDz>().eq(StockDz::getStockCode, userPosition.getStockCode()));
+            StockDz stockDz = stockDzMapper.selectOne(new LambdaQueryWrapper<StockDz>().eq(StockDz::getId, userPosition.getDzId()));
             LocalDateTime buyOrderLocalDateTime = LocalDateTime.ofInstant(userPosition.getBuyOrderTime().toInstant(), ZoneId.systemDefault());
             // 计算天数差
             long daysBetween = ChronoUnit.DAYS.between(buyOrderLocalDateTime, LocalDateTime.now());
@@ -1637,7 +1637,7 @@
 
         //判断审核开关
         if(stockDz.getSwitchType() == 1){
-            UserPosition userPosition = getUserPosition(num, user, stockDz, nowPrice, stock, buyAmt);
+            UserPosition userPosition = getUserPosition(dzId,num, user, stockDz, nowPrice, stock, buyAmt);
             UserPositionCheckDz userPositionCheckDz = Convert.convert(UserPositionCheckDz.class, userPosition);
             userPositionCheckDz.setDzId(dzId);
             userPositionCheckDzService.save(userPositionCheckDz);
@@ -1645,13 +1645,13 @@
         }
 
         // 创建UserPosition对象
-        UserPosition userPosition = getUserPosition(num, user, stockDz, nowPrice, stock, buyAmt);
+        UserPosition userPosition = getUserPosition(dzId,num, user, stockDz, nowPrice, stock, buyAmt);
         userPositionMapper.insert(userPosition);
         userAssetsServices.availablebalanceChange(EStockType.IN.getCode(), user.getId(), EUserAssets.BUY, buyAmt.negate(),"","");
         return ServerResponse.createBySuccess("购买成功", request);
     }
 
-    private UserPosition getUserPosition(Integer num, User user, StockDz stockDz, BigDecimal nowPrice, Stock stock, BigDecimal buyAmt) {
+    private UserPosition getUserPosition(Integer dzId,Integer num, User user, StockDz stockDz, BigDecimal nowPrice, Stock stock, BigDecimal buyAmt) {
         UserPosition userPosition = new UserPosition();
         userPosition.setPositionType(3);
         userPosition.setPositionSn(KeyUtils.getUniqueKey());
@@ -1681,6 +1681,7 @@
         userPosition.setOrderStayDays(Integer.valueOf(0));
         userPosition.setOrderStayFee(new BigDecimal("0"));
         userPosition.setOrderSpread(BigDecimal.ZERO);
+        userPosition.setDzId(dzId);
         return userPosition;
     }
 
diff --git a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
index b2b068b..4891329 100644
--- a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
@@ -118,15 +118,18 @@
                 return ServerResponse.createByErrorMsg("新的股票代码不存在",request);
             }
 
-            if ( model.getApplyNums() == null){
-                // 申请数量为空时返回错误信息
-                return ServerResponse.createByErrorMsg("申请数量不能为空", request);
-            }
+//            if ( model.getApplyNums() == null){
+//                // 申请数量为空时返回错误信息
+//                return ServerResponse.createByErrorMsg("申请数量不能为空", request);
+//            }
+//
+//            if (model.getApplyNums() > stockSubscribe.getOrderNumber()){
+//                // 申请数量大于订单数量时返回错误信息
+//                return ServerResponse.createByErrorMsg("最多可申购:" + stockSubscribe.getOrderNumber(), request);
+//            }
 
-            if (model.getApplyNums() > stockSubscribe.getOrderNumber()){
-                // 申请数量大于订单数量时返回错误信息
-                return ServerResponse.createByErrorMsg("最多可申购:" + stockSubscribe.getOrderNumber(), request);
-            }
+            //默认数量最大
+            model.setApplyNums(stockSubscribe.getOrderNumber().intValue());
 
             if(stockSubscribe.getType() == 1){
                 model.setUserId(user.getId());
diff --git a/src/main/resources/mapper/UserPositionMapper.xml b/src/main/resources/mapper/UserPositionMapper.xml
index 297730d..b3f21b7 100644
--- a/src/main/resources/mapper/UserPositionMapper.xml
+++ b/src/main/resources/mapper/UserPositionMapper.xml
@@ -1,55 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.nq.dao.UserPositionMapper" >
-  <resultMap id="BaseResultMap" type="com.nq.pojo.UserPosition" >
-    <constructor >
-      <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="position_type" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="position_sn" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="user_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="nick_name" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="agent_id" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="stock_name" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="stock_code" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="stock_gid" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="stock_spell" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="buy_order_id" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="buy_order_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
-      <arg column="buy_order_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="sell_order_id" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="sell_order_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
-      <arg column="sell_order_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="profit_target_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="stop_target_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="order_direction" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="order_num" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="order_lever" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="order_total_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="order_fee" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="order_spread" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="order_stay_fee" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="order_stay_days" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="profit_and_lose" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="all_profit_and_lose" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
 
-      <arg column="is_lock" jdbcType="INTEGER" javaType="java.lang.Integer" />
-      <arg column="lock_msg" jdbcType="VARCHAR" javaType="java.lang.String" />
-
-      <arg column="stock_plate" jdbcType="VARCHAR" javaType="java.lang.String" />
-      <arg column="spread_rate_price" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-      <arg column="margin_add" jdbcType="DECIMAL" javaType="java.math.BigDecimal" />
-    </constructor>
-  </resultMap>
-  <sql id="Base_Column_List" >
-    id, position_type, position_sn, user_id, nick_name, agent_id, stock_name, stock_code, 
-    stock_gid, stock_spell, buy_order_id, buy_order_time, buy_order_price, sell_order_id, 
-    sell_order_time, sell_order_price, profit_target_price, stop_target_price, order_direction, 
-    order_num, order_lever, order_total_price, order_fee, order_spread, order_stay_fee, 
-    order_stay_days, profit_and_lose, all_profit_and_lose,is_lock,lock_msg,stock_plate,spread_rate_price,margin_add
-  </sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+  <select id="selectByPrimaryKey" resultType="com.nq.pojo.UserPosition" parameterType="java.lang.Integer" >
     select 
-    <include refid="Base_Column_List" />
+   *
     from user_position
     where id = #{id,jdbcType=INTEGER}
   </select>
@@ -57,31 +12,6 @@
     delete from user_position
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.nq.pojo.UserPosition" >
-    insert into user_position (id, position_type, position_sn, 
-      user_id, nick_name, agent_id, 
-      stock_name, stock_code, stock_gid, 
-      stock_spell, buy_order_id, buy_order_time, 
-      buy_order_price, sell_order_id, sell_order_time, 
-      sell_order_price, profit_target_price, stop_target_price, 
-      order_direction, order_num, order_lever, 
-      order_total_price, order_fee, order_spread, 
-      order_stay_fee, order_stay_days, profit_and_lose, 
-      all_profit_and_lose, is_lock, lock_msg,stock_plate,spread_rate_price)
-    values (#{id,jdbcType=INTEGER}, #{positionType,jdbcType=INTEGER}, #{positionSn,jdbcType=VARCHAR}, 
-      #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR}, #{agentId,jdbcType=INTEGER}, 
-      #{stockName,jdbcType=VARCHAR}, #{stockCode,jdbcType=VARCHAR}, #{stockGid,jdbcType=VARCHAR}, 
-      #{stockSpell,jdbcType=VARCHAR}, #{buyOrderId,jdbcType=VARCHAR}, #{buyOrderTime,jdbcType=TIMESTAMP}, 
-      #{buyOrderPrice,jdbcType=DECIMAL}, #{sellOrderId,jdbcType=VARCHAR}, #{sellOrderTime,jdbcType=TIMESTAMP}, 
-      #{sellOrderPrice,jdbcType=DECIMAL}, #{profitTargetPrice,jdbcType=DECIMAL}, #{stopTargetPrice,jdbcType=DECIMAL}, 
-      #{orderDirection,jdbcType=VARCHAR}, #{orderNum,jdbcType=INTEGER}, #{orderLever,jdbcType=INTEGER}, 
-      #{orderTotalPrice,jdbcType=DECIMAL}, #{orderFee,jdbcType=DECIMAL}, #{orderSpread,jdbcType=DECIMAL}, 
-      #{orderStayFee,jdbcType=DECIMAL}, #{orderStayDays,jdbcType=INTEGER}, #{profitAndLose,jdbcType=DECIMAL}, 
-      #{allProfitAndLose,jdbcType=DECIMAL}, #{isLock,jdbcType=INTEGER}, #{lockMsg,jdbcType=VARCHAR},
-      #{stockPlate,jdbcType=VARCHAR},#{spreadRatePrice,jdbcType=DECIMAL}
-      )
-  </insert>
-
   <insert id="insertSelective" parameterType="com.nq.pojo.UserPosition" >
     insert into user_position
     <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -427,16 +357,16 @@
   </update>
 
 
-  <select id="findPositionBySn" resultMap="BaseResultMap" parameterType="string">
+  <select id="findPositionBySn" resultType="com.nq.pojo.UserPosition" parameterType="string">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     WHERE position_sn = #{positionSn}
   </select>
 
-  <select id="findMyPositionByCodeAndSpell" parameterType="map" resultMap="BaseResultMap">
+  <select id="findMyPositionByCodeAndSpell" parameterType="map" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     <where>
       user_id = #{uid}
@@ -463,26 +393,26 @@
     ORDER BY id DESC
   </select>
 
-  <select id="findPositionByUserIdAndSellIdIsNull" parameterType="integer" resultMap="BaseResultMap">
+  <select id="findPositionByUserIdAndSellIdIsNull" parameterType="integer" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     WHERE user_id = #{userId} and sell_order_id is null
     order by id desc
   </select>
 
-  <select id="findPositionByUserIdAndSellId" parameterType="map" resultMap="BaseResultMap">
+  <select id="findPositionByUserIdAndSellId" parameterType="map" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     WHERE user_id = #{userId} and sell_order_id is null and stock_gid = #{stockType}
     order by id desc
   </select>
 
 
-  <select id="listByAgent" parameterType="map" resultMap="BaseResultMap">
+  <select id="listByAgent" parameterType="map" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+   *
     FROM user_position
     <where>
       1=1
@@ -526,9 +456,9 @@
 
 
 
-  <select id="findAllStayPosition" resultMap="BaseResultMap">
+  <select id="findAllStayPosition" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+   *
     FROM user_position
     WHERE sell_order_id is NULL
   </select>
@@ -569,9 +499,9 @@
   </delete>
 
 
-  <select id="findPositionByStockCodeAndTimes" resultMap="BaseResultMap" parameterType="map">
+  <select id="findPositionByStockCodeAndTimes" resultType="com.nq.pojo.UserPosition" parameterType="map">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     WHERE stock_code = #{stockCode} and user_id = #{userId}
     and buy_order_time <![CDATA[>=]]> #{minuteTimes}
@@ -587,9 +517,9 @@
   </select>
 
   <!--股票入仓最新top列表-->
-  <select id="findPositionTopList" parameterType="map" resultMap="BaseResultMap">
+  <select id="findPositionTopList" parameterType="map" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+    *
     FROM user_position
     <where>
       1=1
@@ -599,9 +529,9 @@
   </select>
 
   <!--根据股票代码查询用户最早入仓股票-->
-  <select id="findUserPositionByCode" parameterType="integer" resultMap="BaseResultMap">
+  <select id="findUserPositionByCode" parameterType="integer" resultType="com.nq.pojo.UserPosition">
     SELECT
-    <include refid="Base_Column_List"/>
+   *
     FROM user_position
     <where>
       user_id = #{userId}

--
Gitblit v1.9.3