Helius
2021-01-29 85e7a8b06e921c81b0ed17ec8f181cfb16e298fb
src/main/java/com/xcong/excoin/rabbit/pricequeue/OrderOperatePriceService.java
@@ -1,6 +1,11 @@
package com.xcong.excoin.rabbit.pricequeue;
import com.alibaba.fastjson.JSONObject;
import com.xcong.excoin.common.contants.AppContants;
import com.xcong.excoin.rabbit.pricequeue.whole.WholeDataQueue;
import com.xcong.excoin.rabbit.pricequeue.whole.WholePriceDataModel;
import com.xcong.excoin.utils.RedisUtils;
import com.xcong.excoin.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
@@ -60,12 +65,12 @@
            // 判断这个单的这个类型是否有
//            if (CollectionUtils.isNotEmpty(list)) {
                // 新增
                OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
                OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo(), order.getMemberId());
                list.add(orderModel);
//            }
        } else {
            List<OrderModel> list = new ArrayList<OrderModel>();
            OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
            OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo(), order.getMemberId());
            list.add(orderModel);
            orderMap.put(price, list);
        }
@@ -95,12 +100,12 @@
            // 判断这个单的这个类型是否有
//            if (CollectionUtils.isNotEmpty(list)) {
                // 新增
                OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
                OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo(), order.getMemberId());
                list.add(orderModel);
//            }
        } else {
            List<OrderModel> list = new ArrayList<OrderModel>();
            OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo());
            OrderModel orderModel = new OrderModel(orderId, type, price, null,order.getOperateNo(), order.getMemberId());
            list.add(orderModel);
            orderMap.put(price, list);
        }
@@ -129,4 +134,19 @@
        }
    }
    public static void wholePriceDataOperation(WholePriceDataModel wholePriceData) {
        RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
        Map<String, WholePriceDataModel> dataModelMap = WholeDataQueue.MAP;
        WholePriceDataModel isExistData = dataModelMap.get(wholePriceData.getMemberId().toString());
        if (isExistData != null) {
            dataModelMap.remove(wholePriceData.getMemberId().toString());
        }
        dataModelMap.put(wholePriceData.getMemberId().toString(), wholePriceData);
        redisUtils.set(AppContants.WHOLE_BOMB_MAP, JSONObject.toJSONString(dataModelMap));
    }
}