安全管理子系统-4
今天给系统做一个定期发布任务的功能。在CompanyController.java类中添加接口:
@GetMapping("/current-tasks")
public List<company> getCurrentTasks() {
LocalDateTime now = LocalDateTime.now();
return repo.findCurrentTasks(now);
}
在CompanyRepository.java中添加查询方法
@Query("SELECT c FROM company c WHERE c.next_inspection_date IS NOT NULL AND c.next_inspection_date <= :currentTime")
List<company> findCurrentTasks(LocalDateTime currentTime);
实现了定时发布的功能,但是出现了时区转换问题未解决。
浙公网安备 33010602011771号