KKSU
2024-04-17 d23645e976981bc9b670eea1d469fe8a36be309c
src/main/java/com/xcong/excoin/rabbit/init/OrderProducerInit.java
@@ -12,10 +12,12 @@
import com.xcong.excoin.rabbit.pricequeue.OrderModel;
import com.xcong.excoin.rabbit.producer.OrderProducer;
import com.xcong.excoin.utils.CalculateUtil;
import com.xcong.excoin.utils.ThreadPoolUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@@ -31,6 +33,7 @@
 * @author helius
 */
@Slf4j
@DependsOn("springContextHolder")
@Component
@ConditionalOnProperty(prefix = "app", name = "newest-price-update-job", havingValue = "true")
public class OrderProducerInit {
@@ -126,17 +129,10 @@
        }
        // 全仓持仓
        List<HashMap<String, Object>> wholeHoldOrders = contractHoldOrderDao.selectAllWholeOrderMemberIdAndSymbol();
        List<Long> wholeHoldOrders = contractHoldOrderDao.selectAllWholeOrderMemberId();
        if (CollUtil.isNotEmpty(wholeHoldOrders)) {
            MemberEntity memberEntity = null;
            for (HashMap<String, Object> wholeHoldOrder : wholeHoldOrders) {
                Long memberId = (Long) wholeHoldOrder.get("member_id");
                String symbol = (String) wholeHoldOrder.get("symbol");
                if (memberEntity == null || !memberId.equals(memberEntity.getId())) {
                    memberEntity = memberDao.selectById(memberId);
                }
                CalculateUtil.getForceSetPriceForWhole(symbol, memberEntity);
            for (Long memberId : wholeHoldOrders) {
                ThreadPoolUtils.sendWholePrice(memberId);
            }
        }