From 292a4634d9c52ce193eca9de356d65960bdc35f4 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 15 Jan 2021 18:20:37 +0800
Subject: [PATCH] 20210115
---
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 78 +++++++++++++++++++++-----------------
1 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
index d5ce636..5b9178e 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -355,43 +355,45 @@
}
// 需要先
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 {
- // 判断redis开关
- String string = redisUtils.getString("SELL_LIMIT_KEY");
- if (StringUtils.isNotBlank(string)) {
- 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;
//查询当前价
BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol + "/USDT")));
+ 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("请输入合适的价格");
+ }
// 获取交易管理的杠杠倍率,手续费率等信息,由平台进行设置
symbol = symbol.toUpperCase();
@@ -658,6 +660,12 @@
OrderCoinsEntity coinsEntityCancel = trader.cancelOrder(orderCoinsEntity);
if (coinsEntityCancel == null) {
// 此时说明撮合系统已经没这个单了 不需要继续处理
+ // 直接更新状态先
+ OrderCoinsEntity update = new OrderCoinsEntity();
+ update.setId(Long.valueOf(orderId));
+ update.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_CANCEL);
+ //orderCoinsEntity.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_CANCEL);
+ orderCoinsDao.updateById(update);
return null;
}
@@ -789,7 +797,7 @@
@Override
public Result findAllWalletCoinOrder() {
- List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.ROC.toString());
+ List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.RFNC.toString());
return Result.ok(orderCoinsDealEntities);
}
@@ -908,7 +916,7 @@
@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) {
--
Gitblit v1.9.1