package com.hzs.bonus.bonus.controller.api;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.hzs.bonus.bonus.param.BonusParam;
import com.hzs.bonus.bonus.service.ICuMemberBonusService;
import com.hzs.bonus.bonus.vo.*;
import com.hzs.common.core.enums.EGrantStatus;
import com.hzs.common.core.utils.ComputeUtil;
import com.hzs.common.core.utils.DateUtils;
import com.hzs.common.core.web.controller.BaseController;
import com.hzs.common.core.web.page.TableDataInfo;
import com.hzs.common.domain.member.ext.CuMemberBonusExt;
import com.hzs.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/api/bonus")
@Slf4j
public class ApiCuMemberBonusController extends BaseController {

    @Autowired
    private ICuMemberBonusService cuMemberBonusService;

//    /**
//     * 查询会员某个时间段内的奖金，默认查询15天内,查询直推
//     */
//    @PostMapping("/query-bonus-first")
//    public TableDataInfo listFirstRepurchaseBonus(@RequestBody BonusParam bonusParam){
//        setBonusParam(bonusParam);
//        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
//        List<MemberBonusFirstPurchaseVO> firstPurchaseVOList = new ArrayList<>();
//        cuMemberBonusList.forEach(cuMemberBonus -> {
//            MemberBonusFirstPurchaseVO memberBonusFirstPurchaseVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusFirstPurchaseVO.class, "settleDate");
//            packageSettleDate(cuMemberBonus, memberBonusFirstPurchaseVO);
////            if(DateUtils.compareDate(cuMemberBonus.getSettleDate(), DateUtils.parseStringToDate("2024-09-09"))>0) {
//                BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getDirectIncome(), memberBonusFirstPurchaseVO.getExpandIncome(),
//                                memberBonusFirstPurchaseVO.getCoachIncome(), memberBonusFirstPurchaseVO.getServiceIncome(), memberBonusFirstPurchaseVO.getShareIncome(),
//                                memberBonusFirstPurchaseVO.getRepurExpandIncome(), memberBonusFirstPurchaseVO.getRepurRangeIncome(), memberBonusFirstPurchaseVO.getRepurPushIncome()),
//                        ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal()));
//                memberBonusFirstPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
//                memberBonusFirstPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
//                memberBonusFirstPurchaseVO.setExpandIncome(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getExpandIncome(), memberBonusFirstPurchaseVO.getRepurExpandIncome(),
//                        memberBonusFirstPurchaseVO.getRepurRangeIncome(), memberBonusFirstPurchaseVO.getRepurPushIncome()));
//                memberBonusFirstPurchaseVO.setPurRealSubtotal(ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal()));
////            }else{
////                BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getDirectIncome(), memberBonusFirstPurchaseVO.getExpandIncome(),
////                                memberBonusFirstPurchaseVO.getCoachIncome(), memberBonusFirstPurchaseVO.getServiceIncome(), memberBonusFirstPurchaseVO.getShareIncome(),
////                                memberBonusFirstPurchaseVO.getRepurExpandIncome(), memberBonusFirstPurchaseVO.getRepurExpandIncome()),
////                        ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal()));
////                memberBonusFirstPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
////                memberBonusFirstPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
////            }
//            firstPurchaseVOList.add(memberBonusFirstPurchaseVO);
//        });
//        return getDataTable(firstPurchaseVOList);
//    }

    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询直推
     */
    @PostMapping("/query-bonus-first")
    public TableDataInfo listFirstRepurchaseBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusFirstPurchaseVO> firstPurchaseVOList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusFirstPurchaseVO memberBonusFirstPurchaseVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusFirstPurchaseVO.class, "settleDate");
            packageSettleDate(cuMemberBonus, memberBonusFirstPurchaseVO);
//            BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getDirectIncome(), memberBonusFirstPurchaseVO.getExpandIncome(),
//                            memberBonusFirstPurchaseVO.getCoachIncome(), memberBonusFirstPurchaseVO.getServiceIncome(), memberBonusFirstPurchaseVO.getShareIncome()),
//                    memberBonusFirstPurchaseVO.getPurRealSubtotal());
//            memberBonusFirstPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
//            memberBonusFirstPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
            //            if(DateUtils.compareDate(cuMemberBonus.getSettleDate(), DateUtils.parseStringToDate("2024-09-09"))>0) {
            // 新版逻辑，首购+复购合并计算显示

            // TODO new 乐学直推级差收益现在扣20%，所以直接使用库中的就可以
