This commit is contained in:
parent
a68fa7ae4e
commit
3c1c7bff7c
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue