| | |
| | | * @author wzy |
| | | */ |
| | | public enum CoinTypeEnum { |
| | | USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,BEA,GUSD,GOLDRICE, |
| | | // USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,BEA,GUSD,GOLDRICE, |
| | | USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,GUSD,GOLDRICE, |
| | | } |
| | |
| | | */ |
| | | @Getter |
| | | public enum SymbolEnum { |
| | | BEA("BEA", "BEA/USDT") |
| | | ,GUSD("GUSD", "GUSD/USDT") |
| | | ,GOLDRICE("GOLDRICE", "GOLDRICE/USDT") |
| | | // BEA("BEA", "BEA/USDT") |
| | | // ,GUSD("GUSD", "GUSD/USDT") |
| | | GOLDRICE("GOLDRICE", "GOLDRICE/USDT") |
| | | ,BTC("BTC", "BTC/USDT") |
| | | ,ETH("ETH", "ETH/USDT") |
| | | ,LTC("LTC", "LTC/USDT") |
| | |
| | | } |
| | | |
| | | if (Integer.parseInt(total) < gbzAddDto.getCount()) { |
| | | return Result.fail("BEA数量不足"); |
| | | return Result.fail("GOLDRICE数量不足"); |
| | | } |
| | | |
| | | GbzOrderEntity gbzOrder = new GbzOrderEntity(); |
| | |
| | | gbzOrder.setAmount(amount); |
| | | gbzOrder.setCnt(gbzAddDto.getCount()); |
| | | gbzOrder.setMemberId(loginUser.getId()); |
| | | gbzOrder.setSymbol(CoinTypeEnum.BEA.name()); |
| | | gbzOrder.setSymbol(CoinTypeEnum.GOLDRICE.name()); |
| | | gbzOrder.setStatus(1); |
| | | |
| | | gbzOrderDao.insert(gbzOrder); |
| | | |
| | | memberWalletCoinDao.updateBlockBalance(wallet.getId(), amount.negate(), BigDecimal.ZERO, 0); |
| | | redisUtils.set("bea_coin_total", Integer.parseInt(total) - gbzAddDto.getCount()); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买BEA", amount, "USDT", 1, 1); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买GOLDRICE", amount, "USDT", 1, 1); |
| | | return Result.ok("购买成功"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum |
| | | .BEA.name()); |
| | | .GOLDRICE.name()); |
| | | memberWalletCoinDao.updateBlockBalance(wallet.getId(), totalAmount, BigDecimal.ZERO, 0); |
| | | |
| | | gbzOrderDao.updateStatus(member.getId()); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取BEA到资产", totalAmount, "BEA", 1, 1); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取GOLDRICE到资产", totalAmount, "GOLDRICE", 1, 1); |
| | | return Result.ok("提取成功"); |
| | | } |
| | | } |
| | |
| | | } |
| | | Long memberId = memberCoinAddress.getMemberId(); |
| | | // 查询钱包 并更新 |
| | | MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.BEA.name()); |
| | | MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.GOLDRICE.name()); |
| | | if (walletCoinEntity == null) { |
| | | // 创建一个钱包 |
| | | // 创建这个钱包 |
| | |
| | | |
| | | memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), balance, BigDecimal.ZERO, 0); |
| | | |
| | | String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.BEA.name(), "", BigDecimal.ZERO, null); |
| | | String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.GOLDRICE.name(), "", BigDecimal.ZERO, null); |
| | | // 插入财务记录 |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.BEA.name(), 1, 1); |
| | | LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.GOLDRICE.name(), 1, 1); |
| | | |
| | | try { |
| | | ThreadPoolUtils.sendDingTalk(5); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | if (StrUtil.isNotBlank(member.getPhone())) { |
| | | String amount = balance.toPlainString() + "BEA"; |
| | | String amount = balance.toPlainString() + "GOLDRICE"; |
| | | Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | | } else { |
| | | SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo); |
| | |
| | |
|
| | | @Override
|
| | | public Result findAllWalletCoinOrder() {
|
| | | List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.BEA.toString());
|
| | | List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.GOLDRICE.toString());
|
| | | return Result.ok(orderCoinsDealEntities);
|
| | | }
|
| | |
|
| | |
| | | |
| | | public class SymbolsConstats { |
| | | public final static List<String> EXCHANGE_SYMBOLS = new ArrayList<>(); |
| | | public final static String ROC = "BEA"; |
| | | public final static String ROC = "GOLDRICE"; |
| | | static { |
| | | EXCHANGE_SYMBOLS.add("BEA"); |
| | | EXCHANGE_SYMBOLS.add("GOLDRICE"); |
| | | } |
| | | } |
| | |
| | | kLine.setLow(kLine.getClose()); |
| | | kLine.setHigh(kLine.getClose()); |
| | | kLine.setVolume(BigDecimal.ZERO); |
| | | redisUtils.set("BEA/USDT",kLine); |
| | | redisUtils.set("GOLDRICE/USDT",kLine); |
| | | } |
| | | } |
| | | |
| | |
| | | @RabbitListener(queues = RabbitMqConfig.QUEUE_TRADE_PLATE) |
| | | public void tradePlate(String content) { |
| | | //log.info("--发送盘口消息--"); |
| | | tradePlateSendWebSocket.sendMessagePlate("BEA/USDT",content,null); |
| | | tradePlateSendWebSocket.sendMessagePlate("GOLDRICE/USDT",content,null); |
| | | } |
| | | |
| | | /** |
| | |
| | | return "EOS/USDT"; |
| | | case "etcusdt": |
| | | return "ETC/USDT"; |
| | | case "beausdt": |
| | | return "BEA/USDT"; |
| | | case "goldriceusdt": |
| | | return "GOLDRICE/USDT"; |
| | | default: |
| | | return null; |
| | | } |
| | |
| | | switch (symbol) { |
| | | case "BTC/USDT": |
| | | return "btcusdt"; |
| | | case "BEA/USDT": |
| | | return "beausdt"; |
| | | case "GOLDRICE/USDT": |
| | | return "goldriceusdt"; |
| | | default: |
| | | return null; |
| | | } |
| | |
| | | return "EOS_NEW_PRICE"; |
| | | case "ETC/USDT": |
| | | return "ETC_NEW_PRICE"; |
| | | case "BEA/USDT": |
| | | return "BEA_NEW_PRICE"; |
| | | case "GOLDRICE/USDT": |
| | | return "GOLDRICE_NEW_PRICE"; |
| | | default: |
| | | return null; |
| | | } |
| | |
| | | // 发送订阅消息 |
| | | String nekk = factory.getTrader(SymbolsConstats.ROC).sendTradePlateMessage(); |
| | | SubResultModel subResultModel = new SubResultModel(); |
| | | subResultModel.setId("beausdt"); |
| | | subResultModel.setId("goldriceusdt"); |
| | | subResultModel.setSubbed(sub); |
| | | synchronized (session) { |
| | | try { |
| | |
| | | String key = "KINE_{}_{}"; |
| | | // 币币k线数据 |
| | | //key = StrUtil.format(key, symbol, period); |
| | | key = StrUtil.format(key, "BEA/USDT", period); |
| | | key = StrUtil.format(key, "GOLDRICE/USDT", period); |
| | | RedisUtils bean = SpringContextHolder.getBean(RedisUtils.class); |
| | | Object o = bean.get(key); |
| | | List<CandlestickModel> candlestickModels = new ArrayList<>(); |