Search in sources :

Example 1 with RedisService

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

the class TradeRedis method getMatchOnePrice.

/*     */
/*     */
/*     */
public static BigDecimal getMatchOnePrice(EntrustTrade exEntrust) /*     */
{
    /* 460 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 461 */
    String key = "";
    /* 462 */
    if (exEntrust.getType().equals(Integer.valueOf(1))) {
        /* 463 */
        key = getHeaderFront(exEntrust) + ":" + "sellonePrice";
    /*     */
    } else {
        /* 465 */
        key = getHeaderFront(exEntrust) + ":" + "buyonePrice";
    /*     */
    }
    /* 467 */
    String onePrice = redisService.get(key);
    /* 468 */
    if (StringUtil.isEmpty(onePrice)) {
        /* 469 */
        return null;
    /*     */
    }
    /* 471 */
    return new BigDecimal(onePrice);
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) BigDecimal(java.math.BigDecimal)

Example 2 with RedisService

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

the class TradeRedis method matchOneEnd.

/*     */
/*     */
/*     */
public static void matchOneEnd(List<Accountadd> exEntrustAccountadd, EntrustTrade exEntrust, Map<String, List<EntrustTrade>> maping, List<EntrustTrade> listed, BigDecimal matchonePrice) /*     */
{
    /* 199 */
    aaddlists.addAll(0, exEntrustAccountadd);
    /* 200 */
    listed.add(exEntrust);
    /* 201 */
    if (!exEntrust.getStatus().equals(Integer.valueOf(2))) {
        /* 202 */
        putSelfEntrustTradelist(exEntrust);
        /* 203 */
        setSelfonePrice(exEntrust);
    /*     */
    }
    /*     */
    /* 206 */
    RedisTradeService redisTradeService = (RedisTradeService) ContextUtil.getBean("redisTradeService");
    /* 207 */
    for (Entry<String, List<EntrustTrade>> entry : maping.entrySet()) {
        /* 208 */
        List<EntrustTrade> listing = (List) entry.getValue();
        /* 209 */
        if ((null == listing) || (listing.size() == 0)) {
            /* 210 */
            redisTradeService.delete((String) entry.getKey());
        /*     */
        } else {
            /* 212 */
            redisTradeService.save((String) entry.getKey(), JSON.toJSONString(listing));
        /*     */
        }
    /*     */
    }
    /*     */
    /*     */
    /* 217 */
    MQEnter.pushDealFundMQ(aaddlists);
    /* 220 */
    for (EntrustTrade entrust : listed) {
        /* 221 */
        putEntrustByUser(entrust);
    /*     */
    }
    /* 223 */
    setMatchOnePrice(matchonePrice, exEntrust);
    /* 224 */
    String keyFront = getHeaderFront(exEntrust);
    /* 225 */
    setExchangeDataCache(eoinfolists, keyFront);
    /*     */
    /* 227 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 228 */
    redisService.save(getTradeDealEntrustChangeNum(), JSON.toJSONString(listed));
    /* 229 */
    redisService.save(getTradeDealOrderInfoChangeNum(), JSON.toJSONString(eoinfolists));
    /*     */
    /*     */
    /*     */
    /* 233 */
    List<ExOrderInfo> arr = new ArrayList();
    /* 234 */
    arr.addAll(eoinfolists);
    /* 235 */
    PeriodLastKLineListRunable periodLastKLineListRunable = new PeriodLastKLineListRunable(arr);
    /* 236 */
    ThreadPool.exe(periodLastKLineListRunable);
    /* 237 */
    aaddlists.clear();
    /* 238 */
    eoinfolists.clear();
    /*     */
    /* 240 */
    redisTradeService.save(getEntrustTimeFlag(exEntrust.getCoinCode(), exEntrust.getFixPriceCoinCode()), "1");
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) RedisTradeService(hry.redis.common.utils.RedisTradeService) ExOrderInfo(hry.trade.entrust.model.ExOrderInfo)

Example 3 with RedisService

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

the class TradeRedis method NoMatchEnd.

/*     */
/*     */
public static void NoMatchEnd(EntrustTrade entrust, List<Accountadd> aadds) /*     */
{
    /* 179 */
    setSelfonePrice(entrust);
    /* 180 */
    putSelfEntrustTradelist(entrust);
    /*     */
    /* 182 */
    MQEnter.pushDealFundMQ(aadds);
    /* 183 */
    putEntrustByUser(entrust);
    /*     */
    /*     */
    /* 186 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 187 */
    List<EntrustTrade> listchange = new ArrayList();
    /* 188 */
    listchange.add(entrust);
    /* 189 */
    redisService.save(getTradeDealEntrustChangeNum(), JSON.toJSONString(listchange));
    /*     */
    /*     */
    /* 192 */
    RedisTradeService redisTradeService = (RedisTradeService) ContextUtil.getBean("redisTradeService");
    /* 193 */
    redisTradeService.save(getEntrustTimeFlag(entrust.getCoinCode(), entrust.getFixPriceCoinCode()), "1");
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService) RedisTradeService(hry.redis.common.utils.RedisTradeService)

Example 4 with RedisService

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

the class TradeRedis method getTradeDealOrderInfoChangeNum.

/*     */
/*     */
public static String getTradeDealOrderInfoChangeNum() {
    /* 166 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 167 */
    String v = redisService.get("deal:tradeDealOrderInfoChangeNum");
    /* 168 */
    if ((!StringUtil.isEmpty(v)) && (!"null".equals(v))) {
        /* 169 */
        String num = String.valueOf(Integer.valueOf(v).intValue() + 1);
        /* 170 */
        redisService.save("deal:tradeDealOrderInfoChangeNum", num);
        /* 171 */
        return "deal:tradeDealOrderInfoChange:" + num;
    /*     */
    }
    /* 173 */
    redisService.save("deal:tradeDealOrderInfoChangeNum", "0");
    /* 174 */
    return "deal:tradeDealOrderInfoChange:0";
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService)

Example 5 with RedisService

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

the class TradeRedis method getTradeDealAccountChangeNum.

/*     */
/*     */
public static String getTradeDealAccountChangeNum() {
    /* 154 */
    RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
    /* 155 */
    String v = redisService.get("deal:tradeDealAccountChangeNum");
    /* 156 */
    if ((!StringUtil.isEmpty(v)) && (!"null".equals(v))) {
        /* 157 */
        String num = String.valueOf(Integer.valueOf(v).intValue() + 1);
        /* 158 */
        redisService.save("deal:tradeDealAccountChangeNum", num);
        /* 159 */
        return "deal:TradeDealAccountChange:" + num;
    /*     */
    }
    /* 161 */
    redisService.save("deal:tradeDealAccountChangeNum", "0");
    /* 162 */
    return "deal:TradeDealAccountChange:0";
/*     */
}
Also used : RedisService(hry.redis.common.utils.RedisService)

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