傅行帆 6 年前
父节点
当前提交
9ac1130809
共有 29 个文件被更改,包括 5291 次插入2936 次删除
  1. 25
    0
      CODE/smart-community/hardware-server/.gitignore
  2. 二进制
      CODE/smart-community/hardware-server/.mvn/wrapper/maven-wrapper.jar
  3. 1
    0
      CODE/smart-community/hardware-server/.mvn/wrapper/maven-wrapper.properties
  4. 225
    0
      CODE/smart-community/hardware-server/mvnw
  5. 143
    0
      CODE/smart-community/hardware-server/mvnw.cmd
  6. 245
    0
      CODE/smart-community/hardware-server/pom.xml
  7. 30
    0
      CODE/smart-community/hardware-server/src/main/assembly/assembly.xml
  8. 86
    0
      CODE/smart-community/hardware-server/src/main/assembly/bin/start.sh
  9. 44
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/HardwareApplication.java
  10. 40
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/Swagger2.java
  11. 26
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/controller/HardwareController.java
  12. 66
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java
  13. 23
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/exception/WisdomException.java
  14. 39
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/feign/TaUserFeignService.java
  15. 31
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java
  16. 32
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogAnnotation.java
  17. 43
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogEnums.java
  18. 103
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogFactory.java
  19. 46
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogFileManager.java
  20. 7
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/FSHardwareServiceI.java
  21. 7
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/HkHardwareServiceI.java
  22. 13
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/impl/FSHardwareServiceImpl.java
  23. 13
    0
      CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/impl/HkHardwareServiceImpl.java
  24. 1
    0
      CODE/smart-community/hardware-server/src/main/resources/application.yml
  25. 24
    0
      CODE/smart-community/hardware-server/src/main/resources/bootstrap.yml
  26. 32
    0
      CODE/smart-community/hardware-server/src/main/resources/log4j.properties
  27. 1973
    1468
      文档/MYSQL/smartCommunity.pdb
  28. 1973
    1468
      文档/MYSQL/smartCommunity.pdm
  29. 二进制
      文档/计划/V2.3.0/智慧社区V2.3.2.mpp

+ 25
- 0
CODE/smart-community/hardware-server/.gitignore 查看文件

@@ -0,0 +1,25 @@
1
+/target/
2
+!.mvn/wrapper/maven-wrapper.jar
3
+
4
+### STS ###
5
+.apt_generated
6
+.classpath
7
+.factorypath
8
+.project
9
+.settings
10
+.springBeans
11
+.sts4-cache
12
+
13
+### IntelliJ IDEA ###
14
+.idea
15
+*.iws
16
+*.iml
17
+*.ipr
18
+
19
+### NetBeans ###
20
+/nbproject/private/
21
+/build/
22
+/nbbuild/
23
+/dist/
24
+/nbdist/
25
+/.nb-gradle/

二进制
CODE/smart-community/hardware-server/.mvn/wrapper/maven-wrapper.jar 查看文件


+ 1
- 0
CODE/smart-community/hardware-server/.mvn/wrapper/maven-wrapper.properties 查看文件

@@ -0,0 +1 @@
1
+distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip

+ 225
- 0
CODE/smart-community/hardware-server/mvnw 查看文件

