From 183f7ace7ed8de8fe36e36b67c49b0b2ad24ac95 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Fri, 07 Aug 2020 09:56:23 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 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 7bf3550..122b682 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 @@ -13,6 +13,7 @@ import com.xcong.excoin.modules.contract.service.RabbitOrderService; import com.xcong.excoin.modules.documentary.common.NoticeConstant; import com.xcong.excoin.modules.documentary.dao.FollowFollowerOrderRelationDao; +import com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderInfoDao; import com.xcong.excoin.modules.documentary.dao.FollowTraderProfitDetailDao; import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; @@ -76,6 +77,8 @@ private FollowTraderInfoDao followTraderInfoDao; @Resource private FollowTraderProfitDetailDao followTraderProfitDetailDao; + @Resource + private FollowFollowerProfitDao followFollowerProfitDao; @Transactional(rollbackFor = Exception.class) @Override @@ -143,6 +146,9 @@ } } + // 盈亏比例(回报率) + BigDecimal rewardRatio = profitOrLoss.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN); + FollowTraderInfoEntity traderInfoEntity = null; // 判断当前订单是否为跟单 if (ContractOrderEntity.CONTRACTTYPE_DOCUMENTARY == holdOrderEntity.getContractType()) { @@ -151,7 +157,7 @@ traderInfoEntity = followTraderInfoDao.selectTraderInfoByOrderId(holdOrderEntity.getId()); if (profitOrLoss.compareTo(BigDecimal.ZERO) > 0) { // 计算需返利给交易员的金额 - BigDecimal returnMoney = profitOrLoss.subtract(traderInfoEntity.getProfitRatio()); + BigDecimal returnMoney = profitOrLoss.multiply(traderInfoEntity.getProfitRatio()); profitOrLoss = profitOrLoss.subtract(returnMoney); MemberWalletContractEntity traderWallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(traderInfoEntity.getMemberId(), CoinTypeEnum.USDT.name()); memberWalletContractDao.increaseWalletContractBalanceById(returnMoney, returnMoney, null, traderWallet.getId()); @@ -159,9 +165,6 @@ } } } - - // 盈亏比例(回报率) - BigDecimal rewardRatio = profitOrLoss.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN); ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity); contractOrderEntity.setId(null); @@ -192,7 +195,8 @@ if (MemberEntity.IS_TRADER_Y.equals(memberEntity.getIsTrader())) { followOrderOperationService.closingFollowOrders(holdOrderEntity.getOrderNo()); } else { - LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CLOSE_ORDER_TITLE, StrUtil.format(NoticeConstant.CLOSE_ORDER_CONTENT, contractOrderEntity.getSymbol(), contractOrderEntity.getClosingPrice(), profitOrLoss)); + followFollowerProfitDao.updateFollowerProfitByTradeMemberId(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), profitOrLoss, traderInfoEntity.getMemberId(), memberEntity.getId()); + LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.CLOSE_ORDER_TITLE, StrUtil.format(NoticeConstant.CLOSE_ORDER_CONTENT, contractOrderEntity.getSymbol(), contractOrderEntity.getClosingPrice(), profitOrLoss, traderInfoEntity.getNickname())); } } } -- Gitblit v1.9.1