From c616dbc2d763e32aa55b7ea165c40a9aa375d86b Mon Sep 17 00:00:00 2001
From: jack <zengjieli93@163.com>
Date: Thu, 28 Mar 2024 13:04:41 +0800
Subject: [PATCH] 0311 增加百分比

---
 src/main/java/com/nq/utils/stock/sina/StockApi.java                 |   18 ---
 src/main/java/com/nq/vo/stock/StockListVO.java                      |  220 -------------------------------------------
 src/main/java/com/nq/ws/WebSocketClientBeanConfig.java              |    4 
 src/main/java/com/nq/service/impl/UserFundsPositionServiceImpl.java |    7 -
 4 files changed, 7 insertions(+), 242 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserFundsPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserFundsPositionServiceImpl.java
index 69d98a0..601ff43 100644
--- a/src/main/java/com/nq/service/impl/UserFundsPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserFundsPositionServiceImpl.java
@@ -187,7 +187,6 @@
             return ServerResponse.createByErrorMsg("报价0,平仓失败,请稍后再试");
         }
 
-        double stock_crease = stockListVO.getHcrate().doubleValue();
 
         BigDecimal zsPrice = new BigDecimal(stockListVO.getPreclose_px());
 
@@ -197,12 +196,6 @@
 
         BigDecimal ztRate = chaPrice.multiply(new BigDecimal("100")).divide(zsPrice, 2, 4);
 
-        ztRate = ztRate.negate();
-        log.info("股票当前涨跌幅 = {} 跌停幅度 = {}", Double.valueOf(stock_crease), ztRate);
-        if ((new BigDecimal(String.valueOf(stock_crease))).compareTo(ztRate) == 0 && "买涨"
-                .equals(userPosition.getOrderDirection())) {
-            return ServerResponse.createByErrorMsg("当前股票已跌停不能卖出");
-        }
 
         Integer buy_num = userPosition.getOrderNum();
 
diff --git a/src/main/java/com/nq/utils/stock/sina/StockApi.java b/src/main/java/com/nq/utils/stock/sina/StockApi.java
index f02b67a..82a197b 100644
--- a/src/main/java/com/nq/utils/stock/sina/StockApi.java
+++ b/src/main/java/com/nq/utils/stock/sina/StockApi.java
@@ -38,12 +38,8 @@
                 Stock stock = stocks.get(i);
                 StockRealTimeBean realTimeStock = RedisKeyUtil.getCacheRealTimeStock(stock);
                 StockListVO stockListVO = new StockListVO();
-
-                if(realTimeStock.getPcp().contains("%")){
-                    realTimeStock.setPcp(realTimeStock.getPcp()+"%");
-                }
-
                 stockListVO.setHcrate(new BigDecimal(realTimeStock.getPcp()));
