From 9a1593ad184cd28282bf46f1acb259138271766e Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 09 十二月 2025 09:52:47 +0800
Subject: [PATCH] init
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java | 49 -------------------------------------------------
1 files changed, 0 insertions(+), 49 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
index be14b68..3754ed6 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskUtil.java
@@ -1,21 +1,7 @@
package com.ruoyi.web.controller.task;
-import com.ruoyi.system.model.TOldster;
-import com.ruoyi.system.model.TOldsterWarning;
-import com.ruoyi.system.model.TOtherConfig;
-import com.ruoyi.system.service.TOldsterService;
-import com.ruoyi.system.service.TOldsterWarningService;
-import com.ruoyi.system.service.TOtherConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
/**
* @author xiaochen
@@ -24,40 +10,5 @@
@Component
public class TaskUtil {
- @Autowired
- private TOldsterService oldsterService;
- @Autowired
- private TOldsterWarningService oldsterWarningService;
- @Autowired
- private TOtherConfigService otherConfigService;
-
- /**
- * 每日0点定时任务
- */
- @Scheduled(cron = "0 0 0 * * ?")
- public void generateOldsterWarning(){
-
- // 查询所有老人信息
- List<TOldster> oldsterList = oldsterService.list();
- // 查询预警阈值
- TOtherConfig otherConfig = otherConfigService.getById(1);
- Integer elderlyAge = otherConfig.getElderlyAge();
- Integer days = otherConfig.getDays();
- List<TOldsterWarning> oldsterWarningList = new ArrayList<>();
- for (TOldster oldster : oldsterList) {
- LocalDate birthDate = oldster.getBirthDate();
- // 判断年龄是否与elderlyAge是否为同一年
- if(birthDate.plusYears(elderlyAge).getYear() == LocalDate.now().getYear() && birthDate.plusYears(elderlyAge).minusDays(days).isEqual(LocalDate.now())){
- // 添加预警信息
- TOldsterWarning oldsterWarning = new TOldsterWarning();
- oldsterWarning.setOldsterId(oldster.getId());
- oldsterWarning.setWarningTime(LocalDateTime.now());
- oldsterWarningList.add(oldsterWarning);
- }
- }
- if(!CollectionUtils.isEmpty(oldsterWarningList)){
- oldsterWarningService.saveBatch(oldsterWarningList);
- }
- }
}
--
Gitblit v1.7.1