From 1405d2e5b97e8f934cfb9a127c108c63f4dbcf3b Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Mon, 27 May 2024 14:19:59 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java |    2 
 src/main/java/com/nq/service/impl/UserPositionServiceImpl.java       |    7 +
 src/main/java/com/nq/pojo/UserStockSubscribe.java                    |  176 +++++++++++++++++++++++++++++++++++++++++++
 src/main/resources/mapper/UserStockSubscribeMapper.xml               |    5 
 src/main/resources/mapper/UserMapper.xml                             |    3 
 5 files changed, 186 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/nq/pojo/UserStockSubscribe.java b/src/main/java/com/nq/pojo/UserStockSubscribe.java
index 1a02f79..392feeb 100644
--- a/src/main/java/com/nq/pojo/UserStockSubscribe.java
+++ b/src/main/java/com/nq/pojo/UserStockSubscribe.java
@@ -2,8 +2,11 @@
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -18,6 +21,9 @@
 * @Date: 2022/10/25
 */
 @Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName(value ="user_stock_subscribe")
 public class UserStockSubscribe implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -55,6 +61,7 @@
      * 代理姓名
      */
     private String agentName;
+
 
     /**
      * 申购股票代码
@@ -122,7 +129,174 @@
 
     private BigDecimal dbMoney;
 
-    public UserStockSubscribe() {
+    public Integer getId() {
+        return id;
     }
 
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Integer getAgentId() {
+        return agentId;
+    }
+
+    public void setAgentId(Integer agentId) {
+        this.agentId = agentId;
+    }
+
+    public String getAgentName() {
+        return agentName;
+    }
+
+    public void setAgentName(String agentName) {
+        this.agentName = agentName;
+    }
+
+    public String getNewCode() {
+        return newCode;
+    }
+
+    public void setNewCode(String newCode) {
+        this.newCode = newCode;
+    }
+
+    public String getNewName() {
+        return newName;
+    }
+
+    public void setNewName(String newName) {
+        this.newName = newName;
+    }
+
+    public BigDecimal getBond() {
+        return bond;
+    }
+
+    public void setBond(BigDecimal bond) {
+        this.bond = bond;
+    }
+
+    public BigDecimal getBuyPrice() {
+        return buyPrice;
+    }
+
+    public void setBuyPrice(BigDecimal buyPrice) {
+        this.buyPrice = buyPrice;
+    }
+
+    public Integer getApplyNums() {
+        return applyNums;
+    }
+
+    public void setApplyNums(Integer applyNums) {
+        this.applyNums = applyNums;
+    }
+
+    public Integer getApplyNumber() {
+        return applyNumber;
+    }
+
+    public void setApplyNumber(Integer applyNumber) {
+        this.applyNumber = applyNumber;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public Date getSubmitTime() {
+        return submitTime;
+    }
+
+    public void setSubmitTime(Date submitTime) {
+        this.submitTime = submitTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public Date getFixTime() {
+        return fixTime;
+    }
+
+    public void setFixTime(Date fixTime) {
+        this.fixTime = fixTime;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public BigDecimal getDbMoney() {
+        return dbMoney;
+    }
+
+    public void setDbMoney(BigDecimal dbMoney) {
+        this.dbMoney = dbMoney;
+    }
+
+
+
 }
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index 6bdb651..125b73e 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -1201,8 +1201,10 @@
             userPosition.setStockCode(stock.getStockCode());
             userPosition.setStockSpell(stock.getStockSpell());
             userPosition.setStockName(userStockSubscribe.getNewName());
-            userPosition.setStockGid(stockSubscribe.getStockType() + userStockSubscribe.getNewCode());
-
+            StringBuffer gid = new StringBuffer();
+            gid.append(stockSubscribe.getStockType()!=null?stockSubscribe.getStockType():"");
+            gid.append(userStockSubscribe.getNewCode()!=null?userStockSubscribe.getNewCode():"stock code invaild");
+            userPosition.setStockGid(gid.toString());
             userPosition.setBuyOrderId(GeneratePosition.getPositionId());
             userPosition.setBuyOrderTime(new Date());
             userPosition.setBuyOrderPrice(userStockSubscribe.getBuyPrice());
@@ -1258,6 +1260,7 @@
                 return ServerResponse.createByErrorMsg("新股转持仓失败");
             }
             userAssets.setFreezeMoney(userAssets.getFreezeMoney().add(userPosition.getOrderTotalPrice()));
+            userAssets.setFreezeMoney(userAssets.getFreezeMoney()!=null?userAssets.getFreezeMoney().setScale(2,BigDecimal.ROUND_UP):null);
             userAssetsMapper.updateById(userAssets);
             if (ret > 0) {
                 userStockSubscribe.setStatus(5);
diff --git a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
index 91fb092..7469774 100644
--- a/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserStockSubscribeServiceImpl.java
@@ -286,7 +286,7 @@
                 model.setAgentId(user.getAgentId());
                 model.setAgentName(user.getAgentName());
                 StockSubscribe stockSubscribe = stockSubscribeMapper.selectOne(new QueryWrapper<>(new StockSubscribe())
-                        .eq("code", model.getNewCode()).eq("type",model.getType()));
+                        .eq("code", model.getNewCode()));
                 if (stockSubscribe == null) {
                     return ServerResponse.createByErrorMsg("Failed. Ipo information does not exist");
                 }
diff --git a/src/main/resources/mapper/UserMapper.xml b/src/main/resources/mapper/UserMapper.xml
index 5665a62..25e3a6a 100644
--- a/src/main/resources/mapper/UserMapper.xml
+++ b/src/main/resources/mapper/UserMapper.xml
@@ -36,6 +36,9 @@
   </sql>
 
 
+    <select id="findByPhone" parameterType="string" resultType="com.nq.pojo.User">
+        select * from user where phone= #{phone}
+    </select>
 
     <select id="login" resultMap="BaseResultMap" parameterType="map">
         SELECT
diff --git a/src/main/resources/mapper/UserStockSubscribeMapper.xml b/src/main/resources/mapper/UserStockSubscribeMapper.xml
index f80cfda..dbad41a 100644
--- a/src/main/resources/mapper/UserStockSubscribeMapper.xml
+++ b/src/main/resources/mapper/UserStockSubscribeMapper.xml
@@ -201,9 +201,8 @@
     </update>
 
 
-    <select id="load" resultMap="BaseResultMap">
-        SELECT <include refid="Base_Column_List" />
-        FROM user_stock_subscribe
+    <select id="load" resultType="com.nq.pojo.UserStockSubscribe" parameterType="int">
+        SELECT * FROM user_stock_subscribe
         WHERE id = #{id}
     </select>
 

--
Gitblit v1.9.3