zainali5120
2021-04-25 a55747a7cedc4c4f04f33755a27862c959c1ad30
Merge remote-tracking branch 'origin/activity' into activity
3 files modified
46 ■■■■ changed files
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java 30 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml 13 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/documentary/dao/FollowFollowerProfitDao.java
@@ -48,5 +48,6 @@
    BigDecimal selectSumBondAmountBymemberId(@Param("memberId")Long memberId,@Param("tradeId") Long tradeId);
    BigDecimal selectSumRewardAmountByMemberId(@Param("memberId")Long memberId,@Param("tradeId") Long tradeId);
    List<BigDecimal> selectBondAmountByTradeIdAndMemberId(@Param("memberId")Long memberId,@Param("tradeId") Long tradeId);
}
src/main/java/com/xcong/excoin/modules/documentary/service/impl/DocumentaryServiceImpl.java
@@ -287,9 +287,19 @@
        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);
                Long memberIdFollow = followRecordsVo.getMemberId();
                Long tradeId = followRecordsVo.getTradeId();
                //获取当前跟随者最后一个历史跟单的保证金
                BigDecimal bondAmount = BigDecimal.ZERO;
                List<BigDecimal> bondamounts = followFollowerProfitDao.selectBondAmountByTradeIdAndMemberId(memberIdFollow,tradeId);
                if(CollUtil.isNotEmpty(bondamounts)){
                    bondAmount = bondamounts.get(0).setScale(2, BigDecimal.ROUND_DOWN);
                }
                followRecordsVo.setTotalPrincipal(bondAmount);
//                BigDecimal totalPrincipal = followRecordsVo.getTotalPrincipal().setScale(2, BigDecimal.ROUND_DOWN);
//                followRecordsVo.setTotalPrincipal(totalPrincipal);
                BigDecimal totalProfit = followRecordsVo.getTotalProfit().setScale(2, BigDecimal.ROUND_DOWN);
                followRecordsVo.setTotalProfit(totalProfit);
                
@@ -1229,8 +1239,18 @@
                
                Long id = followFollowerProfitEntity.getId();
                myFollowTraderInfoVo.setId(id);
                BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal();
                myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
                Long tradeId = followFollowerProfitEntity.getTradeId();
                //获取当前跟随者最后一个历史跟单的保证金
                BigDecimal bondAmount = BigDecimal.ZERO;
                List<BigDecimal> bondamounts = followFollowerProfitDao.selectBondAmountByTradeIdAndMemberId(followMemberId,tradeId);
                if(CollUtil.isNotEmpty(bondamounts)){
                    bondAmount = bondamounts.get(0).setScale(2, BigDecimal.ROUND_DOWN);
                }
                myFollowTraderInfoVo.setTotalPrincipal(bondAmount);
//                BigDecimal totalPrincipal = followFollowerProfitEntity.getTotalPrincipal();
//                myFollowTraderInfoVo.setTotalPrincipal(totalPrincipal);
                BigDecimal totalProfit = followFollowerProfitEntity.getTotalProfit();
                myFollowTraderInfoVo.setTotalProfit(totalProfit.setScale(2, BigDecimal.ROUND_DOWN));
                
src/main/resources/mapper/documentary/FollowFollowerProfitDao.xml
@@ -2,6 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xcong.excoin.modules.documentary.dao.FollowFollowerProfitDao">
    <select id="selectBondAmountByTradeIdAndMemberId" resultType="java.math.BigDecimal">
        SELECT
            b.bond_amount
        FROM
            follow_follower_order_relation a
                LEFT JOIN contract_order b ON a.order_id = b.id
        WHERE
            a.member_id = #{memberId}
          AND a.trade_id = #{tradeId}
          AND a.order_type = 2
        order by b.create_time desc
    </select>
    <select id="selectSumRewardAmountByMemberId" resultType="java.math.BigDecimal">
        SELECT
            SUM(a.reward_amount)