Files
mosty-dyga-cloud/mosty-qwzx/src/main/java/com/mosty/qwzx/task/TbQwBmjlbbTask.java
2025-09-04 18:25:00 +08:00

41 lines
1.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.mosty.qwzx.task;
import com.mosty.common.base.util.DateUtils;
import com.mosty.qwzx.service.TbQwBmjlbbService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @author dw
* @since 2022/8/6
* 规则:
* 一、每晚1点更新昨天数据并写入今天数据。
* 写入今天逻辑:
* 一、去人员表查询所有有部门且非虚拟的人员,全面写入。
* 二、去值班排班表查询数据并修改相关字段。
* 三、去请休假表查询数据并修改相关字段。
* 昨天数据更新逻辑:
* 一、去值班班表查询数据并修改相关字段。
* 二、去请休假表查询数据并修改相关字段。
**/
@Slf4j
@Component
@AllArgsConstructor
public class TbQwBmjlbbTask {
private final TbQwBmjlbbService tbQwBmjlbbService;
@Scheduled(cron = "0 0 1 * * ?")
@Transactional
public void run() {
String time = DateUtils.dateTime(new Date());
// 写入今日数据
this.tbQwBmjlbbService.setBmjlbbInfo(time);
}
}