From 2f6670dc8a71ec0eb2980408d558f2c3d6ddce2a Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Wed, 27 Jan 2021 18:30:42 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java | 27 +++++++++------------------ 1 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java index 3d1476a..08df59a 100644 --- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java @@ -35,6 +35,7 @@ import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity; import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity; import com.xcong.excoin.rabbit.pricequeue.OrderModel; +import com.xcong.excoin.rabbit.pricequeue.whole.WholePriceDataModel; import com.xcong.excoin.utils.*; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -471,6 +472,10 @@ ThreadPoolUtils.calReturnMoney(memberEntity.getId(), fee, contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE); } + @Override + public void wholeBombOrder(WholePriceDataModel wholePriceData) { + + } @Transactional(rollbackFor = Exception.class) @Override @@ -483,7 +488,9 @@ Map<Object, Object> value = redisUtils.hmget(AppContants.WHOLE_BOMB_PREFIX + memberId); if (CollUtil.isNotEmpty(holdOrderEntities)) { - PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting(); + BigDecimal maxLess = BigDecimal.ZERO; + ContractOrderEntity maxLessEntity = null; + BigDecimal totalProfitOrLess = BigDecimal.ZERO; for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) { // 删除次仓订单 contractHoldOrderDao.deleteById(holdOrderEntity.getId()); @@ -491,23 +498,7 @@ String symbolPrice = (String) value.get(holdOrderEntity.getSymbol()); log.info("symbolPrice : {}, symbol : {}", symbolPrice, holdOrderEntity.getSymbol()); BigDecimal currentPrice = new BigDecimal(symbolPrice); - // 单个订单盈利 -// BigDecimal profitOrLess = BigDecimal.ZERO; -// // 开多 -// if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) { -// profitOrLess = currentPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber); -// // 开空 -// } else { -// profitOrLess = holdOrderEntity.getOpeningPrice().subtract(currentPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCntSale())).multiply(lotNumber); -// } -// -// if (MemberEntity.IS_PROFIT_Y == memberEntity.getIsProfit()) { -// if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) { -// profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam())); -// } else { -// profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam())); -// } -// } + BigDecimal profitOrLess = CalculateUtil.calOrderProfitOrLess(holdOrderEntity.getOpeningType(), currentPrice, holdOrderEntity.getOpeningPrice(), lotNumber, holdOrderEntity.getSymbolCntSale(), memberEntity.getIsProfit()); log.info("profitOrLess ---> {}", profitOrLess); ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity); -- Gitblit v1.9.1