| | |
| | | BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol()); |
| | | Long tradeMemberId = holdOrderEntity.getMemberId(); |
| | | if (CollUtil.isNotEmpty(followerSettings)) { |
| | | List<Long> hasExists = new ArrayList<>(); |
| | | List<Object> hasExist = new ArrayList<>(); |
| | | for (FollowFollowerSettingEntity followerSetting : followerSettings) { |
| | | // 加redis锁,同一个用户不能同时触发两个跟单任务,否则会出现金额问题 |
| | | while(true) { |
| | | List<Object> followerMemberId = redisUtils.lGet(AppContants.MEMBER_HAS_FOLLOW, 0, -1); |
| | | while (true) { |
| | | List<Object> followerMemberId = redisUtils.lGet(AppContants.MEMBER_HAS_FOLLOW, 0, -1); |
| | | log.info("#跟单用户任务已存在:{}, 当前:{}#", followerMemberId, followerSetting.getMemberId()); |
| | | log.info("#------->{}#", followerMemberId.contains(followerSetting.getMemberId().intValue())); |
| | | if (CollUtil.isEmpty(followerMemberId) || !followerMemberId.contains(followerSetting.getMemberId().intValue())) { |
| | | log.info("跳出"); |
| | | hasExists.add(followerSetting.getMemberId()); |
| | | redisUtils.lSet(AppContants.MEMBER_HAS_FOLLOW, hasExists); |
| | | hasExist.add(followerSetting.getMemberId()); |
| | | redisUtils.lSet(AppContants.MEMBER_HAS_FOLLOW, hasExist); |
| | | break; |
| | | } |
| | | |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // 预付款 |
| | | BigDecimal prePaymentAmount = bondAmount.add(openFeePrice).add(openFeePrice); |
| | | log.info("可用的余额:{}, {}", prePaymentAmount, walletContract.getAvailableBalance()); |
| | | if (prePaymentAmount.compareTo(walletContract.getAvailableBalance()) > -1) { |
| | | log.info("可用金额不足"); |
| | | LogRecordUtils.insertFollowerNotice(followerSetting.getMemberId(), NoticeConstant.MONEY_NOT_ENOUGH_TITLE, StrUtil.format(NoticeConstant.MONEY_NOT_ENOUGH_CONTENT, followTraderInfoEntity.getNickname())); |