@@ -0,0 +1,225 @@
1
+#!/bin/sh
2
+# ----------------------------------------------------------------------------
3
+# Licensed to the Apache Software Foundation (ASF) under one
4
+# or more contributor license agreements.  See the NOTICE file
5
+# distributed with this work for additional information
6
+# regarding copyright ownership.  The ASF licenses this file
7
+# to you under the Apache License, Version 2.0 (the
8
+# "License"); you may not use this file except in compliance
9
+# with the License.  You may obtain a copy of the License at
10
+#
11
+#    http://www.apache.org/licenses/LICENSE-2.0
12
+#
13
+# Unless required by applicable law or agreed to in writing,
14
+# software distributed under the License is distributed on an
15
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+# KIND, either express or implied.  See the License for the
17
+# specific language governing permissions and limitations
18
+# under the License.
19
+# ----------------------------------------------------------------------------
20
+
21
+# ----------------------------------------------------------------------------
22
+# Maven2 Start Up Batch script
23
+#
24
+# Required ENV vars:
25
+# ------------------
26
+#   JAVA_HOME - location of a JDK home dir
27
+#
28
+# Optional ENV vars
29
+# -----------------
30
+#   M2_HOME - location of maven2's installed home dir
31
+#   MAVEN_OPTS - parameters passed to the Java VM when running Maven
32
+#     e.g. to debug Maven itself, use
33
+#       set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34
+#   MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35
+# ----------------------------------------------------------------------------
36
+
37
+if [ -z "$MAVEN_SKIP_RC" ] ; then
38
+
39
+  if [ -f /etc/mavenrc ] ; then
40
+    . /etc/mavenrc
41
+  fi
42
+
43
+  if [ -f "$HOME/.mavenrc" ] ; then
44
+    . "$HOME/.mavenrc"
45
+  fi
46
+
47
+fi
48
+
49
+# OS specific support.  $var _must_ be set to either true or false.
50
+cygwin=false;
51
+darwin=false;
52
+mingw=false
53
+case "`uname`" in
54
+  CYGWIN*) cygwin=true ;;
55
+  MINGW*) mingw=true;;
56
+  Darwin*) darwin=true
57
+    # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58
+    # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59
+    if [ -z "$JAVA_HOME" ]; then
60
+      if [ -x "/usr/libexec/java_home" ]; then
61
+        export JAVA_HOME="`/usr/libexec/java_home`"
62
+      else
63
+        export JAVA_HOME="/Library/Java/Home"
64
+      fi
65
+    fi
66
+    ;;
67
+esac
68
+
69
+if [ -z "$JAVA_HOME" ] ; then
70
+  if [ -r /etc/gentoo-release ] ; then
71
+    JAVA_HOME=`java-config --jre-home`
72
+  fi
73
+fi
74
+
75
+if [ -z "$M2_HOME" ] ; then
76
+  ## resolve links - $0 may be a link to maven's home
77
+  PRG="$0"
78
+
79
+  # need this for relative symlinks
80
+  while [ -h "$PRG" ] ; do
81
+    ls=`ls -ld "$PRG"`
82
+    link=`expr "$ls" : '.*-> \(.*\)$'`
83
+    if expr "$link" : '/.*' > /dev/null; then
84
+      PRG="$link"
85
+    else
86
+      PRG="`dirname "$PRG"`/$link"
87
+    fi
88
+  done
89
+
90
+  saveddir=`pwd`
91
+
92
+  M2_HOME=`dirname "$PRG"`/..
93
+
94
+  # make it fully qualified
95
+  M2_HOME=`cd "$M2_HOME" && pwd`
96
+
97
+  cd "$saveddir"
98
+  # echo Using m2 at $M2_HOME
99
+fi
100
+
101
+# For Cygwin, ensure paths are in UNIX format before anything is touched
102
+if $cygwin ; then
103
+  [ -n "$M2_HOME" ] &&
104
+    M2_HOME=`cygpath --unix "$M2_HOME"`
105
+  [ -n "$JAVA_HOME" ] &&
106
+    JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107
+  [ -n "$CLASSPATH" ] &&
108
+    CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109
+fi
110
+
111
+# For Migwn, ensure paths are in UNIX format before anything is touched
112
+if $mingw ; then
113
+  [ -n "$M2_HOME" ] &&
114
+    M2_HOME="`(cd "$M2_HOME"; pwd)`"
115
+  [ -n "$JAVA_HOME" ] &&
116
+    JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117
+  # TODO classpath?
118
+fi
119
+
120
+if [ -z "$JAVA_HOME" ]; then
121
+  javaExecutable="`which javac`"
122
+  if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
123
+    # readlink(1) is not available as standard on Solaris 10.
124
+    readLink=`which readlink`
125
+    if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
126
+      if $darwin ; then
127
+        javaHome="`dirname \"$javaExecutable\"`"
128
+        javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
129
+      else
130
+        javaExecutable="`readlink -f \"$javaExecutable\"`"
131
+      fi
132
+      javaHome="`dirname \"$javaExecutable\"`"
133
+      javaHome=`expr "$javaHome" : '\(.*\)/bin'`
134
+      JAVA_HOME="$javaHome"
135
+      export JAVA_HOME
136
+    fi
137
+  fi
138
+fi
139
+
140
+if [ -z "$JAVACMD" ] ; then
141
+  if [ -n "$JAVA_HOME"  ] ; then
142
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
143
+      # IBM's JDK on AIX uses strange locations for the executables
144
+      JAVACMD="$JAVA_HOME/jre/sh/java"
145
+    else
146
+      JAVACMD="$JAVA_HOME/bin/java"
147
+    fi
148
+  else
149
+    JAVACMD="`which java`"
150
+  fi
151
+fi
152
+
153
+if [ ! -x "$JAVACMD" ] ; then
154
+  echo "Error: JAVA_HOME is not defined correctly." >&2
155
+  echo "  We cannot execute $JAVACMD" >&2
156
+  exit 1
157
+fi
158
+
159
+if [ -z "$JAVA_HOME" ] ; then
160
+  echo "Warning: JAVA_HOME environment variable is not set."
161
+fi
162
+
163
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
164
+
165
+# traverses directory structure from process work directory to filesystem root
166
+# first directory with .mvn subdirectory is considered project base directory
167
+find_maven_basedir() {
168
+
169
+  if [ -z "$1" ]
170
+  then
171
+    echo "Path not specified to find_maven_basedir"
172
+    return 1
173
+  fi
174
+
175
+  basedir="$1"
176
+  wdir="$1"
177
+  while [ "$wdir" != '/' ] ; do
178
+    if [ -d "$wdir"/.mvn ] ; then
179
+      basedir=$wdir
180
+      break
181
+    fi
182
+    # workaround for JBEAP-8937 (on Solaris 10/Sparc)
183
+    if [ -d "${wdir}" ]; then
184
+      wdir=`cd "$wdir/.."; pwd`
185
+    fi
186
+    # end of workaround
187
+  done
188
+  echo "${basedir}"
189
+}
190
+
191
+# concatenates all lines of a file
192
+concat_lines() {
193
+  if [ -f "$1" ]; then
194
+    echo "$(tr -s '\n' ' ' < "$1")"
195
+  fi
196
+}
197
+
198
+BASE_DIR=`find_maven_basedir "$(pwd)"`
199
+if [ -z "$BASE_DIR" ]; then
200
+  exit 1;
201
+fi
202
+
203
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
204
+echo $MAVEN_PROJECTBASEDIR
205
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
206
+
207
+# For Cygwin, switch paths to Windows format before running java
208
+if $cygwin; then
209
+  [ -n "$M2_HOME" ] &&
210
+    M2_HOME=`cygpath --path --windows "$M2_HOME"`
211
+  [ -n "$JAVA_HOME" ] &&
212
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
213
+  [ -n "$CLASSPATH" ] &&
214
+    CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
215
+  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
216
+    MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
217
+fi
218
+
219
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
220
+
221
+exec "$JAVACMD" \
222
+  $MAVEN_OPTS \
223
+  -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
224
+  "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
225
+  ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

+ 143
- 0
CODE/smart-community/hardware-server/mvnw.cmd 查看文件

