Search in sources :

Example 1 with ExOrderDao

use of hry.trade.entrust.dao.ExOrderDao in project benchmark by seelunzi.

the class ExOrderServiceImpl method setLastExchangPrice.

/*     */
/*     */
public void setLastExchangPrice(String header) /*     */
{
    /* 107 */
    ExOrderDao exOrderDao = (ExOrderDao) this.dao;
    /* 108 */
    String[] headarry = header.split(":");
    /* 109 */
    Map<String, Object> map = new HashMap();
    /* 110 */
    map.put("website", headarry[0]);
    /* 111 */
    map.put("currencyType", headarry[1]);
    /* 112 */
    map.put("coinCode", headarry[2].split("_")[0]);
    /* 113 */
    map.put("fixPriceCoinCode", headarry[2].split("_")[1]);
    /* 114 */
    List<ExOrder> list = exOrderDao.getLastExchangPrice(map);
    /* 116 */
    if ((null != list) && (list.size() != 0)) {
        /* 117 */
        if (list.size() == 2) {
            /* 118 */
            TradeRedis.setStringData(header + ":" + "lastExchangPrice", ((ExOrder) list.get(1)).getTransactionPrice().toString());
        /* 119 */
        } else if (list.size() == 1) {
            /* 120 */
            TradeRedis.setStringData(header + ":" + "lastExchangPrice", ((ExOrder) list.get(0)).getTransactionPrice().toString());
        /*     */
        }
    /*     */
    } else {
        /* 123 */
        TradeRedis.setStringData(header + ":" + "lastExchangPrice", "0.00");
    /*     */
    }
/*     */
}
Also used : ExOrder(hry.trade.entrust.model.ExOrder) JSONObject(com.alibaba.fastjson.JSONObject) ExOrderDao(hry.trade.entrust.dao.ExOrderDao)

Example 2 with ExOrderDao

use of hry.trade.entrust.dao.ExOrderDao in project benchmark by seelunzi.

the class ExOrderServiceImpl method setOpenedExchangPrice.

/*     */
/*     */
public void setOpenedExchangPrice(String header, BigDecimal issuePrice) /*     */
{
    /* 129 */
    ExOrderDao exOrderDao = (ExOrderDao) this.dao;
    /* 130 */
    String[] headarry = header.split(":");
    /* 131 */
    Map<String, Object> map = new HashMap();
    /* 132 */
    map.put("website", headarry[0]);
    /* 133 */
    map.put("currencyType", headarry[1]);
    /* 134 */
    map.put("coinCode", headarry[2].split("_")[0]);
    /* 135 */
    map.put("fixPriceCoinCode", headarry[2].split("_")[1]);
    /* 136 */
    map.put("minDate", DateUtil.dateToString(new Date(), "yyyy-MM-dd 00:00:00"));
    /* 137 */
    List<ExOrder> list = exOrderDao.getOpenExchangPrice(map);
    /* 138 */
    if ((null != list) && (list.size() != 0)) {
        /* 139 */
        TradeRedis.setStringData(header + ":" + "openedExchangPrice", ((ExOrder) list.get(0)).getTransactionPrice().toString());
    /*     */
    } else /*     */
    {
        /* 142 */
        List<ExOrder> list1 = exOrderDao.getCurrentExchangPrice(map);
        /* 143 */
        if ((null != list1) && (list1.size() != 0)) {
            /* 144 */
            TradeRedis.setStringData(header + ":" + "openedExchangPrice", ((ExOrder) list1.get(0)).getTransactionPrice().toString());
        /*     */
        } else {
            /* 146 */
            TradeRedis.setStringData(header + ":" + "openedExchangPrice", issuePrice == null ? "0.00" : issuePrice.toString());
        /*     */
        }
    /*     */
    }
/*     */
}
Also used : ExOrder(hry.trade.entrust.model.ExOrder) JSONObject(com.alibaba.fastjson.JSONObject) ExOrderDao(hry.trade.entrust.dao.ExOrderDao)

Example 3 with ExOrderDao

use of hry.trade.entrust.dao.ExOrderDao in project benchmark by seelunzi.

the class ExOrderServiceImpl method setCurrentExchangPrice.

