package com.simuwang.manage.task;

import cn.hutool.core.date.DateUtil;
import com.simuwang.base.common.enums.DeletionType;
import com.simuwang.base.common.enums.DistributeType;
import com.simuwang.base.common.enums.Frequency;
import com.simuwang.base.common.util.DateUtils;
import com.simuwang.base.common.util.StringUtil;
import com.simuwang.base.mapper.*;
import com.simuwang.base.pojo.dos.*;
import com.simuwang.base.pojo.dto.DeletionDownParam;
import com.simuwang.manage.service.DeletionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * FileName: FundDeletionTask
 * Author:   chenjianhua
 * Date:     2024/9/18 22:43
 * Description: ${DESCRIPTION}
 */
@EnableScheduling
@Component
public class FundDeletionTask {

    @Autowired
    private NavMapper navMapper;
    @Autowired
    private DeletionService deletionService;
    @Scheduled(cron = "0 0 5,12,19 * * ?")
    public void computeDeletion(){
        List<String> fundIdList = navMapper.getAllFundId();
        for(String fundId : fundIdList){
            DeletionDownParam deletionDownParam = new DeletionDownParam();
            deletionDownParam.setFundId(fundId);
            deletionService.computeDeletion(deletionDownParam);
        }
    }

}