@@ -0,0 +1,143 @@
1
+@REM ----------------------------------------------------------------------------
2
+@REM Licensed to the Apache Software Foundation (ASF) under one
3
+@REM or more contributor license agreements.  See the NOTICE file
4
+@REM distributed with this work for additional information
5
+@REM regarding copyright ownership.  The ASF licenses this file
6
+@REM to you under the Apache License, Version 2.0 (the
7
+@REM "License"); you may not use this file except in compliance
8
+@REM with the License.  You may obtain a copy of the License at
9
+@REM
10
+@REM    http://www.apache.org/licenses/LICENSE-2.0
11
+@REM
12
+@REM Unless required by applicable law or agreed to in writing,
13
+@REM software distributed under the License is distributed on an
14
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+@REM KIND, either express or implied.  See the License for the
16
+@REM specific language governing permissions and limitations
17
+@REM under the License.
18
+@REM ----------------------------------------------------------------------------
19
+
20
+@REM ----------------------------------------------------------------------------
21
+@REM Maven2 Start Up Batch script
22
+@REM
23
+@REM Required ENV vars:
24
+@REM JAVA_HOME - location of a JDK home dir
25
+@REM
26
+@REM Optional ENV vars
27
+@REM M2_HOME - location of maven2's installed home dir
28
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31
+@REM     e.g. to debug Maven itself, use
32
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34
+@REM ----------------------------------------------------------------------------
35
+
36
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37
+@echo off
38
+@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
39
+@if "%MAVEN_BATCH_ECHO%" == "on"  echo %MAVEN_BATCH_ECHO%
40
+
41
+@REM set %HOME% to equivalent of $HOME
42
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
43
+
44
+@REM Execute a user defined script before this one
45
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
46
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
47
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
48
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
49
+:skipRcPre
50
+
51
+@setlocal
52
+
53
+set ERROR_CODE=0
54
+
55
+@REM To isolate internal variables from possible post scripts, we use another setlocal
56
+@setlocal
57
+
58
+@REM ==== START VALIDATION ====
59
+if not "%JAVA_HOME%" == "" goto OkJHome
60
+
61
+echo.
62
+echo Error: JAVA_HOME not found in your environment. >&2
63
+echo Please set the JAVA_HOME variable in your environment to match the >&2
64
+echo location of your Java installation. >&2
65
+echo.
66
+goto error
67
+
68
+:OkJHome
69
+if exist "%JAVA_HOME%\bin\java.exe" goto init
70
+
71
+echo.
72
+echo Error: JAVA_HOME is set to an invalid directory. >&2
73
+echo JAVA_HOME = "%JAVA_HOME%" >&2
74
+echo Please set the JAVA_HOME variable in your environment to match the >&2
75
+echo location of your Java installation. >&2
76
+echo.
77
+goto error
78
+
79
+@REM ==== END VALIDATION ====
80
+
81
+:init
82
+
83
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
84
+@REM Fallback to current working directory if not found.
85
+
86
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
87
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
88
+
89
+set EXEC_DIR=%CD%
90
+set WDIR=%EXEC_DIR%
91
+:findBaseDir
92
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
93
+cd ..
94
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
95
+set WDIR=%CD%
96
+goto findBaseDir
97
+
98
+:baseDirFound
99
+set MAVEN_PROJECTBASEDIR=%WDIR%
100
+cd "%EXEC_DIR%"
101
+goto endDetectBaseDir
102
+
103
+:baseDirNotFound
104
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
105
+cd "%EXEC_DIR%"
106
+
107
+:endDetectBaseDir
108
+
109
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
110
+
111
+@setlocal EnableExtensions EnableDelayedExpansion
112
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
113
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
114
+
115
+:endReadAdditionalConfig
116
+
117
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
118
+
119
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
120
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
121
+
122
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
123
+if ERRORLEVEL 1 goto error
124
+goto end
125
+
126
+:error
127
+set ERROR_CODE=1
128
+
129
+:end
130
+@endlocal & set ERROR_CODE=%ERROR_CODE%
131
+
132
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
133
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
134
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
135
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
136
+:skipRcPost
137
+
138
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
139
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
140
+
141
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
142
+
143
+exit /B %ERROR_CODE%

+ 245
- 0
CODE/smart-community/hardware-server/pom.xml 查看文件

