xiaoyong931011
2021-03-04 d7a26f3570e65d4364b30b4650f01618f2c33cc6
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -287,7 +287,43 @@
      }else {
         followInfoVo.setNickname(phone);
      }
      List<ContractHoldOrderEntity> myFollowOrder = followFollowerProfitDao.getFollowOrderNowRecords(memberId);
      BigDecimal totalBondAmount = BigDecimal.ZERO;
      BigDecimal profitOrLess = BigDecimal.ZERO;
      if (CollUtil.isNotEmpty(myFollowOrder)) {
         for(ContractHoldOrderEntity contractHoldOrderEntity : myFollowOrder) {
            BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(contractHoldOrderEntity.getSymbol())));
            BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(contractHoldOrderEntity.getSymbol());
            // 盈亏
            BigDecimal rewardRatio = BigDecimal.ZERO;
            // 开多
            if (contractHoldOrderEntity.OPENING_TYPE_MORE == contractHoldOrderEntity.getOpeningType()) {
               // (最新价-开仓价)*规格*张数
               rewardRatio = newPrice.subtract(contractHoldOrderEntity.getOpeningPrice()).multiply(lotNumber).multiply(new BigDecimal(contractHoldOrderEntity.getSymbolCnt()));
               // 开空
            } else {
               // (开仓价-最新价)*规格*张数
               rewardRatio = contractHoldOrderEntity.getOpeningPrice().subtract(newPrice).multiply(lotNumber).multiply(new BigDecimal(contractHoldOrderEntity.getSymbolCnt()));
            }
            if (member.getIsProfit() == MemberEntity.IS_PROFIT_Y) {
               PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
               if (rewardRatio.compareTo(BigDecimal.ZERO) > -1) {
                  rewardRatio = rewardRatio.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam()));
               }
            }
            profitOrLess = profitOrLess.add(rewardRatio).setScale(2, BigDecimal.ROUND_DOWN);
            totalBondAmount = totalBondAmount.add(contractHoldOrderEntity.getBondAmount()).setScale(2, BigDecimal.ROUND_DOWN);
         }
      }
      followInfoVo.setTotalAmount(totalBondAmount);
      followInfoVo.setTotalProfitOrLess(profitOrLess);
      BigDecimal totalPrincipals =  BigDecimal.ZERO;
      BigDecimal totalProfits =  BigDecimal.ZERO;
      Map<String, Object> columnMap = new HashMap<>();
@@ -641,8 +677,9 @@
        Integer maxFollowCnt = followFollowerSettingEntity.getMaxFollowCnt();
        if(maxFollowCnt > 0){
           documentaryOrderSetInfoVo.setMaxFollowCnt(maxFollowCnt.toString());
      }else {
         documentaryOrderSetInfoVo.setMaxFollowCnt("");
      }
        documentaryOrderSetInfoVo.setMaxFollowCnt("");
        log.info(memberId + "-最大持仓张数-"+maxFollowCnt.toString());
      return Result.ok(documentaryOrderSetInfoVo);
   }
@@ -784,6 +821,7 @@
           followTraderInfoEntity.setDeclaration(declaration);
        }
        followTraderInfoEntity.setLabels(labels);
        followTraderInfoEntity.setFollowNum(FollowTraderInfoEntity.FOLLOWNUM_DEFAULT);
        followTraderInfoEntity.setIsAll(FollowTraderInfoEntity.IS_ALL_N);
        followTraderInfoEntity.setProfitRatio(BigDecimal.ZERO);
        followTraderInfoEntity.setVerifyStatus(FollowTraderInfoEntity.VERIFYSTATUS_ING);