From a516a9bb2cd4f655a9801ad24ed8e3fd38570999 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Thu, 30 Jul 2020 18:53:07 +0800 Subject: [PATCH] 20200730 代码提交 --- src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java | 1 - src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java | 39 +++++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java index 11c7f7c..8d1f9ab 100644 --- a/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java +++ b/src/main/java/com/xcong/excoin/modules/documentary/controller/DocumentaryController.java @@ -11,7 +11,6 @@ import com.xcong.excoin.common.response.Result; import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto; -import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo; import com.xcong.excoin.modules.documentary.dto.CancelDocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.DocumentaryOrderSetDto; import com.xcong.excoin.modules.documentary.dto.FollowRecordsDto; 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..2fed8e5 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); } } -- Gitblit v1.9.1