@@ -0,0 +1,245 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
+	<modelVersion>4.0.0</modelVersion>
5
+
6
+	<groupId>com.community</groupId>
7
+	<artifactId>hardware-server</artifactId>
8
+	<version>0.0.1</version>
9
+	<packaging>jar</packaging>
10
+
11
+	<name>hardware-server</name>
12
+	<description>hardware-server</description>
13
+
14
+	<parent>
15
+		<groupId>com.community</groupId>
16
+		<artifactId>smart-community</artifactId>
17
+		<version>0.0.1</version>
18
+	</parent>
19
+
20
+	<properties>
21
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
23
+		<java.version>1.8</java.version>
24
+		<spring-cloud.version>Finchley.SR1</spring-cloud.version>
25
+	</properties>
26
+
27
+	<dependencies>
28
+
29
+		<dependency>
30
+			<groupId>com.google.zxing</groupId>
31
+			<artifactId>javase</artifactId>
32
+			<version>3.0.0</version>
33
+		</dependency>
34
+
35
+		<dependency>
36
+			<groupId>junit</groupId>
37
+			<artifactId>junit</artifactId>
38
+			<version>4.10</version>
39
+		</dependency>
40
+
41
+		<dependency>
42
+			<groupId>com.alibaba</groupId>
43
+			<artifactId>fastjson</artifactId>
44
+			<version>1.1.29</version>
45
+		</dependency>
46
+
47
+		<dependency>
48
+			<groupId>org.springframework.boot</groupId>
49
+			<artifactId>spring-boot-starter-web</artifactId>
50
+		</dependency>
51
+
52
+		<dependency>
53
+			<groupId>org.springframework.cloud</groupId>
54
+			<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
55
+		</dependency>
56
+
57
+		<dependency>
58
+			<groupId>org.springframework.cloud</groupId>
59
+			<artifactId>spring-cloud-starter-openfeign</artifactId>
60
+		</dependency>
61
+
62
+		<dependency>
63
+			<groupId>io.springfox</groupId>
64
+			<artifactId>springfox-swagger2</artifactId>
65
+			<version>2.7.0</version>
66
+		</dependency>
67
+
68
+		<dependency>
69
+			<groupId>io.springfox</groupId>
70
+			<artifactId>springfox-swagger-ui</artifactId>
71
+			<version>2.7.0</version>
72
+		</dependency>
73
+
74
+		<dependency>
75
+			<groupId>org.springframework.cloud</groupId>
76
+			<artifactId>spring-cloud-starter-config</artifactId>
77
+		</dependency>
78
+
79
+		<dependency>
80
+			<groupId>org.springframework.boot</groupId>
81
+			<artifactId>spring-boot-starter-actuator</artifactId>
82
+		</dependency>
83
+
84
+		<dependency>
85
+			<groupId>mysql</groupId>
86
+			<artifactId>mysql-connector-java</artifactId>
87
+			<scope>runtime</scope>
88
+		</dependency>
89
+
90
+		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
91
+		<dependency>
92
+			<groupId>org.projectlombok</groupId>
93
+			<artifactId>lombok</artifactId>
94
+			<version>1.18.2</version>
95
+			<scope>provided</scope>
96
+		</dependency>
97
+
98
+		<dependency>
99
+			<groupId>org.springframework.boot</groupId>
100
+			<artifactId>spring-boot-starter-test</artifactId>
101
+			<scope>test</scope>
102
+		</dependency>
103
+
104
+		<dependency>
105
+			<groupId>com.community</groupId>
106
+			<artifactId>community-common</artifactId>
107
+			<version>0.0.1</version>
108
+			<scope>compile</scope>
109
+		</dependency>
110
+
111
+		<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
112
+		<dependency>
113
+			<groupId>org.projectlombok</groupId>
114
+			<artifactId>lombok</artifactId>
115
+			<version>1.18.2</version>
116
+			<scope>provided</scope>
117
+		</dependency>
118
+
119
+		<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
120
+		<dependency>
121
+			<groupId>com.google.guava</groupId>
122
+			<artifactId>guava</artifactId>
123
+			<version>26.0-jre</version>
124
+		</dependency>
125
+
126
+		<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
127
+		<dependency>
128
+			<groupId>org.apache.commons</groupId>
129
+			<artifactId>commons-lang3</artifactId>
130
+			<version>3.8.1</version>
131
+		</dependency>
132
+
133
+		<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
134
+		<dependency>
135
+			<groupId>commons-lang</groupId>
136
+			<artifactId>commons-lang</artifactId>
137
+			<version>2.6</version>
138
+		</dependency>
139
+
140
+		<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
141
+		<dependency>
142
+			<groupId>com.squareup.okhttp3</groupId>
143
+			<artifactId>okhttp</artifactId>
144
+			<version>3.11.0</version>
145
+		</dependency>
146
+        <dependency>
147
+            <groupId>org.springframework</groupId>
148
+            <artifactId>spring-test</artifactId>
149
+            <version>5.1.3.RELEASE</version>
150
+            <scope>compile</scope>
151
+        </dependency>
152
+
153
+		<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
154
+		<dependency>
155
+			<groupId>com.alibaba</groupId>
156
+			<artifactId>easyexcel</artifactId>
157
+			<version>1.1.2-beat1</version>
158
+		</dependency>
159
+        <dependency>
160
+            <groupId>com.alibaba</groupId>
161
+            <artifactId>fastjson</artifactId>
162
+            <version>1.2.56</version>
163
+            <scope>compile</scope>
164
+        </dependency>
165
+
166
+		<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
167
+		<dependency>
168
+			<groupId>com.alibaba</groupId>
169
+			<artifactId>fastjson</artifactId>
170
+			<version>1.2.56</version>
171
+		</dependency>
172
+        <dependency>
173
+            <groupId>com.google.guava</groupId>
174
+            <artifactId>guava</artifactId>
175
+            <version>27.1-jre</version>
176
+            <scope>compile</scope>
177
+        </dependency>
178
+
179
+		<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
180
+		<dependency>
181
+			<groupId>commons-codec</groupId>
182
+			<artifactId>commons-codec</artifactId>
183
+			<version>1.10</version>
184
+		</dependency>
185
+
186
+		<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
187
+		<dependency>
188
+			<groupId>org.springframework.boot</groupId>
189
+			<artifactId>spring-boot-starter-aop</artifactId>
190
+			<version>2.0.4.RELEASE</version>
191
+		</dependency>
192
+
193
+
194
+	</dependencies>
195
+
196
+	<dependencyManagement>
197
+		<dependencies>
198
+			<dependency>
199
+				<groupId>org.springframework.cloud</groupId>
200
+				<artifactId>spring-cloud-dependencies</artifactId>
201
+				<version>${spring-cloud.version}</version>
202
+				<type>pom</type>
203
+				<scope>import</scope>
204
+			</dependency>
205
+		</dependencies>
206
+	</dependencyManagement>
207
+
208
+	<build>
209
+		<plugins>
210
+			<plugin>
211
+				<groupId>org.springframework.boot</groupId>
212
+				<artifactId>spring-boot-maven-plugin</artifactId>
213
+			</plugin>
214
+			<!--服务化打包工具-->
215
+			<plugin>
216
+				<groupId>org.apache.maven.plugins</groupId>
217
+				<artifactId>maven-assembly-plugin</artifactId>
218
+				<configuration>
219
+					<descriptors>
220
+						<descriptor>src/main/assembly/assembly.xml</descriptor>
221
+					</descriptors>
222
+				</configuration>
223
+				<executions>
224
+					<execution>
225
+						<id>make-assembly</id>
226
+						<phase>package</phase>
227
+						<goals>
228
+							<goal>single</goal>
229
+						</goals>
230
+					</execution>
231
+				</executions>
232
+			</plugin>
233
+			<plugin>
234
+				<groupId>org.apache.maven.plugins</groupId>
235
+				<artifactId>maven-surefire-plugin</artifactId>
236
+				<version>2.4.2</version>
237
+				<configuration>
238
+					<skipTests>true</skipTests>
239
+				</configuration>
240
+			</plugin>
241
+		</plugins>
242
+	</build>
243
+
244
+
245
+</project>

+ 30
- 0
CODE/smart-community/hardware-server/src/main/assembly/assembly.xml 查看文件