//            BigDecimal serviceSpend = ComputeUtil.computeSubtract(
//                    // 直推收益 + 拓展收益 + 辅导收益 + 分红收益 + 报单收益 + 复购拓展收益 + 复购级差收益 + 复购推荐收益 + 乐学直推收益
//                    ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getDirectIncome(), memberBonusFirstPurchaseVO.getExpandIncome(),
//                            memberBonusFirstPurchaseVO.getCoachIncome(), memberBonusFirstPurchaseVO.getShareIncome(), memberBonusFirstPurchaseVO.getServiceIncome(),
//                            memberBonusFirstPurchaseVO.getRepurExpandIncome(), memberBonusFirstPurchaseVO.getRepurRangeIncome(), memberBonusFirstPurchaseVO.getRepurPushIncome(),
//                            memberBonusFirstPurchaseVO.getGlobalPoints()),
//
//                    ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal())
//
//            );
//            memberBonusFirstPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
//            memberBonusFirstPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
            memberBonusFirstPurchaseVO.setBackPoints(cuMemberBonus.getBackPoints());
            memberBonusFirstPurchaseVO.setServiceSpend(cuMemberBonus.getServiceSpend());

            // 拓展收益 = 首购拓展 + 复购拓展 + 复购推荐
            memberBonusFirstPurchaseVO.setExpandIncome(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getExpandIncome(),
                    memberBonusFirstPurchaseVO.getRepurExpandIncome(), memberBonusFirstPurchaseVO.getRepurPushIncome()));
            // 辅导收益 = 首购辅导 + 复购辅导
            memberBonusFirstPurchaseVO.setCoachIncome(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getCoachIncome(),
                    memberBonusFirstPurchaseVO.getRepurCoachIncome()));
            // 首购实发小计 = 首购实发小计 + 复购实发小计
            memberBonusFirstPurchaseVO.setPurRealSubtotal(ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal()));

//            }else{
//                BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusFirstPurchaseVO.getDirectIncome(), memberBonusFirstPurchaseVO.getExpandIncome(),
//                                memberBonusFirstPurchaseVO.getCoachIncome(), memberBonusFirstPurchaseVO.getServiceIncome(), memberBonusFirstPurchaseVO.getShareIncome(),
//                                memberBonusFirstPurchaseVO.getRepurExpandIncome(), memberBonusFirstPurchaseVO.getRepurExpandIncome()),
//                        ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getRepurRealSubtotal()));
//                memberBonusFirstPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
//                memberBonusFirstPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
//            }
            // TODO new 乐学直推结算时，已经加到首购实发小计，此处不需要再累加
