|  |  | 
 |  |  |  * @author wzy | 
 |  |  |  */ | 
 |  |  | public enum CoinTypeEnum { | 
 |  |  |     USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,BZZ | 
 |  |  |     USDT, BTC, ETH, LTC, EOS, XRP, BCH, ETC,BEA | 
 |  |  | } | 
 
 |  |  | 
 |  |  |  */ | 
 |  |  | @Getter | 
 |  |  | public enum SymbolEnum { | 
 |  |  |     BZZ("BZZ", "BZZ/USDT") | 
 |  |  |     BEA("BEA", "BEA/USDT") | 
 |  |  |     ,BTC("BTC", "BTC/USDT") | 
 |  |  |     ,ETH("ETH", "ETH/USDT") | 
 |  |  |     ,LTC("LTC", "LTC/USDT") | 
 
 |  |  | 
 |  |  |     @PostMapping(value = "/add") | 
 |  |  |     @Transactional(rollbackFor = Exception.class) | 
 |  |  |     public Result add(@RequestBody GbzAddDto gbzAddDto) { | 
 |  |  |         String status = redisUtils.getString("bzz_order_status"); | 
 |  |  |         String status = redisUtils.getString("bea_order_status"); | 
 |  |  |         if ("1".equals(status)) { | 
 |  |  |             return Result.fail("无法购买"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         String start = redisUtils.getString("bzz_start"); | 
 |  |  |         String start = redisUtils.getString("bea_start"); | 
 |  |  |         if ("2".equals(start)) { | 
 |  |  |             return Result.fail("暂无法购买"); | 
 |  |  |         } | 
 |  |  |         String total = redisUtils.getString("bzz_coin_total"); | 
 |  |  |         String total = redisUtils.getString("bea_coin_total"); | 
 |  |  |  | 
 |  |  |         MemberEntity loginUser = LoginUserUtils.getAppLoginUser(); | 
 |  |  |         BigDecimal price = new BigDecimal(redisUtils.getString("bzz_order_new_price")); | 
 |  |  |         BigDecimal price = new BigDecimal(redisUtils.getString("bea_order_new_price")); | 
 |  |  |         BigDecimal amount = BigDecimal.valueOf(gbzAddDto.getCount()).multiply(price); | 
 |  |  |  | 
 |  |  |         MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(loginUser.getId(), CoinTypeEnum.USDT.name()); | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (Integer.parseInt(total) < gbzAddDto.getCount()) { | 
 |  |  |             return Result.fail("BZZ数量不足"); | 
 |  |  |             return Result.fail("BEA数量不足"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         GbzOrderEntity gbzOrder = new GbzOrderEntity(); | 
 |  |  | 
 |  |  |         gbzOrder.setAmount(amount); | 
 |  |  |         gbzOrder.setCnt(gbzAddDto.getCount()); | 
 |  |  |         gbzOrder.setMemberId(loginUser.getId()); | 
 |  |  |         gbzOrder.setSymbol(CoinTypeEnum.BZZ.name()); | 
 |  |  |         gbzOrder.setSymbol(CoinTypeEnum.BEA.name()); | 
 |  |  |         gbzOrder.setStatus(1); | 
 |  |  |  | 
 |  |  |         gbzOrderDao.insert(gbzOrder); | 
 |  |  |  | 
 |  |  |         memberWalletCoinDao.updateBlockBalance(wallet.getId(), amount.negate(), BigDecimal.ZERO, 0); | 
 |  |  |         redisUtils.set("bzz_coin_total", Integer.parseInt(total) - gbzAddDto.getCount()); | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买BZZ", amount, "USDT", 1, 1); | 
 |  |  |         redisUtils.set("bea_coin_total", Integer.parseInt(total) - gbzAddDto.getCount()); | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(loginUser.getId(), "购买BEA", amount, "USDT", 1, 1); | 
 |  |  |         return Result.ok("购买成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @GetMapping(value = "/findPrice") | 
 |  |  |     public Result findPrice() { | 
 |  |  |         PriceVo priceVo = new PriceVo(); | 
 |  |  |         String newPriceStr = redisUtils.getString("bzz_order_new_price"); | 
 |  |  |         String newPriceStr = redisUtils.getString("bea_order_new_price"); | 
 |  |  |         priceVo.setNewPrice(StrUtil.isNotBlank(newPriceStr) ? new BigDecimal(newPriceStr) : BigDecimal.valueOf(66)); | 
 |  |  |  | 
 |  |  |         String status = redisUtils.getString("bzz_order_status"); | 
 |  |  |         String status = redisUtils.getString("bea_order_status"); | 
 |  |  |         priceVo.setStatus(StrUtil.isNotBlank(status) ? Integer.parseInt(status) : 2); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         String remain = redisUtils.getString("bzz_coin_total"); | 
 |  |  |         String remain = redisUtils.getString("bea_coin_total"); | 
 |  |  |         priceVo.setRemainCnt(88888); | 
 |  |  |  | 
 |  |  |         BigDecimal totalAmount = gbzOrderDao.selectOrderTotalAmount(LoginUserUtils.getAppLoginUser().getId()); | 
 |  |  | 
 |  |  |     @ApiOperation(value = "提取到资产") | 
 |  |  |     @PostMapping(value = "/changeWallet") | 
 |  |  |     public Result changeWallet() { | 
 |  |  |         String status = redisUtils.getString("bzz_order_status"); | 
 |  |  |         String status = redisUtils.getString("bea_order_status"); | 
 |  |  |         if (!"1".equals(status)) { | 
 |  |  |             return Result.fail("暂无法划转"); | 
 |  |  |         } | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         MemberWalletCoinEntity wallet = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum | 
 |  |  |                 .BZZ.name()); | 
 |  |  |                 .BEA.name()); | 
 |  |  |         memberWalletCoinDao.updateBlockBalance(wallet.getId(), totalAmount, BigDecimal.ZERO, 0); | 
 |  |  |  | 
 |  |  |         gbzOrderDao.updateStatus(member.getId()); | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取BZZ到资产", totalAmount, "BZZ", 1, 1); | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(member.getId(), "提取BEA到资产", totalAmount, "BEA", 1, 1); | 
 |  |  |         return Result.ok("提取成功"); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     @SubmitRepeat
 | 
 |  |  |     public Result submitSalesWalletCoinOrder(@RequestBody @Valid SubmitSalesWalletCoinOrderDto submitSalesWalletCoinOrderDto) {
 | 
 |  |  |         log.debug("买卖单参数[{}]", JSONObject.toJSONString(submitSalesWalletCoinOrderDto));
 | 
 |  |  |         String status = redisUtils.getString("bzz_order_status");
 | 
 |  |  |         String status = redisUtils.getString("bea_order_status");
 | 
 |  |  |         if (!"1".equals(status)) {
 | 
 |  |  |             return Result.fail("暂未开放");
 | 
 |  |  |         }
 | 
 
 |  |  | 
 |  |  |         } | 
 |  |  |         Long memberId = memberCoinAddress.getMemberId(); | 
 |  |  |         // 查询钱包 并更新 | 
 |  |  |         MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.BZZ.name()); | 
 |  |  |         MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.BEA.name()); | 
 |  |  |         if (walletCoinEntity == null) { | 
 |  |  |             // 创建一个钱包 | 
 |  |  |             // 创建这个钱包 | 
 |  |  | 
 |  |  |  | 
 |  |  |         memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), balance, BigDecimal.ZERO, 0); | 
 |  |  |  | 
 |  |  |         String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.BZZ.name(), "", BigDecimal.ZERO, null); | 
 |  |  |         String orderNo = insertCoinCharge(address, memberId, balance, CoinTypeEnum.BEA.name(), "", BigDecimal.ZERO, null); | 
 |  |  |         // 插入财务记录 | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.BZZ.name(), 1, 1); | 
 |  |  |         LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", balance, CoinTypeEnum.BEA.name(), 1, 1); | 
 |  |  |  | 
 |  |  |         try { | 
 |  |  |             ThreadPoolUtils.sendDingTalk(5); | 
 |  |  |             MemberEntity member = memberDao.selectById(memberId); | 
 |  |  |             if (StrUtil.isNotBlank(member.getPhone())) { | 
 |  |  |                 String amount = balance.toPlainString() + "BZZ"; | 
 |  |  |                 String amount = balance.toPlainString() + "BEA"; | 
 |  |  |                 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.BZZ.toString());
 | 
 |  |  |         List<OrderCoinsDealEntity> orderCoinsDealEntities = orderCoinDealDao.selectAllCoinDealsOrderBySymbol(CoinTypeEnum.BEA.toString());
 | 
 |  |  |         return Result.ok(orderCoinsDealEntities);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 
 |  |  | 
 |  |  |  | 
 |  |  | public class SymbolsConstats { | 
 |  |  |     public final  static List<String> EXCHANGE_SYMBOLS = new ArrayList<>(); | 
 |  |  |     public final  static String ROC = "BZZ"; | 
 |  |  |     public final  static String ROC = "BEA"; | 
 |  |  |     static { | 
 |  |  |         EXCHANGE_SYMBOLS.add("BZZ"); | 
 |  |  |         EXCHANGE_SYMBOLS.add("BEA"); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  |             kLine.setLow(kLine.getClose()); | 
 |  |  |             kLine.setHigh(kLine.getClose()); | 
 |  |  |             kLine.setVolume(BigDecimal.ZERO); | 
 |  |  |             redisUtils.set("BZZ/USDT",kLine); | 
 |  |  |             redisUtils.set("BEA/USDT",kLine); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |     @RabbitListener(queues = RabbitMqConfig.QUEUE_TRADE_PLATE) | 
 |  |  |     public void tradePlate(String content) { | 
 |  |  |         //log.info("--发送盘口消息--"); | 
 |  |  |         tradePlateSendWebSocket.sendMessagePlate("BZZ/USDT",content,null); | 
 |  |  |         tradePlateSendWebSocket.sendMessagePlate("BEA/USDT",content,null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 
 |  |  | 
 |  |  |                 return "EOS/USDT"; | 
 |  |  |             case "etcusdt": | 
 |  |  |                 return "ETC/USDT"; | 
 |  |  |             case "bzzusdt": | 
 |  |  |                 return "BZZ/USDT"; | 
 |  |  |             case "beausdt": | 
 |  |  |                 return "BEA/USDT"; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  | 
 |  |  |         switch (symbol) { | 
 |  |  |             case "BTC/USDT": | 
 |  |  |                 return "btcusdt"; | 
 |  |  |             case "BZZ/USDT": | 
 |  |  |                 return "bzzusdt"; | 
 |  |  |             case "BEA/USDT": | 
 |  |  |                 return "beausdt"; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  | 
 |  |  |                 return "EOS_NEW_PRICE"; | 
 |  |  |             case "ETC/USDT": | 
 |  |  |                 return "ETC_NEW_PRICE"; | 
 |  |  |             case "BZZ/USDT": | 
 |  |  |                 return "BZZ_NEW_PRICE"; | 
 |  |  |             case "BEA/USDT": | 
 |  |  |                 return "BEA_NEW_PRICE"; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |             // 发送订阅消息 | 
 |  |  |             String nekk = factory.getTrader(SymbolsConstats.ROC).sendTradePlateMessage(); | 
 |  |  |             SubResultModel subResultModel = new SubResultModel(); | 
 |  |  |             subResultModel.setId("bzzusdt"); | 
 |  |  |             subResultModel.setId("beausdt"); | 
 |  |  |             subResultModel.setSubbed(sub); | 
 |  |  |             synchronized (session) { | 
 |  |  |                 try { | 
 |  |  | 
 |  |  |             String key = "KINE_{}_{}"; | 
 |  |  |             // 币币k线数据 | 
 |  |  |             //key = StrUtil.format(key, symbol, period); | 
 |  |  |             key = StrUtil.format(key, "BZZ/USDT", period); | 
 |  |  |             key = StrUtil.format(key, "BEA/USDT", period); | 
 |  |  |             RedisUtils bean = SpringContextHolder.getBean(RedisUtils.class); | 
 |  |  |             Object o = bean.get(key); | 
 |  |  |             List<CandlestickModel> candlestickModels = new ArrayList<>(); |