@@ -0,0 +1,30 @@
1
+<assembly>
2
+    <id>assembly</id>
3
+    <formats>
4
+        <format>tar.gz</format>
5
+    </formats>
6
+    <includeBaseDirectory>true</includeBaseDirectory>
7
+    <fileSets>
8
+        <fileSet>
9
+            <directory>src/main/assembly/bin</directory>
10
+            <outputDirectory>bin</outputDirectory>
11
+            <fileMode>0755</fileMode>
12
+        </fileSet>
13
+        <fileSet>
14
+            <directory>target/classes</directory>
15
+            <outputDirectory>conf</outputDirectory>
16
+            <includes>
17
+                <include>META-INF/**</include>
18
+                <include>*.yml</include>
19
+                <include>conf/**</include>
20
+            </includes>
21
+            <fileMode>0755</fileMode>
22
+        </fileSet>
23
+    </fileSets>
24
+    <dependencySets>
25
+        <dependencySet>
26
+            <useProjectArtifact>true</useProjectArtifact>
27
+            <outputDirectory>lib</outputDirectory>
28
+        </dependencySet>
29
+    </dependencySets>
30
+</assembly>

+ 86
- 0
CODE/smart-community/hardware-server/src/main/assembly/bin/start.sh 查看文件

@@ -0,0 +1,86 @@
1
+#!/bin/bash
2
+
3
+SERVER_NAME='hardware-server'
4
+# jar名称
5
+JAR_NAME='hardware-server-0.0.1.jar'
6
+cd `dirname $0`
7
+BIN_DIR=`pwd`
8
+cd ..
9
+DEPLOY_DIR=`pwd`
10
+CONF_DIR=$DEPLOY_DIR/conf
11
+# 获取应用的端口号
12
+SERVER_PORT=`sed -nr '/port: [0-9]+/ s/.*port: +([0-9]+).*/\1/p' conf/bootstrap.yml`
13
+
14
+PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk '{print $2}'`
15
+if [ "$1" = "status" ]; then
16
+    if [ -n "$PIDS" ]; then
17
+        echo "The $SERVER_NAME is running...!"
18
+        echo "PID: $PIDS"
19
+        exit 0
20
+    else
21
+        echo "The $SERVER_NAME is stopped"
22
+        exit 0
23
+    fi
24
+fi
25
+
26
+if [ -n "$PIDS" ]; then
27
+    echo "ERROR: The $SERVER_NAME already started!"
28
+    echo "PID: $PIDS"
29
+    exit 1
30
+fi
31
+
32
+if [ -n "$SERVER_PORT" ]; then
33
+    SERVER_PORT_COUNT=`netstat -tln | grep $SERVER_PORT | wc -l`
34
+    if [ $SERVER_PORT_COUNT -gt 0 ]; then
35
+        echo "ERROR: The $SERVER_NAME port $SERVER_PORT already used!"
36
+        exit 1
37
+    fi
38
+fi
39
+
40
+LOGS_DIR=$DEPLOY_DIR/logs
41
+if [ ! -d $LOGS_DIR ]; then
42
+    mkdir $LOGS_DIR
43
+fi
44
+STDOUT_FILE=$LOGS_DIR/stdout.log
45
+
46
+JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
47
+JAVA_DEBUG_OPTS=""
48
+if [ "$1" = "debug" ]; then
49
+    JAVA_DEBUG_OPTS=" -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n "
50
+fi
51
+
52
+JAVA_JMX_OPTS=""
53
+if [ "$1" = "jmx" ]; then
54
+    JAVA_JMX_OPTS=" -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false "
55
+fi
56
+
57
+JAVA_MEM_OPTS=""
58
+BITS=`java -version 2>&1 | grep -i 64-bit`
59
+if [ -n "$BITS" ]; then
60
+    JAVA_MEM_OPTS=" -server -Xmx512m -Xms512m -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
61
+else
62
+    JAVA_MEM_OPTS=" -server -Xms512m -Xmx512m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
63
+fi
64
+
65
+CONFIG_FILES=" -Dspring.config.location=$CONF_DIR/ "
66
+echo -e "Starting the $SERVER_NAME ..."
67
+nohup java $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPTS $JAVA_JMX_OPTS $CONFIG_FILES -jar $DEPLOY_DIR/lib/$JAR_NAME > $STDOUT_FILE 2>&1 &
68
+
69
+COUNT=0
70
+while [ $COUNT -lt 1 ]; do
71
+    echo -e ".\c"
72
+    sleep 1
73
+    if [ -n "$SERVER_PORT" ]; then
74
+        COUNT=`netstat -an | grep $SERVER_PORT | wc -l`
75
+    else
76
+        COUNT=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}' | wc -l`
77
+    fi
78
+    if [ $COUNT -gt 0 ]; then
79
+        break
80
+    fi
81
+done
82
+
83
+echo "OK!"
84
+PIDS=`ps -f | grep java | grep "$DEPLOY_DIR" | awk '{print $2}'`
85
+echo "PID: $PIDS"
86
+echo "STDOUT: $STDOUT_FILE"

+ 44
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/HardwareApplication.java 查看文件

@@ -0,0 +1,44 @@
1
+package com.community.huiju;
2
+
3
+import com.alibaba.fastjson.serializer.SerializerFeature;
4
+import com.alibaba.fastjson.support.config.FastJsonConfig;
5
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
6
+
7
+import org.springframework.boot.SpringApplication;
8
+import org.springframework.boot.autoconfigure.SpringBootApplication;
9
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
10
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
11
+import org.springframework.cloud.openfeign.EnableFeignClients;
12
+import org.springframework.context.annotation.Bean;
13
+
14
+
15
+@EnableDiscoveryClient
16
+@SpringBootApplication
17
+@EnableFeignClients
18
+public class HardwareApplication {
19
+
20
+	public static void main(String[] args) {
21
+		SpringApplication.run(HardwareApplication.class, args);
22
+	}
23
+
24
+	@Bean
25
+	public HttpMessageConverters fastJsonConfigure(){
26
+		FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
27
+		FastJsonConfig fastJsonConfig = new FastJsonConfig();
28
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat,SerializerFeature.DisableCircularReferenceDetect,SerializerFeature.WriteMapNullValue);
29
+		//日期格式化
30
+		//fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
31
+		converter.setFastJsonConfig(fastJsonConfig);
32
+		return new HttpMessageConverters(converter);
33
+	}
34
+
35
+	/**
36
+	 * 文件上传临时路径
37
+	 */
38
+	//@Bean
39
+	//public MultipartConfigElement multipartConfigElement() {
40
+	//	MultipartConfigFactory factory = new MultipartConfigFactory();
41
+	//	factory.setLocation("/tmp/smart-community");
42
+	//	return factory.createMultipartConfig();
43
+	//}
44
+}

+ 40
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/Swagger2.java 查看文件

@@ -0,0 +1,40 @@
1
+package com.community.huiju;
2
+
3
+import org.springframework.context.annotation.Bean;
4
+import org.springframework.context.annotation.Configuration;
5
+import springfox.documentation.builders.ApiInfoBuilder;
6
+import springfox.documentation.builders.PathSelectors;
7
+import springfox.documentation.builders.RequestHandlerSelectors;
8
+import springfox.documentation.service.ApiInfo;
9
+import springfox.documentation.service.Contact;
10
+import springfox.documentation.spi.DocumentationType;
11
+import springfox.documentation.spring.web.plugins.Docket;
12
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
13
+
14
+/**
15
+ * @author FXF
16
+ * @date 2018-09-27
17
+ */
18
+@Configuration
19
+@EnableSwagger2
20
+public class Swagger2 {
21
+    @Bean
22
+    public Docket docket(){
23
+        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
24
+                .apis(RequestHandlerSelectors.basePackage("com.community.huiju.controller"))
25
+                .paths(PathSelectors.any()).build();
26
+    }
27
+    //构建api文档的详细信息函数
28
+    private ApiInfo apiInfo(){
29
+        return new ApiInfoBuilder()
30
+                //页面标题
31
+                .title("物业端 的 RESTful API")
32
+                //创建人
33
+                .contact(new Contact("fuxingfan","","fuxingfan@dingtalk.com"))
34
+                //版本号
35
+                .version("1.0")
36
+                //描述
37
+                .description("API 描述")
38
+                .build();
39
+    }
40
+}

