Browse Source

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis-background

# Conflicts:
#	gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Alertrule2Mapper.java
#	gyee-sample-impala/src/main/java/com/gyee/impala/model/slave/Alertrule2.java
#	gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/slave/Alertrule2Service.java
#	gyee-sample-impala/src/main/resources/mapper/slave/Alertrule2Mapper.xml
chenminghua 2 years ago
parent
commit
f15c08a0ff
100 changed files with 3268 additions and 116 deletions
  1. 1 4
      gyee-sample-impala/src/main/java/com/gyee/impala/FaultFilterMain.java
  2. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/base/PageInfo.java
  3. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/InfoCache.java
  4. 73 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/PointUnitCache.java
  5. 34 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/StationCache.java
  6. 49 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/WindturbineCache.java
  7. 119 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/AjaxResult.java
  8. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/GyeeConfig.java
  9. 0 2
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/DecisionDataSourceConfig.java
  10. 4 2
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/KuduDataSourceConfig.java
  11. 2 13
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/MasterDataSourceConfig.java
  12. 13 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/SlaveDataSourceConfig.java
  13. 0 2
      gyee-sample-impala/src/main/java/com/gyee/impala/common/constant/Constants.java
  14. 0 2
      gyee-sample-impala/src/main/java/com/gyee/impala/common/exception/AdviceException.java
  15. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/feign/IShardingService.java
  16. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/spring/DecisionConvert.java
  17. 12 3
      gyee-sample-impala/src/main/java/com/gyee/impala/common/spring/InitialRunner.java
  18. 15 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ChineseDes.java
  19. 7 2
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ExcelUtil.java
  20. 224 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ExcelUtil2.java
  21. 0 5
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/FileUtil.java
  22. 92 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/LogService.java
  23. 91 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ResponseWrapper.java
  24. 530 0
      gyee-sample-impala/src/main/java/com/gyee/impala/common/util/StringUtil.java
  25. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/AlarmHistoryController.java
  26. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/DiagnoseFaultController.java
  27. 0 3
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/DiagnoseReportController.java
  28. 0 3
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/GearboxDiagnosisController.java
  29. 4 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/ServerparamController.java
  30. 4 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/SupervisedController.java
  31. 2 2
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/TrainFaultDiagnoseController.java
  32. 3 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/TrainFaultPredictController.java
  33. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/WindspeedforecastspshorttermController.java
  34. 4 2
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/test/TrainDataController.java
  35. 4 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/analyse/AnalyseScatterController.java
  36. 3 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/analyse/PowerCurveController.java
  37. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/cases/CaseWarningController.java
  38. 2 3
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/know/KnowBasicController.java
  39. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/know/WindturbinePointController.java
  40. 40 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/AlertRuleEventLogController.java
  41. 216 8
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/Alertrule2Controller.java
  42. 391 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/DeviceController.java
  43. 159 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/DeviceFaultModeController.java
  44. 191 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/InfoController.java
  45. 189 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/ScadabjController.java
  46. 42 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/TestingPointDIController.java
  47. 188 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/Warning2Controller.java
  48. 37 0
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/WindpowerstationController.java
  49. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/CasefaultMapper.java
  50. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowalgMapper.java
  51. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowcategoryMapper.java
  52. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowfaultfixMapper.java
  53. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowfaultsymptomMapper.java
  54. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/PowercurvefittingMapper.java
  55. 3 2
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindpowerstationMapper.java
  56. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbineMapper.java
  57. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbinemetricsMapper.java
  58. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbinepointMapper.java
  59. 53 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Alertrule2Mapper.java
  60. 16 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DatadictionaryMapper.java
  61. 29 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceFaultModeMapper.java
  62. 14 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceMapper.java
  63. 35 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceMetricsMapper.java
  64. 21 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceModelMapper.java
  65. 25 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceModelMetricsMapper.java
  66. 24 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceStructureMapper.java
  67. 21 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/RuleUpdateEventInfoMapper.java
  68. 16 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/RuleUpdateEventMapper.java
  69. 24 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/ScadabjMapper.java
  70. 17 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/StationInfoMapper.java
  71. 21 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/StationMapper.java
  72. 23 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/TestingPointAIMapper.java
  73. 28 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/TestingPointDIMapper.java
  74. 24 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Warning2Mapper.java
  75. 16 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WarningClassifyMapper.java
  76. 16 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WarningTypeMapper.java
  77. 15 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindTurbineTestingPointAiMapper.java
  78. 15 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindTurbineTestingPointDiMapper.java
  79. 16 0
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindturbinePartsMapper.java
  80. 0 2
      gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Windturbinetestingpointai2Mapper.java
  81. 0 2
      gyee-sample-impala/src/main/java/com/gyee/impala/model/custom/TsDoubleData.java
  82. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Collectorwireproject.java
  83. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Mv.java
  84. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Windplantproject.java
  85. 4 3
      gyee-sample-impala/src/main/java/com/gyee/impala/model/gdoa/EqEquipment.java
  86. 4 3
      gyee-sample-impala/src/main/java/com/gyee/impala/model/gdoa/EqJxjl.java
  87. 2 4
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Casefault.java
  88. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Casefaultalg.java
  89. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Caseperformance.java
  90. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowalg.java
  91. 2 4
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowcategory.java
  92. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultfix.java
  93. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultprocess.java
  94. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultsymptom.java
  95. 1 0
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Powercurvebasic.java
  96. 10 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windpowerstation.java
  97. 2 3
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbine.java
  98. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbinemetrics.java
  99. 2 1
      gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbinepoint.java
  100. 0 0
      gyee-sample-impala/src/main/java/com/gyee/impala/model/slave/Alertrule2.java

+ 1 - 4
gyee-sample-impala/src/main/java/com/gyee/impala/FaultFilterMain.java

@@ -10,9 +10,6 @@ import feign.Request;
 import feign.Retryer;
 import feign.jackson.JacksonDecoder;
 import feign.jackson.JacksonEncoder;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -20,8 +17,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.sql.*;
-import java.util.*;
 import java.util.Date;
