This commit is contained in:
李京通 2025-07-29 16:50:12 +08:00
parent a68fa7ae4e
commit 3c1c7bff7c
1 changed files with 25 additions and 11 deletions

View File

@ -18,6 +18,8 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@ -438,7 +440,6 @@ public class StandardTask {
// }
public boolean sendHighThrowMq(HighThrowDto bean) {
try {
rabbitTemplate.convertAndSend("warnrecord", "routing.key.warnrecord", JSON.toJSONString(bean));
@ -588,17 +589,20 @@ public class StandardTask {
}
/**
* 推送电表设备用电信息
*/
// @Scheduled(cron = "0/5 * * * * ? ")
@Scheduled(cron = "0 30 2 * * ?")
public void DevicePowerInfoRecord() {
LocalDateTime now = LocalDateTime.now();
// 昨天
LocalDateTime yesterday = now.minusDays(1);
// 转成yyyy-MM-dd HH:mm:ss格式
String format = yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<DevicePowerInfo> lists = devicePowerInfoService.list(new QueryWrapper<DevicePowerInfo>()
.eq("is_send", "0")
.like("use_date", format)
.last("limit 100")
);
@ -641,4 +645,14 @@ public class StandardTask {
}
}
public static void main(String[] args) {
LocalDateTime now = LocalDateTime.now();
// 昨天
LocalDateTime yesterday = now.minusDays(1);
// 转成yyyy-MM-dd HH:mm:ss格式
String format = yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(format);
System.out.println(yesterday);
}
}