Explorar o código

添加报警功能

523096025 %!s(int64=4) %!d(string=hai) anos
pai
achega
f56c6b4758

+ 2 - 1
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/EnvironmentControlController.java

@@ -55,7 +55,8 @@ public class EnvironmentControlController {
 
 
     //定时检测数据库中是否有数据
-    @Scheduled(cron = "0 0 23 1 * ? ")
+//    @Scheduled(cron = "0 0 23 1 * ? ")
+    @RequestMapping(value = "/examine")
     public void examine(){
         envControlService.examine();
     }

+ 0 - 2
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/controller/SetTemperature.java

@@ -39,8 +39,6 @@ public class SetTemperature {
     public Result login(HttpSession session,
                              @RequestParam(name = "high_temperature", required = true) String high_temperature,
                              @RequestParam(name = "low_temperature", required = true) String low_temperature,
-                             @RequestParam(name = "create", required = true) String create,
-                             @RequestParam(name = "updata", required = true) String updata,
                              @RequestParam(name = "remark", required = true) String remark,
                              HttpServletRequest req)  {
 

+ 3 - 0
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/DeviceUpDataEntityRepo.java

@@ -24,6 +24,9 @@ public interface DeviceUpDataEntityRepo extends JpaRepository<DeviceUpDataEntity
             "WHERE DATE_FORMAT(TIMESTAMP,'%Y-%m-%d')=DATE_FORMAT(?3,'%Y-%m-%d')  ")
     List<DeviceUpDataEntity> findAllByTimestampBetween(Double minTemp,Double maxTemp, String today );
 
+    @Query(nativeQuery = true,value = "SELECT  any_value(`timestamp`),device_id FROM `device_up_data` WHERE DATE_FORMAT(TIMESTAMP,'%Y-%m-%d')=DATE_FORMAT(?1,'%Y-%m-%d') GROUP BY device_id")
+    List findAllByIdAfter(String today);
+
 
 
 }

+ 5 - 1
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/EnvironmentControlServiceImpl.java

@@ -233,7 +233,11 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
     @Override
     @DS("slave")
     public void examine() {
-//        deviceUpDataEntityRepo.
+        String todayDate = new DateUtil().formatDate(new Date());
+        System.out.println(todayDate);
+        List allByIdAfter = deviceUpDataEntityRepo.findAllByIdAfter(todayDate);
+        System.out.println(allByIdAfter);
+
     }
 
   /*  @Override