//            memberBonusFirstPurchaseVO.setPurRealSubtotal(ComputeUtil.computeAdd(memberBonusFirstPurchaseVO.getPurRealSubtotal(), memberBonusFirstPurchaseVO.getGlobalPoints()));

            firstPurchaseVOList.add(memberBonusFirstPurchaseVO);
        });
        return getDataTable(firstPurchaseVOList);
    }

    /**
     * 查询会员昨天奖金的值
     */
    @PostMapping("/query-bonus-total")
    public TableDataInfo lisBonusTotal(@RequestBody BonusParam bonusParam) {
        Date nowDate = DateUtils.currentDate();
        bonusParam.setPkCountry(SecurityUtils.getPkCountry());
        bonusParam.setPkMember(SecurityUtils.getUserId());
//        bonusParam.setStartDate(DateUtils.beforeDate(1, ChronoUnit.DAYS));
        bonusParam.setStartDate(DateUtils.currentMonthFirstDate(nowDate));
        bonusParam.setEndDate(nowDate);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusTotalByCondition(bonusParam);
        MemberRealIncomeVO memberRealIncomeVO = MemberRealIncomeVO.builder()
                .realIncomeTotal(BigDecimal.ZERO)
                .monthIncomeTotal(BigDecimal.ZERO)
                .build();
        if (CollectionUtil.isNotEmpty(cuMemberBonusList)) {
            if (DateUtils.beforeDate(1, ChronoUnit.DAYS, nowDate).equals(cuMemberBonusList.get(0).getSettleDate())) {
                // 最新数据是昨天的奖金数据
                memberRealIncomeVO.setRealIncomeTotal(cuMemberBonusList.get(0).getRealIncomeTotal());
            }
            BigDecimal monthTotal = BigDecimal.ZERO;
            for (CuMemberBonusExt cuMemberBonusExt : cuMemberBonusList) {
                monthTotal = monthTotal.add(cuMemberBonusExt.getRealIncomeTotal());
            }
            memberRealIncomeVO.setMonthIncomeTotal(monthTotal);
        }
        return getDataTable(Collections.singletonList(memberRealIncomeVO));
    }

    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询复购
     */
    @PostMapping("/query-bonus-repurchase")
    public TableDataInfo listRepurchaseBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusPurchaseVO> memberBonusPurchaseVoList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusPurchaseVO memberBonusPurchaseVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusPurchaseVO.class, "settleDate");
            packageSettleDate(cuMemberBonus, memberBonusPurchaseVO);
            BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusPurchaseVO.getRepurPushIncome(), memberBonusPurchaseVO.getRepurExpandIncome(), memberBonusPurchaseVO.getRepurRangeIncome()),
                    memberBonusPurchaseVO.getRepurRealSubtotal());
            memberBonusPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
            memberBonusPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
            memberBonusPurchaseVoList.add(memberBonusPurchaseVO);
        });
        return getDataTable(memberBonusPurchaseVoList);
    }

    @PostMapping("/query-bonus-range")
    public TableDataInfo listRangeBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusPurchaseVO> memberBonusPurchaseVoList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusPurchaseVO memberBonusPurchaseVO = MemberBonusPurchaseVO.builder()
                    .directIncome(cuMemberBonus.getRepurPushIncome())
                    .storeIncome(null != cuMemberBonus.getStoreIncome() ? cuMemberBonus.getStoreIncome() : BigDecimal.ZERO)
                    .repurPushIncome(cuMemberBonus.getCloudDirectIncome())
                    .repurRangeIncome(cuMemberBonus.getCloudPurIncome())
                    .repurExpandIncome(cuMemberBonus.getCloudRepurIncome())
                    .repurRealSubtotal(cuMemberBonus.getCloudRealSubtotal())
                    .build();
            packageSettleDate(cuMemberBonus, memberBonusPurchaseVO);
            BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(memberBonusPurchaseVO.getRepurPushIncome(), memberBonusPurchaseVO.getRepurExpandIncome(),
                    memberBonusPurchaseVO.getRepurRangeIncome(), memberBonusPurchaseVO.getDirectIncome(), memberBonusPurchaseVO.getStoreIncome()),
                    memberBonusPurchaseVO.getRepurRealSubtotal());
            memberBonusPurchaseVO.setBackPoints(ComputeUtil.computeMultiplyHalf(serviceSpend));
            memberBonusPurchaseVO.setServiceSpend(ComputeUtil.computeMultiplyHalf(serviceSpend));
            memberBonusPurchaseVoList.add(memberBonusPurchaseVO);
        });
        return getDataTable(memberBonusPurchaseVoList);
    }

    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询复购
     */
    @PostMapping("/query-bonus-hi-fun")
    public TableDataInfo listHiFunBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusHiFunVO> bonusHiFunVoList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusHiFunVO memberBonusHiFunVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusHiFunVO.class, "settleDate");
            packageSettleDate(cuMemberBonus, memberBonusHiFunVO);
            memberBonusHiFunVO.setHiFunRealSubtotal(cuMemberBonus.getHiFunIncome());
            bonusHiFunVoList.add(memberBonusHiFunVO);
        });
        return getDataTable(bonusHiFunVoList);
    }

    private static void packageSettleDate(CuMemberBonusExt cuMemberBonus, PubMemberBonusVO pubMemberBonusVO) {
        if (cuMemberBonus.getEndSettleDate() == null) {
            pubMemberBonusVO.setSettleDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, cuMemberBonus.getSettleDate()));
        } else {
            pubMemberBonusVO.setSettleDate(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, cuMemberBonus.getSettleDate()) + "-" +
                    DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, cuMemberBonus.getEndSettleDate()));
        }
        pubMemberBonusVO.setServiceSpend(BigDecimal.ZERO);
    }

    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询复购
     */
    @PostMapping("/query-bonus-cloud")
    public TableDataInfo listCloudAgentBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusCloudAgentVO> memberBonusCloudAgentVoArrayList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            if (ComputeUtil.compareValue(cuMemberBonus.getCloudRepurIncome())) {
                MemberBonusCloudAgentVO bonusCloudAgentVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusCloudAgentVO.class, "settleDate");
                packageSettleDate(cuMemberBonus, bonusCloudAgentVO);
                BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAddNum(bonusCloudAgentVO.getCloudDirectIncome(),
                        bonusCloudAgentVO.getCloudPurIncome(), bonusCloudAgentVO.getCloudRepurIncome()),
                        bonusCloudAgentVO.getCloudRealSubtotal());
                bonusCloudAgentVO.setServiceSpend(serviceSpend);
                memberBonusCloudAgentVoArrayList.add(bonusCloudAgentVO);
            }
        });
        return getDataTable(memberBonusCloudAgentVoArrayList);
    }

    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询复购
     */
    @PostMapping("/query-bonus-coupon")
    public TableDataInfo listRepurchaseCouponBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusRepurchaseCouponVO> memberBonusRepurchaseCouponList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusRepurchaseCouponVO repurchaseCouponVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusRepurchaseCouponVO.class, "settleDate");
            packageSettleDate(cuMemberBonus, repurchaseCouponVO);
            BigDecimal serviceSpend = ComputeUtil.computeSubtract(ComputeUtil.computeAdd(repurchaseCouponVO.getRepurCoupon(),
                    repurchaseCouponVO.getRepurCouponShare()), repurchaseCouponVO.getRepurCouponSubtotal());
            repurchaseCouponVO.setServiceSpend(serviceSpend);
            memberBonusRepurchaseCouponList.add(repurchaseCouponVO);
        });
        return getDataTable(memberBonusRepurchaseCouponList);
    }


    /**
     * 查询会员某个时间段内的奖金，默认查询15天内,查询复购
     */
    @PostMapping("/query-bonus-hai-fun")
    public TableDataInfo listHaiFunBonus(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        List<CuMemberBonusExt> cuMemberBonusList = cuMemberBonusService.queryMemberBonusVoByCondition(bonusParam);
        List<MemberBonusHaiFunVO> bonusHaiFunVoList = new ArrayList<>();
        cuMemberBonusList.forEach(cuMemberBonus -> {
            MemberBonusHaiFunVO memberBonusHaiFunVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusHaiFunVO.class, "settleDate");
            packageSettleDate(cuMemberBonus, memberBonusHaiFunVO);
            memberBonusHaiFunVO.setServiceSpend(BigDecimal.ZERO);
            memberBonusHaiFunVO.setHaiFunRealSubtotal(cuMemberBonus.getHaiFunIncome());
            bonusHaiFunVoList.add(memberBonusHaiFunVO);
        });
        return getDataTable(bonusHaiFunVoList);
    }


    private void setBonusParam(@RequestBody BonusParam bonusParam) {
        bonusParam.setPkCountry(SecurityUtils.getPkCountry());
        bonusParam.setPkMember(SecurityUtils.getUserId());
        Date startDate = DateUtils.beforeDate(15, ChronoUnit.DAYS, DateUtils.currentDate());
        if (bonusParam.getStartDate() == null) {
            bonusParam.setStartDate(startDate);
        } else if (DateUtils.compareDateBefore(bonusParam.getStartDate(), startDate)) {
            bonusParam.setStartDate(startDate);
        }
        if (bonusParam.getEndDate() == null) {
            bonusParam.setEndDate(DateUtils.currentDate());
        } else {
            bonusParam.setEndDate(DateUtils.afterDate(1, ChronoUnit.DAYS, bonusParam.getEndDate()));
        }
    }

    /**
     * 查询会员某个时间段内的奖金来源
     */
    @PostMapping("/query-bonus-detail")
    public TableDataInfo listBonusSource(@RequestBody BonusParam bonusParam) {
        setBonusParam(bonusParam);
        startPage();
//        List<MemberBonusVO> memberBonusVoList = new ArrayList<>();
        TableDataInfo tableDataInfo = cuMemberBonusService.queryMemberBonusDetailVoByCondition(bonusParam);
//        cuMemberBonusList.forEach(cuMemberBonus -> {
//            MemberBonusVO memberBonusVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusVO.class);
//            memberBonusVoList.add(memberBonusVO);
//        });
//        TableDataInfo dataTable = getDataTable(cuMemberBonusList);
//        dataTable.setRows(memberBonusVoList);
        return tableDataInfo;
    }

    /**
     * 查询会员某个时间段内的奖金来源
     */
    @PostMapping("/query-mark-bonus-detail")
    public TableDataInfo listMarkBonusSource(@RequestBody BonusParam bonusParam) {
        if (bonusParam.getStartDate() == null || bonusParam.getBonusValue() == null) {
            return getDataTable(null);
        }
        bonusParam.setEndDate(DateUtils.afterDate(1, ChronoUnit.DAYS, bonusParam.getStartDate()));
        bonusParam.setPkCountry(SecurityUtils.getPkCountry());
        bonusParam.setPkMember(SecurityUtils.getUserId());
//        List<MemberBonusVO> memberBonusVoList = new ArrayList<>();
        List<MemberBonusDetailVO> memberBonusDetailVOList = cuMemberBonusService.queryMemberMarkBonusDetailSource(bonusParam);
//        cuMemberBonusList.forEach(cuMemberBonus -> {
//            MemberBonusVO memberBonusVO = BeanUtil.copyProperties(cuMemberBonus, MemberBonusVO.class);
//            memberBonusVoList.add(memberBonusVO);
//        });
//        TableDataInfo dataTable = getDataTable(cuMemberBonusList);
//        dataTable.setRows(memberBonusVoList);
        return getDataTable(memberBonusDetailVOList);
    }
}
