Kaynağa Gözat

添加微服务opc项目

zhoupeng 2 yıl önce
ebeveyn
işleme
fb3f268d5e
100 değiştirilmiş dosya ile 7104 ekleme ve 0 silme
  1. 33 0
      chaunyi_opc/opc_da/.gitignore
  2. BIN
      chaunyi_opc/opc_da/.mvn/wrapper/maven-wrapper.jar
  3. 2 0
      chaunyi_opc/opc_da/.mvn/wrapper/maven-wrapper.properties
  4. 316 0
      chaunyi_opc/opc_da/mvnw
  5. 188 0
      chaunyi_opc/opc_da/mvnw.cmd
  6. 186 0
      chaunyi_opc/opc_da/pom.xml
  7. 21 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/OpcDaApplication.java
  8. 13 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/PermissionControl.java
  9. 120 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/PermissionControlAspect.java
  10. 22 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/WebLog.java
  11. 133 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/WebLogAspect.java
  12. 26 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/CrossConfig.java
  13. 41 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/InterceptorConfig.java
  14. 54 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/Interceptors.java
  15. 29 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/MessageReceiver.java
  16. 55 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/RedisConfig.java
  17. 61 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/SpringContextUtils.java
  18. 52 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/ThreadPoolConfig.java
  19. 114 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataModelController.java
  20. 136 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataSourceController.java
  21. 210 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DepartmentController.java
  22. 234 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DictController.java
  23. 18 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/FileController.java
  24. 94 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ItemGroupController.java
  25. 41 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/LogController.java
  26. 275 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MenuController.java
  27. 95 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MessageNoticeController.java
  28. 119 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/PermissionController.java
  29. 56 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/RawDataController.java
  30. 245 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ReportTableController.java
  31. 312 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/RoleController.java
  32. 419 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserController.java
  33. 136 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserGroupController.java
  34. 28 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DataModelDao.java
  35. 29 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DataSourceDao.java
  36. 114 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DepartmentDao.java
  37. 160 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DictDao.java
  38. 16 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/FileDao.java
  39. 47 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java
  40. 21 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/LogDao.java
  41. 130 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MenuDao.java
  42. 22 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MessageNoticeDao.java
  43. 39 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/PermissionDao.java
  44. 22 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/RawDataDao.java
  45. 66 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ReportTableDao.java
  46. 183 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/RoleDao.java
  47. 137 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserDao.java
  48. 36 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserGroupDao.java
  49. 24 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/BaseSchedule.java
  50. 72 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/CronTaskRegister.java
  51. 42 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/DynamicScheduleConfig.java
  52. 24 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/ScheduleConfig.java
  53. 18 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/ScheduledTask.java
  54. 57 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/SchedulingRunnable.java
  55. 19 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/AddUserRole.java
  56. 17 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ChartDataDto.java
  57. 39 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataModel.java
  58. 91 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataSource.java
  59. 36 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataSourceType.java
  60. 61 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Department.java
  61. 52 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Dict.java
  62. 32 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DictType.java
  63. 44 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/FileEntity.java
  64. 45 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Item.java
  65. 65 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ItemGroup.java
  66. 58 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Log.java
  67. 66 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Menu.java
  68. 52 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/MessageNotice.java
  69. 29 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Permission.java
  70. 69 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/RawData.java
  71. 50 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ReportTable.java
  72. 31 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Role.java
  73. 28 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableDataDto.java
  74. 20 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableDataDtoCh.java
  75. 33 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableTemplate.java
  76. 42 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TreeDepartment.java
  77. 67 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/User.java
  78. 44 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserGroup.java
  79. 26 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserGroupUser.java
  80. 26 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserRole.java
  81. 34 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/DataSourceTypeEnum.java
  82. 56 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ModelEnum.java
  83. 21 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/OpcDaDriverEnum.java
  84. 50 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/OperationEnum.java
  85. 41 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ResultEnum.java
  86. 30 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ServerEnum.java
  87. 39 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/exception/CustomException.java
  88. 45 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/exception/GlobalExceptionHandler.java
  89. 19 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DataModelService.java
  90. 23 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DataSourceService.java
  91. 65 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DepartmentService.java
  92. 98 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DictService.java
  93. 23 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ItemGroupService.java
  94. 16 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/LogService.java
  95. 80 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MenuService.java
  96. 16 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MessageNoticeService.java
  97. 23 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/PermissionService.java
  98. 16 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/RawDataService.java
  99. 38 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ReportTableService.java
  100. 86 0
      chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/RoleService.java

+ 33 - 0
chaunyi_opc/opc_da/.gitignore

@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/

BIN
chaunyi_opc/opc_da/.mvn/wrapper/maven-wrapper.jar


+ 2 - 0
chaunyi_opc/opc_da/.mvn/wrapper/maven-wrapper.properties

@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

+ 316 - 0
chaunyi_opc/opc_da/mvnw

@@ -0,0 +1,316 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+#   JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+#   M2_HOME - location of maven2's installed home dir
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
+#     e.g. to debug Maven itself, use
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+  if [ -f /usr/local/etc/mavenrc ] ; then
+    . /usr/local/etc/mavenrc
+  fi
+
+  if [ -f /etc/mavenrc ] ; then
+    . /etc/mavenrc
+  fi
+
+  if [ -f "$HOME/.mavenrc" ] ; then
+    . "$HOME/.mavenrc"
+  fi
+
+fi
+
+# OS specific support.  $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+  CYGWIN*) cygwin=true ;;
+  MINGW*) mingw=true;;
+  Darwin*) darwin=true
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+    if [ -z "$JAVA_HOME" ]; then
+      if [ -x "/usr/libexec/java_home" ]; then
+        export JAVA_HOME="`/usr/libexec/java_home`"
+      else
+        export JAVA_HOME="/Library/Java/Home"
+      fi
+    fi
+    ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+  if [ -r /etc/gentoo-release ] ; then
+    JAVA_HOME=`java-config --jre-home`
+  fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+  ## resolve links - $0 may be a link to maven's home
+  PRG="$0"
+
+  # need this for relative symlinks
+  while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+      PRG="$link"
+    else
+      PRG="`dirname "$PRG"`/$link"
+    fi
+  done
+
+  saveddir=`pwd`
+
+  M2_HOME=`dirname "$PRG"`/..
+
+  # make it fully qualified
+  M2_HOME=`cd "$M2_HOME" && pwd`
+
+  cd "$saveddir"
+  # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --unix "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+  javaExecutable="`which javac`"
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+    # readlink(1) is not available as standard on Solaris 10.
+    readLink=`which readlink`
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+      if $darwin ; then
+        javaHome="`dirname \"$javaExecutable\"`"
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+      else
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
+      fi
+      javaHome="`dirname \"$javaExecutable\"`"
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+      JAVA_HOME="$javaHome"
+      export JAVA_HOME
+    fi
+  fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+  if [ -n "$JAVA_HOME"  ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+      # IBM's JDK on AIX uses strange locations for the executables
+      JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+      JAVACMD="$JAVA_HOME/bin/java"
+    fi
+  else
+    JAVACMD="`\\unset -f command; \\command -v java`"
+  fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly." >&2
+  echo "  We cannot execute $JAVACMD" >&2
+  exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+  echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+  if [ -z "$1" ]
+  then
+    echo "Path not specified to find_maven_basedir"
+    return 1
+  fi
+
+  basedir="$1"
+  wdir="$1"
+  while [ "$wdir" != '/' ] ; do
+    if [ -d "$wdir"/.mvn ] ; then
+      basedir=$wdir
+      break
+    fi
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+    if [ -d "${wdir}" ]; then
+      wdir=`cd "$wdir/.."; pwd`
+    fi
+    # end of workaround
+  done
+  echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+  if [ -f "$1" ]; then
+    echo "$(tr -s '\n' ' ' < "$1")"
+  fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+  exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Found .mvn/wrapper/maven-wrapper.jar"
+    fi
+else
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+    fi
+    if [ -n "$MVNW_REPOURL" ]; then
+      jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+    else
+      jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+    fi
+    while IFS="=" read key value; do
+      case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+      esac
+    done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+    if [ "$MVNW_VERBOSE" = true ]; then
+      echo "Downloading from: $jarUrl"
+    fi
+    wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+    if $cygwin; then
+      wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+    fi
+
+    if command -v wget > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found wget ... using wget"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+        else
+            wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+        fi
+    elif command -v curl > /dev/null; then
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Found curl ... using curl"
+        fi
+        if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+            curl -o "$wrapperJarPath" "$jarUrl" -f
+        else
+            curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+        fi
+
+    else
+        if [ "$MVNW_VERBOSE" = true ]; then
+          echo "Falling back to using Java to download"
+        fi
+        javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+        # For Cygwin, switch paths to Windows format before running javac
+        if $cygwin; then
+          javaClass=`cygpath --path --windows "$javaClass"`
+        fi
+        if [ -e "$javaClass" ]; then
+            if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Compiling MavenWrapperDownloader.java ..."
+                fi
+                # Compiling the Java class
+                ("$JAVA_HOME/bin/javac" "$javaClass")
+            fi
+            if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+                # Running the downloader
+                if [ "$MVNW_VERBOSE" = true ]; then
+                  echo " - Running MavenWrapperDownloader.java ..."
+                fi
+                ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+            fi
+        fi
+    fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+  echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+  [ -n "$M2_HOME" ] &&
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
+  [ -n "$JAVA_HOME" ] &&
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+  [ -n "$CLASSPATH" ] &&
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+  $MAVEN_OPTS \
+  $MAVEN_DEBUG_OPTS \
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+  "-Dmaven.home=${M2_HOME}" \
+  "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 188 - 0
chaunyi_opc/opc_da/mvnw.cmd

@@ -0,0 +1,188 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM
+@REM    https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM     e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+    IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Found %WRAPPER_JAR%
+    )
+) else (
+    if not "%MVNW_REPOURL%" == "" (
+        SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
+    )
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Couldn't find %WRAPPER_JAR%, downloading it ...
+        echo Downloading from: %DOWNLOAD_URL%
+    )
+
+    powershell -Command "&{"^
+		"$webclient = new-object System.Net.WebClient;"^
+		"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+		"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+		"}"^
+		"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+		"}"
+    if "%MVNW_VERBOSE%" == "true" (
+        echo Finished downloading %WRAPPER_JAR%
+    )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+  %JVM_CONFIG_MAVEN_PROPS% ^
+  %MAVEN_OPTS% ^
+  %MAVEN_DEBUG_OPTS% ^
+  -classpath %WRAPPER_JAR% ^
+  "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+  %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%

+ 186 - 0
chaunyi_opc/opc_da/pom.xml

@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.example</groupId>
+        <artifactId>chaunyi_opc</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>opc_da</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <!-- 修改opc_da模块的打包方式为jar,为mapper模块提供依赖 -->
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.example</groupId>
+            <artifactId>opc_ua</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <scope>runtime</scope>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.auth0</groupId>
+            <artifactId>java-jwt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.quartz-scheduler</groupId>
+            <artifactId>quartz</artifactId>
+        </dependency>
+        <!--对象池化组件-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+        <!--数学四则运算依赖 -->
+        <dependency>
+            <groupId>com.mpobjects</groupId>
+            <artifactId>bdparsii</artifactId>
+        </dependency>
+        <!--opcDa读取依赖-->
+        <!--utgard -->
+        <dependency>
+            <groupId>org.openscada.external</groupId>
+            <artifactId>org.openscada.external.jcifs</artifactId>
+            <version>1.2.25</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.bouncycastle</groupId>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+
+        <!--这个依赖不能要,不然会影响opcda获取所有驱动-->
+<!--        <dependency>-->
+<!--            <groupId>org.openscada.jinterop</groupId>-->
+<!--            <artifactId>org.openscada.jinterop.core</artifactId>-->
+<!--            <version>2.1.8</version>-->
+<!--        </dependency>-->
+        <!--这个依赖不能要,不然会影响opcda获取所有驱动-->
+
+        <!--这个依赖不能要,不然会影响opcua获取所有驱动-->
+        <dependency>
+            <groupId>org.jinterop</groupId>
+            <artifactId>j-interop</artifactId>
+            <version>3.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jinterop</groupId>
+            <artifactId>j-interopdeps</artifactId>
+            <version>3.0.0</version>
+        </dependency>
+        <!--这个依赖不能要,不然会影响opcua获取所有驱动-->
+
+
+        <dependency>
+            <groupId>org.openscada.jinterop</groupId>
+            <artifactId>org.openscada.jinterop.deps</artifactId>
+            <version>1.5.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.bouncycastle</groupId>
+                    <artifactId>bcprov-jdk15on</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.openscada.utgard</groupId>
+            <artifactId>org.openscada.opc.dcom</artifactId>
+            <version>1.5.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openscada.utgard</groupId>
+            <artifactId>org.openscada.opc.lib</artifactId>
+            <version>1.5.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk15on</artifactId>
+            <version>1.61</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+        </dependency>
+        <!--opcDa读取依赖-->
+
+        <!--Test依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 21 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/OpcDaApplication.java

@@ -0,0 +1,21 @@
+package com.example.opc_da;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.bind.annotation.CrossOrigin;
+
+@CrossOrigin
+@SpringBootApplication
+@EnableAsync//开启异步
+@EnableScheduling//开启定时器
+@MapperScan("com.example.opc_da.dao")
+public class OpcDaApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(OpcDaApplication.class, args);
+    }
+
+}

+ 13 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/PermissionControl.java

@@ -0,0 +1,13 @@
+package com.example.opc_da.annotation;
+
+
+import java.lang.annotation.*;
+
+/**
+ * 加入此注解后,表明,需要管理员权限才能调动此接口
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)//用来修饰自定义注解的生命力。SOURCE,则它将被限定在Java源文件中。CLASS,则它将被编译到Class文件中。RUNTIME,在运行期的加载阶段被加载到Class对象中
+@Target(ElementType.METHOD)//使用范围,表明使用在(方法)METHOD上面
+public @interface PermissionControl {
+}

+ 120 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/PermissionControlAspect.java

@@ -0,0 +1,120 @@
+package com.example.opc_da.annotation;
+
+import com.example.opc_da.dao.MenuDao;
+import com.example.opc_da.dao.RoleDao;
+import com.example.opc_da.dao.UserDao;
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.entity.Role;
+import com.example.opc_da.entity.User;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.exception.CustomException;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+@Aspect
+@Slf4j
+public class PermissionControlAspect {
+
+    @Resource
+    private UserDao userDao;
+
+    @Resource
+    private RoleDao roleDao;
+
+    @Resource
+    private MenuDao menuDao;
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    @Resource
+    private HttpServletRequest request;
+
+    /**
+     * 定义切点 @Pointcut
+     * 在注解的位置切入代码
+     */
+    @Pointcut("execution(* com.judong.chuanyiserver..*.*(..))")
+    public void permissionControl() {
+    }
+
+    /**
+     * 环绕通知
+     */
+    @Around(value = "permissionControl() && @annotation(com.example.opc_da.annotation.PermissionControl)")
+    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        request = attributes.getRequest();
+        if (Blank.isEmpty(request)) {
+            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+        }
+        String userId = (String) redisUtil.get(request.getHeader("token"));
+        if (Blank.isEmpty(userId)) {
+            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+        }
+        User user = userDao.getUserById(userId);
+        if (Blank.isEmpty(user)) {
+            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+        }
+        List<Role> roleList = userDao.getRoleListByUserId(user.getUserId());
+        if (Blank.isEmpty(roleList)) {
+            throw new CustomException(ResultEnum.NO_OPERATION_AUTHORITY.getRespCode(), ResultEnum.NO_OPERATION_AUTHORITY.getRespMsg());
+        }
+        List<Menu> menuList = roleDao.getMenuListByroleList(roleList);
+        if (Blank.isEmpty(menuList)) {
+            throw new CustomException(ResultEnum.NO_OPERATION_AUTHORITY.getRespCode(), ResultEnum.NO_OPERATION_AUTHORITY.getRespMsg());
+        }
+        List<Permission> permissionList = menuDao.getPermissionListByMenuList(menuList);
+        if (Blank.isEmpty(permissionList)) {
+            throw new CustomException(ResultEnum.NO_OPERATION_AUTHORITY.getRespCode(), ResultEnum.NO_OPERATION_AUTHORITY.getRespMsg());
+        }
+        for (Permission permission : permissionList) {
+            if (permission.getPermissionUrl().equals(request.getRequestURI())) {
+                // 获取签名
+                Signature signature = joinPoint.getSignature();
+                // 获取切入的包名
+                String declaringTypeName = signature.getDeclaringTypeName();
+                // 获取即将执行的方法名
+                String funcName = signature.getName();
+                Map<String, Object> params = new HashMap<>();
+                String[] keys = ((MethodSignature) signature).getParameterNames();
+                Object[] args = joinPoint.getArgs();
+                for (int i = 0; i < keys.length; i++) {
+                    params.put(keys[i], args[i]);
+                }
+                log.info("即将执行{}包下的方法,方法名为: {}", declaringTypeName, funcName);
+                log.info("请求的参数有: {}", params.toString());
+                return joinPoint.proceed();
+            }
+        }
+        throw new CustomException(ResultEnum.NO_OPERATION_AUTHORITY.getRespCode(), ResultEnum.NO_OPERATION_AUTHORITY.getRespMsg());
+    }
+
+    @Before(value = "permissionControl() && @annotation(com.example.opc_da.annotation.PermissionControl)")
+    public void before(JoinPoint joinPoint) {
+        // 请求参数
+//        System.out.println("Before");
+    }
+
+    @After(value = "permissionControl() && @annotation(com.example.opc_da.annotation.PermissionControl)")
+    public void after() {
+//        System.out.println("After");
+    }
+}

+ 22 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/WebLog.java