+ 26
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/controller/HardwareController.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.huiju.service.FSHardwareServiceI;
4
+import com.community.huiju.service.HkHardwareServiceI;
5
+import io.swagger.annotations.Api;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.cloud.context.config.annotation.RefreshScope;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RestController;
10
+
11
+/**
12
+ * @author FXF
13
+ * @date 2019-07-03
14
+ */
15
+@RestController
16
+@RequestMapping("/")
17
+@RefreshScope
18
+@Api(value = "硬件服务 API", description = "硬件服务 API")
19
+public class HardwareController {
20
+	
21
+	@Autowired
22
+	private FSHardwareServiceI fsHardwareService;
23
+	
24
+	@Autowired
25
+	private HkHardwareServiceI hkHardwareService;
26
+}

+ 66
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/exception/ExceptionHandleAdice.java 查看文件

@@ -0,0 +1,66 @@
1
+package com.community.huiju.exception;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.fushi.error.FuShiException;
5
+import com.community.commom.mode.ResponseBean;
6
+import lombok.extern.slf4j.Slf4j;
7
+import org.springframework.validation.ObjectError;
8
+import org.springframework.web.bind.MethodArgumentNotValidException;
9
+import org.springframework.web.bind.annotation.ControllerAdvice;
10
+import org.springframework.web.bind.annotation.ExceptionHandler;
11
+import org.springframework.web.bind.annotation.ResponseBody;
12
+
13
+import java.util.List;
14
+
15
+/**
16
+ * 统一异常出口
17
+ * @author weiximei
18
+ */
19
+@ControllerAdvice
20
+@ResponseBody
21
+@Slf4j
22
+public class ExceptionHandleAdice {
23
+
24
+
25
+    @ExceptionHandler(Exception.class)
26
+    public ResponseBean handleException(Exception e){
27
+        log.error(e.getMessage(),e);
28
+        ResponseBean response = new ResponseBean();
29
+        response.addError(Constant.REQUEST_ERROR,"设备还未联网,系统维护中");
30
+        return response;
31
+    }
32
+
33
+
34
+    @ExceptionHandler(WisdomException.class)
35
+    public ResponseBean handleException(WisdomException e) {
36
+        log.error(e.getMessage(),e);
37
+        ResponseBean response = new ResponseBean();
38
+        response.addError(e.getMessage());
39
+        return response;
40
+    }
41
+
42
+
43
+    @ExceptionHandler(MethodArgumentNotValidException.class)
44
+    public ResponseBean handlelllewgalParamException(MethodArgumentNotValidException e){
45
+        ResponseBean response = new ResponseBean();
46
+
47
+        List<ObjectError> errors  =e.getBindingResult().getAllErrors();
48
+        String message = "参数不合法";
49
+        if (errors.size() >0) {
50
+            message = errors.get(0).getDefaultMessage();
51
+        }
52
+
53
+        response.addError(message);
54
+
55
+        return response;
56
+    }
57
+
58
+    @ExceptionHandler(FuShiException.class)
59
+    public ResponseBean handleException(FuShiException e) {
60
+        log.error(e.getMessage(),e);
61
+        ResponseBean response = new ResponseBean();
62
+        response.addError(e.getMessage());
63
+        return response;
64
+    }
65
+
66
+}

+ 23
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/exception/WisdomException.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.community.huiju.exception;
2
+
3
+
4
+/**
5
+ * @author weiximei
6
+ */
7
+public class WisdomException extends RuntimeException {
8
+
9
+
10
+    public WisdomException(String msg, Throwable t) {
11
+        super(msg, t);
12
+    }
13
+
14
+    public WisdomException(String msg) {
15
+        super(msg);
16
+    }
17
+
18
+    public WisdomException(String msg, Object ...args) {
19
+        this(String.format(msg, args));
20
+    }
21
+
22
+
23
+}

+ 39
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/feign/TaUserFeignService.java 查看文件

@@ -0,0 +1,39 @@
1
+package com.community.huiju.feign;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.feign.impl.TaUserFeignFallBack;
5
+import org.springframework.cloud.openfeign.FeignClient;
6
+import org.springframework.web.bind.annotation.*;
7
+
8
+@FeignClient(value = "app-api", fallback = TaUserFeignFallBack.class)
9
+public interface TaUserFeignService {
10
+
11
+    /**
12
+     * 注册
13
+     *      JSON类型
14
+     *      userName用户姓名;idCard身份证;gender性别(1:男  2:女);loginName手机号;code验证码
15
+     *
16
+     * @param parameter
17
+     * @return
18
+     */
19
+    @RequestMapping(value = "/user/register",method = RequestMethod.POST)
20
+    ResponseBean register(@RequestBody String parameter);
21
+
22
+    /**
23
+     * 推送海康人员添加
24
+     * @param appUserId
25
+     * @return
26
+     */
27
+    @RequestMapping(value = "/pushHKPerson/{appUserId}", method = RequestMethod.POST)
28
+    ResponseBean pushHKPerson(@PathVariable("appUserId") Integer appUserId, @RequestParam("userVerifyId") Integer userVerifyId);
29
+
30
+    /**
31
+     * 异动下载门禁权限
32
+     * @return
33
+     */
34
+    @RequestMapping(value = "/downloadAuthorityByDeviceUuids", method = RequestMethod.POST)
35
+    ResponseBean downloadAuthorityByDeviceUuids();
36
+
37
+
38
+
39
+}

+ 31
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java 查看文件

