xiaoyong931011
2020-07-31 bc83d475764693f00e77dd8a2b67b026a9963f47
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);
   }