Commit d5ec6196 authored by 廖旭伟's avatar 廖旭伟

考勤汇总任务

parent 90e07860
package com.mortals.xhx.daemon.task;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.attendance.service.AttendanceStatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 考勤汇总
*/
@Slf4j
@Service("AttendanceSummaryTask")
public class AttendanceSummaryTaskImpl implements ITaskExcuteService {
@Autowired
private AttendanceStatService attendanceStatService;
@Autowired
private ICacheService cacheService;
private static String SUMMARY_TASK_KEY ="attendanceSummaryTask:run";
@Override
public void excuteTask(ITask task) throws AppException {
try {
String verify = cacheService.get(SUMMARY_TASK_KEY);
if(StringUtils.isNotEmpty(verify)&&verify.equals("true")){
Thread.sleep(600*1000);
}
cacheService.setnx(SUMMARY_TASK_KEY,"true",3600);
attendanceStatService.doAttendanceSummary(null);
cacheService.setnx(SUMMARY_TASK_KEY,"false",60);
}catch (Exception e){
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment