| 1234567891011121314151617181920212223242526 |
- package com.jyxt.thridparty.scheduled;
- import com.jyxt.thridparty.service.ReagentConsumableService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.scheduling.annotation.Scheduled;
- import org.springframework.stereotype.Component;
- import java.time.LocalDate;
- import java.time.format.DateTimeFormatter;
- @Component
- public class ReagentConsumableScheduledTask {
- @Autowired
- private ReagentConsumableService reagentConsumableService;
- @Scheduled(cron = "${scheduled.reagent-consumable.cron}")
- public void startTask() {
- LocalDate today = LocalDate.now();
- String startTime = today.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00";
- String endTime = today.plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00";
-
- reagentConsumableService.startTask(startTime, endTime);
- }
- }
|