|  |  |  | 
|---|
|  |  |  | package com.xcong.excoin.utils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.hutool.core.collection.CollUtil; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.xcong.excoin.common.contants.AppContants; | 
|---|
|  |  |  | import com.xcong.excoin.common.enumerates.CoinTypeEnum; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.dao.ContractEntrustOrderDao; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.dao.ContractOrderDao; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper; | 
|---|
|  |  |  | import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl; | 
|---|
|  |  |  | import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService; | 
|---|
|  |  |  | import com.xcong.excoin.modules.member.dao.MemberWalletContractDao; | 
|---|
|  |  |  | import com.xcong.excoin.modules.member.entity.MemberEntity; | 
|---|
|  |  |  | import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity; | 
|---|
|  |  |  | import com.xcong.excoin.rabbit.pricequeue.whole.HoldOrderDataModel; | 
|---|
|  |  |  | import com.xcong.excoin.rabbit.pricequeue.whole.WholePriceDataModel; | 
|---|
|  |  |  | import com.xcong.excoin.rabbit.producer.OrderProducer; | 
|---|
|  |  |  | import com.xcong.excoin.utils.dingtalk.DingTalkUtils; | 
|---|
|  |  |  | import lombok.SneakyThrows; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.validation.constraints.NotNull; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.concurrent.ExecutorService; | 
|---|
|  |  |  | import java.util.concurrent.Executors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 全仓模式 -- 预估强平价 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param symbol       币种 | 
|---|
|  |  |  | * @param memberEntity 会员信息 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static void sendWholeForceClosingPrice(@NotNull String symbol, @NotNull MemberEntity memberEntity) { | 
|---|
|  |  |  | EXECUTOR.execute(new Runnable() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void run() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | CalculateUtil.getForceSetPriceForWhole(null, memberEntity); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | log.error("全仓模式预估强平价", e); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 发送全仓价格操作 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param memberId | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public static void sendWholePrice(@NotNull Long memberId) { | 
|---|
|  |  |  | EXECUTOR.execute(new Runnable() { | 
|---|
|  |  |  | @SneakyThrows | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void run() { | 
|---|
|  |  |  | Thread.sleep(500); | 
|---|
|  |  |  | log.info("全仓操作价格"); | 
|---|
|  |  |  | OrderProducer orderProducer = SpringContextHolder.getBean(OrderProducer.class); | 
|---|
|  |  |  | orderProducer.sendWholePrice(memberId.toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|