xiaoyong931011
2022-09-05 097f92827a7f6896dd2861ee83dcfed9204f1abc
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -258,7 +258,9 @@
        MallMember loginUser = LoginUserUtil.getLoginUser();
        Long memberId = loginUser.getId();
        MallMember mallMember = mallMemberMapper.selectById(memberId);
        if(ObjectUtil.isEmpty(mallMember)){
            return new FebsResponse().success();
        }
        log.info(mallMember.getInviteId());
        MallTeamLeader mallTeamLeader = this.baseMapper.selectLeaderByUniqueCode(mallMember.getInviteId());
        if(ObjectUtil.isEmpty(mallTeamLeader)){
@@ -389,14 +391,23 @@
    public FebsResponse leaderProfit() {
        MallMember loginUser = LoginUserUtil.getLoginUser();
        ApiLeaderProfitVo apiLeaderProfitVo = new ApiLeaderProfitVo();
//        BigDecimal TotalProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(null,null,loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
//        apiLeaderProfitVo.setTotalProfit(TotalProfit);
        BigDecimal todayProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(2,DateUtil.date(),loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
        BigDecimal totalProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),null,null,null);
        apiLeaderProfitVo.setTotalProfit(totalProfit);
        BigDecimal todayProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,DateUtil.date(),
                null);
        apiLeaderProfitVo.setTodayProfit(todayProfit);
        BigDecimal monthProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,null,
                DateUtil.date());
        apiLeaderProfitVo.setMonthProfit(monthProfit);
        BigDecimal waitProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(1,null,loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
        apiLeaderProfitVo.setWaitProfit(waitProfit);
        BigDecimal totalProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),null);
        apiLeaderProfitVo.setTotalProfit(totalProfit);
        return new FebsResponse().success().data(apiLeaderProfitVo);
    }