Search in sources :

Example 1 with AppAccountRedis

use of hry.trade.redis.model.AppAccountRedis in project benchmark by seelunzi.

the class AppAccountServiceImpl method getAppAccountByRedis.

/*     */
/*     */
/*     */
/*     */
/*     */
public AppAccountRedis getAppAccountByRedis(String id) /*     */
{
    /* 118 */
    Object obj = TradeRedis.redisUtilAppAccount.get(id);
    /* 119 */
    if (null == obj) /*     */
    {
        /* 121 */
        AppAccount account = (AppAccount) get(Long.valueOf(id));
        /* 122 */
        AppAccountRedis accountr = (AppAccountRedis) JSON.parseObject(JSON.toJSONString(account), AppAccountRedis.class);
        /* 123 */
        return accountr;
    /*     */
    }
    /* 125 */
    AppAccountRedis accountr = (AppAccountRedis) obj;
    /* 126 */
    return accountr;
/*     */
}
Also used : AppAccountRedis(hry.trade.redis.model.AppAccountRedis) AppAccount(hry.account.fund.model.AppAccount)

Example 2 with AppAccountRedis

use of hry.trade.redis.model.AppAccountRedis in project benchmark by seelunzi.

the class ExOrderInfoServiceImpl method reidsToredisLog.

