| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xcong.excoin.common.contants.AppContants; |
| | | import com.xcong.excoin.common.enumerates.CoinTypeEnum; |
| | | import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum; |
| | | import com.xcong.excoin.common.enumerates.RabbitPriceTypeEnum; |
| | |
| | | import com.xcong.excoin.rabbit.pricequeue.OrderModel; |
| | | import com.xcong.excoin.rabbit.producer.FollowProducer; |
| | | import com.xcong.excoin.rabbit.producer.OrderProducer; |
| | | import com.xcong.excoin.utils.CacheSettingUtils; |
| | | import com.xcong.excoin.utils.CalculateUtil; |
| | | import com.xcong.excoin.utils.LogRecordUtils; |
| | | import com.xcong.excoin.utils.ThreadPoolUtils; |
| | | import com.xcong.excoin.utils.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private FollowProducer followProducer; |
| | | @Autowired |
| | | private FollowTraderProfitDetailDao followTraderProfitDetailDao; |
| | | |
| | | @Resource |
| | | private RedisUtils redisUtils; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | Long tradeMemberId = holdOrderEntity.getMemberId(); |
| | | if (CollUtil.isNotEmpty(followerSettings)) { |
| | | for (FollowFollowerSettingEntity followerSetting : followerSettings) { |
| | | // 加redis锁,同一个用户不能同时触发两个跟单任务,否则会出现金额问题 |
| | | while(true) { |
| | | Long followerMemberId = (Long) redisUtils.get(AppContants.MEMBER_HAS_FOLLOW); |
| | | log.info("#跟单用户任务已存在:{}#", followerMemberId); |
| | | if (followerMemberId == null) { |
| | | log.info("跳出"); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //更新更新消息提醒的状态 |
| | | //更新更新消息提醒的状态 |
| | | MemberSettingEntity memberSettingEntity = memberSettingDao.selectMemberSettingByMemberId(followerSetting.getMemberId()); |
| | | if(ObjectUtil.isNotEmpty(memberSettingEntity)){ |
| | | Long memberId = memberSettingEntity.getMemberId(); |
| | |
| | | LogRecordUtils.insertFollowerNotice(memberEntity.getId(), NoticeConstant.OPEN_ORDER_TITLE, StrUtil.format(NoticeConstant.OPEN_ORDER_CONTENT, holdOrderEntity.getSymbol() + "开空", openPrice.setScale(2, BigDecimal.ROUND_HALF_UP).toString(), followTraderInfoEntity.getNickname())); |
| | | } |
| | | } |
| | | |
| | | redisUtils.del(AppContants.MEMBER_HAS_FOLLOW); |
| | | } |
| | | } |
| | | } |