| | |
| | | package com.xcong.excoin.rabbit.pricequeue; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | /** |
| | | * 处理消费者的订单止盈等价格信息 |
| | | */ |
| | | @Slf4j |
| | | public class OrderOperatePriceService { |
| | | |
| | | /** |
| | |
| | | Long orderId = order.getOrderId(); |
| | | queue.add(new DescBigDecimal(price)); |
| | | |
| | | log.info("原有:{}", JSONObject.toJSONString(orderMap)); |
| | | removeExistOrder(type, orderId, orderMap); |
| | | log.info("删除后:{}", JSONObject.toJSONString(orderMap)); |
| | | if (orderMap.containsKey(price)) { |
| | | // 有这个价的key |
| | | List<OrderModel> list = orderMap.get(price); |
| | |
| | | list.add(orderModel); |
| | | orderMap.put(price, list); |
| | | } |
| | | log.info("调整后:{}", JSONObject.toJSONString(orderMap)); |
| | | } |
| | | |
| | | |
| | |
| | | int type = order.getType(); |
| | | Long orderId = order.getOrderId(); |
| | | queue.add(new AscBigDecimal(price)); |
| | | log.info("原有:{}", JSONObject.toJSONString(orderMap)); |
| | | // 需要找到这个订单的原始的单进行处理 |
| | | removeExistOrder(type, orderId, orderMap); |
| | | |
| | | log.info("删除后:{}", JSONObject.toJSONString(orderMap)); |
| | | if (orderMap.containsKey(price)) { |
| | | // 有这个价的key |
| | | List<OrderModel> list = orderMap.get(price); |
| | |
| | | list.add(orderModel); |
| | | orderMap.put(price, list); |
| | | } |
| | | log.info("调整后:{}", JSONObject.toJSONString(orderMap)); |
| | | } |
| | | |
| | | private static void removeExistOrder(Integer type, Long orderId, Map<String, List<OrderModel>> orderMap) { |