fix
wzy
2022-06-08 f7ed73841b806f36bd5f058e1a01386e66437076
fix
6 files modified
60 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 13 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 16 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappFundFlowDao.xml 11 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberDao.xml 11 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -6,8 +6,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface DappFundFlowDao extends BaseMapper<DappFundFlowEntity> {
@@ -15,9 +17,9 @@
    List<DappFundFlowEntity> selectListForMemberAndDay(@Param("memberId") Long memberId, @Param("type") int type);
    DappFundFlowEntity selectMineFundFlowByMemberIdAndTime(@Param("time") Long memberId, @Param("time") Date time);
    DappFundFlowEntity selectByFromHash(@Param("txHash") String txHash, @Param("status") Integer status);
    List<DappFundFlowEntity> selectFundFlowListByAddress(@Param("address") String address, @Param("status") Integer status);
    Map<String, BigDecimal> selectAmountTotalByType(@Param("memberId") Long memberId);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -25,4 +26,6 @@
    List<DappMemberEntity> selectAgentMemberList(@Param("list") List<String> inviteIds, @Param("size") Integer size);
    List<DappMemberEntity> selectParentsList(@Param("list") List<String> inviteIds, @Param("size") Integer size);
    BigDecimal selectAllBalance(@Param("accountType") String accountType);
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -45,16 +45,17 @@
    private final DappOnlineTransferDao dappOnlineTransferDao;
    private final ChainProducer chainProducer;
    private final String[] ADDRESS_PREFIX = {"T", "0x"};
    @Override
    public Map<String, Object> findTotalInComeAndList() {
        DappMineDataEntity dataMine = dappSystemDao.selectMineDataForOne();
        List<DappMemberEntity> addresses = dappMemberDao.selectList(null);
        DappMemberEntity mineAddress = dappMemberDao.selectByAddress(ChainEnum.BSC_TFC.getAddress(), null);
        BigDecimal coinCnt = dappMemberDao.selectAllBalance("normal");
        Map<String, Object> result = new HashMap<>();
        result.put("total", 6000);
        result.put("addreessCnt", 1234);
        result.put("coinCnt", 4000);
        result.put("total", mineAddress.getBalance());
        result.put("addreessCnt", addresses.size());
        result.put("coinCnt", coinCnt);
        return result;
    }
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -48,18 +48,16 @@
    @Override
    public WalletInfoVo walletInfo() {
//        DappMemberEntity member = LoginUserUtil.getAppUser();
//        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
//        DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId());
        DappMemberEntity member = LoginUserUtil.getAppUser();
        Map<String, BigDecimal> map = dappFundFlowDao.selectAmountTotalByType(member.getId());
        WalletInfoVo walletInfo = new WalletInfoVo();
//        walletInfo.setInviteId(member.getInviteId());
//        walletInfo.setTotalMine(walletMine.getTotalAmount());
//        walletInfo.setAvailableMine(walletMine.getAvailableAmount());
//        walletInfo.setAvailableWallet(walletCoin.getAvailableAmount());
        walletInfo.setTotalChild(10000);
        walletInfo.setTotalChild(41451);
        walletInfo.setDirectCnt(100);
        walletInfo.setTotalChildCoin(BigDecimal.valueOf(1));
        walletInfo.setTeamReward(map.get("teamReward"));
        walletInfo.setMiningAmount(map.get("mine"));
        return walletInfo;
    }
@@ -136,7 +134,9 @@
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity();
        if (recordInPageDto.getType() != null && recordInPageDto.getType() != 0) {
        dappFundFlowEntity.setType(recordInPageDto.getType());
        }
        dappFundFlowEntity.setMemberId(member.getId());
        IPage<DappFundFlowEntity> records = dappFundFlowDao.selectInPage(page, dappFundFlowEntity);
        return records.getRecords();
src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -49,4 +49,15 @@
            and a.status=#{status}
        </if>
    </select>
    <select id="selectAmountTotalByType" resultType="java.util.HashMap">
        select
            case when type=1 then amount end buy,
            case when type=2 then amount end sale,
            case when type=3 then amount end mine,
            case when type=4 then amount end teamReward
        from (select type, sum(amount) amount from dapp_fund_flow
                 where member_id=#{memberId}
             ) a
    </select>
</mapper>
src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -74,4 +74,15 @@
            limit ${size}
        </if>
    </select>
    <select id="selectAllBalance" resultType="java.math.BigDecimal">
        select ifnull(sum(balance), 0)
        from dapp_member
        <where>
            1=1
            <if test="accountType != null">
                and account_type=#{accountType}
            </if>
        </where>
    </select>
</mapper>