35 lines
1.1 KiB
Java
35 lines
1.1 KiB
Java
package com.ycwl.basic.task;
|
|
|
|
import com.ycwl.basic.mapper.ScenicMapper;
|
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
|
import com.ycwl.basic.service.task.TaskFaceService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
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.util.List;
|
|
|
|
@Component
|
|
@EnableScheduling
|
|
@Slf4j
|
|
public class FaceCleaner {
|
|
@Autowired
|
|
private ScenicMapper scenicMapper;
|
|
@Autowired
|
|
private TaskFaceService faceService;
|
|
|
|
|
|
@Scheduled(cron = "0 0 4 * * ?")
|
|
public void clean(){
|
|
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
|
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
|
scenicList.forEach(scenic -> {
|
|
log.info("当前景区{},开始删除人脸样本", scenic.getName());
|
|
faceService.batchDeleteFace(scenic.getId());
|
|
});
|
|
}
|
|
}
|