Helius
2020-09-08 1fc98d66589965b5b10e09334f715b28ed5ab455
src/main/java/com/xcong/excoin/rabbit/pricequeue/WebsocketPriceService.java
@@ -1,6 +1,7 @@
package com.xcong.excoin.rabbit.pricequeue;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.common.enumerates.CoinTypeEnum;
@@ -303,14 +304,21 @@
                    MemberWalletContractEntity wallet = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, CoinTypeEnum.USDT.name());
                    BigDecimal sub = wallet.getTotalBalance().add(totalProfitOrLess);
//                    log.info("sub : {}, memberId : {}", sub, memberId);
                    if (sub.compareTo(BigDecimal.ZERO) <= 0) {
                        List<OrderModel> list = new ArrayList<>();
                        OrderModel orderModel = new OrderModel(null, 0, price, symbol, memberId);
                        list.add(orderModel);
                        String content = JSONObject.toJSONString(list);
                        orderProducer.sendWholeBomb(content);
                        contractHoldOrderDao.updateMemberAllHoldOrderClosingStatus(memberId);
                        String key = AppContants.WHOLE_BOMB_PREFIX + memberId;
                        String value = redisUtils.getString(key);
                        if (StrUtil.isBlank(value)) {
                            orderProducer.sendWholeBomb(content);
                            contractHoldOrderDao.updateMemberAllHoldOrderClosingStatus(memberId);
                            redisUtils.set(key, memberId);
                        }
                    }
                }
            }