Explorar el Código

内蒙水资源平台版本提交-20240221

dylan hace 2 años
padre
commit
a1f823e160
Se han modificado 18 ficheros con 1040 adiciones y 2344 borrados
  1. 7 34
      NMSZYYWXT/src/main/java/org/springblade/jobtask/DataShareProcessor.java
  2. 0 337
      NMSZYYWXT/src/main/java/org/springblade/jobtask/RainDataCountProcessor.java
  3. 0 725
      NMSZYYWXT/src/main/java/org/springblade/jobtask/ReportCountProcessor.java
  4. 121 237
      NMSZYYWXT/src/main/java/org/springblade/jobtask/RtuUpCountProcessor.java
  5. 171 322
      NMSZYYWXT/src/main/java/org/springblade/jobtask/WarnCheckProcessor.java
  6. 227 202
      NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/project/controller/ProjectBaseInfoController.java
  7. 51 32
      NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/project/entity/ProjectTreeNodeEntity.java
  8. 379 341
      NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/controller/RtuBaseInfoController.java
  9. 7 1
      NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/mapper/RtuInfoMapper.xml
  10. 4 0
      NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/wrapper/RtuInfoWrapper.java
  11. 1 4
      NMSZYYWXT/src/main/java/org/springblade/modules/business/home/VO/RtuStatusCountInfoVO.java
  12. 35 94
      NMSZYYWXT/src/main/java/org/springblade/modules/business/home/controller/HomeController.java
  13. 7 6
      NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/controller/WaterFlowRateMonitorController.java
  14. 8 0
      NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/dto/WaterFlowRateInfoDTO.java
  15. 3 0
      NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateHistoryMapper.xml
  16. 10 6
      NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateMapper.xml
  17. 6 0
      NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/vo/WaterFlowRateInfoVO.java
  18. 3 3
      NMSZYYWXT/src/main/resources/application-dev.yml

+ 7 - 34
NMSZYYWXT/src/main/java/org/springblade/jobtask/DataShareProcessor.java

@@ -13,20 +13,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.springblade.constant.BusinessConstant;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.enums.IsValidEnum;
-import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointRelEntity;
-import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointRelService;
-import org.springblade.modules.baseinfo.monitorsite.dto.MonitorSiteInfoDTO;
-import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteInfoEntity;
-import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteRelEntity;
-import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteRelService;
-import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
 import org.springblade.modules.baseinfo.rtu.dto.RtuInfoDTO;
 import org.springblade.modules.baseinfo.rtu.entity.RtuInfoEntity;
 import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
-import org.springblade.modules.baseinfo.wateruseconsumer.entity.WaterUseConsumerInfoEntity;
-import org.springblade.modules.baseinfo.wateruseconsumer.service.IWaterUseConsumerService;
 import org.springblade.modules.business.monitor.entity.WaterFlowRateInfoEntity;
-import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
 import org.springblade.modules.business.monitor.service.IWaterFlowRateService;
 import org.springblade.modules.share.entity.DataShareLogEntity;
 import org.springblade.modules.share.service.IDataShareLogServcie;
@@ -45,8 +35,8 @@ import java.util.concurrent.FutureTask;
 
 /***
  * Date:2023/11/16
- * Title:文件所属模块(必须填写)
- * Description:对本文件的详细描述,原则上不能少于30字
+ * Title:数据共享任务
+ * Description:推送计量设施、日水量到金水平台
  * @author dylan
  * @version 1.0
  * Remark:认为有必要的其他信息
@@ -58,27 +48,12 @@ public class DataShareProcessor {
     @Resource
     private TaskManager taskManager;
 
-//    @Resource
-//    private IMonitorSiteService monitorSiteService;
-
-//    @Resource
-//    private IMonitorPointRelService monitorPointRelService;
-//
-//    @Resource
-//    private IMonitorSiteRelService monitorSiteRelService;
-
-//    @Resource
-//    private IWaterUseConsumerService waterUseConsumerService;
-
     @Resource
     private IRtuBaseInfoService rtuBaseInfoService;
 
     @Resource
     private IWaterFlowRateService waterFlowRateService;
 
-    @Resource
-    private IWaterFlowRateHistoryService waterFlowRateHistoryService;
-
     @Resource
     private IDataShareLogServcie dataShareLogServcie;
 
@@ -104,8 +79,7 @@ public class DataShareProcessor {
      * 计量设施数据同步,每天执行一次
      */
 //    @Scheduled(cron = "10 0 0 * * ?")
