| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.huobi.client.model.Candlestick; |
| | | import com.xcong.excoin.common.LoginUserUtils; |
| | | import com.xcong.excoin.common.contants.AppContants; |
| | | import com.xcong.excoin.common.enumerates.CoinTypeEnum; |
| | |
| | | import com.xcong.excoin.modules.contract.parameter.vo.*; |
| | | import com.xcong.excoin.modules.contract.service.ContractHoldOrderService; |
| | | 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.entity.FollowFollowerOrderRelationEntity; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity; |
| | | import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; |
| | | import com.xcong.excoin.modules.member.dao.MemberDao; |
| | | import com.xcong.excoin.modules.member.dao.MemberLevelRateDao; |
| | |
| | | |
| | | @Resource |
| | | private MemberDao memberDao; |
| | | |
| | | @Resource |
| | | private MemberSettingDao memberSettingDao; |
| | | |
| | | @Resource |
| | | private FollowFollowerProfitDao followFollowerProfitDao; |
| | | |
| | | @Resource |
| | | private FollowTraderInfoDao followTraderInfoDao; |
| | |
| | | wholeHoldOrder.setSymbolCntSale(wholeHoldOrder.getSymbolCntSale() + submitOrderDto.getSymbolCnt()); |
| | | wholeHoldOrder.setPrePaymentAmount(prePaymentAmount.add(wholeHoldOrder.getPrePaymentAmount())); |
| | | wholeHoldOrder.setOperateNo(wholeHoldOrder.getOperateNo()); |
| | | wholeHoldOrder.setHoldBond(CalculateUtil.calMemberHoldBond(wholeHoldOrder)); |
| | | int i = contractHoldOrderDao.updateById(wholeHoldOrder); |
| | | if (i > 0) { |
| | | memberWalletContractDao.increaseWalletContractBalanceById(prePaymentAmount.negate(), openFeePrice.negate(), null, walletContract.getId()); |
| | | |
| | | // 全仓爆仓 |
| | | ThreadPoolUtils.sendWholePrice(memberEntity.getId()); |
| | | |
| | | // 发送预估强平价 |
| | | ThreadPoolUtils.sendWholeForceClosingPrice(submitOrderDto.getSymbol(), memberEntity); |
| | |
| | | |
| | | ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity); |
| | | contractOrderEntity.setOpeningTime(new Date()); |
| | | |
| | | holdOrderEntity.setHoldBond(CalculateUtil.calMemberHoldBond(holdOrderEntity)); |
| | | contractHoldOrderDao.insert(holdOrderEntity); |
| | | int i = contractOrderDao.insert(contractOrderEntity); |
| | | |
| | |
| | | if (equity.compareTo(BigDecimal.ZERO) <= 0) { |
| | | equity = BigDecimal.ZERO; |
| | | } |
| | | |
| | | |
| | | // 获取当日k线的开盘价 |
| | | Candlestick symbolObject = (Candlestick) redisUtils.get(symbol); |
| | | BigDecimal openPrice = symbolObject.getOpen(); |
| | | BigDecimal upOrDown = newPriceSymbol.subtract(openPrice).divide(openPrice, 8, BigDecimal.ROUND_HALF_UP); |
| | | contractMoneyInfoVo.setBeUsedBondAmount(beUsedBondAmount); |
| | | contractMoneyInfoVo.setFrozenBondAmount(frozenBondAmount); |
| | | contractMoneyInfoVo.setEquity(equity); |
| | |
| | | contractMoneyInfoVo.setFeeRatio(tradeSetting.getFeeRatio()); |
| | | contractMoneyInfoVo.setLeverAgeRatio(tradeSetting.getLeverageRatio()); |
| | | contractMoneyInfoVo.setNewPrice(newPriceSymbol); |
| | | contractMoneyInfoVo.setUpOrDown(upOrDown); |
| | | contractMoneyInfoVo.setSymbolSku(cacheSettingUtils.getSymbolSku(symbol)); |
| | | contractMoneyInfoVo.setLeverRate(rateEntity.getLevelRateUp()); |
| | | return Result.ok(contractMoneyInfoVo); |
| | |
| | | if (CollUtil.isNotEmpty(list) || CollUtil.isNotEmpty(entrustList)) { |
| | | return Result.fail("存在持仓/委托, 无法更改"); |
| | | } |
| | | |
| | | /** |
| | | * 验证用户是否存在跟随交易员 |
| | | * 是:不允许切换成全仓模式 |
| | | */ |
| | | List<FollowFollowerProfitEntity> followFollowerProfitEntitys = followFollowerProfitDao.selectByMemberIdandIsFollow(member.getId(),FollowFollowerProfitEntity.IS_FOLLOW_Y); |
| | | if(CollUtil.isNotEmpty(followFollowerProfitEntitys)) { |
| | | return Result.fail(MessageSourceUtils.getString("documentary_service_0018")); |
| | | } |
| | | |
| | | Integer positionType = member.getContractPositionType() == ContractEntrustOrderEntity.POSITION_TYPE_ADD ? ContractEntrustOrderEntity.POSITION_TYPE_ALL : ContractEntrustOrderEntity.POSITION_TYPE_ADD; |
| | | MemberEntity updateEntity = new MemberEntity(); |