package com.zksy.task;

import com.zksy.commonFile.service.ManageCommonService;
import com.zksy.system.basicData.domain.CrmFile;
import com.zksy.system.basicData.service.CrmFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @project credit-rating
 * @description
 * @date 2024/4/1 16:42:28
 */
@Component
public class MyScheduledTask {
    @Autowired
    private CrmFileService fileService;

    @Autowired
    private ManageCommonService service;
    //每月1号凌晨1点执行
    @Scheduled(cron = "0 0 1 1 * ?")
    public void deleteByFidTask(){
        List<CrmFile> fileList = fileService.selectByFid(0L);
        for(CrmFile entity : fileList){
            service.deleteFile(entity.getId().toString());
        }
    }

}
