历史考勤推送步骤

This commit is contained in:
fl 2025-02-18 21:01:09 +08:00
parent 64dcc34d46
commit 5f76423d4c
1 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,196 @@
package com.bonus.system.att.controller;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.Log;
import com.bonus.common.log.enums.BusinessType;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.att.entity.AttDataDetailsBean;
import com.bonus.system.att.entity.OrgChangeBean;
import com.bonus.system.att.service.AttCalService;
import com.bonus.system.att.service.OrgChangeService;
import com.bonus.system.att.tasks.AttTasks;
import com.bonus.system.att.tasks.NewAttTask;
import com.bonus.system.att.utils.AttTimeUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 考勤数据拉取控制层
*
* @author fly
*/
@RestController
@RequestMapping("/attHisPull")
@Slf4j
public class AttHisPullController extends BaseController {
@Resource
private NewAttTask attTask;
/**
* 考勤模版数据
* 某天考勤人员列表
* 基模版数据生成
*/
@GetMapping("/getAttTempData")
@Log(title = "考勤数据拉取->考勤模版数据", businessType = BusinessType.QUERY)
public AjaxResult getAttTempData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.insertAttDateHistory(date);
attTask.insertAttTempData(date, 2);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 1.数据拉取考勤定时器 每隔1个小时获取一次数据
* 2.考勤数据应用步骤一考勤数据更新
*/
@GetMapping("/getAttDataPull")
@Log(title = "考勤数据拉取->数据拉取(考勤)考勤数据更新", businessType = BusinessType.QUERY)
public AjaxResult getAttDataPull(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.getAttendanceData(date,2);
attTask.updateAttData(date,2);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 单独子流程不在主流程中
* 旷工判断
*/
@GetMapping("/getAbsenteeismData")
@Log(title = "考勤数据拉取->旷工判断", businessType = BusinessType.QUERY)
public AjaxResult getAbsenteeismData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.updateAbsenteeismData(date,1);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 请假数据应用--法假
* 每天更新一次一点更新
*/
@GetMapping("/getLegalHolidayData")
@Log(title = "考勤数据拉取->请假数据应用--法假", businessType = BusinessType.QUERY)
public AjaxResult getLegalHolidayData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.updateLegalHolidayData(date);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 请假数据应用--请假
* 每天更新两次上午8点下午18点45天前数据
*/
@GetMapping("/getLeaveData")
@Log(title = "考勤数据拉取->请假数据应用--请假", businessType = BusinessType.QUERY)
public AjaxResult getLeaveData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.updateLeaveData(date);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 报表数据生成日报表
* 每次更新数据都要执行(跟随)
*/
@GetMapping("/insertDayReportData")
@Log(title = "考勤数据拉取->报表数据生成(日报表)", businessType = BusinessType.QUERY)
public AjaxResult insertDayReportData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.updateLeaveData(date);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 报表数据生成月报表
* 月初生成一次
*/
@GetMapping("/insertMonthReportTempData")
@Log(title = "考勤数据拉取->报表数据生成(月报表)", businessType = BusinessType.QUERY)
public AjaxResult insertMonthReportTempData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.insertMonthReportTempData(date);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
/**
* 报表数据生成--月报表
* 每日数据变化修改之后修改
*/
@GetMapping("/updateMonthReportData")
@Log(title = "考勤数据拉取->报表数据生成--月报表修改", businessType = BusinessType.QUERY)
public AjaxResult updateMonthReportData(@RequestBody AttDataDetailsBean bean) {
try{
List<String> dateList = AttTimeUtil.getStrDateListBetween(bean.getStartDate(), bean.getEndDate());
for (String date : dateList) {
attTask.updateMonthReportData(date);
}
return toAjax(true);
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
}