From 20b8e71d1b5079dc2f32fbbf0931380ca4d5e243 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Fri, 26 Apr 2024 23:24:13 +0800
Subject: [PATCH] 1
---
src/main/resources/mapper/UserPositionMapper.xml | 10 +++++-----
src/main/java/com/nq/service/impl/StockDzServiceImpl.java | 4 ++--
target/classes/mapper/UserPositionMapper.xml | 10 +++++-----
src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java | 2 +-
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | 12 ++++--------
5 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/src/main/java/com/nq/service/impl/StockDzServiceImpl.java b/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
index 65dd361..f9e1199 100644
--- a/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockDzServiceImpl.java
@@ -66,13 +66,13 @@
}
QueryWrapper queryWrapper = new QueryWrapper();
- queryWrapper.eq("stock_spell",stockCode);
+ queryWrapper.eq("stock_code",stockCode);
Stock stock = stockMapper.selectOne(queryWrapper);
if (stock == null){
return ServerResponse.createByErrorMsg("股票代码不存在");
}
- Long count = stockDzMapper.selectCount(new LambdaQueryWrapper<StockDz>().eq(StockDz::getStockSpell, stockCode));
+ Long count = stockDzMapper.selectCount(new LambdaQueryWrapper<StockDz>().eq(StockDz::getStockCode, stockCode));
if(count > 0){
return ServerResponse.createByErrorMsg("股票代码已存在");
}
diff --git a/src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java b/src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java
index d520922..a4a35e3 100644
--- a/src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java
@@ -83,7 +83,7 @@
public ServerResponse add(StockSubscribe model, HttpServletRequest request) {
//判断是否已经存在
log.info("model:{}", model);
- Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockSpell, model.getCode()).last(" limit 1"));
+ Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockCode, model.getCode()).last(" limit 1"));
if(null == stock){
return ServerResponse.createByErrorMsg("新股代码不存在");
}
diff --git a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
index f29214f..6209313 100644
--- a/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -1172,7 +1172,7 @@
return ServerResponse.createByErrorMsg("该新股不存在");
}
if (userStockSubscribe.getStatus() == 4 || userStockSubscribe.getStatus() == 3 && stockSubscribe.getType() == 2) {
- Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockSpell, userStockSubscribe.getNewCode()));
+ Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockCode, userStockSubscribe.getNewCode()));
if(null == stock){
return ServerResponse.createByErrorMsg("该新股不存在");
}
@@ -1617,10 +1617,6 @@
Result result = getResult(position);
if (result == null) continue;
- //利润为0不需要进行强制平仓
- if(result.signum == 0){
- continue;
- }
boolean liquidation = false;
liquidation = isLiquidation(position, result.signum, result.profit, liquidation);
if(liquidation){
@@ -1703,7 +1699,7 @@
//如果买涨 signum 为-1则表示亏损
if(signum == -1){
//止损
- if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) >= 0){
+ if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) <= 0){
//强制平仓
return liquidation = true;
}
@@ -1722,7 +1718,7 @@
//买跌 signum
if(signum == 1){
//止损
- if(null != position.getStopTargetPrice() && profit.compareTo(position.getStopTargetPrice()) >= 0){
+ if(null != position.getStopTargetPrice() && nowPrice.compareTo(position.getStopTargetPrice()) >= 0){
//强制平仓
return liquidation = true;
}
@@ -1733,7 +1729,7 @@
}
}else{
//止盈
- if(null != position.getProfitTargetPrice() && profit.compareTo(position.getProfitTargetPrice()) >= 0){
+ if(null != position.getProfitTargetPrice() && nowPrice.compareTo(position.getProfitTargetPrice()) <= 0){
//强制平仓
return liquidation = true;
}
diff --git a/src/main/resources/mapper/UserPositionMapper.xml b/src/main/resources/mapper/UserPositionMapper.xml
index 7025a34..1edb775 100644
--- a/src/main/resources/mapper/UserPositionMapper.xml
+++ b/src/main/resources/mapper/UserPositionMapper.xml
@@ -485,7 +485,7 @@
<include refid="Base_Column_List"/>
FROM user_position
<where>
- <if test="searchId != null ">
+ <if test="searchId != null and searchId != '' ">
and agent_id = #{searchId}
</if>
<if test="state != null ">
@@ -502,16 +502,16 @@
<if test="positionSn != null and positionSn != '' ">
and position_sn like CONCAT('%','${positionSn}','%')
</if>
- <if test="positionType != null ">
+ <if test="positionType != null and positionType != ''">
and position_type = #{positionType}
</if>
- <if test="beginTime != null ">
+ <if test="beginTime != null and beginTime != ''">
and sell_order_time <![CDATA[>=]]> #{beginTime}
</if>
- <if test="endTime != null ">
+ <if test="endTime != null and endTime != ''">
and sell_order_time <![CDATA[<=]]> #{endTime}
</if>
- <if test="phone != null ">
+ <if test="phone != null and phone != ''">
and user_id = (select id from user where phone = #{phone})
</if>
diff --git a/target/classes/mapper/UserPositionMapper.xml b/target/classes/mapper/UserPositionMapper.xml
index 7025a34..1edb775 100644
--- a/target/classes/mapper/UserPositionMapper.xml
+++ b/target/classes/mapper/UserPositionMapper.xml
@@ -485,7 +485,7 @@
<include refid="Base_Column_List"/>
FROM user_position
<where>
- <if test="searchId != null ">
+ <if test="searchId != null and searchId != '' ">
and agent_id = #{searchId}
</if>
<if test="state != null ">
@@ -502,16 +502,16 @@
<if test="positionSn != null and positionSn != '' ">
and position_sn like CONCAT('%','${positionSn}','%')
</if>
- <if test="positionType != null ">
+ <if test="positionType != null and positionType != ''">
and position_type = #{positionType}
</if>
- <if test="beginTime != null ">
+ <if test="beginTime != null and beginTime != ''">
and sell_order_time <![CDATA[>=]]> #{beginTime}
</if>
- <if test="endTime != null ">
+ <if test="endTime != null and endTime != ''">
and sell_order_time <![CDATA[<=]]> #{endTime}
</if>
- <if test="phone != null ">
+ <if test="phone != null and phone != ''">
and user_id = (select id from user where phone = #{phone})
</if>
--
Gitblit v1.9.3