/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
/*     */
public void setCurrentExchangPrice(String header) /*     */
{
    /*  86 */
    ExOrderDao exOrderDao = (ExOrderDao) this.dao;
    /*  87 */
    String[] headarry = header.split(":");
    /*  88 */
    Map<String, Object> map = new HashMap();
    /*  89 */
    map.put("website", headarry[0]);
    /*  90 */
    map.put("currencyType", headarry[1]);
    /*  91 */
    map.put("coinCode", headarry[2].split("_")[0]);
    /*  92 */
    map.put("fixPriceCoinCode", headarry[2].split("_")[1]);
    /*  93 */
    List<ExOrder> list = exOrderDao.getCurrentExchangPrice(map);
    /*  94 */
    if ((null != list) && (list.size() != 0)) {
        /*  95 */
        TradeRedis.setStringData(header + ":" + "currentExchangPrice", ((ExOrder) list.get(0)).getTransactionPrice().toString());
        /*  96 */
        TradeRedis.setStringData(header + ":" + "currentExchangDate", DateUtil.dateToString(((ExOrder) list.get(0)).getTransactionTime(), "yyyy-MM-dd").toString());
        /*  97 */
        TradeRedis.setStringData(header + ":" + "currentExchangTime", DateUtil.dateToString(((ExOrder) list.get(0)).getTransactionTime(), "yyyy-MM-dd HH:mm:ss").toString());
    /*     */
    } else {
        /*  99 */
        TradeRedis.setStringData(header + ":" + "currentExchangPrice", "0.00");
        /* 100 */
        TradeRedis.setStringData(header + ":" + "currentExchangDate", DateUtil.dateToString(new Date(), "yyyy-MM-dd").toString());
        /* 101 */
        TradeRedis.setStringData(header + ":" + "currentExchangTime", DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss").toString());
    /*     */
    }
/*     */
}
Also used : ExOrder(hry.trade.entrust.model.ExOrder) JSONObject(com.alibaba.fastjson.JSONObject) ExOrderDao(hry.trade.entrust.dao.ExOrderDao)

Example 4 with ExOrderDao

use of hry.trade.entrust.dao.ExOrderDao in project benchmark by seelunzi.

the class ExOrderServiceImpl method findNewListMarketnewAdd.

/*     */
/*     */
public String findNewListMarketnewAdd(String header, String minDate, String maxDate) /*     */
{
    /* 251 */
    ExOrderDao exOrderDao = (ExOrderDao) this.dao;
    /* 252 */
    String[] headarry = header.split(":");
    /* 253 */
    Map<String, Object> seramap = new HashMap();
    /* 254 */
    seramap.put("website", headarry[0]);
    /* 255 */
    seramap.put("currencyType", headarry[1]);
    /* 256 */
    seramap.put("coinCode", headarry[2].split("_")[0]);
    /* 257 */
    seramap.put("fixPriceCoinCode", headarry[2].split("_")[1]);
    /* 258 */
    seramap.put("minDate", minDate);
    /* 259 */
    seramap.put("maxDate", maxDate);
    /* 260 */
    List<ExOrder> list = new ArrayList();
    /* 261 */
    if (DifCustomer.isexOrderIsMemory().booleanValue()) {
        /* 262 */
        list = this.redisService.getList1(header + ":" + "LastOrderRecordAdds");
        /* 263 */
        if ((null == list) || (list.size() == 0)) {
            /* 264 */
            list = exOrderDao.findNewListnewAdd(seramap);
            /* 265 */
            this.redisService.setList(header + ":" + "LastOrderRecords", list);
        /*     */
        } else {
            /* 267 */
            Collections.reverse(list);
            /*     */
            /* 269 */
            this.redisService.setList(header + ":" + "LastOrderRecordAdds", new ArrayList());
        /*     */
        }
    /*     */
    } else /*     */
    {
        /* 273 */
        list = exOrderDao.findNewListnewAdd(seramap);
    /*     */
    }
    /* 275 */
    List<MarketTradesSub> listsub = new ArrayList();
    /* 276 */
    if ((null != list) && (list.size() > 0)) {
        /* 277 */
        for (ExOrder l : list) {
            /* 278 */
            MarketTradesSub sub = new MarketTradesSub();
            /* 279 */
            sub.setAmount(l.getTransactionCount().setScale(4, 4));
            /* 280 */
            sub.setPrice(l.getTransactionPrice().setScale(2, 4));
            /* 281 */
            sub.setTid(l.getOrderNum());
            /* 282 */
            sub.setType(l.getInOrOutTransaction());
            /* 283 */
            sub.setTime(l.getTransactionTime().getTime() / 1000L);
            /* 284 */
            listsub.add(sub);
        /*     */
        }
        /* 286 */
        MarketTrades marketTrades = new MarketTrades();
        /* 287 */
        marketTrades.setTrades(listsub);
        /* 288 */
        return JSON.toJSONString(marketTrades).toString();
    /*     */
    }
    /* 290 */
    return "";
/*     */
}
Also used : MarketTrades(hry.trade.websoketContext.model.MarketTrades) MarketTradesSub(hry.trade.websoketContext.model.MarketTradesSub) ExOrder(hry.trade.entrust.model.ExOrder) JSONObject(com.alibaba.fastjson.JSONObject) ExOrderDao(hry.trade.entrust.dao.ExOrderDao)

Example 5 with ExOrderDao

use of hry.trade.entrust.dao.ExOrderDao in project benchmark by seelunzi.

the class ExOrderServiceImpl method getNewList.

/*     */
/*     */
/*     */
public String getNewList(String header, Integer count) /*     */
{
    /* 160 */
    if (null == count) {
        /* 161 */
        count = Integer.valueOf(10);
    /*     */
    }
    /* 163 */
    ExOrderDao exOrderDao = (ExOrderDao) this.dao;
    /* 164 */
    String[] headarry = header.split(":");
    /* 165 */
    Map<String, Object> seramap = new HashMap();
    /* 166 */
    seramap.put("website", headarry[0]);
    /* 167 */
    seramap.put("currencyType", headarry[1]);
    /* 168 */
    seramap.put("coinCode", headarry[2].split("_")[0]);
    /* 169 */
    seramap.put("fixPriceCoinCode", headarry[2].split("_")[1]);
    /* 170 */
    seramap.put("count", count);
    /* 171 */
    List<ExOrder> list = exOrderDao.findNewList(seramap);
    /* 172 */
    for (ExOrder l : list) {
        /* 173 */
        l.setTransactionPrice(l.getTransactionPrice().setScale(4, 4));
        /* 174 */
        l.setTransactionCount(l.getTransactionCount().setScale(4, 4));
    /*     */
    }
    /* 176 */
    MarketTradesSelf marketTrades = new MarketTradesSelf();
    /* 177 */
    marketTrades.setTrades(list);
    /* 178 */
    SimplePropertyPreFilter s = new SimplePropertyPreFilter(ExOrder.class, new String[] { "coinCode", "transactionTime", "transactionPrice", "transactionCount" });
    /* 179 */
    return JSON.toJSONString(marketTrades, s, new SerializerFeature[0]).toString();
/*     */
}
Also used : SimplePropertyPreFilter(com.alibaba.fastjson.serializer.SimplePropertyPreFilter) SerializerFeature(com.alibaba.fastjson.serializer.SerializerFeature) ExOrder(hry.trade.entrust.model.ExOrder) JSONObject(com.alibaba.fastjson.JSONObject) ExOrderDao(hry.trade.entrust.dao.ExOrderDao) MarketTradesSelf(hry.trade.websoketContext.model.MarketTradesSelf)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)5 ExOrderDao (hry.trade.entrust.dao.ExOrderDao)5 ExOrder (hry.trade.entrust.model.ExOrder)5 SerializerFeature (com.alibaba.fastjson.serializer.SerializerFeature)1 SimplePropertyPreFilter (com.alibaba.fastjson.serializer.SimplePropertyPreFilter)1 MarketTrades (hry.trade.websoketContext.model.MarketTrades)1 MarketTradesSelf (hry.trade.websoketContext.model.MarketTradesSelf)1 MarketTradesSub (hry.trade.websoketContext.model.MarketTradesSub)1