use of hry.exchange.product.model.ExCointoCoin in project benchmark by seelunzi.
the class ExEntrustServiceImpl method autoAddExEntrust.
/* */
/* */
/* */
/* */
public void autoAddExEntrust() /* */
{
/* 250 */
Map<String, String> mapLoadWeb = PropertiesUtils.getLoadWeb();
/* 251 */
for (String Website : mapLoadWeb.keySet()) {
/* 252 */
String currencyType = (String) mapLoadWeb.get(Website);
/* 253 */
List<ExCointoCoin> listExCointoCoin = this.commonDao.getExointocoinValid();
/* 254 */
max = 10;
/* 255 */
maxjs = 1;
/* 256 */
for (ExCointoCoin exCointoCoin : listExCointoCoin) {
/* 257 */
if (maxjs > max) {
/* 258 */
if (entrustType == 1) /* */
{
/* 260 */
entrustType = 2;
/* */
} else {
/* 262 */
entrustType = 1;
/* */
}
/* 264 */
return;
/* */
}
/* 266 */
String autoUsernames = exCointoCoin.getAutoUsername();
/* 267 */
Long customerId = exCointoCoin.getCustomerId();
/* 268 */
BigDecimal autoCount = exCointoCoin.getAutoCount();
/* 269 */
BigDecimal autoCountFloat = exCointoCoin.getAutoCountFloat();
/* 270 */
BigDecimal autoPrice = exCointoCoin.getAutoPrice();
/* 271 */
BigDecimal autoPriceFloat = exCointoCoin.getAutoPriceFloat();
/* 272 */
Integer isSratAuto = exCointoCoin.getIsSratAuto();
/* 273 */
Integer isFromChbtc = exCointoCoin.getIsFromChbtc();
/* 274 */
Integer fixPriceType = exCointoCoin.getFixPriceType();
/* 275 */
if (isSratAuto.equals(Integer.valueOf(1))) {
/* 276 */
String[] autoUsernameArr = null;
/* 277 */
if (null == customerId) {
/* 278 */
autoUsernameArr = autoUsernames.split(",");
/* */
}
/* 280 */
if (null == autoUsernameArr)
break;
/* 281 */
for (String autoUsername : autoUsernameArr) /* */
{
/* 283 */
AppCustomer customer = this.commonDao.getAppUserByuserName(autoUsername);
/* 284 */
if (null == autoUsername) {
/* 285 */
System.out.println("填写的手机号有误,请检查重试!");
/* 286 */
break;
/* */
}
/* 288 */
customerId = customer.getId();
/* 289 */
exCointoCoin.setCustomerId(customerId);
/* */
/* 291 */
maxjs++;
/* 292 */
if (isFromChbtc.equals(Integer.valueOf(0))) /* */
{
/* 297 */
for (int i = 0; i < 1; i++) {
/* 298 */
if (entrustType == 1) /* */
{
/* 300 */
BigDecimal buyautoPrice = getPrcie(exCointoCoin.getAtuoPriceType(), exCointoCoin.getUpFloatPer(), exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode(), autoPrice, autoPriceFloat);
/* */
/* 302 */
buyautoPrice = buyautoPrice.setScale(8, 5);
/* */
/* 304 */
BigDecimal buytrueNum = getPrcie(exCointoCoin.getAtuoPriceType(), exCointoCoin.getUpFloatPer(), exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode(), autoCount, autoCountFloat);
/* */
/* 306 */
buytrueNum = buytrueNum.setScale(8, 5);
/* 307 */
String coinCodebuy = exCointoCoin.getCoinCode() + "_" + exCointoCoin.getFixPriceCoinCode();
/* 308 */
addExEntrust(fixPriceType, Integer.valueOf(1), customerId, buyautoPrice, autoUsername, coinCodebuy, buytrueNum, "cny", "cn");
/* */
} else /* */
{
/* 311 */
BigDecimal sellautoPrice = getPrcie(exCointoCoin.getAtuoPriceType(), exCointoCoin.getUpFloatPer(), exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode(), autoPrice, autoPriceFloat);
/* */
/* 313 */
sellautoPrice = sellautoPrice.setScale(8, 5);
/* */
/* 315 */
BigDecimal selltrueNum = getPrcie(exCointoCoin.getAtuoPriceType(), exCointoCoin.getUpFloatPer(), exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode(), autoCount, autoCountFloat);
/* */
/* 317 */
selltrueNum = selltrueNum.setScale(8, 5);
/* 318 */
String coinCodesell = exCointoCoin.getCoinCode() + "_" + exCointoCoin.getFixPriceCoinCode();
/* 319 */
addExEntrust(fixPriceType, Integer.valueOf(2), customerId, sellautoPrice, autoUsername, coinCodesell, selltrueNum, "cny", "cn");
/* */
}
/* */
}
/* */
}
/* */
}
/* */
}
/* */
}
/* */
}
/* */
/* */
/* */
/* */
int max;
/* */
/* */
/* */
/* */
int maxjs;
/* 337 */
if (entrustType == 1) /* */
{
/* 339 */
entrustType = 2;
/* */
} else {
/* 341 */
entrustType = 1;
/* */
}
/* */
}
use of hry.exchange.product.model.ExCointoCoin in project benchmark by seelunzi.
the class ExEntrustServiceImpl method initTradeRedis.
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
public void initTradeRedis() /* */
{
/* 87 */
RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
/* 88 */
ExEntrustService exEntrustService = (ExEntrustService) ContextUtil.getBean("exEntrustService");
/* */
/* */
/* */
/* 92 */
List<ExCointoCoin> listExCointoCoin = this.commonDao.getExointocoinValid();
/* 93 */
for (ExCointoCoin exCointoCoin : listExCointoCoin) {
/* 94 */
String header = getHeader(exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode());
/* 95 */
this.exOrderService.setLastExchangPrice(header);
/* 96 */
this.exOrderService.setCurrentExchangPrice(header);
/* */
}
/* */
}
use of hry.exchange.product.model.ExCointoCoin in project benchmark by seelunzi.
the class ExEntrustServiceImpl method tradeInit.
/* */
/* */
/* */
/* */
public void tradeInit() /* */
{
/* 104 */
RedisTradeService redisTradeService = (RedisTradeService) ContextUtil.getBean("redisTradeService");
/* */
/* 106 */
redisTradeService.delkeys(":buy:");
/* 107 */
redisTradeService.delkeys(":sell:");
/* */
/* */
/* 110 */
List<ExCointoCoin> listExCointoCoin = this.commonDao.getExointocoinValid();
/* 111 */
for (ExCointoCoin exCointoCoin : listExCointoCoin) {
/* 112 */
String header = getHeader(exCointoCoin.getCoinCode(), exCointoCoin.getFixPriceCoinCode());
/* */
/* 114 */
QueryFilter filterbuy = new QueryFilter(ExEntrust.class);
/* 115 */
filterbuy.addFilter("status<", Integer.valueOf(2));
/* 116 */
filterbuy.addFilter("type=", Integer.valueOf(1));
/* 117 */
filterbuy.addFilter("coinCode=", exCointoCoin.getCoinCode());
/* 118 */
filterbuy.addFilter("fixPriceCoinCode=", exCointoCoin.getFixPriceCoinCode());
/* 119 */
filterbuy.setOrderby("entrustPrice desc");
/* 120 */
List<ExEntrust> listbuy = find(filterbuy);
/* 121 */
List<EntrustTrade> listbuypricesame = new ArrayList();
/* 122 */
String buyonePricekey = header + ":" + "buyonePrice";
/* 123 */
if ((null != listbuy) && (listbuy.size() > 0)) {
/* 124 */
BigDecimal sameprice = ((ExEntrust) listbuy.get(0)).getEntrustPrice();
/* 125 */
EntrustTrade entrustTrade = null;
/* 126 */
for (ExEntrust l : listbuy) {
/* 127 */
String exentrust = JSON.toJSONString(l);
/* 128 */
entrustTrade = (EntrustTrade) JSON.parseObject(exentrust, EntrustTrade.class);
/* 129 */
if (l.getEntrustPrice().compareTo(sameprice) == 0) {
/* 130 */
listbuypricesame.add(entrustTrade);
/* */
} else {
/* 132 */
String key = getHeader(entrustTrade) + ":buy:" + sameprice.setScale(10, 6).toString();
/* 133 */
redisTradeService.save(key, JSON.toJSONString(listbuypricesame));
/* 134 */
listbuypricesame = new ArrayList();
/* 135 */
listbuypricesame.add(entrustTrade);
/* 136 */
sameprice = l.getEntrustPrice();
/* */
}
/* */
}
/* 139 */
String key = header + ":buy:" + sameprice.setScale(10, 6).toString();
/* 140 */
redisTradeService.save(key, JSON.toJSONString(listbuypricesame));
/* */
/* */
/* 143 */
this.redisService.save(buyonePricekey, JSON.toJSONString(((ExEntrust) listbuy.get(0)).getEntrustPrice()));
/* */
} else {
/* 145 */
this.redisService.delete(buyonePricekey);
/* */
}
/* */
/* */
/* */
/* 150 */
QueryFilter filtersell = new QueryFilter(ExEntrust.class);
/* 151 */
filtersell.addFilter("status<", Integer.valueOf(2));
/* 152 */
filtersell.addFilter("type=", Integer.valueOf(2));
/* 153 */
filtersell.addFilter("coinCode=", exCointoCoin.getCoinCode());
/* 154 */
filtersell.addFilter("fixPriceCoinCode=", exCointoCoin.getFixPriceCoinCode());
/* 155 */
filtersell.setOrderby("entrustPrice asc");
/* 156 */
List<ExEntrust> listsell = find(filtersell);
/* 157 */
List<EntrustTrade> listsellpricesame = new ArrayList();
/* 158 */
String sellonePricekey = header + ":" + "sellonePrice";
/* 159 */
if ((null != listsell) && (listsell.size() > 0)) {
/* 160 */
BigDecimal sameprice = ((ExEntrust) listsell.get(0)).getEntrustPrice();
/* 161 */
EntrustTrade entrustTrade = null;
/* 162 */
for (ExEntrust l : listsell) {
/* 163 */
String exentrust = JSON.toJSONString(l);
/* 164 */
entrustTrade = (EntrustTrade) JSON.parseObject(exentrust, EntrustTrade.class);
/* 165 */
if (l.getEntrustPrice().compareTo(sameprice) == 0) {
/* 166 */
listsellpricesame.add(entrustTrade);
/* */
} else {
/* 168 */
String key = getHeader(entrustTrade) + ":sell:" + sameprice.setScale(10, 6).toString();
/* 169 */
redisTradeService.save(key, JSON.toJSONString(listsellpricesame));
/* 170 */
listsellpricesame = new ArrayList();
/* 171 */
listsellpricesame.add(entrustTrade);
/* 172 */
sameprice = l.getEntrustPrice();
/* */
}
/* */
}
/* */
/* */
/* 177 */
String key = header + ":sell:" + sameprice.setScale(10, 6).toString();
/* 178 */
redisTradeService.save(key, JSON.toJSONString(listsellpricesame));
/* */
/* 180 */
this.redisService.save(sellonePricekey, JSON.toJSONString(((ExEntrust) listsell.get(0)).getEntrustPrice()));
/* */
} else {
/* 182 */
this.redisService.delete(sellonePricekey);
/* */
}
/* */
}
/* */
}
use of hry.exchange.product.model.ExCointoCoin in project benchmark by seelunzi.
the class ExEntrustServiceImpl method cancelAutoAddExEntrust.
/* */
/* */
/* */
/* */
/* */
public void cancelAutoAddExEntrust() /* */
{
/* 192 */
Map<String, String> mapLoadWeb = PropertiesUtils.getLoadWeb();
/* 193 */
for (String Website : mapLoadWeb.keySet()) {
/* 194 */
List<ExCointoCoin> listExCointoCoin = this.commonDao.getExointocoinValid();
/* 195 */
for (ExCointoCoin exCointoCoin : listExCointoCoin) {
/* 196 */
String autoUsernames = exCointoCoin.getAutoUsername();
/* 197 */
Long customerId = exCointoCoin.getCustomerId();
/* 198 */
Integer isSratAuto = exCointoCoin.getIsSratAuto();
/* 199 */
Integer isFromChbtc = exCointoCoin.getIsFromChbtc();
/* 202 */
if (isSratAuto.equals(Integer.valueOf(1))) {
/* 203 */
String[] autoUsernameArr = null;
/* 204 */
if (null == customerId) {
/* 205 */
autoUsernameArr = autoUsernames.split(",");
/* */
}
/* 207 */
if (null == autoUsernameArr)
break;
/* 208 */
for (String autoUsername : autoUsernameArr) {
/* 209 */
if (null == customerId) {
/* 210 */
AppCustomer customer = this.commonDao.getAppUserByuserName(autoUsername);
/* 211 */
if (null == autoUsername) {
/* 212 */
System.out.println("填写的手机号有误,请检查重试!");
/* 213 */
break;
/* */
}
/* 215 */
customerId = customer.getId();
/* 216 */
exCointoCoin.setCustomerId(customerId);
/* */
}
/* 219 */
if (isFromChbtc.equals(Integer.valueOf(0))) /* */
{
/* 221 */
EntrustTrade entrustTrade = new EntrustTrade();
/* 222 */
entrustTrade.setCustomerId(customerId);
/* 223 */
entrustTrade.setCoinCode(exCointoCoin.getCoinCode());
/* 224 */
entrustTrade.setFixPriceCoinCode(exCointoCoin.getFixPriceCoinCode());
/* 225 */
entrustTrade.setCancelKeepN(Integer.valueOf(10));
/* */
/* 227 */
String str = JSON.toJSONString(entrustTrade);
/* 228 */
MessageProducer messageProducer = (MessageProducer) ContextUtil.getBean("messageProducer");
/* */
/* 230 */
messageProducer.toTrade(str);
/* */
}
/* */
}
/* */
}
/* */
}
/* */
}
/* */
}
Aggregations