+import java.util.*;
 import java.util.stream.Collectors;
 
 public class FaultFilterMain {

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/base/PageInfo.java

@@ -3,7 +3,6 @@ package com.gyee.impala.common.base;
 import lombok.Data;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/InfoCache.java

@@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 

+ 73 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/PointUnitCache.java

@@ -0,0 +1,73 @@
+package com.gyee.impala.common.cache;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.common.collect.Lists;
+import com.gyee.impala.mapper.slave.DeviceMetricsMapper;
+import com.gyee.impala.mapper.slave.DeviceModelMetricsMapper;
+import com.gyee.impala.model.slave.DeviceMetrics;
+import com.gyee.impala.model.slave.DeviceModelMetrics;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @description: 缓存风机型号,统一编码,测点值单位等
+ * @auther: Wanghs
+ * @date: 2022-02-28
+ */
+@Component
+public class PointUnitCache {
+
+    @Autowired
+    private DeviceModelMetricsMapper deviceModelMetricsMapper;
+    @Autowired
+    private DeviceMetricsMapper deviceMetricsMapper;
+
+    //key1=风机型号,valye1=测点集合,key2为测点统一编码,value2 DeviceMetrics
+    private Map<String, Map<String, DeviceMetrics>> modelMap = new HashMap<>();
+
+    public Map<String, DeviceMetrics> getMapByModel(String model) {
+        if (modelMap.size() <= 0) {
+
+            //获取所有风机型号以及统一编码
+            List<DeviceModelMetrics> modelList = deviceModelMetricsMapper.getAll();
+            //根据风机型号分组
+            Map<String, List<DeviceModelMetrics>> collect = modelList.stream().collect(Collectors.groupingBy(DeviceModelMetrics::getDevicemodel));
+            for (String key :
+                    collect.keySet()) {
+                List<String> metricCodeList = collect.get(key).stream().map(s -> s.getMetriccode()).collect(Collectors.toList());
+
+                List<List<String>> partition = Lists.partition(metricCodeList, 800);
+                List<DeviceMetrics> list=new ArrayList<>();
+                for (List<String> codeList:
+                     partition) {
+                    QueryWrapper wrapper = new QueryWrapper<DeviceMetrics>();
+                    wrapper.in("METRICCODE", codeList);
+                    list.addAll(deviceMetricsMapper.selectList(wrapper))  ;
+
+                }
+
+                Map<String, DeviceMetrics> metricsMap = new HashMap<>();
+                for (DeviceModelMetrics metrics :
+                        collect.get(key)) {
+
+                    Optional<DeviceMetrics> first = list.stream().filter(s -> s.getMetriccode().equals(metrics.getMetriccode())).findFirst();
+                    if (first.isPresent())
+                        metricsMap.put(metrics.getUniformcode(), first.get());
+
+                }
+                if (!modelMap.containsKey(key))
+                    modelMap.put(key, metricsMap);
+            }
+
+        }
+
+        if (modelMap.containsKey(model))
+            return modelMap.get(model);
+        else
+            return null;
+
+    }
+}

+ 34 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/StationCache.java

@@ -0,0 +1,34 @@
+package com.gyee.impala.common.cache;
+
+
+import com.gyee.impala.common.spring.SpringContextUtil;
+import com.gyee.impala.model.master.Windpowerstation;
+import com.gyee.impala.service.master.WindpowerstationService;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-04-02
+ */
+public class StationCache {
+
+    static List<Windpowerstation> stationList = new ArrayList<>();
+
+    public static String getStationName(String stationId) {
+        if (stationList.size() <= 0) {
+
+            WindpowerstationService bean = SpringContextUtil.getBean(WindpowerstationService.class);
+            List<Windpowerstation> lst = bean.getAll();
+            stationList = lst;
+        }
+        Optional<Windpowerstation> first = stationList.stream().filter(s -> s.getId().equals(stationId)).findFirst();
+        if (first.isPresent())
+            return first.get().getName();
+        else
+            return null;
+    }
+}

+ 49 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/cache/WindturbineCache.java

@@ -0,0 +1,49 @@
+package com.gyee.impala.common.cache;
+
+import com.gyee.impala.model.master.Windturbine;
+import com.gyee.impala.service.master.WindturbineService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-03-17
+ */
+@Component
+public class WindturbineCache {
+
+    @Autowired
+    private WindturbineService windturbineService;
+
+    private List<Windturbine> windturbineList=new ArrayList<>();
+
+
+    private void initWindturbineList(){
+        List<Windturbine> windturbines = windturbineService.list();
+
+        windturbineList=windturbines;
+    }
+
+    public List<Windturbine> getWindturbineList(){
+        if(windturbineList.size()<=0)
+            initWindturbineList();
+        return this.windturbineList;
+    }
+
+    public Windturbine getWindturbine(String windturbineId){
+        if(windturbineList.size()<=0)
+            initWindturbineList();
+
+        Optional<Windturbine> first = windturbineList.stream().filter(s -> s.getId().equals(windturbineId)).findFirst();
+
+        if(first.isPresent())
+            return first.get();
+        else
+            return  null;
+    }
+}

+ 119 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/AjaxResult.java

@@ -0,0 +1,119 @@
+package com.gyee.impala.common.config;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+* @ClassName: AjaxResult
+* @Description: TODO(ajax操作消息提醒)
+* @author gyee
+* @date 2018年8月18日
+*
+ */
+public class AjaxResult extends HashMap<String, Object>
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 初始化一个新创建的 Message 对象
+     */
+    public AjaxResult()
+    {
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @return 错误消息
+     */
+    public static AjaxResult error()
+    {
+        return error(1, "操作失败");
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param msg 内容
+     * @return 错误消息
+     */
+    public static AjaxResult error(String msg)
+    {
+        return error(500, msg);
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param code 错误码
+     * @param msg 内容
+     * @return 错误消息
+     */
+    public static AjaxResult error(int code, String msg)
+    {
+        AjaxResult json = new AjaxResult();
+        json.put("code", code);
+        json.put("msg", msg);
+        return json;
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @param msg 内容
+     * @return 成功消息
+     */
+    public static AjaxResult success(String msg)
+    {
+        AjaxResult json = new AjaxResult();
+        json.put("msg", msg);
+        json.put("code", 200);
+        return json;
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @return 成功消息
+     */
+    public static AjaxResult success()
+    {
+        return AjaxResult.success("操作成功");
+    }
+
+    public static AjaxResult successData(Object value){
+        AjaxResult json = new AjaxResult();
+        json.put("code", 200);
+        json.put("data", value);
+        return json;
+    }
+
+    public static AjaxResult successData(int code, Object value){
+        AjaxResult json = new AjaxResult();
+        json.put("code", code);
+        json.put("data", value);
+        return json;
+    }
+
+    public static <T> AjaxResult successData(List<Entry<String, List<T>>> list) {
+        AjaxResult json = new AjaxResult();
+        json.put("code", 200);
+        json.put("data", list);
+        return json;
+    }
+
+
+    /**
+     * 返回成功消息
+     *
+     * @param key 键值
+     * @param value 内容
+     * @return 成功消息
+     */
+    @Override
+    public AjaxResult put(String key, Object value)
+    {
+        super.put(key, value);
+        return this;
+    }
+}

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/GyeeConfig.java

@@ -2,7 +2,6 @@ package com.gyee.impala.common.config;
 
 import com.gyee.impala.common.util.JudeSystem;
 import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 

+ 0 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/DecisionDataSourceConfig.java

@@ -1,9 +1,7 @@
 package com.gyee.impala.common.config.datasource;
 
 
-import com.baomidou.mybatisplus.core.MybatisConfiguration;
 import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import org.apache.ibatis.logging.stdout.StdOutImpl;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.mybatis.spring.SqlSessionTemplate;
 import org.mybatis.spring.annotation.MapperScan;

+ 4 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/KuduDataSourceConfig.java

@@ -1,10 +1,12 @@
 package com.gyee.impala.common.config.datasource;
 
 import com.gyee.impala.common.config.GyeeConfig;
-import com.gyee.impala.common.config.jsch.JSchConfig;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.kudu.client.*;
+import org.apache.kudu.client.KuduClient;
+import org.apache.kudu.client.KuduException;
+import org.apache.kudu.client.KuduSession;
+import org.apache.kudu.client.SessionConfiguration;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.stereotype.Component;

+ 2 - 13
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/MasterDataSourceConfig.java

@@ -1,8 +1,6 @@
 package com.gyee.impala.common.config.datasource;
 
-import com.baomidou.mybatisplus.annotation.DbType;
 import com.baomidou.mybatisplus.core.MybatisConfiguration;
-import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
 import org.apache.ibatis.logging.stdout.StdOutImpl;
 import org.apache.ibatis.session.SqlSessionFactory;
@@ -44,9 +42,9 @@ public class MasterDataSourceConfig {
     public SqlSessionFactory masterSqlSessionFactory(@Qualifier("master") DataSource dataSource) throws Exception {
         MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
         sessionFactoryBean.setDataSource(dataSource);
-        /*MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
+        MybatisConfiguration mybatisConfiguration = new MybatisConfiguration();
         mybatisConfiguration.setLogImpl(StdOutImpl.class);
-        sessionFactoryBean.setConfiguration(mybatisConfiguration);*/
+        sessionFactoryBean.setConfiguration(mybatisConfiguration);
         sessionFactoryBean.setMapperLocations(
                 new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/master/*.xml"));
 
@@ -60,13 +58,4 @@ public class MasterDataSourceConfig {
         return new SqlSessionTemplate(sessionFactory);
     }
 
-    /**
-     * 分页插件
-     */
-    @Bean
-    public PaginationInterceptor paginationInterceptor() {
-        PaginationInterceptor page = new PaginationInterceptor();
-        page.setDbType(DbType.MYSQL);
-        return page;
-    }
 }

+ 13 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/SlaveDataSourceConfig.java

@@ -1,5 +1,7 @@
 package com.gyee.impala.common.config.datasource;
 
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
 import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.mybatis.spring.SqlSessionTemplate;
@@ -30,7 +32,7 @@ public class SlaveDataSourceConfig {
     public SqlSessionFactory slaveSqlSessionFactory(@Qualifier("slave") DataSource dataSource) throws Exception {
         MybatisSqlSessionFactoryBean sessionFactoryBean = new MybatisSqlSessionFactoryBean();
         sessionFactoryBean.setDataSource(dataSource);
-
+        sessionFactoryBean.setPlugins(paginationInterceptor());
         sessionFactoryBean.setMapperLocations(
                 new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/slave/*.xml"));
 
@@ -42,4 +44,14 @@ public class SlaveDataSourceConfig {
             @Qualifier("slaveSqlSessionFactory") SqlSessionFactory sessionFactory) {
         return new SqlSessionTemplate(sessionFactory);
     }
+
+    /**
+     * 分页插件
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        PaginationInterceptor page = new PaginationInterceptor();
+        page.setDbType(DbType.ORACLE);
+        return page;
+    }
 }

+ 0 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/common/constant/Constants.java

@@ -1,8 +1,6 @@
 package com.gyee.impala.common.constant;
 
 import lombok.extern.slf4j.Slf4j;
-import java.util.ArrayList;
-import java.util.List;
 
 
 @Slf4j

+ 0 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/common/exception/AdviceException.java

@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.gyee.impala.common.result.JsonResult;
 import com.gyee.impala.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/feign/IShardingService.java

@@ -4,7 +4,6 @@ package com.gyee.impala.common.feign;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.impala.model.custom.diagnose.FaultInfo;
-import feign.Headers;
 import feign.Param;
 import feign.RequestLine;
 

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/spring/DecisionConvert.java

@@ -16,7 +16,6 @@ import com.gyee.impala.model.decision.Wtur;
 import com.gyee.impala.model.master.Windturbine;
 import com.gyee.impala.model.slave.Line;
 import com.gyee.impala.model.slave.Project;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;

+ 12 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/common/spring/InitialRunner.java

@@ -1,10 +1,16 @@
 package com.gyee.impala.common.spring;
 
 
-import com.gyee.impala.model.master.*;
+import com.gyee.impala.model.master.Equipmentmodel;
+import com.gyee.impala.model.master.Knowcategory;
+import com.gyee.impala.model.master.Windpowerstation;
+import com.gyee.impala.model.master.Windturbine;
 import com.gyee.impala.model.master.diagnose.Diagnosepoint;
 import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
-import com.gyee.impala.service.master.*;
+import com.gyee.impala.service.master.EquipmentmodelService;
+import com.gyee.impala.service.master.KnowcategoryService;
+import com.gyee.impala.service.master.WindpowerstationService;
+import com.gyee.impala.service.master.WindturbineService;
 import com.gyee.impala.service.master.diagnose.DiagnosepointService;
 import com.gyee.impala.service.master.diagnose.DiagnosetrainhistoryService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +19,10 @@ import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**

+ 15 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ChineseDes.java

@@ -0,0 +1,15 @@
+package com.gyee.impala.common.util;
+
+import java.lang.annotation.*;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-04-02
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface ChineseDes {
+    String value()default "";
+}

+ 7 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ExcelUtil.java

@@ -8,8 +8,13 @@ import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.util.StringUtils;
 
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  */

+ 224 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ExcelUtil2.java

@@ -0,0 +1,224 @@
+package com.gyee.impala.common.util;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class ExcelUtil2 {
+
+    public static void createExcel(List<String> header, List<String[]> data, OutputStream out) throws IOException {
+        // 创建一个Excel文件
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        // 创建一个工作表
+        HSSFSheet sheet = workbook.createSheet("sheet1");
+        // 添加表头行
+        HSSFRow hssfRow = sheet.createRow(0);
+        // 设置单元格格式居中
+        HSSFCellStyle cellStyle = workbook.createCellStyle();
+
+        // 添加表头内容
+        for (int i = 0; i < header.size(); i++) {
+            HSSFCell headCell = hssfRow.createCell(i);
+            headCell.setCellValue(header.get(i));
+            headCell.setCellStyle(cellStyle);
+        }
+
+        // 添加数据内容
+        for (int i = 0; i < data.size(); i++) {
+            String[] strings = data.get(i);
+            hssfRow = sheet.createRow(i + 1);
+            for (int j = 0; j < strings.length; j++) {
+                HSSFCell cell = hssfRow.createCell(j);
+                cell.setCellValue(strings[j]);
+                cell.setCellStyle(cellStyle);
+            }
+        }
+        //单元格自适应
+        sheet.autoSizeColumn(2,true);
+        // 保存Excel文件
+        workbook.write(out);
+    }
+
+    public static void createExcel(String title,List<String> header, List<String[]> data, OutputStream out) throws IOException {
+        // 创建一个Excel文件
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        // 创建一个工作表
+        HSSFSheet sheet = workbook.createSheet("sheet1");
+        // 添加表头行
+        HSSFRow hssfRow = sheet.createRow(0);
+        HSSFCell cellTitle = hssfRow.createCell(0);
+        // 设置标题外的单元格格式居中
+        HSSFCellStyle cellStyle = workbook.createCellStyle();
+        //设置标题的样式
+        HSSFCellStyle titleCellStyle = workbook.createCellStyle();
+        //设置标题字体的样式
+        HSSFFont font = workbook.createFont();
+        font.setFontHeightInPoints((short) 12);//设置字体大小
+        titleCellStyle.setFont(font);
+        //标题设置(四个参数分别表示起始行,终止行,起始列,终止列)
+        cellTitle.setCellValue(title);
+        int lastCol = header.size() > 1 ? header.size() : 2;
+        CellRangeAddress region1 = new CellRangeAddress(0, 1, (short) 0, (short) lastCol - 1);
+        sheet.addMergedRegion(region1);
+        hssfRow = sheet.createRow(1);
+        hssfRow = sheet.createRow(2);
+        cellTitle.setCellStyle(titleCellStyle);
+        // 添加表头内容
+        for (int i = 0; i < header.size(); i++) {
+            HSSFCell headCell = hssfRow.createCell(i);
+            headCell.setCellValue(header.get(i));
+            headCell.setCellStyle(cellStyle);
+        }
+
+        // 添加数据内容
+        for (int i = 0; i < data.size(); i++) {
+            String[] strings = data.get(i);
+            hssfRow = sheet.createRow(i + 3);
+            for (int j = 0; j < strings.length; j++) {
+                HSSFCell cell = hssfRow.createCell(j);
+                cell.setCellValue(strings[j]);
+                cell.setCellStyle(cellStyle);
+            }
+        }
+
+        // 保存Excel文件
+        workbook.write(out);
+    }
+
+    /**
+     * 读取Excel的内容
+     *
+     * @param fileType 文件类型,xls或xlsx
+     * @param startRows 开始读取行数,比喻行头不需要读入 忽略的行数为1
+     * @param ignoreRowBlank 是否忽略空行
+     * @param is 文件输入流
+     * @return 读出的Excel中数据的内容
+     * @throws IOException duxxxxx
+     */
+    public static List<String[]> readData(String fileType, int startRows, boolean ignoreRowBlank, InputStream is) throws IOException {
+        List<String[]> result = new ArrayList<>();
+
+        Workbook wb = readExcel(fileType, is);
+        for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
+            Sheet sheet = wb.getSheetAt(sheetIndex);
+
+            for (int rowIndex = startRows, z = sheet.getLastRowNum(); rowIndex <= z; rowIndex++) {
+                Row row = sheet.getRow(rowIndex);
+                if (row == null) {
+                    continue;
+                }
+
+                int rowSize = sheet.getRow(0).getLastCellNum();
+                String[] values = new String[rowSize];
+                boolean hasValue = false;
+                for (int columnIndex = 0; columnIndex < rowSize; columnIndex++) {
+                    String value = "";
+                    Cell cell = row.getCell(columnIndex);
+                    if (cell != null) {
+                        // 注意:一定要设成这个,否则可能会出现乱码,后面版本默认设置
+                        switch (cell.getCellType()) {
+                            case HSSFCell.CELL_TYPE_STRING:
+                                value = cell.getStringCellValue();
+                                break;
+                            case HSSFCell.CELL_TYPE_NUMERIC:
+                                if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                                    Date date = cell.getDateCellValue();
+                                    if (date != null) {
+                                        value = new SimpleDateFormat("yyyy-MM-dd")
+                                                .format(date);
+                                    } else {
+                                        value = "";
+                                    }
+                                } else {
+                                    //value = new DecimalFormat("0").format(cell.getNumericCellValue());
+                                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                                        value = String.valueOf(cell.getDateCellValue());
+                                    } else {
+                                        cell.setCellType(Cell.CELL_TYPE_STRING);
+                                        String temp = cell.getStringCellValue();
+                                        // 判断是否包含小数点,如果不含小数点,则以字符串读取,如果含小数点,则转换为Double类型的字符串
+                                        if (temp.indexOf(".") > -1) {
+                                            value = String.valueOf(new Double(temp)).trim();
+                                        } else {
+                                            value = temp.trim();
+                                        }
+                                    }
+                                }
+                                break;
+                            case HSSFCell.CELL_TYPE_FORMULA:
+                                // 导入时如果为公式生成的数据则无值
+                                if (!cell.getStringCellValue().equals("")) {
+                                    value = cell.getStringCellValue();
+                                } else {
+                                    value = cell.getNumericCellValue() + "";
+                                }
+                                break;
+                            case HSSFCell.CELL_TYPE_BLANK:
+                                break;
+                            case HSSFCell.CELL_TYPE_ERROR:
+                                value = "";
+                                break;
+                            case HSSFCell.CELL_TYPE_BOOLEAN:
+                                value = (cell.getBooleanCellValue() == true ? "Y"
+
+                                        : "N");
+                                break;
+                            default:
+                                value = "";
+                        }
+                    }
+                    values[columnIndex] = value;
+                    if (!value.isEmpty()) {
+                        hasValue = true;
+                    }
+                }
+                if (!ignoreRowBlank || hasValue) {//不为忽略空行模式或不为空行
+                    result.add(values);
+                }
+            }
+        }
+        return result;
+    }
+
+    //读取excel
+    private static Workbook readExcel(String fileType, InputStream is) throws IOException {
+        if ("xls".equals(fileType)) {
+            return new HSSFWorkbook(is);
+        } else if ("xlsx".equals(fileType)) {
+            return new XSSFWorkbook(is);
+        } else {
+            throw new IllegalArgumentException("不支持的文件类型,仅支持xls和xlsx");
+        }
+    }
+
+    /**
+     * 去掉字符串右边的空格
+     *
+     * @param str 要处理的字符串
+     * @return 处理后的字符串
+     */
+    private static String rightTrim(String str) {
+        if (str == null) {
+            return "";
+        }
+        int length = str.length();
+        for (int i = length - 1; i >= 0; i--) {
+            if (str.charAt(i) != 0x20) {
+                break;
+            }
+            length--;
+        }
+        return str.substring(0, length);
+    }
+}

+ 0 - 5
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/FileUtil.java

@@ -3,16 +3,11 @@ package com.gyee.impala.common.util;
 import com.gyee.impala.common.exception.CustomException;
 import com.gyee.impala.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.UrlResource;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.net.MalformedURLException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
-import java.nio.file.Path;
-import java.util.List;
 
 @Slf4j
 public class FileUtil {

+ 92 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/LogService.java

@@ -0,0 +1,92 @@
+package com.gyee.impala.common.util;
+
+import com.alibaba.fastjson.JSON;
+import com.gyee.impala.model.slave.Alertrule2;
+import com.gyee.impala.model.slave.Scadabj;
+import com.gyee.impala.model.slave.Warning2;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @descrition:日志记录工具
+ * @author:Wanghs
+ * @date:2020-04-23
+ */
+@Component
+
+public class LogService {
+    Logger log = LogManager.getLogger("dataChangeLogger");
+    //自定义报警--更新数据
+    public void alertRuleUpdateLog(Alertrule2 oldData, Alertrule2 newData, String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+         Date nowTime=new Date();
+        log.info(format.format(nowTime)+"自定义报警数据更新-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String oldDataString= JSON.toJSONString(oldData);
+        log.info("原数据:"+oldDataString);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("-----------------------------------------------------------------------");
+    }
+    //自定义报警--添加数据
+    public void alertRuleAddLog(Alertrule2 newData,String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date nowTime=new Date();
+        log.info(format.format(nowTime)+"自定义报警数据新增-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("-----------------------------------------------------------------------");
+
+    }
+
+    //风机报警--更新数据
+    public void windturbineUpdateLog(Warning2 oldData, Warning2 newData, String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date nowTime=new Date();
+        log.info(format.format(nowTime)+"风机报警数据更新-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String oldDataString= JSON.toJSONString(oldData);
+        log.info("原数据:"+oldDataString);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("---------------------------------------------------------------------");
+    }
+    //风机报警--添加数据
+    public void windturbineAddLog(Warning2 newData, String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date nowTime=new Date();
+        log.info(format.format(nowTime)+"风机报警数据新增-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("-----------------------------------------------------------------------");
+    }
+    //升压站报警--更新数据
+    public void scadaUpdateLog(Scadabj oldData, Scadabj newData, String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date nowTime=new Date();
+        log.info(format.format(nowTime)+"升压站报警数据更新-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String oldDataString= JSON.toJSONString(oldData);
+        log.info("原数据:"+oldDataString);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("-----------------------------------------------------------------------");
+    }
+    //升压站报警--添加数据
+    public void scadaAddLog(Scadabj newData, String userName){
+        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date nowTime=new Date();
+        log.info(format.format(nowTime)+"升压站报警数据新增-----------------------------------------------------");
+        log.info("操作人:"+userName);
+        String newDataString=JSON.toJSONString(newData);
+        log.info("新数据:"+newDataString);
+        log.info("-----------------------------------------------------------------------");
+    }
+}

+ 91 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/ResponseWrapper.java

@@ -0,0 +1,91 @@
+package com.gyee.impala.common.util;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+
+@Data
+public class ResponseWrapper<T> implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Boolean success;
+    private Integer status;
+    private Integer count;
+    private String msg;
+    private T data;
+    private static final int STATUS_SUCCESS = 20000;
+    private static final int STATUS_ERROR = 50000;
+    public static final int STATUS_ERROR_SYSTEM = 50100;
+
+    private String token;
+
+    public ResponseWrapper() {
+    }
+
+    private ResponseWrapper(Boolean success, Integer status, Integer count, String msg, Class entityType, T data) {
+        this.success = success;
+        this.status = status;
+        this.count = count;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    private ResponseWrapper(Boolean success, Integer status, Integer count, String msg, T data) {
+        this.success = success;
+        this.status = status;
+        this.count = count;
+        this.msg = msg;
+        this.data = data;
+    }
+
+    public static ResponseWrapper success(int count, String msg, Object data) {
+        if (data != null) {
+            return data instanceof Collection ? new ResponseWrapper(true, 20000, ((Collection)data).size(), msg, data) : new ResponseWrapper(true, 20000, count, msg, data);
+        } else {
+            return count == -1 ? new ResponseWrapper(true, 20000, -1, msg, msg) : new ResponseWrapper(true, 20000, count, msg, count);
+        }
+    }
+
+    public static ResponseWrapper success(String msg, int count, Object data) {
+        return new ResponseWrapper(true, 20000, count, msg, data);
+    }
+
+    public static ResponseWrapper success(int count, String msg) {
+        return success(count, msg, (Object)null);
+    }
+
+    public static ResponseWrapper success(int count) {
+        return success(count, "count");
+    }
+
+    public static ResponseWrapper success(String msg) {
+        return success(-1, msg);
+    }
+
+    public ResponseWrapper<T> success(T data) {
+        this.data = data;
+        return this;
+    }
+
+    public static ResponseWrapper success(String msg, Object data) {
+        return success(1, msg, data);
+    }
+
+    public static ResponseWrapper error(String msg, Object data, int status) {
+        return new ResponseWrapper(false, status, 0, msg, data.getClass(), data);
+    }
+
+    public static ResponseWrapper error(String msg, Object data) {
+        return new ResponseWrapper(false, 50000, 0, msg, data.getClass(), data);
+    }
+
+    public static ResponseWrapper error(String msg, int status) {
+        return new ResponseWrapper(false, status, -1, msg, String.class, msg);
+    }
+
+    public static ResponseWrapper error(String msg) {
+        return error(msg, 50000);
+    }
+
+
+}

+ 530 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/common/util/StringUtil.java

@@ -0,0 +1,530 @@
+package com.gyee.impala.common.util;
+
+
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * 字符串工具类
+ * 
+ * @author fc
+ */
+public class StringUtil extends org.apache.commons.lang3.StringUtils
+{
+    /** 空字符串 */
+    private static final String NULLSTR = "";
+
+    /** 下划线 */
+    private static final char SEPARATOR = '_';
+
+    /**
+     * 获取参数不为空值
+     * 
+     * @param value defaultValue 要判断的value
+     * @return value 返回值
+     */
+    public static <T> T nvl(T value, T defaultValue)
+    {
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * * 判断一个Collection是否为空, 包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Collection<?> coll)
+    {
+        return isNull(coll) || coll.isEmpty();
+    }
+
+    /**
+     * * 判断一个Collection是否非空,包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Collection<?> coll)
+    {
+        return !isEmpty(coll);
+    }
+    public static int roundToInt(double num) {
+
+        return new BigDecimal(num).setScale(0, RoundingMode.HALF_UP).intValue();
+    }
+    /**
+     * * 判断一个对象数组是否为空
+     * 
+     * @param objects 要判断的对象数组
+     ** @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Object[] objects)
+    {
+        return isNull(objects) || (objects.length == 0);
+    }
+
+    /**
+     * * 判断一个对象数组是否非空
+     * 
+     * @param objects 要判断的对象数组
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Object[] objects)
+    {
+        return !isEmpty(objects);
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Map<?, ?> map)
+    {
+        return isNull(map) || map.isEmpty();
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Map<?, ?> map)
+    {
+        return !isEmpty(map);
+    }
+
+    /**
+     * * 判断一个字符串是否为空串
+     * 
+     * @param str String
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(String str)
+    {
+        return isNull(str) || NULLSTR.equals(str.trim());
+    }
+
+    /**
+     * * 判断一个字符串是否为非空串
+     * 
+     * @param str String
+     * @return true:非空串 false:空串
+     */
+    public static boolean isNotEmpty(String str)
+    {
+        return !isEmpty(str);
+    }
+
+    /**
+     * * 判断一个对象是否为空
+     * 
+     * @param object Object
+     * @return true:为空 false:非空
+     */
+    public static boolean isNull(Object object)
+    {
+        return object == null;
+    }
+
+    /**
+     * * 判断一个对象是否非空
+     * 
+     * @param object Object
+     * @return true:非空 false:空
+     */
+    public static boolean isNotNull(Object object)
+    {
+        return !isNull(object);
+    }
+
+    /**
+     * * 判断一个对象是否是数组类型(Java基本型别的数组)
+     * 
+     * @param object 对象
+     * @return true:是数组 false:不是数组
+     */
+    public static boolean isArray(Object object)
+    {
+        return isNotNull(object) && object.getClass().isArray();
+    }
+
+    /**
+     * 去空格
+     */
+    public static String trim(String str)
+    {
+        return (str == null ? "" : str.trim());
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @return 结果
+     */
+    public static String substring(final String str, int start)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (start > str.length())
+        {
+            return NULLSTR;
+        }
+
+        return str.substring(start);
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @param end 结束
+     * @return 结果
+     */
+    public static String substring(final String str, int start, int end)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (end < 0)
+        {
+            end = str.length() + end;
+        }
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (end > str.length())
+        {
+            end = str.length();
+        }
+
+        if (start > end)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (end < 0)
+        {
+            end = 0;
+        }
+
+        return str.substring(start, end);
+    }
+
+
+
+
+    /**
+     * 驼峰命名转下划线 nameVc>>name_vc
+     */
+    public static String toUnderScoreCase(String s)
+    {
+        if (s == null)
+        {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean upperCase = false;
+        for (int i = 0; i < s.length(); i++)
+        {
+            char c = s.charAt(i);
+
+            boolean nextUpperCase = true;
+
+            if (i < (s.length() - 1))
+            {
+                nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
+            }
+
+            if ((i > 0) && Character.isUpperCase(c))
+            {
+                if (!upperCase || !nextUpperCase)
+                {
+                    sb.append(SEPARATOR);
+                }
+                upperCase = true;
+            }
+            else
+            {
+                upperCase = false;
+            }
+
+            sb.append(Character.toLowerCase(c));
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 是否包含字符串
+     * 
+     * @param str 验证字符串
+     * @param strs 字符串组
+     * @return 包含返回true
+     */
+    public static boolean inStringIgnoreCase(String str, String... strs)
+    {
+        if (str != null && strs != null)
+        {
+            for (String s : strs)
+            {
+                if (str.equalsIgnoreCase(trim(s)))
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+   
+    
+    /**
+     * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
+     * 
+     * @param name 转换前的下划线大写方式命名的字符串
+     * @return 转换后的驼峰式命名的字符串
+     */
+    public static String convertToCamelCase(String name)
+    {
+        StringBuilder result = new StringBuilder();
+        // 快速检查
+        if (name == null || name.isEmpty())
+        {
+            // 没必要转换
+            return "";
+        }
+        else if (!name.contains("_"))
+        {
+            // 不含下划线,仅将首字母大写
+            return name.substring(0, 1).toUpperCase() + name.substring(1);
+        }
+        // 用下划线将原始字符串分割
+        String[] camels = name.split("_");
+        for (String camel : camels)
+        {
+            // 跳过原始字符串中开头、结尾的下换线或双重下划线
+            if (camel.isEmpty())
+            {
+                continue;
+            }
+            // 首字母大写
+            result.append(camel.substring(0, 1).toUpperCase());
+            result.append(camel.substring(1).toLowerCase());
+        }
+        return result.toString();
+    }
+    /**
+     * 首字母大写
+     *
+     * @param name
+     * @return
+     */
+    public static String firstUpperCase(String name) {
+        name = name.substring(0, 1).toUpperCase() + name.substring(1);
+        return name;
+    }
+    /**
+     * 首字母小写
+     *
+     * @param name
+     * @return
+     */
+    public static String firstLowerCase(String name) {
+        name = name.substring(0, 1).toLowerCase() + name.substring(1);
+        return name;
+
+    }
+    
+    /**
+     * 将下划线转化为大写
+     *
+     * @param name
+     * @param firstCase 首字母是否大写 true:大写 false;小写
+     * @return
+     */
+    public static String upperCase_(String name, boolean firstCase) {
+        if(isEmpty(name)){
+            return "";
+        }
+        String[] s = name.split("_");
+        StringBuffer stringBuffer = new StringBuffer();
+        for (String s1 : s) {
+            stringBuffer.append(s1.substring(0, 1).toUpperCase() + s1.substring(1));
+        }
+        if(!firstCase){
+            return firstLowerCase(stringBuffer.toString());
+        }
+        return stringBuffer.toString();
+    }
+    
+    /**
+     * get方法名字转成 t_b_abc>>tBAbc
+     * @param str
+     * @return
+     * @author gyee
+     * @Date 2020年1月30日 下午11:55:54
+     */
+    public static String toFUNName(String str) {
+    	StringBuffer buffer=new StringBuffer();
+    	String name=str;
+    	if(name.contains("_")) {
+    		// 用下划线将原始字符串分割
+            String[] camels = name.split("_");
+            boolean b=true;
+            
+            for (String str1 : camels) {
+            	if(str1.length()==1&&b) {
+            		b=false;
+            		buffer.append(str1);
+            	}else {
+            		buffer.append(StringUtil.firstUpperCase(str1));
+            	}
+				
+			}
+    	}else {
+    		buffer.append(StringUtil.firstUpperCase(name));
+    	}
+		return buffer.toString();
+    }
+
+
+    /**
+     * 是否不为空串
+     *
+     * @param obj
+     * @return
+     */
+    public static boolean notEmp(Object obj) {
+        return !empty(obj);
+    }
+
+    /**
+     * 是否为空串
+     *
+     * @param obj
+     * @return
+     */
+    public static boolean empty(Object obj) {
+        if (obj == null)
+            return true;
+        String str;
+        if (obj instanceof String) {
+            str = (String) obj;
+        } else {
+            str = obj.toString();
+        }
+        return str.length() == 0;
+    }
+
+    public static double round(double num, int digit) {
+
+        return new BigDecimal(num).setScale(digit, RoundingMode.HALF_UP).doubleValue();
+    }
+    /**
+     * 将字符串解析为Date类型
+     *
+     * @param date
+     * @param pattern
+     * @return
+     */
+    public static Date toDate(String date, String pattern) {
+        SimpleDateFormat format = new SimpleDateFormat(pattern);
+        try {
+            return format.parse(date);
+        } catch (ParseException e) {
+            throw new RuntimeException(String.format("Failed to parse the String [%s] to Date.", date), e);
+        }
+    }
+    /**
+     *
+     * @方法名称: getUUID
+     * @描述: 获得UUID
+     * @参数 @return
+     * @返回值 String
+     * @抛出异常
+     */
+    public static String getUUID() {
+        String s = UUID.randomUUID().toString();
+        // 去掉“-”符号
+        return s.substring(0, 8) + s.substring(9, 13) + s.substring(14, 18) + s.substring(19, 23) + s.substring(24);
+    }
+
+    /**
+     * 判断是否为数字字符串
+     * @param str
+     * @return
+     */
+    public static boolean isNumeric(String str){
+        Pattern pattern = Pattern.compile("^(-?\\d+)(\\.\\d+)?$");
+        if(notEmp(str))
+        {
+            Matcher isNum = pattern.matcher(str);
+            if( !isNum.matches() ){
+                return false;
+            }
+
+        }else
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+
+    /**
+     * 正则表达式
+     * @param input     需要匹配的字符串
+     * @param expression 正则表达公式
+     * @return
+     */
+    public static List<String> pattern(String input, String expression){
+        // 创建 Pattern 对象
+        Pattern p = Pattern.compile(expression);
+        Matcher m = p.matcher(input);
+
+        ArrayList list = new ArrayList();
+        while (m.find()) {
+            list.add(m.group(0));
+        }
+        //去除重复值
+        HashSet hs=new HashSet(list);
+        list.clear();
+        list.addAll(hs);
+
+        return list;
+    }
+}

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/AlarmHistoryController.java

@@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.*;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 报警历史

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/DiagnoseFaultController.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.gyee.impala.common.feign.RemoteServiceBuilder;
 import com.gyee.impala.common.result.JsonResult;
 import com.gyee.impala.common.result.ResultCode;
-import com.gyee.impala.common.util.DateUtil;
 import com.gyee.impala.model.custom.diagnose.FaultInfo;
 import com.gyee.impala.model.master.Casefaultalg;
 import com.gyee.impala.service.custom.diagnose.AutoCmdService;

+ 0 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/DiagnoseReportController.java

@@ -11,12 +11,10 @@ import com.gyee.impala.model.custom.diagnose.DataInfo;
 import com.gyee.impala.model.custom.diagnose.PointData;
 import com.gyee.impala.model.custom.diagnose.TrainPointWeight;
 import com.gyee.impala.model.master.Casefaultalg;
-import com.gyee.impala.model.master.diagnose.Diagnosepoint;
 import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
 import com.gyee.impala.service.custom.diagnose.AlarmService;
 import com.gyee.impala.service.master.CasefaultalgService;
 import com.gyee.impala.service.master.diagnose.DiagnosereportService;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -24,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.*;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 /**

+ 0 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/GearboxDiagnosisController.java

@@ -9,13 +9,10 @@ import com.gyee.impala.model.custom.diagnose.History;
 import com.gyee.impala.model.master.diagnose.AlgorithmType;
 import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
 import com.gyee.impala.service.master.diagnose.DiagnosetrainhistoryService;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
 import java.util.List;
 
 /**

+ 4 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/ServerparamController.java

@@ -7,7 +7,10 @@ import com.gyee.impala.common.result.ResultCode;
 import com.gyee.impala.model.master.diagnose.Serverparam;
 import com.gyee.impala.service.master.diagnose.ServerparamService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 

+ 4 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/SupervisedController.java

@@ -14,7 +14,10 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**

+ 2 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/TrainFaultDiagnoseController.java

@@ -11,10 +11,10 @@ import com.gyee.impala.model.master.Casefault;
 import com.gyee.impala.model.master.diagnose.Diagnosepoint;
 import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
 import com.gyee.impala.model.master.diagnose.TrainInfo;
+import com.gyee.impala.service.custom.diagnose.CmdFaultDiagnoseService;
 import com.gyee.impala.service.custom.diagnose.DataDiagnoseService;
-import com.gyee.impala.service.master.CasefaultService;
 import com.gyee.impala.service.custom.diagnose.TrainDataModeService;
-import com.gyee.impala.service.custom.diagnose.CmdFaultDiagnoseService;
+import com.gyee.impala.service.master.CasefaultService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.kudu.client.ListTablesResponse;
 import org.springframework.beans.factory.annotation.Autowired;

+ 3 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/TrainFaultPredictController.java

@@ -12,8 +12,8 @@ import com.gyee.impala.model.master.Casefault;
 import com.gyee.impala.model.master.diagnose.Diagnosepoint;
 import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
 import com.gyee.impala.model.master.diagnose.TrainInfo;
+import com.gyee.impala.service.custom.diagnose.CmdFaultPredictService;
 import com.gyee.impala.service.custom.diagnose.DataPredictService;
-import com.gyee.impala.service.custom.diagnose.CmdFaultPredictService;;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -27,6 +27,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
+;
+
 /**
  * 故障预测模型训练
  */

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/WindspeedforecastspshorttermController.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.impala.common.result.JsonResult;
 import com.gyee.impala.common.result.ResultCode;
-import com.gyee.impala.model.master.Windspeedforecastshortterm;
 import com.gyee.impala.model.master.Windspeedforecastspshortterm;
 import com.gyee.impala.service.master.IWindspeedforecastspshorttermService;
 import org.apache.commons.lang3.StringUtils;

+ 4 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/test/TrainDataController.java

@@ -9,11 +9,13 @@ import com.gyee.impala.model.custom.diagnose.DataInfo;
 import com.gyee.impala.model.custom.diagnose.ExecuteInfo;
 import com.gyee.impala.model.master.Casefaultalg;
 import com.gyee.impala.model.master.diagnose.Diagnosepoint;
-import com.gyee.impala.model.master.diagnose.Diagnosetrainhistory;
 import com.gyee.impala.service.custom.diagnose.DataDiagnoseService;
 import com.gyee.impala.service.master.CasefaultalgService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Calendar;
 import java.util.HashMap;

+ 4 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/analyse/AnalyseScatterController.java

@@ -13,7 +13,10 @@ import com.gyee.impala.service.slave.WindturbinewindyawService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 功率曲线拟合样本库

+ 3 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/analyse/PowerCurveController.java

@@ -11,7 +11,9 @@ import com.gyee.impala.service.master.PowercurvefittingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.List;
 
 
 /**

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/cases/CaseWarningController.java

@@ -7,7 +7,6 @@ import com.gyee.impala.common.spring.InitialRunner;
 import com.gyee.impala.model.custom.AlertHistory;
 import com.gyee.impala.model.master.Casewarningcustom;
 import com.gyee.impala.model.master.Casewarningscada;
-import com.gyee.impala.model.master.Powercurvebasic;
 import com.gyee.impala.service.custom.WarningService;
 import com.gyee.impala.service.master.CasewarningcustomService;
 import com.gyee.impala.service.master.CasewarningscadaService;

+ 2 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/know/KnowBasicController.java

@@ -6,19 +6,18 @@ import com.gyee.impala.common.result.JsonResult;
 import com.gyee.impala.common.result.ResultCode;
 import com.gyee.impala.common.spring.InitialRunner;
 import com.gyee.impala.common.util.DateUtil;
+import com.gyee.impala.model.master.Knowcategory;
 import com.gyee.impala.model.master.Knowfaultfix;
 import com.gyee.impala.model.master.Knowfaultsymptom;
-import com.gyee.impala.model.master.Knowcategory;
 import com.gyee.impala.model.master.Knowinspectrecord;
+import com.gyee.impala.service.master.KnowcategoryService;
 import com.gyee.impala.service.master.KnowfaultfixService;
 import com.gyee.impala.service.master.KnowfaultsymptomService;
-import com.gyee.impala.service.master.KnowcategoryService;
 import com.gyee.impala.service.master.KnowinspectService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Date;
 import java.util.List;
 
 /**

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/know/WindturbinePointController.java

@@ -4,7 +4,6 @@ package com.gyee.impala.controller.sample.know;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.impala.common.result.JsonResult;
 import com.gyee.impala.common.result.ResultCode;
-import com.gyee.impala.model.master.Casefault;
 import com.gyee.impala.model.master.Windturbinepoint;
 import com.gyee.impala.service.custom.GoldenService;
 import com.gyee.impala.service.master.WindturbinepointService;

+ 40 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/AlertRuleEventLogController.java

@@ -0,0 +1,40 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.RuleUpdateEvent;
+import com.gyee.impala.service.impl.slave.RuleUpdateEventService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @description: 报警规则日志
+ * @auther: Wanghs
+ * @date: 2022-04-01
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("/rulevent")
+@CrossOrigin
+public class AlertRuleEventLogController {
+    @Autowired
+    private RuleUpdateEventService ruleUpdateEventService;
+
+    @GetMapping("/page")
+    public ResponseWrapper getRuleEventLog(
+            @RequestParam(value = "pagenum",required = true) Integer pageNum,
+            @RequestParam(value = "pagesize",required = true) Integer pageSize,
+            @RequestParam(value = "ruleName",required = false) String ruleName,
+            @RequestParam(value = "ruleType",required = false) String ruleType
+
+
+            ) {
+        Page<RuleUpdateEvent> page = new Page<RuleUpdateEvent>(pageNum,pageSize);
+
+        IPage updateEventByPage = ruleUpdateEventService.getUpdateEventByPage(page, ruleName,ruleType);
+        return ResponseWrapper.success("请求成功",updateEventByPage);
+    }
+}

+ 216 - 8
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/Alertrule2Controller.java

@@ -1,20 +1,228 @@
 package com.gyee.impala.controller.sample.warning;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.common.util.ExcelUtil2;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.Alertrule2;
+import com.gyee.impala.service.impl.slave.Alertrule2Service;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 
-/**
- * 自定义规则接口
- */
 @Slf4j
 @RestController
 @RequestMapping("/alertrule2")
 @CrossOrigin
 public class Alertrule2Controller {
 
-//    @Autowired
-//    private Alertrule2Service alertrule2Service;
+    @Autowired
+    private Alertrule2Service alertrule2Service;
+
+    @GetMapping(value = "/list")
+    public List<Alertrule2> queryTree() {
+        List<Alertrule2> alertrules = alertrule2Service.queryTree();
+        return alertrules;
+    }
+
+    @GetMapping(value = "/map")
+    public List<Map<String, Alertrule2>> queryMap() {
+        List<Map<String, Alertrule2>> alertrules = alertrule2Service.queryMap();
+        return alertrules;
+    }
+
+
+    @PostMapping(value = "/save")
+    @ResponseBody
+    public ResponseWrapper<Alertrule2> saveAlertrule2(HttpServletRequest request, @RequestBody Alertrule2 alertrule2) {
+
+        ResponseWrapper<Alertrule2> wrapper = dataCheck(alertrule2);
+        if (wrapper.getSuccess()) {
+            int result = alertrule2Service.saveAndUpdateAlertrule2(alertrule2);
+            if (result <= 0) {
+                if(result==-999)
+                {
+                    wrapper.setMsg("报警规则id生成错误,请联系管理员");
+                }
+                else {
+                    wrapper.setMsg("操作数据库失败");
+                }
+
+                wrapper.setSuccess(false);
+            }else{
+                wrapper.success("操作成功");
+            }
+        }
+        return wrapper;
+
+    }
+
+    @DeleteMapping(value = "/delete")
+    public int deleteAlertrule2(Alertrule2 alertrule2) {
+        return alertrule2Service.deleteAlertrule2(alertrule2);
+    }
+
+    @GetMapping(value = "/page")
+    public IPage<Alertrule2> queryByPage(
+            @RequestParam(value = "pagenum") Integer pageNum,
+            @RequestParam(value = "pagesize") Integer pageSize,
+            @RequestParam(value = "name", required = false) String name,
+            @RequestParam(value = "station", required = false) String station,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "rank", required = false) String rank,
+            @RequestParam(value = "category", required = false) String category,
+            @RequestParam(value = "enabled",required = false) String enabled,
+            @RequestParam(value = "relatedparts",required = false) String relatedparts
+    ) {
+        Page<Alertrule2> page = new Page(pageNum, pageSize);
+        IPage<Alertrule2> pageResult = alertrule2Service.pageQueryAll(page, name,station,modelId,rank,category,enabled,relatedparts);
+
+        return pageResult;
+    }
+
+    private ResponseWrapper<Alertrule2> dataCheck(Alertrule2 alertrule) {
+        ResponseWrapper<Alertrule2> wrapper = null;
+        String msg = "";
+        boolean result = true;
+        if (StringUtils.isBlank(alertrule.getName())) {
+            msg = "报警名称不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getDescription())) {
+            msg = "规则描述不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getExpression())) {
+            msg = "报警规则不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getRank())) {
+            msg = "报警级别不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getEnabled()+"")) {
+            msg = "是否可用不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getStation())) {
+            msg = "风场不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(alertrule.getCategory())) {
+            msg = "报警类别不能为空";
+            result = false;
+        }
+        if (alertrule.getCategory().equals("1")) {
+            if (StringUtils.isBlank(alertrule.getModelId())) {
+                msg = "风机型号不能为空";
+                result = false;
+            }
+        }
+
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, alertrule);
+        } else {
+            wrapper = ResponseWrapper.error(msg, alertrule);
+        }
+        return wrapper;
+    }
+
+    @PostMapping(value = "/save-batch")
+    @ResponseBody
+    public ResponseWrapper<Alertrule2> saveAlertrule2Batch(HttpServletRequest request,@RequestBody List<Alertrule2> lst) {
+
+        boolean allCheck = true;
+        ResponseWrapper<Alertrule2> wrapper = null;
+        for (Alertrule2 alertRule : lst) {
+            wrapper = dataCheck(alertRule);
+            if (wrapper.getSuccess() != true) {
+                allCheck = false;
+                String msg = wrapper.getMsg();
+                wrapper.setMsg(alertRule.getName() + ":" + msg);
+                break;
+            }
+        }
+        if (allCheck) {
+            for (Alertrule2 alertRule : lst) {
+                int result = alertrule2Service.saveAndUpdateAlertrule2(alertRule);
+                if (result <= 0) {
+                    wrapper.setMsg(alertRule.getName() + ":" + "操作数据库失败");
+                    wrapper.setSuccess(false);
+                    break;
+                }
+            }
+            return wrapper;
+        } else {
+            return wrapper;
+        }
+
+
+    }
+
+
+    @PostMapping(value ="/import")
+    @ResponseBody
+    public ResponseWrapper<Alertrule2> importAlertrule(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+        ResponseWrapper<Alertrule2> wrapper = null;
+        boolean allCheck = true;
+        if (!file.isEmpty()) {
+            try {
+                //获取原始的文件名
+                String originalFilename = file.getOriginalFilename();
+                //获取文件类型
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                //默认从第一行开始读取
+                Integer startRows = 1;
+                //获取输入流
+                InputStream is = file.getInputStream();
+                List<Alertrule2> bindingList = new ArrayList<>();
+                //Excel导入导出的单元类
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                //遍历Excel表每一行的数据
+                for (String[] str : strings) {
+                    Alertrule2 alertrule2 = new Alertrule2();
+                    alertrule2.setId(str[0]);
+                    alertrule2.setName(str[1]);
+                    alertrule2.setCategory(str[2]);
+                    alertrule2.setRank(str[3]);
+                    alertrule2.setEnabled(Integer.parseInt(str[4]));
+                    alertrule2.setStation(str[5]);
+                    alertrule2.setModelId(str[6]);
+                    alertrule2.setRelatedParts(str[7]);
+                    alertrule2.setExpression(str[8]);
+                    alertrule2.setDescription(str[9]);
+                    bindingList.add(alertrule2);
+                }
+                for (Alertrule2 alertRule : bindingList) {
+                    wrapper = dataCheck(alertRule);
+                    if (wrapper.getSuccess() != true) {
+                        allCheck = false;
+                        String msg = wrapper.getMsg();
+                        wrapper.setMsg(alertRule.getName() + ":" + msg);
+                        break;
+                    }
+                }
+                if (allCheck) {
+                    for (Alertrule2 alertRule : bindingList) {
+                        int result = alertrule2Service.saveAndUpdateAlertrule2(alertRule);
+                        if (result <= 0) {
+                            wrapper.setMsg(alertRule.getName() + ":" + "操作数据库失败");
+                            wrapper.setSuccess(false);
+                            break;
+                        }else {
+                            wrapper.setMsg("批量导入成功");
+                            wrapper.setSuccess(true);
+                        }
+                    }
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return wrapper;
+    }
 }

+ 391 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/DeviceController.java

@@ -0,0 +1,391 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.common.config.AjaxResult;
+import com.gyee.impala.common.util.ExcelUtil2;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.*;
+import com.gyee.impala.service.impl.slave.DeviceService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 设备管理类数据接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/device")
+@CrossOrigin
+public class DeviceController {
+    Logger logger = LogManager.getLogger(DeviceController.class);
+
+    @Autowired
+    private DeviceService deviceService;
+
+
+    @GetMapping(value = "/list")
+    public List<Device> getAllDevice() {
+        return deviceService.getAllDevice();
+    }
+
+    @GetMapping(value = "/structure/all")
+    public List<DeviceStructure> getAllDeviceStructure() {
+        return deviceService.getAllDeviceStructure();
+    }
+
+    @GetMapping(value = "/structure/{deviceId}")
+    public List<DeviceStructure> getDeviceStructureByDeviceId(@PathVariable("deviceId")  String deviceId) {
+        return deviceService.getDeviceStructureByDeviceId(deviceId);
+    }
+
+    @GetMapping(value = "/structure/{deviceId}/{nodeCode}")
+    public List<DeviceStructure> getAllDeviceStructure(@PathVariable("deviceId")  String deviceId,
+                                                       @PathVariable("nodeCode")  String nodeCode) {
+        return deviceService.getDeviceStructureChildNode(deviceId, nodeCode);
+    }
+
+    @GetMapping(value = "/structure/single/{deviceId}/{nodeCode}")
+    public DeviceStructure getDeviceStructureByCode(@PathVariable("deviceId")  String deviceId,
+                                                       @PathVariable("nodeCode")  String nodeCode) {
+        return deviceService.getDeviceStructureByCode(deviceId, nodeCode);
+    }
+
+    @GetMapping(value = "/structure/tree/{deviceId}/{nodeCode}")
+    public TreeNode<DeviceStructure> getDeviceStructureTree(@PathVariable("deviceId")  String deviceId,
+                                                              @PathVariable("nodeCode")  String nodeCode) {
+        return deviceService.getDeviceStructureTree(deviceId, nodeCode);
+    }
+
+    @GetMapping(value = "/structure/tree/{deviceId}")
+    public TreeNode<DeviceStructure> getDeviceStructureTree(@PathVariable("deviceId")  String deviceId) {
+        return deviceService.getDeviceStructureTree(deviceId);
+    }
+
+    @DeleteMapping(value = "/structure/delete/{dsId}")
+    public int deleteDeviceStructure(@PathVariable("dsId") long dsId) {
+        return deviceService.deleteDeviceStructure(dsId);
+    }
+
+    @PostMapping(value = "/structure")
+    @ResponseBody
+    public ResponseWrapper<DeviceStructure> saveDeviceStructure(@RequestBody DeviceStructure ds) {
+        ResponseWrapper<DeviceStructure> wrapper = dataCheck(ds);
+        if (wrapper.getSuccess()) {
+            //mybatis 操作数据库成功会返回影响的条数,如果成功则为1,失败为0
+            int result = deviceService.saveOrUpdateDeviceStructure(ds);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+
+    }
+
+    public ResponseWrapper<DeviceStructure> dataCheck(DeviceStructure ds) {
+
+        ResponseWrapper<DeviceStructure> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getCode() == null || ds.getCode().equals("")) {
+            msg = "结构编码不能为空";
+            result = false;
+        } else if (ds.getParentcode() == null || ds.getParentcode().equals("")) {
+            msg = "父节点不能为空";
+            result = false;
+        } else if (ds.getDeviceid() == null || ds.getDeviceid().equals("")) {
+            msg = "设备ID不能为空";
+            result = false;
+        } else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+
+        return wrapper;
+    }
+
+    @GetMapping(value = "/metrics/{deviceId}")
+    public List<DeviceMetrics> getDeviceMetricsByDeviceId(@PathVariable("deviceId")  String deviceId) {
+        return deviceService.getDeviceMetricsByDeviceId(deviceId);
+    }
+
+    @GetMapping(value = "/metrics/{deviceId}/{structureCode}")
+    public List<DeviceMetrics> getDeviceMetricsBySturctureCode(@PathVariable("deviceId")  String deviceId,
+                                                       @PathVariable("structureCode")  String structureCode) {
+        return deviceService.getDeviceMetricsByStructureCode(deviceId, structureCode);
+    }
+    @GetMapping(value = "/metrics/page")
+    public IPage<DeviceMetrics> queryByPage(
+            @RequestParam(value = "pagenum")Integer pageNum,
+            @RequestParam(value = "pagesize")Integer pageSize,
+            @RequestParam(value = "categorydata",required = false)String categorydata,
+            @RequestParam(value = "keyword",required = false)String  keyword,
+            @RequestParam(value = "model",required = false)String  model,
+            @RequestParam(value = "deviceId", required = false) String deviceId,
+            @RequestParam(value = "structureCode",required = false) String structureCode
+    ){
+        Page<DeviceMetrics> page =new Page(pageNum,pageSize);
+
+        try {
+            return  deviceService.pageQueryAll(page,deviceId,categorydata,keyword,model,structureCode);
+        } catch (Exception e) {
+            logger.error("操作失败",e);
+            return null;
+        }
+
+    }
+
+
+    @GetMapping(value = "/metrics/single/{deviceId}/{metricCode}")
+    public DeviceMetrics getDeviceMetricsByCode(@PathVariable("deviceId")  String deviceId,
+                                                    @PathVariable("metricCode")  String metricCode) {
+        return deviceService.getDeviceMetricsByCode(deviceId, metricCode);
+    }
+
+
+    @DeleteMapping(value = "/metrics/single/delete/{metricId}")
+    public int deleteDeviceMetric(@PathVariable("metricId") long metricId) {
+        return deviceService.deleteDeviceMetric(metricId);
+    }
+
+    @PostMapping(value = "/metrics/single")
+    @ResponseBody
+    public ResponseWrapper<DeviceMetrics> saveDeviceMetrics(@RequestBody DeviceMetrics ds) {
+        ResponseWrapper<DeviceMetrics> wrapper = dataCheck(ds);
+        if (wrapper.getSuccess()) {
+            //mybatis 操作数据库成功会返回影响的条数,如果成功则为1,失败为0
+            List<DeviceModelMetrics> deviceModelMetrics =ds.getDeviceModelMetrics();
+            int result = deviceService.saveOrUpdateDeviceMetric(ds,deviceModelMetrics);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+
+    }
+
+    private ResponseWrapper<DeviceMetrics> dataCheck(DeviceMetrics ds) {
+
+        ResponseWrapper<DeviceMetrics> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getMetriccode() == null || ds.getMetriccode().equals("")) {
+            msg = "指标编码不能为空";
+            result = false;
+        } else if (ds.getStructurecode() == null || ds.getStructurecode().equals("")) {
+            msg = "设备结构编码不能为空";
+            result = false;
+        } else if (ds.getDeviceid() == null || ds.getDeviceid().equals("")) {
+            msg = "设备ID不能为空";
+            result = false;
+        } else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+
+        /*if (deviceService.getDeviceMetricsByCode(ds.getDeviceid(), ds.getMetriccode()) != null) {
+            msg = "指标编码重复!!";
+            result = false;
+        }*/
+
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+
+        return wrapper;
+    }
+
+    @GetMapping(value = "/model/list")
+    public List<DeviceModel> getDeviceModelList() {
+        return deviceService.getDeviceModelList();
+    }
+
+    @GetMapping(value = "/model/page")
+    public ResponseWrapper queryByPage(
+            @RequestParam(value = "pagenum") Integer pageNum,
+            @RequestParam(value = "pagesize") Integer pageSize,
+            @RequestParam(value = "code", required = false) String code,
+            @RequestParam(value = "stationname", required = false) String stationname
+    ) {
+        Page<DeviceModel> page = new Page(pageNum, pageSize);
+        IPage<DeviceModel> pageResult = deviceService.pageQueryDeviceModel(page, code,stationname);
+        return ResponseWrapper.success("请求成功",pageResult);
+    }
+
+    @GetMapping(value = "/model/{id}")
+    public List<DeviceModel> getDeviceModelsById(@PathVariable("id")  String id) {
+        return deviceService.getDeviceModelsById(id);
+    }
+
+
+    @DeleteMapping(value = "/model/delete/{id}")
+    public int deleteDeviceModel(@PathVariable("id") int id) {
+        return deviceService.deleteDeviceModel(id);
+    }
+
+    @PostMapping(value = "/model")
+    @ResponseBody
+    public ResponseWrapper<DeviceModel> saveDeviceModel(@RequestBody DeviceModel ds) {
+        ResponseWrapper<DeviceModel> wrapper = dataCheck2(ds);
+        if (wrapper.getSuccess()) {
+            //mybatis 操作数据库成功会返回影响的条数,如果成功则为1,失败为0
+            int result = deviceService.saveOrUpdateDeviceModel(ds);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+    }
+    public ResponseWrapper<DeviceModel> dataCheck2(DeviceModel ds) {
+
+        ResponseWrapper<DeviceModel> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getCode() == null || ds.getCode().equals("")) {
+            msg = "设备编码不能为空";
+            result = false;
+        }  else if (ds.getDeviceid() == null || ds.getDeviceid().equals("")) {
+            msg = "设备ID不能为空";
+            result = false;
+        } else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+
+        if (deviceService.getDeviceModelByCode(ds.getDeviceid(), ds.getCode()) != null) {
+            msg = "指标编码重复!!";
+            result = false;
+        }
+
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+
+        return wrapper;
+    }
+
+    @PostMapping(value ="/conversion")
+    @ResponseBody
+    public ResponseWrapper<DeviceMetrics> converSion(@RequestParam("file") MultipartFile file){
+        ResponseWrapper<DeviceMetrics> wrapper = null;
+        if (!file.isEmpty()) {
+            try {
+                String originalFilename = file.getOriginalFilename();
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                Integer startRows = 1;
+                InputStream is = file.getInputStream();
+                List<DeviceMetrics> bindingList = new ArrayList<>();
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                for (String[] str : strings) {
+                    DeviceMetrics deviceMetrics = new DeviceMetrics();
+                    deviceMetrics.setDeviceid(str[0]);
+                    deviceMetrics.setName(str[1]);
+                    deviceMetrics.setDescription(str[2]);
+                    deviceMetrics.setEnname(str[3]);
+                    bindingList.add(deviceMetrics);
+                }
+                wrapper = ResponseWrapper.success("转化成功",bindingList);
+            }catch (IOException e) {
+                wrapper = ResponseWrapper.error("转化失败");
+            }
+        }
+        return wrapper;
+    }
+
+    @PostMapping(value ="/input")
+    @ResponseBody
+    public AjaxResult InputExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+        if (!file.isEmpty()) {
+            try {
+                //获取原始的文件名
+                String originalFilename = file.getOriginalFilename();
+                //获取文件类型
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                //默认从第一行开始读取
+                Integer startRows = 1;
+                //获取输入流
+                InputStream is = file.getInputStream();
+                List<DeviceMetrics> bindingList = new ArrayList<>();
+                //List<Bookcase> bookcaseList = new ArrayList<>();
+                //Excel导入导出的单元类
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                //遍历Excel表每一行的数据
+                for (String[] str : strings) {
+                    DeviceMetrics deviceMetrics = new DeviceMetrics();
+                    if(str[0]==null||str[0].length()<=0){
+                        deviceMetrics.setStructurecode("1010102");
+                    }else {
+                        deviceMetrics.setStructurecode(str[0]);
+                    }
+                    deviceMetrics.setMetriccode(str[1]);
+                    deviceMetrics.setName(str[2]);
+                    deviceMetrics.setEnname(str[3]);
+                    deviceMetrics.setUnitname(str[4]);
+                    deviceMetrics.setCategorydata(str[5]);
+                    deviceMetrics.setCategorysci(str[6]);
+                    deviceMetrics.setDescription(str[7]);
+                    bindingList.add(deviceMetrics);
+                }
+                int bookState = deviceService.insertOrUpdate(bindingList);
+                if(bookState>0){
+                    return AjaxResult.success("上传文件成功!");
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return AjaxResult.error("上传文件失败!");
+    }
+
+    public ResponseWrapper<DeviceMetrics> dataCheck3(DeviceMetrics ds) {
+
+        ResponseWrapper<DeviceMetrics> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getMetriccode() == null || ds.getMetriccode().equals("")) {
+            msg = "指标编码不能为空";
+            result = false;
+        } else if (ds.getStructurecode() == null || ds.getStructurecode().equals("")) {
+            msg = "设备结构编码不能为空";
+            result = false;
+        }  else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+
+        return wrapper;
+    }
+
+}

+ 159 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/DeviceFaultModeController.java

@@ -0,0 +1,159 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.gyee.impala.common.config.AjaxResult;
+import com.gyee.impala.common.util.ExcelUtil2;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.DeviceFaultMode;
+import com.gyee.impala.service.impl.slave.DeviceFaultModeService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/device/faultmode")
+@CrossOrigin
+public class DeviceFaultModeController {
+
+    @Autowired
+    private DeviceFaultModeService deviceFaultModeService;
+
+
+    @GetMapping(value = "/{deviceId}")
+    public List<DeviceFaultMode> getDeviceFaultModeByDeviceId(@PathVariable("deviceId")  String deviceId) {
+        return deviceFaultModeService.getDeviceFaultModeByDeviceId(deviceId);
+    }
+
+    @GetMapping(value = "/{deviceId}/{structurecode}")
+    public List<DeviceFaultMode> getDeviceFaultModeBySturctureCode(@PathVariable("deviceId")  String deviceId,
+                                                               @PathVariable("structurecode")  String structurecode) {
+        return deviceFaultModeService.getDeviceFaultModeByStructureCode(deviceId, structurecode);
+    }
+
+
+    @GetMapping(value = "/single/{code}")
+    public DeviceFaultMode getDeviceFaultModeByCode(@PathVariable("code")  String code) {
+        return deviceFaultModeService.getDeviceFaultModeByCode(code);
+    }
+
+
+    @DeleteMapping(value = "/delete/{id}")
+    public int deleteDeviceFaultMode(@PathVariable("id") Long id) {
+        int result = deviceFaultModeService.deleteDeviceFaultMode(id);
+        return result;
+    }
+
+    @PostMapping()
+    @ResponseBody
+    public ResponseWrapper<DeviceFaultMode> saveDeviceFaultMode(@RequestBody DeviceFaultMode ds) {
+        ResponseWrapper<DeviceFaultMode> wrapper = dataCheck(ds);
+        if (wrapper.getSuccess()) {
+            //mybatis 操作数据库成功会返回影响的条数,如果成功则为1,失败为0
+            int result = deviceFaultModeService.saveorUpdateDeviceFaultMode(ds);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+    }
+
+    private ResponseWrapper<DeviceFaultMode> dataCheck(DeviceFaultMode ds) {
+
+        ResponseWrapper<DeviceFaultMode> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getCode() == null || ds.getCode().equals("")) {
+            msg = "结构编码不能为空";
+            result = false;
+        } else if (ds.getDeviceid() == null || ds.getDeviceid().equals("")) {
+            msg = "设备ID不能为空";
+            result = false;
+        } else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+        return wrapper;
+    }
+
+    @PostMapping(value ="/input")
+    @ResponseBody
+    public AjaxResult InputExcel(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+        if (!file.isEmpty()) {
+            try {
+                //获取原始的文件名
+                String originalFilename = file.getOriginalFilename();
+                //获取文件类型
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                //默认从第一行开始读取
+                Integer startRows = 1;
+                //获取输入流
+                InputStream is = file.getInputStream();
+                List<DeviceFaultMode> bindingList = new ArrayList<>();
+                //List<Bookcase> bookcaseList = new ArrayList<>();
+                //Excel导入导出的单元类
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                //遍历Excel表每一行的数据
+                for (String[] str : strings) {
+                    DeviceFaultMode deviceFaultMode = new DeviceFaultMode();
+                    if(str[0]==null||str[0].length()<=0){
+                        deviceFaultMode.setStructurecode("1010102");
+                    }else {
+                        deviceFaultMode.setStructurecode(str[0]);
+                    }
+                    deviceFaultMode.setName(str[1]);
+                    deviceFaultMode.setCode(str[2]);
+                    deviceFaultMode.setOccurence(Integer.parseInt(str[3]));
+                    deviceFaultMode.setSeverity(Integer.parseInt(str[4]));
+                    deviceFaultMode.setDetection(Integer.parseInt(str[5]));
+                    deviceFaultMode.setCause(str[6]);
+                    deviceFaultMode.setEffects(str[7]);
+                    deviceFaultMode.setMeasure(str[8]);
+                    bindingList.add(deviceFaultMode);
+                }
+                int bookState = deviceFaultModeService.insertOrUpdate(bindingList);
+                if(bookState>0){
+                    return AjaxResult.success("上传文件成功!");
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return AjaxResult.error("上传文件失败!");
+    }
+
+
+    private ResponseWrapper<DeviceFaultMode> dataCheck2(DeviceFaultMode ds) {
+
+        ResponseWrapper<DeviceFaultMode> wrapper = null;
+        String msg = "";
+        boolean result = true;
+
+        if (ds.getCode() == null || ds.getCode().equals("")) {
+            msg = "结构编码不能为空";
+            result = false;
+        }  else if (ds.getName() == null || ds.getName().equals("")) {
+            msg = "名称不能为空";
+            result = false;
+        }
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, ds);
+        } else {
+            wrapper = ResponseWrapper.error(msg, ds);
+        }
+        return wrapper;
+    }
+}

+ 191 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/InfoController.java

@@ -0,0 +1,191 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.mapper.master.WindpowerstationMapper;
+import com.gyee.impala.mapper.slave.*;
+import com.gyee.impala.model.master.Windpowerstation;
+import com.gyee.impala.model.master.Windturbine;
+import com.gyee.impala.model.slave.*;
+import com.gyee.impala.service.impl.slave.DeviceService;
+import com.gyee.impala.service.impl.slave.StationInfoService;
+import com.gyee.impala.service.master.WindturbineService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @descrition: 页面基本信息
+ * @author:Wanghs
+ * @date:2019-12-06
+ */
+@Slf4j
+@RestController
+@RequestMapping("/info")
+@CrossOrigin
+public class InfoController {
+
+    @Resource
+    private WindpowerstationMapper WindpowerstationMapper;
+
+    @Autowired
+    private WindturbineService windturbineService;
+
+    @Autowired
+    private TestingPointAIMapper testingPointAIMapper;
+
+    @Autowired
+    private TestingPointDIMapper testingPointDIMapper;
+
+    @Autowired
+    private WindturbinePartsMapper windturbinePartsMapper;
+
+    @Autowired
+    private WarningTypeMapper warningTypeMapper;
+
+    @Autowired
+    private WarningClassifyMapper warningClassifyMapper;
+
+    @Autowired
+    private DeviceService deviceService;
+
+    @Autowired
+    private StationInfoService stationInfoService;
+
+    @GetMapping(value = "/station")
+    @ResponseBody
+    public List<Windpowerstation> getAllWindStation(@RequestParam(value = "id", required = false) String id) {
+
+        if (StringUtils.isBlank(id)) {
+            id = "_FDC";
+        }
+        QueryWrapper<Windpowerstation> wrapper = new QueryWrapper<>();
+        wrapper.like("id", id);
+        List<Windpowerstation> lst = WindpowerstationMapper.selectList(wrapper);
+        return lst;
+    }
+
+    @GetMapping(value = "/station/all")
+    @ResponseBody
+    public List<Windpowerstation> getAllStation(@RequestParam(value = "id", required = false) String id) {
+
+        QueryWrapper<Windpowerstation> wrapper = new QueryWrapper<>();
+        wrapper.like("id", id);
+        List<Windpowerstation> lst = WindpowerstationMapper.selectList(wrapper);
+        return lst;
+    }
+
+
+    @GetMapping(value = "/windturbine")
+    @ResponseBody
+    public List<Windturbine> getWindturbineByStation(@RequestParam(value = "stationId", required = false) String stationId) {
+        List<Windturbine> lst = windturbineService.getWindTurbineId(stationId);
+        return lst;
+    }
+
+    @GetMapping(value = "/testing_point_ai")
+    @ResponseBody
+    public List<TestingPointAI> getTestingPointAIByStationIdAndModelId(
+            @RequestParam(value = "stationId") String stationId,
+            @RequestParam(value = "modelId") String modelId
+    ) {
+
+        List<TestingPointAI> lst = new ArrayList<>();
+        if (StringUtils.isNotBlank(stationId) && StringUtils.isNotBlank(modelId)) {
+            String stationStr = stationId.replace("_FDC", "").replace("_GDC", "").trim();
+            lst = testingPointAIMapper.selectByStationAndModel(stationStr, modelId);
+        }
+        return lst;
+    }
+
+    @GetMapping(value = "/testing_point_di")
+    @ResponseBody
+    public List<TestingPointDI> getTestingPointDIByStationIdAndModelId(
+            @RequestParam(value = "stationId", required = false) String stationId,
+            @RequestParam(value = "modelId", required = false) String modelId
+    ) {
+        List<TestingPointDI> lst = new ArrayList<>();
+        if (StringUtils.isNotBlank(stationId) || StringUtils.isNotBlank(modelId)) {
+            String stationStr = "";
+            if (StringUtils.isNotBlank(stationId))
+                stationStr = stationId.replace("_FDC", "").replace("_GDC", "").trim();
+            lst = testingPointDIMapper.selectByStationAndModel(stationStr, modelId);
+        }
+        return lst;
+
+    }
+
+    @GetMapping(value = "/windturbine_parts")
+    public List<WindturbineParts> getWindturbineParts() {
+        List<WindturbineParts> lst = new ArrayList<>();
+        try {
+            lst = windturbinePartsMapper.selectAllWindturbineParts();
+
+        } catch (Exception ex) {
+            log.error("获取风机部件信息失败" + ex.getMessage() + ex.getStackTrace());
+        } finally {
+            return lst;
+        }
+    }
+
+    @GetMapping(value = "/warning_type")
+    public List<WarningType> getWarningType() {
+        List<WarningType> lst = new ArrayList<>();
+        try {
+            lst = warningTypeMapper.getAll();
+
+        } catch (Exception ex) {
+            log.error("获取报警种类信息失败" + ex.getMessage() + ex.getStackTrace());
+        } finally {
+            return lst;
+        }
+    }
+
+    @GetMapping(value = "/warning_classify")
+    public List<WarningClassify> getWarningClassify() {
+        List<WarningClassify> lst = new ArrayList<>();
+        try {
+            lst = warningClassifyMapper.getAll();
+
+        } catch (Exception ex) {
+            log.error("获取报警分类信息失败" + ex.getMessage() + ex.getStackTrace());
+        } finally {
+            return lst;
+        }
+    }
+
+    @GetMapping(value = "/point")
+    @ResponseBody
+    public JSONObject getPointList(@RequestParam(value = "deviceId", required = true) String deviceid,
+                                   @RequestParam(value = "structcode", required = false) String structCode,
+                                   @RequestParam(value = "stationId", required = true) String stationId,
+                                   @RequestParam(value = "windturbineId", required = true) String windturbineId,
+                                   @RequestParam(value = "pageSize", required = false) Integer pageSize,
+                                   @RequestParam(value = "pageNum", required = false) Integer pageNum
+    ) {
+
+        if (pageSize == null || pageSize == 0)
+            pageSize = 100;
+        if (pageNum == null || pageNum == 0)
+            pageNum = 1;
+        JSONObject testingPoint = deviceService.getTestingPointByStructCode(deviceid, structCode, windturbineId, pageSize, pageNum);
+        return testingPoint;
+
+
+    }
+
+    @GetMapping("/stationinfo")
+    public ResponseWrapper getStationInfo(@RequestParam(value = "stationId", required = false) String stationId) {
+        List<StationInfo> stationInfoList = stationInfoService.getStationInfo(stationId);
+
+        ResponseWrapper responseWrapper = ResponseWrapper.success("获取成功", stationInfoList);
+        return responseWrapper;
+    }
+}
+

+ 189 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/ScadabjController.java

@@ -0,0 +1,189 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.common.util.ExcelUtil2;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.common.util.SnowFlakeUtil;
+import com.gyee.impala.model.slave.Scadabj;
+import com.gyee.impala.service.impl.slave.ScadabjService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/scadabj")
+@CrossOrigin
+public class ScadabjController {
+
+    @Autowired
+    private ScadabjService scadabjService;
+
+    @PostMapping(value = "/save")
+    @ResponseBody
+    public ResponseWrapper<Scadabj> saveScadabj(HttpServletRequest request, @RequestBody Scadabj scadabj) {
+        ResponseWrapper<Scadabj> wrapper = dataCheck(scadabj);
+        if (wrapper.getSuccess()) {
+            //mybatis 操作数据库成功会返回影响的条数,如果成功则为1,失败为0
+            int result = scadabjService.saveAndUpdateScadabj(scadabj);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+
+    }
+
+    @DeleteMapping(value = "/delete")
+    public int deleteScadabj(Scadabj scadabj) {
+        return scadabjService.deleteScadabj(scadabj);
+    }
+
+
+    @GetMapping(value = "/page")
+    public IPage<Scadabj> queryByPage(
+            @RequestParam(value = "pagenum") Integer pageNum,
+            @RequestParam(value = "pagesize") Integer pageSize,
+            @RequestParam(value = "pointKey", required = false) String pointKey,
+            @RequestParam(value = "stationId", required = false) String stationId,
+            @RequestParam(value = "enable", required = false) String enable,
+            @RequestParam(value = "description", required = false) String description
+
+    ) {
+        Page<Scadabj> page = new Page(pageNum, pageSize);
+        IPage<Scadabj> pg = scadabjService.pageQueryAll(page, pointKey, stationId, enable, description);
+        return pg;
+    }
+
+    @PostMapping(value = "/save-batch")
+    @ResponseBody
+    public ResponseWrapper<Scadabj> saveScadabjBatch(HttpServletRequest request,@RequestBody List<Scadabj> lst) {
+        boolean allCheck = true;
+        ResponseWrapper<Scadabj> wrapper = null;
+        for (Scadabj scadabj : lst) {
+            wrapper = dataCheck(scadabj);
+            if (wrapper.getSuccess() != true) {
+                allCheck = false;
+                String msg = wrapper.getMsg();
+                wrapper.setMsg(scadabj.getDescription() + ":" + msg);
+                break;
+            }
+        }
+        if (allCheck) {
+            for (Scadabj scadabj : lst) {
+                int result = scadabjService.saveAndUpdateScadabj(scadabj);
+                if (result <= 0) {
+                    wrapper.setMsg(scadabj.getDescription() + ":" + "操作数据库失败");
+                    wrapper.setSuccess(false);
+                    break;
+                }
+            }
+            return wrapper;
+        } else {
+            return wrapper;
+        }
+
+    }
+
+    @PostMapping(value = "/import")
+    @ResponseBody
+    public ResponseWrapper<Scadabj> saveScadabjImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+        ResponseWrapper<Scadabj> wrapper = null;
+        boolean allCheck = true;
+        if (!file.isEmpty()) {
+            try {
+                String originalFilename = file.getOriginalFilename();
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                Integer startRows = 1;
+                InputStream is = file.getInputStream();
+                List<Scadabj> bindingList = new ArrayList<>();
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                for (String[] str : strings) {
+                    Scadabj scadabj = new Scadabj();
+                    if (str[0] == null || str[0].equals("")){
+                        scadabj.setId(SnowFlakeUtil.generateIdL());
+                    }else {
+                        scadabj.setId(Long.valueOf(str[0]));
+                    }
+                    scadabj.setStationId(str[1]);
+                    scadabj.setPointKey(str[2]);
+                    scadabj.setDescription(str[3]);
+                    scadabj.setCategory1(str[4]);
+                    scadabj.setCategory2(str[5]);
+                    scadabj.setCategory3(str[6]);
+                    scadabj.setCategory4(str[7]);
+                    scadabj.setRank(str[8]);
+                    scadabj.setAlarmType(Integer.parseInt(str[9]));
+                    scadabj.setEnabled(Integer.parseInt(str[10]));
+                    scadabj.setDeviceId(str[11]);
+                    bindingList.add(scadabj);
+                }
+                for (Scadabj scadabj : bindingList) {
+                    wrapper = dataCheck(scadabj);
+                    if (wrapper.getSuccess() != true) {
+                        allCheck = false;
+                        String msg = wrapper.getMsg();
+                        wrapper.setMsg(scadabj.getDescription() + ":" + msg);
+                        break;
+                    }
+                }
+                if (allCheck) {
+                    for (Scadabj scadabj : bindingList) {
+                        int result = scadabjService.saveAndUpdateScadabj(scadabj);
+                        if (result <= 0) {
+                            wrapper.setMsg(scadabj.getDescription() + ":" + "操作数据库失败");
+                            wrapper.setSuccess(false);
+                            break;
+                        }else {
+                            wrapper.setMsg("批量导入成功");
+                            wrapper.setSuccess(true);
+                        }
+                    }
+                }
+            } catch (IOException e) {
+                wrapper.setMsg("操作数据库失败");
+                wrapper.setSuccess(false);
+            }
+        }
+        return wrapper;
+    }
+
+
+    private ResponseWrapper<Scadabj> dataCheck(Scadabj scadabj) {
+
+        ResponseWrapper<Scadabj> wrapper = null;
+        String msg = "";
+        boolean result = true;
+        if (scadabj.getPointKey() != null && scadabj.getPointKey().equals("")) {
+            msg = "测点不能为空";
+            result = false;
+        } else if (scadabj.getDescription() != null && scadabj.getDescription().equals("")) {
+            msg = "描述不能为空";
+            result = false;
+        } else if (scadabj.getRank() != null && scadabj.getRank().equals("")) {
+            msg = "报警级别不能为空";
+            result = false;
+        } else if (scadabj.getEnabled() == -1) {
+            msg = "是否可用不能为空";
+            result = false;
+        } else if (scadabj.getAlarmType() == -1) {
+            msg = "报警逻辑不能为空";
+            result = false;
+        }
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, scadabj);
+        } else {
+            wrapper = ResponseWrapper.error(msg, scadabj);
+        }
+        return wrapper;
+    }
+}

+ 42 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/TestingPointDIController.java

@@ -0,0 +1,42 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.TestingPointDI;
+import com.gyee.impala.service.impl.slave.TestingPointDIService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-04-08
+ */
+@Slf4j
+@RestController
+@RequestMapping("/testingpointDI")
+@CrossOrigin
+public class TestingPointDIController {
+
+    @Autowired
+    private TestingPointDIService testingPointDIService;
+
+    @GetMapping("/model")
+    public ResponseWrapper getModel() {
+        List<String> model = testingPointDIService.getModel();
+        ResponseWrapper wrapper = ResponseWrapper.success("查询成功", model);
+        return wrapper;
+    }
+
+    @RequestMapping(value = "/point")
+    @ResponseBody
+    public ResponseWrapper getTestingPointDIByModel(
+            @RequestParam(value = "minModel", required = true) String minModel
+    ) {
+        List<TestingPointDI> lst = testingPointDIService.getTestingPointDIByMinModelId(minModel);
+        ResponseWrapper result = ResponseWrapper.success("查询成功", lst);
+        return result;
+    }
+}

+ 188 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/Warning2Controller.java

@@ -0,0 +1,188 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.common.util.ExcelUtil2;
+import com.gyee.impala.common.util.ResponseWrapper;
+import com.gyee.impala.model.slave.Warning2;
+import com.gyee.impala.service.impl.slave.Warning2Service;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/warning2")
+@CrossOrigin
+public class Warning2Controller {
+
+    @Autowired
+    private Warning2Service warning2Service;
+
+    @PostMapping(value = "/save")
+    @ResponseBody
+    public ResponseWrapper saveWarning(HttpServletRequest request,@RequestBody Warning2 warning2) {
+        ResponseWrapper<Warning2> wrapper = dataCheck(warning2);
+        if (wrapper.getSuccess()) {
+            int result = warning2Service.saveAndUpdateWarning2(warning2);
+            if (result <= 0) {
+                wrapper.setSuccess(false);
+                wrapper.setMsg("操作数据库失败");
+            }
+        }
+        return wrapper;
+    }
+
+    @PostMapping(value = "/save-batch")
+    @ResponseBody
+    public ResponseWrapper saveWarningBatch(HttpServletRequest request, @RequestBody List<Warning2> lst) {
+        boolean allCheck = true;
+        ResponseWrapper<Warning2> wrapper = null;
+        for (Warning2 warning : lst) {
+            wrapper = dataCheck(warning);
+            if (wrapper.getSuccess() != true) {
+                allCheck = false;
+                String msg = wrapper.getMsg();
+                wrapper.setMsg(warning.getChineseText() + ":" + msg);
+                break;
+            }
+        }
+        if (allCheck) {
+            for (Warning2 warning : lst) {
+                int result = warning2Service.saveAndUpdateWarning2(warning);
+                if (result <= 0) {
+                    wrapper.setMsg(warning.getChineseText() + ":" + "操作数据库失败");
+                    wrapper.setSuccess(false);
+                    break;
+                }
+            }
+            return wrapper;
+        } else {
+            return wrapper;
+        }
+
+
+    }
+
+    @PostMapping(value ="/import")
+    @ResponseBody
+    public ResponseWrapper<Warning2> importWarning(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
+        ResponseWrapper<Warning2> wrapper = null;
+        boolean allCheck = true;
+        if (!file.isEmpty()) {
+            try {
+                //获取原始的文件名
+                String originalFilename = file.getOriginalFilename();
+                //获取文件类型
+                String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1, originalFilename.length());
+                //默认从第一行开始读取
+                Integer startRows = 1;
+                //获取输入流
+                InputStream is = file.getInputStream();
+                List<Warning2> bindingList = new ArrayList<>();
+                //Excel导入导出的单元类
+                List<String[]> strings = ExcelUtil2.readData(fileType, startRows, true, is);
+                //遍历Excel表每一行的数据
+                for (String[] str : strings) {
+                    Warning2 warning2 = new Warning2();
+                    warning2.setId(str[0]);
+                    warning2.setLevelId(str[1]);
+                    warning2.setManufacturerCode(str[2]);
+                    warning2.setChineseText(str[3]);
+                    warning2.setParentId(str[4]);
+                    warning2.setIsleaf(Integer.parseInt(str[5]));
+                    warning2.setSequenceNumber(Integer.parseInt(str[6]));
+                    warning2.setCharacteristic(str[7]);
+                    warning2.setModelId(str[8]);
+                    warning2.setCodeName(str[9]);
+                    warning2.setEdnaValue(Integer.parseInt(str[10]));
+                    warning2.setDisplay(Integer.parseInt(str[11]));
+                    warning2.setWarningClassIfyId(str[12]);
+                    warning2.setStandardTime(Integer.parseInt(str[13]));
+                    warning2.setIsreset(Integer.parseInt(str[14]));
+                    warning2.setWarningTypeId(str[15]);
+                    warning2.setFaultCode(str[16]);
+                    warning2.setRelatedParts(str[17]);
+                    bindingList.add(warning2);
+                }
+                for (Warning2 warning : bindingList) {
+                    wrapper = dataCheck(warning);
+                    if (wrapper.getSuccess() != true) {
+                        allCheck = false;
+                        String msg = wrapper.getMsg();
+                        wrapper.setMsg(warning.getChineseText() + ":" + msg);
+                        break;
+                    }
+                }
+                if (allCheck) {
+                    for (Warning2 warning : bindingList) {
+                        int result = warning2Service.saveAndUpdateWarning2(warning);
+                        if (result <= 0) {
+                            wrapper.setMsg(warning.getChineseText() + ":" + "操作数据库失败");
+                            wrapper.setSuccess(false);
+                            break;
+                        }
+                        else {
+                            wrapper.setMsg("批量导入成功");
+                            wrapper.setSuccess(true);
+                        }
+                    }
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return wrapper;
+    }
+
+    @DeleteMapping(value = "/delete")
+    public int deleteScadafault(Warning2 warning2) {
+        return warning2Service.deleteWarning2(warning2);
+    }
+
+    @GetMapping(value = "/page")
+    public IPage<Warning2> queryByPage(
+            @RequestParam(value = "pagenum") Integer pageNum,
+            @RequestParam(value = "pagesize") Integer pageSize,
+            @RequestParam(value = "modelId", required = false) String modelId,
+            @RequestParam(value = "name", required = false) String name,
+            @RequestParam(value = "isLeaf", required = false) String isLeaf
+    ) {
+        Page<Warning2> page = new Page(pageNum, pageSize);
+        return warning2Service.pageQueryAll(page, modelId, name, isLeaf);
+    }
+
+    private ResponseWrapper<Warning2> dataCheck(Warning2 warning) {
+
+        ResponseWrapper<Warning2> wrapper = null;
+        String msg = "";
+        boolean result = true;
+        if (warning.getModelId() != null && warning.getModelId().equals("")) {
+            msg = "风机型号不能为空";
+            result = false;
+        } else if (warning.getEdnaValue() == 0) {
+            msg = "统一编码不能为空";
+            result = false;
+        } else if (warning.getChineseText() != null && warning.getChineseText().equals("")) {
+            msg = "报警名称不能为空";
+            result = false;
+        } else if (StringUtils.isBlank(warning.getLevelId())) {
+            msg = "报警级别不能为空";
+            result = false;
+        }
+        if (result) {
+            wrapper = ResponseWrapper.success(msg, warning);
+        } else {
+            wrapper = ResponseWrapper.error(msg, warning);
+        }
+        return wrapper;
+    }
+}

+ 37 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/warning/WindpowerstationController.java

@@ -0,0 +1,37 @@
+package com.gyee.impala.controller.sample.warning;
+
+import com.gyee.impala.model.master.Equipmentmodel;
+import com.gyee.impala.model.master.Windpowerstation;
+import com.gyee.impala.service.master.EquipmentmodelService;
+import com.gyee.impala.service.master.WindpowerstationService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 风机接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/windpowerstation")
+@CrossOrigin
+public class WindpowerstationController {
+    @Autowired
+    private WindpowerstationService WindpowerstationService;
+
+    @Autowired
+    private EquipmentmodelService equipmentmodelService;
+
+    @GetMapping()
+    public Windpowerstation getAllWindpowerstation(@RequestParam(value = "id", required = false) String id) {
+        if(id.isEmpty()){
+            List<Equipmentmodel> equipmentmodels =  equipmentmodelService.list();
+            Windpowerstation Windpowerstation = new Windpowerstation();
+            Windpowerstation.setEquipmentmodel(equipmentmodels);
+            return Windpowerstation;
+        }
+        return WindpowerstationService.getWindpowerstation(id);
+    }
+}

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/CasefaultMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Casefault;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Casefault;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.ResultType;
 import org.apache.ibatis.annotations.Select;

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowalgMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Knowalg;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Knowalg;
 
 /**
  * <p>

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowcategoryMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Knowcategory;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Knowcategory;
 
 /**
  * <p>

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowfaultfixMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Knowfaultfix;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Knowfaultfix;
 
 /**
  * <p>

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/KnowfaultsymptomMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Knowfaultsymptom;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Knowfaultsymptom;
 
 /**
  * <p>

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/PowercurvefittingMapper.java

@@ -2,7 +2,6 @@ package com.gyee.impala.mapper.master;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gyee.impala.model.master.Powercurvebasic;
 import com.gyee.impala.model.master.Powercurvefitting;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;

+ 3 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindpowerstationMapper.java

@@ -1,7 +1,8 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Windpowerstation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Windpowerstation;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -12,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2021-10-15
  */
 public interface WindpowerstationMapper extends BaseMapper<Windpowerstation> {
-
+    Windpowerstation selectByid(@Param("station")String station);
 }

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbineMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Windturbine;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Windturbine;
 
 /**
  * <p>

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbinemetricsMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Windturbinemetrics;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Windturbinemetrics;
 
 /**
  * <p>

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/WindturbinepointMapper.java

@@ -1,7 +1,7 @@
 package com.gyee.impala.mapper.master;
 
-import com.gyee.impala.model.master.Windturbinepoint;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.master.Windturbinepoint;
 
 /**
  * <p>

+ 53 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Alertrule2Mapper.java

@@ -0,0 +1,53 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.model.slave.Alertrule2;
+import org.apache.ibatis.annotations.MapKey;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface Alertrule2Mapper extends BaseMapper<Alertrule2> {
+
+    IPage<Alertrule2> pageQueryAll(Page page,
+                                   @Param("name") String name,
+                                   @Param("station") String station,
+                                   @Param("modelId")String modelId,
+                                   @Param("rank")String rank,
+                                   @Param("category")String category,
+                                   @Param("enabled") String enabled,
+                                   @Param("relatedparts")String relatedparts);
+
+    Integer getMaxEdnaValue();
+
+    List<Alertrule2> getAllByStationIdAndModelId(@Param("idString") String idString);
+
+    List<Alertrule2> getAllByStationIdAndModelId2(
+            @Param("station") String station,
+            @Param("modelid") String modelId
+    );
+
+
+    List<Alertrule2> getById(@Param("idString") String idString);
+
+    List<Alertrule2> queryTree();
+
+    @MapKey("ar2id")
+    List<Map<String, Alertrule2>> quertByrelatedParts(String relatedParts);
+
+    List<Alertrule2> queryMap();
+
+    int updateByAlertrule2Id(Alertrule2 alertrule2);
+
+    Alertrule2 selectByAlertrule2Id(String id);
+
+
+    int insertAlerture2(Alertrule2 alertrule2);
+
+}
+

+ 16 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DatadictionaryMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.Datadictionary;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+
+@Mapper
+public interface DatadictionaryMapper extends BaseMapper<Datadictionary> {
+
+    Datadictionary selectBycode(String relatedParts);
+
+    List<Datadictionary> getAllDatadictionary();
+}

+ 29 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceFaultModeMapper.java

@@ -0,0 +1,29 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.DeviceFaultMode;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceFaultModeMapper extends BaseMapper<DeviceFaultMode> {
+
+    DeviceFaultMode getDeviceFaultModeByCode(@Param("code")String code);
+
+
+    List<DeviceFaultMode> getDeviceFaultModeByDeviceId(@Param("deviceId")String deviceId);
+
+
+    List<DeviceFaultMode> getDeviceFaultModeByStructureCode(@Param("deviceId")String deviceId,
+                                                      @Param("structureCode")String structureCode);
+
+    int deleteDeviceFaultMode(@Param("id")Long id);
+
+
+    DeviceFaultMode getDeviceFaultModeTree(@Param("deviceId")String deviceId,
+                                           @Param("nodeCode")String nodeCode);
+
+}

+ 14 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceMapper.java

@@ -0,0 +1,14 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.Device;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceMapper extends BaseMapper<Device> {
+    List<Device> getAll();
+
+}

+ 35 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceMetricsMapper.java

@@ -0,0 +1,35 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.model.slave.DeviceMetrics;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceMetricsMapper extends BaseMapper<DeviceMetrics> {
+
+    DeviceMetrics getDeviceMetricsByCode(@Param("deviceId")String deviceId,
+                                             @Param("metricCode")String metricCode);
+
+
+    List<DeviceMetrics> getDeviceMetricsByDeviceId(@Param("deviceId")String deviceId);
+
+    List<DeviceMetrics> getDeviceMetricsByStructureCode(@Param("deviceId")String deviceId,
+                                                      @Param("structureCode")String nodeCode);
+
+
+    DeviceMetrics selectByMetricsId(@Param("id")long id);
+
+    int updateByMetricsId(DeviceMetrics metrics);
+
+    int insertByMetrics(DeviceMetrics metrics);
+
+    IPage<DeviceMetrics> pageQueryAll(Page page, String deviceId,String categorydata,String keyword,String model, String structureCode);
+
+    DeviceMetrics selectByMetriccode(@Param("metriccode")String metriccode);
+}

+ 21 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceModelMapper.java

@@ -0,0 +1,21 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.DeviceModel;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceModelMapper extends BaseMapper<DeviceModel> {
+
+
+    List<DeviceModel> getDeviceModelsById(@Param("id")String id);
+
+    DeviceModel getDeviceModelByCode(@Param("deviceid")String deviceid,
+                                         @Param("code")String code);
+
+    List<DeviceModel> getAll();
+}

+ 25 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceModelMetricsMapper.java

@@ -0,0 +1,25 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.DeviceModelMetrics;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceModelMetricsMapper extends BaseMapper<DeviceModelMetrics> {
+
+    List<DeviceModelMetrics> getDeviceModelMetricsById(@Param("metriccode")String metriccode);
+
+    List<DeviceModelMetrics> getAll();
+
+    DeviceModelMetrics selectModelMetricsById(@Param("id")long id);
+
+    int updateModelMetricsById(DeviceModelMetrics deviceModelMetrics1);
+
+    int insertModelMetrics(DeviceModelMetrics deviceModelMetrics1);
+
+    List<DeviceModelMetrics> getDeviceModelMetrics(@Param("metricCodeList")List<String> metricCodeList,@Param("modelId")String modelId);
+}

+ 24 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/DeviceStructureMapper.java

@@ -0,0 +1,24 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.DeviceStructure;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface DeviceStructureMapper extends BaseMapper<DeviceStructure> {
+
+    DeviceStructure getDeviceStructureByCode(@Param("deviceId")String deviceId,
+                                             @Param("nodeCode")String nodeCode);
+
+    List<DeviceStructure> getAllDeviceStructure();
+
+    List<DeviceStructure> getDeviceStructureByDeviceId(@Param("deviceId")String deviceId);
+
+    List<DeviceStructure> getDeviceStructureChildNode(@Param("deviceId")String deviceId,
+                                                      @Param("nodeCode")String nodeCode);
+
+}

+ 21 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/RuleUpdateEventInfoMapper.java

@@ -0,0 +1,21 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.RuleUpdateEventInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-04-01
+ */
+@Repository
+@Mapper
+public interface RuleUpdateEventInfoMapper extends BaseMapper<RuleUpdateEventInfo> {
+
+    List<RuleUpdateEventInfo> getInfoByEventId(@Param("eventId")Long eventId);
+}

+ 16 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/RuleUpdateEventMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.RuleUpdateEvent;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-04-01
+ */
+@Repository
+@Mapper
+public interface RuleUpdateEventMapper  extends BaseMapper<RuleUpdateEvent> {
+}

+ 24 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/ScadabjMapper.java

@@ -0,0 +1,24 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.model.slave.Scadabj;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ScadabjMapper extends BaseMapper<Scadabj> {
+
+    IPage<Scadabj> pageQueryAll(Page page,
+                                @Param("pointKey")String pointKey,
+                                @Param("stationId")String stationId,
+                                @Param("enable") String enable,
+                                @Param("description")String description);
+
+    List<Scadabj> getAll();
+
+
+}

+ 17 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/StationInfoMapper.java

@@ -0,0 +1,17 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.StationInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-06-17
+ */
+
+@Repository
+@Mapper
+public interface StationInfoMapper extends BaseMapper<StationInfo> {
+}

+ 21 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/StationMapper.java

@@ -0,0 +1,21 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.Station;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author:Wanghs
+ * @date:2019-12-06
+ */
+@Mapper
+public interface StationMapper extends BaseMapper<Station> {
+    List<Station> getStationAll(@Param("idString") String idString);
+
+    Station selectByid(@Param("station")String station);
+
+    Station getStationByid(@Param("id") String id);
+}

+ 23 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/TestingPointAIMapper.java

@@ -0,0 +1,23 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.TestingPointAI;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2019-12-06
+ */
+@Mapper
+public interface TestingPointAIMapper extends BaseMapper<TestingPointAI> {
+    List<TestingPointAI> selectByStationAndModel(@Param("station") String station,
+                                                 @Param("modelId") String modelId);
+
+    List<TestingPointAI> selectByUniformCodeAndModel(@Param("uniformcodeList") List<String> uniformcodeList,
+                                                     @Param("modelId") String modelId,
+                                                     @Param("stationSimpleName")String stationSimpleName);
+}

+ 28 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/TestingPointDIMapper.java

@@ -0,0 +1,28 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.TestingPointDI;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2019-12-06
+ */
+@Mapper
+public interface TestingPointDIMapper  extends BaseMapper<TestingPointDI>{
+    List<TestingPointDI> selectByStationAndModel(@Param("station") String station,
+                                         @Param("modelId") String modelId);
+
+    List<TestingPointDI> selectByUniformCodeAndModel(@Param("uniformcodeList") List<String> uniformcodeList,
+                                                     @Param("modelId") String modelId,
+                                                     @Param("stationSimpleName")String stationSimpleName
+                                                     );
+
+    List<String> getModel();
+
+    List<TestingPointDI> getPointByMinModel(@Param("minModel")String minModel);
+}

+ 24 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Warning2Mapper.java

@@ -0,0 +1,24 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.impala.model.slave.Warning2;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface Warning2Mapper extends BaseMapper<Warning2> {
+
+    IPage<Warning2> pageQueryAll(Page page,
+                                 @Param("modelId")String modelId,
+                                 @Param("name")String name,
+                                 @Param("isLeaf") String isLeaf);
+
+    String getMaxIdByModelId( @Param("modelId") String modelId);
+
+
+    List<String>  selectGroupType();
+}

+ 16 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WarningClassifyMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.impala.mapper.slave;
+
+import com.gyee.impala.model.slave.WarningClassify;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author:Wanghs
+ * @date:2020-01-08
+ */
+@Mapper
+public interface WarningClassifyMapper {
+
+   List<WarningClassify> getAll();
+}

+ 16 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WarningTypeMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.impala.mapper.slave;
+
+import com.gyee.impala.model.slave.WarningType;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2020-01-08
+ */
+@Mapper
+public interface WarningTypeMapper {
+    List<WarningType> getAll();
+}

+ 15 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindTurbineTestingPointAiMapper.java

@@ -0,0 +1,15 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.WindTurbineTestingPointAi;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface WindTurbineTestingPointAiMapper extends BaseMapper<WindTurbineTestingPointAi> {
+    WindTurbineTestingPointAi getWindTurbineTestingPointAi(@Param("wtId") String wtId, @Param("unicode") String unicode);
+
+    List<WindTurbineTestingPointAi> getPointList(@Param("windturbineId")String windturbineId,@Param("uniformCodeList")List<String> uniformCodeList);
+}

+ 15 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindTurbineTestingPointDiMapper.java

@@ -0,0 +1,15 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.WindTurbineTestingPointDi;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface WindTurbineTestingPointDiMapper extends BaseMapper<WindTurbineTestingPointDi> {
+    WindTurbineTestingPointDi getWindTurbineTestingPointDi(@Param("wtId") String wtId, @Param("unicode") String unicode);
+
+    List<WindTurbineTestingPointDi> getPointList(@Param("windturbineId")String windturbineId,@Param("uniformCodeList")List<String> uniformCodeList);
+}

+ 16 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/WindturbinePartsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.impala.mapper.slave;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.impala.model.slave.WindturbineParts;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @author:Wanghs
+ * @date:2019-12-25
+ */
+@Mapper
+public interface WindturbinePartsMapper extends BaseMapper<WindturbineParts> {
+    List<WindturbineParts> selectAllWindturbineParts();
+}

+ 0 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/slave/Windturbinetestingpointai2Mapper.java

@@ -4,11 +4,9 @@ package com.gyee.impala.mapper.slave;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.impala.model.slave.Temperatureinfo;
 import com.gyee.impala.model.slave.Windturbinetestingpointai2;
-import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>

+ 0 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/model/custom/TsDoubleData.java

@@ -1,7 +1,5 @@
 package com.gyee.impala.model.custom;
 
-import java.math.BigDecimal;
-
 public class TsDoubleData {
 
     private long ts;

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Collectorwireproject.java

@@ -1,7 +1,6 @@
 package com.gyee.impala.model.decision;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Mv.java

@@ -1,7 +1,6 @@
 package com.gyee.impala.model.decision;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/decision/Windplantproject.java

@@ -1,7 +1,6 @@
 package com.gyee.impala.model.decision;
 
 import java.io.Serializable;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**

+ 4 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/model/gdoa/EqEquipment.java

@@ -1,13 +1,14 @@
 package com.gyee.impala.model.gdoa;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 设备台账表

+ 4 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/model/gdoa/EqJxjl.java

@@ -1,13 +1,14 @@
 package com.gyee.impala.model.gdoa;
 
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 检修记录

+ 2 - 4
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Casefault.java

@@ -2,15 +2,13 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
-
 import com.gyee.impala.common.spring.InitialRunner;
-import com.gyee.impala.common.util.DateUtil;
-import com.gyee.impala.common.util.SnowFlakeUtil;
 import com.gyee.impala.model.ToData;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Casefaultalg.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Caseperformance.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  *

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowalg.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 4
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowcategory.java

@@ -2,13 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
-
-import com.gyee.impala.model.ToData;
-import com.gyee.impala.model.custom.AlertHistory;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultfix.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultprocess.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Knowfaultsymptom.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 1 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Powercurvebasic.java

@@ -6,6 +6,7 @@ import com.gyee.impala.model.ToData;
 import com.gyee.impala.model.custom.PowerCurveCondition;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+
 import java.io.Serializable;
 
 

+ 10 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windpowerstation.java

@@ -1,12 +1,15 @@
 package com.gyee.impala.model.master;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.apache.commons.lang3.StringUtils;
 
+import java.io.Serializable;
+import java.util.List;
+
 /**
  * <p>
  * 
@@ -50,6 +53,12 @@ public class Windpowerstation extends Model<Windpowerstation> {
 
     private String remark;
 
+    @TableField(exist = false)
+    private List<Equipmentmodel> Equipmentmodel;
+
+    @TableField(exist = false)
+    private List<String> modelList;
+
 
     public String getType() {
         return StringUtils.isEmpty(type) ? "FJ" : type;

+ 2 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbine.java

@@ -2,12 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-
-import java.io.Serializable;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  *

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbinemetrics.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 2 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/Windturbinepoint.java

@@ -2,10 +2,11 @@ package com.gyee.impala.model.master;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.io.Serializable;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.io.Serializable;
+
 /**
  * <p>
  * 

+ 0 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/model/slave/Alertrule2.java


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