| | |
| | | }
|
| | | // 需要先
|
| | | 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("卖出受限");
|
| | | }
|
| | | }
|
| | | // 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;
|
| | | //查询当前价
|
| | |
| | |
|
| | | @Override
|
| | | public Result findAllWalletCoinOrder() {
|
| | | List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.ROC.toString());
|
| | | List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.RFNC.toString());
|
| | | return Result.ok(orderCoinsDealEntities);
|
| | | }
|
| | |
|
| | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void dealEntrustCoinOrder() {
|
| | | List<String> ignoreTypes = new ArrayList<>();
|
| | | ignoreTypes.add(SymbolsConstats.ROC);
|
| | | ignoreTypes.add(SymbolsConstats.RFNC);
|
| | | List<OrderCoinsEntity> list = orderCoinsDao.selectAllEntrustingCoinOrderList(ignoreTypes);
|
| | | if (CollUtil.isNotEmpty(list)) {
|
| | | for (OrderCoinsEntity orderCoinsEntity : list) {
|
| | |
| | | if (CollectionUtils.isNotEmpty(trades)) {
|
| | | for (OrderCoinsEntity trade : trades) {
|
| | | if (trade != null) {
|
| | | orderCoinsDao.updateStatus(trade.getId(),OrderCoinsEntity.ORDERSTATUS_DONE);
|
| | | //orderCoinsDao.updateStatus(trade.getId(),OrderCoinsEntity.ORDERSTATUS_DONE);
|
| | | ids.add(trade.getId());
|
| | | // 买单 实际成交金额小于委托的 这一部分从冻结扣除
|
| | | if(OrderCoinsEntity.ORDERTYPE_BUY==trade.getOrderType()){
|
| | | if(trade.getEntrustAmount().compareTo(trade.getDealAmount())>0){
|
| | | // 此时退回这部分的差额
|
| | | BigDecimal subtract = trade.getEntrustAmount().subtract(trade.getDealAmount());
|
| | | System.out.println(subtract);
|
| | | MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(trade.getMemberId(), CoinTypeEnum.USDT.name());
|
| | | if(memberWalletCoinEntity!=null){
|
| | | memberWalletCoinDao.updateWalletBalance(memberWalletCoinEntity.getId(),subtract,null,subtract.negate());
|
| | |
| | | }
|
| | | }
|
| | | if (CollectionUtils.isNotEmpty(ids)) {
|
| | | // orderCoinsDao.batchUpdateStatus(ids, OrderCoinsEntity.ORDERSTATUS_DONE);
|
| | | orderCoinsDao.batchUpdateStatus(ids, OrderCoinsEntity.ORDERSTATUS_DONE);
|
| | | }
|
| | | }
|
| | |
|