Ver código fonte

兴安盟水资源运维系统-20240221代码提交

dylan 2 anos atrás
pai
commit
e8dc10d6cd
84 arquivos alterados com 2918 adições e 2011 exclusões
  1. 1 1
      README.md
  2. 4 2
      pom.xml
  3. 7 2
      src/main/java/org/springblade/constant/BusinessConstant.java
  4. 212 0
      src/main/java/org/springblade/jobtask/DataCountProcessor.java
  5. 16 14
      src/main/java/org/springblade/jobtask/DataShareProcessor.java
  6. 0 337
      src/main/java/org/springblade/jobtask/RainDataCountProcessor.java
  7. 0 725
      src/main/java/org/springblade/jobtask/ReportCountProcessor.java
  8. 0 279
      src/main/java/org/springblade/jobtask/RtuUpCountProcessor.java
  9. 0 150
      src/main/java/org/springblade/jobtask/WarnCheckProcessor.java
  10. 6 0
      src/main/java/org/springblade/modules/baseinfo/monitorpoint/controller/MonitorPointController.java
  11. 6 0
      src/main/java/org/springblade/modules/baseinfo/monitorsite/controller/MonitorSiteController.java
  12. 6 0
      src/main/java/org/springblade/modules/baseinfo/monitorsite/entity/MonitorSiteInfoEntity.java
  13. 2 0
      src/main/java/org/springblade/modules/baseinfo/monitorsite/mapper/MonitorSiteMapper.xml
  14. 8 7
      src/main/java/org/springblade/modules/baseinfo/monitorsite/wrapper/MonitorSiteWrapper.java
  15. 79 58
      src/main/java/org/springblade/modules/baseinfo/org/controller/BaseOrgController.java
  16. 3 2
      src/main/java/org/springblade/modules/baseinfo/org/dto/OrgInfoDTO.java
  17. 11 11
      src/main/java/org/springblade/modules/baseinfo/org/mapper/BaseOrgMapper.xml
  18. 9 3
      src/main/java/org/springblade/modules/baseinfo/org/wrapper/OrgInfoWrapper.java
  19. 0 31
      src/main/java/org/springblade/modules/baseinfo/rtu/controller/RtuBaseInfoController.java
  20. 255 236
      src/main/java/org/springblade/modules/baseinfo/servicePerson/controller/ServicePersonController.java
  21. 7 0
      src/main/java/org/springblade/modules/baseinfo/wateruseconsumer/controller/WaterUseConsumerController.java
  22. 61 31
      src/main/java/org/springblade/modules/business/count/controller/CountController.java
  23. 31 0
      src/main/java/org/springblade/modules/business/count/dto/WaterUseConsumerMonthCountDTO.java
  24. 31 0
      src/main/java/org/springblade/modules/business/count/dto/WaterUseConsumerYearCountDTO.java
  25. 1 1
      src/main/java/org/springblade/modules/business/count/entity/OrgWaterUseCountEntity.java
  26. 1 1
      src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerCountEntity.java
  27. 13 12
      src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerMonthCountEntity.java
  28. 38 0
      src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerYearCountEntity.java
  29. 36 0
      src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerMonthCountMapper.java
  30. 43 0
      src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerMonthCountMapper.xml
  31. 36 0
      src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerYearCountMapper.java
  32. 42 0
      src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerYearCountMapper.xml
  33. 32 0
      src/main/java/org/springblade/modules/business/count/service/IWaterUseConsumerMonthCountService.java
  34. 32 0
      src/main/java/org/springblade/modules/business/count/service/IWaterUseConsumerYearCountService.java
  35. 34 0
      src/main/java/org/springblade/modules/business/count/service/impl/WaterUseConsumerMonthCountServiceImpl.java
  36. 36 0
      src/main/java/org/springblade/modules/business/count/service/impl/WaterUseConsumerYearCountServiceImpl.java
  37. 31 0
      src/main/java/org/springblade/modules/business/count/vo/WaterUseConsumerMonthCountVO.java
  38. 30 0
      src/main/java/org/springblade/modules/business/count/vo/WaterUseConsumerYearCountVO.java
  39. 29 15
      src/main/java/org/springblade/modules/business/home/controller/HomeController.java
  40. 7 6
      src/main/java/org/springblade/modules/business/monitor/controller/WaterFlowRateMonitorController.java
  41. 5 0
      src/main/java/org/springblade/modules/business/monitor/entity/WaterFlowRateHistoryInfoEntity.java
  42. 5 0
      src/main/java/org/springblade/modules/business/monitor/entity/WaterFlowRateInfoEntity.java
  43. 8 0
      src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateHistoryMapper.xml
  44. 6 19
      src/main/java/org/springblade/modules/business/monitor/mapper/WaterFlowRateMapper.xml
  45. 8 22
      src/main/java/org/springblade/modules/business/monitor/service/impl/WaterFlowRateHistoryServiceImpl.java
  46. 22 22
      src/main/java/org/springblade/modules/business/notice/controller/NoticeController.java
  47. 72 0
      src/main/java/org/springblade/modules/etl/controller/EtlDataController.java
  48. 32 0
      src/main/java/org/springblade/modules/etl/dto/EtlMpQrDTO.java
  49. 52 0
      src/main/java/org/springblade/modules/etl/entity/EtlMpEntity.java
  50. 58 0
      src/main/java/org/springblade/modules/etl/entity/EtlMpQrEntity.java
  51. 55 0
      src/main/java/org/springblade/modules/etl/entity/EtlWiuEntity.java
  52. 35 0
      src/main/java/org/springblade/modules/etl/entity/EtlWiuWiustDataEntity.java
  53. 49 0
      src/main/java/org/springblade/modules/etl/entity/EtlWiustEntity.java
  54. 35 0
      src/main/java/org/springblade/modules/etl/entity/EtlWiustMpDataEntity.java
  55. 25 0
      src/main/java/org/springblade/modules/etl/mapper/EtlMpMapper.java
  56. 28 0
      src/main/java/org/springblade/modules/etl/mapper/EtlMpMapper.xml
  57. 28 0
      src/main/java/org/springblade/modules/etl/mapper/EtlMpQrMapper.java
  58. 30 0
      src/main/java/org/springblade/modules/etl/mapper/EtlMpQrMapper.xml
  59. 25 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiuMapper.java
  60. 27 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiuMapper.xml
  61. 25 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiuWiustMapper.java
  62. 23 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiuWiustMapper.xml
  63. 25 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiustMapper.java
  64. 29 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiustMapper.xml
  65. 25 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiustMpMapper.java
  66. 23 0
      src/main/java/org/springblade/modules/etl/mapper/EtlWiustMpMapper.xml
  67. 25 0
      src/main/java/org/springblade/modules/etl/service/IEtlMpDataService.java
  68. 27 0
      src/main/java/org/springblade/modules/etl/service/IEtlMpQrDataService.java
  69. 24 0
      src/main/java/org/springblade/modules/etl/service/IEtlWiuDataService.java
  70. 24 0
      src/main/java/org/springblade/modules/etl/service/IEtlWiuWiustDataService.java
  71. 24 0
      src/main/java/org/springblade/modules/etl/service/IEtlWiustDataService.java
  72. 24 0
      src/main/java/org/springblade/modules/etl/service/IEtlWiustMpDataService.java
  73. 34 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlMpDatadServiceImpl.java
  74. 36 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlMpQrDatadServiceImpl.java
  75. 34 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlWiuDatadServiceImpl.java
  76. 34 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlWiuWiustDatadServiceImpl.java
  77. 34 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlWiustDatadServiceImpl.java
  78. 34 0
      src/main/java/org/springblade/modules/etl/service/impl/EtlWiustMpDatadServiceImpl.java
  79. 335 0
      src/main/java/org/springblade/modules/etl/task/EtlBaseRtuInfoTask.java
  80. 146 0
      src/main/java/org/springblade/modules/etl/task/EtlMpQrDataTask.java
  81. 98 6
      src/main/java/org/springblade/modules/test/TestController.java
  82. 30 16
      src/main/java/org/springblade/mq/kafka/handler/MessageHandler.java
  83. 2 2
      src/main/resources/application-dev.yml
  84. 2 0
      src/main/resources/application.yml

+ 1 - 1
README.md

@@ -2,4 +2,4 @@
     兴安盟水资源运维系统
 
 ## 项目模块介绍
-项目改造
+    项目改造,包括数据接收、管理平台、数据推送到金水平台。

+ 4 - 2
pom.xml

@@ -5,11 +5,13 @@
     <modelVersion>4.0.0</modelVersion>
 
     <groupId>org.springblade.xamszyywxt</groupId>
-    <artifactId>xamszyywxt</artifactId>
+    <!--<artifactId>xamszyywxt</artifactId>-->
+    <artifactId>tlszyywxt</artifactId>
     <name>${project.artifactId}</name>
     <packaging>jar</packaging>
     <version>1.0-SNAPSHOT</version>
-    <description>系统平台-兴安盟水资源管理平台</description>
+    <!--<description>系统平台-兴安盟水资源管理平台</description>-->
+    <description>系统平台-通辽水资源管理平台</description>
 
     <properties>
         <bladex.project.id>blade-api</bladex.project.id>

+ 7 - 2
src/main/java/org/springblade/constant/BusinessConstant.java

@@ -44,10 +44,12 @@ public class BusinessConstant {
 	 * 公司运维管理员角色ID
 	 */
 	public static final  String ROLE_COMPANY_ADMIN_ID ="1641334149732265985";
+	public static final  String ROLE_COMPANY_ADMIN_CODE ="company_admin";
 	/**
 	 * 公司运维人员角色ID
 	 */
 	public static final  String ROLE_COMPANY_SERVICE_PERSON_ID ="1641334272017199106";
+	public static final  String ROLE_COMPANY_SERVICE_PERSON_CODE ="company_servcie_person";
 	/**
 	 * 管理岗位
 	 */
@@ -80,6 +82,9 @@ public class BusinessConstant {
 
 	//public static final String DATA_SHARE_JS_SERVER="https://waterintake.goldenwater.com.cn";
 
-	public static final String DATA_SHARE_AREA ="152200_CHANGSHANG1";
-	public static final String DATA_SHARE_KEY ="0A3F8C5809D4F72BE0630EC3010A433C";
+//	public static final String DATA_SHARE_AREA ="152200_CHANGSHANG1";
+//	public static final String DATA_SHARE_KEY ="0A3F8C5809D4F72BE0630EC3010A433C";
+
+	public static final String DATA_SHARE_AREA ="150500_CHANGSHANG1";
+	public static final String DATA_SHARE_KEY ="0D4D40FF9F3E4FB5E0630EC3010A6010";
 }

+ 212 - 0
src/main/java/org/springblade/jobtask/DataCountProcessor.java

@@ -0,0 +1,212 @@
+/**
+ * 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.baseinfo.wateruseconsumer.entity.WaterUseConsumerInfoEntity;
+import org.springblade.modules.baseinfo.wateruseconsumer.service.IWaterUseConsumerService;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+import org.springblade.modules.business.count.service.IWaterUseConsumerMonthCountService;
+import org.springblade.modules.business.count.service.IWaterUseConsumerYearCountService;
+import org.springblade.modules.business.monitor.dto.WaterFlowRateHistoryInfoDTO;
+import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
+import org.springblade.modules.business.monitor.vo.ConsumerWaterFlowCountInfoVO;
+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.List;
+import java.util.concurrent.*;
+
+/***
+ * Date:2023/8/4
+ * Title: 数据统计
+ * Description:用水户月用水统计、用水户年用水统计
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Slf4j
+@Component
+@EnableScheduling
+public class DataCountProcessor {
+
+    private static ThreadFactory waterDataCountThreadFactory = new ThreadFactoryBuilder().setNameFormat("data-count-thread-pool-%d").build();
+    private static ExecutorService waterDataCountThreadPool = new ThreadPoolExecutor(1, 1,
+            0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(1024), waterDataCountThreadFactory, new ThreadPoolExecutor.AbortPolicy());
+
+    @Resource
+    private IWaterUseConsumerService waterUseConsumerService;
+
+    @Resource
+    private IWaterFlowRateHistoryService waterFlowRateHistoryService;
+
+
+    @Resource
+    private IWaterUseConsumerMonthCountService waterUseConsumerMonthCountService;
+
+    @Resource
+    private IWaterUseConsumerYearCountService waterUseConsumerYearCountService;
+
+    /**
+     * 用水户月用水统计
+     */
+    @Scheduled(cron = "10 0 0 * * ?")
+    public void monthDataCountTask() {
+        try {
+            Date dt = new Date();
+            log.info("用水户月用水统计 {}", Func.formatDateTime(dt));
+            MonthDataCountTask task = new MonthDataCountTask(dt);
+            FutureTask<Integer> futureTask = new FutureTask<>(task);
+            waterDataCountThreadPool.execute(futureTask);
+        } catch (Exception e) {
+            log.error("{}", e.getMessage());
+        }
+    }
+
+    /**
+     * 用水户年用水统计
+     */
+    @Scheduled(cron = "20 0 0 * * ?")
+    public void yearDataCountTask() {
+        try {
+            Date dt = new Date();
+            log.info("用水户年用水统计 {}", Func.formatDateTime(dt));
+            YearDataCountTask task = new YearDataCountTask(dt);
+            FutureTask<Integer> futureTask = new FutureTask<>(task);
+            waterDataCountThreadPool.execute(futureTask);
+        } catch (Exception e) {
+            log.error("{}", e.getMessage());
+        }
+    }
+
+    private class MonthDataCountTask implements Callable<Integer> {
+
+        private Date countTime;
+
+        public MonthDataCountTask(Date countTime) {
+            this.countTime = countTime;
+        }
+
+        @Override
+        public Integer call() throws Exception {
+            try {
+                log.info("用水户月用水统计开始执行 {}", Func.formatDateTime(countTime));
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(countTime);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                calendar.set(Calendar.MILLISECOND, 0);
+                Date et = calendar.getTime();
+                calendar.add(Calendar.MONTH, -1);
+                Date tm = calendar.getTime();
+                Date st = calendar.getTime();
+                log.info("月{},开始时间{},结束时间{}", Func.formatDate(tm), Func.formatDateTime(st), Func.formatDateTime(et));
+                WaterUseConsumerInfoEntity entity = new WaterUseConsumerInfoEntity();
+                List<WaterUseConsumerInfoEntity> waterUseConsumerInfoEntityList = waterUseConsumerService.selectAll(entity);
+                for (WaterUseConsumerInfoEntity consumerInfoEntity : waterUseConsumerInfoEntityList) {
+                    LambdaQueryWrapper<WaterUseConsumerMonthCountEntity> wrapper = Wrappers.<WaterUseConsumerMonthCountEntity>query().lambda();
+                    wrapper.eq(WaterUseConsumerMonthCountEntity::getWiuCd, consumerInfoEntity.getWiuCd());
+                    wrapper.eq(WaterUseConsumerMonthCountEntity::getTm, tm);
+                    wrapper.last("limit 1");
+                    WaterUseConsumerMonthCountEntity monthCountEntity = waterUseConsumerMonthCountService.getOne(wrapper);
+                    if (Func.isNull(monthCountEntity)) {
+                        monthCountEntity = new WaterUseConsumerMonthCountEntity();
+                        monthCountEntity.setWiuCd(consumerInfoEntity.getWiuCd());
+                        monthCountEntity.setTm(tm);
+                    }
+                    WaterFlowRateHistoryInfoDTO infoDTO = new WaterFlowRateHistoryInfoDTO();
+                    infoDTO.setWiuCd(consumerInfoEntity.getWiuCd());
+                    infoDTO.setBeginTime(st);
+                    infoDTO.setEndTime(et);
+                    List<ConsumerWaterFlowCountInfoVO> voList = waterFlowRateHistoryService.consumerWaterUseCount(infoDTO);
+                    if (Func.notNull(voList) && voList.size() == 1) {
+                        monthCountEntity.setAccw(voList.get(0).getMpaccq().longValue());
+                    } else {
+                        monthCountEntity.setAccw(0L);
+                    }
+                    waterUseConsumerMonthCountService.saveOrUpdate(monthCountEntity);
+                }
+                log.info("用水户月用水统计任务完成 {} 毫秒", System.currentTimeMillis() - countTime.getTime());
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("用水户月用水统计任务异常 {}", e.getMessage());
+            }
+            return 0;
+        }
+    }
+
+
+    private class YearDataCountTask implements Callable<Integer> {
+
+        private Date countTime;
+
+        public YearDataCountTask(Date countTime) {
+            this.countTime = countTime;
+        }
+
+        @Override
+        public Integer call() throws Exception {
+            try {
+                log.info("用水户年用水统计任务开始执行 {}", Func.formatDateTime(countTime));
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(countTime);
+                calendar.set(Calendar.MONTH, 0);
+                calendar.set(Calendar.DAY_OF_MONTH, 1);
+                calendar.set(Calendar.HOUR_OF_DAY, 0);
+                calendar.set(Calendar.MINUTE, 0);
+                calendar.set(Calendar.SECOND, 0);
+                calendar.set(Calendar.MILLISECOND, 0);
+                Date et = calendar.getTime();
+                calendar.add(Calendar.YEAR, -1);
+                Date tm = calendar.getTime();
+                Date st = calendar.getTime();
+                log.info("年{},开始时间{},结束时间{}", Func.formatDate(tm), Func.formatDateTime(st), Func.formatDateTime(et));
+                WaterUseConsumerInfoEntity entity = new WaterUseConsumerInfoEntity();
+                List<WaterUseConsumerInfoEntity> waterUseConsumerInfoEntityList = waterUseConsumerService.selectAll(entity);
+                for (WaterUseConsumerInfoEntity consumerInfoEntity : waterUseConsumerInfoEntityList) {
+                    LambdaQueryWrapper<WaterUseConsumerYearCountEntity> wrapper = Wrappers.<WaterUseConsumerYearCountEntity>query().lambda();
+                    wrapper.eq(WaterUseConsumerYearCountEntity::getWiuCd, consumerInfoEntity.getWiuCd());
+                    wrapper.eq(WaterUseConsumerYearCountEntity::getTm, tm);
+                    wrapper.last("limit 1");
+                    WaterUseConsumerYearCountEntity yearCountEntity = waterUseConsumerYearCountService.getOne(wrapper);
+                    if (Func.isNull(yearCountEntity)) {
+                        yearCountEntity = new WaterUseConsumerYearCountEntity();
+                        yearCountEntity.setWiuCd(consumerInfoEntity.getWiuCd());
+                        yearCountEntity.setTm(tm);
+                    }
+                    WaterFlowRateHistoryInfoDTO infoDTO = new WaterFlowRateHistoryInfoDTO();
+                    infoDTO.setWiuCd(consumerInfoEntity.getWiuCd());
+                    infoDTO.setBeginTime(st);
+                    infoDTO.setEndTime(et);
+                    List<ConsumerWaterFlowCountInfoVO> voList = waterFlowRateHistoryService.consumerWaterUseCount(infoDTO);
+                    if (Func.notNull(voList) && voList.size() == 1) {
+                        yearCountEntity.setAccw(voList.get(0).getMpaccq().longValue());
+                    } else {
+                        yearCountEntity.setAccw(0L);
+                    }
+                    waterUseConsumerYearCountService.saveOrUpdate(yearCountEntity);
+                }
+                log.info("用水户年用水统计任务完成 {} 毫秒", System.currentTimeMillis() - countTime.getTime());
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("用水户年用水统计任务异常 {}", e.getMessage());
+            }
+            return 0;
+        }
+    }
+}

+ 16 - 14
src/main/java/org/springblade/jobtask/DataShareProcessor.java

@@ -90,7 +90,8 @@ public class DataShareProcessor {
     /**
      * 计量设施数据同步,每天执行一次
      */
-    @Scheduled(cron = "10 0 0 * * ?")
+//    @Scheduled(cron = "10 0 0 * * ?")
+    @Scheduled(cron = "0 0 0/1 * * ?")
     public void siteShareDataTaskScheduled() {
         try {
             Date dt = new Date();
@@ -147,6 +148,7 @@ public class DataShareProcessor {
                                 JSONObject data = new JSONObject();
                                 data.put("id", BusinessConstant.DATA_SHARE_AREA + "_" + entity.getWiustCd());
                                 data.put("measName", entity.getWiustNm());
+                                data.put("measCode", entity.getWiustCd());
                                 //计量方式代码,参考输入参数说明下的字典项(以电折水计量涉及的样本井、普通井选用其他计量-以电量、柴油和其他动力消耗折算水量)
                                 data.put("measTypeCode", "24");
                                 //计量方式
@@ -267,11 +269,11 @@ public class DataShareProcessor {
                                 data.put("dayW", dayAccw);
                                 Calendar calendar = Calendar.getInstance();
                                 calendar.setTime(countTime);
-                                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);
+                                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);
 
                                 data.put("dt", Func.formatDate(calendar.getTime()));
                                 data.put("inTime", Func.formatDate(calendar.getTime()));
@@ -283,11 +285,11 @@ public class DataShareProcessor {
                                 data.put("dayW", 0.0);
                                 Calendar calendar = Calendar.getInstance();
                                 calendar.setTime(countTime);
-                                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);
+                                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);
 
                                 data.put("dt", Func.formatDate(calendar.getTime()));
                                 data.put("inTime", Func.formatDate(calendar.getTime()));
@@ -341,20 +343,20 @@ public class DataShareProcessor {
                     logEntity.setPostUrl(url);
                     if (Func.notNull(res)) {
                         logEntity.setRequestResult(res.toJSONString());
-                   }
+                    }
                     int timeLong = (int) (System.currentTimeMillis() - countTime.getTime());
                     logEntity.setTaskTimeLong(timeLong);
                     dataShareLogServcie.save(logEntity);
                 }
             } catch (Exception e) {
-               // e.printStackTrace();
+                // e.printStackTrace();
                 log.error("实时流量同步任务异常 {}", e.getMessage());
                 //记录请求日志
                 DataShareLogEntity logEntity = new DataShareLogEntity();
                 logEntity.setRequestDesc("实时流量数据同步");
                 logEntity.setCountTime(countTime);
                 logEntity.setPostUrl(dataShareServer + "/wr_web_manager/api/wr/datasync/wiwrDayWr/insertOrUpdate");
-                logEntity.setRequestResult("实时流量同步任务异常 "+e.getMessage());
+                logEntity.setRequestResult("实时流量同步任务异常 " + e.getMessage());
                 int timeLong = (int) (System.currentTimeMillis() - countTime.getTime());
                 logEntity.setTaskTimeLong(timeLong);
                 dataShareLogServcie.save(logEntity);

+ 0 - 337
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
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;
-		}
-	}
-}

+ 0 - 279
src/main/java/org/springblade/jobtask/RtuUpCountProcessor.java

@@ -1,279 +0,0 @@
-/**
- * Copyright 2019 DH
- * All right reserved.
- * 项目名称: 山洪灾害运维系统
- * 创建日期:2023/8/21
- */
-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.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.upcount.dto.RtuUpCountInfoDTO;
-import org.springblade.modules.business.upcount.entity.RtuUpCountInfoEntity;
-import org.springblade.modules.business.upcount.service.IRtuUpCountService;
-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.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.*;
-
-/***
- * Date:2023/8/21
- * Title: 测站上报率统计
- * Description:按小时统计上报率,按天统计上报率
- * @author dylan
- * @version 1.0
- * Remark:认为有必要的其他信息
- */
-@Slf4j
-@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;
-		}
-	}
-}

+ 0 - 150
src/main/java/org/springblade/jobtask/WarnCheckProcessor.java

@@ -65,23 +65,6 @@ public class WarnCheckProcessor {
 	@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分钟执行一次
@@ -101,139 +84,6 @@ public class WarnCheckProcessor {
 		}
 	}
 
