| | |
| | | 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; |
| | |
| | | * @author helius |
| | | */ |
| | | @Slf4j |
| | | @DependsOn("springContextHolder") |
| | | @Component |
| | | @ConditionalOnProperty(prefix = "app", name = "newest-price-update-job", havingValue = "true") |
| | | public class OrderProducerInit { |
| | |
| | | } |
| | | |
| | | // 全仓持仓 |
| | | 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); |
| | | } |
| | | } |
| | | |