From bc83d475764693f00e77dd8a2b67b026a9963f47 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 31 Jul 2020 10:33:52 +0800 Subject: [PATCH] 20200731 代碼提交 --- src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java index c36640a..5f59d22 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java @@ -158,6 +158,15 @@ Page<HistoryOrderRecordsVo> page = new Page<>(historyOrderRecordsDto.getPageNum(), historyOrderRecordsDto.getPageSize()); IPage<HistoryOrderRecordsVo> historyOrderRecordsVoList = followTraderProfitInfoDao.selectHistoryOrderRecords(page, memberId); + List<HistoryOrderRecordsVo> records = historyOrderRecordsVoList.getRecords(); + if(CollUtil.isNotEmpty(records)) { + for(HistoryOrderRecordsVo historyOrderRecordsVo : records) { + BigDecimal closingPrice = historyOrderRecordsVo.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN); + historyOrderRecordsVo.setClosingPrice(closingPrice); + BigDecimal openingPrice = historyOrderRecordsVo.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); + historyOrderRecordsVo.setOpeningPrice(openingPrice); + } + } return Result.ok(historyOrderRecordsVoList); } @@ -173,6 +182,12 @@ List<FollowRecordsVo> records = historyOrderRecordsVoList.getRecords(); if(CollUtil.isNotEmpty(records)) { for(FollowRecordsVo followRecordsVo : records) { + + BigDecimal totalPrincipal = followRecordsVo.getTotalPrincipal().setScale(2, BigDecimal.ROUND_DOWN); + followRecordsVo.setTotalPrincipal(totalPrincipal); + BigDecimal totalProfit = followRecordsVo.getTotalProfit().setScale(2, BigDecimal.ROUND_DOWN); + followRecordsVo.setTotalProfit(totalProfit); + Long memberIds = followRecordsVo.getMemberId(); MemberEntity MemberEntity = memberDao.selectById(memberIds); String phone = MemberEntity.getPhone(); @@ -216,8 +231,8 @@ totalProfits = totalProfits.add(totalProfit); } } - followInfoVo.setTotalPrincipal(totalPrincipals.setScale(4, BigDecimal.ROUND_DOWN)); - followInfoVo.setTotalProfit(totalProfits.setScale(4, BigDecimal.ROUND_DOWN)); + followInfoVo.setTotalPrincipal(totalPrincipals.setScale(2, BigDecimal.ROUND_DOWN)); + followInfoVo.setTotalProfit(totalProfits.setScale(2, BigDecimal.ROUND_DOWN)); return Result.ok(followInfoVo); } @@ -242,17 +257,17 @@ myFollowOrderVo.setOrderType(orderType); int leverRatio = contractOrderEntity.getLeverRatio(); myFollowOrderVo.setLeverRatio(leverRatio); - BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal rewardAmount = contractOrderEntity.getRewardAmount().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setRewardAmount(rewardAmount); - BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal rewardRatio = contractOrderEntity.getRewardRatio().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setRewardRatio(rewardRatio); int symbolCnt = contractOrderEntity.getSymbolCnt(); myFollowOrderVo.setSymbolCnt(symbolCnt); - BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal bondAmount = contractOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setBondAmount(bondAmount); - BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal openingPrice = contractOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setOpeningPrice(openingPrice); - BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal closingPrice = contractOrderEntity.getClosingPrice().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setClosingPrice(closingPrice); Date openingTime = contractOrderEntity.getOpeningTime(); myFollowOrderVo.setOpeningTime(openingTime); @@ -290,9 +305,9 @@ myFollowOrderVo.setLeverRatio(leverRatio); int symbolCnt = contractHoldOrderEntity.getSymbolCnt(); myFollowOrderVo.setSymbolCnt(symbolCnt); - BigDecimal bondAmount = contractHoldOrderEntity.getBondAmount().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal bondAmount = contractHoldOrderEntity.getBondAmount().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setBondAmount(bondAmount); - BigDecimal openingPrice = contractHoldOrderEntity.getOpeningPrice().setScale(4, BigDecimal.ROUND_DOWN); + BigDecimal openingPrice = contractHoldOrderEntity.getOpeningPrice().setScale(2, BigDecimal.ROUND_DOWN); myFollowOrderVo.setOpeningPrice(openingPrice); String orderNo = contractHoldOrderEntity.getOrderNo(); myFollowOrderVo.setOrderNo(orderNo); @@ -320,11 +335,11 @@ rewardRatio = rewardRatio.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam())); } } - myFollowOrderVo.setRewardAmount(rewardRatio.setScale(4, BigDecimal.ROUND_DOWN)); + myFollowOrderVo.setRewardAmount(rewardRatio.setScale(2, BigDecimal.ROUND_DOWN)); // 回报率 BigDecimal returnRate = rewardRatio.divide(contractHoldOrderEntity.getBondAmount().subtract(contractHoldOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN); - myFollowOrderVo.setRewardRatio(returnRate.setScale(4, BigDecimal.ROUND_DOWN)); + myFollowOrderVo.setRewardRatio(returnRate.setScale(2, BigDecimal.ROUND_DOWN)); myFollowOrderVos.add(myFollowOrderVo); } @@ -358,7 +373,7 @@ BigDecimal totalPrincipal = FollowFollowerProfitEntity.getTotalPrincipal(); myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal); BigDecimal totalProfit = FollowFollowerProfitEntity.getTotalProfit(); - myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(4, BigDecimal.ROUND_DOWN)); + myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN)); myFollowOrderVos.add(myFollowTraderInfoVo); } } @@ -499,6 +514,22 @@ return Result.ok(MessageSourceUtils.getString("member_service_0024")); } + + @Override + public Result getFollowTraderProfit(long traderId) { + FollowTraderInfoEntity followTraderInfoEntity = followTraderInfoDao.selectById(traderId); + Long memberId = followTraderInfoEntity.getMemberId(); + FollowTraderProfitInfoVo followTraderProfitInfoVo = followTraderProfitInfoDao.selectOneByMemberId(memberId); + String avatar = followTraderInfoEntity.getAvatar(); + String nickname = followTraderInfoEntity.getNickname(); + String declaration = followTraderInfoEntity.getDeclaration(); + Integer isAll = followTraderInfoEntity.getIsAll(); + followTraderProfitInfoVo.setAvatar(avatar); + followTraderProfitInfoVo.setNickname(nickname); + followTraderProfitInfoVo.setDeclaration(declaration); + followTraderProfitInfoVo.setIsAll(isAll); + return Result.ok(followTraderProfitInfoVo); + } -- Gitblit v1.9.1