| | |
| | | String yyyyMMdd = DateUtil.dateToString(new Date(), "yyyyMMdd");
|
| | | String persentKey = String.format(LIMIT_SELL_PERSENT_KEY,yyyyMMdd,memberId.toString());
|
| | | BigDecimal aviSell =BigDecimal.ZERO;
|
| | | if(StringUtils.isBlank(persentKey)){
|
| | | String string = redisUtils.getString(persentKey);
|
| | | if(StringUtils.isBlank(string)){
|
| | | // 当日可以卖的数量
|
| | | aviSell = spread.divide(PERSENT,4, RoundingMode.HALF_UP).multiply(availableBalance);
|
| | | }else{
|
| | | aviSell = new BigDecimal(string);
|
| | | }
|
| | |
|
| | | if(aviSell.compareTo(amount)<0){
|
| | | return Result.fail("卖出超过上限"+spread+"%");
|
| | | return Result.fail("卖出超过上限"+spread.setScale(0,RoundingMode.HALF_UP)+"%");
|
| | | }
|
| | | aviSell = aviSell.subtract(amount);
|
| | | // 设置
|