@@ -0,0 +1,22 @@
+package com.example.opc_da.annotation;
+
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ServerEnum;
+
+import java.lang.annotation.*;
+
+/**
+ * 系统全局日志注解
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface WebLog {
+
+    ServerEnum ServerEnum() default ServerEnum.UNKNOWN;
+
+    ModelEnum ModelEnum() default ModelEnum.UNKNOWN;
+
+    OperationEnum OperationEnum() default OperationEnum.UNKNOWN;
+}

+ 133 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/annotation/WebLogAspect.java

@@ -0,0 +1,133 @@
+package com.example.opc_da.annotation;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.extra.servlet.ServletUtil;
+import com.example.opc_da.dao.UserDao;
+import com.example.opc_da.entity.Log;
+import com.example.opc_da.entity.User;
+import com.example.opc_da.service.LogService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.RedisUtil;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.Signature;
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+@Aspect
+@Slf4j
+@Order(100)
+public class WebLogAspect {
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    @Resource
+    private LogService logService;
+
+    @Resource
+    private HttpServletRequest request;
+
+    @Resource
+    private UserDao userDao;
+
+    private String methodName;
+
+    private String requestArgs;
+
+    private Long beginTime;
+
+
+    /**
+     * 定义切点 @Pointcut
+     * 在注解的位置切入代码
+     */
+    @Pointcut("execution(* com.judong.chuanyiserver..*.*(..))")
+    public void webLog() {
+    }
+
+    /**
+     * 环绕通知
+     */
+    @Around(value = "webLog() && @annotation(com.example.opc_da.annotation.WebLog)")
+    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+        beginTime = System.currentTimeMillis();
+        // 获取签名
+        Signature signature = joinPoint.getSignature();
+        // 获取切入的包名
+        String declaringTypeName = signature.getDeclaringTypeName();
+        // 获取即将执行的方法名
+        String funcName = signature.getName();
+        Map<String, Object> params = new HashMap<>();
+        String[] keys = ((MethodSignature) signature).getParameterNames();
+        Object[] args = joinPoint.getArgs();
+        for (int i = 0; i < keys.length; i++) {
+            params.put(keys[i], args[i]);
+        }
+        methodName = declaringTypeName + "." + funcName;
+        requestArgs = params.toString();
+        log.info("即将执行{}包下的方法,方法名为: {}", declaringTypeName, funcName);
+        log.info("请求的参数有: {}", params.toString());
+        return joinPoint.proceed();
+    }
+
+    @Before(value = "webLog() && @annotation(com.example.opc_da.annotation.WebLog)")
+    public void before(JoinPoint joinPoint) {
+        System.out.println("Before");
+    }
+
+    @After(value = "webLog() && @annotation(com.example.opc_da.annotation.WebLog)")
+    public void after() {
+        System.out.println("After");
+    }
+
+    @AfterReturning(value = "webLog() && @annotation(com.example.opc_da.annotation.WebLog)", returning = "result")
+    public void doAfterReturning(JoinPoint joinPoint, Object result) {
+        Log log = new Log();
+        //获取抽象方法
+        Signature signature = joinPoint.getSignature();
+        MethodSignature methodSignature = (MethodSignature) signature;
+        //获取目标对象上的Method对象
+        Method method = methodSignature.getMethod();
+        //获取注解
+        WebLog webLog = method.getAnnotation(WebLog.class);
+        if (webLog != null) {
+            log.setServerName(webLog.ServerEnum().getName());
+            log.setModelName(webLog.ModelEnum().getValue());
+        }
+        log.setMethodName(methodName);
+        if (Blank.isNotEmpty(result)) {
+            if (result instanceof Result){
+                log.setOperationStatus(((Result) result).getCode());
+            }
+        }
+        log.setContent("操作类型:" + webLog.OperationEnum().getValue() + "\n请求参数:" + requestArgs + "\n响应结果:" + result.toString());
+        String userId = Convert.toStr(redisUtil.get(request.getHeader("token")));
+        User user = userDao.getUserById(userId);
+        String userName = user == null ? "" : (user.getUserName() + "@");
+        log.setUserId(userName + userId);
+        String clientIP = ServletUtil.getClientIP(request, "");
+        clientIP = "0:0:0:0:0:0:0:1".equals(clientIP) ? "127.0.0.1" : clientIP;
+        log.setIpAddress(clientIP);
+        log.setConsumeTime((System.currentTimeMillis() - beginTime) + "ms");
+        logService.insertLog(log);
+    }
+
+    //后置异常通知
+    @AfterThrowing(value = "webLog() && @annotation(com.example.opc_da.annotation.WebLog)")
+    public void afterThrowing(JoinPoint joinPoint) {
+        System.out.println("AfterThrowing");
+    }
+
+}

+ 26 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/CrossConfig.java

@@ -0,0 +1,26 @@
+package com.example.opc_da.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import org.springframework.web.filter.CorsFilter;
+
+@Configuration
+public class CrossConfig {
+
+    // 当前跨域请求最大有效时长。这里默认1天
+    private static final long MAX_AGE = 24 * 60 * 60;
+
+    @Bean
+    public CorsFilter corsFilter() {
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        CorsConfiguration corsConfiguration = new CorsConfiguration();
+        corsConfiguration.addAllowedOrigin("*"); // 1 设置访问源地址
+        corsConfiguration.addAllowedHeader("*"); // 2 设置访问源请求头
+        corsConfiguration.addAllowedMethod("*"); // 3 设置访问源请求方法
+        corsConfiguration.setMaxAge(MAX_AGE);
+        source.registerCorsConfiguration("/**", corsConfiguration); // 4 对接口配置跨域设置
+        return new CorsFilter(source);
+    }
+}

+ 41 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/InterceptorConfig.java

@@ -0,0 +1,41 @@
+package com.example.opc_da.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 拦截器配置
+ */
+@Configuration
+public class InterceptorConfig implements WebMvcConfigurer {
+
+    //将拦截器bean化
+    @Bean
+    public Interceptors interceptors(){
+        return new Interceptors();
+    }
+
+    //注册自己的拦截器,并设置拦截的请求路径
+    //addPathPatterns为拦截此请求路径的请求
+    //excludePathPatterns为不拦截此路径的请求
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(interceptors())
+                .addPathPatterns("/**")
+                .excludePathPatterns("/user/getCodeImage")
+                .excludePathPatterns("/user/getPublicKey")
+                .excludePathPatterns("/user/frontUserLogin")
+                .excludePathPatterns("/user/backUserLogin")
+                .excludePathPatterns("/connect/testConnect")
+                .excludePathPatterns("/user/assignUserListByRoleId")
+                .excludePathPatterns("/role/getMenuTreeByRoleList")
+                .excludePathPatterns("/user/getUserById")
+                .excludePathPatterns("/file/uploadFiles")
+                .excludePathPatterns("/itemGroup/test")
+                .excludePathPatterns("/itemGroup/test1")
+//                .excludePathPatterns("/**")
+        ;
+    }
+}

+ 54 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/Interceptors.java

@@ -0,0 +1,54 @@
+package com.example.opc_da.config;
+
+import cn.hutool.core.convert.Convert;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.ConstantStr;
+import com.example.opc_da.util.RedisUtil;
+import com.example.opc_da.exception.CustomException;
+import org.springframework.web.servlet.HandlerInterceptor;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * 拦截器配置
+ */
+public class Interceptors implements HandlerInterceptor {
+
+    @Resource
+    private RedisUtil redisUtil;
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
+        String token = request.getHeader("token");
+        String requestURI = request.getRequestURI();
+        if (Blank.isEmpty(token)) {
+            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+        }
+
+//        boolean verify = TokenUtil.verify(token);
+//        if (!verify) {
+//            throw new CustomException(ResultEnum.UNAUTHORIZED.getRespCode(), ResultEnum.UNAUTHORIZED.getRespMsg());
+//        }
+//        return verify;
+        String userId = Convert.toStr(redisUtil.get(token));
+        if (Blank.isNotEmpty(userId)){
+            redisUtil.set(token, userId, ConstantStr.FIVE_HOUR);
+        }
+        return true;
+    }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+        HandlerInterceptor.super.postHandle(request, response, handler, modelAndView);
+    }
+
+    @Override
+    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
+        HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
+    }
+
+}

+ 29 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/MessageReceiver.java

@@ -0,0 +1,29 @@
+package com.example.opc_da.config;
+
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.connection.MessageListener;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class MessageReceiver implements MessageListener {
+
+    private static Logger logger = LoggerFactory.getLogger(MessageReceiver.class);
+
+    @Autowired
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public void onMessage(Message message, byte[] pattern) {
+        logger.info("channel:" + new String(pattern));
+        Result result = (Result) redisTemplate.getValueSerializer().deserialize(message.getBody());
+        System.out.println("接收到的消息是:" + result);
+        logger.info("Received <" + result + ">");
+    }
+}

+ 55 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/RedisConfig.java

@@ -0,0 +1,55 @@
+package com.example.opc_da.config;
+
+import com.example.opc_da.util.ConstantStr;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.listener.PatternTopic;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+@Configuration
+public class RedisConfig {
+
+    /*
+     * Redis消息监听器容器
+     * 这个容器加载了RedisConnectionFactory和消息监听器
+     * 可以添加多个监听不同话题的redis监听器,只需要把消息监听器和相应的消息订阅处理器绑定,该消息监听器
+     * 通过反射技术调用消息订阅处理器的相关方法进行一些业务处理
+     */
+    @Bean
+    public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory, MessageListenerAdapter adapter) {
+        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+        container.setConnectionFactory(connectionFactory);
+        //可以添加多个 messageListener
+        container.addMessageListener(adapter, new PatternTopic(ConstantStr.ITEM_GROUP));
+        return container;
+    }
+
+    /*
+     * 消息监听器适配器,绑定消息处理器,利用反射技术调用消息处理器的业务方法
+     * 将MessageReceiver注册为一个消息监听器,可以自定义消息接收的方法(handleMessage)
+     * 如果不指定消息接收的方法,消息监听器会默认的寻找MessageReceiver中的onMessage这个方法作为消息接收的方法
+     */
+    @Bean
+    public MessageListenerAdapter adapter(MessageReceiver messageReceiver) {
+        return new MessageListenerAdapter(messageReceiver, "onMessage");
+    }
+
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        //key value序列化方式
+        redisTemplate.setKeySerializer(new StringRedisSerializer());
+        redisTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
+        //对hash序列化
+        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
+        redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
+        //注入连接工厂
+        redisTemplate.setConnectionFactory(redisConnectionFactory);
+        return redisTemplate;
+    }
+}

+ 61 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/SpringContextUtils.java

@@ -0,0 +1,61 @@
+package com.example.opc_da.config;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SpringContextUtils implements ApplicationContextAware {
+
+    private static ApplicationContext applicationContext = null;
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        if (SpringContextUtils.applicationContext == null) {
+            SpringContextUtils.applicationContext = applicationContext;
+        }
+    }
+
+    /**
+     * 获取ApplicationContext
+     *
+     * @return
+     */
+    public static ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+
+    /**
+     * 通过name获取Bean
+     *
+     * @param name
+     * @return
+     */
+    public static Object getBean(String name) {
+        return getApplicationContext().getBean(name);
+    }
+
+    /**
+     * 通过class获取Bean
+     *
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public static <T> T getBean(Class<T> clazz) {
+        return getApplicationContext().getBean(clazz);
+    }
+
+    /**
+     * 通过name和clazz返回指定的Bean
+     *
+     * @param name
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public static <T> T getBean(String name, Class<T> clazz) {
+        return getApplicationContext().getBean(name, clazz);
+    }
+}

+ 52 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/config/ThreadPoolConfig.java

@@ -0,0 +1,52 @@
+package com.example.opc_da.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * 线程池配置
+ */
+@Configuration
+public class ThreadPoolConfig {
+
+    private static final int corePoolSize = 10;               // 默认线程数
+    private static final int maxPoolSize = 100;                // 最大线程数
+    private static final int keepAliveTime = 10;            // 允许线程空闲时间(单位:默认为秒),十秒后就把线程关闭,默认60s
+    private static final int queueCapacity = 200;            // 缓冲队列数
+    private static final boolean waitForTasksToCompleteOnShutdown = false;// 当任务完成后,长时间无待处理任务时,销毁线程池
+    private static final int awaitTerminationSeconds = 0;
+    private static final String threadNamePrefix = "Async-Thread-"; // 线程池名前缀
+
+    @Bean("threadPoolTaskExecutor") // bean的名称,默认为首字母小写的方法名
+    public ThreadPoolTaskExecutor taskExecutor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(keepAliveTime);
+        executor.setKeepAliveSeconds(queueCapacity);
+        executor.setThreadNamePrefix(threadNamePrefix);
+        // 当任务完成后,长时间无待处理任务时,销毁线程池
+        executor.setWaitForTasksToCompleteOnShutdown(waitForTasksToCompleteOnShutdown);
+        executor.setAwaitTerminationSeconds(awaitTerminationSeconds);
+
+        //线程池拒绝任务的处理策略
+        /**
+         * 4种
+         * ThreadPoolExecutor类有几个内部实现类来处理这类情况:
+         - AbortPolicy 丢弃任务,抛RejectedExecutionException
+         - CallerRunsPolicy 由该线程调用线程运行。直接调用Runnable的run方法运行。
+         - DiscardPolicy  抛弃策略,直接丢弃这个新提交的任务
+         - DiscardOldestPolicy 抛弃旧任务策略,从队列中踢出最先进入队列(最后一个执行)的任务
+         * 实现RejectedExecutionHandler接口,可自定义处理器
+         */
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        //初始化
+        executor.initialize();
+
+        return executor;
+    }
+
+}

+ 114 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataModelController.java

