zainali5120
2020-10-19 066139a0179cf9760abffae650ca0ffef1976fcb
优化卖出限制,使用redis配置进行控制
2 files modified
13 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java 11 ●●●● patch | view | raw | blame | history
src/main/resources/application.yml 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -381,7 +381,11 @@
//                    return Result.fail("买入额度受限");
//                }
            } else {
                // 判断redis开关
                String string = redisUtils.getString("SELL_LIMIT_KEY");
                if (StringUtils.isNotBlank(string)) {
               return Result.fail("卖出受限");
                }
            }
        }
@@ -419,18 +423,15 @@
            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"));
            multiply=  nowPrice.multiply(new BigDecimal("0.8"));
                if(price.compareTo(multiply)<0){
                    return Result.fail("不能低于当前价的80%");
                }
            }
        } else {
            // 市价
            if (OrderCoinsEntity.ORDERTYPE_BUY == type) {
src/main/resources/application.yml
@@ -5,7 +5,7 @@
spring:
  profiles:
    active: test
    active: dayline
  datasource:
    url: jdbc:mysql://rm-bp1i2g5rg5dubo9s40o.mysql.rds.aliyuncs.com:3306/db_roc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
    username: roc_user