wzy
2020-10-15 0c276f7836257053aa77309c40199bd4ce3a0612
modify
4 files modified
53 ■■■■■ changed files
src/main/java/com/xcong/excoin/common/system/controller/LoginController.java 4 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java 16 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java 31 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/common/system/controller/LoginController.java
@@ -111,7 +111,11 @@
        return rsa.encryptBase64(token + "_" + System.currentTimeMillis(), KeyType.PublicKey);
    }
<<<<<<< HEAD
//    @SubmitRepeat
=======
    //@SubmitRepeat
>>>>>>> feature/撮合交易
    @ApiOperation(value = "app注册接口", notes = "app注册接口,验证码必须输入可默认为123456")
    @PostMapping(value = "/register")
    public Result register(@RequestBody @Validated RegisterDto registerDto) {
src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
@@ -116,7 +116,7 @@
        boolean isDebug = applicationProperties.isDebug();
        if (!isDebug) {
            long currentTime = System.currentTimeMillis();
            return currentTime - time <= 10000;
            return currentTime - time <= 30000;
        }
        return true;
    }
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -383,12 +383,15 @@
        BigDecimal nowPriceinBigDecimal = price;
        //查询当前价
        BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol + "/USDT")));
<<<<<<< HEAD
        BigDecimal subPrice = nowPrice.multiply(BigDecimal.valueOf(0.2));
        BigDecimal minPrice = nowPrice.subtract(subPrice);
        BigDecimal maxPrice = nowPrice.add(subPrice);
        if (nowPriceinBigDecimal.compareTo(minPrice) < 0 || nowPriceinBigDecimal.compareTo(maxPrice) > 0) {
            return Result.fail("请输入合适的价格");
        }
=======
>>>>>>> feature/撮合交易
        // 获取交易管理的杠杠倍率,手续费率等信息,由平台进行设置
        symbol = symbol.toUpperCase();
@@ -419,6 +422,19 @@
            closingPrice = price.multiply(amount).multiply(tradeSetting.getCoinFeeRatio());
            totalPayPrice = price.multiply(amount).add(closingPrice);
            entrustAmount = price.multiply(amount);
            // 限价买不能高于当前10%
            if (OrderCoinsEntity.ORDERTYPE_BUY == type) {
                BigDecimal multiply = nowPrice.multiply(new BigDecimal("1.2"));
                if(price.compareTo(multiply)>0){
                    return Result.fail("不能高于当前价的120%");
                }
            }else{
                // 卖不能小于当前90
                BigDecimal multiply = nowPrice.multiply(new BigDecimal("0.8"));
                if(price.compareTo(multiply)<0){
                    return Result.fail("不能低于当前价的80%");
                }
            }
        } else {
            // 市价
            if (OrderCoinsEntity.ORDERTYPE_BUY == type) {
src/main/java/com/xcong/excoin/modules/exchange/service/impl/HandleKlineServiceImpl.java
@@ -49,7 +49,35 @@
                newPrice=exchangeTrade.getPrice();
            }
        }
        // 更新今日高地价
        BigDecimal min=BigDecimal.ZERO;
        BigDecimal max=BigDecimal.ZERO;
        BigDecimal vol = BigDecimal.ZERO;
        for (ExchangeTrade exchangeTrade : trades) {
            if(exchangeTrade==null){
                continue;
            }
            min=exchangeTrade.getPrice().min(min);
            max=exchangeTrade.getPrice().max(max);
            vol=vol.add(exchangeTrade.getAmount());
        }
        Object o = redisUtils.get(symbolUsdt);
        if(o!=null){
            Candlestick today =   (Candlestick)o;
            today.setHigh(today.getHigh().max(max));
            today.setLow(today.getLow().min(min));
            today.setVolume(today.getVolume().add(vol));
            redisUtils.set(symbolUsdt,today);
        }else{
            Candlestick today =   new Candlestick();
            today.setClose(newPrice);
            today.setLow(newPrice);
            today.setHigh(newPrice);
            today.setHigh(today.getHigh().max(max));
            today.setLow(today.getLow().min(min));
            today.setLow(vol);
            redisUtils.set(symbolUsdt,today);
        }
        // 存入redis,websocket去取
        String key = "NEW_KINE_{}";
        key = StrUtil.format(key, symbolUsdt);
@@ -60,4 +88,5 @@
        }
    }
}