package org.security.trans.taskCheck.task.impl;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.security.common.eum.FrequencyEnum;
import org.security.common.util.TaskCehckUtil;
import org.security.trans.task.entity.Task;
import org.security.trans.taskCheck.task.ITaskCheck;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author zj 2022/4/11
 * 按半年
 */
@Slf4j
@AllArgsConstructor
@Service
public class ByHalfYearTaskCheck implements ITaskCheck {
	private final BaseTaskCheck baseTaskCheck;

	@Override
	public void handle(Task task) {
		log.info("=============任务类型[按半年]开始处理==============");
		Date begin = TaskCehckUtil.getHalfYearStart();
		Date end = TaskCehckUtil.getHalfYearEnd();
		baseTaskCheck.handle(task, begin, end);
		log.info("=============任务类型[按半年]处理结束==============");
	}

	@Override
	public boolean support(FrequencyEnum frequencyEnum) {
		return FrequencyEnum.BY_HALFYEAR.equals(frequencyEnum);
	}




}
