瀏覽代碼

修改首页报警信息

523096025 4 年之前
父節點
當前提交
16a6481f4f

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

@@ -85,6 +85,7 @@ public class EnvironmentControlController {
     public void test(){
         RestTemplate restTemplate = new RestTemplate();
         DeviceUpDataEntity[] forObject = restTemplate.getForObject("http://127.0.0.1:8085/environmentControl/findAllByTime", DeviceUpDataEntity[].class);
+        System.out.println(forObject);
         envControlService.save(forObject);
 
     }

+ 1 - 1
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/repo/WarningInfoEntityRepo.java

@@ -13,7 +13,7 @@ public interface WarningInfoEntityRepo extends JpaRepository<WarningInfoEntity,
     List<WarningInfoEntity> findAllByShowStatusAndUploadTimeBetween(Integer showStatus,Date starTime, Date endTime);
 
 
-    @Query(nativeQuery = true,value = "update warning_info set show_status 1 where warning_type = 2")
+    @Query(nativeQuery = true,value = "update warning_info set show_status 1 where warning_type = 2 and show_status = 0")
     void updateShowStatusByWarningType();
 
 }

+ 4 - 6
huimv-ql-farm/huimv-ql-environment/src/main/java/com/huimv/environment/service/impl/EnvironmentControlServiceImpl.java

@@ -332,20 +332,20 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
     @Override
     @DS("master")
     public void save(DeviceUpDataEntity[] forObject) {
-        warningInfoEntityRepo.updateShowStatusByWarningType();
-        List<FarmSm> all = farmSmRepository.findAll();
 
+
+        List<FarmSm> all = farmSmRepository.findAll();
+        warningInfoEntityRepo.updateShowStatusByWarningType();
         if (forObject == null){
             for (FarmSm farmSm : all) {
                 WarningInfoEntity warningInfoEntity = new WarningInfoEntity();
                 warningInfoEntity.setLQID(farmSm.getLqid());
-                warningInfoEntity.setType("设备故障");
+                warningInfoEntity.setType("设备故障,当天无数据上传");
                 warningInfoEntity.setUploadTime(new Date());
                 warningInfoEntity.setShowStatus(0);
                 warningInfoEntity.setWarningType(1);
                 warningInfoEntityRepo.save(warningInfoEntity);
             }
-
         }else {
             List list1= new ArrayList();
             List list2= new ArrayList();
@@ -355,10 +355,8 @@ public class EnvironmentControlServiceImpl implements IEnvironmentControlService
             for (FarmSm farmSm : all) {
                 list2.add(farmSm.getLqid());
             }
-
             Collection<String> subtract = CollectionUtils.subtract(list2, list1);
             if (subtract == null){
-                warningInfoEntityRepo.updateShowStatusByWarningType();
                 return;
             }else {
                 for (String s : subtract) {