| | |
| | | * 服务器地址
|
| | | */
|
| | | //private static final String ETH_UTL = "https://mainnet.infura.io/v3/882c66ebcfc141abbea22b948fa44321";
|
| | | //private static final String ETH_UTL = "http://120.55.86.146:8545";
|
| | | private static final String ETH_UTL = "http://114.55.250.231:8545";
|
| | |
|
| | | public EthService() {
|
| | |
| | | // memberCoinChargeDao.updateById(coinCharge); |
| | | // } |
| | | } else { |
| | | String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE,gasPrice); |
| | | //String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE,gasPrice); |
| | | //log.info("转手续费:{}", hash); |
| | | } |
| | | } |
| | |
| | | if(CollectionUtils.isNotEmpty(memberCoinChargeEntities)){ |
| | | return; |
| | | } |
| | | // 校验这个交易是否成功 |
| | | EthService ethService = new EthService(); |
| | | boolean b = ethService.checkTransferResult(hash); |
| | | if(!b){ |
| | | log.info("#USDT假充值:{}#", hash); |
| | | return; |
| | | } |
| | | MemberCoinAddressEntity coinAddressEntity = memberCoinAddressDao.selectCoinAddressByAddressAndSymbol(address, CoinTypeEnum.USDT.toString()); |
| | | if (coinAddressEntity == null) { |
| | | return; |
| | |
| | | memberCoinChargeDao.insert(memberCoinChargeEntity); |
| | | return orderNo; |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | private Integer isForce; |
| | | |
| | | /** |
| | | * shifou xianzhi |
| | | */ |
| | | private Integer isTrader; |
| | | |
| | | /** |
| | | * 滑点 |
| | | */ |
| | |
| | | @Transactional |
| | | public Result memberTradersPwd(@Valid MemberForgetPwdDto memberForgetPwdDto) { |
| | | //获取用户ID |
| | | MemberEntity memberEntity = LoginUserUtils.getAppLoginUser(); |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | MemberEntity memberEntity = memberDao.selectById(memberId); |
| | | |
| | | String code = memberForgetPwdDto.getCode(); |
| | | String password = memberForgetPwdDto.getPassword(); |
| | |
| | | //获取用户ID |
| | | Long memberId = LoginUserUtils.getAppLoginUser().getId(); |
| | | MemberEntity member = memberDao.selectById(memberId); |
| | | // 判断是否限制 |
| | | if(1 == member.getIsTrader()){ |
| | | return Result.fail("此账号有财务问题,需联系客服"); |
| | | } |
| | | if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) { |
| | | return Result.fail(MessageSourceUtils.getString("member_service_0077")); |
| | | } |
| | |
| | | } |
| | | // 如果开盘价为0,则设置为前一个价格 |
| | | if(kLine.getOpen().compareTo(BigDecimal.ZERO) == 0) { |
| | | // 查询前一根K线 TODO |
| | | String key = "KINE_" + symbol + "/USDT_" + period; |
| | | Object data = redisUtils.get(key); |
| | | List list = new ArrayList(); |
| | | if (data != null) { |
| | | list = (List) data; |
| | | Candlestick o = (Candlestick)list.get(list.size() - 1); |
| | | kLine.setOpen(o.getClose()); |
| | | kLine.setClose(o.getClose()); |
| | | kLine.setLow(o.getClose()); |
| | | kLine.setHigh(o.getClose()); |
| | | }else{ |
| | | kLine.setOpen(coinThumb.getClose()); |
| | | kLine.setClose(coinThumb.getClose()); |
| | | kLine.setLow(coinThumb.getClose()); |
| | | kLine.setHigh(coinThumb.getClose()); |
| | | } |
| | | |
| | | } |
| | | //logger.info("generate " + range + rangeUnit + " kline in {},data={}", df.format(new Date(kLine.getTimestamp())), JSON.toJSONString(kLine)); |
| | | service.saveKLine(symbol,period, kLine); |
| | | // 生成一个对应的新K线 后续的交易会更新这个最新K线数据 |
| | |
| | | List<OrderCoinsEntity> tradingOrders = new ArrayList<>(); |
| | | List<OrderCoinsEntity> completedOrders = new ArrayList<>(); |
| | | orders.forEach(order -> { |
| | | if(order.getDealCnt()==null){ |
| | | order.setDealCnt(BigDecimal.ZERO); |
| | | } |
| | | if(order.getDealAmount()==null){ |
| | | order.setDealAmount(BigDecimal.ZERO); |
| | | } |
| | | tradingOrders.add(order); |
| | | }); |
| | | try { |
| | |
| | | public static boolean sendRechargeMsg(String phone, String time, String orderNo) { |
| | | String msg = "尊敬的用户,您的帐号于{}有一笔成功充值订单,订单编号{}"; |
| | | String content = StrUtil.format(msg, time, orderNo); |
| | | return request(phone, content, "充值"); |
| | | return true; |
| | | //return request(phone, content, "充值"); |
| | | } |
| | | |
| | | public static boolean sendWithdrawalMsg(String phone, String time, String orderNo) { |
| | | String msg = "尊敬的用户,您的帐号于{}有一笔成功提现订单,订单编号为{}"; |
| | | String content = StrUtil.format(msg, time, orderNo); |
| | | return request(phone, content, "提现"); |
| | | return true; |
| | | //return request(phone, content, "提现"); |
| | | } |
| | | |
| | | private static boolean request(String phone, String content, String tagName) { |
| | |
| | | </select>
|
| | |
|
| | | <select id="selectCoinOrderOnTrade" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
|
| | | select *
|
| | | from coins_order
|
| | | where order_status=1
|
| | | select a.id,
|
| | | a.deal_price,
|
| | | a.entrust_amount,
|
| | | a.fee_amount,
|
| | | a.entrust_cnt,
|
| | | a.mark_price,
|
| | | a.member_id,
|
| | | a.order_no,
|
| | | a.order_status,
|
| | | a.order_type,
|
| | | a.symbol,
|
| | | a.trade_type,
|
| | | a.version,
|
| | | a.create_by,
|
| | | a.create_time,
|
| | | a.update_by,
|
| | | a.update_time,
|
| | | a.entrust_price,
|
| | | (select sum(symbol_cnt) from coins_order_deal where order_id = a.id) as deal_cnt,
|
| | | (select sum(deal_amount) from coins_order_deal where order_id = a.id) as deal_amount
|
| | | from coins_order a
|
| | | where a.order_status=1
|
| | | <if test="list != null">
|
| | | and symbol in
|
| | | and a.symbol in
|
| | | <foreach collection="list" separator="," item="item" open="(" close=")">
|
| | | #{item}
|
| | | </foreach>
|
| | |
| | | package com.xcong.excoin; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.xcong.excoin.modules.coin.dao.OrderCoinsDao; |
| | | import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity; |
| | | import com.xcong.excoin.modules.coin.service.OrderCoinService; |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws InterruptedException { |
| | | // 测试两个地方 |
| | | List<String> list = new ArrayList<>(); |
| | | list.add("1"); |
| | | list.add("2"); |
| | | list.add("3"); |
| | | list.add("4"); |
| | | // 开一个线程 |
| | | Thread thread = new Thread(new Runnable() { |
| | | @SneakyThrows |
| | | @Override |
| | | public void run() { |
| | | Thread.sleep(1000); |
| | | synchronized (list){ |
| | | Iterator<String> iterator = list.iterator(); |
| | | while (iterator.hasNext()){ |
| | | System.out.println("线程里"+iterator.next()); |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | thread.start(); |
| | | synchronized (list){ |
| | | Iterator<String> iterator = list.iterator(); |
| | | while (iterator.hasNext()){ |
| | | Thread.sleep(1000); |
| | | System.out.println(iterator.next()); |
| | | } |
| | | } |
| | | |
| | | // |
| | | String s = SecureUtil.md5("330021"); |
| | | System.out.println(s); |
| | | } |
| | | } |