@@ -0,0 +1,31 @@
1
+package com.community.huiju.feign.impl;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.feign.TaUserFeignService;
5
+import lombok.extern.slf4j.Slf4j;
6
+
7
+@Slf4j
8
+public class TaUserFeignFallBack implements TaUserFeignService {
9
+
10
+    @Override
11
+    public ResponseBean register(String parameter) {
12
+        return back();
13
+    }
14
+
15
+    @Override
16
+    public ResponseBean pushHKPerson(Integer appUserId,Integer userVerifyId) {
17
+        return back();
18
+    }
19
+
20
+    @Override
21
+    public ResponseBean downloadAuthorityByDeviceUuids() {
22
+        return back();
23
+    }
24
+
25
+    private ResponseBean back() {
26
+        log.error("app-api 远端服务请求失败!");
27
+        ResponseBean responseBean = new ResponseBean();
28
+        responseBean.addError("app-api 远端服务请求失败!");
29
+        return responseBean;
30
+    }
31
+}

+ 32
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogAnnotation.java 查看文件

@@ -0,0 +1,32 @@
1
+package com.community.huiju.log;
2
+
3
+import java.lang.annotation.*;
4
+
5
+/**
6
+ * 日志注解
7
+ * @author weiximei
8
+ */
9
+@Retention(RetentionPolicy.RUNTIME) // 在运行时使用
10
+@Target({ ElementType.METHOD }) // 在方法上使用
11
+@Documented
12
+public @interface LogAnnotation {
13
+
14
+    /**
15
+     * 日志类型
16
+     * @return
17
+     */
18
+    LogEnums value() default LogEnums.NOT;
19
+
20
+    /**
21
+     * 是否记录
22
+     * @return
23
+     */
24
+    boolean record() default true;
25
+
26
+    /**
27
+     * 别名, 作为注释用
28
+     * @return
29
+     */
30
+    String alias() default "";
31
+
32
+}

+ 43
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogEnums.java 查看文件

@@ -0,0 +1,43 @@
1
+package com.community.huiju.log;
2
+
3
+/**
4
+ * 日志类型
5
+ *
6
+ * @author weiximei
7
+ */
8
+public enum LogEnums {
9
+
10
+    NOT(8000, "无类型"),
11
+
12
+    DA_SU(8001, "大苏")
13
+
14
+    ;
15
+
16
+    private Integer code;
17
+
18
+    private String value;
19
+
20
+
21
+    LogEnums(Integer code, String value) {
22
+        this.code = code;
23
+        this.value = value;
24
+    }
25
+
26
+    public Integer getCode() {
27
+        return code;
28
+    }
29
+
30
+    public void setCode(Integer code) {
31
+        this.code = code;
32
+    }
33
+
34
+    public String getValue() {
35
+        return value;
36
+    }
37
+
38
+    public void setValue(String value) {
39
+        this.value = value;
40
+    }
41
+
42
+
43
+}

+ 103
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogFactory.java 查看文件

@@ -0,0 +1,103 @@
1
+package com.community.huiju.log;
2
+
3
+import java.io.File;
4
+import java.io.FileNotFoundException;
5
+import java.io.IOException;
6
+import java.io.RandomAccessFile;
7
+import java.nio.ByteBuffer;
8
+import java.nio.channels.FileChannel;
9
+import java.nio.channels.FileLock;
10
+import java.time.LocalDate;
11
+import java.time.LocalDateTime;
12
+import java.time.format.DateTimeFormatter;
13
+import java.util.TimerTask;
14
+
15
+/**
16
+ * 日志工厂
17
+ * @author weiximei
18
+ */
19
+public class LogFactory {
20
+
21
+    public static File getFile() {
22
+        LocalDate localDate = LocalDate.now();
23
+        String pathMkdir = "";
24
+
25
+        String os = System.getProperty("os.name");
26
+        if(os.toLowerCase().startsWith("win")){
27
+            pathMkdir = "E:" + File.separator + "log" + File.separator + "property-log" + File.separator + localDate.getYear() + "-" + localDate.getMonthValue() + "-" + localDate.getDayOfMonth();
28
+        } else {
29
+            pathMkdir = "/home/fxf/smart-community" + File.separator + "log" + File.separator + "property-log" + File.separator + localDate.getYear() + "-" + localDate.getMonthValue() + "-" + localDate.getDayOfMonth();
30
+        }
31
+
32
+        File file = new File(pathMkdir);
33
+        if (!file.exists()) {
34
+            file.mkdirs();
35
+        }
36
+        file = new File(pathMkdir + File.separator + "app-log.log");
37
+
38
+        return file;
39
+    }
40
+
41
+    /**
42
+     * 记录请求参数和返回值
43
+     * @param parameters
44
+     * @param returnValue
45
+     * @return
46
+     */
47
+    public static TimerTask parametersAndReturn(String parameters, String returnValue){
48
+        return new TimerTask() {
49
+            @Override
50
+            public void run() {
51
+
52
+                RandomAccessFile accessFile = null;
53
+                FileChannel fileChannel = null;
54
+                FileLock fileLock = null;
55
+                try {
56
+                    // 获取这个文件的读和写的权限
57
+                    accessFile = new RandomAccessFile(getFile(), "rw");
58
+                    // 文件通道
59
+                    fileChannel = accessFile.getChannel();
60
+                    fileLock = null;
61
+                    while (true) {
62
+                        try {
63
+                            // 获取锁,如果失败,继续尝试
64
+                            fileLock = fileChannel.tryLock();
65
+                            break;
66
+                        } catch (Exception e) {
67
+                            Thread.sleep(100);
68
+                        }
69
+                    }
70
+
71
+                    // 获取当前这个文件的大小
72
+                    long length = accessFile.length();
73
+                    // 设置写入的指针, 设置到这个文件的末尾
74
+                    accessFile.seek(length);
75
+                    // 开始写入文件
76
+                    LocalDateTime localDateTime = LocalDateTime.now();
77
+                    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
78
+                    String str = dateTimeFormatter.format(localDateTime) + " === " + Thread.currentThread().getName() + "  : " + parameters + "\n";
79
+                    fileChannel.write(ByteBuffer.wrap(str.getBytes()));
80
+                    str = dateTimeFormatter.format(localDateTime) + " === " + Thread.currentThread().getName() + "  : " + returnValue + "\n";
81
+                    fileChannel.write(ByteBuffer.wrap(str.getBytes()));
82
+
83
+                } catch (Exception e) {
84
+                    e.printStackTrace();
85
+                } finally {
86
+                    if (fileLock != null && fileChannel != null && accessFile != null) {
87
+                        // 释放锁
88
+                        try {
89
+                            fileLock.release();
90
+                            fileChannel.close();
91
+                            accessFile.close();
92
+                        } catch (Exception e) {
93
+                            e.printStackTrace();
94
+                        }
95
+                    }
96
+                }
97
+
98
+
99
+            }
100
+        };
101
+    }
102
+
103
+}

