Browse Source

修改了很多

yjj 3 years ago
parent
commit
13f5a25cac
100 changed files with 9854 additions and 0 deletions
  1. 88 0
      huimv-smart-incubator/cloud-platform-mobile/pom.xml
  2. 267 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/controller/AlarmRecordController.java
  3. 126 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/entity/AlarmRecord.java
  4. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/enums/AlarmRecordExceptionEnum.java
  5. 52 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/mapper/AlarmRecordMapper.java
  6. 24 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/mapper/mapping/AlarmRecordMapper.xml
  7. 114 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/param/AlarmRecordParam.java
  8. 97 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/service/AlarmRecordService.java
  9. 164 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/service/impl/AlarmRecordServiceImpl.java
  10. 206 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/controller/AlarmValueSetController.java
  11. 103 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/entity/AlarmValueSet.java
  12. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/enums/AlarmValueSetExceptionEnum.java
  13. 39 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/mapper/AlarmValueSetMapper.java
  14. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/mapper/mapping/AlarmValueSetMapper.xml
  15. 90 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/param/AlarmValueSetParam.java
  16. 97 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/service/AlarmValueSetService.java
  17. 151 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/service/impl/AlarmValueSetServiceImpl.java
  18. 34 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/controller/AnalysisController.java
  19. 25 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/entity/RegionAndStock.java
  20. 43 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/enums/AnalysisExceptionEnum.java
  21. 22 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/param/AnalysisParam.java
  22. 23 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/service/AnalysisService.java
  23. 109 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/service/impl/AnalysisServiceImpl.java
  24. 145 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/controller/BasePigpenController.java
  25. 191 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/entity/BasePigpen.java
  26. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/enums/BasePigpenExceptionEnum.java
  27. 39 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/mapper/BasePigpenMapper.java
  28. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/mapper/mapping/BasePigpenMapper.xml
  29. 105 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/param/BasePigpenParam.java
  30. 97 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/service/BasePigpenService.java
  31. 179 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/service/impl/BasePigpenServiceImpl.java
  32. 157 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/controller/BaseRegionController.java
  33. 74 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/entity/BaseRegion.java
  34. 66 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/enums/BaseRegionExceptionEnum.java
  35. 37 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/mapper/BaseRegionMapper.java
  36. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/mapper/mapping/BaseRegionMapper.xml
  37. 73 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/param/BaseRegionParam.java
  38. 100 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/service/BaseRegionService.java
  39. 140 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/service/impl/BaseRegionServiceImpl.java
  40. 19 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/EartagDataCountVo.java
  41. 169 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/controller/CollectorRegisterController.java
  42. 157 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/entity/CollectorRegister.java
  43. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/enums/CollectorRegisterExceptionEnum.java
  44. 40 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/mapper/CollectorRegisterMapper.java
  45. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/mapper/mapping/CollectorRegisterMapper.xml
  46. 148 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/param/CollectorRegisterParam.java
  47. 96 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/service/CollectorRegisterService.java
  48. 200 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/service/impl/CollectorRegisterServiceImpl.java
  49. 124 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/consts/SysExpEnumConstant.java
  50. 279 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/controller/DailyTabulateDataController.java
  51. 159 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/DailyTabulateData.java
  52. 21 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/DailyVo.java
  53. 54 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/OrgUser.java
  54. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/enums/DailyTabulateDataExceptionEnum.java
  55. 48 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/DailyTabulateDataMapper.java
  56. 10 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/OrgUserMapper.java
  57. 24 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/mapping/DailyTabulateDataMapper.xml
  58. 6 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/mapping/OrgUserMapper.xml
  59. 140 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/param/DailyTabulateDataParam.java
  60. 55 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/service/DailyTabulateDataService.java
  61. 253 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/service/impl/DailyTabulateDataServiceImpl.java
  62. 177 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/controller/EartagDataController.java
  63. 175 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/entity/EartagData.java
  64. 121 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/entity/TempMovePenEntity.java
  65. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/enums/EartagDataExceptionEnum.java
  66. 54 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/mapper/EartagDataMapper.java
  67. 31 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/mapper/mapping/EartagDataMapper.xml
  68. 175 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/param/EartagDataParam.java
  69. 114 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/service/EartagDataService.java
  70. 594 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/service/impl/EartagDataServiceImpl.java
  71. 148 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/controller/EartagRegisterController.java
  72. 108 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/entity/EartagRegister.java
  73. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/enums/EartagRegisterExceptionEnum.java
  74. 39 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/mapper/EartagRegisterMapper.java
  75. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/mapper/mapping/EartagRegisterMapper.xml
  76. 102 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/param/EartagRegisterParam.java
  77. 97 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/service/EartagRegisterService.java
  78. 172 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/service/impl/EartagRegisterServiceImpl.java
  79. 145 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/controller/FarmAlarmNumberController.java
  80. 127 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/entity/FarmAlarmNumber.java
  81. 65 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/enums/FarmAlarmNumberExceptionEnum.java
  82. 47 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/mapper/FarmAlarmNumberMapper.java
  83. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/mapper/mapping/FarmAlarmNumberMapper.xml
  84. 115 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/param/FarmAlarmNumberParam.java
  85. 99 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/service/FarmAlarmNumberService.java
  86. 164 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/service/impl/FarmAlarmNumberServiceImpl.java
  87. 182 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/controller/FarmStockController.java
  88. 140 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/entity/FarmStock.java
  89. 64 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/enums/FarmStockExceptionEnum.java
  90. 37 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/mapper/FarmStockMapper.java
  91. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/mapper/mapping/FarmStockMapper.xml
  92. 138 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/param/FarmStockParam.java
  93. 106 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/service/FarmStockService.java
  94. 190 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/service/impl/FarmStockServiceImpl.java
  95. 146 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/controller/HeartBeatRecordController.java
  96. 106 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/entity/HeartBeatRecord.java
  97. 63 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/enums/HeartBeatRecordExceptionEnum.java
  98. 39 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/mapper/HeartBeatRecordMapper.java
  99. 5 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/mapper/mapping/HeartBeatRecordMapper.xml
  100. 0 0
      huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/param/HeartBeatRecordParam.java

+ 88 - 0
huimv-smart-incubator/cloud-platform-mobile/pom.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>huimv-smart-incubator</artifactId>
+        <groupId>con.huimv</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>cloud-platform-mobile</artifactId>
+
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <mysql-connector-java.version>8.0.17</mysql-connector-java.version>
+        <oracle.version>11.2.0.3</oracle.version>
+        <mssql.version>9.3.0.jre8-preview</mssql.version>
+        <postgresql.version>42.2.19</postgresql.version>
+        <druid.version>1.1.21</druid.version>
+        <mp.version>3.4.2</mp.version>
+        <fastjson.version>1.2.75</fastjson.version>
+        <jwt.version>0.9.1</jwt.version>
+        <hutool.version>5.5.8</hutool.version>
+        <lombok.versin>1.18.12</lombok.versin>
+        <easypoi.version>4.2.0</easypoi.version>
+        <jodconverter.version>4.2.0</jodconverter.version>
+        <libreoffice.version>6.4.3</libreoffice.version>
+        <justauth.version>1.15.6</justauth.version>
+        <aliyun.oss.version>3.8.0</aliyun.oss.version>
+        <qcloud.oss.version>5.6.23</qcloud.oss.version>
+        <aliyun.sms.sdk.version>4.4.6</aliyun.sms.sdk.version>
+        <aliyun.sms.esc.version>4.17.6</aliyun.sms.esc.version>
+        <qcloud.sms.sdk.version>3.1.57</qcloud.sms.sdk.version>
+        <knife4j.version>2.0.8</knife4j.version>
+    </properties>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.20</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>5.3.9</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>5.3.9</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>5.3.9</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.20</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>5.3.9</version>
+            <scope>compile</scope>
+        </dependency>
+        <!--easypoi导入导出-->
+        <dependency>
+            <groupId>cn.afterturn</groupId>
+            <artifactId>easypoi-base</artifactId>
+            <version>${easypoi.version}</version>
+        </dependency>
+
+    </dependencies>
+
+
+</project>

+ 267 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/controller/AlarmRecordController.java

