From 914ba427c03d65de5b574723e6a0866f15b385aa Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 29 Jan 2021 17:24:00 +0800
Subject: [PATCH] 20210129
---
src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java | 39 +++++----------------------------------
1 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java b/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java
index 3a1adff..dfc37dc 100644
--- a/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java
+++ b/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java
@@ -4,8 +4,10 @@
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;
@@ -106,39 +108,8 @@
* @param memberId
*/
public static void sendWholePrice(@NotNull Long memberId) {
- log.info("执行了这个方法");
- EXECUTOR.execute(new Runnable() {
- @Override
- public void run() {
- log.info("全仓操作价格");
- ContractHoldOrderDao contractHoldOrderDao = SpringContextHolder.getBean(ContractHoldOrderDao.class);
- RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
- MemberWalletContractDao memberWalletContractDao = SpringContextHolder.getBean(MemberWalletContractDao.class);
-
- List<ContractHoldOrderEntity> holdOrders = contractHoldOrderDao.selectHoldOrderListByMemberId(memberId);
- if (CollUtil.isEmpty(holdOrders)) {
- return;
- }
- MemberWalletContractEntity wallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, CoinTypeEnum.USDT.name());
-
- WholePriceDataModel wholePriceData = new WholePriceDataModel();
- List<HoldOrderDataModel> holdOrderDataModels = ContractHoldOrderEntityMapper.INSTANCE.entitiesToDataModels(holdOrders);
- wholePriceData.setList(holdOrderDataModels);
-
- BigDecimal totalHoldBond = BigDecimal.ZERO;
- for (ContractHoldOrderEntity holdOrder : holdOrders) {
- totalHoldBond = totalHoldBond.add(holdOrder.getHoldBond() == null ? BigDecimal.ZERO : holdOrder.getHoldBond());
- }
-
- wholePriceData.setHoldBond(totalHoldBond);
- wholePriceData.setBalance(wallet.getTotalBalance());
- wholePriceData.setMemberId(memberId);
-
- OrderProducer orderProducer = SpringContextHolder.getBean(OrderProducer.class);
-
- orderProducer.sendWholePrice(JSONObject.toJSONString(wholePriceData));
- }
- });
-
+ log.info("全仓操作价格");
+ OrderProducer orderProducer = SpringContextHolder.getBean(OrderProducer.class);
+ orderProducer.sendWholePrice(memberId.toString());
}
}
--
Gitblit v1.9.1