mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
bugfix
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.lihongjie.coal.emDevice.entity.EmDeviceEntity;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
@@ -14,7 +15,7 @@ public interface EmDeviceRepository extends BaseRepository<EmDeviceEntity> {
|
||||
value =
|
||||
"select d.id\n"
|
||||
+ "from t_em_device d\n"
|
||||
+ "where (select max(time) from t_em_device_data data where data.device_id = d.id) + (d.\"interval\" * interval '1 minute') >= now()",
|
||||
+ "where (select max(time) from t_em_device_data data where data.device_id = d.id) + (d.\"interval\" * interval '1 minute') <= :now",
|
||||
nativeQuery = true)
|
||||
List<String> findNeedToFetchDevice();
|
||||
List<String> findNeedToFetchDevice(LocalDateTime now);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public class EmDeviceService extends BaseService<EmDeviceEntity, EmDeviceReposit
|
||||
|
||||
try {
|
||||
|
||||
List<String> ids = this.repository.findNeedToFetchDevice();
|
||||
List<String> ids = this.repository.findNeedToFetchDevice(LocalDateTime.now());
|
||||
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
log.info("no need to fetch data");
|
||||
|
||||
Reference in New Issue
Block a user