1
zj
2024-04-26 20b8e71d1b5079dc2f32fbbf0931380ca4d5e243
1
5 files modified
38 ■■■■■ changed files
src/main/java/com/nq/service/impl/StockDzServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/StockSubscribeServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/nq/service/impl/UserPositionServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/UserPositionMapper.xml 10 ●●●● patch | view | raw | blame | history
target/classes/mapper/UserPositionMapper.xml 10 ●●●● patch | view | raw | blame | history
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("股票代码已存在");
        }
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("新股代码不存在");
        }
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;
                }
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>
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>