/*     */
/*     */
public void reidsToredisLog() /*     */
{
    /* 349 */
    long start = System.currentTimeMillis();
    /* 350 */
    Set<Long> setaccount = new HashSet();
    /* 351 */
    Set<Long> setaccountcoin = new HashSet();
    /* 352 */
    List<Accountadd> accountaddSlistss = new ArrayList();
    /* 353 */
    Set<String> keysTradeDealAccountChange = this.redisService.noPerkeys("deal:TradeDealAccountChange:");
    /* 354 */
    Iterator<String> iteratorTradeDealAccountChange = keysTradeDealAccountChange.iterator();
    /* 355 */
    while (iteratorTradeDealAccountChange.hasNext()) {
        /* 356 */
        String keystr = (String) iteratorTradeDealAccountChange.next();
        /* 357 */
        List<Accountadd> accountaddSlist = JSON.parseArray(this.redisService.get(keystr), Accountadd.class);
        /* 358 */
        if (null != accountaddSlist) {
            /* 359 */
            accountaddSlistss.addAll(accountaddSlist);
        /*     */
        }
    /*     */
    }
    /*     */
    /* 363 */
    List<AppHotAccountRecord> listahar = new ArrayList();
    /* 364 */
    List<AppColdAccountRecord> listacar = new ArrayList();
    /* 365 */
    List<ExDmHotAccountRecord> listehar = new ArrayList();
    /* 366 */
    List<ExDmColdAccountRecord> listedcar = new ArrayList();
    /* 367 */
    if (null != accountaddSlistss) {
        /* 368 */
        for (Accountadd accountadd : accountaddSlistss) {
            /* 369 */
            if (accountadd.getAcccountType().equals(Integer.valueOf(0))) {
                /* 370 */
                AppAccount appAccount = (AppAccount) this.appAccountService.get(accountadd.getAccountId());
                /* 371 */
                if (null != appAccount) {
                    /* 372 */
                    if (accountadd.getMonteyType().equals(Integer.valueOf(1))) {
                        /* 373 */
                        if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == -1) {
                            /* 374 */
                            AppHotAccountRecord appHotAccountRecord = this.appAccountService.createHotRecord(Integer.valueOf(2), appAccount, BigDecimal.ZERO.subtract(accountadd.getMoney()), accountadd.getTransactionNum(), accountadd.getRemarks());
                            /* 375 */
                            listahar.add(appHotAccountRecord);
                        /* 376 */
                        } else if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == 1) {
                            /* 377 */
                            AppHotAccountRecord appHotAccountRecord = this.appAccountService.createHotRecord(Integer.valueOf(1), appAccount, accountadd.getMoney(), accountadd.getTransactionNum(), accountadd.getRemarks());
                            /* 378 */
                            listahar.add(appHotAccountRecord);
                        /*     */
                        }
                    /*     */
                    /*     */
                    } else /* 382 */
                    if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == -1) {
                        /* 383 */
                        AppColdAccountRecord AppColdAccountRecord = this.appAccountService.createColdRecord(Integer.valueOf(2), appAccount, BigDecimal.ZERO.subtract(accountadd.getMoney()), accountadd.getTransactionNum(), accountadd.getRemarks());
                        /* 384 */
                        listacar.add(AppColdAccountRecord);
                    /* 385 */
                    } else if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == 1) {
                        /* 386 */
                        AppColdAccountRecord AppColdAccountRecord = this.appAccountService.createColdRecord(Integer.valueOf(1), appAccount, accountadd.getMoney(), accountadd.getTransactionNum(), accountadd.getRemarks());
                        /* 387 */
                        listacar.add(AppColdAccountRecord);
                    /*     */
                    }
                    /*     */
                    /* 390 */
                    setaccount.add(appAccount.getId());
                /*     */
                }
            /*     */
            } else /*     */
            {
                /* 394 */
                ExDigitalmoneyAccount exDigitalmoneyAccount = (ExDigitalmoneyAccount) this.exDigitalmoneyAccountService.get(accountadd.getAccountId());
                /* 395 */
                if (null != exDigitalmoneyAccount) {
                    /* 396 */
                    if (accountadd.getMonteyType().equals(Integer.valueOf(1))) {
                        /* 397 */
                        if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == -1) {
                            /* 398 */
                            ExDmHotAccountRecord exDmHotAccountRecord = this.exDigitalmoneyAccountService.createHotRecord(Integer.valueOf(2), exDigitalmoneyAccount, BigDecimal.ZERO.subtract(accountadd.getMoney()), accountadd.getTransactionNum(), accountadd.getRemarks());
                            /* 399 */
                            listehar.add(exDmHotAccountRecord);
                        /* 400 */
                        } else if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == 1) {
                            /* 401 */
                            ExDmHotAccountRecord exDmHotAccountRecord = this.exDigitalmoneyAccountService.createHotRecord(Integer.valueOf(1), exDigitalmoneyAccount, accountadd.getMoney(), accountadd.getTransactionNum(), accountadd.getRemarks());
                            /* 402 */
                            listehar.add(exDmHotAccountRecord);
                        /*     */
                        }
                    /*     */
                    } else /* 405 */
                    if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == -1) {
                        /* 406 */
                        ExDmColdAccountRecord exDmColdAccountRecord = this.exDigitalmoneyAccountService.createColdRecord(Integer.valueOf(2), exDigitalmoneyAccount, BigDecimal.ZERO.subtract(accountadd.getMoney()), accountadd.getTransactionNum(), accountadd.getRemarks());
                        /* 407 */
                        listedcar.add(exDmColdAccountRecord);
                    /* 408 */
                    } else if (accountadd.getMoney().compareTo(BigDecimal.ZERO) == 1) {
                        /* 409 */
                        ExDmColdAccountRecord exDmColdAccountRecord = this.exDigitalmoneyAccountService.createColdRecord(Integer.valueOf(1), exDigitalmoneyAccount, accountadd.getMoney(), accountadd.getTransactionNum(), accountadd.getRemarks());
                        /* 410 */
                        listedcar.add(exDmColdAccountRecord);
                    /*     */
                    }
                    /*     */
                    /*     */
                    /* 414 */
                    setaccountcoin.add(exDigitalmoneyAccount.getId());
                /*     */
                }
            /*     */
            }
        /*     */
        }
    /*     */
    }
    /* 421 */
    if ((null != listahar) && (listahar.size() > 0)) {
        /* 422 */
        this.appHotAccountRecordDao.insertRecord(listahar);
    /*     */
    }
    /* 424 */
    if ((null != listacar) && (listacar.size() > 0)) {
        /* 425 */
        this.appColdAccountRecordDao.insertRecord(listacar);
    /*     */
    }
    /* 427 */
    if ((null != listehar) && (listehar.size() > 0)) {
        /* 428 */
        this.exDmHotAccountRecordDao.insertRecord(listehar);
    /*     */
    }
    /* 430 */
    if ((null != listedcar) && (listedcar.size() > 0)) {
        /* 431 */
        this.exDmColdAccountRecordDao.insertRecord(listedcar);
    /*     */
    }
    /*     */
    /*     */
    /*     */
    /*     */
    /* 437 */
    Iterator<Long> iteratora = setaccount.iterator();
    /* 438 */
    List<AppAccountRedis> lista = new ArrayList();
    /* 439 */
    while (iteratora.hasNext()) {
        /* 440 */
        Long id = (Long) iteratora.next();
        /* 441 */
        AppAccountRedis appAccountredis = this.appAccountService.getAppAccountByRedis(id.toString());
        /* 442 */
        appAccountredis.setHotMoneyDouble(Double.valueOf(appAccountredis.getHotMoney().doubleValue()));
        /* 443 */
        appAccountredis.setColdMoneyDouble(Double.valueOf(appAccountredis.getColdMoney().doubleValue()));
        /* 444 */
        lista.add(appAccountredis);
    /*     */
    }
    /* 446 */
    if ((null != lista) && (lista.size() > 0)) {
        /* 447 */
        this.appAccountDao.updateAppAccount(lista);
    /*     */
    }
    /* 449 */
    Iterator<Long> iteratorc = setaccountcoin.iterator();
    /* 450 */
    List<ExDigitalmoneyAccountRedis> listd = new ArrayList();
    /* 451 */
    while (iteratorc.hasNext()) {
        /* 452 */
        Long id = (Long) iteratorc.next();
        /* 453 */
        ExDigitalmoneyAccountRedis exDigitalmoneyAccountredis = this.exDigitalmoneyAccountService.getExDigitalmoneyAccountByRedis(id.toString());
        /* 454 */
        exDigitalmoneyAccountredis.setHotMoneyDouble(Double.valueOf(exDigitalmoneyAccountredis.getHotMoney().doubleValue()));
        /* 455 */
        exDigitalmoneyAccountredis.setColdMoneyDouble(Double.valueOf(exDigitalmoneyAccountredis.getColdMoney().doubleValue()));
        /* 456 */
        listd.add(exDigitalmoneyAccountredis);
    /*     */
    }
    /* 458 */
    if ((null != listd) && (listd.size() > 0)) {
        /* 459 */
        this.exDigitalmoneyAccountDao.updateExDigitalmoneyAccount(listd);
    /*     */
    }
    /*     */
    /*     */
    /*     */
    /*     */
    /* 465 */
    Iterator<String> iteratorTradeDealAccountChangedelete = keysTradeDealAccountChange.iterator();
    /* 466 */
    while (iteratorTradeDealAccountChangedelete.hasNext()) {
        /* 467 */
        String keystr = (String) iteratorTradeDealAccountChangedelete.next();
        /* 468 */
        this.redisService.delete(keystr);
    /*     */
    }
    /* 470 */
    long end = System.currentTimeMillis();
    /* 471 */
    long time = end - start;
    /* 472 */
    if (time > 800L) {
        /* 473 */
        LogFactory.info("accountredis(账户和资金流水)入库总耗时:" + time + "ms");
    /*     */
    }