+ 46
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/log/LogFileManager.java 查看文件

@@ -0,0 +1,46 @@
1
+package com.community.huiju.log;
2
+
3
+import java.util.TimerTask;
4
+import java.util.concurrent.ScheduledThreadPoolExecutor;
5
+
6
+/**
7
+ * 日志文件记录
8
+ * @author weiximei
9
+ */
10
+public class LogFileManager {
11
+
12
+    // 记录日志的线程池
13
+    private ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(10);
14
+
15
+    private LogFileManager() {}
16
+
17
+    public static LogFileManager getInstance() {
18
+        return LogSingleton.INSTANCE.getInstance();
19
+    }
20
+
21
+    /**
22
+     * 记录日志
23
+     * @param timerTask 任务
24
+     */
25
+    public void executeLog(TimerTask timerTask){
26
+        // 日志记录
27
+        scheduledThreadPoolExecutor.execute(timerTask);
28
+    }
29
+
30
+    /**
31
+     * 枚举
32
+     */
33
+    private static enum LogSingleton {
34
+        INSTANCE;
35
+
36
+        private LogFileManager logFileManager;
37
+        private LogSingleton() {
38
+            logFileManager = new LogFileManager();
39
+        }
40
+
41
+        public LogFileManager getInstance() {
42
+            return logFileManager;
43
+        }
44
+
45
+    }
46
+}

+ 7
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/FSHardwareServiceI.java 查看文件

@@ -0,0 +1,7 @@
1
+package com.community.huiju.service;
2
+
3
+/**
4
+ * 富士硬件接口
5
+ */
6
+public interface FSHardwareServiceI {
7
+}

+ 7
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/HkHardwareServiceI.java 查看文件

@@ -0,0 +1,7 @@
1
+package com.community.huiju.service;
2
+
3
+/**
4
+ * 海康硬件接口
5
+ */
6
+public interface HkHardwareServiceI {
7
+}

+ 13
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/impl/FSHardwareServiceImpl.java 查看文件

@@ -0,0 +1,13 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.service.FSHardwareServiceI;
4
+import org.springframework.stereotype.Service;
5
+
6
+/**
7
+ * 富士硬件接口
8
+ * @author FXF
9
+ * @date 2019-07-03
10
+ */
11
+@Service
12
+public class FSHardwareServiceImpl implements FSHardwareServiceI {
13
+}

+ 13
- 0
CODE/smart-community/hardware-server/src/main/java/com/community/huiju/service/impl/HkHardwareServiceImpl.java 查看文件

@@ -0,0 +1,13 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.service.HkHardwareServiceI;
4
+import org.springframework.stereotype.Service;
5
+
6
+/**
7
+ * 海康硬件接口
8
+ * @author FXF
9
+ * @date 2019-07-03
10
+ */
11
+@Service
12
+public class HkHardwareServiceImpl implements HkHardwareServiceI {
13
+}

+ 1
- 0
CODE/smart-community/hardware-server/src/main/resources/application.yml 查看文件

@@ -0,0 +1 @@
1
+

+ 24
- 0
CODE/smart-community/hardware-server/src/main/resources/bootstrap.yml 查看文件

@@ -0,0 +1,24 @@
1
+server:
2
+  port: 8088
3
+spring:
4
+  application:
5
+    name: hardware-server
6
+  aop:
7
+    auto: true
8
+    proxy-target-class: true
9
+eureka:
10
+  client:
11
+    service-url:
12
+      defaultZone: http://localhost:8080/eureka/
13
+hystrix:
14
+  command:
15
+    default:
16
+      execution:
17
+        isolation:
18
+          thread:
19
+            timeoutInMilliseconds: 180000
20
+
21
+ribbon:
22
+  ReadTimeout: 38000
23
+  ConnectTimeout: 38000
24
+  eureka.enabled: true

+ 32
- 0
CODE/smart-community/hardware-server/src/main/resources/log4j.properties 查看文件

@@ -0,0 +1,32 @@
1
+log4j.rootLogger=info,A1,R
2
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
3
+log4j.appender.A1.Target=System.out
4
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
5
+log4j.appender.A1.layout.ConversionPattern=%-5p%x [%t] %d - %c %m%n  
6
+
7
+log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
8
+log4j.appender.R.File=../logs/resold_admin_.log
9
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
10
+log4j.appender.R.Append = true
11
+log4j.appender.R.ImmediateFlush = true
12
+log4j.appender.R.DatePattern = '.' yyyy - MM - dd '.txt'
13
+log4j.appender.R.layout.ConversionPattern=%-5p%x [%t] %d -%c %m%n
14
+
15
+#log4j.logger.com.ibatis=DEBUG
16
+log4j.logger.org.springframework.transaction.support.TransactionSynchronizationManager = INFO
17
+log4j.logger.java.sql.Connection=DEBUG
18
+log4j.logger.java.sql.Statement=DEBUG
19
+log4j.logger.java.sql.PreparedStatement=DEBUG
20
+
21
+###############Log4j 4 SQL Output start################# #DEBUG
22
+log4j.logger.com.**.dao=INFO
23
+log4j.logger.com.springframework=DEBUG
24
+log4j.logger.com.ibatis=DEBUG  
25
+log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG  
26
+log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG  
27
+log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
28
+log4j.logger.java.sql.ResultSet=DEBUG
29
+log4j.logger.org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl=DEBUG
30
+log4j.logger.java.sql=DEBUG,CONSOLE 
31
+###############Log4j 4 SQL Output end###################
32
+##### ²âÊÔÌá½»

+ 1973
- 1468
文档/MYSQL/smartCommunity.pdb
文件差异内容过多而无法显示
查看文件


+ 1973
- 1468
文档/MYSQL/smartCommunity.pdm
文件差异内容过多而无法显示
查看文件


二进制
文档/计划/V2.3.0/智慧社区V2.3.2.mpp 查看文件