-	private class WarningCheckMinTask implements Callable<Integer> {
-
-		private LocalDateTime checkTime;
-
-		public WarningCheckMinTask(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> {
 

+ 6 - 0
src/main/java/org/springblade/modules/baseinfo/monitorpoint/controller/MonitorPointController.java

@@ -15,6 +15,8 @@ import lombok.AllArgsConstructor;
 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.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.monitorpoint.dto.MonitorPointInfoDTO;
@@ -59,6 +61,10 @@ public class MonitorPointController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<IPage<MonitorPointInfoVO>> page(@ApiIgnore MonitorPointInfoDTO dto, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (Func.isNull(dto.getOrgId())){
+            dto.setOrgId(Func.toLong(user.getDeptId()));
+        }
         IPage<MonitorPointInfoVO> pages = monitorPointService.selectPage(Condition.getPage(query), dto);
         List<MonitorPointInfoVO> list = pages.getRecords();
         for (MonitorPointInfoVO vo : list) {

+ 6 - 0
src/main/java/org/springblade/modules/baseinfo/monitorsite/controller/MonitorSiteController.java

@@ -15,6 +15,8 @@ import lombok.AllArgsConstructor;
 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.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointInfoEntity;
@@ -75,6 +77,10 @@ public class MonitorSiteController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<IPage<MonitorSiteInfoVO>> page(@ApiIgnore MonitorSiteInfoDTO dto, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (Func.isNull(dto.getOrgId())){
+            dto.setOrgId(Func.toLong(user.getDeptId()));
+        }
         IPage<MonitorSiteInfoVO> pages = monitorSiteService.selectPage(Condition.getPage(query), dto);
         List<MonitorSiteInfoVO> list = pages.getRecords();
         for (MonitorSiteInfoVO vo : list) {

+ 6 - 0
src/main/java/org/springblade/modules/baseinfo/monitorsite/entity/MonitorSiteInfoEntity.java

@@ -161,4 +161,10 @@ public class MonitorSiteInfoEntity extends BaseEntity {
      */
     @ApiModelProperty(value = "是否同步到金水平台")
     private Integer dataShareActive;
+
+    /**
+     * 测站数据是否有效, 0否,2是 默认1
+     */
+    @ApiModelProperty(value = "测站数据是否有效")
+    private Integer upDataValid;
 }

+ 2 - 0
src/main/java/org/springblade/modules/baseinfo/monitorsite/mapper/MonitorSiteMapper.xml

@@ -26,6 +26,7 @@
         <result column="site_cert_id" property="siteCertId"/>
         <result column="site_owner" property="siteOwner"/>
         <result column="data_share_active" property="dataShareActive"/>
+        <result column="up_data_valid" property="upDataValid"/>
 
     </resultMap>
 
@@ -52,6 +53,7 @@
         <result column="site_cert_id" property="siteCertId"/>
         <result column="site_owner" property="siteOwner"/>
         <result column="data_share_active" property="dataShareActive"/>
+        <result column="up_data_valid" property="upDataValid"/>
         <result column="wiu_cd" property="wiuCd"/>
         <result column="wiu_nm" property="wiuNm"/>
         <result column="org_id" property="orgId"/>

+ 8 - 7
src/main/java/org/springblade/modules/baseinfo/monitorsite/wrapper/MonitorSiteWrapper.java

@@ -10,6 +10,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.monitorsite.entity.MonitorSiteInfoEntity;
 import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteRelEntity;
@@ -66,35 +67,35 @@ public class MonitorSiteWrapper extends BaseEntityWrapper<MonitorSiteInfoEntity,
     @Override
     public MonitorSiteInfoVO entityVO(MonitorSiteInfoEntity entity) {
         MonitorSiteInfoVO vo = Objects.requireNonNull(BeanUtil.copy(entity, MonitorSiteInfoVO.class));
-        if (vo.getWiuNm() == null) {
+        if (Func.isNull(vo.getWiuNm())) {
             LambdaQueryWrapper<MonitorSiteRelEntity> wrapper = Wrappers.<MonitorSiteRelEntity>query().lambda();
             wrapper.eq(MonitorSiteRelEntity::getWiustCd, entity.getWiustCd());
             wrapper.last("limit 1");
             MonitorSiteRelEntity relEntity = getMonitorSiteRelService().getOne(wrapper);
-            if (null != relEntity) {
+            if (Func.notNull(relEntity)) {
                 LambdaQueryWrapper<WaterUseConsumerInfoEntity> wrapper2 = Wrappers.<WaterUseConsumerInfoEntity>query().lambda();
                 wrapper2.eq(WaterUseConsumerInfoEntity::getWiuCd, relEntity.getWiuCd());
                 wrapper2.last("limit 1");
                 WaterUseConsumerInfoEntity waterUseConsumerInfoEntity = getWaterUseConsumerService().getOne(wrapper2);
-                if (null != waterUseConsumerInfoEntity) {
+                if (Func.notNull(waterUseConsumerInfoEntity)) {
                     vo.setWiuCd(waterUseConsumerInfoEntity.getWiuCd());
                     vo.setWiuNm(waterUseConsumerInfoEntity.getWiuNm());
                 }
             }
         }
-        if (vo.getOrgName() == null) {
+        if (Func.isNull(vo.getOrgName())) {
             LambdaQueryWrapper<MonitorSiteRelEntity> wrapper = Wrappers.<MonitorSiteRelEntity>query().lambda();
             wrapper.eq(MonitorSiteRelEntity::getWiustCd, entity.getWiustCd());
             wrapper.last("limit 1");
             MonitorSiteRelEntity relEntity = getMonitorSiteRelService().getOne(wrapper);
-            if (null != relEntity) {
+            if (Func.notNull(relEntity)) {
                 LambdaQueryWrapper<WaterUseConsumerInfoEntity> wrapper2 = Wrappers.<WaterUseConsumerInfoEntity>query().lambda();
                 wrapper2.eq(WaterUseConsumerInfoEntity::getWiuCd, relEntity.getWiuCd());
                 wrapper2.last("limit 1");
                 WaterUseConsumerInfoEntity waterUseConsumerInfoEntity = getWaterUseConsumerService().getOne(wrapper2);
-                if (null != waterUseConsumerInfoEntity) {
+                if (Func.notNull(waterUseConsumerInfoEntity)) {
                     Dept dept = getDeptService().getById(waterUseConsumerInfoEntity.getOrgId());
-                    if (null != dept) {
+                    if (Func.notNull(dept)) {
                         vo.setOrgId(waterUseConsumerInfoEntity.getOrgId());
                         vo.setOrgName(dept.getDeptName());
                     }

+ 79 - 58
src/main/java/org/springblade/modules/baseinfo/org/controller/BaseOrgController.java

@@ -23,7 +23,9 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.org.dto.OrgInfoDTO;
 import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
+import org.springblade.modules.baseinfo.org.entity.OrgInfoEntity;
 import org.springblade.modules.baseinfo.org.entity.OrgTreeNodeEntity;
+import org.springblade.modules.baseinfo.org.service.IBaseOrgService;
 import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
 import org.springblade.modules.baseinfo.org.vo.OrgInfoVO;
 import org.springblade.modules.baseinfo.org.wrapper.OrgInfoWrapper;
@@ -54,18 +56,19 @@ public class BaseOrgController extends BladeController {
 	private final IDeptService deptService;
 	private final IDeptRegionService deptRegionService;
 	private final IBaseInfoRegionService regionService;
+	private final IBaseOrgService baseOrgService;
 
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "分页")
-	public R<List<OrgInfoVO>> list() {
-		BladeUser user = AuthUtil.getUser();
-		LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-		wrapper.eq(Dept::getIsDeleted, 0);
-		wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-		List<Dept> pages = deptService.list(wrapper);
-		return R.data(OrgInfoWrapper.build().listVO(pages));
-	}
+//	@GetMapping("/list")
+//	@ApiOperationSupport(order = 1)
+//	@ApiOperation(value = "分页")
+//	public R<List<OrgInfoVO>> list() {
+//		BladeUser user = AuthUtil.getUser();
+//		LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+//		wrapper.eq(Dept::getIsDeleted, 0);
+//		wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+//		List<Dept> pages = deptService.list(wrapper);
+//		return R.data(OrgInfoWrapper.build().listVO(pages));
+//	}
 
 	/**
 	 * 分页
@@ -76,16 +79,20 @@ public class BaseOrgController extends BladeController {
 	})
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "分页")
-	public R<IPage<OrgInfoVO>> page(@ApiIgnore Dept entity, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-		wrapper.eq(Dept::getIsDeleted, 0);
-		wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-		if (entity.getDeptName() != null && entity.getDeptName().length() > 0) {
-			wrapper.like(Dept::getDeptName, entity.getDeptName());
+	public R<IPage<OrgInfoVO>> page(@ApiIgnore OrgInfoDTO dto, Query query) {
+//		BladeUser user = AuthUtil.getUser();
+//		LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+//		wrapper.eq(Dept::getIsDeleted, 0);
+//		wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+//		if (entity.getDeptName() != null && entity.getDeptName().length() > 0) {
+//			wrapper.like(Dept::getDeptName, entity.getDeptName());
+//		}
+		IPage<OrgInfoVO> pages = baseOrgService.selectPage(Condition.getPage(query), dto);
+		List<OrgInfoVO> list = pages.getRecords();
+		for (OrgInfoVO vo:list){
+			OrgInfoWrapper.build().entityVO(vo);
 		}
-		IPage<Dept> pages = deptService.page(Condition.getPage(query), wrapper);
-		return R.data(OrgInfoWrapper.build().pageVO(pages));
+		return R.data(pages);
 	}
 
 	/**
@@ -106,31 +113,39 @@ public class BaseOrgController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "新增", notes = "传入 Dept")
 	@Transactional
-	public R save(@RequestBody OrgInfoDTO dept) {
-		BladeUser user = AuthUtil.getUser();
-		dept.setFullName(dept.getDeptName());
-		dept.setParentId(Func.toLong(user.getDeptId()));
-		Dept parentDept = this.deptService.getById(Func.toLong(user.getDeptId()));
-		dept.setAncestors(parentDept.getAncestors() + "," + parentDept.getId());
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			dept.setDeptCategory(2);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			dept.setDeptCategory(1);
+	public R save(@RequestBody OrgInfoDTO dto) {
+		if (Func.isNull(dto.getParentId())){
+			return R.fail("参数错误");
 		}
+
+	//	BladeUser user = AuthUtil.getUser();
+		Dept dept = new Dept();
+		dept.setDeptName(dto.getDeptName());
+		dept.setFullName(dto.getDeptName());
+		dept.setParentId(dto.getParentId());
+		Dept parentDept = this.deptService.getById(dept.getParentId());
+		dept.setAncestors(parentDept.getAncestors() + "," + parentDept.getId());
+//		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//			dept.setDeptCategory(2);
+//		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+//			dept.setDeptCategory(1);
+//		}
+		dept.setDeptCategory(2);
+		dept.setRemark(dto.getRemark());
 		this.deptService.save(dept);
-		DeptRegionEntity deptRegionEntity = new DeptRegionEntity();
-		deptRegionEntity.setDeptId(dept.getId());
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			deptRegionEntity.setAdcd(dept.getAdcd());
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-			DeptRegionEntity orgAdmindRegion = this.deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-			deptRegionEntity.setAdcd(orgAdmindRegion.getAdcd());
-		}
-		this.deptRegionService.save(deptRegionEntity);
-		this.regionService.updateAdminRegionCache();
+//		DeptRegionEntity deptRegionEntity = new DeptRegionEntity();
+//		deptRegionEntity.setDeptId(dept.getId());
+//		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//			deptRegionEntity.setAdcd(dept.getAdcd());
+//		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+//			LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
+//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
+//			deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
+//			DeptRegionEntity orgAdmindRegion = this.deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
+//			deptRegionEntity.setAdcd(orgAdmindRegion.getAdcd());
+//		}
+//		this.deptRegionService.save(deptRegionEntity);
+//		this.regionService.updateAdminRegionCache();
 		return R.status(true);
 	}
 
@@ -140,20 +155,27 @@ public class BaseOrgController extends BladeController {
 	@PostMapping("/update")
 	@ApiOperationSupport(order = 4)
 	@ApiOperation(value = "修改", notes = "传入 Dept")
-	public R update(@RequestBody Dept dept) {
+	public R update(@RequestBody OrgInfoEntity entity) {
+		if (Func.isNull(entity.getId())){
+			return R.fail("参数错误");
+		}
+		Dept dept = deptService.getById(entity.getId());
+		dept.setDeptName(entity.getDeptName());
+		dept.setFullName(entity.getDeptName());
+		dept.setRemark(entity.getRemark());
 		return R.status(deptService.updateById(dept));
 	}
 
 	/**
 	 * 新增或修改
 	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入 Dept")
-	public R submit(@RequestBody Dept dept) {
-		deptService.saveOrUpdate(dept);
-		return R.status(deptService.saveOrUpdate(dept));
-	}
+//	@PostMapping("/submit")
+//	@ApiOperationSupport(order = 6)
+//	@ApiOperation(value = "新增或修改", notes = "传入 Dept")
+//	public R submit(@RequestBody Dept dept) {
+//		deptService.saveOrUpdate(dept);
+//		return R.status(deptService.saveOrUpdate(dept));
+//	}
 
 	/**
 	 * 删除
@@ -169,13 +191,13 @@ public class BaseOrgController extends BladeController {
 		List<Long> list = Func.toLongList(ids);
 		for (Long id : list) {
 			deptService.removeById(id);
-			LambdaUpdateWrapper<DeptRegionEntity> updateWrapper = Wrappers.<DeptRegionEntity>update().lambda();
-			updateWrapper.set(DeptRegionEntity::getIsDeleted, 1);
-			updateWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-			updateWrapper.eq(DeptRegionEntity::getDeptId, id);
-			deptRegionService.update(updateWrapper);
+//			LambdaUpdateWrapper<DeptRegionEntity> updateWrapper = Wrappers.<DeptRegionEntity>update().lambda();
+//			updateWrapper.set(DeptRegionEntity::getIsDeleted, 1);
+//			updateWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
+//			updateWrapper.eq(DeptRegionEntity::getDeptId, id);
+//			deptRegionService.update(updateWrapper);
 		}
-		this.regionService.updateAdminRegionCache();
+	//	this.regionService.updateAdminRegionCache();
 		return R.status(true);
 	}
 
@@ -221,7 +243,6 @@ public class BaseOrgController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "树")
 	public R<List<OrgTreeNodeEntity>> orgTree() {
-		//ValueOperations<String, String> opsHash = redisTemplate.opsForValue();
 		List<OrgTreeNodeEntity> nodeEntities = new LinkedList<>();
 		BladeUser user = AuthUtil.getUser();
 		LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();

+ 3 - 2
src/main/java/org/springblade/modules/baseinfo/org/dto/OrgInfoDTO.java

@@ -9,7 +9,8 @@ package org.springblade.modules.baseinfo.org.dto;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import org.springblade.modules.system.entity.Dept;
+import org.springblade.modules.baseinfo.org.entity.OrgInfoEntity;
+
 
 /***
  * Date:2023/2/22
@@ -21,7 +22,7 @@ import org.springblade.modules.system.entity.Dept;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class OrgInfoDTO extends Dept {
+public class OrgInfoDTO extends OrgInfoEntity {
 	/**
 	 * 区划
 	 */

+ 11 - 11
src/main/java/org/springblade/modules/baseinfo/org/mapper/BaseOrgMapper.xml

@@ -18,20 +18,20 @@
         <result column="dept_name" property="deptName"/>
         <result column="full_name" property="fullName"/>
         <result column="remark" property="remark"/>
-        <result column="reg_type" property="regType"/>
+        <!--<result column="reg_type" property="regType"/>-->
     </resultMap>
 
     <select id="selectPage" resultMap="orgVoResultMap">
         SELECT
-        d.*,a.reg_type
+        d.*
         FROM
         blade_dept d
-        LEFT JOIN blade_dept_att a ON a.dept_id = d.id and a.is_deleted = 0
+--         LEFT JOIN blade_dept_att a ON a.dept_id = d.id and a.is_deleted = 0
         WHERE
         d.is_deleted = 0
-        <if test="dto.regType!=null">
-            and d.reg_type = #{dto.regType}
-        </if>
+        <!--<if test="dto.regType!=null">-->
+            <!--and d.reg_type = #{dto.regType}-->
+        <!--</if>-->
         <if test="dto.deptName!=null">
             and d.full_name like concat(concat('%', #{dto.deptName}), '%')
         </if>
@@ -44,18 +44,18 @@
 
     <select id="selectList" resultMap="orgVoResultMap">
         SELECT
-        d.*,a.reg_type
+        d.*
         FROM
         blade_dept d
-        LEFT JOIN blade_dept_att a ON a.dept_id = d.id and a.is_deleted = 0
+--         LEFT JOIN blade_dept_att a ON a.dept_id = d.id and a.is_deleted = 0
         WHERE
         d.is_deleted = 0
         <if test="dto.parentId!=null">
             and d.parent_id = #{dto.parentId}
         </if>
-        <if test="dto.regType!=null">
-            and d.reg_type = #{dto.regType}
-        </if>
+        <!--<if test="dto.regType!=null">-->
+            <!--and d.reg_type = #{dto.regType}-->
+        <!--</if>-->
         <if test="dto.deptName!=null">
             and d.full_name like concat(concat('%', #{dto.deptName}), '%')
         </if>

+ 9 - 3
src/main/java/org/springblade/modules/baseinfo/org/wrapper/OrgInfoWrapper.java

@@ -13,6 +13,7 @@ import org.springblade.core.mp.support.BaseEntityWrapper;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.SpringUtil;
 import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
+import org.springblade.modules.baseinfo.org.entity.OrgInfoEntity;
 import org.springblade.modules.baseinfo.org.service.IDeptRegionService;
 import org.springblade.modules.baseinfo.org.vo.OrgInfoVO;
 import org.springblade.modules.baseinfo.region.entity.RegionInfoEntity;
@@ -29,7 +30,7 @@ import java.util.Objects;
  * @version 1.0
  * Remark:认为有必要的其他信息
  */
-public class OrgInfoWrapper extends BaseEntityWrapper<Dept, OrgInfoVO> {
+public class OrgInfoWrapper extends BaseEntityWrapper<OrgInfoEntity, OrgInfoVO> {
 
 	public static OrgInfoWrapper build() {
 		return new OrgInfoWrapper();
@@ -55,7 +56,13 @@ public class OrgInfoWrapper extends BaseEntityWrapper<Dept, OrgInfoVO> {
 
 
 	@Override
-	public OrgInfoVO entityVO(Dept entity) {
+	public OrgInfoVO entityVO(OrgInfoEntity entity) {
+		OrgInfoVO orgInfoVO = Objects.requireNonNull(BeanUtil.copy(entity, OrgInfoVO.class));
+
+		return entityVO(orgInfoVO);
+	}
+
+	public OrgInfoVO entityVO(OrgInfoVO entity) {
 		OrgInfoVO orgInfoVO = Objects.requireNonNull(BeanUtil.copy(entity, OrgInfoVO.class));
 		orgInfoVO.setDictValue(entity.getDeptName());
 		LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
@@ -74,5 +81,4 @@ public class OrgInfoWrapper extends BaseEntityWrapper<Dept, OrgInfoVO> {
 		}
 		return orgInfoVO;
 	}
-
 }

+ 0 - 31
src/main/java/org/springblade/modules/baseinfo/rtu/controller/RtuBaseInfoController.java

@@ -122,41 +122,10 @@ public class RtuBaseInfoController extends BladeController {
 	@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();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			if (rtuInfoDTO.getAdCode() == null) {
-				rtuInfoDTO.setAdCode(BusinessConstant.REGION_NM_ADCODE);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			if (rtuInfoDTO.getAdCode() == null) {
-				LambdaQueryWrapper<DeptRegionEntity> deptRegionEntityLambdaQueryWrapper = Wrappers.<DeptRegionEntity>query().lambda();
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getIsDeleted, 0);
-				deptRegionEntityLambdaQueryWrapper.eq(DeptRegionEntity::getDeptId, Func.toLong(user.getDeptId()));
-				DeptRegionEntity deptRegionEntity = deptRegionService.getOne(deptRegionEntityLambdaQueryWrapper);
-				rtuInfoDTO.setAdCode(deptRegionEntity.getAdcd());
-			}
-		}
-		if (rtuInfoDTO.getAdCode() != null) {
-			RegionTreeNodeEntity node = this.regionService.getRegionNode(user.getRoleName(), user.getDeptId(), rtuInfoDTO.getAdCode());
-			if (null != node) {
-				rtuInfoDTO.setExcludeCode(node.getExclude());
-			}
-		}
-		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);
-		}
 		IPage<RtuInfoVO> pages = rtuBaseInfoService.selectPage(Condition.getPage(query), rtuInfoDTO);
 		List<RtuInfoVO> list = pages.getRecords();
 		for (RtuInfoVO vo : list) {

+ 255 - 236
src/main/java/org/springblade/modules/baseinfo/servicePerson/controller/ServicePersonController.java

@@ -26,8 +26,10 @@ import org.springblade.modules.baseinfo.servicePerson.vo.OrgPersonContactVO;
 import org.springblade.modules.baseinfo.servicePerson.vo.ServicePersonVO;
 import org.springblade.modules.baseinfo.servicePerson.wrapper.ServicePersonWrapper;
 import org.springblade.modules.system.entity.Dept;
+import org.springblade.modules.system.entity.Role;
 import org.springblade.modules.system.entity.User;
 import org.springblade.modules.system.service.IDeptService;
+import org.springblade.modules.system.service.IRoleService;
 import org.springblade.modules.system.service.IUserService;
 import org.springblade.modules.system.vo.UserVO;
 import org.springframework.web.bind.annotation.*;
@@ -51,249 +53,266 @@ import java.util.Objects;
 @AllArgsConstructor
 @Api(value = "项目运维人员管理", tags = "项目运维人员管理")
 public class ServicePersonController extends BladeController {
-	private final IServicePersonService servicePersonService;
-	private final IUserService userService;
-	private final IDeptService deptService;
+    private final IServicePersonService servicePersonService;
+    private final IUserService userService;
+    private final IDeptService deptService;
+    private final IRoleService roleService;
 
-	@GetMapping("/page")
-	@ApiImplicitParams({
-		@ApiImplicitParam(name = "realName", value = "人员名称", paramType = "query", dataType = "string"),
-		@ApiImplicitParam(name = "phone", value = "联系电话", paramType = "query", dataType = "string"),
-	})
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "分页")
-	public R<IPage<UserVO>> orgPersonList(@ApiIgnore User userEntity, Query query) {
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
-			deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
-			deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
-			if (null == deptList || deptList.size() == 0) {
-				return R.data(null);
-			}
-			ArrayList<Long> deptIds = new ArrayList<>();
-			for (Dept dept : deptList) {
-				deptIds.add(dept.getId());
-			}
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.in(User::getDeptId, deptIds);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
-			deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
-			deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
-			if (null == deptList || deptList.size() == 0) {
-				return R.data(null);
-			}
-			ArrayList<Long> deptIds = new ArrayList<>();
-			for (Dept dept : deptList) {
-				deptIds.add(dept.getId());
-			}
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.in(User::getDeptId, deptIds);
-			wrapper.eq(User::getPostId, BusinessConstant.POST_ADMIN_ID);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-			wrapper.eq(User::getIsDeleted, 0);
-			wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
-			wrapper.eq(User::getPostId, BusinessConstant.POST_SERVICE_PERSON_ID);
-			if (userEntity.getRealName() != null) {
-				wrapper.like(User::getRealName, userEntity.getRealName());
-			}
-			if (userEntity.getPhone() != null) {
-				wrapper.like(User::getPhone, userEntity.getPhone());
-			}
-			IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
-			return R.data(ServicePersonWrapper.build().pageVO(pages));
-		}
-		return R.data(null);
-	}
+    @GetMapping("/page")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "realName", value = "人员名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "phone", value = "联系电话", paramType = "query", dataType = "string"),
+    })
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "分页")
+    public R<IPage<UserVO>> orgPersonList(@ApiIgnore User userEntity, Query query) {
+        if (Func.isNull(userEntity.getDeptId())) {
+            return R.fail("参数错误");
+        }
+        // BladeUser user = AuthUtil.getUser();
+//        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//            LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
+//            deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(userEntity.getDeptId()));
+//            List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
+//            if (null == deptList || deptList.size() == 0) {
+//                return R.data(null);
+//            }
+//            ArrayList<Long> deptIds = new ArrayList<>();
+//            for (Dept dept : deptList) {
+//                deptIds.add(dept.getId());
+//            }
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        //  wrapper.eq(User::getIsDeleted, 0);
+        //  wrapper.in(User::getDeptId, deptIds);
+        wrapper.eq(User::getDeptId, userEntity.getDeptId());
+//            if (userEntity.getRealName() != null) {
+//                wrapper.like(User::getRealName, userEntity.getRealName());
+//            }
+//            if (userEntity.getPhone() != null) {
+//                wrapper.like(User::getPhone, userEntity.getPhone());
+//            }
+        IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+        return R.data(ServicePersonWrapper.build().pageVO(pages));
+//        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+//            LambdaQueryWrapper<Dept> deptLambdaQueryWrapper = Wrappers.<Dept>query().lambda();
+//            deptLambdaQueryWrapper.eq(Dept::getIsDeleted, 0);
+//            deptLambdaQueryWrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+//            List<Dept> deptList = deptService.list(deptLambdaQueryWrapper);
+//            if (null == deptList || deptList.size() == 0) {
+//                return R.data(null);
+//            }
+//            ArrayList<Long> deptIds = new ArrayList<>();
+//            for (Dept dept : deptList) {
+//                deptIds.add(dept.getId());
+//            }
+//            LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+//            wrapper.eq(User::getIsDeleted, 0);
+//            wrapper.in(User::getDeptId, deptIds);
+//            wrapper.eq(User::getPostId, BusinessConstant.POST_ADMIN_ID);
+//            if (userEntity.getRealName() != null) {
+//                wrapper.like(User::getRealName, userEntity.getRealName());
+//            }
+//            if (userEntity.getPhone() != null) {
+//                wrapper.like(User::getPhone, userEntity.getPhone());
+//            }
+//            IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+//            return R.data(ServicePersonWrapper.build().pageVO(pages));
+//        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
+//            LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+//            wrapper.eq(User::getIsDeleted, 0);
+//            wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+//            wrapper.eq(User::getPostId, BusinessConstant.POST_SERVICE_PERSON_ID);
+//            if (userEntity.getRealName() != null) {
+//                wrapper.like(User::getRealName, userEntity.getRealName());
+//            }
+//            if (userEntity.getPhone() != null) {
+//                wrapper.like(User::getPhone, userEntity.getPhone());
+//            }
+//            IPage<User> pages = userService.page(Condition.getPage(query), wrapper);
+//            return R.data(ServicePersonWrapper.build().pageVO(pages));
+//        }
+        //return R.data(null);
+    }
 
 
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "列表")
-	public R<List<User>> list() {
-		BladeUser user = AuthUtil.getUser();
-		LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-		wrapper.eq(User::getIsDeleted, 0);
-		wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
-		List<User> lists = userService.list(wrapper);
-		return R.data(lists);
-	}
+    @GetMapping("/list")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "列表")
+    public R<List<User>> list() {
+        BladeUser user = AuthUtil.getUser();
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        wrapper.eq(User::getIsDeleted, 0);
+        wrapper.eq(User::getDeptId, Func.toLong(user.getDeptId()));
+        List<User> lists = userService.list(wrapper);
+        return R.data(lists);
+    }
 
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "详情", notes = "传入 User")
-	public R<User> detail(User user) {
-		User detail = userService.getById(user.getId());
-		return R.data(detail);
-	}
+    /**
+     * 详情
+     */
+    @GetMapping("/detail")
+    @ApiOperationSupport(order = 3)
+    @ApiOperation(value = "详情", notes = "传入 User")
+    public R<User> detail(User user) {
+        User detail = userService.getById(user.getId());
+        return R.data(detail);
+    }
 
-	/**
-	 * 新增
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入 User")
-	public R save(@RequestBody User userEntity) {
-		LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
-		wrapper.eq(User::getAccount, userEntity.getAccount());
-		wrapper.eq(User::getIsDeleted, 0);
-		List<User> list = userService.list(wrapper);
-		if (null != list && list.size() > 0) {
-			return R.fail("帐号已经存在");
-		}
-		userEntity.setName(userEntity.getRealName());
-		userEntity.setPassword(DigestUtil.encrypt(userEntity.getAccount() + BusinessConstant.ACCOUNT_PW_SUFFIX));
-		BladeUser user = AuthUtil.getUser();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_ORG_ADMIN_ID);
-			userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_ADMIN_ID);
-			userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName())) {
-			userEntity.setRoleId(BusinessConstant.ROLE_COMPANY_SERVICE_PERSON_ID);
-			userEntity.setPostId(BusinessConstant.POST_SERVICE_PERSON_ID);
-			userEntity.setDeptId(user.getDeptId());
-		} else {
-			return R.fail("用户创建错误!");
-		}
-		userEntity.setUserType(1);
-		return R.status(userService.save(userEntity));
-	}
+    /**
+     * 新增
+     */
+    @PostMapping("/save")
+    @ApiOperationSupport(order = 4)
+    @ApiOperation(value = "新增", notes = "传入 User")
+    public R save(@RequestBody User userEntity) {
+        if (Func.isNull(userEntity.getAccount()) || Func.isNull(userEntity.getRealName()) || Func.isNull(userEntity.getDeptId()) || Func.isNull(userEntity.getRoleId())) {
+            return R.fail("参数错误");
+        }
+        LambdaQueryWrapper<User> wrapper = Wrappers.<User>query().lambda();
+        wrapper.eq(User::getAccount, userEntity.getAccount());
+        long count = userService.count(wrapper);
+        if (count > 0) {
+            return R.fail("帐号已经存在");
+        }
+        userEntity.setName(userEntity.getRealName());
+        userEntity.setPassword(DigestUtil.encrypt(userEntity.getAccount() + BusinessConstant.ACCOUNT_PW_SUFFIX));
+        if ("1".equals(userEntity.getRoleId())) {
+            LambdaQueryWrapper<Role> wrapper2 = Wrappers.<Role>query().lambda();
+            wrapper2.eq(Role::getRoleAlias, BusinessConstant.ROLE_COMPANY_ADMIN_CODE);
+            wrapper2.last("limit 1");
+            Role role = roleService.getOne(wrapper2);
+            if (Func.notNull(role)) {
+                userEntity.setRoleId(Func.toStr(role.getId()));
+            } else {
+                return R.fail("创建失败");
+            }
+        } else if ("2".equals(userEntity.getRoleId())) {
+            LambdaQueryWrapper<Role> wrapper2 = Wrappers.<Role>query().lambda();
+            wrapper2.eq(Role::getRoleAlias, BusinessConstant.ROLE_COMPANY_SERVICE_PERSON_CODE);
+            wrapper2.last("limit 1");
+            Role role = roleService.getOne(wrapper2);
+            if (Func.notNull(role)) {
+                userEntity.setRoleId(Func.toStr(role.getId()));
+            } else {
+                return R.fail("创建失败");
+            }
+        } else {
+            return R.fail("参数错误");
+        }
+        userEntity.setPostId(BusinessConstant.POST_ADMIN_ID);
+        userEntity.setUserType(1);
+        return R.status(userService.save(userEntity));
+    }
 
-	/**
-	 * 修改
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入 User")
-	public R update(@RequestBody User user) {
-		if (Objects.isNull(user.getId())) {
-			return R.fail("用户ID不能为空!");
-		}
-		return R.status(userService.updateById(user));
-	}
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    @ApiOperationSupport(order = 5)
+    @ApiOperation(value = "修改", notes = "传入 User")
+    public R update(@RequestBody User user) {
+        if (Objects.isNull(user.getId())) {
+            return R.fail("用户ID不能为空!");
+        }
+        return R.status(userService.updateById(user));
+    }
 
-	/**
-	 * 删除
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入 ids")
-	public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
-		List<Long> list = Func.toLongList(ids);
-		if (null != list && list.size() > 0) {
-			for (Long id : list) {
-				userService.removeById(id);
-			}
-		}
-		return R.status(true);
-	}
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ApiOperationSupport(order = 7)
+    @ApiOperation(value = "逻辑删除", notes = "传入 ids")
+    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+        List<Long> list = Func.toLongList(ids);
+        if (null != list && list.size() > 0) {
+            for (Long id : list) {
+                userService.removeById(id);
+            }
+        }
+        return R.status(true);
+    }
 
-	/**
-	 * 用户联系表
-	 * @return
-	 */
-	@GetMapping("/contact")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "通讯录")
-	public R<List<OrgPersonContactVO>> contact() {
-		BladeUser user = AuthUtil.getUser();
-		List<OrgPersonContactVO> list = new LinkedList<>();
-		if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> root = this.deptService.list(wrapper);
-			for (Dept dept : root) {
-				OrgPersonContactVO contactVO = new OrgPersonContactVO();
-				contactVO.setId(dept.getId());
-				contactVO.setOrgName(dept.getDeptName());
-				LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-				userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-				userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-				List<User> userList = this.userService.list(userLambdaQueryWrapper);
-				List<ServicePersonVO> personVOList = new LinkedList<>();
-				for (User u : userList) {
-					ServicePersonVO vo = new ServicePersonVO();
-					vo.setId(u.getId());
-					vo.setPersonName(u.getRealName());
-					vo.setContactPhone(u.getPhone());
-					personVOList.add(vo);
-				}
-				contactVO.setServicePersonVOList(personVOList);
-				list.add(contactVO);
-			}
-		} else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-			LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-			wrapper.eq(Dept::getIsDeleted, 0);
-			wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
-			List<Dept> root = this.deptService.list(wrapper);
-			for (Dept dept : root) {
-				OrgPersonContactVO contactVO = new OrgPersonContactVO();
-				contactVO.setId(dept.getId());
-				contactVO.setOrgName(dept.getDeptName());
-				LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-				userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-				userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-				List<User> userList = this.userService.list(userLambdaQueryWrapper);
-				List<ServicePersonVO> personVOList = new LinkedList<>();
-				for (User u : userList) {
-					ServicePersonVO vo = new ServicePersonVO();
-					vo.setId(u.getId());
-					vo.setPersonName(u.getRealName());
-					vo.setContactPhone(u.getPhone());
-					personVOList.add(vo);
-				}
-				contactVO.setServicePersonVOList(personVOList);
-				list.add(contactVO);
-			}
-		} else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-			OrgPersonContactVO contactVO = new OrgPersonContactVO();
-			contactVO.setId(Func.toLong(user.getDeptId()));
-			Dept dept = this.deptService.getById(contactVO.getId());
-			contactVO.setOrgName(dept.getDeptName());
-			LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
-			userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
-			userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
-			List<User> userList = this.userService.list(userLambdaQueryWrapper);
-			List<ServicePersonVO> personVOList = new LinkedList<>();
-			for (User u : userList) {
-				ServicePersonVO vo = new ServicePersonVO();
-				vo.setId(u.getId());
-				vo.setPersonName(u.getRealName());
-				vo.setContactPhone(u.getPhone());
-				personVOList.add(vo);
-			}
-			contactVO.setServicePersonVOList(personVOList);
+    /**
+     * 用户联系表
+     *
+     * @return
+     */
+    @GetMapping("/contact")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "通讯录")
+    public R<List<OrgPersonContactVO>> contact() {
+        BladeUser user = AuthUtil.getUser();
+        List<OrgPersonContactVO> list = new LinkedList<>();
+        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> root = this.deptService.list(wrapper);
+            for (Dept dept : root) {
+                OrgPersonContactVO contactVO = new OrgPersonContactVO();
+                contactVO.setId(dept.getId());
+                contactVO.setOrgName(dept.getDeptName());
+                LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+                userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+                userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+                List<User> userList = this.userService.list(userLambdaQueryWrapper);
+                List<ServicePersonVO> personVOList = new LinkedList<>();
+                for (User u : userList) {
+                    ServicePersonVO vo = new ServicePersonVO();
+                    vo.setId(u.getId());
+                    vo.setPersonName(u.getRealName());
+                    vo.setContactPhone(u.getPhone());
+                    personVOList.add(vo);
+                }
+                contactVO.setServicePersonVOList(personVOList);
+                list.add(contactVO);
+            }
+        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+            LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
+            wrapper.eq(Dept::getIsDeleted, 0);
+            wrapper.eq(Dept::getParentId, Func.toLong(user.getDeptId()));
+            List<Dept> root = this.deptService.list(wrapper);
+            for (Dept dept : root) {
+                OrgPersonContactVO contactVO = new OrgPersonContactVO();
+                contactVO.setId(dept.getId());
+                contactVO.setOrgName(dept.getDeptName());
+                LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+                userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+                userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+                List<User> userList = this.userService.list(userLambdaQueryWrapper);
+                List<ServicePersonVO> personVOList = new LinkedList<>();
+                for (User u : userList) {
+                    ServicePersonVO vo = new ServicePersonVO();
+                    vo.setId(u.getId());
+                    vo.setPersonName(u.getRealName());
+                    vo.setContactPhone(u.getPhone());
+                    personVOList.add(vo);
+                }
+                contactVO.setServicePersonVOList(personVOList);
+                list.add(contactVO);
+            }
+        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+            OrgPersonContactVO contactVO = new OrgPersonContactVO();
+            contactVO.setId(Func.toLong(user.getDeptId()));
+            Dept dept = this.deptService.getById(contactVO.getId());
+            contactVO.setOrgName(dept.getDeptName());
+            LambdaQueryWrapper<User> userLambdaQueryWrapper = Wrappers.<User>query().lambda();
+            userLambdaQueryWrapper.eq(User::getIsDeleted, 0);
+            userLambdaQueryWrapper.eq(User::getDeptId, Func.toStr(dept.getId()));
+            List<User> userList = this.userService.list(userLambdaQueryWrapper);
+            List<ServicePersonVO> personVOList = new LinkedList<>();
+            for (User u : userList) {
+                ServicePersonVO vo = new ServicePersonVO();
+                vo.setId(u.getId());
+                vo.setPersonName(u.getRealName());
+                vo.setContactPhone(u.getPhone());
+                personVOList.add(vo);
+            }
+            contactVO.setServicePersonVOList(personVOList);
 
-			list.add(contactVO);
-		}
-		return R.data(list);
-	}
+            list.add(contactVO);
+        }
+        return R.data(list);
+    }
 }

+ 7 - 0
src/main/java/org/springblade/modules/baseinfo/wateruseconsumer/controller/WaterUseConsumerController.java

@@ -13,6 +13,8 @@ import lombok.AllArgsConstructor;
 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.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 
@@ -51,10 +53,15 @@ public class WaterUseConsumerController extends BladeController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wiuCd", value = "用水户代码", paramType = "query", dataType = "string"),
             @ApiImplicitParam(name = "wiuNm", value = "用水户名称", paramType = "query", dataType = "string"),
+            @ApiImplicitParam(name = "orgId", value = "机构ID", paramType = "query", dataType = "long"),
     })
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<IPage<WaterUseConsumerInfoVO>> page(@ApiIgnore WaterUseConsumerInfoEntity dto, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (Func.isNull(dto.getOrgId())){
+            dto.setOrgId(Func.toLong(user.getDeptId()));
+        }
         IPage<WaterUseConsumerInfoVO> pages = waterUseConsumerService.selectPage(Condition.getPage(query), dto);
         List<WaterUseConsumerInfoVO> list = pages.getRecords();
         for (WaterUseConsumerInfoVO vo : list) {

+ 61 - 31
src/main/java/org/springblade/modules/business/count/controller/CountController.java

@@ -19,7 +19,10 @@ import org.springblade.constant.BusinessConstant;
 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.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.monitorpoint.dto.MonitorPointInfoDTO;
 import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointInfoEntity;
 import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointService;
@@ -31,10 +34,16 @@ import org.springblade.modules.baseinfo.wateruseconsumer.entity.WaterUseConsumer
 import org.springblade.modules.baseinfo.wateruseconsumer.service.IWaterUseConsumerService;
 import org.springblade.modules.business.count.dto.OrgWaterUseCountDTO;
 import org.springblade.modules.business.count.dto.WaterUseConsumerCountDTO;
+import org.springblade.modules.business.count.dto.WaterUseConsumerMonthCountDTO;
+import org.springblade.modules.business.count.dto.WaterUseConsumerYearCountDTO;
 import org.springblade.modules.business.count.entity.MonitorSiteCountEntity;
 import org.springblade.modules.business.count.entity.OrgWaterUseCountEntity;
 import org.springblade.modules.business.count.entity.WaterUseConsumerCountEntity;
 import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+import org.springblade.modules.business.count.service.IWaterUseConsumerMonthCountService;
+import org.springblade.modules.business.count.service.IWaterUseConsumerYearCountService;
+import org.springblade.modules.business.count.vo.WaterUseConsumerMonthCountVO;
+import org.springblade.modules.business.count.vo.WaterUseConsumerYearCountVO;
 import org.springblade.modules.business.home.VO.WarnCountInfoVO;
 import org.springblade.modules.business.monitor.dto.WaterFlowRateHistoryInfoDTO;
 import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
@@ -70,6 +79,8 @@ public class CountController extends BladeController {
     private final IMonitorSiteService monitorSiteService;
     private final IMonitorPointService monitorPointService;
     private final IWaterFlowRateHistoryService waterFlowRateHistoryService;
+    private final IWaterUseConsumerMonthCountService waterUseConsumerMonthCountService;
+    private final IWaterUseConsumerYearCountService waterUseConsumerYearCountService;
 
     /**
      * 监测站统计
@@ -80,17 +91,18 @@ public class CountController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<List<MonitorSiteCountEntity>> monitorsitePage(@ApiIgnore MonitorSiteCountEntity dto) {
+        BladeUser user = AuthUtil.getUser();
+        dto.setDeptId(Func.toLong(user.getDeptId()));
         List<MonitorSiteCountEntity> list = new LinkedList<>();
         //盟市统计
         LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-        wrapper.eq(Dept::getParentId, BusinessConstant.DEPT_XAM_ID);
+        wrapper.eq(Dept::getParentId, dto.getDeptId());
         List<Dept> deptList = this.deptService.list(wrapper);
         for (Dept dept : deptList) {
             MonitorSiteCountEntity vo = new MonitorSiteCountEntity();
             //盟市名称
             vo.setDeptId(dept.getId());
             vo.setAdCity(dept.getDeptName());
-
             //取用水户
             WaterUseConsumerInfoDTO waterUseConsumerInfoDTO = new WaterUseConsumerInfoDTO();
             waterUseConsumerInfoDTO.setOrgId(dept.getId());
@@ -124,33 +136,31 @@ public class CountController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<List<OrgWaterUseCountEntity>> orgWaterUsePage(@ApiIgnore OrgWaterUseCountDTO dto) {
+        BladeUser user = AuthUtil.getUser();
+        dto.setDeptId(Func.toLong(user.getDeptId()));
         List<OrgWaterUseCountEntity> list = new LinkedList<>();
         //盟市统计
         LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-        wrapper.eq(Dept::getParentId, BusinessConstant.DEPT_XAM_ID);
+        wrapper.eq(Dept::getParentId, dto.getDeptId());
         List<Dept> deptList = this.deptService.list(wrapper);
         for (Dept dept : deptList) {
             OrgWaterUseCountEntity vo = new OrgWaterUseCountEntity();
             //盟市名称
             vo.setDeptId(dept.getId());
             vo.setAdCity(dept.getDeptName());
-
             WaterFlowRateHistoryInfoDTO infoDTO = new WaterFlowRateHistoryInfoDTO();
             infoDTO.setOrgId(dept.getId());
-
             List<OrgWaterFlowCountInfoVO> waterFlowCountInfoVOList = waterFlowRateHistoryService.orgWaterUseCount(infoDTO);
             if (null != waterFlowCountInfoVOList && waterFlowCountInfoVOList.size() > 0) {
-                vo.setWaterFlowSum(waterFlowCountInfoVOList.get(0).getMpaccq().longValue());
+                vo.setWaterFlowSum(waterFlowCountInfoVOList.get(0).getMpaccq());
             } else {
-                vo.setWaterFlowSum(0L);
+                vo.setWaterFlowSum(0.0);
             }
-
             //取用水户
             WaterUseConsumerInfoDTO waterUseConsumerInfoDTO = new WaterUseConsumerInfoDTO();
             waterUseConsumerInfoDTO.setOrgId(dept.getId());
             long count = waterUseConsumerService.getWaterUseConsumerCount(waterUseConsumerInfoDTO);
             vo.setWaterUseConsumer(count);
-
             list.add(vo);
         }
         list.sort(new Comparator<OrgWaterUseCountEntity>() {
@@ -181,7 +191,12 @@ public class CountController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
     public R<List<WaterUseConsumerCountEntity>> waterUseConsumerPage(@ApiIgnore WaterUseConsumerCountDTO dto) {
+        BladeUser user = AuthUtil.getUser();
+        if (Func.isNull(dto.getOrgId())){
+            dto.setOrgId(Func.toLong(user.getDeptId()));
+        }
         WaterFlowRateHistoryInfoDTO infoDTO = new WaterFlowRateHistoryInfoDTO();
+        infoDTO.setOrgId(dto.getOrgId());
         List<ConsumerWaterFlowCountInfoVO> voList = waterFlowRateHistoryService.consumerWaterUseCount(infoDTO);
         voList.sort(new Comparator<ConsumerWaterFlowCountInfoVO>() {
             @Override
@@ -195,13 +210,12 @@ public class CountController extends BladeController {
             }
         });
         List<WaterUseConsumerCountEntity> list = new ArrayList<>();
-        for (ConsumerWaterFlowCountInfoVO vo :voList){
+        for (ConsumerWaterFlowCountInfoVO vo : voList) {
             WaterUseConsumerCountEntity entity = new WaterUseConsumerCountEntity();
             entity.setWiuCd(vo.getWiuCd());
-            entity.setWaterFlowSum(vo.getMpaccq().longValue());
+            entity.setWaterFlowSum(vo.getMpaccq());
             LambdaQueryWrapper<WaterUseConsumerInfoEntity> wrapper = Wrappers.<WaterUseConsumerInfoEntity>query().lambda();
-            wrapper.eq(WaterUseConsumerInfoEntity::getIsDeleted, 0);
-            wrapper.eq(WaterUseConsumerInfoEntity::getWiuCd,vo.getWiuCd());
+            wrapper.eq(WaterUseConsumerInfoEntity::getWiuCd, vo.getWiuCd());
             wrapper.last("limit 1");
             WaterUseConsumerInfoEntity infoEntity = waterUseConsumerService.getOne(wrapper);
             entity.setWiuNm(infoEntity.getWiuNm());
@@ -210,21 +224,26 @@ public class CountController extends BladeController {
         return R.data(list);
     }
 
-    @GetMapping("/wateruseconsumer/month/list")
+    @GetMapping("/wateruseconsumer/month/page")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
-    public R<List<WaterUseConsumerMonthCountEntity>> consumerWaterUseMonthList(@ApiIgnore WaterFlowRateHistoryInfoDTO dto, Query query) {
-
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(dto.getCountTime());
-        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);
-        List<WaterUseConsumerMonthCountEntity> list = new LinkedList<>();
-
-        return R.data(list);
+    public R<IPage<WaterUseConsumerMonthCountVO>> consumerWaterUseMonthList(@ApiIgnore WaterUseConsumerMonthCountDTO dto, Query query) {
+//        BladeUser user = AuthUtil.getUser();
+//        if (Func.isNull(dto.getOrgId())) {
+//            dto.setOrgId(Func.toLong(user.getDeptId()));
+//        }
+        if (Func.notNull(dto.getTm())) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(dto.getTm());
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            calendar.set(Calendar.MILLISECOND, 0);
+            dto.setTm(calendar.getTime());
+        }
+        IPage<WaterUseConsumerMonthCountVO> pages = waterUseConsumerMonthCountService.selectPage(Condition.getPage(query), dto);
+        return R.data(pages);
     }
 
     @GetMapping("/wateruseconsumer/year/page")
@@ -233,12 +252,23 @@ public class CountController extends BladeController {
     })
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页")
-    public R<IPage<WaterFlowRateHistoryInfoVO>> consumerWaterUseYearPage(@ApiIgnore WaterFlowRateHistoryInfoDTO dto, Query query) {
-        IPage<WaterFlowRateHistoryInfoVO> pages = waterFlowRateHistoryService.selectPage(Condition.getPage(query), dto);
-        List<WaterFlowRateHistoryInfoVO> list = pages.getRecords();
-        for (WaterFlowRateHistoryInfoVO v : list) {
-            WaterFlowRateHistoryWrapper.build().entityVO(v);
+    public R<IPage<WaterUseConsumerYearCountVO>> consumerWaterUseYearPage(@ApiIgnore WaterUseConsumerYearCountDTO dto, Query query) {
+//        BladeUser user = AuthUtil.getUser();
+//        if (Func.isNull(dto.getOrgId())) {
+//            dto.setOrgId(Func.toLong(user.getDeptId()));
+//        }
+        if (Func.notNull(dto.getTm())) {
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(dto.getTm());
+            calendar.set(Calendar.MONTH, 0);
+            calendar.set(Calendar.DAY_OF_MONTH, 1);
+            calendar.set(Calendar.HOUR_OF_DAY, 0);
+            calendar.set(Calendar.MINUTE, 0);
+            calendar.set(Calendar.SECOND, 0);
+            calendar.set(Calendar.MILLISECOND, 0);
+            dto.setTm(calendar.getTime());
         }
+        IPage<WaterUseConsumerYearCountVO> pages = waterUseConsumerYearCountService.selectPage(Condition.getPage(query), dto);
         return R.data(pages);
     }
 }

+ 31 - 0
src/main/java/org/springblade/modules/business/count/dto/WaterUseConsumerMonthCountDTO.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2023/10/26
+ */
+package org.springblade.modules.business.count.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+
+/***
+ * Date:2023/10/26
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WaterUseConsumerMonthCountDTO extends WaterUseConsumerMonthCountEntity {
+    /**
+     * 机构ID
+     */
+    @ApiModelProperty("机构ID")
+    private Long orgId;
+
+}

+ 31 - 0
src/main/java/org/springblade/modules/business/count/dto/WaterUseConsumerYearCountDTO.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2023/10/26
+ */
+package org.springblade.modules.business.count.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+
+/***
+ * Date:2023/10/26
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WaterUseConsumerYearCountDTO extends WaterUseConsumerYearCountEntity {
+    /**
+     * 机构ID
+     */
+    @ApiModelProperty("机构ID")
+    private Long orgId;
+
+}

+ 1 - 1
src/main/java/org/springblade/modules/business/count/entity/OrgWaterUseCountEntity.java

@@ -44,5 +44,5 @@ public class OrgWaterUseCountEntity extends BaseEntity {
      * 当月累计用水量
      */
     @JsonSerialize(nullsUsing = NullSerializer.class)
-    private Long waterFlowSum;
+    private Double waterFlowSum;
 }

+ 1 - 1
src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerCountEntity.java

@@ -52,5 +52,5 @@ public class WaterUseConsumerCountEntity extends BaseEntity {
      * 当月累计用水量
      */
     @JsonSerialize(nullsUsing = NullSerializer.class)
-    private Long waterFlowSum;
+    private Double waterFlowSum;
 }

+ 13 - 12
src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerMonthCountEntity.java

@@ -6,6 +6,8 @@
  */
 package org.springblade.modules.business.count.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.NullSerializer;
@@ -27,35 +29,34 @@ import java.util.Date;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
+@TableName("count_wiu_month_acc")
 public class WaterUseConsumerMonthCountEntity extends BaseEntity {
     /**
      * 取用水户代码
      */
     @ApiModelProperty(value = "取用水户代码")
+    @TableField("wiu_cd")
     private String wiuCd;
 
-    /**
-     * 取用水户名称
-     */
-    @ApiModelProperty(value = "取用水户名称")
-    private String wiuNm;
 
     /**
-     * 当月累计用水量
+     * 累计用水量
      */
     @JsonSerialize(nullsUsing = NullSerializer.class)
-    private Long waterFlowSum;
+    @TableField("acc_w")
+    private Long accw;
 
     /**
-     * 设站年月
+     * 时间
      */
-    @ApiModelProperty(value = "设站年月")
+    @ApiModelProperty("时间")
     @DateTimeFormat(
-            pattern = "yyyy-MM"
+            pattern = "yyyy-MM-dd HH:mm:ss"
     )
     @JsonFormat(
-            pattern = "yyyy-MM",
+            pattern = "yyyy-MM-dd HH:mm:ss",
             timezone = "GMT+8"
     )
-    private Date countDate;
+    @TableField("tm")
+    private Date tm;
 }

+ 38 - 0
src/main/java/org/springblade/modules/business/count/entity/WaterUseConsumerYearCountEntity.java

@@ -6,9 +6,18 @@
  */
 package org.springblade.modules.business.count.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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;
 import org.springblade.core.mp.base.BaseEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
 
 /***
  * Date:2023/10/26
@@ -20,5 +29,34 @@ import org.springblade.core.mp.base.BaseEntity;
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
+@TableName("count_wiu_year_acc")
 public class WaterUseConsumerYearCountEntity extends BaseEntity {
+    /**
+     * 取用水户代码
+     */
+    @ApiModelProperty(value = "取用水户代码")
+    @TableField("wiu_cd")
+    private String wiuCd;
+
+
+    /**
+     * 累计用水量
+     */
+    @JsonSerialize(nullsUsing = NullSerializer.class)
+    @TableField("acc_w")
+    private Long accw;
+
+    /**
+     * 时间
+     */
+    @ApiModelProperty("时间")
+    @DateTimeFormat(
+            pattern = "yyyy-MM-dd"
+    )
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    @TableField("tm")
+    private Date tm;
 }

+ 36 - 0
src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerMonthCountMapper.java

@@ -0,0 +1,36 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2022/8/28
+ */
+package org.springblade.modules.business.count.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.business.count.dto.WaterUseConsumerMonthCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+import org.springblade.modules.business.count.vo.WaterUseConsumerMonthCountVO;
+
+
+import java.util.List;
+
+/***
+ * Date:2022/8/28
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface WaterUseConsumerMonthCountMapper extends BaseMapper<WaterUseConsumerMonthCountEntity> {
+	/**
+	 * 自定义分页
+	 *
+	 * @param page 分页
+	 * @return List<RtuInfoVO>
+	 */
+	List<WaterUseConsumerMonthCountVO> selectPage(IPage page, @Param("dto") WaterUseConsumerMonthCountDTO dto);
+
+}

+ 43 - 0
src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerMonthCountMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.business.count.mapper.WaterUseConsumerMonthCountMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="monthCountResultMap"
+               type="org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity">
+        <result column="wiu_cd" property="wiuCd"/>
+        <result column="tm" property="tm"/>
+        <result column="acc_w" property="accw"/>
+    </resultMap>
+
+    <resultMap id="monthCountResultVOMap"
+               type="org.springblade.modules.business.count.vo.WaterUseConsumerMonthCountVO">
+        <result column="wiu_cd" property="wiuCd"/>
+        <result column="tm" property="tm"/>
+        <result column="acc_w" property="accw"/>
+        <result column="wiu_nm" property="wiuNm"/>
+    </resultMap>
+
+
+    <select id="selectPage" resultMap="monthCountResultVOMap">
+        SELECT
+        n.*,w.wiu_nm
+        FROM
+        count_wiu_month_acc n
+        LEFT JOIN base_wr_wiu_info w ON w.wiu_cd = n.wiu_cd and w.is_deleted=0
+        LEFT JOIN blade_dept d ON d.id = w.org_id and d.is_deleted=0
+        WHERE
+        n.is_deleted = 0
+        <if test="dto.wiuCd!=null">
+            and n.wiu_cd = #{dto.wiuCd}
+        </if>
+        <if test="dto.tm!=null">
+            and n.tm = #{dto.tm}
+        </if>
+        <if test="dto.orgId!=null">
+            and (w.org_id =#{dto.orgId} or  FIND_IN_SET(#{dto.orgId} ,d.ancestors) >0 )
+        </if>
+        order by n.tm desc,n.acc_w desc
+    </select>
+
+</mapper>

+ 36 - 0
src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerYearCountMapper.java

@@ -0,0 +1,36 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2022/8/28
+ */
+package org.springblade.modules.business.count.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.business.count.dto.WaterUseConsumerYearCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+import org.springblade.modules.business.count.vo.WaterUseConsumerYearCountVO;
+
+import java.util.List;
+
+/***
+ * Date:2022/8/28
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface WaterUseConsumerYearCountMapper extends BaseMapper<WaterUseConsumerYearCountEntity> {
+	/**
+	 * 自定义分页
+	 *
+	 * @param page 分页
+	 * @return List<RtuInfoVO>
+	 */
+	List<WaterUseConsumerYearCountVO> selectPage(IPage page, @Param("dto") WaterUseConsumerYearCountDTO dto);
+
+
+}

+ 42 - 0
src/main/java/org/springblade/modules/business/count/mapper/WaterUseConsumerYearCountMapper.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.business.count.mapper.WaterUseConsumerYearCountMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="yearCountResultMap"
+               type="org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity">
+        <result column="wiu_cd" property="wiuCd"/>
+        <result column="tm" property="tm"/>
+        <result column="acc_w" property="accw"/>
+    </resultMap>
+
+    <resultMap id="yearCountResultVOMap"
+               type="org.springblade.modules.business.count.vo.WaterUseConsumerYearCountVO">
+        <result column="wiu_cd" property="wiuCd"/>
+        <result column="tm" property="tm"/>
+        <result column="acc_w" property="accw"/>
+        <result column="wiu_nm" property="wiuNm"/>
+    </resultMap>
+
+
+    <select id="selectPage" resultMap="yearCountResultVOMap">
+        SELECT
+        n.*,w.wiu_nm
+        FROM
+        count_wiu_year_acc n
+        LEFT JOIN base_wr_wiu_info w ON w.wiu_cd = n.wiu_cd and w.is_deleted=0
+        LEFT JOIN blade_dept d ON d.id = w.org_id and d.is_deleted=0
+        WHERE
+        n.is_deleted = 0
+        <if test="dto.wiuCd!=null">
+            and n.wiu_cd = #{dto.wiuCd}
+        </if>
+        <if test="dto.tm!=null">
+            and n.tm = #{dto.tm}
+        </if>
+        <if test="dto.orgId!=null">
+            and (w.org_id =#{dto.orgId} or  FIND_IN_SET(#{dto.orgId} ,d.ancestors) >0 )
+        </if>
+        order by n.tm desc,n.acc_w desc
+    </select>
+</mapper>

+ 32 - 0
src/main/java/org/springblade/modules/business/count/service/IWaterUseConsumerMonthCountService.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/20
+ */
+package org.springblade.modules.business.count.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.business.count.dto.WaterUseConsumerMonthCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+import org.springblade.modules.business.count.vo.WaterUseConsumerMonthCountVO;
+
+
+/***
+ * Date:2023/12/20
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IWaterUseConsumerMonthCountService extends BaseService<WaterUseConsumerMonthCountEntity> {
+    /**
+     * 自定义分页
+     *
+     * @param page
+     * @return
+     */
+    IPage<WaterUseConsumerMonthCountVO> selectPage(IPage<WaterUseConsumerMonthCountVO> page, WaterUseConsumerMonthCountDTO dto);
+}

+ 32 - 0
src/main/java/org/springblade/modules/business/count/service/IWaterUseConsumerYearCountService.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/20
+ */
+package org.springblade.modules.business.count.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.business.count.dto.WaterUseConsumerYearCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+import org.springblade.modules.business.count.vo.WaterUseConsumerYearCountVO;
+
+
+/***
+ * Date:2023/12/20
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IWaterUseConsumerYearCountService extends BaseService<WaterUseConsumerYearCountEntity> {
+    /**
+     * 自定义分页
+     *
+     * @param page
+     * @return
+     */
+    IPage<WaterUseConsumerYearCountVO> selectPage(IPage<WaterUseConsumerYearCountVO> page, WaterUseConsumerYearCountDTO dto);
+}

+ 34 - 0
src/main/java/org/springblade/modules/business/count/service/impl/WaterUseConsumerMonthCountServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/20
+ */
+package org.springblade.modules.business.count.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.business.count.dto.WaterUseConsumerMonthCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+import org.springblade.modules.business.count.mapper.WaterUseConsumerMonthCountMapper;
+import org.springblade.modules.business.count.service.IWaterUseConsumerMonthCountService;
+import org.springblade.modules.business.count.vo.WaterUseConsumerMonthCountVO;
+import org.springframework.stereotype.Service;
+
+/***
+ * Date:2023/12/20
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@Slf4j
+public class WaterUseConsumerMonthCountServiceImpl extends BaseServiceImpl<WaterUseConsumerMonthCountMapper, WaterUseConsumerMonthCountEntity> implements IWaterUseConsumerMonthCountService {
+    @Override
+    public IPage<WaterUseConsumerMonthCountVO> selectPage(IPage<WaterUseConsumerMonthCountVO> page, WaterUseConsumerMonthCountDTO dto) {
+        return page.setRecords(baseMapper.selectPage(page, dto));
+    }
+}

+ 36 - 0
src/main/java/org/springblade/modules/business/count/service/impl/WaterUseConsumerYearCountServiceImpl.java

@@ -0,0 +1,36 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/20
+ */
+package org.springblade.modules.business.count.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.business.count.dto.WaterUseConsumerYearCountDTO;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+import org.springblade.modules.business.count.mapper.WaterUseConsumerYearCountMapper;
+import org.springblade.modules.business.count.service.IWaterUseConsumerYearCountService;
+import org.springblade.modules.business.count.vo.WaterUseConsumerYearCountVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/20
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@Slf4j
+public class WaterUseConsumerYearCountServiceImpl extends BaseServiceImpl<WaterUseConsumerYearCountMapper, WaterUseConsumerYearCountEntity> implements IWaterUseConsumerYearCountService {
+    @Override
+    public IPage<WaterUseConsumerYearCountVO> selectPage(IPage<WaterUseConsumerYearCountVO> page, WaterUseConsumerYearCountDTO dto) {
+        return page.setRecords(baseMapper.selectPage(page, dto));
+    }
+}

+ 31 - 0
src/main/java/org/springblade/modules/business/count/vo/WaterUseConsumerMonthCountVO.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2023/10/26
+ */
+package org.springblade.modules.business.count.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.business.count.entity.WaterUseConsumerMonthCountEntity;
+
+/***
+ * Date:2023/10/26
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WaterUseConsumerMonthCountVO extends WaterUseConsumerMonthCountEntity {
+    /**
+     * 取用水户名称
+     */
+    @ApiModelProperty(value = "取用水户名称")
+    private String wiuNm;
+
+}

+ 30 - 0
src/main/java/org/springblade/modules/business/count/vo/WaterUseConsumerYearCountVO.java

@@ -0,0 +1,30 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 运维系统
+ * 创建日期:2023/10/26
+ */
+package org.springblade.modules.business.count.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.business.count.entity.WaterUseConsumerYearCountEntity;
+
+/***
+ * Date:2023/10/26
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WaterUseConsumerYearCountVO extends WaterUseConsumerYearCountEntity {
+    /**
+     * 取用水户名称
+     */
+    @ApiModelProperty(value = "取用水户名称")
+    private String wiuNm;
+}

+ 29 - 15
src/main/java/org/springblade/modules/business/home/controller/HomeController.java

@@ -28,6 +28,7 @@ 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.dto.MonitorSiteInfoDTO;
 import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteInfoEntity;
 import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
 import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
@@ -36,6 +37,7 @@ 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.dto.WaterUseConsumerInfoDTO;
 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;
@@ -113,25 +115,33 @@ public class HomeController {
     @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);
+//        LambdaQueryWrapper<WaterUseConsumerInfoEntity> wrapper = Wrappers.<WaterUseConsumerInfoEntity>query().lambda();
+//        wrapper.eq(WaterUseConsumerInfoEntity::getIsDeleted, 0);
+        WaterUseConsumerInfoDTO waterUseConsumerInfoDTO = new WaterUseConsumerInfoDTO();
+        waterUseConsumerInfoDTO.setOrgId(Func.toLong(user.getDeptId()));
+        long count = waterUseConsumerService.getWaterUseConsumerCount(waterUseConsumerInfoDTO);
         infoVO.setWaterUseConsumers(count);
 
-        LambdaQueryWrapper<MonitorSiteInfoEntity> wrapper2 = Wrappers.<MonitorSiteInfoEntity>query().lambda();
-        wrapper2.eq(MonitorSiteInfoEntity::getIsDeleted, 0);
-        count = monitorSiteService.count(wrapper2);
+//        LambdaQueryWrapper<MonitorSiteInfoEntity> wrapper2 = Wrappers.<MonitorSiteInfoEntity>query().lambda();
+//        wrapper2.eq(MonitorSiteInfoEntity::getIsDeleted, 0);
+        MonitorSiteInfoDTO monitorSiteInfoDTO = new MonitorSiteInfoDTO();
+        monitorSiteInfoDTO.setOrgId(Func.toLong(user.getDeptId()));
+        count = monitorSiteService.getMonitorSiteCount(monitorSiteInfoDTO);
         infoVO.setMonitorSites(count);
 
-        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
-        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
-        count = monitorPointService.count(wrapper3);
+//        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
+//        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
+        MonitorPointInfoDTO monitorPointInfoDTO = new MonitorPointInfoDTO();
+        monitorPointInfoDTO.setOrgId(Func.toLong(user.getDeptId()));
+        count = monitorPointService.getMonitorPointCount(monitorPointInfoDTO);
         infoVO.setMonitorPoints(count);
 
         //预警数量
         RtuWarningInfoDTO dto = new RtuWarningInfoDTO();
+        dto.setDeptId(Func.toLong(user.getDeptId()));
         long warningRtuCount = rtuWarningService.warningRtuCount(dto);
         infoVO.setWarnRtus(warningRtuCount);
         //离线数量
@@ -139,7 +149,6 @@ public class HomeController {
         infoVO.setOfflineRtus(count);
         //其他异常
         infoVO.setOtherWarnRtus((warningRtuCount - count));
-
         return R.data(infoVO);
     }
 
@@ -147,11 +156,13 @@ public class HomeController {
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "详情")
     public R<RtuUpDataCountInfoVO> rtuUpCountInfo() {
-
+        BladeUser user = AuthUtil.getUser();
         RtuUpDataCountInfoVO infoVO = new RtuUpDataCountInfoVO();
-        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
-        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
-        long count = monitorPointService.count(wrapper3);
+//        LambdaQueryWrapper<MonitorPointInfoEntity> wrapper3 = Wrappers.<MonitorPointInfoEntity>query().lambda();
+//        wrapper3.eq(MonitorPointInfoEntity::getIsDeleted, 0);
+        MonitorPointInfoDTO monitorPointInfoDTO = new MonitorPointInfoDTO();
+        monitorPointInfoDTO.setOrgId(Func.toLong(user.getDeptId()));
+        long count = monitorPointService.getMonitorPointCount(monitorPointInfoDTO);
         infoVO.setMonitorPoints(count);
 
         Calendar calendar = Calendar.getInstance();
@@ -163,6 +174,7 @@ public class HomeController {
         Date beiganTime = calendar.getTime();
         //监测点小时上报统计
         WaterFlowRateHistoryInfoDTO dto = new WaterFlowRateHistoryInfoDTO();
+        dto.setOrgId(Func.toLong(user.getDeptId()));
         dto.setBeginTime(beiganTime);
         dto.setEndTime(endTime);
         count = waterFlowRateHistoryService.rtuUpDataCount(dto);
@@ -178,6 +190,7 @@ public class HomeController {
         beiganTime = calendar.getTime();
         //监测点日上报统计
         dto = new WaterFlowRateHistoryInfoDTO();
+        dto.setOrgId(Func.toLong(user.getDeptId()));
         dto.setBeginTime(beiganTime);
         dto.setEndTime(endTime);
         count = waterFlowRateHistoryService.rtuUpDataCount(dto);
@@ -190,10 +203,11 @@ public class HomeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "预警统计列表", notes = "")
     public R<List<WarnCountInfoVO>> warnCountInfoList() {
+        BladeUser user = AuthUtil.getUser();
         List<WarnCountInfoVO> list = new LinkedList<>();
         //盟市统计
         LambdaQueryWrapper<Dept> wrapper = Wrappers.<Dept>query().lambda();
-        wrapper.eq(Dept::getParentId,BusinessConstant.DEPT_XAM_ID);
+        wrapper.eq(Dept::getParentId,Func.toLong(user.getDeptId()));
         List<Dept> deptList = this.deptService.list(wrapper);
         for (Dept dept : deptList) {
             WarnCountInfoVO vo = new WarnCountInfoVO();

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

@@ -16,13 +16,10 @@ import lombok.AllArgsConstructor;
 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.secure.BladeUser;
+import org.springblade.core.secure.utils.AuthUtil;
 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;
@@ -65,6 +62,10 @@ public class WaterFlowRateMonitorController extends BladeController {
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "分页")
     public R<IPage<WaterFlowRateInfoVO>> page(@ApiIgnore WaterFlowRateInfoDTO dto, Query query) {
+        BladeUser user = AuthUtil.getUser();
+        if (Func.isNull(dto.getOrgId())){
+            dto.setOrgId(Func.toLong(user.getDeptId()));
+        }
         IPage<WaterFlowRateInfoVO> pages = waterFlowRateService.selectPage(Condition.getPage(query), dto);
         List<WaterFlowRateInfoVO> list = pages.getRecords();
         for (WaterFlowRateInfoVO v : list) {

+ 5 - 0
src/main/java/org/springblade/modules/business/monitor/entity/WaterFlowRateHistoryInfoEntity.java

@@ -128,4 +128,9 @@ public class WaterFlowRateHistoryInfoEntity extends BaseEntity {
     @ApiModelProperty("报文ID")
     @TableField("packet_uuid")
     private String packetuuid;
+
+    @ApiModelProperty("水位")
+    @JsonSerialize(nullsUsing = NullSerializer.class)
+    @TableField("water_level")
+    private Double waterLevel;
 }

+ 5 - 0
src/main/java/org/springblade/modules/business/monitor/entity/WaterFlowRateInfoEntity.java

@@ -128,4 +128,9 @@ public class WaterFlowRateInfoEntity extends BaseEntity {
     @ApiModelProperty("报文ID")
     @TableField("packet_uuid")
     private String packetuuid;
+
+    @ApiModelProperty("水位")
+    @JsonSerialize(nullsUsing = NullSerializer.class)
+    @TableField("water_level")
+    private Double waterLevel;
 }

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

@@ -15,6 +15,7 @@
         <result column="ts" property="ts"/>
         <result column="packet_uuid" property="packetuuid"/>
         <result column="hour_w" property="hourw"/>
+        <result column="water_level" property="waterLevel"/>
     </resultMap>
 
 
@@ -99,14 +100,21 @@
         LEFT JOIN base_wiust_info site ON site.wiust_cd = mp.wiust_cd AND site.is_deleted=0
         LEFT JOIN base_wiu_wiust_rel ww ON ww.wiust_cd = site.wiust_cd AND ww.is_deleted=0
         LEFT JOIN base_wr_wiu_info u ON u.wiu_cd = ww.wiu_cd AND u.is_deleted=0
+        LEFT JOIN blade_dept d ON d.id = u.org_id and d.is_deleted=0
         WHERE
             q.is_deleted = 0
+        <if test="dto.wiuCd!=null">
+            AND u.wiu_cd = #{dto.wiuCd}
+        </if>
         <if test="dto.beginTime!=null">
             AND q.tm >= #{dto.beginTime}
         </if>
         <if test="dto.endTime!=null">
             AND q.tm &lt; #{dto.endTime}
         </if>
+        <if test="dto.orgId!=null">
+            and (u.org_id =#{dto.orgId} or  FIND_IN_SET(#{dto.orgId} ,d.ancestors) >0 )
+        </if>
         GROUP BY u.wiu_cd
     </select>
 </mapper>

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

@@ -15,6 +15,7 @@
         <result column="ts" property="ts"/>
         <result column="packet_uuid" property="packetuuid"/>
         <result column="hour_w" property="hourw"/>
+        <result column="water_level" property="waterLevel"/>
     </resultMap>
 
 
@@ -29,6 +30,7 @@
         <result column="qr_ts" property="ts"/>
         <result column="packet_uuid" property="packetuuid"/>
         <result column="hour_w" property="hourw"/>
+        <result column="water_level" property="waterLevel"/>
 
         <result column="mp_nm" property="mpnm"/>
         <result column="run_status_id" property="runStatusId"/>
@@ -45,22 +47,8 @@
 
 
     <select id="selectPage" resultMap="waterFlowRateVOResultMap">
---         SELECT
---         s.*,i.mp_cd,n.tm,n.mp_q,n.acc_w,n.in_stp_q,n.acc_pq_w,n.spe_reg_data,n.ts,n.packet_uuid,n.hour_w,i.mp_nm,i.lat,i.lng,i.mp_addr,i.mp_item,i.is_auto,i.sour_tp,w.wiust_cd,w.wiust_nm,u.wiu_cd,u.wiu_nm
---         FROM
---         rtu_status s
---         LEFT JOIN base_wiust_info w ON w.wiust_cd = s.rtu_code and w.is_deleted=0
---         LEFT JOIN base_wiust_mp_rel wm ON wm.wiust_cd = w.wiust_cd and wm.is_deleted=0
---         LEFT JOIN base_mp_info i ON i.mp_cd = wm.mp_cd and i.is_deleted=0
---         LEFT JOIN data_mp_qr_cache n ON n.mp_cd = i.mp_cd and n.is_deleted=0
---         LEFT JOIN base_wiu_wiust_rel ww ON ww.wiust_cd = w.wiust_cd and ww.is_deleted=0
---         LEFT JOIN base_wr_wiu_info u ON u.wiu_cd = ww.wiu_cd and u.is_deleted=0
---         LEFT JOIN rtu_info r ON r.rtu_code = s.rtu_code and r.is_deleted = 0
---         LEFT JOIN blade_dept d ON d.id = r.org_id and d.is_deleted=0
---         WHERE
---         s.is_deleted = 0
         SELECT
-        i.*,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,w.wiust_cd,w.wiust_nm,u.wiu_cd,u.wiu_nm,s.run_status_id,s.last_up_time
+        i.*,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,n.water_level,w.wiust_cd,w.wiust_nm,u.wiu_cd,u.wiu_nm,s.run_status_id,s.last_up_time
         FROM
         base_mp_info i
         LEFT JOIN data_mp_qr_cache n ON n.mp_cd = i.mp_cd and n.is_deleted=0
@@ -68,9 +56,8 @@
         LEFT JOIN base_wiust_info w ON w.wiust_cd = wm.wiust_cd and w.is_deleted=0
         LEFT JOIN base_wiu_wiust_rel ww ON ww.wiust_cd = w.wiust_cd and ww.is_deleted=0
         LEFT JOIN base_wr_wiu_info u ON u.wiu_cd = ww.wiu_cd and u.is_deleted=0
-        LEFT JOIN rtu_info r ON r.rtu_code = w.wiust_cd and r.is_deleted = 0
-        LEFT JOIN blade_dept d ON d.id = r.org_id and d.is_deleted=0
-        LEFT JOIN rtu_status s ON s.rtu_code = r.rtu_code and s.is_deleted=0
+        LEFT JOIN blade_dept d ON d.id = u.org_id and d.is_deleted=0
+        LEFT JOIN rtu_status s ON s.rtu_code = w.wiust_cd and s.is_deleted=0
         WHERE
         i.is_deleted =0
         <if test="dto.wiuNm!=null ">
@@ -83,7 +70,7 @@
             and i.mp_cd like concat(concat('%', #{dto.mpcd}), '%')
         </if>
         <if test="dto.orgId!=null">
-            and (r.org_id =#{dto.orgId} or  FIND_IN_SET(#{dto.orgId} ,d.ancestors) >0 )
+            and (u.org_id =#{dto.orgId} or  FIND_IN_SET(#{dto.orgId} ,d.ancestors) >0 )
         </if>
         <choose>
             <when test="dto.order!=null and dto.order=='ascending'">

+ 8 - 22
src/main/java/org/springblade/modules/business/monitor/service/impl/WaterFlowRateHistoryServiceImpl.java

@@ -9,6 +9,7 @@ package org.springblade.modules.business.monitor.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.extern.slf4j.Slf4j;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointRelEntity;
@@ -35,6 +36,7 @@ import java.util.List;
  * Remark:认为有必要的其他信息
  */
 @Service
+@Slf4j
 public class WaterFlowRateHistoryServiceImpl extends BaseServiceImpl<WaterFlowRateHistoryMapper, WaterFlowRateHistoryInfoEntity> implements IWaterFlowRateHistoryService {
 
     @Override
@@ -59,7 +61,6 @@ public class WaterFlowRateHistoryServiceImpl extends BaseServiceImpl<WaterFlowRa
 
     @Override
     public double getDayAccw(String mpcd) {
-
         Date tm = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(tm);
@@ -68,45 +69,30 @@ public class WaterFlowRateHistoryServiceImpl extends BaseServiceImpl<WaterFlowRa
         calendar.set(Calendar.SECOND,0);
         calendar.set(Calendar.MILLISECOND,0);
         Date et =  calendar.getTime();
-
         calendar.add(Calendar.DAY_OF_MONTH,-1);
         Date st = calendar.getTime();
-
         LambdaQueryWrapper<WaterFlowRateHistoryInfoEntity> wrapper = Wrappers.<WaterFlowRateHistoryInfoEntity>query().lambda();
+        wrapper.eq(WaterFlowRateHistoryInfoEntity::getMpcd,mpcd);
         wrapper.ge(WaterFlowRateHistoryInfoEntity::getTm,st);
-       // wrapper.lt(WaterFlowRateHistoryInfoEntity::getTm,et);
         wrapper.orderByAsc(WaterFlowRateHistoryInfoEntity::getTm);
         wrapper.last("limit 1");
-
         WaterFlowRateHistoryInfoEntity first = this.getOne(wrapper);
         if (Func.notNull(first)){
-          //  calendar.setTime(tm);
-          //  calendar.set(Calendar.HOUR_OF_DAY,0);
-          //  calendar.set(Calendar.MINUTE,0);
-         //   calendar.set(Calendar.SECOND,0);
-         //   calendar.set(Calendar.MILLISECOND,0);
-          //   et =  calendar.getTime();
-
-         //   calendar.add(Calendar.DAY_OF_MONTH,-1);
-           //  st = calendar.getTime();
             wrapper = Wrappers.<WaterFlowRateHistoryInfoEntity>query().lambda();
+            wrapper.eq(WaterFlowRateHistoryInfoEntity::getMpcd,mpcd);
             wrapper.ge(WaterFlowRateHistoryInfoEntity::getTm,et);
-         //   wrapper.lt(WaterFlowRateHistoryInfoEntity::getTm,et);
             wrapper.orderByAsc(WaterFlowRateHistoryInfoEntity::getTm);
             wrapper.last("limit 1");
-
             WaterFlowRateHistoryInfoEntity last = this.getOne(wrapper);
             if (Func.notNull(last)){
                 if (Func.notNull(first.getAccw()) && Func.notNull(last.getAccw())){
-                    return (double) last.getAccw().longValue()-(double) first.getAccw().longValue();
+                    if (last.getAccw()>first.getAccw()){
+                        // log.info("last accw1 {} {} first accw2 {} {}",last.getAccw(),last.getAccw().doubleValue(),first.getAccw(),first.getAccw().doubleValue());
+                        return last.getAccw().doubleValue()-first.getAccw().doubleValue();
+                    }
                 }
-                //else{
-                   // return 0;
-            //    }
             }
         }
-
-
         return 0;
     }
 

+ 22 - 22
src/main/java/org/springblade/modules/business/notice/controller/NoticeController.java

@@ -110,17 +110,17 @@ public class NoticeController extends BladeController {
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "分页", notes = "传入实体类NoticeDTO")
     public R<IPage<NoticeVO>> page(@ApiIgnore NoticeDTO notice, Query query) {
-        BladeUser user = AuthUtil.getUser();
-        notice.setCreateDept(Func.toLong(user.getDeptId()));
-        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-            notice.setCategory(0);
-        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-            //盟市查看本部门通知,以及自治区公开的通知
-            notice.setCategory(1);
-        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-            //运维公司查看本部门通知,以及盟市公开的通知
-            notice.setCategory(2);
-        }
+//        BladeUser user = AuthUtil.getUser();
+//        notice.setCreateDept(Func.toLong(user.getDeptId()));
+//        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//            notice.setCategory(0);
+//        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+//            //盟市查看本部门通知,以及自治区公开的通知
+//            notice.setCategory(1);
+//        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+//            //运维公司查看本部门通知,以及盟市公开的通知
+//            notice.setCategory(2);
+//        }
         IPage<NoticeVO> pages = noticeService.selectPage(Condition.getPage(query), notice);
         List<NoticeVO> list = pages.getRecords();
         for (NoticeVO vo : list) {
@@ -161,17 +161,17 @@ public class NoticeController extends BladeController {
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "新增", notes = "传入notice")
     public R save(@RequestBody NoticeDTO noticeEntity) {
-        BladeUser user = AuthUtil.getUser();
-        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
-            noticeEntity.setCategory(0);
-        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
-            //盟市查看本部门通知,以及自治区公开的通知
-            noticeEntity.setCategory(1);
-        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
-            //运维公司查看本部门通知,以及盟市公开的通知
-            noticeEntity.setCategory(2);
-            noticeEntity.setPublicState(0);
-        }
+//        BladeUser user = AuthUtil.getUser();
+//        if (BusinessConstant.ROLE_SYS_ADMIN.equals(user.getRoleName())) {
+//            noticeEntity.setCategory(0);
+//        } else if (BusinessConstant.ROLE_ORG_ADMIN.equals(user.getRoleName())) {
+//            //盟市查看本部门通知,以及自治区公开的通知
+//            noticeEntity.setCategory(1);
+//        } else if (BusinessConstant.ROLE_COMPANY_ADMIN.equals(user.getRoleName()) || BusinessConstant.ROLE_COMPANY_SERVICE_PERSON.equals(user.getRoleName())) {
+//            //运维公司查看本部门通知,以及盟市公开的通知
+//            noticeEntity.setCategory(2);
+            noticeEntity.setPublicState(1);
+        //}
         if (noticeService.save(noticeEntity)) {
             if (noticeEntity.getAttach() != null && noticeEntity.getAttach().size() > 0) {
                 for (Map<String, Object> att : noticeEntity.getAttach()) {

+ 72 - 0
src/main/java/org/springblade/modules/etl/controller/EtlDataController.java

@@ -0,0 +1,72 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称:
+ * 创建日期:2022/8/31
+ */
+package org.springblade.modules.etl.controller;
+
+
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.jobtask.TaskManager;
+import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointRelService;
+import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointService;
+import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
+import org.springblade.modules.etl.task.EtlBaseRtuInfoTask;
+import org.springblade.modules.etl.task.EtlMpQrDataTask;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.concurrent.FutureTask;
+
+/***
+ * Date:2022/8/31
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@RestController
+@RequestMapping("galaxy-business/etl/data")
+@RequiredArgsConstructor
+@Api(value = "数据抽取模块", tags = "数据抽取模块接口")
+public class EtlDataController extends BladeController {
+
+    @Resource
+    private TaskManager taskManager;
+
+
+    @GetMapping("/rtu/task")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<String> baseinfoTask() {
+        EtlBaseRtuInfoTask task = new EtlBaseRtuInfoTask();
+        FutureTask<Integer> futureTask = new FutureTask<>(task);
+        taskManager.submitTask(futureTask);
+        return R.data("任务已经提交");
+    }
+
+    @GetMapping("/mp/task")
+    @ApiOperationSupport(order = 2)
+    @ApiOperation(value = "分页")
+    public R<String> mpDataTask(@RequestParam("year") String year) {
+        if (Func.isNull(year)){
+            R.fail("参数错误");
+        }
+        EtlMpQrDataTask task = new EtlMpQrDataTask(year);
+        FutureTask<Integer> futureTask = new FutureTask<>(task);
+        taskManager.submitTask(futureTask);
+        return R.data("任务已经提交");
+    }
+}

+ 32 - 0
src/main/java/org/springblade/modules/etl/dto/EtlMpQrDTO.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/19
+ */
+package org.springblade.modules.etl.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.modules.etl.entity.EtlMpQrEntity;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/***
+ * Date:2023/12/19
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class EtlMpQrDTO extends EtlMpQrEntity {
+    @ApiModelProperty("年份")
+    private String year;
+
+}

+ 52 - 0
src/main/java/org/springblade/modules/etl/entity/EtlMpEntity.java

@@ -0,0 +1,52 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WR_MP_B")
+public class EtlMpEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("监测点代码")
+    private String mpCd;
+
+    @ApiModelProperty("监测点名称")
+    private String mpNm;
+
+    @ApiModelProperty("监测点地址")
+    private String mpAddr;
+
+    @ApiModelProperty("监测项目")
+    private String mpItem;
+
+    @ApiModelProperty("监测类型")
+    private String isAuto;
+
+    @ApiModelProperty("水源类型")
+    private String sourTp;
+
+    @ApiModelProperty("纬度")
+    private String weiDu;
+
+    @ApiModelProperty("经度")
+    private String jingDu;
+}

+ 58 - 0
src/main/java/org/springblade/modules/etl/entity/EtlMpQrEntity.java

@@ -0,0 +1,58 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("wr_mp_q_r")
+public class EtlMpQrEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("监测点代码")
+    private String mpCd;
+
+    @ApiModelProperty("监测时间")
+    private String tm;
+
+    @ApiModelProperty("取排水流量")
+    private String mpq;
+
+    @ApiModelProperty("累计水量")
+    private String accw;
+
+    @ApiModelProperty("入厂污水流量")
+    private String inStpq;
+
+    @ApiModelProperty("累计入厂污水量")
+    private String accPqw;
+
+    @ApiModelProperty("特殊区域数据")
+    private String speRegData;
+
+    @ApiModelProperty("时间戳")
+    private String ts;
+
+    @ApiModelProperty("时间戳")
+    private String hourw;
+
+
+
+}

+ 55 - 0
src/main/java/org/springblade/modules/etl/entity/EtlWiuEntity.java

@@ -0,0 +1,55 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WR_WIU_B")
+public class EtlWiuEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("编码")
+    private String wiuCd;
+
+    @ApiModelProperty("名称")
+    private String wiuNm;
+
+    @ApiModelProperty("法人代表")
+    private String lrNm;
+
+    @ApiModelProperty("行业类别")
+    private String tradTp;
+
+    @ApiModelProperty("经济类型")
+    private String ecoTp;
+
+    @ApiModelProperty("监控级别")
+    private String mong;
+
+    @ApiModelProperty("取用类别")
+    private String wiuTp;
+
+    @ApiModelProperty("地址")
+    private String addr;
+
+    @ApiModelProperty("机构")
+    private String orgCode;
+}

+ 35 - 0
src/main/java/org/springblade/modules/etl/entity/EtlWiuWiustDataEntity.java

@@ -0,0 +1,35 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("REL_WIU_WIUST")
+public class EtlWiuWiustDataEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("用水户")
+    private String wiuCd;
+
+    @ApiModelProperty("测站")
+    private String wiustCd;
+
+}

+ 49 - 0
src/main/java/org/springblade/modules/etl/entity/EtlWiustEntity.java

@@ -0,0 +1,49 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WR_WIUST_B")
+public class EtlWiustEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("取用水测站代码")
+    private String wiustCd;
+
+    @ApiModelProperty("取用水测站名称")
+    private String wiustNm;
+
+    @ApiModelProperty("取用水测站类别")
+    private String wiustTp;
+
+    @ApiModelProperty("所在地")
+    private String loc;
+
+    @ApiModelProperty("基面类型")
+    private String datTp;
+
+    @ApiModelProperty("测井类型")
+    private String wellTp;
+
+    @ApiModelProperty("设站年月")
+    private String estStYm;
+}

+ 35 - 0
src/main/java/org/springblade/modules/etl/entity/EtlWiustMpDataEntity.java

@@ -0,0 +1,35 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.base.BaseEntity;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("REL_WIUST_MP")
+public class EtlWiustMpDataEntity extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("取用水测点代码")
+    private String mpCd;
+
+    @ApiModelProperty("取用水测站代码")
+    private String wiustCd;
+
+}

+ 25 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlMpMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.etl.entity.EtlMpEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlMpMapper extends BaseMapper<EtlMpEntity> {
+    List<EtlMpEntity> selectList(@Param("entity") EtlMpEntity entity);
+}

+ 28 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlMpMapper.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlMpMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlMpEntity">
+        <result column="MP_CD" property="mpCd"/>
+        <result column="MP_NM" property="mpNm"/>
+        <result column="MP_ADDR" property="mpAddr"/>
+        <result column="MP_ITEM" property="mpItem"/>
+        <result column="IS_AUTO" property="isAuto"/>
+        <result column="SOUR_TP" property="sourTp"/>
+        <result column="wei_du" property="weiDu"/>
+        <result column="jing_du" property="jingDu"/>
+
+    </resultMap>
+
+    <select id="selectList" resultMap="entityResultMap">
+        SELECT
+        d.MP_CD,d.MP_NM,d.MP_ADDR,d.MP_ITEM,d.IS_AUTO,d.SOUR_TP,d.wei_du,d.jing_du
+        FROM
+        WR_MP_B d
+        WHERE 1=1
+        <if test="entity.mpCd!=null">
+            and d.MP_CD = #{entity.mpCd}
+        </if>
+    </select>
+</mapper>

+ 28 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlMpQrMapper.java

@@ -0,0 +1,28 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.baseinfo.wateruseconsumer.vo.WaterUseConsumerInfoVO;
+import org.springblade.modules.etl.dto.EtlMpQrDTO;
+import org.springblade.modules.etl.entity.EtlMpQrEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlMpQrMapper extends BaseMapper<EtlMpQrEntity> {
+    List<EtlMpQrEntity> selectPage(IPage<EtlMpQrEntity> page, @Param("dto") EtlMpQrDTO dto);
+}

+ 30 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlMpQrMapper.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlMpQrMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlMpQrEntity">
+        <result column="MP_CD" property="mpCd"/>
+        <result column="TM" property="tm"/>
+        <result column="MP_Q" property="mpq"/>
+        <result column="ACC_W" property="accw"/>
+        <result column="IN_STP_Q" property="inStpq"/>
+        <result column="ACC_PQ_W" property="accPqw"/>
+        <result column="SPE_REG_DATA" property="speRegData"/>
+        <result column="TS" property="ts"/>
+        <result column="HOUR_W" property="hourw"/>
+
+    </resultMap>
+
+    <select id="selectPage" resultMap="entityResultMap">
+        SELECT
+        d.MP_CD,d.TM,d.MP_Q,d.ACC_W,d.IN_STP_Q,d.ACC_PQ_W,d.SPE_REG_DATA,d.TS,d.HOUR_W
+        FROM
+        wr_mp_q_r d
+        WHERE 1=1
+        <if test="dto.year!=null">
+            and d.TM like( #{dto.year}+'%')
+        </if>
+        order by  d.TM
+    </select>
+</mapper>

+ 25 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiuMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.etl.entity.EtlWiuEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlWiuMapper extends BaseMapper<EtlWiuEntity> {
+    List<EtlWiuEntity> selectList(@Param("entity") EtlWiuEntity entity);
+}

+ 27 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiuMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlWiuMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlWiuEntity">
+        <result column="WIU_CD" property="wiuCd"/>
+        <result column="WIU_NM" property="wiuNm"/>
+        <result column="LR_NM" property="lrNm"/>
+        <result column="TRAD_TP" property="tradTp"/>
+        <result column="ECO_TP" property="ecoTp"/>
+        <result column="MON_G" property="mong"/>
+        <result column="WIU_TP" property="wiuTp"/>
+        <result column="ADDR" property="addr"/>
+        <result column="org_code" property="orgCode"/>
+
+
+    </resultMap>
+
+    <select id="selectList" resultMap="entityResultMap">
+        SELECT
+        d.WIU_CD,d.WIU_NM,d.LR_NM,d.TRAD_TP,d.ECO_TP,d.MON_G,d.WIU_TP,d.ADDR,d.org_code
+        FROM
+        WR_WIU_B d
+        WHERE 1=1
+    </select>
+</mapper>

+ 25 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiuWiustMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.etl.entity.EtlWiuWiustDataEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlWiuWiustMapper extends BaseMapper<EtlWiuWiustDataEntity> {
+    List<EtlWiuWiustDataEntity> selectList(@Param("entity") EtlWiuWiustDataEntity entity);
+}

+ 23 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiuWiustMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlWiuWiustMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlWiuWiustDataEntity">
+        <result column="WIUST_CD" property="wiustCd"/>
+        <result column="WIU_CD" property="wiuCd"/>
+
+
+    </resultMap>
+
+    <select id="selectList" resultMap="entityResultMap">
+        SELECT
+        d.WIUST_CD,d.WIU_CD
+        FROM
+        REL_WIU_WIUST d
+        WHERE 1=1
+        <if test="entity.wiuCd!=null">
+            and d.WIU_CD = #{entity.wiuCd}
+        </if>
+    </select>
+</mapper>

+ 25 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiustMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.etl.entity.EtlWiustEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlWiustMapper extends BaseMapper<EtlWiustEntity> {
+    List<EtlWiustEntity> selectList(@Param("entity") EtlWiustEntity entity);
+}

+ 29 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiustMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlWiustMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlWiustEntity">
+        <result column="WIUST_CD" property="wiustCd"/>
+        <result column="WIUST_NM" property="wiustNm"/>
+        <result column="WIUST_TP" property="wiustTp"/>
+        <result column="LOC" property="loc"/>
+        <result column="DAT_TP" property="datTp"/>
+        <result column="WELL_TP" property="wellTp"/>
+        <result column="EST_ST_YM" property="estStYm"/>
+
+
+    </resultMap>
+
+    <select id="selectList" resultMap="entityResultMap">
+        SELECT
+        d.WIUST_CD,d.WIUST_NM,d.WIUST_TP,d.LOC,d.DAT_TP,d.WELL_TP,d.EST_ST_YM
+        FROM
+        WR_WIUST_B d
+        WHERE 1=1
+        <if test="entity.wiustCd!=null">
+            and d.WIUST_CD = #{entity.wiustCd}
+        </if>
+    </select>
+</mapper>
+

+ 25 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiustMpMapper.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.etl.entity.EtlWiustMpDataEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface EtlWiustMpMapper extends BaseMapper<EtlWiustMpDataEntity> {
+    List<EtlWiustMpDataEntity> selectList(@Param("entity") EtlWiustMpDataEntity entity);
+}

+ 23 - 0
src/main/java/org/springblade/modules/etl/mapper/EtlWiustMpMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.modules.etl.mapper.EtlWiustMpMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="entityResultMap" type="org.springblade.modules.etl.entity.EtlWiustMpDataEntity">
+        <result column="MP_CD" property="mpCd"/>
+        <result column="WIUST_CD" property="wiustCd"/>
+
+
+    </resultMap>
+
+    <select id="selectList" resultMap="entityResultMap">
+        SELECT
+        d.MP_CD,d.WIUST_CD
+        FROM
+        REL_WIUST_MP d
+        WHERE 1=1
+        <if test="entity.wiustCd!=null">
+            and d.WIUST_CD = #{entity.wiustCd}
+        </if>
+    </select>
+</mapper>

+ 25 - 0
src/main/java/org/springblade/modules/etl/service/IEtlMpDataService.java

@@ -0,0 +1,25 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.entity.EtlMpEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlMpDataService extends BaseService<EtlMpEntity> {
+    List<EtlMpEntity> selectList(EtlMpEntity entity);
+}
+

+ 27 - 0
src/main/java/org/springblade/modules/etl/service/IEtlMpQrDataService.java

@@ -0,0 +1,27 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.dto.EtlMpQrDTO;
+import org.springblade.modules.etl.entity.EtlMpQrEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlMpQrDataService extends BaseService<EtlMpQrEntity> {
+    IPage<EtlMpQrEntity> selectPage(IPage<EtlMpQrEntity> page, EtlMpQrDTO dto);
+}
+

+ 24 - 0
src/main/java/org/springblade/modules/etl/service/IEtlWiuDataService.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.entity.EtlWiuEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlWiuDataService extends BaseService<EtlWiuEntity> {
+    List<EtlWiuEntity> selectList(EtlWiuEntity entity);
+}

+ 24 - 0
src/main/java/org/springblade/modules/etl/service/IEtlWiuWiustDataService.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.entity.EtlWiuWiustDataEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlWiuWiustDataService extends BaseService<EtlWiuWiustDataEntity> {
+    List<EtlWiuWiustDataEntity> selectList(EtlWiuWiustDataEntity entity);
+}

+ 24 - 0
src/main/java/org/springblade/modules/etl/service/IEtlWiustDataService.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.entity.EtlWiustEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlWiustDataService extends BaseService<EtlWiustEntity> {
+    List<EtlWiustEntity> selectList(EtlWiustEntity entity);
+}

+ 24 - 0
src/main/java/org/springblade/modules/etl/service/IEtlWiustMpDataService.java

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service;
+
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.modules.etl.entity.EtlWiustMpDataEntity;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+public interface IEtlWiustMpDataService extends BaseService<EtlWiustMpDataEntity> {
+    List<EtlWiustMpDataEntity> selectList(EtlWiustMpDataEntity entity);
+}

+ 34 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlMpDatadServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.entity.EtlMpEntity;
+import org.springblade.modules.etl.mapper.EtlMpMapper;
+import org.springblade.modules.etl.service.IEtlMpDataService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlMpDatadServiceImpl extends BaseServiceImpl<EtlMpMapper, EtlMpEntity> implements IEtlMpDataService {
+
+    @Override
+    public List<EtlMpEntity> selectList(EtlMpEntity entity) {
+        return baseMapper.selectList(entity);
+    }
+}

+ 36 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlMpQrDatadServiceImpl.java

@@ -0,0 +1,36 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.dto.EtlMpQrDTO;
+import org.springblade.modules.etl.entity.EtlMpQrEntity;
+import org.springblade.modules.etl.mapper.EtlMpQrMapper;
+import org.springblade.modules.etl.service.IEtlMpQrDataService;
+import org.springframework.stereotype.Service;
+
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlMpQrDatadServiceImpl extends BaseServiceImpl<EtlMpQrMapper, EtlMpQrEntity> implements IEtlMpQrDataService {
+
+
+    @Override
+    public IPage<EtlMpQrEntity> selectPage(IPage<EtlMpQrEntity> page, EtlMpQrDTO dto) {
+        return page.setRecords(baseMapper.selectPage(page, dto));
+    }
+}

+ 34 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlWiuDatadServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.entity.EtlWiuEntity;
+import org.springblade.modules.etl.mapper.EtlWiuMapper;
+import org.springblade.modules.etl.service.IEtlWiuDataService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlWiuDatadServiceImpl extends BaseServiceImpl<EtlWiuMapper, EtlWiuEntity> implements IEtlWiuDataService {
+
+    @Override
+    public List<EtlWiuEntity> selectList(EtlWiuEntity entity) {
+        return baseMapper.selectList(entity);
+    }
+}

+ 34 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlWiuWiustDatadServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.entity.EtlWiuWiustDataEntity;
+import org.springblade.modules.etl.mapper.EtlWiuWiustMapper;
+import org.springblade.modules.etl.service.IEtlWiuWiustDataService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlWiuWiustDatadServiceImpl extends BaseServiceImpl<EtlWiuWiustMapper, EtlWiuWiustDataEntity> implements IEtlWiuWiustDataService {
+
+    @Override
+    public List<EtlWiuWiustDataEntity> selectList(EtlWiuWiustDataEntity entity) {
+        return baseMapper.selectList(entity);
+    }
+}

+ 34 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlWiustDatadServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.entity.EtlWiustEntity;
+import org.springblade.modules.etl.mapper.EtlWiustMapper;
+import org.springblade.modules.etl.service.IEtlWiustDataService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlWiustDatadServiceImpl extends BaseServiceImpl<EtlWiustMapper, EtlWiustEntity> implements IEtlWiustDataService {
+
+    @Override
+    public List<EtlWiustEntity> selectList(EtlWiustEntity entity) {
+        return baseMapper.selectList(entity);
+    }
+}

+ 34 - 0
src/main/java/org/springblade/modules/etl/service/impl/EtlWiustMpDatadServiceImpl.java

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2019 DH
+ * All right reserved.
+ * 项目名称: 大恒泰山系统
+ * 创建日期:2023/12/15
+ */
+package org.springblade.modules.etl.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.modules.etl.entity.EtlWiustMpDataEntity;
+import org.springblade.modules.etl.mapper.EtlWiustMpMapper;
+import org.springblade.modules.etl.service.IEtlWiustMpDataService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/***
+ * Date:2023/12/15
+ * Title:文件所属模块(必须填写)
+ * Description:对本文件的详细描述,原则上不能少于30字
+ * @author dylan
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Service
+@DS("sqlserver_1")
+public class EtlWiustMpDatadServiceImpl extends BaseServiceImpl<EtlWiustMpMapper, EtlWiustMpDataEntity> implements IEtlWiustMpDataService {
+
+    @Override
+    public List<EtlWiustMpDataEntity> selectList(EtlWiustMpDataEntity entity) {
+        return baseMapper.selectList(entity);
+    }
+}

+ 335 - 0
src/main/java/org/springblade/modules/etl/task/EtlBaseRtuInfoTask.java

@@ -0,0 +1,335 @@
+/**
+ * Copyright
+ * All right reserved.
+ * 项目名称:运维系统
+ * 创建日期:2022/5/22
+ */
+package org.springblade.modules.etl.task;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.utils.ConcurrentDateFormat;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointInfoEntity;
+import org.springblade.modules.baseinfo.monitorpoint.entity.MonitorPointRelEntity;
+import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointRelService;
+import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointService;
+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.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.etl.entity.*;
+import org.springblade.modules.etl.service.*;
+
+import java.util.List;
+import java.util.concurrent.Callable;
+
+/***
+ * Date:2022/5/22
+ * Title: 基础测站信息抽取
+ * Description:
+ * @author swp
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Slf4j
+public class EtlBaseRtuInfoTask implements Callable<Integer> {
+
+    private static IEtlMpDataService etlMpDataService;
+
+    private static IEtlMpDataService getEtlMpDataService() {
+        if (etlMpDataService == null) {
+            etlMpDataService = SpringUtil.getBean(IEtlMpDataService.class);
+        }
+        return etlMpDataService;
+    }
+
+    private static IEtlWiuDataService etlWiuDataService;
+
+    private static IEtlWiuDataService getEtlWiuDataService() {
+        if (etlWiuDataService == null) {
+            etlWiuDataService = SpringUtil.getBean(IEtlWiuDataService.class);
+        }
+        return etlWiuDataService;
+    }
+
+
+    private static IEtlWiustDataService etlWiustDataService;
+
+    private static IEtlWiustDataService getEtlWiustDataService() {
+        if (etlWiustDataService == null) {
+            etlWiustDataService = SpringUtil.getBean(IEtlWiustDataService.class);
+        }
+        return etlWiustDataService;
+    }
+
+
+    private static IEtlWiustMpDataService etlWiustMpDataService;
+
+    private static IEtlWiustMpDataService getEtlWiustMpDataService() {
+        if (etlWiustMpDataService == null) {
+            etlWiustMpDataService = SpringUtil.getBean(IEtlWiustMpDataService.class);
+        }
+        return etlWiustMpDataService;
+    }
+
+    private static IEtlWiuWiustDataService etlWiuWiustDataService;
+
+    private static IEtlWiuWiustDataService getEtlWiuWiustDataService() {
+        if (etlWiuWiustDataService == null) {
+            etlWiuWiustDataService = SpringUtil.getBean(IEtlWiuWiustDataService.class);
+        }
+        return etlWiuWiustDataService;
+    }
+
+
+    private static IMonitorPointService monitorPointService;
+
+    private static IMonitorPointService getMonitorPointService() {
+        if (monitorPointService == null) {
+            monitorPointService = SpringUtil.getBean(IMonitorPointService.class);
+        }
+        return monitorPointService;
+    }
+
+    private static IMonitorPointRelService monitorPointRelService;
+
+    private static IMonitorPointRelService getMonitorPointRelService() {
+        if (monitorPointRelService == null) {
+            monitorPointRelService = SpringUtil.getBean(IMonitorPointRelService.class);
+        }
+        return monitorPointRelService;
+    }
+
+    private static IMonitorSiteService monitorSiteService;
+
+    private static IMonitorSiteService getMonitorSiteService() {
+        if (monitorSiteService == null) {
+            monitorSiteService = SpringUtil.getBean(IMonitorSiteService.class);
+        }
+        return monitorSiteService;
+    }
+
+    private static IMonitorSiteRelService monitorSiteRelService;
+
+    private static IMonitorSiteRelService getMonitorSiteRelService() {
+        if (monitorSiteRelService == null) {
+            monitorSiteRelService = SpringUtil.getBean(IMonitorSiteRelService.class);
+        }
+        return monitorSiteRelService;
+    }
+
+    private static IWaterUseConsumerService waterUseConsumerService;
+
+    private static IWaterUseConsumerService getWaterUseConsumerService() {
+        if (waterUseConsumerService == null) {
+            waterUseConsumerService = SpringUtil.getBean(IWaterUseConsumerService.class);
+        }
+        return waterUseConsumerService;
+    }
+
+    private static IRtuBaseInfoService rtuBaseInfoService;
+
+    private static IRtuBaseInfoService getRtuBaseInfoService() {
+        if (rtuBaseInfoService == null) {
+            rtuBaseInfoService = SpringUtil.getBean(IRtuBaseInfoService.class);
+        }
+        return rtuBaseInfoService;
+    }
+
+
+    public EtlBaseRtuInfoTask() {
+    }
+
+    @Override
+    public Integer call() {
+        try {
+            log.info("RTU导入任务开始执行*********************");
+            //取水户
+            EtlWiuEntity dto = new EtlWiuEntity();
+            List<EtlWiuEntity> wiuList = getEtlWiuDataService().selectList(dto);
+            for (EtlWiuEntity etlWiuEntity : wiuList) {
+                log.info("用水户 {}", etlWiuEntity.getWiuNm());
+                WaterUseConsumerInfoEntity waterUseConsumerInfoEntity = new WaterUseConsumerInfoEntity();
+                waterUseConsumerInfoEntity.setAddr(etlWiuEntity.getAddr());
+                waterUseConsumerInfoEntity.setWiuTp(etlWiuEntity.getWiuTp());
+                waterUseConsumerInfoEntity.setMonLevel(etlWiuEntity.getMong());
+                waterUseConsumerInfoEntity.setEcoTp(etlWiuEntity.getEcoTp());
+                waterUseConsumerInfoEntity.setTradTp(etlWiuEntity.getTradTp());
+                waterUseConsumerInfoEntity.setLrNm(etlWiuEntity.getLrNm());
+                waterUseConsumerInfoEntity.setWiuNm(etlWiuEntity.getWiuNm());
+                waterUseConsumerInfoEntity.setWiuCd(etlWiuEntity.getWiuCd());
+//                if ("00".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1123598813738675201L);
+//                } else if ("11".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715215595639267330L);
+//                } else if ("12".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715215690510229506L);
+//                } else if ("10".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715215884710699010L);
+//                } else if ("13".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715215952884916226L);
+//                } else if ("14".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715216007264067585L);
+//                } else if ("15".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715216066533777409L);
+//                } else if ("713".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715215779899236354L);
+//                } else if ("111".equals(etlWiuEntity.getOrgCode())) {
+//                    waterUseConsumerInfoEntity.setOrgId(1715216136150835201L);
+//                }
+
+                if ("00".equals(etlWiuEntity.getOrgCode())) {
+                    waterUseConsumerInfoEntity.setOrgId(1123598813738675201L);
+                } else if ("10".equals(etlWiuEntity.getOrgCode())) {
+                    //开发区
+                    waterUseConsumerInfoEntity.setOrgId(1739167486811115521L);
+                } else if ("11".equals(etlWiuEntity.getOrgCode())) {
+                    //科尔沁区
+                    waterUseConsumerInfoEntity.setOrgId(1739167199606149121L);
+                } else if ("12".equals(etlWiuEntity.getOrgCode())) {
+                    //霍林郭勒市
+                    waterUseConsumerInfoEntity.setOrgId(1739167583787618306L);
+                } else if ("13".equals(etlWiuEntity.getOrgCode())) {
+                    //开鲁县
+                    waterUseConsumerInfoEntity.setOrgId(1739167691912581122L);
+                } else if ("14".equals(etlWiuEntity.getOrgCode())) {
+                    //库伦旗
+                    waterUseConsumerInfoEntity.setOrgId(1739168295204491265L);
+                } else if ("15".equals(etlWiuEntity.getOrgCode())) {
+                    //奈曼旗
+                    waterUseConsumerInfoEntity.setOrgId(1739168422233182210L);
+                } else if ("16".equals(etlWiuEntity.getOrgCode())) {
+                    //扎鲁特旗
+                    waterUseConsumerInfoEntity.setOrgId(1739168489350434818L);
+                } else if ("17".equals(etlWiuEntity.getOrgCode())) {
+                    //科尔沁左翼中旗
+                    waterUseConsumerInfoEntity.setOrgId(1739168550947983362L);
+                }else if ("18".equals(etlWiuEntity.getOrgCode())) {
+                    //科尔沁左翼后旗
+                    waterUseConsumerInfoEntity.setOrgId(1739168612600057857L);
+                }else if ("19".equals(etlWiuEntity.getOrgCode())) {
+                    //市直属
+                    waterUseConsumerInfoEntity.setOrgId(1739168664903028738L);
+                }else if ("2226".equals(etlWiuEntity.getOrgCode())) {
+                    //灌区
+                    waterUseConsumerInfoEntity.setOrgId(1739168715259842562L);
+                }else if ("2222".equals(etlWiuEntity.getOrgCode())) {
+                    //露天煤业南矿
+                    waterUseConsumerInfoEntity.setOrgId(1739170233228791810L);
+                }else if ("51".equals(etlWiuEntity.getOrgCode())) {
+                    //露天煤业北矿
+                    waterUseConsumerInfoEntity.setOrgId(1739170334680616961L);
+                }else if ("11111111".equals(etlWiuEntity.getOrgCode())) {
+                    //华北制药
+                    waterUseConsumerInfoEntity.setOrgId(1739170709617840130L);
+                }else if ("111112".equals(etlWiuEntity.getOrgCode())) {
+                    //扎哈淖尔煤业
+                    waterUseConsumerInfoEntity.setOrgId(1739171042817544194L);
+                }else if ("1".equals(etlWiuEntity.getOrgCode())) {
+                    //吉源热电
+                    waterUseConsumerInfoEntity.setOrgId(1739171286364000257L);
+                }else if ("20".equals(etlWiuEntity.getOrgCode())) {
+                    //通辽自来
+                    waterUseConsumerInfoEntity.setOrgId(1739171527926550530L);
+                }else if ("2223".equals(etlWiuEntity.getOrgCode())) {
+                    //现代牧业
+                    waterUseConsumerInfoEntity.setOrgId(1739171579386466305L);
+                }else if ("52".equals(etlWiuEntity.getOrgCode())) {
+                    //金源口热电
+                    waterUseConsumerInfoEntity.setOrgId(1739171627251863553L);
+                }
+
+                //waterUseConsumerInfoEntity.setOrgId(Func.toLong(etlWiuEntity.getOrgCode()));
+                if (getWaterUseConsumerService().save(waterUseConsumerInfoEntity)) {
+                    //取水户关联测站
+                    EtlWiuWiustDataEntity wiuRelDto = new EtlWiuWiustDataEntity();
+                    wiuRelDto.setWiuCd(etlWiuEntity.getWiuCd());
+                    List<EtlWiuWiustDataEntity> wiuRelList = getEtlWiuWiustDataService().selectList(wiuRelDto);
+                    for (EtlWiuWiustDataEntity wiuWiustDataEntity : wiuRelList) {
+                        //测站
+                        EtlWiustEntity etlWiustDto = new EtlWiustEntity();
+                        etlWiustDto.setWiustCd(wiuWiustDataEntity.getWiustCd());
+                        List<EtlWiustEntity> etlWiustEntityList = getEtlWiustDataService().selectList(etlWiustDto);
+                        for (EtlWiustEntity etlWiustEntity : etlWiustEntityList) {
+
+                            log.info("测站 {}", etlWiustEntity.getWiustNm());
+
+                            MonitorSiteInfoEntity monitorSiteInfoEntity = new MonitorSiteInfoEntity();
+                            monitorSiteInfoEntity.setWiustCd(etlWiustEntity.getWiustCd());
+                            monitorSiteInfoEntity.setWiustNm(etlWiustEntity.getWiustNm());
+                            monitorSiteInfoEntity.setWiustTp(etlWiustEntity.getWiustTp());
+                            monitorSiteInfoEntity.setLoc(etlWiustEntity.getLoc());
+                            monitorSiteInfoEntity.setDatTp(etlWiustEntity.getDatTp());
+                            monitorSiteInfoEntity.setWellTp(etlWiustEntity.getWellTp());
+                            if (Func.notNull(etlWiustEntity.getEstStYm())){
+                                if (etlWiustEntity.getEstStYm().length()==4){
+                                    String tm = etlWiustEntity.getEstStYm() + "0101120000";
+                                    monitorSiteInfoEntity.setEstStYm(Func.parse(tm, ConcurrentDateFormat.of("yyyyMMddHHmmss")));
+                                }else if (etlWiustEntity.getEstStYm().length()==6){
+                                    String tm = etlWiustEntity.getEstStYm() + "01120000";
+                                    monitorSiteInfoEntity.setEstStYm(Func.parse(tm, ConcurrentDateFormat.of("yyyyMMddHHmmss")));
+                                }
+                            }
+
+                            if (getMonitorSiteService().save(monitorSiteInfoEntity)) {
+
+                                RtuInfoEntity rtuInfoEntity = new RtuInfoEntity();
+                                rtuInfoEntity.setRtuCode(monitorSiteInfoEntity.getWiustCd());
+                                rtuInfoEntity.setAdCode(etlWiuEntity.getOrgCode());
+                                rtuInfoEntity.setOrgId(waterUseConsumerInfoEntity.getOrgId());
+                                rtuInfoEntity.setRtuName(monitorSiteInfoEntity.getWiustNm());
+                                getRtuBaseInfoService().save(rtuInfoEntity);
+
+                                MonitorSiteRelEntity siteRelEntity = new MonitorSiteRelEntity();
+                                siteRelEntity.setWiuCd(waterUseConsumerInfoEntity.getWiuCd());
+                                siteRelEntity.setWiustCd(monitorSiteInfoEntity.getWiustCd());
+                                getMonitorSiteRelService().save(siteRelEntity);
+
+                                //测站关联站点
+                                EtlWiustMpDataEntity wiustRelDto = new EtlWiustMpDataEntity();
+                                wiustRelDto.setWiustCd(monitorSiteInfoEntity.getWiustCd());
+                                List<EtlWiustMpDataEntity> wiustMpRelList = getEtlWiustMpDataService().selectList(wiustRelDto);
+                                for (EtlWiustMpDataEntity wiustMpDataEntity : wiustMpRelList) {
+                                    //点位
+                                    EtlMpEntity mpDto = new EtlMpEntity();
+                                    mpDto.setMpCd(wiustMpDataEntity.getMpCd());
+                                    List<EtlMpEntity> mpList = getEtlMpDataService().selectList(mpDto);
+                                    for (EtlMpEntity mpEntity : mpList) {
+                                        log.info("点位 {}", mpEntity.getMpNm());
+                                        MonitorPointInfoEntity pointInfoEntity = new MonitorPointInfoEntity();
+                                        pointInfoEntity.setMpCd(mpEntity.getMpCd());
+                                        pointInfoEntity.setMpNm(mpEntity.getMpNm());
+                                        pointInfoEntity.setMpAddr(mpEntity.getMpAddr());
+                                        pointInfoEntity.setMpItem(mpEntity.getMpItem());
+                                        pointInfoEntity.setIsAuto(mpEntity.getIsAuto());
+                                        pointInfoEntity.setSourTp(mpEntity.getSourTp());
+                                        pointInfoEntity.setLat(mpEntity.getWeiDu());
+                                        pointInfoEntity.setLng(mpEntity.getJingDu());
+
+                                        if (getMonitorPointService().save(pointInfoEntity)) {
+                                            MonitorPointRelEntity pointRelEntity = new MonitorPointRelEntity();
+                                            pointRelEntity.setMpCd(pointInfoEntity.getMpCd());
+                                            pointRelEntity.setWiustCd(monitorSiteInfoEntity.getWiustCd());
+                                            getMonitorPointRelService().save(pointRelEntity);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("RTU导入任务异常 {}", e.getMessage());
+        }
+        return 0;
+    }
+
+}

+ 146 - 0
src/main/java/org/springblade/modules/etl/task/EtlMpQrDataTask.java

@@ -0,0 +1,146 @@
+/**
+ * Copyright
+ * All right reserved.
+ * 项目名称:运维系统
+ * 创建日期:2022/5/22
+ */
+package org.springblade.modules.etl.task;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.ConcurrentDateFormat;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.modules.baseinfo.org.entity.DeptRegionEntity;
+import org.springblade.modules.business.monitor.entity.WaterFlowRateHistoryInfoEntity;
+import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
+import org.springblade.modules.etl.dto.EtlMpQrDTO;
+import org.springblade.modules.etl.entity.EtlMpQrEntity;
+import org.springblade.modules.etl.service.IEtlMpQrDataService;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+/***
+ * Date:2022/5/22
+ * Title: 历史数据抽取
+ * Description:
+ * @author swp
+ * @version 1.0
+ * Remark:认为有必要的其他信息
+ */
+@Slf4j
+public class EtlMpQrDataTask implements Callable<Integer> {
+
+    private static IEtlMpQrDataService etlMpQrDataService;
+
+    private static IEtlMpQrDataService getEtlMpQrDataService() {
+        if (etlMpQrDataService == null) {
+            etlMpQrDataService = SpringUtil.getBean(IEtlMpQrDataService.class);
+        }
+        return etlMpQrDataService;
+    }
+
+    private static IWaterFlowRateHistoryService waterFlowRateHistoryService;
+
+    private static IWaterFlowRateHistoryService getWaterFlowRateHistoryService() {
+        if (waterFlowRateHistoryService == null) {
+            waterFlowRateHistoryService = SpringUtil.getBean(IWaterFlowRateHistoryService.class);
+        }
+        return waterFlowRateHistoryService;
+    }
+
+    private String year;
+
+    public EtlMpQrDataTask(String year) {
+        this.year = year;
+    }
+
+    @Override
+    public Integer call() {
+        try {
+            log.info("{}年历史数据导入任务开始执行*********************", year);
+            EtlMpQrDTO dto = new EtlMpQrDTO();
+            String stStr = year + "0101000000";
+            Date st = Func.parse(stStr, ConcurrentDateFormat.of("yyyyMMddHHmmss"));
+            String etStr = Func.toStr(Func.toInt(year) + 1) + "0101000000";
+            Date et = Func.parse(etStr, ConcurrentDateFormat.of("yyyyMMddHHmmss"));
+            log.info("查询时间 {} {}", Func.formatDateTime(st), Func.formatDateTime(et));
+            dto.setYear(year);
+
+            int index = 1;
+            while (true) {
+                try {
+                    Query query = new Query();
+                    query.setSize(100);
+                    query.setCurrent(index);
+                    IPage<EtlMpQrEntity> pages = getEtlMpQrDataService().selectPage(Condition.getPage(query), dto);
+                    List<EtlMpQrEntity> list = pages.getRecords();
+                    if (Func.isNull(list)) {
+                        break;
+                    }
+                    if (list.size() == 0) {
+                        break;
+                    }
+                    for (EtlMpQrEntity etlMpQrEntity : list) {
+                        log.info("点位 {} 时间 {}", etlMpQrEntity.getMpCd(), etlMpQrEntity.getTm());
+                        if (Func.notNull(etlMpQrEntity.getMpCd()) && Func.notNull(etlMpQrEntity.getTm())) {
+                            LambdaQueryWrapper<WaterFlowRateHistoryInfoEntity> wrapper = Wrappers.<WaterFlowRateHistoryInfoEntity>query().lambda();
+                            wrapper.eq(WaterFlowRateHistoryInfoEntity::getMpcd, etlMpQrEntity.getMpCd());
+                            wrapper.eq(WaterFlowRateHistoryInfoEntity::getTm, Func.parse(etlMpQrEntity.getTm(), ConcurrentDateFormat.of("yyyyMMddHHmmss")));
+                            long count = getWaterFlowRateHistoryService().count(wrapper);
+                            if (count == 0) {
+                                WaterFlowRateHistoryInfoEntity entity = new WaterFlowRateHistoryInfoEntity();
+                                entity.setMpcd(etlMpQrEntity.getMpCd());
+                                String tm = etlMpQrEntity.getTm();
+                                entity.setTm(Func.parse(tm, ConcurrentDateFormat.of("yyyyMMddHHmmss")));
+                                if (Func.notNull(etlMpQrEntity.getMpq())) {
+                                    entity.setMpq(Func.toDouble(etlMpQrEntity.getMpq()));
+                                }
+                                if (Func.notNull(etlMpQrEntity.getAccw())) {
+                                    entity.setAccw(Func.toLong(etlMpQrEntity.getAccw()));
+                                }
+                                if (Func.notNull(etlMpQrEntity.getAccPqw())) {
+                                    entity.setAccpqw(Func.toLong(etlMpQrEntity.getAccPqw()));
+                                }
+                                if (Func.notNull(etlMpQrEntity.getInStpq())) {
+                                    entity.setInstpq(Func.toDouble(etlMpQrEntity.getInStpq()));
+                                }
+                                if (Func.notNull(etlMpQrEntity.getAccPqw())) {
+                                    entity.setAccpqw(Func.toLong(etlMpQrEntity.getAccPqw()));
+                                }
+                                if (Func.notNull(etlMpQrEntity.getSpeRegData())) {
+                                    entity.setSperegdata(etlMpQrEntity.getSpeRegData());
+                                }
+                                if (Func.notNull(etlMpQrEntity.getHourw())) {
+                                    entity.setHourw(Func.toLong(etlMpQrEntity.getHourw()));
+                                }
+                                String ts = etlMpQrEntity.getTs();
+                                if (Func.notNull(ts)) {
+                                    entity.setTs(Func.parse(ts, ConcurrentDateFormat.of("yyyyMMddHHmmss")));
+                                }
+                                getWaterFlowRateHistoryService().save(entity);
+                            }
+                        }
+                    }
+                    index += 1;
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    log.error(e.getMessage());
+                }
+            }
+            log.info("{}年历史数据导入任务完成", year);
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("历史数据导入任务异常 {}", e.getMessage());
+        }
+        return 0;
+    }
+
+}

+ 98 - 6
src/main/java/org/springblade/modules/test/TestController.java

@@ -8,22 +8,33 @@ package org.springblade.modules.test;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springblade.constant.BusinessConstant;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.tool.api.R;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.enums.IsValidEnum;
+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.wateruseconsumer.entity.WaterUseConsumerInfoEntity;
+import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
+import org.springblade.modules.share.entity.DataShareLogEntity;
+import org.springblade.utils.HttpRequestUtil;
+import org.springframework.data.redis.core.HashOperations;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.io.FileInputStream;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 
 /***
  * Date:2023/9/12
@@ -40,6 +51,87 @@ import java.util.List;
 @Api(value = "运维单位管理", tags = "运维单位管理")
 public class TestController extends BladeController {
 
+    private final IWaterFlowRateHistoryService waterFlowRateHistoryService;
+
+    @Resource
+    private KafkaTemplate<String, String> kafkaTemplate;
+
+    @GetMapping("/js/test")
+    public R jsTest() {
+        try {
+            JSONObject post = new JSONObject();
+            post.put("pageSize", 20);
+            post.put("pageNum", 1);
+            String url = "https://qysgl.mwr.cn/wr/datasync/fac/info/findPage";
+            // 请求头
+            Map<String, String> headers = new HashMap<>();
+            headers.put("area", BusinessConstant.DATA_SHARE_AREA);
+            headers.put("key", BusinessConstant.DATA_SHARE_KEY);
+            JSONObject res = HttpRequestUtil.doHttpPostRequest("计量设施数据同步", url, headers, post.toJSONString(), 30000);
+            if (Func.notNull(res)) {
+                log.info("接口返回 {}", res.toJSONString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("计量设施同步任务异常 {}", e.getMessage());
+        }
+        return R.success("ok");
+    }
+
+    @GetMapping("/js/test2")
+    public R jsTest2(@RequestParam(name = "measId") String measId, @RequestParam(name = "dateStr") String dateStr) {
+        try {
+            JSONObject post = new JSONObject();
+            post.put("pageSize", 20);
+            post.put("pageNum", 1);
+            post.put("measId", measId);
+            post.put("dateStr", dateStr);
+            String url = "https://qysgl.mwr.cn/wr/datasync/wiwrDayWr/water/findPage";
+            // 请求头
+            Map<String, String> headers = new HashMap<>();
+            headers.put("area", BusinessConstant.DATA_SHARE_AREA);
+            headers.put("key", BusinessConstant.DATA_SHARE_KEY);
+            JSONObject res = HttpRequestUtil.doHttpPostRequest("日水量数据同步", url, headers, post.toJSONString(), 30000);
+            if (Func.notNull(res)) {
+                log.info("接口返回 {}", res.toJSONString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("计量设施同步任务异常 {}", e.getMessage());
+        }
+        return R.success("ok");
+    }
+
+    @GetMapping("/waterflowrate/add")
+    public R waterflowrateAdd() {
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("from_time","20240221130000");
+        jsonObject.put("tm","20240221130000");
+        jsonObject.put("up_time","20240221130000");
+        jsonObject.put("rtu_code","1522001004");
+        jsonObject.put("q",250.0);
+        jsonObject.put("acc_q",12574L);
+        jsonObject.put("hour_q",30L);
+
+        kafkaTemplate.send("topic-szy-water-flow-rate",jsonObject.toJSONString());
+        return R.success("ok");
+    }
+
+    @GetMapping("/js/test3")
+    public R jsTest3() {
+        double dayAccw = waterFlowRateHistoryService.getDayAccw("1522002011001");
+        List<JSONObject> datas = new ArrayList<>();
+        JSONObject data = new JSONObject();
+        data.put("dayW", dayAccw);
+        data.put("dayW2", 0.0);
+        datas.add(data);
+        JSONObject post = new JSONObject();
+        post.put("data", datas);
+        log.info("json post {}", post.toJSONString());
+        return R.success(post.toJSONString());
+    }
+
     @GetMapping("/map/json")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "获取配置项", notes = "获取配置项")

+ 30 - 16
src/main/java/org/springblade/mq/kafka/handler/MessageHandler.java

@@ -14,7 +14,6 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.enums.*;
 import org.springblade.modules.baseinfo.monitorsite.entity.MonitorSiteInfoEntity;
 import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
-import org.springblade.modules.business.check.order.dto.CheckOrderInfoDTO;
 import org.springblade.modules.business.monitor.entity.WaterFlowRateHistoryInfoEntity;
 import org.springblade.modules.business.monitor.entity.WaterFlowRateInfoEntity;
 import org.springblade.modules.business.monitor.service.IWaterFlowRateHistoryService;
@@ -77,6 +76,7 @@ public class MessageHandler {
     /**
      * 报文
      * 流量数据
+     *
      * @param record
      * @param acknowledgment
      */
@@ -102,11 +102,29 @@ public class MessageHandler {
             LambdaQueryWrapper<MonitorSiteInfoEntity> siteInfoWrapper = Wrappers.<MonitorSiteInfoEntity>query().lambda();
             siteInfoWrapper.eq(MonitorSiteInfoEntity::getIsDeleted, 0);
             siteInfoWrapper.eq(MonitorSiteInfoEntity::getWiustCd, rtuCode);
-            long siteCount = monitorSiteService.count(siteInfoWrapper);
-            if (siteCount > 0) {
-                historyInfoEntity.setMpq(body.getDouble(SzyFlowRateMetadataEnum.METADATA_CODE_Q.getName()));
-                historyInfoEntity.setAccw(body.getLong(SzyFlowRateMetadataEnum.METADATA_CODE_ACC_Q.getName()));
-                historyInfoEntity.setHourw(body.getLong(SzyFlowRateMetadataEnum.METADATA_CODE_HOUR_Q.getName()));
+            siteInfoWrapper.last("limit 1");
+            MonitorSiteInfoEntity siteInfoEntity = monitorSiteService.getOne(siteInfoWrapper);
+            if (Func.notNull(siteInfoEntity)) {
+                if (siteInfoEntity.getUpDataValid() == 0) {
+                    LambdaQueryWrapper<WaterFlowRateHistoryInfoEntity> lastWaterFlowRateWrapper = Wrappers.<WaterFlowRateHistoryInfoEntity>query().lambda();
+                    lastWaterFlowRateWrapper.eq(WaterFlowRateHistoryInfoEntity::getMpcd, historyInfoEntity.getMpcd());
+                    lastWaterFlowRateWrapper.orderByDesc(WaterFlowRateHistoryInfoEntity::getTm);
+                    lastWaterFlowRateWrapper.last("limit 1");
+                    WaterFlowRateHistoryInfoEntity lastWaterFlowRateEntity = waterFlowRateHistoryService.getOne(lastWaterFlowRateWrapper);
+                    if (Func.notNull(lastWaterFlowRateEntity)) {
+                        historyInfoEntity.setMpq(0.0);
+                        historyInfoEntity.setAccw(lastWaterFlowRateEntity.getAccw());
+                        historyInfoEntity.setHourw(0L);
+                    } else {
+                        historyInfoEntity.setMpq(0.0);
+                        historyInfoEntity.setAccw(0L);
+                        historyInfoEntity.setHourw(0L);
+                    }
+                } else {
+                    historyInfoEntity.setMpq(body.getDouble(SzyFlowRateMetadataEnum.METADATA_CODE_Q.getName()));
+                    historyInfoEntity.setAccw(body.getLong(SzyFlowRateMetadataEnum.METADATA_CODE_ACC_Q.getName()));
+                    historyInfoEntity.setHourw(body.getLong(SzyFlowRateMetadataEnum.METADATA_CODE_HOUR_Q.getName()));
+                }
                 historyInfoEntity.setTs(Func.parse(body.getString(SzyFlowRateMetadataEnum.METADATA_UP_TIME.getName()), ConcurrentDateFormat.of("yyyyMMddHHmmss")));
                 historyInfoEntity.setTm(Func.parse(body.getString(SzyFlowRateMetadataEnum.METADATA_COLLECT_TIME.getName()), ConcurrentDateFormat.of("yyyyMMddHHmmss")));
                 waterFlowRateHistoryService.save(historyInfoEntity);
@@ -124,7 +142,6 @@ public class MessageHandler {
                 entity.setTm(historyInfoEntity.getTm());
                 waterFlowRateService.saveOrUpdate(entity);
 
-
                 //更新测站最新上报时间
                 HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
                 String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuCode;
@@ -169,6 +186,7 @@ public class MessageHandler {
     /**
      * 报文
      * 水位数据
+     *
      * @param record
      * @param acknowledgment
      */
@@ -195,12 +213,11 @@ public class MessageHandler {
             LambdaQueryWrapper<MonitorSiteInfoEntity> siteInfoWrapper = Wrappers.<MonitorSiteInfoEntity>query().lambda();
             siteInfoWrapper.eq(MonitorSiteInfoEntity::getIsDeleted, 0);
             siteInfoWrapper.eq(MonitorSiteInfoEntity::getWiustCd, rtuCode);
-            long siteCount = monitorSiteService.count(siteInfoWrapper);
-            if (siteCount > 0) {
+            siteInfoWrapper.last("limit 1");
+            MonitorSiteInfoEntity siteInfoEntity = monitorSiteService.getOne(siteInfoWrapper);
+            if (Func.notNull(siteInfoEntity)) {
                 double waterLevel = body.getDouble(SzyWaterLevelMetadataEnum.METADATA_CODE_LEVEL.getName());
-                historyInfoEntity.setHourw(0L);
-                historyInfoEntity.setMpq(waterLevel);
-                historyInfoEntity.setAccw(0L);
+                historyInfoEntity.setWaterLevel(waterLevel);
                 historyInfoEntity.setTs(Func.parse(body.getString(SzyFlowRateMetadataEnum.METADATA_UP_TIME.getName()), ConcurrentDateFormat.of("yyyyMMddHHmmss")));
                 historyInfoEntity.setTm(Func.parse(body.getString(SzyFlowRateMetadataEnum.METADATA_COLLECT_TIME.getName()), ConcurrentDateFormat.of("yyyyMMddHHmmss")));
                 waterFlowRateHistoryService.save(historyInfoEntity);
@@ -211,14 +228,11 @@ public class MessageHandler {
                     entity = new WaterFlowRateInfoEntity();
                     entity.setMpcd(historyInfoEntity.getMpcd());
                 }
-                entity.setMpq(historyInfoEntity.getMpq());
-                entity.setAccw(historyInfoEntity.getAccw());
-                entity.setHourw(historyInfoEntity.getHourw());
+                entity.setWaterLevel(historyInfoEntity.getWaterLevel());
                 entity.setTs(historyInfoEntity.getTs());
                 entity.setTm(historyInfoEntity.getTm());
                 waterFlowRateService.saveOrUpdate(entity);
 
-
                 //更新测站最新上报时间
                 HashOperations<String, String, String> hashops = redisTemplate.opsForHash();
                 String key = RedisBusinessConstant.KEY_RTU_RUN_INFO + rtuCode;

+ 2 - 2
src/main/resources/application-dev.yml

@@ -5,7 +5,7 @@ spring:
     host: 172.31.1.228
     port: 6379
     password:  Dh@82828800
-    database: 4
+    database: 5
     ssl: false
     ##redis 集群环境配置
     #cluster:
@@ -64,7 +64,7 @@ spring:
       strict: false
       datasource:
         master:
-          url: jdbc:mysql://172.31.1.233:3306/xamszyywxt?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
+          url: jdbc:mysql://172.31.1.233:3306/tlszyywxt?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
           username: root
           password: Dh@82828800
           driver-class-name: com.mysql.cj.jdbc.Driver

+ 2 - 0
src/main/resources/application.yml

@@ -204,6 +204,8 @@ blade:
     skip-url:
       - /galaxy-test/**
       - /galaxy-business/notice/last/list
+      - /galaxy-business/etl/data/rtu/task
+      - /galaxy-business/etl/data/mp/task
     #授权认证配置
     auth:
       - method: ALL