xiaoyong931011
2022-09-06 5abae2f9eaa8304878a893cea47435eca8528494
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)){
@@ -365,6 +367,11 @@
                    mallOrderInfoMapper.updateById(mallOrderRefund);
                }
            }else{
                //更新订单详情
                mallOrderItem.setState(1);
                mallOrderItemMapper.updateById(mallOrderItem);
                mallRefundEntity.setState(2);
                mallRefundMapper.updateById(mallRefundEntity);
                return new FebsResponse().fail().message("退款失败,请联系客服人员");
@@ -389,14 +396,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);
    }