| | |
| | | if(!MemberEntity.CERTIFY_STATUS_Y.equals(memberEntity.getCertifyStatus())){
|
| | | return Result.fail(MessageSourceUtils.getString("member_controller_0001"));
|
| | | }
|
| | | // 需要先
|
| | | String phone = memberEntity.getPhone();
|
| | | if(!"13632989240".equals(phone) && !"15158130575".equals(phone)){
|
| | | if(OrderCoinsEntity.ORDERTYPE_BUY.equals(type)){
|
| | | // 不能超过800个
|
| | |
|
| | | if(amount!=null && amount.compareTo(new BigDecimal("800"))>0){
|
| | | return Result.fail("买入额度受限");
|
| | | }
|
| | | BigDecimal bigDecimal = orderCoinDealDao.sumTodayBuyAmount(memberId, symbol);
|
| | | if(bigDecimal==null){
|
| | | bigDecimal= BigDecimal.ZERO;
|
| | | }
|
| | | amount= amount==null?BigDecimal.ZERO:amount;
|
| | | bigDecimal = bigDecimal.add(amount);
|
| | | if(bigDecimal!=null && bigDecimal.compareTo(new BigDecimal("800"))>0){
|
| | | return Result.fail("买入额度受限");
|
| | | }
|
| | | // 挂单不能超过800
|
| | | BigDecimal bigDecimal1 = orderCoinDealDao.sumTodayEntrustCntBuyAmount(memberId, symbol);
|
| | | if(bigDecimal1==null){
|
| | | bigDecimal1=BigDecimal.ZERO;
|
| | | }
|
| | | bigDecimal1 = bigDecimal1.add(amount);
|
| | | if(bigDecimal1!=null && bigDecimal1.compareTo(new BigDecimal("800"))>0){
|
| | | return Result.fail("买入额度受限");
|
| | | }
|
| | | }else{
|
| | | return Result.fail("卖出受限");
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal nowPriceinBigDecimal = price;
|
| | | //查询当前价
|
| | | //BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol + "/USDT")));
|
| | |
| | | if (SymbolsConstats.EXCHANGE_SYMBOLS.contains(orderCoinsEntity.getSymbol())) {
|
| | | orderSubmitProducer.sendCancelMsg(orderId);
|
| | | // return this.cancelEntrustWalletCoinOrderForMatch(orderId);
|
| | | return Result.ok("order_service_0013");
|
| | | return Result.ok(MessageSourceUtils.getString("order_service_0013"));
|
| | | }
|
| | | if (orderCoinsEntity.getOrderStatus() == OrderCoinsEntity.ORDERSTATUS_CANCEL || orderCoinsEntity.getOrderStatus()==OrderCoinsEntity.ORDERSTATUS_DONE) {
|
| | | return Result.fail(MessageSourceUtils.getString("order_service_0012"));
|
| | |
| | | detail.setDealPrice(orderCoinsEntity.getDealPrice());
|
| | | detail.setDealAmount(orderCoinsEntity.getDealAmount());
|
| | | detail.setFeeAmount(orderCoinsEntity.getFeeAmount());
|
| | | orderCoinDealDao.insert(detail);
|
| | |
|
| | | if (OrderCoinsEntity.ORDERTYPE_BUY.equals(orderCoinsEntity.getOrderType())) {
|
| | | //如果是限价买入,撤单将USDT账户冻结金额返回
|
| | | String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
|
| | |
| | | BigDecimal needFee = orderCoinsEntity.getFeeAmount().multiply(dealAmount.divide(orderCoinsEntity.getEntrustAmount(), 8, BigDecimal.ROUND_DOWN));
|
| | | returnFee = orderCoinsEntity.getFeeAmount().subtract(needFee);
|
| | | }
|
| | | BigDecimal avi = walletCoin.getAvailableBalance().add(returnBalance).add(returnFee);
|
| | | BigDecimal avi = returnBalance.add(returnFee);
|
| | | memberWalletCoinDao.updateWalletBalance(walletCoin.getId(),avi,null,returnBalance.negate());
|
| | | walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(returnBalance).add(returnFee));
|
| | | walletCoin.setFrozenBalance(walletCoin.getFrozenBalance().subtract(returnBalance));
|
| | |
| | | return Result.ok(MessageSourceUtils.getString("order_service_0013"));
|
| | | }
|
| | | }
|
| | | orderCoinDealDao.insert(detail);
|
| | | }
|
| | | return Result.fail(MessageSourceUtils.getString("order_service_0043"));
|
| | | }
|