/*     */
}
Also used : AppAccountRedis(hry.trade.redis.model.AppAccountRedis) AppAccount(hry.account.fund.model.AppAccount) ExDmColdAccountRecord(hry.exchange.account.model.ExDmColdAccountRecord) Accountadd(hry.trade.redis.model.Accountadd) ExDigitalmoneyAccountRedis(hry.trade.redis.model.ExDigitalmoneyAccountRedis) AppHotAccountRecord(hry.account.fund.model.AppHotAccountRecord) ExDmHotAccountRecord(hry.exchange.account.model.ExDmHotAccountRecord) AppColdAccountRecord(hry.account.fund.model.AppColdAccountRecord) ExDigitalmoneyAccount(hry.exchange.account.model.ExDigitalmoneyAccount)

Aggregations

AppAccount (hry.account.fund.model.AppAccount)2 AppAccountRedis (hry.trade.redis.model.AppAccountRedis)2 AppColdAccountRecord (hry.account.fund.model.AppColdAccountRecord)1 AppHotAccountRecord (hry.account.fund.model.AppHotAccountRecord)1 ExDigitalmoneyAccount (hry.exchange.account.model.ExDigitalmoneyAccount)1 ExDmColdAccountRecord (hry.exchange.account.model.ExDmColdAccountRecord)1 ExDmHotAccountRecord (hry.exchange.account.model.ExDmHotAccountRecord)1 Accountadd (hry.trade.redis.model.Accountadd)1 ExDigitalmoneyAccountRedis (hry.trade.redis.model.ExDigitalmoneyAccountRedis)1