From f3134a2269d7c14e3a73c6407139e6d8973e58a9 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 06 Apr 2021 15:38:19 +0800 Subject: [PATCH] 20210406 交易员列表查询 --- src/test/java/com/xcong/excoin/FollowTest.java | 513 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 493 insertions(+), 20 deletions(-) diff --git a/src/test/java/com/xcong/excoin/FollowTest.java b/src/test/java/com/xcong/excoin/FollowTest.java index 7cf737a..748f6e7 100644 --- a/src/test/java/com/xcong/excoin/FollowTest.java +++ b/src/test/java/com/xcong/excoin/FollowTest.java @@ -1,13 +1,57 @@ package com.xcong.excoin; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.xcong.excoin.common.LoginUserUtils; +import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum; +import com.xcong.excoin.common.response.Result; +import com.xcong.excoin.modules.activity.dao.ActivityMainDao; +import com.xcong.excoin.modules.activity.dao.ActivityMemberDetailDao; +import com.xcong.excoin.modules.activity.dao.ActivityReceiveRecordDao; +import com.xcong.excoin.modules.activity.dao.ActivitySubDao; +import com.xcong.excoin.modules.activity.entity.ActivityMain; +import com.xcong.excoin.modules.activity.entity.ActivityMemberDetail; +import com.xcong.excoin.modules.activity.entity.ActivityReceiveRecord; +import com.xcong.excoin.modules.activity.entity.ActivitySub; +import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange; +import com.xcong.excoin.modules.contract.dao.ContractOrderDao; +import com.xcong.excoin.modules.contract.entity.ContractOrderEntity; +import com.xcong.excoin.modules.documentary.common.NoticeConstant; +import com.xcong.excoin.modules.documentary.dao.*; +import com.xcong.excoin.modules.documentary.dto.MyFollowOrderDto; +import com.xcong.excoin.modules.documentary.dto.TradeOrderInfoDto; +import com.xcong.excoin.modules.documentary.entity.FollowFollowerOrderRelationEntity; +import com.xcong.excoin.modules.documentary.entity.FollowFollowerProfitEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderInfoEntity; +import com.xcong.excoin.modules.documentary.entity.FollowTraderProfitInfoEntity; import com.xcong.excoin.modules.documentary.service.FollowOrderOperationService; +import com.xcong.excoin.modules.documentary.vo.MyFollowOrderVo; +import com.xcong.excoin.modules.documentary.vo.TradeHistoryOrderInfoVo; +import com.xcong.excoin.modules.member.dao.MemberDao; +import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.quartz.job.FollowProfitUpdateJob; +import com.xcong.excoin.utils.LogRecordUtils; import com.xcong.excoin.utils.ThreadPoolUtils; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import jnr.ffi.Struct.int16_t; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import javax.annotation.Resource; +import javax.validation.Valid; /** * @author wzy @@ -19,27 +63,456 @@ @Resource private FollowOrderOperationService followOrderOperationService; - - @Test - public void addFollowTest() { - followOrderOperationService.addFollowerOrder(601L); -// ThreadPoolUtils.sendFollowOrderTask(601L); - - } - - @Test - public void strContainsTest() { - String symbols = "BTC,ETH,LTC,BCH"; - String symbol = "BTC/USDT"; - - System.out.println(symbols.contains(symbol.replace("/USDT", ""))); - } - @Resource - private FollowProfitUpdateJob followProfitUpdateJob; + private ActivityMainDao activityMainDao; + @Resource + private ActivitySubDao activitySubDao; + @Resource + private ActivityMemberDetailDao activityMemberDetailDao; + @Resource + private ActivityReceiveRecordDao activityReceiveRecordDao; + @Resource + private MemberDao memberDao; + @Resource + private FollowFollowerProfitDao followFollowerProfitDao; + @Resource + private FollowFollowerOrderRelationDao followFollowerOrderRelationDao; + @Resource + private FollowTraderInfoDao followTraderInfoDao; + @Resource + private FollowTraderProfitInfoDao followTraderProfitInfoDao; + @Resource + private ContractOrderDao contractOrderDao; + @Resource + private FollowTraderProfitDetailDao followTraderProfitDetailDao; + +// public static void main(String[] args) { +// String orderNo = "2021033112500017"; +// System.out.println(orderNo.substring(8)); +// } +// +// @Test +// public void getReturn(){ +// String orderNo = "2021033112880019"; +// +// //生成返利记录和资金变化记录 +// List<FollowFollowerOrderRelationEntity> orderRelationDone = followFollowerOrderRelationDao.selectFollowOrderByTradeOrderNo(orderNo); +// if(CollUtil.isNotEmpty(orderRelationDone)) { +// List<Long> orderIds = new ArrayList<>(); +// for (FollowFollowerOrderRelationEntity orderRelationd : orderRelationDone) { +// orderIds.add(orderRelationd.getOrderId()); +// } +// +// if(CollUtil.isNotEmpty(orderIds)){ +// //获取对应的平仓记录单号 +// List<String> orderNosList = new ArrayList<>(); +// for(Long orderId : orderIds) { +// String orderNos = contractOrderDao.selectOrderNoByOrderIds(orderId); +// orderNosList.add(orderNos); +// } +// //获取总返佣 +// BigDecimal totalAmount = followTraderProfitDetailDao.selectFollowHoldOrderByFollowOrderNo(orderNosList); +// totalAmount = (totalAmount == null?BigDecimal.ZERO:totalAmount.setScale(2, BigDecimal.ROUND_DOWN)); +// if(totalAmount.compareTo(BigDecimal.ZERO) > 0){ +// //增加返佣提醒 +// String symbol = contractOrderDao.selectById(orderIds.get(0)).getSymbol(); +// String orderNoTrader = orderRelationDone.get(0).getTradeOrderNo(); +// Long traderMemberId = orderRelationDone.get(0).getTradeMemberId(); +// LogRecordUtils.insertFollowerNotice(traderMemberId, +// NoticeConstant.RETURN_MONEY_TITLE, +// StrUtil.format(NoticeConstant.RETURN_MONEY_CONTENT, +// orderNoTrader, +// symbol, +// totalAmount)); +// //带单返利的记录要在资产页面的其他记录 +// LogRecordUtils.insertMemberAccountMoneyChange( +// traderMemberId, +// StrUtil.format(NoticeConstant.RETURN_MONEY_CONTENT_MAMC, +// orderNoTrader, +// symbol), +// totalAmount, +// MemberWalletCoinEnum.WALLETCOINCODE.getValue(), +// MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER, +// MemberAccountMoneyChange.TYPE_WALLET_AGENT); +// } +// } +// } +// } - @Test - public void updateJobTest() { - followProfitUpdateJob.traderProfitUpdate(); + +// @Test +// public void getTradeHistoryOrderInfo() { +// //获取用户ID +// Long memberId = 14L; +// List<TradeHistoryOrderInfoVo> myFollowOrderVos = new ArrayList<>(); +// //历史跟单 +// Page<ContractOrderEntity> page = new Page<>(1, 5); +// IPage<ContractOrderEntity> contractOrderEntitys = followFollowerProfitDao.getMyFollowOrderHistoryRecords(page, memberId); +// +// List<ContractOrderEntity> records = contractOrderEntitys.getRecords(); +// if(CollUtil.isNotEmpty(records)) { +// for(ContractOrderEntity contractOrderEntity : records) { +// TradeHistoryOrderInfoVo myFollowOrderVo = new TradeHistoryOrderInfoVo(); +// //获取【跟随者-订单关联表】中的累计数据 +// BigDecimal allRewardAmount = BigDecimal.ZERO; +// BigDecimal allRewardRatio = BigDecimal.ZERO; +// +// Long orderId = contractOrderEntity.getId(); +// String orderNo = contractOrderEntity.getOrderNo(); +// Map<String, Object> columnMapRelation = new HashMap<>(); +// columnMapRelation.put("trade_order_no", orderNo); +// columnMapRelation.put("trade_member_id", memberId); +// columnMapRelation.put("order_type", 2); +// columnMapRelation.put("is_show", 1); +// List<FollowFollowerOrderRelationEntity> followFollowerOrderRelations = followFollowerOrderRelationDao.selectByMap(columnMapRelation); +// if(CollUtil.isNotEmpty(followFollowerOrderRelations)) { +// int size = followFollowerOrderRelations.size() - 1; +// myFollowOrderVo.setFollowerNumber(size); +// for(FollowFollowerOrderRelationEntity followFollowerOrderRelation : followFollowerOrderRelations) { +// Long followerMemberId = followFollowerOrderRelation.getMemberId(); +// if(!memberId.equals(followerMemberId)) { +// Long followerOrderId = followFollowerOrderRelation.getOrderId(); +// ContractOrderEntity orderEntity = contractOrderDao.selectById(followerOrderId); +// BigDecimal rewardAmount = orderEntity.getRewardAmount(); +// allRewardAmount = allRewardAmount.add(rewardAmount); +// BigDecimal rewardRatio = orderEntity.getRewardRatio(); +// rewardRatio = rewardRatio == null ? BigDecimal.ZERO : rewardRatio; +// allRewardRatio = allRewardRatio.add(rewardRatio); +// } +// } +// }else { +// myFollowOrderVo.setFollowerNumber(0); +// } +// myFollowOrderVo.setFollowerRewardAmount(allRewardAmount); +// myFollowOrderVo.setFollowerRewardRatio(allRewardRatio); +// +// //获取交易员信息 +// FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId); +// String nickname = followTraderInfoEntity.getNickname(); +// myFollowOrderVo.setNickname(nickname); +// myFollowOrderVo.setOrderId(orderId); +// String symbol = contractOrderEntity.getSymbol(); +// myFollowOrderVo.setSymbol(symbol); +// int orderType = contractOrderEntity.getOrderType(); +// myFollowOrderVo.setOrderType(orderType); +// int leverRatio = contractOrderEntity.getLeverRatio(); +// myFollowOrderVo.setLeverRatio(leverRatio); +// BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardAmount(rewardAmount); +// BigDecimal rewardRatio = contractOrderEntity.getRewardRatio() == null ? BigDecimal.ZERO : contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardRatio(rewardRatio); +// int symbolCnt = contractOrderEntity.getSymbolCnt(); +// myFollowOrderVo.setSymbolCnt(symbolCnt); +// BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setBondAmount(bondAmount); +// BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setOpeningPrice(openingPrice); +// BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setClosingPrice(closingPrice); +// Date openingTime = contractOrderEntity.getOpeningTime(); +// myFollowOrderVo.setOpeningTime(openingTime); +// Date closingTime = contractOrderEntity.getClosingTime(); +// myFollowOrderVo.setClosingTime(closingTime); +// +// myFollowOrderVo.setOrderNo(orderNo); +// myFollowOrderVos.add(myFollowOrderVo); +// } +// } +// System.out.println(myFollowOrderVos); +// } + + @Test + public void traderProfitUpdate() { + log.info("交易员定时任务执行"); + // 查询所有交易员信息 + List<FollowTraderInfoEntity> allTraders = followTraderInfoDao.selectAllTraderInfo(); + if (CollUtil.isNotEmpty(allTraders)) { + for (FollowTraderInfoEntity trader : allTraders) { + Long tradeMemberId = trader.getMemberId(); + //获取交易员的当前跟随者 + Map<String, Object> hashMap = new HashMap<>(); + hashMap.put("trade_member_id", tradeMemberId); + hashMap.put("is_follow", FollowFollowerProfitEntity.IS_FOLLOW_Y); + List<FollowFollowerProfitEntity> followFollowerProfitEntityList = followFollowerProfitDao.selectByMap(hashMap); + if(CollUtil.isNotEmpty(followFollowerProfitEntityList)) { + for(FollowFollowerProfitEntity followFollowerProfitEntity : followFollowerProfitEntityList) { + //获取当前跟随者的跟随本金 + Long memberId = followFollowerProfitEntity.getMemberId(); + BigDecimal sumBondAmountBigDecimal = followFollowerProfitDao.selectSumBondAmountBymemberId(memberId,trader.getId()); + sumBondAmountBigDecimal = (sumBondAmountBigDecimal == null?BigDecimal.ZERO:sumBondAmountBigDecimal.setScale(2, BigDecimal.ROUND_DOWN)); + followFollowerProfitEntity.setTotalPrincipal(sumBondAmountBigDecimal); + //获取当前的盈亏 + BigDecimal sumRewardAmountBigDecimal = followFollowerProfitDao.selectSumRewardAmountByMemberId(memberId,trader.getId()); + sumRewardAmountBigDecimal = (sumRewardAmountBigDecimal == null?BigDecimal.ZERO:sumRewardAmountBigDecimal.setScale(2, BigDecimal.ROUND_DOWN)); + followFollowerProfitEntity.setTotalProfit(sumRewardAmountBigDecimal); + followFollowerProfitDao.updateById(followFollowerProfitEntity); + } + } + + + FollowTraderProfitInfoEntity traderInfoProfit = followTraderProfitInfoDao.selectTraderInfoProfitByMemberId(tradeMemberId); + // 累计收益率 + BigDecimal ljsyl = contractOrderDao.selectFollowOrderTotalProfitByMemberId(tradeMemberId); + BigDecimal totalProfitRatio = (ljsyl == null?BigDecimal.ZERO:ljsyl.setScale(2, BigDecimal.ROUND_DOWN)); + traderInfoProfit.setTotalProfitRatio(totalProfitRatio); + // 带单总收益,只查询交易员自己的带单总收益 + BigDecimal totalProfit = followFollowerOrderRelationDao.selectTraderTotalProfitSelf(tradeMemberId); + //BigDecimal totalProfit = followFollowerOrderRelationDao.selectTraderTotalProfit(tradeMemberId); + traderInfoProfit.setTotalProfit(totalProfit); + // 交易笔数 +// List<ContractOrderEntity> orders = contractOrderDao.selectFollowOrderByMemberId(tradeMemberId); + List<ContractOrderEntity> orders = contractOrderDao.selectFollowOrderListByMemberId(tradeMemberId); + traderInfoProfit.setTotalOrderCnt(CollUtil.isNotEmpty(orders) ? orders.size() : 0); + // 近三周胜率 + Integer winCnt = contractOrderDao.selectFollowOrderCntForWinRate(tradeMemberId, 1); + Integer allCnt = contractOrderDao.selectFollowOrderCntForWinRate(tradeMemberId, null); + + if (winCnt != null && allCnt != null && allCnt!=0) { + BigDecimal winRate = BigDecimal.valueOf(winCnt).divide(BigDecimal.valueOf(allCnt), 4, BigDecimal.ROUND_DOWN); + traderInfoProfit.setWinRate(winRate); + } + Date date = new Date(); + DateTime offsetDay = DateUtil.offsetDay(new Date(), -30); + //30天胜率(30天盈利总张数/30平仓总张数) + BigDecimal thirtyTotalCnt = contractOrderDao.selectThirtyTotalCntByMemberId(tradeMemberId,date,offsetDay); + BigDecimal thirtyWinCnt = contractOrderDao.selectThirtyWinCntByMemberId(tradeMemberId,date,offsetDay); + BigDecimal thirtyTotalCntRatio = (thirtyTotalCnt == null?BigDecimal.ZERO:thirtyTotalCnt.setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal thirtyWinCntRatio = (thirtyWinCnt == null?BigDecimal.ZERO:thirtyWinCnt.setScale(2, BigDecimal.ROUND_DOWN)); + BigDecimal thirtyProfitRatio = BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_DOWN);; + if(thirtyTotalCnt.compareTo(BigDecimal.ZERO) > 0) { + thirtyProfitRatio = thirtyWinCntRatio.divide(thirtyTotalCntRatio, 2, BigDecimal.ROUND_DOWN).setScale(2, BigDecimal.ROUND_DOWN); + } + traderInfoProfit.setThirtyProfitRatio(thirtyProfitRatio); + //30天最大回撤率(30天最高收益率-30天最低收益率) + BigDecimal thirtyMaxRatio = contractOrderDao.selectThirtyMaxRatioByMemberId(tradeMemberId,date,offsetDay); + BigDecimal thirtyMinRatio = contractOrderDao.selectThirtyMinRatioByMemberId(tradeMemberId,date,offsetDay); + BigDecimal thirtyRatio = (thirtyMaxRatio == null?BigDecimal.ZERO:thirtyMaxRatio.setScale(2, BigDecimal.ROUND_DOWN)) + .subtract((thirtyMinRatio == null?BigDecimal.ZERO:thirtyMinRatio.setScale(2, BigDecimal.ROUND_DOWN))); + traderInfoProfit.setThirtyRatio(thirtyRatio); + // 当前跟随者总收益 + BigDecimal followerProfit = followFollowerProfitDao.selectAllFollowerProfit(tradeMemberId); + traderInfoProfit.setFollowerTotalProfit(followerProfit); + // 当前跟随人数 + int followerCnt = followFollowerProfitDao.selectFollowerCntByTradeMemberId(tradeMemberId); + traderInfoProfit.setTotalFollowerCnt(followerCnt); + + followTraderProfitInfoDao.updateById(traderInfoProfit); + } + } } + +// @Test +// public void getTradeHistoryOrderInfo() { +// //获取用户ID +// Long memberId = 3L; +// List<TradeHistoryOrderInfoVo> myFollowOrderVos = new ArrayList<>(); +// //历史跟单 +// Page<ContractOrderEntity> page = new Page<>(1, 5); +// IPage<ContractOrderEntity> contractOrderEntitys = followFollowerProfitDao.getMyFollowOrderHistoryRecords(page, memberId); +// +// List<ContractOrderEntity> records = contractOrderEntitys.getRecords(); +// if(CollUtil.isNotEmpty(records)) { +// for(ContractOrderEntity contractOrderEntity : records) { +// TradeHistoryOrderInfoVo myFollowOrderVo = new TradeHistoryOrderInfoVo(); +// //获取【跟随者-订单关联表】中的累计数据 +// BigDecimal allRewardAmount = BigDecimal.ZERO; +// BigDecimal allRewardRatio = BigDecimal.ZERO; +// +// Long orderId = contractOrderEntity.getId(); +// String orderNo = contractOrderEntity.getOrderNo(); +// Map<String, Object> columnMapRelation = new HashMap<>(); +// columnMapRelation.put("trade_order_no", orderNo); +// columnMapRelation.put("trade_member_id", memberId); +// columnMapRelation.put("order_type", 2); +// columnMapRelation.put("is_show", 1); +// List<FollowFollowerOrderRelationEntity> followFollowerOrderRelations = followFollowerOrderRelationDao.selectByMap(columnMapRelation); +// if(CollUtil.isNotEmpty(followFollowerOrderRelations)) { +// int size = followFollowerOrderRelations.size() - 1; +// myFollowOrderVo.setFollowerNumber(size); +// for(FollowFollowerOrderRelationEntity followFollowerOrderRelation : followFollowerOrderRelations) { +// Long followerMemberId = followFollowerOrderRelation.getMemberId(); +// if(!memberId.equals(followerMemberId)) { +// Long followerOrderId = followFollowerOrderRelation.getOrderId(); +// ContractOrderEntity orderEntity = contractOrderDao.selectById(followerOrderId); +// BigDecimal rewardAmount = orderEntity.getRewardAmount(); +// allRewardAmount = allRewardAmount.add(rewardAmount); +// BigDecimal rewardRatio = orderEntity.getRewardRatio(); +// allRewardRatio = allRewardRatio.add(rewardRatio); +// } +// } +// }else { +// myFollowOrderVo.setFollowerNumber(0); +// } +// myFollowOrderVo.setFollowerRewardAmount(allRewardAmount); +// myFollowOrderVo.setFollowerRewardRatio(allRewardRatio); +// +// //获取交易员信息 +// FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectTraderInfoByMemberId(memberId); +// String nickname = followTraderInfoEntity.getNickname(); +// myFollowOrderVo.setNickname(nickname); +// myFollowOrderVo.setOrderId(orderId); +// String symbol = contractOrderEntity.getSymbol(); +// myFollowOrderVo.setSymbol(symbol); +// int orderType = contractOrderEntity.getOrderType(); +// myFollowOrderVo.setOrderType(orderType); +// int leverRatio = contractOrderEntity.getLeverRatio(); +// myFollowOrderVo.setLeverRatio(leverRatio); +// BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardAmount(rewardAmount); +// BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardRatio(rewardRatio); +// int symbolCnt = contractOrderEntity.getSymbolCnt(); +// myFollowOrderVo.setSymbolCnt(symbolCnt); +// BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setBondAmount(bondAmount); +// BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setOpeningPrice(openingPrice); +// BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setClosingPrice(closingPrice); +// Date openingTime = contractOrderEntity.getOpeningTime(); +// myFollowOrderVo.setOpeningTime(openingTime); +// Date closingTime = contractOrderEntity.getClosingTime(); +// myFollowOrderVo.setClosingTime(closingTime); +// +// myFollowOrderVo.setOrderNo(orderNo); +// myFollowOrderVos.add(myFollowOrderVo); +// } +// } +// System.out.println(myFollowOrderVos); +// } + +// @Test +// public void getHistoryMyFollowOrderRecords() { +// //获取用户ID +// Long memberId = 4L; +// List<MyFollowOrderVo> myFollowOrderVos = new ArrayList<>(); +// //历史跟单 +// Page<ContractOrderEntity> page = new Page<>(1, 5); +// IPage<ContractOrderEntity> contractOrderEntitys = followFollowerProfitDao.getMyFollowOrderHistoryRecords(page, memberId); +// +// List<ContractOrderEntity> records = contractOrderEntitys.getRecords(); +// if(CollUtil.isNotEmpty(records)) { +// for(ContractOrderEntity contractOrderEntity : records) { +// MyFollowOrderVo myFollowOrderVo = new MyFollowOrderVo(); +// //获取交易员信息 +// Long orderId = contractOrderEntity.getId(); +// FollowFollowerOrderRelationEntity FollowFollowerOrderRelation = followFollowerOrderRelationDao.selectHistoryOneByorderId(orderId); +// if(ObjectUtil.isNotEmpty(FollowFollowerOrderRelation)) { +// myFollowOrderVo.setOrderId(orderId); +// Long tradeId = FollowFollowerOrderRelation.getTradeId(); +// FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(tradeId); +// if(ObjectUtil.isNotEmpty(followTraderInfoEntity)) { +// String nickname = followTraderInfoEntity.getNickname(); +// myFollowOrderVo.setNickname(nickname); +// } +// String symbol = contractOrderEntity.getSymbol(); +// myFollowOrderVo.setSymbol(symbol); +// int orderType = contractOrderEntity.getOrderType(); +// myFollowOrderVo.setOrderType(orderType); +// int leverRatio = contractOrderEntity.getLeverRatio(); +// myFollowOrderVo.setLeverRatio(leverRatio); +// BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardAmount(rewardAmount); +// BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setRewardRatio(rewardRatio); +// int symbolCnt = contractOrderEntity.getSymbolCnt(); +// myFollowOrderVo.setSymbolCnt(symbolCnt); +// BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setBondAmount(bondAmount); +// BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setOpeningPrice(openingPrice); +// BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN); +// myFollowOrderVo.setClosingPrice(closingPrice); +// Date openingTime = contractOrderEntity.getOpeningTime(); +// myFollowOrderVo.setOpeningTime(openingTime); +// Date closingTime = contractOrderEntity.getClosingTime(); +// myFollowOrderVo.setClosingTime(closingTime); +// String orderNo = contractOrderEntity.getOrderNo(); +// myFollowOrderVo.setOrderNo(orderNo); +// myFollowOrderVos.add(myFollowOrderVo); +// } +// } +// } +// System.out.println(myFollowOrderVos); +// } + +// @Test +// public void test() { +// //查询是否可以点击平仓按钮 +// Long memberIdLong = Long.parseLong("102"); +// MemberEntity selectById = memberDao.selectById(memberIdLong); +// Integer pcState = selectById.getPcState(); +// if(memberEntity.PCSTATE_N == pcState) { +// return Result.loading("loading_type"); +// } +// } + +// @Test +// public void add() { +// Map<String, Object> columnMap = new HashMap<>(); +// List<MemberEntity> memberEntitys = memberDao.selectByMap(columnMap); +// int i =0; +// for(MemberEntity member :memberEntitys) { +// System.out.println(i++); +// Long id = member.getId(); +// if(ObjectUtil.isNotEmpty(id)) { +// //获取开始中的活动 +// ActivityMain activityMain = activityMainDao.selectById(1); +// if(ObjectUtil.isNotEmpty(activityMain)) { +// if(ActivityMain.STATE_START == activityMain.getState()) { +// //新增【活动记录表】信息 +// ActivityReceiveRecord activityReceiveRecord = new ActivityReceiveRecord(); +// activityReceiveRecord.setMemberId(member.getId()); +// activityReceiveRecord.setMainId(activityMain.getId()); +// activityReceiveRecord.setReceiveCoinAmount(BigDecimal.ZERO); +// activityReceiveRecord.setReceiveState(ActivityReceiveRecord.RECEIVESTATE_TWO); +// Date startTime = new Date(); +// Date date = new Date(startTime.getTime() + ActivityReceiveRecord.DAYS*24*60*60*1000); +// activityReceiveRecord.setInvalidTime(date); +// Map<String, Object> activitySubMap = new HashMap<>(); +// activitySubMap.put("main_id", activityMain.getId()); +// List<ActivitySub> activitySubs = activitySubDao.selectByMap(activitySubMap ); +// if(CollUtil.isNotEmpty(activitySubs)) { +// for(ActivitySub ActivitySub : activitySubs) { +// Long subId = ActivitySub.getId(); +// activityReceiveRecord.setSubId(subId); +// activityReceiveRecordDao.insert(activityReceiveRecord); +// } +// } +// //新增【活动个人详情表】信息 +// ActivityMemberDetail activityMemberDetail = new ActivityMemberDetail(); +// activityMemberDetail.setMainId(activityMain.getId()); +// activityMemberDetail.setBurstUsdt(BigDecimal.ZERO); +// activityMemberDetail.setReceivedUsdt(BigDecimal.ZERO); +// activityMemberDetail.setSurplusUsdt(activityMain.getAmount()); +// activityMemberDetail.setMemberId(member.getId()); +// activityMemberDetailDao.insert(activityMemberDetail); +// } +// } +// } +// } +// } + +// @Test +// public void addFollowTest() { +// followOrderOperationService.addFollowerOrder(601L); +//// ThreadPoolUtils.sendFollowOrderTask(601L); +// +// } +// +// @Test +// public void strContainsTest() { +// String symbols = "BTC,ETH,LTC,BCH"; +// String symbol = "BTC/USDT"; +// +// System.out.println(symbols.contains(symbol.replace("/USDT", ""))); +// } +// +// @Resource +// private FollowProfitUpdateJob followProfitUpdateJob; +// +// @Test +// public void updateJobTest() { +// followProfitUpdateJob.traderProfitUpdate(); +// } } -- Gitblit v1.9.1