+                stockListVO.setHcrateP(realTimeStock.getPcp()+"%");
                 if(realTimeStock.getPcp().contains("-")){
                     stockListVO.setColor(0);
                 }else{
@@ -118,17 +114,9 @@
         }
         try {
             StockRealTimeBean qhBean = RedisKeyUtil.getCacheRealTimeStock(stock);
-            if(!qhBean.getPcp().endsWith("%")){
-                stockListVO.setHcrate(qhBean.getPcp()+"%");
-            }else{
-                stockListVO.setHcrate(qhBean.getPcp());
-            }
 
-            if(qhBean.getPcp().startsWith("-")){
-                stockListVO.setColor("rgb(208, 75, 100)");
-            }else{
-                stockListVO.setColor("rgb(3, 173, 143)");
-            }
+
+            stockListVO.setHcrate(qhBean.getPcp());
             stockListVO.setNowPrice(qhBean.getLast());
             stockListVO.setToday_max(qhBean.getHigh());
             stockListVO.setToday_min(qhBean.getLow());
diff --git a/src/main/java/com/nq/vo/stock/StockListVO.java b/src/main/java/com/nq/vo/stock/StockListVO.java
index 7c5f3e6..d7803c1 100644
--- a/src/main/java/com/nq/vo/stock/StockListVO.java
+++ b/src/main/java/com/nq/vo/stock/StockListVO.java
@@ -21,6 +21,8 @@
 
     private BigDecimal hcrate;
 
+    private String hcrateP;
+
     private String today_max;
 
     public void setName(String name) {
@@ -40,224 +42,6 @@
     private String type;
 
     private int color;
-    public void setCode(String code) {
-        this.code = code;
-    }
-
-    public void setSpell(String spell) {
-        this.spell = spell;
-    }
-
-    public void setGid(String gid) {
-        this.gid = gid;
-    }
-
-    public void setNowPrice(String nowPrice) {
-        this.nowPrice = nowPrice;
-    }
-
-    public void setHcrate(BigDecimal hcrate) {
-        this.hcrate = hcrate;
-    }
-
-    public void setToday_max(String today_max) {
-        this.today_max = today_max;
-    }
-
-    public void setToday_min(String today_min) {
-        this.today_min = today_min;
-    }
-
-    public void setBusiness_balance(String business_balance) {
-        this.business_balance = business_balance;
-    }
-
-    public void setBusiness_amount(String business_amount) {
-        this.business_amount = business_amount;
-    }
-
-    public void setPreclose_px(String preclose_px) {
-        this.preclose_px = preclose_px;
-    }
-
-    public void setOpen_px(String open_px) {
-        this.open_px = open_px;
-    }
-
-    public void setDay3Rate(BigDecimal day3Rate) {
-        this.day3Rate = day3Rate;
-    }
-
-    public void setStock_type(String stock_type) {
-        this.stock_type = stock_type;
-    }
-
-    public void setStock_plate(String stock_plate) {
-        this.stock_plate = stock_plate;
-    }
-
-    public boolean equals(Object o) {
-        if (o == this) return true;
-        if (!(o instanceof StockListVO)) return false;
-        StockListVO other = (StockListVO) o;
-        if (!other.canEqual(this)) return false;
-        Object this$name = getName(), other$name = other.getName();
-        if ((this$name == null) ? (other$name != null) : !this$name.equals(other$name)) return false;
-        Object this$code = getCode(), other$code = other.getCode();
-        if ((this$code == null) ? (other$code != null) : !this$code.equals(other$code)) return false;
-        Object this$spell = getSpell(), other$spell = other.getSpell();
-        if ((this$spell == null) ? (other$spell != null) : !this$spell.equals(other$spell)) return false;
-        Object this$gid = getGid(), other$gid = other.getGid();
-        if ((this$gid == null) ? (other$gid != null) : !this$gid.equals(other$gid)) return false;
-        Object this$nowPrice = getNowPrice(), other$nowPrice = other.getNowPrice();
-        if ((this$nowPrice == null) ? (other$nowPrice != null) : !this$nowPrice.equals(other$nowPrice)) return false;
-        Object this$hcrate = getHcrate(), other$hcrate = other.getHcrate();
-        if ((this$hcrate == null) ? (other$hcrate != null) : !this$hcrate.equals(other$hcrate)) return false;
-        Object this$today_max = getToday_max(), other$today_max = other.getToday_max();
-        if ((this$today_max == null) ? (other$today_max != null) : !this$today_max.equals(other$today_max))
-            return false;
-        Object this$today_min = getToday_min(), other$today_min = other.getToday_min();
-        if ((this$today_min == null) ? (other$today_min != null) : !this$today_min.equals(other$today_min))
-            return false;
-        Object this$business_balance = getBusiness_balance(), other$business_balance = other.getBusiness_balance();
-        if ((this$business_balance == null) ? (other$business_balance != null) : !this$business_balance.equals(other$business_balance))
-            return false;
-        Object this$business_amount = getBusiness_amount(), other$business_amount = other.getBusiness_amount();
-        if ((this$business_amount == null) ? (other$business_amount != null) : !this$business_amount.equals(other$business_amount))
-            return false;
-        Object this$preclose_px = getPreclose_px(), other$preclose_px = other.getPreclose_px();
-        if ((this$preclose_px == null) ? (other$preclose_px != null) : !this$preclose_px.equals(other$preclose_px))
-            return false;
-        Object this$open_px = getOpen_px(), other$open_px = other.getOpen_px();
-        if ((this$open_px == null) ? (other$open_px != null) : !this$open_px.equals(other$open_px)) return false;
-        Object this$day3Rate = getDay3Rate(), other$day3Rate = other.getDay3Rate();
-        if ((this$day3Rate == null) ? (other$day3Rate != null) : !this$day3Rate.equals(other$day3Rate)) return false;
-        Object this$stock_type = getStock_type(), other$stock_type = other.getStock_type();
-        if ((this$stock_type == null) ? (other$stock_type != null) : !this$stock_type.equals(other$stock_type))
-            return false;
-        Object this$stock_plate = getStock_plate(), other$stock_plate = other.getStock_plate();
-        return !((this$stock_plate == null) ? (other$stock_plate != null) : !this$stock_plate.equals(other$stock_plate));
-    }
-
-    protected boolean canEqual(Object other) {
-        return other instanceof StockListVO;
-    }
-
-    public int hashCode() {
-        int PRIME = 59;
-        int result = 1;
-        Object $name = getName();
-        result = result * 59 + (($name == null) ? 43 : $name.hashCode());
-        Object $code = getCode();
-        result = result * 59 + (($code == null) ? 43 : $code.hashCode());
-        Object $spell = getSpell();
-        result = result * 59 + (($spell == null) ? 43 : $spell.hashCode());
-        Object $gid = getGid();
-        result = result * 59 + (($gid == null) ? 43 : $gid.hashCode());
-        Object $nowPrice = getNowPrice();
-        result = result * 59 + (($nowPrice == null) ? 43 : $nowPrice.hashCode());
-        Object $hcrate = getHcrate();
-        result = result * 59 + (($hcrate == null) ? 43 : $hcrate.hashCode());
-        Object $today_max = getToday_max();
-        result = result * 59 + (($today_max == null) ? 43 : $today_max.hashCode());
-        Object $today_min = getToday_min();
-        result = result * 59 + (($today_min == null) ? 43 : $today_min.hashCode());
-        Object $business_balance = getBusiness_balance();
-        result = result * 59 + (($business_balance == null) ? 43 : $business_balance.hashCode());
-        Object $business_amount = getBusiness_amount();
-        result = result * 59 + (($business_amount == null) ? 43 : $business_amount.hashCode());
-        Object $preclose_px = getPreclose_px();
-        result = result * 59 + (($preclose_px == null) ? 43 : $preclose_px.hashCode());
-        Object $open_px = getOpen_px();
-        result = result * 59 + (($open_px == null) ? 43 : $open_px.hashCode());
-        Object $day3Rate = getDay3Rate();
-        result = result * 59 + (($day3Rate == null) ? 43 : $day3Rate.hashCode());
-        Object $stock_type = getStock_type();
-        result = result * 59 + (($stock_type == null) ? 43 : $stock_type.hashCode());
-        Object $stock_plate = getStock_plate();
-        return result * 59 + (($stock_plate == null) ? 43 : $stock_plate.hashCode());
-    }
-
-    public String toString() {
-        return "StockListVO(name=" + getName() + ", code=" + getCode() + ", spell=" + getSpell() + ", gid=" + getGid() + ", nowPrice=" + getNowPrice() + ", hcrate=" + getHcrate() + ", today_max=" + getToday_max() + ", today_min=" + getToday_min() + ", business_balance=" + getBusiness_balance() + ", business_amount=" + getBusiness_amount() + ", preclose_px=" + getPreclose_px() + ", open_px=" + getOpen_px() + ", day3Rate=" + getDay3Rate() + ", stock_type=" + getStock_type() + ", stock_plate=" + getStock_plate() + ")";
-    }
 
 
-    public String getName() {
-        return this.name;
-    }
-
-    public String getCode() {
-        return this.code;
-    }
-
-    public String getSpell() {
-        return this.spell;
-    }
-
-    public String getGid() {
-        return this.gid;
-    }
-
-
-    public String getNowPrice() {
-        return this.nowPrice;
-    }
-
-
-    public BigDecimal getHcrate() {
-        return this.hcrate;
-    }
-
-
-    public String getToday_max() {
-        return this.today_max;
-    }
-
-
-    public String getToday_min() {
-        return this.today_min;
-    }
-
-
-    public String getBusiness_balance() {
-        return this.business_balance;
-    }
-
-
-    public String getBusiness_amount() {
-        return this.business_amount;
-    }
-
-
-    public String getPreclose_px() {
-        return this.preclose_px;
-    }
-
-
-    public String getOpen_px() {
-        return this.open_px;
-    }
-
-
-    public BigDecimal getDay3Rate() {
-        return this.day3Rate;
-    }
-
-
-    public String getStock_type() {
-        return this.stock_type;
-    }
-
-    public String getStock_plate() {
-        return this.stock_plate;
-    }
-
-    public String getIsOption() {
-        return isOption;
-    }
-
-    public void setIsOption(String isOption) {
-        this.isOption = isOption;
-    }
 }
diff --git a/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java b/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
index 720492e..639832f 100644
--- a/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
+++ b/src/main/java/com/nq/ws/WebSocketClientBeanConfig.java
@@ -26,7 +26,7 @@
 
 
         try {
-            WebsocketRunClient websocketRunClient = new WebsocketRunClient(new URI(PropertiesUtil.getProperty("US_WS_URL")));
+            WebsocketRunClient websocketRunClient = new WebsocketRunClient(new URI(PropertiesUtil.getProperty("MAS_WS_URL")));
             websocketRunClient.connect();
             websocketRunClient.setConnectionLostTimeout(0);
             new Thread(() -> {
@@ -45,7 +45,7 @@
         }
 
         try {
-            USWebsocketRunClient usWebsocketRunClient = new USWebsocketRunClient(new URI(PropertiesUtil.getProperty("MAS_WS_URL")));
+            USWebsocketRunClient usWebsocketRunClient = new USWebsocketRunClient(new URI(PropertiesUtil.getProperty("US_WS_URL")));
             usWebsocketRunClient.connect();
             usWebsocketRunClient.setConnectionLostTimeout(0);
             new Thread(() -> {

--
Gitblit v1.9.3