-//    @Scheduled(cron = "0 0 0/1 * * ?")
-    @Scheduled(cron = "0 0/1 * * * ?")
+    @Scheduled(cron = "0 0 0/1 * * ?")
     public void siteShareDataTaskScheduled() {
         try {
             if (dataShareRtuActive) {
@@ -123,11 +97,10 @@ public class DataShareProcessor {
     /**
      * 实时流量数据同步,每小时执行一次
      */
-//    @Scheduled(cron = "30 0/1 * * * ?")
-//    @Scheduled(cron = "30 0 0/1 * * ?")
+    @Scheduled(cron = "30 0 0/1 * * ?")
     public void waterFlowRateShareDataTaskScheduled() {
         try {
-            if (dataShareDataActive){
+            if (dataShareDataActive) {
                 Date dt = new Date();
                 log.info("实时流量数据任务创建 {}", Func.formatDateTime(dt));
                 WaterFlowRateShareDataTask task = new WaterFlowRateShareDataTask(dt);
@@ -157,7 +130,7 @@ public class DataShareProcessor {
                 if (Func.notNull(list)) {
                     for (RtuInfoEntity entity : list) {
                         if (Func.notNull(entity.getDataShareActive()) && IsValidEnum.VALID_2.getCode() == entity.getDataShareActive().intValue()) {
-                            log.info("同步计量设施{}",entity.getRtuCode());
+                            log.info("同步计量设施{}", entity.getRtuCode());
                             JSONObject data = new JSONObject();
                             data.put("id", BusinessConstant.DATA_SHARE_AREA + "_" + entity.getRtuCode());
                             data.put("measName", entity.getRtuName());
@@ -267,7 +240,7 @@ public class DataShareProcessor {
                 if (Func.notNull(list)) {
                     for (RtuInfoEntity entity : list) {
                         if (Func.notNull(entity.getDataShareActive()) && IsValidEnum.VALID_2.getCode() == entity.getDataShareActive().intValue()) {
-                            log.info("同步数据{}",entity.getRtuCode());
+                            log.info("同步数据{}", entity.getRtuCode());
                             LambdaQueryWrapper<WaterFlowRateInfoEntity> dataWrapper = Wrappers.<WaterFlowRateInfoEntity>query().lambda();
                             dataWrapper.eq(WaterFlowRateInfoEntity::getMpcd, entity.getRtuCode());
                             dataWrapper.last("limit 1");

+ 0 - 337
NMSZYYWXT/src/main/java/org/springblade/jobtask/RainDataCountProcessor.java

@@ -1,337 +0,0 @@
-/**
- * Copyright 2019 DH
- * All right reserved.
- * 项目名称: 山洪灾害运维系统
- * 创建日期:2023/8/4
- */
-package org.springblade.jobtask;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import lombok.extern.slf4j.Slf4j;
-import org.glassfish.jersey.internal.guava.ThreadFactoryBuilder;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.modules.business.data.dto.RtuDataRainDTO;
-import org.springblade.modules.business.data.entity.*;
-import org.springblade.modules.business.data.service.*;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.*;
-
-/***
- * Date:2023/8/4
- * Title: 雨量统计
- * Description:统计雨量5分钟数据,生成1小时、3小时、6小时、12小时及24小时成果表
- * @author dylan
- * @version 1.0
- * Remark:认为有必要的其他信息
- */
-@Slf4j
-@Component
-@EnableScheduling
-public class RainDataCountProcessor {
-
-	private static ThreadFactory rainDataCountThreadFactory = new ThreadFactoryBuilder().setNameFormat("rain-data-count-thread-pool-%d").build();
-	private static ExecutorService rainDataCountThreadPool = new ThreadPoolExecutor(1, 1,
-		0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), rainDataCountThreadFactory, new ThreadPoolExecutor.AbortPolicy());
-
-	@Resource
-	private IRtuDataRainH1Service h1Service;
-
-	@Resource
-	private IRtuDataRainH3Service h3Service;
-
-	@Resource
-	private IRtuDataRainH6Service h6Service;
-
-	@Resource
-	private IRtuDataRainH12Service h12Service;
-
-	@Resource
-	private IRtuDataRainH24Service h24Service;
-
-	@Resource
-	private IRtuDataRainStoreService rainStoreService;
-
-	@Resource
-	private IRtuDataRainService rainService;
-
-	@Value("${spring.task-config.rain-count-task}")
-	private boolean rainCountTaskRun;
-
-//	@Scheduled(cron = "0 0/5 * * * * ")
-	public void rainDataCountTask() {
-		try {
-			if (rainCountTaskRun) {
-				Date dt = new Date();
-				log.info("雨量统计任务创建 {}", Func.formatDateTime(dt));
-				RainDataCountTask task = new RainDataCountTask(dt);
-				FutureTask<Integer> futureTask = new FutureTask<>(task);
-				rainDataCountThreadPool.execute(futureTask);
-			}
-		} catch (Exception e) {
-			log.error("{}", e.getMessage());
-		}
-	}
-
-	private RtuDataRainH1Entity updateH1RainData(Date countTime, String rtuCode, Double drp) {
-		try {
-			LambdaQueryWrapper<RtuDataRainH1Entity> rainh1Wrapper = Wrappers.<RtuDataRainH1Entity>query().lambda();
-			rainh1Wrapper.eq(RtuDataRainH1Entity::getIsDeleted, 0);
-			rainh1Wrapper.eq(RtuDataRainH1Entity::getRtuCode, rtuCode);
-			RtuDataRainH1Entity rainH1Entity = h1Service.getOne(rainh1Wrapper);
-			if (null == rainH1Entity) {
-				rainH1Entity = new RtuDataRainH1Entity();
-				rainH1Entity.setRtuCode(rtuCode);
-			}
-			rainH1Entity.setDrp(drp);
-			rainH1Entity.setTm(countTime);
-			rainH1Entity.setFromTime(countTime);
-			return rainH1Entity;
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return null;
-		}
-	}
-
-	private RtuDataRainH3Entity updateH3RainData(Date countTime, String rtuCode, Double drp) {
-		try {
-			LambdaQueryWrapper<RtuDataRainH3Entity> rainh3Wrapper = Wrappers.<RtuDataRainH3Entity>query().lambda();
-			rainh3Wrapper.eq(RtuDataRainH3Entity::getIsDeleted, 0);
-			rainh3Wrapper.eq(RtuDataRainH3Entity::getRtuCode, rtuCode);
-			RtuDataRainH3Entity rainH3Entity = h3Service.getOne(rainh3Wrapper);
-			if (null == rainH3Entity) {
-				rainH3Entity = new RtuDataRainH3Entity();
-				rainH3Entity.setRtuCode(rtuCode);
-			}
-			rainH3Entity.setDrp(drp);
-			rainH3Entity.setTm(countTime);
-			rainH3Entity.setFromTime(countTime);
-			return rainH3Entity;
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return null;
-		}
-	}
-
-	private RtuDataRainH6Entity updateH6RainData(Date countTime, String rtuCode, Double drp) {
-		try {
-			LambdaQueryWrapper<RtuDataRainH6Entity> rainh6Wrapper = Wrappers.<RtuDataRainH6Entity>query().lambda();
-			rainh6Wrapper.eq(RtuDataRainH6Entity::getIsDeleted, 0);
-			rainh6Wrapper.eq(RtuDataRainH6Entity::getRtuCode, rtuCode);
-			RtuDataRainH6Entity rainH6Entity = h6Service.getOne(rainh6Wrapper);
-			if (null == rainH6Entity) {
-				rainH6Entity = new RtuDataRainH6Entity();
-				rainH6Entity.setRtuCode(rtuCode);
-			}
-			rainH6Entity.setDrp(drp);
-			rainH6Entity.setTm(countTime);
-			rainH6Entity.setFromTime(countTime);
-			return rainH6Entity;
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return null;
-		}
-	}
-
-	private RtuDataRainH12Entity updateH12RainData(Date countTime, String rtuCode, Double drp) {
-		try {
-			LambdaQueryWrapper<RtuDataRainH12Entity> rainh12Wrapper = Wrappers.<RtuDataRainH12Entity>query().lambda();
-			rainh12Wrapper.eq(RtuDataRainH12Entity::getIsDeleted, 0);
-			rainh12Wrapper.eq(RtuDataRainH12Entity::getRtuCode, rtuCode);
-			RtuDataRainH12Entity rainH12Entity = h12Service.getOne(rainh12Wrapper);
-			if (null == rainH12Entity) {
-				rainH12Entity = new RtuDataRainH12Entity();
-				rainH12Entity.setRtuCode(rtuCode);
-			}
-			rainH12Entity.setDrp(drp);
-			rainH12Entity.setTm(countTime);
-			rainH12Entity.setFromTime(countTime);
-			return rainH12Entity;
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return null;
-		}
-	}
-
-	private RtuDataRainH24Entity updateH24RainData(Date countTime, String rtuCode, Double drp) {
-		try {
-			LambdaQueryWrapper<RtuDataRainH24Entity> rainh24Wrapper = Wrappers.<RtuDataRainH24Entity>query().lambda();
-			rainh24Wrapper.eq(RtuDataRainH24Entity::getIsDeleted, 0);
-			rainh24Wrapper.eq(RtuDataRainH24Entity::getRtuCode, rtuCode);
-			RtuDataRainH24Entity rainH24Entity = h24Service.getOne(rainh24Wrapper);
-			if (null == rainH24Entity) {
-				rainH24Entity = new RtuDataRainH24Entity();
-				rainH24Entity.setRtuCode(rtuCode);
-			}
-			rainH24Entity.setDrp(drp);
-			rainH24Entity.setTm(countTime);
-			rainH24Entity.setFromTime(countTime);
-			return rainH24Entity;
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return null;
-		}
-	}
-
-	private class RainDataCountTask implements Callable<Integer> {
-
-		private Date countTime;
-
-		public RainDataCountTask(Date countTime) {
-			this.countTime = countTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			try {
-				log.info("雨量统计任务开始执行 {}", Func.formatDateTime(countTime));
-				LambdaQueryWrapper<RtuDataRainEntity> dataWrapper = Wrappers.<RtuDataRainEntity>query().lambda();
-				dataWrapper.eq(RtuDataRainEntity::getIsDeleted, 0);
-				List<RtuDataRainEntity> list = rainService.list(dataWrapper);
-				if (null != list && list.size() > 0) {
-					List<RtuDataRainH1Entity> h1EntityList = new LinkedList<>();
-					List<RtuDataRainH3Entity> h3EntityList = new LinkedList<>();
-					List<RtuDataRainH6Entity> h6EntityList = new LinkedList<>();
-					List<RtuDataRainH12Entity> h12EntityList = new LinkedList<>();
-					List<RtuDataRainH24Entity> h24EntityList = new LinkedList<>();
-					Calendar calendar = Calendar.getInstance();
-					//近1小时
-					calendar.setTime(countTime);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.add(Calendar.HOUR_OF_DAY, -1);
-					log.info("近1小时统计时间 {}", Func.formatDateTime(calendar.getTime()));
-					Date h1Time = calendar.getTime();
-					//近3小时
-					calendar.setTime(countTime);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.add(Calendar.HOUR_OF_DAY, -3);
-					log.info("近3小时统计时间 {}", Func.formatDateTime(calendar.getTime()));
-					Date h3Time = calendar.getTime();
-					//近6小时
-					calendar.setTime(countTime);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.add(Calendar.HOUR_OF_DAY, -6);
-					log.info("近6小时统计时间 {}", Func.formatDateTime(calendar.getTime()));
-					Date h6Time = calendar.getTime();
-					//近12小时
-					calendar.setTime(countTime);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.add(Calendar.HOUR_OF_DAY, -12);
-					log.info("近12小时统计时间 {}", Func.formatDateTime(calendar.getTime()));
-					Date h12Time = calendar.getTime();
-					//近24小时
-					calendar.setTime(countTime);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.add(Calendar.HOUR_OF_DAY, -24);
-					log.info("近24小时统计时间 {}", Func.formatDateTime(countTime));
-					Date h24Time = calendar.getTime();
-					for (RtuDataRainEntity entity : list) {
-						//log.info("upcount code {}", entity.getRtuCode());
-						Double h1Drp = 0.0;
-						Double h3Drp = 0.0;
-						Double h6Drp = 0.0;
-						Double h12Drp = 0.0;
-						Double h24Drp = 0.0;
-
-//						RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-//						dataRainDTO.setRtuCode(entity.getRtuCode());
-//						dataRainDTO.setBeginTime(h1Time);
-//						Double drp = rainStoreService.rainDrpCount(dataRainDTO);
-//						if (null != drp) {
-//							h1Drp = drp;
-//						}
-//						dataRainDTO.setBeginTime(h3Time);
-//						drp = rainStoreService.rainDrpCount(dataRainDTO);
-//						if (null != drp) {
-//							h3Drp = drp;
-//						}
-//						dataRainDTO.setBeginTime(h6Time);
-//						drp = rainStoreService.rainDrpCount(dataRainDTO);
-//						if (null != drp) {
-//							h6Drp = drp;
-//						}
-//						dataRainDTO.setBeginTime(h12Time);
-//						drp = rainStoreService.rainDrpCount(dataRainDTO);
-//						if (null != drp) {
-//							h12Drp = drp;
-//						}
-//						dataRainDTO.setBeginTime(h24Time);
-//						drp = rainStoreService.rainDrpCount(dataRainDTO);
-//						if (null != drp) {
-//							h24Drp = drp;
-//						}
-
-
-						RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-						dataRainDTO.setRtuCode(entity.getRtuCode());
-						dataRainDTO.setBeginTime(h24Time);
-						List<RtuDataRainStoreEntity> rainStoreEntityList = rainStoreService.selectList(dataRainDTO);
-						if (rainStoreEntityList != null && rainStoreEntityList.size() > 0) {
-							for (RtuDataRainStoreEntity rainStoreEntity : rainStoreEntityList) {
-								//近1小时
-								if (rainStoreEntity.getTm().after(h1Time)) {
-									h1Drp += rainStoreEntity.getDrp();
-								}
-								//近3小时
-								if (rainStoreEntity.getTm().after(h3Time)) {
-									h3Drp += rainStoreEntity.getDrp();
-								}
-								//近6小时
-								if (rainStoreEntity.getTm().after(h6Time)) {
-									h6Drp += rainStoreEntity.getDrp();
-								}
-								//近12小时
-								if (rainStoreEntity.getTm().after(h12Time)) {
-									h12Drp += rainStoreEntity.getDrp();
-								}
-								//近24小时
-								h24Drp += rainStoreEntity.getDrp();
-							}
-						}
-
-						RtuDataRainH1Entity h1Entity = updateH1RainData(countTime, entity.getRtuCode(), h1Drp);
-						if (h1Entity != null) {
-							h1EntityList.add(h1Entity);
-						}
-						RtuDataRainH3Entity h3Entity = updateH3RainData(countTime, entity.getRtuCode(), h3Drp);
-						if (h3Entity != null) {
-							h3EntityList.add(h3Entity);
-						}
-						RtuDataRainH6Entity h6Entity = updateH6RainData(countTime, entity.getRtuCode(), h6Drp);
-						if (h6Entity != null) {
-							h6EntityList.add(h6Entity);
-						}
-						RtuDataRainH12Entity h12Entity = updateH12RainData(countTime, entity.getRtuCode(), h12Drp);
-						if (h12Entity != null) {
-							h12EntityList.add(h12Entity);
-						}
-						RtuDataRainH24Entity h24Entity = updateH24RainData(countTime, entity.getRtuCode(), h24Drp);
-						if (h24Entity != null) {
-							h24EntityList.add(h24Entity);
-						}
-					}
-					h1Service.saveOrUpdateBatch(h1EntityList);
-					h3Service.saveOrUpdateBatch(h3EntityList);
-					h6Service.saveOrUpdateBatch(h6EntityList);
-					h12Service.saveOrUpdateBatch(h12EntityList);
-					h24Service.saveOrUpdateBatch(h24EntityList);
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				log.error("雨量数据统计任务异常 {}", e.getMessage());
-			} finally {
-				log.error("雨量数据统计任务完成 {} 毫秒", System.currentTimeMillis() - countTime.getTime());
-			}
-			return 0;
-		}
-	}
-}

+ 0 - 725
NMSZYYWXT/src/main/java/org/springblade/jobtask/ReportCountProcessor.java

@@ -1,725 +0,0 @@
-/**
- * Copyright 2019 DH
- * All right reserved.
- * 项目名称: 山洪灾害运维系统
- * 创建日期:2023/8/7
- */
-package org.springblade.jobtask;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import lombok.extern.slf4j.Slf4j;
-import org.glassfish.jersey.internal.guava.ThreadFactoryBuilder;
-import org.springblade.constant.BusinessConstant;
-import org.springblade.constant.DictBusinessConstant;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.enums.OrderCloseEnum;
-import org.springblade.enums.OrderConfirmEnum;
-import org.springblade.enums.OrderStatusEnum;
-import org.springblade.enums.WarnKindEnum;
-import org.springblade.modules.baseinfo.dict.entity.DictInfoEntity;
-import org.springblade.modules.baseinfo.dict.service.IBaseInfoDictService;
-import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
-import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
-import org.springblade.modules.baseinfo.region.entity.RegionInfoEntity;
-import org.springblade.modules.baseinfo.region.service.IBaseInfoRegionService;
-import org.springblade.modules.baseinfo.rtu.dto.RtuInfoDTO;
-import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
-import org.springblade.modules.business.check.order.dto.CheckOrderInfoDTO;
-import org.springblade.modules.business.check.order.service.IRtuCheckOrderService;
-import org.springblade.modules.business.check.process.service.IRtuOrderProcessService;
-import org.springblade.modules.business.check.process.vo.OrderProcessInfoVO;
-import org.springblade.modules.business.rtumanage.dto.RtuStatusDTO;
-import org.springblade.modules.business.rtumanage.service.IRtuManageService;
-import org.springblade.modules.business.warning.dto.RtuWarningInfoDTO;
-import org.springblade.modules.business.warning.entity.RtuWarningInfoEntity;
-import org.springblade.modules.business.warning.service.IRtuWarningService;
-import org.springblade.modules.report.entity.*;
-import org.springblade.modules.report.service.*;
-import org.springblade.modules.system.entity.Dept;
-import org.springblade.modules.system.service.IDeptService;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.*;
-
-/***
- * Date:2023/8/7
- * Title:报表统计
- * Description:按自治区进行周报统计、按盟市统计维修任务信息
- * @author dylan
- * @version 1.0
- * Remark:认为有必要的其他信息
- */
-@Slf4j
-@Component
-@EnableScheduling
-public class ReportCountProcessor {
-	private static ThreadFactory reportCountThreadFactory = new ThreadFactoryBuilder().setNameFormat("report-count-thread-pool-%d").build();
-	private static ExecutorService reportCountThreadPool = new ThreadPoolExecutor(1, 1,
-		0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), reportCountThreadFactory, new ThreadPoolExecutor.AbortPolicy());
-
-
-	@Resource
-	private IWeekOrgCountService weekReportService;
-
-	@Resource
-	private IWeekOrgRtuFailureService weekOrgRtuFailureService;
-
-	@Resource
-	private IWeekOrgCheckOrderService weekOrgCheckOrderService;
-
-	@Resource
-	private IWeekOrgRtuUpService weekOrgRtuUpService;
-
-	@Resource
-	private IWeekOrgCheckOrderReportService weekOrgCheckOrderReportService;
-
-	@Resource
-	private IWeekOrgEquipmentReplaceService weekOrgEquipmentReplaceService;
-
-	@Resource
-	private IWeekOrgCheckOrderDayService orgCheckOrderDayService;
-
-	@Resource
-	private IRtuBaseInfoService rtuBaseInfoService;
-
-	@Resource
-	private IRtuCheckOrderService checkOrderService;
-
-	@Resource
-	private IRtuOrderProcessService orderProcessService;
-
-	@Resource
-	private IRtuWarningService rtuWarningService;
-
-	@Resource
-	private IBaseInfoDictService dictService;
-
-	@Resource
-	private IDeptRegionService deptRegionService;
-
-	@Resource
-	private IBaseInfoRegionService regionService;
-
-	@Resource
-	private IDeptService deptService;
-
-	@Resource
-	private IRtuManageService rtuManageService;
-
-	@Value("${spring.task-config.report-task}")
-	private boolean reportTaskRun;
-
-//	@Scheduled(cron = "10 0 0 * * MON")
-	public void reportWeekOrgCountTask() {
-		if (reportTaskRun) {
-			Date dt = new Date();
-			log.info("周报表统计任务创建 {}", Func.formatDateTime(dt));
-			WeekOrgCountTask task = new WeekOrgCountTask(dt);
-			FutureTask<Integer> futureTask = new FutureTask<>(task);
-			reportCountThreadPool.execute(futureTask);
-		}
-	}
-
-//	@Scheduled(cron = "20 0 0 0/1 * *")
-	public void reportWeekOrgOrderDayCountTask() {
-		if (reportTaskRun) {
-			Date dt = new Date();
-			log.info("盟市按日维修任务数据统计任务创建 {}", Func.formatDateTime(dt));
-			WeekOrgDayCountTask task = new WeekOrgDayCountTask(dt);
-			FutureTask<Integer> futureTask = new FutureTask<>(task);
-			reportCountThreadPool.execute(futureTask);
-		}
-	}
-
-//	@Scheduled(cron = "30 0 0 1 * * ")
-	public void reportMonthCountTask() {
-		try {
-			if (reportTaskRun) {
-				Date dt = new Date();
-				log.info("月统计任务创建 {}", Func.formatDateTime(dt));
-			}
-		} catch (Exception e) {
-			log.error("{}", e.getMessage());
-		}
-	}
-
-	private class WeekOrgDayCountTask implements Callable<Integer> {
-		private Date reportTime;
-
-		public WeekOrgDayCountTask(Date reportTime) {
-			this.reportTime = reportTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			try {
-				log.info("盟市周统计,按天统计维修任务 {} {}", Func.formatDateTime(reportTime), Func.formatDateTime(new Date()));
-				Calendar calendar = Calendar.getInstance();
-				calendar.setTime(reportTime);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				calendar.set(Calendar.MILLISECOND, 0);
-				calendar.add(Calendar.DAY_OF_MONTH, -1);
-				log.info("统计日期  {}", Func.formatDateTime(calendar.getTime()));
-				LambdaQueryWrapper<WeekOrgCheckOrderDayInfoEntity> wrapper = Wrappers.<WeekOrgCheckOrderDayInfoEntity>query().lambda();
-				wrapper.eq(WeekOrgCheckOrderDayInfoEntity::getIsDeleted, 0);
-				wrapper.eq(WeekOrgCheckOrderDayInfoEntity::getCountTime, calendar.getTime());
-				long size = orgCheckOrderDayService.count(wrapper);
-				if (size == 0) {
-					calendar.setTime(reportTime);
-					calendar.set(Calendar.HOUR_OF_DAY, 0);
-					calendar.set(Calendar.MINUTE, 0);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.set(Calendar.MILLISECOND, 0);
-					Date endTm = calendar.getTime();
-					calendar.add(Calendar.DAY_OF_MONTH, -1);
-					int day = calendar.get(Calendar.DAY_OF_WEEK);
-					String weekName = "";
-					if (1 == day) {
-						weekName = "周日";
-					} else if (2 == day) {
-						weekName = "周一";
-					} else if (3 == day) {
-						weekName = "周二";
-					} else if (4 == day) {
-						weekName = "周三";
-					} else if (5 == day) {
-						weekName = "周四";
-					} else if (6 == day) {
-						weekName = "周五";
-					} else if (7 == day) {
-						weekName = "周六";
-					}
-					Date startTm = calendar.getTime();
-					log.info("统计日期区间  {} {}", Func.formatDateTime(startTm), Func.formatDateTime(endTm));
-					String adCode = BusinessConstant.REGION_NM_ADCODE;
-					WeekOrgCheckOrderDayInfoEntity dayInfoEntity = new WeekOrgCheckOrderDayInfoEntity();
-					dayInfoEntity.setCountTime(calendar.getTime());
-					dayInfoEntity.setWeekName(weekName);
-					//任务总数
-					CheckOrderInfoDTO checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportEndDate(endTm);
-					long count = checkOrderService.orderCount(checkOrderInfoDTO);
-					dayInfoEntity.setOrderCount((int) count);
-
-					//未确认任务
-					checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CREATE.getCode());
-					checkOrderInfoDTO.setReportEndDate(endTm);
-					count = checkOrderService.orderCount(checkOrderInfoDTO);
-					dayInfoEntity.setUnconfirmOrderCount((int) count);
-
-					//处理中任务
-					checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
-					checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-					checkOrderInfoDTO.setReportEndDate(endTm);
-					DictInfoEntity biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_CONFIRM.getCode());
-					if (biz != null) {
-						checkOrderInfoDTO.setOrderStatusKey(biz.getId());
-					}
-					long unCloseOrderCount = checkOrderService.unCloseOrderCount(checkOrderInfoDTO);
-					dayInfoEntity.setProcessingOrderCount((int) unCloseOrderCount);
-
-					//已处理维修任务数量
-					checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
-					checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-					checkOrderInfoDTO.setReportStartDate(startTm);
-					checkOrderInfoDTO.setReportEndDate(endTm);
-					DictInfoEntity orderProcessDict = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
-					if (orderProcessDict != null) {
-						checkOrderInfoDTO.setOrderStatusKey(orderProcessDict.getId());
-					}
-					long reports = checkOrderService.reportCount(checkOrderInfoDTO);
-					dayInfoEntity.setReportOrderCount((int) reports);
-
-					orgCheckOrderDayService.save(dayInfoEntity);
-				}
-
-			} catch (Exception e) {
-				e.printStackTrace();
-				log.error(e.getMessage());
-			} finally {
-				log.info("盟市周统计,按天统计维修任务,运行完成 {}", Func.formatDateTime(new Date()));
-			}
-			return 0;
-		}
-	}
-
-	private class WeekOrgCountTask implements Callable<Integer> {
-
-		private Date reportTime;
-
-		public WeekOrgCountTask(Date reportTime) {
-			this.reportTime = reportTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			try {
-				log.info("盟市周统计 {} {}", Func.formatDateTime(reportTime), Func.formatDateTime(new Date()));
-				Calendar calendar = Calendar.getInstance();
-				calendar.setTime(reportTime);
-				calendar.add(Calendar.WEEK_OF_MONTH, 0);
-				calendar.set(Calendar.DAY_OF_WEEK, 2);
-				calendar.set(Calendar.HOUR_OF_DAY, 0);
-				calendar.set(Calendar.MINUTE, 0);
-				calendar.set(Calendar.SECOND, 0);
-				calendar.set(Calendar.MILLISECOND, 0);
-				//统计第几周
-				int week = calendar.get(Calendar.WEEK_OF_MONTH);
-				if (week == 1) {
-					week = 4;
-				} else {
-					week = week - 1;
-				}
-				LambdaQueryWrapper<WeekOrgCountInfoEntity> wrapper = Wrappers.<WeekOrgCountInfoEntity>query().lambda();
-				wrapper.eq(WeekOrgCountInfoEntity::getIsDeleted, 0);
-				wrapper.eq(WeekOrgCountInfoEntity::getReportTime, calendar.getTime());
-				List<WeekOrgCountInfoEntity> weekReportInfoEntityList = weekReportService.list(wrapper);
-				if (null == weekReportInfoEntityList || weekReportInfoEntityList.size() == 0) {
-					String adCode = BusinessConstant.REGION_NM_ADCODE;
-					//生成周报主记录
-					WeekOrgCountInfoEntity entity = new WeekOrgCountInfoEntity();
-					entity.setName("weekorgcount.ureport.xml");
-					entity.setReportTime(calendar.getTime());
-					SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy年MM月dd日");
-					calendar.setTime(reportTime);
-					calendar.add(Calendar.WEEK_OF_MONTH, -1);
-					calendar.set(Calendar.DAY_OF_WEEK, 2);
-					calendar.set(Calendar.HOUR_OF_DAY, 0);
-					calendar.set(Calendar.MINUTE, 0);
-					calendar.set(Calendar.SECOND, 0);
-					calendar.set(Calendar.MILLISECOND, 0);
-					entity.setReportStartTime(calendar.getTime());
-					String weekTm1 = timeFormat.format(calendar.getTime());
-					calendar.add(Calendar.DAY_OF_MONTH, 6);
-					String weekTm2 = timeFormat.format(calendar.getTime());
-					calendar.add(Calendar.DAY_OF_MONTH, 1);
-					entity.setReportEndTime(calendar.getTime());
-					entity.setReportTitle("统计时间:" + weekTm1 + "-" + weekTm2 + "第" + week + "周");
-					//测站总数
-					RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
-					rtuInfoDTO.setAdCode(adCode);
-					long rtuCount = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-					entity.setRtuCount((int) rtuCount);
-					//任务总数
-					CheckOrderInfoDTO checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-					checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-					long count = checkOrderService.orderCount(checkOrderInfoDTO);
-					entity.setCheckOrderCount((int) count);
-					//未确认任务
-					checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-					checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CREATE.getCode());
-					count = checkOrderService.orderCount(checkOrderInfoDTO);
-					entity.setUnconfirmOrderCount((int) count);
-					//处理中任务
-					checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-					checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
-					checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-					DictInfoEntity biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_CONFIRM.getCode());
-					if (biz != null) {
-						checkOrderInfoDTO.setOrderStatusKey(biz.getId());
-					}
-					count = checkOrderService.orderCount(checkOrderInfoDTO);
-					entity.setProcessingOrderCount((int) count);
-					//本周已处理维修任务数量
-					checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportStartDate(entity.getReportStartTime());
-					checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-					count = checkOrderService.orderReportCount(checkOrderInfoDTO);
-					entity.setReportCheckOrderCount((int) count);
-					//异常测站
-					RtuWarningInfoDTO warningInfoDTO = new RtuWarningInfoDTO();
-					warningInfoDTO.setAdCode(adCode);
-					warningInfoDTO.setEndDate(entity.getReportEndTime());
-					long warnCount = rtuWarningService.warningRtuCount(warningInfoDTO);
-					entity.setWarnRtuCount((int) warnCount);
-					//离线测站
-					warningInfoDTO = new RtuWarningInfoDTO();
-					warningInfoDTO.setAdCode(adCode);
-					warningInfoDTO.setEndDate(entity.getReportEndTime());
-					long offlineCount = rtuWarningService.warningOfflineRtuCount(warningInfoDTO);
-					entity.setOfflineRtuCount((int) offlineCount);
-					//其他异常测站
-					entity.setOthersWarnRtuCount((int) (warnCount - offlineCount));
-					weekReportService.save(entity);
-
-					//统计一周故障
-					Map<String, Integer> failureCountMap = new HashMap<>();
-					failureCountMap.put("rtu", 0);
-					failureCountMap.put("rainSensor", 0);
-					failureCountMap.put("waterLevelSensor", 0);
-					failureCountMap.put("groundLevelSensor", 0);
-					failureCountMap.put("bt", 0);
-					failureCountMap.put("sun", 0);
-					failureCountMap.put("net", 0);
-					failureCountMap.put("signl", 0);
-					checkOrderInfoDTO = new CheckOrderInfoDTO();
-					checkOrderInfoDTO.setAdCode(adCode);
-					checkOrderInfoDTO.setReportStartDate(entity.getReportStartTime());
-					checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-					DictInfoEntity orderProcessDict = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_PROCESS.getCode());
-					if (orderProcessDict != null) {
-						checkOrderInfoDTO.setOrderStatusKey(orderProcessDict.getId());
-					}
-					List<OrderProcessInfoVO> processInfoVOList = orderProcessService.selectReportList(checkOrderInfoDTO);
-					if (null != processInfoVOList && processInfoVOList.size() > 0) {
-						for (OrderProcessInfoVO processInfoVO : processInfoVOList) {
-							StringBuilder stringBuffer = new StringBuilder();
-							if (null != processInfoVO.getRtuStatus() && processInfoVO.getRtuStatus() == 1) {
-								stringBuffer.append("站点故障;");
-							}
-							if (null != processInfoVO.getRtuReplace() && processInfoVO.getRtuReplace() == 1) {
-								int v = failureCountMap.get("rtu");
-								v += 1;
-								failureCountMap.put("rtu", v);
-								stringBuffer.append("更换RTU;");
-							}
-							if (null != processInfoVO.getRainSensorReplace() && processInfoVO.getRainSensorReplace() == 1) {
-								int v = failureCountMap.get("rainSensor");
-								v += 1;
-								failureCountMap.put("rainSensor", v);
-								stringBuffer.append("更换雨量计;");
-							}
-							if (null != processInfoVO.getWaterSensorReplace() && processInfoVO.getWaterSensorReplace() == 1) {
-								int v = failureCountMap.get("waterLevelSensor");
-								v += 1;
-								failureCountMap.put("waterLevelSensor", v);
-								stringBuffer.append("更换水位计;");
-							}
-							if (null != processInfoVO.getGroundSensorReplace() && processInfoVO.getGroundSensorReplace() == 1) {
-								int v = failureCountMap.get("groundLevelSensor");
-								v += 1;
-								failureCountMap.put("groundLevelSensor", v);
-								stringBuffer.append("更换墒情计;");
-							}
-							if (null != processInfoVO.getBatteryReplace() && processInfoVO.getBatteryReplace() == 1) {
-								int v = failureCountMap.get("bt");
-								v += 1;
-								failureCountMap.put("bt", v);
-								stringBuffer.append("更换蓄电池;");
-							}
-							if (null != processInfoVO.getSunPowerReplace() && processInfoVO.getSunPowerReplace() == 1) {
-								int v = failureCountMap.get("sun");
-								v += 1;
-								failureCountMap.put("sun", v);
-								stringBuffer.append("更换太阳能板;");
-							}
-							if (null != processInfoVO.getNetworkOverdue() && processInfoVO.getNetworkOverdue() == 1) {
-								int v = failureCountMap.get("net");
-								v += 1;
-								failureCountMap.put("net", v);
-								stringBuffer.append("物联网卡欠费;");
-							}
-							if (null != processInfoVO.getNetworkStatus() && processInfoVO.getNetworkStatus() == 1) {
-								int v = failureCountMap.get("signl");
-								v += 1;
-								failureCountMap.put("signl", v);
-								stringBuffer.append("网络故障;");
-							}
-
-							//一周站点维修信息清单
-							WeekOrgCheckOrderReportInfoEntity reportInfoEntity = new WeekOrgCheckOrderReportInfoEntity();
-							reportInfoEntity.setReportId(entity.getId());
-							reportInfoEntity.setOrgName(processInfoVO.getAdCity());
-							reportInfoEntity.setRtuName(processInfoVO.getRtuName());
-							reportInfoEntity.setOrderId(processInfoVO.getOrderId());
-							if (null != processInfoVO.getWarnId()) {
-								RtuWarningInfoEntity rtuWarningInfoEntity = rtuWarningService.getById(processInfoVO.getWarnId());
-								if (null != rtuWarningInfoEntity) {
-									String warnKinds = "";
-									if (WarnKindEnum.WARN_CLOCK.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "测站时钟异常";
-									} else if (WarnKindEnum.WARN_UP_MIN_DELAY.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "5分钟上报延时";
-									} else if (WarnKindEnum.WARN_OFFLINE.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "测站离线";
-									} else if (WarnKindEnum.WARN_RAIN_MISS_OUT.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "雨量站小时报漏报";
-									} else if (WarnKindEnum.WARN_WL_MISS_OUT.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "水位站小时报漏报";
-									} else if (WarnKindEnum.WARN_OUTLIER_VALUE.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "雨量疑似异常值";
-									} else if (WarnKindEnum.WARN_RAIN_UP_HOUR_DELAY.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "雨量站小时上报延时";
-									} else if (WarnKindEnum.WARN_WL_UP_HOUR_DELAY.getCode() == rtuWarningInfoEntity.getWarningKind()) {
-										warnKinds = "水位站小时上报延时";
-									}
-									reportInfoEntity.setWarnInfo(warnKinds);
-								}
-							}
-							if (stringBuffer.toString().length() > 0) {
-								reportInfoEntity.setProcessDesc(stringBuffer.toString());
-							} else {
-								reportInfoEntity.setProcessDesc(processInfoVO.getProcessDesc());
-							}
-							weekOrgCheckOrderReportService.save(reportInfoEntity);
-						}
-					}
-					WeekOrgRtuFailureInfoEntity failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("RTU");
-					failureInfoEntity.setFailureCount(failureCountMap.get("rtu"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("雨量计");
-					failureInfoEntity.setFailureCount(failureCountMap.get("rainSensor"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("水位计");
-					failureInfoEntity.setFailureCount(failureCountMap.get("waterLevelSensor"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("墒情计");
-					failureInfoEntity.setFailureCount(failureCountMap.get("groundLevelSensor"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("蓄电池");
-					failureInfoEntity.setFailureCount(failureCountMap.get("bt"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("太阳能板");
-					failureInfoEntity.setFailureCount(failureCountMap.get("sun"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("物联网卡欠费");
-					failureInfoEntity.setFailureCount(failureCountMap.get("net"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-					failureInfoEntity = new WeekOrgRtuFailureInfoEntity();
-					failureInfoEntity.setReportId(entity.getId());
-					failureInfoEntity.setEquipmentName("网络信号故障");
-					failureInfoEntity.setFailureCount(failureCountMap.get("signl"));
-					weekOrgRtuFailureService.save(failureInfoEntity);
-
-					//统计维修任务、上报率
-					LambdaQueryWrapper<Dept> deptwrapper = Wrappers.<Dept>query().lambda();
-					deptwrapper.eq(Dept::getIsDeleted, 0);
-					deptwrapper.eq(Dept::getParentId, BusinessConstant.DEPT_XAM_ID);
-					List<Dept> root = deptService.list(deptwrapper);
-					for (Dept dept : root) {
-						WeekOrgCheckOrderInfoEntity weekOrgCheckOrderInfoEntity = new WeekOrgCheckOrderInfoEntity();
-						weekOrgCheckOrderInfoEntity.setReportId(entity.getId());
-						weekOrgCheckOrderInfoEntity.setOrgName(dept.getDeptName());
-						LambdaQueryWrapper<DeptRegionEntity> deptLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-						deptLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, dept.getId());
-						DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptLambdaQueryWrapper);
-						LambdaQueryWrapper<RegionInfoEntity> nodeQueryWrapper = Wrappers.<RegionInfoEntity>query().lambda();
-						nodeQueryWrapper.eq(RegionInfoEntity::getAdcd, deptRegionEntity.getAdcd());
-						RegionInfoEntity nodeRegion = regionService.getOne(nodeQueryWrapper);
-						int excludecode = 0;
-						if (nodeRegion.getParentCode().equals(BusinessConstant.REGION_NM_ADCODE)) {
-							excludecode = 1;
-						}
-						//按盟市统计维修任务
-						checkOrderInfoDTO = new CheckOrderInfoDTO();
-						checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						checkOrderInfoDTO.setExcludeCode(excludecode);
-						checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-						//任务数量
-						checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-						long orderCount = checkOrderService.orderCount(checkOrderInfoDTO);
-						weekOrgCheckOrderInfoEntity.setOrderCount((int) orderCount);
-						//未确认
-						checkOrderInfoDTO = new CheckOrderInfoDTO();
-						checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						checkOrderInfoDTO.setExcludeCode(excludecode);
-						checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-						checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-						checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CREATE.getCode());
-						count = checkOrderService.unconfirmOrderCount(checkOrderInfoDTO);
-						weekOrgCheckOrderInfoEntity.setUnconfirmOrderCount((int) count);
-						//处理中
-						checkOrderInfoDTO = new CheckOrderInfoDTO();
-						checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						checkOrderInfoDTO.setExcludeCode(excludecode);
-						checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-						checkOrderInfoDTO.setOrderClose(OrderCloseEnum.ACTIVE_OPEN.getCode());
-						checkOrderInfoDTO.setOrderConfirm(OrderConfirmEnum.ACTIVE_CONFIRM.getCode());
-						biz = dictService.getDict(DictBusinessConstant.ORDER_STATUS_CODE, OrderStatusEnum.STATUS_CONFIRM.getCode());
-						if (biz != null) {
-							checkOrderInfoDTO.setOrderStatusKey(biz.getId());
-						}
-						count = checkOrderService.unCloseOrderCount(checkOrderInfoDTO);
-						weekOrgCheckOrderInfoEntity.setProcessingOrderCount((int) count);
-						//已处理
-						checkOrderInfoDTO = new CheckOrderInfoDTO();
-						checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						checkOrderInfoDTO.setExcludeCode(excludecode);
-						checkOrderInfoDTO.setReportStartDate(entity.getReportStartTime());
-						checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-						long reportCount = checkOrderService.orderReportCount(checkOrderInfoDTO);
-						weekOrgCheckOrderInfoEntity.setReportOrderCount((int) reportCount);
-						weekOrgCheckOrderService.save(weekOrgCheckOrderInfoEntity);
-
-						//盟市上报率统计
-						WeekOrgRtuUpInfoEntity weekOrgRtuUpInfoEntity = new WeekOrgRtuUpInfoEntity();
-						weekOrgRtuUpInfoEntity.setReportId(entity.getId());
-						weekOrgRtuUpInfoEntity.setOrgName(dept.getDeptName());
-						rtuInfoDTO = new RtuInfoDTO();
-						rtuInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						rtuInfoDTO.setExcludeCode(excludecode);
-						count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
-						weekOrgRtuUpInfoEntity.setRtuCount(count);
-						RtuStatusDTO rtuStatusDTO = new RtuStatusDTO();
-						rtuStatusDTO.setAdCode(deptRegionEntity.getAdcd());
-						rtuStatusDTO.setExcludeCode(excludecode);
-						rtuStatusDTO.setBeginTime(entity.getReportStartTime());
-						rtuStatusDTO.setEndTime(entity.getReportEndTime());
-						count = rtuManageService.rtuUpDataCount(rtuStatusDTO);
-						weekOrgRtuUpInfoEntity.setUpCount(count);
-						weekOrgRtuUpService.save(weekOrgRtuUpInfoEntity);
-
-						//一周站点设备更换信息
-						Map<String, Integer> orgEquipmentReplace = new HashMap<>();
-						orgEquipmentReplace.put("rtu", 0);
-						orgEquipmentReplace.put("rainSensor", 0);
-						orgEquipmentReplace.put("waterLevelSensor", 0);
-						orgEquipmentReplace.put("groundLevelSensor", 0);
-						orgEquipmentReplace.put("bt", 0);
-						orgEquipmentReplace.put("sun", 0);
-						orgEquipmentReplace.put("net", 0);
-						checkOrderInfoDTO = new CheckOrderInfoDTO();
-						checkOrderInfoDTO.setExcludeCode(excludecode);
-						checkOrderInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-						checkOrderInfoDTO.setReportStartDate(entity.getReportStartTime());
-						checkOrderInfoDTO.setReportEndDate(entity.getReportEndTime());
-						if (orderProcessDict != null) {
-							checkOrderInfoDTO.setOrderStatusKey(orderProcessDict.getId());
-						}
-						processInfoVOList = orderProcessService.selectReportList(checkOrderInfoDTO);
-						if (null != processInfoVOList && processInfoVOList.size() > 0) {
-							for (OrderProcessInfoVO processInfoVO : processInfoVOList) {
-								if (null != processInfoVO.getRtuReplace() && processInfoVO.getRtuReplace() == 1) {
-									int v = orgEquipmentReplace.get("rtu");
-									v += 1;
-									orgEquipmentReplace.put("rtu", v);
-								}
-								if (null != processInfoVO.getRainSensorReplace() && processInfoVO.getRainSensorReplace() == 1) {
-									int v = orgEquipmentReplace.get("rainSensor");
-									v += 1;
-									orgEquipmentReplace.put("rainSensor", v);
-								}
-								if (null != processInfoVO.getWaterSensorReplace() && processInfoVO.getWaterSensorReplace() == 1) {
-									int v = orgEquipmentReplace.get("waterLevelSensor");
-									v += 1;
-									orgEquipmentReplace.put("waterLevelSensor", v);
-								}
-								if (null != processInfoVO.getGroundSensorReplace() && processInfoVO.getGroundSensorReplace() == 1) {
-									int v = orgEquipmentReplace.get("groundLevelSensor");
-									v += 1;
-									orgEquipmentReplace.put("groundLevelSensor", v);
-								}
-								if (null != processInfoVO.getBatteryReplace() && processInfoVO.getBatteryReplace() == 1) {
-									int v = orgEquipmentReplace.get("bt");
-									v += 1;
-									orgEquipmentReplace.put("bt", v);
-								}
-								if (null != processInfoVO.getSunPowerReplace() && processInfoVO.getSunPowerReplace() == 1) {
-									int v = orgEquipmentReplace.get("sun");
-									v += 1;
-									orgEquipmentReplace.put("sun", v);
-								}
-								if (null != processInfoVO.getNetworkOverdue() && processInfoVO.getNetworkOverdue() == 1) {
-									int v = orgEquipmentReplace.get("net");
-									v += 1;
-									orgEquipmentReplace.put("net", v);
-								}
-							}
-						}
-						//一周站点更换信息清单
-						int replaceCount = orgEquipmentReplace.get("rtu");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("RTU");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("rainSensor");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("雨量计");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("waterLevelSensor");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("水位计");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("groundLevelSensor");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("墒情计");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("bt");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("蓄电池");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("sun");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("太阳能板");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-						replaceCount = orgEquipmentReplace.get("net");
-						if (replaceCount > 0) {
-							WeekOrgEquipmentReplaceInfoEntity equipmentReplaceInfoEntity = new WeekOrgEquipmentReplaceInfoEntity();
-							equipmentReplaceInfoEntity.setReportId(entity.getId());
-							equipmentReplaceInfoEntity.setOrgName(dept.getDeptName());
-							equipmentReplaceInfoEntity.setEquipmentName("物联网卡欠费");
-							equipmentReplaceInfoEntity.setReplaceCount(replaceCount);
-							weekOrgEquipmentReplaceService.save(equipmentReplaceInfoEntity);
-						}
-					}
-				}
-			} catch (Exception e) {
-				log.error("{}", e.getMessage());
-			} finally {
-				log.info("周统计结束 {}", Func.formatDateTime(new Date()));
-			}
-			return 0;
-		}
-	}
-}

+ 121 - 237
NMSZYYWXT/src/main/java/org/springblade/jobtask/RtuUpCountProcessor.java

@@ -1,7 +1,7 @@
 /**
  * Copyright 2019 DH
  * All right reserved.
- * 项目名称: 山洪灾害运维系统
+ * 项目名称: 运维系统
  * 创建日期:2023/8/21
  */
 package org.springblade.jobtask;
@@ -13,8 +13,8 @@ import org.glassfish.jersey.internal.guava.ThreadFactoryBuilder;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.rtu.entity.RtuInfoEntity;
 import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
-import org.springblade.modules.business.data.dto.*;
-import org.springblade.modules.business.data.service.*;
+import org.springblade.modules.business.monitor.dto.WaterFlowRateHistoryInfoDTO;
+import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
 import org.springblade.modules.business.upcount.dto.RtuUpCountInfoDTO;
 import org.springblade.modules.business.upcount.entity.RtuUpCountInfoEntity;
 import org.springblade.modules.business.upcount.service.IRtuUpCountService;
@@ -42,238 +42,122 @@ import java.util.concurrent.*;
 @Component
 @EnableScheduling
 public class RtuUpCountProcessor {
-	private static ThreadFactory upCountThreadFactory = new ThreadFactoryBuilder().setNameFormat("up-count-thread-pool-%d").build();
-	private static ExecutorService upCountThreadPool = new ThreadPoolExecutor(1, 1,
-		0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), upCountThreadFactory, new ThreadPoolExecutor.AbortPolicy());
-
-	@Resource
-	private IRtuUpCountService upCountService;
-
-	@Resource
-	private IRtuBaseInfoService rtuBaseInfoService;
-
-	@Resource
-	private IRtuDataRainStoreService rainStoreService;
-
-	@Resource
-	private IRtuDataWaterLevelStoreService waterLevelStoreService;
-
-	@Resource
-	private IRtuDataGroundStoreService groundStoreService;
-
-	@Value("${spring.task-config.rtu-datagram-up-task}")
-	private boolean rtuDatagramUpRun;
-
-
-//	@Scheduled(cron = "10 0 0/1 * * *")
-	public void upHourCountTask() {
-		if(rtuDatagramUpRun) {
-			log.info("按小时上报率统计任务创建 {}", Func.formatDateTime(new Date()));
-			UpHourCountTask task = new UpHourCountTask(LocalDateTime.now());
-			FutureTask<Integer> futureTask = new FutureTask<>(task);
-			upCountThreadPool.execute(futureTask);
-		}
-	}
-
-//	@Scheduled(cron = "20 0 0 0/1 * *")
-	public void upDayCountTask() {
-		if(rtuDatagramUpRun) {
-			log.info("按天上报率统计任务创建 {}", Func.formatDateTime(new Date()));
-			UpDayCountTask task = new UpDayCountTask(LocalDateTime.now());
-			FutureTask<Integer> futureTask = new FutureTask<>(task);
-			upCountThreadPool.execute(futureTask);
-		}
-	}
-
-	private class UpHourCountTask implements Callable<Integer> {
-		private LocalDateTime checkTime;
-
-		public UpHourCountTask(LocalDateTime checkTime) {
-			this.checkTime = checkTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-			rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-			List<RtuInfoEntity> list = rtuBaseInfoService.list(rtuWrapper);
-			for (RtuInfoEntity entity : list) {
-				//统计雨量站
-				if (entity.getIsRain() != null && entity.getIsRain() == 1) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 1);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 1);
-					LocalDateTime et = checkTime.withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusHours(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuDataRainDTO dataRainDTO = new RtuDataRainDTO();
-						dataRainDTO.setRtuCode(entity.getRtuCode());
-						dataRainDTO.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dataRainDTO.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = rainStoreService.rtuUpDataCount(dataRainDTO);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(1);
-						rtuUpCountInfoEntity.setUpKind(1);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-				//统计水位
-				if ((entity.getIsRes() != null && entity.getIsRes() == 1) || (entity.getIsRiver() != null && entity.getIsRiver() == 1)) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 1);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 3);
-					LocalDateTime et = checkTime.withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusHours(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuDataWaterLevelDTO dto = new RtuDataWaterLevelDTO();
-						dto.setRtuCode(entity.getRtuCode());
-						dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = waterLevelStoreService.rtuUpDataCount(dto);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(1);
-						rtuUpCountInfoEntity.setUpKind(3);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-				//墒情
-				if (entity.getIsGround() != null && entity.getIsGround() == 1) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 1);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 4);
-					LocalDateTime et = checkTime.withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusHours(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuDataGroundDTO dataGroundDTO = new RtuDataGroundDTO();
-						dataGroundDTO.setRtuCode(entity.getRtuCode());
-						dataGroundDTO.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dataGroundDTO.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = groundStoreService.rtuUpDataCount(dataGroundDTO);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(1);
-						rtuUpCountInfoEntity.setUpKind(4);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-			}
-			return 0;
-		}
-	}
-
-	private class UpDayCountTask implements Callable<Integer> {
-		private LocalDateTime checkTime;
-
-		public UpDayCountTask(LocalDateTime checkTime) {
-			this.checkTime = checkTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-			rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-			List<RtuInfoEntity> list = rtuBaseInfoService.list(rtuWrapper);
-			for (RtuInfoEntity entity : list) {
-				//统计雨量站
-				if (entity.getIsRain() != null && entity.getIsRain() == 1) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 2);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 1);
-					LocalDateTime et = checkTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusDays(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuUpCountInfoDTO dto = new RtuUpCountInfoDTO();
-						dto.setRtuCode(entity.getRtuCode());
-						dto.setUpKind(1);
-						dto.setTimeKind(1);
-						dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = upCountService.upCount(dto);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(2);
-						rtuUpCountInfoEntity.setUpKind(1);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-				//统计水位
-				if ((entity.getIsRes() != null && entity.getIsRes() == 1) || (entity.getIsRiver() != null && entity.getIsRiver() == 1)) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 2);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 3);
-					LocalDateTime et = checkTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusDays(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuUpCountInfoDTO dto = new RtuUpCountInfoDTO();
-						dto.setRtuCode(entity.getRtuCode());
-						dto.setUpKind(3);
-						dto.setTimeKind(1);
-						dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = upCountService.upCount(dto);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(2);
-						rtuUpCountInfoEntity.setUpKind(3);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-				//墒情
-				if (entity.getIsGround() != null && entity.getIsGround() == 1) {
-					LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
-					wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
-					wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 2);
-					wrapper.eq(RtuUpCountInfoEntity::getUpKind, 4);
-					LocalDateTime et = checkTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
-					LocalDateTime st = et.minusDays(1);
-					wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-					long count = upCountService.count(wrapper);
-					if (count == 0) {
-						RtuUpCountInfoDTO dto = new RtuUpCountInfoDTO();
-						dto.setRtuCode(entity.getRtuCode());
-						dto.setUpKind(4);
-						dto.setTimeKind(1);
-						dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
-						dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						long upCount = upCountService.upCount(dto);
-						RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
-						rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
-						rtuUpCountInfoEntity.setTimeKind(2);
-						rtuUpCountInfoEntity.setUpKind(4);
-						rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
-						rtuUpCountInfoEntity.setUpCount((int) upCount);
-						upCountService.save(rtuUpCountInfoEntity);
-					}
-				}
-			}
-			return 0;
-		}
-	}
+    private static ThreadFactory upCountThreadFactory = new ThreadFactoryBuilder().setNameFormat("up-count-thread-pool-%d").build();
+    private static ExecutorService upCountThreadPool = new ThreadPoolExecutor(1, 1,
+            0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), upCountThreadFactory, new ThreadPoolExecutor.AbortPolicy());
+
+    @Resource
+    private IRtuUpCountService upCountService;
+
+    @Resource
+    private IRtuBaseInfoService rtuBaseInfoService;
+
+    @Resource
+    private IWaterFlowRateHistoryService waterFlowRateHistoryService;
+
+    @Value("${spring.task-config.rtu-datagram-up-task}")
+    private boolean rtuDatagramUpRun;
+
+
+    @Scheduled(cron = "10 0 0/1 * * ?")
+    public void upHourCountTask() {
+        if (rtuDatagramUpRun) {
+            log.info("按小时上报率统计任务创建 {}", Func.formatDateTime(new Date()));
+            UpHourCountTask task = new UpHourCountTask(LocalDateTime.now());
+            FutureTask<Integer> futureTask = new FutureTask<>(task);
+            upCountThreadPool.execute(futureTask);
+        }
+    }
+
+    @Scheduled(cron = "20 0 0/1 * * ?")
+    public void upDayCountTask() {
+        if (rtuDatagramUpRun) {
+            log.info("按天上报率统计任务创建 {}", Func.formatDateTime(new Date()));
+            UpDayCountTask task = new UpDayCountTask(LocalDateTime.now());
+            FutureTask<Integer> futureTask = new FutureTask<>(task);
+            upCountThreadPool.execute(futureTask);
+        }
+    }
+
+    private class UpHourCountTask implements Callable<Integer> {
+        private LocalDateTime checkTime;
+
+        public UpHourCountTask(LocalDateTime checkTime) {
+            this.checkTime = checkTime;
+        }
+
+        @Override
+        public Integer call() throws Exception {
+            LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
+            rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+            List<RtuInfoEntity> list = rtuBaseInfoService.list(rtuWrapper);
+            for (RtuInfoEntity entity : list) {
+                LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
+                wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
+                wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 1);
+                wrapper.eq(RtuUpCountInfoEntity::getUpKind, 1);
+                LocalDateTime et = checkTime.withMinute(0).withSecond(0).withNano(0);
+                LocalDateTime st = et.minusHours(1);
+                wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                long count = upCountService.count(wrapper);
+                if (count == 0) {
+                    WaterFlowRateHistoryInfoDTO dto = new WaterFlowRateHistoryInfoDTO();
+                    dto.setMpcd(entity.getRtuCode());
+                    dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
+                    dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                    long upCount = waterFlowRateHistoryService.rtuUpDataCount(dto);
+                    RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
+                    rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
+                    rtuUpCountInfoEntity.setTimeKind(1);
+                    rtuUpCountInfoEntity.setUpKind(1);
+                    rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                    rtuUpCountInfoEntity.setUpCount((int) upCount);
+                    upCountService.save(rtuUpCountInfoEntity);
+                }
+            }
+            return 0;
+        }
+    }
+
+    private class UpDayCountTask implements Callable<Integer> {
+        private LocalDateTime checkTime;
+
+        public UpDayCountTask(LocalDateTime checkTime) {
+            this.checkTime = checkTime;
+        }
+
+        @Override
+        public Integer call() throws Exception {
+            LambdaQueryWrapper<RtuInfoEntity> rtuWrapper = Wrappers.<RtuInfoEntity>query().lambda();
+            rtuWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+            List<RtuInfoEntity> list = rtuBaseInfoService.list(rtuWrapper);
+            for (RtuInfoEntity entity : list) {
+                LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
+                wrapper.eq(RtuUpCountInfoEntity::getRtuCode, entity.getRtuCode());
+                wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 2);
+                wrapper.eq(RtuUpCountInfoEntity::getUpKind, 1);
+                LocalDateTime et = checkTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
+                LocalDateTime st = et.minusDays(1);
+                wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                long count = upCountService.count(wrapper);
+                if (count == 0) {
+                    RtuUpCountInfoDTO dto = new RtuUpCountInfoDTO();
+                    dto.setRtuCode(entity.getRtuCode());
+                    dto.setUpKind(1);
+                    dto.setTimeKind(1);
+                    dto.setBeginTime(Date.from(st.atZone(ZoneId.systemDefault()).toInstant()));
+                    dto.setEndTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                    long upCount = upCountService.upCount(dto);
+                    RtuUpCountInfoEntity rtuUpCountInfoEntity = new RtuUpCountInfoEntity();
+                    rtuUpCountInfoEntity.setRtuCode(entity.getRtuCode());
+                    rtuUpCountInfoEntity.setTimeKind(2);
+                    rtuUpCountInfoEntity.setUpKind(1);
+                    rtuUpCountInfoEntity.setCountTime(Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+                    rtuUpCountInfoEntity.setUpCount((int) upCount);
+                    upCountService.save(rtuUpCountInfoEntity);
+                }
+            }
+            return 0;
+        }
+    }
 }

+ 171 - 322
NMSZYYWXT/src/main/java/org/springblade/jobtask/WarnCheckProcessor.java

@@ -1,7 +1,7 @@
 /**
  * Copyright 2019 DH
  * All right reserved.
- * 项目名称: 山洪灾害运维系统
+ * 项目名称: 运维系统
  * 创建日期:2023/8/4
  */
 package org.springblade.jobtask;
@@ -40,320 +40,169 @@ import java.util.concurrent.*;
 @Component
 @EnableScheduling
 public class WarnCheckProcessor {
-	private static ThreadFactory warnCheckThreadFactory = new ThreadFactoryBuilder().setNameFormat("warn-check-thread-pool-%d").build();
-	private static ExecutorService warnCheckThreadPool = new ThreadPoolExecutor(1, 1,
-		0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), warnCheckThreadFactory, new ThreadPoolExecutor.AbortPolicy());
+    private static ThreadFactory warnCheckThreadFactory = new ThreadFactoryBuilder().setNameFormat("warn-check-thread-pool-%d").build();
+    private static ExecutorService warnCheckThreadPool = new ThreadPoolExecutor(1, 1,
+            0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), warnCheckThreadFactory, new ThreadPoolExecutor.AbortPolicy());
 
-	@Value("${spring.task-config.warning-check-task}")
-	private boolean warnCheckTaskRun;
+    @Value("${spring.task-config.warning-check-task}")
+    private boolean warnCheckTaskRun;
 
-	@Value("${spring.warn-config.delay-duration}")
-	private Integer hourDelayduration;
+    @Value("${spring.warn-config.delay-duration}")
+    private Integer hourDelayduration;
 
-	@Value("${spring.warn-config.delay-min-duration}")
-	private Integer minDelayduration;
+    @Value("${spring.warn-config.delay-min-duration}")
+    private Integer minDelayduration;
 
-	@Value("${spring.warn-config.missout}")
-	private Integer missOutNum;
+    @Value("${spring.warn-config.missout}")
+    private Integer missOutNum;
 
-	@Resource
-	private IRtuBaseInfoService rtuBaseInfoService;
+    @Resource
+    private IRtuBaseInfoService rtuBaseInfoService;
 
-	@Resource
-	private IRtuWarningService rtuWarningService;
+    @Resource
+    private IRtuWarningService rtuWarningService;
 
-	@Resource
-	private IBaseWarnSettingService warnSettingService;
+    @Resource
+    private IBaseWarnSettingService warnSettingService;
 
-	/**
-	 * 每5分钟执行一次
-	 */
-//	@Scheduled(cron = "10 0/5 * * * * ")
-	public void warnMinTask() {
-		try {
-			if (warnCheckTaskRun) {
-				log.info("雨量5分钟延时预警统计任务创建 {}", Func.formatDateTime(new Date()));
-				LocalDateTime now = LocalDateTime.now();
-				WarningCheckMinTask warningTask = new WarningCheckMinTask(now.withSecond(0).withNano(0));
-				FutureTask<Integer> futureTask = new FutureTask<>(warningTask);
-				warnCheckThreadPool.execute(futureTask);
-			}
-		} catch (Exception e) {
-			log.error("{}", e.getMessage());
-		}
-	}
+    /**
+     * 每10分钟执行一次
+     */
+    @Scheduled(cron = "20 0/10 * * * ?")
+    public void warnHourTask() {
+        try {
+            if (warnCheckTaskRun) {
+                log.info("预警统计任务创建 {}", Func.formatDateTime(new Date()));
+                LocalDateTime now = LocalDateTime.now();
+                WarningCheckTask warningTask = new WarningCheckTask(now.withSecond(0).withNano(0));
+                FutureTask<Integer> futureTask = new FutureTask<>(warningTask);
+                warnCheckThreadPool.execute(futureTask);
+            }
+        } catch (Exception e) {
+            log.error("{}", e.getMessage());
+        }
+    }
 
-	/**
-	 * 每10分钟执行一次
-	 */
-	@Scheduled(cron = "20 0/10 * * * * ")
-	public void warnHourTask() {
-		try {
-			if (warnCheckTaskRun) {
-				log.info("预警统计任务创建 {}", Func.formatDateTime(new Date()));
-				LocalDateTime now = LocalDateTime.now();
-				WarningCheckTask warningTask = new WarningCheckTask(now.withSecond(0).withNano(0));
-				FutureTask<Integer> futureTask = new FutureTask<>(warningTask);
-				warnCheckThreadPool.execute(futureTask);
-			}
-		} catch (Exception e) {
-			log.error("{}", e.getMessage());
-		}
-	}
 
-	private class WarningCheckMinTask implements Callable<Integer> {
+    private class WarningCheckTask implements Callable<Integer> {
 
-		private LocalDateTime checkTime;
+        private LocalDateTime checkTime;
 
-		public WarningCheckMinTask(LocalDateTime checkTime) {
-			this.checkTime = checkTime;
-		}
+        public WarningCheckTask(LocalDateTime checkTime) {
+            this.checkTime = checkTime;
+        }
 
-		@Override
-		public Integer call() throws Exception {
-			long startTime = System.currentTimeMillis();
-			try {
-				log.info("每5分钟预警检测任务开始执行 {}", Func.formatDateTime(checkTime));
-				//测站检测参数
-				BaseWarnSettingEntity warnSettingEntity = new BaseWarnSettingEntity();
-				//预警开关
-				warnSettingEntity.setWarnActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnClockActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnOfflineActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnMissOutActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnOutlierValueActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnHourUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnMinUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				//延时,小时
-				warnSettingEntity.setWarnRainDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnRiverDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnRsvrDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnGroundDelayHourDuration(hourDelayduration);
-				//延时,分钟
-				warnSettingEntity.setWarnRainDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnRiverDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnRsvrDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnGroundDelayMinDuration(minDelayduration);
-				//延时,离线
-				warnSettingEntity.setWarnRainOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnRiverOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnRsvrOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnGroundOfflineDuration(minDelayduration);
-				//漏报,预警数量
-				warnSettingEntity.setWarnMissNum(missOutNum);
-				//读取预警配置
-				LambdaQueryWrapper<BaseWarnSettingEntity> warnSettingWrapper = Wrappers.<BaseWarnSettingEntity>query().lambda();
-				warnSettingWrapper.eq(BaseWarnSettingEntity::getIsDeleted, 0);
-				List<BaseWarnSettingEntity> warnSettingEntityList = warnSettingService.list(warnSettingWrapper);
-				if (null != warnSettingEntityList && warnSettingEntityList.size() > 0) {
-					if (warnSettingEntityList.get(0).getWarnActive() != null) {
-						warnSettingEntity.setWarnActive(warnSettingEntityList.get(0).getWarnActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnClockActive() != null) {
-						warnSettingEntity.setWarnClockActive(warnSettingEntityList.get(0).getWarnClockActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnOfflineActive() != null) {
-						warnSettingEntity.setWarnOfflineActive(warnSettingEntityList.get(0).getWarnOfflineActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnMissOutActive() != null) {
-						warnSettingEntity.setWarnMissOutActive(warnSettingEntityList.get(0).getWarnMissOutActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnOutlierValueActive() != null) {
-						warnSettingEntity.setWarnOutlierValueActive(warnSettingEntityList.get(0).getWarnOutlierValueActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnHourUpDelayActive() != null) {
-						warnSettingEntity.setWarnHourUpDelayActive(warnSettingEntityList.get(0).getWarnHourUpDelayActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnMinUpDelayActive() != null) {
-						warnSettingEntity.setWarnMinUpDelayActive(warnSettingEntityList.get(0).getWarnMinUpDelayActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRainDelayHourDuration(warnSettingEntityList.get(0).getWarnRainDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRiverDelayHourDuration(warnSettingEntityList.get(0).getWarnRiverDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRsvrDelayHourDuration(warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundDelayHourDuration() != null) {
-						warnSettingEntity.setWarnGroundDelayHourDuration(warnSettingEntityList.get(0).getWarnGroundDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRainDelayMinDuration(warnSettingEntityList.get(0).getWarnRainDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRiverDelayMinDuration(warnSettingEntityList.get(0).getWarnRiverDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRsvrDelayMinDuration(warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundDelayMinDuration() != null) {
-						warnSettingEntity.setWarnGroundDelayMinDuration(warnSettingEntityList.get(0).getWarnGroundDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainOfflineDuration() != null) {
-						warnSettingEntity.setWarnRainOfflineDuration(warnSettingEntityList.get(0).getWarnRainOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverOfflineDuration() != null) {
-						warnSettingEntity.setWarnRiverOfflineDuration(warnSettingEntityList.get(0).getWarnRiverOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrOfflineDuration() != null) {
-						warnSettingEntity.setWarnRsvrOfflineDuration(warnSettingEntityList.get(0).getWarnRsvrOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundOfflineDuration() != null) {
-						warnSettingEntity.setWarnGroundOfflineDuration(warnSettingEntityList.get(0).getWarnGroundOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnMissNum() != null) {
-						warnSettingEntity.setWarnMissNum(warnSettingEntityList.get(0).getWarnMissNum());
-					}
-				}
-				//开始检测
-				if (warnSettingEntity.getWarnActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
-					LambdaQueryWrapper<RtuInfoEntity> dataWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-					dataWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-					dataWrapper.orderByAsc(RtuInfoEntity::getRtuCode);
-					List<RtuInfoEntity> list = rtuBaseInfoService.list(dataWrapper);
-					if (null != list && list.size() > 0) {
-						for (RtuInfoEntity entity : list) {
-							if (warnSettingEntity.getWarnMinUpDelayActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
-
-								if (entity.getIsRain() == 1) {
-									//雨量报5分钟延时检测
-									rtuWarningService.checkRtuRainUpDelayStatus(entity, warnSettingEntity, checkTime);
-								}
-							}
-						}
-					}
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				log.error("每5分钟预警检测任务异常 {}", e.getMessage());
-			} finally {
-				log.info("每5分钟预警检测任务完成 {} 毫秒", System.currentTimeMillis() - startTime);
-			}
-			return 0;
-		}
-	}
-
-	private class WarningCheckTask implements Callable<Integer> {
-
-		private LocalDateTime checkTime;
-
-		public WarningCheckTask(LocalDateTime checkTime) {
-			this.checkTime = checkTime;
-		}
-
-		@Override
-		public Integer call() throws Exception {
-			long startTime = System.currentTimeMillis();
-			try {
-				log.info("每小时预警检测任务开始执行 {}", Func.formatDateTime(checkTime));
-				//测站检测参数
-				BaseWarnSettingEntity warnSettingEntity = new BaseWarnSettingEntity();
-				//预警开关
-				warnSettingEntity.setWarnActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnClockActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnOfflineActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnMissOutActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnOutlierValueActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnHourUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				warnSettingEntity.setWarnMinUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
-				//延时,小时
-				warnSettingEntity.setWarnRainDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnRiverDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnRsvrDelayHourDuration(hourDelayduration);
-				warnSettingEntity.setWarnGroundDelayHourDuration(hourDelayduration);
-				//延时,分钟
-				warnSettingEntity.setWarnRainDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnRiverDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnRsvrDelayMinDuration(minDelayduration);
-				warnSettingEntity.setWarnGroundDelayMinDuration(minDelayduration);
-				//延时,离线
-				warnSettingEntity.setWarnRainOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnRiverOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnRsvrOfflineDuration(minDelayduration);
-				warnSettingEntity.setWarnGroundOfflineDuration(minDelayduration);
-				//漏报,预警数量
-				warnSettingEntity.setWarnMissNum(missOutNum);
-				//读取预警配置
-				LambdaQueryWrapper<BaseWarnSettingEntity> warnSettingWrapper = Wrappers.<BaseWarnSettingEntity>query().lambda();
-				warnSettingWrapper.eq(BaseWarnSettingEntity::getIsDeleted, 0);
-				List<BaseWarnSettingEntity> warnSettingEntityList = warnSettingService.list(warnSettingWrapper);
-				if (null != warnSettingEntityList && warnSettingEntityList.size() > 0) {
-					if (warnSettingEntityList.get(0).getWarnActive() != null) {
-						warnSettingEntity.setWarnActive(warnSettingEntityList.get(0).getWarnActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnClockActive() != null) {
-						warnSettingEntity.setWarnClockActive(warnSettingEntityList.get(0).getWarnClockActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnOfflineActive() != null) {
-						warnSettingEntity.setWarnOfflineActive(warnSettingEntityList.get(0).getWarnOfflineActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnMissOutActive() != null) {
-						warnSettingEntity.setWarnMissOutActive(warnSettingEntityList.get(0).getWarnMissOutActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnOutlierValueActive() != null) {
-						warnSettingEntity.setWarnOutlierValueActive(warnSettingEntityList.get(0).getWarnOutlierValueActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnHourUpDelayActive() != null) {
-						warnSettingEntity.setWarnHourUpDelayActive(warnSettingEntityList.get(0).getWarnHourUpDelayActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnMinUpDelayActive() != null) {
-						warnSettingEntity.setWarnMinUpDelayActive(warnSettingEntityList.get(0).getWarnMinUpDelayActive());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRainDelayHourDuration(warnSettingEntityList.get(0).getWarnRainDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRiverDelayHourDuration(warnSettingEntityList.get(0).getWarnRiverDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration() != null) {
-						warnSettingEntity.setWarnRsvrDelayHourDuration(warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundDelayHourDuration() != null) {
-						warnSettingEntity.setWarnGroundDelayHourDuration(warnSettingEntityList.get(0).getWarnGroundDelayHourDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRainDelayMinDuration(warnSettingEntityList.get(0).getWarnRainDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRiverDelayMinDuration(warnSettingEntityList.get(0).getWarnRiverDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration() != null) {
-						warnSettingEntity.setWarnRsvrDelayMinDuration(warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundDelayMinDuration() != null) {
-						warnSettingEntity.setWarnGroundDelayMinDuration(warnSettingEntityList.get(0).getWarnGroundDelayMinDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRainOfflineDuration() != null) {
-						warnSettingEntity.setWarnRainOfflineDuration(warnSettingEntityList.get(0).getWarnRainOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRiverOfflineDuration() != null) {
-						warnSettingEntity.setWarnRiverOfflineDuration(warnSettingEntityList.get(0).getWarnRiverOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnRsvrOfflineDuration() != null) {
-						warnSettingEntity.setWarnRsvrOfflineDuration(warnSettingEntityList.get(0).getWarnRsvrOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnGroundOfflineDuration() != null) {
-						warnSettingEntity.setWarnGroundOfflineDuration(warnSettingEntityList.get(0).getWarnGroundOfflineDuration());
-					}
-					if (warnSettingEntityList.get(0).getWarnMissNum() != null) {
-						warnSettingEntity.setWarnMissNum(warnSettingEntityList.get(0).getWarnMissNum());
-					}
-				}
-				//开始检测
-				if (warnSettingEntity.getWarnActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
-					LambdaQueryWrapper<RtuInfoEntity> dataWrapper = Wrappers.<RtuInfoEntity>query().lambda();
-					dataWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-					dataWrapper.orderByAsc(RtuInfoEntity::getRtuCode);
-					List<RtuInfoEntity> list = rtuBaseInfoService.list(dataWrapper);
-					if (null != list && list.size() > 0) {
-						for (RtuInfoEntity entity : list) {
-							boolean isOffline = false;
-							if (warnSettingEntity.getWarnOfflineActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
-								//检测离线状态
-								isOffline = rtuWarningService.checkRtuOfflineStatus(entity, warnSettingEntity, checkTime);
-							}
+        @Override
+        public Integer call() throws Exception {
+            long startTime = System.currentTimeMillis();
+            try {
+                log.info("每小时预警检测任务开始执行 {}", Func.formatDateTime(checkTime));
+                //测站检测参数
+                BaseWarnSettingEntity warnSettingEntity = new BaseWarnSettingEntity();
+                //预警开关
+                warnSettingEntity.setWarnActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnClockActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnOfflineActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnMissOutActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnOutlierValueActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnHourUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                warnSettingEntity.setWarnMinUpDelayActive(WarningActiveEnum.ACTIVE_OFF.getCode());
+                //延时,小时
+                warnSettingEntity.setWarnRainDelayHourDuration(hourDelayduration);
+                warnSettingEntity.setWarnRiverDelayHourDuration(hourDelayduration);
+                warnSettingEntity.setWarnRsvrDelayHourDuration(hourDelayduration);
+                warnSettingEntity.setWarnGroundDelayHourDuration(hourDelayduration);
+                //延时,分钟
+                warnSettingEntity.setWarnRainDelayMinDuration(minDelayduration);
+                warnSettingEntity.setWarnRiverDelayMinDuration(minDelayduration);
+                warnSettingEntity.setWarnRsvrDelayMinDuration(minDelayduration);
+                warnSettingEntity.setWarnGroundDelayMinDuration(minDelayduration);
+                //延时,离线
+                warnSettingEntity.setWarnRainOfflineDuration(minDelayduration);
+                warnSettingEntity.setWarnRiverOfflineDuration(minDelayduration);
+                warnSettingEntity.setWarnRsvrOfflineDuration(minDelayduration);
+                warnSettingEntity.setWarnGroundOfflineDuration(minDelayduration);
+                //漏报,预警数量
+                warnSettingEntity.setWarnMissNum(missOutNum);
+                //读取预警配置
+                LambdaQueryWrapper<BaseWarnSettingEntity> warnSettingWrapper = Wrappers.<BaseWarnSettingEntity>query().lambda();
+                warnSettingWrapper.eq(BaseWarnSettingEntity::getIsDeleted, 0);
+                List<BaseWarnSettingEntity> warnSettingEntityList = warnSettingService.list(warnSettingWrapper);
+                if (null != warnSettingEntityList && warnSettingEntityList.size() > 0) {
+                    if (warnSettingEntityList.get(0).getWarnActive() != null) {
+                        warnSettingEntity.setWarnActive(warnSettingEntityList.get(0).getWarnActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnClockActive() != null) {
+                        warnSettingEntity.setWarnClockActive(warnSettingEntityList.get(0).getWarnClockActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnOfflineActive() != null) {
+                        warnSettingEntity.setWarnOfflineActive(warnSettingEntityList.get(0).getWarnOfflineActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnMissOutActive() != null) {
+                        warnSettingEntity.setWarnMissOutActive(warnSettingEntityList.get(0).getWarnMissOutActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnOutlierValueActive() != null) {
+                        warnSettingEntity.setWarnOutlierValueActive(warnSettingEntityList.get(0).getWarnOutlierValueActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnHourUpDelayActive() != null) {
+                        warnSettingEntity.setWarnHourUpDelayActive(warnSettingEntityList.get(0).getWarnHourUpDelayActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnMinUpDelayActive() != null) {
+                        warnSettingEntity.setWarnMinUpDelayActive(warnSettingEntityList.get(0).getWarnMinUpDelayActive());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRainDelayHourDuration() != null) {
+                        warnSettingEntity.setWarnRainDelayHourDuration(warnSettingEntityList.get(0).getWarnRainDelayHourDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRiverDelayHourDuration() != null) {
+                        warnSettingEntity.setWarnRiverDelayHourDuration(warnSettingEntityList.get(0).getWarnRiverDelayHourDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration() != null) {
+                        warnSettingEntity.setWarnRsvrDelayHourDuration(warnSettingEntityList.get(0).getWarnRsvrDelayHourDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnGroundDelayHourDuration() != null) {
+                        warnSettingEntity.setWarnGroundDelayHourDuration(warnSettingEntityList.get(0).getWarnGroundDelayHourDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRainDelayMinDuration() != null) {
+                        warnSettingEntity.setWarnRainDelayMinDuration(warnSettingEntityList.get(0).getWarnRainDelayMinDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRiverDelayMinDuration() != null) {
+                        warnSettingEntity.setWarnRiverDelayMinDuration(warnSettingEntityList.get(0).getWarnRiverDelayMinDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration() != null) {
+                        warnSettingEntity.setWarnRsvrDelayMinDuration(warnSettingEntityList.get(0).getWarnRsvrDelayMinDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnGroundDelayMinDuration() != null) {
+                        warnSettingEntity.setWarnGroundDelayMinDuration(warnSettingEntityList.get(0).getWarnGroundDelayMinDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRainOfflineDuration() != null) {
+                        warnSettingEntity.setWarnRainOfflineDuration(warnSettingEntityList.get(0).getWarnRainOfflineDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRiverOfflineDuration() != null) {
+                        warnSettingEntity.setWarnRiverOfflineDuration(warnSettingEntityList.get(0).getWarnRiverOfflineDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnRsvrOfflineDuration() != null) {
+                        warnSettingEntity.setWarnRsvrOfflineDuration(warnSettingEntityList.get(0).getWarnRsvrOfflineDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnGroundOfflineDuration() != null) {
+                        warnSettingEntity.setWarnGroundOfflineDuration(warnSettingEntityList.get(0).getWarnGroundOfflineDuration());
+                    }
+                    if (warnSettingEntityList.get(0).getWarnMissNum() != null) {
+                        warnSettingEntity.setWarnMissNum(warnSettingEntityList.get(0).getWarnMissNum());
+                    }
+                }
+                //开始检测
+                if (warnSettingEntity.getWarnActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
+                    LambdaQueryWrapper<RtuInfoEntity> dataWrapper = Wrappers.<RtuInfoEntity>query().lambda();
+                    dataWrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+                    dataWrapper.orderByAsc(RtuInfoEntity::getRtuCode);
+                    List<RtuInfoEntity> list = rtuBaseInfoService.list(dataWrapper);
+                    if (null != list && list.size() > 0) {
+                        for (RtuInfoEntity entity : list) {
+                            boolean isOffline = false;
+                            if (warnSettingEntity.getWarnOfflineActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
+                                //检测离线状态
+                                isOffline = rtuWarningService.checkRtuOfflineStatus(entity, warnSettingEntity, checkTime);
+                            }
 //							if (warnSettingEntity.getWarnClockActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
 //								//检测测站时钟状态
 //								if (!isOffline) {
@@ -377,22 +226,22 @@ public class WarnCheckProcessor {
 //									}
 //								}
 //							}
-							if (warnSettingEntity.getWarnHourUpDelayActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
-								if (!isOffline) {
+                            if (warnSettingEntity.getWarnHourUpDelayActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
+                                if (!isOffline) {
 //									if (entity.getIsRain() == 1) {
 //										//雨量小时报延时检测
 //										rtuWarningService.checkRtuRainUpHourDelayStatus(entity, warnSettingEntity, checkTime);
 //									}
-									//if (entity.getIsRiver() == 1) {
-										//河道小时报延时检测
-										rtuWarningService.checkRtuRiverUpHourDelayStatus(entity, warnSettingEntity, checkTime);
-									//}
+                                    //if (entity.getIsRiver() == 1) {
+                                    //河道小时报延时检测
+                                    rtuWarningService.checkRtuRiverUpHourDelayStatus(entity, warnSettingEntity, checkTime);
+                                    //}
 //									if (entity.getIsRes() == 1) {
 //										//水库小时报延时检测
 //										rtuWarningService.checkRtuRsvrUpHourDelayStatus(entity, warnSettingEntity, checkTime);
 //									}
-								}
-							}
+                                }
+                            }
 //							if (warnSettingEntity.getWarnOutlierValueActive() == WarningActiveEnum.ACTIVE_OPEN.getCode()) {
 //								if (!isOffline) {
 //									if (entity.getIsRain() == 1) {
@@ -401,16 +250,16 @@ public class WarnCheckProcessor {
 //									}
 //								}
 //							}
-						}
-					}
-				}
-			} catch (Exception e) {
-				e.printStackTrace();
-				log.error("预警检测任务异常 {}", e.getMessage());
-			} finally {
-				log.info("预警检测任务完成 {} 毫秒", System.currentTimeMillis() - startTime);
-			}
-			return 0;
-		}
-	}
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("预警检测任务异常 {}", e.getMessage());
+            } finally {
+                log.info("预警检测任务完成 {} 毫秒", System.currentTimeMillis() - startTime);
+            }
+            return 0;
+        }
+    }
 }

+ 227 - 202
NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/project/controller/ProjectBaseInfoController.java

@@ -46,210 +46,235 @@ import java.util.List;
  * Remark:认为有必要的其他信息
  */
 @RestController
-@RequestMapping("galaxy-business/project/base")
+@RequestMapping("galaxy-business/base/project")
 @AllArgsConstructor
 @Api(value = "项目信息基础管理", tags = "项目信息基础管理")
 public class ProjectBaseInfoController extends BladeController {
-	private final IProjectBaseInfoService projectBaseInfoService;
-	private final IProjectWarningSettingService warningSettingService;
-	private final IDeptService deptService;
-	private final IUserService userService;
-
-	/**
-	 * 分页
-	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<IPage<ProjectInfoVO>> list(Query query) {
-		IPage<ProjectInfoEntity> pages = projectBaseInfoService.page(Condition.getPage(query));
-		return R.data(ProjectInfoWrapper.build().pageVO(pages));
-	}
-
-	@GetMapping("/org/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<List<ProjectInfoVO>> orglist() {
-		LambdaQueryWrapper<ProjectInfoEntity> wrapper = Wrappers.<ProjectInfoEntity>query().lambda();
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			wrapper.eq(ProjectInfoEntity::getOrgId, user.getDeptId());
-		}
-		wrapper.eq(ProjectInfoEntity::getIsDeleted, 0);
-		List<ProjectInfoEntity> pages = projectBaseInfoService.list(wrapper);
-		return R.data(ProjectInfoWrapper.build().listVO(pages));
-	}
-
-	/**
-	 * 多表联合查询自定义分页
-	 */
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "string"),
-
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页")
-	public R<IPage<ProjectInfoVO>> page(@ApiIgnore  ProjectInfoEntity entity, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			entity.setOrgId(Func.toLong(user.getDeptId()));
-		}
-		IPage<ProjectInfoVO> pages = projectBaseInfoService.selectPage(entity, Condition.getPage(query));
-		return R.data(pages);
-	}
-
-
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入projectInfoEntity")
-	public R<ProjectInfoVO> detail(ProjectInfoEntity projectInfoEntity) {
-		ProjectInfoEntity detail = projectBaseInfoService.getOne(Condition.getQueryWrapper(projectInfoEntity));
-		return R.data(ProjectInfoWrapper.build().entityVO(detail));
-	}
-
-
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入ProjectInfoEntity")
-	public R save(@RequestBody ProjectInfoEntity projectInfoEntity) {
-		return R.status(projectBaseInfoService.save(projectInfoEntity));
-	}
-
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入ProjectInfoEntity")
-	public R update(@RequestBody ProjectInfoEntity projectInfoEntity) {
-		return R.status(projectBaseInfoService.updateById(projectInfoEntity));
-	}
-
-	/**
-	 * 新增或修改
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入projectInfoEntity")
-	public R submit(@RequestBody ProjectInfoEntity projectInfoEntity) {
-		return R.status(projectBaseInfoService.saveOrUpdate(projectInfoEntity));
-	}
-
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		boolean temp = projectBaseInfoService.deleteLogic(Func.toLongList(ids));
-		return R.status(temp);
-	}
-
-	/**
-	 * 项目预警配置保存或修改
-	 *
-	 * @param projectInfoEntity
-	 * @return
-	 */
-	@PostMapping("/setting/warning/submit")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "id", value = "项目ID", paramType = "query", dataType = "long"),
-		@ApiImplicitParam(name = "warnActive", value = "预警开关", paramType = "query", dataType = "int"),
-		@ApiImplicitParam(name = "delayTime", value = "延时", paramType = "query", dataType = "int")
-	})
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "项目预警配置新增或修改", notes = "传入warningSettingEntity")
-	public R warningSubmit(@ApiIgnore ProjectInfoEntity projectInfoEntity) {
-		//return R.status(warningSettingService.saveOrUpdate(warningSettingEntity));
-
-		LambdaUpdateWrapper<ProjectInfoEntity> wrapper = Wrappers.<ProjectInfoEntity>update().lambda();
-		wrapper.set(ProjectInfoEntity::getWarnActive, projectInfoEntity.getWarnActive());
-		wrapper.set(ProjectInfoEntity::getDelayTime, projectInfoEntity.getDelayTime());
-		wrapper.eq(ProjectInfoEntity::getId, projectInfoEntity.getId());
-
-		this.projectBaseInfoService.update(wrapper);
-
-		return R.success("预警设置操作成功");
-	}
-
-	@GetMapping("/tree")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情")
-	public R<List<ProjectTreeNodeEntity>> projectTree() {
-		BladeUser user = AuthUtil.getUser();
-		List<ProjectTreeNodeEntity> tree = new LinkedList<>();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getParentId, 0);
-			Dept dept = this.deptService.getOne(wrapper);
-			ProjectTreeNodeEntity root = new ProjectTreeNodeEntity();
-			root.setText(dept.getDeptName());
-			root.setValue("" + dept.getId() + "-0");
-			root.setOrgId(dept.getId());
-
-			List<ProjectTreeNodeEntity> orgNode = new LinkedList<>();
-			root.setChildren(orgNode);
-			tree.add(root);
-			List<Dept> childs = this.deptService.getDeptChild(dept.getId());
-			if (null != childs && childs.size() > 0) {
-				for (Dept child : childs) {
-					ProjectTreeNodeEntity entity = new ProjectTreeNodeEntity();
-					entity.setText(child.getDeptName());
-					entity.setValue("" + child.getId() + "-0");
-					entity.setOrgId(child.getId());
-
-					List<ProjectTreeNodeEntity> projectNode = new LinkedList<>();
-					entity.setChildren(projectNode);
-					orgNode.add(entity);
-					LambdaQueryWrapper<ProjectInfoEntity> projectwrapper = Wrappers.<ProjectInfoEntity>query().lambda();
-					projectwrapper.eq(ProjectInfoEntity::getOrgId, child.getId());
-
-					List<ProjectInfoEntity> projectInfoEntities = this.projectBaseInfoService.list(projectwrapper);
-					for (ProjectInfoEntity p : projectInfoEntities) {
-						entity = new ProjectTreeNodeEntity();
-						entity.setText(p.getProjectName());
-						entity.setValue("" + child.getId() + "-" + p.getId());
-						entity.setOrgId(child.getId());
-						entity.setProjectId(p.getId());
-						projectNode.add(entity);
-					}
-				}
-			}
-
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-
-			ProjectTreeNodeEntity root = new ProjectTreeNodeEntity();
-			root.setText("北京大恒");
-			root.setValue("0");
-			List<ProjectTreeNodeEntity> projectNode = new LinkedList<>();
-			root.setChildren(projectNode);
-			tree.add(root);
-
-			ProjectTreeNodeEntity entity = new ProjectTreeNodeEntity();
-			entity.setText("赤峰市");
-			entity.setValue("1");
-			projectNode.add(entity);
-
-			entity = new ProjectTreeNodeEntity();
-			entity.setText("锡盟");
-			entity.setValue("2");
-			projectNode.add(entity);
-
-		}
-
-		return R.data(tree);
-	}
+    private final IProjectBaseInfoService projectBaseInfoService;
+    private final IProjectWarningSettingService warningSettingService;
+    private final IDeptService deptService;
+    private final IUserService userService;
+
+    /**
+     * 分页
+     */
+    @GetMapping("/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<IPage<ProjectInfoVO>> list(Query query) {
+        IPage<ProjectInfoEntity> pages = projectBaseInfoService.page(Condition.getPage(query));
+        return R.data(ProjectInfoWrapper.build().pageVO(pages));
+    }
+
+    @GetMapping("/org/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<List<ProjectInfoVO>> orglist() {
+       LambdaQueryWrapper<ProjectInfoEntity> wrapper = Wrappers.<ProjectInfoEntity>query().lambda();
+        BladeUser user = AuthUtil.getUser();
+//        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//
+//        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            wrapper.eq(ProjectInfoEntity::getOrgId, Func.toLong(user.getDeptId()));
+        //}
+       // wrapper.eq(ProjectInfoEntity::getIsDeleted, 0);
+        List<ProjectInfoEntity> pages = projectBaseInfoService.list(wrapper);
+        return R.data(ProjectInfoWrapper.build().listVO(pages));
+    }
+
+    /**
+     * 多表联合查询自定义分页
+     */
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "projectName", value = "项目名称", paramType = "query", dataType = "string"),
+
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页")
+    public R<IPage<ProjectInfoVO>> page(@ApiIgnore ProjectInfoEntity entity, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+
+        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            entity.setOrgId(Func.toLong(user.getDeptId()));
+        }
+        IPage<ProjectInfoVO> pages = projectBaseInfoService.selectPage(entity, Condition.getPage(query));
+        return R.data(pages);
+    }
+
+
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入projectInfoEntity")
+    public R<ProjectInfoVO> detail(ProjectInfoEntity projectInfoEntity) {
+        ProjectInfoEntity detail = projectBaseInfoService.getOne(Condition.getQueryWrapper(projectInfoEntity));
+        return R.data(ProjectInfoWrapper.build().entityVO(detail));
+    }
+
+
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入ProjectInfoEntity")
+    public R save(@RequestBody ProjectInfoEntity projectInfoEntity) {
+        BladeUser user = AuthUtil.getUser();
+        projectInfoEntity.setOrgId(Func.toLong(user.getDeptId()));
+        return R.status(projectBaseInfoService.save(projectInfoEntity));
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入ProjectInfoEntity")
+    public R update(@RequestBody ProjectInfoEntity projectInfoEntity) {
+        return R.status(projectBaseInfoService.updateById(projectInfoEntity));
+    }
+
+    /**
+     * 新增或修改
+     */
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "新增或修改", notes = "传入projectInfoEntity")
+    public R submit(@RequestBody ProjectInfoEntity projectInfoEntity) {
+        return R.status(projectBaseInfoService.saveOrUpdate(projectInfoEntity));
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入projectInfoEntity")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        boolean temp = projectBaseInfoService.deleteLogic(Func.toLongList(ids));
+        return R.status(temp);
+    }
+
+    /**
+     * 项目预警配置保存或修改
+     *
+     * @param projectInfoEntity
+     * @return
+     */
+    @PostMapping("/setting/warning/submit")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "项目ID", paramType = "query", dataType = "long"),
+            @ApiImplicitParam(name = "warnActive", value = "预警开关", paramType = "query", dataType = "int"),
+            @ApiImplicitParam(name = "delayTime", value = "延时", paramType = "query", dataType = "int")
+    })
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "项目预警配置新增或修改", notes = "传入warningSettingEntity")
+    public R warningSubmit(@ApiIgnore ProjectInfoEntity projectInfoEntity) {
+        //return R.status(warningSettingService.saveOrUpdate(warningSettingEntity));
+
+        LambdaUpdateWrapper<ProjectInfoEntity> wrapper = Wrappers.<ProjectInfoEntity>update().lambda();
+        wrapper.set(ProjectInfoEntity::getWarnActive, projectInfoEntity.getWarnActive());
+        wrapper.set(ProjectInfoEntity::getDelayTime, projectInfoEntity.getDelayTime());
+        wrapper.eq(ProjectInfoEntity::getId, projectInfoEntity.getId());
+
+        this.projectBaseInfoService.update(wrapper);
+
+        return R.success("预警设置操作成功");
+    }
+
+    @GetMapping("/tree")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情")
+    public R<List<ProjectTreeNodeEntity>> projectTree() {
+        BladeUser user = AuthUtil.getUser();
+        List<ProjectTreeNodeEntity> tree = new LinkedList<>();
+
+        //根节点
+        Dept dept = this.deptService.getById(Func.toLong(user.getDeptId()));
+        ProjectTreeNodeEntity root = new ProjectTreeNodeEntity();
+        root.setText(dept.getDeptName());
+        root.setTitle(dept.getDeptName());
+        root.setId("0");
+        root.setValue("0");
+        root.setKey("0");
+        root.setHasChildren(true);
+        tree.add(root);
+
+        //项目节点
+        List<ProjectTreeNodeEntity> projectNode = new LinkedList<>();
+        LambdaQueryWrapper<ProjectInfoEntity> projectwrapper = Wrappers.<ProjectInfoEntity>query().lambda();
+        projectwrapper.eq(ProjectInfoEntity::getOrgId, Func.toLong(user.getDeptId()));
+        List<ProjectInfoEntity> projectInfoEntities = this.projectBaseInfoService.list(projectwrapper);
+        for (ProjectInfoEntity p : projectInfoEntities) {
+            ProjectTreeNodeEntity entity = new ProjectTreeNodeEntity();
+            entity.setText(p.getProjectName());
+            entity.setTitle(p.getProjectName());
+            entity.setId(Func.toStr(p.getId()));
+            entity.setValue(Func.toStr(p.getId()));
+            entity.setKey(Func.toStr(p.getId()));
+            entity.setParentId("0");
+            entity.setHasChildren(false);
+            projectNode.add(entity);
+        }
+        root.setChildren(projectNode);
+
+
+//			List<Dept> childs = this.deptService.getDeptChild(dept.getId());
+//			if (null != childs && childs.size() > 0) {
+//
+//				List<ProjectTreeNodeEntity> orgNode = new LinkedList<>();
+//				root.setChildren(orgNode);
+//
+//				for (Dept child : childs) {
+//					ProjectTreeNodeEntity entity = new ProjectTreeNodeEntity();
+//					entity.setText(child.getDeptName());
+//					entity.setValue("" + child.getId() + "-0");
+//					entity.setOrgId(child.getId());
+//
+//					List<ProjectTreeNodeEntity> projectNode = new LinkedList<>();
+//					entity.setChildren(projectNode);
+//					orgNode.add(entity);
+//					LambdaQueryWrapper<ProjectInfoEntity> projectwrapper = Wrappers.<ProjectInfoEntity>query().lambda();
+//					projectwrapper.eq(ProjectInfoEntity::getOrgId, child.getId());
+//
+//					List<ProjectInfoEntity> projectInfoEntities = this.projectBaseInfoService.list(projectwrapper);
+//					for (ProjectInfoEntity p : projectInfoEntities) {
+//						entity = new ProjectTreeNodeEntity();
+//						entity.setText(p.getProjectName());
+//						entity.setValue("" + child.getId() + "-" + p.getId());
+//						entity.setOrgId(child.getId());
+//						entity.setProjectId(p.getId());
+//						projectNode.add(entity);
+//					}
+//				}
+//			}
+
+//		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+//
+//			ProjectTreeNodeEntity root = new ProjectTreeNodeEntity();
+//			root.setText("北京大恒");
+//			root.setValue("0");
+//			List<ProjectTreeNodeEntity> projectNode = new LinkedList<>();
+//			root.setChildren(projectNode);
+//			tree.add(root);
+//
+//			ProjectTreeNodeEntity entity = new ProjectTreeNodeEntity();
+//			entity.setText("赤峰市");
+//			entity.setValue("1");
+//			projectNode.add(entity);
+//
+//			entity = new ProjectTreeNodeEntity();
+//			entity.setText("锡盟");
+//			entity.setValue("2");
+//			projectNode.add(entity);
+//
+//		}
+
+        return R.data(tree);
+    }
 
 }

+ 51 - 32
NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/project/entity/ProjectTreeNodeEntity.java

@@ -10,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.core.mp.base.BaseEntity;
+import org.springblade.modules.baseinfo.org.entity.OrgTreeNodeEntity;
 
 import java.util.List;
 
@@ -22,44 +23,62 @@ import java.util.List;
  * Remark:认为有必要的其他信息
  */
 @Data
-@EqualsAndHashCode(callSuper = true)
-public class ProjectTreeNodeEntity extends BaseEntity {
-	private static final long serialVersionUID = 1L;
+public class ProjectTreeNodeEntity  {
 
-	/**
-	 * 租户ID
-	 */
-	@ApiModelProperty("租户ID")
-	private String tenantId;
-	/**
-	 * 标题
-	 */
-	@ApiModelProperty("标题")
-	private String text;
 
-	/**
-	 * 值
-	 */
-	@ApiModelProperty("值")
+	@ApiModelProperty("ID")
+	private String id;
+
+	@ApiModelProperty("父ID")
+	private String parentId;
+
+	@ApiModelProperty("键")
+	private String key;
+
+	@ApiModelProperty("节点值")
 	private String value;
 
-	/**
-	 * 机构ID
-	 */
-	@ApiModelProperty("机构ID")
-	private Long orgId;
+	@ApiModelProperty("标题")
+	private String  title;
 
+	@ApiModelProperty("标题")
+	private String  text;
 
-	/**
-	 * 项目ID
-	 */
-	@ApiModelProperty("项目ID")
-	private Long projectId;
+	@ApiModelProperty("子节点")
+	List<ProjectTreeNodeEntity> children;
 
+	@ApiModelProperty("是否有子节点")
+	private Boolean hasChildren;
 
-	/**
-	 * 子列表
-	 */
-	@ApiModelProperty("子列表")
-	private List<ProjectTreeNodeEntity> children;
+//	/**
+//	 * 标题
+//	 */
+//	@ApiModelProperty("标题")
+//	private String text;
+//
+//	/**
+//	 * 值
+//	 */
+//	@ApiModelProperty("值")
+//	private String value;
+//
+//	/**
+//	 * 机构ID
+//	 */
+//	@ApiModelProperty("机构ID")
+//	private Long orgId;
+//
+//
+//	/**
+//	 * 项目ID
+//	 */
+//	@ApiModelProperty("项目ID")
+//	private Long projectId;
+//
+//
+//	/**
+//	 * 子列表
+//	 */
+//	@ApiModelProperty("子列表")
+//	private List<ProjectTreeNodeEntity> children;
 }

+ 379 - 341
NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/controller/RtuBaseInfoController.java

@@ -8,6 +8,7 @@ package org.springblade.modules.baseinfo.rtu.controller;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -25,6 +26,7 @@ import org.springblade.core.tool.utils.Func;
 
 import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
 import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
+import org.springblade.modules.baseinfo.project.entity.ProjectInfoEntity;
 import org.springblade.modules.baseinfo.region.entity.RegionInfoEntity;
 import org.springblade.modules.baseinfo.region.entity.RegionTreeNodeEntity;
 import org.springblade.modules.baseinfo.region.service.IBaseInfoRegionService;
@@ -66,68 +68,74 @@ import java.util.List;
  * Remark:认为有必要的其他信息
  */
 @RestController
-@RequestMapping("galaxy-business/rtu/base")
+@RequestMapping("galaxy-business/base/rtu")
 @AllArgsConstructor
 @Api(value = "测站设备基础管理", tags = "测站设备基础管理")
 public class RtuBaseInfoController extends BladeController {
-	private final IRtuBaseInfoService rtuBaseInfoService;
-	private final IDeptService deptService;
-	private final IRtuWarningService rtuWarningService;
-	private final IRtuManageService rtuManageService;
-	private final IRtuDataRainService rtuDataRainService;
-	private final IRtuDataRiverService rtuDataRiverService;
-	private final IRtuDataRsvrService rtuDataRsvrService;
-	private final IDictBizService dictBizService;
-	private final IDeptRegionService deptRegionService;
-	private final IBaseInfoRegionService regionService;
+    private final IRtuBaseInfoService rtuBaseInfoService;
+    private final IDeptService deptService;
+    private final IRtuWarningService rtuWarningService;
+    private final IRtuManageService rtuManageService;
+    private final IRtuDataRainService rtuDataRainService;
+    private final IRtuDataRiverService rtuDataRiverService;
+    private final IRtuDataRsvrService rtuDataRsvrService;
+    private final IDictBizService dictBizService;
+    private final IDeptRegionService deptRegionService;
+    private final IBaseInfoRegionService regionService;
 
 
-	/**
-	 * 分页
-	 */
-	@GetMapping("/list")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "不分页")
-	public R<List<RtuInfoVO>> list(@ApiIgnore RtuInfoDTO rtuInfoDTO) {
-		if (rtuInfoDTO.getRtuKind() != null && "1".equals(rtuInfoDTO.getRtuKind())) {
-			rtuInfoDTO.setIsRain(1);
-		} else if (rtuInfoDTO.getRtuKind() != null && "2".equals(rtuInfoDTO.getRtuKind())) {
-			rtuInfoDTO.setIsRiver(1);
-			//rtuInfoDTO.setIsRes(1);
-		} else if (rtuInfoDTO.getRtuKind() != null && "3".equals(rtuInfoDTO.getRtuKind())) {
-			rtuInfoDTO.setIsGround(1);
-		} else if (rtuInfoDTO.getRtuKind() != null && "4".equals(rtuInfoDTO.getRtuKind())) {
-			rtuInfoDTO.setIsVideo(1);
-		}
-		LambdaQueryWrapper<RtuInfoEntity> wrapper = Wrappers.<RtuInfoEntity>query().lambda();
-		if (null != rtuInfoDTO.getRtuName()) {
-			wrapper.like(RtuInfoEntity::getRtuName, rtuInfoDTO.getRtuName());
-		}
-		if (null != rtuInfoDTO.getRtuCode()) {
-			wrapper.like(RtuInfoEntity::getRtuCode, rtuInfoDTO.getRtuCode());
-		}
-		wrapper.orderByAsc(RtuInfoEntity::getRtuCode);
-		List<RtuInfoEntity> pages = rtuBaseInfoService.list(wrapper);
-		return R.data(RtuInfoWrapper.build().listVO(pages));
-	}
+    /**
+     * 分页
+     */
+    @GetMapping("/list")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "不分页")
+    public R<List<RtuInfoVO>> list(@ApiIgnore RtuInfoDTO rtuInfoDTO) {
+        if (rtuInfoDTO.getRtuKind() != null && "1".equals(rtuInfoDTO.getRtuKind())) {
+            rtuInfoDTO.setIsRain(1);
+        } else if (rtuInfoDTO.getRtuKind() != null && "2".equals(rtuInfoDTO.getRtuKind())) {
+            rtuInfoDTO.setIsRiver(1);
+            //rtuInfoDTO.setIsRes(1);
+        } else if (rtuInfoDTO.getRtuKind() != null && "3".equals(rtuInfoDTO.getRtuKind())) {
+            rtuInfoDTO.setIsGround(1);
+        } else if (rtuInfoDTO.getRtuKind() != null && "4".equals(rtuInfoDTO.getRtuKind())) {
+            rtuInfoDTO.setIsVideo(1);
+        }
+        LambdaQueryWrapper<RtuInfoEntity> wrapper = Wrappers.<RtuInfoEntity>query().lambda();
+        if (null != rtuInfoDTO.getRtuName()) {
+            wrapper.like(RtuInfoEntity::getRtuName, rtuInfoDTO.getRtuName());
+        }
+        if (null != rtuInfoDTO.getRtuCode()) {
+            wrapper.like(RtuInfoEntity::getRtuCode, rtuInfoDTO.getRtuCode());
+        }
+        wrapper.orderByAsc(RtuInfoEntity::getRtuCode);
+        List<RtuInfoEntity> pages = rtuBaseInfoService.list(wrapper);
+        return R.data(RtuInfoWrapper.build().listVO(pages));
+    }
 
-	/**
-	 * 多表联合查询自定义分页
-	 */
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页")
-	public R<IPage<RtuInfoVO>> page(@ApiIgnore RtuInfoDTO rtuInfoDTO, Query query) {
-		BladeUser user = AuthUtil.getUser();
+    /**
+     * 多表联合查询自定义分页
+     */
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "rtuName", value = "测站名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "rtuCode", value = "测站编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "adCode", value = "行政区划编码", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "projectId", value = "项目ID", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "分页")
+    public R<IPage<RtuInfoVO>> page(@ApiIgnore RtuInfoDTO rtuInfoDTO, Query query) {
+        if (Func.notNull(rtuInfoDTO.getProjectId())) {
+            if (0 == rtuInfoDTO.getProjectId()) {
+                rtuInfoDTO.setProjectId(null);
+            }
+        }
+        //BladeUser user = AuthUtil.getUser();
 //		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
 //			if (rtuInfoDTO.getAdCode() == null) {
 //				rtuInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
@@ -156,104 +164,104 @@ public class RtuBaseInfoController extends BladeController {
 //		} else if (rtuInfoDTO.getRtuKind() != null && "4".equals(rtuInfoDTO.getRtuKind())) {
 //			rtuInfoDTO.setIsVideo(1);
 //		}
-		IPage<RtuInfoVO> pages = rtuBaseInfoService.selectPage(Condition.getPage(query), rtuInfoDTO);
-		List<RtuInfoVO> list = pages.getRecords();
-		for (RtuInfoVO vo : list) {
-			RtuInfoWrapper.build().entityVO(vo);
-		}
-		return R.data(pages);
-	}
+        IPage<RtuInfoVO> pages = rtuBaseInfoService.selectPage(Condition.getPage(query), rtuInfoDTO);
+        List<RtuInfoVO> list = pages.getRecords();
+        for (RtuInfoVO vo : list) {
+            RtuInfoWrapper.build().entityVO(vo);
+        }
+        return R.data(pages);
+    }
 
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入rtuInfoEntity")
-	public R<RtuInfoVO> detail(RtuInfoEntity rtuInfoEntity) {
-		RtuInfoEntity detail = rtuBaseInfoService.getOne(Condition.getQueryWrapper(rtuInfoEntity));
-		RtuInfoVO rtuInfoVO = RtuInfoWrapper.build().entityVO(detail);
-		Dept dept = deptService.getById(detail.getOrgId());
-		if (null != dept) {
-			rtuInfoVO.setOrgName(dept.getDeptName());
-		}
-		LambdaQueryWrapper<RtuStatusEntity> statusWwrapper = Wrappers.<RtuStatusEntity>query().lambda();
-		statusWwrapper.eq(RtuStatusEntity::getIsDeleted, 0);
-		statusWwrapper.eq(RtuStatusEntity::getRtuCode, detail.getRtuCode());
-		RtuStatusEntity statusEntity = rtuManageService.getOne(statusWwrapper);
-		if (null != statusEntity) {
-			rtuInfoVO.setLastUpTime(statusEntity.getLastUpTime());
-		}
-		if (detail.getIsRain() != null && detail.getIsRain() == 1) {
-			LambdaQueryWrapper<RtuDataRainEntity> rainwrapper = Wrappers.<RtuDataRainEntity>query().lambda();
-			rainwrapper.eq(RtuDataRainEntity::getRtuCode, detail.getRtuCode());
-			rainwrapper.eq(RtuDataRainEntity::getIsDeleted, 0L);
-			RtuDataRainEntity rainEntity = rtuDataRainService.getOne(rainwrapper);
-			if (null != rainEntity) {
-				rtuInfoVO.setDrp(rainEntity.getDrp());
-			}
-		}
-		if (detail.getIsRiver() != null && detail.getIsRiver() == 1) {
-			LambdaQueryWrapper<RtuDataRiverEntity> riverwrapper = Wrappers.<RtuDataRiverEntity>query().lambda();
-			riverwrapper.eq(RtuDataRiverEntity::getRtuCode, detail.getRtuCode());
-			riverwrapper.eq(RtuDataRiverEntity::getIsDeleted, 0L);
-			RtuDataRiverEntity riverEntity = rtuDataRiverService.getOne(riverwrapper);
-			if (null != riverEntity) {
-				rtuInfoVO.setZ(riverEntity.getZ());
-			}
-		}
-		if (detail.getIsRes() != null && detail.getIsRes() == 1) {
-			LambdaQueryWrapper<RtuDataRsvrEntity> rsvrWrapper = Wrappers.<RtuDataRsvrEntity>query().lambda();
-			rsvrWrapper.eq(RtuDataRsvrEntity::getRtuCode, detail.getRtuCode());
-			rsvrWrapper.eq(RtuDataRsvrEntity::getIsDeleted, 0L);
-			RtuDataRsvrEntity rsvrEntity = rtuDataRsvrService.getOne(rsvrWrapper);
-			if (null != rsvrEntity) {
-				rtuInfoVO.setRz(rsvrEntity.getRz());
-			}
-		}
-		if (detail.getIsGround() != null && detail.getIsGround() == 1) {
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "详情", notes = "传入rtuInfoEntity")
+    public R<RtuInfoVO> detail(RtuInfoEntity rtuInfoEntity) {
+        RtuInfoEntity detail = rtuBaseInfoService.getOne(Condition.getQueryWrapper(rtuInfoEntity));
+        RtuInfoVO rtuInfoVO = RtuInfoWrapper.build().entityVO(detail);
+        Dept dept = deptService.getById(detail.getOrgId());
+        if (null != dept) {
+            rtuInfoVO.setOrgName(dept.getDeptName());
+        }
+        LambdaQueryWrapper<RtuStatusEntity> statusWwrapper = Wrappers.<RtuStatusEntity>query().lambda();
+        statusWwrapper.eq(RtuStatusEntity::getIsDeleted, 0);
+        statusWwrapper.eq(RtuStatusEntity::getRtuCode, detail.getRtuCode());
+        RtuStatusEntity statusEntity = rtuManageService.getOne(statusWwrapper);
+        if (null != statusEntity) {
+            rtuInfoVO.setLastUpTime(statusEntity.getLastUpTime());
+        }
+        if (detail.getIsRain() != null && detail.getIsRain() == 1) {
+            LambdaQueryWrapper<RtuDataRainEntity> rainwrapper = Wrappers.<RtuDataRainEntity>query().lambda();
+            rainwrapper.eq(RtuDataRainEntity::getRtuCode, detail.getRtuCode());
+            rainwrapper.eq(RtuDataRainEntity::getIsDeleted, 0L);
+            RtuDataRainEntity rainEntity = rtuDataRainService.getOne(rainwrapper);
+            if (null != rainEntity) {
+                rtuInfoVO.setDrp(rainEntity.getDrp());
+            }
+        }
+        if (detail.getIsRiver() != null && detail.getIsRiver() == 1) {
+            LambdaQueryWrapper<RtuDataRiverEntity> riverwrapper = Wrappers.<RtuDataRiverEntity>query().lambda();
+            riverwrapper.eq(RtuDataRiverEntity::getRtuCode, detail.getRtuCode());
+            riverwrapper.eq(RtuDataRiverEntity::getIsDeleted, 0L);
+            RtuDataRiverEntity riverEntity = rtuDataRiverService.getOne(riverwrapper);
+            if (null != riverEntity) {
+                rtuInfoVO.setZ(riverEntity.getZ());
+            }
+        }
+        if (detail.getIsRes() != null && detail.getIsRes() == 1) {
+            LambdaQueryWrapper<RtuDataRsvrEntity> rsvrWrapper = Wrappers.<RtuDataRsvrEntity>query().lambda();
+            rsvrWrapper.eq(RtuDataRsvrEntity::getRtuCode, detail.getRtuCode());
+            rsvrWrapper.eq(RtuDataRsvrEntity::getIsDeleted, 0L);
+            RtuDataRsvrEntity rsvrEntity = rtuDataRsvrService.getOne(rsvrWrapper);
+            if (null != rsvrEntity) {
+                rtuInfoVO.setRz(rsvrEntity.getRz());
+            }
+        }
+        if (detail.getIsGround() != null && detail.getIsGround() == 1) {
 
-		}
-		if (null != detail.getWaterSensorType()) {
-			DictBiz dictBiz = dictBizService.getById(detail.getWaterSensorType());
-			if (null != dictBiz) {
-				rtuInfoVO.setWaterSensorTypeText(dictBiz.getDictValue());
-			}
-		}
-		if (null != detail.getGroundSensorType()) {
-			DictBiz dictBiz = dictBizService.getById(detail.getGroundSensorType());
-			if (null != dictBiz) {
-				rtuInfoVO.setGroundSensorTypeText(dictBiz.getDictValue());
-			}
-		}
-		if (null != detail.getSatelliteModel()) {
-			DictBiz dictBiz = dictBizService.getById(detail.getSatelliteModel());
-			if (null != dictBiz) {
-				rtuInfoVO.setSatelliteModelText(dictBiz.getDictValue());
-			}
-		}
-		return R.data(rtuInfoVO);
-	}
+        }
+        if (null != detail.getWaterSensorType()) {
+            DictBiz dictBiz = dictBizService.getById(detail.getWaterSensorType());
+            if (null != dictBiz) {
+                rtuInfoVO.setWaterSensorTypeText(dictBiz.getDictValue());
+            }
+        }
+        if (null != detail.getGroundSensorType()) {
+            DictBiz dictBiz = dictBizService.getById(detail.getGroundSensorType());
+            if (null != dictBiz) {
+                rtuInfoVO.setGroundSensorTypeText(dictBiz.getDictValue());
+            }
+        }
+        if (null != detail.getSatelliteModel()) {
+            DictBiz dictBiz = dictBizService.getById(detail.getSatelliteModel());
+            if (null != dictBiz) {
+                rtuInfoVO.setSatelliteModelText(dictBiz.getDictValue());
+            }
+        }
+        return R.data(rtuInfoVO);
+    }
 
 
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入rtuInfoEntity")
-	public R save(@RequestBody RtuInfoDTO dto) {
-		if (Func.isNull(dto.getRtuCode())){
-			R.fail("参数错误");
-		}
-		LambdaQueryWrapper<RtuInfoEntity> rtuwrapper = Wrappers.<RtuInfoEntity>query().lambda();
-		rtuwrapper.eq(RtuInfoEntity::getRtuCode, dto.getRtuCode());
-		rtuwrapper.last("limit 1");
-		RtuInfoEntity entity = rtuBaseInfoService.getOne(rtuwrapper);
-		if (null != entity) {
-			return R.fail("测站编码已存在,请确认!");
-		}
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入rtuInfoEntity")
+    public R save(@RequestBody RtuInfoDTO dto) {
+        if (Func.isNull(dto.getRtuCode())) {
+            R.fail("参数错误");
+        }
+        LambdaQueryWrapper<RtuInfoEntity> rtuwrapper = Wrappers.<RtuInfoEntity>query().lambda();
+        rtuwrapper.eq(RtuInfoEntity::getRtuCode, dto.getRtuCode());
+        rtuwrapper.last("limit 1");
+        RtuInfoEntity entity = rtuBaseInfoService.getOne(rtuwrapper);
+        if (null != entity) {
+            return R.fail("测站编码已存在,请确认!");
+        }
 //		LambdaQueryWrapper<RegionInfoEntity> wrapper = Wrappers.<RegionInfoEntity>query().lambda();
 //		wrapper.eq(RegionInfoEntity::getAdcd, dto.getAdCode());
 //		wrapper.eq(RegionInfoEntity::getIsDeleted, 0L);
@@ -264,11 +272,11 @@ public class RtuBaseInfoController extends BladeController {
 //		citywrapper.eq(RegionInfoEntity::getIsDeleted, 0L);
 //		regionInfoEntity = this.regionService.getOne(citywrapper);
 //		dto.setAdCity(regionInfoEntity.getAdnm());
-		dto.setIsRain(0);
-		dto.setIsRiver(0);
-		dto.setIsRes(0);
-		dto.setIsGround(0);
-		dto.setIsVideo(0);
+        dto.setIsRain(0);
+        dto.setIsRiver(0);
+        dto.setIsRes(0);
+        dto.setIsGround(0);
+        dto.setIsVideo(0);
 //		if (dto.getSiteKind() != null && dto.getSiteKind().length > 0) {
 //			for (String kind : dto.getSiteKind()) {
 //				if ("1".equals(kind)) {
@@ -284,27 +292,27 @@ public class RtuBaseInfoController extends BladeController {
 //				}
 //			}
 //		}
-		if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
-			String lng = this.getLng(dto.getLng().trim());
-			dto.setLng(lng);
-		}
-		if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
-			String lat = this.getLat(dto.getLat().trim());
-			dto.setLat(lat);
-		}
-		return R.status(rtuBaseInfoService.save(dto));
-	}
+        if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
+            String lng = this.getLng(dto.getLng().trim());
+            dto.setLng(lng);
+        }
+        if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
+            String lat = this.getLat(dto.getLat().trim());
+            dto.setLat(lat);
+        }
+        return R.status(rtuBaseInfoService.save(dto));
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入RtuInfoDTO")
-	public R update(@RequestBody RtuInfoDTO dto) {
-		if (Func.isNull(dto.getId())){
-			return R.fail("参数错误");
-		}
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入RtuInfoDTO")
+    public R update(@RequestBody RtuInfoDTO dto) {
+        if (Func.isNull(dto.getId())) {
+            return R.fail("参数错误");
+        }
 //		LambdaQueryWrapper<RegionInfoEntity> wrapper = Wrappers.<RegionInfoEntity>query().lambda();
 //		wrapper.eq(RegionInfoEntity::getAdcd, dto.getAdCode());
 //		wrapper.eq(RegionInfoEntity::getIsDeleted, 0L);
@@ -335,24 +343,24 @@ public class RtuBaseInfoController extends BladeController {
 //				}
 //			}
 //		}
-		if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
-			String lng = this.getLng(dto.getLng().trim());
-			dto.setLng(lng);
-		}
-		if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
-			String lat = this.getLat(dto.getLat().trim());
-			dto.setLat(lat);
-		}
-		return R.status(rtuBaseInfoService.updateById(dto));
-	}
+        if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
+            String lng = this.getLng(dto.getLng().trim());
+            dto.setLng(lng);
+        }
+        if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
+            String lat = this.getLat(dto.getLat().trim());
+            dto.setLat(lat);
+        }
+        return R.status(rtuBaseInfoService.updateById(dto));
+    }
 
-	/**
-	 * 新增或修改
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入RtuInfoDTO")
-	public R submit(@RequestBody RtuInfoDTO dto) {
+    /**
+     * 新增或修改
+     */
+    @PostMapping("/submit")
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "新增或修改", notes = "传入RtuInfoDTO")
+    public R submit(@RequestBody RtuInfoDTO dto) {
 //		LambdaQueryWrapper<RegionInfoEntity> wrapper = Wrappers.<RegionInfoEntity>query().lambda();
 //		wrapper.eq(RegionInfoEntity::getAdcd, dto.getAdCode());
 //		wrapper.eq(RegionInfoEntity::getIsDeleted, 0L);
@@ -383,159 +391,189 @@ public class RtuBaseInfoController extends BladeController {
 //				}
 //			}
 //		}
-		if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
-			String lng = this.getLng(dto.getLng().trim());
-			dto.setLng(lng);
-		}
-		if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
-			String lat = this.getLat(dto.getLat().trim());
-			dto.setLat(lat);
-		}
-		return R.status(rtuBaseInfoService.saveOrUpdate(dto));
-	}
+        if (null != dto.getLng() && dto.getLng().trim().length() > 0) {
+            String lng = this.getLng(dto.getLng().trim());
+            dto.setLng(lng);
+        }
+        if (null != dto.getLat() && dto.getLat().trim().length() > 0) {
+            String lat = this.getLat(dto.getLat().trim());
+            dto.setLat(lat);
+        }
+        return R.status(rtuBaseInfoService.saveOrUpdate(dto));
+    }
 
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入ID数组")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		boolean temp = rtuBaseInfoService.deleteLogic(Func.toLongList(ids));
-		return R.status(temp);
-	}
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入ID数组")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        boolean temp = rtuBaseInfoService.deleteLogic(Func.toLongList(ids));
+        return R.status(temp);
+    }
 
-	@GetMapping("/dict/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<List<DictBiz>> dictList(@RequestParam String code) {
-		List<DictBiz> dicts = dictBizService.getList(code);
-		return R.data(dicts);
-	}
+    @GetMapping("/dict/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<List<DictBiz>> dictList(@RequestParam String code) {
+        List<DictBiz> dicts = dictBizService.getList(code);
+        return R.data(dicts);
+    }
 
-	/**
-	 * 按机构统计测站信息
-	 *
-	 * @return
-	 */
-	@GetMapping("/statistics")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页")
-	public R<List<RtuStatisticsInfoVO>> rtuStatistics() {
-		List<RtuStatisticsInfoVO> list = new LinkedList<>();
-		BladeUser user = AuthUtil.getUser();
-		List<Dept> root = this.deptService.getDeptChild(Func.toLong(user.getDeptId()));
-		for (Dept dept : root) {
-			RtuStatisticsInfoVO rtuStatisticsInfoVO = new RtuStatisticsInfoVO();
-			rtuStatisticsInfoVO.setId(dept.getId());
-			rtuStatisticsInfoVO.setOrgName(dept.getDeptName());
-			LambdaQueryWrapper<RtuInfoEntity> wrapper = Wrappers.<RtuInfoEntity>query().lambda();
-			wrapper.eq(RtuInfoEntity::getOrgId, dept.getId());
-			wrapper.eq(RtuInfoEntity::getIsDeleted, 0);
-			Long rtus = rtuBaseInfoService.count(wrapper);
-			rtuStatisticsInfoVO.setRtuCount(rtus);
-			RtuWarningInfoDTO rtuWarningInfoDTO = new RtuWarningInfoDTO();
-			rtuWarningInfoDTO.setDeptId(dept.getId());
-			Long warningRtus = rtuWarningService.warningRtuCount(rtuWarningInfoDTO);
-			rtuStatisticsInfoVO.setWarningRtuCount(warningRtus);
-			list.add(rtuStatisticsInfoVO);
-		}
-		return R.data(list);
-	}
+    /**
+     * 按机构统计测站信息
+     *
+     * @return
+     */
+    @GetMapping("/statistics")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<List<RtuStatisticsInfoVO>> rtuStatistics() {
+        List<RtuStatisticsInfoVO> list = new LinkedList<>();
+        BladeUser user = AuthUtil.getUser();
+        List<Dept> root = this.deptService.getDeptChild(Func.toLong(user.getDeptId()));
+        for (Dept dept : root) {
+            RtuStatisticsInfoVO rtuStatisticsInfoVO = new RtuStatisticsInfoVO();
+            rtuStatisticsInfoVO.setId(dept.getId());
+            rtuStatisticsInfoVO.setOrgName(dept.getDeptName());
+            LambdaQueryWrapper<RtuInfoEntity> wrapper = Wrappers.<RtuInfoEntity>query().lambda();
+            wrapper.eq(RtuInfoEntity::getOrgId, dept.getId());
+            wrapper.eq(RtuInfoEntity::getIsDeleted, 0);
+            Long rtus = rtuBaseInfoService.count(wrapper);
+            rtuStatisticsInfoVO.setRtuCount(rtus);
+            RtuWarningInfoDTO rtuWarningInfoDTO = new RtuWarningInfoDTO();
+            rtuWarningInfoDTO.setDeptId(dept.getId());
+            Long warningRtus = rtuWarningService.warningRtuCount(rtuWarningInfoDTO);
+            rtuStatisticsInfoVO.setWarningRtuCount(warningRtus);
+            list.add(rtuStatisticsInfoVO);
+        }
+        return R.data(list);
+    }
 
-	private String getLng(String lngText) {
-		ArrayList<String> textArr = new ArrayList<>();
-		textArr.add("");
-		for (int l = 0; l < lngText.length(); l++) {
-			String subtext = lngText.substring(l, l + 1);
-			if (Func.isNumeric(subtext)) {
-				String str = textArr.get(textArr.size() - 1);
-				str += subtext;
-				textArr.set(textArr.size() - 1, str);
-			} else {
-				textArr.add("");
-			}
-		}
-		ArrayList<String> tmp = new ArrayList<>();
-		for (String text : textArr) {
-			if (text.length() > 0) {
-				tmp.add(text);
-			}
-		}
-		if (tmp.size() >= 4) {
-			//度分秒,秒有小数点
-			String v = tmp.get(2) + "." + tmp.get(3);
-			double lat = Double.parseDouble(v);
-			lat = lat / 60.0;
-			v = tmp.get(1);
-			lat = (Double.parseDouble(v) + lat) / 60.0;
-			v = tmp.get(0);
-			lat = Double.parseDouble(v) + lat;
-			return String.format("%.06f", lat);
-		} else if (tmp.size() == 3) {
-			//度分秒
-			String v = tmp.get(2);
-			double lat = Double.parseDouble(v);
-			lat = lat / 60.0;
-			v = tmp.get(1);
-			lat = (Double.parseDouble(v) + lat) / 60.0;
-			v = tmp.get(0);
-			lat = Double.parseDouble(v) + lat;
-			return String.format("%.06f", lat);
-		} else if (tmp.size() == 2) {
-			//度
-			String v = tmp.get(0) + "." + tmp.get(1);
-			double lat = Double.parseDouble(v);
-			return String.format("%.06f", lat);
-		}
-		return null;
-	}
+    /**
+     * 项目绑定
+     * @param dto
+     * @return
+     */
+    @PostMapping("/project/bind")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType = "long"),
+            @ApiImplicitParam(name = "projectId", value = "项目ID", paramType = "query", dataType = "long"),
+    })
+    @ApiOperationSupport(order = 6)
+    @ApiOperation(value = "项目绑定", notes = "")
+    public R bindProject(@ApiIgnore RtuInfoDTO dto) {
+        if (Func.isNull(dto.getId()) || Func.isNull(dto.getProjectId())) {
+            return R.fail("参数错误");
+        }
+        RtuInfoEntity entity = rtuBaseInfoService.getById(dto.getId());
+        entity.setProjectId(dto.getProjectId());
+        rtuBaseInfoService.updateById(entity);
+        return R.success("项目绑定操作成功");
+    }
 
-	private String getLat(String latText) {
-		ArrayList<String> textArr = new ArrayList<>();
-		textArr.add("");
-		for (int l = 0; l < latText.length(); l++) {
-			String subtext = latText.substring(l, l + 1);
-			if (Func.isNumeric(subtext)) {
-				String str = textArr.get(textArr.size() - 1);
-				str += subtext;
-				textArr.set(textArr.size() - 1, str);
-			} else {
-				textArr.add("");
-			}
-		}
-		ArrayList<String> tmp = new ArrayList<>();
-		for (String text : textArr) {
-			if (text.length() > 0) {
-				tmp.add(text);
-			}
-		}
-		if (tmp.size() >= 4) {
-			//度分秒,秒有小数点
-			String v = tmp.get(2) + "." + tmp.get(3);
-			double lat = Double.parseDouble(v);
-			lat = lat / 60.0;
-			v = tmp.get(1);
-			lat = (Double.parseDouble(v) + lat) / 60.0;
-			v = tmp.get(0);
-			lat = Double.parseDouble(v) + lat;
-			return String.format("%.06f", lat);
-		} else if (tmp.size() == 3) {
-			//度分秒
-			String v = tmp.get(2);
-			double lat = Double.parseDouble(v);
-			lat = lat / 60.0;
-			v = tmp.get(1);
-			lat = (Double.parseDouble(v) + lat) / 60.0;
-			v = tmp.get(0);
-			lat = Double.parseDouble(v) + lat;
-			return String.format("%.06f", lat);
-		} else if (tmp.size() == 2) {
-			//度
-			String v = tmp.get(0) + "." + tmp.get(1);
-			double lat = Double.parseDouble(v);
-			return String.format("%.06f", lat);
-		}
-		return null;
-	}
+    private String getLng(String lngText) {
+        ArrayList<String> textArr = new ArrayList<>();
+        textArr.add("");
+        for (int l = 0; l < lngText.length(); l++) {
+            String subtext = lngText.substring(l, l + 1);
+            if (Func.isNumeric(subtext)) {
+                String str = textArr.get(textArr.size() - 1);
+                str += subtext;
+                textArr.set(textArr.size() - 1, str);
+            } else {
+                textArr.add("");
+            }
+        }
+        ArrayList<String> tmp = new ArrayList<>();
+        for (String text : textArr) {
+            if (text.length() > 0) {
+                tmp.add(text);
+            }
+        }
+        if (tmp.size() >= 4) {
+            //度分秒,秒有小数点
+            String v = tmp.get(2) + "." + tmp.get(3);
+            double lat = Double.parseDouble(v);
+            lat = lat / 60.0;
+            v = tmp.get(1);
+            lat = (Double.parseDouble(v) + lat) / 60.0;
+            v = tmp.get(0);
+            lat = Double.parseDouble(v) + lat;
+            return String.format("%.06f", lat);
+        } else if (tmp.size() == 3) {
+            //度分秒
+            String v = tmp.get(2);
+            double lat = Double.parseDouble(v);
+            lat = lat / 60.0;
+            v = tmp.get(1);
+            lat = (Double.parseDouble(v) + lat) / 60.0;
+            v = tmp.get(0);
+            lat = Double.parseDouble(v) + lat;
+            return String.format("%.06f", lat);
+        } else if (tmp.size() == 2) {
+            //度
+            String v = tmp.get(0) + "." + tmp.get(1);
+            double lat = Double.parseDouble(v);
+            return String.format("%.06f", lat);
+        }else if (tmp.size() == 1) {
+            String v = tmp.get(0) + ".0";
+            double lat = Double.parseDouble(v);
+            return String.format("%.06f", lat);
+        }
+        return "";
+    }
+
+    private String getLat(String latText) {
+        ArrayList<String> textArr = new ArrayList<>();
+        textArr.add("");
+        for (int l = 0; l < latText.length(); l++) {
+            String subtext = latText.substring(l, l + 1);
+            if (Func.isNumeric(subtext)) {
+                String str = textArr.get(textArr.size() - 1);
+                str += subtext;
+                textArr.set(textArr.size() - 1, str);
+            } else {
+                textArr.add("");
+            }
+        }
+        ArrayList<String> tmp = new ArrayList<>();
+        for (String text : textArr) {
+            if (text.length() > 0) {
+                tmp.add(text);
+            }
+        }
+        if (tmp.size() >= 4) {
+            //度分秒,秒有小数点
+            String v = tmp.get(2) + "." + tmp.get(3);
+            double lat = Double.parseDouble(v);
+            lat = lat / 60.0;
+            v = tmp.get(1);
+            lat = (Double.parseDouble(v) + lat) / 60.0;
+            v = tmp.get(0);
+            lat = Double.parseDouble(v) + lat;
+            return String.format("%.06f", lat);
+        } else if (tmp.size() == 3) {
+            //度分秒
+            String v = tmp.get(2);
+            double lat = Double.parseDouble(v);
+            lat = lat / 60.0;
+            v = tmp.get(1);
+            lat = (Double.parseDouble(v) + lat) / 60.0;
+            v = tmp.get(0);
+            lat = Double.parseDouble(v) + lat;
+            return String.format("%.06f", lat);
+        } else if (tmp.size() == 2) {
+            //度
+            String v = tmp.get(0) + "." + tmp.get(1);
+            double lat = Double.parseDouble(v);
+            return String.format("%.06f", lat);
+        }else if (tmp.size() == 1) {
+            String v = tmp.get(0) + ".0";
+            double lat = Double.parseDouble(v);
+            return String.format("%.06f", lat);
+        }
+        return "";
+    }
 }

+ 7 - 1
NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/mapper/RtuInfoMapper.xml

@@ -140,15 +140,18 @@
         <result column="site_cert_id" property="siteCertId"/>
         <result column="site_owner" property="siteOwner"/>
         <result column="data_share_active" property="dataShareActive"/>
+
+        <result column="project_name" property="projectName"/>
     </resultMap>
 
 
     <select id="selectPage" resultMap="rtuInfoVOResultMap">
         SELECT
-        n.*
+        n.*,p.project_name
         FROM
         rtu_info n
         LEFT JOIN data_ad_cd_b a ON a.adcd = n.ad_code and a.is_deleted=0
+        LEFT JOIN project_info p ON p.id = n.project_id and p.is_deleted=0
         WHERE
         n.is_deleted = 0
         <if test="rtuInfoDTO.rtuName!=null">
@@ -157,6 +160,9 @@
         <if test="rtuInfoDTO.rtuCode!=null">
             and n.rtu_code like concat(concat('%', #{rtuInfoDTO.rtuCode}), '%')
         </if>
+        <if test="rtuInfoDTO.projectId!=null ">
+            and n.project_id = #{rtuInfoDTO.projectId}
+        </if>
         <if test="rtuInfoDTO.isRain!=null">
             and n.is_rain = #{rtuInfoDTO.isRain}
         </if>

+ 4 - 0
NMSZYYWXT/src/main/java/org/springblade/modules/baseinfo/rtu/wrapper/RtuInfoWrapper.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.SpringUtil;
 import org.springblade.modules.baseinfo.region.entity.RegionInfoEntity;
 import org.springblade.modules.baseinfo.region.service.IBaseInfoRegionService;
@@ -59,6 +60,9 @@ public class RtuInfoWrapper extends BaseEntityWrapper<RtuInfoEntity, RtuInfoVO>
 	}
 
 	public RtuInfoVO entityVO(RtuInfoVO entity) {
+		if (Func.isNull(entity.getDataShareActive())){
+			entity.setDataShareActive(1);
+		}
 		List<String> siteKinds = new ArrayList<>();
 		String rtuKindDesc = "";
 		if (entity.getIsRain() != null && entity.getIsRain() == 1) {

+ 1 - 4
NMSZYYWXT/src/main/java/org/springblade/modules/business/home/VO/RtuStatusCountInfoVO.java

@@ -26,14 +26,11 @@ import org.springblade.modules.business.home.Entity.HomeInfoEntity;
 public class RtuStatusCountInfoVO extends HomeInfoEntity {
 
 	@JsonSerialize(nullsUsing = NullSerializer.class)
-	private Long waterUseConsumers;
+	private Long projects;
 
 	@JsonSerialize(nullsUsing = NullSerializer.class)
 	private Long monitorSites;
 
-	@JsonSerialize(nullsUsing = NullSerializer.class)
-	private Long monitorPoints;
-
 	/**
 	 * 预警数量
 	 */

+ 35 - 94
NMSZYYWXT/src/main/java/org/springblade/modules/business/home/controller/HomeController.java

@@ -14,53 +14,23 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springblade.constant.BusinessConstant;
-import org.springblade.constant.DictBusinessConstant;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.ConcurrentDateFormat;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.enums.OrderCloseEnum;
-import org.springblade.enums.OrderConfirmEnum;
-import org.springblade.enums.OrderStatusEnum;
-import org.springblade.modules.baseinfo.dict.entity.DictInfoEntity;
-import org.springblade.modules.baseinfo.dict.service.IBaseInfoDictService;
 import org.springblade.modules.baseinfo.monitorpoint.dto.MonitorPointInfoDTO;
-import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointInfoEntity;
 import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointService;
-import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteInfoEntity;
-import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
 import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
 import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
+import org.springblade.modules.baseinfo.project.entity.ProjectInfoEntity;
+import org.springblade.modules.baseinfo.project.service.IProjectBaseInfoService;
 import org.springblade.modules.baseinfo.region.entity.RegionInfoEntity;
 import org.springblade.modules.baseinfo.region.service.IBaseInfoRegionService;
 import org.springblade.modules.baseinfo.rtu.dto.RtuInfoDTO;
 import org.springblade.modules.baseinfo.rtu.service.IRtuBaseInfoService;
-import org.springblade.modules.baseinfo.wateruseconsumer.entity.WaterUseConsumerInfoEntity;
-import org.springblade.modules.baseinfo.wateruseconsumer.service.IWaterUseConsumerService;
-import org.springblade.modules.business.check.order.dto.CheckOrderInfoDTO;
-import org.springblade.modules.business.check.order.entity.CheckOrderInfoEntity;
-import org.springblade.modules.business.check.order.entity.CheckOrderSettingEntity;
-import org.springblade.modules.business.check.order.service.ICheckOrderSettingService;
-import org.springblade.modules.business.check.order.service.IRtuCheckOrderService;
-import org.springblade.modules.business.check.order.vo.CheckOrderInfoVO;
-import org.springblade.modules.business.check.process.dto.OrderProcessInfoDTO;
-import org.springblade.modules.business.check.process.service.IRtuOrderProcessService;
-import org.springblade.modules.business.data.dto.RtuDataGroundDTO;
-import org.springblade.modules.business.data.dto.RtuDataRainDTO;
-import org.springblade.modules.business.data.dto.RtuDataWaterLevelDTO;
-import org.springblade.modules.business.data.service.*;
-import org.springblade.modules.business.equipment.inspection.plan.entity.EquipmentInspectionPlanEntity;
-import org.springblade.modules.business.equipment.inspection.plan.service.IEquipmentInspectionPlanService;
-import org.springblade.modules.business.equipment.inspection.report.dto.EquipmentInspectionReportDTO;
-import org.springblade.modules.business.equipment.inspection.report.service.IEquipmentInspectionReportService;
 import org.springblade.modules.business.home.VO.*;
-import org.springblade.modules.business.monitor.dto.WaterFlowRateHistoryInfoDTO;
-import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
-import org.springblade.modules.business.notice.dto.NoticeDTO;
-import org.springblade.modules.business.notice.entity.NoticeViewEntity;
-import org.springblade.modules.business.notice.service.INoticeService;
-import org.springblade.modules.business.notice.service.INoticeViewService;
+import org.springblade.modules.business.upcount.entity.RtuUpCountInfoEntity;
+import org.springblade.modules.business.upcount.service.IRtuUpCountService;
 import org.springblade.modules.business.warning.dto.RtuWarningInfoDTO;
 import org.springblade.modules.business.warning.service.IRtuWarningService;
 import org.springblade.modules.system.entity.Dept;
@@ -69,7 +39,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.time.Duration;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.util.*;
 
 /***
@@ -86,50 +57,32 @@ import java.util.*;
 @AllArgsConstructor
 @Api(value = "实时数据管理模块", tags = "实时数据管理模块")
 public class HomeController {
-    private final IRtuCheckOrderService checkOrderService;
-    private final INoticeService noticeService;
-    private final INoticeViewService noticeViewService;
     private final IRtuBaseInfoService rtuBaseInfoService;
     private final IRtuWarningService rtuWarningService;
     private final IDeptRegionService deptRegionService;
-    private final IEquipmentInspectionReportService inspectionReportService;
-    private final ICheckOrderSettingService checkOrderSettingService;
-    private final IEquipmentInspectionPlanService planService;
-    private final IRtuOrderProcessService rtuOrderProcessService;
-    private final IEquipmentInspectionReportService equipmentInspectionReportService;
     private final IDeptService deptService;
     private final IBaseInfoRegionService regionService;
-    private final IBaseInfoDictService dictService;
-    private final IRtuDataRainStoreService rainStoreService;
-    private final IRtuDataWaterLevelStoreService waterLevelStoreService;
-    private final IRtuDataGroundStoreService groundStoreService;
-
-    private final IWaterUseConsumerService waterUseConsumerService;
-    private final IMonitorSiteService monitorSiteService;
+    private final IProjectBaseInfoService projectBaseInfoService;
     private final IMonitorPointService monitorPointService;
-    private final IWaterFlowRateHistoryService waterFlowRateHistoryService;
+    private final IRtuUpCountService rtuUpCountService;
 
     @GetMapping("/rtu/status/count/info")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "详情")
     public R<RtuStatusCountInfoVO> rtuStatusCountInfo() {
+        BladeUser user = AuthUtil.getUser();
         RtuStatusCountInfoVO infoVO = new RtuStatusCountInfoVO();
-        //测站数量
-        LambdaQueryWrapper<WaterUseConsumerInfoEntity> wrapper = Wrappers.<WaterUseConsumerInfoEntity>query().lambda();
-        wrapper.eq(WaterUseConsumerInfoEntity::getIsDeleted, 0);
-        long count = waterUseConsumerService.count(wrapper);
-        infoVO.setWaterUseConsumers(count);
+        LambdaQueryWrapper<ProjectInfoEntity> wrapper = Wrappers.<ProjectInfoEntity>query().lambda();
+        wrapper.eq(ProjectInfoEntity::getIsDeleted, 0);
+        wrapper.eq(ProjectInfoEntity::getOrgId, Func.toLong(user.getDeptId()));
+        long count = projectBaseInfoService.count(wrapper);
+        infoVO.setProjects(count);
 
-        LambdaQueryWrapper<MonitorSiteInfoEntity> wrapper2 = Wrappers.<MonitorSiteInfoEntity>query().lambda();
-        wrapper2.eq(MonitorSiteInfoEntity::getIsDeleted, 0);
-        count = monitorSiteService.count(wrapper2);
+        //测站数量
+        RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+        count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
         infoVO.setMonitorSites(count);
 
-        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
-        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
-        count = monitorPointService.count(wrapper3);
-        infoVO.setMonitorPoints(count);
-
         //预警数量
         RtuWarningInfoDTO dto = new RtuWarningInfoDTO();
         long warningRtuCount = rtuWarningService.warningRtuCount(dto);
@@ -147,40 +100,28 @@ public class HomeController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "详情")
     public R<RtuUpDataCountInfoVO> rtuUpCountInfo() {
-
+        LocalDateTime checkTime = LocalDateTime.now();
         RtuUpDataCountInfoVO infoVO = new RtuUpDataCountInfoVO();
-        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
-        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
-        long count = monitorPointService.count(wrapper3);
+        RtuInfoDTO rtuInfoDTO = new RtuInfoDTO();
+        long count = rtuBaseInfoService.rtuCount(rtuInfoDTO);
         infoVO.setMonitorPoints(count);
 
-        Calendar calendar = Calendar.getInstance();
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        Date endTime = calendar.getTime();
-        calendar.add(Calendar.HOUR_OF_DAY, -1);
-        Date beiganTime = calendar.getTime();
-        //监测点小时上报统计
-        WaterFlowRateHistoryInfoDTO dto = new WaterFlowRateHistoryInfoDTO();
-        dto.setBeginTime(beiganTime);
-        dto.setEndTime(endTime);
-        count = waterFlowRateHistoryService.rtuUpDataCount(dto);
+        LambdaQueryWrapper<RtuUpCountInfoEntity> wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
+        wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 1);
+        LocalDateTime et = checkTime.withMinute(0).withSecond(0).withNano(0);
+       // LocalDateTime st = et.minusHours(1);
+        wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+        wrapper.gt(RtuUpCountInfoEntity::getUpCount, 0);
+        count = rtuUpCountService.count(wrapper);
         infoVO.setHourUpDataCount(count);
 
-        calendar = Calendar.getInstance();
-        calendar.set(Calendar.HOUR_OF_DAY, 0);
-        calendar.set(Calendar.MINUTE, 0);
-        calendar.set(Calendar.SECOND, 0);
-        calendar.set(Calendar.MILLISECOND, 0);
-        endTime = calendar.getTime();
-        calendar.add(Calendar.DAY_OF_MONTH, -1);
-        beiganTime = calendar.getTime();
-        //监测点日上报统计
-        dto = new WaterFlowRateHistoryInfoDTO();
-        dto.setBeginTime(beiganTime);
-        dto.setEndTime(endTime);
-        count = waterFlowRateHistoryService.rtuUpDataCount(dto);
+        wrapper = Wrappers.<RtuUpCountInfoEntity>query().lambda();
+        wrapper.eq(RtuUpCountInfoEntity::getTimeKind, 2);
+        et = checkTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
+       // st = et.minusDays(1);
+        wrapper.eq(RtuUpCountInfoEntity::getCountTime, Date.from(et.atZone(ZoneId.systemDefault()).toInstant()));
+        wrapper.gt(RtuUpCountInfoEntity::getUpCount, 0);
+        count = rtuUpCountService.count(wrapper);
         infoVO.setDayUpDataCount(count);
 
         return R.data(infoVO);
@@ -193,7 +134,7 @@ public class HomeController {
         List<WarnCountInfoVO> list = new LinkedList<>();
         //盟市统计
         LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-        wrapper.eq(Dept::getParentId,BusinessConstant.DEPT_XAM_ID);
+        wrapper.eq(Dept::getParentId, BusinessConstant.DEPT_XAM_ID);
         List<Dept> deptList = this.deptService.list(wrapper);
         for (Dept dept : deptList) {
             WarnCountInfoVO vo = new WarnCountInfoVO();

+ 7 - 6
NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/controller/WaterFlowRateMonitorController.java

@@ -17,12 +17,7 @@ import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
-import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointInfoEntity;
-import org.springblade.modules.baseinfo.monitorpoint.vo.MonitorPointInfoVO;
-import org.springblade.modules.baseinfo.monitorpoint.wrapper.MonitorPointWrapper;
-import org.springblade.modules.baseinfo.wateruseconsumer.entity.WaterUseConsumerInfoEntity;
-import org.springblade.modules.baseinfo.wateruseconsumer.vo.WaterUseConsumerInfoVO;
-import org.springblade.modules.baseinfo.wateruseconsumer.wrapper.WaterUseConsumerWrapper;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.business.monitor.dto.WaterFlowRateInfoDTO;
 import org.springblade.modules.business.monitor.entity.WaterFlowRateInfoEntity;
 import org.springblade.modules.business.monitor.service.IWaterFlowRateService;
@@ -61,10 +56,16 @@ public class WaterFlowRateMonitorController extends BladeController {
             @ApiImplicitParam(name = "mpnm", value = "测点名称", paramType = "query", dataType = "string"),
             @ApiImplicitParam(name = "mpcd", value = "测点编码", paramType = "query", dataType = "string"),
             @ApiImplicitParam(name = "orgId", value = "机构ID", paramType = "query", dataType = "long"),
+            @ApiImplicitParam(name = "projectId", value = "项目ID", paramType = "query", dataType = "long"),
     })
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "分页")
     public R<IPage<WaterFlowRateInfoVO>> page(@ApiIgnore WaterFlowRateInfoDTO dto, Query query) {
+        if (Func.notNull(dto.getProjectId())) {
+            if (0 == dto.getProjectId()) {
+                dto.setProjectId(null);
+            }
+        }
         IPage<WaterFlowRateInfoVO> pages = waterFlowRateService.selectPage(Condition.getPage(query), dto);
         List<WaterFlowRateInfoVO> list = pages.getRecords();
         for (WaterFlowRateInfoVO v : list) {

+ 8 - 0
NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/dto/WaterFlowRateInfoDTO.java

@@ -6,6 +6,8 @@
  */
 package org.springblade.modules.business.monitor.dto;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -48,6 +50,12 @@ public class WaterFlowRateInfoDTO extends WaterFlowRateInfoEntity {
 	@ApiModelProperty("机构ID")
 	private Long orgId;
 
+	/**
+	 * 所属项目ID
+	 */
+	@ApiModelProperty(value = "所属项目")
+	private Long projectId;
+
 	/**
 	 * 取用水户名称
 	 */

+ 3 - 0
NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateHistoryMapper.xml

@@ -63,6 +63,9 @@
         data_mp_qr w
         WHERE
         w.is_deleted = 0
+        <if test="dto.mpcd!=null">
+            and w.mp_cd = #{dto.mpcd}
+        </if>
         AND w.tm >= #{dto.beginTime}
         AND w.tm &lt; #{dto.endTime}
         GROUP BY

+ 10 - 6
NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateMapper.xml

@@ -5,7 +5,7 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="waterFlowRateResultMap"
                type="org.springblade.modules.business.monitor.entity.WaterFlowRateInfoEntity">
-        <result column="mp_cd" property="mpcd"/>
+        <result column="rtu_code" property="mpcd"/>
         <result column="tm" property="tm"/>
         <result column="mp_q" property="mpq"/>
         <result column="acc_w" property="accw"/>
@@ -21,7 +21,7 @@
 
 
     <resultMap id="waterFlowRateVOResultMap" type="org.springblade.modules.business.monitor.vo.WaterFlowRateInfoVO">
-        <result column="mp_cd" property="mpcd"/>
+        <result column="rtu_code" property="mpcd"/>
         <result column="tm" property="tm"/>
         <result column="mp_q" property="mpq"/>
         <result column="acc_w" property="accw"/>
@@ -38,26 +38,30 @@
         <result column="run_status_id" property="runStatusId"/>
         <result column="last_up_time" property="lastUpTime"/>
 
+        <result column="project_name" property="projectName"/>
+
     </resultMap>
 
 
     <select id="selectPage" resultMap="waterFlowRateVOResultMap">
         SELECT
-        i.*,n.mp_cd,n.water_level,n.flow_speed,n.tm,n.mp_q,n.acc_w,n.in_stp_q,n.acc_pq_w,n.spe_reg_data,n.ts qr_ts,n.packet_uuid,n.hour_w,s.run_status_id,s.last_up_time
+        i.*,n.water_level,n.flow_speed,n.tm,n.mp_q,n.acc_w,n.in_stp_q,n.acc_pq_w,n.spe_reg_data,n.ts qr_ts,n.packet_uuid,n.hour_w,s.run_status_id,s.last_up_time,p.project_name
         FROM
         rtu_info i
         LEFT JOIN  data_mp_qr_cache n ON i.rtu_code = n.mp_cd and n.is_deleted=0
         LEFT JOIN rtu_status s ON s.rtu_code = i.rtu_code and s.is_deleted=0
+        LEFT JOIN project_info p ON p.id = i.project_id and p.is_deleted=0
         WHERE
         i.is_deleted =0
-
+        <if test="dto.projectId!=null ">
+            and i.project_id = #{dto.projectId}
+        </if>
         <if test="dto.mpnm!=null ">
             and i.rtu_name LIKE concat(concat('%', #{dto.mpnm}), '%')
         </if>
         <if test="dto.mpcd!=null">
-            and n.mp_cd like concat(concat('%', #{dto.mpcd}), '%')
+            and i.rtu_code like concat(concat('%', #{dto.mpcd}), '%')
         </if>
-
         <choose>
             <when test="dto.order!=null and dto.order=='ascending'">
                 <if test="dto.prop!=null and dto.prop=='tm'">

+ 6 - 0
NMSZYYWXT/src/main/java/org/springblade/modules/business/monitor/vo/WaterFlowRateInfoVO.java

@@ -111,4 +111,10 @@ public class WaterFlowRateInfoVO extends WaterFlowRateInfoEntity {
      */
     @ApiModelProperty(value = "取用水户名称")
     private String wiuNm;
+
+    /**
+     * 项目名称
+     */
+    @ApiModelProperty(value = "项目名称")
+    private String projectName;
 }

+ 3 - 3
NMSZYYWXT/src/main/resources/application-dev.yml

@@ -79,9 +79,9 @@ spring:
     rain-count-task: false
     surface-rain-task: false
     report-task: false
-    rtu-datagram-up-task: false
-    data-share-rtu: true
-    data-share-data: true
+    rtu-datagram-up-task: true
+    data-share-rtu: false
+    data-share-data: false
     data-share-server: https://waterintake.goldenwater.com.cn
     #data-share-server: https://qysgl.mwr.cn
   warn-config: