Search in sources :

Example 16 with RedisService

use of hry.redis.common.utils.RedisService in project benchmark by seelunzi.

the class TradeRedis method cancelEntrust.

/*     */
/*     */
public static void cancelEntrust(EntrustTrade exEntrust, List<EntrustTrade> entrustlist, String key, List<Accountadd> aadds) /*     */
{
    /* 245 */
    putIngExEntrust(entrustlist, key);
    /*     */
    /* 247 */
    MQEnter.pushDealFundMQ(aadds);
    /*     */
    /* 249 */
    putEntrustByUser(exEntrust);
    /* 250 */
    setcancelSelfOnePrice(exEntrust);
    /*     */
    /*     */
    /* 253 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 254 */
    List<EntrustTrade> listchange = new ArrayList();
    /* 255 */
    listchange.add(exEntrust);
    /* 256 */
    redisService.save(getTradeDealEntrustChangeNum(), JSON.toJSONString(listchange));
    /*     */
    /* 258 */
    RedisTradeService redisTradeService = (RedisTradeService) ContextUtil.getBean("redisTradeService");
    /* 259 */
    redisTradeService.save(getEntrustTimeFlag(exEntrust.getCoinCode(), exEntrust.getFixPriceCoinCode()), "1");
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) RedisTradeService(hry.redis.common.utils.RedisTradeService)

Example 17 with RedisService

use of hry.redis.common.utils.RedisService in project benchmark by seelunzi.

the class TradeRedis method setMatchOnePrice.

/*     */
/*     */
/*     */
public static void setMatchOnePrice(BigDecimal matchonePrice, EntrustTrade exEntrust) /*     */
{
    /* 292 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 293 */
    String keyFront = getHeaderFront(exEntrust);
    /* 294 */
    if (null != matchonePrice) {
        /* 295 */
        if (exEntrust.getType().equals(Integer.valueOf(2))) {
            /* 296 */
            String buyonePricekey = keyFront + ":" + "buyonePrice";
            /* 297 */
            redisService.save(buyonePricekey, JSON.toJSONString(matchonePrice));
        /*     */
        } else {
            /* 299 */
            String sellonePricekey = keyFront + ":" + "sellonePrice";
            /* 300 */
            redisService.save(sellonePricekey, JSON.toJSONString(matchonePrice));
        /*     */
        }
    /*     */
    /*     */
    } else /* 304 */
    if (exEntrust.getType().equals(Integer.valueOf(2))) {
        /* 305 */
        String buyonePricekey = keyFront + ":" + "buyonePrice";
        /* 306 */
        redisService.delete(buyonePricekey);
    /*     */
    } else {
        /* 308 */
        String sellonePricekey = keyFront + ":" + "sellonePrice";
        /* 309 */
        redisService.save(sellonePricekey, JSON.toJSONString(matchonePrice));
        /* 310 */
        redisService.delete(sellonePricekey);
    /*     */
    }
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService)

Example 18 with RedisService

use of hry.redis.common.utils.RedisService in project benchmark by seelunzi.

the class TradeRedis method setSelfonePrice.

/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
public static void setSelfonePrice(EntrustTrade entrust) /*     */
{
    /* 116 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 117 */
    String key = getHeaderFront(entrust);
    /* 118 */
    if (entrust.getType().equals(Integer.valueOf(1))) {
        /* 119 */
        String buyonePricekey = key + ":" + "buyonePrice";
        /* 120 */
        String buyonePrices = redisService.get(buyonePricekey);
        /* 121 */
        if (StringUtil.isEmpty(buyonePrices)) {
            /* 122 */
            redisService.save(buyonePricekey, JSON.toJSONString(entrust.getEntrustPrice()));
        /*     */
        } else /* 124 */
        if (new BigDecimal(buyonePrices).compareTo(entrust.getEntrustPrice()) == -1) {
            /* 125 */
            redisService.save(buyonePricekey, JSON.toJSONString(entrust.getEntrustPrice()));
        /*     */
        }
    /*     */
    } else /*     */
    /*     */
    {
        /* 130 */
        String sellonePricekey = key + ":" + "sellonePrice";
        /* 131 */
        String sellonePrices = redisService.get(sellonePricekey);
        /* 132 */
        if (StringUtil.isEmpty(sellonePrices)) {
            /* 133 */
            redisService.save(sellonePricekey, JSON.toJSONString(entrust.getEntrustPrice()));
        /*     */
        } else /* 135 */
        if (new BigDecimal(sellonePrices).compareTo(entrust.getEntrustPrice()) == 1) {
            /* 136 */
            redisService.save(sellonePricekey, JSON.toJSONString(entrust.getEntrustPrice()));
        /*     */
        }
    /*     */
    }
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) BigDecimal(java.math.BigDecimal)

Example 19 with RedisService

use of hry.redis.common.utils.RedisService in project benchmark by seelunzi.

the class TradeRedis method setExchangeDataCache.

/*     */
/*     */
/*     */
public static void setExchangeDataCache(List<ExOrderInfo> listExOrderInfo, String header) /*     */
{
    /* 317 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 318 */
    ExOrderInfo exOrderInfo = (ExOrderInfo) listExOrderInfo.get(listExOrderInfo.size() - 1);
    /*     */
    /* 320 */
    setStringData(header + ":" + "currentExchangPrice", exOrderInfo.getTransactionPrice().setScale(10, 4).toString());
    /*     */
    /* 322 */
    String v = redisService.get(header + ":" + "LastOrderRecords");
    /* 323 */
    List<ExOrderInfo> list = null;
    /* 324 */
    if (!StringUtil.isEmpty(v)) {
        /* 325 */
        list = JSON.parseArray(v, ExOrderInfo.class);
    /*     */
    } else {
        /* 327 */
        list = new ArrayList();
    /*     */
    }
    /* 329 */
    list.addAll(listExOrderInfo);
    /* 330 */
    if (list.size() > ExchangeDataCacheRedis.LastOrderRecordsLmit.intValue()) {
        /* 331 */
        List<ExOrderInfo> sublist = list.subList(list.size() - ExchangeDataCacheRedis.LastOrderRecordsLmit.intValue(), list.size());
        /* 332 */
        redisService.save(header + ":" + "LastOrderRecords", JSON.toJSONString(sublist));
    /*     */
    } else {
        /* 334 */
        redisService.save(header + ":" + "LastOrderRecords", JSON.toJSONString(list));
    /*     */
    }
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) ExOrderInfo(hry.trade.entrust.model.ExOrderInfo)

Example 20 with RedisService

use of hry.redis.common.utils.RedisService in project benchmark by seelunzi.

the class TradeRedis method put.

/*     */
/*     */
/*     */
public static void put(ExOrderInfo exOrderInfo) /*     */
{
    /* 528 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 529 */
    String v = redisService.get("exorderinfos");
    /* 530 */
    List<ExOrderInfo> list = JSON.parseArray(v, ExOrderInfo.class);
    /* 531 */
    list.add(exOrderInfo);
    /* 532 */
    redisService.save("exorderinfos", JSON.toJSONString(list));
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) ExOrderInfo(hry.trade.entrust.model.ExOrderInfo)

Aggregations

RedisService (hry.redis.common.utils.RedisService)29 ExOrderInfo (hry.trade.entrust.model.ExOrderInfo)4 RedisTradeService (hry.redis.common.utils.RedisTradeService)3 BigDecimal (java.math.BigDecimal)3 ExCointoCoin (hry.exchange.product.model.ExCointoCoin)1 ExEntrustService (hry.trade.entrust.service.ExEntrustService)1