@@ -0,0 +1,267 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.core.annotion.BusinessLog;
+import com.huimv.core.annotion.Permission;
+import com.huimv.core.context.login.LoginContextHolder;
+import com.huimv.core.enums.LogAnnotionOpTypeEnum;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.alarmrecord.entity.AlarmRecord;
+import com.huimv.modular.alarmrecord.mapper.AlarmRecordMapper;
+import com.huimv.modular.alarmrecord.param.AlarmRecordParam;
+import com.huimv.modular.alarmrecord.service.AlarmRecordService;
+import com.huimv.modular.alarmvalueset.mapper.AlarmValueSetMapper;
+import com.huimv.modular.alarmvalueset.service.AlarmValueSetService;
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.mapper.CollectorRegisterMapper;
+import com.huimv.modular.farmalarmnumber.entity.FarmAlarmNumber;
+import com.huimv.modular.farmalarmnumber.mapper.FarmAlarmNumberMapper;
+import com.huimv.modular.utils.util.StringUtilsWork;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 报警记录控制器
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+@RestController
+public class AlarmRecordController {
+
+
+
+    @Resource
+    private AlarmRecordService alarmRecordService;
+    @Resource
+    private AlarmValueSetService alarmValueSetService;
+    @Resource
+    private CollectorRegisterMapper collectorRegisterMapper;
+    @Resource
+    private AlarmValueSetMapper alarmValueSetMapper;
+    @Resource
+    private AlarmRecordMapper alarmRecordMapper;
+    @Resource
+    private FarmAlarmNumberMapper farmAlarmNumberMapper;
+
+    /**
+     * 添加报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    //@Permission
+    @PostMapping("/alarmRecord/listByOrgid")
+    // public ResponseData add(@RequestBody @Validated(AlarmValueSetParam.add.class) AlarmValueSetParam alarmValueSetParam) {
+    public Map listByOrgid(@RequestBody Map<String, Object> params) {
+
+        Long orgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        List<Long> list = alarmRecordMapper.findChildFarmsByOrgIds(orgId);
+        Map<String, Object> map = new HashMap<>();
+
+        Integer earHighTemp = 0;
+        Integer earLowTemp = 0;
+        Integer envHighTemp = 0;
+        Integer envLowTemp = 0;
+        Integer deviceAlarm = 0;
+        Integer disesAlarm = 0;
+        IPage<FarmAlarmNumber> iPage = new Page<>();
+        LambdaQueryWrapper<FarmAlarmNumber> wrapper4 = Wrappers.lambdaQuery();
+        wrapper4.in(FarmAlarmNumber::getOrgid, list);
+        IPage<FarmAlarmNumber> farmAlarmNumberIPage = farmAlarmNumberMapper.selectPage(iPage, wrapper4);
+        System.out.println(farmAlarmNumberIPage.getRecords());
+        //牧场相加
+        for (FarmAlarmNumber farmAlarmNumber : farmAlarmNumberIPage.getRecords()) {
+            earHighTemp += farmAlarmNumber.getEarHightemp();
+            earLowTemp += farmAlarmNumber.getEarHightemp();
+            envHighTemp += farmAlarmNumber.getEnvHightemp();
+            envLowTemp += farmAlarmNumber.getEnvLowtemp();
+            deviceAlarm += farmAlarmNumber.getDaviceAlarm();
+            disesAlarm += farmAlarmNumber.getDiseaseAlarm();
+        }
+        map.put("earHighTemp", earHighTemp);
+        map.put("earLowTemp", earLowTemp);
+        map.put("envHighTemp", envHighTemp);
+        map.put("envLowTemp", envLowTemp);
+        map.put("deviceAlarm", 0);
+        map.put("disesAlarm", 0);
+        map.put("total", farmAlarmNumberIPage);
+        return map;
+    }
+
+
+
+    /**
+     * 添加报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    //@Permission
+    @PostMapping("/alarmRecord/listByfarmOrgid")
+    // public ResponseData add(@RequestBody @Validated(AlarmValueSetParam.add.class) AlarmValueSetParam alarmValueSetParam) {
+    public Map listByfarmOrgid(@RequestBody Map<String, Object> params) {
+        Long FinalOrdId;
+        String orgId = (String) params.get("orgId");//开始时间
+        Integer pageNum = (Integer) params.get("pageNum");//开始时间
+        Integer pageSize = (Integer) params.get("pageSize");//开始时间
+        if (StringUtilsWork.isNotBlank(orgId)){
+            FinalOrdId=Long.valueOf(orgId);
+        }else {
+            FinalOrdId=LoginContextHolder.me().getSysLoginUserOrgId();
+        }
+        Map<String, Object> map = new HashMap<>();
+        //拿到组织ID 放到map   //牧场为空,返回省数据或者市数据,不为空返回
+        LambdaQueryWrapper<FarmAlarmNumber> wrapper4 = Wrappers.lambdaQuery();
+        wrapper4.eq(FarmAlarmNumber::getOrgid, FinalOrdId);
+        FarmAlarmNumber farmAlarmNumber = farmAlarmNumberMapper.selectOne(wrapper4);
+        IPage<AlarmRecord> iPage = new Page<>(pageNum,pageSize);
+        LambdaQueryWrapper<AlarmRecord> wrapper45 = Wrappers.lambdaQuery();
+        wrapper45.eq(AlarmRecord::getOrgId, FinalOrdId).orderByDesc(AlarmRecord::getId);
+        IPage<AlarmRecord> alarmRecordIPage = alarmRecordMapper.selectPage(iPage, wrapper45);
+
+        for (AlarmRecord record : alarmRecordIPage.getRecords()) {
+            LambdaQueryWrapper<CollectorRegister> wrapper48 = Wrappers.lambdaQuery();
+            wrapper48.eq(CollectorRegister::getDeviceCode, record.getCollectorCode());
+            CollectorRegister collectorRegister = collectorRegisterMapper.selectOne(wrapper48);
+            record.setFarmName(collectorRegister.getPenName());
+            record.setRemark(collectorRegister.getUnitName());
+        }
+        map.put("farmAlarmNumber", farmAlarmNumber);
+        map.put("alarmRecordIPage", alarmRecordIPage);
+        return map;
+    }
+
+
+    /**
+     * 查询报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @GetMapping("/alarmRecord/page")
+    @BusinessLog(title = "报警记录_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(AlarmRecordParam alarmRecordParam) {
+        return new SuccessResponseData(alarmRecordService.page(alarmRecordParam));
+    }
+
+
+    /**
+     * 添加报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @PostMapping("/alarmRecord/add")
+    @BusinessLog(title = "报警记录_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(AlarmRecordParam.add.class) AlarmRecordParam alarmRecordParam) {
+        alarmRecordService.add(alarmRecordParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除报警记录,可批量删除
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @PostMapping("/alarmRecord/delete")
+    @BusinessLog(title = "报警记录_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(AlarmRecordParam.delete.class) List<AlarmRecordParam> alarmRecordParamList) {
+        alarmRecordService.delete(alarmRecordParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @PostMapping("/alarmRecord/edit")
+    @BusinessLog(title = "报警记录_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(AlarmRecordParam.edit.class) AlarmRecordParam alarmRecordParam) {
+        alarmRecordService.edit(alarmRecordParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @GetMapping("/alarmRecord/detail")
+    @BusinessLog(title = "报警记录_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(AlarmRecordParam.detail.class) AlarmRecordParam alarmRecordParam) {
+        return new SuccessResponseData(alarmRecordService.detail(alarmRecordParam));
+    }
+
+    /**
+     * 报警记录列表
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @GetMapping("/alarmRecord/list")
+    @BusinessLog(title = "报警记录_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(AlarmRecordParam alarmRecordParam) {
+        return new SuccessResponseData(alarmRecordService.list(alarmRecordParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+
+    @GetMapping("/alarmRecord/export")
+    @BusinessLog(title = "报警记录_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(AlarmRecordParam alarmRecordParam) {
+        alarmRecordService.export(alarmRecordParam);
+    }
+
+}

+ 126 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/entity/AlarmRecord.java

@@ -0,0 +1,126 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 报警记录
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+
+@Data
+@TableName("alarm_record")
+public class AlarmRecord  {
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @Excel(name = "组织id")
+    private String orgId;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @Excel(name = "采集时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    private Date alarmTime;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String farmName;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String eartagNo;
+
+    /**
+     * 采集器编码
+     */
+    @Excel(name = "采集器编码")
+    private String collectorCode;
+
+    /**
+     * 猪舍id
+     */
+    @Excel(name = "猪舍id")
+    private Integer penId;
+
+    @Excel(name = "阶段")
+    private Integer stage;
+
+    /**
+     * 单元id
+     */
+    @Excel(name = "单元id")
+    private Integer unitId;
+
+    /**
+     * 类型
+     */
+    @Excel(name = "类型")
+    private Integer alarmType;
+
+    /**
+     * 当前报警数值
+     */
+    @Excel(name = "当前报警数值")
+    private Double nowValue;
+
+    /**
+     * 是否被处理-0.否--1.是
+     */
+    @Excel(name = "是否被处理-0.否--1.是")
+    private Integer status;
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remark;
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/enums/AlarmRecordExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+
+/**
+ * 报警记录
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum AlarmRecordExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        AlarmRecordExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 52 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/mapper/AlarmRecordMapper.java

@@ -0,0 +1,52 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.modular.alarmrecord.entity.AlarmRecord;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 报警记录
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+@Repository
+public interface AlarmRecordMapper extends BaseMapper<AlarmRecord> {
+    List<Long> findChildFarmsByOrgId(Long i);
+    List<Long> findChildFarmsByOrgIds(Long i);
+
+    void selectList(IPage<AlarmRecord> iPage1, LambdaQueryWrapper<AlarmRecord> wrapper45);
+
+    Page<AlarmRecord> findByCondition(@Param("page") IPage<AlarmRecord> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<AlarmRecord> wrapper);
+}

+ 24 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/mapper/mapping/AlarmRecordMapper.xml

@@ -0,0 +1,24 @@
+<?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="com.huimv.modular.alarmrecord.mapper.AlarmRecordMapper">
+
+
+    <select id="findByCondition" resultType="com.huimv.modular.eartagdata.entity.EartagData">
+        SELECT * FROM eartag_data ed1 JOIN (SELECT MAX(id) id FROM eartag_data ed2 ${ew.customSqlSegment}) b ON ed1.id = b.id
+    </select>
+
+
+
+    <select id="findChildFarmsByOrgId" parameterType="long" resultType="long">
+        SELECT * FROM sys_org so1 WHERE pids LIKE CONCAT('%',#{value},'%') AND NOT EXISTS(SELECT 1 FROM sys_org so2 WHERE so1.id = so2.pid)
+    </select>
+
+
+
+    <select id="findChildFarmsByOrgIds" parameterType="long" resultType="long">
+       SELECT * FROM sys_org so1 WHERE (id = #{value}  OR pids LIKE CONCAT('%',#{value},'%')) AND NOT EXISTS(SELECT 1 FROM sys_org so2 WHERE so1.id = so2.pid)
+    </select>
+
+
+
+</mapper>

+ 114 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/param/AlarmRecordParam.java

@@ -0,0 +1,114 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.param;
+
+import com.huimv.core.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 报警记录参数类
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+*/
+@Data
+public class AlarmRecordParam extends BaseParam {
+
+    /**
+     * 主键
+     */
+    @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @NotBlank(message = "组织id不能为空,请检查orgId参数", groups = {add.class, edit.class})
+    private String orgId;
+
+    /**
+     * 牧场编码
+     */
+    @NotBlank(message = "牧场编码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查farmName参数", groups = {add.class, edit.class})
+    private String farmName;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查eartagNo参数", groups = {add.class, edit.class})
+    private String eartagNo;
+
+    /**
+     * 采集器编码
+     */
+    @NotBlank(message = "采集器编码不能为空,请检查collectorCode参数", groups = {add.class, edit.class})
+    private String collectorCode;
+
+    /**
+     * 猪舍id
+     */
+    @NotNull(message = "猪舍id不能为空,请检查penId参数", groups = {add.class, edit.class})
+    private Integer penId;
+
+    /**
+     * 单元id
+     */
+    @NotNull(message = "单元id不能为空,请检查unitId参数", groups = {add.class, edit.class})
+    private Integer unitId;
+
+    /**
+     * 类型
+     */
+    @NotNull(message = "类型不能为空,请检查alarmType参数", groups = {add.class, edit.class})
+    private Integer alarmType;
+
+    /**
+     * 当前报警数值
+     */
+    @NotNull(message = "当前报警数值不能为空,请检查nowValue参数", groups = {add.class, edit.class})
+    private Double nowValue;
+
+    /**
+     * 是否被处理-0.否--1.是
+     */
+    @NotNull(message = "是否被处理-0.否--1.是不能为空,请检查status参数", groups = {add.class, edit.class})
+    private Integer status;
+
+    /**
+     * 备注
+     */
+    @NotBlank(message = "备注不能为空,请检查remark参数", groups = {add.class, edit.class})
+    private String remark;
+
+}

+ 97 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/service/AlarmRecordService.java

@@ -0,0 +1,97 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.modular.alarmrecord.entity.AlarmRecord;
+import com.huimv.modular.alarmrecord.param.AlarmRecordParam;
+import java.util.List;
+
+/**
+ * 报警记录service接口
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+public interface AlarmRecordService extends IService<AlarmRecord> {
+
+    /**
+     * 查询报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    PageResult<AlarmRecord> page(AlarmRecordParam alarmRecordParam);
+
+    /**
+     * 报警记录列表
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    List<AlarmRecord> list(AlarmRecordParam alarmRecordParam);
+
+    /**
+     * 添加报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    void add(AlarmRecordParam alarmRecordParam);
+
+    /**
+     * 删除报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    void delete(List<AlarmRecordParam> alarmRecordParamList);
+
+    /**
+     * 编辑报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    void edit(AlarmRecordParam alarmRecordParam);
+
+    /**
+     * 查看报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+     AlarmRecord detail(AlarmRecordParam alarmRecordParam);
+
+    /**
+     * 导出报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+     void export(AlarmRecordParam alarmRecordParam);
+
+}

+ 164 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmrecord/service/impl/AlarmRecordServiceImpl.java

@@ -0,0 +1,164 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmrecord.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.consts.CommonConstant;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.alarmrecord.entity.AlarmRecord;
+import com.huimv.modular.alarmrecord.enums.AlarmRecordExceptionEnum;
+import com.huimv.modular.alarmrecord.mapper.AlarmRecordMapper;
+import com.huimv.modular.alarmrecord.param.AlarmRecordParam;
+import com.huimv.modular.alarmrecord.service.AlarmRecordService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 报警记录service接口实现类
+ *
+ * @author ydd
+ * @date 2021-08-20 13:27:00
+ */
+@Service
+public class AlarmRecordServiceImpl extends ServiceImpl<AlarmRecordMapper, AlarmRecord> implements AlarmRecordService {
+
+    @Override
+    public PageResult<AlarmRecord> page(AlarmRecordParam alarmRecordParam) {
+        QueryWrapper<AlarmRecord> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(alarmRecordParam)) {
+
+            // 根据组织id 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getOrgId())) {
+                queryWrapper.lambda().eq(AlarmRecord::getOrgId, alarmRecordParam.getOrgId());
+            }
+            // 根据牧场编码 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getFarmCode())) {
+                queryWrapper.lambda().eq(AlarmRecord::getFarmCode, alarmRecordParam.getFarmCode());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getFarmName())) {
+                queryWrapper.lambda().eq(AlarmRecord::getFarmName, alarmRecordParam.getFarmName());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getEartagNo())) {
+                queryWrapper.lambda().eq(AlarmRecord::getEartagNo, alarmRecordParam.getEartagNo());
+            }
+            // 根据采集器编码 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getCollectorCode())) {
+                queryWrapper.lambda().eq(AlarmRecord::getCollectorCode, alarmRecordParam.getCollectorCode());
+            }
+            // 根据猪舍id 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getPenId())) {
+                queryWrapper.lambda().eq(AlarmRecord::getPenId, alarmRecordParam.getPenId());
+            }
+            // 根据单元id 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getUnitId())) {
+                queryWrapper.lambda().eq(AlarmRecord::getUnitId, alarmRecordParam.getUnitId());
+            }
+            // 根据类型 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getAlarmType())) {
+                queryWrapper.lambda().eq(AlarmRecord::getAlarmType, alarmRecordParam.getAlarmType());
+            }
+            // 根据当前报警数值 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getNowValue())) {
+                queryWrapper.lambda().eq(AlarmRecord::getNowValue, alarmRecordParam.getNowValue());
+            }
+            // 根据是否被处理-0.否--1.是 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getStatus())) {
+                queryWrapper.lambda().eq(AlarmRecord::getStatus, alarmRecordParam.getStatus());
+            }
+            // 根据备注 查询
+            if (ObjectUtil.isNotEmpty(alarmRecordParam.getRemark())) {
+                queryWrapper.lambda().eq(AlarmRecord::getRemark, alarmRecordParam.getRemark());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<AlarmRecord> list(AlarmRecordParam alarmRecordParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(AlarmRecordParam alarmRecordParam) {
+        AlarmRecord alarmRecord = new AlarmRecord();
+        BeanUtil.copyProperties(alarmRecordParam, alarmRecord);
+        this.save(alarmRecord);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<AlarmRecordParam> alarmRecordParamList) {
+        alarmRecordParamList.forEach(alarmRecordParam -> {
+            this.removeById(alarmRecordParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(AlarmRecordParam alarmRecordParam) {
+        AlarmRecord alarmRecord = this.queryAlarmRecord(alarmRecordParam);
+        BeanUtil.copyProperties(alarmRecordParam, alarmRecord);
+        this.updateById(alarmRecord);
+    }
+
+    @Override
+    public AlarmRecord detail(AlarmRecordParam alarmRecordParam) {
+        return this.queryAlarmRecord(alarmRecordParam);
+    }
+
+    /**
+     * 获取报警记录
+     *
+     * @author ydd
+     * @date 2021-08-20 13:27:00
+     */
+    private AlarmRecord queryAlarmRecord(AlarmRecordParam alarmRecordParam) {
+        AlarmRecord alarmRecord = this.getById(alarmRecordParam.getId());
+        if (ObjectUtil.isNull(alarmRecord)) {
+            throw new ServiceException(AlarmRecordExceptionEnum.NOT_EXIST);
+        }
+        return alarmRecord;
+    }
+
+    @Override
+    public void export(AlarmRecordParam alarmRecordParam) {
+        List<AlarmRecord> list = this.list(alarmRecordParam);
+        PoiUtil.exportExcelWithStream("SnowyAlarmRecord.xls", AlarmRecord.class, list);
+    }
+
+}

+ 206 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/controller/AlarmValueSetController.java

@@ -0,0 +1,206 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.huimv.core.annotion.BusinessLog;
+import com.huimv.core.annotion.Permission;
+import com.huimv.core.context.login.LoginContextHolder;
+import com.huimv.core.enums.LogAnnotionOpTypeEnum;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.alarmvalueset.entity.AlarmValueSet;
+import com.huimv.modular.alarmvalueset.mapper.AlarmValueSetMapper;
+import com.huimv.modular.alarmvalueset.param.AlarmValueSetParam;
+import com.huimv.modular.alarmvalueset.service.AlarmValueSetService;
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.mapper.CollectorRegisterMapper;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 报警参数设置控制器
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+@RestController
+public class AlarmValueSetController {
+
+    @Resource
+    private AlarmValueSetService alarmValueSetService;
+    @Resource
+    private CollectorRegisterMapper collectorRegisterMapper;
+    @Resource
+    private AlarmValueSetMapper  alarmValueSetMapper;
+
+    /**
+     * 查询报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @GetMapping("/alarmValueSet/page")
+    @BusinessLog(title = "报警参数设置_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(AlarmValueSetParam alarmValueSetParam) {
+        return new SuccessResponseData(alarmValueSetService.page(alarmValueSetParam));
+    }
+
+    /**
+     * 添加报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @PostMapping("/alarmValueSet/add")
+    @BusinessLog(title = "报警参数设置_增加", opType = LogAnnotionOpTypeEnum.ADD)
+   // public ResponseData add(@RequestBody @Validated(AlarmValueSetParam.add.class) AlarmValueSetParam alarmValueSetParam) {
+    public ResponseData add(@RequestParam Map<String, Object> params) {
+        String alarmType = (String) params.get("alarmType");//开始时间
+        Long orgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        System.out.println(orgId+"组织ID"+alarmType);
+
+        String setValue = (String) params.get("setValue");//开始时间
+        LambdaQueryWrapper<CollectorRegister> wrapper3 = Wrappers.lambdaQuery();
+        wrapper3.eq(CollectorRegister::getOrgId, orgId).orderByAsc(CollectorRegister::getId).last("limit 1");
+        CollectorRegister collectorRegister = collectorRegisterMapper.selectOne(wrapper3);
+        if(collectorRegister==null){
+            return new SuccessResponseData("当前牧场没有数据采集设备,无法设置阈值");
+        }
+
+        LambdaQueryWrapper<AlarmValueSet> wrapper4 = Wrappers.lambdaQuery();
+        wrapper4.eq(AlarmValueSet::getOrgId, orgId).eq(AlarmValueSet::getAlarmType,Integer.valueOf(alarmType) );
+        AlarmValueSet alarmValueSet1 = alarmValueSetMapper.selectOne(wrapper4);
+        System.out.println(alarmValueSet1);
+        if (alarmValueSet1!=null) {
+            return new SuccessResponseData("已经设置此阈值");
+        }
+
+
+        AlarmValueSet alarmValueSet = new AlarmValueSet();
+        alarmValueSet.setAlarmType(Integer.valueOf(alarmType));
+        alarmValueSet.setCanStatus(0);
+        alarmValueSet.setFarmCode(collectorRegister.getFarmCode());
+        alarmValueSet.setFarmName(collectorRegister.getFarmName());
+        alarmValueSet.setOrgId(String.valueOf(orgId) );
+        alarmValueSet.setRemark("测试数据");
+        alarmValueSet.setSetValue(Double.valueOf(setValue));
+        alarmValueSet.setUpdateTime(new Date());
+        alarmValueSetService.save(alarmValueSet);
+        return new SuccessResponseData();
+    }
+
+
+
+
+    /**
+     * 删除报警参数设置,可批量删除
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @PostMapping("/alarmValueSet/delete")
+    @BusinessLog(title = "报警参数设置_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(AlarmValueSetParam.delete.class) List<AlarmValueSetParam> alarmValueSetParamList) {
+            alarmValueSetService.delete(alarmValueSetParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @PostMapping("/alarmValueSet/edit")
+    @BusinessLog(title = "报警参数设置_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    //public ResponseData edit(@RequestBody @Validated(AlarmValueSetParam.edit.class) AlarmValueSetParam alarmValueSetParam) {
+    public ResponseData edit(@RequestBody  Map<String, Object> params) {
+           // alarmValueSetService.edit(alarmValueSetParam);
+        // String farmID = (String) params.get("farmID");//牧场编码
+        String  id = (String) params.get("id");//牧场编码
+        Integer alarmType = (int) params.get("alarmType");//开始时间
+        String setValue = (String) params.get("setValue");//开始时间
+        LambdaQueryWrapper<AlarmValueSet> wrapper3 = Wrappers.lambdaQuery();
+        wrapper3.eq(AlarmValueSet::getId,Integer.valueOf(id) );
+        AlarmValueSet alarmValueSet = alarmValueSetMapper.selectOne(wrapper3);
+
+        alarmValueSet.setAlarmType(alarmType);
+        alarmValueSet.setCanStatus(0);
+        alarmValueSet.setSetValue(Double.valueOf(setValue));
+        alarmValueSetService.updateById(alarmValueSet);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @GetMapping("/alarmValueSet/detail")
+    @BusinessLog(title = "报警参数设置_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(AlarmValueSetParam.detail.class) AlarmValueSetParam alarmValueSetParam) {
+        return new SuccessResponseData(alarmValueSetService.detail(alarmValueSetParam));
+    }
+
+    /**
+     * 报警参数设置列表
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @GetMapping("/alarmValueSet/list")
+    @BusinessLog(title = "报警参数设置_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(AlarmValueSetParam alarmValueSetParam) {
+        return new SuccessResponseData(alarmValueSetService.list(alarmValueSetParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+
+    @GetMapping("/alarmValueSet/export")
+    @BusinessLog(title = "报警参数设置_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(AlarmValueSetParam alarmValueSetParam) {
+        alarmValueSetService.export(alarmValueSetParam);
+    }
+
+}

+ 103 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/entity/AlarmValueSet.java

@@ -0,0 +1,103 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 报警参数设置
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+
+@Data
+@TableName("alarm_value_set")
+public class AlarmValueSet  {
+
+    /**
+     * 
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    //@Excel(name = "采集时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    private Date updateTime;
+
+
+    /**
+     * 组织id
+     */
+    @Excel(name = "组织id")
+    private String orgId;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    @Excel(name = "牧场名称")
+    private String farmName;
+
+    /**
+     * 1.耳温高2.耳温低3.环温高4.环温低5.设备掉线6.疫病报警
+     */
+    @Excel(name = "1.耳温高2.耳温低3.环温高4.环温低5.设备掉线6.疫病报警")
+    private Integer alarmType;
+
+    /**
+     * 设定值
+     */
+    @Excel(name = "设定值")
+    private Double setValue;
+
+    /**
+     * 备注
+     */
+    @Excel(name = "备注")
+    private String remark;
+
+    /**
+     * 0.在使用  1.停止使用
+     */
+    @Excel(name = "0.在使用  1.停止使用")
+    private Integer canStatus;
+
+
+
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/enums/AlarmValueSetExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+
+/**
+ * 报警参数设置
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum AlarmValueSetExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        AlarmValueSetExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 39 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/mapper/AlarmValueSetMapper.java

@@ -0,0 +1,39 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.alarmvalueset.entity.AlarmValueSet;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 报警参数设置
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+@Repository
+public interface AlarmValueSetMapper extends BaseMapper<AlarmValueSet> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/mapper/mapping/AlarmValueSetMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.alarmvalueset.mapper.AlarmValueSetMapper">
+
+</mapper>

+ 90 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/param/AlarmValueSetParam.java

@@ -0,0 +1,90 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.param;
+
+import com.huimv.core.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 报警参数设置参数类
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+*/
+@Data
+public class AlarmValueSetParam extends BaseParam {
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @NotBlank(message = "组织id不能为空,请检查orgId参数", groups = {add.class, edit.class})
+    private String orgId;
+
+    /**
+     * 牧场编码
+     */
+    @NotBlank(message = "牧场编码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    @NotBlank(message = "牧场名称不能为空,请检查farmName参数", groups = {add.class, edit.class})
+    private String farmName;
+
+    /**
+     * 1.耳温高2.耳温低3.环温高4.环温低5.设备掉线6.疫病报警
+     */
+    @NotNull(message = "1.耳温高2.耳温低3.环温高4.环温低5.设备掉线6.疫病报警不能为空,请检查alarmType参数", groups = {add.class, edit.class})
+    private Integer alarmType;
+
+    /**
+     * 设定值
+     */
+    @NotNull(message = "设定值不能为空,请检查setValue参数", groups = {add.class, edit.class})
+    private Double setValue;
+
+    /**
+     * 备注
+     */
+    @NotBlank(message = "备注不能为空,请检查remark参数", groups = {add.class, edit.class})
+    private String remark;
+
+    /**
+     * 0.在使用  1.停止使用
+     */
+    @NotNull(message = "0.在使用  1.停止使用不能为空,请检查canStatus参数", groups = {add.class, edit.class})
+    private Integer canStatus;
+
+}

+ 97 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/service/AlarmValueSetService.java

@@ -0,0 +1,97 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.modular.alarmvalueset.entity.AlarmValueSet;
+import com.huimv.modular.alarmvalueset.param.AlarmValueSetParam;
+import java.util.List;
+
+/**
+ * 报警参数设置service接口
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+public interface AlarmValueSetService extends IService<AlarmValueSet> {
+
+    /**
+     * 查询报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    PageResult<AlarmValueSet> page(AlarmValueSetParam alarmValueSetParam);
+
+    /**
+     * 报警参数设置列表
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    List<AlarmValueSet> list(AlarmValueSetParam alarmValueSetParam);
+
+    /**
+     * 添加报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    void add(AlarmValueSetParam alarmValueSetParam);
+
+    /**
+     * 删除报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    void delete(List<AlarmValueSetParam> alarmValueSetParamList);
+
+    /**
+     * 编辑报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    void edit(AlarmValueSetParam alarmValueSetParam);
+
+    /**
+     * 查看报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+     AlarmValueSet detail(AlarmValueSetParam alarmValueSetParam);
+
+    /**
+     * 导出报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+     void export(AlarmValueSetParam alarmValueSetParam);
+
+}

+ 151 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/alarmvalueset/service/impl/AlarmValueSetServiceImpl.java

@@ -0,0 +1,151 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.alarmvalueset.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.consts.CommonConstant;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.alarmvalueset.entity.AlarmValueSet;
+import com.huimv.modular.alarmvalueset.enums.AlarmValueSetExceptionEnum;
+import com.huimv.modular.alarmvalueset.mapper.AlarmValueSetMapper;
+import com.huimv.modular.alarmvalueset.param.AlarmValueSetParam;
+import com.huimv.modular.alarmvalueset.service.AlarmValueSetService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 报警参数设置service接口实现类
+ *
+ * @author ydd
+ * @date 2021-08-20 13:23:30
+ */
+@Service
+public class AlarmValueSetServiceImpl extends ServiceImpl<AlarmValueSetMapper, AlarmValueSet> implements AlarmValueSetService {
+
+    @Override
+    public PageResult<AlarmValueSet> page(AlarmValueSetParam alarmValueSetParam) {
+        QueryWrapper<AlarmValueSet> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(alarmValueSetParam)) {
+
+            // 根据组织id 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getOrgId())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getOrgId, alarmValueSetParam.getOrgId());
+            }
+            // 根据牧场编码 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getFarmCode())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getFarmCode, alarmValueSetParam.getFarmCode());
+            }
+            // 根据牧场名称 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getFarmName())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getFarmName, alarmValueSetParam.getFarmName());
+            }
+            // 根据1.耳温高2.耳温低3.环温高4.环温低5.设备掉线6.疫病报警 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getAlarmType())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getAlarmType, alarmValueSetParam.getAlarmType());
+            }
+            // 根据设定值 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getSetValue())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getSetValue, alarmValueSetParam.getSetValue());
+            }
+            // 根据备注 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getRemark())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getRemark, alarmValueSetParam.getRemark());
+            }
+            // 根据0.在使用  1.停止使用 查询
+            if (ObjectUtil.isNotEmpty(alarmValueSetParam.getCanStatus())) {
+                queryWrapper.lambda().eq(AlarmValueSet::getCanStatus, alarmValueSetParam.getCanStatus());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<AlarmValueSet> list(AlarmValueSetParam alarmValueSetParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(AlarmValueSetParam alarmValueSetParam) {
+        AlarmValueSet alarmValueSet = new AlarmValueSet();
+
+
+
+        BeanUtil.copyProperties(alarmValueSetParam, alarmValueSet);
+        this.save(alarmValueSet);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<AlarmValueSetParam> alarmValueSetParamList) {
+        alarmValueSetParamList.forEach(alarmValueSetParam -> {
+            this.removeById(alarmValueSetParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(AlarmValueSetParam alarmValueSetParam) {
+        AlarmValueSet alarmValueSet = this.queryAlarmValueSet(alarmValueSetParam);
+        BeanUtil.copyProperties(alarmValueSetParam, alarmValueSet);
+        this.updateById(alarmValueSet);
+    }
+
+    @Override
+    public AlarmValueSet detail(AlarmValueSetParam alarmValueSetParam) {
+        return this.queryAlarmValueSet(alarmValueSetParam);
+    }
+
+    /**
+     * 获取报警参数设置
+     *
+     * @author ydd
+     * @date 2021-08-20 13:23:30
+     */
+    private AlarmValueSet queryAlarmValueSet(AlarmValueSetParam alarmValueSetParam) {
+        AlarmValueSet alarmValueSet = this.getById(alarmValueSetParam.getId());
+        if (ObjectUtil.isNull(alarmValueSet)) {
+            throw new ServiceException(AlarmValueSetExceptionEnum.NOT_EXIST);
+        }
+        return alarmValueSet;
+    }
+
+    @Override
+    public void export(AlarmValueSetParam alarmValueSetParam) {
+        List<AlarmValueSet> list = this.list(alarmValueSetParam);
+        PoiUtil.exportExcelWithStream("SnowyAlarmValueSet.xls", AlarmValueSet.class, list);
+    }
+
+}

+ 34 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/controller/AnalysisController.java

@@ -0,0 +1,34 @@
+package com.huimv.modular.analysis.controller;
+
+import com.huimv.core.annotion.DataScope;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.analysis.param.AnalysisParam;
+import com.huimv.modular.analysis.service.AnalysisService;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * <p>
+ * 数据分析控制器
+ * </p>
+ *
+ * @author yinhao
+ * @version 1.0
+ * @date 2021/8/18 14:40
+ */
+@RestController
+public class AnalysisController {
+
+    @Resource
+    private AnalysisService analysisService;
+
+    @DataScope
+    @GetMapping("/analysis/childPigStock")
+    public ResponseData getChildPigStockByOrgId(@Validated(AnalysisParam.list.class) AnalysisParam analysisParam) {
+        return new SuccessResponseData(analysisService.getChildPigStockByOrgId(analysisParam));
+    }
+}

+ 25 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/entity/RegionAndStock.java

@@ -0,0 +1,25 @@
+package com.huimv.modular.analysis.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 数据分析返回区域集合和存栏数集合
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/8/18 14:51
+ */
+@Data
+public class RegionAndStock implements Serializable {
+    private static final long serialVersionUID = -7393227753388568804L;
+
+    private List<String> regionList;
+
+    private List<Integer> stockList;
+
+    private List<Long> orgIdList;
+}

+ 43 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/enums/AnalysisExceptionEnum.java

@@ -0,0 +1,43 @@
+package com.huimv.modular.analysis.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+/**
+ * <p>
+ * 数据分析异常枚举类
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/8/18 16:11
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum  AnalysisExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "组织信息不存在!"),
+    NO_CHILD(2, "没有子级组织,无法查看存栏情况!");
+
+    private final Integer code;
+
+    private final String message;
+
+    AnalysisExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+}

+ 22 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/param/AnalysisParam.java

@@ -0,0 +1,22 @@
+package com.huimv.modular.analysis.param;
+
+import com.huimv.core.pojo.base.param.BaseParam;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ * 数据分析参数类
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/8/18 15:42
+ */
+@Data
+public class AnalysisParam extends BaseParam {
+
+    @NotNull(message = "组织id不能为空,请检查组织id参数!", groups = list.class)
+    private Long orgId;
+
+}

+ 23 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/service/AnalysisService.java

@@ -0,0 +1,23 @@
+package com.huimv.modular.analysis.service;
+
+import com.huimv.modular.analysis.entity.RegionAndStock;
+import com.huimv.modular.analysis.param.AnalysisParam;
+
+/**
+ * <p>
+ * 数据分析service接口
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/8/18 14:45
+ * @version 1.0
+ */
+public interface AnalysisService {
+
+    /**
+     * 根据orgId获取子区域存栏数
+     * @param analysisParam
+     * @return
+     */
+    RegionAndStock getChildPigStockByOrgId(AnalysisParam analysisParam);
+}

+ 109 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/analysis/service/impl/AnalysisServiceImpl.java

@@ -0,0 +1,109 @@
+package com.huimv.modular.analysis.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.huimv.core.context.login.LoginContextHolder;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.pojo.login.SysLoginUser;
+import com.huimv.modular.analysis.entity.RegionAndStock;
+import com.huimv.modular.analysis.enums.AnalysisExceptionEnum;
+import com.huimv.modular.analysis.param.AnalysisParam;
+import com.huimv.modular.analysis.service.AnalysisService;
+import com.huimv.modular.dailytabulatedata.entity.DailyTabulateData;
+import com.huimv.modular.dailytabulatedata.service.DailyTabulateDataService;
+import com.huimv.sys.core.enums.AdminTypeEnum;
+import com.huimv.sys.modular.org.entity.SysOrg;
+import com.huimv.sys.modular.org.service.SysOrgService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 数据分析service接口实现类
+ * </p>
+ *
+ * @author yinhao
+ * @date 2021/8/18 15:35
+ */
+@Service("analysisService")
+public class AnalysisServiceImpl implements AnalysisService {
+
+    @Resource
+    private SysOrgService sysOrgService;
+
+    @Resource
+    private DailyTabulateDataService dailyTabulateDataService;
+
+    @Override
+    public RegionAndStock getChildPigStockByOrgId(AnalysisParam analysisParam) {
+        //检查参数,返回当前组织的子级组织列表
+        List<Long> childOrgIdList = checkParam(analysisParam);
+
+        //超级管理员查询全部,非超级管理员根据数据范围查询
+        SysLoginUser sysLoginUser = LoginContextHolder.me().getSysLoginUser();
+        if (!sysLoginUser.getAdminType().equals(AdminTypeEnum.SUPER_ADMIN.getCode())) {
+            List<Long> dataScopes = sysLoginUser.getDataScopes();
+            childOrgIdList = (List<Long>) CollUtil.intersection(childOrgIdList, dataScopes);
+        }
+
+        //判断子级组织和数据范围的交集是否为空
+        RegionAndStock regionAndStock = new RegionAndStock();
+        if (CollUtil.isEmpty(childOrgIdList)) {
+            regionAndStock.setRegionList(CollUtil.newArrayList());
+            regionAndStock.setStockList(CollUtil.newArrayList());
+            regionAndStock.setOrgIdList(CollUtil.newArrayList());
+            return regionAndStock;
+        }
+
+        //将交集放入条件查询
+        LambdaQueryWrapper<DailyTabulateData> dailyTabulateDataQuery = Wrappers.lambdaQuery();
+        dailyTabulateDataQuery.in(DailyTabulateData::getOrgId,childOrgIdList);
+
+        //查询数据列表,分组,返回时间最新的数据
+        List<DailyTabulateData> dataList = dailyTabulateDataService.list(dailyTabulateDataQuery);
+        Collection<DailyTabulateData> values = dataList.stream()
+                .collect(Collectors.toMap(DailyTabulateData::getOrgId,
+                        dailyTabulateData -> dailyTabulateData,
+                        (dailyTabulateData, dailyTabulateData2)
+                                -> dailyTabulateData.getStatisticDate().getTime() > dailyTabulateData2.getStatisticDate().getTime() ? dailyTabulateData : dailyTabulateData2))
+                .values();
+
+        regionAndStock.setRegionList(values.stream().map(DailyTabulateData::getOrgName).collect(Collectors.toList()));
+        regionAndStock.setStockList(values.stream().map(DailyTabulateData::getStockTotal).collect(Collectors.toList()));
+        regionAndStock.setOrgIdList(values.stream().map(DailyTabulateData::getOrgId).collect(Collectors.toList()));
+
+        return regionAndStock;
+    }
+
+    private List<Long> checkParam(AnalysisParam analysisParam) {
+        Long orgId = analysisParam.getOrgId();
+        LambdaQueryWrapper<SysOrg> queryWrapperById = Wrappers.lambdaQuery();
+        queryWrapperById.eq(SysOrg::getId, orgId)
+                .ne(SysOrg::getStatus, CommonStatusEnum.DELETED.getCode());
+        //判断是否存在
+        int countById = sysOrgService.count(queryWrapperById);
+        if (countById <= 0) {
+            throw new ServiceException(AnalysisExceptionEnum.NOT_EXIST);
+        }
+        //判断是否有子级组织
+        queryWrapperById.clear();
+        queryWrapperById.eq(SysOrg::getPid, orgId)
+                .ne(SysOrg::getStatus, CommonStatusEnum.DELETED.getCode());
+        List<SysOrg> sysOrgList = sysOrgService.list(queryWrapperById);
+        if (CollUtil.isEmpty(sysOrgList)) {
+            ArrayList<Long> list = new ArrayList<>();
+            list.add(orgId);
+            return list;
+//            throw new ServiceException(AnalysisExceptionEnum.NO_CHILD);
+        }
+        return sysOrgList.stream().map(SysOrg::getId).collect(Collectors.toList());
+    }
+
+}

+ 145 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/controller/BasePigpenController.java

@@ -0,0 +1,145 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import com.huimv.modular.basepigpen.param.BasePigpenParam;
+import com.huimv.modular.basepigpen.service.BasePigpenService;
+import com.huimv.modular.collectorregister.param.CollectorRegisterParam;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 栋舍表控制器
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+@RestController
+public class BasePigpenController {
+
+    @Resource
+    private BasePigpenService basePigpenService;
+
+    /**
+     * 查询栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+   //
+    @GetMapping("/basePigpen/page")
+   // @BusinessLog(title = "设备管理_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(BasePigpenParam basePigpenParam) {
+        return new SuccessResponseData(basePigpenService.page(basePigpenParam));
+    }
+
+    /**
+     * 添加栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    //@Permission
+    @PostMapping("/basePigpen/add")
+   // @BusinessLog(title = "设备管理_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(BasePigpenParam.add.class) BasePigpenParam basePigpenParam) {
+
+        basePigpenService.add(basePigpenParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除栋舍表,可批量删除
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+   //
+    @PostMapping("/basePigpen/delete")
+   // @BusinessLog(title = "设备管理_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody List<Integer> ids) {
+        return   basePigpenService.delete(ids);
+    }
+
+    /**
+     * 编辑栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+   //
+    @PostMapping("/basePigpen/edit")
+  //  @BusinessLog(title = "设备管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(BasePigpenParam.edit.class) BasePigpenParam basePigpenParam) {
+            basePigpenService.edit(basePigpenParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+   //
+    @GetMapping("/basePigpen/detail")
+  //  @BusinessLog(title = "设备管理_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(BasePigpenParam.detail.class) BasePigpenParam basePigpenParam) {
+        return new SuccessResponseData(basePigpenService.detail(basePigpenParam));
+    }
+
+    /**
+     * 栋舍表列表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+  //
+    @GetMapping("/basePigpen/list")
+   // @BusinessLog(title = "设备管理_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(BasePigpenParam basePigpenParam) {
+        return new SuccessResponseData(basePigpenService.list(basePigpenParam));
+    }
+
+    @GetMapping("/basePigpen/listPigpen")
+    public ResponseData listPigpen() {
+        return new SuccessResponseData(basePigpenService.listPigpen());
+    }
+
+
+    @GetMapping("/basePigpen/listUnit")
+    public ResponseData listUnit(Integer id) {
+        return new SuccessResponseData(basePigpenService.listUnit(id));
+    }
+}

+ 191 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/entity/BasePigpen.java

@@ -0,0 +1,191 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.sql.Date;
+
+/**
+ * 栋舍表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+@Data
+@TableName("base_pigpen")
+public class BasePigpen {
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 栋舍名称
+     */
+    private String pigpenName;
+
+    /**
+     * 上级id
+     */
+    private Integer parentId;
+
+    /**
+     * 1.猪舍 2.单元
+     */
+    private Integer type;
+
+    /**
+     * 牧场编号
+     */
+    private String farmCode;
+
+    /**
+     * 猪舍温度
+     */
+    private Double pigpenTemp;
+
+    /**
+     * 异常状态  1.正常 0.异常
+     */
+    private Integer tempAnomaly;
+
+    /**
+     * 备注:没有用
+     */
+    private Object children;
+
+    /**
+     * 阶段
+     */
+    private Integer stage;
+
+    /**
+     * 创建时间
+     */
+
+    @JsonFormat()
+    private Date creatTime;
+
+    /**
+     * 组织id
+     */
+    private Long orgId;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getPigpenName() {
+        return pigpenName;
+    }
+
+    public void setPigpenName(String pigpenName) {
+        this.pigpenName = pigpenName;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getFarmCode() {
+        return farmCode;
+    }
+
+    public void setFarmCode(String farmCode) {
+        this.farmCode = farmCode;
+    }
+
+    public Double getPigpenTemp() {
+        return pigpenTemp;
+    }
+
+    public void setPigpenTemp(Double pigpenTemp) {
+        this.pigpenTemp = pigpenTemp;
+    }
+
+    public Integer getTempAnomaly() {
+        return tempAnomaly;
+    }
+
+    public void setTempAnomaly(Integer tempAnomaly) {
+        this.tempAnomaly = tempAnomaly;
+    }
+
+    public Object getChildren() {
+        return children;
+    }
+
+    public void setChildren(Object children) {
+        this.children = children;
+    }
+
+    public Integer getStage() {
+        return stage;
+    }
+
+    public void setStage(Integer stage) {
+        this.stage = stage;
+    }
+
+    public Date getCreatTime() {
+        return creatTime;
+    }
+
+    public void setCreatTime(Date creatTime) {
+        this.creatTime = creatTime;
+    }
+
+    public Long getOrgId() {
+        return orgId;
+    }
+
+    public void setOrgId(Long orgId) {
+        this.orgId = orgId;
+    }
+
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/enums/BasePigpenExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.enums;
+
+
+import com.huimv.modular.consts.SysExpEnumConstant;
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+import com.huimv.modular.utils.ExpEnumType;
+
+/**
+ * 栋舍表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum BasePigpenExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        BasePigpenExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 39 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/mapper/BasePigpenMapper.java

@@ -0,0 +1,39 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.basepigpen.entity.BasePigpen;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 栋舍表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+@Repository
+public interface BasePigpenMapper extends BaseMapper<BasePigpen> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/mapper/mapping/BasePigpenMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.basepigpen.mapper.BasePigpenMapper">
+
+</mapper>

+ 105 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/param/BasePigpenParam.java

@@ -0,0 +1,105 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.param;
+
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 栋舍表参数类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+*/
+@Data
+public class BasePigpenParam extends BaseParam {
+
+    /**
+     * 主键
+     */
+    @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 栋舍名称
+     */
+    @NotBlank(message = "栋舍名称不能为空,请检查pigpenName参数", groups = {add.class, edit.class})
+    private String pigpenName;
+
+    /**
+     * 上级id
+     */
+    @NotNull(message = "上级id不能为空,请检查parentId参数", groups = {add.class, edit.class})
+    private Integer parentId;
+
+    /**
+     * 1.猪舍 2.单元
+     */
+    @NotNull(message = "1.猪舍 2.单元不能为空,请检查type参数", groups = {add.class, edit.class})
+    private Integer type;
+
+    /**
+     * 牧场编号
+     */
+    private String farmCode;
+
+    /**
+     * 猪舍温度
+     */
+    private Double pigpenTemp;
+
+    /**
+     * 异常状态  1.正常 0.异常
+     */
+    private Integer tempAnomaly;
+
+    /**
+     * 备注:没有用
+     */
+    private String children;
+
+    /**
+     * 阶段
+     */
+    @NotNull(message = "阶段不能为空,请检查stage参数", groups = {add.class, edit.class})
+    private Integer stage;
+
+    /**
+     * 创建时间
+     */
+    @NotNull(message = "创建时间不能为空,请检查creatTime参数", groups = {add.class, edit.class})
+    private String creatTime;
+
+    /**
+     * 栋舍名称
+     */
+    //@NotNull(message = "组织不能为空,请检查orgId参数", groups = {add.class, edit.class})
+    private Long orgId;
+
+}

+ 97 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/service/BasePigpenService.java

@@ -0,0 +1,97 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.huimv.modular.basepigpen.entity.BasePigpen;
+import com.huimv.modular.basepigpen.param.BasePigpenParam;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+
+import java.util.List;
+
+/**
+ * 栋舍表service接口
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+public interface BasePigpenService extends IService<BasePigpen> {
+
+    /**
+     * 查询栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    PageResult<BasePigpen> page(BasePigpenParam basePigpenParam);
+
+    /**
+     * 栋舍表列表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    List<BasePigpen> list(BasePigpenParam basePigpenParam);
+
+    /**
+     * 添加栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    void add(BasePigpenParam basePigpenParam);
+
+    /**
+     * 删除栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    ResponseData delete(List<Integer> basePigpenParamList);
+
+    /**
+     * 编辑栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    void edit(BasePigpenParam basePigpenParam);
+
+    /**
+     * 查看栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+     BasePigpen detail(BasePigpenParam basePigpenParam);
+
+
+
+    List<BasePigpen> listPigpen();
+
+    List<BasePigpen> listUnit(Integer id);
+}

+ 179 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/basepigpen/service/impl/BasePigpenServiceImpl.java

@@ -0,0 +1,179 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.basepigpen.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.huimv.modular.basepigpen.entity.BasePigpen;
+import com.huimv.modular.basepigpen.enums.BasePigpenExceptionEnum;
+import com.huimv.modular.basepigpen.mapper.BasePigpenMapper;
+import com.huimv.modular.basepigpen.param.BasePigpenParam;
+import com.huimv.modular.basepigpen.service.BasePigpenService;
+import com.huimv.modular.factory.PageFactory;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ErrorResponseData;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 栋舍表service接口实现类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:00:42
+ */
+@Service
+public class BasePigpenServiceImpl extends ServiceImpl<BasePigpenMapper, BasePigpen> implements BasePigpenService {
+
+    @Autowired
+    private SysOrgMapper sysOrgMapper;
+
+    @Override
+    public PageResult<BasePigpen> page(BasePigpenParam basePigpenParam) {
+        QueryWrapper<BasePigpen> queryWrapper = new QueryWrapper<>();
+        queryWrapper.orderByDesc("id");
+        if (ObjectUtil.isNotNull(basePigpenParam)) {
+            Long sysLoginUserOrgId = LoginContextHolder.me().getSysLoginUserOrgId();
+
+            queryWrapper.lambda().eq(BasePigpen::getOrgId,sysLoginUserOrgId);
+
+            // 根据栋舍名称 查询
+            if (ObjectUtil.isNotEmpty(basePigpenParam.getPigpenName())) {
+                queryWrapper.lambda().like(BasePigpen::getPigpenName, basePigpenParam.getPigpenName());
+            }
+            // 根据时间 查询
+            if (ObjectUtil.isNotEmpty(basePigpenParam.getCreatTime())) {
+                queryWrapper.lambda().eq(BasePigpen::getCreatTime, basePigpenParam.getCreatTime());
+            }
+            // 根据阶段 查询
+            if (ObjectUtil.isNotEmpty(basePigpenParam.getStage())) {
+                queryWrapper.lambda().like(BasePigpen::getStage, basePigpenParam.getStage());
+            }
+
+
+        }
+        queryWrapper.lambda().eq(BasePigpen::getType, 1);
+        PageResult<BasePigpen> basePigpenPageResult = new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+        List<BasePigpen> rows = basePigpenPageResult.getRows();
+        for (BasePigpen row : rows) {
+
+            queryWrapper.clear();
+            queryWrapper.eq("parent_id",row.getId());
+            row.setChildren(this.list(queryWrapper));
+        }
+        return basePigpenPageResult;
+    }
+
+    @Override
+    public List<BasePigpen> list(BasePigpenParam basePigpenParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(BasePigpenParam basePigpenParam) {
+        Long sysLoginUserOrgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        SysOrg sysOrg = sysOrgMapper.selectById(sysLoginUserOrgId);
+        basePigpenParam.setOrgId(sysLoginUserOrgId);
+        basePigpenParam.setFarmCode(sysOrg.getCode());
+        BasePigpen basePigpen = new BasePigpen();
+        BeanUtil.copyProperties(basePigpenParam, basePigpen);
+        this.save(basePigpen);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseData delete(List<Integer> basePigpenParamList) {
+
+        for (Integer basePigpenParam : basePigpenParamList) {
+            QueryWrapper<BasePigpen> basePigpenQueryWrapper = new QueryWrapper<>();
+            basePigpenQueryWrapper.eq("parent_id",basePigpenParam);
+            int count = this.count(basePigpenQueryWrapper);
+            if (count > 0){
+                return  new ErrorResponseData("该栋舍下有单元为清理");
+            }
+        }
+        basePigpenParamList.forEach(this::removeById);
+        return new SuccessResponseData();
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(BasePigpenParam basePigpenParam) {
+        BasePigpen basePigpen = this.queryBasePigpen(basePigpenParam);
+        BeanUtil.copyProperties(basePigpenParam, basePigpen);
+
+        if ( basePigpen.getType() == 1){
+            QueryWrapper<BasePigpen> basePigpenQueryWrapper = new QueryWrapper<>();
+            basePigpenQueryWrapper.eq("parent_id",basePigpen.getId());
+            BasePigpen pigpen = new BasePigpen();
+            pigpen.setStage(basePigpen.getStage());
+            this.update(pigpen,basePigpenQueryWrapper);
+        }
+        this.updateById(basePigpen);
+    }
+
+    @Override
+    public BasePigpen detail(BasePigpenParam basePigpenParam) {
+        return this.queryBasePigpen(basePigpenParam);
+    }
+
+    /**
+     * 获取栋舍表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:00:42
+     */
+    private BasePigpen queryBasePigpen(BasePigpenParam basePigpenParam) {
+        BasePigpen basePigpen = this.getById(basePigpenParam.getId());
+        if (ObjectUtil.isNull(basePigpen)) {
+            throw new ServiceException(BasePigpenExceptionEnum.NOT_EXIST);
+        }
+        return basePigpen;
+    }
+
+
+    @Override
+    public List<BasePigpen> listPigpen() {
+        Long sysLoginUserOrgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        return this.list(new QueryWrapper<BasePigpen>().eq("type",1).eq("org_id",sysLoginUserOrgId));
+    }
+
+    @Override
+    public List<BasePigpen> listUnit(Integer id) {
+        Long sysLoginUserOrgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        return this.list(new QueryWrapper<BasePigpen>().eq("parent_id",id).eq("org_id",sysLoginUserOrgId));
+
+    }
+}

+ 157 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/controller/BaseRegionController.java

@@ -0,0 +1,157 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.controller;
+
+import com.huimv.core.annotion.BusinessLog;
+import com.huimv.core.annotion.DataScope;
+import com.huimv.core.annotion.Permission;
+import com.huimv.core.enums.LogAnnotionOpTypeEnum;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.baseregion.param.BaseRegionParam;
+import com.huimv.modular.baseregion.service.BaseRegionService;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 区域管理控制器
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+@RestController
+public class BaseRegionController {
+
+    @Resource
+    private BaseRegionService baseRegionService;
+
+    /**
+     * 查询区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @GetMapping("/baseRegion/page")
+    @BusinessLog(title = "区域管理_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(BaseRegionParam baseRegionParam) {
+        return new SuccessResponseData(baseRegionService.page(baseRegionParam));
+    }
+
+    /**
+     * 添加区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @PostMapping("/baseRegion/add")
+    @BusinessLog(title = "区域管理_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(BaseRegionParam.add.class) BaseRegionParam baseRegionParam) {
+            baseRegionService.add(baseRegionParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除区域管理,可批量删除
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @PostMapping("/baseRegion/delete")
+    @BusinessLog(title = "区域管理_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(BaseRegionParam.delete.class) List<BaseRegionParam> baseRegionParamList) {
+            baseRegionService.delete(baseRegionParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @PostMapping("/baseRegion/edit")
+    @BusinessLog(title = "区域管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(BaseRegionParam.edit.class) BaseRegionParam baseRegionParam) {
+            baseRegionService.edit(baseRegionParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @GetMapping("/baseRegion/detail")
+    @BusinessLog(title = "区域管理_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(BaseRegionParam.detail.class) BaseRegionParam baseRegionParam) {
+        return new SuccessResponseData(baseRegionService.detail(baseRegionParam));
+    }
+
+    /**
+     * 区域管理列表
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @GetMapping("/baseRegion/list")
+    @BusinessLog(title = "区域管理_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(BaseRegionParam baseRegionParam) {
+        return new SuccessResponseData(baseRegionService.list(baseRegionParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+
+    @GetMapping("/baseRegion/export")
+    @BusinessLog(title = "区域管理_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(BaseRegionParam baseRegionParam) {
+        baseRegionService.export(baseRegionParam);
+    }
+
+
+    @DataScope
+    @GetMapping("/baseRegion/test")
+    @BusinessLog(title = "yxx_test", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void test() {
+        baseRegionService.test();
+    }
+
+}

+ 74 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/entity/BaseRegion.java

@@ -0,0 +1,74 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.*;
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+/**
+ * 区域管理
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+@Data
+@TableName("base_region")
+public class BaseRegion {
+
+    /**
+     * 
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 行政区域代码
+     */
+    @Excel(name = "行政区域代码")
+    private String regionCode;
+
+    /**
+     * 行政区域名称
+     */
+    @Excel(name = "行政区域名称")
+    private String regionName;
+
+    /**
+     * 上级行政区域代码
+     */
+    @Excel(name = "上级行政区域代码")
+    private String parentCode;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+}

+ 66 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/enums/BaseRegionExceptionEnum.java

@@ -0,0 +1,66 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.enums;
+
+
+import com.huimv.modular.consts.SysExpEnumConstant;
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+import com.huimv.modular.utils.ExpEnumType;
+
+/**
+ * 区域管理
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum BaseRegionExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+
+    BaseRegionExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 37 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/mapper/BaseRegionMapper.java

@@ -0,0 +1,37 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.baseregion.entity.BaseRegion;
+
+/**
+ * 区域管理
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+public interface BaseRegionMapper extends BaseMapper<BaseRegion> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/mapper/mapping/BaseRegionMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.baseregion.mapper.BaseRegionMapper">
+
+</mapper>

+ 73 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/param/BaseRegionParam.java

@@ -0,0 +1,73 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.param;
+
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 区域管理参数类
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+*/
+@Data
+public class BaseRegionParam extends BaseParam {
+
+    /**
+     * 主键
+     */
+    @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 行政区域代码
+     */
+    @NotBlank(message = "行政区域代码不能为空,请检查regionCode参数", groups = {add.class, edit.class})
+    private String regionCode;
+
+    /**
+     * 行政区域名称
+     */
+    @NotBlank(message = "行政区域名称不能为空,请检查regionName参数", groups = {add.class, edit.class})
+    private String regionName;
+
+    /**
+     * 上级行政区域代码
+     */
+    @NotBlank(message = "上级行政区域代码不能为空,请检查parentCode参数", groups = {add.class, edit.class})
+    private String parentCode;
+
+    /**
+     * 牧场编码
+     */
+    @NotBlank(message = "牧场编码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+}

+ 100 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/service/BaseRegionService.java

@@ -0,0 +1,100 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.modular.baseregion.entity.BaseRegion;
+import com.huimv.modular.baseregion.param.BaseRegionParam;
+import java.util.List;
+
+
+
+/**
+ * 区域管理service接口
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+public interface BaseRegionService extends IService<BaseRegion> {
+
+    /**
+     * 查询区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    PageResult<BaseRegion> page(BaseRegionParam baseRegionParam);
+
+    /**
+     * 区域管理列表
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    List<BaseRegion> list(BaseRegionParam baseRegionParam);
+
+    /**
+     * 添加区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    void add(BaseRegionParam baseRegionParam);
+
+    /**
+     * 删除区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    void delete(List<BaseRegionParam> baseRegionParamList);
+
+    /**
+     * 编辑区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    void edit(BaseRegionParam baseRegionParam);
+
+    /**
+     * 查看区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+     BaseRegion detail(BaseRegionParam baseRegionParam);
+
+    /**
+     * 导出区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+     void export(BaseRegionParam baseRegionParam);
+
+    void test();
+}

+ 140 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/baseregion/service/impl/BaseRegionServiceImpl.java

@@ -0,0 +1,140 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.baseregion.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.context.login.LoginContextHolder;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.baseregion.entity.BaseRegion;
+import com.huimv.modular.baseregion.enums.BaseRegionExceptionEnum;
+import com.huimv.modular.baseregion.mapper.BaseRegionMapper;
+import com.huimv.modular.baseregion.param.BaseRegionParam;
+import com.huimv.modular.baseregion.service.BaseRegionService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.net.ContentHandler;
+import java.util.List;
+
+/**
+ * 区域管理service接口实现类
+ *
+ * @author yinhao
+ * @date 2021-08-10 16:57:21
+ */
+@Service
+public class BaseRegionServiceImpl extends ServiceImpl<BaseRegionMapper, BaseRegion> implements BaseRegionService {
+
+    @Override
+    public PageResult<BaseRegion> page(BaseRegionParam baseRegionParam) {
+        QueryWrapper<BaseRegion> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(baseRegionParam)) {
+
+            // 根据行政区域代码 查询
+            if (ObjectUtil.isNotEmpty(baseRegionParam.getRegionCode())) {
+                queryWrapper.lambda().eq(BaseRegion::getRegionCode, baseRegionParam.getRegionCode());
+            }
+            // 根据行政区域名称 查询
+            if (ObjectUtil.isNotEmpty(baseRegionParam.getRegionName())) {
+                queryWrapper.lambda().eq(BaseRegion::getRegionName, baseRegionParam.getRegionName());
+            }
+            // 根据上级行政区域代码 查询
+            if (ObjectUtil.isNotEmpty(baseRegionParam.getParentCode())) {
+                queryWrapper.lambda().eq(BaseRegion::getParentCode, baseRegionParam.getParentCode());
+            }
+            // 根据牧场编码 查询
+            if (ObjectUtil.isNotEmpty(baseRegionParam.getFarmCode())) {
+                queryWrapper.lambda().eq(BaseRegion::getFarmCode, baseRegionParam.getFarmCode());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<BaseRegion> list(BaseRegionParam baseRegionParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(BaseRegionParam baseRegionParam) {
+        BaseRegion baseRegion = new BaseRegion();
+        BeanUtil.copyProperties(baseRegionParam, baseRegion);
+        this.save(baseRegion);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<BaseRegionParam> baseRegionParamList) {
+        baseRegionParamList.forEach(baseRegionParam -> {
+            this.removeById(baseRegionParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(BaseRegionParam baseRegionParam) {
+        BaseRegion baseRegion = this.queryBaseRegion(baseRegionParam);
+        BeanUtil.copyProperties(baseRegionParam, baseRegion);
+        this.updateById(baseRegion);
+    }
+
+    @Override
+    public BaseRegion detail(BaseRegionParam baseRegionParam) {
+        return this.queryBaseRegion(baseRegionParam);
+    }
+
+    /**
+     * 获取区域管理
+     *
+     * @author yinhao
+     * @date 2021-08-10 16:57:21
+     */
+    private BaseRegion queryBaseRegion(BaseRegionParam baseRegionParam) {
+        BaseRegion baseRegion = this.getById(baseRegionParam.getId());
+        if (ObjectUtil.isNull(baseRegion)) {
+            throw new ServiceException(BaseRegionExceptionEnum.NOT_EXIST);
+        }
+        return baseRegion;
+    }
+
+    @Override
+    public void export(BaseRegionParam baseRegionParam) {
+        List<BaseRegion> list = this.list(baseRegionParam);
+        PoiUtil.exportExcelWithStream("BaseRegion.xls", BaseRegion.class, list);
+    }
+
+    @Override
+    public void test() {
+        LoginContextHolder.me().getLoginUserRoleIds();
+        LoginContextHolder.me().getSysLoginUser();
+        LoginContextHolder.me().getSysLoginUserOrgId();
+    }
+}

+ 19 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/EartagDataCountVo.java

@@ -0,0 +1,19 @@
+package com.huimv.modular.collectorregister;
+
+import lombok.Data;
+
+/**
+ * @Author : yuxuexuan
+ * @Create : 2021/7/26 0026 14:28
+ **/
+@Data
+public class EartagDataCountVo {
+
+    private int uploadCount;
+
+
+    private String countTime;
+
+
+    private Double envTemp;
+}

+ 169 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/controller/CollectorRegisterController.java

@@ -0,0 +1,169 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.param.CollectorRegisterParam;
+import com.huimv.modular.collectorregister.service.CollectorRegisterService;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import com.huimv.modular.eartagregister.service.EartagRegisterService;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 设备管理控制器
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+@RestController
+public class CollectorRegisterController {
+
+    @Resource
+    private CollectorRegisterService collectorRegisterService;
+
+    @Resource
+    private EartagRegisterService eartagRegisterService;
+
+    /**
+     * 查询设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+
+    @GetMapping("/collectorRegister/page")
+    public ResponseData page(CollectorRegisterParam collectorRegisterParam) {
+        return new SuccessResponseData(collectorRegisterService.page(collectorRegisterParam));
+    }
+
+    /**
+     * 添加设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+
+    @PostMapping("/collectorRegister/add")
+    public ResponseData add(@RequestBody @Validated(CollectorRegisterParam.add.class) CollectorRegisterParam collectorRegisterParam) {
+            collectorRegisterService.add(collectorRegisterParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除设备管理,可批量删除
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    @PostMapping("/collectorRegister/delete")
+    public ResponseData delete(@RequestBody @Validated(CollectorRegisterParam.delete.class) List<Integer> ids) {
+        if (ids == null || ids.size() == 0){
+            return ResponseData.error("请选择设备");
+        }
+        for (Integer id : ids) {
+            CollectorRegister collectorRegisterEntity= collectorRegisterService.getById(id);
+            String deviceCode = collectorRegisterEntity.getDeviceCode();
+
+            int count = eartagRegisterService.count(Wrappers.<EartagRegister>lambdaQuery().eq(EartagRegister::getDeviceCode, deviceCode));
+            if (count > 0){
+                return ResponseData.error("删除失败,设备号为"+collectorRegisterEntity.getDeviceCode()+"的设备下有未清理耳标");
+            }
+        }
+
+            collectorRegisterService.delete(ids);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    @PostMapping("/collectorRegister/edit")
+    public ResponseData edit(@RequestBody @Validated(CollectorRegisterParam.edit.class) CollectorRegisterParam collectorRegisterParam) {
+            collectorRegisterService.edit(collectorRegisterParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    @GetMapping("/collectorRegister/detail")
+    public ResponseData detail(@Validated(CollectorRegisterParam.detail.class) CollectorRegisterParam collectorRegisterParam) {
+        return new SuccessResponseData(collectorRegisterService.detail(collectorRegisterParam));
+    }
+
+    @PostMapping("/collectorRegister/logout")
+    public ResponseData logout(@RequestBody CollectorRegister collectorRegister) {
+        Integer id = collectorRegister.getId();
+        CollectorRegister byId = collectorRegisterService.getById(id);
+        if ( 0 ==byId.getCanStatus() ){
+            byId.setCanStatus(3);
+        }else {
+            byId.setCanStatus(0);
+        }
+        collectorRegisterService.updateById(byId);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 设备管理列表
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    @GetMapping("/collectorRegister/list")
+    public ResponseData list(CollectorRegisterParam collectorRegisterParam) {
+        return new SuccessResponseData(collectorRegisterService.list(collectorRegisterParam));
+    }
+
+    /**
+     * 采集器总数
+     * @date 2021-08-19 09:43:52
+     */
+    @GetMapping("/collectorRegister/selectPcEveryStatusCollectors")
+    public ResponseData selectPcEveryStatusCollectors(Long orgId) {
+        return collectorRegisterService.selectPcEveryStatusCollectors(orgId);
+    }
+
+
+
+
+}

+ 157 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/entity/CollectorRegister.java

@@ -0,0 +1,157 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 设备管理
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+@Data
+@TableName("collector_register")
+public class CollectorRegister  {
+
+    /**
+     * 记录id(主键)
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @Excel(name = "组织id")
+    private Long orgId;
+
+    /**
+     * 组织名称
+     */
+    @Excel(name = "组织名称")
+    private String orgName;
+
+    /**
+     * 设备编码
+     */
+    @Excel(name = "设备编码")
+    private String deviceCode;
+
+    /**
+     * 盒子的芯片编码
+     */
+    @Excel(name = "盒子的芯片编码")
+    private String registeCode;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    @Excel(name = "牧场名称")
+    private String farmName;
+
+    /**
+     * 动物种类
+     */
+    @Excel(name = "动物种类")
+    private Integer typeF;
+
+    /**
+     * 阶段
+     */
+    @Excel(name = "阶段")
+    private Integer stage;
+
+    /**
+     * 猪舍id
+     */
+    @Excel(name = "猪舍id")
+    private Integer pigpenId;
+
+    /**
+     * 栋舍名称
+     */
+    @Excel(name = "栋舍名称")
+    private String penName;
+
+    /**
+     * 单元id
+     */
+    @Excel(name = "单元id")
+    private Integer unitId;
+
+    /**
+     * 单元名称
+     */
+    @Excel(name = "单元名称")
+    private String unitName;
+
+    /**
+     * 上传服务器地址
+     */
+    @Excel(name = "上传服务器地址")
+    private String serverIp;
+
+    /**
+     * 端口
+     */
+    @Excel(name = "端口")
+    private Integer port;
+
+    /**
+     * 注册时间
+     */
+    //@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date registerTime;
+
+    /**
+     * 最后上传时间
+     */
+
+   // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+    private Date lastTime;
+    /**
+     * 0:正常,1:网络异常,2:采集异常,3:注销
+     */
+    @Excel(name = "状态")
+    private Integer canStatus;
+
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/enums/CollectorRegisterExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.enums;
+
+
+import com.huimv.modular.consts.SysExpEnumConstant;
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+import com.huimv.modular.utils.ExpEnumType;
+
+/**
+ * 设备管理
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum CollectorRegisterExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        CollectorRegisterExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 40 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/mapper/CollectorRegisterMapper.java

@@ -0,0 +1,40 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 设备管理
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+
+@Repository
+public interface CollectorRegisterMapper extends BaseMapper<CollectorRegister> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/mapper/mapping/CollectorRegisterMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.collectorregister.mapper.CollectorRegisterMapper">
+
+</mapper>

+ 148 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/param/CollectorRegisterParam.java

@@ -0,0 +1,148 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.param;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.sql.Timestamp;
+import java.util.*;
+
+/**
+* 设备管理参数类
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+*/
+@Data
+public class CollectorRegisterParam extends BaseParam {
+
+    /**
+     * 记录id(主键)
+     */
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    private Long orgId;
+
+    /**
+     * 组织名称
+     */
+    private String orgName;
+
+    /**
+     * 设备编码
+     */
+    @NotBlank(message = "设备编码不能为空,请检查deviceCode参数", groups = {add.class, edit.class})
+    private String deviceCode;
+
+    /**
+     * 盒子的芯片编码
+     */
+    @NotBlank(message = "盒子的芯片编码不能为空,请检查registeCode参数", groups = {add.class, edit.class})
+    private String registeCode;
+
+    /**
+     * 牧场编码
+     */
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    private String farmName;
+
+    /**
+     * 动物种类
+     */
+    private Integer typeF;
+
+    /**
+     * 阶段
+     */
+    @NotNull(message = "阶段不能为空,请检查stage参数", groups = {add.class, edit.class})
+    private Integer stage;
+
+    /**
+     * 猪舍id
+     */
+    @NotNull(message = "猪舍id不能为空,请检查pigpenId参数", groups = {add.class, edit.class})
+    private Integer pigpenId;
+
+    /**
+     * 栋舍名称
+     */
+    @NotBlank(message = "栋舍名称不能为空,请检查penName参数", groups = {add.class, edit.class})
+    private String penName;
+
+    /**
+     * 单元id
+     */
+    @NotNull(message = "单元id不能为空,请检查unitId参数", groups = {add.class, edit.class})
+    private Integer unitId;
+
+    /**
+     * 单元名称
+     */
+    @NotBlank(message = "单元名称不能为空,请检查unitName参数", groups = {add.class, edit.class})
+    private String unitName;
+
+    /**
+     * 上传服务器地址
+     */
+    private String serverIp;
+
+    /**
+     * 端口
+     */
+    private Integer port;
+
+    /**
+     * 注册时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date registerTime;
+
+    /**
+     * 最后上传时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date lastTime;
+
+    /**
+     * 0:正常,1:网络异常,2:采集异常,3:注销
+     */
+    private Integer canStatus;
+
+}

+ 96 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/service/CollectorRegisterService.java

@@ -0,0 +1,96 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.param.CollectorRegisterParam;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+
+import java.util.List;
+
+/**
+ * 设备管理service接口
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+public interface CollectorRegisterService extends IService<CollectorRegister> {
+
+    /**
+     * 查询设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    PageResult<CollectorRegister> page(CollectorRegisterParam collectorRegisterParam);
+
+    /**
+     * 设备管理列表
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    List<CollectorRegister> list(CollectorRegisterParam collectorRegisterParam);
+
+    /**
+     * 添加设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    void add(CollectorRegisterParam collectorRegisterParam);
+
+    /**
+     * 删除设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    void delete(List<Integer> ids);
+
+    /**
+     * 编辑设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    void edit(CollectorRegisterParam collectorRegisterParam);
+
+    /**
+     * 查看设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+     CollectorRegister detail(CollectorRegisterParam collectorRegisterParam);
+
+
+    ResponseData selectPcEveryStatusCollectors(Long orgId);
+
+
+}

+ 200 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/collectorregister/service/impl/CollectorRegisterServiceImpl.java

@@ -0,0 +1,200 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.collectorregister.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.enums.CollectorRegisterExceptionEnum;
+import com.huimv.modular.collectorregister.mapper.CollectorRegisterMapper;
+import com.huimv.modular.collectorregister.param.CollectorRegisterParam;
+import com.huimv.modular.collectorregister.service.CollectorRegisterService;
+import com.huimv.modular.factory.PageFactory;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import com.huimv.sys.modular.org.entity.SysOrg;
+import com.huimv.sys.modular.org.mapper.SysOrgMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.sql.Timestamp;
+import java.util.*;
+
+/**
+ * 设备管理service接口实现类
+ *
+ * @author yinhao
+ * @date 2021-08-19 09:43:52
+ */
+@Service
+public class CollectorRegisterServiceImpl extends ServiceImpl<CollectorRegisterMapper, CollectorRegister> implements CollectorRegisterService {
+
+    @Autowired
+    private SysOrgMapper sysOrgMapper;
+
+    @Override
+    public PageResult<CollectorRegister> page(CollectorRegisterParam collectorRegisterParam) {
+        QueryWrapper<CollectorRegister> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(collectorRegisterParam)) {
+            Long  orgId = collectorRegisterParam.getOrgId();
+            if (ObjectUtil.isEmpty(orgId)){
+                orgId = LoginContextHolder.me().getSysLoginUserOrgId();
+            }
+            // 根据组织id 查询
+            List<Long> orgIds = getOrgid(orgId);
+            queryWrapper.in("org_id",orgIds);
+//            queryWrapper.lambda().eq(CollectorRegister::getOrgId, orgId);
+
+
+            if (ObjectUtil.isNotEmpty(collectorRegisterParam.getRegisterTime())) {
+                Date registerTime = collectorRegisterParam.getRegisterTime();
+                DateTime startTime = DateUtil.beginOfDay(registerTime);
+                DateTime endTime = DateUtil.endOfDay(registerTime);
+                queryWrapper.lambda().ge(CollectorRegister::getRegisterTime,startTime);
+                queryWrapper.lambda().le(CollectorRegister::getRegisterTime,endTime);
+            }
+
+            // 根据设备编码查询
+            if (ObjectUtil.isNotEmpty(collectorRegisterParam.getPigpenId())) {
+                queryWrapper.lambda().like(CollectorRegister::getPigpenId, collectorRegisterParam.getPigpenId());
+            }
+
+            // 根据设备编码查询
+            if (ObjectUtil.isNotEmpty(collectorRegisterParam.getDeviceCode())) {
+                queryWrapper.lambda().like(CollectorRegister::getDeviceCode, collectorRegisterParam.getDeviceCode());
+            }
+            // 根据状态
+            if (ObjectUtil.isNotEmpty(collectorRegisterParam.getCanStatus())) {
+                queryWrapper.lambda().like(CollectorRegister::getCanStatus, collectorRegisterParam.getCanStatus());
+            }
+        }
+        queryWrapper.orderByDesc("id");
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<CollectorRegister> list(CollectorRegisterParam collectorRegisterParam) {
+        return this.list();
+    }
+
+
+    @Override
+    public void add(CollectorRegisterParam collectorRegisterParam) {
+        CollectorRegister collectorRegister = new CollectorRegister();
+        BeanUtil.copyProperties(collectorRegisterParam, collectorRegister);
+        Long sysLoginUserOrgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        SysOrg sysOrg = sysOrgMapper.selectById(sysLoginUserOrgId);
+        collectorRegister.setOrgId(sysLoginUserOrgId);
+        collectorRegister.setOrgName(sysOrg.getName());
+        this.save(collectorRegister);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<Integer> ids) {
+        ids.forEach(this::removeById);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(CollectorRegisterParam collectorRegisterParam) {
+        CollectorRegister collectorRegister = this.queryCollectorRegister(collectorRegisterParam);
+        BeanUtil.copyProperties(collectorRegisterParam, collectorRegister);
+        this.updateById(collectorRegister);
+    }
+
+    @Override
+    public CollectorRegister detail(CollectorRegisterParam collectorRegisterParam) {
+        return this.queryCollectorRegister(collectorRegisterParam);
+    }
+
+    /**
+     * 获取设备管理
+     *
+     * @author yinhao
+     * @date 2021-08-19 09:43:52
+     */
+    private CollectorRegister queryCollectorRegister(CollectorRegisterParam collectorRegisterParam) {
+        CollectorRegister collectorRegister = this.getById(collectorRegisterParam.getId());
+        if (ObjectUtil.isNull(collectorRegister)) {
+            throw new ServiceException(CollectorRegisterExceptionEnum.NOT_EXIST);
+        }
+        return collectorRegister;
+    }
+
+    @Override
+    public ResponseData selectPcEveryStatusCollectors(Long orgId) {
+        if (ObjectUtil.isEmpty(orgId)){
+             orgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        }
+        List<Long> orgIds = getOrgid(orgId);
+
+        LambdaQueryWrapper<CollectorRegister> lambdaQuery = Wrappers.lambdaQuery();
+        lambdaQuery.in(CollectorRegister::getOrgId, orgIds);
+
+        Map<String, Integer> map = new LinkedHashMap<>();
+        map.put("total", count(lambdaQuery));
+
+        lambdaQuery.eq(CollectorRegister::getCanStatus, 0);
+        map.put("normal", count(lambdaQuery));
+
+        lambdaQuery.clear();
+        lambdaQuery.eq(CollectorRegister::getOrgId, orgId);
+        lambdaQuery.ne(CollectorRegister::getCanStatus, 0);
+        map.put("abnormal", count(lambdaQuery));
+
+        lambdaQuery.clear();
+        lambdaQuery.eq(CollectorRegister::getOrgId, orgId);
+        lambdaQuery.eq(CollectorRegister::getCanStatus, 3);
+        map.put("logout", count(lambdaQuery));
+
+        return  new SuccessResponseData(map);
+    }
+
+    public List<Long> getOrgid(Long orgId){
+          QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+            sysOrgQueryWrapper.select("id");
+            sysOrgQueryWrapper.like("pids",orgId);
+            List<SysOrg> sysOrgs = sysOrgMapper.selectList(sysOrgQueryWrapper);
+            List<Long> orgIds = new ArrayList<>();
+            orgIds.add(orgId);
+            for (SysOrg sysOrg : sysOrgs) {
+                orgIds.add(sysOrg.getId());
+            }
+           return orgIds;
+    }
+
+
+}

+ 124 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/consts/SysExpEnumConstant.java

@@ -0,0 +1,124 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.consts;
+
+/**
+ * 系统管理异常枚举编码构成常量
+ * <p>
+ * 异常枚举编码由3部分组成,如下:
+ * <p>
+ * 模块编码(2位) + 分类编码(4位) + 具体项编码(至少1位)
+ * <p>
+ * 模块编码和分类编码在ExpEnumCodeConstant类中声明
+ *
+ * @author yubaoshan
+ * @date 2020/6/19 20:46
+ */
+public interface SysExpEnumConstant {
+
+    /**
+     * 模块分类编码(2位)
+     * <p>
+     * snowy-system模块异常枚举编码
+     */
+    int SNOWY_SYS_MODULE_EXP_CODE = 20;
+
+    /* 分类编码(4位) */
+    /**
+     * 系统应用相关异常枚举
+     */
+    int SYS_APP_EXCEPTION_ENUM = 1100;
+
+    /**
+     * 系统参数配置相关异常枚举
+     */
+    int SYS_CONFIG_EXCEPTION_ENUM = 1200;
+
+    /**
+     * 系统字典值相关异常枚举
+     */
+    int SYS_DICT_DATA_EXCEPTION_ENUM = 1300;
+
+    /**
+     * 系统字典类型相关异常枚举
+     */
+    int SYS_DICT_TYPE_EXCEPTION_ENUM = 1400;
+
+    /**
+     * 文件信息表相关枚举
+     */
+    int SYS_FILE_INFO_EXCEPTION_ENUM = 1500;
+
+    /**
+     * 系统菜单相关异常枚举
+     */
+    int SYS_MENU_EXCEPTION_ENUM = 1600;
+
+    /**
+     * 系统组织机构相关异常枚举
+     */
+    int SYS_ORG_EXCEPTION_ENUM = 1700;
+
+    /**
+     * 系统职位相关异常枚举
+     */
+    int SYS_POS_EXCEPTION_ENUM = 1800;
+
+    /**
+     * 系统角色相关异常枚举
+     */
+    int SYS_ROLE_EXCEPTION_ENUM = 1900;
+
+    /**
+     * 系统用户相关异常枚举
+     */
+    int SYS_USER_EXCEPTION_ENUM = 2000;
+
+    /**
+     * 系统通知公告相关异常枚举
+     */
+    int SYS_NOTICE_EXCEPTION_ENUM = 2100;
+
+    /**
+     * 定时任务相关
+     */
+    int TIMER_EXCEPTION_ENUM = 2200;
+
+    /**
+     * 邮件相关
+     */
+    int EMAIL_EXCEPTION_ENUM = 2300;
+
+    /**
+     * 短信相关
+     */
+    int SMS_EXCEPTION_ENUM = 2400;
+
+    /**
+     * Oauth登录相关
+     */
+    int OAUTH_EXCEPTION_ENUM = 2500;
+
+}

+ 279 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/controller/DailyTabulateDataController.java

@@ -0,0 +1,279 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import com.huimv.modular.dailytabulatedata.entity.DailyTabulateData;
+import com.huimv.modular.dailytabulatedata.mapper.DailyTabulateDataMapper;
+import com.huimv.modular.dailytabulatedata.param.DailyTabulateDataParam;
+import com.huimv.modular.dailytabulatedata.service.DailyTabulateDataService;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import com.huimv.modular.eartagregister.mapper.EartagRegisterMapper;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import com.huimv.modular.result.R;
+import com.huimv.modular.yesterdaypig.entity.YesterdayPig;
+import com.huimv.modular.yesterdaypig.mapper.YesterdayPigMapper;
+
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 耳标每日汇总表控制器
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+@RestController
+public class DailyTabulateDataController {
+
+    @Resource
+    private DailyTabulateDataService dailyTabulateDataService;
+
+
+    @RequestMapping("/dailyTabulateData/countAllSow")
+    public ResponseData countAllsow(Long orgId) {
+        Map list = dailyTabulateDataService.countAllsow(orgId);
+
+        return new SuccessResponseData(list);
+    }
+
+
+    /**
+     * 列表
+     */
+    @RequestMapping("/dailyTabulateData/list")
+    public ResponseData list(DailyTabulateData dailyTabulateData) {
+        PageResult page = dailyTabulateDataService.queryPage(dailyTabulateData);
+
+        return new SuccessResponseData(page);
+    }
+
+
+    @RequestMapping("/dailyTabulateData/countAllChange")
+    public ResponseData countAllChange(@RequestParam Map<String, Object> params) {
+      List lsit   = dailyTabulateDataService.countAllChange(params);
+
+        return new SuccessResponseData(lsit);
+    }
+
+
+    /**
+     * 列表(牧场)
+     */
+    @RequestMapping("/dailyTabulateData/farmList")
+    public ResponseData f(@RequestParam Map<String, Object> params) {
+        PageResult page = dailyTabulateDataService.farmList(params);
+
+        return new SuccessResponseData(page);
+    }
+
+    /**
+     * 耳标数据牧场存栏
+     * @date 2021-08-19 09:43:52
+     */
+    @GetMapping("/dailyTabulateData/listByFarm")
+    public ResponseData listByFarm(Long orgId) {
+        return dailyTabulateDataService.listByFarm(orgId);
+    }
+
+//测试中
+@Resource
+private EartagRegisterMapper eartagRegisterMapper;
+
+    @Resource
+    private SysOrgMapper sysOrgMapper;
+
+    @Resource
+    private YesterdayPigMapper yesterdayPigMapper;
+    @Resource
+    private DailyTabulateDataMapper dailyTabulateDataMapper;
+
+    @RequestMapping("/test/test")
+    public void action() {
+        System.out.println("--------------start");
+        QueryWrapper<DailyTabulateData> wrapper = new QueryWrapper<>();
+        wrapper.eq("statistic_date",DateUtil.beginOfDay(new Date()));
+        dailyTabulateDataMapper.delete(wrapper);
+
+        QueryWrapper<SysOrg> sysOrgQueryWrapper1 = new QueryWrapper<>();
+        sysOrgQueryWrapper1.eq("status",0);
+        List<SysOrg> list = sysOrgMapper.selectList(sysOrgQueryWrapper1);
+        Date now = new Date();
+        for (SysOrg sysOrg : list) {
+            Long orgId = sysOrg.getId();
+            QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+            sysOrgQueryWrapper.like("pids",orgId);
+            sysOrgQueryWrapper.eq("status",0);
+            List<SysOrg> sysOrgs = sysOrgMapper.selectList(sysOrgQueryWrapper);
+            List<Long> orgIds = CollectionUtil.newArrayList();
+            for (SysOrg org : sysOrgs) {
+                orgIds.add(org.getId());
+            }
+            orgIds.add(orgId);
+
+
+            QueryWrapper<EartagRegister> eartagRegisterQueryWrapper = new QueryWrapper<>();
+            eartagRegisterQueryWrapper.in("org_id",orgIds);
+            List<EartagRegister> eartagRegisters = eartagRegisterMapper.selectList(eartagRegisterQueryWrapper);
+            //计算日龄
+            Integer ratio1 = 0, ratio2 = 0, ratio3 = 0, ratio4 = 0;
+            //(1:配种舍,2:分娩舍,3:保育舍,4:育成育肥舍,5:空怀舍,6:后备母猪舍,
+            // 7:公猪舍,8:病死猪场内收集点,9:病死猪集中收集点,10:病死猪无害化处理中心
+            Set<String> nowEartag = CollectionUtil.newHashSet();
+            int stock1 =0,stock2=0,stock3=0,stock4=0,stock5=0,stock6=0,stock7=0;
+            for (EartagRegister eartagRegister : eartagRegisters) {
+                Integer stage = eartagRegister.getStage();
+                if (stage == 1  ){
+                    stock1++;
+                }
+                if (stage == 2  ){
+                    stock2++;
+                }
+                if (stage == 3  ){
+                    stock3++;
+                }
+                if (stage == 4  ){
+                    stock4++;
+                }
+                if (stage == 5  ){
+                    stock5++;
+                }
+                if (stage == 6  ){
+                    stock6++;
+                }
+                nowEartag.add(eartagRegister.getEartagNo());
+
+                Integer dayAge = eartagRegister.getAge();
+                if (dayAge != null) {
+                    if (dayAge > 240 && dayAge < 600) {
+                        ratio1++;
+                    }
+
+                    if (dayAge >= 600 && dayAge < 960) {
+                        ratio2++;
+                    }
+
+                    if (dayAge >= 960 && dayAge < 1320) {
+                        ratio3++;
+                    }
+
+                    if (dayAge >= 1320) {
+                        ratio4++;
+                    }
+                }
+
+            }
+            //母猪总存栏
+            int allSow = stock1+stock2+stock3+stock5+stock6;
+            String ratioStr1 = calculateUtil(BigDecimal.valueOf(ratio1), BigDecimal.valueOf(allSow));
+            String ratioStr2 = calculateUtil(BigDecimal.valueOf(ratio2), BigDecimal.valueOf(allSow));
+            String ratioStr3 = calculateUtil(BigDecimal.valueOf(ratio3), BigDecimal.valueOf(allSow));
+            String ratioStr4 = calculateUtil(BigDecimal.valueOf(ratio4), BigDecimal.valueOf(allSow));
+
+            //昨日耳标
+            QueryWrapper<YesterdayPig> yesterdayPigQueryWrapper = new QueryWrapper<>();
+            yesterdayPigQueryWrapper.in("org_id",orgIds);
+            List<YesterdayPig> yesterdayPigs = yesterdayPigMapper.selectList(yesterdayPigQueryWrapper);
+            Set<String> yesterdayEartag = CollectionUtil.newHashSet();
+            for (YesterdayPig yesterdayPig : yesterdayPigs) {
+                yesterdayEartag.add(yesterdayPig.getEartagNo());
+            }
+
+            Set<String> yesterdayEartagClone = ObjectUtil.cloneByStream(yesterdayEartag);
+            Set<String> nowEartagClone = ObjectUtil.cloneByStream(nowEartag);
+            //离线耳标
+//            yesterdayEartagClone.removeAll(nowEartag);
+//            int offSow = yesterdayEartagClone.size();
+            int offSow =0;
+            if ( yesterdayPigs.size()-allSow > 0){
+                offSow = yesterdayPigs.size()-allSow;
+            }
+            //新增耳标
+            nowEartagClone.removeAll(yesterdayEartag);
+            int newSow = 0;
+            if ( allSow-yesterdayPigs.size() > 0){
+                newSow = allSow-yesterdayPigs.size();
+            }
+
+
+
+            //添加到每日表
+            QueryWrapper<DailyTabulateData> dailyTabulateDataQueryWrapper = new QueryWrapper<>();
+            dailyTabulateDataQueryWrapper.eq("statistic_date", DateUtil.beginOfDay(now));
+            dailyTabulateDataQueryWrapper.eq("org_id",orgId);
+            DailyTabulateData  dailyTabulateData = dailyTabulateDataMapper.selectOne(dailyTabulateDataQueryWrapper);
+            if (dailyTabulateData == null) {
+                dailyTabulateData = new DailyTabulateData();
+            }
+
+            dailyTabulateData.setOrgId(orgId);
+            dailyTabulateData.setStock1(stock1);
+            dailyTabulateData.setStock2(stock2);
+            dailyTabulateData.setStock3(stock3);
+            dailyTabulateData.setStock4(stock4);
+            dailyTabulateData.setStock5(stock5);
+            dailyTabulateData.setStock6(stock6);
+            if (eartagRegisters.size() > 0){
+                dailyTabulateData.setFarmCode(eartagRegisters.get(0).getFarmCode());
+            }
+            dailyTabulateData.setStockTotal(allSow);
+            dailyTabulateData.setStatisticDate(now);
+            dailyTabulateData.setStockNew(newSow);
+            dailyTabulateData.setOfflineNo(offSow);
+            dailyTabulateData.setRatio1(ratio1 + " (" + ratioStr1 + ")");
+            dailyTabulateData.setRatio2(ratio2 + " (" + ratioStr2 + ")");
+            dailyTabulateData.setRatio3(ratio3 + " (" + ratioStr3 + ")");
+            dailyTabulateData.setRatio4(ratio4 + " (" + ratioStr4 + ")");
+            dailyTabulateData.setSowStock(stock1 + stock2 + stock3);
+            dailyTabulateData.setOrgName(sysOrg.getName());
+            if (dailyTabulateData.getId() == null) {
+                dailyTabulateDataMapper.insert(dailyTabulateData);
+            } else {
+                dailyTabulateDataMapper.updateById(dailyTabulateData);
+            }
+        }
+    }
+    //计算百分比
+    public String calculateUtil(BigDecimal a, BigDecimal b) {
+        return b == null ? "-" :
+                b.compareTo(new BigDecimal(0)) == 0 ? "-" :
+                        a == null ? "0.00%" :
+                                a.multiply(new BigDecimal(100)).divide(b, 2, BigDecimal.ROUND_HALF_UP) + "%";
+    }
+}

+ 159 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/DailyTabulateData.java

@@ -0,0 +1,159 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.lang.reflect.Type;
+import java.util.*;
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+/**
+ * 耳标每日汇总表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+@Data
+@TableName("daily_tabulate_data")
+public class DailyTabulateData  {
+
+    /**
+     * 
+     */
+//    @TableId(type = IdType.ASSIGN_ID)
+     @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 组织名称
+     */
+    private String  orgName;
+    /**
+     * 组织id
+     */
+    private Long orgId;
+    /**
+     * 统计日期
+     */
+//    @Excel(name = "统计日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date statisticDate;
+
+    /**
+     * 当日母猪总存栏
+     */
+    @Excel(name = "当日母猪总存栏")
+    private Integer stockTotal;
+
+    /**
+     * 每日母猪新增耳标数
+     */
+    @Excel(name = "每日母猪新增耳标数")
+    private Integer stockNew;
+
+    /**
+     * 每日离线耳标数
+     */
+    @Excel(name = "每日离线耳标数")
+    private Integer offlineNo;
+
+    /**
+     * 能繁母猪存栏数
+     */
+    @Excel(name = "能繁母猪存栏数")
+    private Integer sowStock;
+
+    /**
+     * 日龄占比(250-1000)
+     */
+    @Excel(name = "日龄占比(250-1000)")
+    private String ratio1;
+
+    /**
+     * 日龄(1000-1700)
+     */
+    @Excel(name = "日龄(1000-1700)")
+    private String ratio2;
+
+    /**
+     * 日龄(1700-2400)
+     */
+    @Excel(name = "日龄(1700-2400)")
+    private String ratio3;
+
+    /**
+     * 日龄(>2400)
+     */
+    @Excel(name = "日龄(>2400)")
+    private String ratio4;
+
+    /**
+     * 配怀存栏
+     */
+    @Excel(name = "配怀存栏")
+    private Integer stock1;
+
+    /**
+     * 分娩存栏
+     */
+    @Excel(name = "分娩存栏")
+    private Integer stock2;
+
+    /**
+     * 保育母猪
+     */
+    @Excel(name = "保育母猪")
+    private Integer stock3;
+
+    /**
+     * 育成育肥存栏
+     */
+    @Excel(name = "育成育肥存栏")
+    private Integer stock4;
+
+    /**
+     * 空怀舍
+     */
+    @Excel(name = "空怀")
+    private Integer stock5;
+
+    /**
+     * 后备母猪
+     */
+    @Excel(name = "后备母猪")
+    private Integer stock6;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+}

+ 21 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/DailyVo.java

@@ -0,0 +1,21 @@
+package com.huimv.modular.dailytabulatedata.entity;
+
+import lombok.Data;
+
+@Data
+public class DailyVo {
+
+    private String ydate;
+
+    private Integer stock1;
+
+    private Integer stock2;
+
+    private Integer stock5;
+
+    private Integer stock6;
+
+    private Integer stockNew;
+
+    private Integer offlineNo;
+}

+ 54 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/entity/OrgUser.java

@@ -0,0 +1,54 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 耳标每日汇总表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+@Data
+@TableName("org_user")
+public class OrgUser {
+
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    private Long orgId;
+
+    private Long userId;
+
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/enums/DailyTabulateDataExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.enums;
+
+
+import com.huimv.modular.consts.SysExpEnumConstant;
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+import com.huimv.modular.utils.ExpEnumType;
+
+/**
+ * 耳标每日汇总表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum DailyTabulateDataExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        DailyTabulateDataExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 48 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/DailyTabulateDataMapper.java

@@ -0,0 +1,48 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.huimv.modular.dailytabulatedata.entity.DailyTabulateData;
+import com.huimv.modular.dailytabulatedata.entity.DailyVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 耳标每日汇总表
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+public interface DailyTabulateDataMapper extends BaseMapper<DailyTabulateData> {
+    List<DailyVo> selectDay(@Param(Constants.WRAPPER) QueryWrapper<DailyTabulateData> wrapper);
+
+    List<DailyVo> selectMonth(@Param(Constants.WRAPPER) QueryWrapper<DailyTabulateData> wrapper);
+
+    List<DailyVo> selectYear(@Param(Constants.WRAPPER) QueryWrapper<DailyTabulateData> wrapper);
+}

+ 10 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/OrgUserMapper.java

@@ -0,0 +1,10 @@
+package com.huimv.modular.dailytabulatedata.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.dailytabulatedata.entity.OrgUser;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface OrgUserMapper extends BaseMapper<OrgUser> {
+}

+ 24 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/mapping/DailyTabulateDataMapper.xml

@@ -0,0 +1,24 @@
+<?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="com.huimv.modular.dailytabulatedata.mapper.DailyTabulateDataMapper">
+
+    <select id="selectDay" resultType="com.huimv.modular.dailytabulatedata.entity.DailyVo">
+
+        SELECT DATE_FORMAT(statistic_date,"%m-%d") ydate,
+          stock1,stock2,stock5, stock6 , stock_new, offline_no
+          FROM `daily_tabulate_data`
+         ${ew.customSqlSegment}
+    </select>
+    <select id="selectMonth" resultType="com.huimv.modular.dailytabulatedata.entity.DailyVo">
+         SELECT DATE_FORMAT(statistic_date,"%Y-%m") ydate,
+                  stock1,stock2,stock5, stock6 , stock_new, offline_no
+                  FROM `daily_tabulate_data`
+                 ${ew.customSqlSegment}
+    </select>
+    <select id="selectYear" resultType="com.huimv.modular.dailytabulatedata.entity.DailyVo">
+         SELECT DATE_FORMAT(statistic_date,"%Y") ydate,
+                  stock1,stock2, stock5,stock6 , stock_new, offline_no
+                  FROM `daily_tabulate_data`
+                 ${ew.customSqlSegment}
+    </select>
+</mapper>

+ 6 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/mapper/mapping/OrgUserMapper.xml

@@ -0,0 +1,6 @@
+<?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="com.huimv.modular.dailytabulatedata.mapper.OrgUserMapper">
+
+
+</mapper>

+ 140 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/param/DailyTabulateDataParam.java

@@ -0,0 +1,140 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.param;
+
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 耳标每日汇总表参数类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+*/
+@Data
+public class DailyTabulateDataParam extends BaseParam {
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 统计日期
+     */
+    @NotNull(message = "统计日期不能为空,请检查statisticDate参数", groups = {add.class, edit.class})
+    private String statisticDate;
+
+    /**
+     * 当日母猪总存栏
+     */
+    @NotNull(message = "当日母猪总存栏不能为空,请检查stockTotal参数", groups = {add.class, edit.class})
+    private Integer stockTotal;
+
+    /**
+     * 每日母猪新增耳标数
+     */
+    @NotNull(message = "每日母猪新增耳标数不能为空,请检查stockNew参数", groups = {add.class, edit.class})
+    private Integer stockNew;
+
+    /**
+     * 每日离线耳标数
+     */
+    @NotNull(message = "每日离线耳标数不能为空,请检查offlineNo参数", groups = {add.class, edit.class})
+    private Integer offlineNo;
+
+    /**
+     * 能繁母猪存栏数
+     */
+    @NotNull(message = "能繁母猪存栏数不能为空,请检查sowStock参数", groups = {add.class, edit.class})
+    private Integer sowStock;
+
+    /**
+     * 日龄占比(250-1000)
+     */
+    @NotBlank(message = "日龄占比(250-1000)不能为空,请检查ratio1参数", groups = {add.class, edit.class})
+    private String ratio1;
+
+    /**
+     * 日龄(1000-1700)
+     */
+    @NotBlank(message = "日龄(1000-1700)不能为空,请检查ratio2参数", groups = {add.class, edit.class})
+    private String ratio2;
+
+    /**
+     * 日龄(1700-2400)
+     */
+    @NotBlank(message = "日龄(1700-2400)不能为空,请检查ratio3参数", groups = {add.class, edit.class})
+    private String ratio3;
+
+    /**
+     * 日龄(>2400)
+     */
+    @NotBlank(message = "日龄(>2400)不能为空,请检查ratio4参数", groups = {add.class, edit.class})
+    private String ratio4;
+
+    /**
+     * 配怀存栏
+     */
+    @NotNull(message = "配怀存栏不能为空,请检查stock1参数", groups = {add.class, edit.class})
+    private Integer stock1;
+
+    /**
+     * 分娩存栏
+     */
+    @NotNull(message = "分娩存栏不能为空,请检查stock2参数", groups = {add.class, edit.class})
+    private Integer stock2;
+
+    /**
+     * 空怀母猪
+     */
+    @NotNull(message = "空怀母猪不能为空,请检查stock3参数", groups = {add.class, edit.class})
+    private Integer stock3;
+
+    /**
+     * 后备存栏
+     */
+    @NotNull(message = "后备存栏不能为空,请检查stock4参数", groups = {add.class, edit.class})
+    private Integer stock4;
+
+    /**
+     * 公猪存栏
+     */
+    @NotNull(message = "公猪存栏不能为空,请检查stock5参数", groups = {add.class, edit.class})
+    private Integer stock5;
+
+    /**
+     * 牧场编码
+     */
+    @NotBlank(message = "牧场编码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+}

+ 55 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/service/DailyTabulateDataService.java

@@ -0,0 +1,55 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.huimv.modular.dailytabulatedata.entity.DailyTabulateData;
+import com.huimv.modular.dailytabulatedata.param.DailyTabulateDataParam;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 耳标每日汇总表service接口
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+public interface DailyTabulateDataService extends IService<DailyTabulateData> {
+
+
+    Map countAllsow(Long orgId);
+
+    PageResult queryPage(DailyTabulateData dailyTabulateData);
+
+    List countAllChange(Map<String, Object> params);
+
+    PageResult farmList(Map<String, Object> params);
+
+    ResponseData listByFarm(Long orgId);
+}

+ 253 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/dailytabulatedata/service/impl/DailyTabulateDataServiceImpl.java

@@ -0,0 +1,253 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.dailytabulatedata.service.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.map.MapUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.huimv.modular.dailytabulatedata.entity.DailyTabulateData;
+import com.huimv.modular.dailytabulatedata.entity.DailyVo;
+import com.huimv.modular.dailytabulatedata.entity.OrgUser;
+import com.huimv.modular.dailytabulatedata.mapper.DailyTabulateDataMapper;
+import com.huimv.modular.dailytabulatedata.mapper.OrgUserMapper;
+import com.huimv.modular.dailytabulatedata.service.DailyTabulateDataService;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import com.huimv.modular.eartagregister.mapper.EartagRegisterMapper;
+import com.huimv.modular.factory.PageFactory;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import com.huimv.modular.yesterdaypig.entity.YesterdayPig;
+import com.huimv.modular.yesterdaypig.mapper.YesterdayPigMapper;
+import com.huimv.sys.modular.org.entity.SysOrg;
+import com.huimv.sys.modular.org.mapper.SysOrgMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.sql.Struct;
+import java.util.*;
+
+/**
+ * 耳标每日汇总表service接口实现类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:34:00
+ */
+@Service
+public class DailyTabulateDataServiceImpl extends ServiceImpl<DailyTabulateDataMapper, DailyTabulateData> implements DailyTabulateDataService {
+
+
+    //(1:配种舍,2:分娩舍,3:保育舍,4:育成育肥舍,5:空怀舍,6:后备母猪舍,
+    // 7:公猪舍,8:病死猪场内收集点,9:病死猪集中收集点,10:病死猪无害化处理中心
+    @Autowired
+    private SysOrgMapper sysOrgMapper ;
+
+    @Autowired
+    private OrgUserMapper orgUserMapper ;
+
+    @Override
+    public Map countAllsow(Long orgId) {
+        HashMap<String, Object> endMap = new HashMap<>();
+        QueryWrapper<DailyTabulateData> wrapper = new QueryWrapper<>();
+
+        wrapper.ge("statistic_date",DateUtil.offsetDay(DateUtil.beginOfDay(DateUtil.date()),-7));
+        if (ObjectUtil.isEmpty(orgId)){
+            orgId = LoginContextHolder.me().getSysLoginUserOrgId();
+        }
+        wrapper.eq("org_id",orgId);
+        List<DailyTabulateData> list = this.list(wrapper);
+        endMap.put("sowTotalStockValue",0);
+        endMap.put("sowTotalStockType",true);
+
+        if (list.size() >1){
+            Integer  dailyTabulateData = list.get(0).getStockTotal();
+            Integer yesterdayData = list.get(1).getStockTotal();
+            if (dailyTabulateData > yesterdayData){
+                endMap.put("sowTotalStockValue",dailyTabulateData -yesterdayData);
+            }
+            if (dailyTabulateData < yesterdayData){
+                endMap.put("sowTotalStockValue",yesterdayData - dailyTabulateData);
+                endMap.put("sowTotalStockType",false);
+            }
+        }
+
+        endMap.put("data",list);
+        return endMap;
+
+    }
+
+    @Override
+    public PageResult queryPage(DailyTabulateData dailyTabulateData) {
+        QueryWrapper<DailyTabulateData> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(dailyTabulateData)) {
+
+            Long orgId = dailyTabulateData.getOrgId();
+            if (ObjectUtil.isNotEmpty(orgId)) {
+                QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+                sysOrgQueryWrapper.eq("pid",orgId);
+                List<SysOrg> sysOrgs = sysOrgMapper.selectList(sysOrgQueryWrapper);
+                List<Long> list = new ArrayList<>();
+                for (SysOrg sysOrg : sysOrgs) {
+                    list.add(sysOrg.getId());
+                }
+                list.add(orgId);
+                queryWrapper.in("org_id", list);
+                queryWrapper.eq("statistic_date", DateUtil.beginOfDay(new Date()));
+            }
+
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+
+    }
+
+    @Override
+    public List countAllChange(Map<String, Object> params) {
+        List<DailyVo> list = new ArrayList<>();
+
+        String orgId = (String)params.get("orgId");
+        String startDate = (String)params.get("startDate");
+        String endDate = (String)params.get("endDate");
+        String type = (String)params.get("type");
+
+
+        QueryWrapper<DailyTabulateData> wrapper = new QueryWrapper<>();
+        wrapper.eq("org_id",orgId);
+        if (startDate != null && startDate.length() > 0){
+            if (startDate.length()==7){
+                startDate = startDate+"-01";
+            }
+            if ( startDate.length()==4){
+                startDate = startDate+"-01-01";
+            }
+        }
+
+        if (endDate != null && endDate.length() > 0){
+            if ( endDate.length()==4){
+                endDate = endDate+"-12-30";
+            }
+            if ( endDate.length()==7){
+                endDate = endDate+"-30";
+            }
+        }
+
+
+        wrapper.ge(StringUtils.isNotBlank(startDate),"statistic_date",startDate);
+        wrapper.le(StringUtils.isNotBlank(endDate),"statistic_date",endDate);
+        wrapper.groupBy("ydate");
+        wrapper.orderByDesc("statistic_date");
+
+        if ("1".equals(type)){
+            if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+                wrapper.last("limit 7");
+            }
+            list = baseMapper.selectDay(wrapper);
+        }
+        if ("2".equals(type)){
+            if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+                wrapper.last("limit 6");
+            }
+            list = baseMapper.selectMonth(wrapper);
+        }
+        if ("3".equals(type)){
+            if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+                wrapper.last("limit 5");
+            }
+            list = baseMapper.selectYear(wrapper);
+        }
+
+        return list;
+    }
+
+    @Override
+    public PageResult farmList(Map<String, Object> params) {
+
+        String minStockTotal = (String)params.get("minStockTotal");
+        String maxStockTotal = (String)params.get("maxStockTotal");
+        String minStockNew = (String)params.get("minStockNew");
+        String maxStockNew = (String)params.get("maxStockNew");
+        String minOfflineNo = (String)params.get("minOfflineNo");
+        String maxOfflineNo = (String)params.get("maxOfflineNo");
+        String orgId = (String)params.get("orgId");
+        if (ObjectUtil.isEmpty(orgId)){
+            orgId = LoginContextHolder.me().getSysLoginUserOrgId()+"";
+        }
+        QueryWrapper<DailyTabulateData> wrapper = new QueryWrapper<>();
+        wrapper.eq("org_id",orgId);
+        if (StringUtils.isNotBlank(minStockTotal)){
+            wrapper.ge("stock_total",Integer.parseInt(minStockTotal));
+        }
+        if (StringUtils.isNotBlank(maxStockTotal)){
+            wrapper.le("stock_total",Integer.parseInt(maxStockTotal));
+        }
+        if (StringUtils.isNotBlank(minStockNew)){
+            wrapper.ge("stock_new",Integer.parseInt(minStockNew));
+        }
+        if (StringUtils.isNotBlank(maxStockNew)){
+            wrapper.le("stock_new",Integer.parseInt(maxStockNew));
+        }
+        if (StringUtils.isNotBlank(minOfflineNo)){
+            wrapper.ge("offline_no",Integer.parseInt(minOfflineNo));
+        }
+        if (StringUtils.isNotBlank(maxOfflineNo)){
+            wrapper.le("offline_no",Integer.parseInt(maxOfflineNo));
+        }
+
+        return new PageResult<>(this.page(PageFactory.defaultPage(),wrapper));
+    }
+
+    @Override
+    public ResponseData listByFarm(Long orgId) {
+        Long userId = LoginContextHolder.me().getSysLoginUserId();
+        LambdaQueryWrapper<OrgUser> wrapper = new QueryWrapper<OrgUser>().lambda();
+        wrapper.eq(OrgUser::getUserId,userId);
+        List<OrgUser> orgUsers = orgUserMapper.selectList(wrapper);
+
+        if (ObjectUtil.isEmpty(orgUsers)){
+            OrgUser orgUser = new OrgUser();
+            orgUser.setOrgId(1429617697447870465L);
+            orgUser.setUserId(userId);
+            orgUserMapper.insert(orgUser);
+            return new SuccessResponseData( this.list(new QueryWrapper<DailyTabulateData>().eq("org_id",1429617697447870465L).eq("statistic_date",DateUtil.beginOfDay(new Date()))));
+        }
+
+        if (ObjectUtil.isEmpty(orgId)){
+           return new SuccessResponseData( this.list(new QueryWrapper<DailyTabulateData>().eq("org_id",orgUsers.get(0).getOrgId()).eq("statistic_date",DateUtil.beginOfDay(new Date()))));
+
+        }else {
+            OrgUser orgUser = orgUsers.get(0);
+            orgUser.setOrgId(orgId);
+            orgUserMapper.updateById(orgUser);
+            return new SuccessResponseData( this.list(new QueryWrapper<DailyTabulateData>().eq("org_id",orgId).eq("statistic_date",DateUtil.beginOfDay(new Date()))));
+
+        }
+    }
+}

+ 177 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/controller/EartagDataController.java

@@ -0,0 +1,177 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.controller;
+
+
+import com.huimv.modular.eartagdata.entity.EartagData;
+import com.huimv.modular.eartagdata.param.EartagDataParam;
+import com.huimv.modular.eartagdata.service.EartagDataService;
+
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import com.huimv.modular.result.R;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+/**
+ * 耳标数据详情控制器
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+@RestController
+public class EartagDataController {
+
+    @Resource
+    private EartagDataService eartagDataService;
+
+    //增加处理耳标数据接口
+
+    //根据耳标电量查询
+
+    @PostMapping("/manager/eartagdata/findByConditions")
+    //@BusinessLog(title = "栋舍表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData findByConditions(@RequestParam Map<String, Object> params  ) throws ParseException {
+        System.out.println("进入查询111");
+        PageResult<EartagData> byConditions = eartagDataService.findByConditions(params);
+        System.out.println("进入查询");
+        return   new SuccessResponseData(byConditions);
+    }
+
+
+
+
+    @PostMapping("/manager/eartagdata/list_deatils_byeartagno")
+    public R listDeatils01(@RequestParam Map<String, Object> params) throws ParseException {
+        Map queryDetailsMap = eartagDataService.queryDetailsByEarTag(params);
+        return R.ok().put("page", queryDetailsMap);
+    }
+
+
+    /**
+     * 查询耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @GetMapping("/eartagData/page")
+    public ResponseData page(EartagDataParam eartagDataParam) {
+        return new SuccessResponseData(eartagDataService.page(eartagDataParam));
+    }
+
+    /**
+     * 添加耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @PostMapping("/eartagData/add")
+    public ResponseData add(@RequestBody @Validated(EartagDataParam.add.class) EartagDataParam eartagDataParam) {
+            eartagDataService.add(eartagDataParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除耳标数据详情,可批量删除
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @PostMapping("/eartagData/delete")
+    public ResponseData delete(@RequestBody @Validated(EartagDataParam.delete.class) List<EartagDataParam> eartagDataParamList) {
+            eartagDataService.delete(eartagDataParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @PostMapping("/eartagData/edit")
+    public ResponseData edit(@RequestBody @Validated(EartagDataParam.edit.class) EartagDataParam eartagDataParam) {
+            eartagDataService.edit(eartagDataParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @GetMapping("/eartagData/detail")
+    public ResponseData detail(@Validated(EartagDataParam.detail.class) EartagDataParam eartagDataParam) {
+        return new SuccessResponseData(eartagDataService.detail(eartagDataParam));
+    }
+
+    /**
+     * 耳标数据详情列表
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @GetMapping("/eartagData/list")
+    public ResponseData list(EartagDataParam eartagDataParam) {
+        return new SuccessResponseData(eartagDataService.list(eartagDataParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    @GetMapping("/eartagData/export")
+    public void export(EartagDataParam eartagDataParam) {
+        eartagDataService.export(eartagDataParam);
+    }
+
+
+
+    /**
+     * 查询每小时的上传量
+     */
+    @RequestMapping("/eartagData/countByTime")
+    public ResponseData countByTime(@RequestParam Map<String, Object> params){
+
+
+        return eartagDataService.countByTime(params);
+    }
+
+    /**
+     * 查询每小时的上传量
+     */
+    @RequestMapping("/eartagData/countByDay")
+    public ResponseData countByDay(@RequestParam Map<String, Object> params){
+
+        return  eartagDataService.countByDay(params);
+    }
+}

+ 175 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/entity/EartagData.java

@@ -0,0 +1,175 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.*;
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+/**
+ * 耳标数据详情
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+@Data
+@TableName("eartag_data")
+public class EartagData {
+
+    /**
+     * 记录id(主键)
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @Excel(name = "组织id")
+    private String orgId;
+
+    /**
+     * 采集器编码
+     */
+    @Excel(name = "采集器编码")
+    private String deviceCode;
+
+    /**
+     * 耳标号
+     */
+    @Excel(name = "耳标号")
+    private String eartagNo;
+
+    /**
+     * 采集时间
+     */
+    @Excel(name = "采集时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    private Date time;
+
+    /**
+     * 耳根温度
+     */
+    @Excel(name = "耳根温度")
+    private Double earTemp;
+
+    /**
+     * 运动量
+     */
+    @Excel(name = "运动量")
+    private Integer exercise;
+
+    /**
+     * 栋舍
+     */
+    @Excel(name = "栋舍")
+    private String pigpen;
+
+    /**
+     * 环境温度
+     */
+    @Excel(name = "环境温度")
+    private Double envTemp;
+
+    /**
+     * 电池电量
+     */
+    @Excel(name = "电池电量")
+    private Integer bat;
+
+    /**
+     * 信号强度
+     */
+    @Excel(name = "信号强度")
+    private Integer rssi;
+
+    /**
+     * 命令头
+     */
+    @Excel(name = "命令头")
+    private String head;
+
+    /**
+     * 指令
+     */
+    @Excel(name = "指令")
+    private String command;
+
+    /**
+     * 版本号
+     */
+    @Excel(name = "版本号")
+    private String version;
+
+    /**
+     * 耳标帧序号
+     */
+    @Excel(name = "耳标帧序号")
+    private Integer frameSerialNo;
+
+    /**
+     * 重启次数
+     */
+    @Excel(name = "重启次数")
+    private Integer rebootTimes;
+
+    /**
+     * 预留字段
+     */
+    @Excel(name = "预留字段")
+    private String prepareField;
+
+    /**
+     * 校验码
+     */
+    @Excel(name = "校验码")
+    private String chk;
+
+    /**
+     * 命令尾
+     */
+    @Excel(name = "命令尾")
+    private String tail;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+    /**
+     * 阶段
+     */
+    @Excel(name = "阶段")
+    private Integer stage;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer sportGap;
+
+}

+ 121 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/entity/TempMovePenEntity.java

@@ -0,0 +1,121 @@
+package com.huimv.modular.eartagdata.entity;
+
+import java.util.Date;
+
+/**
+ * @Author Anchor
+ * @Date 2021/7/30 17:23
+ * @Version 1.0.1
+ */
+public class TempMovePenEntity {
+
+
+    private Integer id;
+    /**
+     * 耳标号
+     */
+    private String eartagNo;
+    /**
+     * 转舍日期
+     */
+    private Date moveDate;
+    /**
+     * 当前阶段
+     */
+    private Integer stage;
+    /**
+     * 设备编码
+     */
+    private String deviceCode;
+
+
+    //第几次转舍
+    private String  removeSec;
+
+    //猪舍名称
+    private String penName;
+
+
+    //单元名称
+    private String unitname;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getEartagNo() {
+        return eartagNo;
+    }
+
+    public void setEartagNo(String eartagNo) {
+        this.eartagNo = eartagNo;
+    }
+
+    public Date getMoveDate() {
+        return moveDate;
+    }
+
+    public void setMoveDate(Date moveDate) {
+        this.moveDate = moveDate;
+    }
+
+    public Integer getStage() {
+        return stage;
+    }
+
+    public void setStage(Integer stage) {
+        this.stage = stage;
+    }
+
+    public String getDeviceCode() {
+        return deviceCode;
+    }
+
+    public void setDeviceCode(String deviceCode) {
+        this.deviceCode = deviceCode;
+    }
+
+    public String getRemoveSec() {
+        return removeSec;
+    }
+
+    public void setRemoveSec(String removeSec) {
+        this.removeSec = removeSec;
+    }
+
+    public String getPenName() {
+        return penName;
+    }
+
+    public void setPenName(String penName) {
+        this.penName = penName;
+    }
+
+    public String getUnitname() {
+        return unitname;
+    }
+
+    public void setUnitname(String unitname) {
+        this.unitname = unitname;
+    }
+
+
+    @Override
+    public String toString() {
+        return "MovePenEntity{" +
+                "id=" + id +
+                ", eartagNo='" + eartagNo + '\'' +
+                ", moveDate=" + moveDate +
+                ", stage=" + stage +
+                ", deviceCode='" + deviceCode + '\'' +
+                ", removeSec='" + removeSec + '\'' +
+                ", penName='" + penName + '\'' +
+                ", unitname='" + unitname + '\'' +
+                '}';
+    }
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/enums/EartagDataExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.enums;
+
+
+import com.huimv.modular.consts.SysExpEnumConstant;
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+import com.huimv.modular.utils.ExpEnumType;
+
+/**
+ * 耳标数据详情
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum EartagDataExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        EartagDataExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 54 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/mapper/EartagDataMapper.java

@@ -0,0 +1,54 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.modular.collectorregister.EartagDataCountVo;
+import com.huimv.modular.eartagdata.entity.EartagData;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 耳标数据详情
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+@Repository
+public interface EartagDataMapper extends BaseMapper<EartagData> {
+    List<EartagDataCountVo> countByTime(@Param(Constants.WRAPPER) QueryWrapper<EartagData> wrapper);
+
+    List<EartagDataCountVo> countByDay(@Param(Constants.WRAPPER) QueryWrapper<EartagData> wrapper);
+
+    Page<EartagData> findByCondition(@Param("page") IPage<EartagData> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<EartagData> wrapper);
+
+}

+ 31 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/mapper/mapping/EartagDataMapper.xml

@@ -0,0 +1,31 @@
+<?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="com.huimv.modular.eartagdata.mapper.EartagDataMapper">
+
+    <select id="countByTime" resultType="com.huimv.modular.collectorregister.EartagDataCountVo">
+         SELECT
+          DATE_FORMAT(`time`,"%y-%m-%d %H") count_time,COUNT(*) upload_count, CAST(AVG(env_temp) AS DECIMAL(10,2)) envTemp
+	        FROM `eartag_data`
+	        ${ew.customSqlSegment}
+    </select>
+
+
+
+    <select id="countByDay" resultType="com.huimv.modular.collectorregister.EartagDataCountVo">
+        SELECT
+          DATE_FORMAT(`time`,"%y-%m-%d") count_time,COUNT(*) upload_count, CAST(AVG(env_temp) AS DECIMAL(10,2)) envTemp
+	        FROM `eartag_data`
+	        ${ew.customSqlSegment}
+    </select>
+
+
+
+    <select id="findByCondition" resultType="com.huimv.modular.eartagdata.entity.EartagData">
+        SELECT * FROM eartag_data ed1 JOIN (SELECT MAX(id) id FROM eartag_data ed2 ${ew.customSqlSegment}) b ON ed1.id = b.id
+    </select>
+
+
+
+
+
+</mapper>

+ 175 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/param/EartagDataParam.java

@@ -0,0 +1,175 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.param;
+
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 耳标数据详情参数类
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+*/
+@Data
+public class EartagDataParam extends BaseParam {
+
+    /**
+     * 记录id(主键)
+     */
+    @NotNull(message = "记录id(主键)不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @NotBlank(message = "组织id不能为空,请检查orgId参数", groups = {add.class, edit.class})
+    private String orgId;
+
+    /**
+     * 采集器编码
+     */
+    @NotBlank(message = "采集器编码不能为空,请检查deviceCode参数", groups = {add.class, edit.class})
+    private String deviceCode;
+
+    /**
+     * 耳标号
+     */
+    @NotBlank(message = "耳标号不能为空,请检查eartagNo参数", groups = {add.class, edit.class})
+    private String eartagNo;
+
+    /**
+     * 采集时间
+     */
+    @NotNull(message = "采集时间不能为空,请检查time参数", groups = {add.class, edit.class})
+    private String time;
+
+    /**
+     * 耳根温度
+     */
+    @NotNull(message = "耳根温度不能为空,请检查earTemp参数", groups = {add.class, edit.class})
+    private Double earTemp;
+
+    /**
+     * 运动量
+     */
+    @NotNull(message = "运动量不能为空,请检查exercise参数", groups = {add.class, edit.class})
+    private Integer exercise;
+
+    /**
+     * 栋舍
+     */
+    @NotBlank(message = "栋舍不能为空,请检查pigpen参数", groups = {add.class, edit.class})
+    private String pigpen;
+
+    /**
+     * 环境温度
+     */
+    @NotNull(message = "环境温度不能为空,请检查envTemp参数", groups = {add.class, edit.class})
+    private Double envTemp;
+
+    /**
+     * 电池电量
+     */
+    @NotNull(message = "电池电量不能为空,请检查bat参数", groups = {add.class, edit.class})
+    private Integer bat;
+
+    /**
+     * 信号强度
+     */
+    @NotNull(message = "信号强度不能为空,请检查rssi参数", groups = {add.class, edit.class})
+    private Integer rssi;
+
+    /**
+     * 命令头
+     */
+    @NotBlank(message = "命令头不能为空,请检查head参数", groups = {add.class, edit.class})
+    private String head;
+
+    /**
+     * 指令
+     */
+    @NotBlank(message = "指令不能为空,请检查command参数", groups = {add.class, edit.class})
+    private String command;
+
+    /**
+     * 版本号
+     */
+    @NotBlank(message = "版本号不能为空,请检查version参数", groups = {add.class, edit.class})
+    private String version;
+
+    /**
+     * 耳标帧序号
+     */
+    @NotNull(message = "耳标帧序号不能为空,请检查frameSerialNo参数", groups = {add.class, edit.class})
+    private Integer frameSerialNo;
+
+    /**
+     * 重启次数
+     */
+    @NotNull(message = "重启次数不能为空,请检查rebootTimes参数", groups = {add.class, edit.class})
+    private Integer rebootTimes;
+
+    /**
+     * 预留字段
+     */
+    @NotBlank(message = "预留字段不能为空,请检查prepareField参数", groups = {add.class, edit.class})
+    private String prepareField;
+
+    /**
+     * 校验码
+     */
+    @NotBlank(message = "校验码不能为空,请检查chk参数", groups = {add.class, edit.class})
+    private String chk;
+
+    /**
+     * 命令尾
+     */
+    @NotBlank(message = "命令尾不能为空,请检查tail参数", groups = {add.class, edit.class})
+    private String tail;
+
+    /**
+     * 牧场编码
+     */
+    @NotBlank(message = "牧场编码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 阶段
+     */
+    @NotNull(message = "阶段不能为空,请检查stage参数", groups = {add.class, edit.class})
+    private Integer stage;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查sportGap参数", groups = {add.class, edit.class})
+    private Integer sportGap;
+
+}

+ 114 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/service/EartagDataService.java

@@ -0,0 +1,114 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.huimv.modular.eartagdata.entity.EartagData;
+import com.huimv.modular.eartagdata.param.EartagDataParam;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 耳标数据详情service接口
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+public interface EartagDataService extends IService<EartagData> {
+
+
+    PageResult<EartagData> findByConditions(Map<String, Object> params) throws ParseException;
+
+
+    Map<String ,Object>    queryDetailsByEarTag(Map<String, Object> params) throws ParseException;
+
+
+
+
+    /**
+     * 查询耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    PageResult<EartagData> page(EartagDataParam eartagDataParam);
+
+    /**
+     * 耳标数据详情列表
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    List<EartagData> list(EartagDataParam eartagDataParam);
+
+    /**
+     * 添加耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    void add(EartagDataParam eartagDataParam);
+
+    /**
+     * 删除耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    void delete(List<EartagDataParam> eartagDataParamList);
+
+    /**
+     * 编辑耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    void edit(EartagDataParam eartagDataParam);
+
+    /**
+     * 查看耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+     EartagData detail(EartagDataParam eartagDataParam);
+
+    /**
+     * 导出耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+     void export(EartagDataParam eartagDataParam);
+
+    ResponseData countByTime(Map<String, Object> params);
+
+    ResponseData countByDay(Map<String, Object> params);
+}

+ 594 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagdata/service/impl/EartagDataServiceImpl.java

@@ -0,0 +1,594 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagdata.service.impl;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.huimv.modular.basepigpen.mapper.BasePigpenMapper;
+import com.huimv.modular.collectorregister.EartagDataCountVo;
+import com.huimv.modular.collectorregister.entity.CollectorRegister;
+import com.huimv.modular.collectorregister.mapper.CollectorRegisterMapper;
+import com.huimv.modular.eartagdata.entity.EartagData;
+import com.huimv.modular.eartagdata.entity.TempMovePenEntity;
+import com.huimv.modular.eartagdata.enums.EartagDataExceptionEnum;
+import com.huimv.modular.eartagdata.mapper.EartagDataMapper;
+import com.huimv.modular.eartagdata.param.EartagDataParam;
+import com.huimv.modular.eartagdata.service.EartagDataService;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+
+import com.huimv.modular.eartagregister.mapper.EartagRegisterMapper;
+import com.huimv.modular.eartagregister.service.EartagRegisterService;
+
+import com.huimv.modular.factory.PageFactory;
+import com.huimv.modular.factory.util.PoiUtil;
+import com.huimv.modular.movepigpen.entity.MovePigpen;
+import com.huimv.modular.movepigpen.mapper.MovePigpenMapper;
+import com.huimv.modular.pojo.page.PageResult;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import com.huimv.modular.utils.util.DateUtilsPublic;
+import com.huimv.modular.utils.util.StringUtilsWork;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.DateFormat;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 耳标数据详情service接口实现类
+ *
+ * @author Yangdi
+ * @date 2021-08-19 13:18:22
+ */
+@Service
+public class EartagDataServiceImpl extends ServiceImpl<EartagDataMapper, EartagData> implements EartagDataService {
+
+    @Autowired
+    private CollectorRegisterMapper collectorRegisterMapper;
+
+    @Autowired
+    private BasePigpenMapper  basePigpenMapper  ;
+
+
+    @Autowired
+    private MovePigpenMapper  movePigpenMapper  ;
+    @Autowired
+    private EartagRegisterMapper eartagRegisterMapper     ;
+
+    @Autowired
+    private EartagRegisterService eartagRegisterService   ;
+
+
+
+    @Autowired
+    private EartagDataMapper eartagDataMapper   ;
+
+
+    @Override
+    public PageResult<EartagData> findByConditions(Map<String, Object> params) throws ParseException {
+
+
+        String orgId = (String) params.get("orgId");//牧场编码
+        String starttime = (String) params.get("startTime");//开始时间
+        String endtime = (String) params.get("endTime");//结束时间
+        String eartagNo = (String) params.get("eartagNo");//耳标号----------------------
+        String highEartagTemp = (String) params.get("highEartagTemp");//耳标温度
+        String lowEartagTemp = (String) params.get("lowEartagTemp");//耳标温度
+        String highEnvTemp = (String) params.get("highEnvTemp");//环境温度
+        String lowEnvTemp = (String) params.get("lowEnvTemp");//环境温度
+        String deviceCode = (String) params.get("deviceCode");//采集器编码
+        String rssiMin = (String) params.get("rssiMin");//电量
+        String rssiMax = (String) params.get("rssiMax");//电量
+        System.out.println(orgId + "耳标号");
+
+        LambdaQueryWrapper<EartagData> wrapper = Wrappers.lambdaQuery();
+        if (StringUtilsWork.isNotBlank(rssiMax) & StringUtilsWork.isNotBlank(rssiMin)) {
+            wrapper.between(EartagData::getRssi, rssiMax, rssiMin);
+        }
+        if (StringUtilsWork.isNotBlank(orgId)) {
+            wrapper.eq(EartagData::getOrgId, orgId);
+        }
+        //耳标做判断---
+        if (StringUtilsWork.isNotBlank(eartagNo)) {
+            wrapper.eq(EartagData::getEartagNo, eartagNo);
+        }
+        if (StringUtilsWork.isNotBlank(deviceCode)) {
+            wrapper.eq(EartagData::getDeviceCode, deviceCode);
+        }
+        if (StringUtilsWork.isNotBlank(starttime) & StringUtilsWork.isNotBlank(endtime)) {
+            System.out.println(starttime + "***shijian**" + endtime);
+            DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            //格式化传入的时间
+            Date startTime = fmt.parse(starttime);
+            Date endTime = fmt.parse(endtime);
+            System.out.println("yangdi" + starttime + endtime);
+            //过滤时间
+            wrapper.between(EartagData::getTime, startTime, endTime);
+        }
+
+        if (StringUtilsWork.isNotBlank(highEartagTemp) & StringUtilsWork.isNotBlank(lowEartagTemp)) {
+            wrapper.between(EartagData::getEarTemp, highEartagTemp, lowEartagTemp);
+        }
+        if (StringUtilsWork.isNotBlank(highEnvTemp) & StringUtilsWork.isNotBlank(lowEnvTemp)) {
+            wrapper.between(EartagData::getEnvTemp, highEnvTemp, lowEnvTemp);
+        }
+        List<EartagData> records;
+        PageResult<EartagData> EartagDataPageResult  = new PageResult<>();
+       //PageResult<List<EartagData> EartagDataPageResult1  = new PageResult<>();
+          //如果没有传耳标号,就展示符合条件的最新一条,若是传了,就展示当前耳标下的最近数据
+        if (StringUtilsWork.isNotBlank(eartagNo)) {
+            System.out.println("有耳标号,展示耳标所有数据");
+            EartagDataPageResult = new PageResult<>(this.page(PageFactory.defaultPage(), wrapper));
+            records = EartagDataPageResult.getRows();  //获取信息
+        } else {
+            //用 result 来装page
+            System.out.println("没有耳标号,展示最新");
+            wrapper.groupBy(EartagData::getEartagNo).orderByDesc(EartagData::getId);
+            IPage<EartagData> iPage = new Page<>();
+            Page<EartagData> page = baseMapper.findByCondition(iPage, wrapper);
+            records=page.getRecords();
+            System.out.println(page);
+                  EartagDataPageResult = new PageResult<>(page);
+        }
+        //拼接栋舍信息在里面
+        for (EartagData record : records) {
+            //还要装日龄和配标日龄
+            LambdaQueryWrapper<EartagRegister> wrapper231 = Wrappers.lambdaQuery();
+            wrapper231.eq(EartagRegister::getEartagNo, record.getEartagNo());
+            EartagRegister eartagRegister = eartagRegisterMapper.selectOne(wrapper231);
+            record.setRebootTimes(eartagRegister.getAge());//日龄
+            record.setPrepareField( String.valueOf(eartagRegister.getWaertagAge()));//佩戴标日龄
+            System.out.println("数据record" + records);
+            LambdaQueryWrapper<MovePigpen> wrapper23 = Wrappers.lambdaQuery();
+            wrapper23.eq(MovePigpen::getEartagNo, record.getEartagNo()).orderByAsc(MovePigpen::getId).last("limit 1");
+            MovePigpen movePigpen = movePigpenMapper.selectOne(wrapper23);
+            System.out.println("转舍信息" + movePigpen + "转舍耳标号" + record.getEartagNo());
+            //获取注册---注册信息为空
+            LambdaQueryWrapper<CollectorRegister> wrapper3 = Wrappers.lambdaQuery();
+            wrapper3.eq(CollectorRegister::getDeviceCode, record.getDeviceCode());
+            CollectorRegister collectorRegister = collectorRegisterMapper.selectOne(wrapper3);
+            System.out.println("注册表信息" + collectorRegister);
+            record.setVersion(collectorRegister.getUnitName());//这个多余字段存猪舍名字
+            record.setCommand(collectorRegister.getPenName());//这个多余字段存单元名字
+            //格式化传入的时---第一条不应该没有----但是新耳标上来没有存信息
+            if (movePigpen != null) {
+                record.setTail(DateUtilsPublic.dateToString(movePigpen.getMoveDate()));//配标时间
+            }
+        }
+        return  EartagDataPageResult;
+    }
+
+
+
+    @Override
+    public Map<String, Object> queryDetailsByEarTag(Map<String, Object> params) throws ParseException {
+
+        System.out.println("eartagno = "+params.get("eartagNo"));
+        System.out.println("orgId = "+params.get("orgId"));
+        String  eartagno1 = String.valueOf(params.get("eartagNo"));
+        String  orgId = String.valueOf(params.get("orgId"));
+        String starttime = String.valueOf(params.get("startTime"));
+        String endtime = String.valueOf( params.get("endTime"));
+
+        //找出对应的ID
+        LambdaQueryWrapper<EartagData> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(EartagData::getEartagNo, eartagno1 ).orderByDesc( EartagData::getId ).last( "limit 1");
+        EartagData  earTagData = eartagDataMapper.selectOne(wrapper);
+        if(earTagData==null){
+            Map map = new HashMap();
+            map.put("error" ,"当前数据不存在");
+            return  map;
+        }
+          //存数据
+        LambdaQueryWrapper<EartagRegister> wrapper231 = Wrappers.lambdaQuery();
+        wrapper231.eq(EartagRegister::getEartagNo, earTagData.getEartagNo());
+        EartagRegister eartagRegister = eartagRegisterMapper.selectOne(wrapper231);
+
+        //对数据进行包装
+        LambdaQueryWrapper<CollectorRegister> wrapper1 = Wrappers.lambdaQuery();
+        wrapper1.eq(CollectorRegister::getDeviceCode, earTagData.getDeviceCode() );
+
+        CollectorRegister collectorRegister = collectorRegisterMapper.selectOne(wrapper1);
+        Map<String ,Object>    map1 = new HashMap<>();
+        map1.put("Registentity",collectorRegister);//耳标所在的机器信息
+        Map<String, Object>  pen = new HashMap<>();
+        //倒数yi条
+        LambdaQueryWrapper<MovePigpen> wrapper2 = Wrappers.lambdaQuery();
+        wrapper2.eq(MovePigpen::getEartagNo , earTagData.getEartagNo()).orderByDesc( MovePigpen::getId ).last( "limit 1");
+        List<MovePigpen> movePigpenEntities = movePigpenMapper.selectList(wrapper2);
+        //时间最开始的一条
+        LambdaQueryWrapper<MovePigpen> wrapper23 = Wrappers.lambdaQuery();
+        wrapper23.eq(MovePigpen::getEartagNo , earTagData.getEartagNo()).orderByAsc( MovePigpen::getId ).last( "limit 1");
+        MovePigpen  movePigpen = movePigpenMapper.selectOne(wrapper23);
+
+        movePigpenEntities.add(movePigpen);//加上去l
+
+        System.out.println(movePigpen+"ioioio");//最开始不为空
+
+        System.out.println(movePigpenEntities+"opop");
+
+
+        if ( movePigpen!=null ) {
+            List<Object> movePigpe111 = new ArrayList<>();
+
+            for (MovePigpen MovePigpen : movePigpenEntities) {
+                Map<String, Object> c = new HashMap<>();
+
+                LambdaQueryWrapper<CollectorRegister> wrapper3 = Wrappers.lambdaQuery();
+                wrapper3.eq(CollectorRegister::getDeviceCode, MovePigpen.getDeviceCode());
+                CollectorRegister collectorRegisterEntit = collectorRegisterMapper.selectOne(wrapper3);
+
+                TempMovePenEntity tempMovePenEntity = new TempMovePenEntity();
+                tempMovePenEntity.setDeviceCode(MovePigpen.getDeviceCode());
+                tempMovePenEntity.setEartagNo(MovePigpen.getEartagNo());
+                tempMovePenEntity.setPenName(collectorRegisterEntit.getPenName());
+                tempMovePenEntity.setUnitname(collectorRegisterEntit.getUnitName());
+                tempMovePenEntity.setMoveDate(MovePigpen.getMoveDate());
+                tempMovePenEntity.setId(MovePigpen.getId());
+                tempMovePenEntity.setStage(MovePigpen.getStage());
+
+                movePigpe111.add(tempMovePenEntity);
+            }
+
+            map1.put("movePigPenData",movePigpe111);
+        }else{
+            map1.put("movePigPenData",null);}
+
+        map1.put("eartagdeta",earTagData);  //点击的耳标信息
+
+        //获取运动等信息
+        String eartag = earTagData.getEartagNo();
+        DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        //格式化传入的时间
+        Date startTime = fmt.parse(starttime);
+        Date   endTime = fmt.parse(endtime);
+        System.out.println("yangdi"+starttime+endtime);
+
+        LambdaQueryWrapper<EartagData> lambdaQuery = Wrappers.lambdaQuery();
+        lambdaQuery.eq(EartagData::getEartagNo,eartag);
+        //过滤时间
+        lambdaQuery.between(EartagData::getTime,startTime, endTime);
+        List<EartagData> eartagDateEntities = baseMapper.selectList(lambdaQuery);
+        //生成平均温度 -----如果刚刚转舍就没办法操作了---数据不会立马出来需要等
+
+        LambdaQueryWrapper<EartagData> lambdaQuery1 = Wrappers.lambdaQuery();
+        lambdaQuery1.eq(EartagData::getDeviceCode,earTagData.getDeviceCode());
+        //过滤时间
+        lambdaQuery1.between(EartagData::getTime,startTime, endTime);
+        List<EartagData> eartagDateEntities1 = baseMapper.selectList(lambdaQuery1);
+        Map averange = getAverange(starttime, endtime, eartagDateEntities1);
+
+        //这样,时间轴
+
+        List<String> timeList = new ArrayList<>();
+        List<Double>  tempList = new ArrayList<>();
+        List<Integer>  sportsList = new ArrayList<>();
+        List<Integer> electricList = new ArrayList<>();
+        List<Double> environmenttempList = new ArrayList<>();
+        List<Object> averangeTemp = new ArrayList<>();
+        for (EartagData data : eartagDateEntities) {
+            timeList.add(fmt.format(data.getTime()));
+            tempList.add(data.getEarTemp());
+            if (data.getDeviceCode() == null) {
+                sportsList.add(0);
+            } else {
+                sportsList.add(data.getSportGap());
+            }
+            electricList.add(data.getBat());
+            //sleeptime.add(data.getSleepStatus());    用来存睡眠状态了
+            environmenttempList.add(data.getEnvTemp());
+            averangeTemp.add(averange.get(getMonthDayHour(  data.getTime()  ) ) );
+        }
+
+        map1.put("time",timeList);
+        map1.put("temp",tempList);
+        map1.put("sports",sportsList);
+        map1.put("electric",electricList);
+        map1.put("environmenttemp",environmenttempList);
+        map1.put("averangeTemp",averangeTemp);
+        map1.put("eartagRegisteraddday",eartagRegister);
+        System.out.println("changdu"+timeList.size()+"**"+averangeTemp.size());
+
+        return map1;
+    }
+
+
+    public   Map<String ,String>    getAverange(String  starttime , String endtime  , List<EartagData> entityList     ) throws ParseException {
+        DecimalFormat df = new DecimalFormat("####0.00");
+        DateFormat fmt1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        //格式化传入的时间
+        Date startTime = fmt1.parse(starttime);
+        Date endTime  =    fmt1.parse(endtime);
+        Map<String ,String> map = new HashMap<>();
+        while(startTime.before(endTime)){
+            double totlatemp = 0.0;
+            double avreange = 0.0;
+//            System.out.println("开始时间"+startTime+"----"+"结束时间"+endTime);
+            int a =0;
+            for (EartagData data : entityList) {
+                //这个操作占用时间太多
+                if(data.getTime().after(startTime)&data.getTime().before(DateUtilsPublic.addDateHour(startTime,1))){
+                    a++;
+                    totlatemp += data.getEarTemp();
+                    System.out.println(data.getEarTemp());
+                }
+            }
+
+//            System.out.println("结果"+totlatemp+a+totlatemp/a);
+            //直接三元
+            if(totlatemp/a>0.01){
+                avreange  =  totlatemp/a;
+            }
+            //这个时间有点麻烦,需要对应进去
+            // map.put(format.format(startTime),df.format(avreange));
+            //时间变为年+天+小时
+            map.put(getMonthDayHour(startTime),df.format(avreange));
+
+            startTime =DateUtilsPublic.addDateHour(startTime,1);
+        }
+
+        return  map;
+    }
+
+     //用于匹配时间
+    public  String getMonthDayHour(  Date date  ){
+        String year=String.format("%tY", date);
+        String mon=String .format("%tm", date);
+        String day=String .format("%td", date);
+        String h=String .format("%tH", date);
+        String m=String .format("%tM", date);
+        String s=String .format("%tS", date);
+        return mon+day+h;
+
+    }
+
+
+
+
+    @Override
+    public PageResult<EartagData> page(EartagDataParam eartagDataParam) {
+        QueryWrapper<EartagData> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(eartagDataParam)) {
+
+            // 根据组织id 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getOrgId())) {
+                queryWrapper.lambda().eq(EartagData::getOrgId, eartagDataParam.getOrgId());
+            }
+            // 根据采集器编码 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getDeviceCode())) {
+                queryWrapper.lambda().eq(EartagData::getDeviceCode, eartagDataParam.getDeviceCode());
+            }
+            // 根据耳标号 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getEartagNo())) {
+                queryWrapper.lambda().eq(EartagData::getEartagNo, eartagDataParam.getEartagNo());
+            }
+            // 根据采集时间 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getTime())) {
+                queryWrapper.lambda().eq(EartagData::getTime, eartagDataParam.getTime());
+            }
+            // 根据耳根温度 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getEarTemp())) {
+                queryWrapper.lambda().eq(EartagData::getEarTemp, eartagDataParam.getEarTemp());
+            }
+            // 根据运动量 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getExercise())) {
+                queryWrapper.lambda().eq(EartagData::getExercise, eartagDataParam.getExercise());
+            }
+            // 根据栋舍 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getPigpen())) {
+                queryWrapper.lambda().eq(EartagData::getPigpen, eartagDataParam.getPigpen());
+            }
+            // 根据环境温度 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getEnvTemp())) {
+                queryWrapper.lambda().eq(EartagData::getEnvTemp, eartagDataParam.getEnvTemp());
+            }
+            // 根据电池电量 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getBat())) {
+                queryWrapper.lambda().eq(EartagData::getBat, eartagDataParam.getBat());
+            }
+            // 根据信号强度 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getRssi())) {
+                queryWrapper.lambda().eq(EartagData::getRssi, eartagDataParam.getRssi());
+            }
+            // 根据命令头 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getHead())) {
+                queryWrapper.lambda().eq(EartagData::getHead, eartagDataParam.getHead());
+            }
+            // 根据指令 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getCommand())) {
+                queryWrapper.lambda().eq(EartagData::getCommand, eartagDataParam.getCommand());
+            }
+            // 根据版本号 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getVersion())) {
+                queryWrapper.lambda().eq(EartagData::getVersion, eartagDataParam.getVersion());
+            }
+            // 根据耳标帧序号 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getFrameSerialNo())) {
+                queryWrapper.lambda().eq(EartagData::getFrameSerialNo, eartagDataParam.getFrameSerialNo());
+            }
+            // 根据重启次数 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getRebootTimes())) {
+                queryWrapper.lambda().eq(EartagData::getRebootTimes, eartagDataParam.getRebootTimes());
+            }
+            // 根据预留字段 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getPrepareField())) {
+                queryWrapper.lambda().eq(EartagData::getPrepareField, eartagDataParam.getPrepareField());
+            }
+            // 根据校验码 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getChk())) {
+                queryWrapper.lambda().eq(EartagData::getChk, eartagDataParam.getChk());
+            }
+            // 根据命令尾 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getTail())) {
+                queryWrapper.lambda().eq(EartagData::getTail, eartagDataParam.getTail());
+            }
+            // 根据牧场编码 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getFarmCode())) {
+                queryWrapper.lambda().eq(EartagData::getFarmCode, eartagDataParam.getFarmCode());
+            }
+            // 根据阶段 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getStage())) {
+                queryWrapper.lambda().eq(EartagData::getStage, eartagDataParam.getStage());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagDataParam.getSportGap())) {
+                queryWrapper.lambda().eq(EartagData::getSportGap, eartagDataParam.getSportGap());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<EartagData> list(EartagDataParam eartagDataParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(EartagDataParam eartagDataParam) {
+        EartagData eartagData = new EartagData();
+        BeanUtil.copyProperties(eartagDataParam, eartagData);
+        this.save(eartagData);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<EartagDataParam> eartagDataParamList) {
+        eartagDataParamList.forEach(eartagDataParam -> {
+            this.removeById(eartagDataParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(EartagDataParam eartagDataParam) {
+        EartagData eartagData = this.queryEartagData(eartagDataParam);
+        BeanUtil.copyProperties(eartagDataParam, eartagData);
+        this.updateById(eartagData);
+    }
+
+    @Override
+    public EartagData detail(EartagDataParam eartagDataParam) {
+        return this.queryEartagData(eartagDataParam);
+    }
+
+    /**
+     * 获取耳标数据详情
+     *
+     * @author Yangdi
+     * @date 2021-08-19 13:18:22
+     */
+    private EartagData queryEartagData(EartagDataParam eartagDataParam) {
+        EartagData eartagData = this.getById(eartagDataParam.getId());
+        if (ObjectUtil.isNull(eartagData)) {
+            throw new ServiceException(EartagDataExceptionEnum.NOT_EXIST);
+        }
+        return eartagData;
+    }
+
+    @Override
+    public void export(EartagDataParam eartagDataParam) {
+        List<EartagData> list = this.list(eartagDataParam);
+        PoiUtil.exportExcelWithStream("SnowyEartagData.xls", EartagData.class, list);
+    }
+
+    @Override
+    public ResponseData countByTime(Map<String, Object> params) {
+        String startTime = (String) params.get("startTime");
+        String endTime = (String) params.get("endTime");
+        String deviceCode = (String) params.get("deviceCode");
+
+
+        QueryWrapper<EartagData> wrapper = new QueryWrapper<>();
+        wrapper.eq(StringUtils.isNotBlank(deviceCode), "device_code", deviceCode);
+        wrapper.ge(StringUtils.isNotBlank(startTime), "time", startTime);
+        wrapper.le(StringUtils.isNotBlank(endTime), "time", endTime);
+        wrapper.groupBy("count_time");
+        List<EartagDataCountVo> eartagDataCountVos = baseMapper.countByTime(wrapper);
+
+        List timeList = new ArrayList();
+        List envTempList = new ArrayList();
+        List count = new ArrayList();
+        for (EartagDataCountVo eartagDataCountVo : eartagDataCountVos) {
+            timeList.add(eartagDataCountVo.getCountTime());
+            envTempList.add(eartagDataCountVo.getEnvTemp());
+            count.add(eartagDataCountVo.getUploadCount());
+        }
+        Map map = new HashMap();
+        map.put("time", timeList);
+        map.put("envTemp", envTempList);
+        map.put("count", count);
+
+
+        return new SuccessResponseData(map);
+    }
+
+
+    @Override
+    public ResponseData countByDay(Map<String, Object> params) {
+        String startTime = (String) params.get("startTime");
+        String endTime = (String) params.get("endTime");
+        String deviceCode = (String) params.get("deviceCode");
+
+
+        QueryWrapper<EartagData> wrapper = new QueryWrapper<>();
+        wrapper.eq(StringUtils.isNotBlank(deviceCode), "device_code", deviceCode);
+        wrapper.ge(StringUtils.isNotBlank(startTime), "time", startTime);
+        wrapper.le(StringUtils.isNotBlank(endTime), "time", endTime);
+        wrapper.groupBy("count_time");
+        List<EartagDataCountVo> eartagDataCountVos = baseMapper.countByDay(wrapper);
+
+        List<String> timeList = new ArrayList<>();
+        List<Double> envTempList = new ArrayList<>();
+        List<Integer> count = new ArrayList<>();
+        for (EartagDataCountVo eartagDataCountVo : eartagDataCountVos) {
+            timeList.add(eartagDataCountVo.getCountTime());
+            envTempList.add(eartagDataCountVo.getEnvTemp());
+            count.add(eartagDataCountVo.getUploadCount());
+        }
+        Map map = new HashMap();
+        map.put("time", timeList);
+        map.put("envTemp", envTempList);
+        map.put("count", count);
+
+
+        return new SuccessResponseData(map);
+    }
+}

+ 148 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/controller/EartagRegisterController.java

@@ -0,0 +1,148 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.controller;
+
+import com.huimv.core.annotion.BusinessLog;
+import com.huimv.core.annotion.Permission;
+import com.huimv.core.enums.LogAnnotionOpTypeEnum;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.eartagregister.param.EartagRegisterParam;
+import com.huimv.modular.eartagregister.service.EartagRegisterService;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 耳标注册控制器
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+@RestController
+public class EartagRegisterController {
+
+    @Resource
+    private EartagRegisterService eartagRegisterService;
+
+    /**
+     * 查询耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @GetMapping("/eartagRegister/page")
+    @BusinessLog(title = "耳标注册_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(EartagRegisterParam eartagRegisterParam) {
+        return new SuccessResponseData(eartagRegisterService.page(eartagRegisterParam));
+    }
+
+    /**
+     * 添加耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @PostMapping("/eartagRegister/add")
+    @BusinessLog(title = "耳标注册_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(EartagRegisterParam.add.class) EartagRegisterParam eartagRegisterParam) {
+            eartagRegisterService.add(eartagRegisterParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除耳标注册,可批量删除
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @PostMapping("/eartagRegister/delete")
+    @BusinessLog(title = "耳标注册_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(EartagRegisterParam.delete.class) List<EartagRegisterParam> eartagRegisterParamList) {
+            eartagRegisterService.delete(eartagRegisterParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @PostMapping("/eartagRegister/edit")
+    @BusinessLog(title = "耳标注册_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(EartagRegisterParam.edit.class) EartagRegisterParam eartagRegisterParam) {
+            eartagRegisterService.edit(eartagRegisterParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @GetMapping("/eartagRegister/detail")
+    @BusinessLog(title = "耳标注册_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(EartagRegisterParam.detail.class) EartagRegisterParam eartagRegisterParam) {
+        return new SuccessResponseData(eartagRegisterService.detail(eartagRegisterParam));
+    }
+
+    /**
+     * 耳标注册列表
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @GetMapping("/eartagRegister/list")
+    @BusinessLog(title = "耳标注册_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(EartagRegisterParam eartagRegisterParam) {
+        return new SuccessResponseData(eartagRegisterService.list(eartagRegisterParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+
+    @GetMapping("/eartagRegister/export")
+    @BusinessLog(title = "耳标注册_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(EartagRegisterParam eartagRegisterParam) {
+        eartagRegisterService.export(eartagRegisterParam);
+    }
+
+}

+ 108 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/entity/EartagRegister.java

@@ -0,0 +1,108 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 耳标注册
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+
+@Data
+@TableName("eartag_register")
+public class EartagRegister{
+
+    /**
+     * 默认主键
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @Excel(name = "组织id")
+    private Long orgId;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String eartagNo;
+
+    /**
+     * 
+     */
+   // @Excel(name = "", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date registerDate;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer age;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String deviceCode;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String farmCode;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer stage;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String pigpen;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer waertagAge;
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/enums/EartagRegisterExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+
+/**
+ * 耳标注册
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum EartagRegisterExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        EartagRegisterExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 39 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/mapper/EartagRegisterMapper.java

@@ -0,0 +1,39 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 耳标注册
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+@Repository
+public interface EartagRegisterMapper extends BaseMapper<EartagRegister> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/mapper/mapping/EartagRegisterMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.eartagregister.mapper.EartagRegisterMapper">
+
+</mapper>

+ 102 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/param/EartagRegisterParam.java

@@ -0,0 +1,102 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.param;
+
+import com.huimv.core.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 耳标注册参数类
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+*/
+@Data
+public class EartagRegisterParam extends BaseParam {
+
+    /**
+     * 默认主键
+     */
+    @NotNull(message = "默认主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 组织id
+     */
+    @NotNull(message = "组织id不能为空,请检查orgId参数", groups = {add.class, edit.class})
+    private Long orgId;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查eartagNo参数", groups = {add.class, edit.class})
+    private String eartagNo;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查registerDate参数", groups = {add.class, edit.class})
+    private String registerDate;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查age参数", groups = {add.class, edit.class})
+    private Integer age;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查deviceCode参数", groups = {add.class, edit.class})
+    private String deviceCode;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查stage参数", groups = {add.class, edit.class})
+    private Integer stage;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查pigpen参数", groups = {add.class, edit.class})
+    private String pigpen;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查waertagAge参数", groups = {add.class, edit.class})
+    private Integer waertagAge;
+
+}

+ 97 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/service/EartagRegisterService.java

@@ -0,0 +1,97 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import com.huimv.modular.eartagregister.param.EartagRegisterParam;
+import java.util.List;
+
+/**
+ * 耳标注册service接口
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+public interface EartagRegisterService extends IService<EartagRegister> {
+    void updateYestdayPig();
+    /**
+     * 查询耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    PageResult<EartagRegister> page(EartagRegisterParam eartagRegisterParam);
+
+    /**
+     * 耳标注册列表
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    List<EartagRegister> list(EartagRegisterParam eartagRegisterParam);
+
+    /**
+     * 添加耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    void add(EartagRegisterParam eartagRegisterParam);
+
+    /**
+     * 删除耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    void delete(List<EartagRegisterParam> eartagRegisterParamList);
+
+    /**
+     * 编辑耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    void edit(EartagRegisterParam eartagRegisterParam);
+
+    /**
+     * 查看耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+     EartagRegister detail(EartagRegisterParam eartagRegisterParam);
+
+    /**
+     * 导出耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+     void export(EartagRegisterParam eartagRegisterParam);
+
+}

+ 172 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/eartagregister/service/impl/EartagRegisterServiceImpl.java

@@ -0,0 +1,172 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.eartagregister.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.consts.CommonConstant;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.eartagregister.entity.EartagRegister;
+import com.huimv.modular.eartagregister.enums.EartagRegisterExceptionEnum;
+import com.huimv.modular.eartagregister.mapper.EartagRegisterMapper;
+import com.huimv.modular.eartagregister.param.EartagRegisterParam;
+import com.huimv.modular.eartagregister.service.EartagRegisterService;
+import com.huimv.modular.yesterdaypig.entity.YesterdayPig;
+import com.huimv.modular.yesterdaypig.mapper.YesterdayPigMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 耳标注册service接口实现类
+ *
+ * @author 杨迪
+ * @date 2021-08-21 17:19:57
+ */
+@Service
+public class EartagRegisterServiceImpl extends ServiceImpl<EartagRegisterMapper, EartagRegister> implements EartagRegisterService {
+    @Autowired
+    private YesterdayPigMapper yesterdayPigMapper;
+    @Transactional
+    @Override
+    public void updateYestdayPig() {
+        List<EartagRegister> list = this.list();
+        yesterdayPigMapper.delete(null);
+        for (EartagRegister eartagRegister : list) {
+            YesterdayPig yesterdayPig = new YesterdayPig();
+            BeanUtil.copyProperties(eartagRegister,yesterdayPig);
+            yesterdayPigMapper.insert(yesterdayPig);
+        }
+
+    }
+    @Override
+    public PageResult<EartagRegister> page(EartagRegisterParam eartagRegisterParam) {
+        QueryWrapper<EartagRegister> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(eartagRegisterParam)) {
+
+            // 根据组织id 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getOrgId())) {
+                queryWrapper.lambda().eq(EartagRegister::getOrgId, eartagRegisterParam.getOrgId());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getEartagNo())) {
+                queryWrapper.lambda().eq(EartagRegister::getEartagNo, eartagRegisterParam.getEartagNo());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getRegisterDate())) {
+                queryWrapper.lambda().eq(EartagRegister::getRegisterDate, eartagRegisterParam.getRegisterDate());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getAge())) {
+                queryWrapper.lambda().eq(EartagRegister::getAge, eartagRegisterParam.getAge());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getDeviceCode())) {
+                queryWrapper.lambda().eq(EartagRegister::getDeviceCode, eartagRegisterParam.getDeviceCode());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getFarmCode())) {
+                queryWrapper.lambda().eq(EartagRegister::getFarmCode, eartagRegisterParam.getFarmCode());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getStage())) {
+                queryWrapper.lambda().eq(EartagRegister::getStage, eartagRegisterParam.getStage());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getPigpen())) {
+                queryWrapper.lambda().eq(EartagRegister::getPigpen, eartagRegisterParam.getPigpen());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(eartagRegisterParam.getWaertagAge())) {
+                queryWrapper.lambda().eq(EartagRegister::getWaertagAge, eartagRegisterParam.getWaertagAge());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<EartagRegister> list(EartagRegisterParam eartagRegisterParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(EartagRegisterParam eartagRegisterParam) {
+        EartagRegister eartagRegister = new EartagRegister();
+        BeanUtil.copyProperties(eartagRegisterParam, eartagRegister);
+        this.save(eartagRegister);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<EartagRegisterParam> eartagRegisterParamList) {
+        eartagRegisterParamList.forEach(eartagRegisterParam -> {
+            this.removeById(eartagRegisterParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(EartagRegisterParam eartagRegisterParam) {
+        EartagRegister eartagRegister = this.queryEartagRegister(eartagRegisterParam);
+        BeanUtil.copyProperties(eartagRegisterParam, eartagRegister);
+        this.updateById(eartagRegister);
+    }
+
+    @Override
+    public EartagRegister detail(EartagRegisterParam eartagRegisterParam) {
+        return this.queryEartagRegister(eartagRegisterParam);
+    }
+
+    /**
+     * 获取耳标注册
+     *
+     * @author 杨迪
+     * @date 2021-08-21 17:19:57
+     */
+    private EartagRegister queryEartagRegister(EartagRegisterParam eartagRegisterParam) {
+        EartagRegister eartagRegister = this.getById(eartagRegisterParam.getId());
+        if (ObjectUtil.isNull(eartagRegister)) {
+            throw new ServiceException(EartagRegisterExceptionEnum.NOT_EXIST);
+        }
+        return eartagRegister;
+    }
+
+    @Override
+    public void export(EartagRegisterParam eartagRegisterParam) {
+        List<EartagRegister> list = this.list(eartagRegisterParam);
+        PoiUtil.exportExcelWithStream("SnowyEartagRegister.xls", EartagRegister.class, list);
+    }
+
+}

+ 145 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/controller/FarmAlarmNumberController.java

@@ -0,0 +1,145 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.controller;
+
+import com.huimv.modular.farmalarmnumber.param.FarmAlarmNumberParam;
+import com.huimv.modular.farmalarmnumber.service.FarmAlarmNumberService;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * alarm_number控制器
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+@RestController
+public class FarmAlarmNumberController {
+
+    @Resource
+    private FarmAlarmNumberService farmAlarmNumberService;
+
+    /**
+     * 查询alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+  //
+    @GetMapping("/farmAlarmNumber/page")
+  //  @BusinessLog(title = "alarm_number_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(FarmAlarmNumberParam farmAlarmNumberParam) {
+        return new SuccessResponseData(farmAlarmNumberService.page(farmAlarmNumberParam));
+    }
+
+    /**
+     * 添加alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+   //
+    @PostMapping("/farmAlarmNumber/add")
+  //  @BusinessLog(title = "alarm_number_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(FarmAlarmNumberParam.add.class) FarmAlarmNumberParam farmAlarmNumberParam) {
+            farmAlarmNumberService.add(farmAlarmNumberParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除alarm_number,可批量删除
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+  //
+    @PostMapping("/farmAlarmNumber/delete")
+ //   @BusinessLog(title = "alarm_number_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(FarmAlarmNumberParam.delete.class) List<FarmAlarmNumberParam> farmAlarmNumberParamList) {
+            farmAlarmNumberService.delete(farmAlarmNumberParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+   //
+    @PostMapping("/farmAlarmNumber/edit")
+   // @BusinessLog(title = "alarm_number_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(FarmAlarmNumberParam.edit.class) FarmAlarmNumberParam farmAlarmNumberParam) {
+            farmAlarmNumberService.edit(farmAlarmNumberParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+   //
+    @GetMapping("/farmAlarmNumber/detail")
+   // @BusinessLog(title = "alarm_number_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(FarmAlarmNumberParam.detail.class) FarmAlarmNumberParam farmAlarmNumberParam) {
+        return new SuccessResponseData(farmAlarmNumberService.detail(farmAlarmNumberParam));
+    }
+
+    /**
+     * alarm_number列表
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+   //
+    @GetMapping("/farmAlarmNumber/list")
+  //  @BusinessLog(title = "alarm_number_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(FarmAlarmNumberParam farmAlarmNumberParam) {
+        return new SuccessResponseData(farmAlarmNumberService.list(farmAlarmNumberParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+  //
+    @GetMapping("/farmAlarmNumber/export")
+  //  @BusinessLog(title = "alarm_number_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(FarmAlarmNumberParam farmAlarmNumberParam) {
+        farmAlarmNumberService.export(farmAlarmNumberParam);
+    }
+
+}

+ 127 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/entity/FarmAlarmNumber.java

@@ -0,0 +1,127 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * alarm_number
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+
+@Data
+@TableName("farm_alarm_number")
+public class FarmAlarmNumber {
+
+    /**
+     * 
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String farmCode;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String farmName;
+
+    /**
+     * 组织ID
+     */
+    @Excel(name = "组织ID")
+    private Long orgid;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer earHightemp;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer earLowtemp;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer envHightemp;
+
+
+    //加一个采集时间
+   // @Excel(name = "采集时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date createTime;
+
+
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer envLowtemp;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer daviceAlarm;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer diseaseAlarm;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String remark;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String remark1;
+
+}

+ 65 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/enums/FarmAlarmNumberExceptionEnum.java

@@ -0,0 +1,65 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+
+/**
+ * alarm_number
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum FarmAlarmNumberExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        FarmAlarmNumberExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 47 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/mapper/FarmAlarmNumberMapper.java

@@ -0,0 +1,47 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.huimv.modular.farmalarmnumber.entity.FarmAlarmNumber;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+ * alarm_number
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+@Repository
+public interface FarmAlarmNumberMapper extends BaseMapper<FarmAlarmNumber> {
+
+    Page<FarmAlarmNumber> findByCondition(@Param("page") IPage<FarmAlarmNumber> page, @Param(Constants.WRAPPER) LambdaQueryWrapper<FarmAlarmNumber> wrapper);
+
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/mapper/mapping/FarmAlarmNumberMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.farmalarmnumber.mapper.FarmAlarmNumberMapper">
+
+</mapper>

+ 115 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/param/FarmAlarmNumberParam.java

@@ -0,0 +1,115 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.param;
+
+
+import com.huimv.modular.pojo.base.param.BaseParam;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+* alarm_number参数类
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+*/
+@Data
+public class FarmAlarmNumberParam extends BaseParam {
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查farmName参数", groups = {add.class, edit.class})
+    private String farmName;
+
+    /**
+     * 组织ID
+     */
+    @NotNull(message = "组织ID不能为空,请检查orgid参数", groups = {add.class, edit.class})
+    private Long orgid;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查earHightemp参数", groups = {add.class, edit.class})
+    private Integer earHightemp;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查earLowtemp参数", groups = {add.class, edit.class})
+    private Integer earLowtemp;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查envHightemp参数", groups = {add.class, edit.class})
+    private Integer envHightemp;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查envLowtemp参数", groups = {add.class, edit.class})
+    private Integer envLowtemp;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查daviceAlarm参数", groups = {add.class, edit.class})
+    private Integer daviceAlarm;
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查diseaseAlarm参数", groups = {add.class, edit.class})
+    private Integer diseaseAlarm;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查remark参数", groups = {add.class, edit.class})
+    private String remark;
+
+    /**
+     * 
+     */
+    @NotBlank(message = "不能为空,请检查remark1参数", groups = {add.class, edit.class})
+    private String remark1;
+
+}

+ 99 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/service/FarmAlarmNumberService.java

@@ -0,0 +1,99 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import com.huimv.modular.farmalarmnumber.entity.FarmAlarmNumber;
+import com.huimv.modular.farmalarmnumber.param.FarmAlarmNumberParam;
+import com.huimv.modular.pojo.page.PageResult;
+
+import java.util.List;
+
+/**
+ * alarm_numberservice接口
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+public interface FarmAlarmNumberService extends IService<FarmAlarmNumber> {
+
+    /**
+     * 查询alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    PageResult<FarmAlarmNumber> page(FarmAlarmNumberParam farmAlarmNumberParam);
+
+    /**
+     * alarm_number列表
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    List<FarmAlarmNumber> list(FarmAlarmNumberParam farmAlarmNumberParam);
+
+    /**
+     * 添加alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    void add(FarmAlarmNumberParam farmAlarmNumberParam);
+
+    /**
+     * 删除alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    void delete(List<FarmAlarmNumberParam> farmAlarmNumberParamList);
+
+    /**
+     * 编辑alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    void edit(FarmAlarmNumberParam farmAlarmNumberParam);
+
+    /**
+     * 查看alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+     FarmAlarmNumber detail(FarmAlarmNumberParam farmAlarmNumberParam);
+
+    /**
+     * 导出alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+     void export(FarmAlarmNumberParam farmAlarmNumberParam);
+
+}

+ 164 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmalarmnumber/service/impl/FarmAlarmNumberServiceImpl.java

@@ -0,0 +1,164 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmalarmnumber.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.consts.CommonConstant;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.farmalarmnumber.entity.FarmAlarmNumber;
+import com.huimv.modular.farmalarmnumber.enums.FarmAlarmNumberExceptionEnum;
+import com.huimv.modular.farmalarmnumber.mapper.FarmAlarmNumberMapper;
+import com.huimv.modular.farmalarmnumber.param.FarmAlarmNumberParam;
+import com.huimv.modular.farmalarmnumber.service.FarmAlarmNumberService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * alarm_numberservice接口实现类
+ *
+ * @author yangdi
+ * @date 2021-08-23 15:12:46
+ */
+@Service
+public class FarmAlarmNumberServiceImpl extends ServiceImpl<FarmAlarmNumberMapper, FarmAlarmNumber> implements FarmAlarmNumberService {
+
+    @Override
+    public PageResult<FarmAlarmNumber> page(FarmAlarmNumberParam farmAlarmNumberParam) {
+        QueryWrapper<FarmAlarmNumber> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(farmAlarmNumberParam)) {
+
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getFarmCode())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getFarmCode, farmAlarmNumberParam.getFarmCode());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getFarmName())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getFarmName, farmAlarmNumberParam.getFarmName());
+            }
+            // 根据组织ID 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getOrgid())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getOrgid, farmAlarmNumberParam.getOrgid());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getEarHightemp())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getEarHightemp, farmAlarmNumberParam.getEarHightemp());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getEarLowtemp())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getEarLowtemp, farmAlarmNumberParam.getEarLowtemp());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getEnvHightemp())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getEnvHightemp, farmAlarmNumberParam.getEnvHightemp());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getEnvLowtemp())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getEnvLowtemp, farmAlarmNumberParam.getEnvLowtemp());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getDaviceAlarm())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getDaviceAlarm, farmAlarmNumberParam.getDaviceAlarm());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getDiseaseAlarm())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getDiseaseAlarm, farmAlarmNumberParam.getDiseaseAlarm());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getRemark())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getRemark, farmAlarmNumberParam.getRemark());
+            }
+            // 根据 查询
+            if (ObjectUtil.isNotEmpty(farmAlarmNumberParam.getRemark1())) {
+                queryWrapper.lambda().eq(FarmAlarmNumber::getRemark1, farmAlarmNumberParam.getRemark1());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<FarmAlarmNumber> list(FarmAlarmNumberParam farmAlarmNumberParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(FarmAlarmNumberParam farmAlarmNumberParam) {
+        FarmAlarmNumber farmAlarmNumber = new FarmAlarmNumber();
+        BeanUtil.copyProperties(farmAlarmNumberParam, farmAlarmNumber);
+        this.save(farmAlarmNumber);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<FarmAlarmNumberParam> farmAlarmNumberParamList) {
+        farmAlarmNumberParamList.forEach(farmAlarmNumberParam -> {
+            this.removeById(farmAlarmNumberParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(FarmAlarmNumberParam farmAlarmNumberParam) {
+        FarmAlarmNumber farmAlarmNumber = this.queryFarmAlarmNumber(farmAlarmNumberParam);
+        BeanUtil.copyProperties(farmAlarmNumberParam, farmAlarmNumber);
+        this.updateById(farmAlarmNumber);
+    }
+
+    @Override
+    public FarmAlarmNumber detail(FarmAlarmNumberParam farmAlarmNumberParam) {
+        return this.queryFarmAlarmNumber(farmAlarmNumberParam);
+    }
+
+    /**
+     * 获取alarm_number
+     *
+     * @author yangdi
+     * @date 2021-08-23 15:12:46
+     */
+    private FarmAlarmNumber queryFarmAlarmNumber(FarmAlarmNumberParam farmAlarmNumberParam) {
+        FarmAlarmNumber farmAlarmNumber = this.getById(farmAlarmNumberParam.getId());
+        if (ObjectUtil.isNull(farmAlarmNumber)) {
+            throw new ServiceException(FarmAlarmNumberExceptionEnum.NOT_EXIST);
+        }
+        return farmAlarmNumber;
+    }
+
+    @Override
+    public void export(FarmAlarmNumberParam farmAlarmNumberParam) {
+        List<FarmAlarmNumber> list = this.list(farmAlarmNumberParam);
+        PoiUtil.exportExcelWithStream("SnowyFarmAlarmNumber.xls", FarmAlarmNumber.class, list);
+    }
+
+}

+ 182 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/controller/FarmStockController.java

@@ -0,0 +1,182 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.controller;
+
+import com.huimv.core.annotion.BusinessLog;
+import com.huimv.core.annotion.Permission;
+import com.huimv.core.enums.LogAnnotionOpTypeEnum;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.pojo.response.ResponseData;
+import com.huimv.core.pojo.response.SuccessResponseData;
+import com.huimv.modular.farmstock.param.FarmStockParam;
+import com.huimv.modular.farmstock.service.FarmStockService;
+import com.huimv.modular.result.R;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 月度统计控制器
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+@RestController
+public class FarmStockController {
+
+    @Resource
+    private FarmStockService farmStockService;
+
+    /**
+     * 查询月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @GetMapping("/farmStock/page")
+    @BusinessLog(title = "月度统计_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(FarmStockParam farmStockParam) {
+        return new SuccessResponseData(farmStockService.page(farmStockParam));
+    }
+
+    /**
+     * 添加月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @PostMapping("/farmStock/add")
+    @BusinessLog(title = "月度统计_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(FarmStockParam.add.class) FarmStockParam farmStockParam) {
+            farmStockService.add(farmStockParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除月度统计,可批量删除
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @PostMapping("/farmStock/delete")
+    @BusinessLog(title = "月度统计_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(FarmStockParam.delete.class) List<FarmStockParam> farmStockParamList) {
+            farmStockService.delete(farmStockParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @PostMapping("/farmStock/edit")
+    @BusinessLog(title = "月度统计_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(FarmStockParam.edit.class) FarmStockParam farmStockParam) {
+            farmStockService.edit(farmStockParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @GetMapping("/farmStock/detail")
+    @BusinessLog(title = "月度统计_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(FarmStockParam.detail.class) FarmStockParam farmStockParam) {
+        return new SuccessResponseData(farmStockService.detail(farmStockParam));
+    }
+
+    /**
+     * 月度统计列表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @GetMapping("/farmStock/list")
+    @BusinessLog(title = "月度统计_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(FarmStockParam farmStockParam) {
+        return new SuccessResponseData(farmStockService.list(farmStockParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+
+    @GetMapping("/farmStock/export")
+    @BusinessLog(title = "月度统计_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(FarmStockParam farmStockParam) {
+        farmStockService.export(farmStockParam);
+    }
+
+
+
+    /**
+     * 列表
+     *//*
+    @RequestMapping("/list")
+    public R list(@RequestParam Map<String, Object> params){
+        PageResult pageResult = farmStockService.queryPage(params);
+
+        return R.ok().put("page", pageResult);
+    }
+
+    *//**
+     * 全部
+     *//*
+    @RequestMapping("/countAll")
+    public R countAll(@RequestParam Map<String, Object> params){
+        List list = farmStockService.countAll(params);
+        return R.ok().put("page", list);
+    }
+
+    *//**
+     * 市全部
+     *//*
+    @RequestMapping("/cityCountAll")
+    public R cityCountAll(@RequestParam Map<String, Object> params){
+        List list = farmStockService.cityCountAll(params);
+        return R.ok().put("page", list);
+    }*/
+
+
+
+}

+ 140 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/entity/FarmStock.java

@@ -0,0 +1,140 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.huimv.core.pojo.base.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.*;
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+/**
+ * 月度统计
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+@Data
+@TableName("farm_stock")
+public class FarmStock{
+
+    /**
+     * 
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 牧场代码
+     */
+    @Excel(name = "牧场代码")
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    @Excel(name = "牧场名称")
+    private String farmName;
+
+    /**
+     * 母猪总存栏
+     */
+    @Excel(name = "母猪总存栏")
+    private Integer sowTotalStock;
+
+    /**
+     * 母猪新增
+     */
+    @Excel(name = "母猪新增")
+    private Integer eartagNew;
+
+    /**
+     * 耳标离线
+     */
+    @Excel(name = "耳标离线")
+    private Integer eartagOffone;
+
+    /**
+     * 能繁母猪存栏
+     */
+    @Excel(name = "能繁母猪存栏")
+    private Integer sowStock;
+
+    /**
+     * 配怀存栏
+     */
+    @Excel(name = "配怀存栏")
+    private Integer stock1;
+
+    /**
+     * 分娩存栏
+     */
+    @Excel(name = "分娩存栏")
+    private Integer stock2;
+
+    /**
+     * 空怀存栏
+     */
+    @Excel(name = "空怀存栏")
+    private Integer stock3;
+
+    /**
+     * 后备存栏
+     */
+    @Excel(name = "后备存栏")
+    private Integer stock4;
+
+    /**
+     * 公猪存栏
+     */
+    @Excel(name = "公猪存栏")
+    private Integer stock5;
+
+    /**
+     * 月份
+     */
+    @Excel(name = "月份")
+    private Integer month;
+
+    /**
+     * 年度
+     */
+    @Excel(name = "年度")
+    private Integer year;
+
+    /**
+     * 地市代码
+     */
+    @Excel(name = "地市代码")
+    private String cityCode;
+
+    /**
+     * 区县代码
+     */
+    @Excel(name = "区县代码")
+    private String countyCode;
+
+}

+ 64 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/enums/FarmStockExceptionEnum.java

@@ -0,0 +1,64 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.enums;
+
+import com.huimv.core.annotion.ExpEnumType;
+import com.huimv.core.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.core.factory.ExpEnumCodeFactory;
+import com.huimv.sys.core.consts.SysExpEnumConstant;
+
+/**
+ * 月度统计
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum FarmStockExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        FarmStockExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 37 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/mapper/FarmStockMapper.java

@@ -0,0 +1,37 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.farmstock.entity.FarmStock;
+
+/**
+ * 月度统计
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+public interface FarmStockMapper extends BaseMapper<FarmStock> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/mapper/mapping/FarmStockMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.farmstock.mapper.FarmStockMapper">
+
+</mapper>

+ 138 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/param/FarmStockParam.java

@@ -0,0 +1,138 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.param;
+
+import com.huimv.core.pojo.base.param.BaseParam;
+import lombok.Data;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.NotBlank;
+import java.util.*;
+
+/**
+* 月度统计参数类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+*/
+@Data
+public class FarmStockParam extends BaseParam {
+
+    /**
+     * 
+     */
+    @NotNull(message = "不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class})
+    private Integer id;
+
+    /**
+     * 牧场代码
+     */
+    @NotBlank(message = "牧场代码不能为空,请检查farmCode参数", groups = {add.class, edit.class})
+    private String farmCode;
+
+    /**
+     * 牧场名称
+     */
+    @NotBlank(message = "牧场名称不能为空,请检查farmName参数", groups = {add.class, edit.class})
+    private String farmName;
+
+    /**
+     * 母猪总存栏
+     */
+    @NotNull(message = "母猪总存栏不能为空,请检查sowTotalStock参数", groups = {add.class, edit.class})
+    private Integer sowTotalStock;
+
+    /**
+     * 母猪新增
+     */
+    @NotNull(message = "母猪新增不能为空,请检查eartagNew参数", groups = {add.class, edit.class})
+    private Integer eartagNew;
+
+    /**
+     * 耳标离线
+     */
+    @NotNull(message = "耳标离线不能为空,请检查eartagOffone参数", groups = {add.class, edit.class})
+    private Integer eartagOffone;
+
+    /**
+     * 能繁母猪存栏
+     */
+    @NotNull(message = "能繁母猪存栏不能为空,请检查sowStock参数", groups = {add.class, edit.class})
+    private Integer sowStock;
+
+    /**
+     * 配怀存栏
+     */
+    @NotNull(message = "配怀存栏不能为空,请检查stock1参数", groups = {add.class, edit.class})
+    private Integer stock1;
+
+    /**
+     * 分娩存栏
+     */
+    @NotNull(message = "分娩存栏不能为空,请检查stock2参数", groups = {add.class, edit.class})
+    private Integer stock2;
+
+    /**
+     * 空怀存栏
+     */
+    @NotNull(message = "空怀存栏不能为空,请检查stock3参数", groups = {add.class, edit.class})
+    private Integer stock3;
+
+    /**
+     * 后备存栏
+     */
+    @NotNull(message = "后备存栏不能为空,请检查stock4参数", groups = {add.class, edit.class})
+    private Integer stock4;
+
+    /**
+     * 公猪存栏
+     */
+    @NotNull(message = "公猪存栏不能为空,请检查stock5参数", groups = {add.class, edit.class})
+    private Integer stock5;
+
+    /**
+     * 月份
+     */
+    @NotNull(message = "月份不能为空,请检查month参数", groups = {add.class, edit.class})
+    private Integer month;
+
+    /**
+     * 年度
+     */
+    @NotNull(message = "年度不能为空,请检查year参数", groups = {add.class, edit.class})
+    private Integer year;
+
+    /**
+     * 地市代码
+     */
+    @NotBlank(message = "地市代码不能为空,请检查cityCode参数", groups = {add.class, edit.class})
+    private String cityCode;
+
+    /**
+     * 区县代码
+     */
+    @NotBlank(message = "区县代码不能为空,请检查countyCode参数", groups = {add.class, edit.class})
+    private String countyCode;
+
+}

+ 106 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/service/FarmStockService.java

@@ -0,0 +1,106 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.modular.farmstock.entity.FarmStock;
+import com.huimv.modular.farmstock.param.FarmStockParam;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 月度统计service接口
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+public interface FarmStockService extends IService<FarmStock> {
+
+    /**
+     * 查询月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    PageResult<FarmStock> page(FarmStockParam farmStockParam);
+
+    /**
+     * 月度统计列表
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    List<FarmStock> list(FarmStockParam farmStockParam);
+
+    /**
+     * 添加月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    void add(FarmStockParam farmStockParam);
+
+    /**
+     * 删除月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    void delete(List<FarmStockParam> farmStockParamList);
+
+    /**
+     * 编辑月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    void edit(FarmStockParam farmStockParam);
+
+    /**
+     * 查看月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+     FarmStock detail(FarmStockParam farmStockParam);
+
+    /**
+     * 导出月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+     void export(FarmStockParam farmStockParam);
+//
+//    PageResult queryPage(Map<String, Object> params);
+//
+//
+//
+//    List countAll(Map<String, Object> params);
+//
+//    List cityCountAll(Map<String, Object> params);
+
+}

+ 190 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/farmstock/service/impl/FarmStockServiceImpl.java

@@ -0,0 +1,190 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.farmstock.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.Query;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huimv.core.consts.CommonConstant;
+import com.huimv.core.enums.CommonStatusEnum;
+import com.huimv.core.exception.ServiceException;
+import com.huimv.core.factory.PageFactory;
+import com.huimv.core.pojo.page.PageResult;
+import com.huimv.core.util.PoiUtil;
+import com.huimv.modular.farmstock.entity.FarmStock;
+import com.huimv.modular.farmstock.enums.FarmStockExceptionEnum;
+import com.huimv.modular.farmstock.mapper.FarmStockMapper;
+import com.huimv.modular.farmstock.param.FarmStockParam;
+import com.huimv.modular.farmstock.service.FarmStockService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 月度统计service接口实现类
+ *
+ * @author yinhao
+ * @date 2021-08-17 14:45:39
+ */
+@Service
+public class FarmStockServiceImpl extends ServiceImpl<FarmStockMapper, FarmStock> implements FarmStockService {
+
+    @Override
+    public PageResult<FarmStock> page(FarmStockParam farmStockParam) {
+        QueryWrapper<FarmStock> queryWrapper = new QueryWrapper<>();
+        if (ObjectUtil.isNotNull(farmStockParam)) {
+
+            // 根据牧场代码 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getFarmCode())) {
+                queryWrapper.lambda().eq(FarmStock::getFarmCode, farmStockParam.getFarmCode());
+            }
+            // 根据牧场名称 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getFarmName())) {
+                queryWrapper.lambda().eq(FarmStock::getFarmName, farmStockParam.getFarmName());
+            }
+            // 根据母猪总存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getSowTotalStock())) {
+                queryWrapper.lambda().eq(FarmStock::getSowTotalStock, farmStockParam.getSowTotalStock());
+            }
+            // 根据母猪新增 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getEartagNew())) {
+                queryWrapper.lambda().eq(FarmStock::getEartagNew, farmStockParam.getEartagNew());
+            }
+            // 根据耳标离线 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getEartagOffone())) {
+                queryWrapper.lambda().eq(FarmStock::getEartagOffone, farmStockParam.getEartagOffone());
+            }
+            // 根据能繁母猪存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getSowStock())) {
+                queryWrapper.lambda().eq(FarmStock::getSowStock, farmStockParam.getSowStock());
+            }
+            // 根据配怀存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getStock1())) {
+                queryWrapper.lambda().eq(FarmStock::getStock1, farmStockParam.getStock1());
+            }
+            // 根据分娩存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getStock2())) {
+                queryWrapper.lambda().eq(FarmStock::getStock2, farmStockParam.getStock2());
+            }
+            // 根据空怀存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getStock3())) {
+                queryWrapper.lambda().eq(FarmStock::getStock3, farmStockParam.getStock3());
+            }
+            // 根据后备存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getStock4())) {
+                queryWrapper.lambda().eq(FarmStock::getStock4, farmStockParam.getStock4());
+            }
+            // 根据公猪存栏 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getStock5())) {
+                queryWrapper.lambda().eq(FarmStock::getStock5, farmStockParam.getStock5());
+            }
+            // 根据月份 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getMonth())) {
+                queryWrapper.lambda().eq(FarmStock::getMonth, farmStockParam.getMonth());
+            }
+            // 根据年度 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getYear())) {
+                queryWrapper.lambda().eq(FarmStock::getYear, farmStockParam.getYear());
+            }
+            // 根据地市代码 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getCityCode())) {
+                queryWrapper.lambda().eq(FarmStock::getCityCode, farmStockParam.getCityCode());
+            }
+            // 根据区县代码 查询
+            if (ObjectUtil.isNotEmpty(farmStockParam.getCountyCode())) {
+                queryWrapper.lambda().eq(FarmStock::getCountyCode, farmStockParam.getCountyCode());
+            }
+        }
+        return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
+    }
+
+    @Override
+    public List<FarmStock> list(FarmStockParam farmStockParam) {
+        return this.list();
+    }
+
+    @Override
+    public void add(FarmStockParam farmStockParam) {
+        FarmStock farmStock = new FarmStock();
+        BeanUtil.copyProperties(farmStockParam, farmStock);
+        this.save(farmStock);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(List<FarmStockParam> farmStockParamList) {
+        farmStockParamList.forEach(farmStockParam -> {
+            this.removeById(farmStockParam.getId());
+        });
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(FarmStockParam farmStockParam) {
+        FarmStock farmStock = this.queryFarmStock(farmStockParam);
+        BeanUtil.copyProperties(farmStockParam, farmStock);
+        this.updateById(farmStock);
+    }
+
+    @Override
+    public FarmStock detail(FarmStockParam farmStockParam) {
+        return this.queryFarmStock(farmStockParam);
+    }
+
+    /**
+     * 获取月度统计
+     *
+     * @author yinhao
+     * @date 2021-08-17 14:45:39
+     */
+    private FarmStock queryFarmStock(FarmStockParam farmStockParam) {
+        FarmStock farmStock = this.getById(farmStockParam.getId());
+        if (ObjectUtil.isNull(farmStock)) {
+            throw new ServiceException(FarmStockExceptionEnum.NOT_EXIST);
+        }
+        return farmStock;
+    }
+
+    @Override
+    public void export(FarmStockParam farmStockParam) {
+        List<FarmStock> list = this.list(farmStockParam);
+        PoiUtil.exportExcelWithStream("SnowyFarmStock.xls", FarmStock.class, list);
+    }
+
+
+
+
+}

+ 146 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/controller/HeartBeatRecordController.java

@@ -0,0 +1,146 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.heartbeatrecord.controller;
+
+
+import com.huimv.modular.heartbeatrecord.param.HeartBeatRecordParam;
+import com.huimv.modular.heartbeatrecord.service.HeartBeatRecordService;
+import com.huimv.modular.pojo.response.ResponseData;
+import com.huimv.modular.pojo.response.SuccessResponseData;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 基站心跳控制器
+ *
+ * @author haohao
+ * @date 2021-08-20 11:00:36
+ */
+@RestController
+public class HeartBeatRecordController {
+
+    @Resource
+    private HeartBeatRecordService heartBeatRecordService;
+
+    /**
+     * 查询基站心跳
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+    //@Permission
+    @GetMapping("/heartBeatRecord/page")
+   /*/ @BusinessLog(title = "基站心跳_查询", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData page(HeartBeatRecordParam heartBeatRecordParam) {
+        return new SuccessResponseData(heartBeatRecordService.page(heartBeatRecordParam));
+    }
+
+    /**
+     * 添加基站心跳
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+   //
+    @PostMapping("/heartBeatRecord/add")
+  //  @BusinessLog(title = "基站心跳_增加", opType = LogAnnotionOpTypeEnum.ADD)
+    public ResponseData add(@RequestBody @Validated(HeartBeatRecordParam.add.class) HeartBeatRecordParam heartBeatRecordParam) {
+            heartBeatRecordService.add(heartBeatRecordParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 删除基站心跳,可批量删除
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+  //
+    @PostMapping("/heartBeatRecord/delete")
+   // @BusinessLog(title = "基站心跳_删除", opType = LogAnnotionOpTypeEnum.DELETE)
+    public ResponseData delete(@RequestBody @Validated(HeartBeatRecordParam.delete.class) List<HeartBeatRecordParam> heartBeatRecordParamList) {
+            heartBeatRecordService.delete(heartBeatRecordParamList);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 编辑基站心跳
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+   //
+    @PostMapping("/heartBeatRecord/edit")
+  //  @BusinessLog(title = "基站心跳_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
+    public ResponseData edit(@RequestBody @Validated(HeartBeatRecordParam.edit.class) HeartBeatRecordParam heartBeatRecordParam) {
+            heartBeatRecordService.edit(heartBeatRecordParam);
+        return new SuccessResponseData();
+    }
+
+    /**
+     * 查看基站心跳
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+   //
+    @GetMapping("/heartBeatRecord/detail")
+   // @BusinessLog(title = "基站心跳_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
+    public ResponseData detail(@Validated(HeartBeatRecordParam.detail.class) HeartBeatRecordParam heartBeatRecordParam) {
+        return new SuccessResponseData(heartBeatRecordService.detail(heartBeatRecordParam));
+    }
+
+    /**
+     * 基站心跳列表
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+   //
+    @GetMapping("/heartBeatRecord/list")
+  //  @BusinessLog(title = "基站心跳_列表", opType = LogAnnotionOpTypeEnum.QUERY)
+    public ResponseData list(HeartBeatRecordParam heartBeatRecordParam) {
+        return new SuccessResponseData(heartBeatRecordService.list(heartBeatRecordParam));
+    }
+
+    /**
+     * 导出系统用户
+     *
+     * @author haohao
+     * @date 2021-08-20 11:00:36
+     */
+  //
+    @GetMapping("/heartBeatRecord/export")
+   // @BusinessLog(title = "基站心跳_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
+    public void export(HeartBeatRecordParam heartBeatRecordParam) {
+        heartBeatRecordService.export(heartBeatRecordParam);
+    }
+
+}

+ 106 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/entity/HeartBeatRecord.java

@@ -0,0 +1,106 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.heartbeatrecord.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import com.huimv.modular.pojo.base.entity.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.*;
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+/**
+ * 基站心跳
+ *
+ * @author haohao
+ * @date 2021-08-20 11:00:36
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@TableName("heart_beat_record")
+public class HeartBeatRecord extends BaseEntity {
+
+    /**
+     * 
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String head;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String deviceCode;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private Integer cmd;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String checkNo;
+
+    /**
+     * 
+     */
+    @Excel(name = "")
+    private String tail;
+
+    /**
+     * 地县编码
+     */
+    @Excel(name = "地县编码")
+    private String countyCode;
+
+    /**
+     * 牧场编码
+     */
+    @Excel(name = "牧场编码")
+    private String farmCode;
+
+    /**
+     * 猪舍id
+     */
+    @Excel(name = "猪舍id")
+    private String pigpenId;
+
+    /**
+     * 单元id
+     */
+    @Excel(name = "单元id")
+    private String unitId;
+
+}

+ 63 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/enums/HeartBeatRecordExceptionEnum.java

@@ -0,0 +1,63 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.heartbeatrecord.enums;
+
+
+import com.huimv.modular.exception.enums.abs.AbstractBaseExceptionEnum;
+import com.huimv.modular.factory.ExpEnumCodeFactory;
+
+/**
+ * 基站心跳
+ *
+ * @author haohao
+ * @date 2021-08-20 11:00:36
+ */
+//@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
+public enum HeartBeatRecordExceptionEnum implements AbstractBaseExceptionEnum {
+
+    /**
+     * 数据不存在
+     */
+    NOT_EXIST(1, "此数据不存在");
+
+    private final Integer code;
+
+    private final String message;
+        HeartBeatRecordExceptionEnum(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    @Override
+    public Integer getCode() {
+        return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+}

+ 39 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/mapper/HeartBeatRecordMapper.java

@@ -0,0 +1,39 @@
+/*
+Copyright [2020] [https://www.xiaonuo.vip]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
+
+1.请不要删除和修改根目录下的LICENSE文件。
+2.请不要删除和修改Snowy源码头部的版权声明。
+3.请保留源码和相关描述文件的项目出处,作者声明等。
+4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy
+6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
+ */
+package com.huimv.modular.heartbeatrecord.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huimv.modular.heartbeatrecord.entity.HeartBeatRecord;
+import org.springframework.stereotype.Repository;
+
+/**
+ * 基站心跳
+ *
+ * @author haohao
+ * @date 2021-08-20 11:00:36
+ */
+@Repository
+public interface HeartBeatRecordMapper extends BaseMapper<HeartBeatRecord> {
+}

+ 5 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/mapper/mapping/HeartBeatRecordMapper.xml

@@ -0,0 +1,5 @@
+<?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="com.huimv.modular.heartbeatrecord.mapper.HeartBeatRecordMapper">
+
+</mapper>

+ 0 - 0
huimv-smart-incubator/cloud-platform-mobile/src/main/java/com/huimv/modular/heartbeatrecord/param/HeartBeatRecordParam.java


Some files were not shown because too many files changed in this diff