@@ -0,0 +1,114 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.entity.DataModel;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.DataModelService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import com.example.opc_da.annotation.WebLog;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("dataModel")
+@Slf4j
+public class DataModelController {
+
+    @Resource
+    private DataModelService dataModelService;
+
+    /**
+     * 增加数据模型
+     *
+     * @param dataModel
+     * @return
+     */
+    @PostMapping("/addDataModel")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.ADD)
+    public Result addDataModel(@RequestBody DataModel dataModel) {
+        if (Blank.isEmpty(dataModel, dataModel.getRemark(), dataModel.getMathParameter(), dataModel.getOperationRule())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空,数学参数和四则混合运算表达式不能为空");
+        }
+        return dataModelService.addDataModel(dataModel);
+    }
+
+    /**
+     * 修改数据模型
+     *
+     * @param dataModel
+     * @return
+     */
+    @PostMapping("/updateDataModel")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.UPDATE)
+    public Result updateDataModel(@RequestBody DataModel dataModel) {
+        if (Blank.isEmpty(dataModel, dataModel.getId(), dataModel.getRemark(), dataModel.getMathParameter(), dataModel.getOperationRule())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "名称不能为空,数学参数和四则混合运算表达式不能为空");
+        }
+        return dataModelService.updateDataModel(dataModel);
+    }
+
+    /**
+     * 获取当前登录人的所有数据模型
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("getAllDataModel")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.SELECT)
+    public Result getAllDataModel(Integer page, Integer limit) {
+        return dataModelService.getAllDataModel(page, limit);
+    }
+
+    /**
+     * 根据id获取数据模型
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getDataModelById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.SELECT)
+    public Result getDataModelById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataModelService.getDataModelById(id);
+    }
+
+    /**
+     * 删除数据模型
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delDataModelById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.DELETE)
+    public Result delDataModelById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataModelService.delDataModelById(id);
+    }
+
+    /**
+     * 测试数据模型的值
+     *
+     * @param id        数据模型id
+     * @param dataValue 测试的值
+     * @return
+     */
+    @GetMapping("/testDataModelById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAMODEL, OperationEnum = OperationEnum.TEST)
+    public Result testDataModelById(Integer id, Double dataValue) {
+        if (Blank.isEmpty(id, dataValue)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataModelService.testDataModelById(id, dataValue);
+    }
+
+}

+ 136 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DataSourceController.java

@@ -0,0 +1,136 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.DataSource;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.DataSourceService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("dataSource")
+@Slf4j
+public class DataSourceController {
+
+    @Resource
+    private DataSourceService dataSourceService;
+
+    /**
+     * 获取数据源配置类型树
+     *
+     * @return
+     */
+    @GetMapping("/getDataSourceTree")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
+    public Result getDataSourceTree() {
+        return dataSourceService.getDataSourceTree();
+    }
+
+    /**
+     * 增加数据源
+     *
+     * @param dataSource
+     * @return
+     */
+    @PostMapping("/addDataSource")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.ADD)
+    public Result addDataSource(@RequestBody DataSource dataSource) {
+        if (Blank.isEmpty(dataSource, dataSource.getTypeId(), dataSource.getDataSourceName())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据源名称不能为空");
+        }
+        return dataSourceService.addDataSource(dataSource);
+    }
+
+    /**
+     * 获取Da下面的所有驱动
+     *
+     * @param dataSource
+     * @return
+     */
+    @PostMapping("/getDaAllDriver")
+    public Result getDaAllDriver(@RequestBody DataSource dataSource) {
+        if (Blank.isEmpty(dataSource, dataSource.getTypeId(), dataSource.getIpAddress(), dataSource.getIpUserName(), dataSource.getIpPassword())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "ip地址,账号,密码都不能为空");
+        }
+        return dataSourceService.getDaAllDriver(dataSource);
+    }
+
+    /**
+     * 测试数据源配置连接
+     *
+     * @param dataSource
+     * @return
+     */
+    @PostMapping("/testConnect")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.TEST)
+    public Result testConnect(@RequestBody DataSource dataSource) {
+        if (Blank.isEmpty(dataSource, dataSource.getTypeId(), dataSource.getDataSourceName())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "数据源名称不能为空");
+        }
+        return dataSourceService.testConnect(dataSource);
+    }
+
+    /**
+     * 获取当前登录人的所有数据源配置
+     *
+     * @return
+     */
+    @GetMapping("/getAllDataSource")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
+    public Result getAllDataSource() {
+        return dataSourceService.getAllDataSource();
+    }
+
+    /**
+     * 通过id获取数据源配置
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getDataSourceById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
+    public Result getDataSourceById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataSourceService.getDataSourceById(id);
+    }
+
+    /**
+     * 获取数据源下的tree
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getDataSourceItemTree/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.SELECT)
+    public Result getDataSourceItemTree(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataSourceService.getDataSourceItemTree(id);
+    }
+
+    /**
+     * 通过id删除数据源配置
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delDataSourceById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATASOURCE, OperationEnum = OperationEnum.DELETE)
+    public Result delDataSourceById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return dataSourceService.delDataSourceById(id);
+    }
+
+}

+ 210 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DepartmentController.java

@@ -0,0 +1,210 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Department;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.DepartmentService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("department")
+public class DepartmentController {
+
+    @Autowired
+    private DepartmentService departmentService;
+
+    /**
+     * 新增部门
+     *
+     * @param department
+     * @return
+     */
+    @PostMapping("/addDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.ADD)
+    public Result addDepartment(@RequestBody Department department) {
+        if (Blank.isEmpty(department)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.addDepartment(department);
+    }
+
+    /**
+     * 修改部门信息
+     *
+     * @param department
+     * @return
+     */
+    @PostMapping("/updateDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.UPDATE)
+    public Result updateDepartment(@RequestBody Department department) {
+        if (Blank.isEmpty(department)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.updateDepartment(department);
+    }
+
+    /**
+     * 分页查询所有的部门信息
+     *
+     * @param page
+     * @param limit
+     * @param departmentName
+     * @param createTime
+     * @return
+     */
+    @GetMapping("/getDepartmentListByPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.SELECT)
+    public Result getDepartmentListByPage(Integer page, Integer limit, String departmentName, String createTime) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.getDepartmentListByPage(page, limit, departmentName, createTime);
+    }
+
+    /**
+     * 通过角色id查看部门信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getDepartmentById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.SELECT)
+    public Result getDepartmentById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.getDepartmentById(id);
+    }
+
+    /**
+     * 根据父亲id查子节点(一级查询)
+     */
+    @GetMapping("/queryChildren")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.SELECT)
+    public Result queryDepartmentChildren(Integer parenId){
+        if (Blank.isEmpty(parenId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.queryDepartmentByParentId(parenId);
+    }
+
+
+    /**
+     * 根据父亲id查所有子节点
+     */
+    @GetMapping("/queryAllChildren")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.SELECT)
+    public Result queryDepartmentAllChildren(Integer parenId){
+        if (Blank.isEmpty(parenId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        List<Department> departments = departmentService.queryDepartmentAllChildren(parenId);
+        return Result.ok(departments);
+    }
+
+    /**
+     * 逻辑删除(批量删除)
+     */
+    @PostMapping("/isDeleteById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result isDeleteByid(@RequestBody List<Integer> ids){
+        if (Blank.isEmpty(ids)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.isDeleteById(ids);
+    }
+
+    /**
+     * 根据部门查部门员工
+     */
+    @GetMapping("queryUserByDepartmentId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result queryUserByDepartmentId(Integer departmentId,Integer page,Integer num){
+        if (Blank.isEmpty(departmentId,page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.queryUserByDepartmentId(departmentId, page, num);
+    }
+
+    /**
+     *根据用户id查询所属部门
+     */
+    @GetMapping("queryDepartmentByUserId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result queryDepartmentByUserId(String userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.queryDepartmentByUserId(userId);
+    }
+
+    /**
+     * 批量添加部门用户
+     */
+    @GetMapping("/addUserDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result addUserDepartment(@RequestParam("userIds") List<String> userIds, Integer departmentId){
+        if (Blank.isEmpty(userIds,departmentId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.addUserDepartment(userIds, departmentId);
+    }
+
+    /**
+     * 更新用户所属部门
+     */
+    @GetMapping("/updateUserDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result updateUserDepartment(String userId, Integer departmentId){
+        if (Blank.isEmpty(userId,departmentId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.updateUserDepartment(userId, departmentId);
+    }
+
+    /**
+     * 批量删除部门所属员工
+     *
+     */
+    @GetMapping("/deleteUserDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result deleteUserDepartment(@RequestParam("userIds") List<String> userIds, Integer departmentId){
+        if (Blank.isEmpty(userIds,departmentId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.deleteUserDepartment(userIds, departmentId);
+    }
+
+    /**
+     * 查询部门详情
+     *
+     */
+    @GetMapping("/queryDepartmentDetail")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DEPARTMENT, OperationEnum = OperationEnum.DELETE)
+    public Result queryDepartmentDetail(Integer departmentId){
+        if (Blank.isEmpty(departmentId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return departmentService.queryDepartmentDetail(departmentId);
+    }
+
+}

+ 234 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/DictController.java

@@ -0,0 +1,234 @@
+package com.example.opc_da.controller;
+
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Dict;
+import com.example.opc_da.entity.DictType;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.DictService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+@RequestMapping("dict")
+public class DictController {
+
+    @Resource
+    private DictService dictService;
+
+
+    /**
+     * 查询所有数据
+     */
+    @GetMapping("/queryAll")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryAll(Integer page, Integer num){
+        return dictService.queryAll(page, num);
+    }
+
+    /**
+     * 分页查询
+     * param dictKey
+     * param dictValue
+     * param page
+     * param num
+     */
+    @GetMapping("/queryPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryPage(String dictKey,String dictValue,Integer dictTypeId,Integer page,Integer num){
+        if (Blank.isEmpty(page,num)){
+            return  Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "参数错误");
+        }
+        return dictService.queryPage(dictKey, dictValue,dictTypeId, page, num);
+    }
+
+
+    /**
+     * 根据id或者dice_key查询
+     */
+    @GetMapping("/queryByIdorKey")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryByIdOrKey(Integer id,String dictKey,Integer page,Integer num){
+        if (Blank.isEmpty(page,num)){
+            return  Result.no(ResultEnum.SERVER_ERROR.getRespCode(), "参数错误");
+        }
+        return dictService.queryByIdOrKey(id, dictKey,page,num);
+    }
+
+    /**
+     * 根据父id查子节点信息 树结构
+     * param parentId
+     */
+    @GetMapping("/queryByParentId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryByParentId(Integer parentId){
+        if (Blank.isEmpty(parentId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "父id不能为空");
+        }
+        List<Dict> dicts = dictService.queryByParentId(parentId);
+        return Result.ok(dicts);
+    }
+
+    /**
+     * 新增
+     */
+    @PostMapping("/addDict")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.ADD)
+    public Result addDict(@RequestBody Dict dict){
+        return dictService.addDict(dict);
+    }
+
+    /**
+     * 根据id修改
+     */
+    @PostMapping("/updateById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.UPDATE)
+    public Result updataById(@RequestBody Dict dict){
+        return dictService.updataById(dict);
+    }
+
+    /**
+     * 根据id删除(批量)
+     */
+    @PostMapping("deleteById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.DELETE)
+    public Result deleteByid(@RequestBody List<Integer> ids){
+        return dictService.deleteByid(ids);
+    }
+
+    /**
+     * 根据key批量查询
+     */
+    @GetMapping("queryByDictKey")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryByDictKey(@RequestParam("dictKeys") List<String> dictKeys){
+        if (dictKeys.size()<=0){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        List<Dict> dicts = dictService.queryByDictKey(dictKeys);
+        return Result.ok(dicts);
+    }
+
+    /**
+     *查询所有字典类型
+     */
+    @GetMapping("queryType")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryType(Integer page,Integer num,String dictKeyType,String description){
+        return dictService.queryType(page, num, dictKeyType, description);
+    }
+
+
+    /**
+     *根据字典类型查询对应数据
+     */
+    @GetMapping("queryByType")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryByType(String keyType,Integer page,Integer num){
+        return dictService.queryByType(keyType, page, num);
+    }
+
+
+    /**
+     * 字典类型新增
+     */
+    @PostMapping("addDictType")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.ADD)
+    public Result addDictType(@RequestBody DictType dictType){
+        return dictService.addDictType(dictType);
+    }
+
+    /**
+     * 字典类型修改
+     */
+    @PostMapping("updataDictType")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.UPDATE)
+    public Result updataDictType(@RequestBody DictType dictType){
+        return dictService.updataDictType(dictType);
+    }
+
+    /**
+     * 根据字典类型id删除字典类型(批量)
+     */
+    @PostMapping("deleteDictTypeById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.DELETE)
+    public Result deleteDictTypeById(@RequestBody List<Integer> ids){
+        return dictService.deleteDictTypeById(ids);
+    }
+
+
+    /**
+     * 查询所有的字典类型
+     * 返回map(key:dictKeyType,Value:dictKeyValue)
+     */
+    @GetMapping("queryTypeAll")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryTypeAll(){
+        return dictService.queryTypeAll();
+    }
+
+
+    /**
+     *根据字典类型查询对应数据(不分页)
+     */
+    @GetMapping("queryByTypes")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryByTypes(String keyType){
+        if (Blank.isEmpty(keyType)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),"参数错误");
+        }
+        return dictService.queryByTypes(keyType);
+    }
+
+    /**
+     *查询字典类型详情
+     */
+    @GetMapping("queryDictTypeById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryDictTypeById(Integer dictTypeId){
+        if (Blank.isEmpty(dictTypeId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),"参数错误");
+        }
+        return dictService.queryDictTypeById(dictTypeId);
+    }
+
+
+    /**
+     *查询字典详情
+     */
+    @GetMapping("queryDictById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.DICT, OperationEnum = OperationEnum.SELECT)
+    public Result queryDictById(Integer dictId){
+        if (Blank.isEmpty(dictId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),"参数错误");
+        }
+        return dictService.queryDictById(dictId);
+    }
+
+
+}

+ 18 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/FileController.java

@@ -0,0 +1,18 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.util.Result;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController
+@RequestMapping("file")
+public class FileController {
+
+    @PostMapping("/uploadFiles")
+    public Result uploadFiles(@RequestParam(value = "files", required = false) MultipartFile[] files) {
+        return null;
+    }
+}

+ 94 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ItemGroupController.java

@@ -0,0 +1,94 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Item;
+import com.example.opc_da.entity.ItemGroup;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.ItemGroupService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("itemGroup")
+@Slf4j
+public class ItemGroupController {
+
+    @Resource
+    private ItemGroupService itemGroupService;
+
+    @PostMapping("/addItemGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.ADD)
+    public Result addItemGroup(@RequestBody ItemGroup itemGroup) {
+        if (Blank.isEmpty(itemGroup, itemGroup.getGroupName())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "组名称不能为空");
+        }
+        return itemGroupService.addItemGroup(itemGroup);
+    }
+
+    @GetMapping("/getAllItemGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getAllItemGroup() {
+        return itemGroupService.getAllItemGroup();
+    }
+
+    @GetMapping("/getItemGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getItemGroupById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.getItemGroupById(id);
+    }
+
+    @PostMapping("/delItemGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.DELETE)
+    public Result delItemGroupById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.delItemGroupById(id);
+    }
+
+    @PostMapping("/runItemGroupById")
+    public Result runItemGroupById(Integer id, Integer runState) {
+        if (Blank.isEmpty(id, runState)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.runItemGroupById(id, runState);
+    }
+
+    @GetMapping("/getItemValueById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getItemValueById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.getItemValueById(id);
+    }
+
+    @PostMapping("/updateItemDescribe")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.DATAGROUP, OperationEnum = OperationEnum.UPDATE)
+    public Result updateItemDescribe(@RequestBody Item item) {
+        if (Blank.isEmpty(item, item.getId(), item.getDescribe())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.updateItemDescribe(item);
+    }
+
+    @GetMapping("/getTableItemGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.SELECT)
+    public Result getTableItemGroupById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return itemGroupService.getTableItemGroupById(id);
+    }
+
+}

+ 41 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/LogController.java

@@ -0,0 +1,41 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.service.LogService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("log")
+@Slf4j
+public class LogController {
+
+    @Autowired
+    private LogService logService;
+
+    @GetMapping("/getLogPage")
+    @PermissionControl
+    public Result getLogPage(int page, int limit, String serverName, String modelName, String content, String userId, String ipAddress, String methodName, String startDate, String endDate) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return logService.getLogPage(page, limit, serverName, modelName, content, userId, ipAddress, methodName,startDate,endDate);
+    }
+
+    /**
+     * 删除6个月之前数据
+     */
+    @GetMapping("/deleteByDate")
+    @PermissionControl
+    public Result logDeleteByDate(){
+        return logService.logDeleteByTime();
+    }
+
+
+}

+ 275 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MenuController.java

@@ -0,0 +1,275 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.MenuService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("menu")
+public class MenuController {
+
+    @Autowired
+    private MenuService menuService;
+
+    /**
+     * 新增菜单
+     *
+     * @param menu
+     * @return
+     */
+    @PostMapping("/addMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.ADD)
+    public Result addMenu(@RequestBody Menu menu) {
+        if (Blank.isEmpty(menu)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.addMenu(menu);
+    }
+
+    /**
+     * 修改菜单信息.这个接口,父id不允许被修改
+     *
+     * @param menu
+     * @return
+     */
+    @PostMapping("/updateMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.UPDATE)
+    public Result updateMenu(@RequestBody  Menu menu) {
+        if (Blank.isEmpty(menu)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.updateMenu(menu);
+    }
+
+    /**
+     * 分页查询所有的菜单信息
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getMenuListByPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result getMenuListByPage(Integer page, Integer limit, String menuName, String menuUrl, Integer menuStatus) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.getMenuListByPage(page, limit, menuName, menuUrl, menuStatus);
+    }
+
+    /**
+     * 通过id查看菜单信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getMenuById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result getMenuById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.getMenuById(id);
+    }
+
+    /**
+     * 通过id删除菜单信息,同时删除菜单关联的信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/deleteMenuById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.DELETE)
+    public Result deleteMenuById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.deleteMenuById(id);
+    }
+
+    /**
+     * 菜单分配接口权限
+     *
+     * @param menu
+     * @return
+     */
+    @PostMapping("/assignPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.ASSIGN)
+    public Result assignPermission(@RequestBody Menu menu) {
+        if (Blank.isEmpty(menu, menu.getId(), menu.getPermissionList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.assignPermission(menu.getId(), menu.getPermissionList());
+    }
+
+    /**
+     * 通过父id所有本身及下级的权限信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getPermissionByMenuId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result getPermissionByMenuId(Integer id,Integer page,Integer num) {
+        if (Blank.isEmpty(id,page,num)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.getPermissionByMenuId(id,page,num);
+    }
+
+    /**
+     * 获取所有的菜单信息
+     *
+     */
+    @GetMapping("getAllMenu")
+    public Result queryAllMenu(){
+        return menuService.queryAllMenu();
+    }
+
+    /**
+     * 取消菜单权限(批量)
+     *
+     */
+    @PostMapping("deleteMenuPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result deleteMenuPermission(@RequestBody Menu menu) {
+        if (Blank.isEmpty(menu.getId())||menu.getPermissionList().size()<=0){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.deleteMenuPermission(menu.getId(),menu.getPermissionList());
+    }
+
+    /**
+     * 给菜单分配权限
+     *
+     */
+    @PostMapping("assignMenuAndPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result assignMenuAndPermission(@RequestBody Menu menu){
+        if (Blank.isEmpty(menu.getId(),menu.getPermissionList())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.assignMenuAndPermission(menu);
+    }
+
+    /**
+     * 查询菜单未拥有的权限
+     */
+    @GetMapping("queryNotPermission")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result queryNotPermission(Integer menuId,Integer page,Integer num,String permissionUrl,String permissionName){
+        if (Blank.isEmpty(menuId,page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.queryNotPermission(menuId, page, num,permissionUrl,permissionName);
+    }
+
+    /**
+     * 查询菜单已拥有的权限
+     */
+    @GetMapping("queryPermission")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result queryPermission(Integer menuId,Integer page,Integer num){
+        if (Blank.isEmpty(menuId,page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.queryPermission(menuId, page, num);
+    }
+
+    /**
+     * 批量新增菜单权限
+     */
+    @PostMapping("addMenuAndPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result addMenuAndPermission(@RequestBody Menu menu){
+        if (Blank.isEmpty(menu.getId(),menu.getPermissionList())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.addMenuAndPermission(menu);
+    }
+
+    /**
+     *批量取消菜单权限
+     */
+    @PostMapping("deleteMenuAndPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result deleteMenuAndPermission(@RequestBody Menu menu){
+        if (Blank.isEmpty(menu.getId(),menu.getPermissionList())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.deleteMenuAndPermission(menu);
+    }
+
+    @GetMapping("/queryRoleListByMenuId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleListByMenuId(Integer menuId, Integer page, Integer limit){
+        if (Blank.isEmpty(menuId,page,limit)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.queryRoleListByMenuId(menuId, page, limit);
+    }
+
+    /**
+     * 查询菜单详情
+     */
+    @GetMapping("/queryMenuDetail")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result queryMenuDetail(Integer menuId,Integer page,Integer limit){
+        if (Blank.isEmpty(menuId,page,limit)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.queryMenuDetail(menuId, page, limit);
+    }
+
+
+    /**
+     * 查询停用菜单
+     */
+    @GetMapping("/getMenuStatusListByPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result getMenuStatusListByPage(Long startNum, Long limitNum, String menuName, String menuUrl, Integer parentId){
+        if (Blank.isEmpty(startNum,limitNum)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.getMenuStatusListByPage(startNum, limitNum, menuName, menuUrl, parentId);
+    }
+
+    /**
+     * 启用菜单
+     */
+    @GetMapping("/updateMenuStatue")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.MENU, OperationEnum = OperationEnum.SELECT)
+    public Result updateMenuStatue(List<Integer> ids){
+        if (Blank.isEmpty(ids)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return menuService.updateMenuStatue(ids);
+    }
+
+}

+ 95 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/MessageNoticeController.java

@@ -0,0 +1,95 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.MessageNotice;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.MessageNoticeService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("messageNotice")
+@Slf4j
+public class MessageNoticeController {
+
+    @Resource
+    private MessageNoticeService messageNoticeService;
+
+    @PostMapping("/addMessageNotice")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.ADD)
+    public Result addMessageNotice(@RequestBody MessageNotice messageNotice) {
+        if (Blank.isEmpty(messageNotice, messageNotice.getUserId(),messageNotice.getNoticeTitle(), messageNotice.getNoticeContent())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "消息通知人,通知标题,内容不能为空");
+        }
+        return messageNoticeService.addMessageNotice(messageNotice);
+    }
+
+    /**
+     * 获取当前登录人的所有消息通知
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getAllMessageNotice")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.SELECT)
+    public Result getAllMessageNotice(Integer page, Integer limit) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "page和limit必须大于0");
+        }
+        return messageNoticeService.getAllMessageNotice(page, limit);
+    }
+
+    /**
+     * 通过id获取消息通知
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getMessageNoticeById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.SELECT)
+    public Result getMessageNoticeById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "id不能为空");
+        }
+        return messageNoticeService.getMessageNoticeById(id);
+    }
+
+    /**
+     * 标记消息通知为已读
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/readMessageNoticeById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.UPDATE)
+    public Result readMessageNoticeById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return messageNoticeService.readMessageNoticeById(id);
+    }
+
+    /**
+     * 通过id删除消息通知
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/deleteMessageNoticeById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.MESSAGENOTICE, OperationEnum = OperationEnum.DELETE)
+    public Result deleteMessageNoticeById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return messageNoticeService.deleteMessageNoticeById(id);
+    }
+
+}

+ 119 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/PermissionController.java

@@ -0,0 +1,119 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.PermissionService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+@RestController
+@RequestMapping("permission")
+public class PermissionController {
+
+    @Autowired
+    private PermissionService permissionService;
+
+    /**
+     * 新增权限资源
+     *
+     * @param permission
+     * @return
+     */
+    @PostMapping("/addPermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.ADD)
+    public Result addPermission(@RequestBody Permission permission) {
+        if (Blank.isEmpty(permission)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.addPermission(permission);
+    }
+
+    /**
+     * 修改权限
+     *
+     * @param permission
+     * @return
+     */
+    @PostMapping("/updatePermission")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.UPDATE)
+    public Result updatePermission(@RequestBody Permission permission) {
+        if (Blank.isEmpty(permission)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.updatePermission(permission);
+    }
+
+    /**
+     * 通过id查询权限
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getPermissionById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.SELECT)
+    public Result getPermissionById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.getPermissionById(id);
+    }
+
+    /**
+     * 分页查询权限
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getPermissionListByPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.SELECT)
+    public Result getPermissionListByPage(Integer page, Integer limit, String permissionUrl, String permissionName) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.getPermissionListByPage(page, limit, permissionUrl, permissionName);
+    }
+
+    /**
+     * 删除权限
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/deletePermissionById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.DELETE)
+    public Result deletePermissionById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.deletePermissionById(id);
+    }
+
+    /**
+     * 查询权限所属菜单
+     */
+    @GetMapping("/queryMenuByPermissionId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.PERMISSION, OperationEnum = OperationEnum.DELETE)
+    public Result queryMenuByPermissionId(Integer permissionId,Integer page,Integer limit){
+        if (Blank.isEmpty(permissionId,page,limit)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return permissionService.queryMenuByPermissionId(permissionId, page, limit);
+    }
+
+
+}

+ 56 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/RawDataController.java

@@ -0,0 +1,56 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.ChartDataDto;
+import com.example.opc_da.entity.TableDataDto;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.RawDataService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+@RequestMapping("rawData")
+@Slf4j
+public class RawDataController {
+
+    @Resource
+    private RawDataService rawDataService;
+
+    @GetMapping("/getDataByTimeType")
+    public Result getDataByTimeType(List<Integer> itemGroupIdList) {
+        return rawDataService.getDataByTimeType(itemGroupIdList);
+    }
+
+    /**
+     * @param chartDataDto type统计图类型(扇形pie,折现line,条形bar),itemGroupId数据组配置id,itemIdList所选的item集合id,dataModelId 数据模型id
+     * @return
+     */
+    @PostMapping("/getChartData")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.CHARTDATA)
+    public Result getChartData(@RequestBody ChartDataDto chartDataDto) {
+        if (Blank.isEmpty(chartDataDto, chartDataDto.getType(), chartDataDto.getItemGroup(), chartDataDto.getItemGroup().getId(), chartDataDto.getItemGroup().getItemList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表id,名称不能为空");
+        }
+        return rawDataService.getChartData(chartDataDto);
+    }
+
+    /**
+     * 获取表格数据 其中TableDataDto的itemGroupId,itemName为必填选项
+     *
+     * @param tableDataDto
+     * @return
+     */
+    @PostMapping("/getTableData")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.TABLEDATA)
+    public Result getTableData(@RequestBody TableDataDto tableDataDto) {
+        return rawDataService.getTableData(tableDataDto);
+    }
+}

+ 245 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/ReportTableController.java

@@ -0,0 +1,245 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.ReportTable;
+import com.example.opc_da.entity.TableTemplate;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.ReportTableService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("reportTable")
+@Slf4j
+public class ReportTableController {
+
+    @Resource
+    private ReportTableService reportTableService;
+
+    /**
+     * 添加报表模板
+     *
+     * @param tableTemplate
+     * @return
+     */
+    @PostMapping("/addTableTemplate")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.TABLETEMPLATE, OperationEnum = OperationEnum.ADD)
+    public Result addTableTemplate(@RequestBody TableTemplate tableTemplate) {
+        if (Blank.isEmpty(tableTemplate, tableTemplate.getTemplateName(), tableTemplate.getTemplateData())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "模板名称不能为空");
+        }
+        return reportTableService.addTableTemplate(tableTemplate);
+    }
+
+    /**
+     * 修改报表模板
+     *
+     * @param tableTemplate
+     * @return
+     */
+    @PostMapping("/updateTableTemplate")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.TABLETEMPLATE, OperationEnum = OperationEnum.UPDATE)
+    public Result updateTableTemplate(@RequestBody TableTemplate tableTemplate) {
+        if (Blank.isEmpty(tableTemplate, tableTemplate.getId(), tableTemplate.getTemplateName(), tableTemplate.getTemplateData())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "模板id,名称不能为空");
+        }
+        return reportTableService.updateTableTemplate(tableTemplate);
+    }
+
+    /**
+     * 如果userId为空,则获取当前登录人的所有报表模板;不为空,则查询对应的参数的报表模板
+     *
+     * @param page
+     * @param limit
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getAllTableTemplate")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.TABLETEMPLATE, OperationEnum = OperationEnum.SELECT)
+    public Result getAllTableTemplate(Integer page, Integer limit, String userId) {
+        return reportTableService.getAllTableTemplate(page, limit, userId);
+    }
+
+    /**
+     * 通过id获取报表模板
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getTableTemplateById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.TABLETEMPLATE, OperationEnum = OperationEnum.SELECT)
+    public Result getTableTemplateById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return reportTableService.getTableTemplateById(id);
+    }
+
+    /**
+     * 删除报表模板
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delTableTemplateById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.TABLETEMPLATE, OperationEnum = OperationEnum.DELETE)
+    public Result delTableTemplateById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return reportTableService.delTableTemplateById(id);
+    }
+
+    /**
+     * 新增报表
+     *
+     * @param reportTable
+     * @return
+     */
+    @PostMapping("/addReportTable")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.ADD)
+    public Result addReportTable(@RequestBody ReportTable reportTable) {
+        if (Blank.isEmpty(reportTable, reportTable.getReportTableName(), reportTable.getReportTableData(), reportTable.getReportValueFormat())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表名称,报表内容,报表取值格式不能为空");
+        }
+        return reportTableService.addReportTable(reportTable);
+    }
+
+    /**
+     * 修改报表
+     *
+     * @param reportTable
+     * @return
+     */
+    @PostMapping("/updateReportTable")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.UPDATE)
+    public Result updateReportTable(@RequestBody ReportTable reportTable) {
+        if (Blank.isEmpty(reportTable, reportTable.getId(), reportTable.getReportTableName(), reportTable.getReportTableData(), reportTable.getReportValueFormat())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表id,名称,报表内容,报表取值格式不能为空");
+        }
+        return reportTableService.updateReportTable(reportTable);
+    }
+
+    /**
+     * 获取当前登录人的所有报表
+     *
+     * @param page
+     * @param limit
+     * @param isAutoReport 如果为空,则查询所有,为0只查询手动报表,为1查询自动报表,为2查询自动报表生成的报表
+     * @return
+     */
+    @GetMapping("/getAllReportTable")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.SELECT)
+    public Result getAllReportTable(Integer page, Integer limit, Integer isAutoReport) {
+        return reportTableService.getAllReportTable(page, limit, isAutoReport);
+    }
+
+    /**
+     * 通过id获取报表
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getReportTableById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.SELECT)
+    public Result getReportTableById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return reportTableService.getReportTableById(id);
+    }
+
+    /**
+     * 通过id删除报表
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delReportTableById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.DELETE)
+    public Result delReportTableById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return reportTableService.delReportTableById(id);
+    }
+
+    /**
+     * 报表类型转换
+     *
+     * @param id
+     * @param isAutoReport 0手动,1自动
+     * @return
+     */
+    @PostMapping("/tableExchangeTypeById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.UPDATE)
+    public Result tableExchangeTypeById(Integer id, Integer isAutoReport, String cron) {
+        if (Blank.isEmpty(id, isAutoReport)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "id和报表类型不能为空");
+        }
+        return reportTableService.tableExchangeTypeById(id, isAutoReport, cron);
+    }
+
+    /**
+     * 查询报表数量
+     */
+    @GetMapping("/queryTableNum")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryTableNum() {
+        return reportTableService.queryTableNum();
+    }
+
+    /**
+     * 给报表分配用户组
+     *
+     * @param id
+     * @param userGroupId
+     * @return
+     */
+    @PostMapping("/tableAssignUserById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.ASSIGN)
+    public Result tableAssignUserById(Integer id, Integer userGroupId) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表id不能为空");
+        }
+        return reportTableService.tableAssignUserById(id, userGroupId);
+    }
+
+    /**
+     * 根据id修改报表名称
+     * @param id
+     * @param reportTableName
+     * @return
+     */
+    @PostMapping("/updateTableNameById")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.UPDATE)
+    public Result updateTableNameById(Integer id, String reportTableName) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表id不能为空");
+        }
+        return reportTableService.updateTableNameById(id, reportTableName);
+    }
+
+    /**
+     * 获取当前登录人的能查看的所有报表(包括自己创建的)
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getAllOkReportTable")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.REPORTTABLE, OperationEnum = OperationEnum.SELECT)
+    public Result getAllOkReportTable(Integer page, Integer limit, Integer isAutoReport) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "page,limit不能为空,且必须大于0");
+        }
+        return reportTableService.getAllOkReportTable(page, limit, isAutoReport);
+    }
+}

+ 312 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/RoleController.java

@@ -0,0 +1,312 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.Role;
+import com.example.opc_da.entity.User;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.RoleService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("role")
+public class RoleController {
+
+    @Autowired
+    private RoleService roleService;
+
+    /**
+     * 新增角色
+     *
+     * @param role
+     * @return
+     */
+    @PostMapping("/addRole")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.ADD)
+    public Result addRole(@RequestBody Role role) {
+        if (Blank.isEmpty( role.getRoleName(), role.getRoleCode())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.addRole(role);
+    }
+
+    /**
+     * 修改角色信息
+     *
+     * @param role
+     * @return
+     */
+    @PostMapping("/updateRole")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.UPDATE)
+    public Result updateRole(@RequestBody Role role) {
+        if (Blank.isEmpty(role)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.updateRole(role);
+    }
+
+    /**
+     * 分页查询所有的角色信息
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getRoleListByPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result getRoleListByPage(Integer page, Integer limit, String roleName, String roleCode) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.getRoleListByPage(page, limit, roleName, roleCode);
+    }
+
+    /**
+     * 通过角色id查看角色信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getRoleById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result getRoleById(Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.getRoleById(id);
+    }
+
+    /**
+     * 通过传入的角色集合获取菜单信息
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/getMenuListByRoleList")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result getMenuListByRoleList(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getRoleList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.getMenuListByRoleList(user.getRoleList());
+    }
+
+    /**
+     * 通过角色id逻辑删除角色
+     *
+     * @param roleId
+     * @return
+     */
+    @PostMapping("/deleteRoleById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.DELETE)
+    public Result deleteRoleById(Integer roleId) {
+        if (Blank.isEmpty(roleId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.deleteRoleById(roleId);
+    }
+
+    /**
+     * 角色分配菜单
+     *
+     * @param role
+     * @return
+     */
+    @PostMapping("/assignMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.ASSIGN)
+    public Result assignMenu(@RequestBody Role role) {
+        if (Blank.isEmpty(role, role.getId(), role.getMenuList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.assignMenu(role.getId(), role.getMenuList());
+    }
+
+    /**
+     * 通过角色集合获取菜单信息,并返回成树
+     *
+     * @param roleIdList
+     * @return
+     */
+    @PostMapping("/getMenuTreeByRoleList")
+    public Result getMenuTreeByRoleList(@RequestBody List<Integer> roleIdList) {
+        if (Blank.isEmpty(roleIdList)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.getMenuTreeByRoleList(roleIdList);
+    }
+
+    /**
+     * 批量取消角色菜单
+     *
+     */
+    @PostMapping("/deleteRoleMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.ASSIGN)
+    public Result deleteRoleMenu(@RequestBody Role role) {
+        if (Blank.isEmpty(role, role.getId(), role.getMenuList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.deleteRole(role);
+    }
+
+    /**
+     * 批量删除角色
+     *
+     * @param roleIdList
+     * @return
+     */
+    @PostMapping("/deleteRoleByIds")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result deleteRoleByIds(@RequestBody List<Integer> roleIdList){
+        if (roleIdList.size()<=0){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.deleteRoleByIds(roleIdList);
+    }
+
+    /**
+     * 给角色分配菜单
+     *
+     */
+    @PostMapping("/assignRoleAndMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result assignRoleAndMenu(@RequestBody Role role){
+        if (Blank.isEmpty(role.getId(),role.getMenuList())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.assignRoleAndMenu(role);
+    }
+
+    /**
+     * 查看角色已有的菜单
+     *
+     */
+    @GetMapping("/queryRoleAndMenuId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleAndMenuId(Integer roleId,Integer page,Integer num){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryRoleAndMenuId(roleId,page,num);
+    }
+
+    /**
+     * 查看角色未有的菜单
+     *
+     */
+    @GetMapping("/queryNotRoleAndMenu")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryNotRoleAndMenu(Integer roleId,Integer page,Integer num){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryNotRoleAndMenu(roleId,page,num);
+    }
+
+    /**
+     * 角色已有菜单id
+     *
+     */
+    @GetMapping("/queryRoleAndMenuListId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleAndMenuListId(Integer roleId){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryRoleAndMenuListId(roleId);
+    }
+
+    /**
+     * 查询用户已有菜单
+     *
+     */
+    @GetMapping("/queryMenuByUserId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryMenuByUserId(String userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryMenuByUserId(userId);
+    }
+
+
+    /**
+     * 查询角色未拥有的用户
+     *
+     */
+    @GetMapping("/queryNotUserByRoleId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryNotUserByRoleId(Integer roleId, Integer page, Integer num,String userName,Integer userType){
+        if (Blank.isEmpty(roleId,page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryNotUserByRoleId(roleId, page, num, userName, userType);
+    }
+
+    /**
+     * 查询角色已有的用户id
+     */
+    @GetMapping("/queryUserIdByRoleId")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryUserIdByRoleId(Integer roleId, String userName, Integer userType){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryUserIdByRoleId(roleId, userName, userType);
+    }
+
+    /**
+     * 给角色分配用户
+     */
+    @GetMapping("/assignUserAndRole")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result assignUserAndRole(@RequestParam("userIdList") List<String> userIdList,Integer roleId){
+        if (Blank.isEmpty(roleId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.assignUserAndRole(userIdList, roleId);
+    }
+
+    /**
+     * 查询角色对应权限
+     */
+    @GetMapping("/queryPermissionByRoleId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryPermissionByRoleId(Integer roleId, Integer page, Integer num){
+        if (Blank.isEmpty(roleId,page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(),ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return roleService.queryPermissionByRoleId(roleId, page, num);
+    }
+
+    /**
+     * 查询角色数量
+     */
+    @GetMapping("/queryRoleNum")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.ROLE, OperationEnum = OperationEnum.SELECT)
+    public Result queryRoleNum(){
+        return roleService.queryRoleNum();
+    }
+}

+ 419 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserController.java

@@ -0,0 +1,419 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.PermissionControl;
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.AddUserRole;
+import com.example.opc_da.entity.User;
+import com.example.opc_da.entity.UserRole;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.UserService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.RSAUtil;
+import com.example.opc_da.util.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("user")
+public class UserController {
+
+    @Autowired
+    private UserService userService;
+
+    /**
+     * 获取图形验证码
+     *
+     * @return
+     */
+    @GetMapping("/getCodeImage")
+    public Result getCodeImage(boolean hasPubKey) {
+        return userService.getCodeImage(hasPubKey);
+    }
+
+    /**
+     * 获取公钥
+     *
+     * @return
+     */
+    @GetMapping("/getPublicKey")
+    public Result getPublicKey() {
+        return Result.ok(RSAUtil.PUBLIC_KEY);
+    }
+
+    /**
+     * 前端用户登录
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/frontUserLogin")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.LOGIN)
+    public Result frontUserLogin(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getUserName(), user.getPassword(), user.getUid(), user.getVerifyCode())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.frontUserLogin(user);
+    }
+
+    /**
+     * 后台管理系统登录(只允许管理员登录)
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/backUserLogin")
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.LOGIN)
+    public Result backUserLogin(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getUserName(), user.getPassword(), user.getUid(), user.getVerifyCode())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.backUserLogin(user);
+    }
+
+    /**
+     * 用户退出登录
+     *
+     * @return
+     */
+    @PostMapping("/userLoginOut")
+    @WebLog(ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.LOGOUT)
+    public Result userLoginOut() {
+        return userService.userLoginOut();
+    }
+
+    /**
+     * 添加用户
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/addUser")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.ADD)
+    public Result addUser(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getUserName(), user.getPassword(), user.getUserType())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.addUser(user);
+    }
+
+    /**
+     * 修改用户信息
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/updateUser")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.UPDATE)
+    public Result updateUser(@RequestBody User user) {
+        if (Blank.isEmpty(user) ) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.updateUser(user);
+    }
+
+    /**
+     * 管理员分页查询所有用户信息
+     *
+     * @param page
+     * @param limit
+     * @return
+     */
+    @GetMapping("/getUserPage")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result getUserPage(int page, int limit, String userName, Integer state, Integer userType) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.getUserPage(page, limit, userName, state, userType);
+    }
+
+    /**
+     * 管理员可以查看任何用户的信息,不是管理员只能查看自己的信息
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getUserById")
+    @WebLog(ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result getUserById(String userId) {
+        if (Blank.isEmpty(userId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.getUserById(userId);
+    }
+
+    /**
+     * 锁定用户,解除用户锁定。只有管理员才能操作
+     *
+     * @param userId
+     * @return
+     */
+    @PostMapping("/updateUserStateById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.UPDATE)
+    public Result updateUserStateById(String userId, Integer userState) {
+        if (Blank.isEmpty(userId, userState)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.updateUserStateById(userId, userState);
+    }
+
+    /**
+     * 逻辑删除用户
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/deleteUserById")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.DELETE)
+    public Result deleteUserById(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getUserId())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.deleteUserById(user.getUserId());
+    }
+
+    /**
+     * 用户分配角色
+     *
+     * @param user
+     * @return
+     */
+    @PostMapping("/assignRole")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.ASSIGN)
+    public Result assignRole(@RequestBody User user) {
+        if (Blank.isEmpty(user, user.getUserId(), user.getRoleList())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.assignRole(user.getUserId(), user.getRoleList());
+    }
+
+    /**
+     * 根据角色ID查询该角色下人员
+     *
+     * @param page
+     * @param limit
+     * @param roleId
+     * @param userName
+     * @return
+     */
+    @GetMapping("/getUserListByRoleId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result getUserListByRoleId(Integer page, Integer limit, Integer roleId, String userName) {
+        if (Blank.isEmpty(page, limit) || page < 1 || limit < 1) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.getUserListByRoleId(page, limit, roleId, userName);
+    }
+
+    /**
+     * 根据用户列表授权某一个角色
+     *
+     * @param addUserRole
+     * @return
+     */
+    @PostMapping("/assignUserListByRoleId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.ASSIGN)
+    public Result assignUserListByRoleId(@RequestBody AddUserRole addUserRole ) {
+        if (Blank.isEmpty(addUserRole.getUserIdList(), addUserRole.getRoleId())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.assignUserListByRoleId(addUserRole.getUserIdList(), addUserRole.getRoleId());
+    }
+
+    /**
+     * 根据角色ID和用户ID解除角色权限
+     *
+     * @param userId
+     * @param roleId
+     * @return
+     */
+    @GetMapping("/relieveUserRole")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result relieveUserRole(String userId, String roleId) {
+        if (Blank.isEmpty(userId, roleId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userService.relieveUserRole(userId, roleId);
+    }
+
+
+    /**
+     * 根据角色ID和用户ID批量解除角色权限
+     *
+     * @param userRoles
+     * @return
+     */
+    @PostMapping("/relieveUserRoles")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result relieveUserRole(@RequestBody List<UserRole> userRoles){
+        if (userRoles.size()<=0){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return  userService.relieveUserRoles(userRoles);
+    }
+
+    /**
+     * 修改密码
+     */
+    @PostMapping("/updatePassWord")
+    public Result updatePassWord(@RequestBody User user){
+        if (Blank.isEmpty(user.getPassword(),user.getNewPassword(),user.getUserId())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.updatePassWord(user);
+    }
+
+    /**
+     * 重置密码
+     */
+    @PostMapping("/updatePasswordByAdmin")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result updatePasswordByAdmin(@RequestBody User user){
+        if (Blank.isEmpty(user.getNewPassword(),user.getUserId())){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.updatePasswordByAdmin(user);
+    }
+
+    /**
+     * 查看用户详情
+     */
+    @GetMapping("queryUserDtail")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result queryUserDtail(String userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryUserDtail(userId);
+    }
+
+    /**
+     * 查询用户未有菜单
+     */
+    @GetMapping("/queryNotMenuByUserId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result queryNotMenuByUserId(String userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryNotMenuByUserId(userId);
+    }
+
+    /**
+     * 查询用户身份
+     */
+    @GetMapping("/queryUserRoleByUserId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.RELIEVE)
+    public Result queryUserRoleByUserId(String userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryUserRoleByUserId(userId);
+    }
+
+    /**
+     * 查询所有后端用户
+     */
+    @GetMapping("/queryUserType")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result queryUserType(Integer startNum, Integer limitNum, String userName, Integer state,Integer roleId){
+        if (Blank.isEmpty(startNum,limitNum)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryUserType(startNum, limitNum, userName, state,roleId);
+    }
+
+    /**
+     * 查询所有没有部门用户
+     */
+    @GetMapping("/queryUserNOtInDepartment")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result queryUserNOtInDepartment(String userName, Integer state, Integer page, Integer num){
+        if (Blank.isEmpty(page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryUserNOtInDepartment(userName, state, page, num);
+    }
+
+    /**
+     * 批量逻辑删除用户
+     */
+    @PostMapping("/updateUserListState")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.DELETE)
+    public Result updateUserListState(@RequestBody List<String> userId){
+        if (Blank.isEmpty(userId)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.updateUserListState(userId);
+    }
+
+    /**
+     * 查询删除用户
+     */
+    @GetMapping("/queryDeleteUser")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result queryDeleteUser(Integer page, Integer num, String userName, Integer userType){
+        if (Blank.isEmpty(page,num)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.queryDeleteUser(page, num, userName, userType);
+    }
+
+
+    /**
+     * 恢复已被删除的用户
+     */
+    @GetMapping("/updateUserByListId")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.UPDATE)
+    public Result updateUserByListId(@RequestParam("userIdList") List<String> userIdList){
+        if (Blank.isEmpty(userIdList)){
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "参数错误");
+        }
+        return userService.updateUserByListId(userIdList);
+    }
+
+    /**
+     * 客户端用户数量
+     */
+    @GetMapping("/queryCustomerUserNum")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result queryCustomerUserNum(){
+        return userService.queryCustomerUserNum();
+    }
+
+    /**
+     * 管理端用户数量
+     */
+    @GetMapping("/queryManagerUserNum")
+    @PermissionControl
+    @WebLog(ServerEnum = ServerEnum.SERVER, ModelEnum = ModelEnum.USER, OperationEnum = OperationEnum.SELECT)
+    public Result queryManagerUserNum(){
+        return userService.queryManagerUserNum();
+    }
+
+}

+ 136 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/controller/UserGroupController.java

@@ -0,0 +1,136 @@
+package com.example.opc_da.controller;
+
+import com.example.opc_da.annotation.WebLog;
+import com.example.opc_da.entity.UserGroup;
+import com.example.opc_da.enums.ModelEnum;
+import com.example.opc_da.enums.OperationEnum;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.enums.ServerEnum;
+import com.example.opc_da.service.UserGroupService;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.Result;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("userGroup")
+@Slf4j
+public class UserGroupController {
+
+    @Resource
+    private UserGroupService userGroupService;
+
+    /**
+     * 获取部门机构树
+     *
+     * @return
+     */
+    @GetMapping("/getDepartmentTree")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getDepartmentTree() {
+        return userGroupService.getDepartmentTree();
+    }
+
+    /**
+     * 通过机构获取相应的客户端人员
+     *
+     * @param departmentId
+     * @return
+     */
+    @GetMapping("/getClientUserByDepartmentId")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getClientUserByDepartmentId(Integer departmentId) {
+        if (Blank.isEmpty(departmentId)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userGroupService.getClientUserByDepartmentId(departmentId);
+    }
+
+    /**
+     * 新增用户组
+     *
+     * @param userGroup
+     * @return
+     */
+    @PostMapping("/addUserGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.ADD)
+    public Result addUserGroup(@RequestBody UserGroup userGroup) {
+        if (Blank.isEmpty(userGroup, userGroup.getUserGroupName(), userGroup.getSortNum())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "用户组名称,排序号不能为空");
+        }
+        return userGroupService.addUserGroup(userGroup);
+    }
+
+    /**
+     * 修改用户组
+     *
+     * @param userGroup
+     * @return
+     */
+    @PostMapping("/updateUserGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.UPDATE)
+    public Result updateUserGroup(@RequestBody UserGroup userGroup) {
+        if (Blank.isEmpty(userGroup, userGroup.getId(), userGroup.getUserGroupName(), userGroup.getSortNum())) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "用户组id,名称,排序号不能为空");
+        }
+        return userGroupService.updateUserGroup(userGroup);
+    }
+
+    /**
+     * 获取当前登录人,创建的用户组
+     *
+     * @return
+     */
+    @GetMapping("/getAllUserGroup")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getAllUserGroup() {
+        return userGroupService.getAllUserGroup();
+    }
+
+    /**
+     * 通过id获取用户组
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getUserGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getUserGroupById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userGroupService.getUserGroupById(id);
+    }
+
+    /**
+     * 通过用户组id获取所有的用户信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getUserByGroupId/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.SELECT)
+    public Result getUserByGroupId(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userGroupService.getUserByGroupId(id);
+    }
+
+    /**
+     * 通过id删除用户组
+     *
+     * @param id
+     * @return
+     */
+    @PostMapping("/delUserGroupById/{id}")
+    @WebLog(ServerEnum = ServerEnum.CLIENT, ModelEnum = ModelEnum.USERGROUP, OperationEnum = OperationEnum.DELETE)
+    public Result delUserGroupById(@PathVariable Integer id) {
+        if (Blank.isEmpty(id)) {
+            return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), ResultEnum.REQUEST_WRONGPARAMS.getRespMsg());
+        }
+        return userGroupService.delUserGroupById(id);
+    }
+}

+ 28 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DataModelDao.java

@@ -0,0 +1,28 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.DataModel;
+import com.example.opc_da.entity.Item;
+import com.example.opc_da.entity.TableDataDto;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DataModelDao {
+
+    Integer addDataModel(DataModel dataModel);
+
+    Integer updateDataModel(DataModel dataModel);
+
+    Long getDataModelCount(String userId);
+
+    List<DataModel> getAllDataModel(Long startNum, Long limitNum, String userId);
+
+    DataModel getDataModelById(Integer id);
+
+    Integer delDataModelById(Integer id);
+
+    List<DataModel> getDmListByItemList(List<Item> itemList);
+
+    List<DataModel> getDmListByTdList(List<TableDataDto> tableDataDtoList);
+}

+ 29 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DataSourceDao.java

@@ -0,0 +1,29 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.DataSource;
+import com.example.opc_da.entity.DataSourceType;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DataSourceDao {
+
+    List<DataSourceType> getAllDataSourceType();
+
+    DataSource getDataSourceByName(String userId, String dataSourceName);
+
+    Integer addDataSource(DataSource dataSource);
+
+    DataSourceType getDataSourceTypeById(Integer id);
+
+    List<DataSource> getAllDataSource(String userId);
+
+    DataSource getDataSourceById(Integer id);
+
+    Integer delDataSourceById(Integer id);
+
+    DataSource getDataSourceByNameNoId(Integer id, String userId, String dataSourceName);
+
+    Integer updateDataSource(DataSource dataSource);
+}

+ 114 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DepartmentDao.java

@@ -0,0 +1,114 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Department;
+import com.example.opc_da.entity.User;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DepartmentDao {
+
+    Department getDepartmentByName(String departmentName, Integer parentId);
+
+    Integer addDepartment(Department department);
+
+    Department getDepartmentByNoIdName(int id, String departmentName, Integer parentId);
+
+    Integer updateDepartment(Department department);
+
+    Long getDepartmentCount(String departmentName, String createTime, Integer noDelete, Integer parentId);
+
+    List<Department> getDepartmentListByPage(Long startNum, Long limitNum, String departmentName, String createTime, Integer noDelete, Integer parentId);
+
+    Department getDepartmentById(Integer id);
+
+    /**
+     * 根据父亲id查自己的一级子部门
+     */
+    List<Department> queryDepartmentListByparentId(Integer parentId);
+
+    /**
+     * 根据id查自己是哪些部门的父亲
+     */
+    List<Department> queryDepartmentListByid(Integer id);
+
+    /**
+     * 逻辑删除(批量)
+     */
+    Integer isDeleteByid(@Param("ids") List<Integer> ids);
+
+    /**
+     * 根据部门查部门员工
+     */
+    List<User> queryUserByDepartmentId(Integer departmentId, Integer page, Integer num);
+
+    Integer queryUserDepartmentIdCount(Integer departmentId);
+
+    /**
+     * 根据用户id查询所属部门
+     */
+    Department queryDepartmentByUserId(String userId);
+
+    /**
+     * 根据部门id查部门
+     */
+    Department queryDepartmentIsExist(Integer departmentId);
+
+    /**
+     * 根据id判断自己是否为父节点
+     */
+    Integer queryDepartmentByParentId(Integer id);
+
+    /**
+     * 根据部门id查用户部门的人数
+     */
+    Integer queryUserDepartmentById(Integer id);
+
+    /**
+     * 批量新增部门用户
+     */
+    Integer addUserDepartment(@Param("userIds") List<String> userIds, Integer departmentId);
+
+    Integer queryUserDepartmentByUserId(String userId);
+
+    /**
+     * 更新用户所属部门
+     */
+    Integer updateUserDepartment(String userId, Integer departmentId);
+
+    /**
+     * 批量删除部门用户
+     */
+    Integer deleteUserDepartment(@Param("userIds") List<String> userIds, Integer departmentId);
+
+    /**
+     * 查询用户所属部门id
+     */
+    Integer queryDepartmentIdByUserId(String userId);
+
+    /**
+     * 新增部门员工
+     */
+    Integer addUserAdnDepartment(String userId, Integer departmentId);
+
+    /**
+     * 查询部门员工
+     */
+    List<User> queryUserListByDepartmentId(Integer departmentId);
+
+    /**
+     * 查询上级部门
+     */
+    Department queryParentDepartmentById(Integer departmentParentId);
+
+    /**
+     * 删除部门用户信息
+     */
+    Integer deleteDepartmentUserByIdList(@Param("idList") List<Integer> IdList);
+
+    List<User> getClientUserByDepartmentId(Integer departmentId);
+
+    List<Department> getAllDepartment();
+}

+ 160 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/DictDao.java

@@ -0,0 +1,160 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Dict;
+import com.example.opc_da.entity.DictType;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface DictDao {
+
+    /**
+     * 查询所有数据
+     */
+    List<Dict> queryAll(Integer page,Integer num);
+
+    /**
+     * 查询总条数
+     */
+    Integer queryAllnum();
+
+    /**
+     * 分页查询
+     * param dictKey
+     * param dictValue
+     * param page
+     * param num
+     */
+    List<Dict> queryPage(String dictKey,String dictValue,Integer dictTypeId,Integer page,Integer num,Integer parentId);
+
+    /**
+     * 模糊查询总条数
+     */
+    Integer queryNumber(String dictKey,String dictValue,Integer dictTypeId,Integer parentId);
+
+    /**
+     * 根据id或者dice_key查询
+     */
+    List<Dict> queryByIdOrKey(Integer id,String dictKey,Integer page,Integer num);
+
+    /**
+     * 根据id或者dice_key查询总条数
+     */
+    Integer queryByIdOrKeyNum(Integer id,String dictKey);
+
+    /**
+     * 根据父id查子节点信息 树结构
+     */
+    List<Dict> queryByParentId(Integer parentId);
+
+    /**
+     * 新增
+     */
+    Integer addDict(@Param("dict") Dict dict);
+
+    /**
+     * 根据id修改
+     */
+    Integer updataById(@Param("dict") Dict dict);
+
+    /**
+     * 根据id删除(批量)
+     */
+    Integer deleteByid(@Param("ids") List<Integer> ids);
+
+    Dict queryById(Integer id);
+
+    /**
+     * 判断key是否重复
+     */
+    Dict queryByDictKeyIsExist(String dictKey);
+
+    /**
+     * 根据key批量查询
+     */
+    List<Dict> queryByDictKey(@Param("dictKeys") List<String> dictKeys);
+
+    /**
+     * 辅助新增和修改的时候判断是否为重复数据
+     */
+    Dict queryIsExist(@Param("dict") Dict dict);
+
+    /**
+     *查询所有字典类型
+     */
+    List<DictType> queryType(Integer page,Integer num,String dictKeyType,String description);
+
+    Integer queryTypeNum(String dictKeyType,String description);
+
+
+    /**
+     *根据字典类型查询对应数据
+     */
+    List<Dict> queryByType(String keyType,Integer page,Integer num);
+
+    /**
+     * 根据字典类型查询总条数
+     */
+    Integer queryByTypeNum(String keyType);
+
+    /**
+     * 字典类型新增
+     */
+    Integer addDictType(@Param("dictType") DictType dictType);
+
+    /**
+     * 字典类型修改
+     */
+    Integer updataDictType(@Param("dictType") DictType dictType);
+
+    /**
+     * 根据字典类型id删除字典类型(批量)
+     */
+    Integer deleteDictTypeById(List<Integer> ids);
+
+    /**
+     * 根据字典类型值查字典类型对象(辅助判断)
+     */
+    DictType queryDictTypeByKeyType(String dictKeyType,Integer id);
+
+    List<DictType> queryTypeAll();
+
+    /**
+     *根据字典类型查询对应数据(不分页)
+     */
+    List<Dict> queryByTypes(String keyType);
+
+    DictType queryDictTypeById(Integer dictTypeId);
+
+    Dict queryDictById(Integer dictId);
+
+    /**
+     * 查询同一字典类型下key是否重复
+     */
+    Dict queryDictKeyByType(Integer dictTypeId,String dictKey,Integer parentId,Integer id);
+
+    /**
+     * 查询同一字典类型下value是否重复
+     */
+    Dict queryDictValueByType(Integer dictTypeId,String dictValue,Integer parentId,Integer id);
+
+    /**
+     * 查询字典类型值是否被占用
+     */
+    DictType queryDictTypeValue(String dictTypeValue,Integer id);
+
+    /**
+     * 查询字典详情
+     */
+    Dict queryDictDetailById(Integer id);
+
+    /**
+     * 查询字典类型对应字典总条数
+     */
+    Integer queryDictNumByType(Integer dictTypeId);
+
+
+
+}

+ 16 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/FileDao.java

@@ -0,0 +1,16 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.FileEntity;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface FileDao {
+
+    Integer saveFile(FileEntity fileEntity);
+
+    Integer updateFile(FileEntity fileEntity);
+
+    Integer deleteFileById(Integer id);
+
+    FileEntity queryFileById(Integer id);
+}

+ 47 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ItemGroupDao.java

@@ -0,0 +1,47 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Item;
+import com.example.opc_da.entity.ItemGroup;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ItemGroupDao {
+
+    ItemGroup getItemGroupByName(String userId, String groupName);
+
+    Integer addItemGroup(ItemGroup itemGroup);
+
+    ItemGroup getItemGroupById(Integer id);
+
+    List<ItemGroup> getAllItemGroup(String userId);
+
+    ItemGroup getItemGroupByNameNoId(Integer id, String userId, String groupName);
+
+    Integer updateItemGroup(ItemGroup itemGroup);
+
+    Integer addItem(Integer itemGroupId, List<Item> itemList);
+
+    Integer delItemByGroupId(Integer itemGroupId);
+
+    Integer delItemGroupById(Integer id);
+
+    List<Item> getItemListByGroupId(Integer itemGroupId);
+
+    List<Item> getPublicItemList(Integer itemGroupId, List<Item> itemList);
+
+    Integer delItemNoPub(Integer itemGroupId, List<Item> itemList);
+
+    Integer runItemGroupById(Integer id, Integer runState);
+
+    List<String> getItemReadNameById(Integer itemGroupId);
+
+    Integer updateItemDescribe(Item item);
+
+    List<Item> getItemListDescribe(List<Item> itemList);
+
+    Item getItemByGroupIdName(Integer itemGroupId, String itemName);
+
+    List<ItemGroup> getItemGroupByDataSourceId(Integer dataSourceId);
+}

+ 21 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/LogDao.java

@@ -0,0 +1,21 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Log;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface LogDao {
+
+    Long getLogCount(String serverName, String modelName, String content, String userId, String ipAddress, String methodName,String startDate,String endDate);
+
+    List<Log> getLogPage(Long startNum, Long limitNum, String serverName, String modelName, String content, String userId, String ipAddress, String methodName,String startDate,String endDate);
+
+    Integer insertLog(Log log);
+
+    /**
+     *删除6个月以前的数据
+     */
+    Integer logDeleteByTime(String time);
+}

+ 130 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MenuDao.java

@@ -0,0 +1,130 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.entity.Role;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MenuDao {
+
+    Menu getMenuByUrl(String menuUrl);
+
+    Integer addMenu(Menu menu);
+
+    Menu getMenuByNoIdUrl(int id, String menuUrl);
+
+    Integer updateMenu(@Param("menu") Menu menu);
+
+    Long getMenuCount(String menuName, String menuUrl, Integer menuStatus,Integer parentId);
+
+    List<Menu> getMenuListByPage(Long startNum, Long limitNum, String menuName, String menuUrl, Integer menuStatus,Integer parentId);
+
+    Menu getMenuById(Integer id);
+
+    Menu getMenuByName(String menuName,Integer parentId);
+
+    Menu getMenuByNoIdName(Integer id, String menuName,Integer parentId);
+
+    Integer deleteMenuById(Integer id);
+
+    Integer deleteRoleMenuById(Integer menuId);
+
+    Integer deleteMenuPermissionByMenuId(Integer menuId);
+
+    List<Permission> getPermissionListByMenuList(List<Menu> menuList);
+
+    List<Permission> getSharePermissionList(Integer menuId, List<Permission> permissionList);
+
+    List<Permission> getNoShareOldPermissionList(Integer menuId, List<Permission> permissionList);
+
+    Integer deleteMenuPermission(Integer menuId, List<Permission> permissionList);
+
+    Integer addMenuPermissionList(Integer menuId, List<Permission> permissionList);
+
+    List<Menu> getAllMenu(Integer menuAvailable);
+
+    /**
+     * 查所有可用菜单(树结构)
+     */
+    List<Menu> queryAllMenuTree(Integer parentId);
+
+    /**
+     * 查询顶层父接口
+     */
+    List<Menu> queryFatherMenu();
+
+    List<Permission> getPermissionListByMenuListPage(@Param("menuList") List<Menu> menuList, Integer page, Integer num);
+
+    Integer getPermissionListByMenuListPageSize(@Param("menuList") List<Menu> menuList);
+
+    /**
+     * 查询菜单对应权限
+     */
+    List<Integer> queryPermissionId(Integer menuId);
+
+    /**
+     * 批量新增菜单权限
+     */
+    Integer addMenuAndPermission(@Param("menu") Menu menu);
+
+    /**
+     *批量取消菜单权限
+     */
+    Integer deleteMenuAndPermission(@Param("menu") Menu menu);
+
+    /**
+     * 查询菜单未拥有的权限
+     */
+    List<Permission> queryNotPermission(Integer menuId,Integer page,Integer num,String permissionUrl,String permissionName);
+
+    Integer queryNotPermissionNum(Integer menuId,String permissionUrl,String permissionName);
+
+    /**
+     * 查询菜单已拥有的权限
+     */
+    List<Permission> queryPermission(Integer menuId,Integer page,Integer num);
+
+    Integer queryPermissionNum(Integer menuId);
+
+    /**
+     * 根据id查自己的子节点数
+     */
+    Integer queryMenuByParentId(Integer id);
+
+    Integer queryMenuAndRoleNumByMenuId(Integer menuId);
+
+    Integer queryMenuAndPermissionNumByMenuId(Integer menuId);
+
+    /**
+     * 查询菜单所属哪些角色
+     */
+    List<Role> queryRoleListByMenuId(Integer menuId,Integer page,Integer limit);
+
+    Integer queryRoleListNumByMenuId(Integer menuId);
+
+    /**
+     * 查看停用菜单
+     */
+    List<Menu> getMenuStatusListByPage(Long startNum, Long limitNum, String menuName, String menuUrl, Integer parentId);
+
+    Integer getMenuStatusListNumByPage(String menuName, String menuUrl, Integer parentId);
+
+    /**
+     * 启用停用菜单
+     */
+    Integer updateMenuStatue(@Param("ids") List<Integer> ids);
+
+    /**
+     * 查询菜单
+     */
+    List<Menu> queryMenuTree(Integer parentId);
+
+    Integer updateMenuHiddenById(Integer menuId,Integer hidden);
+
+
+
+}

+ 22 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/MessageNoticeDao.java

@@ -0,0 +1,22 @@
+package com.example.opc_da.dao;
+
+
+import com.example.opc_da.entity.MessageNotice;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface MessageNoticeDao {
+    Long getAllMessageNoticeCount(String userId);
+
+    List<MessageNotice> getAllMessageNotice(Long startNum, Integer limitNum, String userId);
+
+    Integer deleteMessageNoticeById(Integer id);
+
+    Integer readMessageNoticeById(Integer id, Integer alreadyRead);
+
+    Integer addMessageNotice(MessageNotice messageNotice);
+
+    MessageNotice getMessageNoticeById(Integer id);
+}

+ 39 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/PermissionDao.java

@@ -0,0 +1,39 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Permission;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface PermissionDao {
+
+    Permission getPermissionByUrl(String permissionUrl);
+
+    Integer addPermission(Permission permission);
+
+    Permission getPermissionByNoIdUrl(int id, String permissionUrl);
+
+    Integer updatePermission(Permission permission);
+
+    Permission getPermissionById(Integer id);
+
+    Long getPermissionCount(String permissionUrl, String permissionName);
+
+    List<Permission> getPermissionListByPage(Long startNum, Long limitNum, String permissionUrl, String permissionName);
+
+    Integer deletePermissionById(Integer id);
+
+    Integer deleteMenuPermissionById(Integer permissionId);
+
+    /**
+     * 查询权限所属菜单
+     */
+    List<Menu> queryMenuByPermissionId(Integer permissionId,Integer page,Integer limit);
+
+    Integer queryMenuNumByPermissionId(Integer permissionId);
+
+
+
+}

+ 22 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/RawDataDao.java

@@ -0,0 +1,22 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Item;
+import com.example.opc_da.entity.RawData;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Repository
+public interface RawDataDao {
+
+    Integer addRawData(Integer itemGroupId, Integer remainder, RawData rawData);
+
+    Integer addRawDataList(Integer itemGroupId, Integer remainder, List<RawData> rawDataList);
+
+    List<RawData> getLineOrBarData(Integer itemGroupId, Integer remainder, Integer dataSourceId, String itemName);
+
+    List<Map<String, Object>> getPieData(Integer itemGroupId, Integer remainder, Integer dataSourceId, List<Item> itemList);
+
+    List<RawData> getTableDataEvery(Integer itemGroupId, Integer remainder, Integer dataSourceId, String itemName,String startBelongTime,String endBelongTime);
+}

+ 66 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/ReportTableDao.java

@@ -0,0 +1,66 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.ReportTable;
+import com.example.opc_da.entity.TableTemplate;
+import com.example.opc_da.entity.UserGroupUser;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface ReportTableDao {
+
+    TableTemplate getTableTemplateByName(String userId, String templateName);
+
+    Integer addTableTemplate(TableTemplate tableTemplate);
+
+    List<TableTemplate> getAllTableTemplate(Long startNum, Long limitNum, String userId);
+
+    TableTemplate getTableTemplateById(Integer id);
+
+    Integer delTableTemplateById(Integer id);
+
+    TableTemplate getTableTemplateByNameNoId(Integer id, String userId, String templateName);
+
+    Integer updateTableTemplate(TableTemplate tableTemplate);
+
+    ReportTable getReportTableByName(String userId, String reportTableName);
+
+    Integer addReportTable(ReportTable reportTable);
+
+    ReportTable getReportTableByNameNoId(Integer id, String userId, String reportTableName);
+
+    Integer updateReportTable(ReportTable reportTable);
+
+    List<ReportTable> getAllReportTable(Long startNum, Long limitNum, String userId, Integer isAutoReport);
+
+    ReportTable getReportTableById(Integer id);
+
+    Integer delReportTableById(Integer id);
+
+    Long getReportTableCount(String userId, Integer isAutoReport);
+
+    Long getTableTemplateCount(String userId);
+
+    Integer tableExchangeTypeById(Integer id, Integer isAutoReport);
+
+    Integer queryTableNum();
+
+    List<ReportTable> getAllOkReportTable1(List<UserGroupUser> userGroupUserList, Long startNum, Long limitNum, String userId, Integer isAutoReport);
+
+    List<ReportTable> getAllOkReportTable2(Long startNum, Long limitNum, String userId, Integer isAutoReport);
+
+    List<ReportTable> getAllAutoReportTable(Integer autoReport);
+
+    Integer tableExchangeAutoById(Integer id, Integer isAutoReport, String cronId, String cron);
+
+    Integer tableAssignUserById(Integer id, Integer userGroupId);
+
+    Integer getAllOkReportTableCount1(List<UserGroupUser> userGroupUserList, String userId, Integer isAutoReport);
+
+    Integer getAllOkReportTableCount2(String userId, Integer isAutoReport);
+
+    List<ReportTable> getReportTableByUserGroupId(Integer userGroupId);
+
+    Integer updateTableNameById(Integer id, String reportTableName);
+}

+ 183 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/RoleDao.java

@@ -0,0 +1,183 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.entity.Role;
+import com.example.opc_da.entity.User;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface RoleDao {
+
+    Role getRoleByName(String roleName);
+
+    Integer addRole(Role role);
+
+    Role getRoleByNoIdName(int id, String roleName);
+
+    Integer updateRole(Role role);
+
+    Long getRoleCount(String roleName, String roleCode, Integer noDelete);
+
+    List<Role> getRoleListByPage(Long startNum, Long limitNum, String roleName, String roleCode, Integer noDelete);
+
+    Role getRoleById(Integer id, Integer noDelete);
+
+    List<Menu> getMenuListByroleList(List<Role> roleList);
+
+    Integer deleteRoleById(Integer roleId, Integer publicIsDelete);
+
+    List<Menu> getShareMenuList(Integer roleId, List<Menu> menuList);
+
+    Integer deleteRoleMenuByRoleId(Integer roleId);
+
+    List<Menu> getNoShareOldMenuList(Integer roleId, List<Menu> menuList);
+
+    Integer deleteRoleMenu(Integer roleId, List<Menu> menuList);
+
+    Integer addRoleMenuList(Integer roleId, List<Menu> menuList);
+
+    List<Menu> getMenuByRoleIdList(List<Integer> roleIdList, Integer menuAvailable);
+
+    /**
+     * 批量删除角色
+     */
+    Integer deleteRoleIdList(@Param("ids") List<Integer> ids);
+
+    /**
+     * 查询删除的角色是否有对应用户
+     */
+    Integer queryUserByRoleId(Integer roleId);
+
+    /**
+     * 查询删除的角色是否有对应菜单
+     */
+    Integer queryMenuByRoleId(Integer roleId);
+
+
+    /**
+     * 根据角色id查角色
+     */
+    List<Role> queryRoleByRoleIds(@Param("ids") List<Integer> ids);
+
+    /**
+     * 查询角色对应菜单
+     */
+    List<Integer> queryRoleAndMenuId(Integer roleId);
+
+
+    /**
+     * 批量新增角色菜单
+     */
+    Integer addRoleAndMenu(@Param("role") Role role);
+
+    /**
+     *批量取消角色菜单
+     */
+    Integer deleteRoleAndMenu(@Param("role") Role role);
+
+    /**
+     * 查询角色未有菜单
+     */
+    List<Menu> queryNotRoleAndMenu(Integer roleId,Integer page,Integer num);
+
+    Integer queryNotRoleAndMenuNum(Integer roleId);
+
+    /**
+     * 查询角色已有菜单分页
+     */
+    List<Menu> queryRoleAndMenuIdPage(Integer roleId,Integer page,Integer num);
+
+    Integer queryRoleAndMenuIdNum(Integer roleId);
+
+    /**
+     * 查询角色已有菜单id
+     */
+    List<Integer> queryRoleAndMenuListId(Integer roleId);
+
+    /**
+     * 根据用户id删除用户角色关联信息
+     */
+    Integer deleteUserRoleByUserId(String userId);
+
+    /**
+     * 根据用户id得到对应的菜单id
+     */
+    List<Integer> queryMenuIdByUserId(String userId);
+
+    /**
+     * 根据用户id查已有父级菜单
+     */
+    List<Menu> queryMenuByUserId(String userId);
+
+    /**
+     * 查询角色未有的用户
+     */
+    List<User> queryNotUserByRoleId(Integer roleId,Integer page,Integer num,String userName,Integer userType);
+
+    Integer queryNotUserByRoleIdNum(Integer roleId,String userName,Integer userType);
+
+    /**
+     * 查询用户已有用户id
+     */
+    List<String> queryUserIdByRoleId(Integer roleId,String userName,Integer userType);
+
+    /**
+     * 查询角色未拥有的用户id
+     */
+    List<String> queryNotUserIdByRoleId(Integer roleId,String userName,Integer userType);
+
+    /**
+     * 批量新增角色对应用户
+     */
+    Integer addUserAndRole(Integer roleId,List<String> userIds);
+
+    /**
+     * 批量删除角色对应用户
+     */
+    Integer deleteUserByROleId(Integer roleId,List<String> userIds);
+
+    Integer deleteUserAndRole(Integer roId);
+
+    /**
+     * 为用户批量新增角色
+     */
+    Integer addUserAndRoleByUserId(String userId,@Param("roleList") List<Role> roleList);
+
+    /**
+     * 为用户批量删除角色
+     */
+    Integer deleteUserAndRoleByUserId(String userId,@Param("roleList") List<Role> roleList);
+
+    Integer getRoleMenuByRoleIdList(@Param("roleIdList") List<Integer> roleIdList);
+    /**
+     * 查询角色已有权限
+     */
+    List<Permission> queryPermissionByRoleId(Integer roleId, Integer page, Integer num);
+
+    Integer queryPermissionCountByRoleId(Integer roleId);
+
+    /**
+     * 查询角色对应的用户数量
+     */
+    Integer queryUserNumByRoleIdList(@Param("roleIdList") List<Integer> roleIdList);
+
+    /**
+     * 根据用户id删除用户角色关联信息
+     */
+    Integer deleteUserRoleByUserIdList( @Param("userIdList") List<String> userIdList);
+
+    /**
+     * 删除角色以及对应的相关信息
+     */
+    Integer deleteRoleList(@Param("roleIdList") List<Integer> roleIdList);
+
+    /**
+     * 查询角色数量
+     */
+    Integer queryRoleNum(Integer PUBLIC_NO_DELETE);
+
+}

+ 137 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserDao.java

@@ -0,0 +1,137 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.*;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface UserDao {
+
+    User getUserByNamePass(String userName, String password);
+
+    User getUserById(String userId);
+
+    User getUserByName(String userName);
+
+    Integer addUser(User user);
+
+    Integer addUserRole(String userId, int roleId);
+
+    List<Role> getShareRoleList(String userId, List<Role> roleList);
+
+    List<Role> getNoShareOldRoleList(String userId, List<Role> roleList);
+
+    Integer deleteUserRole(String userId, List<Role> roleList);
+
+    Integer addUserRoleList(String userId, List<Role> roleList);
+
+    List<Role> getRoleListByUserId(String userId);
+
+    Long getUserCount(String userName, Integer state, Integer userType, Integer tombstoneUser);
+
+    List<User> getUserPage(Long startNum, Long limitNum, String userName, Integer state, Integer userType, Integer tombstoneUser);
+
+    Integer deleteUserRoleByUserId(String userId);
+
+    Integer updateUserState(String userId, Integer userState);
+
+    Integer updateLoginState(String userId);
+
+    Integer updateUser(User user);
+
+    User getUserByNameNoId(String userId, String userName);
+
+    Long getUserListByRoleIdCount(Integer roleId, String userName, Integer noDelete, Integer tombstoneUser);
+
+    List<User> getUserListByRoleId(Long startNum, Long limitNum, Integer roleId, String userName, Integer noDelete, Integer tombstoneUser);
+
+    List<String> getAssignUserIdList(List<String> userIdList, Integer roleId);
+
+    Integer assignUserListByRoleId(List<String> userIdList, Integer roleId);
+
+    Integer deleteByUserIdRoleId(String userId, String roleId);
+
+    /**
+     * 根据用户id查姓名
+     */
+    String queryUserNameByid(String id);
+
+    /**
+     * 根据用户和roleid批量删除用户角色
+     */
+    Integer deleteByUserIdRoleIds(@Param("userRoles")List<UserRole> userRoles);
+
+    /**
+     *修改密码(重置)
+     */
+    Integer updatePassWord(@Param("user") User user);
+
+    Integer queryUserName(String name);
+
+    User getUserByNamePassByUpdate(String userName, String password);
+
+    /**
+     * 查询用户详情
+     */
+    User queryUserDtail(String userId);
+
+    /**
+     * 查询用户对应角色
+     */
+    List<Role> queryRoleByUserId(String userId);
+
+    /**
+     * 查询用户所属部门
+     */
+    List<Department> queryDepartmentByUserId(String userId);
+
+    /**
+     * 查询用户未拥有的菜单
+     */
+    List<Menu> queryNotMenuByUserId(String userId);
+
+    /**
+     * 查询所有管理端用户
+     */
+    List<User> queryUserType(Integer startNum, Integer limitNum, String userName, Integer state,  Integer tombstoneUser,Integer roleId);
+
+    Integer queryUserTypeNum(String userName, Integer state,  Integer tombstoneUser,Integer roleId);
+
+    /**
+     * 查询未有部门的用户
+     */
+    List<User> queryUserNOtInDepartment(String userName,Integer state,Integer page,Integer num);
+
+    Integer queryUserNOtInDepartmentNum(String userName,Integer state);
+
+    /**
+     * 批量逻辑删除用户
+     */
+    Integer updateUserListState(@Param("userIdList") List<String> userId, Integer userState);
+
+    /**
+     * 查询删除用户
+     */
+    List<User> queryDeleteUser(Integer page, Integer num, String userName, Integer userType, Integer TOMBSTONE);
+
+    Integer queryDleteUserNum(String userName, Integer userType, Integer TOMBSTONE);
+
+    /**
+     * 恢复已被删除的用户
+     */
+    Integer updateUserByListId(@Param("userIdList") List<String> userIdList, Integer normalUse);
+
+    /**
+     * 客户端用户数量
+     */
+    Integer queryCustomerUserNum(Integer frontUser,Integer TOMBSTONE);
+
+    /**
+     * 管理端用户数量
+     */
+    Integer queryManagerUserNum(Integer backUser,Integer TOMBSTONE);
+
+
+}

+ 36 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dao/UserGroupDao.java

@@ -0,0 +1,36 @@
+package com.example.opc_da.dao;
+
+import com.example.opc_da.entity.User;
+import com.example.opc_da.entity.UserGroup;
+import com.example.opc_da.entity.UserGroupUser;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface UserGroupDao {
+
+    List<UserGroup> getAllUserGroup(String userId);
+
+    UserGroup getUserGroupById(Integer id);
+
+    List<String> getUserGroupUserById(Integer userGroupId);
+
+    Integer delUserGroupUserListById(Integer userGroupId);
+
+    Integer delUserGroupById(Integer id);
+
+    Integer addUserGroup(UserGroup userGroup);
+
+    Integer addUserGroupUserList(Integer userGroupId, List<String> userIdList);
+
+    UserGroup getUserGroupByNameNoId(Integer id, String userId, String userGroupName);
+
+    Integer updateUserGroup(UserGroup userGroup);
+
+    List<UserGroupUser> getUserGroupUserList(String userId);
+
+    List<User> getUserByGroupId(Integer userGroupId,Integer normalUse);
+
+    UserGroup getUserGroupByName(String userId, String userGroupName);
+}

+ 24 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/BaseSchedule.java

@@ -0,0 +1,24 @@
+package com.example.opc_da.dynamicSchedule;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 所有动态定时器,都需要继承这个超类
+ */
+@Data
+public class BaseSchedule implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * 定时器主键
+     */
+    private String cronId;
+
+    /**
+     * 定时器cron表达式
+     */
+    private String cron;
+}

+ 72 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/CronTaskRegister.java

@@ -0,0 +1,72 @@
+package com.example.opc_da.dynamicSchedule;
+
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.scheduling.TaskScheduler;
+import org.springframework.scheduling.config.CronTask;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * 定时器注册类,增加定时器任务,删除定时器任务
+ */
+@Component
+public class CronTaskRegister implements DisposableBean {
+
+    @Resource
+    TaskScheduler taskScheduler;
+
+    private final Map<String, ScheduledTask> scheduledTaskMap = new ConcurrentHashMap<>();
+
+    public TaskScheduler getTaskScheduler() {
+        return this.taskScheduler;
+    }
+
+    /**
+     * 新增定时器任务
+     *
+     * @param task
+     * @param cron
+     */
+    public void addCronTask(Runnable task, String cronId, String cron) {
+        addCronTask(new CronTask(task, cron), cronId);
+    }
+
+    public void addCronTask(CronTask cronTask, String cronId) {
+        if (cronTask != null) {
+            if (this.scheduledTaskMap.containsKey(cronId)) {
+                removeCronTask(cronId);
+            }
+            //重新添加
+            this.scheduledTaskMap.put(cronId, scheduleCronTask(cronTask));
+        }
+    }
+
+    /**
+     * 移除定时器
+     *
+     * @param cronId
+     */
+    public void removeCronTask(String cronId) {
+        ScheduledTask scheduledTask = this.scheduledTaskMap.remove(cronId);
+        if (scheduledTask != null) {
+            scheduledTask.cancel();
+        }
+    }
+
+    public ScheduledTask scheduleCronTask(CronTask cronTask) {
+        ScheduledTask scheduledTask = new ScheduledTask();
+        scheduledTask.future = this.taskScheduler.schedule(cronTask.getRunnable(), cronTask.getTrigger());
+        return scheduledTask;
+    }
+
+    @Override
+    public void destroy() throws Exception {
+        for (ScheduledTask task : this.scheduledTaskMap.values()) {
+            task.cancel();
+        }
+        this.scheduledTaskMap.clear();
+    }
+}

+ 42 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/DynamicScheduleConfig.java

@@ -0,0 +1,42 @@
+package com.example.opc_da.dynamicSchedule;
+
+import com.example.opc_da.dao.ReportTableDao;
+import com.example.opc_da.entity.ReportTable;
+import com.example.opc_da.task.ReportTableTask;
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.ConstantStr;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.SchedulingConfigurer;
+import org.springframework.scheduling.config.ScheduledTaskRegistrar;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Slf4j
+@Configuration
+public class DynamicScheduleConfig implements SchedulingConfigurer {
+
+    //这里因为报表存在动态定时器,所以,引入进来,如果后面有其他类型的动态定时器也需要在这里引进来,系统启动才能扫描到配置的定时器
+    @Resource
+    ReportTableDao reportTableDao;
+
+    @Resource
+    CronTaskRegister cronTaskRegister;
+
+    @Override
+    public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
+
+        List<ReportTable> reportTableList = reportTableDao.getAllAutoReportTable(ConstantStr.AUTOMATIC_REPORT);
+        if (Blank.isNotEmpty(reportTableList)) {
+            for (ReportTable reportTable : reportTableList) {
+//                scheduledTaskRegistrar.addTriggerTask(
+//                        new SchedulingRunnable(TestTask.class, "test1", new Object[]{reportTable.getId(), reportTable.getCron()})
+//                        , triggerContext -> {
+//                            return new CronTrigger(reportTable.getCron()).nextExecutionTime(triggerContext);
+//                        });
+                cronTaskRegister.addCronTask(new SchedulingRunnable(ReportTableTask.class, "getTableData", new Object[]{reportTable.getId()}), reportTable.getCronId(), reportTable.getCron());
+            }
+        }
+    }
+}

+ 24 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/ScheduleConfig.java

@@ -0,0 +1,24 @@
+package com.example.opc_da.dynamicSchedule;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.TaskScheduler;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
+
+@Configuration
+public class ScheduleConfig {
+
+    /**
+     * 线程池
+     * @return
+     */
+    @Bean
+    public TaskScheduler taskScheduler() {
+        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
+        //定时任务执行线程池核心线程数
+        taskScheduler.setPoolSize(50);
+        taskScheduler.setRemoveOnCancelPolicy(true);
+        taskScheduler.setThreadNamePrefix("schedule-task-");
+        return taskScheduler;
+    }
+}

+ 18 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/ScheduledTask.java

@@ -0,0 +1,18 @@
+package com.example.opc_da.dynamicSchedule;
+
+import java.util.concurrent.ScheduledFuture;
+
+public final class ScheduledTask {
+
+    public volatile ScheduledFuture<?> future;
+
+    /**
+     * 取消定时任务
+     */
+    public void cancel() {
+        ScheduledFuture<?> future = this.future;
+        if (future != null) {
+            future.cancel(true);
+        }
+    }
+}

+ 57 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/dynamicSchedule/SchedulingRunnable.java

@@ -0,0 +1,57 @@
+package com.example.opc_da.dynamicSchedule;
+
+import com.example.opc_da.config.SpringContextUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.ReflectionUtils;
+
+import java.lang.reflect.Method;
+
+public class SchedulingRunnable implements Runnable {
+
+    private static final Logger logger = LoggerFactory.getLogger(SchedulingRunnable.class);
+
+    private Class clazz;
+    private String className;
+
+    private String methodName;
+
+    private Object[] params;
+
+    public SchedulingRunnable(Class clazz, String methodName, Object... params) {
+        this.clazz = clazz;
+        className = clazz.getName();
+        this.methodName = methodName;
+        this.params = params;
+    }
+
+    @Override
+    public void run() {
+        logger.info("定时任务开始执行 -bean:{},方法:{},参数:{}", className, methodName, params);
+
+        long startTime = System.currentTimeMillis();
+        try {
+            Object target = SpringContextUtils.getBean(clazz);
+            Method method = null;
+            if (null != params && params.length > 0) {
+                Class<?>[] paramCls = new Class[params.length];
+                for (int i = 0; i < params.length; i++) {
+                    paramCls[i] = params[i].getClass();
+                }
+                method = target.getClass().getDeclaredMethod(methodName, paramCls);
+            } else {
+                method = target.getClass().getDeclaredMethod(methodName);
+            }
+            ReflectionUtils.makeAccessible(method);
+            if (null != params && params.length > 0) {
+                method.invoke(target, params);
+            } else {
+                method.invoke(target);
+            }
+        } catch (Exception e) {
+            logger.error(String.format("定时任务执行异常 - bean:%s,方法:%s,参数:%s ", className, methodName, params), e);
+        }
+        long times = System.currentTimeMillis() - startTime;
+        logger.info("定时任务执行结束 - bean:{},方法:{},参数:{},耗时:{} 毫秒", className, methodName, params, times);
+    }
+}

+ 19 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/AddUserRole.java

@@ -0,0 +1,19 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AddUserRole {
+
+    /**
+     * 用户id列表
+     */
+    private List<String> userIdList;
+
+    /**
+     * roleid
+     */
+    private Integer roleId;
+}

+ 17 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ChartDataDto.java

@@ -0,0 +1,17 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ChartDataDto implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+    /**
+     * 统计图类型(扇形pie,折现line,条形bar)
+     */
+    private String type;
+
+    private ItemGroup itemGroup;
+}

+ 39 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataModel.java

@@ -0,0 +1,39 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class DataModel implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * 主键id
+     */
+    private Integer id;
+
+    /**
+     * 数学参数
+     */
+    private String mathParameter;
+    /**
+     * 四则混合运算表达式
+     */
+    private String operationRule;
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    /**
+     * 备注,数据模型名称
+     */
+    private String remark;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+}

+ 91 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataSource.java

@@ -0,0 +1,91 @@
+package com.example.opc_da.entity;
+
+import com.example.opc_da.util.Blank;
+import com.example.opc_da.util.RSAUtil;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class DataSource implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 数据源类型id
+     */
+    private Integer typeId;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 数据源类型名称
+     */
+    private String dataSourceName;
+    /**
+     * 数据源类型描述
+     */
+    private String dataSourceDescribe;
+    /**
+     * ip地址
+     */
+    private String ipAddress;
+    /**
+     * ip端口
+     */
+    private String ipPort;
+    /**
+     * ip用户名
+     */
+    private String ipUserName;
+    /**
+     * ip密码
+     */
+    private String ipPassword;
+    /**
+     * 是否匿名;0不匿名,1匿名
+     */
+    private Integer isAnonymous;
+    /**
+     * 驱动的注册表id
+     */
+    private String clsId;
+    /**
+     * 驱动名称
+     */
+    private String progId;
+    /**
+     * 驱动描述
+     */
+    private String driverDescribe;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+    /**
+     * 虚拟字段
+     */
+    private String dataSourceTypeName;
+    private String dataSourceTypeKey;
+    private String dataSourceTypeDescribe;
+
+    public static DataSource convertPassword(DataSource dataSource) {
+        if (Blank.isEmpty(dataSource)) {
+            return null;
+        }
+        if (Blank.isNotEmpty(dataSource.getIpPassword())) {
+            try {
+                dataSource.setIpPassword(RSAUtil.decrypt(dataSource.getIpPassword(), "UTF-8"));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return dataSource;
+    }
+}

+ 36 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DataSourceType.java

@@ -0,0 +1,36 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class DataSourceType implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父id
+     */
+    private Integer parentId;
+    /**
+     * 数据源类型名称
+     */
+    private String dataSourceTypeName;
+    /**
+     * 数据源类型代码
+     */
+    private String dataSourceTypeKey;
+    /**
+     * 排序号
+     */
+    private Integer sortNum;
+    /**
+     * 数据源类型描述
+     */
+    private String dataSourceTypeDescribe;
+}

+ 61 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Department.java

@@ -0,0 +1,61 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class Department implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父id
+     */
+    private Integer parentId;
+    /**
+     * 菜单名称
+     */
+    private String departmentName;
+    /**
+     * 菜单路径
+     */
+    private String departmentDescribe;
+    /**
+     * 排序号
+     */
+    private Integer departmentNum;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 逻辑删除,0未删除,1已删除
+     */
+    private Integer isDelete;
+
+    /**
+     * 子节点
+     */
+    private List<Department> children=new ArrayList<>();
+
+    /**
+     * 部门所属员工
+     */
+    private List<User> userList;
+
+    private  Department departmentParent;
+
+}

+ 52 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Dict.java

@@ -0,0 +1,52 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class Dict {
+
+    /**
+     *id
+     */
+    private Integer id;
+
+    /**
+     *父id
+     */
+    private Integer parentId;
+
+    /**
+     *字典编码
+     */
+    private String dictKey;
+
+    /**
+     *字典值
+     */
+    private String dictValue;
+
+    /**
+     * 字典id
+     */
+    private Integer dictTypeId;
+
+
+    /**
+     *排序号
+     */
+    private Integer sortNum;
+
+    /**
+     *创建时间
+     */
+    private String createTime;
+
+    /**
+     * 子节点    private List<Dict> children=new ArrayList<>();
+     */
+    private List<Dict> children=new ArrayList<>();
+
+}

+ 32 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/DictType.java

@@ -0,0 +1,32 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+@Data
+public class DictType {
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 字典类型
+     */
+    private String dictKeyType;
+
+    /**
+     *字典值
+     */
+    private String dictKeyValue;
+
+    /**
+     * 排序号
+     */
+    private Integer sortNum;
+
+    /**
+     * 描述
+     */
+    private String description;
+}

+ 44 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/FileEntity.java

@@ -0,0 +1,44 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class FileEntity implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 保存的路径
+     */
+    private String filePath;
+    /**
+     * 文件原始名称
+     */
+    private String originalFileName;
+    /**
+     * 保存的文件名称
+     */
+    private String saveFileName;
+    /**
+     * 文件后缀名
+     */
+    private String suffixName;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+    public FileEntity(String filePath, String originalFileName, String saveFileName, String suffixName) {
+        this.filePath = filePath;
+        this.originalFileName = originalFileName;
+        this.saveFileName = saveFileName;
+        this.suffixName = suffixName;
+    }
+
+}

+ 45 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Item.java

@@ -0,0 +1,45 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class Item implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * item组id
+     */
+    private Integer itemGroupId;
+    /**
+     * 项名称
+     */
+    private String itemName;
+    /**
+     * 项读取数据使用的名称
+     */
+    private String itemReadName;
+    /**
+     * opcUa特有的nodeId路径
+     */
+    private Integer nodeIndex;
+    private String dataType;
+
+    private String describe;
+    /**
+     * 数据模型id
+     */
+    private Integer dataModelId;
+
+    /**
+     * 虚拟数据源名称,返回给前端的
+     */
+    private String dataSourceName;
+
+}

+ 65 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ItemGroup.java

@@ -0,0 +1,65 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class ItemGroup implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 组名称
+     */
+    private String groupName;
+    /**
+     * 组描述
+     */
+    private String groupDescribe;
+    /**
+     * 数据源配置id
+     */
+    private Integer dataSourceId;
+    /**
+     * 读取模式;0频率,1变化时读取,2超过或者等于设定值读取,3低于或者等于设定值读取
+     */
+    private Integer readMode;
+    /**
+     * 模式值
+     */
+    private Integer modeValue;
+    /**
+     * 启动状态:0停用,1启用
+     */
+    private Integer runState;
+    /**
+     * 开始读取时间
+     */
+    private String startReadTime;
+    /**
+     * 结束读取时间
+     */
+    private String endReadTime;
+    /**
+     * 取值条件0平均值,1最大值,2最小值,3瞬时值
+     */
+    private Integer valueCondition;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+    /**
+     * 标签集合
+     */
+    private List<Item> itemList;
+}

+ 58 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Log.java

@@ -0,0 +1,58 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class Log implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * 主键id
+     */
+    private Integer id;
+    /**
+     * 服务名称
+     */
+    private String serverName;
+    /**
+     * 模块名称
+     */
+    private String modelName;
+    /**
+     * 日志内容
+     */
+    private String content;
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * IP地址
+     */
+    private String ipAddress;
+    /**
+     * 操作状态
+     */
+    private Integer operationStatus;
+    /**
+     * 方法名
+     */
+    private String methodName;
+    /**
+     * 耗时
+     */
+    private String consumeTime;
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 66 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Menu.java

@@ -0,0 +1,66 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class Menu implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父id
+     */
+    private Integer parentId;
+    /**
+     * 菜单名称
+     */
+    private String menuName;
+    /**
+     * 菜单路径
+     */
+    private String menuUrl;
+    /**
+     * 菜单图标
+     */
+    private String menuIcon;
+    /**
+     * 排序号
+     */
+    private Integer sortNum;
+    /**
+     * 菜单状态1:可用,0:不可用
+     */
+    private Integer menuStatus;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 子菜单
+     */
+    private List<Menu> children=new ArrayList<>();
+
+    private List<Permission> permissionList;
+
+    /**
+     * 是否隐藏
+     * 0:不隐藏
+     * 1:隐藏
+     */
+    private Integer hidden;
+
+}

+ 52 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/MessageNotice.java

@@ -0,0 +1,52 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+import lombok.experimental.Tolerate;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class MessageNotice implements Serializable {
+
+
+    /**
+     * 主键id
+     */
+    private Integer id;
+    /**
+     * 通知用户id
+     */
+    private String userId;
+    /**
+     * 通知标题
+     */
+    private String noticeTitle;
+    /**
+     * 通知内容
+     */
+    private String noticeContent;
+    /**
+     * 是否已读,0未读,1已读
+     */
+    private Integer readState;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 无参构造方法被覆盖了,需要手动
+     */
+    @Tolerate
+    public MessageNotice() {
+
+    }
+
+    public MessageNotice(String userId, String noticeTitle, String noticeContent, Integer readState) {
+        this.userId = userId;
+        this.noticeTitle = noticeTitle;
+        this.noticeContent = noticeContent;
+        this.readState = readState;
+    }
+}

+ 29 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Permission.java

@@ -0,0 +1,29 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class Permission implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 权限路径
+     */
+    private String permissionUrl;
+    /**
+     * 权限名称
+     */
+    private String permissionName;
+
+    /**
+     * 菜单名(权限来源)
+     */
+    private String menuName;
+}

+ 69 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/RawData.java

@@ -0,0 +1,69 @@
+package com.example.opc_da.entity;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.Tolerate;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class RawData implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * item组id
+     */
+    private Integer itemGroupId;
+    /**
+     * 数据源id
+     */
+    private Integer dataSourceId;
+    /**
+     * 项名称
+     */
+    private String itemName;
+    /**
+     * 数据类型
+     */
+    private String dataType;
+    /**
+     * 数据值集合(按照每个小时存为一个集合)
+     */
+    private String dataValue;
+    /**
+     * 数据值对应的时间集合
+     */
+    private String dataValueTime;
+    /**
+     * 数据值归属时间,比如:2023-01-01 08,代表指定日期,指定小时的所有数据
+     */
+    private String valueBelongTime;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 无参构造方法被覆盖了,需要手动
+     */
+    @Tolerate
+    public RawData() {
+
+    }
+
+    public RawData(Integer dataSourceId, String itemName, String dataType, String dataValue, String dataValueTime, String valueBelongTime, Date createTime) {
+        this.dataSourceId = dataSourceId;
+        this.itemName = itemName;
+        this.dataType = dataType;
+        this.dataValueTime = dataValueTime;
+        this.valueBelongTime = valueBelongTime;
+        this.dataValue = dataValue;
+        this.createTime = createTime;
+    }
+}

+ 50 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/ReportTable.java

@@ -0,0 +1,50 @@
+package com.example.opc_da.entity;
+
+import com.example.opc_da.dynamicSchedule.BaseSchedule;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class ReportTable extends BaseSchedule implements Serializable {
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 用户名,虚拟的,用于返回
+     */
+    private String userName;
+    /**
+     * 报表名称
+     */
+    private String reportTableName;
+
+    /**
+     * 报表信息
+     */
+    private String reportTableData;
+    /**
+     * 报表取值格式,0代表取昨天08-今天07的数据
+     */
+    private Integer reportValueFormat;
+    /**
+     * 报表类型,是否为自动报表,0手动,1 自动,2自动报表生成的表
+     */
+    private Integer isAutoReport;
+    /**
+     * 用户组id
+     */
+    private Integer userGroupId;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+}

+ 31 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/Role.java

@@ -0,0 +1,31 @@
+package com.example.opc_da.entity;
+
+import com.example.opc_da.util.ConstantStr;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class Role implements Serializable {
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 角色名称
+     */
+    private String roleName;
+    /**
+     * 角色代码
+     */
+    private String roleCode;
+    /**
+     * 逻辑删除0未删除,1已删除
+     */
+    private Integer isDelete = ConstantStr.PUBLIC_NO_DELETE;
+
+    private List<Menu> menuList;
+}

+ 28 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableDataDto.java

@@ -0,0 +1,28 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class TableDataDto implements Serializable {
+
+    /**
+     * 报表取值格式
+     */
+    private Integer reportValueFormat;
+
+    /**
+     * 获取值的开始归属时间,yyyy-MM-dd HH,如果未传入,则是昨天的08时
+     */
+    private String startBelongTime;
+
+    /**
+     * 获取值的结束归属时间,yyyy-MM-dd HH,如果未传入,则是今天的07时
+     */
+    private String endBelongTime;
+
+    private List<TableDataDtoCh> tableDataDtoChList;
+
+}

+ 20 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableDataDtoCh.java

@@ -0,0 +1,20 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class TableDataDtoCh implements Serializable {
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * 数据组id
+     */
+    private Integer itemGroupId;
+    /**
+     * 项名称
+     */
+    private String itemName;
+
+}

+ 33 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TableTemplate.java

@@ -0,0 +1,33 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class TableTemplate implements Serializable {
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 模板名称
+     */
+    private String templateName;
+
+    /**
+     * 模板信息
+     */
+    private String templateData;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+}

+ 42 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/TreeDepartment.java

@@ -0,0 +1,42 @@
+package com.example.opc_da.entity;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class TreeDepartment {
+
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 父id
+     */
+    private Integer parentId;
+    /**
+     * 菜单名称
+     */
+    private String departmentName;
+    /**
+     * 菜单路径
+     */
+    private String departmentDescribe;
+    /**
+     * 排序号
+     */
+    private Integer departmentNum;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+
+    /**
+     * 子节点
+     */
+    private List<Department> children=new ArrayList<>();
+}

+ 67 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/User.java

@@ -0,0 +1,67 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class User implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+    /**
+     * 用户名称
+     */
+    private String userName;
+    /**
+     * 用户密码
+     */
+    private String password;
+
+    /**
+     * 用户新密码(修改密码时候操作)
+     */
+    private String newPassword;
+    /**
+     * sessionId传值
+     */
+    private String uid;
+    /**
+     * 验证码
+     */
+    private String verifyCode;
+    /**
+     * 用户类型0前端用户,1后端用户
+     */
+    private Integer userType;
+    /**
+     * 用户状态
+     */
+    private Integer state;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    private Date updateTime;
+    /**
+     * 最后登录时间
+     */
+    private Date lastLoginTime;
+
+    private List<Role> roleList;
+
+    private List<Department> departmentList;
+
+    private Department department;
+
+
+}

+ 44 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserGroup.java

@@ -0,0 +1,44 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class UserGroup implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 用户组名称
+     */
+    private String userGroupName;
+
+    /**
+     * 创建用户组的用户id
+     */
+    private String userId;
+    /**
+     * 排序号
+     */
+    private Integer sortNum;
+    /**
+     * 用户组描述
+     */
+    private String userGroupDescribe;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private List<String> userIdList;
+
+}

+ 26 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserGroupUser.java

@@ -0,0 +1,26 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class UserGroupUser implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 用户组id
+     */
+    private Integer userGroupId;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+}

+ 26 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/entity/UserRole.java

@@ -0,0 +1,26 @@
+package com.example.opc_da.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class UserRole implements Serializable {
+
+    private static final long serialVersionUID = -96536212774977561L;
+
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    /**
+     * 角色id
+     */
+    private String roleId;
+}

+ 34 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/DataSourceTypeEnum.java

@@ -0,0 +1,34 @@
+package com.example.opc_da.enums;
+
+public enum DataSourceTypeEnum {
+
+    OPC_UA_REAL("OPC UA 实时数据", "opc_ua_real"),
+    OPC_UA_HISTORY("OPC UA 历史数据", "opc_ua_history"),
+    OPC_DA_REAL("OPC DA 实时数据", "opc_da_real"),
+    OPC_HDA_HISTORY("OPC HDA 历史数据访问", "opc_hda_history"),
+    OPC_AE_ALARMS("OPC AE 实时报警", "opc_ae_alarms");
+
+    private String name;
+    private String value;
+
+    DataSourceTypeEnum(String name, String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 56 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ModelEnum.java

@@ -0,0 +1,56 @@
+package com.example.opc_da.enums;
+
+public enum ModelEnum {
+
+    UNKNOWN("未知模块", "UNKNOWN"),
+
+    USER("用户管理", "USER"), ROLE("角色管理", "ROLE"), BASIC_DATA("基础数据", "BASIC_DATA"), MENU("菜单管理", "MENU"), PERMISSION("接口权限管理", "PERMISSION"),
+    DEPARTMENT("部门管理", "DEPARTMENT"), GROUP("用户组管理", "GROUP"), PERSON("人员管理", "PERSON"), DICT("字典管理", "DICT"),
+
+    RUNNING("运行", "RUNNING"),
+    DATASOURCE("数据源配置", "DATASOURCE"),
+    TABLETEMPLATE("报表模板", "TABLETEMPLATE"),
+    REPORTTABLE("报表", "TABLETEMPLATE"),
+    DATAGROUP("数据组配置", "DATAGROUP"),
+    DATAMODEL("数据模型", "DATAMODEL"),
+    RUNSETUP("运行配置", "RUNSETUP"),
+    USERGROUP("用户组", "USERGROUP"),
+    MESSAGENOTICE("消息通知", "MESSAGENOTICE"),
+
+    SIGNIN("登录", "SIGNIN"), LOGOUT("退出登录", "LOGOUT"), REGISTER("注册", "REGISTER"), HOMEBYPAGE("首页", "HOMEBYPAGE"),
+    UPDATECODE("发送验证码", "UPDATECODE");
+
+    private String value;
+
+    private String name;
+
+    private ModelEnum(String value, String name) {
+        this.value = value;
+        this.name = name;
+    }
+
+    public static String getName(String name) {
+        for (ModelEnum c : ModelEnum.values()) {
+            if (c.getName().equalsIgnoreCase(name)) {
+                return c.value;
+            }
+        }
+        return "";
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 21 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/OpcDaDriverEnum.java

@@ -0,0 +1,21 @@
+package com.example.opc_da.enums;
+
+public enum OpcDaDriverEnum {
+    KEPSERVER("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"),
+    OPCIFIX("3C5702A2-EB8E-11D4-83A4-00105A984CBD"),
+    WINCC("75D00BBB-DDA5-11D1-B944-9E614D000000");
+
+    private String value;
+
+    OpcDaDriverEnum(String value) {
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

+ 50 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/OperationEnum.java

@@ -0,0 +1,50 @@
+package com.example.opc_da.enums;
+
+public enum OperationEnum {
+
+    UNKNOWN("未知操作", "UNKNOWN"),
+
+    LOGIN("登录", "LOGIN"), LOGOUT("退出登录", "LOGOUT"), UPDATEPASSWORD("修改密码", "UPDATEPASSWORD"),
+    ADD("新增", "ADD"), SELECT("查看", "SELECT"), UPDATE("编辑", "UPDATE"), DELETE("删除", "DELETE"),
+    ASSIGN("分配", "ASSIGN"), RELIEVE("解除", "RELIEVE"),
+    IMPORT("导入", "IMPORT"), EXPORT("导出", "EXPORT"),
+    REGISTER("注册", "REGISTER"),
+    TEST("测试", "TEST"), OPEN("打开", "OPEN"), CLOSE("关闭", "CLOSE"),
+    RUN("运行", "RUN"), STOPIT("停用", "STOPIT"),
+    CHARTDATA("统计图数据", "CHARTDATA"), TABLEDATA("表格数据", "TABLEDATA"),
+    READ("读取", "READ");
+
+    private String value;
+
+    private String name;
+
+    private OperationEnum(String value, String name) {
+        this.value = value;
+        this.name = name;
+    }
+
+    public static String getName(String name) {
+        for (OperationEnum c : OperationEnum.values()) {
+            if (c.getName().equalsIgnoreCase(name)) {
+                return c.value;
+            }
+        }
+        return "";
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 41 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ResultEnum.java

@@ -0,0 +1,41 @@
+package com.example.opc_da.enums;
+
+public enum ResultEnum {
+
+    SUCCESS(200, "success"),
+
+    REQUEST_WRONGPARAMS(400, "参数错误"),
+    LOGIN_EXPIRED(401, "登录信息过期,请重新登录"),
+    NO_OPERATION_AUTHORITY(402, "无操作权限"),
+    UNAUTHORIZED(403, "未通过token验证"),
+    NOT_FOUND(404, "不存在"),
+    REQUEST_TIME_OUT(408, "请求超时"),
+
+    SERVER_ERROR(500, "服务器出现异常"),
+    UNKNOWN_ERROR(502, "未知错误");
+
+
+    private Integer respCode;
+    private String respMsg;
+
+    ResultEnum(Integer respCode, String respMsg) {
+        this.respCode = respCode;
+        this.respMsg = respMsg;
+    }
+
+    public Integer getRespCode() {
+        return respCode;
+    }
+
+    public void setRespCode(Integer respCode) {
+        this.respCode = respCode;
+    }
+
+    public String getRespMsg() {
+        return respMsg;
+    }
+
+    public void setRespMsg(String respMsg) {
+        this.respMsg = respMsg;
+    }
+}

+ 30 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/enums/ServerEnum.java

@@ -0,0 +1,30 @@
+package com.example.opc_da.enums;
+
+public enum ServerEnum {
+
+    UNKNOWN("未知"), CLIENT("客户端"), SERVER("服务端");
+
+    private String name;
+
+    private ServerEnum(String name) {
+        this.name = name;
+    }
+
+    public static String getName(String name) {
+        for (ServerEnum c : ServerEnum.values()) {
+            if (c.getName().equalsIgnoreCase(name)) {
+                return c.name;
+            }
+        }
+        return "";
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

+ 39 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/exception/CustomException.java

@@ -0,0 +1,39 @@
+package com.example.opc_da.exception;
+
+import com.example.opc_da.enums.ResultEnum;
+import lombok.Data;
+
+@Data
+public class CustomException extends RuntimeException {
+    private Integer code;
+
+    /**
+     * 通过状态码和错误消息创建异常对象
+     *
+     * @param message
+     * @param code
+     */
+    public CustomException(Integer code, String message) {
+        super(message);
+        this.code = code;
+    }
+
+    /**
+     * 接收枚举类型对象
+     *
+     * @param resultEnum
+     */
+    public CustomException(ResultEnum resultEnum) {
+        super(resultEnum.getRespMsg());
+        this.code = resultEnum.getRespCode();
+    }
+
+    @Override
+    public String toString() {
+        return "CustomException{" +
+                "code=" + code +
+                ", message=" + this.getMessage() +
+                '}';
+    }
+
+}

+ 45 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/exception/GlobalExceptionHandler.java

@@ -0,0 +1,45 @@
+package com.example.opc_da.exception;
+
+import com.example.opc_da.entity.Log;
+import com.example.opc_da.enums.ResultEnum;
+import com.example.opc_da.service.LogService;
+import com.example.opc_da.util.Result;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+@ResponseBody
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+    @Resource
+    private LogService logService;
+
+    /**
+     * 系统异常处理
+     */
+    @ExceptionHandler
+    public Result error(Exception e) {
+        Log log = new Log();
+        e.printStackTrace();
+//        StringWriter stringWriter= new StringWriter();
+//        PrintWriter writer= new PrintWriter(stringWriter);
+//        e.printStackTrace(writer);
+//        StringBuffer buffer= stringWriter.getBuffer();
+        log.setContent(e.getMessage());
+        log.setOperationStatus(500);
+        logService.insertLog(log);
+        return Result.no(ResultEnum.SERVER_ERROR.getRespCode(), e.getMessage());
+    }
+
+    /**
+     * 自定义异常处理
+     */
+    @ExceptionHandler(value = CustomException.class)
+    public Result handle(CustomException e) {
+        e.printStackTrace();
+        return Result.no(e.getCode(), e.getMessage());
+    }
+}

+ 19 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DataModelService.java

@@ -0,0 +1,19 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.DataModel;
+import com.example.opc_da.util.Result;
+
+public interface DataModelService {
+
+    Result addDataModel(DataModel dataModel);
+
+    Result updateDataModel(DataModel dataModel);
+
+    Result getAllDataModel(Integer page, Integer limit);
+
+    Result getDataModelById(Integer id);
+
+    Result delDataModelById(Integer id);
+
+    Result testDataModelById(Integer id, Double dataValue);
+}

+ 23 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DataSourceService.java

@@ -0,0 +1,23 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.DataSource;
+import com.example.opc_da.util.Result;
+
+public interface DataSourceService {
+
+    Result getDataSourceTree();
+
+    Result addDataSource(DataSource dataSource);
+
+    Result testConnect(DataSource dataSource);
+
+    Result getAllDataSource();
+
+    Result getDataSourceById(Integer id);
+
+    Result delDataSourceById(Integer id);
+
+    Result getDataSourceItemTree(Integer id);
+
+    Result getDaAllDriver(DataSource dataSource);
+}

+ 65 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DepartmentService.java

@@ -0,0 +1,65 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Department;
+import com.example.opc_da.util.Result;
+
+import java.util.List;
+
+public interface DepartmentService {
+
+    Result addDepartment(Department department);
+
+    Result updateDepartment(Department department);
+
+    Result getDepartmentListByPage(Integer page, Integer limit, String departmentName, String createTime);
+
+    Result getDepartmentById(Integer id);
+
+    /**
+     * 根据父亲id查孩子部门(一级列表)
+     */
+    Result queryDepartmentByParentId(Integer parentId);
+
+    /**
+     * 查询所有子节点
+     */
+    List<Department> queryDepartmentAllChildren(Integer parentId);
+
+    /**
+     *批量删除
+     */
+    Result isDeleteById(List<Integer> idList);
+
+    /**
+     * 根据部门查部门员工
+     */
+    Result queryUserByDepartmentId(Integer departmentId,Integer page,Integer num);
+
+    /**
+     *根据用户id查询所属部门
+     */
+    Result queryDepartmentByUserId(String userId);
+
+    /**
+     * 批量新增部门用户
+     */
+    Result addUserDepartment(List<String> userIds,Integer departmentId);
+
+    /**
+     * 更新用户所属部门
+     */
+    Result updateUserDepartment(String userId,Integer departmentId);
+
+    /**
+     * 批量删除部门用户
+     */
+    Result deleteUserDepartment( List<String> userIds,Integer departmentId);
+
+    /**
+     * 查询部门详情
+     */
+    Result queryDepartmentDetail(Integer departmentId);
+
+
+
+}

+ 98 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/DictService.java

@@ -0,0 +1,98 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Dict;
+import com.example.opc_da.entity.DictType;
+import com.example.opc_da.util.Result;
+
+import java.util.List;
+
+public interface DictService {
+    /**
+     * 查询所有数据
+     * param page
+     * param num
+     */
+    Result queryAll(Integer page, Integer num);
+
+    /**
+     * 分页查询
+     * param dictKey
+     * param dictValue
+     * param page
+     * param num
+     */
+    Result queryPage(String dictKey,String dictValue,Integer dictTypeId,Integer page,Integer num);
+
+
+    /**
+     * 根据id或者dice_key查询
+     */
+    Result queryByIdOrKey(Integer id,String diceKey,Integer page,Integer num);
+
+    /**
+     * 根据父id查子节点信息 树结构
+     * param parentId
+     */
+    List<Dict> queryByParentId(Integer parentId);
+
+    /**
+     * 新增
+     */
+    Result addDict(Dict dict);
+
+    /**
+     * 根据id修改
+     */
+    Result updataById(Dict dict);
+
+    /**
+     * 根据id删除(批量)
+     */
+    Result deleteByid( List<Integer> ids);
+
+    /**
+     * 根据字典编码查数据(树结构)
+     */
+    List<Dict> queryByDictKey(List<String> dictKeys);
+
+    /**
+     *查询所有字典类型
+     */
+    Result queryType(Integer page,Integer num,String dictKeyType,String description);
+
+
+    /**
+     *根据字典类型查询对应数据(分页)
+     */
+    Result queryByType(String keyType,Integer page,Integer num);
+
+
+    /**
+     * 字典类型新增
+     */
+    Result addDictType(DictType dictType);
+
+    /**
+     * 字典类型修改
+     */
+    Result updataDictType( DictType dictType);
+
+    /**
+     * 根据字典类型id删除字典类型(批量)
+     */
+    Result deleteDictTypeById(List<Integer> ids);
+
+    /**
+     * 查询所有的字典类型
+     */
+    Result queryTypeAll();
+
+    /**
+     *根据字典类型查询对应数据(不分页)
+     */
+    Result queryByTypes(String keyType);
+
+    Result queryDictTypeById(Integer dictTypeId);
+
+    Result queryDictById(Integer dictId);
+}

+ 23 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ItemGroupService.java

@@ -0,0 +1,23 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Item;
+import com.example.opc_da.entity.ItemGroup;
+import com.example.opc_da.util.Result;
+
+public interface ItemGroupService {
+    Result addItemGroup(ItemGroup itemGroup);
+
+    Result getItemGroupById(Integer id);
+
+    Result getAllItemGroup();
+
+    Result delItemGroupById(Integer id);
+
+    Result runItemGroupById(Integer id, Integer runState);
+
+    Result getItemValueById(Integer id);
+
+    Result updateItemDescribe(Item item);
+
+    Result getTableItemGroupById(Integer id);
+}

+ 16 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/LogService.java

@@ -0,0 +1,16 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Log;
+import com.example.opc_da.util.Result;
+
+public interface LogService {
+
+    Result getLogPage(int page, int limit, String serverName, String modelName, String content, String userId, String ipAddress, String methodName, String startDate, String endDate);
+
+    Result insertLog(Log log);
+
+    /**
+     * 删除6个月之前数据
+     */
+    Result logDeleteByTime();
+}

+ 80 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MenuService.java

@@ -0,0 +1,80 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.util.Result;
+
+import java.util.List;
+
+public interface MenuService {
+
+    Result addMenu(Menu menu);
+
+    Result updateMenu(Menu menu);
+
+    Result getMenuListByPage(Integer page, Integer limit, String menuName, String menuUrl, Integer menuStatus);
+
+    Result getMenuById(Integer id);
+
+    Result deleteMenuById(Integer id);
+
+    Result assignPermission(Integer menuId, List<Permission> permissionList);
+
+    Result getPermissionByMenuId(Integer menuId,Integer page,Integer num);
+
+    /**
+     * 查询所有菜单(树形结构)
+     */
+    List<Menu> querySonMenu(Integer parentId);
+
+    Result queryAllMenu();
+
+    /**
+     *取消菜单相应权限(批量)
+     */
+    Result deleteMenuPermission(Integer menuId, List<Permission> permissionList);
+
+    Result assignMenuAndPermission(Menu menu);
+
+    /**
+     * 查询菜单未拥有的权限
+     */
+    Result queryNotPermission(Integer menuId,Integer page,Integer num,String permissionUrl,String permissionName);
+
+    /**
+     * 查询菜单已拥有的权限
+     */
+    Result queryPermission(Integer menuId,Integer page,Integer num);
+
+    /**
+     * 批量新增菜单权限
+     */
+    Result addMenuAndPermission( Menu menu);
+
+    /**
+     *批量取消菜单权限
+     */
+    Result deleteMenuAndPermission( Menu menu);
+
+    /**
+     * 查询菜单所属哪些角色
+     */
+    Result queryRoleListByMenuId(Integer menuId,Integer page,Integer limit);
+
+    /**
+     * 查询菜单详情
+     */
+    Result queryMenuDetail(Integer menuId,Integer page,Integer limit);
+
+    /**
+     *查询停用菜单
+     */
+    Result getMenuStatusListByPage(Long startNum, Long limitNum, String menuName, String menuUrl, Integer parentId);
+
+    /**
+     * 启用停用菜单
+     */
+    Result updateMenuStatue(List<Integer> ids);
+
+
+}

+ 16 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/MessageNoticeService.java

@@ -0,0 +1,16 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.MessageNotice;
+import com.example.opc_da.util.Result;
+
+public interface MessageNoticeService {
+    Result getAllMessageNotice(Integer page, Integer limit);
+
+    Result deleteMessageNoticeById(Integer id);
+
+    Result readMessageNoticeById(Integer id);
+
+    Result addMessageNotice(MessageNotice messageNotice);
+
+    Result getMessageNoticeById(Integer id);
+}

+ 23 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/PermissionService.java

@@ -0,0 +1,23 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Permission;
+import com.example.opc_da.util.Result;
+
+public interface PermissionService {
+
+    Result addPermission(Permission permission);
+
+    Result updatePermission(Permission permission);
+
+    Result getPermissionById(Integer id);
+
+    Result getPermissionListByPage(Integer page, Integer limit, String permissionUrl, String permissionName);
+
+    Result deletePermissionById(Integer id);
+
+    /**
+     * 查询权限所属菜单
+     */
+    Result queryMenuByPermissionId(Integer permissionId,Integer page,Integer limit);
+
+}

+ 16 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/RawDataService.java

@@ -0,0 +1,16 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.ChartDataDto;
+import com.example.opc_da.entity.TableDataDto;
+import com.example.opc_da.util.Result;
+
+import java.util.List;
+
+public interface RawDataService {
+
+    Result getDataByTimeType(List<Integer> itemGroupIdList);
+
+    Result getChartData(ChartDataDto chartDataDto);
+
+    Result getTableData(TableDataDto tableDataDto);
+}

+ 38 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/ReportTableService.java

@@ -0,0 +1,38 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.ReportTable;
+import com.example.opc_da.entity.TableTemplate;
+import com.example.opc_da.util.Result;
+
+public interface ReportTableService {
+
+    Result addTableTemplate(TableTemplate tableTemplate);
+
+    Result getAllTableTemplate(Integer page, Integer limit, String userId);
+
+    Result getTableTemplateById(Integer id);
+
+    Result delTableTemplateById(Integer id);
+
+    Result updateTableTemplate(TableTemplate tableTemplate);
+
+    Result addReportTable(ReportTable reportTable);
+
+    Result updateReportTable(ReportTable reportTable);
+
+    Result getAllReportTable(Integer page, Integer limit, Integer isAutoReport);
+
+    Result getReportTableById(Integer id);
+
+    Result delReportTableById(Integer id);
+
+    Result tableExchangeTypeById(Integer id, Integer isAutoReport, String cron);
+
+    Result queryTableNum();
+
+    Result getAllOkReportTable(Integer page, Integer limit, Integer isAutoReport);
+
+    Result tableAssignUserById(Integer id, Integer userGroupId);
+
+    Result updateTableNameById(Integer id, String reportTableName);
+}

+ 86 - 0
chaunyi_opc/opc_da/src/main/java/com/example/opc_da/service/RoleService.java

@@ -0,0 +1,86 @@
+package com.example.opc_da.service;
+
+import com.example.opc_da.entity.Menu;
+import com.example.opc_da.entity.Role;
+import com.example.opc_da.util.Result;
+
+import java.util.List;
+
+public interface RoleService {
+
+    Result addRole(Role role);
+
+    Result updateRole(Role role);
+
+    Result getRoleListByPage(Integer page, Integer limit, String roleName, String roleCode);
+
+    Result getRoleById(Integer id);
+
+    Result getMenuListByRoleList(List<Role> roleList);
+
+    Result deleteRoleById(Integer roleId);
+
+    Result assignMenu(Integer roleId, List<Menu> menuList);
+
+    Result getMenuTreeByRoleList(List<Integer> roleIdList);
+
+    /**
+     * 批量取消角色对应菜单授权
+     */
+    Result deleteRole(Role role);
+
+    /**
+     * 批量删除角色
+     */
+    Result deleteRoleByIds(List<Integer> roleIdList);
+
+    /**
+     * 为角色分配菜单
+     */
+    Result assignRoleAndMenu(Role role);
+
+    /**
+     * 查询角色已有菜单
+     */
+    Result queryRoleAndMenuId(Integer roleId,Integer page,Integer num);
+
+    /**
+     * 查询角色未有菜单
+     */
+    Result queryNotRoleAndMenu(Integer roleId,Integer page,Integer num);
+
+    /**
+     * 查询角色已有菜单id
+     */
+    Result queryRoleAndMenuListId(Integer roleId);
+
+    /**
+     * 根据用户id查已有菜单
+     */
+    Result queryMenuByUserId(String userId);
+
+    /**
+     * 查询角色未有的用户
+     */
+    Result queryNotUserByRoleId(Integer roleId,Integer page,Integer num,String userName,Integer userType);
+
+    /**
+     * 查询用户已有用户id
+     */
+    Result queryUserIdByRoleId(Integer roleId,String userName,Integer userType);
+
+    /**
+     * 给角色分配用户
+     */
+    Result assignUserAndRole(List<String> userIdList,Integer roleId);
+
+    /**
+     * 查询角色已有权限
+     */
+    Result queryPermissionByRoleId(Integer roleId,Integer page,Integer num);
+
+    /**
+     * 查询角色数量
+     */
+    Result queryRoleNum();
+}

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor