package com.hzs.bonus.bonus.component;

import lombok.extern.slf4j.Slf4j;

/**
 * @Description: 奖金结算发放定时任务
 * @Author: sui q
 * @Time: 2023/3/4 13:47
 * @Classname: BonusSettleTimer
 * @PackageName: com.hzs.member.bonus.component
 */
//@Component
@Slf4j
public class BonusSettleTimer {

//    @DubboReference
//    private ISystemConfigServiceApi systemConfigServiceApi;
//
//    @DubboReference
//    private ISaOrderServiceApi saOrderServiceApi;
//
//    @DubboReference
//    private IRangeServiceApi rangeServiceApi;
//
//    private IBonusSettleService bonusSettleService;
//
//    private ICuMemberTreeService cuMemberTreeService;
//
//    @Autowired
//    public void setBonusSettleService(IBonusSettleService bonusSettleService) {
//        this.bonusSettleService = bonusSettleService;
//    }
//
//    @Autowired
//    public void setCuMemberTreeService(ICuMemberTreeService cuMemberTreeService) {
//        this.cuMemberTreeService = cuMemberTreeService;
//    }
//
//    /**
//     * 奖金每天自动结算,计算前一天奖金
//    * @return: void
//    * @Author: sui q
//    * @Date: 2023/3/4 13:48
//    */
////    @Scheduled(cron = "0 0 0 * * ?")
////    @Scheduled(cron = "* */1 * * * ?")
//    public void autoSettleBonusEveryday(){
//        log.info("开始进行奖金结算");
//        Date currentDate = DateUtils.currentDate();
//        Date startDate = DateUtils.beforeDate(1, ChronoUnit.DAYS, currentDate);
//        String settleDate = DateUtils.parseDateTimeToStr(DateUtils.YYYY_MM_DD, startDate);
//        // 自动初始化表
//        cuMemberTreeService.createCuMemberTree(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startDate));
//        log.info("初始化表完成");
//        // 奖金结算
//        List<SaOrderExt> saOrderExtList = saOrderServiceApi.querySaOrderByDay(startDate, currentDate).getData();
//        Map<String, String> systemConfigMap = systemConfigServiceApi.getBonusSystemConfig().getData();
//        Map<String, RangeDTO> rangeDtoMap = rangeServiceApi.queryRangeDto().getData();
//        bonusSettleService.calculateCuMemberBonus(systemConfigMap, rangeDtoMap, settleDate, saOrderExtList);
//    }
}
