diff --git a/.gitignore b/.gitignore index 9154f4c..dcfad87 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,36 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* replay_pid* +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### 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/ + +### VS Code ### +.vscode/ + diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..21d3ee8 --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 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 /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="`which 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/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.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" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$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 \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..84d60ab --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@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 Maven2 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 key stroke 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 "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\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/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar" + +FOR /F "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%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.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 "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\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% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..856cb9d --- /dev/null +++ b/pom.xml @@ -0,0 +1,349 @@ + + + 4.0.0 + + com.chenxi + chenxi + 0.0.1-SNAPSHOT + chenxi + Demo project for Spring Boot + + + + + org.springframework.boot + spring-boot-starter-parent + 2.1.1.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + 2.9.2 + 1.3.2 + 1.2.5 + 1.2.47 + 1.1.14 + 2.5 + 1.3.3 + 1.19 + 0.9.0 + 2.9.2 + 3.17 + 3.9.1 + 5.0.6 + 3.2.0 + + + + + + + org.springframework.boot + spring-boot-starter + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-devtools + true + + + + + org.springframework.boot + spring-boot-starter-security + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + mysql + mysql-connector-java + runtime + + + + + + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatisplus.version} + + + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + cn.hutool + hutool-all + ${hutool.version} + + + + + org.apache.commons + commons-lang3 + + + + + commons-io + commons-io + ${commons.io.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + com.alibaba + fastjson + ${fastjson.version} + + + + + org.springframework + spring-context-support + + + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + + + io.swagger + swagger-annotations + 1.5.21 + + + + io.swagger + swagger-models + 1.5.21 + + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + net.java.dev.jna + jna + + + + net.java.dev.jna + jna-platform + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + + org.quartz-scheduler + quartz + 2.3.0 + + + + com.Algorithm_vibration + Algorithm_vibration + system + 1.0 + ${project.basedir}/src/main/resources/lib/Algorithm_vibration-1.0.jar + + + com.javabuilder + javabuilder + system + 1.0 + ${project.basedir}/src/main/resources/lib/javabuilder-1.0.jar + + + com.arraytest + arraytest + system + 1.0 + ${project.basedir}/src/main/resources/lib/arraytest-1.0.jar + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + + + + + public + aliyun nexus + http://maven.aliyun.com/nexus/content/groups/public/ + + true + + + false + + + + + diff --git a/src/main/java/TestMain.java b/src/main/java/TestMain.java new file mode 100644 index 0000000..e29c792 --- /dev/null +++ b/src/main/java/TestMain.java @@ -0,0 +1,7 @@ +public class TestMain { + +// public static void main(String[] args) +// { +// new BigDecimal(0.002364345566222).setScale(4, RoundingMode.UP).doubleValue(); +// } +} diff --git a/src/main/java/com/chenxuan/ChenxiApplication.java b/src/main/java/com/chenxuan/ChenxiApplication.java new file mode 100644 index 0000000..34efa2a --- /dev/null +++ b/src/main/java/com/chenxuan/ChenxiApplication.java @@ -0,0 +1,18 @@ +package com.chenxuan; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.context.annotation.ComponentScan; + +@EnableAutoConfiguration(exclude = DataSourceAutoConfiguration.class) +@ComponentScan(value = "com.chenxuan") +@MapperScan("com.chenxuan.mapper") +@SpringBootApplication +public class ChenxiApplication { + public static void main(String[] args) { + SpringApplication.run( ChenxiApplication.class, args ); + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/base/controller/BaseController.java b/src/main/java/com/chenxuan/base/controller/BaseController.java new file mode 100644 index 0000000..2bd17d0 --- /dev/null +++ b/src/main/java/com/chenxuan/base/controller/BaseController.java @@ -0,0 +1,55 @@ +package com.chenxuan.base.controller; + + +import com.chenxuan.base.entity.AjaxResult; + +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.spring.SpringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; + +import java.beans.PropertyEditorSupport; +import java.util.Date; + +import com.chenxuan.utils.DateUtils; + +public class BaseController { + + + private JwtTokenService jwtTokenService = SpringUtils.getBean( JwtTokenService.class ); + + public LoginUser getLoginInfo(){ + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest() ); + return loginUser ; + } + + public SysUser getLoginUser(){ + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest() ); + if(null != loginUser){ + return loginUser.getUser(); + } + return null ; + } + + /** + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 + */ + @InitBinder + public void initBinder(WebDataBinder binder) { + // Date 类型转换 + binder.registerCustomEditor( Date.class, new PropertyEditorSupport() { + @Override + public void setAsText(String text) { + setValue( DateUtils.parseDate( text ) ); + } + } ); + } + + public AjaxResult returnAjax(boolean flag) { + return flag ? AjaxResult.success() : AjaxResult.error(); + } +} diff --git a/src/main/java/com/chenxuan/base/entity/AjaxResult.java b/src/main/java/com/chenxuan/base/entity/AjaxResult.java new file mode 100644 index 0000000..44f8ec8 --- /dev/null +++ b/src/main/java/com/chenxuan/base/entity/AjaxResult.java @@ -0,0 +1,146 @@ +package com.chenxuan.base.entity; + + +import com.chenxuan.constants.HttpStatusCode; + +import java.util.HashMap; + +/** + * @ClassName:AjaxResult + * @Description: Ajax操作返回 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 12:51 PM + * @Version V1.0 + */ +public class AjaxResult extends HashMap { + + /** + * 状态码 + */ + public static final String CODE_TAG = "code"; + + /** + * 返回内容 + */ + public static final String MSG_TAG = "msg"; + + /** + * 数据对象 + */ + public static final String DATA_TAG = "data"; + + /** + * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 + */ + public AjaxResult() { + + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 数据对象 + */ + public AjaxResult(int code, String msg, Object data) { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + if (data != null) { + super.put(DATA_TAG, data); + } + } + + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() { + return AjaxResult.success("操作成功"); + } + + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(Object data) { + return AjaxResult.success("操作成功", data); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) { + return AjaxResult.success(msg, null); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, Object data) { + return new AjaxResult(HttpStatusCode.SUCCESS, msg, data); + } + + + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() { + return AjaxResult.error("操作失败"); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) { + return AjaxResult.error(msg, null); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, Object data) { + return new AjaxResult(HttpStatusCode.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) { + return new AjaxResult(code, msg, null); + } +} diff --git a/src/main/java/com/chenxuan/base/entity/CustomQuartzJobBean.java b/src/main/java/com/chenxuan/base/entity/CustomQuartzJobBean.java new file mode 100644 index 0000000..8d2901a --- /dev/null +++ b/src/main/java/com/chenxuan/base/entity/CustomQuartzJobBean.java @@ -0,0 +1,51 @@ +package com.chenxuan.base.entity; + +import com.chenxuan.entity.model.ScheduleJob; +import com.chenxuan.utils.ScheduleRunnable; +import lombok.extern.slf4j.Slf4j; +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.PersistJobDataAfterExecution; +import org.springframework.scheduling.quartz.QuartzJobBean; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +/** + * @ClassName:DynamicQuartzJobManager + * @Description: 任务动态调用 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 5:49 PM + * @Version V1.0 + */ +@Slf4j +@PersistJobDataAfterExecution +@DisallowConcurrentExecution// 不允许并发执行 +public class CustomQuartzJobBean extends QuartzJobBean { + + + private ExecutorService service = Executors.newSingleThreadExecutor(); + + @Override + protected void executeInternal(JobExecutionContext context) throws JobExecutionException { + //任务开始时间 + ScheduleJob scheduleJob = (ScheduleJob) context.getMergedJobDataMap().get( JobConstant.JOB_PARAM_KEY ); + //任务开始时间 + long startTime = System.currentTimeMillis(); + try { + ScheduleRunnable task = new ScheduleRunnable( scheduleJob.getBeanName(), + scheduleJob.getMethodName(), scheduleJob.getMethodParams() ); + Future future = service.submit( task ); + Object object = future.get(); + + } catch (Exception e) { + log.error( "任务执行失败,任务ID:" + scheduleJob.getJobId(), e ); + + } finally { + + } + + + } +} diff --git a/src/main/java/com/chenxuan/base/entity/JobConstant.java b/src/main/java/com/chenxuan/base/entity/JobConstant.java new file mode 100644 index 0000000..7b78cdc --- /dev/null +++ b/src/main/java/com/chenxuan/base/entity/JobConstant.java @@ -0,0 +1,21 @@ +package com.chenxuan.base.entity; + + +public class JobConstant { + + /** + * 任务调度参数key + */ + public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY"; + + /** + * 任务调度 + */ + public final static String JOB_KEY = "JOB_KEY"; + + + /** + * 任务调度 + */ + public final static String TRIGGER_kEY = "TRIGGER_kEY"; +} diff --git a/src/main/java/com/chenxuan/base/entity/JobOperateEnum.java b/src/main/java/com/chenxuan/base/entity/JobOperateEnum.java new file mode 100644 index 0000000..a5625e9 --- /dev/null +++ b/src/main/java/com/chenxuan/base/entity/JobOperateEnum.java @@ -0,0 +1,40 @@ +package com.chenxuan.base.entity; + + + + +/** + * @ClassName:JobOperateEnum + * @Description: 定时任务 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 3:51 PM + * @Version V1.0 + */ + +public enum JobOperateEnum { + + START( "1", "启动" ), + PAUSE( "2", "暂停" ), + DELETE( "3", "删除" ); + + private final String value; + private final String desc; + + JobOperateEnum(final String value, final String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return this.value; + } + + // Jackson 注解为 JsonValue 返回中文 json 描述 + public String getDesc() { + return this.desc; + } + + public String getEnumName() { + return name(); + } +} diff --git a/src/main/java/com/chenxuan/base/entity/Query.java b/src/main/java/com/chenxuan/base/entity/Query.java new file mode 100644 index 0000000..30101c2 --- /dev/null +++ b/src/main/java/com/chenxuan/base/entity/Query.java @@ -0,0 +1,65 @@ +package com.chenxuan.base.entity; + + +import com.alibaba.fastjson.JSON; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +public class Query implements Serializable { + + public String page = "1"; + public String limit = "10"; + public String orderByField = ""; + public String isAsc = ""; + + /** + * 请求参数 + */ + private String params; + + public Integer getPage() { + return Integer.parseInt( page ); + } + + public void setPage(String page) { + this.page = page; + } + + public Integer getLimit() { + return Integer.parseInt( limit ); + } + + public void setLimit(String limit) { + this.limit = limit; + } + + public String getOrderByField() { + return orderByField; + } + + public void setOrderByField(String orderByField) { + this.orderByField = orderByField; + } + + public String getIsAsc() { + return isAsc; + } + + public void setIsAsc(String isAsc) { + this.isAsc = isAsc; + } + + public Map getParams() { + if (params == null) { + return new HashMap<>(); + } + return JSON.parseObject(params , Map.class ); + } + + public void setParams(String params) { + this.params = params; + } + +} diff --git a/src/main/java/com/chenxuan/base/exception/GlobalExceptionHandler.java b/src/main/java/com/chenxuan/base/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..1e2ef27 --- /dev/null +++ b/src/main/java/com/chenxuan/base/exception/GlobalExceptionHandler.java @@ -0,0 +1,105 @@ +package com.chenxuan.base.exception; + + +import cn.hutool.core.util.StrUtil; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.exception.BaseException; +import com.chenxuan.exception.CustomException; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.AccountExpiredException; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.NoHandlerFoundException; + + +/** + * @ClassName:GlobalExceptionHandler + * @Description: 全局异常处理器 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:57 PM + * @Version V1.0 + */ +@Slf4j +@RestControllerAdvice +public class GlobalExceptionHandler { + + /** + * 基础异常 + */ + @ExceptionHandler(BaseException.class) + public AjaxResult baseException(BaseException e) { + return AjaxResult.error( e.getMessage() ); + } + + /** + * 业务异常 + */ + @ExceptionHandler(CustomException.class) + public AjaxResult businessException(CustomException e) { + if (e.getCode() == null) + { + return AjaxResult.error(e.getMessage()); + } + return AjaxResult.error( e.getCode(), e.getMessage() ); + } + + @ExceptionHandler(NoHandlerFoundException.class) + public AjaxResult handlerNoFoundException(Exception e) { + log.error( e.getMessage(), e ); + return AjaxResult.error( HttpStatusCode.NOT_FOUND, "路径不存在,请检查路径是否正确" ); + } + + @ExceptionHandler(AccessDeniedException.class) + public AjaxResult handleAuthorizationException(AccessDeniedException e) { + log.error( e.getMessage() ); + return AjaxResult.error( HttpStatusCode.FORBIDDEN, "没有权限,请联系管理员授权" ); + } + + @ExceptionHandler(AccountExpiredException.class) + public AjaxResult handleAccountExpiredException(AccountExpiredException e) { + log.error( e.getMessage(), e ); + return AjaxResult.error( e.getMessage() ); + } + + @ExceptionHandler(UsernameNotFoundException.class) + public AjaxResult handleUsernameNotFoundException(UsernameNotFoundException e) { + log.error( e.getMessage(), e ); + return AjaxResult.error( e.getMessage() ); + } + + @ExceptionHandler(Exception.class) + public AjaxResult handleException(Exception e) { + log.error( e.getMessage(), e ); + return AjaxResult.error( e.getMessage() ); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(BindException.class) + public AjaxResult validatedBindException(BindException e) { + log.error( e.getMessage(), e ); + String message = e.getAllErrors().get( 0 ).getDefaultMessage(); + return AjaxResult.error( message ); + } + + /** + * 自定义验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object validExceptionHandler(MethodArgumentNotValidException e) { + log.error( e.getMessage(), e ); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error( message ); + } +} + diff --git a/src/main/java/com/chenxuan/bean/annotation/DsAnnotation.java b/src/main/java/com/chenxuan/bean/annotation/DsAnnotation.java new file mode 100644 index 0000000..bdd6229 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/annotation/DsAnnotation.java @@ -0,0 +1,27 @@ +package com.chenxuan.bean.annotation; + + +import com.chenxuan.enums.DataSourceType; + +import java.lang.annotation.*; + + +/** + * @ClassName:DsAnnotation + * @Description: 自定义多数据源切换注解 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 5:21 PM + * @Version V1.0 + */ + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +public @interface DsAnnotation { + + /** + * 切换数据源名称 + */ + public DataSourceType value() default DataSourceType.MASTER; +} diff --git a/src/main/java/com/chenxuan/bean/annotation/LogAnnotation.java b/src/main/java/com/chenxuan/bean/annotation/LogAnnotation.java new file mode 100644 index 0000000..0f09770 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/annotation/LogAnnotation.java @@ -0,0 +1,46 @@ +package com.chenxuan.bean.annotation; + +import com.chenxuan.enums.ClientType; +import com.chenxuan.enums.OperateType; + +import java.lang.annotation.*; + +/** + * @ClassName:LogAnnotation + * @Description: 日志注解 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 4:18 PM + * @Version V1.0 + */ + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface LogAnnotation { + + /** + * 模块 + */ + String module(); + + + /** + * 记录参数值 + */ + boolean recordParam() default true; + + + /** + * 务操作类型 + */ + public OperateType operateType() default OperateType.OTHER; + + + /** + * 务操作类型 + */ + public ClientType clientType() default ClientType.MANAGE; + + +} + diff --git a/src/main/java/com/chenxuan/bean/aop/DataSourceAop.java b/src/main/java/com/chenxuan/bean/aop/DataSourceAop.java new file mode 100644 index 0000000..61d4c40 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/aop/DataSourceAop.java @@ -0,0 +1,70 @@ +package com.chenxuan.bean.aop; + + +import com.chenxuan.bean.annotation.DsAnnotation; +import com.chenxuan.bean.datasource.DynamicDataSourceContextHolder; +import com.chenxuan.utils.StringUtils; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + + +/** + * @ClassName:DataSourceAop + * @Description: 多数据源处理 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 5:33 PM + * @Version V1.0 + */ +@Aspect +@Order(1) +@Component +public class DataSourceAop { + protected Logger logger = LoggerFactory.getLogger( getClass() ); + + @Pointcut("@annotation(com.chenxuan.bean.annotation.DsAnnotation)" + + "|| @within(com.chenxuan.bean.annotation.DsAnnotation)") + public void dsPointCut() { + + } + + @Around("dsPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + DsAnnotation dataSource = getDataSource( point ); + + if (StringUtils.isNotNull( dataSource )) { + DynamicDataSourceContextHolder.setDataSourceType( dataSource.value().name() ); + } + + try { + return point.proceed(); + } finally { + // 销毁数据源 在执行方法之后 + DynamicDataSourceContextHolder.clearDataSourceType(); + } + } + + /** + * 获取需要切换的数据源 + */ + public DsAnnotation getDataSource(ProceedingJoinPoint point) { + MethodSignature signature = (MethodSignature) point.getSignature(); + Class targetClass = point.getTarget().getClass(); + DsAnnotation targetDataSource = targetClass.getAnnotation( DsAnnotation.class ); + if (StringUtils.isNotNull( targetDataSource )) { + return targetDataSource; + } else { + Method method = signature.getMethod(); + DsAnnotation dataSource = method.getAnnotation( DsAnnotation.class ); + return dataSource; + } + } +} diff --git a/src/main/java/com/chenxuan/bean/aop/LogAop.java b/src/main/java/com/chenxuan/bean/aop/LogAop.java new file mode 100644 index 0000000..98b6ad7 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/aop/LogAop.java @@ -0,0 +1,257 @@ +package com.chenxuan.bean.aop; + + +import com.alibaba.fastjson.JSON; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysOperLog; +import com.chenxuan.enums.BusinessStatus; +import com.chenxuan.enums.HttpMethod; +import com.chenxuan.manager.AsyncManager; +import com.chenxuan.manager.factory.AsyncFactory; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.StringUtils; +import com.chenxuan.utils.ip.IpUtils; +import com.chenxuan.utils.spring.SpringUtils; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.Signature; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.HandlerMapping; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; +import java.util.Date; +import java.util.Map; + + +/** + * @ClassName:LogAop + * @Description: 日志切面. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 4:20 PM + * @Version V1.0 + */ + +@Slf4j +@Aspect +@Component +public class LogAop { + + @Pointcut("@annotation(com.chenxuan.bean.annotation.LogAnnotation)") + public void logPointCut() { + + } + + + /** + * 处理完请求后执行 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "logPointCut()", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Object jsonResult) { + handleLog( joinPoint, null, jsonResult ); + } + + /** + * 拦截异常操作 + * + * @param joinPoint 切点 + * @param e 异常 + */ + @AfterThrowing(value = "logPointCut()", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Exception e) { + handleLog( joinPoint, e, null ); + } + + protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult) { + try { + // 获得注解 + LogAnnotation controllerLog = getAnnotationLog( joinPoint ); + if (controllerLog == null) { + return; + } + + // 获取当前的用户 + LoginUser loginUser = SpringUtils.getBean( JwtTokenService.class ).getLoginUser( ServletUtils.getRequest() ); + + // *========数据库日志=========*// + SysOperLog operLog = new SysOperLog(); + operLog.setStatus( BusinessStatus.SUCCESS.ordinal() ); + // 请求的地址 + String ip = IpUtils.getIpAddr( ServletUtils.getRequest() ); + operLog.setOperIp( ip ); + // 返回参数 + operLog.setJsonResult( JSON.toJSONString( jsonResult ) ); + operLog.setOperUrl( ServletUtils.getRequest().getRequestURI() ); + if (loginUser != null) { + operLog.setOperName( loginUser.getUsername() ); + } + + if (e != null) { + operLog.setStatus( BusinessStatus.FAIL.ordinal() ); + operLog.setErrorMsg( StringUtils.substring( e.getMessage(), 0, 2000 ) ); + } + // 设置方法名称 + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + operLog.setMethod( className + "." + methodName + "()" ); + // 设置请求方式 + operLog.setRequestMethod( ServletUtils.getRequest().getMethod() ); + operLog.setOperTime( new Date() ); + // 处理设置注解上的参数 + getControllerMethodDescription( joinPoint, controllerLog, operLog ); + + // 保存数据库 + AsyncManager.me().execute( AsyncFactory.recordOperLog( operLog ) ); + } catch (Exception exp) { + // 记录本地异常日志 + log.error( "==前置通知异常==" ); + log.error( "异常信息:{}", exp.getMessage() ); + exp.printStackTrace(); + } + } + + + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param log 日志 + * @param operLog 操作日志 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, LogAnnotation log, SysOperLog operLog) throws Exception { + // 设置action动作 + operLog.setOperatorType( log.operateType().ordinal() ); + // 设置标题 + operLog.setTitle( log.module() ); + // 设置操作人类别 + operLog.setOperatorType( log.clientType().ordinal() ); + // 是否需要保存request,参数和值 + if (log.recordParam()) { + // 获取参数的信息,传入到数据库中。 + setRequestValue( joinPoint, operLog ); + } + } + + /** + * 获取请求的参数,放到log中 + * + * @param operLog 操作日志 + * @throws Exception 异常 + */ + private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception { + String requestMethod = operLog.getRequestMethod(); + if (HttpMethod.PUT.name().equals( requestMethod ) || HttpMethod.POST.name().equals( requestMethod )) { + String params = argsArrayToString( joinPoint.getArgs() ); + operLog.setOperParam( StringUtils.substring( params, 0, 2000 ) ); + } else { + Map paramsMap = (Map) ServletUtils.getRequest().getAttribute( HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE ); + operLog.setOperParam( StringUtils.substring( paramsMap.toString(), 0, 2000 ) ); + } + } + + /** + * 是否存在注解,如果存在就获取 + */ + private LogAnnotation getAnnotationLog(JoinPoint joinPoint) throws Exception { + Signature signature = joinPoint.getSignature(); + MethodSignature methodSignature = (MethodSignature) signature; + Method method = methodSignature.getMethod(); + + if (method != null) { + return method.getAnnotation( LogAnnotation.class ); + } + return null; + } + + /** + * 参数拼装 + */ + private String argsArrayToString(Object[] paramsArray) { + String params = ""; + if (paramsArray != null && paramsArray.length > 0) { + for (int i = 0; i < paramsArray.length; i++) { + if (!isFilterObject( paramsArray[i] )) { + Object jsonObj = JSON.toJSON( paramsArray[i] ); + params += jsonObj.toString() + " "; + } + } + } + return params.trim(); + } + + /** + * 判断是否需要过滤的对象。 + * + * @param o 对象信息。 + * @return 如果是需要过滤的对象,则返回true;否则返回false。 + */ + public boolean isFilterObject(final Object o) { + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse; + } + + /* @Around("logPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = attributes.getRequest(); + + LogVO logVO = new LogVO( ); + + logVO.setCreateTime( new Date( ) ); + logVO.setUserName(""); + logVO.setIpAddr( "" ); + logVO.setRequestUri( request.getRequestURL().toString() ); + + + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + //请求的方法名 + String className = point.getTarget().getClass().getName(); + String methodName = signature.getName(); + logVO.setMethod( className + "." + methodName ); + + + LogAnnotation logAnnotation = method.getDeclaredAnnotation( LogAnnotation.class ); + logVO.setModule( logAnnotation.module() ); + + if(logAnnotation.recordParam()){ + String[] parameterNames = signature.getParameterNames(); + if(null != parameterNames && parameterNames.length > 0){ + Map params = new HashMap<>( ); + + Object[] args = point.getArgs(); + for (int i = 0 ; i < parameterNames.length; i++ ) { + params.put( parameterNames [i], args[i] ); + } + + try { + logVO.setParams( JSONObject.toJSONString( params ) ); + } catch (Exception e) { + log.error( "记录日志失败:{}", e.getMessage() ); + } + } + } + try { + Object object = point.proceed(); + logVO.setFlag( "1" ); + return object; + } catch (Exception e) { + logVO.setFlag( "0" ); + logVO.setMark( e.getMessage() ); + throw e; + }finally { + // TODO 保存日志 + } + }*/ +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/bean/component/RedisCacheService.java b/src/main/java/com/chenxuan/bean/component/RedisCacheService.java new file mode 100644 index 0000000..4efbc07 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/component/RedisCacheService.java @@ -0,0 +1,205 @@ +package com.chenxuan.bean.component; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.*; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.TimeUnit; + +/** + * @ClassName:RedisCacheService + * @Description: redis + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 6:40 PM + * @Version V1.0 + */ + +@Component +public class RedisCacheService { + + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @return 缓存的对象 + */ + public ValueOperations setCacheObject(String key, T value) + { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key, value); + return operation; + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + * @return 缓存的对象 + */ + public ValueOperations setCacheObject(String key, T value, Integer timeout, TimeUnit timeUnit) + { + ValueOperations operation = redisTemplate.opsForValue(); + operation.set(key, value, timeout, timeUnit); + return operation; + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(String key) + { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public void deleteObject(String key) + { + redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection + */ + public void deleteObject(Collection collection) + { + redisTemplate.delete(collection); + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public ListOperations setCacheList(String key, List dataList) + { + ListOperations listOperation = redisTemplate.opsForList(); + if (null != dataList) + { + int size = dataList.size(); + for (int i = 0; i < size; i++) + { + listOperation.leftPush(key, dataList.get(i)); + } + } + return listOperation; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(String key) + { + List dataList = new ArrayList(); + ListOperations listOperation = redisTemplate.opsForList(); + Long size = listOperation.size(key); + + for (int i = 0; i < size; i++) + { + dataList.add(listOperation.index(key, i)); + } + return dataList; + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(String key, Set dataSet) + { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(String key) + { + Set dataSet = new HashSet(); + BoundSetOperations operation = redisTemplate.boundSetOps(key); + Long size = operation.size(); + for (int i = 0; i < size; i++) + { + dataSet.add(operation.pop()); + } + return dataSet; + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + * @return + */ + public HashOperations setCacheMap(String key, Map dataMap) + { + HashOperations hashOperations = redisTemplate.opsForHash(); + if (null != dataMap) + { + for (Map.Entry entry : dataMap.entrySet()) + { + hashOperations.put(key, entry.getKey(), entry.getValue()); + } + } + return hashOperations; + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(String key) + { + Map map = redisTemplate.opsForHash().entries(key); + return map; + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(String pattern) + { + return redisTemplate.keys(pattern); + } +} diff --git a/src/main/java/com/chenxuan/bean/config/DruidConfig.java b/src/main/java/com/chenxuan/bean/config/DruidConfig.java new file mode 100644 index 0000000..3592c72 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/DruidConfig.java @@ -0,0 +1,102 @@ +package com.chenxuan.bean.config; + +import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; +import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; +import com.alibaba.druid.util.Utils; + +import com.chenxuan.bean.config.properties.DruidProperties; +import com.chenxuan.bean.datasource.DynamicDataSource; +import com.chenxuan.enums.DataSourceType; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.servlet.*; +import javax.sql.DataSource; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName:DruidConfig + * @Description: druid 配置多数据源 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:57 PM + * @Version V1.0 + */ + +@Configuration +public class DruidConfig { + + @Bean + @ConfigurationProperties("spring.datasource.druid.master") + public DataSource masterDataSource(DruidProperties druidProperties) { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource( dataSource ); + } + + @Bean + @ConfigurationProperties("spring.datasource.druid.slave") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true") + public DataSource slaveDataSource(DruidProperties druidProperties) { + DruidDataSource dataSource = DruidDataSourceBuilder.create().build(); + return druidProperties.dataSource( dataSource ); + } + + @Bean(name = "dynamicDataSource") + @Primary + public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource) { + Map targetDataSources = new HashMap<>(); + targetDataSources.put( DataSourceType.MASTER.name(), masterDataSource ); + targetDataSources.put( DataSourceType.SLAVE.name(), slaveDataSource ); + return new DynamicDataSource( masterDataSource, targetDataSources ); + } + + /** + * 去除监控页面底部的广告 + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + @Bean + @ConditionalOnProperty(name = "spring.datasource.druid.statViewServlet.enabled", havingValue = "true") + public FilterRegistrationBean removeDruidFilterRegistrationBean(DruidStatProperties properties) { + // 获取web监控页面的参数 + DruidStatProperties.StatViewServlet config = properties.getStatViewServlet(); + // 提取common.js的配置路径 + String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*"; + String commonJsPattern = pattern.replaceAll( "\\*", "js/common.js" ); + final String filePath = "support/http/resources/js/common.js"; + // 创建filter进行过滤 + Filter filter = new Filter() { + @Override + public void init(javax.servlet.FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + chain.doFilter( request, response ); + // 重置缓冲区,响应头不会被重置 + response.resetBuffer(); + // 获取common.js + String text = Utils.readFromResource( filePath ); + // 正则替换banner, 除去底部的广告信息 + text = text.replaceAll( "
", "" ); + text = text.replaceAll( "powered.*?shrek.wang", "" ); + response.getWriter().write( text ); + } + + @Override + public void destroy() { + } + }; + FilterRegistrationBean registrationBean = new FilterRegistrationBean(); + registrationBean.setFilter( filter ); + registrationBean.addUrlPatterns( commonJsPattern ); + return registrationBean; + } +} diff --git a/src/main/java/com/chenxuan/bean/config/FastJson2JsonRedisSerializer.java b/src/main/java/com/chenxuan/bean/config/FastJson2JsonRedisSerializer.java new file mode 100644 index 0000000..2f4f2b4 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/FastJson2JsonRedisSerializer.java @@ -0,0 +1,74 @@ +package com.chenxuan.bean.config; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.parser.ParserConfig; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import org.springframework.util.Assert; + +import java.nio.charset.Charset; + + +/** + * @ClassName:FastJson2JsonRedisSerializer + * @Description: Redis使用FastJson序列化 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:37 PM + * @Version V1.0 + */ + +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + @SuppressWarnings("unused") + private ObjectMapper objectMapper = new ObjectMapper(); + + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + private Class clazz; + + static + { + ParserConfig.getGlobalInstance().setAutoTypeSupport(true); + } + + public FastJson2JsonRedisSerializer(Class clazz) + { + super(); + this.clazz = clazz; + } + + public byte[] serialize(T t) throws SerializationException + { + if (t == null) + { + return new byte[0]; + } + return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); + } + + public T deserialize(byte[] bytes) throws SerializationException + { + if (bytes == null || bytes.length <= 0) + { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + + return JSON.parseObject(str, clazz); + } + + public void setObjectMapper(ObjectMapper objectMapper) + { + Assert.notNull(objectMapper, "'objectMapper' must not be null"); + this.objectMapper = objectMapper; + } + + protected JavaType getJavaType(Class clazz) + { + return TypeFactory.defaultInstance().constructType(clazz); + } +} diff --git a/src/main/java/com/chenxuan/bean/config/FilterConfig.java b/src/main/java/com/chenxuan/bean/config/FilterConfig.java new file mode 100644 index 0000000..1b8f418 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/FilterConfig.java @@ -0,0 +1,52 @@ +package com.chenxuan.bean.config; + + +import com.chenxuan.utils.StringUtils; +import com.chenxuan.xxs.XssFilter; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.DispatcherType; +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName:FilterConfig + * @Description: Filter配置 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:38 AM + * @Version V1.0 + */ + +@Configuration +public class FilterConfig +{ + @Value("${xss.enabled}") + private String enabled; + + @Value("${xss.excludes}") + private String excludes; + + @Value("${xss.urlPatterns}") + private String urlPatterns; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + public FilterRegistrationBean xssFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setDispatcherTypes( DispatcherType.REQUEST); + registration.setFilter(new XssFilter()); + registration.addUrlPatterns( StringUtils.split(urlPatterns, ",")); + registration.setName("xssFilter"); + registration.setOrder(Integer.MAX_VALUE); + Map initParameters = new HashMap(); + initParameters.put("excludes", excludes); + initParameters.put("enabled", enabled); + registration.setInitParameters(initParameters); + return registration; + } +} diff --git a/src/main/java/com/chenxuan/bean/config/MybatisPlusConfig.java b/src/main/java/com/chenxuan/bean/config/MybatisPlusConfig.java new file mode 100644 index 0000000..83af41d --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/MybatisPlusConfig.java @@ -0,0 +1,31 @@ +package com.chenxuan.bean.config; + + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @ClassName:MybatisPlusConfig + * @Description: MybatisPlus配置. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 5:14 PM + * @Version V1.0 + */ + +@Configuration +public class MybatisPlusConfig { + + + + /** + * + * @description: 分页插件 + * @return: PaginationInterceptor + * + **/ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } +} diff --git a/src/main/java/com/chenxuan/bean/config/RedisConfig.java b/src/main/java/com/chenxuan/bean/config/RedisConfig.java new file mode 100644 index 0000000..da61bcc --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/RedisConfig.java @@ -0,0 +1,45 @@ +package com.chenxuan.bean.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.cache.annotation.CachingConfigurerSupport; +import org.springframework.cache.annotation.EnableCaching; +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.serializer.StringRedisSerializer; + + +/** + * @ClassName:RedisConfig + * @Description: redis配置 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:36 PM + * @Version V1.0 + */ + +@Configuration +@EnableCaching +public class RedisConfig extends CachingConfigurerSupport +{ + @Bean + @SuppressWarnings(value = { "unchecked", "rawtypes" }) + public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) + { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(connectionFactory); + FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(mapper); + + template.setValueSerializer(serializer); + template.setKeySerializer(new StringRedisSerializer()); + template.afterPropertiesSet(); + return template; + } +} diff --git a/src/main/java/com/chenxuan/bean/config/SwaggerConfig.java b/src/main/java/com/chenxuan/bean/config/SwaggerConfig.java new file mode 100644 index 0000000..469c289 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/SwaggerConfig.java @@ -0,0 +1,112 @@ +package com.chenxuan.bean.config; + +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.*; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.ArrayList; +import java.util.List; + + +/** + * @ClassName:SwaggerConfig + * @Description: Swagger2的接口配置 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:55 AM + * @Version V1.0 + */ + +@Configuration +@EnableSwagger2 +public class SwaggerConfig +{ + + + /** + * 创建API + */ + @Bean + public Docket createRestApi() + { + return new Docket( DocumentationType.SWAGGER_2) + //.pathMapping("/dev-api") + // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) + .apiInfo(apiInfo()) + // 设置哪些接口暴露给Swagger展示 + .select() + // 扫描所有有注解的api,用这种方式更灵活 + .apis( RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + // 扫描指定包中的swagger注解 + //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // 扫描所有 .apis(RequestHandlerSelectors.any()) + .paths( PathSelectors.any()) + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()); + } + + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() + { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", "header")); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .forPaths( PathSelectors.regex("^(?!auth).*$")) + .build()); + return securityContexts; + } + + /** + * 默认的安全上引用 + */ + private List defaultAuth() + { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; + } + + /** + * 添加摘要信息 + */ + private ApiInfo apiInfo() + { + // 用ApiInfoBuilder进行定制 + return new ApiInfoBuilder() + // 设置标题 + .title("标题:若依管理系统_接口文档") + // 描述 + .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") + // 作者信息 + .contact(new Contact("HC", null, null)) + // 版本 + .version("版本号:1.0.0" ) + .build(); + } +} diff --git a/src/main/java/com/chenxuan/bean/config/ThreadPoolConfig.java b/src/main/java/com/chenxuan/bean/config/ThreadPoolConfig.java new file mode 100644 index 0000000..3439e77 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/ThreadPoolConfig.java @@ -0,0 +1,69 @@ +package com.chenxuan.bean.config; + + +import com.chenxuan.utils.Threads; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + + + +/** + * @ClassName:ThreadPoolConfig + * @Description: 线程池配置 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:37 AM + * @Version V1.0 + */ + +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) + { + @Override + protected void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r, t); + Threads.printException(r, t); + } + }; + } +} diff --git a/src/main/java/com/chenxuan/bean/config/UploadConfig.java b/src/main/java/com/chenxuan/bean/config/UploadConfig.java new file mode 100644 index 0000000..de98da0 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/UploadConfig.java @@ -0,0 +1,41 @@ +package com.chenxuan.bean.config; + + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * @ClassName:UploadConfig + * @Description: 文件上传相关配置 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:48 AM + * @Version V1.0 + */ + +@Component +@ConfigurationProperties(prefix = "upload") +public class UploadConfig { + + /** 上传路径 */ + private static String profile; + + /** 获取地址开关 */ + private static boolean addressEnabled; + + + public static String getProfile() { + return profile; + } + + public static void setProfile(String profile) { + UploadConfig.profile = profile; + } + + public static boolean isAddressEnabled() { + return addressEnabled; + } + + public static void setAddressEnabled(boolean addressEnabled) { + UploadConfig.addressEnabled = addressEnabled; + } +} diff --git a/src/main/java/com/chenxuan/bean/config/properties/DruidProperties.java b/src/main/java/com/chenxuan/bean/config/properties/DruidProperties.java new file mode 100644 index 0000000..f648958 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/config/properties/DruidProperties.java @@ -0,0 +1,80 @@ +package com.chenxuan.bean.config.properties; + +import com.alibaba.druid.pool.DruidDataSource; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + + +/** + * @ClassName:DruidProperties + * @Description: druid 配置属性 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:55 PM + * @Version V1.0 + */ + +@Configuration +public class DruidProperties { + + @Value("${spring.datasource.druid.initial-size}") + private int initialSize; + + @Value("${spring.datasource.druid.minIdle}") + private int minIdle; + + @Value("${spring.datasource.druid.maxActive}") + private int maxActive; + + @Value("${spring.datasource.druid.maxWait}") + private int maxWait; + + @Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}") + private int timeBetweenEvictionRunsMillis; + + @Value("${spring.datasource.druid.minEvictableIdleTimeMillis}") + private int minEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}") + private int maxEvictableIdleTimeMillis; + + @Value("${spring.datasource.druid.validationQuery}") + private String validationQuery; + + @Value("${spring.datasource.druid.testWhileIdle}") + private boolean testWhileIdle; + + @Value("${spring.datasource.druid.testOnBorrow}") + private boolean testOnBorrow; + + @Value("${spring.datasource.druid.testOnReturn}") + private boolean testOnReturn; + + public DruidDataSource dataSource(DruidDataSource datasource) { + /** 配置初始化大小、最小、最大 */ + datasource.setInitialSize( initialSize ); + datasource.setMaxActive( maxActive ); + datasource.setMinIdle( minIdle ); + + /** 配置获取连接等待超时的时间 */ + datasource.setMaxWait( maxWait ); + + /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ + datasource.setTimeBetweenEvictionRunsMillis( timeBetweenEvictionRunsMillis ); + + /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ + datasource.setMinEvictableIdleTimeMillis( minEvictableIdleTimeMillis ); + datasource.setMaxEvictableIdleTimeMillis( maxEvictableIdleTimeMillis ); + + /** + * 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。 + */ + datasource.setValidationQuery( validationQuery ); + /** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */ + datasource.setTestWhileIdle( testWhileIdle ); + /** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnBorrow( testOnBorrow ); + /** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */ + datasource.setTestOnReturn( testOnReturn ); + return datasource; + } +} diff --git a/src/main/java/com/chenxuan/bean/datasource/DynamicDataSource.java b/src/main/java/com/chenxuan/bean/datasource/DynamicDataSource.java new file mode 100644 index 0000000..fe9b0e6 --- /dev/null +++ b/src/main/java/com/chenxuan/bean/datasource/DynamicDataSource.java @@ -0,0 +1,34 @@ +package com.chenxuan.bean.datasource; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +import javax.sql.DataSource; +import java.util.Map; + + +/** + * @ClassName:DynamicDataSource + * @Description: 动态数据源 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 5:00 PM + * @Version V1.0 + */ + +public class DynamicDataSource extends AbstractRoutingDataSource { + + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) { + super.setDefaultTargetDataSource( defaultTargetDataSource ); + super.setTargetDataSources( targetDataSources ); + super.afterPropertiesSet(); + } + + /* + * 代码中的determineCurrentLookupKey方法取得一个字符串, + * 该字符串将与配置文件中的相应字符串进行匹配以定位数据源,配置文件,即applicationContext.xml文件中需要要如下代码:(non-Javadoc) + * @see org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource#determineCurrentLookupKey() + */ + @Override + protected Object determineCurrentLookupKey() { + return DynamicDataSourceContextHolder.getDataSourceType(); + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/bean/datasource/DynamicDataSourceContextHolder.java b/src/main/java/com/chenxuan/bean/datasource/DynamicDataSourceContextHolder.java new file mode 100644 index 0000000..9eca56f --- /dev/null +++ b/src/main/java/com/chenxuan/bean/datasource/DynamicDataSourceContextHolder.java @@ -0,0 +1,77 @@ +package com.chenxuan.bean.datasource; + +import com.chenxuan.enums.DataSourceType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + + +/** + * @ClassName:DynamicDataSourceContextHolder + * @Description: 数据源切换处理 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 5:00 PM + * @Version V1.0 + */ + +public class DynamicDataSourceContextHolder { + + public static final Logger log = LoggerFactory.getLogger( DynamicDataSourceContextHolder.class ); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + + /* + + * 管理所有的数据源id; + + * 主要是为了判断数据源是否存在; + + */ + + public static List dataSourceIds = new ArrayList(); + + /** + * 设置数据源的变量 + */ + public static void setDataSourceType(String dsType) { + log.info( "切换到{}数据源", dsType ); + CONTEXT_HOLDER.set( dsType ); + } + + /** + * 获得数据源的变量 + */ + public static String getDataSourceType() { + String db = CONTEXT_HOLDER.get(); + if(null == db){ + log.error( "未获取到数据源........" ); + db = DataSourceType.MASTER.name(); + } + return db; + } + + /** + * 清空数据源变量 + */ + public static void clearDataSourceType() { + CONTEXT_HOLDER.remove(); + } + + /** + * 判断指定DataSrouce当前是否存在 + * + */ + public static boolean containsDataSource(String dataSourceId) { + + return dataSourceIds.contains( dataSourceId ); + + } + +} diff --git a/src/main/java/com/chenxuan/config/CookieConfig.java b/src/main/java/com/chenxuan/config/CookieConfig.java new file mode 100644 index 0000000..8a3b93f --- /dev/null +++ b/src/main/java/com/chenxuan/config/CookieConfig.java @@ -0,0 +1,28 @@ +package com.chenxuan.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.servlet.ServletContext; +import javax.servlet.ServletException; + +@Configuration +public class CookieConfig { + /** + * 在配置文件配置APP.NAME参数即可 + */ + @Value("${APP.NAME}") + private String appName; + + @Bean + public ServletContextInitializer servletContextInitializer() { + return new ServletContextInitializer() { + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + servletContext.getSessionCookieConfig().setName(appName); + } + }; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/config/RestTemplateConfig.java b/src/main/java/com/chenxuan/config/RestTemplateConfig.java new file mode 100644 index 0000000..04ac686 --- /dev/null +++ b/src/main/java/com/chenxuan/config/RestTemplateConfig.java @@ -0,0 +1,29 @@ +package com.chenxuan.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + //最好是用不注释的方法,在注入的同时设置连接时间,这种注释的也可以,但是没有设置超时时间 + /*@Bean + public RestTemplate restTemplate(RestTemplateBuilder builder){ + return builder.build(); + }*/ + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory){ + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(5000);//单位为ms + factory.setConnectTimeout(5000);//单位为ms + return factory; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/constants/BusiUrlConstants.java b/src/main/java/com/chenxuan/constants/BusiUrlConstants.java new file mode 100644 index 0000000..a25dc43 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/BusiUrlConstants.java @@ -0,0 +1,79 @@ +package com.chenxuan.constants; + +/** + * 系统路径 + * @author Jordan_Li + * + */ +public class BusiUrlConstants { + + public static final String HEADER = ""; + + public static final String IS_DELETE = "0"; + + //主变信息 + public static final String BUSI_MAIN_DEVICE = HEADER + "busiMainDeviceController"; + + //主变装置信息 + public static final String BUSI_SUB_DEVICE = HEADER + "busiSubDeviceController"; + + //原副边电流电压实时数据配置 + public static final String BUSI_TRANSFORMER_CONF = HEADER + "busiTransformerConfController"; + + //控制参数设置 + public static final String BUSI_CONTROL_CONFIG = HEADER + "busiControlConfigController"; + + //振动装置阈值配置 + public static final String BUSI_AMPLI_THRESHOLD_CONF = HEADER + "busiAmpliThresholdConfController"; + + //中心点电流阈值配置 + public static final String BUSI_CENTER_THRESHOLD_CONF = HEADER + "busiCenterThresholdConfController"; + + //噪声装置阈值配置 + public static final String BUSI_NOISE_THRESHOLD_CONF = HEADER + "busiNoiseThresholdConfController"; + + //振动装置-频率定义 + public static final String BUSI_FREQUENCY_CONF = HEADER + "busiFrequencyConfController"; + + //振动装置-日增长率 + public static final String BUSI_AMPLI_DAY_INCREASE = HEADER + "busiAmpliDayIncreaseController"; + + //原副边电流电压实时数据 + public static final String BUSI_TRANSFORMER_REAL = HEADER + "busiTransformerRealController"; + + //中心点实时数据 + public static final String BUSI_CENTER_REAL = HEADER + "busiCenterRealController"; + + //噪声实时数据 + public static final String BUSI_NOISE_REAL = HEADER + "busiNoiseRealController"; + + //振动实时数据 + public static final String BUSI_SHOCK_REAL = HEADER + "busiShockRealController"; + + //告警信息 + public static final String BUSI_WARNING = HEADER + "busiWarningController"; + + //通信参数设置 + public static final String BUSI_COMMUNICATION_PARAMETERS = HEADER + "busiCommunicationParametersController"; + + //评估页面 + public static final String BUSI_CALC_PARAM_CONF = HEADER + "busiCalcParamConfController"; + + //评估页面 + public static final String BUSI_DEVICE_CALIBRATION = HEADER + "busiDeviceCalibrationContorller"; + + //装置特殊展示页面 + public static final String BUSI_DEVICE_SPECIAL_SHOW = HEADER + "busiDeviceSpecialShowContorller"; + + //远程登录 + public static final String REMOTE_LOGIN = HEADER + "sysLoginRemoteController"; + + //远程新增用户 + public static final String REMOTE_USER = HEADER + "userRemote"; + + //IED信息 + public static final String BUSI_IED = HEADER + "iedController"; + + //IED参数绑定 + public static final String BUSI_PARAM_BIND = HEADER + "busiParamBindController"; +} diff --git a/src/main/java/com/chenxuan/constants/Constants.java b/src/main/java/com/chenxuan/constants/Constants.java new file mode 100644 index 0000000..9c4f797 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/Constants.java @@ -0,0 +1,103 @@ +package com.chenxuan.constants; + +import io.jsonwebtoken.Claims; + + +/** + * @ClassName:Constants + * @Description: 通用常量信息 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:21 PM + * @Version V1.0 + */ +public class Constants { + /** + * UTF-8 字符集 + */ + public static final String UTF8 = "UTF-8"; + + /** + * 通用成功标识 + */ + public static final String SUCCESS = "0"; + + /** + * 通用失败标识 + */ + public static final String FAIL = "1"; + + /** + * 登录成功 + */ + public static final String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + public static final String LOGOUT = "Logout"; + + /** + * 登录失败 + */ + public static final String LOGIN_FAIL = "Error"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 验证码有效期(分钟) + */ + public static final Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + public static final String TOKEN = "token"; + + /** + * 令牌前缀 + */ + public static final String TOKEN_PREFIX = "Bearer "; + + /** + * 令牌前缀 + */ + public static final String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + public static final String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + public static final String JWT_USERNAME = Claims.SUBJECT; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; + + /** + * 资源映射路径 前缀 + */ + public static final String RESOURCE_PREFIX = "/profile"; +} diff --git a/src/main/java/com/chenxuan/constants/ExcelUtils.java b/src/main/java/com/chenxuan/constants/ExcelUtils.java new file mode 100644 index 0000000..4c47dc9 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/ExcelUtils.java @@ -0,0 +1,490 @@ +package com.chenxuan.constants; + +import org.apache.poi.hssf.usermodel.*; +import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFSheet; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + * excel util + * @author Jordan_Li + * + */ +public class ExcelUtils { + public static final String OFFICE_EXCEL_2003_POSTFIX = "xls"; + public static final String OFFICE_EXCEL_2010_POSTFIX = "xlsx"; + public static final String EMPTY = ""; + public static final String POINT = "."; + public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); + + /** + * get path suffix + * + * @param path + * @return + */ + public static String getPostfix(String path) { + if (path == null || EMPTY.equals(path.trim())) { + return EMPTY; + } + if (path.contains(POINT)) { + return path.substring(path.lastIndexOf(POINT) + 1, path.length()); + } + return EMPTY; + } + + /** + * cell style + * + * @param hssfCell + * @return + */ + @SuppressWarnings({ "static-access" }) + public static String getHValue(HSSFCell hssfCell) { + if (hssfCell.getCellType() == hssfCell.CELL_TYPE_BOOLEAN) { + return String.valueOf(hssfCell.getBooleanCellValue()); + } else if (hssfCell.getCellType() == hssfCell.CELL_TYPE_NUMERIC) { + String cellValue = ""; + if (HSSFDateUtil.isCellDateFormatted(hssfCell)) { + Date date = HSSFDateUtil.getJavaDate(hssfCell.getNumericCellValue()); + cellValue = sdf.format(date); + } else { + DecimalFormat df = new DecimalFormat("#.##"); + cellValue = df.format(hssfCell.getNumericCellValue()); + String strArr = cellValue.substring(cellValue.lastIndexOf(POINT) + 1, cellValue.length()); + if (strArr.equals("00")) { + cellValue = cellValue.substring(0, cellValue.lastIndexOf(POINT)); + } + } + return cellValue; + } else { + return String.valueOf(hssfCell.getStringCellValue()); + } + } + + /** + * cell style + * + * @param xssfCell + * @return + */ + public static String getXValue(XSSFCell xssfCell) { + if (xssfCell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { + return String.valueOf(xssfCell.getBooleanCellValue()); + } else if (xssfCell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + String cellValue = ""; + if (DateUtil.isCellDateFormatted(xssfCell)) { + Date date = DateUtil.getJavaDate(xssfCell.getNumericCellValue()); + cellValue = sdf.format(date); + } else { + DecimalFormat df = new DecimalFormat("#.##"); + cellValue = df.format(xssfCell.getNumericCellValue()); + String strArr = cellValue.substring(cellValue.lastIndexOf(POINT) + 1, cellValue.length()); + if (strArr.equals("00")) { + cellValue = cellValue.substring(0, cellValue.lastIndexOf(POINT)); + } + } + return cellValue; + } else { + return String.valueOf(xssfCell.getStringCellValue()); + } + } + + /** + * create row data + * + * @param currentRow + * + * @param textList + * + */ + public static void creatRow(HSSFRow currentRow, String[] textList) { + if (textList != null && textList.length > 0) { + int i = 0; + for (String cellValue : textList) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellValue(cellValue); + } + } + } + + public static void creatborderRow(HSSFWorkbook hwb, HSSFRow currentRow, + String[] textList, HSSFCellStyle unLock, HSSFCellStyle locked) { + if (textList != null && textList.length > 0) { + int i = 0; + for (String cellValue : textList) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellValue(cellValue); + } + } + } + + public static void creatRow(HSSFRow currentRow, Object[] textList) { + if (textList != null && textList.length > 0) { + int i = 0; + for (Object cellValue : textList) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellValue(cellValue.toString()); + } + } + } + + public static void creatFlexibleRow(HSSFRow currentRow, String[] textList, + int beginNum, int endNum) { + if (textList != null && textList.length > 0) { + int i = 0; + for (int j = beginNum; j < textList.length - endNum; j++) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellValue(textList[j]); + } + } + } + + public static void creatFlexibleRow(HSSFRow currentRow, Object[] textList, + int beginNum, int endNum) { + if (textList != null && textList.length > 0) { + int i = 0; + for (int j = beginNum; j < textList.length - endNum; j++) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellValue(textList[j].toString()); + } + } + } + + public static void creatFlexibleRow(HSSFRow currentRow, Object[] textList, + int beginNum, int endNum, int CellNum, String CellValue) { + if (textList != null && textList.length > 0) { + HSSFCell userNameLableCellT = currentRow.createCell(0); + userNameLableCellT.setCellValue(CellValue); + for (int j = beginNum; j < textList.length - endNum; j++) { + HSSFCell userNameLableCell = currentRow.createCell(CellNum++); + userNameLableCell.setCellValue(textList[j].toString()); + } + } + } + + /** + * create row data with style + * + * @param currentRow + * @param textList + */ + public static void creatStyleRow(HSSFRow currentRow, String[] textList, + HSSFWorkbook workbook) { + HSSFCellStyle style = workbook.createCellStyle(); + /*style.setAlignment(HSSFCellStyle.ALIGN_CENTER); + style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); + style.setFillForegroundColor(HSSFColor.LAVENDER.index); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); + style.setBorderBottom(HSSFCellStyle.BORDER_DOTTED); + style.setBorderLeft(HSSFCellStyle.BORDER_DOTTED); + style.setBorderRight(HSSFCellStyle.BORDER_THIN); + style.setBorderTop(HSSFCellStyle.BORDER_THIN);*/ + HSSFFont font = workbook.createFont(); + font.setFontName("Verdana"); + font.setColor(HSSFColor.BLUE.index); + style.setFont(font); + + if (textList != null && textList.length > 0) { + int i = 0; + for (String cellValue : textList) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellStyle(style); + userNameLableCell.setCellValue(cellValue); + } + } + } + + /** + * create row data with no color + * + * @param currentRow + * @param textList + */ + public static void creatNoColorRow(Row currentRow, String[] textList, + Workbook workbook) { + if (textList != null && textList.length > 0) { + int i = 0; + for (String cellValue : textList) { + Cell userNameLableCell = currentRow.createCell(i++); + currentRow.setHeightInPoints(20); + userNameLableCell.setCellValue(cellValue); + } + } + } + + /** + * data valid list + * @param selectTextList + * @param naturalRowIndex + * @param naturalColumnIndex + * @return + */ + public static DataValidation getDataValidationList(String[] selectTextList, + int naturalRowIndex, int naturalColumnIndex) { + DVConstraint constraint = DVConstraint + .createExplicitListConstraint(selectTextList); + int firstRow = naturalRowIndex - 1; + int lastRow = naturalRowIndex - 1; + int firstCol = naturalColumnIndex - 1; + int lastCol = naturalColumnIndex - 1; + CellRangeAddressList regions = new CellRangeAddressList(firstRow, + lastRow, firstCol, lastCol); + DataValidation data_validation_list = new HSSFDataValidation(regions, + constraint); + return data_validation_list; + } + + /** + * data valid list + * + * @param formulaString + * @param naturalRowIndex + * @param naturalColumnIndex + * @return + */ + public static DataValidation getDataValidationByFormula( + String formulaString, int naturalRowIndex, int naturalColumnIndex) { + DVConstraint constraint = DVConstraint + .createFormulaListConstraint(formulaString); + int firstRow = naturalRowIndex - 1; + int lastRow = naturalRowIndex - 1; + int firstCol = naturalColumnIndex - 1; + int lastCol = naturalColumnIndex - 1; + CellRangeAddressList regions = new CellRangeAddressList(firstRow, + lastRow, firstCol, lastCol); + DataValidation data_validation_list = new HSSFDataValidation(regions, + constraint); + return data_validation_list; + + } + + /** + * create excel name + * @param workbook + * + * @param fistMenuList + * + * @param secondMenuList + */ + public static void creatExcelNameList(HSSFWorkbook workbook, + String[] fistMenuList, List secondMenuList, + String hideSheetName, String workForm) { + Name name; + name = workbook.createName(); + name.setNameName(workForm); + if (fistMenuList.length > 0) { + name.setRefersToFormula(hideSheetName + "!$A$1:$" + + intToExcelIndex(fistMenuList.length) + "$1"); + } + if (null != secondMenuList && secondMenuList.size() > 0) { + for (int i = 0; i < secondMenuList.size(); i++) { + String[] secondMenu = (String[]) secondMenuList.get(i); + name = workbook.createName(); + name.setNameName(secondMenu[0]); + if (secondMenu.length > 0) { + name.setRefersToFormula(hideSheetName + "!$B$" + (2 + i) + + ":$" + intToExcelIndex(secondMenu.length) + "$" + + (2 + i) + ""); + + } + } + } + } + + /** + * set workbook style + * + * @param workbook + * @date 2016-8-3 14:55:33 + * @author mary_ma + */ + public static void setCellStyle(Workbook workbook) { + CellStyle headstyle = workbook.createCellStyle(); + //居中 + headstyle.setAlignment(HorizontalAlignment.CENTER); + //垂直 + headstyle.setVerticalAlignment(VerticalAlignment.CENTER); + headstyle.setWrapText(true); + + Font headfont = workbook.createFont(); + headfont.setFontName("新宋体"); + headfont.setFontHeightInPoints((short)13); + //headfont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + headstyle.setFont(headfont); + } + + public static void titleStyle(Workbook wb, Row currentRow, XSSFSheet sheet, String name, int lastCol) { + //标题样式 + XSSFCellStyle titleStyle = (XSSFCellStyle) wb.createCellStyle(); + //居中 + titleStyle.setAlignment(HorizontalAlignment.CENTER); + //垂直 + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); + Font ztFont = wb.createFont(); + // 设置字体为斜体字 + ztFont.setItalic(false); + //将字体大小设置为18px + ztFont.setFontHeightInPoints((short)18); + //将“宋体”字体应用到当前单元格上 + ztFont.setFontName("宋体"); + //字体加粗 + ztFont.setBold(true); + titleStyle.setFont(ztFont); + // 创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个 + Cell cell = currentRow.createCell(0); + // 合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列 + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, lastCol)); + // 设置单元格内容 + cell.setCellValue(name); + cell.setCellStyle(titleStyle); + } + + /** + * generation hide sheet + * + * @param workbook + * @param hideSheetName + * @param firstMenuList + * @param secondMenuList + */ + public static void creatHideSheet(HSSFWorkbook workbook, + String hideSheetName, String[] firstMenuList, + List secondMenuList) { + HSSFSheet hideselectinfosheet = workbook.createSheet(hideSheetName); + HSSFRow firstMenuRow = hideselectinfosheet.createRow(0); + creatRow(firstMenuRow, firstMenuList); + if (null != secondMenuList && secondMenuList.size() > 0) { + for (int i = 0; i < secondMenuList.size(); i++) { + String[] secondMenu = (String[]) secondMenuList.get(i); + HSSFRow secondMenuRow = hideselectinfosheet.createRow(i + 1); + creatRow(secondMenuRow, secondMenu); + } + } + workbook.setSheetHidden(workbook.getSheetIndex(hideSheetName), true); + } + + /** + * generation cascading drop-down menu + * + * @param userinfosheet1 + * @param naturalRowIndex + */ + public static void creatAppRow(HSSFSheet userinfosheet1, + int naturalRowIndex, int firstMenuIndex, int secondMenuIndex, + String workForm) { + DataValidation data_validation_list = getDataValidationByFormula(workForm, naturalRowIndex, + firstMenuIndex); + userinfosheet1.addValidationData(data_validation_list); + DataValidation data_validation_list2 = getDataValidationByFormula("INDIRECT($" + + intToExcelIndex(firstMenuIndex) + "" + + naturalRowIndex + ")", naturalRowIndex, + secondMenuIndex); + userinfosheet1.addValidationData(data_validation_list2); + } + + /** + * generation non-cascading drop-down menu + * + * @param userinfosheet1 + * @param selectTextList + * @param naturalColumnIndex + */ + public static void creatAloneRow(HSSFSheet userinfosheet1, + String[] selectTextList, int firstRow, int lastRow, + int naturalColumnIndex) { + DVConstraint constraint = DVConstraint + .createExplicitListConstraint(selectTextList); + int firstCol = naturalColumnIndex - 1; + int lastCol = naturalColumnIndex - 1; + CellRangeAddressList regions = new CellRangeAddressList(firstRow, + lastRow, firstCol, lastCol); + DataValidation data_validation_list = new HSSFDataValidation(regions, + constraint); + userinfosheet1.addValidationData(data_validation_list); + } + + /** + * alphabet convert to number + * @param i + * + * @return + */ + private static String intToExcelIndex(int i) { + String s = ""; + + int m = i % 26; + i = i / 26; + while (i != 0 || m != 0) { + if (m == 0) { + i--; + m = 26; + } + s = (char) (m + (char) ('A') - 1) + s; + + m = i % 26; + i = i / 26; + } + + return s; + } + + /** + * hide row + * + * @param currentRow + * @param textList + * @param workbook + */ + public static void creatHidenRow(HSSFRow currentRow, String[] textList, + HSSFWorkbook workbook, boolean isLock) { + HSSFCellStyle style = workbook.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setLocked(isLock); + + if (textList != null && textList.length > 0) { + int i = 0; + for (String cellValue : textList) { + HSSFCell userNameLableCell = currentRow.createCell(i++); + userNameLableCell.setCellStyle(style); + userNameLableCell.setCellValue(cellValue); + } + currentRow.setZeroHeight(true); + } + + } + + /** + * get style + * @param workbook + * @param isLock + * @return + */ + public static HSSFCellStyle getStyle(HSSFWorkbook workbook, boolean isLock) { + HSSFCellStyle headStyle = workbook.createCellStyle(); +// headStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); +// headStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); +// headStyle.setFillForegroundColor(HSSFColor.LIGHT_TURQUOISE.index); +// headStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); +// headStyle.setBorderBottom(HSSFCellStyle.BORDER_DOTTED); +// headStyle.setBorderLeft(HSSFCellStyle.BORDER_DOTTED); +// headStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); +// headStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); + headStyle.setLocked(isLock); + headStyle.setWrapText(true); + return headStyle; + } + + +} diff --git a/src/main/java/com/chenxuan/constants/GenerateUtil.java b/src/main/java/com/chenxuan/constants/GenerateUtil.java new file mode 100644 index 0000000..c0295ad --- /dev/null +++ b/src/main/java/com/chenxuan/constants/GenerateUtil.java @@ -0,0 +1,21 @@ +package com.chenxuan.constants; + +import java.util.Random; + +/** + * 主变生成systemCode + * @author Jordan_Li + * + */ +public class GenerateUtil { + + public static String generateCode(int length) { + String ALLCHAR2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + StringBuffer sb = new StringBuffer(); + Random random = new Random(); + for (int i = 0; i < length; i++) { + sb.append(ALLCHAR2.charAt(random.nextInt(ALLCHAR2.length()))); + } + return sb.toString(); + } +} diff --git a/src/main/java/com/chenxuan/constants/HttpStatusCode.java b/src/main/java/com/chenxuan/constants/HttpStatusCode.java new file mode 100644 index 0000000..670c256 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/HttpStatusCode.java @@ -0,0 +1,106 @@ +package com.chenxuan.constants; + + +/** + * + * @Description: 返回状态码 + * + * @Author: Arno_Fu + * + * @Since: 11/26/2019 11:21 AM + * + * @Version: 1.0.0 + + **/ +public interface HttpStatusCode +{ + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + + /** + * 对象创建成功 + */ + public static final int CREATED = 201; + + /** + * 请求已经被接受 + */ + public static final int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + public static final int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + public static final int MOVED_PERM = 301; + + /** + * 重定向 + */ + public static final int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + public static final int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + public static final int BAD_REQUEST = 400; + + /** + * 未授权 + */ + public static final int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + public static final int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + public static final int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + public static final int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + public static final int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + public static final int ERROR = 500; + + /** + * 接口未实现 + */ + public static final int NOT_IMPLEMENTED = 501; + + /** + * token无效 + */ + public static final int TOKEN_INVALID= 601; + + /** + * 暂无数据 + */ + public static final int NO_DATA = 10000; +} diff --git a/src/main/java/com/chenxuan/constants/MD5Utils.java b/src/main/java/com/chenxuan/constants/MD5Utils.java new file mode 100644 index 0000000..48bfda5 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/MD5Utils.java @@ -0,0 +1,69 @@ +package com.chenxuan.constants; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +/** + * 加密 + * @author Jordan_Li + * + */ +public class MD5Utils { + + /*public static String stringToMD5(String plainText) { + byte[] secretBytes = null; + try { + secretBytes = MessageDigest.getInstance("md5").digest( + plainText.getBytes()); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException("没有这个md5算法!"); + } + String md5code = new BigInteger(1, secretBytes).toString(16); + for (int i = 0; i < 32 - md5code.length(); i++) { + md5code = "0" + md5code; + } + return md5code; + }*/ + /** + * MD5加码 生成32位md5码       + */ + public static String string2MD5(String inStr) { + MessageDigest md5 = null; + try { + md5 = MessageDigest.getInstance("MD5"); + } catch (Exception e) { + System.out.println(e.toString()); + e.printStackTrace(); + return ""; + } + char[] charArray = inStr.toCharArray(); + byte[] byteArray = new byte[charArray.length]; + + for (int i = 0; i < charArray.length; i++) + byteArray[i] = (byte) charArray[i]; + byte[] md5Bytes = md5.digest(byteArray); + StringBuffer hexValue = new StringBuffer(); + for (int i = 0; i < md5Bytes.length; i++) { + int val = ((int) md5Bytes[i]) & 0xff; + if (val < 16) + hexValue.append("0"); + hexValue.append(Integer.toHexString(val)); + } + return hexValue.toString(); + + } + + /** + * 加密解密算法 执行一次加密,两次解密  + */ + public static String convertMD5(String inStr) { + char[] a = inStr.toCharArray(); + for (int i = 0; i < a.length; i++) { + a[i] = (char) (a[i] ^ 't'); + } + String s = new String(a); + return s; + + } + +} diff --git a/src/main/java/com/chenxuan/constants/UserStatus.java b/src/main/java/com/chenxuan/constants/UserStatus.java new file mode 100644 index 0000000..11c92bc --- /dev/null +++ b/src/main/java/com/chenxuan/constants/UserStatus.java @@ -0,0 +1,34 @@ +package com.chenxuan.constants; + + +/** + * @ClassName:UserStatus + * @Description: 用户状态 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:48 PM + * @Version V1.0 + */ + +public enum UserStatus +{ + OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); + + private final String code; + private final String info; + + UserStatus(String code, String info) + { + this.code = code; + this.info = info; + } + + public String getCode() + { + return code; + } + + public String getInfo() + { + return info; + } +} diff --git a/src/main/java/com/chenxuan/constants/UuidUtils.java b/src/main/java/com/chenxuan/constants/UuidUtils.java new file mode 100644 index 0000000..ed17f20 --- /dev/null +++ b/src/main/java/com/chenxuan/constants/UuidUtils.java @@ -0,0 +1,16 @@ +package com.chenxuan.constants; + + +import java.util.UUID; + +/** + * Uuid Utils + * @author Jordan_Li + * + */ +public class UuidUtils { + + public static String getUUID() { + return UUID.randomUUID().toString().replace("-", ""); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiAmpliDayIncreaseController.java b/src/main/java/com/chenxuan/controller/BusiAmpliDayIncreaseController.java new file mode 100644 index 0000000..ba9e2b5 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiAmpliDayIncreaseController.java @@ -0,0 +1,87 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiAmpliDayIncrease; +import com.chenxuan.entity.vo.BusiAmpliDayIncreaseVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiAmpliDayIncreaseService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "振动装置日增长率") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_AMPLI_DAY_INCREASE) +public class BusiAmpliDayIncreaseController extends BaseController { + + @Autowired + private BusiAmpliDayIncreaseService busiAmpliDayIncreaseService; + + + /** + * @Description: 获取振动装置日增长率列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取振动装置日增长率列表") + @PostMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiAmpliDayIncreaseService.page( queryParam ); + return AjaxResult.success( page ); + } + + /** + * 新增振动装置日增长率信息 + */ + @ApiOperation(value = "新增振动装置日增长率信息") + @LogAnnotation(module = "振动装置日增长率", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiAmpliDayIncrease busiAmpliDayIncrease) { + return returnAjax( busiAmpliDayIncreaseService.insertAmpliDayIncrease( busiAmpliDayIncrease ) ); + + } + + /** + * 修改振动装置日增长率信息 + */ + @ApiOperation(value = "修改振动装置日增长率信息") + @LogAnnotation(module = "振动装置日增长率", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiAmpliDayIncrease busiAmpliDayIncrease) { + return returnAjax( busiAmpliDayIncreaseService.updateAmpliDayIncrease( busiAmpliDayIncrease ) ); + } + + /** + * 根据主变id加载其振动装置日增长率信息 + */ + @ApiOperation(value = "根据主变id加载其振动装置日增长率信息") + @GetMapping(value = "/getAmpliDayIncreaseByMainId/{mainId}") + public AjaxResult getAmpliDayIncreaseByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success( busiAmpliDayIncreaseService.selectAmpliDayIncreaseByMainId( mainId ) ); + } + + /** + * 根据id删除振动装置日增长率信息 + */ + @ApiOperation(value = "根据id删除振动装置日增长率信息") + @LogAnnotation(module = "振动装置日增长率", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete/{id}") + public AjaxResult delete(@RequestParam("id") String id) { + return returnAjax( busiAmpliDayIncreaseService.delete( id ) ); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiAmpliRealController.java b/src/main/java/com/chenxuan/controller/BusiAmpliRealController.java new file mode 100644 index 0000000..978db09 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiAmpliRealController.java @@ -0,0 +1,114 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiAmpliRealService; +import com.chenxuan.service.BusiExportDataService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api(tags = "振动实时数据") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_SHOCK_REAL) +public class BusiAmpliRealController extends BaseController { + + @Autowired + private BusiAmpliRealService busiAmpliRealService; + + @Autowired + private BusiExportDataService busiExportDataService; + + /** + * 新增振动实时数据信息 + */ + @ApiOperation(value = "新增振动实时数据信息") + @LogAnnotation(module = "振动实时数据", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiAmpliRealList) { + return returnAjax(busiAmpliRealService.insertShockReal(busiAmpliRealList)); + } + + /** + * 根据条件加载振动实时数据信息 + */ + @ApiOperation(value = "根据条件加载振动实时数据信息") + @PostMapping(value = "/getShockRealByMainId") + public AjaxResult getShockRealByMainId(@RequestBody BusiAmpliRealDto dto) { + return AjaxResult.success(busiAmpliRealService.selectShockRealByMainId(dto)); + } + + /** + * 根据主变id加载振动实时数据详细信息 + */ + @ApiOperation(value = "根据条件加载振动实时数据详细信息") + @PostMapping(value = "/getShockRealDetailsByCondition") + public AjaxResult getShockRealDetailsByCondition(@RequestBody BusiAmpliRealDto busiAmpliRealDto) { + return AjaxResult.success(busiAmpliRealService.getShockRealDetailsByCondition(busiAmpliRealDto)); + } + + /** + * 根据主变id以及对应装置信息加载振动装置振幅和频率谱图信息 + */ + @ApiOperation(value = "根据主变id以及对应装置信息加载振动装置振幅和频率谱图信息") + @PostMapping(value = "/queryShockRealChartByInfo") + public AjaxResult queryShockRealChartByInfo(@RequestBody BusiAmpliRealDto busiAmpliRealDto) { + return AjaxResult.success(busiAmpliRealService.getShockRealChartByInfo(busiAmpliRealDto)); + } + + /** + * 根据主变id以及对应装置信息加载振动装置振幅和频率三维图信息 + */ + @ApiOperation(value = "根据主变id以及对应装置信息加载振动装置振幅和频率三维图信息") + @PostMapping(value = "/getAmpliRealChart") + public AjaxResult getAmpliRealChart(@RequestBody BusiAmpliRealDto busiAmpliRealDto) { + return AjaxResult.success(busiAmpliRealService.getAmpliRealThreeChart(busiAmpliRealDto)); + } + + /** + * 三级界面重新计算接口 + */ + @ApiOperation(value = "三级界面重新计算接口") + @PostMapping(value = "/recountData") + public AjaxResult recountData(@RequestBody BusiAmpliRealDto busiAmpliRealDto) { + return AjaxResult.success(busiAmpliRealService.recount(busiAmpliRealDto)); + } + + /** + * 二级页面跳转详情加载三级页面 + */ + @ApiOperation(value = "二级页面跳转详情加载三级页面") + @PostMapping(value = "/showShockRealDetails") + public AjaxResult showShockRealDetails(@RequestBody BusiAmpliRealDto busiAmpliRealDto) { + return AjaxResult.success(busiAmpliRealService.loadingDetails(busiAmpliRealDto)); + } + + /** + * 导出震动实时数据三级界面列表信息Excel + */ + @ApiOperation(value = "导出震动实时数据三级界面列表信息Excel") + @PostMapping(value = "/exportShockRealDetailsPage") + public AjaxResult exportShockRealDetailsPage(@RequestBody BusiAmpliRealDto dto) { + return busiExportDataService.exportShockRealDetails(dto); + } + + /** + * 导出传感器实时数据 + */ + @ApiOperation(value = "导出传感器实时数据") + @PostMapping(value = "/exportAmpliRealByCondition") + public AjaxResult exportAmpliRealByCondition(@RequestBody BusiAmpliRealDto dto) { + return busiExportDataService.exportAmpliReal(dto); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiAmpliThresholdConfController.java b/src/main/java/com/chenxuan/controller/BusiAmpliThresholdConfController.java new file mode 100644 index 0000000..a83e1be --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiAmpliThresholdConfController.java @@ -0,0 +1,90 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.dto.BusiAmpliThresholdConfDto; +import com.chenxuan.entity.model.BusiAmpliThresholdConf; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfNewVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiAmpliThresholdConfService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api(tags = "振动装置阈值配置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_AMPLI_THRESHOLD_CONF) +public class BusiAmpliThresholdConfController extends BaseController { + + @Autowired + private BusiAmpliThresholdConfService busiAmpliThresholdConfService; + + /** + * @Description: 获取振动装置阈值配置列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取振动装置阈值配置列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiAmpliThresholdConfDto dto) { + Page page = busiAmpliThresholdConfService.page(dto); + return AjaxResult.success(page); + } + + /** + * 新增振动装置阈值配置信息 + */ + @ApiOperation(value = "新增振动装置阈值配置信息") + @LogAnnotation(module = "振动装置阈值配置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiAmpliThresholdConfList) { + return returnAjax(busiAmpliThresholdConfService.insertThresholdConf(busiAmpliThresholdConfList)); + } + + /** + * 修改振动装置阈值配置信息 + */ + @ApiOperation(value = "修改振动装置阈值配置信息") + @LogAnnotation(module = "振动装置阈值配置", operateType = OperateType.UPDATE) + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody BusiAmpliThresholdConfNewVo busiAmpliThresholdConfNewVo) { + boolean b = busiAmpliThresholdConfService.updateThresholdConf(busiAmpliThresholdConfNewVo); + if (!b) { + return new AjaxResult(HttpStatusCode.ERROR, "主变有未配置的装置"); + } + return returnAjax(b); + } + + /** + * 根据主变id加载振动装置阈值配置信息 + */ + @ApiOperation(value = "根据主变id加载振动装置阈值配置信息") + @GetMapping(value = "/getAmpliThresholdConfByMainId/{mainId}") + public AjaxResult getAmpliThresholdConfByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiAmpliThresholdConfService.selectThresholdConfByMainId(mainId)); + } + + /** + * 根据振动装置阈值配置id删除其配置信息 + */ + @ApiOperation(value = "根据振动装置阈值配置id删除其配置信息") + @LogAnnotation(module = "振动装置阈值配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete/{id}") + public AjaxResult delete(@RequestParam("id") String id) { + return returnAjax(busiAmpliThresholdConfService.delete(id)); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiCalcParamConfController.java b/src/main/java/com/chenxuan/controller/BusiCalcParamConfController.java new file mode 100644 index 0000000..6658466 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiCalcParamConfController.java @@ -0,0 +1,53 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiCalcParamConfDto; +import com.chenxuan.entity.vo.BusiCalcParamConfVo; +import com.chenxuan.service.BusiCalcParamConfService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * @author Carrey Zheng + * @create 2020-06-28 8:10 PM + **/ +@Api(tags = "评估页面") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_CALC_PARAM_CONF) +public class BusiCalcParamConfController { + + @Autowired + private BusiCalcParamConfService busiParamGisService; + + /** + * 评估参数列表 + * + * @param mainEquipmentId + * @return + */ + @ApiOperation(value = "列表查询") + @GetMapping(value = "/list/{mainId}", produces = {"application/json;charset=utf-8"}) + public Map queryList(@PathVariable("mainId") String mainEquipmentId) { + List busiParamGis = busiParamGisService.findBusiParamGis(mainEquipmentId); + return AjaxResult.success(busiParamGis); + } + + /** + * 评估参数提交 + * + * @param busiParams + * @return + */ + @ApiOperation(value = "参数提交") + @PostMapping(value = "/save") + public AjaxResult saveBusiSite(@RequestBody List busiParams) { + return busiParamGisService.saveBusiParamGis(busiParams); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiCenterRealController.java b/src/main/java/com/chenxuan/controller/BusiCenterRealController.java new file mode 100644 index 0000000..8e61277 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiCenterRealController.java @@ -0,0 +1,97 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.model.BusiCenterReal; +import com.chenxuan.entity.vo.BusiCenterRealDetailsVo; +import com.chenxuan.entity.vo.BusiCenterRealVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiCenterRealService; +import com.chenxuan.service.BusiExportDataService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = "中心点实时数据") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_CENTER_REAL) +public class BusiCenterRealController extends BaseController { + + @Autowired + private BusiCenterRealService busiCenterRealService; + + @Autowired + private BusiExportDataService busiExportDataService; + + /** + * 新增中心点实时数据信息 + */ + @ApiOperation(value = "新增中心点实时数据信息") + @LogAnnotation(module = "中心点实时数据", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiCenterRealList) { + return returnAjax(busiCenterRealService.insertCenterReal(busiCenterRealList)); + } + + /** + * 根据主变id加载中心点实时数据信息 + */ + @ApiOperation(value = "根据主变id加载中心点实时数据信息") + @GetMapping(value = "/getCenterRealByMainId/{mainId}") + public AjaxResult getCenterRealByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiCenterRealService.selectCenterRealByMainId(mainId)); + } + + /** + * 根据主变id及当天时间加载中心点谱图信息 + */ + @ApiOperation(value = "根据主变id及当天时间加载中心点谱图信息") + @PostMapping(value = "/queryCenterRealChartByInfo") + public AjaxResult queryCenterRealChartByInfo(@RequestBody BusiCenterRealDto busiCenterRealDto) { + return AjaxResult.success(busiCenterRealService.findCenterRealChartByInfo(busiCenterRealDto)); + } + + /** + * 根据主变id和时间加载中心点实时数据信息 + */ + @ApiOperation(value = "根据主变id和时间加载中心点实时数据信息") + @PostMapping(value = "/getCenterRealByMainIdAndCreateTime") + public AjaxResult getCenterRealByMainIdAndCreateTime(@RequestBody BusiCenterRealVo busiCenterRealVo) { + return AjaxResult.success(busiCenterRealService.selectCenterRealByMainIdAndCreateTime(busiCenterRealVo)); + } + + /** + * 根据主变id加载中心点实时数据详细信息 + */ + @ApiOperation(value = "根据主变id加载中心点实时数据详细信息") + @PostMapping(value = "/getCenterRealDetailsByMainId") + public AjaxResult getCenterRealDetailsByMainId(@RequestBody BusiCenterRealDto dto) { + Page centerRealDetailsByMainId = busiCenterRealService.getCenterRealDetailsByMainId(dto); + return AjaxResult.success(centerRealDetailsByMainId); + } + + /** + * 导出中心点实时数据详细信息Excel + */ + @ApiOperation(value = "导出中心点实时数据详细信息Excel") + @PostMapping(value = "/exportCenterRealDetails") + public AjaxResult exportCenterRealDetails(@RequestBody BusiCenterRealDto dto) { + return busiExportDataService.exportCenterRealDetails(dto); + } + + /** + * 导出中心点实时数据 + */ + @ApiOperation(value = "导出中心点实时数据") + @PostMapping(value = "/exportCenterRealByMainId") + public AjaxResult exportCenterRealByMainId(@RequestBody BusiCenterRealDto dto) { + return busiExportDataService.exportCenterReal(dto); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiCenterThresholdConfController.java b/src/main/java/com/chenxuan/controller/BusiCenterThresholdConfController.java new file mode 100644 index 0000000..4d74b3e --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiCenterThresholdConfController.java @@ -0,0 +1,87 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiCenterThresholdConfDto; +import com.chenxuan.entity.model.BusiCenterThresholdConf; +import com.chenxuan.entity.vo.BusiCenterThresholdConfVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiCenterThresholdConfService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "中心点电流阈值配置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_CENTER_THRESHOLD_CONF) +public class BusiCenterThresholdConfController extends BaseController { + + @Autowired + private BusiCenterThresholdConfService busiCenterThresholdConfService; + + /** + * @Description: 获取中心点电流阈值配置列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取中心点电流阈值配置列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiCenterThresholdConfDto busiCenterThresholdConfDto) { + Page page = busiCenterThresholdConfService.page(busiCenterThresholdConfDto); + return AjaxResult.success(page); + } + + /** + * 新增中心点电流阈值配置信息 + */ + @ApiOperation(value = "新增中心点电流阈值配置信息") + @LogAnnotation(module = "中心点电流阈值配置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiCenterThresholdConf busiCenterThresholdConf) { + return busiCenterThresholdConfService.insertThresholdConf(busiCenterThresholdConf); + } + + /** + * 修改中心点电流阈值配置信息 + */ + @ApiOperation(value = "修改中心点电流阈值配置信息") + @LogAnnotation(module = "中心点电流阈值配置", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiCenterThresholdConf busiCenterThresholdConf) { + return busiCenterThresholdConfService.updateThresholdConf(busiCenterThresholdConf); + } + + /** + * 根据主变id加载中心点电流阈值配置信息 + */ + @ApiOperation(value = "根据主变id加载中心点电流阈值配置信息") + @GetMapping(value = "/getCenterThresholdConfByMainId/{mainId}") + public AjaxResult getCenterThresholdConfByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiCenterThresholdConfService.selectCenterThresholdConfByMainId(mainId)); + } + + /** + * 根据主变id删除中心点电流阈值配置信息 + */ + @ApiOperation(value = "根据主变id删除中心点电流阈值配置信息") + @LogAnnotation(module = "中心点电流阈值配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/deleteByMainId/{mainId}") + public AjaxResult remove(@RequestParam("mainId") String mainId) { + return returnAjax(busiCenterThresholdConfService.deleteThresholdConfByMainId(mainId)); + } + + /** + * 根据中心点电流阈值配置id删除其配置信息 + */ + @ApiOperation(value = "根据中心点电流阈值配置id删除其配置信息") + @LogAnnotation(module = "中心点电流阈值配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult delete(@RequestParam("id") String id) { + return returnAjax(busiCenterThresholdConfService.delete(id)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiCommunicationParametersController.java b/src/main/java/com/chenxuan/controller/BusiCommunicationParametersController.java new file mode 100644 index 0000000..b5f0c2a --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiCommunicationParametersController.java @@ -0,0 +1,90 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiCommunicationParameters; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiCommunicationParametersService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "通信参数设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_COMMUNICATION_PARAMETERS) +public class BusiCommunicationParametersController extends BaseController { + + @Autowired + private BusiCommunicationParametersService busiCommunicationParametersService; + + /** + * @Description: 获取通信参数信息列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "分页查询通信参数列表") + @PostMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiCommunicationParametersService.page(queryParam); + return AjaxResult.success(page); + } + + /** + * 新增通信参数信息 + */ + @ApiOperation(value = "新增通信参数信息") +// @LogAnnotation(module = "通信参数设置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiCommunicationParameters busiCommunicationParameters) { + return returnAjax(busiCommunicationParametersService.insertBusiCommunicationParameters(busiCommunicationParameters)); + } + + /** + * 修改通信参数信息 + */ + @ApiOperation(value = "修改通信参数信息") + @LogAnnotation(module = "通信参数设置", operateType = OperateType.UPDATE) + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody BusiCommunicationParameters busiCommunicationParameters) { + return returnAjax(busiCommunicationParametersService.updateBusiCommunicationParameters(busiCommunicationParameters)); + } + + /** + * 根据id加载通信参数信息 + */ + @ApiOperation(value = "根据id加载通信参数信息") + @GetMapping(value = "/getBusiCommunicationParametersById/{id}") + public AjaxResult getBusiCommunicationParametersById(@PathVariable("id") String id) { + return AjaxResult.success(busiCommunicationParametersService.selectBusiCommunicationParametersById(id)); + } + + /** + * 删除主变信息 + */ + @ApiOperation(value = "删除通信参数信息") +// @LogAnnotation(module = "通信参数设置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete/{id}") + public AjaxResult remove(@RequestParam("id") String id) { + return returnAjax(busiCommunicationParametersService.deleteById(id)); + } + + + @ApiOperation(value = "根据通信协议类型加载通信参数信息") + @GetMapping(value = "/getBusiCommunicationParametersByProtocol/{protocol}") + public AjaxResult getBusiCommunicationParametersByProtocol(@PathVariable("protocol") String protocol) { + return AjaxResult.success(busiCommunicationParametersService.selectBusiCommunicationParametersByProtocol(protocol)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiControlConfigController.java b/src/main/java/com/chenxuan/controller/BusiControlConfigController.java new file mode 100644 index 0000000..8e4fc50 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiControlConfigController.java @@ -0,0 +1,95 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiControlConfig; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiControlConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api(tags = "控制参数设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_CONTROL_CONFIG) +public class BusiControlConfigController extends BaseController { + + @Autowired + private BusiControlConfigService busiControlConfigService; + + /** + * @Description: 获取控制参数设置列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取控制参数设置列表") + @GetMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiControlConfigService.page(queryParam); + return AjaxResult.success(page); + } + + /** + * 新增控制参数设置信息 + */ + @ApiOperation(value = "新增控制参数设置信息") + @LogAnnotation(module = "控制参数设置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiControlConfigList) { + return returnAjax(busiControlConfigService.insertConfigs(busiControlConfigList)); + } + + /** + * 修改控制参数设置信息 + */ + @ApiOperation(value = "修改控制参数设置信息") + @LogAnnotation(module = "控制参数设置", operateType = OperateType.UPDATE) + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody List busiControlConfigList) { + return busiControlConfigService.updateConfigs(busiControlConfigList); + } + + /** + * 加载对应主变的控制参数设置信息 + */ + @ApiOperation(value = "加载对应主变的控制参数设置信息") + @GetMapping(value = "/getTransformerConfigByMainId/{mainId}") + public AjaxResult getTransformerConfigByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiControlConfigService.selectConfigsByMainId(mainId)); + } + + /** + * 删除控制参数设置 + */ + @ApiOperation(value = "删除控制参数设置") + @LogAnnotation(module = "控制参数设置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("id") String id) { + return returnAjax(busiControlConfigService.deleteConfById(id)); + } + + /** + * 根据主变id删除该主变对应的控制参数设置信息 + */ + @ApiOperation(value = "根据主变id删除该主变对应的控制参数设置信息") + @LogAnnotation(module = "控制参数设置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/deleteByMainId") + public AjaxResult deleteByMainId(@RequestParam("mainId") String mainId) { + return returnAjax(busiControlConfigService.deleteConfsByMainId(mainId)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiDeviceCalibrationContorller.java b/src/main/java/com/chenxuan/controller/BusiDeviceCalibrationContorller.java new file mode 100644 index 0000000..94b09d3 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiDeviceCalibrationContorller.java @@ -0,0 +1,39 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiDeviceCalibration; +import com.chenxuan.service.BusiDeviceCalibrationService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "装置校时设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_DEVICE_CALIBRATION) +public class BusiDeviceCalibrationContorller extends BaseController { + + @Autowired + private BusiDeviceCalibrationService busiDeviceCalibrationService; + + /** + * 加载对应主变的校时设置信息 + */ + @ApiOperation(value = "加载对应主变装置校时设置设置信息") + @GetMapping(value = "/getBusiDeviceCalibrationByMainId") + public AjaxResult getBusiDeviceCalibrationByMainId(@RequestParam("mainId") String mainId) { + return AjaxResult.success(busiDeviceCalibrationService.selectBusiDeviceCalibrationByMainId(mainId)); + } + + /** + * 主变校准时间 + */ + @ApiOperation(value = "主变校准时间") + @PostMapping(value = "/timing") + public AjaxResult timing(@RequestBody BusiDeviceCalibration busiDeviceCalibration) { + return returnAjax(busiDeviceCalibrationService.timingBusiDeviceCalibration(busiDeviceCalibration)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiDeviceSpecialShowContorller.java b/src/main/java/com/chenxuan/controller/BusiDeviceSpecialShowContorller.java new file mode 100644 index 0000000..84850b9 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiDeviceSpecialShowContorller.java @@ -0,0 +1,51 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiVibrationContrastDto; +import com.chenxuan.entity.model.BusiVibrationSeparation; +import com.chenxuan.service.BusiDeviceSpecialShowService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "装置特殊展示页面") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_DEVICE_SPECIAL_SHOW) +public class BusiDeviceSpecialShowContorller { + + @Autowired + private BusiDeviceSpecialShowService specialShowService; + + /** + * 振动分离 + */ + @ApiOperation(value = "振动分离") + @PostMapping(value = "/getShockRealChartByDevice") + public AjaxResult getShockRealChartByDevice(@RequestBody BusiVibrationSeparation vibrationSeparation) { + return AjaxResult.success(specialShowService.getShockRealChartByDevice(vibrationSeparation)); + } + + /** + * 振动对比实验 + */ + @ApiOperation(value = "振动对比实验") + @PostMapping(value = "/vibrationContrastExper") + public AjaxResult vibrationContrastExper(@RequestBody BusiVibrationContrastDto dto) { + return AjaxResult.success(specialShowService.getVibrationContrastExper(dto)); + } + + /** + * 原副边数据 + */ + @ApiOperation(value = "原副边数据") + @PostMapping(value = "/fixation") + public AjaxResult getFixation() { + return AjaxResult.success(specialShowService.getFixation()); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiFrequencyConfController.java b/src/main/java/com/chenxuan/controller/BusiFrequencyConfController.java new file mode 100644 index 0000000..87c0aa9 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiFrequencyConfController.java @@ -0,0 +1,89 @@ +package com.chenxuan.controller; + + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiFrequencyConf; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiFrequencyConfService; + +@Api(tags = "振动装置-频率配置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_FREQUENCY_CONF) +public class BusiFrequencyConfController extends BaseController { + + @Autowired + private BusiFrequencyConfService busiFrequencyConfService; + + + /** + * @Description: 获取振动装置频率配置信息列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "分页查询振动装置频率配置列表") + @GetMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiFrequencyConfService.page( queryParam ); + return AjaxResult.success( page ); + } + + /** + * 新增振动装置频率配置信息 + */ + @ApiOperation(value = "新增振动装置频率配置信息") + @LogAnnotation(module = "振动装置频率配置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiFrequencyConf busiFrequencyConf) { + return returnAjax( busiFrequencyConfService.insertFrequencyConf( busiFrequencyConf ) ); + + } + + /** + * 修改振动装置频率配置信息 + */ + @ApiOperation(value = "修改振动装置频率配置信息") + @LogAnnotation(module = "振动装置频率配置", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiFrequencyConf busiFrequencyConf) { + return returnAjax( busiFrequencyConfService.updateFrequencyConf( busiFrequencyConf ) ); + } + + /** + * 根据id加载振动装置频率配置信息 + */ + @ApiOperation(value = "根据id加载振动装置频率配置信息") + @GetMapping(value = "/getMainDeviceById/{id}") + public AjaxResult getMainDeviceByMainId(@PathVariable("id") String id) { + return AjaxResult.success( busiFrequencyConfService.selectFrequencyConfById( id ) ); + } + + /** + * 删除振动装置频率配置信息 + */ + @ApiOperation(value = "删除振动装置频率配置信息") + @LogAnnotation(module = "振动装置频率配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("id") String id) { + return returnAjax( busiFrequencyConfService.deleteFrequencyConfById( id ) ); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiMainDeviceController.java b/src/main/java/com/chenxuan/controller/BusiMainDeviceController.java new file mode 100644 index 0000000..206c53e --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiMainDeviceController.java @@ -0,0 +1,126 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiMainDeviceDto; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.entity.vo.PercentageVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiMainDeviceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = "主变设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_MAIN_DEVICE) +public class BusiMainDeviceController extends BaseController { + + @Autowired + private BusiMainDeviceService busiMainDeviceService; + /** + * @Description: 获取主变压器信息列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "分页查询主变列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiMainDeviceDto busiMainDeviceDto) { + Page page = busiMainDeviceService.page(busiMainDeviceDto); + return AjaxResult.success(page); + } + + /** + * 新增主变信息 + */ + @ApiOperation(value = "新增主变信息") + @LogAnnotation(module = "主变信息", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiMainDevice busiMainDevice) { + return busiMainDeviceService.insertMainDevice(busiMainDevice); + } + + /** + * 修改主变信息 + */ + @ApiOperation(value = "修改主变信息") + @LogAnnotation(module = "主变信息", operateType = OperateType.UPDATE) + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody BusiMainDevice busiMainDevice) { + return busiMainDeviceService.updateMainDevice(busiMainDevice); + } + + /** + * 根据id加载主变信息 + */ + @ApiOperation(value = "根据id加载主变信息") + @GetMapping(value = "/getMainDeviceById/{id}") + public AjaxResult getMainDeviceByMainId(@PathVariable("id") String id) { + return AjaxResult.success(busiMainDeviceService.selectMainDeviceById(id)); + } + + /** + * 删除主变信息 + */ + @ApiOperation(value = "删除主变信息") + @LogAnnotation(module = "主变信息", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("id") String id) { + return returnAjax(busiMainDeviceService.deleteMainDeviceById(id)); + } + + /** + * @Description: 获取主变压器信息List + * @Param: + * @Return: + **/ + @ApiOperation(value = "获取主变压器信息List") + @PostMapping(value = "/list") + public AjaxResult list() { + List list = busiMainDeviceService.selectBusiMainDeviceList(); + return AjaxResult.success(list); + } + + /** + * @Description: 获取设备总数 + * @Param: + * @Return: + **/ + @ApiOperation(value = "获取设备总数") + @GetMapping(value = "/selectCountDeviceTotal") + public AjaxResult selectCountDeviceTotal() { + PercentageVo percentageVo = busiMainDeviceService.selectCountDeviceTotal(); + return AjaxResult.success(percentageVo); + } + + /** + * @Description: 获取运行正常设备总数 + * @Param: + * @Return: + **/ + @ApiOperation(value = "获取设备总数") + @GetMapping(value = "/selectNormalDevice") + public AjaxResult selectNormalDevice() { + PercentageVo percentageVo = busiMainDeviceService.selectNormalDevice(); + return AjaxResult.success(percentageVo); + } + + /** + * @Description: 获取运行异常设备总数 + * @Param: + * @Return: + **/ + @ApiOperation(value = "获取设备总数") + @GetMapping(value = "/selectCountEcpDevice") + public AjaxResult selectCountEcpDevice() { + PercentageVo percentageVo = busiMainDeviceService.selectCountEcpDevice(); + return AjaxResult.success(percentageVo); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiNoiseRealController.java b/src/main/java/com/chenxuan/controller/BusiNoiseRealController.java new file mode 100644 index 0000000..428dd1b --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiNoiseRealController.java @@ -0,0 +1,96 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.BusiNoiseReal; +import com.chenxuan.entity.vo.BusiNoiseRealDetailsVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiExportDataService; +import com.chenxuan.service.BusiNoiseRealService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = "噪声实时数据") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_NOISE_REAL) +public class BusiNoiseRealController extends BaseController { + + @Autowired + private BusiNoiseRealService busiNoiseRealService; + + @Autowired + private BusiExportDataService busiExportDataService; + + /** + * 新增噪声实时数据信息 + */ + @ApiOperation(value = "新增噪声实时数据信息") + @LogAnnotation(module = "噪声实时数据", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiNoiseRealList) { + return returnAjax(busiNoiseRealService.insertNoiseReal(busiNoiseRealList)); + } + + /** + * 根据主变id加载噪声实时数据信息 + */ + @ApiOperation(value = "根据主变id加载噪声实时数据信息") + @GetMapping(value = "/getNoiseRealByMainId/{mainId}") + public AjaxResult getNoiseRealByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiNoiseRealService.selectNoiseRealByMainId(mainId)); + } + + /** + * 根据主变id及当天时间加载噪声谱图信息 + */ + @ApiOperation(value = "根据主变id及当天时间加载噪声谱图信息") + @PostMapping(value = "/queryNoiseRealChartByInfo") + public AjaxResult queryNoiseRealChartByInfo(@RequestBody BusiNoiseRealDto busiNoiseRealDto) { + return AjaxResult.success(busiNoiseRealService.findNoiseRealChartByInfo(busiNoiseRealDto)); + } + + /** + * 根据主变id和时间加载噪声实时数据信息 + */ + @ApiOperation(value = "根据主变id和时间加载噪声实时数据信息") + @PostMapping(value = "/getNoiseRealByMainIdAndCreateTime") + public AjaxResult getNoiseRealByMainIdAndCreateTime(@RequestBody BusiNoiseRealDto busiNoiseRealDto) { + return AjaxResult.success(busiNoiseRealService.selectNoiseRealByMainIdAndCreateTime(busiNoiseRealDto)); + } + + /** + * 根据主变id加载噪声实时数据详细信息 + */ + @ApiOperation(value = "根据主变id加载噪声实时数据详细信息") + @PostMapping(value = "/getNoiseRealDetailsByMainId") + public AjaxResult getNoiseRealDetailsByMainId(@RequestBody BusiNoiseRealDto dto) { + Page pageList = busiNoiseRealService.getNoiseRealDetailsByMainId(dto); + return AjaxResult.success(pageList); + } + + /** + * 导出噪声实时数据详细信息Excel + */ + @ApiOperation(value = "导出噪声实时数据详细信息Excel") + @PostMapping(value = "/exportNoiseRealDetails") + public AjaxResult exportNoiseRealDetails(@RequestBody BusiNoiseRealDto dto) { + return busiExportDataService.exportNoiseRealDetails(dto); + } + + /** + * 导出噪声实时数据 + */ + @ApiOperation(value = "导出噪声实时数据") + @PostMapping(value = "/exportNoiseRealByMainId") + public AjaxResult exportNoiseRealByMainId(@RequestBody BusiNoiseRealDto dto) { + return busiExportDataService.exportNoiseReal(dto); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiNoiseThresholdConfController.java b/src/main/java/com/chenxuan/controller/BusiNoiseThresholdConfController.java new file mode 100644 index 0000000..08fe0ad --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiNoiseThresholdConfController.java @@ -0,0 +1,90 @@ +package com.chenxuan.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiNoiseThresholdConfDto; +import com.chenxuan.entity.model.BusiNoiseThresholdConf; +import com.chenxuan.entity.vo.BusiNoiseThresholdConfVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiNoiseThresholdConfService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "噪声装置阈值配置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_NOISE_THRESHOLD_CONF) +public class BusiNoiseThresholdConfController extends BaseController { + + @Autowired + private BusiNoiseThresholdConfService busiNoiseThresholdConfService; + + + /** + * @Description: 获取噪声装置阈值配置列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取噪声装置阈值配置列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiNoiseThresholdConfDto dto) { + Page page = busiNoiseThresholdConfService.page(dto); + return AjaxResult.success(page); + } + + /** + * 新增噪声装置阈值配置信息 + */ + @ApiOperation(value = "新增噪声装置阈值配置信息") + @LogAnnotation(module = "噪声装置阈值配置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiNoiseThresholdConf busiNoiseThresholdConf) { + return busiNoiseThresholdConfService.insertThresholdConf(busiNoiseThresholdConf); + + } + + /** + * 修改噪声装置阈值配置信息 + */ + @ApiOperation(value = "修改噪声装置阈值配置信息") + @LogAnnotation(module = "噪声装置阈值配置", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiNoiseThresholdConf busiNoiseThresholdConf) { + return busiNoiseThresholdConfService.updateThresholdConf(busiNoiseThresholdConf); + } + + /** + * 根据主变id加载噪声装置阈值配置信息 + */ + @ApiOperation(value = "根据主变id加载噪声装置阈值配置信息") + @GetMapping(value = "/getCenterThresholdConfByMainId/{mainId}") + public AjaxResult getCenterThresholdConfByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiNoiseThresholdConfService.selectThresholdConfByMainId(mainId)); + } + + /** + * 根据主变id删除噪声装置阈值配置信息 + */ + @ApiOperation(value = "根据主变id删除噪声装置阈值配置信息") + @LogAnnotation(module = "噪声装置阈值配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/deleteByMainId") + public AjaxResult remove(@RequestParam("mainId") String mainId) { + return returnAjax(busiNoiseThresholdConfService.deleteThresholdConfByMainId(mainId)); + } + + /** + * 根据噪声装置阈值配置id删除其配置信息 + */ + @ApiOperation(value = "根据噪声装置阈值配置id删除其配置信息") + @LogAnnotation(module = "噪声装置阈值配置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult delete(@RequestParam("ids") String id) { + return returnAjax(busiNoiseThresholdConfService.delete(id)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiParamBindController.java b/src/main/java/com/chenxuan/controller/BusiParamBindController.java new file mode 100644 index 0000000..596b592 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiParamBindController.java @@ -0,0 +1,63 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiParamBindDto; +import com.chenxuan.entity.model.BusiParamBind; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiParamBindService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "ied参数绑定") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_PARAM_BIND) +public class BusiParamBindController extends BaseController { + + @Autowired + private BusiParamBindService busiParamBindService; + /** + * 新增ied参数绑定 + */ + @ApiOperation(value = "新增ied参数信息") + @LogAnnotation(module = "ied参数信息", operateType = OperateType.INSERT) + @PostMapping(value = "/addParamBind") + public AjaxResult addParamBind(@RequestBody BusiParamBind busiParamBind) { +// return busiParamBindService.addParamBind(busiParamBind); + return returnAjax(busiParamBindService.addParamBind(busiParamBind)); + } + + /** + * 修改ied参数绑定 + */ + @ApiOperation(value = "修改ied参数信息") + @LogAnnotation(module = "ied参数信息", operateType = OperateType.UPDATE) + @PostMapping(value = "/updateParamBind") + public AjaxResult updateParamBind(@RequestBody BusiParamBind busiParamBind) { + return returnAjax(busiParamBindService.updateParamBind(busiParamBind)); + } + + @ApiOperation(value = "分页查询") + @PostMapping(value = "/queryParamBind") + public AjaxResult queryParamBind(@RequestBody BusiParamBindDto dto) { + Page page = busiParamBindService.queryParamBind(dto); + return AjaxResult.success(page); + } + + + + /** + * 删除用户 + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delParamBind") + public AjaxResult delParamBind(@RequestParam("iedIds") int[] iedIds) { + return returnAjax(busiParamBindService.delParamBind(iedIds) > 0 ? true : false); + } +} diff --git a/src/main/java/com/chenxuan/controller/BusiSubDeviceController.java b/src/main/java/com/chenxuan/controller/BusiSubDeviceController.java new file mode 100644 index 0000000..dfe0ca9 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiSubDeviceController.java @@ -0,0 +1,124 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiSubDevice; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiSubDeviceService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = "主变装置设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_SUB_DEVICE) +public class BusiSubDeviceController extends BaseController { + + @Autowired + private BusiSubDeviceService busiSubDeviceService; + + + /** + * @Description: 获取主变压器装置信息列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取主变压器装置信息列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiSubDeviceDto dto) { + Page page = busiSubDeviceService.page(dto); + return AjaxResult.success(page); + } + + @ApiOperation(value = "获取主变压器装置信息列表") + @GetMapping(value = "/queryAll") + public AjaxResult queryAll() { + List list = busiSubDeviceService.queryAll(); + return AjaxResult.success(list); + } + + + /** + * 新增主变装置信息 + */ + @ApiOperation(value = "新增主变装置信息") + @LogAnnotation(module = "主变装置信息", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiSubDeviceDto dto) { + return busiSubDeviceService.insertSubDevice(dto); + + } + + /** + * 修改主变装置信息 + */ + @ApiOperation(value = "修改主变装置信息") + @LogAnnotation(module = "主变装置信息", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiSubDevice busiSubDevice) { + return busiSubDeviceService.updateSubDevice(busiSubDevice); + } + + /** + * 根据主变id加载主变装置信息 + */ + @ApiOperation(value = "根据主变id加载主变装置信息") + @GetMapping(value = "/getSubDeviceByMainId/{mainId}") + public AjaxResult getSubDeviceByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiSubDeviceService.selectSubDeviceByMainId(mainId)); + } + + /** + * 根据主变id加载主变装置信息 + */ + @ApiOperation(value = "根据主变id加载主变装置信息") + @GetMapping(value = "/querySubDeviceById/{id}") + public AjaxResult querySubDeviceById(@PathVariable("id") String id) { + return AjaxResult.success(busiSubDeviceService.querySubDeviceById(id)); + } + + /** + * 根据主变id加载主变装置信息 + */ + @ApiOperation(value = "根据主变id加载主变装置信息") + @GetMapping(value = "/querySubDeviceByMainId/{mainId}") + public AjaxResult querySubDeviceByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiSubDeviceService.querySubDeviceByMainId(mainId)); + } +// @ApiOperation(value = "根据通信协议类型加载通信参数信息") +// @GetMapping(value = "/getBusiCommunicationParametersByProtocol/{protocol}") +// public AjaxResult getBusiCommunicationParametersByProtocol(@PathVariable("protocol") String protocol) { +// return AjaxResult.success(busiCommunicationParametersService.selectBusiCommunicationParametersByProtocol(protocol)); +// } + + + + /** + * 根据主变id删除主变装置信息 + */ + @ApiOperation(value = "根据主变id删除该主变下对应的装置信息") + @LogAnnotation(module = "主变装置信息", operateType = OperateType.DELETE) + @DeleteMapping(value = "/deleteByMainId/{mainId}") + public AjaxResult remove(@RequestParam("mainId") String mainId) { + return returnAjax(busiSubDeviceService.deleteSubDeviceByMainId(mainId)); + } + + /** + * 根据装置id删除装置信息 + */ + @ApiOperation(value = "根据装置id删除装置信息") + @LogAnnotation(module = "主变装置信息", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete/{id}") + public AjaxResult delete(@RequestParam("id") String id) { + return returnAjax(busiSubDeviceService.delete(id)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiTransformerConfController.java b/src/main/java/com/chenxuan/controller/BusiTransformerConfController.java new file mode 100644 index 0000000..4ca5887 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiTransformerConfController.java @@ -0,0 +1,97 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.BusiTransformerConf; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiTransformerConfService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Api(tags = "原副边电流电压配置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_TRANSFORMER_CONF) +public class BusiTransformerConfController extends BaseController { + + @Autowired + private BusiTransformerConfService busiTransformerConfService; + + + /** + * @Description: 获取原副边电流电压配置列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取原副边电流电压配置列表") + @GetMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiTransformerConfService.page(queryParam); + return AjaxResult.success(page); + } + + /** + * 新增电流电压配置 + */ + @ApiOperation(value = "新增电流电压配置") + @LogAnnotation(module = "电流电压设置", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiTransformerConfList) { + return returnAjax(busiTransformerConfService.insertConfigs(busiTransformerConfList)); + + } + + /** + * 修改电流电压配置 + */ + @ApiOperation(value = "修改电流电压配置") +// @LogAnnotation(module = "电流电压设置", operateType = OperateType.UPDATE) + @PostMapping(value = "/update") + public AjaxResult update(@RequestBody List busiTransformerConfList) { + return returnAjax(busiTransformerConfService.updateConfigs(busiTransformerConfList)); + } + + /** + * 加载对应主变的原边副边电流电压信息 + */ + @ApiOperation(value = "加载对应主变的原边副边电流电压信息") + @GetMapping(value = "/getTransformerConfigByMainId/{mainId}") + public AjaxResult getTransformerConfigByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success(busiTransformerConfService.selectConfigsByMainId(mainId)); + } + + /** + * 删除配置 + */ + @ApiOperation(value = "根据配置id删除电流电压配置") + @LogAnnotation(module = "电流电压设置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("id") String id) { + return returnAjax(busiTransformerConfService.deleteConfById(id)); + } + + /** + * 根据主变id删除该主变下对应的电流电压配置信息 + */ + @ApiOperation(value = "根据主变id删除该主变下对应的电流电压配置信息") + @LogAnnotation(module = "电流电压设置", operateType = OperateType.DELETE) + @DeleteMapping(value = "/deleteByMainId") + public AjaxResult deleteByMainId(@RequestParam("mainId") String mainId) { + return returnAjax(busiTransformerConfService.deleteConfsByMainId(mainId)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiTransformerRealController.java b/src/main/java/com/chenxuan/controller/BusiTransformerRealController.java new file mode 100644 index 0000000..755d170 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiTransformerRealController.java @@ -0,0 +1,70 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiTransformerRealDto; +import com.chenxuan.entity.model.BusiTransformerReal; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiTransformerRealService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = "原副边电流电压实时数据") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_TRANSFORMER_REAL) +public class BusiTransformerRealController extends BaseController { + + @Autowired + private BusiTransformerRealService busiTransformerRealService; + + + /** + * @Description: 获取原副边电流电压实时数据列表 + * @Param: + * @Return: TableDataInfo + **/ + @ApiOperation(value = "获取原副边电流电压实时数据列表") + @PostMapping(value = "/page") + public AjaxResult page(Query queryParam) { + Page page = busiTransformerRealService.page( queryParam ); + return AjaxResult.success( page ); + } + + /** + * 新增原副边电流电压实时数据 + */ + @ApiOperation(value = "新增原副边电流电压实时数据") + @LogAnnotation(module = "原副边电流电压实时数据", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody List busiTransformerRealList) { + return returnAjax( busiTransformerRealService.insertTransformerReals( busiTransformerRealList ) ); + + } + + /** + * 加载对应主变的原副边电流电压实时数据信息 + */ + @ApiOperation(value = "加载对应主变的原副边电流电压实时数据信息") + @GetMapping(value = "/getTransformerConfigByMainId/{mainId}") + public AjaxResult getTransformerConfigByMainId(@PathVariable("mainId") String mainId) { + return AjaxResult.success( busiTransformerRealService.selectTransformerRealByMainId( mainId ) ); + } + + /** + * 导出原副边电流电压实时数据Excel + */ + @ApiOperation(value = "导出原副边电流电压实时数据Excel") + @PostMapping(value = "/exporTransformReal") + public AjaxResult exporTransformReal(@RequestBody BusiTransformerRealDto dto) { + return AjaxResult.success(busiTransformerRealService.exporTransformReal(dto)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/BusiWarningController.java b/src/main/java/com/chenxuan/controller/BusiWarningController.java new file mode 100644 index 0000000..8f5cd56 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/BusiWarningController.java @@ -0,0 +1,64 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.dto.BusiWarningDto; +import com.chenxuan.entity.model.BusiWarning; +import com.chenxuan.entity.vo.BusiWarningVo; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.BusiWarningService; +import com.chenxuan.utils.StringUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Api(tags = "告警信息") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_WARNING) +public class BusiWarningController extends BaseController { + + @Autowired + private BusiWarningService busiWarningService; + + /** + * 获取告警信息列表 + * + * @param dto + * @return + */ + @ApiOperation(value = "获取告警信息列表") + @PostMapping(value = "/page") + public AjaxResult page(@RequestBody BusiWarningDto dto) { + Page page; + if (StringUtils.isNotBlank(dto.getWarnType())) { + page = busiWarningService.getPage(dto); + } else { + page = busiWarningService.page(dto); + } + return AjaxResult.success(page); + } + + /** + * 新增告警信息 + */ + @ApiOperation(value = "新增告警信息") + @LogAnnotation(module = "告警信息", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody BusiWarning busiWarning) { + return returnAjax(busiWarningService.insertWarning(busiWarning)); + } + + /** + * 修改告警阈值信息 + */ + @ApiOperation(value = "修改告警信息") + @LogAnnotation(module = "告警信息", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody BusiWarning busiWarning) { + return returnAjax(busiWarningService.updateWarning(busiWarning)); + } +} diff --git a/src/main/java/com/chenxuan/controller/CaptchaController.java b/src/main/java/com/chenxuan/controller/CaptchaController.java new file mode 100644 index 0000000..55304b8 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/CaptchaController.java @@ -0,0 +1,65 @@ +package com.chenxuan.controller; + + +import cn.hutool.core.codec.Base64; +import cn.hutool.core.util.IdUtil; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.component.RedisCacheService; +import com.chenxuan.constants.Constants; +import com.chenxuan.utils.VerifyCodeUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.cache.RedisCache; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + + +/** + * @ClassName:CaptchaController + * @Description: 验证码操作处理 + * @Author: Arno_Fu + * @CreatTime:11/27/2019 - 2:19 PM + * @Version V1.0 + */ + +@RestController +public class CaptchaController { + + @Autowired + private RedisCacheService redisCacheService; + + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException { + // 生成随机字串 + String verifyCode = VerifyCodeUtils.generateVerifyCode( 4 ); + // 唯一标识 + String uuid = IdUtil.simpleUUID(); + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + + redisCacheService.setCacheObject( verifyKey, verifyCode, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES ); + ByteArrayOutputStream stream = null; + try { + // 生成图片 + int w = 111, h = 36; + stream = new ByteArrayOutputStream(); + VerifyCodeUtils.outputImage( w, h, stream, verifyCode ); + + AjaxResult ajax = AjaxResult.success(); + ajax.put( "uuid", uuid ); + ajax.put( "img", Base64.encode( stream.toByteArray() ) ); + return ajax; + } catch (Exception e) { + e.printStackTrace(); + return AjaxResult.error( e.getMessage() ); + } finally { + stream.close(); + } + } +} diff --git a/src/main/java/com/chenxuan/controller/IedController.java b/src/main/java/com/chenxuan/controller/IedController.java new file mode 100644 index 0000000..9cbab4e --- /dev/null +++ b/src/main/java/com/chenxuan/controller/IedController.java @@ -0,0 +1,26 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.service.BusiIedparamService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "主变装置设置") +@RestController +@RequestMapping(value = BusiUrlConstants.BUSI_IED) +public class IedController { + @Autowired + private BusiIedparamService busiIedparamService; + + @ApiOperation(value = "加载对应主变的原副边电流电压实时数据信息") + @GetMapping(value = "/quereyIcdById/{id}") + public AjaxResult quereyIcdById(@PathVariable("id") String id) { + return AjaxResult.success(busiIedparamService.quereyIcdById(id) ); + } +} diff --git a/src/main/java/com/chenxuan/controller/ScheduleJobController.java b/src/main/java/com/chenxuan/controller/ScheduleJobController.java new file mode 100644 index 0000000..d3ee743 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/ScheduleJobController.java @@ -0,0 +1,135 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.dto.ScheduleJobDto; +import com.chenxuan.entity.model.ScheduleJob; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.ScheduleJobService; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @ClassName:ScheduleJobController + * @Description: 定时任务控制器 + * @Author: Arno_Fu + * @CreatTime:12/26/2019 - 4:57 PM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/quartz/job") +public class ScheduleJobController extends BaseController { + + @Autowired + private ScheduleJobService scheduleJobService; + + /** + * 获取定时列表 + */ + @GetMapping("/page") + public AjaxResult page(ScheduleJobDto dto) { + Page page = scheduleJobService.queryPage(dto); + return AjaxResult.success(page); + } + + /** + * 返回编辑页面数据 + * + * @param jobId + * @return + */ + @GetMapping("/info") + public AjaxResult info(@RequestParam("jobId") Long jobId) { + ScheduleJob job = scheduleJobService.getById(jobId); + return AjaxResult.success(job); + } + + /** + * 新增定时任务 + * + * @param job + * @return + * @throws SchedulerException + */ + @PostMapping("/add") + @LogAnnotation(module = "新增定时任务", operateType = OperateType.INSERT) + public AjaxResult add(@RequestBody ScheduleJob job) throws SchedulerException { + return scheduleJobService.add(job); + } + + /** + * 编辑定时任务 + * + * @param job + * @return + * @throws SchedulerException + */ + @PutMapping("/update") + public AjaxResult update(@RequestBody ScheduleJob job) throws SchedulerException { + return scheduleJobService.update(job); + } + + /** + * 启动定时任务 + * + * @param jobIds + * @return + * @throws SchedulerException + */ + @GetMapping("/start") + public AjaxResult start(@RequestParam("jobIds") String[] jobIds) throws SchedulerException { + return returnAjax(scheduleJobService.start(jobIds)); + } + + /** + * 暂停定时任务 + * + * @param jobIds + * @return + * @throws SchedulerException + */ + @GetMapping("/pause") + public AjaxResult pause(@RequestParam("jobIds") String[] jobIds) throws SchedulerException { + return returnAjax(scheduleJobService.pause(jobIds)); + } + + /** + * 删除定时任务 + * + * @param jobIds + * @return + * @throws SchedulerException + */ + @DeleteMapping("/delete") + public AjaxResult delete(@RequestParam("jobIds") String[] jobIds) throws SchedulerException { + return scheduleJobService.delete(jobIds); + } + + /** + * 启动所有的定时任务 + * + * @return + * @throws SchedulerException + */ + @GetMapping("/startAllJob") + public AjaxResult startAllJob() throws SchedulerException { + scheduleJobService.startAllJob(); + return AjaxResult.success(); + } + + /** + * 暂停所有的定时任务 + * + * @return + * @throws SchedulerException + */ + @GetMapping("/pauseAllJob") + public AjaxResult pauseAllJob() throws SchedulerException { + scheduleJobService.pauseAllJob(); + return AjaxResult.success(); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysConfigController.java b/src/main/java/com/chenxuan/controller/SysConfigController.java new file mode 100644 index 0000000..e7f30b9 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysConfigController.java @@ -0,0 +1,103 @@ +package com.chenxuan.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysConfig; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysConfigService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; + + +/** + * @ClassName:SysConfigController + * @Description: 参数配置 信息操作处理 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 10:50 AM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/system/config") +public class SysConfigController extends BaseController { + + @Autowired + private SysConfigService sysConfigService; + + /** + * 获取参数配置列表 + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + Page page = sysConfigService.queryPage( query ); + return AjaxResult.success( page ); + } + + /* @LogAnnotation(module= "参数管理", operateType = OperateType.EXPORT) + @GetMapping("/export") + public AjaxResult export(SysConfig config) { + List list = sysConfigService.selectConfigList( config ); + ExcelUtil util = new ExcelUtil( SysConfig.class ); + return util.exportExcel( list, "参数数据" ); + }*/ + + /** + * 根据参数编号获取详细信息 + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(@RequestParam("configId") Long configId) { + return AjaxResult.success( sysConfigService.selectConfigById( configId ) ); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey") + public AjaxResult getConfigKey(@RequestParam("configKey") String configKey) { + return AjaxResult.success( sysConfigService.selectConfigByKey( configKey ) ); + } + + /** + * 新增参数配置 + */ + @LogAnnotation(module = "参数管理", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody SysConfig config) { + if (!sysConfigService.checkConfigKeyUnique( config )) { + return AjaxResult.error( "新增参数'" + config.getConfigName() + "'失败,参数键名已存在" ); + } + config.setCreateBy( SecurityUtils.getUsername() ); + config.setCreateTime( new Date() ); + return returnAjax( sysConfigService.insertConfig( config ) ); + } + + /** + * 修改参数配置 + */ + @LogAnnotation(module = "参数管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody SysConfig config) { + if (!sysConfigService.checkConfigKeyUnique( config )) { + return AjaxResult.error( "修改参数'" + config.getConfigName() + "'失败,参数键名已存在" ); + } + config.setUpdateBy( SecurityUtils.getUsername() ); + config.setUpdateTime( new Date() ); + return returnAjax( sysConfigService.updateConfig( config ) ); + } + + /** + * 删除参数配置 + */ + @LogAnnotation(module = "参数管理", operateType = OperateType.DELETE) + @DeleteMapping("/delete") + public AjaxResult delete(@RequestParam("configIds") Long[] configIds) { + return returnAjax( sysConfigService.deleteConfigByIds( configIds ) ); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysDeptController.java b/src/main/java/com/chenxuan/controller/SysDeptController.java new file mode 100644 index 0000000..c15751b --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysDeptController.java @@ -0,0 +1,112 @@ +package com.chenxuan.controller; + + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysDeptService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:SysDeptController + * @Description: 部门信息 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 6:09 PM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/system/dept") +public class SysDeptController extends BaseController { + @Autowired + private SysDeptService deptService; + + /** + * 获取部门列表 + */ + + @GetMapping("/list") + public AjaxResult list(Query query) { + List depts = deptService.getDeptList( query ); + return AjaxResult.success( deptService.buildDeptTree( depts ) ); + } + + + /** + * 获取部门下拉树列表 + */ + @GetMapping("/treeselect") + public AjaxResult treeselect() { + List depts = deptService.getDeptList(); + return AjaxResult.success( deptService.buildDeptTreeSelect( depts ) ); + } + + /** + * 新增部门 + */ + @LogAnnotation(module = "部门管理", operateType = OperateType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody SysDept dept) { + if (!deptService.checkDeptNameUnique( dept )) { + return AjaxResult.error( "新增部门'" + dept.getDeptName() + "'失败,部门名称已存在" ); + } + dept.setCreateBy( SecurityUtils.getUsername() ); + dept.setCreateTime( new Date() ); + return returnAjax( deptService.insertDept( dept ) ); + } + + /** + * 修改部门 + */ + @LogAnnotation(module = "部门管理", operateType = OperateType.UPDATE) + @PutMapping("/update") + public AjaxResult edit(@RequestBody SysDept dept) { + if (!deptService.checkDeptNameUnique( dept )) { + return AjaxResult.error( "修改部门'" + dept.getDeptName() + "'失败,部门名称已存在" ); + } + if (dept.getParentId().equals( dept.getDeptId() )) { + return AjaxResult.error( "修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己" ); + } + dept.setUpdateBy( SecurityUtils.getUsername() ); + dept.setUpdateTime( new Date() ); + return returnAjax( deptService.updateDept( dept ) ); + } + + /** + * 删除部门 + */ + @LogAnnotation(module = "部门管理", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult delete(@RequestParam("deptId") Long deptId) { + if (deptService.hasChildByDeptId( deptId )) { + return AjaxResult.error( "存在下级部门,不允许删除" ); + } + if (deptService.checkDeptExistUser( deptId )) { + return AjaxResult.error( "部门存在用户,不允许删除" ); + } + return returnAjax( deptService.deleteDeptById( deptId ) ); + } + + /** + * 根据部门编号获取详细信息 + */ + @GetMapping(value = "info") + public AjaxResult info(@RequestParam("deptId") Long deptId) { + return AjaxResult.success( deptService.getByPK( deptId ) ); + } + + @GetMapping(value = "/roleDeptTreeselect") + public AjaxResult roleDeptTreeselect(@RequestParam("roleId") Long roleId) + { + return AjaxResult.success(deptService.selectDeptListByRoleId(roleId)); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysDictDataController.java b/src/main/java/com/chenxuan/controller/SysDictDataController.java new file mode 100644 index 0000000..5ad5395 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysDictDataController.java @@ -0,0 +1,115 @@ +package com.chenxuan.controller; + + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysDictData; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysDictDataService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + + +@RestController +@RequestMapping("/system/dict/data") +/** + * @ClassName:SysDictDataController + * @Description: 数据字典信息 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 4:54 PM + * @Version V1.0 + */ + +public class SysDictDataController extends BaseController { + + @Autowired + private SysDictDataService dictDataService; + + /** + * @param dictType + * @Description: 根据字典类型查询字典数据信息 + * @Param: + * @Return: com.chenxuan.base.entity.AjaxResult + **/ + @GetMapping(value = "/dictType/{dictType}") + public AjaxResult dictType(@PathVariable String dictType) { + List list = dictDataService.getDictDataByType(dictType); + return AjaxResult.success(list); + } + + /** + * 数据字典信息分页 + * + * @param query + * @return + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + return AjaxResult.success(dictDataService.selectDictDataPage(query)); + } + + + /* @Log(title = "字典数据", businessType = BusinessType.EXPORT) + @PreAuthorize("@ss.hasPermi('system:dict:export')") + @GetMapping("/export") + public AjaxResult export(SysDictData dictData) + { + List list = dictDataService.selectDictDataList(dictData); + ExcelUtil util = new ExcelUtil(SysDictData.class); + return util.exportExcel(list, "字典数据"); + }*/ + + /** + * 查询字典数据详细 + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(@RequestParam("dictCode") Long dictCode) { + return AjaxResult.success(dictDataService.selectDictDataById(dictCode)); + } + + @GetMapping(value = "/selectDictLabel") + public AjaxResult selectDictLabel(@RequestParam("dictType") String dictType,@RequestParam("dictValue") String dictValue) { + return AjaxResult.success(dictDataService.selectDictLabel(dictType,dictValue)); + } + + + + + /** + * 新增字典类型 + */ + @LogAnnotation(module = "字典数据", operateType = OperateType.INSERT) + @PostMapping(value = "add") + public AjaxResult add(@RequestBody SysDictData dict) { + dict.setCreateBy(SecurityUtils.getUsername()); + dict.setCreateTime(new Date()); + return returnAjax(dictDataService.insertDictData(dict)); + } + + /** + * 修改保存字典类型 + */ + @LogAnnotation(module = "字典数据", operateType = OperateType.UPDATE) + @PutMapping(value = "update") + public AjaxResult update(@RequestBody SysDictData dict) { + dict.setUpdateBy(SecurityUtils.getUsername()); + dict.setUpdateTime(new Date()); + return returnAjax(dictDataService.updateDictData(dict)); + } + + /** + * 删除字典类型 + */ + @LogAnnotation(module = "字典类型", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult delete(@RequestParam("dictCodes") Long[] dictCodes) { + return returnAjax(dictDataService.deleteDictDataByIds(dictCodes)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/SysDictTypeController.java b/src/main/java/com/chenxuan/controller/SysDictTypeController.java new file mode 100644 index 0000000..8bfbedd --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysDictTypeController.java @@ -0,0 +1,120 @@ +package com.chenxuan.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysDictType; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysDictTypeService; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:SysDictTypeController + * @Description: 数据字典信息 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 1:38 PM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/system/dict/type/") +public class SysDictTypeController extends BaseController { + + @Autowired + private SysDictTypeService sysDictService; + @Autowired + private SysExportDataService sysExportDataService; + + /** + * 数据字典分页 + * + * @param query + * @return + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + Page page = sysDictService.selectDictTypePage(query); + return AjaxResult.success(page); + } + + /** + * 数据字典列表 + * + * @param query + * @return + */ + @GetMapping("/list") + public AjaxResult list(Query query) { + List List = sysDictService.selectDictTypeList(); + return AjaxResult.success(List); + } + + /** + * 导出字典类型的数据 + * + * @param query + * @return + */ + @LogAnnotation(module = "字典类型", operateType = OperateType.EXPORT) + @PostMapping("/export") + public AjaxResult export(Query query) { + return AjaxResult.success(sysExportDataService.exportDictInfo(query)); + } + + /** + * 查询字典类型详细 + */ + @GetMapping(value = "/info") + public AjaxResult info(@RequestParam("dictId") Long dictId) { + return AjaxResult.success(sysDictService.selectDictTypeById(dictId)); + } + + /** + * 新增字典类型 + */ + @LogAnnotation(module = "字典类型", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody SysDictType dict) { + if (!sysDictService.checkDictTypeUnique(dict)) { + return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setCreateBy(SecurityUtils.getUsername()); + dict.setCreateTime(new Date()); + return returnAjax(sysDictService.insertDictType(dict)); + } + + /** + * 修改字典类型 + */ + @LogAnnotation(module = "字典类型", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody SysDictType dict) { + if (!sysDictService.checkDictTypeUnique(dict)) { + return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); + } + dict.setUpdateBy(SecurityUtils.getUsername()); + dict.setUpdateTime(new Date()); + return returnAjax(sysDictService.updateDictType(dict)); + } + + /** + * 删除字典类型 + */ + @LogAnnotation(module = "字典类型", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult delete(@RequestParam("dictIds") Long[] dictIds) { + return returnAjax(sysDictService.deleteDictTypeByIds(dictIds)); + } + + +} diff --git a/src/main/java/com/chenxuan/controller/SysExecController.java b/src/main/java/com/chenxuan/controller/SysExecController.java new file mode 100644 index 0000000..97d0f82 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysExecController.java @@ -0,0 +1,29 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.service.SysPostService; +import com.chenxuan.service.SysRoleService; +import com.chenxuan.service.SysExecService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping("/system/exec") +public class SysExecController extends BaseController { + + @Autowired + private SysExecService sysExecService; + + @GetMapping(value = "/exec") + public AjaxResult page(String command) { + sysExecService.runtimeExec( command ); + return AjaxResult.success( ); + } + +} + diff --git a/src/main/java/com/chenxuan/controller/SysLoginController.java b/src/main/java/com/chenxuan/controller/SysLoginController.java new file mode 100644 index 0000000..4c51339 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysLoginController.java @@ -0,0 +1,107 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.Constants; +import com.chenxuan.entity.model.SysMenu; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.CustomPermissionService; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.security.service.LoginService; +import com.chenxuan.service.SysMenuService; +import com.chenxuan.utils.ServletUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.Set; + +/** + * @ClassName:SysLoginController + * @Description: 登录验证 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 1:47 PM + * @Version V1.0 + */ + +@RestController +public class SysLoginController { + + + @Autowired + private LoginService loginService; + + @Autowired + private SysMenuService menuService; + + @Autowired + private CustomPermissionService customPermissionService; + + @Autowired + private JwtTokenService jwtTokenService; + + + /** + * @Description 登录方法 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return com.chenxuan.domain.AjaxResult + */ + @PostMapping("/login") + public AjaxResult login(String username, String password, String code, String uuid) + { + AjaxResult ajax = AjaxResult.success(); + String token = loginService.login(username, password, code, uuid); + ajax.put(Constants.TOKEN, token); + return ajax; + } + + + /** + * @Description 获取用户信息 + * + * @return com.chenxuan.base.entity.AjaxResult + */ + @GetMapping("getInfo") + public AjaxResult getInfo(){ + SysUser user = getSysUser(); + // 权限集合 + Set permissions = customPermissionService.getMenuPermission(user); + // 角色集合 + Set roles = customPermissionService.getRolePermission(user); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + return ajax; + } + + + + + /** + * @Description 获取路由信息 + * + * @return com.chenxuan.base.entity.AjaxResult + */ + @GetMapping("getRouters") + public AjaxResult getRouters(){ + SysUser user = getSysUser(); + List menus = menuService.getMenuTreeByUserId(user); + return AjaxResult.success(menuService.buildMenus(menus)); + } + + private SysUser getSysUser() { + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest()); + return loginUser.getUser(); + } + + + + +} diff --git a/src/main/java/com/chenxuan/controller/SysLoginLogController.java b/src/main/java/com/chenxuan/controller/SysLoginLogController.java new file mode 100644 index 0000000..d8a1488 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysLoginLogController.java @@ -0,0 +1,78 @@ +package com.chenxuan.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.dto.SysLoginLogDto; +import com.chenxuan.entity.model.SysLoginLog; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.service.SysLoginLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 系统访问记录 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/monitor/loginlog") +public class SysLoginLogController extends BaseController { + + @Autowired + private SysLoginLogService sysLoginLogService; + @Autowired + private SysExportDataService sysExportDataService; + + /** + * 登录日志分页 + * + * @param query + * @return + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + Page page = sysLoginLogService.selectLoginLogPage(query); + return AjaxResult.success(page); + } + + /** + * 导出登录日志 + * + * @param dto + * @return + */ + @LogAnnotation(module = "登录日志", operateType = OperateType.EXPORT) + @PostMapping("/export") + public AjaxResult export(@RequestBody SysLoginLogDto dto) { + return sysExportDataService.exportLoginLog(dto); + } + + /** + * 删除登录日志信息 + * + * @param infoIds + * @return + */ + @LogAnnotation(module = "登陆日志", operateType = OperateType.DELETE) + @DeleteMapping("/delete") + public AjaxResult delete(@RequestParam("infoIds") Long[] infoIds) { + return returnAjax(sysLoginLogService.deleteLoginLogByIds(infoIds)); + } + + /** + * 清空登录日志信息 + * + * @return + */ + @LogAnnotation(module = "登陆日志", operateType = OperateType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() { + sysLoginLogService.cleanLoginLog(); + return AjaxResult.success(); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysMenuController.java b/src/main/java/com/chenxuan/controller/SysMenuController.java new file mode 100644 index 0000000..29fd7ea --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysMenuController.java @@ -0,0 +1,115 @@ +package com.chenxuan.controller; + + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysMenu; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysMenuService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:SysMenuController + * @Description: 菜单信息 + * @Author: Arno_Fu + * @CreatTime:12/3/2019 - 9:13 PM + * @Version V1.0 + */ +@RestController +@RequestMapping("/system/menu") +public class SysMenuController extends BaseController { + @Autowired + private SysMenuService menuService; + + + + /** + * 获取菜单列表 + */ + @GetMapping("/list") + public AjaxResult list(Query query) { + List menus = menuService.getMenuList( query ); + return AjaxResult.success( menuService.buildMenuTree( menus ) ); + } + + /** + * 根据菜单编号获取详细信息 + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(@RequestParam("menuId") Long menuId) { + return AjaxResult.success( menuService.getByPK( menuId ) ); + } + + /** + * 获取菜单下拉树列表 + */ + + @GetMapping("/treeselect") + public AjaxResult treeselect() { + List menus = menuService.getMenuList( ); + return AjaxResult.success( menuService.buildMenuTreeSelect( menus ) ); + } + + /** + * 加载对应角色菜单列表树 + */ + + @GetMapping(value = "/roleMenuTreeselect/{roleId}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) { + return AjaxResult.success( menuService.selectMenuListByRoleId( roleId ) ); + } + + /** + * 新增菜单 + */ + + @LogAnnotation(module = "菜单管理", operateType = OperateType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody SysMenu menu) { + if (! menuService.checkMenuNameUnique( menu ) ) { + return AjaxResult.error( "新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在" ); + } + menu.setCreateBy( SecurityUtils.getUsername() ); + menu.setCreateTime( new Date() ); + return returnAjax( menuService.insertMenu( menu ) ); + } + + /** + * 修改菜单 + */ + + @LogAnnotation(module = "菜单管理", operateType = OperateType.UPDATE) + @PutMapping("/update") + public AjaxResult edit(@RequestBody SysMenu menu) { + if ( !menuService.checkMenuNameUnique( menu ) ) { + return AjaxResult.error( "修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在" ); + } + menu.setUpdateBy( SecurityUtils.getUsername() ); + menu.setUpdateTime( new Date( ) ); + return returnAjax( menuService.updateMenu( menu ) ); + } + + /** + * 删除菜单 + */ + + @LogAnnotation(module = "菜单管理", operateType = OperateType.DELETE) + @DeleteMapping("/delete") + public AjaxResult remove(@RequestParam("menuId") Long menuId) { + if (menuService.hasChildByMenuId( menuId )) { + return AjaxResult.error( "存在子菜单,不允许删除" ); + } + if (menuService.checkMenuExistRole( menuId )) { + return AjaxResult.error( "菜单已分配,不允许删除" ); + } + return returnAjax( menuService.deleteMenuById( menuId ) ); + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/controller/SysOperlogController.java b/src/main/java/com/chenxuan/controller/SysOperlogController.java new file mode 100644 index 0000000..849384a --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysOperlogController.java @@ -0,0 +1,81 @@ +package com.chenxuan.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.dto.SysOperLogDto; +import com.chenxuan.entity.model.SysOperLog; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.service.SysOperLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +/** + * @ClassName:SysOperlogController + * @Description: 操作日志记录 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 1:17 PM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/monitor/operlog") +public class SysOperlogController extends BaseController { + + @Autowired + private SysOperLogService sysOperLogService; + @Autowired + private SysExportDataService sysExportDataService; + + /** + * 操作日志分页 + * + * @param query + * @return + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + Page page = sysOperLogService.selectOperLogPage(query); + return AjaxResult.success(page); + } + + /** + * 导出操作日志 + * + * @param dto + * @return + */ + @LogAnnotation(module = "操作日志", operateType = OperateType.EXPORT) + @PostMapping("/export") + public AjaxResult export(@RequestBody SysOperLogDto dto) { + return sysExportDataService.exportOperLog(dto); + } + + /** + * 删除操作日志信息 + * + * @param operIds + * @return + */ + @DeleteMapping("/delete") + public AjaxResult remove(@RequestParam("operIds") Long[] operIds) { + return returnAjax(sysOperLogService.deleteOperLogByIds(operIds) > 0 ? true : false); + } + + /** + * 清空日志信息 + * + * @return + */ + @LogAnnotation(module = "操作日志", operateType = OperateType.CLEAN) + @DeleteMapping("/clean") + public AjaxResult clean() { + sysOperLogService.cleanOperLog(); + return AjaxResult.success(); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysPostController.java b/src/main/java/com/chenxuan/controller/SysPostController.java new file mode 100644 index 0000000..2b596b9 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysPostController.java @@ -0,0 +1,123 @@ +package com.chenxuan.controller; + + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysPost; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysPostService; +import com.chenxuan.utils.SecurityUtils; + +import lombok.extern.slf4j.Slf4j; + + +/** + * @ClassName:SysPostController + * @Description: 岗位信息操作处理 + * @Author: Arno_Fu + * @CreatTime:11/29/2019 - 1:51 PM + * @Version V1.0 + */ +@Slf4j +@RestController +@RequestMapping("/system/post") +public class SysPostController extends BaseController { + + @Autowired + private SysPostService postService; + + + /** + * 获取岗位列表 + */ + @GetMapping(value = "/list") + public AjaxResult list( ) { + List list = postService.lists( ); + return AjaxResult.success( list ); + } + + /** + * 获取岗位分页 + */ + @GetMapping(value = "/page") + public AjaxResult page( Query query) { + log.debug( "--- 分页请求参数 -->>[{}]", query ); + Page page = postService.page( query ); + log.debug( "--- 分页请求返回数据 -->>[{}]", page ); + return AjaxResult.success( page ); + } + + /** + * 新增岗位 + */ + + @LogAnnotation(module = "岗位管理", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody SysPost post) { + if (!postService.checkPostNameUnique( post )) { + return AjaxResult.error( "新增岗位'" + post.getPostName() + "'失败,岗位名称已存在" ); + } + + if (!postService.checkPostCodeUnique( post )) { + return AjaxResult.error( "新增岗位'" + post.getPostName() + "'失败,岗位编码已存在" ); + } + post.setCreateBy( SecurityUtils.getUsername() ); + post.setCreateTime( new Date() ); + postService.insertPost( post ); + return AjaxResult.success(); + } + + /** + * 修改岗位 + */ + @LogAnnotation(module = "岗位管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody SysPost post) { + if (!postService.checkPostNameUnique( post )) { + return AjaxResult.error( "修改岗位'" + post.getPostName() + "'失败,岗位名称已存在" ); + } + if (!postService.checkPostCodeUnique( post )) { + return AjaxResult.error( "修改岗位'" + post.getPostName() + "'失败,岗位编码已存在" ); + } + post.setUpdateBy( SecurityUtils.getUsername() ); + post.setUpdateTime( new Date() ); + postService.updatePost( post ); + return AjaxResult.success(); + } + + /** + * 删除岗位 + */ + @LogAnnotation(module = "岗位管理", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("ids") Long[] ids) { + postService.deleteByIds( ids ) ; + return AjaxResult.success(); + } + + /** + * 根据岗位编号获取详细信息 + */ + @GetMapping(value = "/info") + public AjaxResult info(@RequestParam("id") Long id) { + SysPost find = postService.getByPK(id ); + return AjaxResult.success(find); + } + +} diff --git a/src/main/java/com/chenxuan/controller/SysProfileController.java b/src/main/java/com/chenxuan/controller/SysProfileController.java new file mode 100644 index 0000000..26dacbf --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysProfileController.java @@ -0,0 +1,94 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.enums.OperateType; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.service.SysUserService; + +import com.chenxuan.utils.SecurityUtils; +import com.chenxuan.utils.ServletUtils; +import lombok.extern.java.Log; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +/** + * 个人信息 业务处理 + * + * @author ruoyi + */ +@RestController +@RequestMapping("/system/user/profile") +public class SysProfileController extends BaseController { + @Autowired + private SysUserService sysUserService; + + @Autowired + private JwtTokenService jwtTokenService; + + /** + * 个人信息 + */ + @GetMapping + public AjaxResult profile() { + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest() ); + SysUser user = loginUser.getUser(); + AjaxResult ajax = AjaxResult.success( user ); + ajax.put( "roleGroup", sysUserService.selectUserRoleGroup( loginUser.getUsername() ) ); + ajax.put( "postGroup", sysUserService.selectUserPostGroup( loginUser.getUsername() ) ); + return ajax; + } + + /** + * 修改用户 + */ + @LogAnnotation(module = "个人信息", operateType = OperateType.UPDATE) + @PutMapping + public AjaxResult updateProfile(@RequestBody SysUser user) { + return returnAjax( sysUserService.updateUserProfile( user ) ); + } + + /** + * 重置密码 + */ + @LogAnnotation(module = "个人信息", operateType = OperateType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) { + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest() ); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword( oldPassword, password )) { + return AjaxResult.error( "修改密码失败,旧密码错误" ); + } + if (SecurityUtils.matchesPassword( newPassword, password )) { + return AjaxResult.error( "新密码不能与旧密码相同" ); + } + return returnAjax( sysUserService.resetUserPwd( userName, SecurityUtils.encryptPassword( newPassword ) ) ); + } + + /** + * 头像上传 + */ + @LogAnnotation(module = "用户头像", operateType = OperateType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException { +// if (!file.isEmpty()) { +// LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest() ); +// String avatar = FileUploadUtils.upload( RuoYiConfig.getAvatarPath(), file ); +// if (userService.updateUserAvatar( loginUser.getUsername(), avatar )) { +// AjaxResult ajax = AjaxResult.success(); +// ajax.put( "imgUrl", avatar ); +// loginUser.getUser().setAvatar( avatar ); +// tokenService.setLoginUser( loginUser ); +// return ajax; +// } +// } + return AjaxResult.error( "上传图片异常,请联系管理员" ); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysRoleController.java b/src/main/java/com/chenxuan/controller/SysRoleController.java new file mode 100644 index 0000000..9a03ee6 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysRoleController.java @@ -0,0 +1,154 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.entity.dto.SysRoleDto; +import com.chenxuan.entity.model.SysRole; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.service.SysRoleService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; + + +/** + * @ClassName:SysRoleController + * @Description: 角色信息 + * @Author: Arno_Fu + * @CreatTime:11/30/2019 - 10:36 AM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/system/role") +public class SysRoleController extends BaseController { + + @Autowired + private SysRoleService sysRoleService; + @Autowired + private SysExportDataService sysExportDataService; + + /** + * 角色列表 + * + * @return + */ + @GetMapping("/list") + public AjaxResult list() { + return AjaxResult.success(sysRoleService.lists()); + } + + /** + * 角色分页 + * + * @param query + * @return + */ + @GetMapping("/page") + public AjaxResult page(Query query) { + return AjaxResult.success(sysRoleService.pages(query)); + } + + /** + * 导出角色信息 + * + * @param dto + * @return + */ + @LogAnnotation(module = "角色管理", operateType = OperateType.EXPORT) + @PostMapping("/export") + public AjaxResult export(@RequestBody SysRoleDto dto) { + return sysExportDataService.exportRoleInfo(dto); + } + + /** + * 根据角色编号获取详细信息 + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(@RequestParam("roleId") Long roleId) { + return AjaxResult.success(sysRoleService.getByPK(roleId)); + } + + /** + * 新增角色 + */ + + @LogAnnotation(module = "角色管理", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@Validated @RequestBody SysRole role) { + if (!sysRoleService.checkRoleNameUnique(role)) { + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + if (!sysRoleService.checkRoleKeyUnique(role)) { + return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setCreateBy(SecurityUtils.getUsername()); + role.setCreateTime(new Date()); + return returnAjax(sysRoleService.insertRole(role)); + + } + + /** + * 修改保存角色 + */ + @LogAnnotation(module = "角色管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody SysRole role) { + sysRoleService.checkRoleAllowed(role); + if (!sysRoleService.checkRoleNameUnique(role)) { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); + } + if (!sysRoleService.checkRoleKeyUnique(role)) { + return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); + } + role.setUpdateBy(SecurityUtils.getUsername()); + role.setUpdateTime(new Date()); + return returnAjax(sysRoleService.updateRole(role)); + } + + /** + * 修改保存数据权限 + */ + + @LogAnnotation(module = "角色管理", operateType = OperateType.UPDATE) + @PutMapping("/dataScope") + public AjaxResult dataScope(@RequestBody SysRole role) { + sysRoleService.checkRoleAllowed(role); + return returnAjax(sysRoleService.authDataScope(role)); + } + + /** + * 状态修改 + */ + + @LogAnnotation(module = "角色管理", operateType = OperateType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysRole role) { + sysRoleService.checkRoleAllowed(role); + role.setUpdateBy(SecurityUtils.getUsername()); + return returnAjax(sysRoleService.updateRoleStatus(role)); + } + + /** + * 删除角色 + */ + @LogAnnotation(module = "角色管理", operateType = OperateType.DELETE) + @DeleteMapping("/delete") + public AjaxResult remove(@RequestParam("ids") Long[] ids) { + return returnAjax(sysRoleService.deleteRoleByIds(ids)); + } + + /** + * 获取角色选择框列表 + */ + @GetMapping("/optionselect") + public AjaxResult optionselect() { + return AjaxResult.success(sysRoleService.selectRoleAll()); + } +} diff --git a/src/main/java/com/chenxuan/controller/SysUserController.java b/src/main/java/com/chenxuan/controller/SysUserController.java new file mode 100644 index 0000000..f4a4bed --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysUserController.java @@ -0,0 +1,145 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.service.SysPostService; +import com.chenxuan.service.SysRoleService; +import com.chenxuan.service.SysUserService; +import com.chenxuan.utils.Md5; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; + +@RestController +@RequestMapping("/system/user") +public class SysUserController extends BaseController { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private SysRoleService sysRoleService; + + @Autowired + private SysPostService sysPostService; + @Autowired + private SysExportDataService sysExportDataService; + + + /** + * @Description: 获取用户列表 + * @Param: user + * @Return: TableDataInfo + **/ + @GetMapping(value = "/page") + public AjaxResult page(Query query) { + return AjaxResult.success(sysUserService.page(query)); + } + + /** + * 导出用户信息 + * + * @param query + * @return + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.EXPORT) + @GetMapping("/export") + public AjaxResult export(Query query) { + return sysExportDataService.exportUserInfo(query); + } + + /** + * 新增用户 + * + * @param sysUser + * @return + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.INSERT) + @PostMapping(value = "/add") + public AjaxResult add(@RequestBody SysUser sysUser) { + if (!sysUserService.checkUserNameUnique(sysUser.getUserName())) { + return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,登录账号已存在"); + } + if (!sysUserService.checkPhoneUnique(sysUser)) { + return AjaxResult.error("新增用户'" + sysUser.getUserName() + "'失败,手机号码已存在"); + } + String salt = UuidUtils.getUUID(); + sysUser.setCreateTime(new Date()); + sysUser.setPasswordSalt(salt); + sysUser.setPassword(Md5.getMD5Code(salt + sysUser.getPassword())); + return returnAjax(sysUserService.insertUser(sysUser)); + } + + /** + * 根据用户id获取用户信息 + * + * @param userId + * @return + */ + @GetMapping(value = "/info") + public AjaxResult getInfo(@RequestParam("userId") Long userId) { + AjaxResult ajax = AjaxResult.success(sysUserService.getById(userId)); + ajax.put("postIds", sysPostService.selectPostListByUserId(userId)); + ajax.put("roleIds", sysRoleService.selectRoleListByUserId(userId)); + return ajax; + } + + /** + * 修改用户 + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/update") + public AjaxResult update(@RequestBody SysUser user) { + sysUserService.checkUserAllowed(user); + if (!sysUserService.checkPhoneUnique(user)) { + return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); + } + user.setUpdateBy(SecurityUtils.getUsername()); + user.setUpdateTime(new Date()); + return returnAjax(sysUserService.updateUser(user)); + } + + /** + * 删除用户 + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.DELETE) + @DeleteMapping(value = "/delete") + public AjaxResult remove(@RequestParam("userIds") Long[] userIds) { + return returnAjax(sysUserService.deleteUserByIds(userIds) > 0 ? true : false); + } + + + /** + * 重置密码 + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) { + sysUserService.checkUserAllowed(user); + String salt = UuidUtils.getUUID(); + user.setPasswordSalt(salt); + user.setPassword(Md5.getMD5Code(salt + user.getPassword())); + user.setUpdateBy(SecurityUtils.getUsername()); + return returnAjax(sysUserService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.UPDATE) + @PutMapping(value = "/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) { + sysUserService.checkUserAllowed(user); + user.setUpdateBy(SecurityUtils.getUsername()); + return returnAjax(sysUserService.updateUserStatus(user)); + } + +} diff --git a/src/main/java/com/chenxuan/controller/SysUserOnlineController.java b/src/main/java/com/chenxuan/controller/SysUserOnlineController.java new file mode 100644 index 0000000..1d0a457 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/SysUserOnlineController.java @@ -0,0 +1,80 @@ +package com.chenxuan.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.bean.component.RedisCacheService; +import com.chenxuan.constants.Constants; +import com.chenxuan.entity.model.SysUserOnline; +import com.chenxuan.enums.OperateType; +import com.chenxuan.security.LoginUser; +import com.chenxuan.service.SysUserOnlineService; +import com.chenxuan.utils.StringUtils; +import org.aspectj.weaver.loadtime.Aj; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + + +/** + * @ClassName:SysUserOnlineController + * @Description: 在线用户监控 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:25 PM + * @Version V1.0 + */ + +@RestController +@RequestMapping("/monitor/online") +public class SysUserOnlineController { + @Autowired + private SysUserOnlineService sysUserOnlineService; + + @Autowired + private RedisCacheService redisCacheService; + + @GetMapping("/list") + public AjaxResult list(String ipaddr, String userName) { + Collection keys = redisCacheService.keys( Constants.LOGIN_TOKEN_KEY + "*" ); + List userOnlineList = new ArrayList(); + for (String key : keys) { + LoginUser user = redisCacheService.getCacheObject( key ); + if (StringUtils.isNotEmpty( ipaddr ) && StringUtils.isNotEmpty( userName )) { + if (StringUtils.equals( ipaddr, user.getIpaddr() ) && StringUtils.equals( userName, user.getUsername() )) { + userOnlineList.add( sysUserOnlineService.selectOnlineByInfo( ipaddr, userName, user ) ); + } + } else if (StringUtils.isNotEmpty( ipaddr )) { + if (StringUtils.equals( ipaddr, user.getIpaddr() )) { + userOnlineList.add( sysUserOnlineService.selectOnlineByIpaddr( ipaddr, user ) ); + } + } else if (StringUtils.isNotEmpty( userName ) && StringUtils.isNotNull( user.getUser() )) { + if (StringUtils.equals( userName, user.getUsername() )) { + userOnlineList.add( sysUserOnlineService.selectOnlineByUserName( userName, user ) ); + } + } else { + userOnlineList.add( sysUserOnlineService.loginUserToUserOnline( user ) ); + } + } + Collections.reverse( userOnlineList ); + userOnlineList.removeAll( Collections.singleton( null ) ); + Page page = new Page( ); + page.setRecords( userOnlineList ); + page.setTotal(userOnlineList.size() ); + return AjaxResult.success( page ); + } + + /** + * 强退用户 + */ + @LogAnnotation(module= "在线用户", operateType = OperateType.DELETE) + @DeleteMapping("/{tokenId}") + public AjaxResult forceLogout(@PathVariable String tokenId) { + redisCacheService.deleteObject( Constants.LOGIN_TOKEN_KEY + tokenId ); + return AjaxResult.success(); + } +} diff --git a/src/main/java/com/chenxuan/controller/TestController.java b/src/main/java/com/chenxuan/controller/TestController.java new file mode 100644 index 0000000..dc92825 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/TestController.java @@ -0,0 +1,20 @@ +package com.chenxuan.controller; + +import com.chenxuan.base.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Api(tags = "swaager测试") +@RestController +@RequestMapping("/test") +public class TestController extends BaseController { + @ApiOperation(value = "测试") + @PostMapping(value = "/info") + public String info() { + + return "test Success"; + } +} diff --git a/src/main/java/com/chenxuan/controller/remote/BusiMainDeviceRemoteController.java b/src/main/java/com/chenxuan/controller/remote/BusiMainDeviceRemoteController.java new file mode 100644 index 0000000..91b8747 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/remote/BusiMainDeviceRemoteController.java @@ -0,0 +1,32 @@ +package com.chenxuan.controller.remote; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.service.remote.RemoteService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +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; + +import java.util.Map; + +@Api(tags = "主变设置") +@RestController +@RequestMapping(value = "remote/busiMainDeviceRemote") +public class BusiMainDeviceRemoteController extends BaseController { + @Autowired + private RemoteService remoteService; + /** + * @Description: 获取运行异常设备总数BusiMainDeviceController + * @Param: + * @Return: + **/ + @ApiOperation(value = "获取设备总数") + @GetMapping(value = "/findTransformerSubTree") + public AjaxResult findTransformerSubTree() { + Map map = remoteService.findTransformerSubTree(); + return AjaxResult.success(map); + } +} diff --git a/src/main/java/com/chenxuan/controller/remote/SysLoginRemoteController.java b/src/main/java/com/chenxuan/controller/remote/SysLoginRemoteController.java new file mode 100644 index 0000000..5493384 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/remote/SysLoginRemoteController.java @@ -0,0 +1,90 @@ +package com.chenxuan.controller.remote; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.constants.Constants; +import com.chenxuan.entity.model.SysMenu; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.CustomPermissionService; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.security.service.LoginService; +import com.chenxuan.service.SysMenuService; +import com.chenxuan.utils.ServletUtils; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Set; + +/** + * @ClassName:SysLoginController + * @Description: 登录验证 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 1:47 PM + * @Version V1.0 + */ +@Api(tags = "远程调用登录接口") +@RestController +@RequestMapping(value = BusiUrlConstants.REMOTE_LOGIN) +public class SysLoginRemoteController { + + @Autowired + private LoginService loginService; + + @Autowired + private SysMenuService menuService; + + @Autowired + private CustomPermissionService customPermissionService; + + @Autowired + private JwtTokenService jwtTokenService; + /** + * @return com.chenxuan.domain.AjaxResult + * @Description 登录方法 + */ + @PostMapping("/login") + public AjaxResult login(@RequestBody SysUser sysUser) { + + AjaxResult ajax = AjaxResult.success(); + String token = loginService.remoteLogin(sysUser.getUserName(), sysUser.getPassword()); + ajax.put(Constants.TOKEN, token); + return ajax; + } + /** + * @Description 获取用户信息 + * + * @return com.chenxuan.base.entity.AjaxResult + */ + @GetMapping("getInfo") + public AjaxResult getInfo(){ + SysUser user = getSysUser(); + // 权限集合 + Set permissions = customPermissionService.getMenuPermission(user); + // 角色集合 + Set roles = customPermissionService.getRolePermission(user); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + return ajax; + } + /** + * @Description 获取路由信息 + * + * @return com.chenxuan.base.entity.AjaxResult + */ + @GetMapping("getRouters") + public AjaxResult getRouters(){ + SysUser user = getSysUser(); + List menus = menuService.getMenuTreeByUserId(user); + return AjaxResult.success(menuService.buildMenus(menus)); + } + + private SysUser getSysUser() { + LoginUser loginUser = jwtTokenService.getLoginUser( ServletUtils.getRequest()); + return loginUser.getUser(); + } +} diff --git a/src/main/java/com/chenxuan/controller/remote/SysUserRemoteController.java b/src/main/java/com/chenxuan/controller/remote/SysUserRemoteController.java new file mode 100644 index 0000000..1d98506 --- /dev/null +++ b/src/main/java/com/chenxuan/controller/remote/SysUserRemoteController.java @@ -0,0 +1,70 @@ +package com.chenxuan.controller.remote; + +import com.chenxuan.base.controller.BaseController; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.bean.annotation.LogAnnotation; +import com.chenxuan.constants.BusiUrlConstants; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.enums.OperateType; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.service.SysPostService; +import com.chenxuan.service.SysRoleService; +import com.chenxuan.service.SysUserService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Date; +import java.util.Map; + +@RestController +//@RequestMapping("/remote/user") +@RequestMapping(value = BusiUrlConstants.REMOTE_USER) +public class SysUserRemoteController extends BaseController { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private SysRoleService sysRoleService; + + @Autowired + private SysPostService sysPostService; + @Autowired + private SysExportDataService sysExportDataService; + + /** + * 新增用户 + * + * @param param + * @return + */ + @LogAnnotation(module = "用户管理", operateType = OperateType.INSERT) + @RequestMapping(value = "/addUser",method = RequestMethod.POST) + public AjaxResult add(@RequestBody Map param) { + if (!sysUserService.checkUserNameUnique(param.get("userName").toString())) { + return AjaxResult.error("新增用户'" + param.get("userName") + "'失败,登录账号已存在"); + } + if (!sysUserService.checkPhoneUnique(param.get("phone").toString())) { + return AjaxResult.error("新增用户'" + param.get("userName") + "'失败,手机号码已存在"); + } + SysUser sysUser = new SysUser(); + String userName = param.get("userName").toString(); + String nickName= userName; +// if(userName.length()>8) +// { +// nickName = userName.substring(0,7); +// } + sysUser.setUserName(userName); + sysUser.setNickName(nickName); + + sysUser.setCreateTime(new Date()); + sysUser.setPassword(SecurityUtils.encryptPassword(param.get("password").toString())); + sysUser.setEmail(param.get("email").toString()); + sysUser.setPhone(param.get("phone").toString()); + return returnAjax(sysUserService.insertUser(sysUser)); + } +} diff --git a/src/main/java/com/chenxuan/entity/dto/AmplitudeDto.java b/src/main/java/com/chenxuan/entity/dto/AmplitudeDto.java new file mode 100644 index 0000000..2650acc --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/AmplitudeDto.java @@ -0,0 +1,26 @@ +package com.chenxuan.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class AmplitudeDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 名称 + */ + @ApiModelProperty(value="名称", name="name") + private String name; + + /** + * 数据集合 + */ + @ApiModelProperty(value="数据集合", name="data") + private List data; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiAmpliComtradResultDto.java b/src/main/java/com/chenxuan/entity/dto/BusiAmpliComtradResultDto.java new file mode 100644 index 0000000..55ae602 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiAmpliComtradResultDto.java @@ -0,0 +1,96 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class BusiAmpliComtradResultDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final String PRISIDE = "P"; // 原边 + public static final String SECSIDE = "S"; // 副边 + + public static final String APHASE = "A"; // A相 + public static final String BPHASE = "B"; // B相 + public static final String CPHASE = "C"; // C相 + + public static final String UINOUT = "U"; // 上侧 + public static final String DINOUT = "D"; // 下侧 + + /** + * id + */ + @ApiModelProperty(value="id", name="id") + private String id; + + /** + * 录播文件记录id + */ + @ApiModelProperty(value="录播文件记录id", name="fileId") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置id", name="subId") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="loadType") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value="原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name="side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value="相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name="phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value="上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name="inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value="振动频率", name="frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value="最大振幅", name="maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDetailsDto.java b/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDetailsDto.java new file mode 100644 index 0000000..3fbefc6 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDetailsDto.java @@ -0,0 +1,109 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BusiAmpliRealDetailsDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)", name = "inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 负载类型 + */ + @ApiModelProperty(value = "负载类型", name = "loadType") + private String loadType; + + /** + * 日增长率 + */ + @ApiModelProperty(value = "日增长率", name = "dayRate") + private String dayRate; + + /** + * 月增长率 + */ + @ApiModelProperty(value = "月增长率", name = "monthRate") + private String monthRate; + + /** + * 月偏差率 + */ + @ApiModelProperty(value = "月偏差率", name = "deviationRate") + private String deviationRate; + + /** + * 开始日期 + */ + @ApiModelProperty(value = "开始日期", name = "startTime") + private String startTime; + + /** + * 终止日期 + */ + @ApiModelProperty(value = "终止日期", name = "endTime") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDto.java b/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDto.java new file mode 100644 index 0000000..458de2a --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiAmpliRealDto.java @@ -0,0 +1,127 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName:BusiAmpliRealDto + * @Description: 振动实时数据表Dto + * @Author:Jordan_Li + * @CreatTime:6/22/2020 - 16:20 PM + * @Version V1.0 + */ +@Data +public class BusiAmpliRealDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final String D = "day"; //日 + public static final String W = "week"; //周 + public static final String M = "month"; //月 + + /** + * id + */ + @ApiModelProperty(value = "id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(value = "设备名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value = "负载类型 1:空载 2:负载", name = "loadType") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name = "inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 开始日期 + */ + @ApiModelProperty(value = "开始日期", name = "startTime") + private String startTime; + + /** + * 终止日期 + */ + @ApiModelProperty(value = "终止日期", name = "endTime") + private String endTime; + + /** + * 周期类型 + */ + @ApiModelProperty(value = "周期类型", name = "dateType") + private String dateType; + + /** + * 统计时间 + */ + @ApiModelProperty(value = "统计时间", name = "createTime") + private String createTime; + + /** + * 录播文件id + */ + @ApiModelProperty(value = "录播文件id", name = "fileId") + private String fileId; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiAmpliThresholdConfDto.java b/src/main/java/com/chenxuan/entity/dto/BusiAmpliThresholdConfDto.java new file mode 100644 index 0000000..70016df --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiAmpliThresholdConfDto.java @@ -0,0 +1,119 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author Carrey Zheng + * @create 2020-07-13 5:56 PM + **/ +@Data +public class BusiAmpliThresholdConfDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 主变名称 + */ + @ApiModelProperty(value = "主变名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 装置名称 + */ + @ApiModelProperty(value = "装置名称", name = "subDeviceName") + private String subDeviceName; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)", name = "deviceType") + private String deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)", name = "inAndOut") + private String inAndOut; + + /** + * 频率段ID + */ + @ApiModelProperty(value = "频率段ID", name = "frequencyId") + private String frequencyId; + + /** + * 频率 + */ + @ApiModelProperty(value = "频率", name = "frequency") + private String frequency; + + /** + * 频率状态 + */ + @ApiModelProperty(value = "频率状态", name = "state") + private String state; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value = "振幅阈值(mm/s2)", name = "amplitude") + private String amplitude; + + /** + * 振动幅值日增长率(%) + */ + @ApiModelProperty(value = "振动幅值日增长率(%)", name = "dayRate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value = "振动幅值月增长率(%)", name = "monthRate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value = "振动幅值月偏差率(%)", name = "deviationRate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiCalcParamConfDto.java b/src/main/java/com/chenxuan/entity/dto/BusiCalcParamConfDto.java new file mode 100644 index 0000000..82b36dd --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiCalcParamConfDto.java @@ -0,0 +1,129 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Data +public class BusiCalcParamConfDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主设备ID + */ + @ApiModelProperty(name = "mainEquipmentId", value = "主设备ID") + private String mainEquipmentId; + + /** + * 1:第一级分项权重 2:第二级 3:第三级 + */ + @ApiModelProperty(name = "weightLevel", value = "1:第一级分项权重 2:第二级 3:第三级") + private String weightLevel; + + /** + * 1:高压端 2:低压端 3:中心点 4:噪声 + */ + private String hltype; + + /** + * 计算指标的名称 + */ + @ApiModelProperty(name = "name", value = "计算指标的名称") + private String name; + + /** + * 上级计算指标名称 + */ + @ApiModelProperty(name = "pname", value = "上级计算指标名称") + private String pname; + + /** + * 描述 + */ + @ApiModelProperty(name = "description", value = "描述") + private String description; + + /** + * 权重值 + */ + @ApiModelProperty(name = "value", value = "权重值") + private BigDecimal value; + + /** + * 是否显示AB值:0——否;1——是 + */ + @ApiModelProperty(name = "abValueFlag", value = "是否显示AB值:0——否;1——是") + private String abValueFlag; + + /** + * a值 + */ + @ApiModelProperty(name = "aValue", value = "a值") + private BigDecimal aValue; + + /** + * b值 + */ + @ApiModelProperty(name = "bValue", value = "b值") + private BigDecimal bValue; + + /** + * 注意值 + */ + @ApiModelProperty(name = "warningValue", value = "注意值") + private String warningValue; + + /** + * 评分模型:1:升 2:降 + */ + @ApiModelProperty(name = "model", value = "评分模型:1:升 2:降") + private String model; + + /** + * 单位 + */ + @ApiModelProperty(name = "unit", value = "单位") + private String unit; + + /** + * 是否参与评测: 0:不参与 1:参与 + */ + @ApiModelProperty(name = "isAttend", value = "是否参与评测: 0:不参与 1:参与") + private String isAttend; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "createTime", value = "创建时间") + private Date createTime; + + /** + * 创建人 + */ + @ApiModelProperty(name = "createUser", value = "创建人") + private String createUser; + + /** + * 排序 + */ + @ApiModelProperty(name = "sortNum", value = "排序") + private Integer sortNum; + + /** + * 下级计算指标列表 + */ + @ApiModelProperty(name = "children", value = "下级计算指标列表") + private List children; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiCenterRealDto.java b/src/main/java/com/chenxuan/entity/dto/BusiCenterRealDto.java new file mode 100644 index 0000000..6b15eab --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiCenterRealDto.java @@ -0,0 +1,90 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-06-22 3:01 PM + **/ +@Data +public class BusiCenterRealDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(name = "frequency", value = "振动频率") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(name = "maxAmplitude", value = "最大振幅") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(name = "gatherTimeList", value = "统计时间集合") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(name = "maxAmplitudeList", value = "最大幅值集合") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(name = "createTime", value = "统计时间") + private String createTime; + + /** + * 开始日期 + */ + @ApiModelProperty(name = "startTime", value = "开始日期") + private String startTime; + + /** + * 结束日期 + */ + @ApiModelProperty(name = "endTime", value = "结束日期") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiCenterThresholdConfDto.java b/src/main/java/com/chenxuan/entity/dto/BusiCenterThresholdConfDto.java new file mode 100644 index 0000000..b737357 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiCenterThresholdConfDto.java @@ -0,0 +1,93 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName:BusiCenterThresholdConfVo + * @Description: 中心点电流阈值配置表Vo + * @Author:Jordan_Li + * @CreatTime:6/8/2020 - 13:15 PM + * @Version V1.0 + */ +@Data +public class BusiCenterThresholdConfDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 主变装置id + */ + @ApiModelProperty(name = "subId", value = "主变装置id") + private String subId; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 正电流(A) + */ + @ApiModelProperty(name = "positive", value = "正电流(A)") + private String positive; + + /** + * 负电流(A) + */ + @ApiModelProperty(name = "negative", value = "负电流(A)") + private String negative; + + /** + * 中心点电流日增长率(%) + */ + @ApiModelProperty(name = "dayRate", value = "中心点电流日增长率(%)") + private String dayRate; + + /** + * 中心点电流月增长率(%) + */ + @ApiModelProperty(name = "monthRate", value = "中心点电流月增长率(%)") + private String monthRate; + + /** + * 中心点电流月偏差率(%) + */ + @ApiModelProperty(name = "deviationRate", value = "中心点电流月偏差率(%)") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiIedparamDto.java b/src/main/java/com/chenxuan/entity/dto/BusiIedparamDto.java new file mode 100644 index 0000000..a0b06b0 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiIedparamDto.java @@ -0,0 +1,31 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author buck_guo + */ +@Data +public class BusiIedparamDto extends Query implements Serializable { + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + private String nodeId; + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + private String nodeName; + + /** + * 振动类型 + */ + @ApiModelProperty(value="振动类型", name="nodeType") + private String nodeType; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiMainDeviceDto.java b/src/main/java/com/chenxuan/entity/dto/BusiMainDeviceDto.java new file mode 100644 index 0000000..3393a19 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiMainDeviceDto.java @@ -0,0 +1,79 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BusiMainDeviceDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 主变状态 (N(0):非正常 Y(1):正常) + */ + @ApiModelProperty(name = "state", value = "主变状态 (N(0):非正常 Y(1):正常)") + private String state; + + /** + * 投运日期 + */ + @ApiModelProperty(name = "deliveryTime", value = "投运日期") + private String deliveryTime; + + /** + * 设备型号 + */ + @ApiModelProperty(name = "deviceModel", value = "设备型号") + private String deviceModel; + + /** + * 制造厂家名称 + */ + @ApiModelProperty(name = "manufacturer", value = "制造厂家名称") + private String manufacturer; + + /** + * 出厂日期 + */ + @ApiModelProperty(name = "factoryTime", value = "出厂日期") + private String factoryTime; + + /** + * 出厂序号 + */ + @ApiModelProperty(name = "factoryNumber", value = "出厂序号") + private String factoryNumber; + + /** + * 设计使用寿命(年) + */ + @ApiModelProperty(name = "designLife", value = "设计使用寿命(年)") + private String designLife; + + /** + * 系统编码 + */ + @ApiModelProperty(name = "systemCode", value = "系统编码") + private String systemCode; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiNoiseRealDto.java b/src/main/java/com/chenxuan/entity/dto/BusiNoiseRealDto.java new file mode 100644 index 0000000..a0f9379 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiNoiseRealDto.java @@ -0,0 +1,94 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @ClassName:BusiNoiseRealDto + * @Description: 噪声实时数据表Dto + * @Author:Jordan_Li + * @CreatTime:6/22/2020 - 15:50 PM + * @Version V1.0 + */ +@Data +public class BusiNoiseRealDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(name = "frequency", value = "振动频率") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(name = "maxAmplitude", value = "最大振幅") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(name = "gatherTimeList", value = "统计时间集合") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(name = "maxAmplitudeList", value = "最大幅值集合") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(name = "createTime", value = "统计时间") + private String createTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiNoiseThresholdConfDto.java b/src/main/java/com/chenxuan/entity/dto/BusiNoiseThresholdConfDto.java new file mode 100644 index 0000000..d876cb6 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiNoiseThresholdConfDto.java @@ -0,0 +1,87 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName:BusiNoiseThresholdConfVo + * @Description: 噪声装置阈值配置Vo + * @Author:Jordan_Li + * @CreatTime:6/11/2020 - 16:16 PM + * @Version V1.0 + */ +@Data +public class BusiNoiseThresholdConfDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 主变装置id + */ + @ApiModelProperty(name = "subId", value = "主变装置id") + private String subId; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 噪声阈值(db) + */ + @ApiModelProperty(name = "noise", value = "噪声阈值(db)") + private String noise; + + /** + * 噪声日增长率(%) + */ + @ApiModelProperty(name = "dayRate", value = "噪声日增长率(%)") + private String dayRate; + + /** + * 噪声月增长率(%) + */ + @ApiModelProperty(name = "monthRate", value = "噪声月增长率(%)") + private String monthRate; + + /** + * 噪声月偏差率(%) + */ + @ApiModelProperty(name = "deviationRate", value = "噪声月偏差率(%)") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiParamBindDto.java b/src/main/java/com/chenxuan/entity/dto/BusiParamBindDto.java new file mode 100644 index 0000000..590506b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiParamBindDto.java @@ -0,0 +1,67 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BusiParamBindDto extends Query implements Serializable { + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + private String subId; + + /** + * 传感器code + */ + @ApiModelProperty(value="传感器code,源自表busi_sub_device.sensor_code", name="sensorCode") + private String sensorCode; + + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + private String nodeId; + + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + private String nodeName; + + /** + * 频率(Hz) + */ + @ApiModelProperty(value="频率(Hz)", name="frequency") + private String frequency; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "subDeviceName", value = "装置名称") + private String subDeviceName; + +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiSubDeviceDto.java b/src/main/java/com/chenxuan/entity/dto/BusiSubDeviceDto.java new file mode 100644 index 0000000..2e2798f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiSubDeviceDto.java @@ -0,0 +1,110 @@ +package com.chenxuan.entity.dto; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Carrey Zheng + * @create 2020-06-30 2:48 PM + **/ +@Data +public class BusiSubDeviceDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final Integer Ampli = 1; //传感器 + public static final Integer NOISE = 2; //噪声 + public static final Integer CENTER = 3; //中心点 + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "subDeviceName", value = "装置名称") + private String subDeviceName; + + /** + * 传感器编码 + */ + @ApiModelProperty(name = "sensorCode", value = "传感器编码") + private String sensorCode; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(name = "deviceType", value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)") + private Integer deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "side", value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "phase", value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(name = "inOut", value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)") + private String inOut; + + /** + * 创建日期 + */ + @ApiModelProperty(name = "insTime", value = "创建日期") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; + + /** + * 请求参数 + */ + @ApiModelProperty(name = "params", value = "请求参数") + private Object params; + + public Map getParams() { + if (params == null) { + return new HashMap<>(); + } + return JSON.parseObject(JSONObject.toJSONString(params), Map.class); + } +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiTransformerRealDto.java b/src/main/java/com/chenxuan/entity/dto/BusiTransformerRealDto.java new file mode 100644 index 0000000..545ea55 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiTransformerRealDto.java @@ -0,0 +1,80 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@Data +public class BusiTransformerRealDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "side", value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)") + private String side; + + /** + * 电压(kV) + */ + @ApiModelProperty(name = "voltage", value = "电压(kV)") + private BigDecimal voltage; + + /** + * 电流(A) + */ + @ApiModelProperty(name = "current", value = "电流(A)") + private BigDecimal current; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 导出时间 + */ + @ApiModelProperty(name = "createTime", value = "导出时间") + private String createTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiVibrationContrastDto.java b/src/main/java/com/chenxuan/entity/dto/BusiVibrationContrastDto.java new file mode 100644 index 0000000..51a681f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiVibrationContrastDto.java @@ -0,0 +1,195 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +public class BusiVibrationContrastDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 线电压(kV) + */ + @ApiModelProperty(name = "voltage", value = "线电压(kV)") + private String voltage; + + /** + * 线电流(A) + */ + @ApiModelProperty(name = "electricity", value = "线电流(A)") + private String electricity; + + /** + * 电压-幅值 横坐标(kV) + */ + @ApiModelProperty(name = "uAmplitudeList", value = "电压-幅值 横坐标(kV)") + private List uAmplitudeList; + + /** + * 电流-幅值 横坐标(A) + */ + @ApiModelProperty(name = "iAmplitudeList", value = "电流-幅值 横坐标(A)") + private List iAmplitudeList; + + /** + * 电压铁芯振动幅值 + */ + @ApiModelProperty(name = "coreUList", value = "电压铁芯振动幅值") + private List coreUList; + + /** + * 电流绕组振动幅值 + */ + @ApiModelProperty(name = "windingIList", value = "电流绕组振动幅值") + private List windingIList; + + /** + * 当前线电压下铁芯振动幅值 + */ + @ApiModelProperty(name = "uAccList", value = "当前线电压下铁芯振动幅值") + private List uAccList; + + /** + * 当前线电流下绕组振动幅值 + */ + @ApiModelProperty(name = "iAccList", value = "当前线电流下绕组振动幅值") + private List iAccList; + + /** + * 频率集合 + */ + @ApiModelProperty(name = "frequencyList", value = "频率集合") + private List frequencyList; + + /** + * 铁芯最大幅值 + */ + @ApiModelProperty(name = "maxCoreAmplitude", value = "铁芯最大幅值") + private BigDecimal maxCoreAmplitude; + + /** + * 绕组最大幅值 + */ + @ApiModelProperty(name = "maxWindingAmplitude", value = "绕组最大幅值") + private BigDecimal maxWindingAmplitude; + + /** + * 铁芯对应频率 + */ + @ApiModelProperty(name = "coreFrequency", value = "铁芯对应频率") + private String coreFrequency; + + /** + * 绕组对应频率 + */ + @ApiModelProperty(name = "windingFrequency", value = "绕组对应频率") + private String windingFrequency; + + public String getVoltage() { + return voltage; + } + + public void setVoltage(String voltage) { + this.voltage = voltage; + } + + public String getElectricity() { + return electricity; + } + + public void setElectricity(String electricity) { + this.electricity = electricity; + } + + public List getuAmplitudeList() { + return uAmplitudeList; + } + + public void setuAmplitudeList(List uAmplitudeList) { + this.uAmplitudeList = uAmplitudeList; + } + + public List getiAmplitudeList() { + return iAmplitudeList; + } + + public void setiAmplitudeList(List iAmplitudeList) { + this.iAmplitudeList = iAmplitudeList; + } + + public List getCoreUList() { + return coreUList; + } + + public void setCoreUList(List coreUList) { + this.coreUList = coreUList; + } + + public List getWindingIList() { + return windingIList; + } + + public void setWindingIList(List windingIList) { + this.windingIList = windingIList; + } + + public List getuAccList() { + return uAccList; + } + + public void setuAccList(List uAccList) { + this.uAccList = uAccList; + } + + public List getiAccList() { + return iAccList; + } + + public void setiAccList(List iAccList) { + this.iAccList = iAccList; + } + + public List getFrequencyList() { + return frequencyList; + } + + public void setFrequencyList(List frequencyList) { + this.frequencyList = frequencyList; + } + + public BigDecimal getMaxCoreAmplitude() { + return maxCoreAmplitude; + } + + public void setMaxCoreAmplitude(BigDecimal maxCoreAmplitude) { + this.maxCoreAmplitude = maxCoreAmplitude; + } + + public BigDecimal getMaxWindingAmplitude() { + return maxWindingAmplitude; + } + + public void setMaxWindingAmplitude(BigDecimal maxWindingAmplitude) { + this.maxWindingAmplitude = maxWindingAmplitude; + } + + public String getCoreFrequency() { + return coreFrequency; + } + + public void setCoreFrequency(String coreFrequency) { + this.coreFrequency = coreFrequency; + } + + public String getWindingFrequency() { + return windingFrequency; + } + + public void setWindingFrequency(String windingFrequency) { + this.windingFrequency = windingFrequency; + } +} diff --git a/src/main/java/com/chenxuan/entity/dto/BusiWarningDto.java b/src/main/java/com/chenxuan/entity/dto/BusiWarningDto.java new file mode 100644 index 0000000..914e244 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/BusiWarningDto.java @@ -0,0 +1,199 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName:BusiWarningVo + * @Description: 告警信息Vo + * @Author:Jordan_Li + * @CreatTime:6/18/2020 - 16:29 PM + * @Version V1.0 + */ +@Data +public class BusiWarningDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final String SOLVE = "0"; // 已处理 + public static final String UNSOLVE = "1"; // 未处理 + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 装置ID,源自表busi_sub_device.id + */ + @ApiModelProperty(name = "subId", value = "装置ID,源自表busi_sub_device.id") + private String subId; + + /** + * 告警时间 + */ + @ApiModelProperty(name = "warnTime", value = "告警时间") + private String warnTime; + + /** + * 告警分类 1:通信异常告警 2:装置自检异常告警 3:信号异常告警 4:供电异常告警 5:振动阈值告警 + * 6:噪声阈值告警 7:中心点阈值告警 8:日增长率告警 9:月增长率告警 10:月偏差率告警 + * 11:服务器与IED通信异常 12:传感器振动告警 13:传感器噪声告警 14:传感器中心点告警 + */ + @ApiModelProperty(name = "warnType", value = "告警分类") + private String warnType; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(name = "loadType", value = "负载类型 1:空载 2:负载") + private String loadType; + + /** + * 采样值 + */ + @ApiModelProperty(name = "sampleValue", value = "采样值") + private String sampleValue; + + /** + * 采样值单位(A)(db)(mm/s2) + */ + @ApiModelProperty(name = "valueUnit", value = "采样值单位(A)(db)(mm/s2)") + private String valueUnit; + + /** + * 告警信息/设备名称/设备安装位置 + */ + @ApiModelProperty(name = "warnDesc", value = "告警信息/设备名称/设备安装位置") + private String warnDesc; + + /** + * 告警级别 0:高 1:中 2:低 + */ + @ApiModelProperty(name = "warnLevel", value = "告警级别 0:高 1:中 2:低") + private String warnLevel; + + /** + * 处理状态 0:已处理 1:未处理 + */ + @ApiModelProperty(name = "state", value = "处理状态 0:已处理 1:未处理") + private String state; + + /** + * 处理结果描述 + */ + @ApiModelProperty(name = "process", value = "处理结果描述") + private String process; + + /** + * 处理人id + */ + @ApiModelProperty(name = "processUser", value = "处理人id") + private String processUser; + + /** + * 处理时间 + */ + @ApiModelProperty(name = "processTime", value = "处理时间") + private String processTime; + + /** + * hbase同步主键 + */ + @ApiModelProperty(name = "hbaseKey", value = "hbase同步主键") + private String hbaseKey; + + /** + * 装置位置 + */ + @ApiModelProperty(name = "deviceLocation", value = "装置位置") + private String deviceLocation; + + /** + * 振幅阈值 + */ + @ApiModelProperty(name = "amplitudeThreshold", value = "振幅阈值") + private String amplitudeThreshold; + + /** + * 振幅增长率 + */ + @ApiModelProperty(name = "amplitudeRate", value = "振幅增长率") + private String amplitudeRate; + + /** + * 电流阈值 + */ + @ApiModelProperty(name = "currentThreshold", value = "电流阈值") + private String currentThreshold; + + /** + * 电流增长率 + */ + @ApiModelProperty(name = "currentRate", value = "电流增长率") + private String currentRate; + + /** + * 噪声阈值 + */ + @ApiModelProperty(name = "noiseThreshold", value = "噪声阈值") + private String noiseThreshold; + + /** + * 噪声增长率 + */ + @ApiModelProperty(name = "noiseRate", value = "噪声增长率") + private String noiseRate; + + /** + * 增长率 + */ + @ApiModelProperty(name = "rate", value = "增长率") + private String rate; + + /** + * 预警值 + */ + @ApiModelProperty(name = "threshold", value = "预警值") + private String threshold; + + /** + * 设备类型 + */ + @ApiModelProperty(name = "deviceType", value = "设备类型") + private String deviceType; + + /** + * 告警次数 + */ + @ApiModelProperty(name = "warningSum", value = "告警次数") + private String warningSum; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "deviceName", value = "装置名称") + private String deviceName; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/ScheduleJobDto.java b/src/main/java/com/chenxuan/entity/dto/ScheduleJobDto.java new file mode 100644 index 0000000..e8af267 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/ScheduleJobDto.java @@ -0,0 +1,80 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ScheduleJobDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 参数主键 + */ + @ApiModelProperty(name = "jobId", value = "参数主键") + private Long jobId; + + /** + * cron表达式 + */ + @ApiModelProperty(name = "cronExpression", value = "cron表达式") + private String cronExpression; + + /** + * 服务名称 + */ + @ApiModelProperty(name = "beanName", value = "服务名称") + private String beanName; + + /** + * 方法名称 + */ + @ApiModelProperty(name = "methodName", value = "方法名称") + private String methodName; + + /** + * 方法参数 + */ + @ApiModelProperty(name = "methodParams", value = "方法参数") + private String methodParams; + + /** + * 状态 1.启动 2.暂停 + */ + @ApiModelProperty(name = "status", value = "状态 1.启动 2.暂停") + private String status; + + /** + * 创建者 + */ + @ApiModelProperty(name = "createBy", value = "创建者") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "createTime", value = "创建时间") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(name = "updateBy", value = "更新者") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(name = "updateTime", value = "更新时间") + private Date updateTime; + + /** + * 备注 + */ + @ApiModelProperty(name = "remark", value = "备注") + private String remark; +} diff --git a/src/main/java/com/chenxuan/entity/dto/SysLoginLogDto.java b/src/main/java/com/chenxuan/entity/dto/SysLoginLogDto.java new file mode 100644 index 0000000..e7e2a84 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/SysLoginLogDto.java @@ -0,0 +1,80 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class SysLoginLogDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 登录id + */ + @ApiModelProperty(name = "loginId", value = "登录id") + private Long loginId; + + /** + * 用户账号 + */ + @ApiModelProperty(name = "userName", value = "用户账号") + private String userName; + + /** + * 登录状态 0成功 1失败 + */ + @ApiModelProperty(name = "status", value = "登录状态 0成功 1失败") + private String status; + + /** + * 登录IP地址 + */ + @ApiModelProperty(name = "ipaddr", value = "登录IP地址") + private String ipaddr; + + /** + * 登录地点 + */ + @ApiModelProperty(name = "loginLocation", value = "登录地点") + private String loginLocation; + + /** + * 浏览器类型 + */ + @ApiModelProperty(name = "browser", value = "浏览器类型") + private String browser; + + /** + * 操作系统 + */ + @ApiModelProperty(name = "os", value = "操作系统") + private String os; + + /** + * 提示消息 + */ + @ApiModelProperty(name = "msg", value = "提示消息") + private String msg; + + /** + * 访问时间 + */ + @ApiModelProperty(name = "loginTime", value = "访问时间") + private Date loginTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "beginTime", value = "开始时间") + private String beginTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/dto/SysOperLogDto.java b/src/main/java/com/chenxuan/entity/dto/SysOperLogDto.java new file mode 100644 index 0000000..c1f96e7 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/SysOperLogDto.java @@ -0,0 +1,116 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class SysOperLogDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 日志主键 + */ + @ApiModelProperty(name = "operId", value = "日志主键") + private Long operId; + + /** + * 操作模块 + */ + @ApiModelProperty(name = "modules", value = "操作模块") + private String modules; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + @ApiModelProperty(name = "businessType", value = "业务类型") + private Integer businessType; + + /** + * 请求方法 + */ + @ApiModelProperty(name = "method", value = "请求方法") + private String method; + + /** + * 请求方式 + */ + @ApiModelProperty(name = "requestMethod", value = "请求方式") + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + @ApiModelProperty(name = "operateType", value = "操作类别") + private Integer operateType; + + /** + * 操作人员 + */ + @ApiModelProperty(name = "operName", value = "操作人员") + private String operName; + + /** + * 部门名称 + */ + @ApiModelProperty(name = "deptName", value = "部门名称") + private String deptName; + + /** + * 操作url + */ + @ApiModelProperty(name = "operUrl", value = "操作url") + private String operUrl; + + /** + * 操作地址 + */ + @ApiModelProperty(name = "operIp", value = "操作地址") + private String operIp; + + /** + * 操作地点 + */ + @ApiModelProperty(name = "operLocation", value = "操作地点") + private String operLocation; + + /** + * 请求参数 + */ + @ApiModelProperty(name = "operParam", value = "请求参数") + private String operParam; + + /** + * 返回参数 + */ + @ApiModelProperty(name = "jsonResult", value = "返回参数") + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + @ApiModelProperty(name = "status", value = "操作状态") + private Integer status; + + /** + * 错误消息 + */ + @ApiModelProperty(name = "errorMsg", value = "错误消息") + private String errorMsg; + + /** + * 操作时间 + */ + @ApiModelProperty(name = "operTime", value = "操作时间") + private Date operTime; + + /** + * 业务类型数组 + */ + @ApiModelProperty(name = "businessTypes", value = "业务类型数组") + private Integer[] businessTypes; +} diff --git a/src/main/java/com/chenxuan/entity/dto/SysRoleDto.java b/src/main/java/com/chenxuan/entity/dto/SysRoleDto.java new file mode 100644 index 0000000..452d6e0 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/dto/SysRoleDto.java @@ -0,0 +1,98 @@ +package com.chenxuan.entity.dto; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class SysRoleDto extends Query implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + @ApiModelProperty(name = "roleId", value = "角色ID") + private Long roleId; + + /** + * 角色名称 + */ + @ApiModelProperty(name = "roleName", value = "角色名称") + private String roleName; + + /** + * 角色权限字符串 + */ + @ApiModelProperty(name = "roleKey", value = "角色权限字符串") + private String roleKey; + + /** + * 显示顺序 + */ + @ApiModelProperty(name = "roleSort", value = "显示顺序") + private Integer roleSort; + + /** + * 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) + */ + @ApiModelProperty(name = "dataScope", value = "数据范围") + private String dataScope; + + /** + * 角色状态(0正常 1停用) + */ + @ApiModelProperty(name = "status", value = "角色状态") + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + @ApiModelProperty(name = "delFlag", value = "删除标志") + private String delFlag; + + /** + * 创建者 + */ + @ApiModelProperty(name = "createBy", value = "创建者") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "createTime", value = "创建时间") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(name = "updateBy", value = "更新者") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(name = "updateTime", value = "更新时间") + private Date updateTime; + + /** + * 备注 + */ + @ApiModelProperty(name = "remark", value = "备注") + private String remark; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "beginTime", value = "开始时间") + private String beginTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliComtrad.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliComtrad.java new file mode 100644 index 0000000..47e2034 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliComtrad.java @@ -0,0 +1,51 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("busi_ampli_comtrad") +public class BusiAmpliComtrad extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 录播文件名称 + */ + @ApiModelProperty(value="录播文件名称", name="comtradFile") + @TableField("comtrad_file") + private String comtradFile; + + /** + * 录播文件名称 + */ + @ApiModelProperty(value="录播振动数据", name="comtradData") + @TableField("comtrad_data") + private String comtradData; + + + @ApiModelProperty(value="录播振动数据", name="Dtime") + @TableField("d_time") + private Date dTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliComtradResult.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliComtradResult.java new file mode 100644 index 0000000..6fc9683 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliComtradResult.java @@ -0,0 +1,102 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("busi_ampli_comtrad_result") +public class BusiAmpliComtradResult extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 录播文件记录id + */ + @ApiModelProperty(value = "录播文件记录id,源自表busi_ampli_comtrad.id", name = "fileId") + @TableField(value = "file_id") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + @TableField("sub_id") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value = "负载类型 1:空载 2:负载", name = "load_type") + @TableField("load_type") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + @TableField("side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + @TableField("phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name = "inOut") + @TableField("in_out") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + @TableField("frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliDayIncrease.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliDayIncrease.java new file mode 100644 index 0000000..6f826cf --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliDayIncrease.java @@ -0,0 +1,103 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiAmpliDayIncrease + * @Description: 振动装置日增长率表 + * @Author:Jordan_Li + * @CreatTime:6/10/2020 - 10:00 AM + * @Version V1.0 + */ +@Data +@TableName("busi_ampli_increase") +public class BusiAmpliDayIncrease extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 录播文件记录id + */ + @ApiModelProperty(value = "录播文件记录id,源自表busi_ampli_comtrad.id", name = "fileId") + @TableField(value = "file_id") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置ID,源自表busi_sub_device.id", name = "subId") + @TableField("sub_id") + private String subId; + + /** + * 频率 + */ + @ApiModelProperty(value = "频率", name = "frequency") + @TableField("frequency") + private String frequency; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value = "振幅阈值(mm/s2)", name = "amplitude") + @TableField("amplitude") + private String amplitude; + + /** + * 日增长率(%) + */ + @ApiModelProperty(value = "日增长率(%)", name = "dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value = "振动幅值月增长率(%)", name = "monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value = "振动幅值月偏差率(%)", name = "deviationRate") + @TableField("deviation_rate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "dTime") + @TableField("d_time") + private Date dTime; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="load_type") + @TableField("load_type") + private String loadType; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliReal.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliReal.java new file mode 100644 index 0000000..ff85d3f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliReal.java @@ -0,0 +1,103 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiAmpliReal + * @Description: 振动实时数据表 + * @Author:Jordan_Li + * @CreatTime:6/17/2020 - 9:50 AM + * @Version V1.0 + */ +@Data +@TableName("busi_ampli_real") +public class BusiAmpliReal extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="load_type") + @TableField("load_type") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value="原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name="side") + @TableField("side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value="相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效)", name="phase") + @TableField("phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value="上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name="inOut") + @TableField("in_out") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value="振动频率", name="frequency") + @TableField("frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value="最大振幅", name="maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliStatistics.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliStatistics.java new file mode 100644 index 0000000..97c99a6 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliStatistics.java @@ -0,0 +1,98 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-07-06 5:44 PM + **/ +@Data +@TableName("busi_ampli_statistics") +public class BusiAmpliStatistics extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + @TableField("sub_id") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="load_type") + @TableField("load_type") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + @TableField("side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效)", name = "phase") + @TableField("phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)", name = "inOut") + @TableField("in_out") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + @TableField("frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAmpliThresholdConf.java b/src/main/java/com/chenxuan/entity/model/BusiAmpliThresholdConf.java new file mode 100644 index 0000000..4bd1085 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAmpliThresholdConf.java @@ -0,0 +1,81 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiAmpliThresholdConf + * @Description: 振动装置阈值配置表 + * @Author:Jordan_Li + * @CreatTime:6/8/2020 - 10:49 AM + * @Version V1.0 + */ +@Data +@TableName("busi_ampli_threshold_conf") +public class BusiAmpliThresholdConf extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id") + private String id; + + /** + * 装置id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 频率段ID + */ + @ApiModelProperty(value="频率段ID,源自表busi_frequency.id", name="frequencyId") + @TableField("frequencyid") + private String frequencyId; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value="振幅阈值(mm/s2)", name="amplitude") + @TableField("amplitude") + private String amplitude; + + /** + * 振动幅值日增长率(%) + */ + @ApiModelProperty(value="振动幅值日增长率(%)", name="dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value="振动幅值月增长率(%)", name="monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value="振动幅值月偏差率(%)", name="deviationRate") + @TableField("deviation_rate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiAssessParameter.java b/src/main/java/com/chenxuan/entity/model/BusiAssessParameter.java new file mode 100644 index 0000000..11b1969 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiAssessParameter.java @@ -0,0 +1,46 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("busi_assess_parameter") +public class BusiAssessParameter extends Model { + + private static final long serialVersionUID = -6128102035538007317L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 振幅 + */ + @ApiModelProperty(value="振幅", name="amplitude") + @TableField("amplitude") + private String amplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCalcParamConf.java b/src/main/java/com/chenxuan/entity/model/BusiCalcParamConf.java new file mode 100644 index 0000000..e8a7e9b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCalcParamConf.java @@ -0,0 +1,120 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-06-28 7:51 PM + **/ +@Data +@TableName("busi_calc_param_conf") +public class BusiCalcParamConf { + + /** + * 主键id + */ + @TableId("id") + private String id; + + /** + * 主设备ID + */ + @TableField("main_id") + private String mainId; + + /** + * 1:第一级分项权重 2:第二级 3:第三级 + */ + @TableField("weight_level") + private String weightLevel; + + /** + * 1:高压端 2:低压端 3:中心点 4:噪声 + */ + @TableField("hltype") + private String hltype; + + /** + * 计算指标的名称 + */ + @TableField("name") + private String name; + + /** + * 上级计算指标名称 + */ + @TableField("pname") + private String pname; + + /** + * 描述 + */ + @TableField("description") + private String description; + + /** + * 权重值 + */ + @TableField("value") + private BigDecimal value; + + /** + * 是否显示AB值:0——否;1——是 + */ + @TableField("ab_value_flag") + private String abValueFlag; + + /** + * a值 + */ + @TableField("a_value") + private BigDecimal aValue; + + /** + * b值 + */ + @TableField("b_value") + private BigDecimal bValue; + + /** + * 注意值 + */ + @TableField("warning_value") + private String warningValue; + + /** + * 评分模型:1:升 2:降 + */ + @TableField("model") + private String model; + + /** + * 是否参与评测: 0:不参与 1:参与 + */ + @TableField("is_attend") + private String isAttend; + + /** + * 创建时间 + */ + @TableField("create_time") + private Date createTime; + + /** + * 创建者 + */ + @TableField("create_user") + private String createUser; + + /** + * 排序 + */ + @TableField("sort_num") + private Integer sortNum; + +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCenterIncrease.java b/src/main/java/com/chenxuan/entity/model/BusiCenterIncrease.java new file mode 100644 index 0000000..3b35e62 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCenterIncrease.java @@ -0,0 +1,65 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-07-09 5:14 PM + **/ +@Data +@TableName("busi_center_increase") +public class BusiCenterIncrease extends Model { + + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置ID + */ + @ApiModelProperty(value = "装置ID,", name = "subId") + @TableField("sub_id") + private String subId; + + /** + * 0:空载,1:负载 + */ + @ApiModelProperty(value = "0:空载,1:负载,", name = "subId") + @TableField("load_type") + private String loadType; + + /** + * '日增长率(%)' + */ + @ApiModelProperty(value = "'日增长率(%)'", name = "dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * ''日增长率(%)' + */ + @ApiModelProperty(value = "''日增长率(%)'(%)'", name = "monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * ''日增长率(%)' + */ + @ApiModelProperty(value = "'统计日期 YYYY-MM-DD'", name = "dTime") + @TableField("d_time") + private Date dTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCenterReal.java b/src/main/java/com/chenxuan/entity/model/BusiCenterReal.java new file mode 100644 index 0000000..b47e639 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCenterReal.java @@ -0,0 +1,61 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + +/** + * @ClassName:BusiCenterReal + * @Description: 中心点实时数据表 + * @Author:Jordan_Li + * @CreatTime:6/16/2020 - 13:50 PM + * @Version V1.0 + */ +@Data +@TableName("busi_center_real") +public class BusiCenterReal extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + + /** + * 电流值 + */ + @ApiModelProperty(value="最大振幅", name="maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCenterRealStatistics.java b/src/main/java/com/chenxuan/entity/model/BusiCenterRealStatistics.java new file mode 100644 index 0000000..1f03d8f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCenterRealStatistics.java @@ -0,0 +1,56 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-07-06 5:38 PM + **/ +@Data +@TableName("busi_center_real_statistics") +public class BusiCenterRealStatistics extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 电流值 + */ + @ApiModelProperty(value = "电流值", name = "maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCenterThresholdConf.java b/src/main/java/com/chenxuan/entity/model/BusiCenterThresholdConf.java new file mode 100644 index 0000000..3418b92 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCenterThresholdConf.java @@ -0,0 +1,91 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiCenterThresholdConf + * @Description: 中心点电流阈值配置表 + * @Author:Jordan_Li + * @CreatTime:6/8/2020 - 13:15 PM + * @Version V1.0 + */ +@Data +@TableName("busi_center_threshold_conf") +public class BusiCenterThresholdConf extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置ID,源自表busi_sub_device.id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 正电流(A) + */ + @ApiModelProperty(value="正电流(A)", name="positive") + @TableField("positive") + private String positive; + + /** + * 负电流(A) + */ + @ApiModelProperty(value="负电流(A)", name="negative") + @TableField("negative") + private String negative; + + /** + * 中心点电流日增长率(%) + */ + @ApiModelProperty(value="中心点电流日增长率(%)", name="dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * 中心点电流月增长率(%) + */ + @ApiModelProperty(value="中心点电流月增长率(%)", name="monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * 中心点电流月偏差率(%) + */ + @ApiModelProperty(value="中心点电流月偏差率(%)", name="deviationRate") + @TableField("deviation_rate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiCommunicationParameters.java b/src/main/java/com/chenxuan/entity/model/BusiCommunicationParameters.java new file mode 100644 index 0000000..5042e47 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiCommunicationParameters.java @@ -0,0 +1,120 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + + +/** + * @ClassName:BusiCommunicationParameters + * @Description: 通信参数设置 + * @Author:Jordan_Li + * @CreatTime:6/20/2020 - 13:29 PM + * @Version V1.0 + */ +@Data +@TableName("busi_communication_parameters") +public class BusiCommunicationParameters extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 协议选项(1:Modbus,2:62850) + */ + @ApiModelProperty(value="协议选项(1:Modbus,2:61850)", name="protocol") + @TableField("protocol") + private String protocol; + + /** + * 通信接口(0:选中,1:未选中),当protocol为1起效 + */ + @ApiModelProperty(value="通信接口(0:选中,1:未选中),当protocol为1起效", name="communicationInterface") + @TableField("communication_interface") + private String communicationInterface; + + /** + * 串口号,当protocol为1起效 所选值为 com1,com2,com3,com4,com5,com6,com7……24 + */ + @ApiModelProperty(value="串口号,当protocol为1起效 所选值为 com1,com2,com3,com4,com5,com6,com7……24", name="serialNumber") + @TableField("serial_number") + private String serialNumber; + + /** + * 波特率,当protocol为1起效 所选值为4800、9600、19200,115200 + */ + @ApiModelProperty(value="波特率,当protocol为1起效 所选值为4800、9600、19200,115200", name="baudRate") + @TableField("baud_rate") + private String baudRate; + + /** + * 校验位(0:无,1:奇校验,2:偶校验),当protocol为1起效 + */ + @ApiModelProperty(value="校验位(0:无,1:奇校验,2:偶校验),当protocol为1起效", name="checkBit") + @TableField("check_bit") + private String checkBit; + + /** + * 数据位(6,7,8),当protocol为1起效 + */ + @ApiModelProperty(value="数据位(6,7,8),当protocol为1起效", name="dataBit") + @TableField("data_bit") + private String dataBit; + + /** + * 停止位(1和2),当protocol为1起效 + */ + @ApiModelProperty(value="停止位(1和2),当protocol为1起效", name="stopBit") + @TableField("stop_bit") + private String stopBit; + + /** + * IP地址,当protocol为2起效 + */ + @ApiModelProperty(value="子装置ID", name="subDeviceId") + @TableField("sub_device_id") + private String subDeviceId; + + /** + * IP地址,当protocol为2起效 + */ + @ApiModelProperty(value="IP地址,当protocol为2起效", name="ipAddr") + @TableField("ip_addr") + private String ipAddr; + + /** + * 端口号,当protocol为2起效 + */ + @ApiModelProperty(value="端口号,当protocol为2起效", name="port") + @TableField("port") + private String port; + + /** + * 密码 + */ + @ApiModelProperty(value="密码", name="password") + @TableField("password") + private String password; + + /** + * 确认密码 + */ + @ApiModelProperty(value="确认密码", name="confirmPassword") + @TableField("confirm_password") + private String confirmPassword; + + + private List deviceArray; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiControlConfig.java b/src/main/java/com/chenxuan/entity/model/BusiControlConfig.java new file mode 100644 index 0000000..6e438f4 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiControlConfig.java @@ -0,0 +1,102 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiControlConfig + * @Description: 控制参数配置表 + * @Author:Jordan_Li + * @CreatTime:6/2/2020 - 13:49 PM + * @Version V1.0 + */ +@Data +@TableName("busi_control_conf") +public class BusiControlConfig extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 控制参数主键 + */ + @ApiModelProperty(value="控制参数主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 使能选项 (0:禁用 1:启用) + */ + @ApiModelProperty(value="使能选项 (0:禁用 1:启用)", name="isEnable") + @TableField("isenable") + private String isEnable; + + /** + * 采集间隔时间(H),1,2,4,8,12,24小时 + */ + @ApiModelProperty(value="采集间隔时间(H),1,2,4,8,12,24小时", name="intervals") + @TableField("intervals") + private String intervals; + + /** + * 每天开始采集时间 + */ + @ApiModelProperty(value="每天开始采集时间", name="gatherTime") + @JsonFormat(pattern = "HH:MM") + @TableField("gather_time") + private Date gatherTime; + + /** + * 独立测试(0:断 1:好) + */ + @ApiModelProperty(value="独立测试(0:断 1:好)", name="aloneTest") + @TableField("alone_test") + private String aloneTest; + + /** + * 校时(0:手动校时 1:自动校时) + */ + @ApiModelProperty(value="校时(0:手动校时 1:自动校时)", name="updateTime") + @TableField("update_time") + private String updateTime; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; + + @ApiModelProperty(value="采用频率(KHz)", name="smpprod") + @TableField("smpprod") + private String smpprod; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiDeviceCalibration.java b/src/main/java/com/chenxuan/entity/model/BusiDeviceCalibration.java new file mode 100644 index 0000000..a7e8210 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiDeviceCalibration.java @@ -0,0 +1,36 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +@Data +@TableName("busi_device_calibration") +public class BusiDeviceCalibration extends Model { + + /** + * id + */ + @TableId(value = "id") + private String id; + + /** + * 主变id + */ + @TableField("main_device_id") + private String mainId; + + /** + * 校时类型 1:自动校时 0:手动校时 + */ + @TableField("type") + private String checkWay; + + /** + * 校准地址 + */ + @TableField("sntp_addr") + private String checkAdress; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiFrequencyConf.java b/src/main/java/com/chenxuan/entity/model/BusiFrequencyConf.java new file mode 100644 index 0000000..e2c9dac --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiFrequencyConf.java @@ -0,0 +1,56 @@ +package com.chenxuan.entity.model; + +import java.util.Date; + +import lombok.Data; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:BusiFrequencyConf + * @Description: 振动装置-频率定义表 + * @Author:Jordan_Li + * @CreatTime:6/9/2020 - 9:49 AM + * @Version V1.0 + */ +@Data +@TableName("busi_frequency_conf") +public class BusiFrequencyConf extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 振动频率 + */ + @ApiModelProperty(value="振动频率", name="frequency") + @TableField("frequency") + private String frequency; + + /** + * 状态: 0-禁止 1:启用 + */ + @ApiModelProperty(value="状态: 0-禁止 1:启用", name="state") + @TableField("state") + private String state; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiIedparam.java b/src/main/java/com/chenxuan/entity/model/BusiIedparam.java new file mode 100644 index 0000000..f517bc5 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiIedparam.java @@ -0,0 +1,35 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author buck_guo + */ +@Data +@TableName("busi_iedparam") +public class BusiIedparam extends Model { + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + @TableField("node_id") + private String nodeId; + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + @TableField("node_name") + private String nodeName; + + /** + * 振动类型 + */ + @ApiModelProperty(value="振动类型", name="nodeType") + @TableField("node_type") + private String nodeType; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiMainDevice.java b/src/main/java/com/chenxuan/entity/model/BusiMainDevice.java new file mode 100644 index 0000000..7060061 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiMainDevice.java @@ -0,0 +1,113 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiMainDevice + * @Description: 主变表 + * @Author:Jordan_Li + * @CreatTime:6/2/2020 - 14:49 PM + * @Version V1.0 + */ +@Data +@TableName("busi_main_device") +public class BusiMainDevice extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变名称 + */ + @ApiModelProperty(value="主变名称", name="deviceName") + @TableField("device_name") + private String deviceName; + + /** + * 主变状态 (N(0):非正常 Y(1):正常) + */ + @ApiModelProperty(value="主变状态 (N(0):非正常 Y(1):正常)", name="state") + @TableField("state") + private String state; + + /** + * 投运日期 + */ + @ApiModelProperty(value="投运日期", name="deliveryTime") + @JsonFormat(pattern = "yyyy-MM-dd") + @TableField("delivery_time") + private Date deliveryTime; + + /** + * 设备型号 + */ + @ApiModelProperty(value="设备型号", name="deviceModel") + @TableField("device_model") + private String deviceModel; + + /** + * 制造厂家名称 + */ + @ApiModelProperty(value="制造厂家名称", name="manufacturer") + @TableField("manufacturer") + private String manufacturer; + + /** + * 出厂日期 + */ + @ApiModelProperty(value="出厂日期", name="factoryTime") + @JsonFormat(pattern = "yyyy-MM-dd") + @TableField("factory_time") + private Date factoryTime; + + /** + * 出厂序号 + */ + @ApiModelProperty(value="出厂序号", name="factoryNumber") + @TableField("factory_number") + private String factoryNumber; + + /** + * 设计使用寿命(年) + */ + @ApiModelProperty(value="设计使用寿命(年)", name="designLife") + @TableField("design_life") + private String designLife; + + /** + * 系统编码 + */ + @ApiModelProperty(value="系统编码", name="systemCode") + @TableField("system_code") + private String systemCode; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; + + /** + * 排序编号 + */ + @ApiModelProperty(value="排序编号", name="sort") + @TableField("sort") + private Integer sort; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiNoiseIncrease.java b/src/main/java/com/chenxuan/entity/model/BusiNoiseIncrease.java new file mode 100644 index 0000000..89cd10a --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiNoiseIncrease.java @@ -0,0 +1,64 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-07-09 6:24 PM + **/ +@Data +@TableName("busi_noise_increase") +public class BusiNoiseIncrease extends Model { + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置ID + */ + @ApiModelProperty(value = "装置ID,", name = "subId") + @TableField("sub_id") + private String subId; + + /** + * 0:空载,1:负载 + */ + @ApiModelProperty(value = "0:空载,1:负载,", name = "subId") + @TableField("load_type") + private String loadType; + + /** + * '日增长率(%)' + */ + @ApiModelProperty(value = "'日增长率(%)'", name = "dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * ''日增长率(%)' + */ + @ApiModelProperty(value = "''日增长率(%)'(%)'", name = "monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * ''日增长率(%)' + */ + @ApiModelProperty(value = "'统计日期 YYYY-MM-DD'", name = "dTime") + @TableField("d_time") + private Date dTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiNoiseReal.java b/src/main/java/com/chenxuan/entity/model/BusiNoiseReal.java new file mode 100644 index 0000000..4bea534 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiNoiseReal.java @@ -0,0 +1,61 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.util.Date; + + +/** + * @ClassName:BusiNoiseReal + * @Description: 噪声实时数据表 + * @Author:Jordan_Li + * @CreatTime:6/16/2020 - 15:50 PM + * @Version V1.0 + */ +@Data +@TableName("busi_noise_real") +public class BusiNoiseReal extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + + /** + * 噪声值 + */ + @ApiModelProperty(value="最大振幅", name="maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiNoiseRealStatistics.java b/src/main/java/com/chenxuan/entity/model/BusiNoiseRealStatistics.java new file mode 100644 index 0000000..cbded2e --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiNoiseRealStatistics.java @@ -0,0 +1,56 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @author Carrey Zheng + * @create 2020-07-06 5:39 PM + **/ +@Data +@TableName("busi_noise_real_statistics") +public class BusiNoiseRealStatistics extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "主键", name = "id") + @TableId(value = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主设备ID,源自表busi_main_device.id", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 电流值 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + @TableField("max_amplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiNoiseThresholdConf.java b/src/main/java/com/chenxuan/entity/model/BusiNoiseThresholdConf.java new file mode 100644 index 0000000..e6ed3b1 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiNoiseThresholdConf.java @@ -0,0 +1,84 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * @ClassName:BusiNoiseThresholdConf + * @Description: 噪声装置阈值配置表 + * @Author:Jordan_Li + * @CreatTime:6/8/2020 - 13:40 PM + * @Version V1.0 + */ +@Data +@TableName("busi_noise_threshold_conf") +public class BusiNoiseThresholdConf extends Model { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置ID,源自表busi_sub_device.id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 噪声阈值(db) + */ + @ApiModelProperty(value="噪声阈值(db)", name="noise") + @TableField("noise") + private String noise; + + /** + * 噪声日增长率(%) + */ + @ApiModelProperty(value="噪声日增长率(%)", name="dayRate") + @TableField("day_rate") + private String dayRate; + + /** + * 噪声月增长率(%) + */ + @ApiModelProperty(value="噪声月增长率(%)", name="monthRate") + @TableField("month_rate") + private String monthRate; + + /** + * 噪声月偏差率(%) + */ + @ApiModelProperty(value="噪声月偏差率(%)", name="deviationRate") + @TableField("deviation_rate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiParamBind.java b/src/main/java/com/chenxuan/entity/model/BusiParamBind.java new file mode 100644 index 0000000..cc05d96 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiParamBind.java @@ -0,0 +1,64 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@TableName("busi_param_bind") +public class BusiParamBind extends Model { + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 传感器code + */ + @ApiModelProperty(value="传感器code,源自表busi_sub_device.sensor_code", name="sensorCode") + @TableField("sensor_code") + private String sensorCode; + + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + @TableField("node_id") + private String nodeId; + + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + @TableField("node_name") + private String nodeName; + + /** + * 频率(Hz) + */ + @ApiModelProperty(value="频率(Hz)", name="frequency") + @TableField("frequency") + private String frequency; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiSubDevice.java b/src/main/java/com/chenxuan/entity/model/BusiSubDevice.java new file mode 100644 index 0000000..ea19c7e --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiSubDevice.java @@ -0,0 +1,111 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.Objects; + + +/** + * @ClassName:BusiSubDevice + * @Description: 主变装置表 + * @Author:Jordan_Li + * @CreatTime:6/2/2020 - 14:10 PM + * @Version V1.0 + */ +@Data +@TableName("busi_sub_device") +public class BusiSubDevice extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id", name = "id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主设备ID + */ + @ApiModelProperty(value = "主设备ID", name = "mainId") + @TableField("main_id") + private String mainId; + + /** + * 装置名称或位置描述 + */ + @ApiModelProperty(value = "装置名称或位置描述", name = "subDeviceName") + @TableField("sub_device_name") + private String subDeviceName; + + /** + * 传感器编码 + */ + @ApiModelProperty(value = "传感器编码", name = "sensorCode") + @TableField("sensor_code") + private String sensorCode; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)", name = "deviceType") + @TableField("device_type") + private Integer deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + @TableField("side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效)", name = "phase") + @TableField("phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧;仅当device_type=1时有效) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧 仅当device_type=1时有效)", name = "inOut") + @TableField("in_out") + private String inOut; + + /** + * 创建日期 + */ + @ApiModelProperty(value = "创建日期", name = "insTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @TableField("ins_time") + private Date insTime; + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof BusiSubDevice)) return false; + BusiSubDevice that = (BusiSubDevice) o; + return Objects.equals(getId(), that.getId()) && + Objects.equals(getMainId(), that.getMainId()) && + Objects.equals(getSensorCode(), that.getSensorCode()) && + Objects.equals(getDeviceType(), that.getDeviceType()) && + Objects.equals(getSide(), that.getSide()) && + Objects.equals(getPhase(), that.getPhase()) && + Objects.equals(getInOut(), that.getInOut()); + } + + @Override + public int hashCode() { + return super.hashCode(); + } +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiTransformerConf.java b/src/main/java/com/chenxuan/entity/model/BusiTransformerConf.java new file mode 100644 index 0000000..7db4dfb --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiTransformerConf.java @@ -0,0 +1,85 @@ +package com.chenxuan.entity.model; + +import java.math.BigDecimal; +import java.util.Date; + +import lombok.Data; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:BusiTransformerConf + * @Description: 原副边电流电压实时数据配置表 + * @Author:Jordan_Li + * @CreatTime:6/2/2020 - 15:49 PM + * @Version V1.0 + */ +@Data +@TableName("busi_transformer_conf") +public class BusiTransformerConf extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 原副边(P:原边 S:副边) + */ + @ApiModelProperty(value="原副边(P:原边 S:副边)", name="side") + @TableField("side") + private String side; + + /** + * 电压(kV) + */ + @ApiModelProperty(value="电压(kV)", name="voltage") + @TableField("voltage") + private BigDecimal voltage; + + /** + * 电流(A) + */ + @ApiModelProperty(value="电流(A)", name="current") + @TableField("current") + private BigDecimal current; + + /** + * 主变电流电压获取方式.0:手动配置 1:自动设置 + */ + @ApiModelProperty(value="主变电流电压获取方式(0:手动配置 1:自动设置)", name="confFlag") + @TableField("conf_flag") + private String confFlag; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiTransformerReal.java b/src/main/java/com/chenxuan/entity/model/BusiTransformerReal.java new file mode 100644 index 0000000..4e0913c --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiTransformerReal.java @@ -0,0 +1,78 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * @ClassName:BusiTransformerReal + * @Description: 原副边电流电压实时数据表 + * @Author:Jordan_Li + * @CreatTime:6/10/2020 - 15:49 PM + * @Version V1.0 + */ +@Data +@TableName("busi_transformer_real") +public class BusiTransformerReal extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 原副边(P:原边 S:副边) + */ + @ApiModelProperty(value="原副边(P:原边 S:副边)", name="side") + @TableField("side") + private String side; + + /** + * 电压(kV) + */ + @ApiModelProperty(value="电压(kV)", name="voltage") + @TableField("voltage") + private BigDecimal voltage; + + /** + * 电流(A) + */ + @ApiModelProperty(value="电流(A)", name="current") + @TableField("current") + private BigDecimal current; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @TableField("ins_time") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + @TableField("hbase_rowkey") + private String hbaseRowkey; + + private String deviceName; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiVibrationSeparation.java b/src/main/java/com/chenxuan/entity/model/BusiVibrationSeparation.java new file mode 100644 index 0000000..06f56e7 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiVibrationSeparation.java @@ -0,0 +1,96 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +@Data +@TableName("busi_vibration_separation") +public class BusiVibrationSeparation extends Model { + + private static final long serialVersionUID = -7262672379061997533L; + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + @TableId(value = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID", name="mainId") + @TableField("main_id") + private String mainId; + + /** + * 录播文件id + */ + @ApiModelProperty(value="录播文件id", name="comtradId") + @TableId(value = "comtrad_id") + private String comtradId; + + /** + * 相位 (A:A相 B:B相 C:C相 ) + */ + @ApiModelProperty(value="相位 (A:A相 B:B相 C:C相 Q:全相)", name="phase") + @TableField("phase") + private String phase; + + /** + * 机械幅值 + */ + @ApiModelProperty(value="机械幅值", name="mechAmplitude") + @TableField("mech_amplitude") + private String mechAmplitude; + + /** + * 绕组幅值 + */ + @ApiModelProperty(value="绕组幅值", name="windingAmplitude") + @TableField("winding_amplitude") + private String windingAmplitude; + + /** + * 铁芯幅值 + */ + @ApiModelProperty(value="铁芯幅值", name="ironCoreAmplitude") + @TableField("iron_core_amplitude") + private String ironCoreAmplitude; + + /** + * 原边幅值 + */ + @ApiModelProperty(value="原边幅值", name="primarySideAmplitude") + @TableField("primary_side_amplitude") + private String primarySideAmplitude; + + /** + * 副边幅值 + */ + @ApiModelProperty(value="副边幅值", name="secSideAmplitude") + @TableField("sec_side_amplitude") + private String secSideAmplitude; + + /** + * 插入顺序 + */ + @ApiModelProperty(value="插入顺序", name="sort") + @TableField("sort") + private Integer sort; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + @JsonFormat(pattern = "yyyy-MM-dd HH") + @TableField("ins_time") + private Date insTime; +} diff --git a/src/main/java/com/chenxuan/entity/model/BusiWarning.java b/src/main/java/com/chenxuan/entity/model/BusiWarning.java new file mode 100644 index 0000000..82665fe --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/BusiWarning.java @@ -0,0 +1,137 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:BusiWarning + * @Description: 告警信息表 + * @Author:Jordan_Li + * @CreatTime:6/17/2020 - 16:29 PM + * @Version V1.0 + */ +@Data +@TableName("busi_warning") +public class BusiWarning extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value="主键id", name="id") + @TableId(value = "id", type = IdType.AUTO) + private String id; + + /** + * 装置ID,源自表busi_sub_device.id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + @TableField("sub_id") + private String subId; + + /** + * 告警时间YYYY-MM-DD HH:MI:SS + */ + @ApiModelProperty(value="告警时间YYYY-MM-DD HH:MI:SS", name="warnTime") + @TableField("warn_time") + private Date warnTime; + + /** + * 告警分类 + */ + @ApiModelProperty(value="告警分类 1:通信异常告警 2:装置自检异常告警 3:信号异常告警 4:供电异常告警 5:振动阈值告警 " + + "6:噪声阈值告警 7:中心点阈值告警 8:日增长率告警 9:月增长率告警 10:月偏差率告警 " + + "11:服务器与IED通信异常 12:传感器振动告警 13:传感器噪声告警 14:传感器中心点告警", name="warnType") + @TableField("warn_type") + private String warnType; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="loadType") + @TableField("load_type") + private String loadType; + + /** + * 采样值 + */ + @ApiModelProperty(value="采样值", name="sampleValue") + @TableField("sample_value") + private String sampleValue; + + /** + * 采样值单位(A)(db)(mm/s2) + */ + @ApiModelProperty(value="采样值单位(A)(db)(mm/s2)", name="valueUnit") + @TableField("value_unit") + private String valueUnit; + + /** + * 告警信息/设备名称/设备安装位置 + */ + @ApiModelProperty(value="告警信息/设备名称/设备安装位置", name="warnDesc") + @TableField("warn_desc") + private String warnDesc; + + /** + * 告警级别 0:高 1:中 2:低 + */ + @ApiModelProperty(value="告警级别 0:高 1:中 2:低", name="warnLevel") + @TableField("warn_level") + private String warnLevel; + + /** + * 处理状态 0:已处理 1:未处理 + */ + @ApiModelProperty(value="处理状态 0:已处理 1:未处理", name="state") + @TableField("state") + private String state; + + /** + * 处理结果描述 + */ + @ApiModelProperty(value="处理结果描述", name="process") + @TableField("process") + private String process; + + /** + * 处理人id + */ + @ApiModelProperty(value="处理人id", name="processUser") + @TableField("process_user") + private String processUser; + + /** + * 处理时间 + */ + @ApiModelProperty(value="处理时间", name="processTime") + @TableField("process_time") + private Date processTime; + + /** + * hbase同步主键 + */ + @ApiModelProperty(value="hbase同步主键", name="hbaseKey") + @TableField("hbase_key") + private String hbaseKey; + + /** + * 状态(single,batch) + */ + private String status; + + /** + * 批量处理id集合 + */ + private List ids; +} diff --git a/src/main/java/com/chenxuan/entity/model/DeviceInfo.java b/src/main/java/com/chenxuan/entity/model/DeviceInfo.java new file mode 100644 index 0000000..22eda90 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/DeviceInfo.java @@ -0,0 +1,34 @@ +package com.chenxuan.entity.model; + +/** + * @author buck_guo + */ +public class DeviceInfo { + private String device; + private String ip; + private String port; + + public String getDevice() { + return device; + } + + public void setDevice(String device) { + this.device = device; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/ExportData.java b/src/main/java/com/chenxuan/entity/model/ExportData.java new file mode 100644 index 0000000..47e764b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/ExportData.java @@ -0,0 +1,100 @@ +package com.chenxuan.entity.model; + + +/** + * @ClassName:ExportData + * @Description: 导出数据对象 + * @Author:Jordan_Li + * @CreatTime:6/23/2020 - 19:50 PM + * @Version V1.0 + */ +public class ExportData { + + //振动频率 + private String frequency; + + //最大振幅 + private String maxAmplitude; + + //负载类型 + private String loadType; + + //日增长率 + private String dayRate; + + //月增长率 + private String monthRate; + + //月偏差率 + private String deviationRate; + + //创建时间 + private String insTime; + + //名称 + private String name; + + public String getFrequency() { + return frequency; + } + + public void setFrequency(String frequency) { + this.frequency = frequency; + } + + public String getMaxAmplitude() { + return maxAmplitude; + } + + public void setMaxAmplitude(String maxAmplitude) { + this.maxAmplitude = maxAmplitude; + } + + public String getLoadType() { + return loadType; + } + + public void setLoadType(String loadType) { + this.loadType = loadType; + } + + public String getDayRate() { + return dayRate; + } + + public void setDayRate(String dayRate) { + this.dayRate = dayRate; + } + + public String getMonthRate() { + return monthRate; + } + + public void setMonthRate(String monthRate) { + this.monthRate = monthRate; + } + + public String getDeviationRate() { + return deviationRate; + } + + public void setDeviationRate(String deviationRate) { + this.deviationRate = deviationRate; + } + + public String getInsTime() { + return insTime; + } + + public void setInsTime(String insTime) { + this.insTime = insTime; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/ScheduleJob.java b/src/main/java/com/chenxuan/entity/model/ScheduleJob.java new file mode 100644 index 0000000..0ce790a --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/ScheduleJob.java @@ -0,0 +1,206 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; + +@TableName("sys_job") +public class ScheduleJob extends Model { + + private static final long serialVersionUID = -5740682705652864474L; + + /** + * 参数主键 + */ + @ApiModelProperty(value = "参数主键", name = "job_id") + @TableId(value = "job_id", type = IdType.AUTO) + private Long jobId; + + +// /** +// * 任务名称 +// */ +// @ApiModelProperty(value = "任务名称", name = "jobName") +// @TableField("job_name") +// private String jobName; + + /** + * cron表达式 + */ + @ApiModelProperty(value = "cron表达式", name = "cronExpression") + @TableField("cron_expression") + private String cronExpression; + + /** + * 服务名称 + */ + @ApiModelProperty(value = "服务名称", name = "beanName") + @TableField("bean_name") + private String beanName; + + /** + * 方法名称 + */ + @ApiModelProperty(value = "方法名称", name = "methodName") + @TableField("method_name") + private String methodName; + + /** + * 方法参数 + */ + @ApiModelProperty(value = "方法参数", name = "methodParams") + @TableField("method_params") + private String methodParams; + + /** + * 状态 1.启动 2.暂停 + */ + @ApiModelProperty(value = "状态 1.启动 2.暂停", name = "status") + @TableField("status") + private String status; + + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者", name = "createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者", name = "updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间", name = "updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + @Override + protected Serializable pkVal() { + return this.jobId; + } + + + public Long getJobId() { + return jobId; + } + + public void setJobId(Long jobId) { + this.jobId = jobId; + } + +/* public String getJobName() { + return jobName; + } + + public void setJobName(String jobName) { + this.jobName = jobName; + }*/ + + public String getCronExpression() { + return cronExpression; + } + + public void setCronExpression(String cronExpression) { + this.cronExpression = cronExpression; + } + + public String getBeanName() { + return beanName; + } + + public void setBeanName(String beanName) { + this.beanName = beanName; + } + + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + + public String getMethodParams() { + return methodParams; + } + + public void setMethodParams(String methodParams) { + this.methodParams = methodParams; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} + + diff --git a/src/main/java/com/chenxuan/entity/model/SysConfig.java b/src/main/java/com/chenxuan/entity/model/SysConfig.java new file mode 100644 index 0000000..3072e69 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysConfig.java @@ -0,0 +1,119 @@ +package com.chenxuan.entity.model; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * @ClassName:SysConfig + * @Description: 参数配置表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:49 PM + * @Version V1.0 + */ + +@Data +@TableName("sys_config") +public class SysConfig extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 参数主键 + */ + @ApiModelProperty(value="参数主键", name="config_id") + @TableId(value = "config_id", type = IdType.AUTO) + private Integer configId; + + /** + * 参数名称 + */ + @ApiModelProperty(value="参数名称", name="configName") + @TableField("config_name") + private String configName; + + /** + * 参数键名 + */ + @ApiModelProperty(value="参数键名", name="configKey") + @TableField("config_key") + private String configKey; + + /** + * 参数键值 + */ + @ApiModelProperty(value="参数键值", name="configValue") + @TableField("config_value") + private String configValue; + + /** + * 系统内置(Y是 N否) + */ + @ApiModelProperty(value="系统内置(Y是 N否)", name="configType") + @TableField("config_type") + private String configType; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + @Override + protected Serializable pkVal() { + return this.configId; + } + + @Override + public String toString() { + return "SysConfig{" + + ", configId=" + configId + + ", configName=" + configName + + ", configKey=" + configKey + + ", configValue=" + configValue + + ", configType=" + configType + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysDept.java b/src/main/java/com/chenxuan/entity/model/SysDept.java new file mode 100644 index 0000000..12f8400 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysDept.java @@ -0,0 +1,288 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.ArrayList; +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:SysDept + * @Description: 部门表. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:50 PM + * @Version V1.0 + */ + +@TableName("sys_dept") +public class SysDept extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 部门id + */ + @ApiModelProperty(value="部门id", name="dept_id") + @TableId(value = "dept_id", type = IdType.AUTO) + private Long deptId; + + /** + * 父部门id + */ + @ApiModelProperty(value="父部门id", name="parentId") + @TableField("parent_id") + private Long parentId; + + /** + * 祖级列表 + */ + private String ancestors; + + /** + * 部门名称 + */ + @ApiModelProperty(value="部门名称", name="deptName") + @TableField("dept_name") + private String deptName; + + /** + * 显示顺序 + */ + @ApiModelProperty(value="显示顺序", name="orderNum") + @TableField("order_num") + private Integer orderNum; + + /** + * 负责人 + */ + @TableField("leader") + private String leader; + + /** + * 联系电话 + */ + @TableField("phone") + private String phone; + + /** + * 邮箱 + */ + @TableField("email") + private String email; + + /** + * 部门状态(0正常 1停用) + */ + @TableField("status") + private String status; + + /** + * 删除标志(0代表存在 1代表删除) + */ + @ApiModelProperty(value="删除标志(0代表存在 1代表删除)", name="delFlag") + @TableField("del_flag") + private String delFlag; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + + /** + * 父部门名称 + * */ + @TableField(exist = false) + private String parentName; + + /** + * 子部门 + * */ + @TableField(exist = false) + private List children = new ArrayList(); + + + @Override + protected Serializable pkVal() { + return this.deptId; + } + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public String getAncestors() { + return ancestors; + } + + public void setAncestors(String ancestors) { + this.ancestors = ancestors; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public String getLeader() { + return leader; + } + + public void setLeader(String leader) { + this.leader = leader; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "SysDept{" + + ", deptId=" + deptId + + ", parentId=" + parentId + + ", ancestors=" + ancestors + + ", deptName=" + deptName + + ", orderNum=" + orderNum + + ", leader=" + leader + + ", phone=" + phone + + ", email=" + email + + ", status=" + status + + ", delFlag=" + delFlag + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysDictData.java b/src/main/java/com/chenxuan/entity/model/SysDictData.java new file mode 100644 index 0000000..a679736 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysDictData.java @@ -0,0 +1,258 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.util.Date; +import java.io.Serializable; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:SysDictData + * @Description: 字典数据表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:52 PM + * @Version V1.0 + */ + +@TableName("sys_dict_data") +public class SysDictData extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 字典编码 + */ + @ApiModelProperty(value="字典编码", name="dict_code") + @TableId(value = "dict_code", type = IdType.AUTO) + private Long dictCode; + + /** + * 字典排序 + */ + @ApiModelProperty(value="字典排序", name="dictSort") + @TableField("dict_sort") + private Integer dictSort; + + /** + * 字典标签 + */ + @ApiModelProperty(value="字典标签", name="dictLabel") + @TableField("dict_label") + private String dictLabel; + + /** + * 字典键值 + */ + @ApiModelProperty(value="字典键值", name="dictValue") + @TableField("dict_value") + private String dictValue; + + /** + * 字典类型 + */ + @ApiModelProperty(value="字典类型", name="dictType") + @TableField("dict_type") + private String dictType; + + /** + * 样式属性(其他样式扩展) + */ + @ApiModelProperty(value="样式属性(其他样式扩展)", name="cssClass") + @TableField("css_class") + private String cssClass; + + /** + * 表格回显样式 + */ + @ApiModelProperty(value="表格回显样式", name="listClass") + @TableField("list_class") + private String listClass; + + /** + * 是否默认(Y是 N否) + */ + @ApiModelProperty(value="是否默认(Y是 N否)", name="isDefault") + @TableField("is_default") + private String isDefault; + + /** + * 状态(0正常 1停用) + */ + private String status; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + + public Long getDictCode() { + return dictCode; + } + + public void setDictCode(Long dictCode) { + this.dictCode = dictCode; + } + + public Integer getDictSort() { + return dictSort; + } + + public void setDictSort(Integer dictSort) { + this.dictSort = dictSort; + } + + public String getDictLabel() { + return dictLabel; + } + + public void setDictLabel(String dictLabel) { + this.dictLabel = dictLabel; + } + + public String getDictValue() { + return dictValue; + } + + public void setDictValue(String dictValue) { + this.dictValue = dictValue; + } + + public String getDictType() { + return dictType; + } + + public void setDictType(String dictType) { + this.dictType = dictType; + } + + public String getCssClass() { + return cssClass; + } + + public void setCssClass(String cssClass) { + this.cssClass = cssClass; + } + + public String getListClass() { + return listClass; + } + + public void setListClass(String listClass) { + this.listClass = listClass; + } + + public String getIsDefault() { + return isDefault; + } + + public void setIsDefault(String isDefault) { + this.isDefault = isDefault; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + protected Serializable pkVal() { + return this.dictCode; + } + + @Override + public String toString() { + return "SysDictData{" + + ", dictCode=" + dictCode + + ", dictSort=" + dictSort + + ", dictLabel=" + dictLabel + + ", dictValue=" + dictValue + + ", dictType=" + dictType + + ", cssClass=" + cssClass + + ", listClass=" + listClass + + ", isDefault=" + isDefault + + ", status=" + status + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysDictType.java b/src/main/java/com/chenxuan/entity/model/SysDictType.java new file mode 100644 index 0000000..aaa4766 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysDictType.java @@ -0,0 +1,180 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.Date; + +//import com.baomidou.mybatisplus.enums.IdType; + + +/** + * @ClassName:SysDict + * @Description: 字典类型表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:51 PM + * @Version V1.0 + */ + +@TableName("sys_dict") +public class SysDictType extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 字典主键 + */ + @ApiModelProperty(value="字典主键", name="dict_id") + @TableId(value = "dict_id", type = IdType.AUTO) + private Long dictId; + + /** + * 字典名称 + */ + @ApiModelProperty(value="字典名称", name="dictName") + @TableField("dict_name") + private String dictName; + + /** + * 字典类型 + */ + @ApiModelProperty(value="字典类型", name="dictType") + @TableField("dict_type") + private String dictType; + + /** + * 状态(0正常 1停用) + */ + private String status; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + public Long getDictId() { + return dictId; + } + + public void setDictId(Long dictId) { + this.dictId = dictId; + } + + public String getDictName() { + return dictName; + } + + public void setDictName(String dictName) { + this.dictName = dictName; + } + + public String getDictType() { + return dictType; + } + + public void setDictType(String dictType) { + this.dictType = dictType; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + protected Serializable pkVal() { + return this.dictId; + } + + @Override + public String toString() { + return "SysDict{" + + ", dictId=" + dictId + + ", dictName=" + dictName + + ", dictType=" + dictType + + ", status=" + status + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysLoginLog.java b/src/main/java/com/chenxuan/entity/model/SysLoginLog.java new file mode 100644 index 0000000..4e557b4 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysLoginLog.java @@ -0,0 +1,156 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + + +import java.io.Serializable; +import java.util.Date; + + +/** + * @ClassName:SysLoginLog + * @Description: 字系统访问记录表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:51 PM + * @Version V1.0 + */ + +@TableName("sys_login_log") +public class SysLoginLog extends Model { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId(value = "login_id", type = IdType.AUTO) + private Long loginId; + + /** + * 用户账号 + */ + @TableField("user_name") + private String userName; + + /** + * 登录状态 0成功 1失败 + */ + @TableField("status") + private String status; + + /** + * 登录IP地址 + */ + @TableField("ipaddr") + private String ipaddr; + + /** + * 登录地点 + */ + @TableField("login_location") + private String loginLocation; + + /** + * 浏览器类型 + */ + @TableField("browser") + private String browser; + + /** + * 操作系统 + */ + @TableField("os") + private String os; + + /** + * 提示消息 + */ + @TableField("msg") + private String msg; + + /** + * 访问时间 + */ + @TableField("login_time") + private Date loginTime; + + @Override + protected Serializable pkVal() { + return this.loginId; + } + + public Long getLoginId() { + return loginId; + } + + public void setLoginId(Long loginId) { + this.loginId = loginId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getIpaddr() { + return ipaddr; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) { + this.loginLocation = loginLocation; + } + + public String getBrowser() { + return browser; + } + + public void setBrowser(String browser) { + this.browser = browser; + } + + public String getOs() { + return os; + } + + public void setOs(String os) { + this.os = os; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Date getLoginTime() { + return loginTime; + } + + public void setLoginTime(Date loginTime) { + this.loginTime = loginTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/entity/model/SysMenu.java b/src/main/java/com/chenxuan/entity/model/SysMenu.java new file mode 100644 index 0000000..9eb0b12 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysMenu.java @@ -0,0 +1,325 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.ArrayList; +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:SysMenu + * @Description: 菜单表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:53 PM + * @Version V1.0 + */ + +@TableName("sys_menu") +public class SysMenu extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 菜单ID + */ + @ApiModelProperty(value="菜单ID", name="menu_id") + @TableId(value = "menu_id", type = IdType.AUTO) + private Long menuId; + + /** + * 菜单名称 + */ + @ApiModelProperty(value="菜单名称", name="menuName") + @TableField("menu_name") + private String menuName; + + /** + * 父菜单ID + */ + @ApiModelProperty(value="父菜单ID", name="parentId") + @TableField("parent_id") + private Long parentId; + + /** + * 显示顺序 + */ + @ApiModelProperty(value="显示顺序", name="orderNum") + @TableField("order_num") + private Integer orderNum; + + /** + * 路由地址 + */ + @ApiModelProperty(value="是否为外链(0是 1否)", name="path") + @TableField("path") + private String path; + + /** + * 组件路径 + */ + @ApiModelProperty(value="组件路径", name="component") + @TableField("component") + private String component; + + /** + * 是否为外链(0是 1否) + */ + @ApiModelProperty(value="是否为外链(0是 1否)", name="isFrame") + @TableField("is_frame") + private String isFrame; + + /** + * 菜单类型(M目录 C菜单 F按钮) + */ + @ApiModelProperty(value="菜单类型(M目录 C菜单 F按钮)", name="menuType") + @TableField("menu_type") + private String menuType; + + /** + * 菜单状态(0显示 1隐藏) + */ + @ApiModelProperty(value="菜单状态(0显示 1隐藏)", name="visible") + @TableField("visible") + private String visible; + + /** + * 权限标识 + */ + @ApiModelProperty(value=" 权限标识", name="perms") + @TableField("perms") + private String perms; + + /** + * 菜单图标 + */ + @ApiModelProperty(value="菜单图标", name="icon") + @TableField("icon") + private String icon; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @ApiModelProperty(value="备注", name="remark") + @TableField("remark") + private String remark; + + /** + * 父菜单名称 + **/ + @TableField(exist = false) + private String parentName; + + + /** + * 子菜单 + */ + @TableField(exist = false) + private List children = new ArrayList(); + + public Long getMenuId() { + return menuId; + } + + public void setMenuId(Long menuId) { + this.menuId = menuId; + } + + public String getMenuName() { + return menuName; + } + + public void setMenuName(String menuName) { + this.menuName = menuName; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } + + public String getIsFrame() { + return isFrame; + } + + public void setIsFrame(String isFrame) { + this.isFrame = isFrame; + } + + public String getMenuType() { + return menuType; + } + + public void setMenuType(String menuType) { + this.menuType = menuType; + } + + public String getVisible() { + return visible; + } + + public void setVisible(String visible) { + this.visible = visible; + } + + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + protected Serializable pkVal() { + return this.menuId; + } + + public List getChildren() { + return children; + } + + public String getParentName() { + return parentName; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "SysMenu{" + + ", menuId=" + menuId + + ", menuName=" + menuName + + ", parentId=" + parentId + + ", orderNum=" + orderNum + + ", path=" + path + + ", component=" + component + + ", isFrame=" + isFrame + + ", menuType=" + menuType + + ", visible=" + visible + + ", perms=" + perms + + ", icon=" + icon + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysOperLog.java b/src/main/java/com/chenxuan/entity/model/SysOperLog.java new file mode 100644 index 0000000..7f392a3 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysOperLog.java @@ -0,0 +1,288 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName:SysOperLog + * @Description: 操作日志记录表 oper_log + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 11:08 AM + * @Version V1.0 + */ +@TableName("sys_oper_log") +public class SysOperLog extends Model { + private static final long serialVersionUID = 1L; + + /** + * 日志主键 + */ + @TableId(value = "oper_id", type = IdType.AUTO) + private Long operId; + + /** + * 操作模块 + */ + @TableField("title") + private String title; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + @TableField("business_type") + private Integer businessType; + + /** + * 请求方法 + */ + @TableField("method") + private String method; + + /** + * 请求方式 + */ + @TableField("request_method") + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + @TableField("operator_type") + private Integer operatorType; + + /** + * 操作人员 + */ + @TableField("oper_name") + private String operName; + + /** + * 部门名称 + */ + @TableField("dept_name") + private String deptName; + + /** + * 请求url + */ + @TableField("oper_url") + private String operUrl; + + /** + * 操作地址 + */ + @TableField("oper_ip") + private String operIp; + + /** + * 操作地点 + */ + @TableField("oper_location") + private String operLocation; + + /** + * 请求参数 + */ + @TableField("oper_param") + private String operParam; + + /** + * 返回参数 + */ + @TableField("json_result") + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + @TableField("status") + private Integer status; + + /** + * 错误消息 + */ + @TableField("error_msg") + private String errorMsg; + + /** + * 操作时间 + */ + @TableField("oper_time") + private Date operTime; + + + /** + * 业务类型数组 + */ + @TableField(exist = false) + private Integer[] businessTypes; + + @Override + protected Serializable pkVal() { + return this.operId; + } + + public Long getOperId() { + return operId; + } + + public void setOperId(Long operId) { + this.operId = operId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getBusinessType() { + return businessType; + } + + public void setBusinessType(Integer businessType) { + this.businessType = businessType; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getRequestMethod() { + return requestMethod; + } + + public void setRequestMethod(String requestMethod) { + this.requestMethod = requestMethod; + } + + public Integer getOperatorType() { + return operatorType; + } + + public void setOperatorType(Integer operatorType) { + this.operatorType = operatorType; + } + + public String getOperName() { + return operName; + } + + public void setOperName(String operName) { + this.operName = operName; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getOperUrl() { + return operUrl; + } + + public void setOperUrl(String operUrl) { + this.operUrl = operUrl; + } + + public String getOperIp() { + return operIp; + } + + public void setOperIp(String operIp) { + this.operIp = operIp; + } + + public String getOperLocation() { + return operLocation; + } + + public void setOperLocation(String operLocation) { + this.operLocation = operLocation; + } + + public String getOperParam() { + return operParam; + } + + public void setOperParam(String operParam) { + this.operParam = operParam; + } + + public String getJsonResult() { + return jsonResult; + } + + public void setJsonResult(String jsonResult) { + this.jsonResult = jsonResult; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public Date getOperTime() { + return operTime; + } + + public void setOperTime(Date operTime) { + this.operTime = operTime; + } + + public Integer[] getBusinessTypes() { + return businessTypes; + } + + public void setBusinessTypes(Integer[] businessTypes) { + this.businessTypes = businessTypes; + } + + @Override + public String toString() { + return "SysOperLog{" + + "operId=" + operId + + ", title='" + title + '\'' + + ", businessType=" + businessType + + ", method='" + method + '\'' + + ", requestMethod='" + requestMethod + '\'' + + ", operatorType=" + operatorType + + ", operName='" + operName + '\'' + + ", deptName='" + deptName + '\'' + + ", operUrl='" + operUrl + '\'' + + ", operIp='" + operIp + '\'' + + ", operLocation='" + operLocation + '\'' + + ", operParam='" + operParam + '\'' + + ", jsonResult='" + jsonResult + '\'' + + ", status=" + status + + ", errorMsg='" + errorMsg + '\'' + + ", operTime=" + operTime + + '}'; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysPost.java b/src/main/java/com/chenxuan/entity/model/SysPost.java new file mode 100644 index 0000000..e359169 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysPost.java @@ -0,0 +1,197 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; +import java.io.Serializable; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:SysPost + * @Description: 岗位信息表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:54 PM + * @Version V1.0 + */ + +@TableName("sys_post") +public class SysPost extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 岗位ID + */ + @ApiModelProperty(value = "岗位ID", name = "post_id") + @TableId(value = "post_id", type = IdType.AUTO) + private Long postId; + + /** + * 岗位编码 + */ + @ApiModelProperty(value = "岗位编码", name = "postCode") + @TableField("post_code") + private String postCode; + + /** + * 岗位名称 + */ + @ApiModelProperty(value = "岗位名称", name = "postName") + @TableField("post_name") + private String postName; + + /** + * 显示顺序 + */ + @ApiModelProperty(value = "显示顺序", name = "postSort") + @TableField("post_sort") + private Integer postSort; + + /** + * 状态(0正常 1停用) + */ + @TableField("status") + private String status; + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者", name = "createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者", name = "updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间", name = "updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + + public Long getPostId() { + return postId; + } + + public void setPostId(Long postId) { + this.postId = postId; + } + + public String getPostCode() { + return postCode; + } + + public void setPostCode(String postCode) { + this.postCode = postCode; + } + + public String getPostName() { + return postName; + } + + public void setPostName(String postName) { + this.postName = postName; + } + + public Integer getPostSort() { + return postSort; + } + + public void setPostSort(Integer postSort) { + this.postSort = postSort; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + protected Serializable pkVal() { + return this.postId; + } + + @Override + public String toString() { + return "SysPost{" + + ", postId=" + postId + + ", postCode=" + postCode + + ", postName=" + postName + + ", postSort=" + postSort + + ", status=" + status + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysRole.java b/src/main/java/com/chenxuan/entity/model/SysRole.java new file mode 100644 index 0000000..513ea44 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysRole.java @@ -0,0 +1,275 @@ +package com.chenxuan.entity.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; +import java.io.Serializable; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; + + +/** + * @ClassName:SysRole + * @Description: 角色信息表. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:48 PM + * @Version V1.0 + */ + +@TableName("sys_role") +public class SysRole extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 角色ID + */ + @ApiModelProperty(value = "角色ID", name = "role_id") + @TableId(value = "role_id", type = IdType.AUTO) + private Long roleId; + + /** + * 角色名称 + */ + @ApiModelProperty(value = "角色名称", name = "roleName") + @TableField("role_name") + private String roleName; + + /** + * 角色权限字符串 + */ + @ApiModelProperty(value = "角色权限字符串", name = "roleKey") + @TableField("role_key") + private String roleKey; + + /** + * 显示顺序 + */ + @ApiModelProperty(value = "显示顺序", name = "roleSort") + @TableField("role_sort") + private Integer roleSort; + + /** + * 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限) + */ + @ApiModelProperty(value = "数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)", name = "dataScope") + @TableField("data_scope") + private String dataScope; + + /** + * 角色状态(0正常 1停用) + */ + @TableField("status") + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)", name = "delFlag") + @TableField("del_flag") + private String delFlag; + + /** + * 创建者 + */ + @ApiModelProperty(value = "创建者", name = "createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value = "更新者", name = "updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间", name = "updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + + /** + * 菜单组 + * */ + @TableField(exist = false) + private Long[] menuIds; + + /** + * 部门组(数据权限) + * */ + @TableField(exist = false) + private Long[] deptIds; + + public SysRole() { + } + + public SysRole(Long roleId) { + this.roleId = roleId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getRoleKey() { + return roleKey; + } + + public void setRoleKey(String roleKey) { + this.roleKey = roleKey; + } + + public Integer getRoleSort() { + return roleSort; + } + + public void setRoleSort(Integer roleSort) { + this.roleSort = roleSort; + } + + public String getDataScope() { + return dataScope; + } + + public void setDataScope(String dataScope) { + this.dataScope = dataScope; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public Long[] getMenuIds() { + return menuIds; + } + + public void setMenuIds(Long[] menuIds) { + this.menuIds = menuIds; + } + + public Long[] getDeptIds() { + return deptIds; + } + + public void setDeptIds(Long[] deptIds) { + this.deptIds = deptIds; + } + + @Override + protected Serializable pkVal() { + return this.roleId; + } + + @Override + public String toString() { + return "SysRole{" + + ", roleId=" + roleId + + ", roleName=" + roleName + + ", roleKey=" + roleKey + + ", roleSort=" + roleSort + + ", dataScope=" + dataScope + + ", status=" + status + + ", delFlag=" + delFlag + + ", createBy=" + createBy + + ", createTime=" + createTime + + ", updateBy=" + updateBy + + ", updateTime=" + updateTime + + ", remark=" + remark + + "}"; + } + + public boolean isAdmin() + { + return isAdmin(this.roleId); + } + + public static boolean isAdmin(Long roleId) + { + return roleId != null && 1L == roleId; + } + +} diff --git a/src/main/java/com/chenxuan/entity/model/SysRoleDept.java b/src/main/java/com/chenxuan/entity/model/SysRoleDept.java new file mode 100644 index 0000000..3598fa8 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysRoleDept.java @@ -0,0 +1,50 @@ +package com.chenxuan.entity.model; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + + +/** + * @ClassName:SysRoleDept + * @Description: 角色和部门关联 sys_role_dept + * @Author: Arno_Fu + * @CreatTime:12/3/2019 - 11:00 PM + * @Version V1.0 + */ + +public class SysRoleDept +{ + /** 角色ID */ + private Long roleId; + + /** 部门ID */ + private Long deptId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("deptId", getDeptId()) + .toString(); + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysRoleMenu.java b/src/main/java/com/chenxuan/entity/model/SysRoleMenu.java new file mode 100644 index 0000000..fa2b4c3 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysRoleMenu.java @@ -0,0 +1,46 @@ +package com.chenxuan.entity.model; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 角色和菜单关联 sys_role_menu + * + * @author ruoyi + */ +public class SysRoleMenu +{ + /** 角色ID */ + private Long roleId; + + /** 菜单ID */ + private Long menuId; + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + public Long getMenuId() + { + return menuId; + } + + public void setMenuId(Long menuId) + { + this.menuId = menuId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("roleId", getRoleId()) + .append("menuId", getMenuId()) + .toString(); + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysUser.java b/src/main/java/com/chenxuan/entity/model/SysUser.java new file mode 100644 index 0000000..5629342 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysUser.java @@ -0,0 +1,363 @@ +package com.chenxuan.entity.model; + + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @ClassName:SysUser + * @Description: 用户信息表 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 2:25 PM + * @Version V1.0 + */ +@Data +@TableName("sys_user") +public class SysUser extends Model { + + /** + * 用户ID + */ + @ApiModelProperty(value="用户ID", name="user_id") + @TableId(value = "user_id", type = IdType.AUTO) + private Long userId; + + /** + * 部门ID + */ + @ApiModelProperty(value="部门ID", name="deptId") + @TableField("dept_id") + private Long deptId; + + /** + * 用户账号 + */ + @ApiModelProperty(value="用户账号", name="userAccount") + @TableField("user_name") + private String userName; + + /** + * 用户昵称 + */ + @ApiModelProperty(value="用户昵称", name="nickName") + @TableField("nick_name") + private String nickName; + + /** + * 用户邮箱 + */ + @TableField("email") + private String email; + + /** + * 手机号码 + */ + @TableField("phone") + private String phone; + + /** + * 用户性别(1男 2女 3未知) + */ + @TableField("sex") + private String sex; + + /** + * 头像地址 + */ + @TableField("avatar") + private String avatar; + + /** + * 密码盐 + */ + @TableField("password_salt") + private String passwordSalt; + + /** + * 密码 + */ + @TableField("password") + private String password; + + /** + * 帐号状态(0正常 1停用) + */ + @TableField("status") + private String status; + + /** + * 删除标志(0代表存在 1代表删除) + */ + @ApiModelProperty(value="删除标志(0代表存在 1代表删除)", name="delFlag") + @TableField("del_flag") + private String delFlag; + + /** + * 创建者 + */ + @ApiModelProperty(value="创建者", name="createBy") + @TableField("create_by") + private String createBy; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="createTime") + @TableField("create_time") + private Date createTime; + + /** + * 更新者 + */ + @ApiModelProperty(value="更新者", name="updateBy") + @TableField("update_by") + private String updateBy; + + /** + * 更新时间 + */ + @ApiModelProperty(value="更新时间", name="updateTime") + @TableField("update_time") + private Date updateTime; + + /** + * 备注 + */ + @TableField("remark") + private String remark; + + /**********************************非持久化字段**********************************/ + + /** 部门对象 */ + @TableField(exist = false) + private SysDept dept; + + /** 角色对象 */ + @TableField(exist = false) + private List roles; + + /** 角色组 */ + @TableField(exist = false) + private Long[] roleIds; + + /** 岗位组 */ + @TableField(exist = false) + private Long[] postIds; + + public SysUser() { + } + + public SysUser(Long userId) { + this.userId = userId; + } + + /**********************************非持久化字段**********************************/ + + + @Override + protected Serializable pkVal() { + return userId; + } + + + public boolean isAdmin() + { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public Long[] getRoleIds() { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) { + this.roleIds = roleIds; + } + + public Long[] getPostIds() { + return postIds; + } + + public void setPostIds(Long[] postIds) { + this.postIds = postIds; + } + + public SysDept getDept() { + return dept; + } + + public void setDept(SysDept dept) { + this.dept = dept; + } + + @Override + public String toString() { + return "SysUser{" + + "userId=" + userId + + ", deptId=" + deptId + + ", userName='" + userName + '\'' + + ", nickName='" + nickName + '\'' + + ", email='" + email + '\'' + + ", phone='" + phone + '\'' + + ", sex='" + sex + '\'' + + ", avatar='" + avatar + '\'' + + ", password='" + password + '\'' + + ", status='" + status + '\'' + + ", delFlag='" + delFlag + '\'' + + ", createBy='" + createBy + '\'' + + ", createTime=" + createTime + + ", updateBy='" + updateBy + '\'' + + ", updateTime=" + updateTime + + ", remark='" + remark + '\'' + + '}'; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysUserOnline.java b/src/main/java/com/chenxuan/entity/model/SysUserOnline.java new file mode 100644 index 0000000..1c78236 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysUserOnline.java @@ -0,0 +1,117 @@ +package com.chenxuan.entity.model; + + +import java.io.Serializable; + +/** + * @ClassName:SysUserOnline + * @Description: 当前在线会话 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:22 PM + * @Version V1.0 + */ +public class SysUserOnline implements Serializable { + /** + * 会话编号 + */ + private String tokenId; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 用户名称 + */ + private String userName; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地址 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + /** + * 登录时间 + */ + private Long loginTime; + + public String getTokenId() { + return tokenId; + } + + public void setTokenId(String tokenId) { + this.tokenId = tokenId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getIpaddr() { + return ipaddr; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) { + this.loginLocation = loginLocation; + } + + public String getBrowser() { + return browser; + } + + public void setBrowser(String browser) { + this.browser = browser; + } + + public String getOs() { + return os; + } + + public void setOs(String os) { + this.os = os; + } + + public Long getLoginTime() { + return loginTime; + } + + public void setLoginTime(Long loginTime) { + this.loginTime = loginTime; + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysUserPost.java b/src/main/java/com/chenxuan/entity/model/SysUserPost.java new file mode 100644 index 0000000..6e2feb5 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysUserPost.java @@ -0,0 +1,52 @@ +package com.chenxuan.entity.model; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + + +/** + * @ClassName:SysUserPost + * @Description: 用户和岗位关联 sys_user_post + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 5:06 PM + * @Version V1.0 + */ + +public class SysUserPost implements Serializable +{ + /** 用户ID */ + private Long userId; + + /** 岗位ID */ + private Long postId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getPostId() + { + return postId; + } + + public void setPostId(Long postId) + { + this.postId = postId; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("postId", getPostId()) + .toString(); + } +} diff --git a/src/main/java/com/chenxuan/entity/model/SysUserRole.java b/src/main/java/com/chenxuan/entity/model/SysUserRole.java new file mode 100644 index 0000000..28c612b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/model/SysUserRole.java @@ -0,0 +1,51 @@ +package com.chenxuan.entity.model; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; + + +/** + * @ClassName:SysUserRole + * @Description: 用户和角色关联 sys_user_role + * @Author: Arno_Fu + * @CreatTime:12/3/2019 - 10:56 PM + * @Version V1.0 + */ + +public class SysUserRole implements Serializable { + /** + * 用户ID + */ + private Long userId; + + /** + * 角色ID + */ + private Long roleId; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder( this, ToStringStyle.MULTI_LINE_STYLE ) + .append( "userId", getUserId() ) + .append( "roleId", getRoleId() ) + .toString(); + } +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliComtradResultVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliComtradResultVo.java new file mode 100644 index 0000000..e5c9f8f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliComtradResultVo.java @@ -0,0 +1,98 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class BusiAmpliComtradResultVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键id", name="id") + private String id; + + /** + * 录播文件记录id + */ + @ApiModelProperty(value="录播文件记录id", name="fileId") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置id", name="subId") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型 1:空载 2:负载", name="loadType") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value="原副边", name="side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value="相位", name="phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value="上下侧或进出侧", name="inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value="振动频率", name="frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value="最大振幅", name="maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + private Date insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value="hbase中的rowkey", name="hbaseRowkey") + private String hbaseRowkey; + + /** + * 频率集合 + */ + @ApiModelProperty(value="频率集合", name="frequencyList") + private List frequencyList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value="最大幅值集合", name="maxAmplitudeList") + private List maxAmplitudeList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliDayIncreaseVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliDayIncreaseVo.java new file mode 100644 index 0000000..745391b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliDayIncreaseVo.java @@ -0,0 +1,104 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class BusiAmpliDayIncreaseVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value="主键id", name="id") + private String id; + + /** + * 录播文件记录id + */ + @ApiModelProperty(value="录播文件记录id", name="fileId") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value="主变id", name="mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置id", name="subId") + private String subId; + + /** + * 频率 + */ + @ApiModelProperty(value="频率", name="frequency") + private String frequency; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value="振幅阈值(mm/s2)", name="amplitude") + private String amplitude; + + /** + * 日增长率(%) + */ + @ApiModelProperty(value="日增长率(%)", name="dayRate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value="振动幅值月增长率(%)", name="monthRate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value="振动幅值月偏差率(%)", name="deviationRate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="dTime") + private Date dTime; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value="负载类型", name="loadType") + private String loadType; + + /** + * 频率集合 + */ + @ApiModelProperty(value="频率集合", name="frequencyList") + private List frequencyList; + + /** + * 日增长率集合 + */ + @ApiModelProperty(value="日增长率集合", name="dayRateList") + private List dayRateList; + + /** + * 振动幅值月增长率集合 + */ + @ApiModelProperty(value="振动幅值月增长率集合", name="monthRateList") + private List monthRateList; + + /** + * 振动幅值月偏差率集合 + */ + @ApiModelProperty(value="振动幅值月偏差率集合", name="deviationRateList") + private List deviationRateList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealDetailsVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealDetailsVo.java new file mode 100644 index 0000000..105c37b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealDetailsVo.java @@ -0,0 +1,140 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName:BusiAmpliRealDetailsVo + * @Description: 震动实时数据明细Vo + * @Author:Jordan_Li + * @CreatTime:6/22/2020 - 13:50 PM + * @Version V1.0 + */ +@Data +public class BusiAmpliRealDetailsVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "id", name = "id") + private String id; + + /** + * 录播文件id + */ + @ApiModelProperty(value = "录播文件id", name = "fileId") + private String fileId; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(value = "设备名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)", name = "inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 负载类型 + */ + @ApiModelProperty(value = "负载类型", name = "loadType") + private String loadType; + + /** + * 日增长率 + */ + @ApiModelProperty(value = "日增长率", name = "dayRate") + private String dayRate; + + /** + * 月增长率 + */ + @ApiModelProperty(value = "月增长率", name = "monthRate") + private String monthRate; + + /** + * 月偏差率 + */ + @ApiModelProperty(value = "月偏差率", name = "deviationRate") + private String deviationRate; + + /** + * 开始日期 + */ + @ApiModelProperty(value = "开始日期", name = "startTime") + private String startTime; + + /** + * 终止日期 + */ + @ApiModelProperty(value = "终止日期", name = "endTime") + private String endTime; + + /** + * 频率集合 + */ + @ApiModelProperty(value = "频率集合", name = "frequencyList") + private List frequencyList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value = "最大幅值集合", name = "maxAmplitudeList") + private List maxAmplitudeList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealVo.java new file mode 100644 index 0000000..9867952 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliRealVo.java @@ -0,0 +1,117 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * @ClassName:BusiAmpliRealVo + * @Description: 振动实时数据表Vo + * @Author:Jordan_Li + * @CreatTime:6/17/2020 - 15:50 PM + * @Version V1.0 + */ +@Data +public class BusiAmpliRealVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(value = "设备名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(value = "负载类型 1:空载 2:负载", name = "loadType") + private String loadType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name = "inOut") + private String inOut; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 频率集合 + */ + @ApiModelProperty(value = "频率集合", name = "frequencyList") + private List frequencyList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value = "最大幅值集合", name = "maxAmplitudeList") + private List maxAmplitudeList; + + /** + * 三维图数据集合 + */ + @ApiModelProperty(value = "三维图数据集合", name = "threeChartList") + private List> threeChartList; + + /** + * 时间集合 + */ + @ApiModelProperty(value = "时间集合", name = "timeList") + private List timeList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfNewVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfNewVo.java new file mode 100644 index 0000000..b240e54 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfNewVo.java @@ -0,0 +1,295 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +/** + * @author Carrey Zheng + * @create 2020-07-13 6:06 PM + **/ +@Data +public class BusiAmpliThresholdConfNewVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id", name = "id") + private String id; + + /** + * A相上幅值 + */ + @ApiModelProperty(value = "A相上幅值", name = "AUpAppreciation") + private String AUpAppreciation; + + /** + * A相上日增长率 + */ + @ApiModelProperty(value = "A相上日增长率", name = "AUpDay") + private String AUpDay; + + /** + * A相上月增长率 + */ + @ApiModelProperty(value = "A相上月增长率", name = "AUpMonth") + private String AUpMonth; + + /** + * A相上月偏差率 + */ + @ApiModelProperty(value = "A相上月偏差率", name = "AUpDeviationRatio") + private String AUpDeviationRatio; + + /** + * A相下幅值 + */ + @ApiModelProperty(value = "A相下幅值", name = "ADownAppreciation") + private String ADownAppreciation; + + /** + * A相下日增长率 + */ + @ApiModelProperty(value = "A相下日增长率", name = "ADownDay") + private String ADownDay; + + /** + * A相下月增长率 + */ + @ApiModelProperty(value = "A相下月增长率", name = "ADownMonth") + private String ADownMonth; + + /** + * A相上月偏差率 + */ + @ApiModelProperty(value = "A相上月偏差率", name = "ADownDeviationRatio") + private String ADownDeviationRatio; + + /** + * B相上幅值 + */ + @ApiModelProperty(value = "B相上幅值", name = "BUpAppreciation") + private String BUpAppreciation; + + /** + * B相上日增长率 + */ + @ApiModelProperty(value = "B相上日增长率", name = "BUpDay") + private String BUpDay; + + /** + * B相上月增长率 + */ + @ApiModelProperty(value = "B相上月增长率", name = "BUpMonth") + private String BUpMonth; + + /** + * B相上月偏差率 + */ + @ApiModelProperty(value = "B相上月偏差率", name = "BUpDeviationRatio") + private String BUpDeviationRatio; + + /** + * B相下幅值 + */ + @ApiModelProperty(value = "B相下幅值", name = "BDownAppreciation") + private String BDownAppreciation; + + /** + * B相下日增长率 + */ + @ApiModelProperty(value = "B相下日增长率", name = "BDownDay") + private String BDownDay; + + /** + * B相下月增长率 + */ + @ApiModelProperty(value = "B相下月增长率", name = "BDownMonth") + private String BDownMonth; + + /** + * B相下月偏差率 + */ + @ApiModelProperty(value = "B相下月偏差率", name = "BDownDeviationRatio") + private String BDownDeviationRatio; + + /** + * C相上幅值 + */ + @ApiModelProperty(value = "C相上幅值", name = "CUpAppreciation") + private String CUpAppreciation; + + /** + * C相上日增长率 + */ + @ApiModelProperty(value = "C相上日增长率", name = "CUpDay") + private String CUpDay; + + /** + * C相上月增长率 + */ + @ApiModelProperty(value = "C相上月增长率", name = "CUpMonth") + private String CUpMonth; + + /** + * C相上月偏差率 + */ + @ApiModelProperty(value = "C相上月偏差率", name = "CUpDeviationRatio") + private String CUpDeviationRatio; + + /** + * C相下幅值 + */ + @ApiModelProperty(value = "C相下幅值", name = "CDownAppreciation") + private String CDownAppreciation; + + /** + * C相下日增长率 + */ + @ApiModelProperty(value = "C相下日增长率", name = "CDownDay") + private String CDownDay; + + /** + * C相下月增长率 + */ + @ApiModelProperty(value = "C相下月增长率", name = "CDownMonth") + private String CDownMonth; + + /** + * C相下月偏差率 + */ + @ApiModelProperty(value = "C相下月偏差率", name = "CDownDeviationRatio") + private String CDownDeviationRatio; + + /** + * 主变名称 + */ + @ApiModelProperty(value = "主变名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 装置名称 + */ + @ApiModelProperty(value = "装置名称", name = "subDeviceName") + private String subDeviceName; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)", name = "deviceType") + private String deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name = "inOut") + private String inAndOut; + + /** + * 频率段ID + */ + @ApiModelProperty(value = "频率段ID", name = "frequencyId") + private String frequencyId; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 频率状态 + */ + @ApiModelProperty(value = "频率状态", name = "state") + private String state; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value = "振幅阈值(mm/s2)", name = "amplitude") + private String amplitude; + + /** + * 振动幅值日增长率(%) + */ + @ApiModelProperty(value = "振动幅值日增长率(%)", name = "dayRate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value = "振动幅值月增长率(%)", name = "monthRate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value = "振动幅值月偏差率(%)", name = "deviationRate") + private String deviationRate; + + /** + * A相上 装置id + */ + @ApiModelProperty(value = "A相上 装置id", name = "AUpSubId") + private String AUpSubId; + + /** + * A相下 装置id + */ + @ApiModelProperty(value = "A相下 装置id", name = "ADownSubId") + private String ADownSubId; + + /** + * B相上 装置id + */ + @ApiModelProperty(value = "B相上 装置id", name = "BUpSubId") + private String BUpSubId; + + /** + * B相下 装置id + */ + @ApiModelProperty(value = "B相下 装置id", name = "BDownSubId") + private String BDownSubId; + + /** + * C相上 装置id + */ + @ApiModelProperty(value = "C相上 装置id", name = "CUpSubId") + private String CUpSubId; + + /** + * C相下 装置id + */ + @ApiModelProperty(value = "C相下 装置id", name = "CDownSubId") + private String CDownSubId; + + private BusiAmpliThresholdConfNewVo content; + + private String column; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfVo.java new file mode 100644 index 0000000..6e33dc3 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiAmpliThresholdConfVo.java @@ -0,0 +1,152 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName:BusiAmpliThresholdConfVo + * @Description: 振动装置阈值配置Vo + * @Author:Jordan_Li + * @CreatTime:6/9/2020 - 13:49 PM + * @Version V1.0 + */ +@Data +public class BusiAmpliThresholdConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(value = "id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 主变名称 + */ + @ApiModelProperty(value = "主变名称", name = "deviceName") + private String deviceName; + + /** + * 装置id + */ + @ApiModelProperty(value = "装置id", name = "subId") + private String subId; + + /** + * 装置名称 + */ + @ApiModelProperty(value = "装置名称", name = "subDeviceName") + private String subDeviceName; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)", name = "deviceType") + private String deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 O:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)", name = "inAndOut") + private String inAndOut; + + /** + * 频率段ID + */ + @ApiModelProperty(value = "频率段ID", name = "frequencyId") + private String frequencyId; + + /** + * 频率 + */ + @ApiModelProperty(value = "频率", name = "frequency") + private String frequency; + + /** + * 频率状态 + */ + @ApiModelProperty(value = "频率状态", name = "state") + private String state; + + /** + * 振幅阈值(mm/s2) + */ + @ApiModelProperty(value = "振幅阈值(mm/s2)", name = "amplitude") + private String amplitude; + + /** + * 振动幅值日增长率(%) + */ + @ApiModelProperty(value = "振动幅值日增长率(%)", name = "dayRate") + private String dayRate; + + /** + * 振动幅值月增长率(%) + */ + @ApiModelProperty(value = "振动幅值月增长率(%)", name = "monthRate") + private String monthRate; + + /** + * 振动幅值月偏差率(%) + */ + @ApiModelProperty(value = "振动幅值月偏差率(%)", name = "deviationRate") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value = "最大幅值集合", name = "maxAmplitudeList") + private List maxAmplitudeList; + + /** + * 频率集合 + */ + @ApiModelProperty(value = "频率集合", name = "frequencyList") + private List frequencyList; + + /** + * 日增长率集合 + */ + @ApiModelProperty(value = "日增长率集合", name = "dayRateList") + private List dayRateList; + + /** + * 振动幅值月增长率集合 + */ + @ApiModelProperty(value = "振动幅值月增长率集合", name = "monthRateList") + private List monthRateList; + + /** + * 振动幅值月偏差率集合 + */ + @ApiModelProperty(value = "振动幅值月偏差率集合", name = "deviationRateList") + private List deviationRateList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiCalcParamConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiCalcParamConfVo.java new file mode 100644 index 0000000..b9bc3a9 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiCalcParamConfVo.java @@ -0,0 +1,132 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-06-28 8:34 PM + **/ +@Data +public class BusiCalcParamConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主设备ID + */ + @ApiModelProperty(name = "mainId", value = "主设备ID") + private String mainId; + + /** + * 1:第一级分项权重 2:第二级 3:第三级 + */ + @ApiModelProperty(name = "weightLevel", value = "1:第一级分项权重 2:第二级 3:第三级") + private String weightLevel; + + /** + * 1:高压端 2:低压端 3:中心点 4:噪声 + */ + private String hltype; + + /** + * 计算指标的名称 + */ + @ApiModelProperty(name = "name", value = "计算指标的名称") + private String name; + + /** + * 上级计算指标名称 + */ + @ApiModelProperty(name = "pname", value = "上级计算指标名称") + private String pname; + + /** + * 描述 + */ + @ApiModelProperty(name = "description", value = "描述") + private String description; + + /** + * 权重值 + */ + @ApiModelProperty(name = "value", value = "权重值") + private BigDecimal value; + + /** + * 是否显示AB值:0——否;1——是 + */ + @ApiModelProperty(name = "abValueFlag", value = "是否显示AB值:0——否;1——是") + private String abValueFlag; + + /** + * a值 + */ + @ApiModelProperty(name = "aValue", value = "a值") + private BigDecimal aValue; + + /** + * b值 + */ + @ApiModelProperty(name = "bValue", value = "b值") + private BigDecimal bValue; + + /** + * 注意值 + */ + @ApiModelProperty(name = "warningValue", value = "注意值") + private String warningValue; + + /** + * 评分模型:1:升 2:降 + */ + @ApiModelProperty(name = "model", value = "评分模型:1:升 2:降") + private String model; + + /** + * 单位 + */ + @ApiModelProperty(name = "unit", value = "单位") + private String unit; + + /** + * 是否参与评测: 0:不参与 1:参与 + */ + @ApiModelProperty(name = "isAttend", value = "是否参与评测: 0:不参与 1:参与") + private String isAttend; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "createTime", value = "创建时间") + private Date createTime; + + /** + * 创建人 + */ + @ApiModelProperty(name = "createUser", value = "创建人") + private String createUser; + + /** + * 排序 + */ + @ApiModelProperty(name = "sortNum", value = "排序") + private Integer sortNum; + + /** + * 下级计算指标列表 + */ + @ApiModelProperty(name = "children", value = "下级计算指标列表") + private List children; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiCenterRealDetailsVo.java b/src/main/java/com/chenxuan/entity/vo/BusiCenterRealDetailsVo.java new file mode 100644 index 0000000..ea8bbc5 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiCenterRealDetailsVo.java @@ -0,0 +1,105 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @ClassName:BusiCenterRealDetailsVo + * @Description: 中心点实时数据明细Vo + * @Author:Jordan_Li + * @CreatTime:6/19/2020 - 13:50 PM + * @Version V1.0 + */ +@Data +public class BusiCenterRealDetailsVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(name = "frequency", value = "振动频率") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(name = "maxAmplitude", value = "最大振幅") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(name = "gatherTimeList", value = "统计时间集合") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(name = "maxAmplitudeList", value = "最大幅值集合") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(name = "createTime", value = "统计时间") + private String createTime; + + /** + * 负载类型 + */ + @ApiModelProperty(name = "loadType", value = "负载类型") + private String loadType; + + /** + * 日增长率 + */ + @ApiModelProperty(name = "dayRate", value = "日增长率") + private String dayRate; + + /** + * 月增长率 + */ + @ApiModelProperty(name = "monthRate", value = "月增长率") + private String monthRate; + + /** + * 月偏差率 + */ + @ApiModelProperty(name = "deviationRate", value = "月偏差率") + private String deviationRate; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiCenterRealVo.java b/src/main/java/com/chenxuan/entity/vo/BusiCenterRealVo.java new file mode 100644 index 0000000..af48228 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiCenterRealVo.java @@ -0,0 +1,81 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @ClassName:BusiCenterRealVo + * @Description: 中心点实时数据Vo + * @Author:Jordan_Li + * @CreatTime:6/19/2020 - 13:50 PM + * @Version V1.0 + */ +@Data +public class BusiCenterRealVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(name = "frequency", value = "振动频率") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(name = "maxAmplitude", value = "最大振幅") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(name = "gatherTimeList", value = "统计时间集合") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(name = "maxAmplitudeList", value = "最大幅值集合") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(name = "createTime", value = "统计时间") + private String createTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiCenterThresholdConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiCenterThresholdConfVo.java new file mode 100644 index 0000000..adb68cd --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiCenterThresholdConfVo.java @@ -0,0 +1,91 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName:BusiCenterThresholdConfVo + * @Description: 中心点电流阈值配置表Vo + * @Author:Jordan_Li + * @CreatTime:6/8/2020 - 13:15 PM + * @Version V1.0 + */ +@Data +public class BusiCenterThresholdConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 主变装置id + */ + @ApiModelProperty(name = "subId", value = "主变装置id") + private String subId; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 正电流(A) + */ + @ApiModelProperty(name = "positive", value = "正电流(A)") + private String positive; + + /** + * 负电流(A) + */ + @ApiModelProperty(name = "negative", value = "负电流(A)") + private String negative; + + /** + * 中心点电流日增长率(%) + */ + @ApiModelProperty(name = "dayRate", value = "中心点电流日增长率(%)") + private String dayRate; + + /** + * 中心点电流月增长率(%) + */ + @ApiModelProperty(name = "monthRate", value = "中心点电流月增长率(%)") + private String monthRate; + + /** + * 中心点电流月偏差率(%) + */ + @ApiModelProperty(name = "deviationRate", value = "中心点电流月偏差率(%)") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiControlConfigVo.java b/src/main/java/com/chenxuan/entity/vo/BusiControlConfigVo.java new file mode 100644 index 0000000..1ccc8b1 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiControlConfigVo.java @@ -0,0 +1,139 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName:BusiControlConfigVo + * @Description: 控制参数配置表Vo + * @Author:Jordan_Li + * @CreatTime:6/2/2020 - 13:49 PM + * @Version V1.0 + */ +@Data +public class BusiControlConfigVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 主变装置id + */ + @ApiModelProperty(name = "subId", value = "主变装置id") + private String subId; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "subDeviceName", value = "装置名称") + private String subDeviceName; + + /** + * 装置类型 + */ + @ApiModelProperty(name = "deviceType", value = "装置类型") + private String deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)", name = "side") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)", name = "phase") + private String phase; + + /** + * 上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧) + */ + @ApiModelProperty(value = "上下侧或进出侧(U:上侧/进口侧 D:下侧/出口侧)", name = "inOut") + private String inOut; + + /** + * 使能选项 (0:禁用 1:启用) + */ + @ApiModelProperty(value = "使能选项 (0:禁用 1:启用)", name = "isEnable") + private String isEnable; + + /** + * 采集间隔时间(H),1,2,4,8,12,24小时 + */ + @ApiModelProperty(value = "采集间隔时间(H),1,2,4,8,12,24小时", name = "intervals") + private String intervals; + + /** + * 每天开始采集时间 + */ + @ApiModelProperty(value = "每天开始采集时间", name = "gatherTime") + private String gatherTime; + + /** + * 独立测试(0:断 1:好) + */ + @ApiModelProperty(value = "独立测试(0:断 1:好)", name = "aloneTest") + private String aloneTest; + + /** + * 更新时间 + */ + @ApiModelProperty(value = "更新时间", name = "updateTime") + private String updateTime; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; + + /** + * 状态(0:存在,1:不存在) + */ + @ApiModelProperty(name = "status", value = "状态(0:存在,1:不存在)") + private String status; + + /** + * 采用频率(KHz) + */ + @ApiModelProperty(name = "smpprod", value = "采用频率(KHz)") + private String smpprod; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiFrequencyConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiFrequencyConfVo.java new file mode 100644 index 0000000..cabe374 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiFrequencyConfVo.java @@ -0,0 +1,54 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +/** + * @ClassName:BusiFrequencyConfVo + * @Description: 振动装置-频率定义Vo + * @Author:Jordan_Li + * @CreatTime:6/11/2020 - 16:49 PM + * @Version V1.0 + */ +@Data +public class BusiFrequencyConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 振动频率 + */ + @ApiModelProperty(name = "frequency", value = "振动频率") + private String frequency; + + /** + * 状态: 0-禁止 1:启用 + */ + @ApiModelProperty(name = "state", value = "状态: 0-禁止 1:启用") + private String state; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiIedparamVo.java b/src/main/java/com/chenxuan/entity/vo/BusiIedparamVo.java new file mode 100644 index 0000000..a8bcc7e --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiIedparamVo.java @@ -0,0 +1,31 @@ +package com.chenxuan.entity.vo; + +import com.chenxuan.base.entity.Query; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author buck_guo + */ +@Data +public class BusiIedparamVo extends Query implements Serializable { + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + private String nodeId; + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + private String nodeName; + + /** + * 振动类型 + */ + @ApiModelProperty(value="振动类型", name="nodeType") + private String nodeType; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiMainDeviceVo.java b/src/main/java/com/chenxuan/entity/vo/BusiMainDeviceVo.java new file mode 100644 index 0000000..dc3d196 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiMainDeviceVo.java @@ -0,0 +1,86 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName:BusiMainDeviceVo + * @Description: 主变信息Vo + * @Author:Jordan_Li + * @CreatTime:6/3/2020 - 17:49 PM + * @Version V1.0 + */ +@Data +public class BusiMainDeviceVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变名称 + */ + @ApiModelProperty(value = "主变名称", name = "deviceName") + private String deviceName; + + /** + * 主变状态 (N(0):非正常 Y(1):正常) + */ + @ApiModelProperty(value = "主变状态 (N(0):非正常 Y(1):正常)", name = "state") + private String state; + + /** + * 投运日期 + */ + @ApiModelProperty(value = "投运日期", name = "deliveryTime") + private String deliveryTime; + + /** + * 设备型号 + */ + @ApiModelProperty(value = "设备型号", name = "deviceModel") + private String deviceModel; + + /** + * 制造厂家名称 + */ + @ApiModelProperty(value = "制造厂家名称", name = "manufacturer") + private String manufacturer; + + /** + * 出厂日期 + */ + @ApiModelProperty(value = "出厂日期", name = "factoryTime") + private String factoryTime; + + /** + * 出厂序号 + */ + @ApiModelProperty(value = "出厂序号", name = "factoryNumber") + private String factoryNumber; + + /** + * 设计使用寿命(年) + */ + @ApiModelProperty(value = "设计使用寿命(年)", name = "designLife") + private String designLife; + + /** + * 系统编码 + */ + @ApiModelProperty(value = "系统编码", name = "systemCode") + private String systemCode; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealDetailsVo.java b/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealDetailsVo.java new file mode 100644 index 0000000..e7a4819 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealDetailsVo.java @@ -0,0 +1,104 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName:BusiNoiseRealDetailsVo + * @Description: 噪声实时数据明细Vo + * @Author:Jordan_Li + * @CreatTime:6/20/2020 - 09:50 AM + * @Version V1.0 + */ +@Data +public class BusiNoiseRealDetailsVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(value = "设备名称", name = "deviceName") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(value = "统计时间集合", name = "gatherTimeList") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value = "最大幅值集合", name = "maxAmplitudeList") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(value = "统计时间", name = "createTime") + private String createTime; + + /** + * 负载类型 + */ + @ApiModelProperty(value = "负载类型", name = "loadType") + private String loadType; + + /** + * 日增长率 + */ + @ApiModelProperty(value = "日增长率", name = "dayRate") + private String dayRate; + + /** + * 月增长率 + */ + @ApiModelProperty(value = "月增长率", name = "monthRate") + private String monthRate; + + /** + * 月偏差率 + */ + @ApiModelProperty(value = "月偏差率", name = "deviationRate") + private String deviationRate; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealVo.java b/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealVo.java new file mode 100644 index 0000000..207718d --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiNoiseRealVo.java @@ -0,0 +1,80 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName:BusiNoiseRealVo + * @Description: 噪声实时数据表Vo + * @Author:Jordan_Li + * @CreatTime:6/19/2020 - 14:50 PM + * @Version V1.0 + */ +@Data +public class BusiNoiseRealVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(value = "主键id", name = "id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value = "主变id", name = "mainId") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(value = "设备名称", name = "deviceName") + private String deviceName; + + /** + * 振动频率 + */ + @ApiModelProperty(value = "振动频率", name = "frequency") + private String frequency; + + /** + * 最大振幅 + */ + @ApiModelProperty(value = "最大振幅", name = "maxAmplitude") + private String maxAmplitude; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间", name = "insTime") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(value = "hbase中的rowkey", name = "hbaseRowkey") + private String hbaseRowkey; + + /** + * 统计时间集合 + */ + @ApiModelProperty(value = "统计时间集合", name = "gatherTimeList") + private List gatherTimeList; + + /** + * 最大幅值集合 + */ + @ApiModelProperty(value = "最大幅值集合", name = "maxAmplitudeList") + private List maxAmplitudeList; + + /** + * 统计时间 + */ + @ApiModelProperty(value = "统计时间", name = "createTime") + private String createTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiNoiseThresholdConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiNoiseThresholdConfVo.java new file mode 100644 index 0000000..9842f7c --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiNoiseThresholdConfVo.java @@ -0,0 +1,86 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * @ClassName:BusiNoiseThresholdConfVo + * @Description: 噪声装置阈值配置Vo + * @Author:Jordan_Li + * @CreatTime:6/11/2020 - 16:16 PM + * @Version V1.0 + */ +@Data +public class BusiNoiseThresholdConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 主变装置id + */ + @ApiModelProperty(name = "subId", value = "主变装置id") + private String subId; + + /** + * 主变名称 + */ + @ApiModelProperty(name = "deviceName", value = "主变名称") + private String deviceName; + + /** + * 噪声阈值(db) + */ + @ApiModelProperty(name = "noise", value = "噪声阈值(db)") + private String noise; + + /** + * 噪声日增长率(%) + */ + @ApiModelProperty(name = "dayRate", value = "噪声日增长率(%)") + private String dayRate; + + /** + * 噪声月增长率(%) + */ + @ApiModelProperty(name = "monthRate", value = "噪声月增长率(%)") + private String monthRate; + + /** + * 噪声月偏差率(%) + */ + @ApiModelProperty(name = "deviationRate", value = "噪声月偏差率(%)") + private String deviationRate; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiParamBindVo.java b/src/main/java/com/chenxuan/entity/vo/BusiParamBindVo.java new file mode 100644 index 0000000..84a1f5d --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiParamBindVo.java @@ -0,0 +1,65 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class BusiParamBindVo implements Serializable { + + /** + * id + */ + @ApiModelProperty(value="主键", name="id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(value="主设备ID,源自表busi_main_device.id", name="mainId") + private String mainId; + + /** + * 装置id + */ + @ApiModelProperty(value="装置ID,源自表busi_sub_device.id", name="subId") + private String subId; + + /** + * 传感器code + */ + @ApiModelProperty(value="传感器code,源自表busi_sub_device.sensor_code", name="sensorCode") + private String sensorCode; + + /** + * 振动传感器 + */ + @ApiModelProperty(value="振动传感器", name="nodeId") + private String nodeId; + + + /** + * 振动分量 + */ + @ApiModelProperty(value="振动分量", name="nodeName") + private String nodeName; + + /** + * 频率(Hz) + */ + @ApiModelProperty(value="频率(Hz)", name="frequency") + private String frequency; + + /** + * 主变 + */ + @ApiModelProperty(value="频率(Hz)", name="deviceName") + private String deviceName; + + /** + * 设备 + */ + @ApiModelProperty(value="频率(Hz)", name="subDeviceName") + private String subDeviceName; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiSubDeviceVo.java b/src/main/java/com/chenxuan/entity/vo/BusiSubDeviceVo.java new file mode 100644 index 0000000..e97c77f --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiSubDeviceVo.java @@ -0,0 +1,90 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; + +/** + * @ClassName:BusiSubDeviceVo + * @Description: 主变装置信息Vo + * @Author:Jordan_Li + * @CreatTime:6/4/2020 - 16:19 PM + * @Version V1.0 + */ +@Data +public class BusiSubDeviceVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "subDeviceName", value = "装置名称") + private String subDeviceName; + + /** + * 传感器编码 + */ + @ApiModelProperty(name = "sensorCode", value = "传感器编码") + private String sensorCode; + + /** + * 装置类别 (1:振动装置 2:噪声装置 3:中心点装置) + */ + @ApiModelProperty(name = "deviceType", value = "装置类别 (1:振动装置 2:噪声装置 3:中心点装置)") + private Integer deviceType; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "side", value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)") + private String side; + + /** + * 相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "phase", value = "相位 (A:A相 B:B相 C:C相 Q:全相;,仅当device_type=1时有效)") + private String phase; + + /** + * 上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧) + */ + @ApiModelProperty(name = "inOut", value = "上下侧或进出侧(I:上侧/进口侧 O:下侧/出口侧)") + private String inOut; + + /** + * 创建日期 + */ + @ApiModelProperty(name = "insTime", value = "创建日期") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiTransformerConfVo.java b/src/main/java/com/chenxuan/entity/vo/BusiTransformerConfVo.java new file mode 100644 index 0000000..de97b2b --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiTransformerConfVo.java @@ -0,0 +1,85 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @ClassName:BusiTransformerConfVo + * @Description: 原副边电流电压实时数据配置Vo + * @Author:Jordan_Li + * @CreatTime:6/11/2020 - 15:33 PM + * @Version V1.0 + */ +@Data +public class BusiTransformerConfVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "side", value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)") + private String side; + + /** + * 电压(kV) + */ + @ApiModelProperty(name = "voltage", value = "电压(kV)") + private BigDecimal voltage; + + /** + * 电流(A) + */ + @ApiModelProperty(name = "current", value = "电流(A)") + private BigDecimal current; + + /** + * 主变电流电压获取方式.0:手动配置 1:自动设置 + */ + @ApiModelProperty(name = "confFlag", value = "主变电流电压获取方式.0:手动配置 1:自动设置") + private String confFlag; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiTransformerRealVo.java b/src/main/java/com/chenxuan/entity/vo/BusiTransformerRealVo.java new file mode 100644 index 0000000..9796b3c --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiTransformerRealVo.java @@ -0,0 +1,79 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @ClassName:BusiTransformerReal + * @Description: 原副边电流电压实时数据表Vo + * @Author:Jordan_Li + * @CreatTime:6/10/2020 - 15:49 PM + * @Version V1.0 + */ +@Data +public class BusiTransformerRealVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 设备名称 + */ + @ApiModelProperty(name = "deviceName", value = "设备名称") + private String deviceName; + + /** + * 原副边 (P: 原边 S:副边,仅当device_type=1时有效) + */ + @ApiModelProperty(name = "side", value = "原副边 (P: 原边 S:副边,仅当device_type=1时有效)") + private String side; + + /** + * 电压(kV) + */ + @ApiModelProperty(name = "voltage", value = "电压(kV)") + private BigDecimal voltage; + + /** + * 电流(A) + */ + @ApiModelProperty(name = "current", value = "电流(A)") + private BigDecimal current; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "insTime", value = "创建时间") + private String insTime; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; + + /** + * hbase中的rowkey + */ + @ApiModelProperty(name = "hbaseRowkey", value = "hbase中的rowkey") + private String hbaseRowkey; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiTransfromerSubTree.java b/src/main/java/com/chenxuan/entity/vo/BusiTransfromerSubTree.java new file mode 100644 index 0000000..a290f3d --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiTransfromerSubTree.java @@ -0,0 +1,75 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @ClassName: BusiTransfromerSubTree + * @FullClassPath: com.huatek.busi.entity.BusiTransfromerSubTree + * @Description: 变压器外挂设备节点树 + * @author: Arno + * @date: Jun 21, 2019 10:11:17 AM + * @version: 1.0 + */ +@Data +public class BusiTransfromerSubTree implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 父类别 id + */ + @ApiModelProperty(name = "parentId", value = "父类别 id") + private String parentId; + + /** + * 名称 + */ + @ApiModelProperty(name = "name", value = "名称") + private String name; + + /** + * 类别状态 1-正常 , 2-删除 + */ + @ApiModelProperty(name = "status", value = "类别状态 1-正常 , 2-删除") + private String status; + + /** + * 变压器设备id + */ + @ApiModelProperty(name = "equipmentId", value = "变压器设备id") + private String equipmentId; + + /** + * 设备类型 + */ + @ApiModelProperty(name = "equipmentType", value = "设备类型") + private String equipmentType; + + /** + * 系统编码 + */ + @ApiModelProperty(name = "systemCode", value = "系统编码") + private String systemCode; + + /** + * 站点id + */ + @ApiModelProperty(name = "siteId", value = "站点id") + private String siteId; + + /** + * 创建时间 + */ + @ApiModelProperty(name = "createTime", value = "创建时间") + private LocalDateTime createTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiVibrationSeparationVo.java b/src/main/java/com/chenxuan/entity/vo/BusiVibrationSeparationVo.java new file mode 100644 index 0000000..0e79f89 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiVibrationSeparationVo.java @@ -0,0 +1,110 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class BusiVibrationSeparationVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 录播文件id + */ + @ApiModelProperty(value="录播文件id", name="comtradId") + private String comtradId; + + /** + * 相位 (A:A相 B:B相 C:C相 ) + */ + @ApiModelProperty(value="相位 (A:A相 B:B相 C:C相 Q:全相)", name="phase") + private String phase; + + /** + * 机械幅值 + */ + @ApiModelProperty(value="机械幅值", name="mechAmplitude") + private String mechAmplitude; + + /** + * 绕组幅值 + */ + @ApiModelProperty(value="绕组幅值", name="windingAmplitude") + private String windingAmplitude; + + /** + * 铁芯幅值 + */ + @ApiModelProperty(value="铁芯幅值", name="ironCoreAmplitude") + private String ironCoreAmplitude; + + /** + * 原边幅值 + */ + @ApiModelProperty(value="原边幅值", name="primarySideAmplitude") + private String primarySideAmplitude; + + /** + * 副边幅值 + */ + @ApiModelProperty(value="副边幅值", name="secSideAmplitude") + private String secSideAmplitude; + + /** + * 插入顺序 + */ + @ApiModelProperty(value="插入顺序", name="sort") + private Integer sort; + + /** + * 创建时间 + */ + @ApiModelProperty(value="创建时间", name="insTime") + private String insTime; + + /** + * 机械幅值集合 + */ + @ApiModelProperty(value="机械幅值集合", name="mechAmplitudeList") + private List mechAmplitudeList; + + /** + * 绕组幅值集合 + */ + @ApiModelProperty(value="绕组幅值集合", name="windingAmplitudeList") + private List windingAmplitudeList; + + /** + * 铁芯幅值集合 + */ + @ApiModelProperty(value="铁芯幅值集合", name="ironCoreAmplitudeList") + private List ironCoreAmplitudeList; + + /** + * 原边幅值集合 + */ + @ApiModelProperty(value="原边幅值集合", name="primarySideAmplitudeList") + private List primarySideAmplitudeList; + + /** + * 副边幅值集合 + */ + @ApiModelProperty(value="副边幅值集合", name="secSideAmplitudeList") + private List secSideAmplitudeList; +} diff --git a/src/main/java/com/chenxuan/entity/vo/BusiWarningVo.java b/src/main/java/com/chenxuan/entity/vo/BusiWarningVo.java new file mode 100644 index 0000000..c54f5ce --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/BusiWarningVo.java @@ -0,0 +1,201 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName:BusiWarningVo + * @Description: 告警信息Vo + * @Author:Jordan_Li + * @CreatTime:6/18/2020 - 16:29 PM + * @Version V1.0 + */ +@Data +public class BusiWarningVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ApiModelProperty(name = "id", value = "主键id") + private String id; + + /** + * 装置ID,源自表busi_sub_device.id + */ + @ApiModelProperty(name = "subId", value = "装置ID,源自表busi_sub_device.id") + private String subId; + + /** + * 告警时间 + */ + @ApiModelProperty(name = "warnTime", value = "告警时间") + private String warnTime; + + /** + * 告警分类 1:通信异常告警 2:装置自检异常告警 3:信号异常告警 4:供电异常告警 5:振动阈值告警 + * 6:噪声阈值告警 7:中心点阈值告警 8:日增长率告警 9:月增长率告警 10:月偏差率告警 + * 11:服务器与IED通信异常 12:传感器振动告警 13:传感器噪声告警 14:传感器中心点告警 + */ + @ApiModelProperty(name = "warnType", value = "告警分类") + private String warnType; + + /** + * 负载类型 1:空载 2:负载 + */ + @ApiModelProperty(name = "loadType", value = "负载类型 1:空载 2:负载") + private String loadType; + + /** + * 采样值 + */ + @ApiModelProperty(name = "sampleValue", value = "采样值") + private String sampleValue; + + /** + * 采样值单位(A)(db)(mm/s2) + */ + @ApiModelProperty(name = "valueUnit", value = "采样值单位(A)(db)(mm/s2)") + private String valueUnit; + + /** + * 告警信息/设备名称/设备安装位置 + */ + @ApiModelProperty(name = "warnDesc", value = "告警信息/设备名称/设备安装位置") + private String warnDesc; + + /** + * 告警级别 0:高 1:中 2:低 + */ + @ApiModelProperty(name = "warnLevel", value = "告警级别 0:高 1:中 2:低") + private String warnLevel; + + /** + * 处理状态 0:已处理 1:未处理 + */ + @ApiModelProperty(name = "state", value = "处理状态 0:已处理 1:未处理") + private String state; + + /** + * 处理结果描述 + */ + @ApiModelProperty(name = "process", value = "处理结果描述") + private String process; + + /** + * 处理人id + */ + @ApiModelProperty(name = "processUser", value = "处理人id") + private String processUser; + + /** + * 处理人姓名 + */ + @ApiModelProperty(name = "processUserName", value = "处理人姓名") + private String processUserName; + + /** + * 处理时间 + */ + @ApiModelProperty(name = "processTime", value = "处理时间") + private String processTime; + + /** + * hbase同步主键 + */ + @ApiModelProperty(name = "hbaseKey", value = "hbase同步主键") + private String hbaseKey; + + /** + * 装置位置 + */ + @ApiModelProperty(name = "deviceLocation", value = "装置位置") + private String deviceLocation; + + /** + * 振幅阈值 + */ + @ApiModelProperty(name = "amplitudeThreshold", value = "振幅阈值") + private String amplitudeThreshold; + + /** + * 振幅增长率 + */ + @ApiModelProperty(name = "amplitudeRate", value = "振幅增长率") + private String amplitudeRate; + + /** + * 电流阈值 + */ + @ApiModelProperty(name = "currentThreshold", value = "电流阈值") + private String currentThreshold; + + /** + * 电流增长率 + */ + @ApiModelProperty(name = "currentRate", value = "电流增长率") + private String currentRate; + + /** + * 噪声阈值 + */ + @ApiModelProperty(name = "noiseThreshold", value = "噪声阈值") + private String noiseThreshold; + + /** + * 噪声增长率 + */ + @ApiModelProperty(name = "noiseRate", value = "噪声增长率") + private String noiseRate; + + /** + * 增长率 + */ + @ApiModelProperty(name = "rate", value = "增长率") + private String rate; + + /** + * 预警值 + */ + @ApiModelProperty(name = "threshold", value = "预警值") + private String threshold; + + /** + * 设备类型 + */ + @ApiModelProperty(name = "deviceType", value = "设备类型") + private String deviceType; + + /** + * 告警次数 + */ + @ApiModelProperty(name = "warningSum", value = "告警次数") + private String warningSum; + + /** + * 主变id + */ + @ApiModelProperty(name = "mainId", value = "主变id") + private String mainId; + + /** + * 装置名称 + */ + @ApiModelProperty(name = "deviceName", value = "装置名称") + private String deviceName; + + /** + * 开始时间 + */ + @ApiModelProperty(name = "startTime", value = "开始时间") + private String startTime; + + /** + * 结束时间 + */ + @ApiModelProperty(name = "endTime", value = "结束时间") + private String endTime; +} diff --git a/src/main/java/com/chenxuan/entity/vo/ColVo.java b/src/main/java/com/chenxuan/entity/vo/ColVo.java new file mode 100644 index 0000000..7ebcf3e --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/ColVo.java @@ -0,0 +1,28 @@ +package com.chenxuan.entity.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + + +/** + * @ClassName:ColVo + * @Description: ColVo 中心点/噪声/振动实时数据Vo + * @Author:Jordan_Li + * @CreatTime:6/17/2020 - 13:12 PM + * @Version V1.0 + */ +@Data +public class ColVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * col + */ + @ApiModelProperty(name = "col", value = "col") + private String col; +} diff --git a/src/main/java/com/chenxuan/entity/vo/MetaVo.java b/src/main/java/com/chenxuan/entity/vo/MetaVo.java new file mode 100644 index 0000000..0143ef8 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/MetaVo.java @@ -0,0 +1,40 @@ +package com.chenxuan.entity.vo; + + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @ClassName:MetaVo + * @Description: 路由显示信息 + * @Author: Arno_Fu + * @CreatTime:11/27/2019 - 10:33 AM + * @Version V1.0 + */ +@Data +public class MetaVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 设置该路由在侧边栏和面包屑中展示的名字 + */ + @ApiModelProperty(name = "title", value = "设置该路由在侧边栏和面包屑中展示的名字") + private String title; + + /** + * 设置该路由的图标,对应路径src/icons/svg + */ + @ApiModelProperty(name = "icon", value = "设置该路由的图标,对应路径src/icons/svg") + private String icon; + + public MetaVo() { + } + + public MetaVo(String title, String icon) { + this.title = title; + this.icon = icon; + } +} diff --git a/src/main/java/com/chenxuan/entity/vo/PercentageVo.java b/src/main/java/com/chenxuan/entity/vo/PercentageVo.java new file mode 100644 index 0000000..43cfb85 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/PercentageVo.java @@ -0,0 +1,29 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @author Carrey Zheng + * @create 2020-06-18 3:24 PM + **/ +@Data +public class PercentageVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 百分比 + */ + @ApiModelProperty(name = "percent", value = "百分比") + private BigDecimal percent; + + /** + * 数量 + */ + @ApiModelProperty(name = "num", value = "数量") + private String num; +} diff --git a/src/main/java/com/chenxuan/entity/vo/RouterVo.java b/src/main/java/com/chenxuan/entity/vo/RouterVo.java new file mode 100644 index 0000000..010aaf3 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/RouterVo.java @@ -0,0 +1,71 @@ +package com.chenxuan.entity.vo; + + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @ClassName:RouterVo + * @Description: 路由配置信息 + * @Author: Arno_Fu + * @CreatTime:11/27/2019 - 10:33 AM + * @Version V1.0 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class RouterVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 路由名字 + */ + @ApiModelProperty(name = "name", value = "路由名字") + private String name; + + /** + * 路由地址 + */ + @ApiModelProperty(name = "path", value = "路由地址") + private String path; + + /** + * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 + */ + @ApiModelProperty(name = "hidden", value = "是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现") + private String hidden; + + /** + * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + */ + @ApiModelProperty(name = "redirect", value = "重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击") + private String redirect; + + /** + * 组件地址 + */ + @ApiModelProperty(name = "component", value = "组件地址") + private String component; + + /** + * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + */ + @ApiModelProperty(name = "alwaysShow", value = "当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面") + private Boolean alwaysShow; + + /** + * 其他元素 + */ + @ApiModelProperty(name = "meta", value = "其他元素") + private MetaVo meta; + + /** + * 子路由 + */ + @ApiModelProperty(name = "children", value = "子路由") + private List children; +} diff --git a/src/main/java/com/chenxuan/entity/vo/TableVo.java b/src/main/java/com/chenxuan/entity/vo/TableVo.java new file mode 100644 index 0000000..b37828d --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/TableVo.java @@ -0,0 +1,33 @@ +package com.chenxuan.entity.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * @ClassName:TableVo + * @Description: TableVo 中心点/噪声/振动实时数据Vo + * @Author:Jordan_Li + * @CreatTime:6/17/2020 - 13:12 PM + * @Version V1.0 + */ +@Data +public class TableVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @ApiModelProperty(name = "id", value = "id") + private String id; + + /** + * rows + */ + @ApiModelProperty(name = "rows", value = "rows") + private List rows; +} diff --git a/src/main/java/com/chenxuan/entity/vo/TreeSelect.java b/src/main/java/com/chenxuan/entity/vo/TreeSelect.java new file mode 100644 index 0000000..46ef1c1 --- /dev/null +++ b/src/main/java/com/chenxuan/entity/vo/TreeSelect.java @@ -0,0 +1,59 @@ +package com.chenxuan.entity.vo; + + +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.entity.model.SysMenu; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @ClassName:DeptTreeVo + * @Description: 部门树 + * @Author: Arno_Fu + * @CreatTime:11/29/2019 - 10:32 AM + * @Version V1.0 + */ +@Data +public class TreeSelect implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 节点ID + */ + @ApiModelProperty(name = "id", value = "节点ID") + private Long id; + + /** + * 节点名称 + */ + @ApiModelProperty(name = "label", value = "节点名称") + /** 节点名称 */ + private String label; + + /** + * 子节点 + */ + @ApiModelProperty(name = "children", value = "子节点") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelect(SysDept dept) + { + this.id = dept.getDeptId(); + this.label = dept.getDeptName(); + this.children = dept.getChildren().stream().map( TreeSelect::new).collect( Collectors.toList()); + } + + public TreeSelect(SysMenu menu) + { + this.id = menu.getMenuId(); + this.label = menu.getMenuName(); + this.children = menu.getChildren().stream().map( TreeSelect::new).collect(Collectors.toList()); + } +} diff --git a/src/main/java/com/chenxuan/enums/BusinessStatus.java b/src/main/java/com/chenxuan/enums/BusinessStatus.java new file mode 100644 index 0000000..b05bc78 --- /dev/null +++ b/src/main/java/com/chenxuan/enums/BusinessStatus.java @@ -0,0 +1,23 @@ +package com.chenxuan.enums; + + +/** + * @ClassName:BusinessStatus + * @Description: 操作状态 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 1:41 PM + * @Version V1.0 + */ + +public enum BusinessStatus +{ + /** + * 成功 + */ + SUCCESS, + + /** + * 失败 + */ + FAIL, +} diff --git a/src/main/java/com/chenxuan/enums/ClientType.java b/src/main/java/com/chenxuan/enums/ClientType.java new file mode 100644 index 0000000..0130b84 --- /dev/null +++ b/src/main/java/com/chenxuan/enums/ClientType.java @@ -0,0 +1,27 @@ +package com.chenxuan.enums; + +/** + * @ClassName:ClientType + * @Description: 操作人类别 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 1:41 PM + * @Version V1.0 + */ + +public enum ClientType +{ + /** + * 其它 + */ + OTHER, + + /** + * 后台用户 + */ + MANAGE, + + /** + * 手机端用户 + */ + MOBILE +} diff --git a/src/main/java/com/chenxuan/enums/DataSourceType.java b/src/main/java/com/chenxuan/enums/DataSourceType.java new file mode 100644 index 0000000..c3c9879 --- /dev/null +++ b/src/main/java/com/chenxuan/enums/DataSourceType.java @@ -0,0 +1,23 @@ +package com.chenxuan.enums; + + +/** + * @ClassName:DataSourceType + * @Description: 数据源 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:58 PM + * @Version V1.0 + */ + +public enum DataSourceType +{ + /** + * 主库 + */ + MASTER, + + /** + * 从库 + */ + SLAVE +} diff --git a/src/main/java/com/chenxuan/enums/HttpMethod.java b/src/main/java/com/chenxuan/enums/HttpMethod.java new file mode 100644 index 0000000..f2f7106 --- /dev/null +++ b/src/main/java/com/chenxuan/enums/HttpMethod.java @@ -0,0 +1,41 @@ +package com.chenxuan.enums; + +import org.springframework.lang.Nullable; + +import java.util.HashMap; +import java.util.Map; + + +/** + * @ClassName:HttpMethod + * @Description: 请求方式 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 1:37 PM + * @Version V1.0 + */ + +public enum HttpMethod +{ + GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; + + private static final Map mappings = new HashMap<>(16); + + static + { + for (HttpMethod httpMethod : values()) + { + mappings.put(httpMethod.name(), httpMethod); + } + } + + @Nullable + public static HttpMethod resolve(@Nullable String method) + { + return (method != null ? mappings.get(method) : null); + } + + public boolean matches(String method) + { + return (this == resolve(method)); + } +} diff --git a/src/main/java/com/chenxuan/enums/OperateType.java b/src/main/java/com/chenxuan/enums/OperateType.java new file mode 100644 index 0000000..43e7907 --- /dev/null +++ b/src/main/java/com/chenxuan/enums/OperateType.java @@ -0,0 +1,63 @@ +package com.chenxuan.enums; + + +/** + * @ClassName:OperateType + * @Description: 业务操作类型 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 6:12 PM + * @Version V1.0 + */ + +public enum OperateType +{ + /** + * 其它 + */ + OTHER, + + /** + * 新增 + */ + INSERT, + + /** + * 修改 + */ + UPDATE, + + /** + * 删除 + */ + DELETE, + + /** + * 授权 + */ + GRANT, + + /** + * 导出 + */ + EXPORT, + + /** + * 导入 + */ + IMPORT, + + /** + * 强退 + */ + FORCE, + + /** + * 生成代码 + */ + GENCODE, + + /** + * 清空数据 + */ + CLEAN, +} diff --git a/src/main/java/com/chenxuan/exception/BaseException.java b/src/main/java/com/chenxuan/exception/BaseException.java new file mode 100644 index 0000000..4778d66 --- /dev/null +++ b/src/main/java/com/chenxuan/exception/BaseException.java @@ -0,0 +1,90 @@ +package com.chenxuan.exception; + +/** + * @ClassName:BaseException + * @Description: 基础异常 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:59 PM + * @Version V1.0 + */ + +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 所属模块 + */ + private String module; + + /** + * 错误码 + */ + private String code; + + /** + * 错误码对应的参数 + */ + private Object[] args; + + /** + * 错误消息 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + @Override + public String getMessage() + { + String message = null; + + return message; + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/src/main/java/com/chenxuan/exception/CustomException.java b/src/main/java/com/chenxuan/exception/CustomException.java new file mode 100644 index 0000000..a763e34 --- /dev/null +++ b/src/main/java/com/chenxuan/exception/CustomException.java @@ -0,0 +1,43 @@ +package com.chenxuan.exception; + +/** + * 自定义异常 + * + * @author ruoyi + */ +public class CustomException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + private Integer code; + + private String message; + + public CustomException(String message) + { + this.message = message; + } + + public CustomException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public CustomException(String message, Throwable e) + { + super(message, e); + this.message = message; + } + + @Override + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } +} diff --git a/src/main/java/com/chenxuan/exception/UserPasswordNotMatchException.java b/src/main/java/com/chenxuan/exception/UserPasswordNotMatchException.java new file mode 100644 index 0000000..426c4f8 --- /dev/null +++ b/src/main/java/com/chenxuan/exception/UserPasswordNotMatchException.java @@ -0,0 +1,50 @@ +package com.chenxuan.exception; + +import org.omg.CORBA.UserException; + + +/** + * @ClassName:UserPasswordNotMatchException + * @Description: 用户密码不正确或不符合规范异常类 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:07 PM + * @Version V1.0 + */ + +public class UserPasswordNotMatchException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + + private Integer code; + + private String message; + + public UserPasswordNotMatchException(String message) + { + this.message = message; + } + + public UserPasswordNotMatchException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public UserPasswordNotMatchException(String message, Throwable e) + { + super(message, e); + this.message = message; + } + + @Override + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } +} diff --git a/src/main/java/com/chenxuan/exception/UtilException.java b/src/main/java/com/chenxuan/exception/UtilException.java new file mode 100644 index 0000000..1a46daa --- /dev/null +++ b/src/main/java/com/chenxuan/exception/UtilException.java @@ -0,0 +1,30 @@ +package com.chenxuan.exception; + + +/** + * @ClassName:UtilException + * @Description: 工具类异常 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:00 PM + * @Version V1.0 + */ + +public class UtilException extends RuntimeException +{ + private static final long serialVersionUID = 8247610319171014183L; + + public UtilException(Throwable e) + { + super(e.getMessage(), e); + } + + public UtilException(String message) + { + super(message); + } + + public UtilException(String message, Throwable throwable) + { + super(message, throwable); + } +} diff --git a/src/main/java/com/chenxuan/manager/AsyncManager.java b/src/main/java/com/chenxuan/manager/AsyncManager.java new file mode 100644 index 0000000..a608aa0 --- /dev/null +++ b/src/main/java/com/chenxuan/manager/AsyncManager.java @@ -0,0 +1,62 @@ +package com.chenxuan.manager; + + + +import com.chenxuan.utils.Threads; +import com.chenxuan.utils.spring.SpringUtils; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + + +/** + * @ClassName:AsyncManager + * @Description: 异步任务管理器 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:05 AM + * @Version V1.0 + */ + +public class AsyncManager +{ + /** + * 操作延迟10毫秒 + */ + private final int OPERATE_DELAY_TIME = 10; + + /** + * 异步操作任务调度线程池 + */ + private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); + + /** + * 单例模式 + */ + private AsyncManager(){} + + private static AsyncManager me = new AsyncManager(); + + public static AsyncManager me() + { + return me; + } + + /** + * 执行任务 + * + * @param task 任务 + */ + public void execute(TimerTask task) + { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } + + /** + * 停止任务线程池 + */ + public void shutdown() + { + Threads.shutdownAndAwaitTermination(executor); + } +} diff --git a/src/main/java/com/chenxuan/manager/ShutdownManager.java b/src/main/java/com/chenxuan/manager/ShutdownManager.java new file mode 100644 index 0000000..d039978 --- /dev/null +++ b/src/main/java/com/chenxuan/manager/ShutdownManager.java @@ -0,0 +1,40 @@ +package com.chenxuan.manager; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; + +/** + * 确保应用退出时能关闭后台线程 + * + * @author ruoyi + */ +@Component +public class ShutdownManager +{ + private static final Logger logger = LoggerFactory.getLogger("sys-user"); + + @PreDestroy + public void destroy() + { + shutdownAsyncManager(); + } + + /** + * 停止异步执行任务 + */ + private void shutdownAsyncManager() + { + try + { + logger.info("====关闭后台任务任务线程池===="); + AsyncManager.me().shutdown(); + } + catch (Exception e) + { + logger.error(e.getMessage(), e); + } + } +} diff --git a/src/main/java/com/chenxuan/manager/factory/AsyncFactory.java b/src/main/java/com/chenxuan/manager/factory/AsyncFactory.java new file mode 100644 index 0000000..5669e0d --- /dev/null +++ b/src/main/java/com/chenxuan/manager/factory/AsyncFactory.java @@ -0,0 +1,97 @@ +package com.chenxuan.manager.factory; + + +import com.chenxuan.constants.Constants; +import com.chenxuan.entity.model.SysLoginLog; +import com.chenxuan.entity.model.SysOperLog; +import com.chenxuan.service.SysLoginLogService; +import com.chenxuan.service.SysOperLogService; +import com.chenxuan.utils.LogUtils; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.ip.AddressUtils; +import com.chenxuan.utils.ip.IpUtils; +import com.chenxuan.utils.spring.SpringUtils; +import eu.bitwalker.useragentutils.UserAgent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.TimerTask; + + +/** + * @ClassName:AsyncFactory + * @Description: 异步工厂(产生任务用) + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:03 PM + * @Version V1.0 + */ + +public class AsyncFactory { + private static final Logger sys_user_logger = LoggerFactory.getLogger( "sys-user" ); + + /** + * 记录登陆信息 + * + * @param username 用户名 + * @param status 状态 + * @param message 消息 + * @param args 列表 + * @return 任务task + */ + public static TimerTask recordLoginLog(final String username, final String status, final String message, + final Object... args) { + final UserAgent userAgent = UserAgent.parseUserAgentString( ServletUtils.getRequest().getHeader( "User-Agent" ) ); + final String ip = IpUtils.getIpAddr( ServletUtils.getRequest() ); + return new TimerTask() { + @Override + public void run() { + String address = AddressUtils.getRealAddressByIP( ip ); + StringBuilder s = new StringBuilder(); + s.append( LogUtils.getBlock( ip ) ); + s.append( address ); + s.append( LogUtils.getBlock( username ) ); + s.append( LogUtils.getBlock( status ) ); + s.append( LogUtils.getBlock( message ) ); + // 打印信息到日志 + sys_user_logger.info( s.toString(), args ); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + // 封装对象 + SysLoginLog logininfor = new SysLoginLog(); + logininfor.setUserName( username ); + logininfor.setIpaddr( ip ); + logininfor.setLoginLocation( address ); + logininfor.setBrowser( browser ); + logininfor.setOs( os ); + logininfor.setMsg( message ); + // 日志状态 + if (Constants.LOGIN_SUCCESS.equals( status ) || Constants.LOGOUT.equals( status )) { + logininfor.setStatus( Constants.SUCCESS ); + } else if (Constants.LOGIN_FAIL.equals( status )) { + logininfor.setStatus( Constants.FAIL ); + } + // 插入数据 + SpringUtils.getBean( SysLoginLogService.class ).insertLoginLog( logininfor ); + } + }; + } + + /** + * 操作日志记录 + * + * @param operLog 操作日志信息 + * @return 任务task + */ + public static TimerTask recordOperLog(final SysOperLog operLog) { + return new TimerTask() { + @Override + public void run() { + // 远程查询操作地点 + operLog.setOperLocation( AddressUtils.getRealAddressByIP( operLog.getOperIp() ) ); + SpringUtils.getBean( SysOperLogService.class ).insertOperlog( operLog ); + } + }; + } +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliComtradMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliComtradMapper.java new file mode 100644 index 0000000..ef941a5 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliComtradMapper.java @@ -0,0 +1,22 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliComtrad; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BusiAmpliComtradMapper extends BaseMapper { + + /** + * 查询录播振动数据 + * + * @param dto + * @return + */ + List findAmpliComtrad(@Param("bean") BusiAmpliRealDto dto); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliComtradResultMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliComtradResultMapper.java new file mode 100644 index 0000000..eb7ffb3 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliComtradResultMapper.java @@ -0,0 +1,31 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.dto.BusiAmpliComtradResultDto; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliComtradResult; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BusiAmpliComtradResultMapper extends BaseMapper { + + /** + * 查询录播振动数据 + * + * @param busiAmpliRealDto + * @return + */ + List findRealChartByThreeInfo(@Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 批量新增算法算出来的数据 + * + * @param results + * @return + */ + int batchInsertAmpliComtrad(List results); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliDayIncreaseMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliDayIncreaseMapper.java new file mode 100644 index 0000000..ee5c971 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliDayIncreaseMapper.java @@ -0,0 +1,82 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliDayIncrease; +import com.chenxuan.entity.vo.BusiAmpliDayIncreaseVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiAmpliDayIncreaseMapper + * @Description: 振动装置日增长率Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/10/2020 11:12 AM + * @Version V1.0 + */ + +@Mapper +public interface BusiAmpliDayIncreaseMapper extends BaseMapper { + + /** + * @Description: 分页 + * @Param page + * @Param params + * @Return: 主变装置集合信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存主变装置信息 + * + * @param increases 主变装置对象 + * @return 结果 + */ + int saveAmpliDayIncrease(List increases); + + /** + * 更新主变装置信息 + * + * @param BusiAmpliDayIncrease 主变装置对象 + * @return 结果 + */ + int updateAmpliDayIncrease(BusiAmpliDayIncrease BusiAmpliDayIncrease); + + /** + * 根据主变信息查询增长率及偏差率 + * + * @param dto + * @return + */ + List getCurrentData(@Param("bean") BusiAmpliRealDto dto); + + /** + * 通过主变ID查询主变装置信息 + * + * @param mainId 主变ID + * @return 主变装置信息集合 + */ + List findAmpliDayIncreaseByMainId(String mainId); + + /** + * 通过主变ID删除对应的装置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteSubDeviceByMainId(String mainId); + + /** + * 通过id删除装置信息 + * + * @param id 装置ID + * @return 结果 + */ + int delete(String id); + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliRealMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliRealMapper.java new file mode 100644 index 0000000..ce16478 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliRealMapper.java @@ -0,0 +1,102 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.entity.model.ExportData; +import com.chenxuan.entity.vo.BusiAmpliRealDetailsVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName:BusiAmpliRealMapper + * @Description: 振动实时数据信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:55 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiAmpliRealMapper extends BaseMapper { + + /** + * 保存振动实时数据信息 + * + * @param busiAmpliReals 振动实时数据对象 + * @return 结果 + */ + int saveShockReal(List busiAmpliReals); + + /** + * 通过条件查询振动实时数据信息 + * + * @param busiAmpliRealDto + * @return + */ + List findShockRealByMainId(@Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 通过条件查询震动实时数据详细信息 + * + * @param page + * @param busiAmpliRealDto + * @return + */ + List findShockRealDetailsByCondition(Page page, @Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 通过条件查询振动实时数据信息 + * + * @param busiAmpliRealDto + * @return + */ + List findShockRealChartByInfo(@Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 根据条件查询振动实时数据三维图信息 + * + * @param busiAmpliRealDto + * @return + */ + List findAmpliRealThreeChart(@Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 加载振动实时数据详细信息明细三级界面 + * + * @param page + * @param busiAmpliRealDto + * @return + */ + List findShockRealDetailsPages(Page page, @Param("bean") BusiAmpliRealDto busiAmpliRealDto); + + /** + * 导出震动实时数据(三级界面)详细信息列表 + * + * @param page + * @param dto + * @return + */ + List exportShockRealDetails(Page page, @Param("bean") BusiAmpliRealDto dto); + + /** + * @return + */ + List selectMainDeviceList(); + + /** + * @param mainId + * @return + */ + List selectShockRealFrequencyByMainId(String mainId); + + /** + * 得到今天的实时数据 + * + * @param dto + * @return + */ + List getTodayAmpliReal(@Param("bean") BusiAmpliRealDto dto); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliStatisticsMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliStatisticsMapper.java new file mode 100644 index 0000000..6b6f7bf --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliStatisticsMapper.java @@ -0,0 +1,28 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.entity.model.BusiAmpliStatistics; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author carrey + * @create 2020-07-07 1:29 PM + **/ +@Mapper +public interface BusiAmpliStatisticsMapper extends BaseMapper { + + List selectMainDeviceList(); + + /** + * 通过主变ID和日期查询震动实时数据明细信息 + * + * @param busiAmpliRealDto + * @return 中心点实时数据信息 + */ + List findAmpliStatisticsByMainIdAndCreateTime(@Param("bean") BusiAmpliRealDto busiAmpliRealDto); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAmpliThresholdConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiAmpliThresholdConfMapper.java new file mode 100644 index 0000000..004567c --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAmpliThresholdConfMapper.java @@ -0,0 +1,75 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiAmpliThresholdConfDto; +import com.chenxuan.entity.model.BusiAmpliThresholdConf; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * @ClassName:BusiAmpliThresholdConfMapper + * @Description: 振动装置阈值配置Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 16:13 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiAmpliThresholdConfMapper extends BaseMapper { + + /** + * @Description: 分页 + * @Param page + * @Param params + * @Return: 振动装置阈值配置集合信息 + **/ + List selectPages(Page page, @Param("params") BusiAmpliThresholdConfDto dto); + + /** + * 保存振动装置阈值配置信息 + * + * @param busiAmpliThresholdConfList + * @return + */ + int saveThresholdConf(List busiAmpliThresholdConfList); + + /** + * 更新振动装置阈值配置信息 + * + * @param busiAmpliThresholdConfList + * @return + */ + int updateThresholdConf(List busiAmpliThresholdConfList); + + /** + * 通过主变ID查询振动装置阈值配置信息 + * + * @param mainId 主变ID + * @return 振动装置阈值配置信息 + */ + List findThresholdConfByMainId(String mainId); + + /** + * 根据主变信息查询增长率及偏差率 + * + * @param dto + * @return + */ + List getCurrentData(@Param("bean") BusiAmpliRealDto dto); + + /** + * 通过id删除阈值配置信息 + * + * @param id 振动装置阈值配置ID + * @return 结果 + */ + int delete(String id); + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiAssessParameterMapper.java b/src/main/java/com/chenxuan/mapper/BusiAssessParameterMapper.java new file mode 100644 index 0000000..2767fb6 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiAssessParameterMapper.java @@ -0,0 +1,19 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiAssessParameter; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface BusiAssessParameterMapper extends BaseMapper { + + /** + * 批量插入数据 + * + * @param parameters + * @return + */ + int saveAssessParameter(List parameters); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCalcParamConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiCalcParamConfMapper.java new file mode 100644 index 0000000..a8ff9b3 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCalcParamConfMapper.java @@ -0,0 +1,73 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.dto.BusiCalcParamConfDto; +import com.chenxuan.entity.model.BusiCalcParamConf; +import com.chenxuan.entity.vo.BusiCalcParamConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author xuan + * @create 2020-06-28 8:38 PM + **/ +@Mapper +public interface BusiCalcParamConfMapper extends BaseMapper { + + /** + * 批量新增评估参数 + * + * @param calcParamConfs + * @return + */ + int saveCalcParamConf(List calcParamConfs); + + /** + * 删除主变关联信息 + * + * @param mainId + * @return + */ + int deleteByMainId(String mainId); + + /** + * 查询模板表数据 + * + * @return + */ + List selectPages(); + + /** + * 获取一级设备分析参数列表 + * + * @param mainId + * @return + */ + List findFirstLevelParams(@Param("mainId") String mainId); + + /** + * 获取分析参数的子分类列表 + * + * @param mainId + * @param pname + * @return + */ + List findSubParams(@Param("mainId") String mainId, @Param("pname") String pname); + + /** + * 批量修改 + * + * @param busiCalcParamConfDtos + */ + int batchUpdateCalaParamConf(List busiCalcParamConfDtos); + + /** + * 根据主变ID查询评估参数 + * + * @param mainId + * @return + */ + List getCalcParamByMainId(String mainId); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCalcParamConfVoMapper.java b/src/main/java/com/chenxuan/mapper/BusiCalcParamConfVoMapper.java new file mode 100644 index 0000000..5485987 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCalcParamConfVoMapper.java @@ -0,0 +1,9 @@ +package com.chenxuan.mapper; + +/** + * @author Carrey Zheng + * @create 2020-06-28 9:03 PM + **/ +public interface BusiCalcParamConfVoMapper { + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCenterIncreaseMapper.java b/src/main/java/com/chenxuan/mapper/BusiCenterIncreaseMapper.java new file mode 100644 index 0000000..3060bde --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCenterIncreaseMapper.java @@ -0,0 +1,14 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiCenterIncrease; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author xuan + * @create 2020-07-09 6:13 PM + **/ +@Mapper +public interface BusiCenterIncreaseMapper extends BaseMapper { + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCenterRealMapper.java b/src/main/java/com/chenxuan/mapper/BusiCenterRealMapper.java new file mode 100644 index 0000000..d29e867 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCenterRealMapper.java @@ -0,0 +1,81 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.model.BusiCenterReal; +import com.chenxuan.entity.model.ExportData; +import com.chenxuan.entity.vo.BusiCenterRealDetailsVo; +import com.chenxuan.entity.vo.BusiCenterRealVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * @ClassName:BusiCenterRealMapper + * @Description: 中心点实时数据信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:55 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiCenterRealMapper extends BaseMapper { + + /** + * 保存中心点实时数据信息 + * + * @param busiCenterRealList 中心点实时数据对象 + * @return 结果 + */ + int saveCenterReal(List busiCenterRealList); + + /** + * 通过主变ID查询中心点实时数据信息 + * + * @param mainId + * @return + */ + List findCenterRealByMainId(String mainId, String insTime); + + /** + * 通过条件查询中心点实时数据信息 + * + * @param busiCenterRealDto + * @return + */ + List findCenterRealChartByInfo(@Param("bean") BusiCenterRealDto busiCenterRealDto); + + /** + * 通过主变ID和日期查询中心点实时数据信息 + * + * @param busiCenterRealVo + * @return + */ + List findCenterRealByMainIdAndCreateTime(@Param("bean") BusiCenterRealVo busiCenterRealVo); + + /** + * 通过主变ID查询中心点实时数据详细信息 + * + * @param page + * @param dto + * @return + */ + List findCenterRealDetailsByMainId(Page page, @Param("bean") BusiCenterRealDto dto); + + /** + * 导出中心点实时数据详细信息列表 + * + * @param page + * @param dto + * @return + */ + List exportCenterRealDetails(Page page, @Param("bean") BusiCenterRealDto dto); + + /** + * @return + */ + List selectMainDeviceList(); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCenterRealStatisticsMapper.java b/src/main/java/com/chenxuan/mapper/BusiCenterRealStatisticsMapper.java new file mode 100644 index 0000000..0e72a8b --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCenterRealStatisticsMapper.java @@ -0,0 +1,16 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiCenterRealStatistics; +import org.apache.ibatis.annotations.Mapper; +import java.util.List; + +/** + * @author xuan + * @create 2020-07-07 1:26 PM + **/ +@Mapper +public interface BusiCenterRealStatisticsMapper extends BaseMapper { + + List selectMainDeviceList(); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCenterThresholdConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiCenterThresholdConfMapper.java new file mode 100644 index 0000000..d8c807f --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCenterThresholdConfMapper.java @@ -0,0 +1,84 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiCenterThresholdConfDto; +import com.chenxuan.entity.model.BusiCenterThresholdConf; +import com.chenxuan.entity.vo.BusiCenterThresholdConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * @ClassName:BusiCenterThresholdConfMapper + * @Description: 中心点电流阈值配置Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:12 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiCenterThresholdConfMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 中心点电流阈值配置集合信息 + **/ + List selectPages(Page page, @Param("params") BusiCenterThresholdConfDto dto); + + /** + * 保存中心点电流阈值配置信息 + * + * @param busicenterthresholdconf + * @return + */ + int saveThresholdConf(BusiCenterThresholdConf busicenterthresholdconf); + + /** + * 更新中心点电流阈值配置信息 + * + * @param busicenterthresholdconf + * @return + */ + int updateThresholdConf(BusiCenterThresholdConf busicenterthresholdconf); + + /** + * 通过主变ID查询中心点电流阈值配置信息 + * + * @param mainId 主变ID + * @return 中心点电流阈值配置信息 + */ + public BusiCenterThresholdConfVo findThresholdConfByMainId(String mainId); + + /** + * 通过主变ID删除对应的中心点电流阈值配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteThresholdConfByMainId(String mainId); + + /** + * 通过主变ID删除对应的中心点电流阈值配置关系 + * + * @param mainId + * @return + */ + int deleteThresholdConfRelation(String mainId); + + /** + * 通过id删除中心点电流阈值配置信息 + * + * @param id 中心点电流阈值配置ID + * @return 结果 + */ + int delete(String id); + + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiCommunicationParametersMapper.java b/src/main/java/com/chenxuan/mapper/BusiCommunicationParametersMapper.java new file mode 100644 index 0000000..0b93c91 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiCommunicationParametersMapper.java @@ -0,0 +1,70 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.BusiCommunicationParameters; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiCommunicationParametersMapper + * @Description: 通信参数设置Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/20/2020 16:00 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiCommunicationParametersMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 配置集合信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存通信参数信息 + * @param busiCommunicationParameters 通信参数对象 + * @return 结果 + */ + int saveBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters); + + /** + * 更新通信参数信息 + * @param busiCommunicationParameters 通信参数对象 + * @return 结果 + */ + int updateBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters); + + /** + * 通过通信参数ID查询通信参数信息 + * + * @param id 通信参数ID + * @return 通信参数信息 + */ + public BusiCommunicationParameters findBusiCommunicationParametersById(String id); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + int deleteConfById(Long id); + + /** + * 通过通信参数ID查询通信参数信息 + * + * @param protocol 通信协议类型 + * @return 通信参数信息 + */ + public List findBusiCommunicationParametersByProtocol(String protocol); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiControlConfigMapper.java b/src/main/java/com/chenxuan/mapper/BusiControlConfigMapper.java new file mode 100644 index 0000000..1f57c99 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiControlConfigMapper.java @@ -0,0 +1,82 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.BusiControlConfig; +import com.chenxuan.entity.vo.BusiControlConfigVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiControlConfigMapper + * @Description: 控制参数配置 Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/6/2020 15:20 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiControlConfigMapper extends BaseMapper { + + /** + * @Description: 分页 + * @Param page + * @Param params + * @Return: 配置集合信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存配置信息 + * + * @param busiControlConfigList 配置集合 + * @return 结果 + */ + int saveControlConfigs(List busiControlConfigList); + + /** + * 更新配置信息 + * + * @param busiControlConfigList 配置集合 + * @return 结果 + */ + int updateControlConfigs(List busiControlConfigList); + + /** + * 通过主变ID查询控制参数配置信息 + * + * @param mainId 主变ID + * @return 配置集合信息 + */ + List selectConfigByMainId(String mainId); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + int deleteConfById(String id); + + /** + * 根据主变id删除该主变下对应的控制参数配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteConfsByMainId(String mainId); + + /** + * 根据主变id和相位查询控制参数 + * + * @param mainId + * @param phase + * @return + */ + List getControlConfig(String mainId, String phase); + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiDeviceCalibrationMapper.java b/src/main/java/com/chenxuan/mapper/BusiDeviceCalibrationMapper.java new file mode 100644 index 0000000..8bee458 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiDeviceCalibrationMapper.java @@ -0,0 +1,19 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiDeviceCalibration; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +@Mapper +public interface BusiDeviceCalibrationMapper extends BaseMapper { + + /** + * 根据主变id查询信息 + * + * @param mainId + * @return + */ + BusiDeviceCalibration selectByMainId(@Param("mainId") String mainId); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiFrequencyConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiFrequencyConfMapper.java new file mode 100644 index 0000000..1e19682 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiFrequencyConfMapper.java @@ -0,0 +1,87 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.BusiFrequencyConf; +import com.chenxuan.entity.vo.BusiFrequencyConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiFrequencyConfMapper + * @Description: 振动装置-频率配置信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/9/2020 10:32 AM + * @Version V1.0 + */ + +@Mapper +public interface BusiFrequencyConfMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 配置集合信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存振动装置频率配置信息 + * @param busiFrequencyConf 振动装置频率配置对象 + * @return 结果 + */ + int saveFrequencyConf(BusiFrequencyConf busiFrequencyConf); + + /** + * 根据状态查询所有值 + * + * @param params + * @return + */ + List selectConfs(@Param("params") Map params); + + /** + * 更新振动装置频率配置信息 + * @param busiFrequencyConf 振动装置频率配置对象 + * @return 结果 + */ + int updateFrequencyConf(BusiFrequencyConf busiFrequencyConf); + + /** + * 根据频率查询信息 + * + * @param frequency + * @return + */ + BusiFrequencyConfVo selectFrequencyConf(@Param("frequency") String frequency); + + /** + * 通过振动装置频率配置ID查询振动装置频率配置信息 + * + * @param id 振动装置频率配置ID + * @return 振动装置频率配置信息 + */ + BusiFrequencyConf findFrequencyConfById(String id); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + int deleteConfById(Long id); + + /** + * 查询所有频率集合 + * @return + */ + List selectFrequency(); + + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiIedparamMapper.java b/src/main/java/com/chenxuan/mapper/BusiIedparamMapper.java new file mode 100644 index 0000000..b638199 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiIedparamMapper.java @@ -0,0 +1,13 @@ +package com.chenxuan.mapper; + +import com.chenxuan.entity.vo.BusiIedparamVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BusiIedparamMapper { + + List quereyIcdById(@Param("nodeId") String nodeId); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiMainDeviceMapper.java b/src/main/java/com/chenxuan/mapper/BusiMainDeviceMapper.java new file mode 100644 index 0000000..a09a185 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiMainDeviceMapper.java @@ -0,0 +1,94 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiMainDeviceDto; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiMainDeviceMapper + * @Description: 主变信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/3/2020 16:44 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiMainDeviceMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 配置集合信息 + **/ + List selectPages(Page page, @Param("params") BusiMainDeviceDto busiMainDeviceDto); + + /** + * 变压器信息列表 + * + * @param params + * @return + */ + List selectList(@Param("params") Map params); + + /** + * 保存主变信息 + * @param busiMainDevice 主变对象 + * @return 结果 + */ + int saveMainDevice(BusiMainDevice busiMainDevice); + + /** + * 更新主变信息 + * @param busiMainDevice 主变对象 + * @return 结果 + */ + int updateMainDevice(BusiMainDevice busiMainDevice); + + /** + * 通过主变ID查询主变信息 + * + * @param id 主变ID + * @return 主变信息 + */ + BusiMainDevice findMainDeviceById(String id); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + int deleteConfById(Long id); + + /** + * 根据设备名称和设备型号以及出厂商查询数量 + * + * @param busiMainDevice + * @return + */ + int getMainDeviceCount(BusiMainDevice busiMainDevice); + + /** + * 查询状态为正常并且投运日期最新的主变信息 + * + * @return 主变信息 + */ + BusiMainDevice findLatestMainDeviceByCondition(); + + /** + * 查询所有正常的主变 + * + * @return + */ + List getAllMainDevice(); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiNoiseIncreaseMapper.java b/src/main/java/com/chenxuan/mapper/BusiNoiseIncreaseMapper.java new file mode 100644 index 0000000..6f2ee23 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiNoiseIncreaseMapper.java @@ -0,0 +1,14 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiNoiseIncrease; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author Carrey Zheng + * @create 2020-07-09 7:02 PM + **/ +@Mapper +public interface BusiNoiseIncreaseMapper extends BaseMapper { + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiNoiseRealMapper.java b/src/main/java/com/chenxuan/mapper/BusiNoiseRealMapper.java new file mode 100644 index 0000000..6f7f2bc --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiNoiseRealMapper.java @@ -0,0 +1,76 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.BusiNoiseReal; +import com.chenxuan.entity.model.ExportData; +import com.chenxuan.entity.vo.BusiNoiseRealDetailsVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName:BusiNoiseRealMapper + * @Description: 噪声实时数据信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:55 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiNoiseRealMapper extends BaseMapper { + + /** + * 保存噪声实时数据信息 + * + * @param busiNoiseRealList 噪声实时数据对象 + * @return 结果 + */ + int saveNoiseReal(List busiNoiseRealList); + + /** + * 通过主变ID查询噪声实时数据信息 + * + * @param mainId + * @return + */ + List findNoiseRealByMainId(String mainId, String insTime); + + /** + * 通过主变ID和日期查询噪声实时数据信息 + * + * @param busiNoiseRealDto + * @return + */ + List findNoiseRealByMainIdAndCreateTime(@Param("bean") BusiNoiseRealDto busiNoiseRealDto); + + /** + * 通过条件查询中心点实时数据信息 + * + * @param busiNoiseRealDto + * @return + */ + List findNoiseRealChartByInfo(@Param("bean") BusiNoiseRealDto busiNoiseRealDto); + + /** + * 通过主变ID查询噪声实时数据详细信息 + * + * @param page + * @param dto + * @return + */ + List findNoiseRealDetailsByMainId(Page page, @Param("bean") BusiNoiseRealDto dto); + + /** + * 导出噪声实时数据详细信息列表 + * + * @param page + * @param dto + * @return + */ + List exportNoiseRealDetails(Page page, @Param("bean") BusiNoiseRealDto dto); + + List selectMainDeviceList(); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiNoiseRealStatisticsMapper.java b/src/main/java/com/chenxuan/mapper/BusiNoiseRealStatisticsMapper.java new file mode 100644 index 0000000..493a7cd --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiNoiseRealStatisticsMapper.java @@ -0,0 +1,16 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiNoiseRealStatistics; +import org.apache.ibatis.annotations.Mapper; +import java.util.List; + +/** + * @author xuan + * @create 2020-07-07 1:27 PM + **/ +@Mapper +public interface BusiNoiseRealStatisticsMapper extends BaseMapper { + + List selectMainDeviceList(); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiNoiseThresholdConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiNoiseThresholdConfMapper.java new file mode 100644 index 0000000..a12afad --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiNoiseThresholdConfMapper.java @@ -0,0 +1,82 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiNoiseThresholdConfDto; +import com.chenxuan.entity.model.BusiNoiseThresholdConf; +import com.chenxuan.entity.vo.BusiNoiseThresholdConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + +/** + * @ClassName:BusiNoiseThresholdConfMapper + * @Description: 噪声装置阈值配置Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:53 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiNoiseThresholdConfMapper extends BaseMapper { + + /** + * @Description: 分页 + * @Param page + * @Param params + * @Return: 噪声装置阈值配置集合信息 + **/ + List selectPages(Page page, @Param("params") BusiNoiseThresholdConfDto dto); + + /** + * 保存噪声装置阈值配置信息 + * + * @param thresholdConf + * @return + */ + int saveThresholdConf(BusiNoiseThresholdConf thresholdConf); + + /** + * 更新噪声装置阈值配置信息 + * + * @param busiNoiseThresholdConf + * @return + */ + int updateThresholdConf(BusiNoiseThresholdConf busiNoiseThresholdConf); + + /** + * 通过主变ID查询噪声装置阈值配置信息 + * + * @param mainId 主变ID + * @return 噪声装置阈值配置信息 + */ + BusiNoiseThresholdConfVo findThresholdConfByMainId(String mainId); + + /** + * 通过主变ID删除对应的噪声装置阈值配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteThresholdConfByMainId(String mainId); + + /** + * 通过主变ID删除对应的噪声装置阈值配置关系 + * + * @param mainId + * @return + */ + int delThresholdConfRelation(String mainId); + + /** + * 通过id删除噪声装置阈值配置信息 + * + * @param id 噪声装置阈值配置ID + * @return 结果 + */ + int delete(String id); + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiParamBindMapper.java b/src/main/java/com/chenxuan/mapper/BusiParamBindMapper.java new file mode 100644 index 0000000..b7ad875 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiParamBindMapper.java @@ -0,0 +1,21 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiParamBindDto; +import com.chenxuan.entity.model.BusiParamBind; +import com.chenxuan.entity.vo.BusiParamBindVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author buck_guo + */ +@Mapper +public interface BusiParamBindMapper extends BaseMapper { + int addParamBind(BusiParamBind BusiParamBind); + List queryParamBind(Page page, @Param("params") BusiParamBindDto dto); + public int delParamBind(int[] ids); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiSubDeviceMapper.java b/src/main/java/com/chenxuan/mapper/BusiSubDeviceMapper.java new file mode 100644 index 0000000..9db2dd0 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiSubDeviceMapper.java @@ -0,0 +1,118 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiSubDevice; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiSubDeviceMapper + * @Description: 主变装置信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/4/2020 15:44 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiSubDeviceMapper extends BaseMapper { + + /** + * @Description: 分页 + * @Param page + * @Param params + * @Return: 主变装置集合信息 + **/ + List selectPages(Page page, @Param("params") BusiSubDeviceDto dto); + + /** + * 主变装置集合信息 + * @return + */ + List queryAll(); + + /** + * 保存主变装置信息 + * + * @param busiSubDevice + * @return + */ + int saveSubDevice(BusiSubDevice busiSubDevice); + + /** + * 更新主变装置信息 + * + * @param busiSubDevice + * @return + */ + int updateSubDevice(BusiSubDevice busiSubDevice); + + /** + * 通过主变ID查询主变装置信息 + * + * @param id + * @return + */ + List findSubDeviceByMainId(String id); + + /** @param id + * @return + */ + BusiSubDeviceVo querySubDeviceById(String id); + + + /** + * 根据主变id和装置类型查询装置信息 + * + * @param params + * @return + */ + BusiSubDeviceVo findSubDevice(@Param("bean") Map params); + + /** + * 根绝信息查询数据量 + * + * @param subDevice + * @return + */ + int getSubDeviceCount(@Param("bean") BusiSubDevice subDevice); + + /** + * 查询是否有重复名称 + * + * @param device + * @return + */ + int getSubDeviceByName(@Param("bean") BusiSubDevice device); + + /** + * 通过主变ID删除对应的装置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteSubDeviceByMainId(String mainId); + + /** + * 通过主变ID删除对应的装置的关联关系 + * + * @param mainId + * @return + */ + int delSubDeviceRelation(String mainId); + + /** + * 通过id删除装置信息 + * + * @param id 装置ID + * @return 结果 + */ + int delete(String id); + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiTransformerConfMapper.java b/src/main/java/com/chenxuan/mapper/BusiTransformerConfMapper.java new file mode 100644 index 0000000..0aadd0e --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiTransformerConfMapper.java @@ -0,0 +1,79 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.BusiTransformerConf; +import com.chenxuan.entity.vo.BusiTransformerConfVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiTransformerConfMapper + * @Description: 原副边电流电压实时数据配置 Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/2/2020 16:54 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiTransformerConfMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 配置集合信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存配置信息 + * @param + */ + int saveConfigs(List busiTransformerConfList); + + /** + * 更新配置信息 + * @param + * @return 结果 + */ + int updateConfigs(List busiTransformerConfList); + + /** + * 通过主变ID查询电流电压配置信息 + * + * @param mainId 主变ID + * @return 配置集合信息 + */ + public List selectConfigByMainId(String mainId); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + int deleteConfById(String id); + + /** + * 根据主变id删除该主变下对应的电流电压信息 + * + * @param mainId 主变ID + * @return 结果 + */ + int deleteConfsByMainId(String mainId); + + /** + * 根据主变id删除该主变下对应的电流电压关系 + * + * @param mainId + * @return + */ + int deleteConfsRelation(String mainId); + + + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiTransformerRealMapper.java b/src/main/java/com/chenxuan/mapper/BusiTransformerRealMapper.java new file mode 100644 index 0000000..d8300c3 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiTransformerRealMapper.java @@ -0,0 +1,55 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.BusiTransformerReal; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiTransformerRealMapper + * @Description: 原副边电流电压实时数据配置 Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/2/2020 16:54 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiTransformerRealMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 原副边电流电压实时数据信息 + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 保存原副边电流电压实时数据信息 + * @param busiTransformerReals 原副边电流电压实时数据集合 + * @return 结果 + */ + int saveTransformerReal(List busiTransformerReals); + + /** + * 通过主变ID查询原副边电流电压实时数据信息 + * + * @param mainId 主变ID + * @return 原副边电流电压实时数据集合信息 + */ + List selectTransformerRealByMainId(String mainId); + + /** + * 根据主变id删除该主变下对应的电流电压实时关系 + * + * @param mainId + * @return + */ + int delTransformerRealRelation(String mainId); + +} diff --git a/src/main/java/com/chenxuan/mapper/BusiVibrationSeparationMapper.java b/src/main/java/com/chenxuan/mapper/BusiVibrationSeparationMapper.java new file mode 100644 index 0000000..f792232 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiVibrationSeparationMapper.java @@ -0,0 +1,36 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.BusiVibrationSeparation; +import com.chenxuan.entity.vo.BusiVibrationSeparationVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BusiVibrationSeparationMapper extends BaseMapper { + + /** + * 保存振动分离数据信息 + * + * @param vibrationSeparations + * @return 结果 + */ + int saveVibrationSeparation(List vibrationSeparations); + + /** + * 查询振动分离数据 + * + * @param vibrationSeparation + */ + List findVibrationSeparation(@Param("bean") BusiVibrationSeparation vibrationSeparation); + + /** + * 获取序号 + * + * @param phase + * @return + */ + Integer getSort(@Param("phase") String phase); +} diff --git a/src/main/java/com/chenxuan/mapper/BusiWarningMapper.java b/src/main/java/com/chenxuan/mapper/BusiWarningMapper.java new file mode 100644 index 0000000..0a682ef --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/BusiWarningMapper.java @@ -0,0 +1,79 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiWarningDto; +import com.chenxuan.entity.model.BusiWarning; +import com.chenxuan.entity.vo.BusiWarningVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName:BusiWarningMapper + * @Description: 告警信息Mapper接口. + * @Author: Jordan_Li + * @CreatTime:6/18/2020 15:44 PM + * @Version V1.0 + */ + +@Mapper +public interface BusiWarningMapper extends BaseMapper { + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: 告警集合信息 + **/ + List selectPages(@Param("bean") BusiWarningDto dto); + + /** + * 查询ied报警信息 + * + * @param dto + * @return + */ + List selectPageByWarnType(Page page, @Param("bean") BusiWarningDto dto); + + /** + * 根据告警类型查询装置告警信息 + * + * @param page + * @param dto + * @return + */ + List getDetails(Page page, @Param("bean") BusiWarningDto dto); + + /** + * 保存告警信息 + * @param busiWarning 告警对象 + * @return 结果 + */ + int saveWarning(BusiWarning busiWarning); + + /** + * 查询当前装置的告警次数 + * + * @param subId + * @return + */ + int getNumberAlarm(@Param("subId") String subId); + + /** + * 更新告警信息 + * @param busiWarning 告警对象 + * @return 结果 + */ + int updateWarning(@Param("bean") BusiWarning busiWarning); + + /** + * 更新告警信息根据告警类型批量修改 + * + * @param busiWarning + * @return + */ + int updateWarningByStatus(@Param("bean") BusiWarning busiWarning); +} diff --git a/src/main/java/com/chenxuan/mapper/ScheduleJobMapper.java b/src/main/java/com/chenxuan/mapper/ScheduleJobMapper.java new file mode 100644 index 0000000..c4379b1 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/ScheduleJobMapper.java @@ -0,0 +1,69 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.ScheduleJobDto; +import com.chenxuan.entity.model.ScheduleJob; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:ScheduleJobMapper + * @Description: 定时任务数据层 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 9:00 PM + * @Version V1.0 + */ + +@Mapper +public interface ScheduleJobMapper extends BaseMapper { + + /** + * 更新定时任务状态 + * + * @param status 任务状态 + */ + void updateStatus(@Param("status") String status); + + /** + * 定时任务分页 + * + * @param page + * @param dto + * @return + */ + List selectPages(Page page, @Param("params") ScheduleJobDto dto); + + /** + * 定时任务列表 + * + * @param params 查询参数 + */ + List selectLists(@Param("params") Map params); + + /** + * 根据任务名称查询名称是否重复 + * + * @param beanName + * @return + */ + int selectJobCount(@Param("beanName") String beanName); + + /** + * 获取检验报告字典表中的检验时间 + * + * @return + */ + Long getCheckReportDays(); + + /** + * 根据用户ID获取用户名称 + * + * @param userId + * @return + */ + String getUserNameById(@Param("userId") Long userId); +} diff --git a/src/main/java/com/chenxuan/mapper/SysConfigMapper.java b/src/main/java/com/chenxuan/mapper/SysConfigMapper.java new file mode 100644 index 0000000..201c092 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysConfigMapper.java @@ -0,0 +1,64 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysConfig; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 参数配置表 Mapper 接口 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Mapper +public interface SysConfigMapper extends BaseMapper { + + /** + * 查询参数配置信息 + * + * @param config 参数配置信息 + * @return 参数配置信息 + */ + SysConfig selectConfig(SysConfig config); + + /** + * 查询参数配置列表 + * + * @param params 参数配置信息 + * @return 参数配置集合 + */ + List selectConfigList(Page page ,@Param("params") Map params); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数配置信息 + */ + SysConfig checkConfigKeyUnique(String configKey); + + + /** + * 删除参数配置 + * + * @param configId 参数ID + * @return 结果 + */ + int deleteConfigById(Long configId); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + int deleteConfigByIds(Long[] configIds); +} diff --git a/src/main/java/com/chenxuan/mapper/SysDeptMapper.java b/src/main/java/com/chenxuan/mapper/SysDeptMapper.java new file mode 100644 index 0000000..03ce362 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysDeptMapper.java @@ -0,0 +1,112 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.entity.model.SysUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 部门表 Mapper 接口 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Mapper +public interface SysDeptMapper extends BaseMapper { + /** + * 查询部门管理数据 + * + * @param + * @return 部门信息集合 + */ + public List selectDeptList(); + + + /** + * @Description: 查询部门管理数据 + * + * @Param params + * @return 部门信息集合 + **/ + List selectDeptLists(@Param("params") Map params); + + + /** + * 校验部门名称是否唯一 + * + * @param deptName 部门名称 + * @param parentId 父部门ID + * @return 结果 + */ + public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + + + /** + * 根据ID查询所有子部门 + * + * @param deptId 部门ID + * @return 部门列表 + */ + public List selectChildrenDeptById(Long deptId); + + + /** + * 修改子元素关系 + * + * @param depts 子元素 + * @return 结果 + */ + public int updateDeptChildren(@Param("depts") List depts); + + + /** + * 修改所在部门的父级部门状态 + * + * @param dept 部门 + */ + public void updateDeptStatus(SysDept dept); + + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 + */ + public int checkDeptExistUser(Long deptId); + + /** + * 是否存在子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public int hasChildByDeptId(Long deptId); + + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(Long roleId); + + +} diff --git a/src/main/java/com/chenxuan/mapper/SysDictDataMapper.java b/src/main/java/com/chenxuan/mapper/SysDictDataMapper.java new file mode 100644 index 0000000..90463dd --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysDictDataMapper.java @@ -0,0 +1,86 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysDictData; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:SysDictDataMapper + * @Description: 字典数据表 Mapper 接口 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 4:56 PM + * @Version V1.0 + */ + +@Mapper +public interface SysDictDataMapper extends BaseMapper { + + /** + * @Description: 根据字典类型查询字典数据 + * @Param: dictType + * @Return: java.util.List + **/ + List selectDictDataByType(@Param("dictType") String dictType); + + + /** + * 根据条件分页查询字典数据 + * + * @param params 字典数据信息 + * @return 字典数据集合信息 + */ + List selectDictDataPage(Page page, @Param("params") Map params); + + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue); + + + /** + * 查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据 + */ + int countDictDataByType(String dictType); + + /** + * 通过字典ID删除字典数据信息 + * + * @param dictCode 字典数据ID + * @return 结果 + */ + int deleteDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + int deleteDictDataByIds(Long[] dictCodes); + + + /** + * 同步修改字典类型 + * + * @param oldDictType 旧字典类型 + * @param newDictType 新旧字典类型 + * @return 结果 + */ + int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType); + +} diff --git a/src/main/java/com/chenxuan/mapper/SysDictTypeMapper.java b/src/main/java/com/chenxuan/mapper/SysDictTypeMapper.java new file mode 100644 index 0000000..265b1c1 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysDictTypeMapper.java @@ -0,0 +1,73 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysDictType; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 字典类型表 Mapper 接口 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Mapper +public interface SysDictTypeMapper extends BaseMapper { + + /** + * 根据条件分页查询字典类型 + * + * @param params 字典类型信息 + * @return 字典类型集合信息 + */ + List selectDictTypePage(Page page, @Param("params") Map params); + + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + List selectDictTypeAll(); + + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + SysDictType selectDictTypeByType(@Param("dictType")String dictType); + + /** + * 通过字典ID删除字典信息 + * + * @param dictId 字典ID + * @return 结果 + */ + int deleteDictTypeById(Long dictId); + + /** + * 批量删除字典类型信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + int deleteDictTypeByIds(Long[] dictIds); + + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + SysDictType checkDictTypeUnique(@Param("dictType")String dictType); +} diff --git a/src/main/java/com/chenxuan/mapper/SysLoginLogMapper.java b/src/main/java/com/chenxuan/mapper/SysLoginLogMapper.java new file mode 100644 index 0000000..8b21268 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysLoginLogMapper.java @@ -0,0 +1,55 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.SysLoginLogDto; +import com.chenxuan.entity.model.SysLoginLog; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface SysLoginLogMapper extends BaseMapper { + + + /** + * 查询系统登录日志集合 + * + * @param params 访问日志对象 + * @return 登录记录集合 + */ + List selectLoginLogPage(Page page, @Param("params") Map params); + + /** + * 查询系统登录日志集合 + * + * @param dto 访问日志对象 + * @return 登录记录集合 + */ + List exportLoginLog(Page page, @Param("params") SysLoginLogDto dto); + + /** + * 查询系统登录日志集合 + * + * @param params 访问日志对象 + * @return 登录记录集合 + */ + List selectLoginLogList(@Param("params") Map params); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return 结果 + */ + int deleteLoginLogByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + * + * @return 结果 + */ + int cleanLoginLog(); +} diff --git a/src/main/java/com/chenxuan/mapper/SysMenuMapper.java b/src/main/java/com/chenxuan/mapper/SysMenuMapper.java new file mode 100644 index 0000000..b4661fa --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysMenuMapper.java @@ -0,0 +1,94 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.entity.model.SysMenu; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; +import java.util.Set; + + +/** + * @ClassName:SysMenuMapper + * @Description: 菜单权限表 Mapper 接口 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:08 PM + * @Version V1.0 + */ + +@Mapper +public interface SysMenuMapper extends BaseMapper { + + /** + * 查询部门管理数据 + * + * @param + * @return 部门信息集合 + */ + public List selectMenuList(); + + + /** + * @Description: 查询部门管理数据 + * + * @Param params + * @return 部门信息集合 + **/ + List selectMenuLists(@Param("params") Map params); + + /** + * @Description 根据用户ID查询权限 + * + * @Param userId + * @Return java.util.Set + */ + public Set selectMenuPermsByUserId(Long userId); + + + /** + * @Description: 根据用户ID查询菜单 + * @Param: + * @Return: java.util.List --菜单列表 + **/ + public List selectMenuTreeAll(); + + + /** + * @Description: 根据用户ID查询菜单 + * + * @param userId 用户ID + * @Return: java.util.List --菜单列表 + **/ + public List selectMenuTreeByUserId(@Param("userId") Long userId); + + /** + * 校验菜单名称是否唯一 + * + * @param menuName 菜单名称 + * @param parentId 父菜单ID + * @return 结果 + */ + public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId); + + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int hasChildByMenuId(Long menuId); + + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(Long roleId); +} diff --git a/src/main/java/com/chenxuan/mapper/SysOperLogMapper.java b/src/main/java/com/chenxuan/mapper/SysOperLogMapper.java new file mode 100644 index 0000000..13ffba8 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysOperLogMapper.java @@ -0,0 +1,63 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.SysOperLogDto; +import com.chenxuan.entity.model.SysOperLog; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:SysOperLogMapper + * @Description: 操作日志 数据层 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 11:19 AM + * @Version V1.0 + */ + +@Mapper +public interface SysOperLogMapper extends BaseMapper { + + + /** + * 查询系统操作日志集合 + * + * @param params 操作日志对象 + * @return 操作日志集合 + */ + List selectOperLogPage(Page page, @Param( "params" ) Map params); + + /** + * 导出系统操作日志集合 + * + * @param dto 操作日志对象 + * @return 操作日志集合 + */ + List exportOperLog(Page page, @Param( "params" )SysOperLogDto dto); + + /** + * 查询系统操作日志集合 + * + * @param params 操作日志对象 + * @return 操作日志集合 + */ + List selectOperLogList(@Param( "params" ) Map params); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + int deleteOperLogByIds(Long[] operIds); + + + + /** + * 清空操作日志 + */ + void cleanOperLog(); +} diff --git a/src/main/java/com/chenxuan/mapper/SysPostMapper.java b/src/main/java/com/chenxuan/mapper/SysPostMapper.java new file mode 100644 index 0000000..55759ec --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysPostMapper.java @@ -0,0 +1,68 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysPost; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 岗位信息表 Mapper 接口 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Mapper +public interface SysPostMapper extends BaseMapper { + + + /** + * @Description: 分页 + * @param page + * @param params + * @Return: java.util.List + **/ + List selectPages( Page page, @Param("params") Map params); + + + /** + * 校验岗位名称 + * + * @param postName 岗位名称 + * @return 结果 + */ + SysPost checkPostNameUnique(@Param("postName") String postName); + + + /** + * 校验岗位编码 + * + * @param postCode 岗位编码 + * @return 结果 + */ + SysPost checkPostCodeUnique(@Param("postCode") String postCode); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + public List selectPostsByUserName(String userName); + +} diff --git a/src/main/java/com/chenxuan/mapper/SysRoleDeptMapper.java b/src/main/java/com/chenxuan/mapper/SysRoleDeptMapper.java new file mode 100644 index 0000000..85bb29b --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysRoleDeptMapper.java @@ -0,0 +1,50 @@ +package com.chenxuan.mapper; + + +import com.chenxuan.entity.model.SysRoleDept; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @ClassName:SysRoleDeptMapper + * @Description: 角色与部门关联表 数据层 + * @Author: Arno_Fu + * @CreatTime:12/3/2019 - 11:00 PM + * @Version V1.0 + */ +@Mapper +public interface SysRoleDeptMapper +{ + /** + * 通过角色ID删除角色和部门关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleDeptByRoleId(Long roleId); + + /** + * 批量删除角色部门关联信息 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteRoleDept(Long[] ids); + + /** + * 查询部门使用数量 + * + * @param deptId 部门ID + * @return 结果 + */ + public int selectCountRoleDeptByDeptId(Long deptId); + + /** + * 批量新增角色部门信息 + * + * @param roleDeptList 角色部门列表 + * @return 结果 + */ + public int batchRoleDept(List roleDeptList); +} diff --git a/src/main/java/com/chenxuan/mapper/SysRoleMapper.java b/src/main/java/com/chenxuan/mapper/SysRoleMapper.java new file mode 100644 index 0000000..d0b27a3 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysRoleMapper.java @@ -0,0 +1,99 @@ +package com.chenxuan.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.SysRoleDto; +import com.chenxuan.entity.model.SysRole; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 角色信息表 Mapper 接口 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Mapper +public interface SysRoleMapper extends BaseMapper { + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return 角色列表 + */ + List selectRolePermissionByUserId(@Param( "userId" ) Long userId); + + /** + * 校验角色名称是否唯一 + * + * @param roleName 角色名称 + * @return 角色信息 + */ + SysRole checkRoleNameUnique(String roleName); + + /** + * 校验角色权限是否唯一 + * + * @param roleKey 角色权限 + * @return 角色信息 + */ + SysRole checkRoleKeyUnique(String roleKey); + + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + List selectRoleAll(); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + int deleteRoleByIds(Long[] roleIds); + + /** + * 分页 + * + * @param + * @return 结果 + */ + List selectPages(@Param("page") Page page, @Param("params") Map params); + + /** + * 导出数据 + * + * @param + * @return 结果 + */ + List exportSysRole(@Param("page") Page page, @Param("params") SysRoleDto dto); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + List selectRoleListByUserId(Long userId); + + + /** + * 根据用户ID查询角色 + * + * @param userName 用户名 + * @return 角色列表 + */ + List selectRolesByUserName(String userName); + + +} diff --git a/src/main/java/com/chenxuan/mapper/SysRoleMenuMapper.java b/src/main/java/com/chenxuan/mapper/SysRoleMenuMapper.java new file mode 100644 index 0000000..bdc5e3a --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysRoleMenuMapper.java @@ -0,0 +1,44 @@ +package com.chenxuan.mapper; + + +import com.chenxuan.entity.model.SysRoleMenu; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + + +/** + * @ClassName:SysRoleMenuMapper + * @Description: 角色与菜单关联表 数据层 + * @Author: Arno_Fu + * @CreatTime:11/30/2019 - 11:15 AM + * @Version V1.0 + */ +@Mapper +public interface SysRoleMenuMapper { + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistRole(Long menuId); + + /** + * 通过角色ID删除角色和菜单关联 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleMenuByRoleId(Long roleId); + + /** + * 批量新增角色菜单信息 + * + * @param roleMenuList 角色菜单列表 + * @return 结果 + */ + public int batchRoleMenu(List roleMenuList); + + +} diff --git a/src/main/java/com/chenxuan/mapper/SysUserMapper.java b/src/main/java/com/chenxuan/mapper/SysUserMapper.java new file mode 100644 index 0000000..9140870 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysUserMapper.java @@ -0,0 +1,107 @@ +package com.chenxuan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.model.SysUser; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:SysUserMapper + * @Description: 用户表 Mapper 接口. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 2:51 PM + * @Version V1.0 + */ + +@Mapper +public interface SysUserMapper extends BaseMapper { + + /** + * + * @Description 通过用户账户获取用户信息 + * @param userAccount + * @return com.chenxuan.entity.model.SysUser + */ + SysUser selectByUserAccount(@Param("userName") String userAccount); + + /** + * @Description: 分页 + * + * @Param page + * @Param params + * @Return: java.util.List + **/ + List selectPages(Page page, @Param("params") Map params); + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + int checkUserNameUnique(@Param("userName") String userName); + + /** + * 校验手机号码是否唯一 + * + * @param phone 手机号码 + * @return 结果 + */ + SysUser checkPhoneUnique(@Param("phone") String phone); + + /** + * 校验email是否唯一 + * + * @param email 用户邮箱 + * @return 结果 + */ + SysUser checkEmailUnique(@Param("email")String email); + + /** + * 通过用户名查询用户 + * + * @param userName 用户名 + * @return 用户对象信息 + */ + public SysUser selectUserByUserName(String userName); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + public SysUser selectUserById(Long userId); + + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); +} diff --git a/src/main/java/com/chenxuan/mapper/SysUserPostMapper.java b/src/main/java/com/chenxuan/mapper/SysUserPostMapper.java new file mode 100644 index 0000000..9ef279e --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysUserPostMapper.java @@ -0,0 +1,49 @@ +package com.chenxuan.mapper; + + +import com.chenxuan.entity.model.SysUserPost; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @ClassName:SysUserPostMapper + * @Description: 用户与岗位关联表 数据层 + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 5:04 PM + * @Version V1.0 + */ +@Mapper +public interface SysUserPostMapper { + /** + * 通过用户ID删除用户和岗位关联 + * + * @param userId 用户ID + * @return 结果 + */ + int deleteUserPostByUserId(Long userId); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + int countUserPostById(Long postId); + + /** + * 批量删除用户和岗位关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + int deleteUserPost(Long[] ids); + + /** + * 批量新增用户岗位信息 + * + * @param userPostList 用户角色列表 + * @return 结果 + */ + int batchUserPost(List userPostList); +} diff --git a/src/main/java/com/chenxuan/mapper/SysUserRoleMapper.java b/src/main/java/com/chenxuan/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..ecb1cc6 --- /dev/null +++ b/src/main/java/com/chenxuan/mapper/SysUserRoleMapper.java @@ -0,0 +1,70 @@ +package com.chenxuan.mapper; + + +import com.chenxuan.entity.model.SysUserRole; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + + + +/** + * @ClassName:SysUserRoleMapper + * @Description: 用户与角色关联表 数据层 + * @Author: Arno_Fu + * @CreatTime:12/3/2019 - 10:57 PM + * @Version V1.0 + */ +@Mapper +public interface SysUserRoleMapper +{ + /** + * 通过用户ID删除用户和角色关联 + * + * @param userId 用户ID + * @return 结果 + */ + public int deleteUserRoleByUserId(Long userId); + + /** + * 批量删除用户和角色关联 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteUserRole(Long[] ids); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public int countUserRoleByRoleId(Long roleId); + + /** + * 批量新增用户角色信息 + * + * @param userRoleList 用户角色列表 + * @return 结果 + */ + public int batchUserRole(List userRoleList); + + /** + * 删除用户和角色关联信息 + * + * @param userRole 用户和角色关联信息 + * @return 结果 + */ + public int deleteUserRoleInfo(SysUserRole userRole); + + /** + * 批量取消授权用户角色 + * + * @param roleId 角色ID + * @param userIds 需要删除的用户数据ID + * @return 结果 + */ + public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds); +} diff --git a/src/main/java/com/chenxuan/security/LoginUser.java b/src/main/java/com/chenxuan/security/LoginUser.java new file mode 100644 index 0000000..a7a85b5 --- /dev/null +++ b/src/main/java/com/chenxuan/security/LoginUser.java @@ -0,0 +1,210 @@ +package com.chenxuan.security; + + +import com.chenxuan.entity.model.SysUser; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import java.util.Collection; +import java.util.Set; + +/** + * @ClassName:LoginUser + * @Description: 登录用户身份权限 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 6:47 PM + * @Version V1.0 + */ + +public class LoginUser implements UserDetails { + + private static final long serialVersionUID = 1L; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 用户信息 + */ + private SysUser user; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登陆时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + + public LoginUser() + { + } + + public LoginUser(SysUser user, Set permissions) + { + this.user = user; + this.permissions = permissions; + } + + @JsonIgnore + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + return user.getUserName(); + } + + public Set getPermissions() { + return permissions; + } + + public void setPermissions(Set permissions) { + this.permissions = permissions; + } + + public SysUser getUser() { + return user; + } + + public void setUser(SysUser user) { + this.user = user; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public Long getLoginTime() { + return loginTime; + } + + public void setLoginTime(Long loginTime) { + this.loginTime = loginTime; + } + + public Long getExpireTime() { + return expireTime; + } + + public void setExpireTime(Long expireTime) { + this.expireTime = expireTime; + } + + public String getIpaddr() { + return ipaddr; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) { + this.loginLocation = loginLocation; + } + + public String getBrowser() { + return browser; + } + + public void setBrowser(String browser) { + this.browser = browser; + } + + public String getOs() { + return os; + } + + public void setOs(String os) { + this.os = os; + } + + @Override + public Collection getAuthorities() { + return null; + } + + + /** + * 账户是否过期 + * @return + */ + @JsonIgnore + @Override + public boolean isAccountNonExpired() { + return true; + } + + /** + * 是否禁用 + * @return + */ + @JsonIgnore + @Override + public boolean isAccountNonLocked() { + return true; + } + + /** + * 密码是否过期 + * @return + */ + @JsonIgnore + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + /** + * 是否启用 + * @return + */ + @JsonIgnore + @Override + public boolean isEnabled() { + return true; + } +} diff --git a/src/main/java/com/chenxuan/security/componet/CustomAuthExceptionEntryPoint.java b/src/main/java/com/chenxuan/security/componet/CustomAuthExceptionEntryPoint.java new file mode 100644 index 0000000..a85a354 --- /dev/null +++ b/src/main/java/com/chenxuan/security/componet/CustomAuthExceptionEntryPoint.java @@ -0,0 +1,46 @@ +package com.chenxuan.security.componet; + + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; + + +import org.springframework.http.HttpStatus; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + + +/** + * @ClassName:CustomAuthExceptionEntryPoint + * @Description: 无效token异常类重写. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 6:20 PM + * @Version V1.0 + */ + +@Component +public class CustomAuthExceptionEntryPoint implements AuthenticationEntryPoint +{ + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, + AuthenticationException authException) throws ServletException { + response.setStatus( HttpStatus.OK.value()); + response.setHeader("Content-Type", "application/json;charset=UTF-8"); + try { + String result = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); + String msg = JSON.toJSONString( AjaxResult.error( HttpStatusCode.UNAUTHORIZED , result ) ); + response.getWriter().write( msg ); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/chenxuan/security/componet/CustomSecurityConfig.java b/src/main/java/com/chenxuan/security/componet/CustomSecurityConfig.java new file mode 100644 index 0000000..ba30960 --- /dev/null +++ b/src/main/java/com/chenxuan/security/componet/CustomSecurityConfig.java @@ -0,0 +1,105 @@ +package com.chenxuan.security.componet; + + +import com.chenxuan.security.filter.JwtAuthenticationTokenFilter; +import com.chenxuan.security.service.CustomUserDetailsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + + +@Configuration +@EnableWebSecurity// 这个注解必须加,开启Security +@EnableGlobalMethodSecurity(prePostEnabled = true)//保证post之前的注解可以使用 +public class CustomSecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + private CustomAuthExceptionEntryPoint customAuthExceptionEntryPoint; + + @Autowired + private CustomUserDetailsService customUserDetailsService; + + @Autowired + private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + + + //先来这里认证一下 + @Autowired + public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { + auth.userDetailsService(customUserDetailsService).passwordEncoder(passwordEncoderBean()); + } + + //拦截在这配 + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + httpSecurity + // CRSF禁用,因为不使用session + .csrf().disable() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(customAuthExceptionEntryPoint).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 验证码captchaImage 允许匿名访问 + .antMatchers("/login", "/captchaImage").anonymous() + .antMatchers( + HttpMethod.GET, + "/*.html", + "/**/*.html", + "/**/*.css", + "/**/*.js" + ).permitAll() + .antMatchers("/profile/**").anonymous() + .antMatchers("/common/download**").anonymous() + .antMatchers("/swagger-ui.html").anonymous() + .antMatchers("/swagger-resources/**").anonymous() + .antMatchers("/webjars/**").anonymous() + .antMatchers("/*/api-docs").anonymous() + .antMatchers("/druid/**").anonymous() + .antMatchers("/test/**").anonymous() +// .antMatchers("/**").anonymous() + .antMatchers("/api/**").anonymous() +// .antMatchers("/busiMainDeviceController/**").anonymous() + .antMatchers("/sysLoginRemoteController/**").anonymous() +// .antMatchers("/remote/**").anonymous() + .antMatchers("/userRemote/**").anonymous() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); + + httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); + // 添加JWT filter + httpSecurity.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + } + + @Bean + public PasswordEncoder passwordEncoderBean() { + return new BCryptPasswordEncoder(); + } + + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception { + return super.authenticationManagerBean(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/security/componet/LogoutSuccessHandlerImpl.java b/src/main/java/com/chenxuan/security/componet/LogoutSuccessHandlerImpl.java new file mode 100644 index 0000000..a4e83c5 --- /dev/null +++ b/src/main/java/com/chenxuan/security/componet/LogoutSuccessHandlerImpl.java @@ -0,0 +1,51 @@ +package com.chenxuan.security.componet; + +import com.alibaba.fastjson.JSON; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.Constants; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; + +import com.chenxuan.utils.ServletUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 自定义退出处理类 返回成功 + * + * @author ruoyi + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private JwtTokenService jwtTokenService; + + /** + * 退出处理 + * + * @return + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException + { + LoginUser loginUser = jwtTokenService.getLoginUser(request); + if (null == loginUser) + { + String userName = loginUser.getUsername(); + // 记录用户退出日志 + // AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, "退出成功")); + jwtTokenService.logout(request); + } + ServletUtils.renderString(response, JSON.toJSONString( AjaxResult.error( HttpStatusCode.SUCCESS, "退出成功"))); + } +} diff --git a/src/main/java/com/chenxuan/security/filter/JwtAuthenticationTokenFilter.java b/src/main/java/com/chenxuan/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 0000000..b05a8c2 --- /dev/null +++ b/src/main/java/com/chenxuan/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,47 @@ +package com.chenxuan.security.filter; + + +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.token.TokenService; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * @ClassName:JwtAuthenticationTokenFilter + * @Description: token过滤器 验证token有效性. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 6:34 PM + * @Version V1.0 + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { + + @Autowired + private JwtTokenService jwtTokenService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { + + LoginUser loginUser = jwtTokenService.getLoginUser(request); + if (null != loginUser && null == SecurityUtils.getAuthentication()) + { + jwtTokenService.verifyToken(loginUser); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + } + chain.doFilter(request, response); + } +} diff --git a/src/main/java/com/chenxuan/security/service/CustomPermissionService.java b/src/main/java/com/chenxuan/security/service/CustomPermissionService.java new file mode 100644 index 0000000..dc6db48 --- /dev/null +++ b/src/main/java/com/chenxuan/security/service/CustomPermissionService.java @@ -0,0 +1,66 @@ +package com.chenxuan.security.service; + +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.service.SysMenuService; +import com.chenxuan.service.SysRoleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashSet; +import java.util.Set; + + +/** + * @ClassName:CustomPermissionService + * @Description: 用户权限处理. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 8:30 PM + * @Version V1.0 + */ + +@Component +public class CustomPermissionService { + + @Autowired + private SysRoleService roleService; + + @Autowired + private SysMenuService menuService; + + + /** + * 获取角色数据权限 + * + * @param user 用户信息 + * @return 角色权限信息 + */ + public Set getRolePermission(SysUser user) + { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin() || user.getStatus().equals("2")){ + roles.add("admin"); + }else{ + roles.addAll(roleService.getRolePermsByUserId(user.getUserId())); + } + return roles; + } + + /** + * 获取菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getMenuPermission(SysUser user) + { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin() || user.getStatus().equals("2")){ + roles.add("*:*:*"); + }else{ + roles.addAll(menuService.getMenuPermsByUserId(user.getUserId())); + } + return roles; + } +} diff --git a/src/main/java/com/chenxuan/security/service/CustomUserDetailsService.java b/src/main/java/com/chenxuan/security/service/CustomUserDetailsService.java new file mode 100644 index 0000000..c5f8d8c --- /dev/null +++ b/src/main/java/com/chenxuan/security/service/CustomUserDetailsService.java @@ -0,0 +1,52 @@ +package com.chenxuan.security.service; + + +import com.chenxuan.constants.UserStatus; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.exception.BaseException; +import com.chenxuan.security.LoginUser; +import com.chenxuan.service.SysUserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +/** + * @ClassName:CustomUserDetailsService + * @Description: 用户验证处理. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 5:34 PM + * @Version V1.0 + */ +@Slf4j +@Service +public class CustomUserDetailsService implements UserDetailsService { + + @Autowired + private SysUserService sysUserService; + + @Autowired + private CustomPermissionService customPermissionService; + + @Override + public UserDetails loadUserByUsername(String userAccount) throws UsernameNotFoundException { + SysUser user = sysUserService.findByUserAccount( userAccount ); + if (null == user) { + log.info( "登录用户:{} 不存在.", userAccount ); + throw new UsernameNotFoundException( "登录用户:" + userAccount + " 不存在" ); + } else if (UserStatus.DELETED.getCode().equals( user.getDelFlag() )) { + log.info( "登录用户:{} 已被删除.", userAccount ); + throw new BaseException( "对不起,您的账号:" + userAccount + " 已被删除" ); + } else if (UserStatus.DISABLE.getCode().equals( user.getStatus() )) { + log.info( "登录用户:{} 已被停用.", userAccount ); + throw new BaseException( "对不起,您的账号:" + userAccount + " 已停用" ); + } + return createLoginUser( user ); + } + + public UserDetails createLoginUser(SysUser user) { + return new LoginUser( user, customPermissionService.getMenuPermission( user ) ); + } +} diff --git a/src/main/java/com/chenxuan/security/service/JwtTokenService.java b/src/main/java/com/chenxuan/security/service/JwtTokenService.java new file mode 100644 index 0000000..6901186 --- /dev/null +++ b/src/main/java/com/chenxuan/security/service/JwtTokenService.java @@ -0,0 +1,216 @@ +package com.chenxuan.security.service; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.chenxuan.bean.component.RedisCacheService; +import com.chenxuan.constants.Constants; +import com.chenxuan.security.LoginUser; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.ip.AddressUtils; +import com.chenxuan.utils.ip.IpUtils; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + + +/** + * @ClassName:JwtTokenService + * @Description: token验证处理 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 6:36 PM + * @Version V1.0 + */ + +@Component +public class JwtTokenService { + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认30分钟) + @Value("${token.expireTime}") + private int expireTime; + + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + + @Autowired + private RedisCacheService redisCacheService; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) { + // 获取请求携带的令牌 + String token = getToken( request ); + if (StrUtil.isNotEmpty( token )) { + Claims claims = parseToken( token ); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get( Constants.LOGIN_USER_KEY ); + String userKey = getTokenKey( uuid ); + LoginUser user = redisCacheService.getCacheObject( userKey ); + return user; + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) { + if (null != loginUser && StrUtil.isNotEmpty( loginUser.getToken() )) { + String userKey = getTokenKey( loginUser.getToken() ); + redisCacheService.setCacheObject( userKey, loginUser ); + } + } + + /** + * 创建令牌 + * + * @param loginUser 用户信息 + * @return 令牌 + */ + public String createToken(LoginUser loginUser) { + String token = IdUtil.fastUUID(); + loginUser.setToken( token ); + setUserAgent( loginUser ); + refreshToken( loginUser ); + + Map claims = new HashMap<>(); + claims.put( Constants.LOGIN_USER_KEY, token ); + return createToken( claims ); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param loginUser 令牌 + * @return 令牌 + */ + public void verifyToken(LoginUser loginUser) { + long expireTime = loginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) { + String token = loginUser.getToken(); + loginUser.setToken( token ); + refreshToken( loginUser ); + } + } + + /** + * 刷新令牌有效期 + * + * @param loginUser 登录信息 + */ + public void refreshToken(LoginUser loginUser) { + loginUser.setLoginTime( System.currentTimeMillis() ); + loginUser.setExpireTime( loginUser.getLoginTime() + expireTime * MILLIS_MINUTE ); + // 根据uuid将loginUser缓存 + String userKey = getTokenKey( loginUser.getToken() ); + redisCacheService.setCacheObject( userKey, loginUser, expireTime, TimeUnit.MINUTES ); + } + + /** + * 设置用户代理信息 + * + * @param loginUser 登录信息 + */ + public void setUserAgent(LoginUser loginUser) { + UserAgent userAgent = UserAgent.parseUserAgentString( ServletUtils.getRequest().getHeader("User-Agent")); + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + loginUser.setIpaddr(ip); + loginUser.setLoginLocation( AddressUtils.getRealAddressByIP(ip)); + loginUser.setBrowser(userAgent.getBrowser().getName()); + loginUser.setOs(userAgent.getOperatingSystem().getName()); + } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) { + String token = Jwts.builder() + .setClaims( claims ) + .signWith( SignatureAlgorithm.HS512, secret ).compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) { + return Jwts.parser() + .setSigningKey( secret ) + .parseClaimsJws( token ) + .getBody(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) { + Claims claims = parseToken( token ); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) { + String token = request.getHeader( header ); + if (StrUtil.isNotEmpty( token ) && token.startsWith( Constants.TOKEN_PREFIX )) { + token = token.replace( Constants.TOKEN_PREFIX, "" ); + } + return token; + } + + private String getTokenKey(String uuid) { + return Constants.LOGIN_TOKEN_KEY + uuid; + } + + /** + * 退出登录--删除token + */ + public void logout(HttpServletRequest request){ + String token = this.getToken(request); + if(StrUtil.isNotEmpty( token )){ + Claims claims = this.parseToken(token); + String uuid = (String)claims.get( Constants.LOGIN_USER_KEY ); + String userKey = this.getTokenKey( uuid ); + this.redisCacheService.deleteObject( userKey ); + + } + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/security/service/LoginService.java b/src/main/java/com/chenxuan/security/service/LoginService.java new file mode 100644 index 0000000..2531f60 --- /dev/null +++ b/src/main/java/com/chenxuan/security/service/LoginService.java @@ -0,0 +1,119 @@ +package com.chenxuan.security.service; + +import com.chenxuan.bean.component.RedisCacheService; +import com.chenxuan.constants.Constants; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.exception.CustomException; +import com.chenxuan.exception.UserPasswordNotMatchException; +import com.chenxuan.manager.AsyncManager; +import com.chenxuan.manager.factory.AsyncFactory; +import com.chenxuan.security.LoginUser; +import com.chenxuan.service.SysUserService; +import com.chenxuan.utils.Md5; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashSet; +import java.util.Set; + +/** + * @ClassName:LoginService + * @Description: 登录校验方法 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:40 PM + * @Version V1.0 + */ + +@Service +public class LoginService { + + @Autowired + private JwtTokenService jwtTokenService; + + @Autowired + private RedisCacheService redisCacheService; + + @Autowired + private SysUserService sysUserService; + + @Autowired + private CustomPermissionService customPermissionService; + + /** + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return java.lang.String + * @description 登录验证 + */ + public String login(String username, String password, String code, String uuid) { + String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid; + String captcha = redisCacheService.getCacheObject(verifyKey); + redisCacheService.deleteObject(verifyKey); + if (captcha == null) { + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_FAIL, "验证码错误")); + throw new CustomException("验证码错误", HttpStatusCode.ERROR); + } + + if (!code.equalsIgnoreCase(captcha)) { + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_FAIL, "验证码错误")); + throw new CustomException("验证码错误", HttpStatusCode.ERROR); + } + // 生成token + return jwtTokenService.createToken(getLoginUser(username, password)); + } + + + /** + * + * @param username 账号 + * @param password 密码 + * @return + */ + public String remoteLogin(String username, String password) { + // 生成token + return jwtTokenService.createToken(getLoginUser(username, password)); + } + + /** + * 用户登录校验 + * + * @param username + * @param password + * @return + */ + private LoginUser getLoginUser(String username, String password) { + Set permissions = new HashSet<>(); + // 用户验证 + SysUser account = sysUserService.findByUserAccount(username); + // 判断用户是否存在 + if (StringUtils.isNull(account)) { + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_FAIL, "用户不存在")); + throw new UserPasswordNotMatchException("用户不存在", HttpStatusCode.ERROR); + } + String userPassword = Md5.getMD5Code(account.getPasswordSalt() + password); + // 密码对比 + if (!account.getPassword().equals(userPassword)) { + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_FAIL, "密码错误")); + throw new UserPasswordNotMatchException("密码错误", HttpStatusCode.ERROR); + } + // 判断用户是否正常 + if (account.getStatus().equals(Constants.FAIL)) { + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_FAIL, "该用户已停用")); + throw new CustomException("该用户已停用", HttpStatusCode.ERROR); + } + // 获取权限列表 + permissions.addAll(customPermissionService.getMenuPermission(account)); + permissions.addAll(customPermissionService.getRolePermission(account)); + // + AsyncManager.me().execute(AsyncFactory.recordLoginLog(username, Constants.LOGIN_SUCCESS, "登录成功")); + LoginUser loginUser = new LoginUser(); + loginUser.setPermissions(permissions); + loginUser.setUser(account); + return loginUser; + } + +} diff --git a/src/main/java/com/chenxuan/service/BusiAmpliDayIncreaseService.java b/src/main/java/com/chenxuan/service/BusiAmpliDayIncreaseService.java new file mode 100644 index 0000000..76cc24d --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiAmpliDayIncreaseService.java @@ -0,0 +1,59 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.BusiAmpliDayIncrease; +import com.chenxuan.entity.vo.BusiAmpliDayIncreaseVo; +import java.util.List; + +/** + * @ClassName:BusiAmpliDayIncreaseService + * @Description: 振动装置日增长率服务类. + * @Author: Jordan_Li + * @CreatTime:6/10/2020 10:35 AM + * @Version V1.0 + */ +public interface BusiAmpliDayIncreaseService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据主变ID查询振动装置日增长率信息 + * + * @param mainId 主变ID + * @return 振动装置日增长率信息集合 + */ + List selectAmpliDayIncreaseByMainId(String mainId); + + /** + * 新增振动装置日增长率信息 + * + * @param BusiAmpliDayIncrease 振动装置日增长率信息 + * @return 结果 + */ + boolean insertAmpliDayIncrease(BusiAmpliDayIncrease BusiAmpliDayIncrease); + + + /** + * 修改振动装置日增长率信息 + * + * @param BusiAmpliDayIncrease 振动装置日增长率信息 + * @return 结果 + */ + boolean updateAmpliDayIncrease(BusiAmpliDayIncrease BusiAmpliDayIncrease); + + /** + * 通过ID删除振动装置日增长率信息 + * + * @param id 装置id + * @return 结果 + */ + boolean delete(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiAmpliRealService.java b/src/main/java/com/chenxuan/service/BusiAmpliRealService.java new file mode 100644 index 0000000..e3664d2 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiAmpliRealService.java @@ -0,0 +1,102 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.entity.vo.BusiAmpliRealDetailsVo; +import com.chenxuan.entity.vo.BusiAmpliRealVo; +import com.chenxuan.entity.vo.TableVo; + +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:BusiAmpliRealService + * @Description: 振动实时数据服务类. + * @Author: Jordan_Li + * @CreatTime:6/17/2020 9:50 AM + * @Version V1.0 + */ +public interface BusiAmpliRealService extends IService { + + /** + * 通过条件查询振动实时数据信息 + * + * @param dto + * @return + */ + List selectShockRealByMainId(BusiAmpliRealDto dto); + + /** + * 新增振动实时数据信息 + * + * @param busiAmpliReals + * @return + */ + boolean insertShockReal(List busiAmpliReals); + + /** + * 根据条件查询振动实时数据详细信息 + * + * @param busiAmpliRealDto + * @return + */ + Page getShockRealDetailsByCondition(BusiAmpliRealDto busiAmpliRealDto); + + /** + * 根据条件查询振动实时数据谱图信息 + * + * @param busiAmpliRealDto + * @return + */ + BusiAmpliRealVo getShockRealChartByInfo(BusiAmpliRealDto busiAmpliRealDto); + + /** + * 根据条件查询振动实时数据三维图信息 + * + * @param busiAmpliRealDto + * @return + */ + BusiAmpliRealVo getAmpliRealThreeChart(BusiAmpliRealDto busiAmpliRealDto); + + /** + * 加载振动实时数据详细信息明细三级界面 + * + * @param busiAmpliRealDto + * @return + */ + Page showShockRealDetailsPages(BusiAmpliRealDto busiAmpliRealDto); + + /** + * 加载详情 + * + * @param dto + * @return + */ + Map loadingDetails(BusiAmpliRealDto dto); + + /** + * 重新计算 + * + * @param dto + * @return + */ + Map recount(BusiAmpliRealDto dto); + + /** + * 获取频率 + * + * @param mainId + * @return + */ + List selectShockRealFrequencyByMainId(String mainId); + + List selectMainDeviceList(); + + List selectShockRealDataByMainId(String mainId); + + List selectShockRealDataByMainIdAndParseAndSideAndInout(String mainId, String P, String A, String U); +} diff --git a/src/main/java/com/chenxuan/service/BusiAmpliStatisticsService.java b/src/main/java/com/chenxuan/service/BusiAmpliStatisticsService.java new file mode 100644 index 0000000..5e76ee0 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiAmpliStatisticsService.java @@ -0,0 +1,16 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.model.BusiAmpliStatistics; + +import java.util.List; + +/** + * @author xuan + * @create 2020-07-09 4:17 PM + **/ +public interface BusiAmpliStatisticsService extends IService { + + List selectMainDeviceList(); + +} diff --git a/src/main/java/com/chenxuan/service/BusiAmpliThresholdConfService.java b/src/main/java/com/chenxuan/service/BusiAmpliThresholdConfService.java new file mode 100644 index 0000000..93cccb5 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiAmpliThresholdConfService.java @@ -0,0 +1,64 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiAmpliThresholdConfDto; +import com.chenxuan.entity.model.BusiAmpliThresholdConf; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfNewVo; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfVo; +import java.util.List; + + + + +/** + * @ClassName:BusiAmpliThresholdConfService + * @Description: 振动装置阈值配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:41 PM + * @Version V1.0 + */ +public interface BusiAmpliThresholdConfService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiAmpliThresholdConfDto dto); + + /** + * 根据主变ID查询阈值配置信息 + * + * @param mainId 主变ID + * @return 噪声装置阈值配置信息 + */ + List selectThresholdConfByMainId(String mainId); + + /** + * 新增阈值配置信息 + * + * @param List 噪声装置阈值信息集合 + * @return 结果 + */ + boolean insertThresholdConf(List busiAmpliThresholdConfList); + + + /** + * 修改阈值配置信息 + * + * @param List 噪声装置阈值信息集合 + * @return 结果 + */ + boolean updateThresholdConf(BusiAmpliThresholdConfNewVo busiAmpliThresholdConfNewVo); + + + /** + * 通过阈值ID删除阈值配置信息 + * + * @param id 阈值id + * @return 结果 + */ + boolean delete(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiCalcParamConfService.java b/src/main/java/com/chenxuan/service/BusiCalcParamConfService.java new file mode 100644 index 0000000..b80693c --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiCalcParamConfService.java @@ -0,0 +1,44 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiCalcParamConfDto; +import com.chenxuan.entity.model.BusiCalcParamConf; +import com.chenxuan.entity.vo.BusiCalcParamConfVo; +import java.util.List; + +/** + * @author xuan + * @create 2020-06-28 8:32 PM + **/ +public interface BusiCalcParamConfService extends IService { + /** + * 初始化设备分析参数 + * + * @param token + * token + * @param siteId + * 站点ID + * @param mainId + * 主设备编码 + */ + void initBusiParams(String token, String siteId, String mainId); + + /** + * 获取设备的分析参数列表 + * + * 站点ID + * @param mainId + * 主设备ID + * @return 分析参数列表 + */ + List findBusiParamGis(String mainId); + + /** + * 保存分析参数列表 + * + * @param busiParams + * @return + */ + AjaxResult saveBusiParamGis(List busiParams); +} diff --git a/src/main/java/com/chenxuan/service/BusiCenterRealService.java b/src/main/java/com/chenxuan/service/BusiCenterRealService.java new file mode 100644 index 0000000..e83ac80 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiCenterRealService.java @@ -0,0 +1,75 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.model.BusiCenterReal; +import com.chenxuan.entity.vo.BusiCenterRealDetailsVo; +import com.chenxuan.entity.vo.BusiCenterRealVo; +import com.chenxuan.entity.vo.TableVo; + +import java.util.List; + + +/** + * @ClassName:BusiCenterRealService + * @Description: 中心点实时数据服务类. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiCenterRealService extends IService { + + /** + * 根据主变ID查询中心点实时数据信息 + * + * @param mainId + * @return + */ + List selectCenterRealByMainId(String mainId); + + /** + * 新增中心点实时数据信息 + * + * @param busiCenterRealList + * @return + */ + boolean insertCenterReal(List busiCenterRealList); + + /** + * 通过条件查询中心点实时数据信息 + * + * @param busiCenterRealDto + * @return + */ + BusiCenterRealVo findCenterRealChartByInfo(BusiCenterRealDto busiCenterRealDto); + + /** + * 根据主变ID和日期查询中心点实时数据信息 + * + * @param busiCenterRealVo + * @return + */ + BusiCenterRealVo selectCenterRealByMainIdAndCreateTime(BusiCenterRealVo busiCenterRealVo); + + /** + * 根据主变ID查询中心点实时数据分页信息 + * + * @param dto + * @return + */ + Page getCenterRealDetails(BusiCenterRealDto dto); + + + /** + * 根据主变ID查询中心点实时数据详细信息 + * + * @param dto + * @return + */ + Page getCenterRealDetailsByMainId(BusiCenterRealDto dto); + + List selectMainDeviceList(); + + List selectCenterRealDataByMainId(String mainId); +} diff --git a/src/main/java/com/chenxuan/service/BusiCenterRealStatisticsService.java b/src/main/java/com/chenxuan/service/BusiCenterRealStatisticsService.java new file mode 100644 index 0000000..d909cfe --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiCenterRealStatisticsService.java @@ -0,0 +1,34 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.model.BusiCenterRealStatistics; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-07-09 4:04 PM + **/ +public interface BusiCenterRealStatisticsService extends IService { + + List selectMainDeviceList(); + + /** + * 查询主变今日数据 + * @param busiCenterReal + * @return + */ + BusiCenterRealStatistics getMainDeviceListTodayData(BusiCenterRealStatistics busiCenterReal); + /** + * 查询主变昨日数据 + * @param busiCenterReal + * @return + */ + BusiCenterRealStatistics getMainDeviceListYesterdayData(BusiCenterRealStatistics busiCenterReal); + + /** + * 查询主变30日之前的数据 + * @param busiCenterReal + * @return + */ + BusiCenterRealStatistics getMainDeviceListBeforOneMonthData(BusiCenterRealStatistics busiCenterReal); +} diff --git a/src/main/java/com/chenxuan/service/BusiCenterThresholdConfService.java b/src/main/java/com/chenxuan/service/BusiCenterThresholdConfService.java new file mode 100644 index 0000000..0d8f808 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiCenterThresholdConfService.java @@ -0,0 +1,67 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiCenterThresholdConfDto; +import com.chenxuan.entity.model.BusiCenterThresholdConf; +import com.chenxuan.entity.vo.BusiCenterThresholdConfVo; + +/** + * @ClassName:BusiCenterThresholdConfService + * @Description: 中心点电流阈值配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 14:41 PM + * @Version V1.0 + */ +public interface BusiCenterThresholdConfService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiCenterThresholdConfDto busiCenterThresholdConfDto); + + /** + * 根据主变ID查询阈值配置信息 + * + * @param mainId 主变ID + * @return 中心点电流阈值配置信息 + */ + BusiCenterThresholdConfVo selectCenterThresholdConfByMainId(String mainId); + + /** + * 新增阈值配置信息 + * + * @param busiCenterThresholdConf + * @return 结果 + */ + AjaxResult insertThresholdConf(BusiCenterThresholdConf busiCenterThresholdConf); + + + /** + * 修改阈值配置信息 + * + * @param busiCenterThresholdConf 中心点电流阈值信息 + * @return 结果 + */ + AjaxResult updateThresholdConf(BusiCenterThresholdConf busiCenterThresholdConf); + + /** + * 通过主变ID删除阈值配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + boolean deleteThresholdConfByMainId(String mainId); + + /** + * 通过阈值ID删除阈值配置信息 + * + * @param id 阈值id + * @return 结果 + */ + boolean delete(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiCommunicationParametersService.java b/src/main/java/com/chenxuan/service/BusiCommunicationParametersService.java new file mode 100644 index 0000000..19d8324 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiCommunicationParametersService.java @@ -0,0 +1,65 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.BusiCommunicationParameters; + +/** + * @ClassName:BusiCommunicationParametersService + * @Description: 通信参数设置服务类. + * @Author: Jordan_Li + * @CreatTime:6/20/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiCommunicationParametersService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据ID查询通信参数信息 + * + * @param id 通信参数ID + * @return 通信参数信息 + */ + BusiCommunicationParameters selectBusiCommunicationParametersById(String id); + + /** + * 新增通信参数信息 + * + * @param busiCommunicationParameters 通信参数对象信息 + * @return 结果 + */ + boolean insertBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters); + + /** + * 修改通信参数信息 + * + * @param busiCommunicationParameters 通信参数对象信息 + * @return 结果 + */ + boolean updateBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters); + + /** + * 通过ID删除通信参数信息 + * + * @param id 通信参数对象ID + * @return 结果 + */ + boolean deleteById(String id); + + + + /** + * 根据ID查询通信参数信息 + * + * @param protocol 通信协议类型 + * @return 通信参数信息 + */ + BusiCommunicationParameters selectBusiCommunicationParametersByProtocol(String protocol); +} diff --git a/src/main/java/com/chenxuan/service/BusiControlConfigService.java b/src/main/java/com/chenxuan/service/BusiControlConfigService.java new file mode 100644 index 0000000..dc6fd82 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiControlConfigService.java @@ -0,0 +1,71 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.BusiControlConfig; +import com.chenxuan.entity.vo.BusiControlConfigVo; + +import java.util.List; + + +/** + * @ClassName:BusiControlConfigService + * @Description: 控制参数配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/6/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiControlConfigService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据主变ID查询控制参数配置信息 + * + * @param mainId 主变ID + * @return 控制参数配置信息集合信息 + */ + List selectConfigsByMainId(String mainId); + + /** + * 新增配置信息 + * + * @param busicontrolconfiglist 配置集合信息 + * @return 结果 + */ + boolean insertConfigs(List busicontrolconfiglist); + + + /** + * 修改配置信息 + * + * @param busicontrolconfiglist 配置集合信息 + * @return 结果 + */ + AjaxResult updateConfigs(List busicontrolconfiglist); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + boolean deleteConfById(String id); + + /** + * 根据主变id删除该主变下对应的控制参数配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + boolean deleteConfsByMainId(String mainId); + +} diff --git a/src/main/java/com/chenxuan/service/BusiDeviceCalibrationService.java b/src/main/java/com/chenxuan/service/BusiDeviceCalibrationService.java new file mode 100644 index 0000000..df6ca02 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiDeviceCalibrationService.java @@ -0,0 +1,26 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.model.BusiDeviceCalibration; + +/** + * @author carrey_zheng + * @create 2020-07-03 3:47 PM + **/ +public interface BusiDeviceCalibrationService extends IService { + + /** + * 校时信息 + * @param mainId + * @return + */ + BusiDeviceCalibration selectBusiDeviceCalibrationByMainId(String mainId); + + /** + * 校准时间 + * + * @param busiDeviceCalibration + * @return + */ + boolean timingBusiDeviceCalibration(BusiDeviceCalibration busiDeviceCalibration); +} diff --git a/src/main/java/com/chenxuan/service/BusiDeviceSpecialShowService.java b/src/main/java/com/chenxuan/service/BusiDeviceSpecialShowService.java new file mode 100644 index 0000000..7a9ba17 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiDeviceSpecialShowService.java @@ -0,0 +1,31 @@ +package com.chenxuan.service; + +import com.chenxuan.entity.dto.BusiVibrationContrastDto; +import com.chenxuan.entity.model.BusiVibrationSeparation; +import com.chenxuan.entity.vo.BusiVibrationSeparationVo; + +public interface BusiDeviceSpecialShowService { + + /** + * 根据装置获取实时数据谱图信息 + * + * @param vibrationSeparation + * @return + */ + BusiVibrationSeparationVo getShockRealChartByDevice(BusiVibrationSeparation vibrationSeparation); + + /** + * 振动对比实验 + * + * @param dto + * @return + */ + BusiVibrationContrastDto getVibrationContrastExper(BusiVibrationContrastDto dto); + + /** + * 原副边折线图 + * + * @return + */ + BusiVibrationContrastDto getFixation(); +} diff --git a/src/main/java/com/chenxuan/service/BusiExportDataService.java b/src/main/java/com/chenxuan/service/BusiExportDataService.java new file mode 100644 index 0000000..fc1e4e7 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiExportDataService.java @@ -0,0 +1,64 @@ +package com.chenxuan.service; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.dto.BusiNoiseRealDto; + +/** + * @ClassName:BusiExportDataService + * @Description: 导出实时数据明细服务类. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiExportDataService { + + /** + * 根据主变ID查询中心点实时数据详细信息 + * + * @param dto + * @return + */ + AjaxResult exportCenterRealDetails(BusiCenterRealDto dto); + + /** + * 根据主变ID查询噪声实时数据详细信息 + * + * @param dto + * @return + */ + AjaxResult exportNoiseRealDetails(BusiNoiseRealDto dto); + + /** + * 导出震动实时数据详细信息(三级界面) + * + * @param dto + * @return + */ + AjaxResult exportShockRealDetails(BusiAmpliRealDto dto); + + /** + * 导出传感器实时数据 + * + * @param dto + * @return + */ + AjaxResult exportAmpliReal(BusiAmpliRealDto dto); + + /** + * 导出中心点实时数据 + * + * @param dto + * @return + */ + AjaxResult exportCenterReal(BusiCenterRealDto dto); + + /** + * 导出噪声实时数据 + * + * @param dto + * @return + */ + AjaxResult exportNoiseReal(BusiNoiseRealDto dto); +} diff --git a/src/main/java/com/chenxuan/service/BusiFrequencyConfService.java b/src/main/java/com/chenxuan/service/BusiFrequencyConfService.java new file mode 100644 index 0000000..31c17af --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiFrequencyConfService.java @@ -0,0 +1,59 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.BusiFrequencyConf; + + +/** + * @ClassName:BusiFrequencyConfService + * @Description: 振动装置频率配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/9/2020 10:15 PM + * @Version V1.0 + */ +public interface BusiFrequencyConfService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据ID查询频率配置信息 + * + * @param id 频率ID + * @return 振动装置频率配置信息 + */ + BusiFrequencyConf selectFrequencyConfById(String id); + + /** + * 新增振动装置频率配置信息 + * + * @param BusiFrequencyConf 振动装置频率配置信息 + * @return 结果 + */ + boolean insertFrequencyConf(BusiFrequencyConf BusiFrequencyConf); + + + /** + * 修改振动装置频率配置信息 + * + * @param BusiFrequencyConf 振动装置频率配置信息 + * @return 结果 + */ + boolean updateFrequencyConf(BusiFrequencyConf BusiFrequencyConf); + + /** + * 通过ID删除振动装置频率配置信息 + * + * @param id 频率配置ID + * @return 结果 + */ + boolean deleteFrequencyConfById(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiIedparamService.java b/src/main/java/com/chenxuan/service/BusiIedparamService.java new file mode 100644 index 0000000..3e130d9 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiIedparamService.java @@ -0,0 +1,12 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.model.BusiIedparam; +import com.chenxuan.entity.vo.BusiIedparamVo; + +import java.util.List; + +public interface BusiIedparamService extends IService { + + List quereyIcdById(String id); +} diff --git a/src/main/java/com/chenxuan/service/BusiMainDeviceService.java b/src/main/java/com/chenxuan/service/BusiMainDeviceService.java new file mode 100644 index 0000000..71fb8f9 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiMainDeviceService.java @@ -0,0 +1,84 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiMainDeviceDto; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.entity.vo.PercentageVo; + +import java.util.List; + +/** + * @ClassName:BusiMainDeviceService + * @Description: 主变信息服务类. + * @Author: Jordan_Li + * @CreatTime:6/3/2020 13:35 PM + * @Version V1.0 + */ +public interface BusiMainDeviceService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiMainDeviceDto busiMainDeviceDto); + + /** + * 根据ID查询主变信息 + * + * @param id 主变ID + * @return 主变信息 + */ + BusiMainDevice selectMainDeviceById(String id); + + /** + * 新增主变信息 + * + * @param busiMainDevice + * @return + */ + AjaxResult insertMainDevice(BusiMainDevice busiMainDevice); + + /** + * 修改主变信息 + * + * @param busiMainDevice + * @return + */ + AjaxResult updateMainDevice(BusiMainDevice busiMainDevice); + + /** + * 通过ID删除主变信息 + * + * @param id 主变ID + * @return 结果 + */ + boolean deleteMainDeviceById(String id); + + /** + * @Description: 获取主变压器信息List + * @Param: + * @Return: + **/ + List selectBusiMainDeviceList(); + + /** + * @Description: 获取设备总数 + * @Param: + * @Return: + **/ + PercentageVo selectCountDeviceTotal(); + + /** + * @Description: 获取运行正常设备总数 + * @Param: + * @Return: + **/ + PercentageVo selectNormalDevice(); + + PercentageVo selectCountEcpDevice(); + +} diff --git a/src/main/java/com/chenxuan/service/BusiNoiseRealService.java b/src/main/java/com/chenxuan/service/BusiNoiseRealService.java new file mode 100644 index 0000000..1f57cbd --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiNoiseRealService.java @@ -0,0 +1,66 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.BusiNoiseReal; +import com.chenxuan.entity.vo.BusiNoiseRealDetailsVo; +import com.chenxuan.entity.vo.BusiNoiseRealVo; +import com.chenxuan.entity.vo.TableVo; + +import java.util.List; + + +/** + * @ClassName:BusiNoiseRealService + * @Description: 噪声实时数据服务类. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiNoiseRealService extends IService { + + /** + * 根据主变ID查询噪声实时数据信息 + * + * @param mainId + * @return + */ + List selectNoiseRealByMainId(String mainId); + + /** + * 新增噪声实时数据信息 + * + * @param busiNoiseRealList + * @return + */ + boolean insertNoiseReal(List busiNoiseRealList); + + /** + * 通过条件查询中心点实时数据谱图信息 + * + * @param busiNoiseRealDto + * @return + */ + BusiNoiseRealVo findNoiseRealChartByInfo(BusiNoiseRealDto busiNoiseRealDto); + + /** + * 根据主变ID和日期查询噪声实时数据信息 + * + * @param busiNoiseRealDto + * @return + */ + BusiNoiseRealVo selectNoiseRealByMainIdAndCreateTime(BusiNoiseRealDto busiNoiseRealDto); + + /** + * 根据主变ID查询噪声实时数据详细信息 + * + * @param dto + * @return + */ + Page getNoiseRealDetailsByMainId(BusiNoiseRealDto dto); + + List selectMainDeviceList(); + + List selectNoiseRealDataByMainId(String mainId); +} diff --git a/src/main/java/com/chenxuan/service/BusiNoiseRealStatisticsService.java b/src/main/java/com/chenxuan/service/BusiNoiseRealStatisticsService.java new file mode 100644 index 0000000..4358627 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiNoiseRealStatisticsService.java @@ -0,0 +1,20 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.model.BusiNoiseRealStatistics; +import java.util.List; + +/** + * @author xuan + * @create 2020-07-09 4:18 PM + **/ +public interface BusiNoiseRealStatisticsService extends IService { + + List selectMainDeviceList(); + + BusiNoiseRealStatistics getMainDeviceListTodayData(BusiNoiseRealStatistics busiNoiseRealStatistics); + + BusiNoiseRealStatistics getMainDeviceListYesterdayData(BusiNoiseRealStatistics busiNoiseRealStatistics); + + BusiNoiseRealStatistics getMainDeviceListBeforOneMonthData(BusiNoiseRealStatistics busiNoiseRealStatistics); +} diff --git a/src/main/java/com/chenxuan/service/BusiNoiseThresholdConfService.java b/src/main/java/com/chenxuan/service/BusiNoiseThresholdConfService.java new file mode 100644 index 0000000..7b627e5 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiNoiseThresholdConfService.java @@ -0,0 +1,70 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiNoiseThresholdConfDto; +import com.chenxuan.entity.model.BusiNoiseThresholdConf; +import com.chenxuan.entity.vo.BusiNoiseThresholdConfVo; + + + +/** + * @ClassName:BusiCenterThresholdConfService + * @Description: 中心点电流阈值配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:41 PM + * @Version V1.0 + */ +public interface BusiNoiseThresholdConfService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiNoiseThresholdConfDto dto); + + /** + * 根据主变ID查询阈值配置信息 + * + * @param mainId 主变ID + * @return 噪声装置阈值配置信息 + */ + BusiNoiseThresholdConfVo selectThresholdConfByMainId(String mainId); + + /** + * 新增阈值配置信息 + * + * @param busiNoiseThresholdConf 噪声装置阈值信息 + * @return 结果 + */ + AjaxResult insertThresholdConf(BusiNoiseThresholdConf busiNoiseThresholdConf); + + + /** + * 修改阈值配置信息 + * + * @param busiNoiseThresholdConf 噪声装置阈值信息 + * @return 结果 + */ + AjaxResult updateThresholdConf(BusiNoiseThresholdConf busiNoiseThresholdConf); + + /** + * 通过主变ID删除阈值配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + boolean deleteThresholdConfByMainId(String mainId); + + /** + * 通过阈值ID删除阈值配置信息 + * + * @param id 阈值id + * @return 结果 + */ + boolean delete(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiParamBindService.java b/src/main/java/com/chenxuan/service/BusiParamBindService.java new file mode 100644 index 0000000..3ce2e8f --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiParamBindService.java @@ -0,0 +1,27 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiParamBindDto; +import com.chenxuan.entity.model.BusiParamBind; + +public interface BusiParamBindService extends IService { + /** + * + * @param busiParamBind + * @return + */ + boolean addParamBind(BusiParamBind busiParamBind); + + /** + * + * @param busiParamBind + * @return + */ + boolean updateParamBind(BusiParamBind busiParamBind); + + Page queryParamBind(BusiParamBindDto busiParamBindDto); + + int delParamBind(int[] ids); + +} diff --git a/src/main/java/com/chenxuan/service/BusiSubDeviceService.java b/src/main/java/com/chenxuan/service/BusiSubDeviceService.java new file mode 100644 index 0000000..7e05f56 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiSubDeviceService.java @@ -0,0 +1,82 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiSubDevice; +import com.chenxuan.entity.vo.BusiSubDeviceVo; + +import java.util.List; + + +/** + * @ClassName:BusiSubDeviceService + * @Description: 主变装置信息服务类. + * @Author: Jordan_Li + * @CreatTime:6/4/2020 14:35 PM + * @Version V1.0 + */ +public interface BusiSubDeviceService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiSubDeviceDto dto); + + List queryAll(); + + /** + * 根据主变ID查询主变装置信息 + * + * @param mainId 主变ID + * @return 主变装置信息集合 + */ + BusiSubDeviceVo selectSubDeviceByMainId(String mainId); + + /** + * 根据主变ID查询主变装置信息 + * + * @param id 主键ID + * @return 主变装置信息 + */ + BusiSubDeviceVo querySubDeviceById(String id); + + + List querySubDeviceByMainId(String mainId); + /** + * 新增主变装置信息 + * + * @param + * @return 结果 + */ + AjaxResult insertSubDevice(BusiSubDeviceDto dto); + + + /** + * 修改主变装置信息 + * + * @param busiSubDevice + * @return + */ + AjaxResult updateSubDevice(BusiSubDevice busiSubDevice); + + /** + * 通过主变ID删除主变装置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + boolean deleteSubDeviceByMainId(String mainId); + + /** + * 通过ID删除装置信息 + * + * @param id 装置id + * @return 结果 + */ + boolean delete(String id); + +} diff --git a/src/main/java/com/chenxuan/service/BusiTransformerConfService.java b/src/main/java/com/chenxuan/service/BusiTransformerConfService.java new file mode 100644 index 0000000..2524de1 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiTransformerConfService.java @@ -0,0 +1,67 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.BusiTransformerConf; +import com.chenxuan.entity.vo.BusiTransformerConfVo; +import java.util.List; + +/** + * @ClassName:BusiTransformerConfService + * @Description: 原副边电流电压实时数据配置服务类. + * @Author: Jordan_Li + * @CreatTime:6/2/2020 16:35 PM + * @Version V1.0 + */ +public interface BusiTransformerConfService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据主变ID查询变压器原边副边电流电压配置信息 + * + * @param mainId 主变ID + * @return 配置集合信息 + */ + List selectConfigsByMainId(String mainId); + + /** + * 新增配置信息 + * + * @param busiTransformerConfList 配置集合信息 + * @return 结果 + */ + boolean insertConfigs(List busiTransformerConfList); + + + /** + * 修改配置信息 + * + * @param busiTransformerConfList 配置集合信息 + * @return 结果 + */ + boolean updateConfigs(List busiTransformerConfList); + + /** + * 通过ID删除配置信息 + * + * @param id 配置ID + * @return 结果 + */ + boolean deleteConfById(String id); + + /** + * 根据主变id删除该主变下对应的电流电压配置信息 + * + * @param mainId 主变ID + * @return 结果 + */ + boolean deleteConfsByMainId(String mainId); + +} diff --git a/src/main/java/com/chenxuan/service/BusiTransformerRealService.java b/src/main/java/com/chenxuan/service/BusiTransformerRealService.java new file mode 100644 index 0000000..6bb7732 --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiTransformerRealService.java @@ -0,0 +1,53 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.dto.BusiTransformerRealDto; +import com.chenxuan.entity.model.BusiTransformerReal; + +import java.util.List; + + +/** + * @ClassName:BusiTransformerRealService + * @Description: 原副边电流电压实时数据服务类. + * @Author: Jordan_Li + * @CreatTime:6/10/2020 16:35 PM + * @Version V1.0 + */ +public interface BusiTransformerRealService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 根据主变ID查询变压器原副边电流电压实时数据信息 + * + * @param mainId 主变ID + * @return 配置集合信息 + */ + List selectTransformerRealByMainId(String mainId); + + /** + * 导出原副边电流电压实时数据Excel + * + * @param dto + * @return + */ + boolean exporTransformReal(BusiTransformerRealDto dto); + + /** + * 新增配置信息 + * + * @param BusiTransformerRealList 原副边电流电压实时数据信息 + * @return 结果 + */ + boolean insertTransformerReals(List BusiTransformerRealList); + +} diff --git a/src/main/java/com/chenxuan/service/BusiWarningService.java b/src/main/java/com/chenxuan/service/BusiWarningService.java new file mode 100644 index 0000000..0e800bc --- /dev/null +++ b/src/main/java/com/chenxuan/service/BusiWarningService.java @@ -0,0 +1,43 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.entity.dto.BusiWarningDto; +import com.chenxuan.entity.model.BusiWarning; +import com.chenxuan.entity.vo.BusiWarningVo; + +public interface BusiWarningService extends IService { + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(BusiWarningDto dto); + + /** + * ied报警分页 + * + * @param dto + * @return + */ + Page getPage(BusiWarningDto dto); + + /** + * 新增告警信息 + * + * @param BusiWarning 告警信息 + * @return 结果 + */ + boolean insertWarning(BusiWarning BusiWarning); + + + /** + * 修改告警信息 + * + * @param BusiWarning 告警信息 + * @return 结果 + */ + boolean updateWarning(BusiWarning BusiWarning); + +} diff --git a/src/main/java/com/chenxuan/service/QuartzManagerService.java b/src/main/java/com/chenxuan/service/QuartzManagerService.java new file mode 100644 index 0000000..81cff05 --- /dev/null +++ b/src/main/java/com/chenxuan/service/QuartzManagerService.java @@ -0,0 +1,60 @@ +package com.chenxuan.service; + +import com.chenxuan.base.entity.JobOperateEnum; +import com.chenxuan.entity.model.ScheduleJob; +import org.quartz.SchedulerException; + +/** + * @ClassName:QuartzService + * @Description: 定时任务服务 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 8:49 PM + * @Version V1.0 + */ + +public interface QuartzManagerService { + + /** + * 新增定时任务 + * + * @param job 任务 + */ + void addJob(ScheduleJob job) throws SchedulerException, SchedulerException; + + + /** + * 更新定时任务 + * + * @param job 任务 + */ + void updateJob(ScheduleJob job) throws SchedulerException; + + /** + * 启动所有任务 + * + *@param job 任务 + */ + void run(ScheduleJob job) throws SchedulerException ; + + /** + * 操作定时任务 + * + * @param jobOperateEnum 操作枚举 + * @param job 任务 + */ + void operateJob(JobOperateEnum jobOperateEnum, ScheduleJob job) throws SchedulerException; + + /** + * 启动所有任务 + * + */ + void startAllJob() throws SchedulerException; + + /** + * 暂停所有任务 + * + */ + void pauseAllJob() throws SchedulerException; + + +} diff --git a/src/main/java/com/chenxuan/service/ScheduleJobService.java b/src/main/java/com/chenxuan/service/ScheduleJobService.java new file mode 100644 index 0000000..34d2a8a --- /dev/null +++ b/src/main/java/com/chenxuan/service/ScheduleJobService.java @@ -0,0 +1,92 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.entity.dto.ScheduleJobDto; +import com.chenxuan.entity.model.ScheduleJob; +import org.quartz.SchedulerException; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:ScheduleJobService + * @Description: 定时任务服务 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 8:58 PM + * @Version V1.0 + */ + +public interface ScheduleJobService extends IService { + + + /** + * 开启定时任务 + */ + void timingTask()throws SchedulerException; + + + /** + * 定时任务分页 + * + * @param dto + * @return + */ + Page queryPage(ScheduleJobDto dto); + + + /** + * 定时任务列表 + * + * @param params 查询参数 + */ + List getList(Map params); + + + /** + * 新增定时任务 + * + * @param job 任务 + */ + AjaxResult add(ScheduleJob job) throws SchedulerException; + + + /** + * 新增定时任务 + * + * @param job 任务 + */ + AjaxResult update(ScheduleJob job) throws SchedulerException; + + /** + * 启动定时任务 + * + * @param id 任务id + */ + boolean start(String[] jobIds) throws SchedulerException; + + /** + * 暂停定时任务 + * + * @param id 任务id + */ + boolean pause(String[] jobIds) throws SchedulerException; + + /** + * 删除定时任务 + * + * @param id 任务id + */ + AjaxResult delete(String[] jobIds) throws SchedulerException; + + /** + * 启动所有定时任务 + */ + void startAllJob() throws SchedulerException; + + /** + * 暂停所有定时任务 + */ + void pauseAllJob() throws SchedulerException; +} diff --git a/src/main/java/com/chenxuan/service/SysConfigService.java b/src/main/java/com/chenxuan/service/SysConfigService.java new file mode 100644 index 0000000..dd92186 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysConfigService.java @@ -0,0 +1,85 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysConfig; + +import javax.xml.namespace.QName; +import java.util.List; + +/** + *

+ * 参数配置表 服务类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +public interface SysConfigService extends IService { + + /** + * 查询参数配置信息 + * + * @param configId 参数配置ID + * @return 参数配置信息 + */ + SysConfig selectConfigById(Long configId); + + /** + * 根据键名查询参数配置信息 + * + * @param configKey 参数键名 + * @return 参数键值 + */ + Object selectConfigByKey(String configKey); + + /** + * 查询参数配置列表 + * + * @param query 参数配置信息 + * @return 参数配置集合 + */ + Page queryPage(Query query); + + /** + * 新增参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + boolean insertConfig(SysConfig config); + + /** + * 修改参数配置 + * + * @param config 参数配置信息 + * @return 结果 + */ + boolean updateConfig(SysConfig config); + + /** + * 删除参数配置信息 + * + * @param configId 参数ID + * @return 结果 + */ + boolean deleteConfigById(Long configId); + + /** + * 批量删除参数信息 + * + * @param configIds 需要删除的参数ID + * @return 结果 + */ + boolean deleteConfigByIds(Long[] configIds); + + /** + * 校验参数键名是否唯一 + * + * @param config 参数信息 + * @return 结果 + */ + boolean checkConfigKeyUnique(SysConfig config); +} diff --git a/src/main/java/com/chenxuan/service/SysDeptService.java b/src/main/java/com/chenxuan/service/SysDeptService.java new file mode 100644 index 0000000..febb833 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysDeptService.java @@ -0,0 +1,119 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.entity.vo.TreeSelect; + +import java.util.List; + +/** + *

+ * 部门表 服务类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +public interface SysDeptService extends IService { + + /** + * 查询部门管理数据 + * + * @return 部门信息集合 + */ + public List getDeptList(); + + + /** + * 查询部门管理数据 + * + * @return 部门信息集合 + */ + public List getDeptList(Query query); + + /** + * 构建前端所需要树结构 + * + * @param depts 部门列表 + * @return 树结构列表 + */ + public List buildDeptTree(List depts); + + + /** + * 构建前端所需要下拉树结构 + * + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + public List buildDeptTreeSelect(List depts); + + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + public Boolean checkDeptNameUnique(SysDept dept); + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public Boolean insertDept(SysDept dept); + + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public Boolean updateDept(SysDept dept); + + /** + * 是否存在部门子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean hasChildByDeptId(Long deptId); + + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean deleteDeptById(Long deptId); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + SysDept getByPK(Long deptId); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(Long roleId); +} diff --git a/src/main/java/com/chenxuan/service/SysDictDataService.java b/src/main/java/com/chenxuan/service/SysDictDataService.java new file mode 100644 index 0000000..c2feb5f --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysDictDataService.java @@ -0,0 +1,95 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDictData; + +import java.util.List; + + +/** + * @ClassName:SysDictDataService + * @Description: 字典数据表 服务类 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 4:55 PM + * @Version V1.0 + */ + +public interface SysDictDataService extends IService { + + /** + *@Description 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + List getDictDataByType(String dictType); + + + /** + * 根据条件分页查询字典数据 + * + * @param query 字典数据信息 + * @return 字典数据集合信息 + */ + Page selectDictDataPage(Query query); + + /** + * 根据字典类型查询字典数据 + * + * @param dictType 字典类型 + * @return 字典数据集合信息 + */ + List selectDictDataByType(String dictType); + + /** + * 根据字典类型和字典键值查询字典数据信息 + * + * @param dictType 字典类型 + * @param dictValue 字典键值 + * @return 字典标签 + */ + String selectDictLabel(String dictType, String dictValue); + + /** + * 根据字典数据ID查询信息 + * + * @param dictCode 字典数据ID + * @return 字典数据 + */ + SysDictData selectDictDataById(Long dictCode); + + /** + * 通过字典ID删除字典数据信息 + * + * @param dictCode 字典数据ID + * @return 结果 + */ + boolean deleteDictDataById(Long dictCode); + + /** + * 批量删除字典数据信息 + * + * @param dictCodes 需要删除的字典数据ID + * @return 结果 + */ + boolean deleteDictDataByIds(Long[] dictCodes); + + /** + * 新增保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + boolean insertDictData(SysDictData dictData); + + /** + * 修改保存字典数据信息 + * + * @param dictData 字典数据信息 + * @return 结果 + */ + boolean updateDictData(SysDictData dictData); +} diff --git a/src/main/java/com/chenxuan/service/SysDictTypeService.java b/src/main/java/com/chenxuan/service/SysDictTypeService.java new file mode 100644 index 0000000..12a40f0 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysDictTypeService.java @@ -0,0 +1,99 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDictType; + +import java.util.List; + +/** + *

+ * 字典类型表 服务类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +public interface SysDictTypeService extends IService { + + /** + * 根据条件分页查询字典类型 + * + * @param query 字典类型信息 + * @return 字典类型集合信息 + */ + Page selectDictTypePage(Query query); + + /** + * 根据条件查询字典类型 + * + * + * @return 字典类型集合信息 + */ + List selectDictTypeList (); + + /** + * 根据所有字典类型 + * + * @return 字典类型集合信息 + */ + List selectDictTypeAll(); + + /** + * 根据字典类型ID查询信息 + * + * @param dictId 字典类型ID + * @return 字典类型 + */ + SysDictType selectDictTypeById(Long dictId); + + /** + * 根据字典类型查询信息 + * + * @param dictType 字典类型 + * @return 字典类型 + */ + SysDictType selectDictTypeByType(String dictType); + + /** + * 通过字典ID删除字典信息 + * + * @param dictId 字典ID + * @return 结果 + */ + boolean deleteDictTypeById(Long dictId); + + /** + * 批量删除字典信息 + * + * @param dictIds 需要删除的字典ID + * @return 结果 + */ + boolean deleteDictTypeByIds(Long[] dictIds); + + /** + * 新增保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + boolean insertDictType(SysDictType dictType); + + /** + * 修改保存字典类型信息 + * + * @param dictType 字典类型信息 + * @return 结果 + */ + boolean updateDictType(SysDictType dictType); + + /** + * 校验字典类型称是否唯一 + * + * @param dictType 字典类型 + * @return 结果 + */ + boolean checkDictTypeUnique(SysDictType dictType); +} diff --git a/src/main/java/com/chenxuan/service/SysExecService.java b/src/main/java/com/chenxuan/service/SysExecService.java new file mode 100644 index 0000000..f5898e5 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysExecService.java @@ -0,0 +1,23 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysUser; + + +/** + * @ClassName:SysUserService + * @Description: 用户信息表 服务类. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 3:25 PM + * @Version V1.0 + */ +public interface SysExecService extends IService { + + + void runtimeExec(String command); + + +} diff --git a/src/main/java/com/chenxuan/service/SysExportDataService.java b/src/main/java/com/chenxuan/service/SysExportDataService.java new file mode 100644 index 0000000..157aa92 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysExportDataService.java @@ -0,0 +1,50 @@ +package com.chenxuan.service; + +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.dto.SysLoginLogDto; +import com.chenxuan.entity.dto.SysOperLogDto; +import com.chenxuan.entity.dto.SysRoleDto; + +public interface SysExportDataService { + + /** + * 导出当前页的操作日志 + * + * @param dto + * @return + */ + AjaxResult exportOperLog(SysOperLogDto dto); + + /** + * 导出当前页的登录日志 + * + * @param dto + * @return + */ + AjaxResult exportLoginLog(SysLoginLogDto dto); + + /** + * 导出用户信息 + * + * @param query + * @return + */ + AjaxResult exportUserInfo(Query query); + + /** + * 导出角色信息 + * + * @param dto + * @return + */ + AjaxResult exportRoleInfo(SysRoleDto dto); + + /** + * 导出字典信息 + * + * @param query + * @return + */ + AjaxResult exportDictInfo(Query query); +} diff --git a/src/main/java/com/chenxuan/service/SysLoginLogService.java b/src/main/java/com/chenxuan/service/SysLoginLogService.java new file mode 100644 index 0000000..a6f4f6b --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysLoginLogService.java @@ -0,0 +1,62 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysLoginLog; + +import java.util.List; + +/** + * @ClassName:SysLoginLogService + * @Description: 登录日志服务 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:15 PM + * @Version V1.0 + */ + +public interface SysLoginLogService extends IService { + + /** + * 新增系统登录日志 + * + * @param sysLoginLog 访问日志对象 + */ + void insertLoginLog(SysLoginLog sysLoginLog); + + + /** + * 查询系统登录日志集合 + * + * @param query + * @return 登录记录集合 + */ + Page selectLoginLogPage(Query query); + + + + /** + * 查询系统登录日志集合 + * + * @param query + * @return 登录记录集合 + */ + List selectLoginLogList(Query query); + + /** + * 批量删除系统登录日志 + * + * @param infoIds 需要删除的登录日志ID + * @return + */ + boolean deleteLoginLogByIds(Long[] infoIds); + + /** + * 清空系统登录日志 + */ + void cleanLoginLog(); + + + +} diff --git a/src/main/java/com/chenxuan/service/SysMenuService.java b/src/main/java/com/chenxuan/service/SysMenuService.java new file mode 100644 index 0000000..03eccab --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysMenuService.java @@ -0,0 +1,146 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysMenu; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.entity.vo.RouterVo; +import com.chenxuan.entity.vo.TreeSelect; + +import java.io.Serializable; +import java.util.List; +import java.util.Set; + +/** + * @ClassName:SysMenuService + * @Description: 菜单权限表 服务类. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:02 PM + * @Version V1.0 + */ +public interface SysMenuService extends IService { + + + /** + * 查询系统菜单列表 + * + * @return 菜单列表 + */ + public List getMenuList(); + + /** + * 查询系统菜单列表 + * + * @param query + * @return 菜单列表 + */ + public List getMenuList(Query query); + + /** + * @Description 根据用户ID查询权限 + * + * @param userId 用户ID + * @return java.util.Set ---权限列表 + **/ + public Set getMenuPermsByUserId(Long userId); + + + /** + * @Description 根据用户ID查询菜单树信息 + * + * @param userId 用户ID + * @return java.util.List -菜单列表 + */ + public List getMenuTreeByUserId(SysUser user); + + + /** + * @Description: 构建前端路由所需要的菜单 + * + * @Param menus 菜单列表 + * @Return: java.util.List 路由列表 + **/ + public List buildMenus(List menus); + + /** + * @Description: 根据主键获取 + * + * @Param pk 主键 + * @Return: SysMenu + **/ + public SysMenu getByPK(Serializable pk); + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildMenuTree(List menus); + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + public List buildMenuTreeSelect(List menus); + + /** + * 是否存在菜单子节点 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean hasChildByMenuId(Long menuId); + + /** + * 查询菜单是否存在角色 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkMenuExistRole(Long menuId); + + /** + * 新增保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean insertMenu(SysMenu menu); + + /** + * 修改保存菜单信息 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean updateMenu(SysMenu menu); + + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public boolean deleteMenuById(Long menuId); + + /** + * 校验菜单名称是否唯一 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean checkMenuNameUnique(SysMenu menu); + + /** + * 根据角色ID查询菜单树信息 + * + * @param roleId 角色ID + * @return 选中菜单列表 + */ + public List selectMenuListByRoleId(Long roleId); + + +} diff --git a/src/main/java/com/chenxuan/service/SysOperLogService.java b/src/main/java/com/chenxuan/service/SysOperLogService.java new file mode 100644 index 0000000..eeacf98 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysOperLogService.java @@ -0,0 +1,65 @@ +package com.chenxuan.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysOperLog; + +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:SysOperLogService + * @Description: 操作日志 服务层 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 11:17 AM + * @Version V1.0 + */ + +public interface SysOperLogService extends IService { + /** + * 新增操作日志 + * + * @param operLog 操作日志对象 + */ + void insertOperlog(SysOperLog operLog); + + /** + * 查询系统操作日志集合 + * + * @param query 操作日志对象 + * @return 操作日志集合 + */ + Page selectOperLogPage(Query query); + + /** + * 查询系统操作日志集合 + * + * @param params 操作日志对象 + * @return 操作日志集合 + */ + List selectOperLogList(Map params); + + /** + * 批量删除系统操作日志 + * + * @param operIds 需要删除的操作日志ID + * @return 结果 + */ + int deleteOperLogByIds(Long[] operIds); + + /** + * 查询操作日志详细 + * + * @param operId 操作ID + * @return 操作日志对象 + */ + SysOperLog selectOperLogById(Long operId); + + /** + * 清空操作日志 + */ + void cleanOperLog(); + +} diff --git a/src/main/java/com/chenxuan/service/SysPostService.java b/src/main/java/com/chenxuan/service/SysPostService.java new file mode 100644 index 0000000..c0e7e94 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysPostService.java @@ -0,0 +1,103 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysPost; + +import java.util.List; + +/** + *

+ * 岗位信息表 服务类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +public interface SysPostService extends IService { + + /** + * 列表 + * + * @return: List + **/ + List lists(); + + /** + * 分页 + * + * @param queryParam 分页条件 + * @return: Page + **/ + Page page(Query queryParam); + + /** + * 校验岗位名称 + * + * @param post 岗位信息 + * @return Boolean 结果 + */ + public Boolean checkPostNameUnique(SysPost post); + + /** + * 校验岗位编码 + * + * @param post 岗位信息 + * @return Boolean 结果 + */ + public Boolean checkPostCodeUnique(SysPost post); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public Boolean deleteById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + * @throws Exception 异常 + */ + public Boolean deleteByIds(Long[] postIds); + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public Boolean insertPost(SysPost post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public Boolean updatePost(SysPost post); + + + + /** + * 通过岗位ID查询岗位信息 + * + * @param postId 岗位ID + * @return 角色对象信息 + */ + public SysPost getByPK(Long postId); + + /** + * 根据用户ID获取岗位选择框列表 + * + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + +} diff --git a/src/main/java/com/chenxuan/service/SysRoleService.java b/src/main/java/com/chenxuan/service/SysRoleService.java new file mode 100644 index 0000000..f8a25d2 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysRoleService.java @@ -0,0 +1,150 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysRole; + + +import java.util.List; +import java.util.Set; + +/** + * @ClassName:SysRoleService + * @Description: 角色信息服务类 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:01 PM + * @Version V1.0 + */ +public interface SysRoleService extends IService { + + + /** + * 根据用户ID查询角色 + * + * @param userId 用户ID + * @return java.util.Set + */ + public Set getRolePermsByUserId(Long userId); + + /** + * 列表 + * + * @return java.util.Set + */ + List lists(); + + + /** + * 分页 + * + * @param query 分页条件 + * @return java.util.Set + */ + Page pages(Query query); + + /** + * 根据主键获取对象 + * + * @param pk 主键ID + * @return java.util.Set + */ + SysRole getByPK(Long pk); + + /** + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean checkRoleNameUnique(SysRole role); + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean checkRoleKeyUnique(SysRole role); + + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + public void checkRoleAllowed(SysRole role); + + /** + * 通过角色ID查询角色使用数量 + * + * @param roleId 角色ID + * @return 结果 + */ + public Boolean countUserRoleByRoleId(Long roleId); + + /** + * 新增保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean insertRole(SysRole role); + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean updateRole(SysRole role); + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean updateRoleStatus(SysRole role); + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + public Boolean authDataScope(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public Boolean deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public Boolean deleteRoleByIds(Long[] roleIds); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + +} diff --git a/src/main/java/com/chenxuan/service/SysUserOnlineService.java b/src/main/java/com/chenxuan/service/SysUserOnlineService.java new file mode 100644 index 0000000..9b36aec --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysUserOnlineService.java @@ -0,0 +1,51 @@ +package com.chenxuan.service; + +import com.chenxuan.entity.model.SysUserOnline; +import com.chenxuan.security.LoginUser; + +/** + * @ClassName:SysUserOnlineService + * @Description: 在线用户 服务层 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:24 PM + * @Version V1.0 + */ + +public interface SysUserOnlineService { + + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + SysUserOnline selectOnlineByUserName(String userName, LoginUser user); + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + SysUserOnline loginUserToUserOnline(LoginUser user); +} diff --git a/src/main/java/com/chenxuan/service/SysUserService.java b/src/main/java/com/chenxuan/service/SysUserService.java new file mode 100644 index 0000000..d441e76 --- /dev/null +++ b/src/main/java/com/chenxuan/service/SysUserService.java @@ -0,0 +1,164 @@ +package com.chenxuan.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysUser; + + +/** + * @ClassName:SysUserService + * @Description: 用户信息表 服务类. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 3:25 PM + * @Version V1.0 + */ +public interface SysUserService extends IService { + + /** + * @param userAccount + * @return com.chenxuan.entity.model.SysUser + * @Description 根据用户账户获取用户 + */ + SysUser findByUserAccount(String userAccount); + + /** + * @Description: 分页 + * @Param:queryParam + * @Return: com.baomidou.mybatisplus.extension.plugins.pagination.Page + **/ + Page page(Query queryParam); + + /** + * 通过用户ID查询用户 + * + * @param userId 用户ID + * @return 用户对象信息 + */ + SysUser selectUserById(Long userId); + + /** + * 根据用户ID查询用户所属角色组 + * + * @param userName 用户名 + * @return 结果 + */ + String selectUserRoleGroup(String userName); + + /** + * 根据用户ID查询用户所属岗位组 + * + * @param userName 用户名 + * @return 结果 + */ + String selectUserPostGroup(String userName); + + + /** + * 校验用户名称是否唯一 + * + * @param userName 用户名称 + * @return 结果 + */ + Boolean checkUserNameUnique(String userName); + + /** + * 校验手机号码是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean checkPhoneUnique(SysUser user); + Boolean checkPhoneUnique(String phone); + /** + * 校验email是否唯一 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean checkEmailUnique(SysUser user); + + /** + * 校验用户是否允许操作 + * + * @param user 用户信息 + */ + void checkUserAllowed(SysUser user); + + + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean insertUser(SysUser user); + + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean updateUser(SysUser user); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean updateUserStatus(SysUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean updateUserProfile(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + boolean updateUserAvatar(String userName, String avatar); + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + Boolean resetPwd(SysUser user); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + Boolean resetUserPwd(String userName, String password); + + /** + * 通过用户ID删除用户 + * + * @param userId 用户ID + * @return 结果 + */ + int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + int deleteUserByIds(Long[] userIds); +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiAmpliDayIncreaseServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiAmpliDayIncreaseServiceImpl.java new file mode 100644 index 0000000..7e52aca --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiAmpliDayIncreaseServiceImpl.java @@ -0,0 +1,59 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiAmpliDayIncrease; +import com.chenxuan.entity.vo.BusiAmpliDayIncreaseVo; +import com.chenxuan.mapper.BusiAmpliDayIncreaseMapper; +import com.chenxuan.service.BusiAmpliDayIncreaseService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + + +/** + * @ClassName:BusiAmpliDayIncreaseServiceImpl + * @Description: 振动装置日增长率服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/10/2020 11:10 AM + * @Version V1.0 + */ +@Service +public class BusiAmpliDayIncreaseServiceImpl extends ServiceImpl implements BusiAmpliDayIncreaseService { + + @Autowired + private BusiAmpliDayIncreaseMapper busiAmpliDayIncreaseMapper; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = busiAmpliDayIncreaseMapper.selectPages( page, query.getParams() ); + page.setRecords(records); + return page; + } + + @Override + public List selectAmpliDayIncreaseByMainId(String mainId) { + return busiAmpliDayIncreaseMapper.findAmpliDayIncreaseByMainId( mainId ); + } + + @Override + public boolean insertAmpliDayIncrease(BusiAmpliDayIncrease BusiAmpliDayIncrease) { + BusiAmpliDayIncrease.setId(UuidUtils.getUUID()); +// busiAmpliDayIncreaseMapper.saveAmpliDayIncrease( BusiAmpliDayIncrease ); + return false; + } + + @Override + public boolean updateAmpliDayIncrease(BusiAmpliDayIncrease BusiAmpliDayIncrease) { + return busiAmpliDayIncreaseMapper.updateAmpliDayIncrease( BusiAmpliDayIncrease ) > 0 ? true : false; + } + + @Override + public boolean delete(String id) { + int count = busiAmpliDayIncreaseMapper.delete(id); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiAmpliRealServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiAmpliRealServiceImpl.java new file mode 100644 index 0000000..924c2e9 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiAmpliRealServiceImpl.java @@ -0,0 +1,794 @@ +package com.chenxuan.service.impl; + +import Algorithm_vibration.cal; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiAmpliComtradResultDto; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.model.*; +import com.chenxuan.entity.vo.*; +import com.chenxuan.mapper.*; +import com.chenxuan.service.BusiAmpliRealService; +import com.chenxuan.utils.DateUtils; +import com.chenxuan.utils.StringUtils; +import com.mathworks.toolbox.javabuilder.MWClassID; +import com.mathworks.toolbox.javabuilder.MWException; +import com.mathworks.toolbox.javabuilder.MWNumericArray; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName:BusiAmpliRealServiceImpl + * @Description: 振动实时数据服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/17/2020 10:00 AM + * @Version V1.0 + */ +@Service +public class BusiAmpliRealServiceImpl extends ServiceImpl implements BusiAmpliRealService { + + @Autowired + private BusiAmpliRealMapper busiAmpliRealMapper; + + @Autowired + private BusiAmpliStatisticsMapper busiAmpliStatisticsMapper; + + @Autowired + private BusiAmpliComtradMapper busiAmpliComtradMapper; + + @Autowired + private BusiAmpliComtradResultMapper busiAmpliComtradResultMapper; + + @Override + public List selectShockRealByMainId(BusiAmpliRealDto dto) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00"); + dto.setInsTime(DateUtils.getDate()); + List list = busiAmpliRealMapper.findShockRealByMainId(dto); + List voList = new ArrayList(list.size()); + list.stream().forEach(bar -> { + // 因最大幅值過長將數值保留兩位小數並四捨五入 + if (StringUtils.isNotEmpty(bar.getMaxAmplitude()) && bar.getMaxAmplitude().contains(".")) { + Double.valueOf(bar.getMaxAmplitude()); + bar.setMaxAmplitude(new BigDecimal(bar.getMaxAmplitude()).setScale(2, RoundingMode.UP).toString()); + } + TableVo tVo = new TableVo(); + List rows = new ArrayList(); + // 创建三个colVo对象 + ColVo colVo1 = new ColVo(); + ColVo colVo2 = new ColVo(); + ColVo colVo3 = new ColVo(); + colVo1.setCol(sdf.format(bar.getInsTime())); + colVo2.setCol(bar.getFrequency()); + colVo3.setCol(bar.getMaxAmplitude()); + rows.add(colVo1); + rows.add(colVo2); + rows.add(colVo3); + tVo.setId(bar.getId()); + tVo.setRows(rows); + voList.add(tVo); + }); + return voList; + } + + @Override + public boolean insertShockReal(List busiAmpliReals) { + busiAmpliReals.stream().forEach(bar -> { + bar.setId(UuidUtils.getUUID()); + bar.setInsTime(new Date()); + bar.setHbaseRowkey(null); + }); + return busiAmpliRealMapper.saveShockReal(busiAmpliReals) > 0 ? true : false; + } + + @Override + public Page getShockRealDetailsByCondition(BusiAmpliRealDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + // 默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getBeforHourDate()); + } + List records = busiAmpliRealMapper.findShockRealDetailsByCondition(page, dto); + page.setRecords(records); + return page; + } + + @Override + public BusiAmpliRealVo getShockRealChartByInfo(BusiAmpliRealDto busiAmpliRealDto) { + // 根据所传信息查询振动实时数据 + List bsrList = null; + if (StringUtils.isEmpty(busiAmpliRealDto.getDateType())) { + busiAmpliRealDto.setDateType(BusiAmpliRealDto.D); + } + // 判断日期类型是那种--分为日/周/月/ + switch (busiAmpliRealDto.getDateType()) { + // 当日查询 + case BusiAmpliRealDto.D: + busiAmpliRealDto.setInsTime(DateUtils.getDate()); + bsrList = busiAmpliRealMapper.findShockRealChartByInfo(busiAmpliRealDto); + break; + // 过去一周查询 + case BusiAmpliRealDto.W: + busiAmpliRealDto.setStartTime(DateUtils.getWeekDate()); + busiAmpliRealDto.setEndTime(DateUtils.getDate()); + bsrList = busiAmpliStatisticsMapper.findAmpliStatisticsByMainIdAndCreateTime(busiAmpliRealDto); + break; + // 过去一月查询 + case BusiAmpliRealDto.M: + busiAmpliRealDto.setStartTime(DateUtils.getLastMonthDate()); + busiAmpliRealDto.setEndTime(DateUtils.getDate()); + bsrList = busiAmpliStatisticsMapper.findAmpliStatisticsByMainIdAndCreateTime(busiAmpliRealDto); + break; + } + List frequencyList = new ArrayList(bsrList.size()); + List maxAmplitudeList = new ArrayList(bsrList.size()); + // 去重 + bsrList.stream().distinct().collect(Collectors.toList()); + // 循环将数据都放在所在集合里 + bsrList.stream().forEach(bsr -> { + frequencyList.add(bsr.getFrequency()); + maxAmplitudeList.add(bsr.getMaxAmplitude()); + }); + BusiAmpliRealVo busiAmpliRealVo = new BusiAmpliRealVo(); + busiAmpliRealVo.setMainId(busiAmpliRealDto.getMainId()); + busiAmpliRealVo.setSide(busiAmpliRealDto.getSide()); + busiAmpliRealVo.setPhase(busiAmpliRealDto.getPhase()); + busiAmpliRealVo.setInOut(busiAmpliRealDto.getInOut()); + busiAmpliRealVo.setFrequencyList(frequencyList.stream().distinct().collect(Collectors.toList())); + busiAmpliRealVo.setMaxAmplitudeList(maxAmplitudeList); + return busiAmpliRealVo; + } + + @Override + public BusiAmpliRealVo getAmpliRealThreeChart(BusiAmpliRealDto busiAmpliRealDto) { + SimpleDateFormat sdf = new SimpleDateFormat("HH:00"); + List bsrList = null; + // 根据所传信息查询振动实时数据 + // 判断日期类型是那种--分为日/周/月/ + switch (busiAmpliRealDto.getDateType()) { + // 当日查询 + case BusiAmpliRealDto.D: + busiAmpliRealDto.setInsTime(DateUtils.getDate()); + bsrList = busiAmpliRealMapper.findShockRealChartByInfo(busiAmpliRealDto); + break; + // 过去一周查询 + case BusiAmpliRealDto.W: + busiAmpliRealDto.setStartTime(DateUtils.getWeekDate()); + busiAmpliRealDto.setEndTime(DateUtils.getDate()); + bsrList = busiAmpliRealMapper.findShockRealChartByInfo(busiAmpliRealDto); + break; + // 过去一月查询 + case BusiAmpliRealDto.M: + busiAmpliRealDto.setStartTime(DateUtils.getLastMonthDate()); + busiAmpliRealDto.setEndTime(DateUtils.getDate()); + bsrList = busiAmpliRealMapper.findShockRealChartByInfo(busiAmpliRealDto); + break; + } + // 声明一个变量作为备用 + int k = 0; + // 初始化各个数据需要的集合 + List times = new ArrayList<>(bsrList.size()); + List frequencyList = new ArrayList(bsrList.size()); + List maxAmplitudeList = new ArrayList<>(bsrList.size()); + List> arrays = new ArrayList<>(); + // 初始化x轴的时间和y轴的频率去重并排序的集合 + List finalTimes = times; + List finalFrequencyList = frequencyList; + // 将库中查出来的数据塞进不同的集合中以备后面使用 + bsrList.stream().forEach(bsr -> { + finalTimes.add(sdf.format(bsr.getInsTime())); + finalFrequencyList.add(bsr.getFrequency()); + maxAmplitudeList.add(new BigDecimal(bsr.getMaxAmplitude())); + }); + // 将x轴的时间和y轴的频率去重并排序 + times = times.stream().distinct().sorted().collect(Collectors.toList()); + frequencyList = frequencyList.stream().distinct().collect(Collectors.toList()); + // 封装三维图所需要的数据 + for (int i = 0; i < times.size(); i++) { + for (int j = 0; j < frequencyList.size(); j++) { + List array = new ArrayList(); + array.add(BigDecimal.valueOf(i)); + array.add(BigDecimal.valueOf(j)); + if (k < maxAmplitudeList.size()) { + array.add(maxAmplitudeList.get(k)); + } + arrays.add(array); + k++; + } + } + // 封装返回展示的数据 + BusiAmpliRealVo busiAmpliRealVo = new BusiAmpliRealVo(); + busiAmpliRealVo.setMainId(busiAmpliRealDto.getMainId()); + busiAmpliRealVo.setSide(busiAmpliRealDto.getSide()); + busiAmpliRealVo.setPhase(busiAmpliRealDto.getPhase()); + busiAmpliRealVo.setInOut(busiAmpliRealDto.getInOut()); + busiAmpliRealVo.setFrequencyList(frequencyList); + busiAmpliRealVo.setTimeList(times); + busiAmpliRealVo.setThreeChartList(arrays); + return busiAmpliRealVo; + } + + @Override + public Page showShockRealDetailsPages(BusiAmpliRealDto busiAmpliRealDto) { + Page page = new Page(busiAmpliRealDto.getPage(), busiAmpliRealDto.getLimit()); + List records = busiAmpliRealMapper.findShockRealDetailsPages(page, busiAmpliRealDto); + page.setRecords(records); + return page; + } + + @Override + public Map loadingDetails(BusiAmpliRealDto dto) { + // 查询 + List threeInfo = busiAmpliComtradResultMapper.findRealChartByThreeInfo(dto); + // 查询实时数据 + List ampliReals = busiAmpliRealMapper.findShockRealChartByInfo(dto); + // 查询数据是否存在 + if (!CollectionUtils.isEmpty(threeInfo)) { + return getThresholdConfVo(threeInfo, ampliReals); + } + // 查询录播数据 + List ampliComtrads = busiAmpliComtradMapper.findAmpliComtrad(dto); + List comtradDatas = new ArrayList<>(ampliComtrads.size()); + List ctdList = new ArrayList<>(); + List resList = new ArrayList<>(); + for (BusiAmpliComtrad comtrad : ampliComtrads) { + comtradDatas.add(comtrad.getComtradData()); + } + // 将数据库中的数据处理 + comtradDatas.stream().forEach(ctd -> { + ctdList.add(new ArrayList<>(CollectionUtils.arrayToList(ctd.split("\\|")))); + }); + // 以逗号分割开每个数据 + for (int i = 0; i < ctdList.get(0).size(); i++) { + resList.add(new ArrayList<>(Arrays.asList(ctdList.get(0).get(i).toString().split(",")))); + } + List newList = new ArrayList<>(resList.size()); + newList.addAll(resList); + // 移除数据中的序号和时间 + for (int i = 0; i < resList.size(); i++) { + newList.get(i).remove(0); + newList.get(i).remove(0); + } + try { + // 得到处理过的数据 + List dtos = callMatlab(newList, ampliComtrads.get(0).getId(), dto); + // 批量新增 + if (busiAmpliComtradResultMapper.batchInsertAmpliComtrad(dtos) > 0) { + // 查询 + return getThresholdConfVo(dtos, ampliReals); + } + } catch (MWException e) { + log.error("处理数据失败"); + } + return null; + } + + @Override + public Map recount(BusiAmpliRealDto dto) { +// //查询数据是否存在 +// List dayIncreaseVos = increaseMapper.getCurrentData(dto); +// //查询实时数据 +// List ampliReals = busiAmpliRealMapper.findShockRealChartByInfo(dto); +// //存在即返回数据即可 +// if (!CollectionUtils.isEmpty(dayIncreaseVos) && dayIncreaseVos.size() > 0) { +// return getThresholdConfVo(dayIncreaseVos, ampliReals); +// } +// //初始化数组 +// List todyResults =null, yesTerDayResults = null, lastMonthResults = null; +// //如果文件ID不存在 就不查询数据 +// if (StringUtils.isNotBlank(dto.getFileId())) { +// // 查询振动装置数据统计表中主变数量 +// dto.setInsTime(DateUtils.getDate()); +// //查询每个主变今日录播数据(录播数据) +// todyResults = busiAmpliComtradResultMapper.findRealChartByThreeInfo(dto); +// //查询每个主变昨日录播数据(录播数据) +// dto.setInsTime(DateUtils.getYesTerDayDate()); +// yesTerDayResults = busiAmpliComtradResultMapper.findRealChartByThreeInfo(dto); +// //查询每个主变30日之前录播数据(录播数据) +// dto.setInsTime(DateUtils.getLastMonthDate()); +// lastMonthResults = busiAmpliComtradResultMapper.findRealChartByThreeInfo(dto); +// } +// List increaseVoList = new ArrayList<>(); +// int addCount = 0; +// //判断今日录播数据是否为空 +// if (!CollectionUtils.isEmpty(todyResults)) { +// for (BusiAmpliComtradResult comtradResult : todyResults) { +// //判断昨日录播数据是否为空 +// if (!CollectionUtils.isEmpty(yesTerDayResults)) { +// for (int i = 0; i < yesTerDayResults.size(); i++) { +// //判断是否是同一个频率 +// if (comtradResult.getFrequency().equals(yesTerDayResults.get(i).getFrequency())) { +// //获得今日幅值 +// String maxAmplitudeToday = comtradResult.getMaxAmplitude(); +// BigDecimal todayData = new BigDecimal(maxAmplitudeToday); +// BusiAmpliDayIncreaseVo increaseVo = new BusiAmpliDayIncreaseVo(); +// //获得昨日幅值 +// String maxAmplitudeYesterdayData = todyResults.get(i).getMaxAmplitude(); +// BigDecimal yesterdayData = new BigDecimal(maxAmplitudeYesterdayData); +// //两日差值 +// BigDecimal decimal = todayData.subtract(yesterdayData); +// //计算日增长率 +// BigDecimal rateOfRiseByYesterday = decimal.divide(yesterdayData, 2, BigDecimal.ROUND_HALF_UP); +// //设值 +// increaseVo.setId(UuidUtils.getUUID()); +// increaseVo.setdTime(new Date()); +// increaseVo.setSubId(dto.getSubId()); +// increaseVo.setMainId(dto.getMainId()); +// increaseVo.setFileId(dto.getFileId()); +// increaseVo.setAmplitude(yesTerDayResults.get(i).getMaxAmplitude()); +// increaseVo.setDayRate(rateOfRiseByYesterday.toString()); +// increaseVo.setFrequency(comtradResult.getFrequency()); +// //判断30天前的数据是否为空 +// if (!CollectionUtils.isEmpty(lastMonthResults)) { +// //获得30日之前幅值 +// String maxAmplitudebeforeOneMonthdayData = lastMonthResults.get(i).getMaxAmplitude(); +// BigDecimal beforeOneMonthdayData = new BigDecimal(maxAmplitudebeforeOneMonthdayData); +// //两日差值 +// BigDecimal bigDecimal = todayData.subtract(beforeOneMonthdayData); +// //计算月增长率 +// BigDecimal rateOfRiseBybeforeOneMonth = bigDecimal.divide(beforeOneMonthdayData, 2, BigDecimal.ROUND_HALF_UP); +// increaseVo.setMonthRate(rateOfRiseBybeforeOneMonth.toString()); +// //计算月偏差率 +// increaseVo.setDeviationRate(rateOfRiseBybeforeOneMonth.toString()); +// } +// increaseVoList.add(increaseVo); +// } +// } +// } +// } +// //判断集合是否为空 +// if (!CollectionUtils.isEmpty(increaseVoList)) { +// addCount = increaseMapper.saveAmpliDayIncrease(increaseVoList); +// } +// } +// //判断数据已经入库 +// if (addCount > 0) { +// dayIncreaseVos = increaseMapper.getCurrentData(dto); +// } +// return getThresholdConfVo(dayIncreaseVos, ampliReals); + return null; + } + + /** + * 封装数据 + * + * @param threeInfo + * @param ampliReals + * @return + */ + private Map getThresholdConfVo(List threeInfo, List ampliReals) { + List comtradAmplitudeList = new ArrayList<>(threeInfo.size()); + List ampliAmplitudes = new ArrayList<>(ampliReals.size()); + LinkedHashSet frequencyList = new LinkedHashSet<>(ampliReals.size()); + Map result = new HashMap<>(); + // 实时数据 + ampliReals.stream().forEach(busiAmpliReal -> { + ampliAmplitudes.add(busiAmpliReal.getMaxAmplitude()); + }); + // 录播文件数据 + threeInfo.stream().forEach(currentData -> { + comtradAmplitudeList.add(currentData.getMaxAmplitude()); + frequencyList.add(currentData.getFrequency()); + }); + result.put("ampliAmplitudes", ampliAmplitudes); + result.put("maxAmplitudeList", comtradAmplitudeList); + result.put("frequencyList", frequencyList); + return result; + } + + /** + * 得到返回对象数据 + * + * @param dto + * @param threeInfo + * @return + */ + private BusiAmpliRealVo getAmpliComtradVo(BusiAmpliRealDto dto, List threeInfo) { + BusiAmpliRealVo busiAmpliRealVo = new BusiAmpliRealVo(); + List frequencyList = new ArrayList(threeInfo.size()); + List maxAmplitudeList = new ArrayList(threeInfo.size()); + // 循环将数据都放在所在集合里 + threeInfo.stream().forEach(bsr -> { + frequencyList.add(bsr.getFrequency()); + maxAmplitudeList.add(bsr.getMaxAmplitude()); + }); + busiAmpliRealVo.setMainId(dto.getMainId()); + busiAmpliRealVo.setSide(dto.getSide()); + busiAmpliRealVo.setPhase(dto.getPhase()); + busiAmpliRealVo.setInOut(dto.getInOut()); + busiAmpliRealVo.setFrequencyList(frequencyList); + busiAmpliRealVo.setMaxAmplitudeList(maxAmplitudeList); + return busiAmpliRealVo; + } + + /** + * 为调用matlab的算法做准备 + * + * @param newList + * @param fileId + * @param realDto + * @return + * @throws MWException + */ + private List callMatlab(List newList, String fileId, BusiAmpliRealDto realDto) throws MWException { + List resultDtos = new ArrayList<>(); + // 用于保存输入矩阵 + MWNumericArray input1, input2, input3; + // 声明原副边从A相到C相的上下侧 + int[] pauArray = new int[10000]; + int[] padArray = new int[10000]; + int[] pbuArray = new int[10000]; + int[] pbdArray = new int[10000]; + int[] pcuArray = new int[10000]; + int[] pcdArray = new int[10000]; + int[] sauArray = new int[10000]; + int[] sduArray = new int[10000]; + int[] sbuArray = new int[10000]; + int[] sbdArray = new int[10000]; + int[] scuArray = new int[10000]; + int[] scdArray = new int[10000]; + // 循环根据A相到C相的上下侧赋值 + for (int i = 0; i < newList.size(); i++) { + pauArray[i] = Integer.parseInt(newList.get(i).get(0).toString()); + padArray[i] = Integer.parseInt(newList.get(i).get(1).toString()); + pbuArray[i] = Integer.parseInt(newList.get(i).get(2).toString()); + pbdArray[i] = Integer.parseInt(newList.get(i).get(3).toString()); + pcuArray[i] = Integer.parseInt(newList.get(i).get(4).toString()); + pcdArray[i] = Integer.parseInt(newList.get(i).get(5).toString()); + sauArray[i] = Integer.parseInt(newList.get(i).get(6).toString()); + sduArray[i] = Integer.parseInt(newList.get(i).get(7).toString()); + sbuArray[i] = Integer.parseInt(newList.get(i).get(8).toString()); + sbdArray[i] = Integer.parseInt(newList.get(i).get(9).toString()); + scuArray[i] = Integer.parseInt(newList.get(i).get(10).toString()); + scdArray[i] = Integer.parseInt(newList.get(i).get(11).toString()); + } + // 声明二维数组 + int[][] arrayList = {pauArray, padArray, pbuArray, pbdArray, pcuArray, + pcdArray, sauArray, sduArray, sbuArray, sbdArray, scuArray, scdArray}; + for (int i = 0; i < arrayList.length; i++) { + // 将调用matlab的数据转换下 + input1 = new MWNumericArray(arrayList[i], MWClassID.DOUBLE); + input2 = new MWNumericArray(10000, MWClassID.DOUBLE); + input3 = new MWNumericArray(1, MWClassID.DOUBLE); + cal cal = new cal(); + // 调取matlab算法进行数据处理 + Object[] ampExtra = cal.single_Amp_Extra(2, input1, input2, input3); + List dtos = processData(ampExtra, i, fileId, realDto); + resultDtos.addAll(dtos); + } + return resultDtos; + } + + /** + * 将返回的结果进行处理得到java模式 + * + * @param ampExtra + * @param i + * @param fileId + * @param realDto + * @return + */ + private List processData(Object[] ampExtra, int i, String fileId, BusiAmpliRealDto realDto) { + List amplitudeList = new ArrayList<>(); + // 得到算法的结果值 + MWNumericArray output2 = (MWNumericArray) ampExtra[1]; + double[][] doubleArray = (double[][]) output2.toDoubleArray(); + int k = 1; + int m = 2; + if (ampExtra[0].toString().equals("3")) { + switch (i) { + case 0: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.APHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 1: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.APHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 2: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.BPHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 3: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.BPHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 4: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.CPHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 5: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.PRISIDE); + dto.setPhase(BusiAmpliComtradResultDto.CPHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 6: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.APHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 7: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.APHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 8: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.BPHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 9: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.BPHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 10: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.CPHASE); + dto.setInOut(BusiAmpliComtradResultDto.UINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + case 11: + for (int j = 0; j < doubleArray[0].length; j++) { + BusiAmpliComtradResultDto dto = new BusiAmpliComtradResultDto(); + // 频率值 + int frequency = 50 * (j + k); + // 当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setId(UuidUtils.getUUID()); + dto.setFileId(fileId); + dto.setMainId(realDto.getMainId()); + dto.setSubId(realDto.getSubId()); + dto.setSide(BusiAmpliComtradResultDto.SECSIDE); + dto.setPhase(BusiAmpliComtradResultDto.CPHASE); + dto.setInOut(BusiAmpliComtradResultDto.DINOUT); + dto.setFrequency(String.valueOf(frequency)); + dto.setMaxAmplitude(new BigDecimal(doubleArray[0][j]).setScale(2, RoundingMode.UP).toString()); + dto.setInsTime(new Date()); + amplitudeList.add(dto); + } + break; + } + } + return amplitudeList; + } + + @Override + public List selectMainDeviceList() { + return busiAmpliRealMapper.selectMainDeviceList(); + } + + @Override + public List selectShockRealDataByMainId(String mainId) { + Map map = new HashMap<>(); + map.put("main_id", mainId); + return busiAmpliRealMapper.selectByMap(map); + } + + @Override + public List selectShockRealFrequencyByMainId(String mainId) { + return busiAmpliRealMapper.selectShockRealFrequencyByMainId(mainId); + } + + @Override + public List selectShockRealDataByMainIdAndParseAndSideAndInout(String mainId, String P, String A, String U) { + Map map = new HashMap<>(); + map.put("main_id", mainId); + map.put("side", P); + map.put("phase", A); + map.put("in_out", U); + return busiAmpliRealMapper.selectByMap(map); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiAmpliStatisticsServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiAmpliStatisticsServiceImpl.java new file mode 100644 index 0000000..3c50542 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiAmpliStatisticsServiceImpl.java @@ -0,0 +1,27 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.entity.model.BusiAmpliStatistics; +import com.chenxuan.mapper.BusiAmpliStatisticsMapper; +import com.chenxuan.service.BusiAmpliStatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-07-09 4:17 PM + **/ +@Service +public class BusiAmpliStatisticsServiceImpl extends ServiceImpl implements BusiAmpliStatisticsService { + + @Autowired + private BusiAmpliStatisticsMapper BusiAmpliStatisticsMapper; + + @Override + public List selectMainDeviceList() { + return BusiAmpliStatisticsMapper.selectMainDeviceList(); + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiAmpliThresholdConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiAmpliThresholdConfServiceImpl.java new file mode 100644 index 0000000..63f847b --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiAmpliThresholdConfServiceImpl.java @@ -0,0 +1,1006 @@ +package com.chenxuan.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiAmpliThresholdConfDto; +import com.chenxuan.entity.model.BusiAmpliThresholdConf; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfNewVo; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfVo; +import com.chenxuan.entity.vo.BusiFrequencyConfVo; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiAmpliThresholdConfMapper; +import com.chenxuan.mapper.BusiFrequencyConfMapper; +import com.chenxuan.mapper.BusiSubDeviceMapper; +import com.chenxuan.service.BusiAmpliThresholdConfService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @ClassName:BusiAmpliThresholdConfServiceImpl + * @Description: 振动装置阈值配置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:48 PM + * @Version V1.0 + */ +@Service +public class BusiAmpliThresholdConfServiceImpl extends ServiceImpl implements BusiAmpliThresholdConfService { + + @Autowired + private BusiAmpliThresholdConfMapper busiAmpliThresholdConfMapper; + + @Autowired + private BusiFrequencyConfMapper busiFrequencyConfMapper; + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Override + public Page page(BusiAmpliThresholdConfDto dto) { + dto.setLimit("999"); + Page page = new Page(dto.getPage(), dto.getLimit()); + Page page1 = new Page(dto.getPage(), dto.getLimit()); + List records = busiAmpliThresholdConfMapper.selectPages(page, dto); + // 获取频率配置信息 + Map map = new HashMap<>(); + map.put("state", 1); + List busiFrequencyConfs = busiFrequencyConfMapper.selectConfs(map); + List newRecords = new ArrayList<>(); + // 循环频率 + for (BusiFrequencyConfVo busiFrequencyConf : busiFrequencyConfs) { + // 每档频率生成一条数据 + BusiAmpliThresholdConfNewVo thresholdConfNewVo = new BusiAmpliThresholdConfNewVo(); + thresholdConfNewVo.setFrequency(busiFrequencyConf.getFrequency()); + thresholdConfNewVo.setFrequencyId(busiFrequencyConf.getId()); + for (BusiAmpliThresholdConfVo record : records) { + // A相上 + if ("P".equals(record.getSide()) && "A".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setAUpSubId(record.getSubId()); + thresholdConfNewVo.setAUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setAUpDay(record.getDayRate()); + thresholdConfNewVo.setAUpMonth(record.getMonthRate()); + thresholdConfNewVo.setAUpDeviationRatio(record.getDeviationRate()); + } + // A相下 + if ("P".equals(record.getSide()) && "A".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setADownSubId(record.getSubId()); + thresholdConfNewVo.setADownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setADownDay(record.getDayRate()); + thresholdConfNewVo.setADownMonth(record.getMonthRate()); + thresholdConfNewVo.setADownDeviationRatio(record.getDeviationRate()); + } + // B相上 + if ("P".equals(record.getSide()) && "B".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setBUpSubId(record.getSubId()); + thresholdConfNewVo.setBUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setBUpDay(record.getDayRate()); + thresholdConfNewVo.setBUpMonth(record.getMonthRate()); + thresholdConfNewVo.setBUpDeviationRatio(record.getDeviationRate()); + } + // B相下 + if ("P".equals(record.getSide()) && "B".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setBDownSubId(record.getSubId()); + thresholdConfNewVo.setBDownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setBDownDay(record.getDayRate()); + thresholdConfNewVo.setBDownMonth(record.getMonthRate()); + thresholdConfNewVo.setBDownDeviationRatio(record.getDeviationRate()); + } + + // C相上 + if ("P".equals(record.getSide()) && "C".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setCUpSubId(record.getSubId()); + thresholdConfNewVo.setCUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setCUpDay(record.getDayRate()); + thresholdConfNewVo.setCUpMonth(record.getMonthRate()); + thresholdConfNewVo.setCUpDeviationRatio(record.getDeviationRate()); + } + // C相下 + if ("P".equals(record.getSide()) && "C".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setCDownSubId(record.getSubId()); + thresholdConfNewVo.setCDownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setCDownDay(record.getDayRate()); + thresholdConfNewVo.setCDownMonth(record.getMonthRate()); + thresholdConfNewVo.setCDownDeviationRatio(record.getDeviationRate()); + } + + // A相上 + if ("S".equals(record.getSide()) && "A".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setAUpSubId(record.getSubId()); + thresholdConfNewVo.setAUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setAUpDay(record.getDayRate()); + thresholdConfNewVo.setAUpMonth(record.getMonthRate()); + thresholdConfNewVo.setAUpDeviationRatio(record.getDeviationRate()); + } + // A相下 + if ("S".equals(record.getSide()) && "A".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setADownSubId(record.getSubId()); + thresholdConfNewVo.setADownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setADownDay(record.getDayRate()); + thresholdConfNewVo.setADownMonth(record.getMonthRate()); + thresholdConfNewVo.setADownDeviationRatio(record.getDeviationRate()); + } + // B相上 + if ("S".equals(record.getSide()) && "B".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setBUpSubId(record.getSubId()); + thresholdConfNewVo.setBUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setBUpDay(record.getDayRate()); + thresholdConfNewVo.setBUpMonth(record.getMonthRate()); + thresholdConfNewVo.setBUpDeviationRatio(record.getDeviationRate()); + } + // B相下 + if ("S".equals(record.getSide()) && "B".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setBDownSubId(record.getSubId()); + thresholdConfNewVo.setBDownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setBDownDay(record.getDayRate()); + thresholdConfNewVo.setBDownMonth(record.getMonthRate()); + thresholdConfNewVo.setBDownDeviationRatio(record.getDeviationRate()); + } + + // C相上 + if ("S".equals(record.getSide()) && "C".equals(record.getPhase()) && "U".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setCUpSubId(record.getSubId()); + thresholdConfNewVo.setCUpAppreciation(record.getAmplitude()); + thresholdConfNewVo.setCUpDay(record.getDayRate()); + thresholdConfNewVo.setCUpMonth(record.getMonthRate()); + thresholdConfNewVo.setCUpDeviationRatio(record.getDeviationRate()); + } + // C相下 + if ("S".equals(record.getSide()) && "C".equals(record.getPhase()) && "D".equals(record.getInAndOut()) && busiFrequencyConf.getId().equals(record.getFrequencyId())) { + thresholdConfNewVo.setId(record.getId()); + thresholdConfNewVo.setCDownSubId(record.getSubId()); + thresholdConfNewVo.setCDownAppreciation(record.getAmplitude()); + thresholdConfNewVo.setCDownDay(record.getDayRate()); + thresholdConfNewVo.setCDownMonth(record.getMonthRate()); + thresholdConfNewVo.setCDownDeviationRatio(record.getDeviationRate()); + } + if (StringUtils.isNotBlank(thresholdConfNewVo.getId())) { + newRecords.add(thresholdConfNewVo); + } + } + if (StringUtils.isNotBlank(thresholdConfNewVo.getFrequencyId())) { + newRecords.add(thresholdConfNewVo); + } + } + // 因为产生的重复数很多必须去重 + page1.setRecords(newRecords.stream().distinct().collect(Collectors.toList())); + return page1; + } + + @Override + public List selectThresholdConfByMainId(String mainId) { + return busiAmpliThresholdConfMapper.findThresholdConfByMainId(mainId); + } + + @Override + public boolean insertThresholdConf(List busiAmpliThresholdConfList) { + for (BusiAmpliThresholdConf batc : busiAmpliThresholdConfList) { + batc.setId(UuidUtils.getUUID()); + batc.setInsTime(new Date()); + } + return busiAmpliThresholdConfMapper.saveThresholdConf(busiAmpliThresholdConfList) > 0 ? true : false; + } + + private Map setParam(String mainId, String side, String phase, String inOut) { + Map params = new HashMap<>(); + params.put("mainId", mainId); + params.put("side", side); + params.put("phase", phase); + params.put("inOut", inOut); + return params; + } + + @Override + public boolean updateThresholdConf(BusiAmpliThresholdConfNewVo batcv) { + BusiAmpliThresholdConfNewVo content = batcv.getContent(); + // A相上幅值 + if ("appreciationBool".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getAUpAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getAUpAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getAUpAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相上日增长率 + if ("appreciationBool1".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getAUpDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getAUpDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getAUpDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相上月增长率 + if ("appreciationBool2".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getAUpMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getAUpMonth()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getAUpMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相上偏差率 + if ("appreciationBool3".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getAUpDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getAUpDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDeviationRate(content.getAUpDeviationRatio()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相下幅值 + if ("appreciationBool4".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getADownAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getADownAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getADownAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相下日增长率 + if ("appreciationBool5".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getADownDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getADownDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getADownDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相下月增长率 + if ("appreciationBool6".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getADownMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getADownMonth()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getADownMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // A相下偏差率 + if ("appreciationBool7".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "A", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getADownDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getADownDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDeviationRate(content.getADownDeviationRatio()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相上幅值 + if ("appreciationBool8".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBUpAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getBUpAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getBUpAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相上日增长率 + if ("appreciationBool9".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBUpDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getBUpDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getBUpDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相上月增长率 + if ("appreciationBool10".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getFrequencyId()); + //根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBUpMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + //设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getBUpMonth()); + //更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + //未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + //有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getBUpMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + //B相上偏差率 + if ("appreciationBool11".equals(batcv.getColumn())) { + //根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBUpDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getBUpDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDeviationRate(content.getBUpDeviationRatio()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相下幅值 + if ("appreciationBool12".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBDownAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getBDownAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getBDownAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相下日增长率 + if ("appreciationBool13".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBDownDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getBDownDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getBDownDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相下月增长率 + if ("appreciationBool14".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBDownMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getBDownMonth()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getBDownMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // B相下偏差率 + if ("appreciationBool15".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "B", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getBDownDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getBDownDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDeviationRate(content.getBDownDeviationRatio()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + + // C相上幅值 + if ("appreciationBool16".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCUpAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getCUpAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getCUpAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相上日增长率 + if ("appreciationBool17".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCUpDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getCUpDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getCUpDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相上月增长率 + if ("appreciationBool18".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCUpMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getCUpMonth()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getCUpMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相上偏差率 + if ("appreciationBool19".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "U")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCUpDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getCUpDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDeviationRate(content.getCUpDeviationRatio()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相下幅值 + if ("appreciationBool20".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCDownAppreciation())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setAmplitude(content.getCDownAppreciation()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setAmplitude(content.getCDownAppreciation()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相下日增长率 + if ("appreciationBool21".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCDownDay())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDayRate(content.getCDownDay()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setDayRate(content.getCDownDay()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相下月增长率 + if ("appreciationBool22".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCDownMonth())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setMonthRate(content.getCDownMonth()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf busiAmpliThresholdConf = new BusiAmpliThresholdConf(); + busiAmpliThresholdConf.setMonthRate(content.getCDownMonth()); + return addThresholdConf(content, subDevice, busiAmpliThresholdConf); + } + } + } + // C相下偏差率 + if ("appreciationBool23".equals(batcv.getColumn())) { + // 根据主变id和其他信息得到装置信息 + BusiSubDeviceVo subDevice = busiSubDeviceMapper.findSubDevice(setParam(batcv.getMainId(), batcv.getSide(), + "C", "D")); + if (ObjectUtil.isNull(subDevice)) { + return false; + } + String frequencyId = content.getFrequencyId(); + Map map = new HashMap<>(); + map.put("frequencyid", frequencyId); + map.put("sub_id", subDevice.getId()); +// map.put("id", content.getId()); + // 根据频率id和阈值id找到对应实体 + List busiAmpliThresholdConfs = busiAmpliThresholdConfMapper.selectByMap(map); + if (StringUtils.isNotBlank(content.getCDownDeviationRatio())) { + if (busiAmpliThresholdConfs.size() > 0) { + BusiAmpliThresholdConf busiAmpliThresholdConf = busiAmpliThresholdConfs.get(0); + // 设置幅值 + busiAmpliThresholdConf.setDeviationRate(content.getCDownDeviationRatio()); + // 更新字段 + busiAmpliThresholdConfMapper.updateById(busiAmpliThresholdConf); + } + // 未找到振动阈值实体 + if (CollectionUtils.isEmpty(busiAmpliThresholdConfs)) { + // 有装置id 新建阈值配置信息 + BusiAmpliThresholdConf thresholdConf = new BusiAmpliThresholdConf(); + thresholdConf.setDeviationRate(content.getCDownDeviationRatio()); + return addThresholdConf(content, subDevice, thresholdConf); + } + } + } + return true; + } + + /** + * @param content + * @param subDevice + * @param thresholdConf + * @return + */ + private boolean addThresholdConf(BusiAmpliThresholdConfNewVo content, + BusiSubDeviceVo subDevice, + BusiAmpliThresholdConf thresholdConf) { + // 有装置id 新建阈值配置信息 + thresholdConf.setId(UuidUtils.getUUID()); + thresholdConf.setInsTime(new Date()); + thresholdConf.setSubId(subDevice.getId()); + thresholdConf.setFrequencyId(content.getFrequencyId()); + return busiAmpliThresholdConfMapper.insert(thresholdConf) > 0 ? true : false; + } + + @Override + public boolean delete(String id) { + int count = busiAmpliThresholdConfMapper.delete(id); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiCalcParamConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiCalcParamConfServiceImpl.java new file mode 100644 index 0000000..fe9384e --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiCalcParamConfServiceImpl.java @@ -0,0 +1,102 @@ +package com.chenxuan.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.dto.BusiCalcParamConfDto; +import com.chenxuan.entity.model.BusiCalcParamConf; +import com.chenxuan.entity.vo.BusiCalcParamConfVo; +import com.chenxuan.mapper.BusiCalcParamConfMapper; +import com.chenxuan.service.BusiCalcParamConfService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-06-28 8:37 PM + **/ +@Service +public class BusiCalcParamConfServiceImpl extends ServiceImpl implements BusiCalcParamConfService { + + @Autowired + private BusiCalcParamConfMapper busiCalcParamConfMapper; + + @Override + public void initBusiParams(String token, String siteId, String mainId) { + + } + + @Override + public List findBusiParamGis(String mainId) { + List resultList = busiCalcParamConfMapper.findFirstLevelParams(mainId); + setChildren(resultList); + return resultList; + } + + private void setChildren(List paramList) { + if (CollectionUtils.isEmpty(paramList)) { + return; + } + for (BusiCalcParamConfVo param : paramList) { + List children = busiCalcParamConfMapper.findSubParams( + param.getMainId(), param.getName()); + param.setChildren(children); + setChildren(children); + } + } + + @Override + public AjaxResult saveBusiParamGis(List busiParams) { + // 初始化一个集合 + List calcParamConfDtos = new ArrayList<>(busiParams.size()); + // 将参与评测的参数放到一个新的集合中 + busiParams.stream().forEach( param -> { + BusiCalcParamConfDto paramConfDto = new BusiCalcParamConfDto(); + // 判断是否属于参与(0:不参与 1:参与) + if (param.getIsAttend().equals("1")) { + paramConfDto.setId(param.getId()); + paramConfDto.setValue(param.getValue()); + calcParamConfDtos.add(paramConfDto); + } + }); + // 批量新增 + int paramConf = busiCalcParamConfMapper.batchUpdateCalaParamConf(calcParamConfDtos); + // 新增成功 + if (paramConf > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "保存成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "保存失败"); + } + + /** + * 处理数据 + * + * @param busiParams + * @return + */ + private List getChildren(List busiParams, List calcParamConfDtos) { + // 判断集合是否为空 + if (CollectionUtils.isEmpty(busiParams)) { + return calcParamConfDtos; + } + // 循环使用递归将数据放进一个集合里 + for (BusiCalcParamConfDto param : busiParams) { + BusiCalcParamConfDto paramConfDto = new BusiCalcParamConfDto(); + if (param.getIsAttend().equals("1")) { + paramConfDto.setId(param.getId()); + paramConfDto.setValue(param.getValue()); + calcParamConfDtos.add(paramConfDto); + } + if (CollectionUtil.isNotEmpty(param.getChildren())) { + getChildren(param.getChildren(), calcParamConfDtos); + } + } + return calcParamConfDtos; + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiCenterRealServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiCenterRealServiceImpl.java new file mode 100644 index 0000000..2ba1072 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiCenterRealServiceImpl.java @@ -0,0 +1,153 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.model.BusiCenterReal; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.vo.BusiCenterRealDetailsVo; +import com.chenxuan.entity.vo.BusiCenterRealVo; +import com.chenxuan.entity.vo.ColVo; +import com.chenxuan.entity.vo.TableVo; +import com.chenxuan.mapper.BusiCenterRealMapper; +import com.chenxuan.mapper.BusiMainDeviceMapper; +import com.chenxuan.service.BusiCenterRealService; +import com.chenxuan.utils.DateUtils; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @ClassName:BusiCenterRealServiceImpl + * @Description: 中心点实时数据服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:50 PM + * @Version V1.0 + */ +@Service +public class BusiCenterRealServiceImpl extends ServiceImpl implements BusiCenterRealService { + + @Autowired + private BusiCenterRealMapper busiCenterRealMapper; + + @Autowired + private BusiMainDeviceMapper busiMainDeviceMapper; + + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + @Override + public List selectCenterRealByMainId(String mainId) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00"); + List list = busiCenterRealMapper.findCenterRealByMainId(mainId, DateUtils.getDate()); + List voList = new ArrayList(list.size()); + list.stream().forEach(bcr -> { + TableVo tVo = new TableVo(); + List rows = new ArrayList(); + // 创建三个colVo对象 + ColVo colVo1 = new ColVo(); + ColVo colVo2 = new ColVo(); + ColVo colVo3 = new ColVo(); + colVo1.setCol(sdf.format(bcr.getInsTime())); + colVo3.setCol(bcr.getMaxAmplitude()); + rows.add(colVo1); + rows.add(colVo2); + rows.add(colVo3); + tVo.setId(bcr.getId()); + tVo.setRows(rows); + voList.add(tVo); + }); + return voList; + } + + @Override + public boolean insertCenterReal(List busiCenterRealList) { + busiCenterRealList.stream().forEach(bcr -> { + bcr.setId(UuidUtils.getUUID()); + bcr.setInsTime(new Date()); + bcr.setHbaseRowkey(null); + }); + return busiCenterRealMapper.saveCenterReal(busiCenterRealList) > 0 ? true : false; + } + + @Override + public BusiCenterRealVo findCenterRealChartByInfo(BusiCenterRealDto busiCenterRealDto) { + SimpleDateFormat sdf = new SimpleDateFormat("HH"); + // 根据所传信息查询振动实时数据 + busiCenterRealDto.setInsTime(DateUtils.getDate()); + List centerReals = busiCenterRealMapper.findCenterRealChartByInfo(busiCenterRealDto); + List gatherTimeList = new ArrayList(centerReals.size()); + List maxAmplitudeList = new ArrayList(centerReals.size()); + // 循环将数据都放在所在集合里 + centerReals.stream().forEach(crcb -> { + gatherTimeList.add(sdf.format(crcb.getInsTime())); + maxAmplitudeList.add(crcb.getMaxAmplitude()); + }); + BusiCenterRealVo busiCenterRealVo = new BusiCenterRealVo(); + busiCenterRealVo.setMainId(busiCenterRealDto.getMainId()); + busiCenterRealVo.setGatherTimeList(gatherTimeList); + busiCenterRealVo.setMaxAmplitudeList(maxAmplitudeList); + return busiCenterRealVo; + } + + @Override + public BusiCenterRealVo selectCenterRealByMainIdAndCreateTime(BusiCenterRealVo busiCenterRealVo) { + if (StringUtils.isEmpty(busiCenterRealVo.getMainId()) && StringUtils.isEmpty(busiCenterRealVo.getCreateTime())) { + BusiMainDevice busiMainDevice = busiMainDeviceMapper.findLatestMainDeviceByCondition(); + busiCenterRealVo.setMainId(busiMainDevice.getId()); + busiCenterRealVo.setCreateTime(sdf.format(new Date())); + } + List bcrList = busiCenterRealMapper.findCenterRealByMainIdAndCreateTime(busiCenterRealVo); + List gatherTimeList = new ArrayList(); + List maxAmplitudeList = new ArrayList(); + // 处理时间为小时 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH"); + // 循环将数据都放在所在集合里 + bcrList.stream().forEach(bcr -> { + gatherTimeList.add(simpleDateFormat.format(bcr.getInsTime())); + maxAmplitudeList.add(bcr.getMaxAmplitude()); + }); + BusiCenterRealVo bcrVo = new BusiCenterRealVo(); + if (bcrList.size() > 0) { + bcrVo.setMainId(bcrList.get(0).getMainId()); + } + bcrVo.setGatherTimeList(gatherTimeList); + bcrVo.setMaxAmplitudeList(maxAmplitudeList); + return bcrVo; + } + + @Override + public Page getCenterRealDetails(BusiCenterRealDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = busiCenterRealMapper.findCenterRealDetailsByMainId(page, dto); + page.setRecords(records); + return page; + } + + @Override + public Page getCenterRealDetailsByMainId(BusiCenterRealDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + // 默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getDate()); + } + List records = busiCenterRealMapper.findCenterRealDetailsByMainId(page, dto); + page.setRecords(records); + return page; + } + + @Override + public List selectMainDeviceList() { + return busiCenterRealMapper.selectMainDeviceList(); + } + + @Override + public List selectCenterRealDataByMainId(String mainId) { + Map map = new HashMap<>(); + map.put("main_id", mainId); + return busiCenterRealMapper.selectByMap(map); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiCenterRealStatisticsServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiCenterRealStatisticsServiceImpl.java new file mode 100644 index 0000000..0948297 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiCenterRealStatisticsServiceImpl.java @@ -0,0 +1,75 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.entity.model.BusiCenterRealStatistics; +import com.chenxuan.mapper.BusiCenterRealStatisticsMapper; +import com.chenxuan.service.BusiCenterRealStatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Carrey Zheng + * @create 2020-07-09 4:06 PM + **/ +@Service +public class BusiCenterRealStatisticsServiceImpl extends ServiceImpl implements BusiCenterRealStatisticsService { + + @Autowired + private BusiCenterRealStatisticsMapper busiCenterRealStatisticsMapper; + + + @Override + public List selectMainDeviceList() { + + List busiCenterRealStatistics = busiCenterRealStatisticsMapper.selectMainDeviceList(); + return busiCenterRealStatistics; + } + + @Override + public BusiCenterRealStatistics getMainDeviceListTodayData(BusiCenterRealStatistics busiCenterReal) { + + Map map = new HashMap<>(); + map.put("main_id",busiCenterReal.getMainId()); + map.put("ins_time",new Date()); + List busiCenterRealStatistics = busiCenterRealStatisticsMapper.selectByMap(map); + if (busiCenterRealStatistics.size()>0){ + return busiCenterRealStatistics.get(0); + } + return null; + } + + @Override + public BusiCenterRealStatistics getMainDeviceListYesterdayData(BusiCenterRealStatistics busiCenterReal) { + Calendar cal=Calendar.getInstance(); + cal.add(Calendar.DATE,-1); + Date yesterday =cal.getTime(); + Map map = new HashMap<>(); + map.put("main_id",busiCenterReal.getMainId()); + map.put("ins_time",yesterday); + List busiCenterRealStatistics = busiCenterRealStatisticsMapper.selectByMap(map); + if (busiCenterRealStatistics.size()>0){ + return busiCenterRealStatistics.get(0); + } + return null; + } + + @Override + public BusiCenterRealStatistics getMainDeviceListBeforOneMonthData(BusiCenterRealStatistics busiCenterReal) { + Calendar cal=Calendar.getInstance(); + cal.add(Calendar.DATE,-30); + Date yesterday =cal.getTime(); + Map map = new HashMap<>(); + map.put("main_id",busiCenterReal.getMainId()); + map.put("ins_time",yesterday); + List busiCenterRealStatistics = busiCenterRealStatisticsMapper.selectByMap(map); + if (busiCenterRealStatistics.size()>0){ + return busiCenterRealStatistics.get(0); + } + return null; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiCenterThresholdConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiCenterThresholdConfServiceImpl.java new file mode 100644 index 0000000..ecae2c3 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiCenterThresholdConfServiceImpl.java @@ -0,0 +1,123 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiCenterThresholdConfDto; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiCenterThresholdConf; +import com.chenxuan.entity.vo.BusiCenterThresholdConfVo; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiCenterThresholdConfMapper; +import com.chenxuan.mapper.BusiSubDeviceMapper; +import com.chenxuan.service.BusiCenterThresholdConfService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:BusiCenterThresholdConfServiceImpl + * @Description: 中心点电流阈值配置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:05 PM + * @Version V1.0 + */ +@Service +public class BusiCenterThresholdConfServiceImpl extends ServiceImpl implements BusiCenterThresholdConfService { + + @Autowired + private BusiCenterThresholdConfMapper busiCenterThresholdConfMapper; + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Override + public Page page(BusiCenterThresholdConfDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = busiCenterThresholdConfMapper.selectPages(page, dto); + page.setRecords(records); + return page; + } + + @Override + public BusiCenterThresholdConfVo selectCenterThresholdConfByMainId(String mainId) { + return busiCenterThresholdConfMapper.findThresholdConfByMainId(mainId); + } + + @Override + public AjaxResult insertThresholdConf(BusiCenterThresholdConf conf) { + // 根据主变id和装置类型查询信息 + Map params = new HashMap<>(); + // 判断是否有主变ID + if (StringUtils.isEmpty(conf.getMainId())) { + return new AjaxResult(HttpStatusCode.ERROR, "请选择主变装置"); + } + params.put("mainId", conf.getMainId()); + params.put("deviceType", BusiSubDeviceDto.CENTER); + // 根据赋值的数据查询装置信息 + BusiSubDeviceVo deviceVo = busiSubDeviceMapper.findSubDevice(params); + // 判断变压器是否拥有当前装置 + if (StringUtils.isNull(deviceVo)) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器暂无中心点装置,请添加装置后再设置阈值"); + } + // 判断当前主变是否已经设置过阈值 + if (StringUtils.isNotNull(busiCenterThresholdConfMapper.findThresholdConfByMainId(conf.getMainId()))) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器中心点装置的阈值已经设置"); + } + // 新增 + conf.setId(UuidUtils.getUUID()); + conf.setInsTime(new Date()); + conf.setSubId(deviceVo.getId()); + if (busiCenterThresholdConfMapper.saveThresholdConf(conf) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "新增成功"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "新增失败"); + } + + @Override + public AjaxResult updateThresholdConf(BusiCenterThresholdConf thresholdConf) { + // 根据当前id查询未修改数据 + BusiCenterThresholdConf conf = busiCenterThresholdConfMapper.selectById(thresholdConf.getId()); + // 根据未修改数据的主变id判断是否同一个主变 + if (!thresholdConf.getMainId().equals(conf.getMainId())) { + // 根据主变id和装置类型查询信息 + Map params = new HashMap<>(); + params.put("mainId", thresholdConf.getMainId()); + params.put("deviceType", BusiSubDeviceDto.CENTER); + // 根据赋值的数据查询装置信息 + BusiSubDeviceVo deviceVo = busiSubDeviceMapper.findSubDevice(params); + // 判断变压器是否拥有当前装置 + if (StringUtils.isNull(deviceVo)) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器暂无中心点装置,请添加装置后再设置阈值"); + } + // 判断当前主变是否已经设置过阈值 + if (StringUtils.isNotNull(busiCenterThresholdConfMapper.findThresholdConfByMainId(thresholdConf.getMainId()))) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器中心点装置的阈值已经设置"); + } + } + if (busiCenterThresholdConfMapper.updateThresholdConf(thresholdConf) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "修改成功"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "修改失败"); + } + + @Override + public boolean deleteThresholdConfByMainId(String mainId) { + int count = busiCenterThresholdConfMapper.deleteThresholdConfByMainId(mainId); + return count > 0 ? true : false; + } + + @Override + public boolean delete(String id) { + int count = busiCenterThresholdConfMapper.delete(id); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiCommunicationParametersServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiCommunicationParametersServiceImpl.java new file mode 100644 index 0000000..6f2139f --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiCommunicationParametersServiceImpl.java @@ -0,0 +1,208 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.MD5Utils; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiCommunicationParameters; +import com.chenxuan.entity.model.DeviceInfo; +import com.chenxuan.mapper.BusiCommunicationParametersMapper; +import com.chenxuan.service.BusiCommunicationParametersService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiCommunicationParametersServiceImpl + * @Description: 通信参数设置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/20/2020 15:50 PM + * @Version V1.0 + */ +@Service +public class BusiCommunicationParametersServiceImpl extends ServiceImpl implements BusiCommunicationParametersService { + + @Autowired + private BusiCommunicationParametersMapper busiCommunicationParametersMapper; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = busiCommunicationParametersMapper.selectPages( page, query.getParams() ); + page.setRecords(records); + return page; + } + + @Override + public BusiCommunicationParameters selectBusiCommunicationParametersById(String id) { + BusiCommunicationParameters bcp = busiCommunicationParametersMapper.findBusiCommunicationParametersById( id ); + BusiCommunicationParameters bcpObject = new BusiCommunicationParameters(); + bcpObject.setId(id); + bcp.setProtocol(bcp.getProtocol()); + bcpObject.setCommunicationInterface(bcp.getCommunicationInterface()); + bcpObject.setProtocol(bcp.getProtocol()); + bcpObject.setSerialNumber(bcp.getSerialNumber()); + bcpObject.setBaudRate(bcp.getBaudRate()); + bcpObject.setCheckBit(bcp.getCheckBit()); + bcpObject.setDataBit(bcp.getDataBit()); + bcpObject.setStopBit(bcp.getStopBit()); + bcpObject.setIpAddr(bcp.getIpAddr()); + bcpObject.setPort(bcp.getPort()); + if(bcp.getPassword()!=null && !"".equals(bcp.getPassword())) { + bcpObject.setPassword(MD5Utils.convertMD5(bcp.getPassword())); + bcpObject.setConfirmPassword(MD5Utils.convertMD5(bcp.getPassword())); + } + return bcpObject; + } + + @Override + public boolean insertBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters) { + busiCommunicationParameters.setId(UuidUtils.getUUID()); + if(busiCommunicationParameters.getPassword()!=null && !"".equals(busiCommunicationParameters.getPassword())) + { + String passwordString = MD5Utils.convertMD5(busiCommunicationParameters.getPassword()); + busiCommunicationParameters.setPassword(passwordString); + busiCommunicationParameters.setConfirmPassword(passwordString); + } + return busiCommunicationParametersMapper.saveBusiCommunicationParameters( busiCommunicationParameters ) > 0 ? true : false; + } + + @Override + public boolean updateBusiCommunicationParameters(BusiCommunicationParameters busiCommunicationParameters) { + boolean flags = true; + List bcp = selectbcpByProtocol(busiCommunicationParameters.getProtocol()); + //ModBus RTU,数据库有记录则更新,没有记录新增 + if("1".equals(busiCommunicationParameters.getProtocol())) + { + //更新 + if(!bcp.isEmpty()) + { + if(busiCommunicationParameters.getPassword()!=null && !"".equals(busiCommunicationParameters.getPassword())) + { + String passwordSecret = MD5Utils.convertMD5(busiCommunicationParameters.getPassword()); + busiCommunicationParameters.setPassword(passwordSecret); + busiCommunicationParameters.setConfirmPassword(passwordSecret); + } + busiCommunicationParameters.setId(bcp.get(0).getId()); + flags= busiCommunicationParametersMapper.updateBusiCommunicationParameters( busiCommunicationParameters ) > 0 ? true : false; + }else//insert + { + flags= insertBusiCommunicationParameters( busiCommunicationParameters ); + } + } + //61850,数据库没有记录新增,有记录则删除原有记录再更新 + else if("2".equals(busiCommunicationParameters.getProtocol())) + { + //根据protocol删除 + flags = deleteCommunicationParameters(busiCommunicationParameters.getProtocol()); + if(flags) { + //新增 + List list = busiCommunicationParameters.getDeviceArray(); + for (DeviceInfo deviceArray : list) { + BusiCommunicationParameters bcpInfo = new BusiCommunicationParameters(); + bcpInfo.setProtocol(busiCommunicationParameters.getProtocol()); + bcpInfo.setSubDeviceId(deviceArray.getDevice()); + bcpInfo.setSubDeviceId(deviceArray.getDevice()); + bcpInfo.setIpAddr(deviceArray.getIp()); + bcpInfo.setPort(deviceArray.getPort()); + bcpInfo.setPassword(busiCommunicationParameters.getPassword()); + bcpInfo.setConfirmPassword(busiCommunicationParameters.getConfirmPassword()); + flags = insertBusiCommunicationParameters(bcpInfo); + } + } + } + return flags ; + } + + @Override + public boolean deleteById(String id) { + int count = busiCommunicationParametersMapper.deleteById(id); + return count > 0 ? true : false; + } + + @Override + public BusiCommunicationParameters selectBusiCommunicationParametersByProtocol(String protocol) { + List list = busiCommunicationParametersMapper.findBusiCommunicationParametersByProtocol(protocol); + BusiCommunicationParameters bcpObject = new BusiCommunicationParameters(); + bcpObject.setProtocol(protocol); + if(!list.isEmpty()) + { + if("1".equals(protocol)) + { + BusiCommunicationParameters bcp = list.get(0); + bcpObject.setProtocol(protocol); + if(bcp != null ) + { + bcpObject.setId(bcp.getId()); + bcpObject.setCommunicationInterface(bcp.getCommunicationInterface()); + bcpObject.setProtocol(bcp.getProtocol()); + bcpObject.setSerialNumber(bcp.getSerialNumber()); + bcpObject.setBaudRate(bcp.getBaudRate()); + bcpObject.setCheckBit(bcp.getCheckBit()); + bcpObject.setDataBit(bcp.getDataBit()); + bcpObject.setStopBit(bcp.getStopBit()); + bcpObject.setIpAddr(bcp.getIpAddr()); + bcpObject.setPort(bcp.getPort()); + if(bcp.getPassword()!=null && !"".equals(bcp.getPassword())) + { + bcpObject.setPassword(MD5Utils.convertMD5(bcp.getPassword())); + bcpObject.setConfirmPassword(MD5Utils.convertMD5(bcp.getPassword())); + } + } + } + else + { + BusiCommunicationParameters bcp = list.get(0); + List deviceInfoList = new ArrayList(); + for(BusiCommunicationParameters bcpInfo:list) + { + DeviceInfo deviceInfo = new DeviceInfo(); + deviceInfo.setDevice(bcpInfo.getSubDeviceId()); + deviceInfo.setIp(bcpInfo.getIpAddr()); + deviceInfo.setPort(bcpInfo.getPort()); + deviceInfoList.add(deviceInfo); + + } + bcpObject.setProtocol(bcp.getProtocol()); + bcpObject.setDeviceArray(deviceInfoList); + if(bcp.getPassword()!=null && !"".equals(bcp.getPassword())) + { + bcpObject.setPassword(MD5Utils.convertMD5(bcp.getPassword())); + bcpObject.setConfirmPassword(MD5Utils.convertMD5(bcp.getPassword())); + } + } + } + return bcpObject; + } + + public List selectbcpByProtocol(String protocol) { + List bcpList = busiCommunicationParametersMapper.findBusiCommunicationParametersByProtocol( protocol ); +// List bcpObject = new ArrayList(); +// bcpObject.setProtocol(protocol); + if(bcpList != null ) + { + for(BusiCommunicationParameters bcp:bcpList) + { + bcp.setProtocol(protocol); + if(bcp.getPassword()!=null && !"".equals(bcp.getPassword())) { + bcp.setPassword(MD5Utils.convertMD5(bcp.getPassword())); + bcp.setConfirmPassword(MD5Utils.convertMD5(bcp.getPassword())); + } + } + } + return bcpList; + } + + public boolean deleteCommunicationParameters(String protocol) + { + Map map = new HashMap(); + map.put("protocol",protocol); + busiCommunicationParametersMapper.deleteByMap(map); + return true; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiControlConfigServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiControlConfigServiceImpl.java new file mode 100644 index 0000000..2e0d263 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiControlConfigServiceImpl.java @@ -0,0 +1,437 @@ +package com.chenxuan.service.impl; + + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiControlConfig; +import com.chenxuan.entity.vo.BusiControlConfigVo; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiControlConfigMapper; +import com.chenxuan.mapper.BusiSubDeviceMapper; +import com.chenxuan.service.BusiControlConfigService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:BusiControlConfigServiceImpl + * @Description: 控制参数配置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/6/2020 15:12 PM + * @Version V1.0 + */ +@Service +public class BusiControlConfigServiceImpl extends ServiceImpl implements BusiControlConfigService { + + @Autowired + private BusiControlConfigMapper busiControlConfigMapper; + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = busiControlConfigMapper.selectPages(page, query.getParams()); + page.setRecords(records); + return page; + } + + @Override + public List selectConfigsByMainId(String mainId) { + List controlConfigs = busiControlConfigMapper.selectConfigByMainId(mainId); + List controlConfigVos = new ArrayList<>(controlConfigs); + //主变装置全都在 + if (CollectionUtil.isNotEmpty(controlConfigs) && controlConfigs.size() >= 14) { + controlConfigs.stream().forEach(config -> { + if (StringUtils.isBlank(config.getId())) { + controlConfigVos.remove(config); + } + }); + controlConfigVos.stream().forEach(control -> { + control.setStatus("1"); + }); + return controlConfigVos; + } + //给主变14个装置设置初始化值 + for (int i = 0; i < 14; i++) { + BusiControlConfigVo configVo = new BusiControlConfigVo(); + boolean exist = false; + //A相上(原边) + switch (i) { + case 0: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "A".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("A"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 1: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "A".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("A"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + case 2: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "B".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("B"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 3: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "B".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("B"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + case 4: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "C".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("C"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 5: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("P".equals(controlConfigs.get(j).getSide()) + && "C".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("P"); + configVo.setPhase("C"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + //副边 + case 6: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "A".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("A"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 7: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "A".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("A"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + case 8: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "B".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("B"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 9: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "B".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("B"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + case 10: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "C".equals(controlConfigs.get(j).getPhase()) + && "U".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("C"); + configVo.setInOut("U"); + controlConfigs.add(configVo); + } + break; + case 11: + for (int j = 0; j < controlConfigs.size(); j++) { + if ("S".equals(controlConfigs.get(j).getSide()) + && "C".equals(controlConfigs.get(j).getPhase()) + && "D".equals(controlConfigs.get(j).getInOut())) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.Ampli.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + configVo.setSide("S"); + configVo.setPhase("C"); + configVo.setInOut("D"); + controlConfigs.add(configVo); + } + break; + case 12: + for (int j = 0; j < controlConfigs.size(); j++) { + if (BusiSubDeviceDto.NOISE.equals(Integer.parseInt(controlConfigs.get(j).getDeviceType()))) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.NOISE.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + controlConfigs.add(configVo); + } + break; + case 13: + for (int j = 0; j < controlConfigs.size(); j++) { + if (BusiSubDeviceDto.CENTER.equals(Integer.parseInt(controlConfigs.get(j).getDeviceType()))) { + controlConfigs.get(j).setStatus("1"); + exist = true; + break; + } + } + if (!exist) { + configVo.setDeviceType(BusiSubDeviceDto.CENTER.toString()); + configVo.setMainId(mainId); + configVo.setStatus("0"); + controlConfigs.add(configVo); + } + break; + } + } + return controlConfigs; + } + + @Override + public boolean insertConfigs(List busiControlConfigList) { + for (BusiControlConfig btc : busiControlConfigList) { + btc.setId(UuidUtils.getUUID()); + btc.setInsTime(new Date()); + btc.setHbaseRowkey(null); + } + return busiControlConfigMapper.saveControlConfigs(busiControlConfigList) > 0 ? true : false; + } + + @Override + public AjaxResult updateConfigs(List configs) { + //根据主变id查询装置信息 + List device = busiSubDeviceMapper.findSubDeviceByMainId(configs.get(0).getMainId()); + //判断是否有数据 + if (CollectionUtil.isEmpty(device)) { + return new AjaxResult(HttpStatusCode.ERROR, "该主变下暂无装置,请添加主变装置"); + } + List updateArrays = new ArrayList<>(); + List arrayList = new ArrayList<>(configs.size()); + arrayList.addAll(configs); + //将修改和新增分开 + for (BusiControlConfig config : configs) { + if (StringUtils.isNotBlank(config.getSubId()) + && StringUtils.isNotBlank(config.getId())) { + updateArrays.add(config); + arrayList.remove(config); + } + } + List addArrays = new ArrayList<>(configs.size()); + addArrays.addAll(configs); + //将空数据去除干净 + for (BusiControlConfig config : configs) { + //判断装置ID是否存在(如果不存在多半装置被删除了,为了防止数据新增报错,从数组中删除) + if (StringUtils.isBlank(config.getSubId())) { + addArrays.remove(config); + } + } + //又有修改又有新增的数据处理 + for (BusiControlConfig config : updateArrays) { + for (BusiControlConfig controlConfig : configs) { + //判断新增的更新是否存在相同数据,如有相同删除新增的数据 + if (StringUtils.isNotBlank(controlConfig.getSubId())) { + if (controlConfig.getSubId().equals(config.getSubId())) { + addArrays.remove(controlConfig); + } + } + } + } + int updateControlConfigs = 0; + int saveControlConfigs = 0; + //修改 + if (CollectionUtil.isNotEmpty(updateArrays)) { + updateArrays.stream().forEach(array -> { + array.setInsTime(new Date()); + array.setHbaseRowkey(null); + }); + //更新 + updateControlConfigs = busiControlConfigMapper.updateControlConfigs(updateArrays); + } + //新增 + if (CollectionUtil.isNotEmpty(addArrays)) { + addArrays.stream().forEach(array -> { + array.setId(UuidUtils.getUUID()); + array.setInsTime(new Date()); + array.setHbaseRowkey(null); + }); + //新增参数 + saveControlConfigs = busiControlConfigMapper.saveControlConfigs(addArrays); + } + //判断是否新增或者更新成功 + if (updateControlConfigs > 0 || saveControlConfigs > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "操作成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "操作失败"); + } + + @Override + public boolean deleteConfById(String id) { + int count = busiControlConfigMapper.deleteConfById(id); + return count > 0 ? true : false; + } + + @Override + public boolean deleteConfsByMainId(String mainId) { + int count = busiControlConfigMapper.deleteConfsByMainId(mainId); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiDeviceCalibrationServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiDeviceCalibrationServiceImpl.java new file mode 100644 index 0000000..28771d1 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiDeviceCalibrationServiceImpl.java @@ -0,0 +1,37 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiDeviceCalibration; +import com.chenxuan.mapper.BusiDeviceCalibrationMapper; +import com.chenxuan.service.BusiDeviceCalibrationService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class BusiDeviceCalibrationServiceImpl extends ServiceImpl implements BusiDeviceCalibrationService { + + @Autowired + private BusiDeviceCalibrationMapper busiDeviceCalibrationMapper; + + @Override + public BusiDeviceCalibration selectBusiDeviceCalibrationByMainId(String mainId) { + return busiDeviceCalibrationMapper.selectByMainId(mainId); + } + + @Override + public boolean timingBusiDeviceCalibration(BusiDeviceCalibration entity) { + int count = 0; + //判断是否是新增或者修改 + if (StringUtils.isBlank(entity.getId())) { + entity.setId(UuidUtils.getUUID()); + count = busiDeviceCalibrationMapper.insert(entity); + } + //修改 + if (StringUtils.isNotBlank(entity.getId())) { + count = busiDeviceCalibrationMapper.updateById(entity); + } + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiDeviceSpecialShowServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiDeviceSpecialShowServiceImpl.java new file mode 100644 index 0000000..63c28bb --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiDeviceSpecialShowServiceImpl.java @@ -0,0 +1,507 @@ +package com.chenxuan.service.impl; + +import Algorithm_vibration.cal; +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.AmplitudeDto; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiVibrationContrastDto; +import com.chenxuan.entity.model.BusiAmpliComtrad; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.entity.model.BusiVibrationSeparation; +import com.chenxuan.entity.vo.BusiControlConfigVo; +import com.chenxuan.entity.vo.BusiFrequencyConfVo; +import com.chenxuan.entity.vo.BusiVibrationSeparationVo; +import com.chenxuan.mapper.*; +import com.chenxuan.service.BusiDeviceSpecialShowService; +import com.chenxuan.utils.StringUtils; +import com.mathworks.toolbox.javabuilder.MWClassID; +import com.mathworks.toolbox.javabuilder.MWException; +import com.mathworks.toolbox.javabuilder.MWNumericArray; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Service +public class BusiDeviceSpecialShowServiceImpl extends ServiceImpl implements BusiDeviceSpecialShowService { + + @Autowired + private BusiAmpliComtradMapper busiAmpliComtradMapper; + + @Autowired + private BusiControlConfigMapper configMapper; + + @Autowired + private BusiVibrationSeparationMapper separationMapper; + + @Autowired + private BusiFrequencyConfMapper frequencyConfMapper; + + @Override + public BusiVibrationSeparationVo getShockRealChartByDevice(BusiVibrationSeparation separation) { + //判断是否传参 + BusiVibrationSeparationVo separationVo = new BusiVibrationSeparationVo(); + if (!StringUtils.isAllBlank(separation.getMainId(), separation.getPhase())) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH"); + BusiAmpliRealDto dto = new BusiAmpliRealDto(); + //根据主变id和相位(可能有时间)查询录播文件id + if (separation.getInsTime() != null) { + dto.setInsTime(sdf.format(separation.getInsTime())); + } + dto.setMainId(separation.getMainId()); + dto.setPhase(separation.getPhase()); + //查询指定录播文件 + List comtrad = busiAmpliComtradMapper.findAmpliComtrad(dto); + if (CollectionUtil.isNotEmpty(comtrad)) { + separation.setComtradId(comtrad.get(0).getId()); + dto.setFileId(comtrad.get(0).getId()); + //查询当前的数据是否有值 + Long startTime = System.currentTimeMillis(); + List separationVos = separationMapper.findVibrationSeparation(separation); + Long endTime = System.currentTimeMillis(); + log.warn("----------------用时:" + (endTime - startTime)); + //如果有数据直接返回 + if (CollectionUtil.isEmpty(separationVos)) { + //调用算法前的数据处理 + int[][] data = disposeData(dto); + //用于保存输入矩阵 + MWNumericArray signal, index, fs, sampleTime, nstd, ne; + //计算下标 + List indexs = disposeIndex(separation); + try { + //将调用matlab的数据转换下 + signal = new MWNumericArray(data, MWClassID.DOUBLE); + index = new MWNumericArray(indexs.toArray(), MWClassID.DOUBLE); + fs = new MWNumericArray(10000, MWClassID.DOUBLE); + sampleTime = new MWNumericArray(1, MWClassID.DOUBLE); + nstd = new MWNumericArray(0.2, MWClassID.DOUBLE); + ne = new MWNumericArray(50, MWClassID.DOUBLE); + //调用算法 + Object[] objects = new cal().winding_core_separ(6, signal, index, fs, sampleTime, nstd, ne); + //将返回的数据传送给前端 + return disposeReverseData(objects, separation); + } catch (MWException e) { + log.error("-------------处理数据失败"); + } + } + List mechAmplitudeList = new ArrayList<>(), windingAmplitudeList = new ArrayList<>(), ironCoreAmplitudeList = new ArrayList<>(), + primarySideAmplitudeList = new ArrayList<>(), secSideAmplitudeList = new ArrayList<>(); + separationVos.stream().forEach(paration -> { + mechAmplitudeList.add(new BigDecimal(paration.getMechAmplitude())); + windingAmplitudeList.add(new BigDecimal(paration.getWindingAmplitude())); + ironCoreAmplitudeList.add(new BigDecimal(paration.getIronCoreAmplitude())); + primarySideAmplitudeList.add(new BigDecimal(paration.getPrimarySideAmplitude())); + secSideAmplitudeList.add(new BigDecimal(paration.getSecSideAmplitude())); + }); + separationVo.setMechAmplitudeList(mechAmplitudeList); + separationVo.setWindingAmplitudeList(windingAmplitudeList); + separationVo.setIronCoreAmplitudeList(ironCoreAmplitudeList); + separationVo.setPrimarySideAmplitudeList(primarySideAmplitudeList); + separationVo.setSecSideAmplitudeList(secSideAmplitudeList); + return separationVo; + } + } + return separationVo; + } + + /** + * 处理返回的对象 + * + * @param objects + * @param separation + * @return + */ + private BusiVibrationSeparationVo disposeReverseData(Object[] objects, BusiVibrationSeparation separation) { + //判断调用算法是否成功,3代表成功 + if (objects[5].toString().equals("3")) { + //得到算法的结果值 + MWNumericArray maxAmpSignalPri = (MWNumericArray) objects[0]; + MWNumericArray maxAmpSignalSec = (MWNumericArray) objects[1]; + MWNumericArray mechVibrOp = (MWNumericArray) objects[2]; + MWNumericArray windingOp = (MWNumericArray) objects[3]; + MWNumericArray coreOp = (MWNumericArray) objects[4]; + double[][] maxAmpPri = (double[][]) maxAmpSignalPri.toDoubleArray(); + double[][] maxAmpSec = (double[][]) maxAmpSignalSec.toDoubleArray(); + double[][] mechVibr = (double[][]) mechVibrOp.toDoubleArray(); + double[][] winding = (double[][]) windingOp.toDoubleArray(); + double[][] core = (double[][]) coreOp.toDoubleArray(); + //声明所需要的集合及对象 + List separationList = new ArrayList<>(); + List mechAmplitudeList = new ArrayList<>(), windingAmplitudeList = new ArrayList<>(), ironCoreAmplitudeList = new ArrayList<>(), + primarySideAmplitudeList = new ArrayList<>(), secSideAmplitudeList = new ArrayList<>(); + BusiVibrationSeparationVo separationVo = new BusiVibrationSeparationVo(); + int j = 1; + //循环处理数据 + for (int i = 0; i < mechVibr.length; i++) { + BusiVibrationSeparation vSeparation = new BusiVibrationSeparation(); + vSeparation.setId(UuidUtils.getUUID()); + vSeparation.setComtradId(separation.getComtradId()); + vSeparation.setInsTime(new Date()); + vSeparation.setPhase(separation.getPhase()); + vSeparation.setMainId(separation.getMainId()); + vSeparation.setSort(j++); + vSeparation.setPrimarySideAmplitude(new BigDecimal(maxAmpPri[i][0]).setScale(2, RoundingMode.UP).toString()); + vSeparation.setSecSideAmplitude(new BigDecimal(maxAmpSec[i][0]).setScale(2, RoundingMode.UP).toString()); + vSeparation.setMechAmplitude(new BigDecimal(mechVibr[i][0]).setScale(2, RoundingMode.UP).toString()); + vSeparation.setWindingAmplitude(new BigDecimal(winding[i][0]).setScale(2, RoundingMode.UP).toString()); + vSeparation.setIronCoreAmplitude(new BigDecimal(core[i][0]).setScale(2, RoundingMode.UP).toString()); + separationList.add(vSeparation); + //封装集合数据 + mechAmplitudeList.add(new BigDecimal(vSeparation.getMechAmplitude())); + windingAmplitudeList.add(new BigDecimal(vSeparation.getWindingAmplitude())); + ironCoreAmplitudeList.add(new BigDecimal(vSeparation.getIronCoreAmplitude())); + primarySideAmplitudeList.add(new BigDecimal(vSeparation.getPrimarySideAmplitude())); + secSideAmplitudeList.add(new BigDecimal(vSeparation.getSecSideAmplitude())); + } + //批量新增 + Long startTime = System.currentTimeMillis(); + int batchInsert = separationMapper.saveVibrationSeparation(separationList); + Long endTime = System.currentTimeMillis(); + log.warn("------------------用时:" + (endTime - startTime)); + //如果新增成功则返回 + if (batchInsert > 0) { + separationVo.setMechAmplitudeList(mechAmplitudeList); + separationVo.setWindingAmplitudeList(windingAmplitudeList); + separationVo.setIronCoreAmplitudeList(ironCoreAmplitudeList); + separationVo.setPrimarySideAmplitudeList(primarySideAmplitudeList); + separationVo.setSecSideAmplitudeList(secSideAmplitudeList); + return separationVo; + } + } + return null; + } + + /** + * 计算数据所对应的下标 + * + * @param separation + */ + private List disposeIndex(BusiVibrationSeparation separation) { + //查询控制参数 + List configVos = configMapper.getControlConfig(separation.getMainId(), separation.getPhase()); + List indexs = new ArrayList<>(); + //处理原副边数据 + for (BusiControlConfigVo configVo : configVos) { + //原边(A相上侧) + if (configVo.getSide().equals("P") && configVo.getPhase().equals("A") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("1"); + continue; + } + //A相下侧 + if (configVo.getSide().equals("P") && configVo.getPhase().equals("A") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("2"); + continue; + } + //B相上侧 + if (configVo.getSide().equals("P") && configVo.getPhase().equals("B") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("3"); + continue; + } + //B相下侧 + if (configVo.getSide().equals("P") && configVo.getPhase().equals("B") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("4"); + continue; + } + //C相上侧 + if (configVo.getSide().equals("P") && configVo.getPhase().equals("C") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("5"); + continue; + } + //C相下侧 + if (configVo.getSide().equals("P") && configVo.getPhase().equals("C") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("6"); + continue; + } + + //副边(A相上侧) + if (configVo.getSide().equals("S") && configVo.getPhase().equals("A") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("7"); + continue; + } + //A相下侧 + if (configVo.getSide().equals("S") && configVo.getPhase().equals("A") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("8"); + continue; + } + //B相上侧 + if (configVo.getSide().equals("S") && configVo.getPhase().equals("B") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("9"); + continue; + } + //B相下侧 + if (configVo.getSide().equals("S") && configVo.getPhase().equals("B") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("10"); + continue; + } + //C相上侧 + if (configVo.getSide().equals("S") && configVo.getPhase().equals("C") + && configVo.getInOut().equals("U") && configVo.getIsEnable().equals("1")) { + indexs.add("11"); + continue; + } + //C相下侧 + if (configVo.getSide().equals("S") && configVo.getPhase().equals("C") + && configVo.getInOut().equals("D") && configVo.getIsEnable().equals("1")) { + indexs.add("12"); + continue; + } + } + return indexs; + } + + /** + * 算法调用前的数据查询及处理 + * + * @param dto + * @return + */ + private int[][] disposeData(BusiAmpliRealDto dto) { + //查询录播数据 + List ampliComtrads = busiAmpliComtradMapper.findAmpliComtrad(dto); + List comtradDatas = new ArrayList<>(ampliComtrads.size()); + List ctdList = new ArrayList<>(); + List resList = new ArrayList<>(); + for (BusiAmpliComtrad comtrad : ampliComtrads) { + comtradDatas.add(comtrad.getComtradData()); + } + //将数据库中的数据处理 + comtradDatas.stream().forEach(ctd -> { + ctdList.add(new ArrayList<>(CollectionUtils.arrayToList(ctd.split("\\|")))); + }); + //以逗号分割开每个数据 + for (int i = 0; i < ctdList.get(0).size(); i++) { + resList.add(new ArrayList<>(Arrays.asList(ctdList.get(0).get(i).toString().split(",")))); + } + List newList = new ArrayList<>(resList.size()); + newList.addAll(resList); + //移除数据中的序号和时间 + for (int i = 0; i < resList.size(); i++) { + newList.get(i).remove(0); + newList.get(i).remove(0); + } + //声明原副边从A相到C相的上下侧 + int[] pauArray = new int[10000]; + int[] padArray = new int[10000]; + int[] pbuArray = new int[10000]; + int[] pbdArray = new int[10000]; + int[] pcuArray = new int[10000]; + int[] pcdArray = new int[10000]; + int[] sauArray = new int[10000]; + int[] sadArray = new int[10000]; + int[] sbuArray = new int[10000]; + int[] sbdArray = new int[10000]; + int[] scuArray = new int[10000]; + int[] scdArray = new int[10000]; + //循环根据A相到C相的上下侧赋值 + for (int i = 0; i < newList.size(); i++) { + pauArray[i] = Integer.parseInt(newList.get(i).get(0).toString()); + padArray[i] = Integer.parseInt(newList.get(i).get(1).toString()); + pbuArray[i] = Integer.parseInt(newList.get(i).get(2).toString()); + pbdArray[i] = Integer.parseInt(newList.get(i).get(3).toString()); + pcuArray[i] = Integer.parseInt(newList.get(i).get(4).toString()); + pcdArray[i] = Integer.parseInt(newList.get(i).get(5).toString()); + sauArray[i] = Integer.parseInt(newList.get(i).get(6).toString()); + sadArray[i] = Integer.parseInt(newList.get(i).get(7).toString()); + sbuArray[i] = Integer.parseInt(newList.get(i).get(8).toString()); + sbdArray[i] = Integer.parseInt(newList.get(i).get(9).toString()); + scuArray[i] = Integer.parseInt(newList.get(i).get(10).toString()); + scdArray[i] = Integer.parseInt(newList.get(i).get(11).toString()); + } + //声明二维数据 + int[][] arrayList = {pauArray, padArray, pbuArray, pbdArray, pcuArray, + pcdArray, sauArray, sadArray, sbuArray, sbdArray, scuArray, scdArray}; + return arrayList; + } + + @Override + public BusiVibrationContrastDto getVibrationContrastExper(BusiVibrationContrastDto dto) { + try { + //将调用matlab的数据转换下 + MWNumericArray U = new MWNumericArray(dto.getVoltage(), MWClassID.DOUBLE); + MWNumericArray I = new MWNumericArray(dto.getElectricity(), MWClassID.DOUBLE); + //声明备用的集合 + List uAccList = new ArrayList<>(), iAccList = new ArrayList<>(), + frequencyList = new ArrayList<>(); + //查询所有频率 + List frequencyConfs = frequencyConfMapper.selectFrequency(); + //调用算法 + Object[] objects = new cal().estimate(7, U, I); + if (objects[6].toString().equals("3")) { + //得到算法的结果值 + MWNumericArray uAcc = (MWNumericArray) objects[4]; + MWNumericArray iAcc = (MWNumericArray) objects[5]; + double[][] uacc = (double[][]) uAcc.toDoubleArray(); + double[][] iacc = (double[][]) iAcc.toDoubleArray(); + //当前线电压下铁芯振动幅值 + getDatas(uacc, uAccList); + //当前线电流下绕组振动幅值 + getDatas(iacc, iAccList); + //设置返回值 + //铁芯振动对应频率 + setCoreFrequency(dto, uAccList.indexOf(CollectionUtil.max(uAccList))); + //绕组振动对应频率 + setWindingFrequency(dto, iAccList.indexOf(CollectionUtil.max(iAccList))); + //铁芯振动最大幅值 + dto.setMaxCoreAmplitude(CollectionUtil.max(uAccList)); + //绕组振动最大幅值 + dto.setMaxWindingAmplitude(CollectionUtil.max(iAccList)); + dto.setuAccList(uAccList); + dto.setiAccList(iAccList); + frequencyConfs.stream().forEach(fre -> { + frequencyList.add(new BigDecimal(fre.getFrequency())); + }); + dto.setFrequencyList(frequencyList); + return dto; + } + } catch (MWException e) { + log.error("处理数据失败"); + } + return dto; + } + + @Override + public BusiVibrationContrastDto getFixation() { + try { + BusiVibrationContrastDto dto = new BusiVibrationContrastDto(); + //将调用matlab的数据转换下 + MWNumericArray U = new MWNumericArray("20", MWClassID.DOUBLE); + MWNumericArray I = new MWNumericArray("50", MWClassID.DOUBLE); + //声明备用的集合 + List uAmplitudeList = new ArrayList<>(), iAmplitudeList = new ArrayList<>(); + List coreUList = new ArrayList<>(), windingIList = new ArrayList<>(); + //调用算法 + Object[] objects = new cal().estimate(7, U, I); + if (objects[6].toString().equals("3")) { + //得到算法的结果值 + MWNumericArray uL = (MWNumericArray) objects[0]; + MWNumericArray iL = (MWNumericArray) objects[1]; + MWNumericArray coreU = (MWNumericArray) objects[2]; + MWNumericArray windingI = (MWNumericArray) objects[3]; + double[][] ul = (double[][]) uL.toDoubleArray(); + double[][] il = (double[][]) iL.toDoubleArray(); + double[][] core = (double[][]) coreU.toDoubleArray(); + double[][] winding = (double[][]) windingI.toDoubleArray(); + //电压-幅值 横坐标(kV) + getDatas(ul, uAmplitudeList); + //电流-幅值 横坐标(A) + getDatas(il, iAmplitudeList); + //电压铁芯振动幅值 + getAmplitude(core, coreUList); + //电流绕组振动幅值 + getAmplitude(winding, windingIList); + //设置返回值 + dto.setuAmplitudeList(uAmplitudeList); + dto.setiAmplitudeList(iAmplitudeList); + dto.setCoreUList(coreUList); + dto.setWindingIList(windingIList); + return dto; + } + } catch (MWException e) { + log.error("处理数据失败"); + } + return null; + } + + /** + * 铁芯对应频率 + * + * @param dto + * @param i + */ + private void setCoreFrequency(BusiVibrationContrastDto dto, int i) { + int k = 1; + int m = 2; + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setCoreFrequency(String.valueOf(frequency)); + } + + /** + * 绕组对应频率 + * + * @param dto + * @param i + */ + private void setWindingFrequency(BusiVibrationContrastDto dto, int i) { + int k = 1; + int m = 2; + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + dto.setWindingFrequency(String.valueOf(frequency)); + } + + /** + * 处理数据 + * + * @param doubles + * @param amplitudeDtos + * @return + */ + private List getDatas(double[][] doubles, List amplitudeDtos) { + Arrays.stream(doubles).forEach(u -> { + //处理值 + amplitudeDtos.add(new BigDecimal(u[0]).setScale(2, RoundingMode.UP)); + }); + return amplitudeDtos; + } + + /** + * 封装数据 + * + * @param doubles + * @param amplitudeDtos + * @return + */ + private List getAmplitude(double[][] doubles, List amplitudeDtos) { + int k = 1; + int m = 2; + for (int i = 0; i < doubles.length; i++) { + AmplitudeDto amplitudeDto = new AmplitudeDto(); + List datas = new ArrayList<>(doubles[i].length); + for (int j = 0; j < doubles[i].length; j++) { + datas.add(new BigDecimal(doubles[i][j]).setScale(2, RoundingMode.UP)); + } + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + amplitudeDto.setName(frequency + "Hz"); + amplitudeDto.setData(datas); + amplitudeDtos.add(amplitudeDto); + } + return amplitudeDtos; + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiExportDataServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiExportDataServiceImpl.java new file mode 100644 index 0000000..b892447 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiExportDataServiceImpl.java @@ -0,0 +1,353 @@ +package com.chenxuan.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.ExcelUtils; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.ExportData; +import com.chenxuan.entity.vo.BusiAmpliRealDetailsVo; +import com.chenxuan.entity.vo.BusiAmpliThresholdConfVo; +import com.chenxuan.entity.vo.BusiCenterRealDetailsVo; +import com.chenxuan.entity.vo.BusiNoiseRealDetailsVo; +import com.chenxuan.mapper.BusiAmpliRealMapper; +import com.chenxuan.mapper.BusiAmpliThresholdConfMapper; +import com.chenxuan.mapper.BusiCenterRealMapper; +import com.chenxuan.mapper.BusiNoiseRealMapper; +import com.chenxuan.service.BusiExportDataService; +import com.chenxuan.utils.DateUtils; +import com.chenxuan.utils.StringUtils; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +@Service +public class BusiExportDataServiceImpl implements BusiExportDataService { + + @Autowired + private BusiCenterRealMapper busiCenterRealMapper; + + @Autowired + private BusiNoiseRealMapper busiNoiseRealMapper; + + @Autowired + private BusiAmpliRealMapper busiAmpliRealMapper; + + @Autowired + private BusiAmpliThresholdConfMapper thresholdConfMapper; + + @Autowired + HttpServletResponse response; + + @Value("${outfilePath}") + private String OUT_FILE_PATH; + + private final static String FILE_NAME_PREFIX = "Real_Data_Export_"; + + /*sheet页1名称*/ + private final static String SHEET1_NAME = "sheet1"; + + private final String[] CENTER_EXPORT_HEADER = {"时间", "空/负载", "电流(A)", "增长率(%)(天)", "增长率(%)(月)", "偏差率(%)(月)"}; + + private final String[] NOISE_EXPORT_HEADER = {"时间", "空/负载", "噪声(db)", "增长率(%)(天)", "增长率(%)(月)", "偏差率(%)(月)"}; + + private final String[] SHOCK_EXPORT_HEADER = {"空/负载", "频率(Hz)", "幅值(mm/s2)", "增长率(%)(天)", "增长率(%)(月)", "偏差率(%)(月)"}; + + private final String[] AMPLI_REAL_EXPORT_HEADER = {"原副边", "相位", "上下侧 ", "振动频率", "最大振幅", "创建时间"}; + + private final String[] CENTER_REAL_EXPORT_HEADER = {"电流值(A)", "创建时间"}; + + private final String[] NOISE_REAL_EXPORT_HEADER = {"噪声值(dB)", "创建时间"}; + + @Override + public AjaxResult exportCenterRealDetails(BusiCenterRealDto dto) { + dto.setLimit("999999999"); + Page page = new Page(dto.getPage(), dto.getLimit()); + List exportDataList = busiCenterRealMapper.exportCenterRealDetails(page, dto); + if (CollectionUtil.isEmpty(exportDataList)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + if (generateExcel(exportDataList, "Center", dto.getCreateTime())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + private boolean generateExcel(List exportDataList, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xlsx"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //中心点明细导出 + if (fileType.toUpperCase().equals("CENTER")) { + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + exportDataList.get(0).getName(), CENTER_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), CENTER_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < exportDataList.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getInsTime()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getLoadType().equals("1") ? "空载" : + exportDataList.get(i).getLoadType().equals("2") ? "负载" : ""); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDayRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMonthRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDeviationRate()); + } + } else if (fileType.toUpperCase().equals("NOISE")) {//噪声明细导出 + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "噪声明细", CENTER_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), NOISE_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < exportDataList.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getInsTime()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getLoadType().equals("1") ? "空载" : + exportDataList.get(i).getLoadType().equals("2") ? "负载" : ""); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDayRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMonthRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDeviationRate()); + } + } else if (fileType.toUpperCase().equals("SHOCK")) {//震动三级界面导出 + ExcelUtils.creatNoColorRow(sheet.createRow(0), SHOCK_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < exportDataList.size(); i++) { + int rowIndex = i + 1; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getLoadType().equals("1") ? "空载" : + exportDataList.get(i).getLoadType().equals("2") ? "负载" : ""); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getFrequency()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDayRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getMonthRate()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDeviationRate()); + } + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } + + private String getExportFileName(String type, String createTime) { + StringBuilder fileName = new StringBuilder(); + fileName.append(FILE_NAME_PREFIX).append(type).append("_") + .append(createTime); + return fileName.toString(); + } + + @Override + public AjaxResult exportNoiseRealDetails(BusiNoiseRealDto dto) { + dto.setLimit("9999"); + Page page = new Page(dto.getPage(), dto.getLimit()); + List exportDataList = busiNoiseRealMapper.exportNoiseRealDetails(page, dto); + if (CollectionUtil.isEmpty(exportDataList)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + if (generateExcel(exportDataList, "Noise", dto.getCreateTime())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportShockRealDetails(BusiAmpliRealDto dto) { + List currentData = thresholdConfMapper.getCurrentData(dto); + if (CollectionUtil.isEmpty(currentData)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + List exportDataList = new ArrayList<>(currentData.size()); + currentData.stream().forEach(data -> { + ExportData exportData = new ExportData(); + exportData.setFrequency(data.getFrequency()); + exportData.setMaxAmplitude(data.getAmplitude()); + exportData.setDayRate(data.getDayRate()); + exportData.setDeviationRate(data.getDeviationRate()); + exportData.setMonthRate(data.getMonthRate()); + exportDataList.add(exportData); + }); + if (generateExcel(exportDataList, "Shock", dto.getCreateTime())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportAmpliReal(BusiAmpliRealDto dto) { + dto.setLimit("9999"); + //默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getDate()); + } + Page page = new Page(dto.getPage(), dto.getLimit()); + List details = busiAmpliRealMapper.findShockRealDetailsByCondition(page, dto); + if (CollectionUtil.isEmpty(details)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + if (generateAmpliExcel(details)) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return null; + } + + @Override + public AjaxResult exportCenterReal(BusiCenterRealDto dto) { + dto.setLimit("9999"); + //默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getDate()); + } + Page page = new Page(dto.getPage(), dto.getLimit()); + List details = busiCenterRealMapper.findCenterRealDetailsByMainId(page, dto); + if (CollectionUtil.isEmpty(details)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + if (generateCenterExcel(details)) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return null; + } + + @Override + public AjaxResult exportNoiseReal(BusiNoiseRealDto dto) { + dto.setLimit("9999"); + //默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getDate()); + } + Page page = new Page(dto.getPage(), dto.getLimit()); + List details = busiNoiseRealMapper.findNoiseRealDetailsByMainId(page, dto); + if (CollectionUtil.isEmpty(details)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "暂无数据"); + } + if (generateNoiseExcel(details)) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return null; + } + + private boolean generateAmpliExcel(List details) { + String fileName = getExportFileName("ampliReal", DateUtils.getDate()) + ".xlsx"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + details.get(0).getDeviceName() + "传感器实时数据", AMPLI_REAL_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), AMPLI_REAL_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < details.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(details.get(i).getSide()); + currentRow.createCell(j++).setCellValue(details.get(i).getPhase()); + currentRow.createCell(j++).setCellValue(details.get(i).getInOut()); + currentRow.createCell(j++).setCellValue(details.get(i).getFrequency()); + currentRow.createCell(j++).setCellValue(details.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(details.get(i).getInsTime()); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } + + private boolean generateCenterExcel(List details) { + String fileName = getExportFileName("center", DateUtils.getDate()) + ".xlsx"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + details.get(0).getDeviceName() + "中心点实时数据", CENTER_REAL_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), CENTER_REAL_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < details.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(details.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(details.get(i).getInsTime()); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } + + private boolean generateNoiseExcel(List details) { + String fileName = getExportFileName("noise", DateUtils.getDate()) + ".xlsx"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + details.get(0).getDeviceName() + "噪声实时数据", NOISE_REAL_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), NOISE_REAL_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < details.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(details.get(i).getMaxAmplitude()); + currentRow.createCell(j++).setCellValue(details.get(i).getInsTime()); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiFrequencyConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiFrequencyConfServiceImpl.java new file mode 100644 index 0000000..a6bceee --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiFrequencyConfServiceImpl.java @@ -0,0 +1,63 @@ +package com.chenxuan.service.impl; + + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiFrequencyConf; +import com.chenxuan.mapper.BusiFrequencyConfMapper; +import com.chenxuan.service.BusiFrequencyConfService; + + +/** + * @ClassName:BusiFrequencyConfServiceImpl + * @Description: 振动装置频率配置信息服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/9/2020 10:23 AM + * @Version V1.0 + */ +@Service +public class BusiFrequencyConfServiceImpl extends ServiceImpl implements BusiFrequencyConfService { + + @Autowired + private BusiFrequencyConfMapper busiFrequencyConfMapper; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = busiFrequencyConfMapper.selectPages( page, query.getParams() ); + page.setRecords(records); + return page; + } + + @Override + public BusiFrequencyConf selectFrequencyConfById(String id) { + return busiFrequencyConfMapper.findFrequencyConfById( id ); + } + + @Override + public boolean insertFrequencyConf(BusiFrequencyConf busiFrequencyConf) { + busiFrequencyConf.setId(UuidUtils.getUUID()); + busiFrequencyConf.setInsTime(new Date()); + return busiFrequencyConfMapper.saveFrequencyConf( busiFrequencyConf ) > 0 ? true : false; + } + + @Override + public boolean updateFrequencyConf(BusiFrequencyConf busiFrequencyConf) { + busiFrequencyConf.setInsTime(new Date()); + return busiFrequencyConfMapper.updateFrequencyConf( busiFrequencyConf ) > 0 ? true : false; + } + + @Override + public boolean deleteFrequencyConfById(String id) { + int count = busiFrequencyConfMapper.deleteById(id); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiIedparamServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiIedparamServiceImpl.java new file mode 100644 index 0000000..31a9389 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiIedparamServiceImpl.java @@ -0,0 +1,150 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.chenxuan.entity.model.BusiIedparam; +import com.chenxuan.entity.vo.BusiIedparamVo; +import com.chenxuan.mapper.BusiIedparamMapper; +import com.chenxuan.service.BusiIedparamService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +/** + * @author buck_guo + */ +@Service +public class BusiIedparamServiceImpl implements BusiIedparamService { + + @Autowired + private BusiIedparamMapper busiIedparamMapper; + @Override + public List quereyIcdById(String id) { + return busiIedparamMapper.quereyIcdById(id); + } + + @Override + public boolean save(BusiIedparam entity) { + return false; + } + + @Override + public boolean saveBatch(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean saveOrUpdateBatch(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean removeById(Serializable id) { + return false; + } + + @Override + public boolean removeByMap(Map columnMap) { + return false; + } + + @Override + public boolean remove(Wrapper queryWrapper) { + return false; + } + + @Override + public boolean removeByIds(Collection idList) { + return false; + } + + @Override + public boolean updateById(BusiIedparam entity) { + return false; + } + + @Override + public boolean update(BusiIedparam entity, Wrapper updateWrapper) { + return false; + } + + @Override + public boolean updateBatchById(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean saveOrUpdate(BusiIedparam entity) { + return false; + } + + @Override + public BusiIedparam getById(Serializable id) { + return null; + } + + @Override + public Collection listByIds(Collection idList) { + return null; + } + + @Override + public Collection listByMap(Map columnMap) { + return null; + } + + @Override + public BusiIedparam getOne(Wrapper queryWrapper, boolean throwEx) { + return null; + } + + @Override + public Map getMap(Wrapper queryWrapper) { + return null; + } + + @Override + public V getObj(Wrapper queryWrapper, Function mapper) { + return null; + } + + @Override + public int count(Wrapper queryWrapper) { + return 0; + } + + @Override + public List list(Wrapper queryWrapper) { + return null; + } + + @Override + public IPage page(IPage page, Wrapper queryWrapper) { + return null; + } + + @Override + public List> listMaps(Wrapper queryWrapper) { + return null; + } + + @Override + public List listObjs(Wrapper queryWrapper, Function mapper) { + return null; + } + + @Override + public IPage> pageMaps(IPage page, Wrapper queryWrapper) { + return null; + } + + @Override + public BaseMapper getBaseMapper() { + return null; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiMainDeviceServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiMainDeviceServiceImpl.java new file mode 100644 index 0000000..81e3f34 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiMainDeviceServiceImpl.java @@ -0,0 +1,198 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.GenerateUtil; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiMainDeviceDto; +import com.chenxuan.entity.model.BusiCalcParamConf; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.model.BusiSubDevice; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.entity.vo.PercentageVo; +import com.chenxuan.mapper.*; +import com.chenxuan.service.BusiMainDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @ClassName:BusiMainDeviceServiceImpl + * @Description: 主变信息服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/3/2020 15:50 PM + * @Version V1.0 + */ +@Service +public class BusiMainDeviceServiceImpl extends ServiceImpl implements BusiMainDeviceService { + + @Autowired + private BusiMainDeviceMapper busiMainDeviceMapper; + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Autowired + private BusiNoiseThresholdConfMapper busiNoiseThresholdConfMapper; + + @Autowired + private BusiCenterThresholdConfMapper busiCenterThresholdConfMapper; + + @Autowired + private BusiTransformerConfMapper busiTransformerConfMapper; + + @Autowired + private BusiTransformerRealMapper busiTransformerRealMapper; + + @Autowired + private BusiCalcParamConfMapper paramConfMapper; + + @Autowired + private BusiControlConfigMapper configMapper; + + @Override + public Page page(BusiMainDeviceDto busiMainDeviceDto) { + Page page = new Page(busiMainDeviceDto.getPage(), busiMainDeviceDto.getLimit()); + List records = busiMainDeviceMapper.selectPages(page, busiMainDeviceDto); + page.setRecords(records); + return page; + } + + @Override + public BusiMainDevice selectMainDeviceById(String id) { + return busiMainDeviceMapper.findMainDeviceById(id); + } + + @Override + public AjaxResult insertMainDevice(BusiMainDevice busiMainDevice) { + //判断新增的数据名称是否重复 + if (busiMainDeviceMapper.getMainDeviceCount(busiMainDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "名称重复,请重新输入"); + } + //给新增数据设值 + busiMainDevice.setId(UuidUtils.getUUID()); + busiMainDevice.setHbaseRowkey(null); + busiMainDevice.setState("Y"); + busiMainDevice.setSystemCode(GenerateUtil.generateCode(17)); + //查询模板数据(评估参数) + List calcParamConfs = paramConfMapper.selectPages(); + //给模板数据设置主变ID + calcParamConfs.stream().forEach( paramConf -> { + paramConf.setId(UuidUtils.getUUID()); + paramConf.setMainId(busiMainDevice.getId()); + }); + //批量新增评估参数(每新增一个主变,默认从模板表中拉取数据新增评估参数) + if (busiMainDeviceMapper.saveMainDevice(busiMainDevice) > 0 && paramConfMapper.saveCalcParamConf(calcParamConfs) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "新增成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "新增失败"); + } + + @Override + public AjaxResult updateMainDevice(BusiMainDevice busiMainDevice) { + busiMainDevice.setHbaseRowkey(null); + BusiMainDevice mainDevice = busiMainDeviceMapper.selectById(busiMainDevice.getId()); + //判断主变下是否已经存在该装置 + if (!busiMainDevice.getDeviceName().equals(mainDevice.getDeviceName())) { + //判断名称是否重复 + if (busiMainDeviceMapper.getMainDeviceCount(busiMainDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "名称重复,请重新输入"); + } + } + //修改 + if (busiMainDeviceMapper.updateMainDevice(busiMainDevice) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "修改成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "修改失败"); + } + + @Override + public boolean deleteMainDeviceById(String id) { + //删除主变评估参数关联信息 + paramConfMapper.deleteByMainId(id); + //删除主变关联信息 + configMapper.deleteConfsByMainId(id); + //删除主变关联噪声信息 + busiNoiseThresholdConfMapper.deleteThresholdConfByMainId(id); + //删除主变关联中心点信息 + busiCenterThresholdConfMapper.deleteThresholdConfByMainId(id); + //删除原副边配置关系信息 + busiTransformerConfMapper.deleteConfsByMainId(id); + //删除原副边配置关系 + busiTransformerRealMapper.delTransformerRealRelation(id); + //删除主变装置关联关系 + busiSubDeviceMapper.deleteSubDeviceByMainId(id); + //删除主变信息 + int count = busiMainDeviceMapper.deleteById(id); + return count > 0 ? true : false; + } + + @Override + public List selectBusiMainDeviceList() { + Map map = new HashMap<>(); + //正常变压器 + map.put("state", "Y"); + List list = busiMainDeviceMapper.selectList(map); + return list; + } + + @Override + public PercentageVo selectCountDeviceTotal() { + //创建返回对象 + PercentageVo percentageVo = new PercentageVo(); + //先获取变压器总数 + QueryWrapper busiMainDeviceQueryWrapper = new QueryWrapper(); + Integer count = busiMainDeviceMapper.selectCount(busiMainDeviceQueryWrapper); + Integer maxDevice = count * 12; + //最大装置总数 + BigDecimal maxDeviceBigDecimal = BigDecimal.valueOf(maxDevice); + //获取所有装置数量 + QueryWrapper busiSubDeviceQueryWrapper = new QueryWrapper(); + Integer totalSubDevice = busiSubDeviceMapper.selectCount(busiSubDeviceQueryWrapper); + BigDecimal bigDecimalTotalSubDevice = BigDecimal.valueOf(totalSubDevice); + //计算百分比 + BigDecimal divide = bigDecimalTotalSubDevice.divide(maxDeviceBigDecimal, 2, BigDecimal.ROUND_HALF_UP); + BigDecimal multiply = divide.multiply(new BigDecimal(100)); + percentageVo.setPercent(multiply); + percentageVo.setNum(totalSubDevice.toString()); + return percentageVo; + } + + @Override + public PercentageVo selectNormalDevice() { + + Map map = new HashMap<>(); + + map.put("state", "N"); + List list = busiMainDeviceMapper.selectByMap(map); + Integer size = list.size(); + //创建返回对象 + PercentageVo percentageVo = new PercentageVo(); + + percentageVo.setPercent(null); + percentageVo.setNum(size.toString()); + return percentageVo; + } + + @Override + public PercentageVo selectCountEcpDevice() { + Map map = new HashMap<>(); + + map.put("state", "Y"); + List list = busiMainDeviceMapper.selectByMap(map); + Integer size = list.size(); + //创建返回对象 + PercentageVo percentageVo = new PercentageVo(); + + percentageVo.setPercent(null); + percentageVo.setNum(size.toString()); + return percentageVo; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiNoiseRealServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiNoiseRealServiceImpl.java new file mode 100644 index 0000000..0779976 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiNoiseRealServiceImpl.java @@ -0,0 +1,144 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.BusiMainDevice; +import com.chenxuan.entity.model.BusiNoiseReal; +import com.chenxuan.entity.vo.BusiNoiseRealDetailsVo; +import com.chenxuan.entity.vo.BusiNoiseRealVo; +import com.chenxuan.entity.vo.ColVo; +import com.chenxuan.entity.vo.TableVo; +import com.chenxuan.mapper.BusiMainDeviceMapper; +import com.chenxuan.mapper.BusiNoiseRealMapper; +import com.chenxuan.service.BusiNoiseRealService; +import com.chenxuan.utils.DateUtils; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @ClassName:BusiNoiseRealServiceImpl + * @Description: 噪声实时数据服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/16/2020 14:50 PM + * @Version V1.0 + */ +@Service +public class BusiNoiseRealServiceImpl extends ServiceImpl implements BusiNoiseRealService { + + @Autowired + private BusiNoiseRealMapper busiNoiseRealMapper; + + @Autowired + private BusiMainDeviceMapper busiMainDeviceMapper; + + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + @Override + public List selectNoiseRealByMainId(String mainId) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00"); + List list = busiNoiseRealMapper.findNoiseRealByMainId(mainId, DateUtils.getDate()); + List voList = new ArrayList(list.size()); + list.stream().forEach(bnr -> { + TableVo tVo = new TableVo(); + List rows = new ArrayList(); + //创建三个colVo对象 + ColVo colVo1 = new ColVo(); + ColVo colVo2 = new ColVo(); + ColVo colVo3 = new ColVo(); + colVo1.setCol(sdf.format(bnr.getInsTime())); + colVo3.setCol(bnr.getMaxAmplitude()); + rows.add(colVo1); + rows.add(colVo2); + rows.add(colVo3); + tVo.setId(bnr.getId()); + tVo.setRows(rows); + voList.add(tVo); + }); + return voList; + } + + @Override + public boolean insertNoiseReal(List busiNoiseRealList) { + busiNoiseRealList.stream().forEach(bcr -> { + bcr.setId(UuidUtils.getUUID()); + bcr.setInsTime(new Date()); + bcr.setHbaseRowkey(null); + }); + return busiNoiseRealMapper.saveNoiseReal(busiNoiseRealList) > 0 ? true : false; + } + + @Override + public BusiNoiseRealVo findNoiseRealChartByInfo(BusiNoiseRealDto busiNoiseRealDto) { + SimpleDateFormat sdf = new SimpleDateFormat("HH"); + //根据所传信息查询振动实时数据 + busiNoiseRealDto.setInsTime(DateUtils.getDate()); + List busiNoiseReals = busiNoiseRealMapper.findNoiseRealChartByInfo(busiNoiseRealDto); + List gatherTimeList = new ArrayList(busiNoiseReals.size()); + List maxAmplitudeList = new ArrayList(busiNoiseReals.size()); + //循环将数据都放在所在集合里 + busiNoiseReals.stream().forEach(bnr -> { + gatherTimeList.add(sdf.format(bnr.getInsTime())); + maxAmplitudeList.add(bnr.getMaxAmplitude()); + }); + BusiNoiseRealVo busiNoiseRealVo = new BusiNoiseRealVo(); + busiNoiseRealVo.setMainId(busiNoiseRealDto.getMainId()); + busiNoiseRealVo.setGatherTimeList(gatherTimeList); + busiNoiseRealVo.setMaxAmplitudeList(maxAmplitudeList); + return busiNoiseRealVo; + } + + @Override + public BusiNoiseRealVo selectNoiseRealByMainIdAndCreateTime(BusiNoiseRealDto busiNoiseRealDto) { + if (StringUtils.isEmpty(busiNoiseRealDto.getMainId()) && StringUtils.isEmpty(busiNoiseRealDto.getCreateTime())) { + BusiMainDevice busiMainDevice = busiMainDeviceMapper.findLatestMainDeviceByCondition(); + busiNoiseRealDto.setMainId(busiMainDevice.getId()); + busiNoiseRealDto.setCreateTime(sdf.format(new Date())); + } + List bnrList = busiNoiseRealMapper.findNoiseRealByMainIdAndCreateTime(busiNoiseRealDto); + List gatherTimeList = new ArrayList(); + List maxAmplitudeList = new ArrayList(); + //处理时间为小时 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH"); + bnrList.stream().forEach(bnr -> { + gatherTimeList.add(simpleDateFormat.format(bnr.getInsTime())); + maxAmplitudeList.add(bnr.getMaxAmplitude()); + }); + BusiNoiseRealVo bnrVo = new BusiNoiseRealVo(); + if (bnrList.size() > 0) { + bnrVo.setMainId(bnrList.get(0).getMainId()); + } + bnrVo.setGatherTimeList(gatherTimeList); + bnrVo.setMaxAmplitudeList(maxAmplitudeList); + return bnrVo; + } + + @Override + public Page getNoiseRealDetailsByMainId(BusiNoiseRealDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + //默认加载时间 + if (StringUtils.isBlank(dto.getInsTime())) { + dto.setInsTime(DateUtils.getDate()); + } + List records = busiNoiseRealMapper.findNoiseRealDetailsByMainId(page, dto); + page.setRecords(records); + return page; + } + + @Override + public List selectMainDeviceList() { + return busiNoiseRealMapper.selectMainDeviceList(); + } + + @Override + public List selectNoiseRealDataByMainId(String mainId) { + Map map = new HashMap<>(); + map.put("main_id", mainId); + return busiNoiseRealMapper.selectByMap(map); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiNoiseRealStatisticsServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiNoiseRealStatisticsServiceImpl.java new file mode 100644 index 0000000..bcc797a --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiNoiseRealStatisticsServiceImpl.java @@ -0,0 +1,41 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.entity.model.BusiNoiseRealStatistics; +import com.chenxuan.mapper.BusiNoiseRealStatisticsMapper; +import com.chenxuan.service.BusiNoiseRealStatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-07-09 4:21 PM + **/ +@Service +public class BusiNoiseRealStatisticsServiceImpl extends ServiceImpl implements BusiNoiseRealStatisticsService { + + @Autowired + private BusiNoiseRealStatisticsMapper busiNoiseRealStatisticsMapper; + + @Override + public List selectMainDeviceList() { + List busiCenterRealStatistics = busiNoiseRealStatisticsMapper.selectMainDeviceList(); + return busiCenterRealStatistics; + } + + @Override + public BusiNoiseRealStatistics getMainDeviceListTodayData(BusiNoiseRealStatistics busiNoiseRealStatistics) { + return null; + } + + @Override + public BusiNoiseRealStatistics getMainDeviceListYesterdayData(BusiNoiseRealStatistics busiNoiseRealStatistics) { + return null; + } + + @Override + public BusiNoiseRealStatistics getMainDeviceListBeforOneMonthData(BusiNoiseRealStatistics busiNoiseRealStatistics) { + return null; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiNoiseThresholdConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiNoiseThresholdConfServiceImpl.java new file mode 100644 index 0000000..73bff36 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiNoiseThresholdConfServiceImpl.java @@ -0,0 +1,125 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiNoiseThresholdConfDto; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiNoiseThresholdConf; +import com.chenxuan.entity.vo.BusiNoiseThresholdConfVo; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiNoiseThresholdConfMapper; +import com.chenxuan.mapper.BusiSubDeviceMapper; +import com.chenxuan.service.BusiNoiseThresholdConfService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:BusiNoiseThresholdConfServiceImpl + * @Description: 噪声装置阈值配置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/8/2020 15:48 PM + * @Version V1.0 + */ +@Service +public class BusiNoiseThresholdConfServiceImpl extends ServiceImpl implements BusiNoiseThresholdConfService { + + @Autowired + private BusiNoiseThresholdConfMapper busiNoiseThresholdConfMapper; + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Override + public Page page(BusiNoiseThresholdConfDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = busiNoiseThresholdConfMapper.selectPages(page, dto); + page.setRecords(records); + return page; + } + + @Override + public BusiNoiseThresholdConfVo selectThresholdConfByMainId(String mainId) { + return busiNoiseThresholdConfMapper.findThresholdConfByMainId(mainId); + } + + @Override + public AjaxResult insertThresholdConf(BusiNoiseThresholdConf conf) { + //根据主变id和装置类型查询信息 + Map params = new HashMap<>(); + //判断是否有主变ID + if (StringUtils.isEmpty(conf.getMainId())) { + return new AjaxResult(HttpStatusCode.ERROR, "请选择主变装置"); + } + params.put("mainId", conf.getMainId()); + params.put("deviceType", BusiSubDeviceDto.NOISE); + //根据赋值的数据查询装置信息 + BusiSubDeviceVo deviceVo = busiSubDeviceMapper.findSubDevice(params); + //判断变压器是否拥有当前装置 + if (StringUtils.isNull(deviceVo)) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器暂无噪声装置,请添加装置后再设置阈值"); + } + //判断当前主变是否已经设置过阈值 + if (StringUtils.isNotNull(busiNoiseThresholdConfMapper.findThresholdConfByMainId(conf.getMainId()))) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器噪声装置的阈值已经设置"); + } + //新增 + conf.setId(UuidUtils.getUUID()); + conf.setInsTime(new Date()); + conf.setSubId(deviceVo.getId()); + if (busiNoiseThresholdConfMapper.saveThresholdConf(conf) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "新增成功"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "新增失败"); + } + + @Override + public AjaxResult updateThresholdConf(BusiNoiseThresholdConf thresholdConf) { + //查询之前数据 + BusiNoiseThresholdConf conf = busiNoiseThresholdConfMapper.selectById(thresholdConf.getId()); + //判断是否是同一个主变下修改 + if (!thresholdConf.getMainId().equals(conf.getMainId())) { + //根据主变id和装置类型查询信息 + Map params = new HashMap<>(); + params.put("mainId", thresholdConf.getMainId()); + params.put("deviceType", BusiSubDeviceDto.CENTER); + //根据赋值的数据查询装置信息 + BusiSubDeviceVo deviceVo = busiSubDeviceMapper.findSubDevice(params); + //判断变压器是否拥有当前装置 + if (StringUtils.isNull(deviceVo)) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器暂无噪声装置,请添加装置后再设置阈值"); + } + //判断当前主变是否已经设置过阈值 + if (StringUtils.isNotNull(busiNoiseThresholdConfMapper.findThresholdConfByMainId(thresholdConf.getMainId()))) { + return new AjaxResult(HttpStatusCode.ERROR, "此变压器噪声装置的阈值已经设置"); + } + } + + if (busiNoiseThresholdConfMapper.updateThresholdConf(thresholdConf) > 0) { + return new AjaxResult(HttpStatusCode.SUCCESS, "修改成功"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "修改失败"); + } + + @Override + public boolean deleteThresholdConfByMainId(String mainId) { + int count = busiNoiseThresholdConfMapper.deleteThresholdConfByMainId(mainId); + return count > 0 ? true : false; + } + + @Override + public boolean delete(String id) { + int count = busiNoiseThresholdConfMapper.delete(id); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiParamBindServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiParamBindServiceImpl.java new file mode 100644 index 0000000..4adab7f --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiParamBindServiceImpl.java @@ -0,0 +1,175 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.entity.dto.BusiParamBindDto; +import com.chenxuan.entity.model.BusiParamBind; +import com.chenxuan.entity.vo.BusiParamBindVo; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiParamBindMapper; +import com.chenxuan.service.BusiParamBindService; +import com.chenxuan.service.BusiSubDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +@Service +public class BusiParamBindServiceImpl implements BusiParamBindService { + + @Autowired + private BusiParamBindMapper busiParamBindMapper; + @Autowired + private BusiSubDeviceService busiSubDeviceService; + @Override + public boolean addParamBind(BusiParamBind busiParamBind) { + BusiSubDeviceVo busiSubDeviceVo = busiSubDeviceService.querySubDeviceById(busiParamBind.getSubId()); + busiParamBind.setSensorCode(busiSubDeviceVo.getSensorCode()); + return busiParamBindMapper.addParamBind(busiParamBind)> 0 ? true : false; + } + + @Override + public boolean updateParamBind(BusiParamBind busiParamBind) { + return busiParamBindMapper.updateById(busiParamBind) > 0 ? true : false; + } + + @Override + public Page queryParamBind(BusiParamBindDto busiParamBindDto) { + + Page page = new Page(busiParamBindDto.getPage(), busiParamBindDto.getLimit()); + List records = busiParamBindMapper.queryParamBind(page, busiParamBindDto); + page.setRecords(records); + return page; + } + + @Override + public int delParamBind(int[] ids) { + return busiParamBindMapper.delParamBind(ids); + } + + @Override + public boolean save(BusiParamBind entity) { + return false; + } + + @Override + public boolean saveBatch(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean saveOrUpdateBatch(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean removeById(Serializable id) { + return false; + } + + @Override + public boolean removeByMap(Map columnMap) { + return false; + } + + @Override + public boolean remove(Wrapper queryWrapper) { + return false; + } + + @Override + public boolean removeByIds(Collection idList) { + return false; + } + + @Override + public boolean updateById(BusiParamBind entity) { + return false; + } + + @Override + public boolean update(BusiParamBind entity, Wrapper updateWrapper) { + return false; + } + + @Override + public boolean updateBatchById(Collection entityList, int batchSize) { + return false; + } + + @Override + public boolean saveOrUpdate(BusiParamBind entity) { + return false; + } + + @Override + public BusiParamBind getById(Serializable id) { + return null; + } + + @Override + public Collection listByIds(Collection idList) { + return null; + } + + @Override + public Collection listByMap(Map columnMap) { + return null; + } + + @Override + public BusiParamBind getOne(Wrapper queryWrapper, boolean throwEx) { + return null; + } + + @Override + public Map getMap(Wrapper queryWrapper) { + return null; + } + + @Override + public V getObj(Wrapper queryWrapper, Function mapper) { + return null; + } + + @Override + public int count(Wrapper queryWrapper) { + return 0; + } + + @Override + public List list(Wrapper queryWrapper) { + return null; + } + + @Override + public IPage page(IPage page, Wrapper queryWrapper) { + return null; + } + + @Override + public List> listMaps(Wrapper queryWrapper) { + return null; + } + + @Override + public List listObjs(Wrapper queryWrapper, Function mapper) { + return null; + } + + @Override + public IPage> pageMaps(IPage page, Wrapper queryWrapper) { + return null; + } + + @Override + public BaseMapper getBaseMapper() { + return null; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiSubDeviceServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiSubDeviceServiceImpl.java new file mode 100644 index 0000000..98c6f07 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiSubDeviceServiceImpl.java @@ -0,0 +1,135 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiSubDeviceDto; +import com.chenxuan.entity.model.BusiSubDevice; +import com.chenxuan.entity.vo.BusiSubDeviceVo; +import com.chenxuan.mapper.BusiSubDeviceMapper; +import com.chenxuan.service.BusiSubDeviceService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:BusiSubDeviceServiceImpl + * @Description: 主变装置信息服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/4/2020 15:10 PM + * @Version V1.0 + */ +@Service +public class BusiSubDeviceServiceImpl extends ServiceImpl implements BusiSubDeviceService { + + @Autowired + private BusiSubDeviceMapper busiSubDeviceMapper; + + @Override + public Page page(BusiSubDeviceDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = busiSubDeviceMapper.selectPages(page, dto); + page.setRecords(records); + return page; + } + + @Override + public List queryAll() { + List records = busiSubDeviceMapper.queryAll(); + return records; + } + + @Override + public BusiSubDeviceVo selectSubDeviceByMainId(String mainId) { + List subDeviceByMainId = busiSubDeviceMapper.findSubDeviceByMainId(mainId); + if (subDeviceByMainId.size() > 0) { + BusiSubDeviceVo subDevice = subDeviceByMainId.get(0); + return subDevice; + } + return null; + } + + @Override + public BusiSubDeviceVo querySubDeviceById(String id) { + BusiSubDeviceVo busiSubDeviceVo = busiSubDeviceMapper.querySubDeviceById(id); + return busiSubDeviceVo; + } + + + + + + @Override + public List querySubDeviceByMainId(String mainId) { + List list = busiSubDeviceMapper.findSubDeviceByMainId(mainId); + return list; + } + + @Override + public AjaxResult insertSubDevice(BusiSubDeviceDto dto) { + BusiSubDevice subDevice = new BusiSubDevice(); + BeanUtils.copyProperties(dto, subDevice); + subDevice.setId(UuidUtils.getUUID()); + subDevice.setInsTime(new Date()); + // 判断该装置名称是否重复 + if (busiSubDeviceMapper.getSubDeviceByName(subDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "名称重复,请重新输入"); + } + // 判断主变下是否已经存在该装置 + if (busiSubDeviceMapper.getSubDeviceCount(subDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "主变下已有当前装置,请勿重复添加"); + } + // 新增 + if (!(busiSubDeviceMapper.saveSubDevice(subDevice) > 0)) { + return new AjaxResult(HttpStatusCode.ERROR, "新增失败"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "新增成功"); + } + + @Override + public AjaxResult updateSubDevice(BusiSubDevice busiSubDevice) { + // 根据装置id查询当前装置 + BusiSubDevice subDevice = busiSubDeviceMapper.selectById(busiSubDevice.getId()); + // 判断主变下是否已经存在该装置 + if (!busiSubDevice.getSubDeviceName().equals(subDevice.getSubDeviceName())) { + // 判断名称是否重复 + if (busiSubDeviceMapper.getSubDeviceByName(busiSubDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "名称重复,请重新输入"); + } + } + // 判断不是振动装置原副边、相位、上下侧都为空 + if (!busiSubDevice.getDeviceType().equals(BusiSubDeviceDto.Ampli)) { + busiSubDevice.setSide(null); + busiSubDevice.setInOut(null); + busiSubDevice.setPhase(null); + } + // 判断装置是否有改变 + if (!subDevice.equals(busiSubDevice)) { + // 判断主变下是否已经存在该装置 + if (busiSubDeviceMapper.getSubDeviceCount(busiSubDevice) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "主变下已有当前装置,请勿重复添加"); + } + } + // 修改装置信息 + if (!(busiSubDeviceMapper.updateSubDevice(busiSubDevice) > 0)) { + return new AjaxResult(HttpStatusCode.ERROR, "修改失败"); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "修改成功"); + } + + @Override + public boolean deleteSubDeviceByMainId(String mainId) { + return busiSubDeviceMapper.deleteSubDeviceByMainId(mainId) > 0 ? true : false; + } + + @Override + public boolean delete(String id) { + return busiSubDeviceMapper.delete(id) > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiTransformerConfServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiTransformerConfServiceImpl.java new file mode 100644 index 0000000..7f7d5d3 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiTransformerConfServiceImpl.java @@ -0,0 +1,94 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiTransformerConf; +import com.chenxuan.entity.vo.BusiTransformerConfVo; +import com.chenxuan.mapper.BusiTransformerConfMapper; +import com.chenxuan.service.BusiTransformerConfService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.Date; +import java.util.List; + +/** + * @ClassName:BusiTransformerConfServiceImpl + * @Description: 原副边电流电压实时数据配置服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/2/2020 16:46 PM + * @Version V1.0 + */ +@Service +public class BusiTransformerConfServiceImpl extends ServiceImpl implements BusiTransformerConfService { + + @Autowired + private BusiTransformerConfMapper busiTransformerConfMapper; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = busiTransformerConfMapper.selectPages(page, query.getParams()); + page.setRecords(records); + return page; + } + + @Override + public List selectConfigsByMainId(String mainId) { + return busiTransformerConfMapper.selectConfigByMainId(mainId); + } + + @Override + public boolean insertConfigs(List busiTransformerConfList) { + + for (BusiTransformerConf btc : busiTransformerConfList) { + btc.setId(UuidUtils.getUUID()); + btc.setInsTime(new Date()); + btc.setHbaseRowkey(null); + } + return busiTransformerConfMapper.saveConfigs(busiTransformerConfList) > 0 ? true : false; + } + + @Override + public boolean updateConfigs(List busiTransformerConfList) { + List busiTransformerConfs = busiTransformerConfMapper.selectConfigByMainId(busiTransformerConfList.get(0).getMainId()); + if (busiTransformerConfs.size() > 0) { + for (BusiTransformerConfVo busiTransformerConf : busiTransformerConfs) { + for (BusiTransformerConf btc : busiTransformerConfList) { + if ("P".equals(busiTransformerConf.getSide()) && "P".equals(btc.getConfFlag())) { + btc.setId(busiTransformerConf.getId()); + } + if ("S".equals(busiTransformerConf.getSide()) && "S".equals(btc.getConfFlag())) { + btc.setId(busiTransformerConf.getId()); + } + } + for (BusiTransformerConf btc : busiTransformerConfList) { + btc.setInsTime(new Date()); + btc.setHbaseRowkey(null); + } + return busiTransformerConfMapper.updateConfigs(busiTransformerConfList) > 0 ? true : false; + } + } else { + for (BusiTransformerConf btc : busiTransformerConfList) { + btc.setId(UuidUtils.getUUID()); + btc.setInsTime(new Date()); + btc.setHbaseRowkey(null); + } + return busiTransformerConfMapper.saveConfigs(busiTransformerConfList) > 0 ? true : false; + } + return false; + } + + @Override + public boolean deleteConfById(String id) { + int count = busiTransformerConfMapper.deleteConfById(id); + return count > 0 ? true : false; + } + + @Override + public boolean deleteConfsByMainId(String mainId) { + int count = busiTransformerConfMapper.deleteConfsByMainId(mainId); + return count > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiTransformerRealServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiTransformerRealServiceImpl.java new file mode 100644 index 0000000..6c7925e --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiTransformerRealServiceImpl.java @@ -0,0 +1,113 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.ExcelUtils; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiTransformerRealDto; +import com.chenxuan.entity.model.BusiTransformerReal; +import com.chenxuan.mapper.BusiTransformerRealMapper; +import com.chenxuan.service.BusiTransformerRealService; +import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.Date; +import java.util.List; + + +/** + * @ClassName:BusiTransformerRealServiceImpl + * @Description: 原副边电流电压实时数据服务实现类. + * @Author: Jordan_Li + * @CreatTime:6/2/2020 16:46 PM + * @Version V1.0 + */ +@Service +public class BusiTransformerRealServiceImpl extends ServiceImpl implements BusiTransformerRealService { + + @Autowired + private BusiTransformerRealMapper BusiTransformerRealMapper; + + private final static String FILE_NAME_PREFIX = "Real_Data_Export_"; + + /*sheet页1名称*/ + private final static String SHEET1_NAME = "sheet1"; + + private final String[] TRANSFORMER_EXPORT_HEADER = {"主变名称", "原副边", "电压(kV)", "电流(A)", "创建时间"}; + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = BusiTransformerRealMapper.selectPages(page, query.getParams()); + page.setRecords(records); + return page; + } + + @Override + public List selectTransformerRealByMainId(String mainId) { + return BusiTransformerRealMapper.selectTransformerRealByMainId(mainId); + } + + @Override + public boolean exporTransformReal(BusiTransformerRealDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = BusiTransformerRealMapper.selectPages(page, dto.getParams()); + return generateExcel(records, dto.getCreateTime()); + } + + @Override + public boolean insertTransformerReals(List busiTransformerRealList) { + for (BusiTransformerReal btr : busiTransformerRealList) { + btr.setId(UuidUtils.getUUID()); + btr.setInsTime(new Date()); + btr.setHbaseRowkey(null); + } + return BusiTransformerRealMapper.saveTransformerReal(busiTransformerRealList) > 0 ? true : false; + } + + private boolean generateExcel(List exportDataList, String createTime) { + String fileName = getExportFileName(createTime); + File excelfile = new File(fileName + ".xlsx"); + try (FileOutputStream fileOutputStream = new FileOutputStream(excelfile)) { + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "原副边电流电压实时数据", TRANSFORMER_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), TRANSFORMER_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < exportDataList.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getDeviceName()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getSide()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getVoltage().toString()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getCurrent().toString()); + currentRow.createCell(j++).setCellValue(exportDataList.get(i).getInsTime()); + } + workbook.write(fileOutputStream); + fileOutputStream.flush(); + } catch (Exception e) { + return false; + } + return true; + } + + private String getExportFileName(String createTime) { + StringBuilder fileName = new StringBuilder(); + fileName.append(FILE_NAME_PREFIX).append("_") + .append(DateFormatUtils.format(Long.parseLong(createTime), "yyyyMMddhhmmss")); + return fileName.toString(); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/BusiWarningServiceImpl.java b/src/main/java/com/chenxuan/service/impl/BusiWarningServiceImpl.java new file mode 100644 index 0000000..bf307b9 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/BusiWarningServiceImpl.java @@ -0,0 +1,117 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.entity.dto.BusiWarningDto; +import com.chenxuan.entity.model.BusiWarning; +import com.chenxuan.entity.vo.BusiWarningVo; +import com.chenxuan.mapper.BusiWarningMapper; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.service.BusiWarningService; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class BusiWarningServiceImpl extends ServiceImpl implements BusiWarningService { + + @Autowired + private BusiWarningMapper busiWarningMapper; + + @Autowired + private JwtTokenService jwtTokenService; + + @Override + public Page page(BusiWarningDto dto) { + Page page = new Page<>(dto.getPage(), dto.getLimit()); + List records; + // 判断是首页的 还是明细 + if (StringUtils.isAllBlank(dto.getMainId(), dto.getSubId())) { + records = busiWarningMapper.selectPages(dto); + // 查询ied的报警信息 + page.setSize(9999999); + List busiWarningVos = busiWarningMapper.selectPageByWarnType(page, dto); + BusiWarningVo warningVo = busiWarningVos.get(0); + warningVo.setWarningSum(String.valueOf(busiWarningVos.size())); + records.add(warningVo); + } else { + records = busiWarningMapper.getDetails(page, dto); + } + records.stream().forEach(record -> { + // 查询告警次数 + if (StringUtils.isNotBlank(record.getSubId())) { + int numberAlarm = busiWarningMapper.getNumberAlarm(record.getSubId()); + record.setWarningSum(String.valueOf(numberAlarm)); + } + // 震动装置 + if ("1".equals(record.getDeviceType())) { + record.setRate(record.getAmplitudeRate()); + record.setThreshold(record.getAmplitudeThreshold()); + if (StringUtils.isNotBlank(record.getSampleValue())) { + record.setSampleValue(record.getSampleValue() + "(mm/s2)"); + } + } + // 噪声装置 + if ("2".equals(record.getDeviceType())) { + record.setRate(record.getNoiseRate()); + record.setThreshold(record.getNoiseThreshold()); + record.setDeviceLocation(record.getDeviceLocation() + "/噪声"); + if (StringUtils.isNotBlank(record.getSampleValue())) { + record.setSampleValue(record.getSampleValue() + "(dB)"); + } + } + // 中心点装置 + if ("3".equals(record.getDeviceType())) { + record.setRate(record.getCurrentRate()); + record.setThreshold(record.getCurrentThreshold()); + record.setDeviceLocation(record.getDeviceLocation() + "/中心点"); + if (StringUtils.isNotBlank(record.getSampleValue())) { + record.setSampleValue(record.getSampleValue() + "(A)"); + } + } + }); + page.setRecords(records); + return page; + } + + @Override + public Page getPage(BusiWarningDto dto) { + Page page = new Page<>(dto.getPage(), dto.getLimit()); + List busiWarningVos = busiWarningMapper.selectPageByWarnType(page, dto); + return page.setRecords(busiWarningVos); + } + + @Override + public boolean insertWarning(BusiWarning busiWarning) { + return busiWarningMapper.saveWarning(busiWarning) > 0 ? true : false; + } + + @Override + public boolean updateWarning(BusiWarning busiWarning) { + // 获取用户信息 + LoginUser loginUser = jwtTokenService.getLoginUser(ServletUtils.getRequest()); + // 设置修改需要的参数 + busiWarning.setState(BusiWarningDto.SOLVE); + busiWarning.setProcessTime(new Date()); + busiWarning.setProcessUser(String.valueOf(loginUser.getUser().getUserId())); + // 单条修改 + if (StringUtils.isNotBlank(busiWarning.getId())) { + return busiWarningMapper.updateWarning(busiWarning) > 0 ? true : false; + } + // 批量修改 + if (StringUtils.isNotBlank(busiWarning.getSubId()) + || !StringUtils.isAllBlank(busiWarning.getSubId(), busiWarning.getWarnType())) { + return busiWarningMapper.updateWarningByStatus(busiWarning) > 0 ? true : false; + } + // 批量处理所有的告警(无论类型和装置) + if (StringUtils.isAllBlank(busiWarning.getId(), busiWarning.getSubId(), busiWarning.getWarnType())) { + return busiWarningMapper.updateWarningByStatus(busiWarning) > 0 ? true : false; + } + return false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/QuartzManagerServiceImpl.java b/src/main/java/com/chenxuan/service/impl/QuartzManagerServiceImpl.java new file mode 100644 index 0000000..986f2ad --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/QuartzManagerServiceImpl.java @@ -0,0 +1,153 @@ +package com.chenxuan.service.impl; + +import com.alibaba.fastjson.JSON; +import com.chenxuan.base.entity.CustomQuartzJobBean; +import com.chenxuan.base.entity.JobConstant; +import com.chenxuan.base.entity.JobOperateEnum; +import com.chenxuan.entity.model.ScheduleJob; +import com.chenxuan.service.QuartzManagerService; +import lombok.extern.slf4j.Slf4j; +import org.quartz.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @ClassName:QuartzServiceImpl + * @Description: 定时任务服务 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 8:50 PM + * @Version V1.0 + */ +@Slf4j +@Service +@Transactional +public class QuartzManagerServiceImpl implements QuartzManagerService { + + @Autowired + private Scheduler scheduler; + + @Override + public void addJob(ScheduleJob job) throws SchedulerException { + CronTrigger trigger = getCronTrigger(scheduler, job.getJobId()); + if (trigger == null) { + //创建触发器 + trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId())) + .withSchedule(CronScheduleBuilder.cronSchedule(job.getCronExpression())) + .startNow() + .build(); + //创建任务 + JobDetail jobDetail = JobBuilder.newJob(CustomQuartzJobBean.class) + .withIdentity(getJobKey(job.getJobId())) + .build(); + + //传入调度的数据,在QuartzFactory中需要使用 + jobDetail.getJobDataMap().put(JobConstant.JOB_PARAM_KEY, job); + //调度作业 + scheduler.scheduleJob(jobDetail, trigger); + + } + + } + + @Override + public void updateJob(ScheduleJob job) throws SchedulerException { + TriggerKey triggerKey = getTriggerKey(job.getJobId()); + CronTrigger trigger = getCronTrigger(scheduler, job.getJobId()); + if (trigger == null) { + return; + } + String oldTime = trigger.getCronExpression(); + if (!oldTime.equalsIgnoreCase(job.getCronExpression())) { + //表达式调度构建器 + CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()) + .withMisfireHandlingInstructionDoNothing(); + //按新的cronExpression表达式重新构建trigger + trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build(); + //参数 + trigger.getJobDataMap().put(JobConstant.JOB_PARAM_KEY, JSON.toJSONString(job)); + scheduler.rescheduleJob(triggerKey, trigger); + //暂停任务 + if (job.getStatus().equals(JobOperateEnum.PAUSE.getValue())) { + operateJob(JobOperateEnum.PAUSE, job); + } + } + } + + @Override + public void run(ScheduleJob job) throws SchedulerException { + //参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(JobConstant.JOB_PARAM_KEY, JSON.toJSONString(job)); + scheduler.triggerJob(getJobKey(job.getJobId()), dataMap); + } + + @Override + public void operateJob(JobOperateEnum jobOperateEnum, ScheduleJob job) throws SchedulerException { + JobKey jobKey = getJobKey(job.getJobId()); + JobDetail jobDetail = scheduler.getJobDetail(jobKey); + if (jobDetail == null) { + //抛异常 + } + switch (jobOperateEnum) { + case START: + scheduler.resumeJob(jobKey); + break; + case PAUSE: + scheduler.pauseJob(jobKey); + break; + case DELETE: + scheduler.deleteJob(jobKey); + break; + } + } + + @Override + public void startAllJob() throws SchedulerException { + scheduler.start(); + } + + @Override + public void pauseAllJob() throws SchedulerException { + scheduler.standby(); + } + + + /** + * @param jobId 任务id + * @return CronTrigger + * @throws + * @Title: getCronTrigger + * @Description: 获取表达式触发器 + * @createDate: Jul 3, 2019 3:02:49 PM + */ + public static CronTrigger getCronTrigger(Scheduler scheduler, Long jobId) throws SchedulerException { + return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId)); + } + + /** + * @param jobId 任务id + * @return TriggerKey + * @throws + * @Title: getTriggerKey + * @Description: 获取触发器key + * @createDate: Jul 3, 2019 3:03:22 PM + */ + public static TriggerKey getTriggerKey(Long jobId) { + return TriggerKey.triggerKey(JobConstant.TRIGGER_kEY + jobId); + } + + + /** + * @param jobId 任务id + * @return JobKey + * @throws + * @Title: getJobKey + * @Description: 获取jobKey + * @createDate: Jul 3, 2019 3:03:06 PM + */ + public static JobKey getJobKey(Long jobId) { + return JobKey.jobKey(JobConstant.JOB_KEY + jobId); + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/ScheduleJobServiceImpl.java b/src/main/java/com/chenxuan/service/impl/ScheduleJobServiceImpl.java new file mode 100644 index 0000000..7a2803c --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/ScheduleJobServiceImpl.java @@ -0,0 +1,154 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.JobOperateEnum; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.dto.ScheduleJobDto; +import com.chenxuan.entity.model.ScheduleJob; +import com.chenxuan.mapper.ScheduleJobMapper; +import com.chenxuan.service.QuartzManagerService; +import com.chenxuan.service.ScheduleJobService; +import org.quartz.CronExpression; +import org.quartz.Scheduler; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * @ClassName:ScheduleJobServiceImpl + * @Description: 任务服务实现 + * @Author: Arno_Fu + * @CreatTime:12/25/2019 - 9:00 PM + * @Version V1.0 + */ +@Service +public class ScheduleJobServiceImpl extends ServiceImpl implements ScheduleJobService { + + @Autowired + private ScheduleJobMapper scheduleJobMapper; + + @Autowired + private QuartzManagerService quartzManagerService; + + @Autowired + private Scheduler scheduler; + + @Override + public void timingTask() throws SchedulerException { + scheduler.clear(); + List scheduleJobs = scheduleJobMapper.selectLists(new HashMap<>()); + if (CollectionUtils.isNotEmpty(scheduleJobs)) { + for (ScheduleJob scheduleJob : scheduleJobs) { + quartzManagerService.addJob(scheduleJob); + } + } + } + + @Override + public Page queryPage(ScheduleJobDto dto) { + Page page = new Page<>(dto.getPage(), dto.getLimit()); + List records = scheduleJobMapper.selectPages(page, dto); + page.setRecords(records); + return page; + } + + @Override + public List getList(Map params) { + List list = scheduleJobMapper.selectLists(params); + return list == null ? Collections.emptyList() : list; + } + + @Override + public AjaxResult add(ScheduleJob job) throws SchedulerException { + //校验corn表达式是否正确 + if (!CronExpression.isValidExpression(job.getCronExpression())) { + return new AjaxResult(HttpStatusCode.ERROR, "corn表达式不正确"); + } + //校验 + if (scheduleJobMapper.selectJobCount(job.getBeanName()) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "服务名称不可重复"); + } + job.setCreateTime(new Date()); + job.setStatus(JobOperateEnum.START.getValue()); + if (!this.save(job)) { + return new AjaxResult(HttpStatusCode.ERROR, "新增失败"); + } + quartzManagerService.addJob(job); + return new AjaxResult(HttpStatusCode.SUCCESS, "新增成功"); + } + + @Override + public AjaxResult update(ScheduleJob job) throws SchedulerException { + //校验corn表达式是否正确 + if (!CronExpression.isValidExpression(job.getCronExpression())) { + return new AjaxResult(HttpStatusCode.ERROR, "corn表达式不正确"); + } + //查询当前id的目前在库数据 + ScheduleJob scheduleJob = scheduleJobMapper.selectById(job.getJobId()); + //判断修改的名称是否一样,不一样的话校验是否存在 + if (!scheduleJob.getBeanName().equals(job.getBeanName())) { + //校验 + if (scheduleJobMapper.selectJobCount(job.getBeanName()) > 0) { + return new AjaxResult(HttpStatusCode.ERROR, "服务名称不可重复"); + } + } + job.setUpdateTime(new Date()); + //修改 + if (!this.updateById(job)) { + return new AjaxResult(HttpStatusCode.ERROR, "修改失败"); + } + quartzManagerService.updateJob(job); + return new AjaxResult(HttpStatusCode.SUCCESS, "修改成功"); + } + + @Override + public boolean start(String[] jobIds) throws SchedulerException { + List jobList = scheduleJobMapper.selectBatchIds(Arrays.asList(jobIds)); + for (ScheduleJob scheduleJob : jobList) { + scheduleJob.setStatus(JobOperateEnum.START.getValue()); + quartzManagerService.operateJob(JobOperateEnum.PAUSE, scheduleJob); + } + boolean flag = this.updateBatchById(jobList); + return flag; + } + + @Override + public boolean pause(String[] jobIds) throws SchedulerException { + List jobList = scheduleJobMapper.selectBatchIds(Arrays.asList(jobIds)); + for (ScheduleJob scheduleJob : jobList) { + scheduleJob.setStatus(JobOperateEnum.PAUSE.getValue()); + quartzManagerService.operateJob(JobOperateEnum.PAUSE, scheduleJob); + } + boolean flag = this.updateBatchById(jobList); + return flag; + } + + @Override + public AjaxResult delete(String[] jobIds) throws SchedulerException { + if (!super.removeByIds(Arrays.asList(jobIds))){ + return new AjaxResult(HttpStatusCode.ERROR, "删除失败"); + } + List scheduleJobs = scheduleJobMapper.selectBatchIds(Arrays.asList(jobIds)); + for (ScheduleJob job : scheduleJobs) { + quartzManagerService.operateJob(JobOperateEnum.DELETE, job); + } + return new AjaxResult(HttpStatusCode.SUCCESS, "删除成功"); + } + + @Override + public void startAllJob() throws SchedulerException { + quartzManagerService.startAllJob(); + scheduleJobMapper.updateStatus(JobOperateEnum.START.getValue()); + } + + @Override + public void pauseAllJob() throws SchedulerException { + quartzManagerService.pauseAllJob(); + scheduleJobMapper.updateStatus(JobOperateEnum.PAUSE.getValue()); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysConfigServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysConfigServiceImpl.java new file mode 100644 index 0000000..9191687 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysConfigServiceImpl.java @@ -0,0 +1,81 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysConfig; +import com.chenxuan.mapper.SysConfigMapper; +import com.chenxuan.service.SysConfigService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 参数配置表 服务实现类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Service +public class SysConfigServiceImpl extends ServiceImpl implements SysConfigService { + + + @Autowired + private SysConfigMapper sysConfigMapper; + + @Override + public SysConfig selectConfigById(Long configId) { + return this.getById( configId ); + } + + @Override + public Object selectConfigByKey(String configKey) { + SysConfig config = new SysConfig(); + config.setConfigKey( configKey ); + SysConfig retConfig = sysConfigMapper.selectConfig( config ); + return StringUtils.isNotNull( retConfig ) ? retConfig.getConfigValue() : ""; + } + + @Override + public Page queryPage(Query query) { + Page page = new Page( query.getPage(), query.getLimit() ); + List records = sysConfigMapper.selectConfigList( page, query.getParams() ); + page.setRecords( records ); + return page; + } + + @Override + public boolean insertConfig(SysConfig config) { + return this.save( config ); + } + + @Override + public boolean updateConfig(SysConfig config) { + return this.updateById( config ); + } + + @Override + public boolean deleteConfigById(Long configId) { + return sysConfigMapper.deleteConfigById( configId ) > 0 ? true : false; + } + + @Override + public boolean deleteConfigByIds(Long[] configIds) { + return sysConfigMapper.deleteConfigByIds( configIds ) > 0 ? true : false; + } + + @Override + public boolean checkConfigKeyUnique(SysConfig config) { + Long configId = StringUtils.isNull( config.getConfigId() ) ? -1L : config.getConfigId(); + SysConfig info = sysConfigMapper.checkConfigKeyUnique( config.getConfigKey() ); + if (StringUtils.isNotNull( info ) && info.getConfigId().longValue() != configId.longValue()) { + return false; + } + return true; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysDeptServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysDeptServiceImpl.java new file mode 100644 index 0000000..18a47fc --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,187 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDept; +import com.chenxuan.entity.vo.TreeSelect; +import com.chenxuan.mapper.SysDeptMapper; +import com.chenxuan.service.SysDeptService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 部门表 服务实现类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Service +public class SysDeptServiceImpl extends ServiceImpl implements SysDeptService { + + @Autowired + private SysDeptMapper sysDeptMapper; + + @Override + public List getDeptList() { + return sysDeptMapper.selectDeptList(); + } + + @Override + public List getDeptList(Query query) { + return sysDeptMapper.selectDeptLists( query.getParams() ); + } + + @Override + public List buildDeptTree(List depts) { + List returnList = new ArrayList(); + for (Iterator iterator = depts.iterator(); iterator.hasNext(); ) { + SysDept t = (SysDept) iterator.next(); + // 根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == 0) { + recursionFn( depts, t ); + returnList.add( t ); + } + } + if (returnList.isEmpty()) { + returnList = depts; + } + return returnList; + } + + + @Override + public List buildDeptTreeSelect(List depts) { + List deptTrees = buildDeptTree( depts ); + return deptTrees.stream().map( TreeSelect::new ).collect( Collectors.toList() ); + } + + + @Override + public Boolean checkDeptNameUnique(SysDept dept) { + Long deptId = StringUtils.isNull( dept.getDeptId() ) ? -1L : dept.getDeptId(); + SysDept info = sysDeptMapper.checkDeptNameUnique( dept.getDeptName(), dept.getParentId() ); + if (StringUtils.isNotNull( info ) && info.getDeptId().longValue() != deptId.longValue()) { + return false; + } + return true; + } + + @Override + public Boolean insertDept(SysDept dept) { + return super.save( dept ); + } + + @Override + public Boolean updateDept(SysDept dept) { + SysDept newParentDept = super.getById( dept.getParentId() ); + SysDept oldDept = super.getById( dept.getDeptId() ); + if (StringUtils.isNotNull( newParentDept ) && StringUtils.isNotNull( oldDept )) { + String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String oldAncestors = oldDept.getAncestors(); + dept.setAncestors( newAncestors ); + updateDeptChildren( dept.getDeptId(), newAncestors, oldAncestors ); + } + boolean flag = super.updateById( dept ); + if ("0".equals( dept.getStatus() )) { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + sysDeptMapper.updateDeptStatus( dept ); + } + return flag; + } + + @Override + public boolean hasChildByDeptId(Long deptId) { + int result = sysDeptMapper.hasChildByDeptId( deptId ); + return result > 0 ? true : false; + } + + @Override + public boolean checkDeptExistUser(Long deptId) { + int result = sysDeptMapper.checkDeptExistUser( deptId ); + return result > 0 ? true : false; + } + + @Override + public boolean deleteDeptById(Long deptId) { + int result = sysDeptMapper.deleteDeptById( deptId ); + return result > 0 ? true : false; + } + + @Override + public SysDept getByPK(Long deptId) { + return super.getById( deptId ); + } + + @Override + public List selectDeptListByRoleId(Long roleId) { + return sysDeptMapper.selectDeptListByRoleId( roleId ); + } + + /** + * 修改子元素关系 + * + * @param deptId 被修改的部门ID + * @param newAncestors 新的父ID集合 + * @param oldAncestors 旧的父ID集合 + */ + public void updateDeptChildren(Long deptId, String newAncestors, String oldAncestors) { + List children = sysDeptMapper.selectChildrenDeptById( deptId ); + for (SysDept child : children) { + child.setAncestors( child.getAncestors().replace( oldAncestors, newAncestors ) ); + } + if (children.size() > 0) { + sysDeptMapper.updateDeptChildren( children ); + } + } + + + /** + * 递归列表 + */ + private void recursionFn(List list, SysDept t) { + // 得到子节点列表 + List childList = getChildList( list, t ); + t.setChildren( childList ); + for (SysDept tChild : childList) { + if (hasChild( list, tChild )) { + // 判断是否有子节点 + Iterator it = childList.iterator(); + while (it.hasNext()) { + SysDept n = (SysDept) it.next(); + recursionFn( list, n ); + } + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysDept t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + SysDept n = (SysDept) it.next(); + if (n.getParentId().longValue() == t.getDeptId().longValue()) { + tlist.add( n ); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysDept t) { + return getChildList( list, t ).size() > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysDictDataServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysDictDataServiceImpl.java new file mode 100644 index 0000000..c61ef8a --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysDictDataServiceImpl.java @@ -0,0 +1,78 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDictData; +import com.chenxuan.mapper.SysDictDataMapper; +import com.chenxuan.service.SysDictDataService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * @ClassName:SysDictDataServiceImpl + * @Description: 字典数据表 服务实现类 + * @Author: Arno_Fu + * @CreatTime:11/28/2019 - 4:55 PM + * @Version V1.0 + */ + +@Service +public class SysDictDataServiceImpl extends ServiceImpl implements SysDictDataService { + + @Autowired + private SysDictDataMapper sysDictDataMapper; + + @Override + public List getDictDataByType(String dictType) { + return sysDictDataMapper.selectDictDataByType(dictType); + } + + + @Override + public Page selectDictDataPage(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + page.setRecords(sysDictDataMapper.selectDictDataPage(page, query.getParams())); + return page; + } + + @Override + public List selectDictDataByType(String dictType) { + return sysDictDataMapper.selectDictDataByType(dictType); + } + + @Override + public String selectDictLabel(String dictType, String dictValue) { + return sysDictDataMapper.selectDictLabel(dictType, dictValue); + } + + @Override + public SysDictData selectDictDataById(Long dictCode) { + return this.getById(dictCode); + } + + @Override + public boolean deleteDictDataById(Long dictCode) { + return sysDictDataMapper.deleteDictDataById(dictCode) > 0 ? true : false; + } + + @Override + public boolean deleteDictDataByIds(Long[] dictCodes) { + return sysDictDataMapper.deleteDictDataByIds(dictCodes) > 0 ? true : false; + } + + @Override + public boolean insertDictData(SysDictData dictData) { + return this.save(dictData); + } + + @Override + public boolean updateDictData(SysDictData dictData) { + return this.updateById(dictData); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysDictTypeServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysDictTypeServiceImpl.java new file mode 100644 index 0000000..6f67eac --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysDictTypeServiceImpl.java @@ -0,0 +1,87 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysDictType; +import com.chenxuan.mapper.SysDictTypeMapper; +import com.chenxuan.service.SysDictTypeService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 字典类型表 服务实现类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Service +public class SysDictTypeServiceImpl extends ServiceImpl implements SysDictTypeService { + + @Autowired + private SysDictTypeMapper sysDictTypeMapper; + + @Override + public Page selectDictTypePage(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + page.setRecords(sysDictTypeMapper.selectDictTypePage(page, query.getParams())); + return page; + } + + @Override + public List selectDictTypeList() { + return this.list(); + } + + @Override + public List selectDictTypeAll() { + return sysDictTypeMapper.selectDictTypeAll(); + } + + @Override + public SysDictType selectDictTypeById(Long dictId) { + return this.getById(dictId); + } + + @Override + public SysDictType selectDictTypeByType(String dictType) { + return sysDictTypeMapper.selectDictTypeByType(dictType); + } + + @Override + public boolean deleteDictTypeById(Long dictId) { + int count = sysDictTypeMapper.deleteDictTypeById(dictId); + return count > 0 ? true : false; + } + + @Override + public boolean deleteDictTypeByIds(Long[] dictIds) { + return sysDictTypeMapper.deleteDictTypeByIds(dictIds) > 0 ? true : false; + } + + @Override + public boolean insertDictType(SysDictType dictType) { + return this.save(dictType); + } + + @Override + public boolean updateDictType(SysDictType dictType) { + return this.saveOrUpdate(dictType); + } + + @Override + public boolean checkDictTypeUnique(SysDictType dict) { + Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId(); + SysDictType dictType = sysDictTypeMapper.checkDictTypeUnique(dict.getDictType()); + if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { + return false; + } + return true; + + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysExecServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysExecServiceImpl.java new file mode 100644 index 0000000..42a9257 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysExecServiceImpl.java @@ -0,0 +1,36 @@ +package com.chenxuan.service.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.entity.model.*; +import com.chenxuan.mapper.*; +import com.chenxuan.service.SysExecService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + + + +@Service +public class SysExecServiceImpl extends ServiceImpl implements SysExecService { + + //@Autowired + //private SysUserMapper sysUserMapper; + + + + @Override + public void runtimeExec(String command) { + + try { + Process proc = Runtime.getRuntime().exec( command ); + } catch (IOException e) { + e.printStackTrace(); + } + + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/SysExportDataServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysExportDataServiceImpl.java new file mode 100644 index 0000000..7cdb582 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysExportDataServiceImpl.java @@ -0,0 +1,378 @@ +package com.chenxuan.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.chenxuan.base.entity.AjaxResult; +import com.chenxuan.base.entity.Query; +import com.chenxuan.constants.ExcelUtils; +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.entity.dto.SysLoginLogDto; +import com.chenxuan.entity.dto.SysOperLogDto; +import com.chenxuan.entity.dto.SysRoleDto; +import com.chenxuan.entity.model.*; +import com.chenxuan.mapper.*; +import com.chenxuan.service.SysExportDataService; +import com.chenxuan.utils.DateUtils; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.List; + +@Service +public class SysExportDataServiceImpl implements SysExportDataService { + + @Autowired + private SysOperLogMapper sysOperLogMapper; + @Autowired + private SysLoginLogMapper sysLoginLogMapper; + @Autowired + private SysUserMapper sysUserMapper; + @Autowired + private SysRoleMapper sysRoleMapper; + @Autowired + private SysDictTypeMapper sysDictTypeMapper; + + @Autowired + HttpServletResponse response; + + private final static String FILE_NAME_PREFIX = "Data_Export_"; + + /*sheet页1名称*/ + private final static String SHEET1_NAME = "sheet1"; + /** + * 操作日志标题栏 + */ + private final String[] OPERLOG_EXPORT_HEADER = {"日志编号", "系统模块", "操作类型", "请求方式", "操作人员", + "主机", "操作地点", "操作状态", "操作日期"}; + /** + * 登录日志标题栏 + */ + private final String[] LOGIN_EXPORT_HEADER = {"访问编号", "用户名称", "登录地址", "登录地点", "浏览器", "操作系统", + "登录状态", "操作信息", "登录日期"}; + /** + * 用户管理标题栏 + */ + private final String[] USER_EXPORT_HEADER = {"用户编号", "用户账号", "用户昵称", "手机号码", "邮箱", + "性别", "部门", "状态", "创建时间"}; + /** + * 角色管理标题栏 + */ + private final String[] ROLE_EXPORT_HEADER = {"角色编号", "角色名称", "权限字符", "显示顺序", "状态", "创建时间"}; + /** + * 字典管理标题栏 + */ + private final String[] DICT_EXPORT_HEADER = {"字典编号", "字典名称", "字典类型", "状态", "备注", "创建时间"}; + + private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00"); + + @Override + public AjaxResult exportOperLog(SysOperLogDto dto){ + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = sysOperLogMapper.exportOperLog(page, dto); + if (CollectionUtil.isEmpty(records)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "操作日志暂无数据"); + } + if (operLogExcel(records, "OPER", DateUtils.getDate())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportLoginLog(SysLoginLogDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = sysLoginLogMapper.exportLoginLog(page, dto); + if (CollectionUtil.isEmpty(records)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "登录日志暂无数据"); + } + if (loginLogExcel(records, "LOGIN", DateUtils.getDate())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportUserInfo(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = sysUserMapper.selectPages(page, query.getParams()); + if (CollectionUtil.isEmpty(records)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "用户信息暂无数据"); + } + if (userInfoExcel(records, "USER", DateUtils.getDate())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportRoleInfo(SysRoleDto dto) { + Page page = new Page(dto.getPage(), dto.getLimit()); + List records = sysRoleMapper.exportSysRole(page, dto); + if (CollectionUtil.isEmpty(records)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "角色暂无数据"); + } + if (roleInfoExcel(records, "ROLE", DateUtils.getDate())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + @Override + public AjaxResult exportDictInfo(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = sysDictTypeMapper.selectDictTypePage(page, query.getParams()); + if (CollectionUtil.isEmpty(records)) { + return new AjaxResult(HttpStatusCode.NO_DATA, "字典信息暂无数据"); + } + if (dictInfoExcel(records, "DICT", DateUtils.getDate())) { + return new AjaxResult(HttpStatusCode.SUCCESS, "导出成功"); + } + return new AjaxResult(HttpStatusCode.ERROR, "导出失败"); + } + + /** + * 操作日志excel导出 + * + * @param records + * @param fileType + * @param createTime + * @return + */ + private boolean operLogExcel(List records, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xls"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "操作日志明细", OPERLOG_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), OPERLOG_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < records.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(records.get(i).getOperId()); + currentRow.createCell(j++).setCellValue(records.get(i).getTitle()); + currentRow.createCell(j++).setCellValue(records.get(i).getOperatorType() == 1 ? "新增" : + records.get(i).getOperatorType() == 2 ? "修改" : records.get(i).getOperatorType() == 3 ? "删除" : "其他"); + currentRow.createCell(j++).setCellValue(records.get(i).getRequestMethod()); + currentRow.createCell(j++).setCellValue(records.get(i).getOperName()); + currentRow.createCell(j++).setCellValue(records.get(i).getOperIp()); + currentRow.createCell(j++).setCellValue(records.get(i).getOperLocation()); + currentRow.createCell(j++).setCellValue(records.get(i).getStatus() == 0 ? "成功" : + records.get(i).getStatus() == 1 ? "失败" : ""); + currentRow.createCell(j++).setCellValue(sdf.format(records.get(i).getOperTime())); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } + + /** + * 登录日志excel + * + * @param records + * @param fileType + * @param createTime + * @return + */ + private boolean loginLogExcel(List records, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xls"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "登录日志明细", LOGIN_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), LOGIN_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < records.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(records.get(i).getLoginId()); + currentRow.createCell(j++).setCellValue(records.get(i).getUserName()); + currentRow.createCell(j++).setCellValue(records.get(i).getIpaddr()); + currentRow.createCell(j++).setCellValue(records.get(i).getLoginLocation()); + currentRow.createCell(j++).setCellValue(records.get(i).getBrowser()); + currentRow.createCell(j++).setCellValue(records.get(i).getOs()); + currentRow.createCell(j++).setCellValue(records.get(i).getStatus().equals("0") ? "成功" : + records.get(i).getStatus().equals("1") ? "失败" : ""); + currentRow.createCell(j++).setCellValue(records.get(i).getMsg()); + currentRow.createCell(j++).setCellValue(sdf.format(records.get(i).getLoginTime())); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (Exception e) { + response.setStatus(500); + } + return true; + } + + /** + * 用户信息excel + * + * @param records + * @param fileType + * @param createTime + * @return + */ + private boolean userInfoExcel(List records, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xls"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "用户信息", USER_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), USER_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < records.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(records.get(i).getUserId()); + currentRow.createCell(j++).setCellValue(records.get(i).getUserName()); + currentRow.createCell(j++).setCellValue(records.get(i).getNickName()); + currentRow.createCell(j++).setCellValue(records.get(i).getPhone()); + currentRow.createCell(j++).setCellValue(records.get(i).getEmail()); + currentRow.createCell(j++).setCellValue(records.get(i).getSex().equals("1") ? "男" : + records.get(i).getSex().equals("2") ? "女" : "未知"); + currentRow.createCell(j++).setCellValue(records.get(i).getDept().getDeptName()); + currentRow.createCell(j++).setCellValue(records.get(i).getStatus().equals("0") ? "正常" : + records.get(i).getStatus().equals("1") ? "停用" : ""); + currentRow.createCell(j++).setCellValue(records.get(i).getCreateTime()); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (IOException e) { + response.setStatus(500); + } + return true; + } + + /** + * 角色信息excel + * + * @param records + * @param fileType + * @param createTime + * @return + */ + private boolean roleInfoExcel(List records, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xls"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "角色信息", ROLE_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), ROLE_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < records.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(records.get(i).getRoleId()); + currentRow.createCell(j++).setCellValue(records.get(i).getRoleName()); + currentRow.createCell(j++).setCellValue(records.get(i).getRoleKey()); + currentRow.createCell(j++).setCellValue(records.get(i).getRoleSort()); + currentRow.createCell(j++).setCellValue(records.get(i).getStatus().equals("0")? "正常" : + records.get(i).getStatus().equals("1")? "停用" : ""); + currentRow.createCell(j++).setCellValue(sdf.format(records.get(i).getCreateTime())); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (IOException e) { + response.setStatus(500); + } + return true; + } + + /** + * 字典信息excel + * + * @param records + * @param fileType + * @param createTime + * @return + */ + private boolean dictInfoExcel(List records, String fileType, String createTime) { + String fileName = getExportFileName(fileType, createTime) + ".xls"; + try { + OutputStream out = response.getOutputStream(); + response.setContentType("application/json; charset=utf-8"); + response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName, "GBK")); + //创建工作簿对象 + XSSFWorkbook workbook = new XSSFWorkbook(); + //创建工作表 + XSSFSheet sheet = workbook.createSheet(SHEET1_NAME); + //设置标题 + ExcelUtils.titleStyle(workbook, sheet.createRow(0), sheet, + "字典信息", DICT_EXPORT_HEADER.length); + ExcelUtils.creatNoColorRow(sheet.createRow(1), DICT_EXPORT_HEADER, workbook); + ExcelUtils.setCellStyle(workbook); + for (int i = 0; i < records.size(); i++) { + int rowIndex = i + 2; + Row currentRow = sheet.createRow(rowIndex); + int j = 0; + currentRow.createCell(j++).setCellValue(records.get(i).getDictId()); + currentRow.createCell(j++).setCellValue(records.get(i).getDictName()); + currentRow.createCell(j++).setCellValue(records.get(i).getDictType()); + currentRow.createCell(j++).setCellValue(records.get(i).getStatus().equals("0") ? "正常" : + records.get(i).getStatus().equals("1") ? "停用" : ""); + currentRow.createCell(j++).setCellValue(records.get(i).getRemark()); + currentRow.createCell(j++).setCellValue(records.get(i).getCreateTime()); + } + workbook.write(out); + out.flush(); + out.close(); + } catch (IOException e) { + response.setStatus(500); + } + return true; + } + + private String getExportFileName(String type, String createTime) { + StringBuilder fileName = new StringBuilder(); + fileName.append(FILE_NAME_PREFIX).append(type).append("_") + .append(createTime); + return fileName.toString(); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysLoginLogServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysLoginLogServiceImpl.java new file mode 100644 index 0000000..9a74bc4 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysLoginLogServiceImpl.java @@ -0,0 +1,50 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysLoginLog; +import com.chenxuan.mapper.SysLoginLogMapper; +import com.chenxuan.service.SysLoginLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class SysLoginLogServiceImpl extends ServiceImpl implements SysLoginLogService { + + @Autowired + private SysLoginLogMapper sysLoginLogMapper; + + @Override + public void insertLoginLog(SysLoginLog sysLoginLog) { + sysLoginLog.setLoginTime( new Date() ); + this.save( sysLoginLog ); + } + + @Override + public Page selectLoginLogPage(Query query) { + Page page = new Page( query.getPage(), query.getLimit() ); + List records = sysLoginLogMapper.selectLoginLogPage( page, query.getParams() ); + page.setRecords( records ); + return page; + } + + @Override + public List selectLoginLogList(Query query) { + return sysLoginLogMapper.selectLoginLogList( query.getParams() ); + } + + @Override + public boolean deleteLoginLogByIds(Long[] infoIds) { + return sysLoginLogMapper.deleteLoginLogByIds( infoIds ) > 0 ? true : false; + } + + @Override + public void cleanLoginLog() { + this.sysLoginLogMapper.cleanLoginLog(); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysMenuServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysMenuServiceImpl.java new file mode 100644 index 0000000..639dae9 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysMenuServiceImpl.java @@ -0,0 +1,274 @@ +package com.chenxuan.service.impl; + + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysMenu; +import com.chenxuan.entity.model.SysUser; +import com.chenxuan.entity.vo.MetaVo; +import com.chenxuan.entity.vo.RouterVo; +import com.chenxuan.entity.vo.TreeSelect; +import com.chenxuan.mapper.SysMenuMapper; +import com.chenxuan.mapper.SysRoleMenuMapper; +import com.chenxuan.security.LoginUser; +import com.chenxuan.security.service.JwtTokenService; +import com.chenxuan.service.SysMenuService; +import com.chenxuan.utils.SecurityUtils; +import com.chenxuan.utils.ServletUtils; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.util.*; +import java.util.stream.Collectors; + + +/** + * @ClassName:SysMenuServiceImpl + * @Description: 菜单权限表 服务实现类 + * @Author: Arno_Fu + * @CreatTime:11/27/2019 - 9:52 AM + * @Version V1.0 + */ + +@Service +public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService { + + @Autowired + private SysMenuMapper sysMenuMapper; + + @Autowired + private SysRoleMenuMapper roleMenuMapper; + + @Autowired + private JwtTokenService jwtTokenService; + + @Override + public SysMenu getByPK(Serializable pk) { + return super.getById(pk); + } + + + @Override + public List getMenuList() { + List menus = sysMenuMapper.selectMenuList(); + LoginUser user = jwtTokenService.getLoginUser(ServletUtils.getRequest()); + //特殊账户使用 + if (!user.getUser().getStatus().equals("2") && CollectionUtil.isNotEmpty(menus)) { + menus.removeIf(sysMenu -> sysMenu.getMenuName().equals("评估参数") + || sysMenu.getMenuName().equals("振动对比试验") + || sysMenu.getMenuName().equals("振动分离")); + } + return menus; + } + + @Override + public List getMenuList(Query query) { + LoginUser user = jwtTokenService.getLoginUser(ServletUtils.getRequest()); + List menus = sysMenuMapper.selectMenuLists(query.getParams()); + //特殊账户使用 + if (!user.getUser().getStatus().equals("2") && CollectionUtil.isNotEmpty(menus)) { + menus.removeIf(sysMenu -> sysMenu.getMenuName().equals("评估参数") + || sysMenu.getMenuName().equals("振动对比试验") + || sysMenu.getMenuName().equals("振动分离")); + } + return menus; + } + + @Override + public Set getMenuPermsByUserId(Long userId) { + return sysMenuMapper.selectMenuPermsByUserId(userId); + } + + + @Override + public List getMenuTreeByUserId(SysUser user) { + List menus = null; + if (SecurityUtils.isAdmin(user.getUserId()) || user.getStatus().equals("2")) { + menus = sysMenuMapper.selectMenuTreeAll(); + } else { + menus = sysMenuMapper.selectMenuTreeByUserId(user.getUserId()); + } + //特殊账户使用 + if (!user.getStatus().equals("2") && CollectionUtil.isNotEmpty(menus)) { + menus.removeIf(sysMenu -> sysMenu.getMenuName().equals("评估参数") + || sysMenu.getMenuName().equals("振动对比试验") + || sysMenu.getMenuName().equals("振动分离")); + } + return getChildPerms(menus, 0); + } + + @Override + public List buildMenus(List menus) { + List routers = new LinkedList(); + for (SysMenu menu : menus) { + RouterVo router = new RouterVo(); + router.setName(menu.getMenuName()); + router.setPath(getRouterPath(menu)); + router.setComponent(StrUtil.isEmpty(menu.getComponent()) ? "Layout" : menu.getComponent()); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setName(menu.getMenuName()); + List cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && "M".equals(menu.getMenuType())) { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + routers.add(router); + } + return routers; + } + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + @Override + public List buildMenuTree(List menus) { + List returnList = new ArrayList(); + for (Iterator iterator = menus.iterator(); iterator.hasNext(); ) { + SysMenu t = (SysMenu) iterator.next(); + // 根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == 0) { + recursionFn(menus, t); + returnList.add(t); + } + } + if (returnList.isEmpty()) { + returnList = menus; + } + return returnList; + } + + @Override + public List buildMenuTreeSelect(List menus) { + List menuTrees = buildMenuTree(menus); + return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + + @Override + public boolean hasChildByMenuId(Long menuId) { + return sysMenuMapper.hasChildByMenuId(menuId) > 0 ? true : false; + } + + @Override + public boolean checkMenuExistRole(Long menuId) { + return roleMenuMapper.checkMenuExistRole(menuId) > 0 ? true : false; + } + + @Override + public boolean insertMenu(SysMenu menu) { + return super.save(menu); + } + + @Override + public boolean updateMenu(SysMenu menu) { + return super.updateById(menu); + } + + @Override + public boolean deleteMenuById(Long menuId) { + return super.removeById(menuId); + } + + @Override + public boolean checkMenuNameUnique(SysMenu menu) { + Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId(); + SysMenu info = sysMenuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId()); + if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { + return false; + } + return true; + } + + @Override + public List selectMenuListByRoleId(Long roleId) { + return sysMenuMapper.selectMenuListByRoleId(roleId); + } + + /** + * 根据父节点的ID获取所有子节点 + * + * @param list 分类表 + * @param parentId 传入的父节点ID + * @return String + */ + private List getChildPerms(List list, int parentId) { + List returnList = new ArrayList(); + for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { + SysMenu t = (SysMenu) iterator.next(); + // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 + if (t.getParentId() == parentId) { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysMenu t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + SysMenu n = (SysMenu) it.next(); + if (n.getParentId().longValue() == t.getMenuId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + + /** + * 获取路由地址 + * + * @param menu 菜单信息 + * @return 路由地址 + */ + public String getRouterPath(SysMenu menu) { + String routerPath = menu.getPath(); + // 非外链并且是一级目录 + if (0 == menu.getParentId().intValue() && "1".equals(menu.getIsFrame().toString())) { + routerPath = "/" + menu.getPath(); + } + return routerPath; + } + + /** + * 递归列表 + * + * @param list + * @param t + */ + private void recursionFn(List list, SysMenu t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysMenu tChild : childList) { + if (hasChild(list, tChild)) { + // 判断是否有子节点 + Iterator it = childList.iterator(); + while (it.hasNext()) { + SysMenu n = (SysMenu) it.next(); + recursionFn(list, n); + } + } + } + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysMenu t) { + return getChildList(list, t).size() > 0 ? true : false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysOperLogServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysOperLogServiceImpl.java new file mode 100644 index 0000000..36f81b1 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysOperLogServiceImpl.java @@ -0,0 +1,62 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysOperLog; +import com.chenxuan.mapper.SysOperLogMapper; +import com.chenxuan.service.SysOperLogService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @ClassName:SysOperLogServiceImpl + * @Description: 操作日志 服务层处理 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 11:19 AM + * @Version V1.0 + */ + +@Service +public class SysOperLogServiceImpl extends ServiceImpl implements SysOperLogService { + + @Autowired + private SysOperLogMapper sysOperLogMapper; + + @Override + public void insertOperlog(SysOperLog operLog) { + super.save(operLog); + } + + @Override + public Page selectOperLogPage(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + List records = sysOperLogMapper.selectOperLogPage(page, query.getParams()); + page.setRecords(records); + return page; + } + + @Override + public List selectOperLogList(Map params) { + return sysOperLogMapper.selectOperLogList(params); + } + + @Override + public int deleteOperLogByIds(Long[] operIds) { + return sysOperLogMapper.deleteOperLogByIds(operIds); + } + + @Override + public SysOperLog selectOperLogById(Long operId) { + return this.getById(operId); + } + + @Override + public void cleanOperLog() { + sysOperLogMapper.cleanOperLog(); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysPostServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysPostServiceImpl.java new file mode 100644 index 0000000..364f1dc --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysPostServiceImpl.java @@ -0,0 +1,98 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysPost; +import com.chenxuan.mapper.SysPostMapper; +import com.chenxuan.service.SysPostService; +import com.chenxuan.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + *

+ * 岗位信息表 服务实现类 + *

+ * + * @author Arno_Fu + * @since 2019-11-26 + */ +@Slf4j +@Service +public class SysPostServiceImpl extends ServiceImpl implements SysPostService { + + @Autowired + private SysPostMapper sysPostMapper; + + + @Override + public List lists() { + return super.list(); + } + + @Override + public Boolean deleteById(Long postId) { + return super.removeById( postId ); + } + + @Override + public Boolean deleteByIds(Long[] postIds) { + return super.removeByIds( Arrays.asList( postIds ) ); + } + + @Override + public Boolean insertPost(SysPost post) { + return this.save( post ); + } + + @Override + public Boolean updatePost(SysPost post) { + return this.updateById( post ); + } + + @Override + public SysPost getByPK(Long postId) { + return super.getById( postId ); + } + + @Override + public Page page(Query query) { + Page page = new Page( query.getPage(), query.getLimit() ); + Map params = query.getParams(); + List records = sysPostMapper.selectPages( page, params ); + page.setRecords( records ); + return page; + } + + @Override + public Boolean checkPostNameUnique(SysPost post) { + Long postId = StringUtils.isNull( post.getPostId() ) ? -1L : post.getPostId(); + SysPost info = sysPostMapper.checkPostNameUnique( post.getPostName() ); + if (StringUtils.isNotNull( info ) && info.getPostId().longValue() != postId.longValue()) { + return false; + } + return true; + } + + @Override + public Boolean checkPostCodeUnique(SysPost post) { + Long postId = StringUtils.isNull( post.getPostId() ) ? -1L : post.getPostId(); + SysPost info = sysPostMapper.checkPostCodeUnique( post.getPostCode() ); + if (StringUtils.isNotNull( info ) && info.getPostId().longValue() != postId.longValue()) { + return false; + } + return true; + } + + @Override + public List selectPostListByUserId(Long userId) { + return sysPostMapper.selectPostListByUserId( userId ); + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysRoleServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysRoleServiceImpl.java new file mode 100644 index 0000000..2f79b24 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysRoleServiceImpl.java @@ -0,0 +1,206 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.SysRole; +import com.chenxuan.entity.model.SysRoleDept; +import com.chenxuan.entity.model.SysRoleMenu; +import com.chenxuan.exception.CustomException; +import com.chenxuan.mapper.SysRoleDeptMapper; +import com.chenxuan.mapper.SysRoleMapper; +import com.chenxuan.mapper.SysRoleMenuMapper; +import com.chenxuan.mapper.SysUserRoleMapper; +import com.chenxuan.service.SysRoleService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.*; + + +/** + * @ClassName:SysRoleServiceImpl + * @Description: 角色信息表 服务实现类 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 9:09 PM + * @Version V1.0 + */ +@Service +public class SysRoleServiceImpl extends ServiceImpl implements SysRoleService { + + @Autowired + private SysRoleMapper sysRoleMapper; + + @Autowired + private SysUserRoleMapper sysUserRoleMapper; + + @Autowired + private SysRoleMenuMapper sysRoleMenuMapper; + + @Autowired + private SysRoleDeptMapper sysRoleDeptMapper; + + @Override + public Set getRolePermsByUserId(Long userId) { + List perms = sysRoleMapper.selectRolePermissionByUserId(userId); + Set permsSet = new HashSet<>(); + for (SysRole perm : perms) { + if (null != perm) { + permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); + } + } + return permsSet; + } + + @Override + public Page pages(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + page.setRecords(sysRoleMapper.selectPages(page, query.getParams())); + return page; + } + + @Override + public List lists() { + return super.list(); + } + + @Override + public SysRole getByPK(Long pk) { + return super.getById(pk); + } + + @Override + public Boolean checkRoleNameUnique(SysRole role) { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = sysRoleMapper.checkRoleNameUnique(role.getRoleName()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { + return false; + } + return true; + } + + @Override + public Boolean checkRoleKeyUnique(SysRole role) { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = sysRoleMapper.checkRoleKeyUnique(role.getRoleKey()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { + return false; + } + return true; + } + + @Override + public void checkRoleAllowed(SysRole role) { + if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { + throw new CustomException("不允许操作超级管理员角色"); + } + } + + @Override + public Boolean countUserRoleByRoleId(Long roleId) { + return sysUserRoleMapper.countUserRoleByRoleId(roleId) > 0 ? true : false; + } + + @Override + public Boolean insertRole(SysRole role) { + super.save(role); + // 新增角色信息 + return insertRoleMenu(role); + } + + @Override + public Boolean updateRole(SysRole role) { + // 修改角色信息 + super.updateById(role); + // 删除角色与菜单关联 + sysRoleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); + return insertRoleMenu(role); + } + + @Override + public Boolean updateRoleStatus(SysRole role) { + return super.updateById(role); + } + + @Override + public Boolean authDataScope(SysRole role) { + // 修改角色信息 + super.updateById(role); + // 删除角色与部门关联 + sysRoleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); + // 新增角色和部门信息(数据权限) + return insertRoleDept(role) > 0 ? true : false; + } + + @Override + public Boolean deleteRoleById(Long roleId) { + + return null; + } + + @Override + public Boolean deleteRoleByIds(Long[] roleIds) { + for (Long roleId : roleIds) { + checkRoleAllowed(new SysRole(roleId)); + SysRole role = getByPK(roleId); + if (countUserRoleByRoleId(roleId)) { + throw new CustomException(String.format("%1$s已分配,不能删除", role.getRoleName())); + } + } + return sysRoleMapper.deleteRoleByIds(roleIds) > 0 ? true : false; + } + + @Override + public List selectRoleAll() { + return sysRoleMapper.selectRoleAll(); + } + + @Override + public List selectRoleListByUserId(Long userId) { + return sysRoleMapper.selectRoleListByUserId(userId); + } + + /** + * 新增角色菜单信息 + * + * @param role 角色对象 + */ + public boolean insertRoleMenu(SysRole role) { + int rows = 1; + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long menuId : role.getMenuIds()) { + SysRoleMenu rm = new SysRoleMenu(); + rm.setRoleId(role.getRoleId()); + rm.setMenuId(menuId); + list.add(rm); + } + if (list.size() > 0) { + rows = sysRoleMenuMapper.batchRoleMenu(list); + } + return rows > 0 ? true : false; + } + + /** + * 新增角色部门信息(数据权限) + * + * @param role 角色对象 + */ + public int insertRoleDept(SysRole role) { + int rows = 1; + // 新增角色与部门(数据权限)管理 + List list = new ArrayList(); + for (Long deptId : role.getDeptIds()) { + SysRoleDept rd = new SysRoleDept(); + rd.setRoleId(role.getRoleId()); + rd.setDeptId(deptId); + list.add(rd); + } + if (list.size() > 0) { + rows = sysRoleDeptMapper.batchRoleDept(list); + } + return rows; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/SysUserOnlineServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysUserOnlineServiceImpl.java new file mode 100644 index 0000000..cd66ee4 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysUserOnlineServiceImpl.java @@ -0,0 +1,92 @@ +package com.chenxuan.service.impl; + + +import com.chenxuan.entity.model.SysUserOnline; +import com.chenxuan.security.LoginUser; +import com.chenxuan.service.SysUserOnlineService; +import com.chenxuan.utils.StringUtils; +import org.springframework.stereotype.Service; + +/** + * @ClassName:SysUserOnlineServiceImpl + * @Description: 在线用户 服务层 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 4:24 PM + * @Version V1.0 + */ + +@Service +public class SysUserOnlineServiceImpl implements SysUserOnlineService { + + + /** + * 通过登录地址查询信息 + * + * @param ipaddr 登录地址 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) { + if (StringUtils.equals( ipaddr, user.getIpaddr() )) { + return loginUserToUserOnline( user ); + } + return null; + } + + /** + * 通过用户名称查询信息 + * + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) { + if (StringUtils.equals( userName, user.getUsername() )) { + return loginUserToUserOnline( user ); + } + return null; + } + + /** + * 通过登录地址/用户名称查询信息 + * + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 + * @return 在线用户信息 + */ + @Override + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) { + if (StringUtils.equals( ipaddr, user.getIpaddr() ) && StringUtils.equals( userName, user.getUsername() )) { + return loginUserToUserOnline( user ); + } + return null; + } + + /** + * 设置在线用户信息 + * + * @param user 用户信息 + * @return 在线用户 + */ + public SysUserOnline loginUserToUserOnline(LoginUser user) { + if (StringUtils.isNull( user ) && StringUtils.isNull( user.getUser() )) { + return null; + } + SysUserOnline sysUserOnline = new SysUserOnline(); + sysUserOnline.setTokenId( user.getToken() ); + sysUserOnline.setUserName( user.getUsername() ); + sysUserOnline.setIpaddr( user.getIpaddr() ); + sysUserOnline.setLoginLocation( user.getLoginLocation() ); + sysUserOnline.setBrowser( user.getBrowser() ); + sysUserOnline.setOs( user.getOs() ); + sysUserOnline.setLoginTime( user.getLoginTime() ); + if (StringUtils.isNotNull( user.getUser().getDept() )) { + sysUserOnline.setDeptName( user.getUser().getDept().getDeptName() ); + } + return sysUserOnline; + } + +} diff --git a/src/main/java/com/chenxuan/service/impl/SysUserServiceImpl.java b/src/main/java/com/chenxuan/service/impl/SysUserServiceImpl.java new file mode 100644 index 0000000..a20a2a0 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/SysUserServiceImpl.java @@ -0,0 +1,286 @@ +package com.chenxuan.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chenxuan.base.entity.Query; +import com.chenxuan.entity.model.*; +import com.chenxuan.exception.CustomException; +import com.chenxuan.mapper.*; +import com.chenxuan.service.SysUserService; +import com.chenxuan.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + + +/** + * @ClassName:SysUserServiceImpl + * @Description: * 用户信息表 服务实现类. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 3:26 PM + * @Version V1.0 + */ +@Service +@Component +public class SysUserServiceImpl extends ServiceImpl implements SysUserService { + + @Autowired + private SysUserMapper sysUserMapper; + + @Autowired + private SysRoleMapper sysRoleMapper; + + @Autowired + private SysPostMapper sysPostMapper; + + @Autowired + private SysUserRoleMapper sysUserRoleMapper; + + @Autowired + private SysUserPostMapper sysUserPostMapper; + + @Autowired + private RestTemplate restTemplate; + + @Value("${remote.user.add}") + private String remoteUserAdd; + + @Override + public SysUser findByUserAccount(String userAccount) { + return sysUserMapper.selectByUserAccount(userAccount); + } + + @Override + public Page page(Query query) { + Page page = new Page(query.getPage(), query.getLimit()); + page.setRecords(sysUserMapper.selectPages(page, query.getParams())); + return page; + } + + @Override + public Boolean checkUserNameUnique(String userName) { + return sysUserMapper.checkUserNameUnique(userName) > 0 ? false : true; + } + + @Override + public Boolean checkPhoneUnique(SysUser user) { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + SysUser info = sysUserMapper.checkPhoneUnique(user.getPhone()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + return false; + } + return true; + } + + @Override + public Boolean checkPhoneUnique(String phone) { + SysUser info = sysUserMapper.checkPhoneUnique(phone); + if(StringUtils.isNotNull(info)) + { + return false; + } + return true; + } + + @Override + public Boolean checkEmailUnique(SysUser user) { + Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); + SysUser info = sysUserMapper.checkEmailUnique(user.getEmail()); + if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + return false; + } + return true; + } + + @Override + public Boolean insertUser(SysUser user) { + boolean flag = super.save(user); + insertUserPost(user); + insertUserRole(user); + return flag; +// Map map = new HashMap(); +// map.put("userName",user.getUserName()); +// map.put("password",user.getPassword()); +// map.put("email",user.getEmail()); +// map.put("phone",user.getPhone()); +// boolean isSussess = addUserRemote(map); +// if(isSussess) +// { +// boolean flag = super.save(user); +// insertUserPost(user); +// // 新增用户与角色管理 +// insertUserRole(user); +// return flag; +// } +// else +// { +// return false; +// } + } + + + @Override + public SysUser selectUserById(Long userId) { + return sysUserMapper.selectUserById(userId); + } + + @Override + public String selectUserRoleGroup(String userName) { + List list = sysRoleMapper.selectRolesByUserName(userName); + StringBuffer idsStr = new StringBuffer(); + for (SysRole role : list) { + idsStr.append(role.getRoleName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + @Override + public String selectUserPostGroup(String userName) { + List list = sysPostMapper.selectPostsByUserName(userName); + StringBuffer idsStr = new StringBuffer(); + for (SysPost post : list) { + idsStr.append(post.getPostName()).append(","); + } + if (StringUtils.isNotEmpty(idsStr.toString())) { + return idsStr.substring(0, idsStr.length() - 1); + } + return idsStr.toString(); + } + + @Override + public void checkUserAllowed(SysUser user) { + if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { + throw new CustomException("不允许操作超级管理员用户"); + } + } + + @Override + public Boolean updateUser(SysUser user) { + Long userId = user.getUserId(); + // 删除用户与角色关联 + sysUserRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + sysUserPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return super.updateById(user); + + + } + + @Override + public Boolean updateUserStatus(SysUser user) { + return super.updateById(user); + } + + @Override + public Boolean updateUserProfile(SysUser user) { + return super.updateById(user); + } + + @Override + public boolean updateUserAvatar(String userName, String avatar) { + int count = sysUserMapper.updateUserAvatar(userName, avatar); + return count > 0 ? true : false; + } + + @Override + public Boolean resetPwd(SysUser user) { + return super.updateById(user); + } + + @Override + public Boolean resetUserPwd(String userName, String password) { + int count = sysUserMapper.resetUserPwd(userName, password); + return count > 0 ? true : false; + } + + @Override + public int deleteUserById(Long userId) { + return 0; + } + + @Override + public int deleteUserByIds(Long[] userIds) { + for (Long userId : userIds) { + checkUserAllowed(new SysUser(userId)); + } + return sysUserMapper.deleteUserByIds(userIds); + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(SysUser user) { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotNull(posts)) { + // 新增用户与岗位管理 + List list = new ArrayList(); + for (Long postId : posts) { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + if (list.size() > 0) { + sysUserPostMapper.batchUserPost(list); + } + } + } + + /**insertUser + * 新增用户角色信息 + * + * @param user 用户对象 + */ + public void insertUserRole(SysUser user) { + Long[] roles = user.getRoleIds(); + if (StringUtils.isNotNull(roles)) { + // 新增用户与角色管理 + List list = new ArrayList(); + for (Long roleId : roles) { + SysUserRole ur = new SysUserRole(); + ur.setUserId(user.getUserId()); + ur.setRoleId(roleId); + list.add(ur); + } + if (list.size() > 0) { + sysUserRoleMapper.batchUserRole(list); + } + } + } + + public boolean addUserRemote(Map map) { + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setContentType(MediaType.parseMediaType(MediaType.APPLICATION_JSON_UTF8_VALUE)); + HttpEntity> httpEntity = new HttpEntity<>(map, httpHeaders); + ResponseEntity responseEntity = restTemplate.postForEntity(remoteUserAdd, httpEntity, + Object.class); +// ResponseEntity responseEntity = restTemplate.postForEntity("http://192.168.128.86:10080/frame-base-control/sysUserRemoter/addUser", httpEntity, +// Object.class); + int code = responseEntity.getStatusCodeValue(); + if(code ==200) + { + return true; + } + return false; + } +} diff --git a/src/main/java/com/chenxuan/service/impl/remote/RemoteServiceImpl.java b/src/main/java/com/chenxuan/service/impl/remote/RemoteServiceImpl.java new file mode 100644 index 0000000..3a560e6 --- /dev/null +++ b/src/main/java/com/chenxuan/service/impl/remote/RemoteServiceImpl.java @@ -0,0 +1,27 @@ +package com.chenxuan.service.impl.remote; + +import com.chenxuan.service.remote.RemoteService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +@Service +@Component +public class RemoteServiceImpl implements RemoteService { + + @Value("${remote.transformer.query}") + private String transformersubTree; + @Autowired + private RestTemplate template; + @Override + public Map findTransformerSubTree() { + String url=transformersubTree; +// String url="http://192.168.128.86:10080/busi-back-control/remote/busiTransformerRemote/findTransformerSubTree"; + Map map = template.getForObject(url, Map.class,""); + return map; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/service/remote/RemoteService.java b/src/main/java/com/chenxuan/service/remote/RemoteService.java new file mode 100644 index 0000000..9039b5a --- /dev/null +++ b/src/main/java/com/chenxuan/service/remote/RemoteService.java @@ -0,0 +1,7 @@ +package com.chenxuan.service.remote; + +import java.util.Map; + +public interface RemoteService { + public Map findTransformerSubTree(); +} diff --git a/src/main/java/com/chenxuan/timeTask/BiasProportionTask.java b/src/main/java/com/chenxuan/timeTask/BiasProportionTask.java new file mode 100644 index 0000000..9afeeba --- /dev/null +++ b/src/main/java/com/chenxuan/timeTask/BiasProportionTask.java @@ -0,0 +1,140 @@ +package com.chenxuan.timeTask; + +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.model.BusiCenterIncrease; +import com.chenxuan.entity.model.BusiCenterRealStatistics; +import com.chenxuan.entity.model.BusiNoiseIncrease; +import com.chenxuan.entity.model.BusiNoiseRealStatistics; +import com.chenxuan.entity.model.BusiAmpliStatistics; +import com.chenxuan.mapper.BusiCenterIncreaseMapper; +import com.chenxuan.mapper.BusiNoiseIncreaseMapper; +import com.chenxuan.service.BusiCenterRealStatisticsService; +import com.chenxuan.service.BusiNoiseRealStatisticsService; +import com.chenxuan.service.BusiAmpliStatisticsService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * @author Carrey Zheng + * @create 2020-07-09 3:41 PM + **/ +@Slf4j +@Component("biasProportionTask") +public class BiasProportionTask { + + @Autowired + private BusiCenterRealStatisticsService busiCenterRealStatisticsService; + + @Autowired + private BusiAmpliStatisticsService BusiAmpliStatisticsService; + + @Autowired + private BusiNoiseRealStatisticsService busiNoiseRealStatisticsService; + + @Autowired + private BusiCenterIncreaseMapper busiCenterIncreaseMapper; + + @Autowired + private BusiNoiseIncreaseMapper busiNoiseIncreaseMapper; + + public void execute() { + log.info("-- >>> 计算增长率定时任务开始"); + log.info("-- >>> 计算中心点增长率"); + //查询中心点数据统计表中主变数量 + List busiCenterReals = busiCenterRealStatisticsService.selectMainDeviceList(); + for (BusiCenterRealStatistics busiCenterReal : busiCenterReals) { + //查询每个主变今日中心点数据 + BusiCenterRealStatistics busiCenterRealStatisticsToday = busiCenterRealStatisticsService.getMainDeviceListTodayData(busiCenterReal); + //查询每个主变昨日中心点数据 + BusiCenterRealStatistics busiCenterRealStatisticsYesterday = busiCenterRealStatisticsService.getMainDeviceListYesterdayData(busiCenterReal); + //查询每个主变30日之前中心点数据 + BusiCenterRealStatistics busiCenterRealStatisticsBeforeOneMonth = busiCenterRealStatisticsService.getMainDeviceListBeforOneMonthData(busiCenterReal); + + if (null != busiCenterRealStatisticsToday) { + //获得今日中心点值 + String maxAmplitudeToday = busiCenterRealStatisticsToday.getMaxAmplitude(); + BigDecimal todayData = new BigDecimal(maxAmplitudeToday); + BusiCenterIncrease busiCenterIncrease = new BusiCenterIncrease(); + if (null != busiCenterRealStatisticsYesterday) { + //获得昨日中心点值 + String maxAmplitudeYesterdayData = busiCenterRealStatisticsYesterday.getMaxAmplitude(); + BigDecimal yesterdayData = new BigDecimal(maxAmplitudeYesterdayData); + + //两日差值 + BigDecimal DValue = todayData.subtract(yesterdayData); + //计算增长率 + BigDecimal rateOfRiseByYesterday = DValue.divide(yesterdayData, 2, BigDecimal.ROUND_HALF_UP); + busiCenterIncrease.setId(UuidUtils.getUUID()); + busiCenterIncrease.setDTime(new Date()); + busiCenterIncrease.setMainId(busiCenterReal.getMainId()); + busiCenterIncrease.setDayRate(rateOfRiseByYesterday.toString()); + } + if (null != busiCenterRealStatisticsBeforeOneMonth) { + //获得30日之前中心点值 + String maxAmplitudebeforeOneMonthdayData = busiCenterRealStatisticsBeforeOneMonth.getMaxAmplitude(); + BigDecimal beforeOneMonthdayData = new BigDecimal(maxAmplitudebeforeOneMonthdayData); + + //两日差值 + BigDecimal DValue = todayData.subtract(beforeOneMonthdayData); + //计算增长率 + BigDecimal rateOfRiseBybeforeOneMonth = DValue.divide(beforeOneMonthdayData, 2, BigDecimal.ROUND_HALF_UP); + busiCenterIncrease.setMonthRate(rateOfRiseBybeforeOneMonth.toString()); + } + if (null != busiCenterIncrease.getId()) { + busiCenterIncreaseMapper.insert(busiCenterIncrease); + } + } + } + log.info("-- >>> 噪声增长率"); + List busiNoiseRealStatisticss = busiNoiseRealStatisticsService.selectMainDeviceList(); + for (BusiNoiseRealStatistics busiNoiseRealStatistics : busiNoiseRealStatisticss) { + //查询每个主变今日噪声数据 + BusiNoiseRealStatistics busiNoiseRealStatisticsToday = busiNoiseRealStatisticsService.getMainDeviceListTodayData(busiNoiseRealStatistics); + //查询每个主变昨日噪声数据 + BusiNoiseRealStatistics busiNoiseRealStatisticsYesterday = busiNoiseRealStatisticsService.getMainDeviceListYesterdayData(busiNoiseRealStatistics); + //查询每个主变30日之前噪声数据 + BusiNoiseRealStatistics busiNoiseRealStatisticsBeforeOneMonth = busiNoiseRealStatisticsService.getMainDeviceListBeforOneMonthData(busiNoiseRealStatistics); + + if (null != busiNoiseRealStatisticsToday) { + //获得今日噪声值 + String maxAmplitudeToday = busiNoiseRealStatisticsToday.getMaxAmplitude(); + BigDecimal todayData = new BigDecimal(maxAmplitudeToday); + BusiNoiseIncrease busiCenterIncrease = new BusiNoiseIncrease(); + if (null != busiNoiseRealStatisticsYesterday) { + //获得昨日噪声值 + String maxAmplitudeYesterdayData = busiNoiseRealStatisticsYesterday.getMaxAmplitude(); + BigDecimal yesterdayData = new BigDecimal(maxAmplitudeYesterdayData); + + //两日差值 + BigDecimal DValue = todayData.subtract(yesterdayData); + //计算增长率 + BigDecimal rateOfRiseByYesterday = DValue.divide(yesterdayData, 2, BigDecimal.ROUND_HALF_UP); + busiCenterIncrease.setId(UuidUtils.getUUID()); + busiCenterIncrease.setDTime(new Date()); + busiCenterIncrease.setMainId(busiNoiseRealStatistics.getMainId()); + busiCenterIncrease.setDayRate(rateOfRiseByYesterday.toString()); + } + if (null != busiNoiseRealStatisticsBeforeOneMonth) { + //获得30日之前噪声值 + String maxAmplitudebeforeOneMonthdayData = busiNoiseRealStatisticsBeforeOneMonth.getMaxAmplitude(); + BigDecimal beforeOneMonthdayData = new BigDecimal(maxAmplitudebeforeOneMonthdayData); + //两日差值 + BigDecimal DValue = todayData.subtract(beforeOneMonthdayData); + //计算增长率 + BigDecimal rateOfRiseBybeforeOneMonth = DValue.divide(beforeOneMonthdayData, 2, BigDecimal.ROUND_HALF_UP); + busiCenterIncrease.setMonthRate(rateOfRiseBybeforeOneMonth.toString()); + } + if (null != busiCenterIncrease.getId()) { + busiNoiseIncreaseMapper.insert(busiCenterIncrease); + } + } + } + log.info("-- >>> 振动装置增长率"); + // 查询振动装置数据统计表中主变数量 todo 频率问题未确定 + List BusiAmpliStatistics = BusiAmpliStatisticsService.selectMainDeviceList(); + } +} diff --git a/src/main/java/com/chenxuan/timeTask/DeviceSmoothing.java b/src/main/java/com/chenxuan/timeTask/DeviceSmoothing.java new file mode 100644 index 0000000..e0be6c7 --- /dev/null +++ b/src/main/java/com/chenxuan/timeTask/DeviceSmoothing.java @@ -0,0 +1,411 @@ +package com.chenxuan.timeTask; + +import cn.hutool.core.collection.CollectionUtil; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.*; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.mapper.*; +import com.chenxuan.utils.DateUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@Component("deviceSmoothing") +public class DeviceSmoothing { + + @Autowired + private BusiCenterRealStatisticsMapper busiCenterRealStatisticsMapper; + + @Autowired + private BusiAmpliStatisticsMapper busiAmpliStatisticsMapper; + + @Autowired + private BusiNoiseRealStatisticsMapper busiNoiseRealStatisticsMapper; + + @Autowired + private BusiMainDeviceMapper busiMainDeviceMapper; + + @Autowired + private BusiAmpliRealMapper busiAmpliRealMapper; + + @Autowired + private BusiCenterRealMapper busiCenterRealMapper; + + @Autowired + private BusiNoiseRealMapper busiNoiseRealMapper; + + /** + * 实时数据俢匀算符 + */ + public void execute() { + //查询每个主变 + List allMainDevice = busiMainDeviceMapper.getAllMainDevice(); + //循环处理每个主变 + for (BusiMainDeviceVo deviceVo : allMainDevice) { + log.info("-- >>> 修匀开始"); + log.info("-- >>> 中心点修匀开始"); + //中心点俢匀 + getCenterReal(deviceVo.getId()); + log.info("-- >>> 中心点修匀结束"); + log.info("-- >>> 噪声修匀开始"); + //噪声俢匀 + getNoiseReal(deviceVo.getId()); + log.info("-- >>> 噪声修匀结束"); + log.info("-- >>> 原边装置修匀开始"); + //原边俢匀 + getAverage(deviceVo.getId(), "P"); + log.info("-- >>> 原边装置修匀结束"); + log.info("-- >>> 副边装置修匀开始"); + //副边俢匀 + getAverage(deviceVo.getId(), "S"); + log.info("-- >>> 修匀结束"); + } + } + + /** + * 原副边平均值 + * + * @param mainId + * @param side + * @return + */ + private void getAverage(String mainId, String side) { + int k = 1; + int m = 2; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < 19; i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //A项上侧装置 + getAmpliReal(mainId, side, "A", "U", frequency); + //A项下侧装置 + getAmpliReal(mainId, side, "A", "D", frequency); + //B项上侧装置 + getAmpliReal(mainId, side, "B", "U", frequency); + //B项下侧装置 + getAmpliReal(mainId, side, "B", "D", frequency); + //C项上侧装置 + getAmpliReal(mainId, side, "C", "U", frequency); + //C项下侧装置 + getAmpliReal(mainId, side, "C", "D", frequency); + } + } + + /** + * 获取一个Hz每天的平均值(中心点装置) + * + * @return + */ + private void getCenterReal(String mainId) { + BusiCenterRealDto centerRealDto = new BusiCenterRealDto(); + centerRealDto.setMainId(mainId); + centerRealDto.setInsTime(DateUtils.getYesTerDayDate()); + //获取前一天的实时数据 + List centerReals = busiCenterRealMapper.findCenterRealChartByInfo(centerRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(centerReals)) { + return; + } + //声明一个新集合 + List amplitudes = new ArrayList<>(centerReals.size()); + //只获取幅值 + centerReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + centerRealDto.setId(real.getId()); + }); + calculateCenter(centerRealDto, amplitudes, 8); + } + + /** + * 获取一个Hz每天的平均值(噪声装置) + * + * @return + */ + private void getNoiseReal(String mainId) { + BusiNoiseRealDto noiseRealDto = new BusiNoiseRealDto(); + noiseRealDto.setMainId(mainId); + noiseRealDto.setInsTime(DateUtils.getYesTerDayDate()); + //获取前一天的实时数据 + List noiseReals = busiNoiseRealMapper.findNoiseRealChartByInfo(noiseRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(noiseReals)) { + return; + } + //声明一个新集合 + List amplitudes = new ArrayList<>(noiseReals.size()); + //只获取幅值 + noiseReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + }); + calculateNoise(noiseRealDto, amplitudes, 8); + } + + /** + * 获取一个Hz每天的平均值(振动装置) + * + * @param mainId + * @param side + * @param phase + * @param inOut + * @param frequency + * @return + */ + private void getAmpliReal(String mainId, String side, String phase, String inOut, int frequency) { + BusiAmpliRealDto ampliRealDto = new BusiAmpliRealDto(); + ampliRealDto.setMainId(mainId); + ampliRealDto.setSide(side); + ampliRealDto.setPhase(phase); + ampliRealDto.setInOut(inOut); + ampliRealDto.setInsTime(DateUtils.getYesTerDayDate()); + ampliRealDto.setFrequency(String.valueOf(frequency)); + //获取前一天的实时数据 + List yesterdayReals = busiAmpliRealMapper.getTodayAmpliReal(ampliRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(yesterdayReals)) { + return; + } + //声明一个新集合 + List amplitudes = new ArrayList<>(yesterdayReals.size()); + //只获取幅值 + yesterdayReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + }); + calculateData(ampliRealDto, amplitudes, 8); + } + + /** + * 计算平均值公式(中心点) + * + * @param amplitudes + * @param splitNum + * @return + */ + private void calculateCenter(BusiCenterRealDto centerRealDto, List amplitudes, int splitNum) { + //判断是否有值 + double sum = amplitudes.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getSum(); + if (sum <= 0) { + return; + } + List amplitude1 = new ArrayList<>(); + List amplitude2 = new ArrayList<>(); + List amplitude3 = new ArrayList<>(); + double average = 0, average1 = 0, average2 = 0; + //判断是否是整数 + int groupFlag = amplitudes.size() % splitNum == 0 ? (amplitudes.size() / splitNum) : (amplitudes.size() / splitNum + 1); + //循环赋值 + for (int i = 0; i < groupFlag; i++) { + switch (i) { + case 0: + amplitude1 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 1: + amplitude2 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 2: + amplitude3 = amplitudes.subList(i * splitNum, amplitudes.size()); + break; + } + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude1)) { + amplitude1 = amplitude1.stream().sorted().collect(Collectors.toList()); + amplitude1 = amplitude1.subList(1, amplitude1.size() - 1); + average = amplitude1.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude2)) { + amplitude2 = amplitude2.stream().sorted().collect(Collectors.toList()); + amplitude2 = amplitude2.subList(1, amplitude2.size() - 1); + average1 = amplitude2.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude3)) { + amplitude3 = amplitude3.stream().sorted().collect(Collectors.toList()); + amplitude3 = amplitude3.subList(1, amplitude3.size() - 1); + average2 = amplitude3.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + BigDecimal bigDecimal = BigDecimal.ZERO; + //求平均值 + if (average > 0) { + bigDecimal = BigDecimal.valueOf(average); + } + if (average > 0 && average1 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1) / 2); + } + if (average > 0 && average1 > 0 && average2 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1 + average2) / 3); + } + //创建日统计数据 + BusiCenterRealStatistics busiCenterRealStatistics = new BusiCenterRealStatistics(); + busiCenterRealStatistics.setId(UuidUtils.getUUID()); + busiCenterRealStatistics.setInsTime(new Date()); + busiCenterRealStatistics.setMainId(centerRealDto.getMainId()); + busiCenterRealStatistics.setMaxAmplitude(String.valueOf(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP))); + busiCenterRealStatisticsMapper.insert(busiCenterRealStatistics); + } + + /** + * 计算平均值公式(噪声) + * + * @param amplitudes + * @param splitNum + * @return + */ + private void calculateNoise(BusiNoiseRealDto noiseRealDto, List amplitudes, int splitNum) { + //判断是否有值 + double sum = amplitudes.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getSum(); + if (sum <= 0) { + return; + } + List amplitude1 = new ArrayList<>(); + List amplitude2 = new ArrayList<>(); + List amplitude3 = new ArrayList<>(); + double average = 0, average1 = 0, average2 = 0; + //判断是否是整数 + int groupFlag = amplitudes.size() % splitNum == 0 ? (amplitudes.size() / splitNum) : (amplitudes.size() / splitNum + 1); + //循环赋值 + for (int i = 0; i < groupFlag; i++) { + switch (i) { + case 0: + amplitude1 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 1: + amplitude2 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 2: + amplitude3 = amplitudes.subList(i * splitNum, amplitudes.size()); + break; + } + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude1)) { + amplitude1 = amplitude1.stream().sorted().collect(Collectors.toList()); + amplitude1 = amplitude1.subList(1, amplitude1.size() - 1); + average = amplitude1.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude2)) { + amplitude2 = amplitude2.stream().sorted().collect(Collectors.toList()); + amplitude2 = amplitude2.subList(1, amplitude2.size() - 1); + average1 = amplitude2.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude3)) { + amplitude3 = amplitude3.stream().sorted().collect(Collectors.toList()); + amplitude3 = amplitude3.subList(1, amplitude3.size() - 1); + average2 = amplitude3.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + BigDecimal bigDecimal = BigDecimal.ZERO; + //求平均值 + if (average > 0) { + bigDecimal = BigDecimal.valueOf(average); + } + if (average > 0 && average1 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1) / 2); + } + if (average > 0 && average1 > 0 && average2 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1 + average2) / 3); + } + //创建日统计数据 + BusiNoiseRealStatistics noiseRealStatistics = new BusiNoiseRealStatistics(); + noiseRealStatistics.setId(UuidUtils.getUUID()); + noiseRealStatistics.setInsTime(new Date()); + noiseRealStatistics.setMainId(noiseRealDto.getMainId()); + noiseRealStatistics.setMaxAmplitude(String.valueOf(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP))); + busiNoiseRealStatisticsMapper.insert(noiseRealStatistics); + } + + /** + * 计算平均值公式(传感器) + * + * @param amplitudes + * @param splitNum + * @return + */ + private void calculateData(BusiAmpliRealDto ampliRealDto, List amplitudes, int splitNum) { + //判断是否有值 + double sum = amplitudes.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getSum(); + if (sum <= 0) { + return; + } + List amplitude1 = new ArrayList<>(); + List amplitude2 = new ArrayList<>(); + List amplitude3 = new ArrayList<>(); + double average = 0, average1 = 0, average2 = 0; + //判断是否是整数 + int groupFlag = amplitudes.size() % splitNum == 0 ? (amplitudes.size() / splitNum) : (amplitudes.size() / splitNum + 1); + //循环赋值 + for (int i = 0; i < groupFlag; i++) { + switch (i) { + case 0: + amplitude1 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 1: + amplitude2 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 2: + amplitude3 = amplitudes.subList(i * splitNum, amplitudes.size()); + break; + } + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude1)) { + amplitude1 = amplitude1.stream().sorted().collect(Collectors.toList()); + amplitude1 = amplitude1.subList(1, amplitude1.size() - 1); + average = amplitude1.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude2)) { + amplitude2 = amplitude2.stream().sorted().collect(Collectors.toList()); + amplitude2 = amplitude2.subList(1, amplitude2.size() - 1); + average1 = amplitude2.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude3)) { + amplitude3 = amplitude3.stream().sorted().collect(Collectors.toList()); + amplitude3 = amplitude3.subList(1, amplitude3.size() - 1); + average2 = amplitude3.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + BigDecimal bigDecimal = BigDecimal.ZERO; + //求平均值 + if (average > 0) { + bigDecimal = BigDecimal.valueOf(average); + } + if (average > 0 && average1 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1) / 2); + } + if (average > 0 && average1 > 0 && average2 > 0) { + bigDecimal = BigDecimal.valueOf((average + average1 + average2) / 3); + } + //创建日统计数据 + BusiAmpliStatistics busiAmpliStatistics = new BusiAmpliStatistics(); + busiAmpliStatistics.setId(UuidUtils.getUUID()); + busiAmpliStatistics.setInsTime(new Date()); + busiAmpliStatistics.setMainId(ampliRealDto.getMainId()); + busiAmpliStatistics.setSubId(ampliRealDto.getSubId()); + busiAmpliStatistics.setSide(ampliRealDto.getSide()); + busiAmpliStatistics.setPhase(ampliRealDto.getPhase()); + busiAmpliStatistics.setInOut(ampliRealDto.getInOut()); + busiAmpliStatistics.setFrequency(ampliRealDto.getFrequency()); + busiAmpliStatistics.setMaxAmplitude(String.valueOf(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP))); + busiAmpliStatisticsMapper.insert(busiAmpliStatistics); + } + +} + + diff --git a/src/main/java/com/chenxuan/timeTask/EvalParamTask.java b/src/main/java/com/chenxuan/timeTask/EvalParamTask.java new file mode 100644 index 0000000..5d8b78d --- /dev/null +++ b/src/main/java/com/chenxuan/timeTask/EvalParamTask.java @@ -0,0 +1,411 @@ +package com.chenxuan.timeTask; + +import cn.hutool.core.collection.CollectionUtil; +import com.chenxuan.constants.UuidUtils; +import com.chenxuan.entity.dto.BusiAmpliRealDto; +import com.chenxuan.entity.dto.BusiCenterRealDto; +import com.chenxuan.entity.dto.BusiNoiseRealDto; +import com.chenxuan.entity.model.BusiAmpliReal; +import com.chenxuan.entity.model.BusiAssessParameter; +import com.chenxuan.entity.model.BusiCenterReal; +import com.chenxuan.entity.model.BusiNoiseReal; +import com.chenxuan.entity.vo.BusiCalcParamConfVo; +import com.chenxuan.entity.vo.BusiMainDeviceVo; +import com.chenxuan.mapper.*; +import com.chenxuan.utils.DateUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + +@Slf4j +@Component("evalParamTask") +public class EvalParamTask { + + @Autowired + private BusiCenterRealMapper busiCenterRealMapper; + + @Autowired + private BusiNoiseRealMapper busiNoiseRealMapper; + + @Autowired + private BusiAmpliRealMapper busiAmpliRealMapper; + + @Autowired + private BusiMainDeviceMapper busiMainDeviceMapper; + + @Autowired + private BusiCalcParamConfMapper busiCalcParamConfMapper; + + @Autowired + private BusiAssessParameterMapper assessParameterMapper; + + /** + * 评估参数俢匀算法 + */ + public void evaluaParame() { + //查询每个主变 + List allMainDevice = busiMainDeviceMapper.getAllMainDevice(); + List subDevices = new ArrayList<>(); + List parameterList = new ArrayList<>(allMainDevice.size()); + //循环处理每个主变 + for (BusiMainDeviceVo deviceVo : allMainDevice) { + BusiAssessParameter parameter = new BusiAssessParameter(); + //根据主变id查询评估参数 + List paramList = busiCalcParamConfMapper.findFirstLevelParams(deviceVo.getId()); + //递归封装数据 + setChildren(paramList); + //判断封装数据是否为空 + if (CollectionUtil.isEmpty(paramList)) { + continue; + } + //俢匀二级数据 + for (BusiCalcParamConfVo child : paramList.get(0).getChildren()) { + //高压侧(原边)铁芯处理数据 + if (child.getName().equals("SJZD_HIGHT_WEIGHT")) { + subDevices.add(getAverage(child)); + } + //低压侧(副边)绕组处理数据 + if (child.getName().equals("SJZD_LOW_WEIGHT")) { + subDevices.add(getAverage(child)); + } + //中心点处理数据 + if (child.getName().equals("SJZD_CENTER_WEIGHT")) { + subDevices.add(getCenterReal(child)); + } + //噪声处理数据 + if (child.getName().equals("SJZD_NOISE_WEIGHT")) { + subDevices.add(getNoiseReal(child)); + } + } + //得到最顶级的平均值 + double average = subDevices.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + //最后俢匀值 + BigDecimal multiply = BigDecimal.valueOf(average).multiply(paramList.get(0).getValue()); + parameter.setId(UuidUtils.getUUID()); + parameter.setMainId(deviceVo.getId()); + parameter.setAmplitude(String.valueOf(multiply.setScale(2, BigDecimal.ROUND_HALF_UP))); + parameter.setInsTime(new Date()); + parameterList.add(parameter); + } + //插入数据 + assessParameterMapper.saveAssessParameter(parameterList); + } + + /** + * 封装数据 + * + * @param paramList + */ + private void setChildren(List paramList) { + if (CollectionUtils.isEmpty(paramList)) { + return; + } + for (BusiCalcParamConfVo param : paramList) { + List children = busiCalcParamConfMapper.findSubParams( + param.getMainId(), param.getName()); + param.setChildren(children); + setChildren(children); + } + } + + /** + * 原副边平均值 + * + * @param child + * @return + */ + private BigDecimal getAverage(BusiCalcParamConfVo child) { + int k = 1; + int m = 2; + List hzAverages = new ArrayList<>(); + List subAverages = new ArrayList<>(); + for (BusiCalcParamConfVo childChild : child.getChildren()) { + //A项上侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_A1") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_a1")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_A1") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "A", "U", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + //A项下侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_A2") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_a2")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_A2") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "A", "D", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + //B项上侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_B1") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_b1")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_B1") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "B", "U", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + //B项下侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_B2") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_b2")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_B2") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "B", "D", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + //C项上侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_C1") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_c1")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_B2") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "C", "U", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + //C项下侧装置 + if (childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_C2") + || childChild.getName().equals("SJZD_LOW_GROUP_WEIGHT_c2")) { + List childChildChildren = childChild.getChildren(); + //判断是原边还是副边 + String side = childChild.getName().equals("SJZD_HIGHT_GROUP_WEIGHT_C2") ? "P" : "S"; + //求当前装置下所有Hz的平均数 + for (int i = 0; i < childChildChildren.size(); i++) { + //频率值 + int frequency = 50 * (i + k); + //当频率达到700时修改k值为2 + if (frequency >= 700) { + k = m; + ++m; + } + //求当前装置下Hz的平均数 + hzAverages.add(getAmpliReal(childChild.getMainId(), side, "C", "D", frequency, childChildChildren.get(i).getValue())); + } + //将所有的Hz的数据汇总成一条 + subAverages.add(calculateData(hzAverages, childChild.getValue(), 6)); + continue; + } + } + return calculateData(subAverages, child.getValue(), 3); + } + + /** + * 获取一个Hz每天的平均值(振动装置) + * + * @param mainId + * @param side + * @param phase + * @param inOut + * @param frequency + * @return + */ + private BigDecimal getAmpliReal(String mainId, String side, String phase, String inOut, int frequency, BigDecimal value) { + BusiAmpliRealDto ampliRealDto = new BusiAmpliRealDto(); + ampliRealDto.setMainId(mainId); + ampliRealDto.setSide(side); + ampliRealDto.setPhase(phase); + ampliRealDto.setInOut(inOut); + ampliRealDto.setInsTime(DateUtils.getYesTerDayDate()); + ampliRealDto.setFrequency(String.valueOf(frequency)); + //获取前一天的实时数据 + List yesterdayReals = busiAmpliRealMapper.getTodayAmpliReal(ampliRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(yesterdayReals)) { + return new BigDecimal(0); + } + //声明一个新集合 + List amplitudes = new ArrayList<>(yesterdayReals.size()); + //只获取幅值 + yesterdayReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + }); + return calculateData(amplitudes, value, 8); + } + + /** + * 获取一个Hz每天的平均值(中心点装置) + * + * @return + */ + private BigDecimal getCenterReal(BusiCalcParamConfVo child) { + BusiCenterRealDto centerRealDto = new BusiCenterRealDto(); + centerRealDto.setMainId(child.getMainId()); + centerRealDto.setInsTime(DateUtils.getYesTerDayDate()); + //获取前一天的实时数据 + List centerReals = busiCenterRealMapper.findCenterRealChartByInfo(centerRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(centerReals)) { + return new BigDecimal(0); + } + //声明一个新集合 + List amplitudes = new ArrayList<>(centerReals.size()); + //只获取幅值 + centerReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + }); + return calculateData(amplitudes, child.getValue(), 8); + } + + /** + * 获取一个Hz每天的平均值(噪声装置) + * + * @return + */ + private BigDecimal getNoiseReal(BusiCalcParamConfVo child) { + BusiNoiseRealDto noiseRealDto = new BusiNoiseRealDto(); + noiseRealDto.setMainId(child.getMainId()); + noiseRealDto.setInsTime(DateUtils.getYesTerDayDate()); + //获取前一天的实时数据 + List noiseReals = busiNoiseRealMapper.findNoiseRealChartByInfo(noiseRealDto); + //判断是否有值 + if (CollectionUtil.isEmpty(noiseReals)) { + return new BigDecimal(0); + } + //声明一个新集合 + List amplitudes = new ArrayList<>(noiseReals.size()); + //只获取幅值 + noiseReals.stream().forEach(real -> { + amplitudes.add(new BigDecimal(real.getMaxAmplitude())); + }); + return calculateData(amplitudes, child.getValue(), 8); + } + + /** + * 计算平均值公式 + * + * @param amplitudes + * @param value + * @param splitNum + * @return + */ + private BigDecimal calculateData(List amplitudes, BigDecimal value, int splitNum) { + // + double sum = amplitudes.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getSum(); + if (sum <= 0) { + return new BigDecimal(0); + } + List amplitude1 = new ArrayList<>(); + List amplitude2 = new ArrayList<>(); + List amplitude3 = new ArrayList<>(); + double average = 0, average1 = 0, average2 = 0; + //判断是否是整数 + int groupFlag = amplitudes.size() % splitNum == 0 ? (amplitudes.size() / splitNum) : (amplitudes.size() / splitNum + 1); + //循环赋值 + for (int i = 0; i < groupFlag; i++) { + switch (i) { + case 0: + amplitude1 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 1: + amplitude2 = amplitudes.subList(i * splitNum, i * splitNum + splitNum); + break; + case 2: + amplitude3 = amplitudes.subList(i * splitNum, amplitudes.size()); + break; + } + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude1)) { + amplitude1 = amplitude1.stream().sorted().collect(Collectors.toList()); + amplitude1 = amplitude1.subList(1, amplitude1.size()-1); + average = amplitude1.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude2)) { + amplitude2 = amplitude2.stream().sorted().collect(Collectors.toList()); + amplitude2 = amplitude2.subList(1, amplitude2.size()-1); + average1 = amplitude2.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //去除最大值和最小值并求和 + if (CollectionUtil.isNotEmpty(amplitude3)) { + amplitude3 = amplitude3.stream().sorted().collect(Collectors.toList()); + amplitude3 = amplitude3.subList(1, amplitude3.size()-1); + average2 = amplitude3.stream().mapToDouble((tude) -> Double.parseDouble(String.valueOf(tude))).summaryStatistics().getAverage(); + } + //求平均值 + if (average > 0 && average1 > 0 && average2 > 0) { + return BigDecimal.valueOf((average + average1 + average2) / 3).multiply(value); + } + if (average > 0 && average1 > 0) { + return BigDecimal.valueOf((average + average1) / 2).multiply(value); + } + if (average > 0) { + return BigDecimal.valueOf(average).multiply(value); + } + return null; + } +} diff --git a/src/main/java/com/chenxuan/utils/ConvertUtils.java b/src/main/java/com/chenxuan/utils/ConvertUtils.java new file mode 100644 index 0000000..2d426c3 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/ConvertUtils.java @@ -0,0 +1,992 @@ +package com.chenxuan.utils; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; + + +/** + * @ClassName:ConvertUtils + * @Description: 类型转换器 + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 4:48 PM + * @Version V1.0 + */ + +public class ConvertUtils +{ + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof String) + { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) + { + return toStr(value, null); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) + { + if (null == value) + { + return defaultValue; + } + if (value instanceof Character) + { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) + { + return toChar(value, null); + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Byte) + { + return (Byte) value; + } + if (value instanceof Number) + { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Byte.parseByte(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) + { + return toByte(value, null); + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Short) + { + return (Short) value; + } + if (value instanceof Number) + { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Short.parseShort(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) + { + return toShort(value, null); + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Number) + { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return NumberFormat.getInstance().parse(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) + { + return toNumber(value, null); + } + + /** + * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Integer) + { + return (Integer) value; + } + if (value instanceof Number) + { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Integer.parseInt(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) + { + return toInt(value, null); + } + + /** + * 转换为Integer数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) + { + return toIntArray(",", str); + } + + /** + * 转换为Long数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) + { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Integer[] {}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组
+ * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) + { + if (StringUtils.isEmpty(str)) + { + return new Long[] {}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) + { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) + { + return toStrArray(",", str); + } + + /** + * 转换为String数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) + { + return str.split(split); + } + + /** + * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Long) + { + return (Long) value; + } + if (value instanceof Number) + { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) + { + return toLong(value, null); + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Double) + { + return (Double) value; + } + if (value instanceof Number) + { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) + { + return toDouble(value, null); + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Float) + { + return (Float) value; + } + if (value instanceof Number) + { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Float.parseFloat(valueStr.trim()); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) + { + return toFloat(value, null); + } + + /** + * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof Boolean) + { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) + { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) + { + return toBool(value, null); + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value, E defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) + { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return Enum.valueOf(clazz, valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value) + { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigInteger) + { + return (BigInteger) value; + } + if (value instanceof Long) + { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigInteger(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) + { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) + { + if (value == null) + { + return defaultValue; + } + if (value instanceof BigDecimal) + { + return (BigDecimal) value; + } + if (value instanceof Long) + { + return new BigDecimal((Long) value); + } + if (value instanceof Double) + { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) + { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) + { + return defaultValue; + } + try + { + return new BigDecimal(valueStr); + } + catch (Exception e) + { + return defaultValue; + } + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) + { + return toBigDecimal(value, null); + } + + + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) + { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) + { + if (null == obj) + { + return null; + } + + if (obj instanceof String) + { + return (String) obj; + } + else if (obj instanceof byte[] || obj instanceof Byte[]) + { + return str((Byte[]) obj, charset); + } + else if (obj instanceof ByteBuffer) + { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) + { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) + { + if (data == null) + { + return null; + } + + if (null == charset) + { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) + { + if (data == null) + { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) + { + if (null == charset) + { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) + { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set notConvertSet) + { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') + { + c[i] = '\u3000'; + } + else if (c[i] < '\177') + { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) + { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set notConvertSet) + { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) + { + if (null != notConvertSet && notConvertSet.contains(c[i])) + { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') + { + c[i] = ' '; + } + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') + { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) + { + String[] fraction = { "角", "分" }; + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) + { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) + { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) + { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) + { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } +} diff --git a/src/main/java/com/chenxuan/utils/DateUtils.java b/src/main/java/com/chenxuan/utils/DateUtils.java new file mode 100644 index 0000000..b9e5d1b --- /dev/null +++ b/src/main/java/com/chenxuan/utils/DateUtils.java @@ -0,0 +1,234 @@ +package com.chenxuan.utils; + +import org.apache.commons.lang3.time.DateFormatUtils; + +import java.lang.management.ManagementFactory; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + + +/** + * @ClassName:DateUtils + * @Description: 时间工具类 + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 4:46 PM + * @Version V1.0 + */ + +public class DateUtils extends org.apache.commons.lang3.time.DateUtils +{ + public static String YYYY = "yyyy"; + + public static String YYYY_MM = "yyyy-MM"; + + public static String YYYY_MM_DD = "yyyy-MM-dd"; + + public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; + + public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + private static String[] parsePatterns = { + "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", + "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", + "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"}; + + /** + * 获取当前Date型日期 + * + * @return Date() 当前日期 + */ + public static Date getNowDate() + { + return new Date(); + } + + /** + * 获取当前日期, 默认格式为yyyy-MM-dd + * + * @return String + */ + public static String getDate() + { + return dateTimeNow(YYYY_MM_DD); + } + + public static final String getTime() + { + return dateTimeNow(YYYY_MM_DD_HH_MM_SS); + } + + public static final String dateTimeNow() + { + return dateTimeNow(YYYYMMDDHHMMSS); + } + + public static final String dateTimeNow(final String format) + { + return parseDateToStr(format, new Date()); + } + + public static final String dateTime(final Date date) + { + return parseDateToStr(YYYY_MM_DD, date); + } + + public static final String parseDateToStr(final String format, final Date date) + { + return new SimpleDateFormat(format).format(date); + } + + public static final Date dateTime(final String format, final String ts) + { + try + { + return new SimpleDateFormat(format).parse(ts); + } + catch (ParseException e) + { + throw new RuntimeException(e); + } + } + + /** + * 日期路径 即年/月/日 如2018/08/08 + */ + public static final String datePath() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyy/MM/dd"); + } + + /** + * 日期路径 即年/月/日 如20180808 + */ + public static final String dateTime() + { + Date now = new Date(); + return DateFormatUtils.format(now, "yyyyMMdd"); + } + + /** + * 日期型字符串转化为日期 格式 + */ + public static Date parseDate(Object str) + { + if (str == null) + { + return null; + } + try + { + return parseDate(str.toString(), parsePatterns); + } + catch (ParseException e) + { + return null; + } + } + + /** + * 获取服务器启动时间 + */ + public static Date getServerStartDate() + { + long time = ManagementFactory.getRuntimeMXBean().getStartTime(); + return new Date(time); + } + + /** + * 计算两个时间差 + */ + public static String getDatePoor(Date endDate, Date nowDate) + { + long nd = 1000 * 24 * 60 * 60; + long nh = 1000 * 60 * 60; + long nm = 1000 * 60; + // long ns = 1000; + // 获得两个时间的毫秒时间差异 + long diff = endDate.getTime() - nowDate.getTime(); + // 计算差多少天 + long day = diff / nd; + // 计算差多少小时 + long hour = diff % nd / nh; + // 计算差多少分钟 + long min = diff % nd % nh / nm; + // 计算差多少秒//输出结果 + // long sec = diff % nd % nh % nm / ns; + return day + "天" + hour + "小时" + min + "分钟"; + } + + /** + * 获取过去一周的日期 + * + * @return + */ + public static String getWeekDate() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.DATE, - 7); + Date today = calendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String result = sdf.format(today); + return result; + } + + /** + * 获取当前时间的前一小时 + * + * @return + */ + public static String getBeforHourDate() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.HOUR, - 1); + Date today = calendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH"); + String result = sdf.format(today); + return result; + } + + /** + * 获取昨天的日期 + * + * @return + */ + public static String getYesTerDayDate() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.DATE, - 1); + Date today = calendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String result = sdf.format(today); + return result; + } + + /** + * 获取过去一月的日期 + * + * @return + */ + public static String getLastMonthDate() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH, - 1); + Date today = calendar.getTime(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String result = sdf.format(today); + return result; + } + + /** + * 获取过去一个月的日期 + * + * @return + */ + public static Date getLastMonth() { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date()); + calendar.add(Calendar.MONTH, -1); + Date lastMonth = calendar.getTime(); + return lastMonth; + } +} diff --git a/src/main/java/com/chenxuan/utils/LogUtils.java b/src/main/java/com/chenxuan/utils/LogUtils.java new file mode 100644 index 0000000..dcd4661 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/LogUtils.java @@ -0,0 +1,22 @@ +package com.chenxuan.utils; + + +/** + * @ClassName:LogUtils + * @Description: 处理并记录日志文件 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:06 PM + * @Version V1.0 + */ + +public class LogUtils +{ + public static String getBlock(Object msg) + { + if (msg == null) + { + msg = ""; + } + return "[" + msg.toString() + "]"; + } +} diff --git a/src/main/java/com/chenxuan/utils/Md5.java b/src/main/java/com/chenxuan/utils/Md5.java new file mode 100644 index 0000000..1467488 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/Md5.java @@ -0,0 +1,56 @@ +package com.chenxuan.utils; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * @author Bobi_huo + * @date 2020-10-10 15:26 + */ +public class Md5 { + + private static final String[] STR_DIGITS = new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"}; + + public Md5() { + } + + private static String byteToArrayString(byte bByte) { + int iRet = bByte; + if (bByte < 0) { + iRet = bByte + 256; + } + + int iD1 = iRet / 16; + int iD2 = iRet % 16; + return STR_DIGITS[iD1] + STR_DIGITS[iD2]; + } + + private static String byteToString(byte[] bByte) { + StringBuffer sBuffer = new StringBuffer(); + + for(int i = 0; i < bByte.length; ++i) { + sBuffer.append(byteToArrayString(bByte[i])); + } + + return sBuffer.toString().toUpperCase(); + } + + public static String getMD5Code(String strObj) { + String resultString = null; + + try { + new String(strObj); + MessageDigest md = MessageDigest.getInstance("MD5"); + resultString = byteToString(md.digest(strObj.getBytes())); + } catch (NoSuchAlgorithmException var3) { + var3.printStackTrace(); + } + + return resultString; + } + + public static void main(String[] args) { + System.out.println(getMD5Code("15500000000123456")); + } + +} diff --git a/src/main/java/com/chenxuan/utils/ScheduleRunnable.java b/src/main/java/com/chenxuan/utils/ScheduleRunnable.java new file mode 100644 index 0000000..1fc9de0 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/ScheduleRunnable.java @@ -0,0 +1,53 @@ +package com.chenxuan.utils; + +import com.chenxuan.utils.spring.SpringUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.ReflectionUtils; +import java.lang.reflect.Method; + +/** + * @ClassName: ScheduleRunnable + * @FullClassPath:com.huatek.busi.service.impl.job.ScheduleRunnable + * @Description: 执行定时任务 + * @author: Arno + * @date: Feb 12, 2018 10:50:56 AM + * @version: 1.0 + */ + +@Slf4j +public class ScheduleRunnable implements Runnable { + + private Object target; + private Method method; + private String params; + + public ScheduleRunnable(String beanName, String methodName, String params) throws NoSuchMethodException, SecurityException { + this.target = SpringUtils.getBean( beanName ); + this.params = params; + + if (StringUtils.isNotBlank( params )) { + this.method = ReflectionUtils.findMethod( target.getClass(), methodName, String.class ); + } else { + this.method = ReflectionUtils.findMethod( target.getClass(), methodName ); + } + } + + @Override + public void run() { + try { + ReflectionUtils.makeAccessible( method ); + if (StringUtils.isNotBlank( params )) { + method.invoke( target, params ); + } else { + method.invoke( target ); + } + } catch (Exception e) { + log.error( "执行定时任务失败---[{}]", e.getMessage() ); + if (log.isDebugEnabled()) { + log.error( e.getMessage(), e ); + } + } + } + +} diff --git a/src/main/java/com/chenxuan/utils/SecurityUtils.java b/src/main/java/com/chenxuan/utils/SecurityUtils.java new file mode 100644 index 0000000..d897550 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/SecurityUtils.java @@ -0,0 +1,96 @@ +package com.chenxuan.utils; + + +import com.chenxuan.constants.HttpStatusCode; +import com.chenxuan.exception.CustomException; +import com.chenxuan.security.LoginUser; +import org.springframework.http.HttpStatus; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + + +/** + * @ClassName:SecurityUtils + * @Description: 安全服务工具类 + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 4:46 PM + * @Version V1.0 + */ + +public class SecurityUtils +{ + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new CustomException("获取用户账户异常", HttpStatusCode.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new CustomException("获取用户信息异常", HttpStatusCode.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + public static boolean matchesPassword(String rawPassword, String encodedPassword) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } +} diff --git a/src/main/java/com/chenxuan/utils/ServletUtils.java b/src/main/java/com/chenxuan/utils/ServletUtils.java new file mode 100644 index 0000000..95f5606 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/ServletUtils.java @@ -0,0 +1,124 @@ +package com.chenxuan.utils; + + +import cn.hutool.core.convert.Convert; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; + + +/** + * @ClassName:ServletUtils + * @Description: 客户端工具类 + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 10:32 PM + * @Version V1.0 + */ + +public class ServletUtils { + /** + * 获取String参数 + */ + public static String getParameter(String name) { + return getRequest().getParameter( name ); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) { + return ConvertUtils.toStr( getRequest().getParameter( name ), defaultValue ); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) { + return Convert.toInt( getRequest().getParameter( name ) ); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) { + return ConvertUtils.toInt( getRequest().getParameter( name ), defaultValue ); + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + * @return null + */ + public static String renderString(HttpServletResponse response, String string) { + try { + response.setStatus( 200 ); + response.setContentType( "application/json" ); + response.setCharacterEncoding( "utf-8" ); + response.getWriter().print( string ); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) { + String accept = request.getHeader( "accept" ); + if (accept != null && accept.indexOf( "application/json" ) != -1) { + return true; + } + + String xRequestedWith = request.getHeader( "X-Requested-With" ); + if (xRequestedWith != null && xRequestedWith.indexOf( "XMLHttpRequest" ) != -1) { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase( uri, ".json", ".xml" )) { + return true; + } + + String ajax = request.getParameter( "__ajax" ); + if (StringUtils.inStringIgnoreCase( ajax, "json", "xml" )) { + return true; + } + return false; + } +} diff --git a/src/main/java/com/chenxuan/utils/StrUtils.java b/src/main/java/com/chenxuan/utils/StrUtils.java new file mode 100644 index 0000000..a18cf4c --- /dev/null +++ b/src/main/java/com/chenxuan/utils/StrUtils.java @@ -0,0 +1,455 @@ +package com.chenxuan.utils; + + + +import cn.hutool.core.text.StrFormatter; + +import java.util.*; + + +/** + * @ClassName:StrUtils + * @Description: StringUtils + * @Author: Arno_Fu + * @CreatTime:12/19/2019 - 4:47 PM + * @Version V1.0 + */ + +public class StrUtils extends org.apache.commons.lang3.StringUtils +{ + /** 空字符串 */ + private static final String NULLSTR = ""; + + /** 下划线 */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) + { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) + { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) + { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + ** @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) + { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) + { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) + { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) + { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) + { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) + { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) + { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) + { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) + { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) + { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) + { + if (str == null) + { + return NULLSTR; + } + + if (start < 0) + { + start = str.length() + start; + } + + if (start < 0) + { + start = 0; + } + if (start > str.length()) + { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) + { + if (str == null) + { + return NULLSTR; + } + + if (end < 0) + { + end = str.length() + end; + } + if (start < 0) + { + start = str.length() + start; + } + + if (end > str.length()) + { + end = str.length(); + } + + if (start > end) + { + return NULLSTR; + } + + if (start < 0) + { + start = 0; + } + if (end < 0) + { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) + { + if (isEmpty(params) || isEmpty(template)) + { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) + { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) + { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) + { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) + { + return list; + } + String[] split = str.split(sep); + for (String string : split) + { + if (filterBlank && StringUtils.isBlank(string)) + { + continue; + } + if (trim) + { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 下划线转驼峰命名 + */ + public static String toUnderScoreCase(String str) + { + if (str == null) + { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) + { + char c = str.charAt(i); + if (i > 0) + { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } + else + { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) + { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) + { + sb.append(SEPARATOR); + } + else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) + { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) + { + if (str != null && strs != null) + { + for (String s : strs) + { + if (str.equalsIgnoreCase(trim(s))) + { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) + { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) + { + // 没必要转换 + return ""; + } + else if (!name.contains("_")) + { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) + { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) + { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) + { + if (s == null) + { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + + if (c == SEPARATOR) + { + upperCase = true; + } + else if (upperCase) + { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } + else + { + sb.append(c); + } + } + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/StringUtils.java b/src/main/java/com/chenxuan/utils/StringUtils.java new file mode 100644 index 0000000..d3f380d --- /dev/null +++ b/src/main/java/com/chenxuan/utils/StringUtils.java @@ -0,0 +1,456 @@ +package com.chenxuan.utils; + + + +import cn.hutool.core.text.StrFormatter; + +import java.util.*; + + + +/** + * @ClassName:StringUtils + * @Description: 字符串工具类 + * @Author: Arno_Fu + * @CreatTime:11/29/2019 - 2:17 PM + * @Version V1.0 + */ + +public class StringUtils extends org.apache.commons.lang3.StringUtils +{ + /** 空字符串 */ + private static final String NULLSTR = ""; + + /** 下划线 */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) + { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) + { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) + { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + ** @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) + { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) + { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) + { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) + { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) + { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) + { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) + { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) + { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) + { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) + { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) + { + if (str == null) + { + return NULLSTR; + } + + if (start < 0) + { + start = str.length() + start; + } + + if (start < 0) + { + start = 0; + } + if (start > str.length()) + { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) + { + if (str == null) + { + return NULLSTR; + } + + if (end < 0) + { + end = str.length() + end; + } + if (start < 0) + { + start = str.length() + start; + } + + if (end > str.length()) + { + end = str.length(); + } + + if (start > end) + { + return NULLSTR; + } + + if (start < 0) + { + start = 0; + } + if (end < 0) + { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) + { + if (isEmpty(params) || isEmpty(template)) + { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) + { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) + { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) + { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) + { + return list; + } + String[] split = str.split(sep); + for (String string : split) + { + if (filterBlank && StringUtils.isBlank(string)) + { + continue; + } + if (trim) + { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 下划线转驼峰命名 + */ + public static String toUnderScoreCase(String str) + { + if (str == null) + { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) + { + char c = str.charAt(i); + if (i > 0) + { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } + else + { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) + { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) + { + sb.append(SEPARATOR); + } + else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) + { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) + { + if (str != null && strs != null) + { + for (String s : strs) + { + if (str.equalsIgnoreCase(trim(s))) + { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) + { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) + { + // 没必要转换 + return ""; + } + else if (!name.contains("_")) + { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) + { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) + { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) + { + if (s == null) + { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + + if (c == SEPARATOR) + { + upperCase = true; + } + else if (upperCase) + { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } + else + { + sb.append(c); + } + } + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/Threads.java b/src/main/java/com/chenxuan/utils/Threads.java new file mode 100644 index 0000000..b06e3bb --- /dev/null +++ b/src/main/java/com/chenxuan/utils/Threads.java @@ -0,0 +1,99 @@ +package com.chenxuan.utils; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 线程相关工具类. + * + * @author ruoyi + */ +public class Threads +{ + private static final Logger logger = LoggerFactory.getLogger(Threads.class); + + /** + * sleep等待,单位为毫秒 + */ + public static void sleep(long milliseconds) + { + try + { + Thread.sleep(milliseconds); + } + catch (InterruptedException e) + { + return; + } + } + + /** + * 停止线程池 + * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. + * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. + * 如果仍人超時,則強制退出. + * 另对在shutdown时线程本身被调用中断做了处理. + */ + public static void shutdownAndAwaitTermination(ExecutorService pool) + { + if (pool != null && !pool.isShutdown()) + { + pool.shutdown(); + try + { + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + pool.shutdownNow(); + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + logger.info("Pool did not terminate"); + } + } + } + catch (InterruptedException ie) + { + pool.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + } + + /** + * 打印线程异常信息 + */ + public static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future) + { + try + { + Future future = (Future) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + logger.error(t.getMessage(), t); + } + } +} diff --git a/src/main/java/com/chenxuan/utils/VerifyCodeUtils.java b/src/main/java/com/chenxuan/utils/VerifyCodeUtils.java new file mode 100644 index 0000000..7a5fbff --- /dev/null +++ b/src/main/java/com/chenxuan/utils/VerifyCodeUtils.java @@ -0,0 +1,226 @@ +package com.chenxuan.utils; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.OutputStream; +import java.security.SecureRandom; +import java.util.Arrays; +import java.util.Random; + + +/** + * @ClassName:VerifyCodeUtils + * @Description: 验证码工具类 + * @Author: Arno_Fu + * @CreatTime:11/27/2019 - 2:21 PM + * @Version V1.0 + */ + +public class VerifyCodeUtils +{ + // 使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符 + public static final String VERIFY_CODES = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ"; + + private static Random random = new SecureRandom(); + + /** + * 使用系统默认字符源生成验证码 + * + * @param verifySize 验证码长度 + * @return + */ + public static String generateVerifyCode(int verifySize) + { + return generateVerifyCode(verifySize, VERIFY_CODES); + } + + /** + * 使用指定源生成验证码 + * + * @param verifySize 验证码长度 + * @param sources 验证码字符源 + * @return + */ + public static String generateVerifyCode(int verifySize, String sources) + { + if (sources == null || sources.length() == 0) + { + sources = VERIFY_CODES; + } + int codesLen = sources.length(); + Random rand = new Random(System.currentTimeMillis()); + StringBuilder verifyCode = new StringBuilder(verifySize); + for (int i = 0; i < verifySize; i++) + { + verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); + } + return verifyCode.toString(); + } + + /** + * 输出指定验证码图片流 + * + * @param w + * @param h + * @param os + * @param code + * @throws IOException + */ + public static void outputImage(int w, int h, OutputStream os, String code) throws IOException + { + int verifySize = code.length(); + BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + Random rand = new Random(); + Graphics2D g2 = image.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + Color[] colors = new Color[5]; + Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, + Color.ORANGE, Color.PINK, Color.YELLOW }; + float[] fractions = new float[colors.length]; + for (int i = 0; i < colors.length; i++) + { + colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)]; + fractions[i] = rand.nextFloat(); + } + Arrays.sort(fractions); + + g2.setColor(Color.GRAY);// 设置边框色 + g2.fillRect(0, 0, w, h); + + Color c = getRandColor(200, 250); + g2.setColor(c);// 设置背景色 + g2.fillRect(0, 2, w, h - 4); + + // 绘制干扰线 + Random random = new Random(); + g2.setColor(getRandColor(160, 200));// 设置线条的颜色 + for (int i = 0; i < 20; i++) + { + int x = random.nextInt(w - 1); + int y = random.nextInt(h - 1); + int xl = random.nextInt(6) + 1; + int yl = random.nextInt(12) + 1; + g2.drawLine(x, y, x + xl + 40, y + yl + 20); + } + + // 添加噪点 + float yawpRate = 0.05f;// 噪声率 + int area = (int) (yawpRate * w * h); + for (int i = 0; i < area; i++) + { + int x = random.nextInt(w); + int y = random.nextInt(h); + int rgb = getRandomIntColor(); + image.setRGB(x, y, rgb); + } + + shear(g2, w, h, c);// 使图片扭曲 + + g2.setColor(getRandColor(100, 160)); + int fontSize = h - 4; + Font font = new Font("Algerian", Font.ITALIC, fontSize); + g2.setFont(font); + char[] chars = code.toCharArray(); + for (int i = 0; i < verifySize; i++) + { + AffineTransform affine = new AffineTransform(); + affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1), + (w / verifySize) * i + fontSize / 2, h / 2); + g2.setTransform(affine); + g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10); + } + + g2.dispose(); + ImageIO.write(image, "jpg", os); + } + + private static Color getRandColor(int fc, int bc) + { + if (fc > 255) + fc = 255; + if (bc > 255) + bc = 255; + int r = fc + random.nextInt(bc - fc); + int g = fc + random.nextInt(bc - fc); + int b = fc + random.nextInt(bc - fc); + return new Color(r, g, b); + } + + private static int getRandomIntColor() + { + int[] rgb = getRandomRgb(); + int color = 0; + for (int c : rgb) + { + color = color << 8; + color = color | c; + } + return color; + } + + private static int[] getRandomRgb() + { + int[] rgb = new int[3]; + for (int i = 0; i < 3; i++) + { + rgb[i] = random.nextInt(255); + } + return rgb; + } + + private static void shear(Graphics g, int w1, int h1, Color color) + { + shearX(g, w1, h1, color); + shearY(g, w1, h1, color); + } + + private static void shearX(Graphics g, int w1, int h1, Color color) + { + + int period = random.nextInt(2); + + boolean borderGap = true; + int frames = 1; + int phase = random.nextInt(2); + + for (int i = 0; i < h1; i++) + { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); + g.copyArea(0, i, w1, 1, (int) d, 0); + if (borderGap) + { + g.setColor(color); + g.drawLine((int) d, i, 0, i); + g.drawLine((int) d + w1, i, w1, i); + } + } + + } + + private static void shearY(Graphics g, int w1, int h1, Color color) + { + + int period = random.nextInt(40) + 10; // 50; + + boolean borderGap = true; + int frames = 20; + int phase = 7; + for (int i = 0; i < w1; i++) + { + double d = (double) (period >> 1) + * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames); + g.copyArea(i, 0, 1, h1, 0, (int) d); + if (borderGap) + { + g.setColor(color); + g.drawLine(i, (int) d, i, 0); + g.drawLine(i, (int) d + h1, i, h1); + } + + } + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/file/FileUploadUtils.java b/src/main/java/com/chenxuan/utils/file/FileUploadUtils.java new file mode 100644 index 0000000..b6ea5c2 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/file/FileUploadUtils.java @@ -0,0 +1,203 @@ +package com.chenxuan.utils.file; + + +import com.chenxuan.bean.config.UploadConfig; +import com.chenxuan.constants.Constants; +import com.chenxuan.utils.DateUtils; +import com.chenxuan.utils.StringUtils; +import com.chenxuan.utils.security.Md5Utils; +import org.apache.commons.fileupload.FileUploadBase; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; + + +/** + * @ClassName:FileUploadUtils + * @Description: 文件上传工具类 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:44 AM + * @Version V1.0 + */ + +public class FileUploadUtils { + /** + * 默认大小 50M + */ + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + + /** + * 默认的文件名最大长度 100 + */ + public static final int DEFAULT_FILE_NAME_LENGTH = 100; + + /** + * 默认上传的地址 + */ + private static String defaultBaseDir = UploadConfig.getProfile(); + + private static int counter = 0; + + public static void setDefaultBaseDir(String defaultBaseDir) { + FileUploadUtils.defaultBaseDir = defaultBaseDir; + } + + public static String getDefaultBaseDir() { + return defaultBaseDir; + } + + /** + * 以默认配置进行文件上传 + * + * @param file 上传的文件 + * @return 文件名称 + * @throws Exception + */ + public static final String upload(MultipartFile file) throws IOException { + try { + return upload( getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION ); + } catch (Exception e) { + throw new IOException( e.getMessage(), e ); + } + } + + /** + * 根据文件路径上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 文件名称 + * @throws IOException + */ + public static final String upload(String baseDir, MultipartFile file) throws IOException { + try { + return upload( baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION ); + } catch (Exception e) { + throw new IOException( e.getMessage(), e ); + } + } + + /** + * 文件上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 返回上传成功的文件名 + */ + public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) throws Exception { + int fileNamelength = file.getOriginalFilename().length(); + /* if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) { + throw new FileNameLengthLimitExceededException( FileUploadUtils.DEFAULT_FILE_NAME_LENGTH ); + }*/ + + assertAllowed( file, allowedExtension ); + + String fileName = extractFilename( file ); + + File desc = getAbsoluteFile( baseDir, fileName ); + file.transferTo( desc ); + String pathFileName = getPathFileName( baseDir, fileName ); + return pathFileName; + } + + /** + * 编码文件名 + */ + public static final String extractFilename(MultipartFile file) { + String fileName = file.getOriginalFilename(); + String extension = getExtension( file ); + fileName = DateUtils.datePath() + "/" + encodingFilename( fileName ) + "." + extension; + return fileName; + } + + private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException { + File desc = new File( uploadDir + File.separator + fileName ); + + if (!desc.getParentFile().exists()) { + desc.getParentFile().mkdirs(); + } + if (!desc.exists()) { + desc.createNewFile(); + } + return desc; + } + + private static final String getPathFileName(String uploadDir, String fileName) throws IOException { + int dirLastIndex = UploadConfig.getProfile().length() + 1; + String currentDir = StringUtils.substring( uploadDir, dirLastIndex ); + String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName; + return pathFileName; + } + + /** + * 编码文件名 + */ + private static final String encodingFilename(String fileName) { + fileName = fileName.replace( "_", " " ); + fileName = Md5Utils.hash( fileName + System.nanoTime() + counter++ ); + return fileName; + } + + /** + * 文件大小校验 + * + * @param file 上传的文件 + * @return + */ + public static final void assertAllowed(MultipartFile file, String[] allowedExtension) throws Exception { + long size = file.getSize(); + /* if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) { + throw new FileSizeLimitExceededException( DEFAULT_MAX_SIZE / 1024 / 1024 ); + }*/ + + String fileName = file.getOriginalFilename(); + String extension = getExtension( file ); + if (allowedExtension != null && !isAllowedExtension( extension, allowedExtension )) { + /* if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) { + throw new InvalidExtensionException.InvalidImageExtensionException( allowedExtension, extension, + fileName ); + } else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) { + throw new InvalidExtensionException.InvalidFlashExtensionException( allowedExtension, extension, + fileName ); + } else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) { + throw new InvalidExtensionException.InvalidMediaExtensionException( allowedExtension, extension, + fileName ); + } else { + throw new InvalidExtensionException( allowedExtension, extension, fileName ); + }*/ + } + + } + + /** + * 判断MIME类型是否是允许的MIME类型 + * + * @param extension + * @param allowedExtension + * @return + */ + public static final boolean isAllowedExtension(String extension, String[] allowedExtension) { + for (String str : allowedExtension) { + if (str.equalsIgnoreCase( extension )) { + return true; + } + } + return false; + } + + /** + * 获取文件名的后缀 + * + * @param file 表单文件 + * @return 后缀名 + */ + public static final String getExtension(MultipartFile file) { + String extension = FilenameUtils.getExtension( file.getOriginalFilename() ); + if (StringUtils.isEmpty( extension )) { + extension = MimeTypeUtils.getExtension( file.getContentType() ); + } + return extension; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/file/FileUtils.java b/src/main/java/com/chenxuan/utils/file/FileUtils.java new file mode 100644 index 0000000..f51815f --- /dev/null +++ b/src/main/java/com/chenxuan/utils/file/FileUtils.java @@ -0,0 +1,113 @@ +package com.chenxuan.utils.file; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.URLEncoder; + + +/** + * @ClassName:FileUtils + * @Description: 文件处理工具类 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:45 AM + * @Version V1.0 + */ + +public class FileUtils { + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + + /** + * 输出指定文件的byte数组 + * + * @param filePath 文件路径 + * @param os 输出流 + * @return + */ + public static void writeBytes(String filePath, OutputStream os) throws IOException { + FileInputStream fis = null; + try { + File file = new File( filePath ); + if (!file.exists()) { + throw new FileNotFoundException( filePath ); + } + fis = new FileInputStream( file ); + byte[] b = new byte[1024]; + int length; + while ((length = fis.read( b )) > 0) { + os.write( b, 0, length ); + } + } catch (IOException e) { + throw e; + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + if (fis != null) { + try { + fis.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } + } + + /** + * 删除文件 + * + * @param filePath 文件 + * @return + */ + public static boolean deleteFile(String filePath) { + boolean flag = false; + File file = new File( filePath ); + // 路径为文件且不为空则进行删除 + if (file.isFile() && file.exists()) { + file.delete(); + flag = true; + } + return flag; + } + + /** + * 文件名称验证 + * + * @param filename 文件名称 + * @return true 正常 false 非法 + */ + public static boolean isValidFilename(String filename) { + return filename.matches( FILENAME_PATTERN ); + } + + /** + * 下载文件名重新编码 + * + * @param request 请求对象 + * @param fileName 文件名 + * @return 编码后的文件名 + */ + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) + throws UnsupportedEncodingException { + final String agent = request.getHeader( "USER-AGENT" ); + String filename = fileName; + if (agent.contains( "MSIE" )) { + // IE浏览器 + filename = URLEncoder.encode( filename, "utf-8" ); + filename = filename.replace( "+", " " ); + } else if (agent.contains( "Firefox" )) { + // 火狐浏览器 + filename = new String( fileName.getBytes(), "ISO8859-1" ); + } else if (agent.contains( "Chrome" )) { + // google浏览器 + filename = URLEncoder.encode( filename, "utf-8" ); + } else { + // 其它浏览器 + filename = URLEncoder.encode( filename, "utf-8" ); + } + return filename; + } +} diff --git a/src/main/java/com/chenxuan/utils/file/MimeTypeUtils.java b/src/main/java/com/chenxuan/utils/file/MimeTypeUtils.java new file mode 100644 index 0000000..7733690 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package com.chenxuan.utils.file; + + +/** + * @ClassName:MimeTypeUtils + * @Description: 媒体类型工具类 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:45 AM + * @Version V1.0 + */ + +public class MimeTypeUtils +{ + public static final String IMAGE_PNG = "image/png"; + + public static final String IMAGE_JPG = "image/jpg"; + + public static final String IMAGE_JPEG = "image/jpeg"; + + public static final String IMAGE_BMP = "image/bmp"; + + public static final String IMAGE_GIF = "image/gif"; + + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; + + public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + + public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb" }; + + public static final String[] DEFAULT_ALLOWED_EXTENSION = { + // 图片 + "bmp", "gif", "jpg", "jpeg", "png", + // word excel powerpoint + "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", + // 压缩文件 + "rar", "zip", "gz", "bz2", + // pdf + "pdf" }; + + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } +} diff --git a/src/main/java/com/chenxuan/utils/html/EscapeUtil.java b/src/main/java/com/chenxuan/utils/html/EscapeUtil.java new file mode 100644 index 0000000..5f73faa --- /dev/null +++ b/src/main/java/com/chenxuan/utils/html/EscapeUtil.java @@ -0,0 +1,156 @@ +package com.chenxuan.utils.html; + + +import com.chenxuan.utils.StringUtils; + +/** + * @ClassName:EscapeUtil + * @Description: 转义和反转义工具类 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:44 AM + * @Version V1.0 + */ + +public class EscapeUtil +{ + public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; + + private static final char[][] TEXT = new char[64][]; + + static + { + for (int i = 0; i < 64; i++) + { + TEXT[i] = new char[] { (char) i }; + } + + // special HTML characters + TEXT['\''] = "'".toCharArray(); // 单引号 + TEXT['"'] = """.toCharArray(); // 单引号 + TEXT['&'] = "&".toCharArray(); // &符 + TEXT['<'] = "<".toCharArray(); // 小于号 + TEXT['>'] = ">".toCharArray(); // 大于号 + } + + /** + * 转义文本中的HTML字符为安全的字符 + * + * @param text 被转义的文本 + * @return 转义后的文本 + */ + public static String escape(String text) + { + return encode(text); + } + + /** + * 还原被转义的HTML特殊字符 + * + * @param content 包含转义符的HTML内容 + * @return 转换后的字符串 + */ + public static String unescape(String content) + { + return decode(content); + } + + /** + * 清除所有HTML标签,但是不删除标签内的内容 + * + * @param content 文本 + * @return 清除标签后的文本 + */ + public static String clean(String content) + { + return content.replaceAll(RE_HTML_MARK, ""); + } + + /** + * Escape编码 + * + * @param text 被编码的文本 + * @return 编码后的字符 + */ + private static String encode(String text) + { + int len; + if ((text == null) || ((len = text.length()) == 0)) + { + return StringUtils.EMPTY; + } + StringBuilder buffer = new StringBuilder(len + (len >> 2)); + char c; + for (int i = 0; i < len; i++) + { + c = text.charAt(i); + if (c < 64) + { + buffer.append(TEXT[c]); + } + else + { + buffer.append(c); + } + } + return buffer.toString(); + } + + /** + * Escape解码 + * + * @param content 被转义的内容 + * @return 解码后的字符串 + */ + public static String decode(String content) + { + if (StringUtils.isEmpty(content)) + { + return content; + } + + StringBuilder tmp = new StringBuilder(content.length()); + int lastPos = 0, pos = 0; + char ch; + while (lastPos < content.length()) + { + pos = content.indexOf("%", lastPos); + if (pos == lastPos) + { + if (content.charAt(pos + 1) == 'u') + { + ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); + tmp.append(ch); + lastPos = pos + 6; + } + else + { + ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); + tmp.append(ch); + lastPos = pos + 3; + } + } + else + { + if (pos == -1) + { + tmp.append(content.substring(lastPos)); + lastPos = content.length(); + } + else + { + tmp.append(content.substring(lastPos, pos)); + lastPos = pos; + } + } + } + return tmp.toString(); + } + + public static void main(String[] args) + { + String html = ""; + System.out.println(EscapeUtil.clean(html)); + System.out.println(EscapeUtil.escape(html)); + System.out.println(EscapeUtil.unescape(html)); + } +} diff --git a/src/main/java/com/chenxuan/utils/http/HttpUtils.java b/src/main/java/com/chenxuan/utils/http/HttpUtils.java new file mode 100644 index 0000000..353e577 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/http/HttpUtils.java @@ -0,0 +1,190 @@ +package com.chenxuan.utils.http; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.*; +import java.io.*; +import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.net.URL; +import java.net.URLConnection; +import java.security.cert.X509Certificate; + + +/** + * @ClassName:HttpUtils + * @Description: 通用http发送方法 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:05 PM + * @Version V1.0 + */ + +public class HttpUtils { + private static final Logger log = LoggerFactory.getLogger( HttpUtils.class ); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try { + String urlNameString = url + "?" + param; + log.info( "sendGet - {}", urlNameString ); + URL realUrl = new URL( urlNameString ); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty( "accept", "*/*" ); + connection.setRequestProperty( "connection", "Keep-Alive" ); + connection.setRequestProperty( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)" ); + connection.connect(); + in = new BufferedReader( new InputStreamReader( connection.getInputStream() ) ); + String line; + while ((line = in.readLine()) != null) { + result.append( line ); + } + log.info( "recv - {}", result ); + } catch (ConnectException e) { + log.error( "调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e ); + } catch (SocketTimeoutException e) { + log.error( "调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e ); + } catch (IOException e) { + log.error( "调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e ); + } catch (Exception e) { + log.error( "调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e ); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception ex) { + log.error( "调用in.close Exception, url=" + url + ",param=" + param, ex ); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + String urlNameString = url + "?" + param; + log.info( "sendPost - {}", urlNameString ); + URL realUrl = new URL( urlNameString ); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty( "accept", "*/*" ); + conn.setRequestProperty( "connection", "Keep-Alive" ); + conn.setRequestProperty( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)" ); + conn.setRequestProperty( "Accept-Charset", "utf-8" ); + conn.setRequestProperty( "contentType", "utf-8" ); + conn.setDoOutput( true ); + conn.setDoInput( true ); + out = new PrintWriter( conn.getOutputStream() ); + out.print( param ); + out.flush(); + in = new BufferedReader( new InputStreamReader( conn.getInputStream(), "utf-8" ) ); + String line; + while ((line = in.readLine()) != null) { + result.append( line ); + } + log.info( "recv - {}", result ); + } catch (ConnectException e) { + log.error( "调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e ); + } catch (SocketTimeoutException e) { + log.error( "调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e ); + } catch (IOException e) { + log.error( "调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e ); + } catch (Exception e) { + log.error( "调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e ); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error( "调用in.close Exception, url=" + url + ",param=" + param, ex ); + } + } + return result.toString(); + } + + public static String sendSSLPost(String url, String param) { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try { + log.info( "sendSSLPost - {}", urlNameString ); + SSLContext sc = SSLContext.getInstance( "SSL" ); + sc.init( null, new TrustManager[]{new TrustAnyTrustManager()}, new java.security.SecureRandom() ); + URL console = new URL( urlNameString ); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty( "accept", "*/*" ); + conn.setRequestProperty( "connection", "Keep-Alive" ); + conn.setRequestProperty( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)" ); + conn.setRequestProperty( "Accept-Charset", "utf-8" ); + conn.setRequestProperty( "contentType", "utf-8" ); + conn.setDoOutput( true ); + conn.setDoInput( true ); + + conn.setSSLSocketFactory( sc.getSocketFactory() ); + conn.setHostnameVerifier( new TrustAnyHostnameVerifier() ); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader( new InputStreamReader( is ) ); + String ret = ""; + while ((ret = br.readLine()) != null) { + if (ret != null && !ret.trim().equals( "" )) { + result.append( new String( ret.getBytes( "ISO-8859-1" ), "utf-8" ) ); + } + } + log.info( "recv - {}", result ); + conn.disconnect(); + br.close(); + } catch (ConnectException e) { + log.error( "调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e ); + } catch (SocketTimeoutException e) { + log.error( "调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e ); + } catch (IOException e) { + log.error( "调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e ); + } catch (Exception e) { + log.error( "调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e ); + } + return result.toString(); + } + + private static class TrustAnyTrustManager implements X509TrustManager { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/ip/AddressUtils.java b/src/main/java/com/chenxuan/utils/ip/AddressUtils.java new file mode 100644 index 0000000..8166299 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/ip/AddressUtils.java @@ -0,0 +1,42 @@ +package com.chenxuan.utils.ip; + +import com.alibaba.fastjson.JSONObject; + +import com.chenxuan.utils.StringUtils; +import com.chenxuan.utils.http.HttpUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @ClassName:AddressUtils + * @Description: 获取地址类 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:04 PM + * @Version V1.0 + */ + +public class AddressUtils { + private static final Logger log = LoggerFactory.getLogger( AddressUtils.class ); + + public static final String IP_URL = "http://ip.taobao.com/service/getIpInfo.php"; + + public static String getRealAddressByIP(String ip) { + String address = "XX XX"; + // 内网不查询 + if (IpUtils.internalIp( ip )) { + return "内网IP"; + } + String rspStr = HttpUtils.sendPost( IP_URL, "ip=" + ip ); + if (StringUtils.isEmpty( rspStr )) { + log.error( "获取地理位置异常 {}", ip ); + return address; + } + JSONObject obj = JSONObject.parseObject( rspStr ); + JSONObject data = obj.getObject( "data", JSONObject.class ); + String region = data.getString( "region" ); + String city = data.getString( "city" ); + address = region + " " + city; + return address; + } +} diff --git a/src/main/java/com/chenxuan/utils/ip/IpUtils.java b/src/main/java/com/chenxuan/utils/ip/IpUtils.java new file mode 100644 index 0000000..740d451 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/ip/IpUtils.java @@ -0,0 +1,196 @@ +package com.chenxuan.utils.ip; + + + +import com.chenxuan.utils.StringUtils; + +import javax.servlet.http.HttpServletRequest; +import java.net.InetAddress; +import java.net.UnknownHostException; + + +/** + * @ClassName:IpUtils + * @Description: 获取IP方法 + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:04 PM + * @Version V1.0 + */ + +public class IpUtils +{ + public static String getIpAddr(HttpServletRequest request) + { + if (request == null) + { + return "unknown"; + } + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Forwarded-For"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Real-IP"); + } + + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getRemoteAddr(); + } + + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : ip; + } + + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + private static boolean internalIp(byte[] addr) + { + if (StringUtils.isNull(addr) || addr.length < 2) + { + return true; + } + final byte b0 = addr[0]; + final byte b1 = addr[1]; + // 10.x.x.x/8 + final byte SECTION_1 = 0x0A; + // 172.16.x.x/12 + final byte SECTION_2 = (byte) 0xAC; + final byte SECTION_3 = (byte) 0x10; + final byte SECTION_4 = (byte) 0x1F; + // 192.168.x.x/16 + final byte SECTION_5 = (byte) 0xC0; + final byte SECTION_6 = (byte) 0xA8; + switch (b0) + { + case SECTION_1: + return true; + case SECTION_2: + if (b1 >= SECTION_3 && b1 <= SECTION_4) + { + return true; + } + case SECTION_5: + switch (b1) + { + case SECTION_6: + return true; + } + default: + return false; + } + } + + /** + * 将IPv4地址转换成字节 + * + * @param text IPv4地址 + * @return byte 字节 + */ + public static byte[] textToNumericFormatV4(String text) + { + if (text.length() == 0) + { + return null; + } + + byte[] bytes = new byte[4]; + String[] elements = text.split("\\.", -1); + try + { + long l; + int i; + switch (elements.length) + { + case 1: + l = Long.parseLong(elements[0]); + if ((l < 0L) || (l > 4294967295L)) + return null; + bytes[0] = (byte) (int) (l >> 24 & 0xFF); + bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 2: + l = Integer.parseInt(elements[0]); + if ((l < 0L) || (l > 255L)) + return null; + bytes[0] = (byte) (int) (l & 0xFF); + l = Integer.parseInt(elements[1]); + if ((l < 0L) || (l > 16777215L)) + return null; + bytes[1] = (byte) (int) (l >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 3: + for (i = 0; i < 2; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + return null; + bytes[i] = (byte) (int) (l & 0xFF); + } + l = Integer.parseInt(elements[2]); + if ((l < 0L) || (l > 65535L)) + return null; + bytes[2] = (byte) (int) (l >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 4: + for (i = 0; i < 4; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + return null; + bytes[i] = (byte) (int) (l & 0xFF); + } + break; + default: + return null; + } + } + catch (NumberFormatException e) + { + return null; + } + return bytes; + } + + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/utils/security/Md5Utils.java b/src/main/java/com/chenxuan/utils/security/Md5Utils.java new file mode 100644 index 0000000..fa61276 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/security/Md5Utils.java @@ -0,0 +1,71 @@ +package com.chenxuan.utils.security; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.security.MessageDigest; + + +/** + * @ClassName:Md5Utils + * @Description: Md5加密方法 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:50 AM + * @Version V1.0 + */ + +public class Md5Utils +{ + private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + log.error("MD5 Error...", e); + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8"); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/src/main/java/com/chenxuan/utils/spring/SpringUtils.java b/src/main/java/com/chenxuan/utils/spring/SpringUtils.java new file mode 100644 index 0000000..566b854 --- /dev/null +++ b/src/main/java/com/chenxuan/utils/spring/SpringUtils.java @@ -0,0 +1,106 @@ +package com.chenxuan.utils.spring; + +import org.springframework.aop.framework.AopContext; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.stereotype.Component; + + +/** + * @ClassName:SpringUtils + * @Description: spring工具类 方便在非spring管理环境中获取bean + * @Author: Arno_Fu + * @CreatTime:12/20/2019 - 5:06 PM + * @Version V1.0 + */ + +@Component +public final class SpringUtils implements BeanFactoryPostProcessor { + /** + * Spring应用上下文环境 + */ + private static ConfigurableListableBeanFactory beanFactory; + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + SpringUtils.beanFactory = beanFactory; + } + + /** + * 获取对象 + * + * @param name + * @return Object 一个以所给名字注册的bean的实例 + * @throws org.springframework.beans.BeansException + */ + @SuppressWarnings("unchecked") + public static T getBean(String name) throws BeansException { + return (T) beanFactory.getBean( name ); + } + + /** + * 获取类型为requiredType的对象 + * + * @param clz + * @return + * @throws org.springframework.beans.BeansException + */ + public static T getBean(Class clz) throws BeansException { + T result = (T) beanFactory.getBean( clz ); + return result; + } + + /** + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true + * + * @param name + * @return boolean + */ + public static boolean containsBean(String name) { + return beanFactory.containsBean( name ); + } + + /** + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) + * + * @param name + * @return boolean + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + */ + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException { + return beanFactory.isSingleton( name ); + } + + /** + * @param name + * @return Class 注册对象的类型 + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + */ + public static Class getType(String name) throws NoSuchBeanDefinitionException { + return beanFactory.getType( name ); + } + + /** + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 + * + * @param name + * @return + * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException + */ + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException { + return beanFactory.getAliases( name ); + } + + /** + * 获取aop代理对象 + * + * @param invoker + * @return + */ + @SuppressWarnings("unchecked") + public static T getAopProxy(T invoker) { + return (T) AopContext.currentProxy(); + } +} diff --git a/src/main/java/com/chenxuan/vo/LogVO.java b/src/main/java/com/chenxuan/vo/LogVO.java new file mode 100644 index 0000000..b522cce --- /dev/null +++ b/src/main/java/com/chenxuan/vo/LogVO.java @@ -0,0 +1,74 @@ +package com.chenxuan.vo; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +/** + * @ClassName:LogVO + * @Description: 日志. + * @Author: Arno_Fu + * @CreatTime:11/26/2019 - 4:21 PM + * @Version V1.0 + */ + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class LogVO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 模块 + */ + private String module; + + /** + * 创建者 + */ + private String userName; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 操作IP地址 + */ + private String ipAddr; + + /** + * 请求URI + */ + private String requestUri; + + /** + * 操作方式 + */ + private String method; + + /** + * 参数值 + */ + private String params; + + + /** + * 执行结果标记 + */ + private String flag; + + /** + * 备注 + */ + private String mark; +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/websocket/MyEndpointConfigure.java b/src/main/java/com/chenxuan/websocket/MyEndpointConfigure.java new file mode 100644 index 0000000..3ed0659 --- /dev/null +++ b/src/main/java/com/chenxuan/websocket/MyEndpointConfigure.java @@ -0,0 +1,25 @@ +package com.chenxuan.websocket; + +import javax.websocket.server.ServerEndpointConfig; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +/** + * @Author:JCccc + * @Description: + * @Date: created in 15:56 2019/5/13 + */ +public class MyEndpointConfigure extends ServerEndpointConfig.Configurator implements ApplicationContextAware { + private static volatile BeanFactory context; + + @Override + public T getEndpointInstance(Class clazz) throws InstantiationException { + return context.getBean(clazz); + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + MyEndpointConfigure.context = applicationContext; + } +} diff --git a/src/main/java/com/chenxuan/websocket/ProductWebSocket.java b/src/main/java/com/chenxuan/websocket/ProductWebSocket.java new file mode 100644 index 0000000..49b8c17 --- /dev/null +++ b/src/main/java/com/chenxuan/websocket/ProductWebSocket.java @@ -0,0 +1,122 @@ +package com.chenxuan.websocket; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.websocket.OnClose; +import javax.websocket.OnError; +import javax.websocket.OnMessage; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import com.chenxuan.websocket.MyEndpointConfigure; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +/** + * @Author:JCccc + * @Description: + * @Date: created in 15:56 2019/5/13 + */ + +@Component +@ServerEndpoint(value = "/websocket/helloSocket", configurator = MyEndpointConfigure.class) +public class ProductWebSocket { + + // 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。 + private static final AtomicInteger OnlineCount = new AtomicInteger(0); + + // concurrent包的线程安全Set,用来存放每个客户端对应的ProductWebSocket对象。 + private static CopyOnWriteArraySet webSocketSet = new CopyOnWriteArraySet(); + + // 与某个客户端的连接会话,需要通过它来给客户端发送数据 + private Session session; + + + private Logger log = LoggerFactory.getLogger(ProductWebSocket.class); + + /** + * 连接建立成功调用的方法 + */ + @OnOpen + public void onOpen(@PathParam("userId")String userId, Session session) { + log.info("新客户端连入,用户id:" + userId); + this.session = session; + webSocketSet.add(this); // 加入set中 + addOnlineCount(); // 在线数加1 + if(userId!=null) { + List totalPushMsgs = new ArrayList(); + totalPushMsgs.add(userId+"连接成功-"+"-当前在线人数为:"+getOnlineCount()); + + + if(totalPushMsgs != null && !totalPushMsgs.isEmpty()) { + totalPushMsgs.forEach(e -> sendMessage(e)); + } + } + + } + + /** + * 连接关闭调用的方法 + */ + @OnClose + public void onClose() { + log.info("一个客户端关闭连接"); + webSocketSet.remove(this); // 从set中删除 + subOnlineCount(); // 在线数减1 + } + + /** + * 收到客户端消息后调用的方法 + * + * @param message + * 客户端发送过来的消息 + */ + @OnMessage + public void onMessage(String message, Session session) { + log.info("用户发送过来的消息为:"+message); + } + + /** + * 发生错误时调用 + */ + @OnError + public void onError(Session session, Throwable error) { + log.error("websocket出现错误"); + error.printStackTrace(); + } + + public void sendMessage(String message) { + try { + this.session.getBasicRemote().sendText(message); + log.info("推送消息成功,消息为:" + message); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 群发自定义消息 + */ + public static void sendInfo(String message) throws IOException { + for (ProductWebSocket productWebSocket : webSocketSet) { + productWebSocket.sendMessage(message); + } + } + + public static synchronized int getOnlineCount() { + return OnlineCount.get(); + } + + public static synchronized void addOnlineCount() { + OnlineCount.incrementAndGet(); // 在线数加1 + } + + public static synchronized void subOnlineCount() { + OnlineCount.decrementAndGet(); // 在线数加1 + } +} diff --git a/src/main/java/com/chenxuan/websocket/WebSocketConfig.java b/src/main/java/com/chenxuan/websocket/WebSocketConfig.java new file mode 100644 index 0000000..37847db --- /dev/null +++ b/src/main/java/com/chenxuan/websocket/WebSocketConfig.java @@ -0,0 +1,23 @@ +package com.chenxuan.websocket; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Bean; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; +/** + * @Author:JCccc + * @Description: + * @Date: created in 15:56 2019/5/13 + */ +@Configuration +public class WebSocketConfig { + + @Bean + public ServerEndpointExporter serverEndpointExporter() { + return new ServerEndpointExporter(); + } + + @Bean + public MyEndpointConfigure newConfigure() { + return new MyEndpointConfigure(); + } +} diff --git a/src/main/java/com/chenxuan/xxs/XssFilter.java b/src/main/java/com/chenxuan/xxs/XssFilter.java new file mode 100644 index 0000000..9395bc2 --- /dev/null +++ b/src/main/java/com/chenxuan/xxs/XssFilter.java @@ -0,0 +1,99 @@ +package com.chenxuan.xxs; + + + +import com.chenxuan.utils.StringUtils; + +import javax.servlet.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +/** + * @ClassName:XssFilter + * @Description: 防止XSS攻击的过滤器 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:43 AM + * @Version V1.0 + */ + +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + /** + * xss过滤开关 + */ + public boolean enabled = false; + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + String tempEnabled = filterConfig.getInitParameter("enabled"); + if (StringUtils.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + if (StringUtils.isNotEmpty(tempEnabled)) + { + enabled = Boolean.valueOf(tempEnabled); + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse resp = (HttpServletResponse) response; + if (handleExcludeURL(req, resp)) + { + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) + { + if (!enabled) + { + return true; + } + if (excludes == null || excludes.isEmpty()) + { + return false; + } + String url = request.getServletPath(); + for (String pattern : excludes) + { + Pattern p = Pattern.compile("^" + pattern); + Matcher m = p.matcher(url); + if (m.find()) + { + return true; + } + } + return false; + } + + @Override + public void destroy() + { + + } +} \ No newline at end of file diff --git a/src/main/java/com/chenxuan/xxs/XssHttpServletRequestWrapper.java b/src/main/java/com/chenxuan/xxs/XssHttpServletRequestWrapper.java new file mode 100644 index 0000000..2c4cea1 --- /dev/null +++ b/src/main/java/com/chenxuan/xxs/XssHttpServletRequestWrapper.java @@ -0,0 +1,95 @@ +package com.chenxuan.xxs; + + +import com.chenxuan.utils.StringUtils; +import com.chenxuan.utils.html.EscapeUtil; +import org.apache.commons.io.IOUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; + +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import java.io.ByteArrayInputStream; +import java.io.IOException; + + +/** + * @ClassName:XssHttpServletRequestWrapper + * @Description: XSS过滤处理 + * @Author: Arno_Fu + * @CreatTime:12/23/2019 - 10:43 AM + * @Version V1.0 + */ + +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper { + /** + * @param request + */ + public XssHttpServletRequestWrapper(HttpServletRequest request) { + super( request ); + } + + @Override + public String[] getParameterValues(String name) { + String[] values = super.getParameterValues( name ); + if (values != null) { + int length = values.length; + String[] escapseValues = new String[length]; + for (int i = 0; i < length; i++) { + // 防xss攻击和过滤前后空格 + escapseValues[i] = EscapeUtil.clean( values[i] ).trim(); + } + return escapseValues; + } + return super.getParameterValues( name ); + } + + @Override + public ServletInputStream getInputStream() throws IOException { + // 非json类型,直接返回 + if (!isJsonRequest()) { + return super.getInputStream(); + } + + // 为空,直接返回 + String json = IOUtils.toString( super.getInputStream(), "utf-8" ); + if (StringUtils.isEmpty( json )) { + return super.getInputStream(); + } + + // xss过滤 + json = EscapeUtil.clean( json ).trim(); + final ByteArrayInputStream bis = new ByteArrayInputStream( json.getBytes( "utf-8" ) ); + return new ServletInputStream() { + @Override + public boolean isFinished() { + return true; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener readListener) { + } + + @Override + public int read() throws IOException { + return bis.read(); + } + }; + } + + /** + * 是否是Json请求 + */ + public boolean isJsonRequest() { + String header = super.getHeader( HttpHeaders.CONTENT_TYPE ); + return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase( header ) + || MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase( header ); + } +} \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..03fafdf --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,146 @@ + +server: + # 服务器的HTTP端口,默认为8081 + port: 8081 + + +spring: + # 数据源配置 + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: com.mysql.cj.jdbc.Driver +# url: jdbc:mysql://127.0.0.1:3306/xuan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 +# username: root +# password: root + druid: + master: +# url: jdbc:mysql://121.36.211.181:3306/sjzd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true +# url: jdbc:mysql://192.168.135.100:3306/sjzd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true + url: jdbc:mysql://192.168.135.81:3306/sjzd_1031?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true + username: root + password: 123456 + slave: + # 从数据源开关/默认关闭 + enabled: false + url: + username: + password: + # 初始连接数 + initial-size: 20 + # 最小连接池数量 + minIdle: 50 + # 最大连接池数量 + maxActive: 100 + # 配置获取连接等待超时的时间 + maxWait: 60000 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + minEvictableIdleTimeMillis: 1800000 + # 配置一个连接在池中最大生存的时间,单位是毫秒 + maxEvictableIdleTimeMillis: 9000000 + # 配置检测连接是否有效 + validationQuery: SELECT 1 FROM DUAL + testWhileIdle: true + testOnBorrow: true + testOnReturn: true + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 设置白名单,不填则允许所有访问 + allow: + url-pattern: /druid/* + # 控制台管理用户名和密码 + login-username: + login-password: + filter: + stat: + enabled: true + # 慢SQL记录 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true + # 处理时区 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 密码 + #password: 111111 + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-active: 8 + # 连接池的最大数据库连接数 + max-idle: 8 + #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: 8 + +# MyBatis配置 +mybatis-plus: + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapper-locations: classpath:/mapper/*.xml + type-aliases-package: com.chenxuan.mapper + #type-enums-package: com.chenxuan.enums + +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌秘钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 120 + +# 日志配置 +logging: + level: + com.chenxuan: debug + org.springframework: warn + +# 防止XSS攻击 +xss: + # 过滤开关 + enabled: true + # 排除链接(多个用逗号分隔) + excludes: /system/notice/* + # 匹配链接 + urlPatterns: /system/*,/monitor/*,/tool/* + + +# 项目相关配置 +upload: + # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) + profile: D:/xuan/uploadPath + # 获取ip地址开关 + addressEnabled: true + +#项目导出相关配置 +# 文件路径 示例( Windows配置E:/home/chenxuan/exportFiles/,Linux配置 /home/ruoyi/exportFiles) +outfilePath: D:/xinYingExportFiles + +APP: + NAME: sjzd + +#远程接口调用地址 +remote: + user: + add: http://192.168.128.86:10080/frame-base-control/sysUserRemoter/addUser +# add: http://192.168.129.213:8088/frame-base-control/sysUserRemoter/addUser + transformer: + query: http://192.168.128.86:10080/busi-back-control/remote/busiTransformerRemote/findTransformerSubTree +# query: http://192.168.129.213:8080/busi-back-control/remote/busiTransformerRemote/findTransformerSubTree \ No newline at end of file diff --git a/src/main/resources/lib/Algorithm_vibration-1.0.jar b/src/main/resources/lib/Algorithm_vibration-1.0.jar new file mode 100644 index 0000000..3d510cb Binary files /dev/null and b/src/main/resources/lib/Algorithm_vibration-1.0.jar differ diff --git a/src/main/resources/lib/arraytest-1.0.jar b/src/main/resources/lib/arraytest-1.0.jar new file mode 100644 index 0000000..b007181 Binary files /dev/null and b/src/main/resources/lib/arraytest-1.0.jar differ diff --git a/src/main/resources/lib/javabuilder-1.0.jar b/src/main/resources/lib/javabuilder-1.0.jar new file mode 100644 index 0000000..9271c07 Binary files /dev/null and b/src/main/resources/lib/javabuilder-1.0.jar differ diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..6ad7054 --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/sys-info.log + + + + ${log.path}/sys-info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/sys-error.log + + + + ${log.path}/sys-error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + ${log.path}/sys-user.log + + + ${log.path}/sys-user.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/BusiAmpliComtradMapper.xml b/src/main/resources/mapper/BusiAmpliComtradMapper.xml new file mode 100644 index 0000000..972f087 --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliComtradMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + SELECT + id, + main_id, + comtrad_file, + comtrad_data, + d_time + FROM + busi_ampli_comtrad + + + + diff --git a/src/main/resources/mapper/BusiAmpliComtradResultMapper.xml b/src/main/resources/mapper/BusiAmpliComtradResultMapper.xml new file mode 100644 index 0000000..2d9b019 --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliComtradResultMapper.xml @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + file_id, + main_id, + sub_id, + load_type, + side, + phase, + in_out, + frequency, + max_amplitude, + ins_time, + hbase_rowkey + FROM + busi_ampli_comtrad_result + + + + + INSERT INTO busi_ampli_comtrad_result + ( + id, + file_id, + main_id, + sub_id, + load_type, + side, + phase, + in_out, + frequency, + max_amplitude, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.fileId}, + #{entity.mainId}, + #{entity.subId}, + #{entity.loadType}, + #{entity.side}, + #{entity.phase}, + #{entity.inOut}, + #{entity.frequency}, + #{entity.maxAmplitude}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + diff --git a/src/main/resources/mapper/BusiAmpliDayIncreaseMapper.xml b/src/main/resources/mapper/BusiAmpliDayIncreaseMapper.xml new file mode 100644 index 0000000..4b6af31 --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliDayIncreaseMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + bai.id, + bai.file_id, + bai.main_id, + bai.sub_id, + bai.frequency, + bai.amplitude, + bai.day_rate, + bai.month_rate, + bai.deviation_rate, + bai.d_time, + bai.load_type + FROM busi_ampli_increase bai + LEFT JOIN busi_sub_device bsd + ON bsd.id = bai.sub_id + + + + + + + + + + INSERT INTO busi_ampli_increase + ( + id, + file_id, + main_id, + sub_id, + d_time, + frequency, + amplitude, + day_rate, + month_rate, + deviation_rate, + load_type + ) + VALUES + + ( + #{entity.id}, + #{entity.fileId}, + #{entity.mainId}, + #{entity.subId}, + #{entity.dTime}, + #{entity.frequency}, + #{entity.amplitude}, + #{entity.dayRate}, + #{entity.monthRate}, + #{entity.deviationRate}, + #{entity.loadType} + ) + + + + + + + UPDATE busi_ampli_day_increase + SET + sub_id = #{entity.subId}, + d_time = #{entity.dTime}, + frequency = #{entity.frequency}, + day_rate = #{entity.dayRate} + WHERE + id = #{entity.id}; + + + + + + + + + delete from busi_ampli_day_increase where id = #{id} + + diff --git a/src/main/resources/mapper/BusiAmpliRealMapper.xml b/src/main/resources/mapper/BusiAmpliRealMapper.xml new file mode 100644 index 0000000..66083d0 --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliRealMapper.xml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + SELECT + id, + main_id, + sub_id, + side, + phase, + in_out, + frequency, + max_amplitude, + ins_time + FROM + busi_ampli_real bar + + + + + INSERT INTO busi_ampli_real + ( + id, + main_id, + sub_id, + side, + phase, + in_out, + frequency, + max_amplitude, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.subId}, + #{entity.side}, + #{entity.phase}, + #{entity.inOut}, + #{entity.frequency}, + #{entity.maxAmplitude}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/BusiAmpliStatisticsMapper.xml b/src/main/resources/mapper/BusiAmpliStatisticsMapper.xml new file mode 100644 index 0000000..14bc230 --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliStatisticsMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + main_id, + sub_id, + side, + phase, + in_out, + frequency, + max_amplitude, + ins_time + FROM + busi_ampli_statistics + + + + + + diff --git a/src/main/resources/mapper/BusiAmpliThresholdConfMapper.xml b/src/main/resources/mapper/BusiAmpliThresholdConfMapper.xml new file mode 100644 index 0000000..ce84d9d --- /dev/null +++ b/src/main/resources/mapper/BusiAmpliThresholdConfMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + SELECT + bath.id, + bath.sub_id, + bath.frequencyid, + bath.amplitude, + bath.day_rate, + bath.month_rate, + bath.deviation_rate, + bath.ins_time, + bfc.frequency + FROM busi_ampli_threshold_conf bath + LEFT JOIN busi_frequency_conf bfc ON bath.frequencyid=bfc.id + LEFT JOIN busi_sub_device bsd ON bsd.id=bath.sub_id + + + + + + + + INSERT INTO busi_ampli_threshold_conf + ( + id, + sub_id, + frequencyid, + amplitude, + day_rate, + month_rate, + deviation_rate, + ins_time + ) + VALUES + + ( + #{entity.id}, + #{entity.subId}, + #{entity.frequencyId}, + #{entity.amplitude}, + #{entity.dayRate}, + #{entity.monthRate}, + #{entity.deviationRate}, + #{entity.insTime} + ) + + + + + + + + + UPDATE busi_ampli_threshold_conf + SET + sub_id = #{entity.subId}, + frequencyid = #{entity.frequencyId}, + amplitude = #{entity.amplitude}, + day_rate = #{entity.dayRate}, + month_rate = #{entity.monthRate}, + deviation_rate = #{entity.deviationRate}, + ins_time = #{entity.insTime} + WHERE + id = #{entity.id}; + + + + + + + + + delete from busi_ampli_threshold_conf where id = #{id} + + + diff --git a/src/main/resources/mapper/BusiAssessParameterMapper.xml b/src/main/resources/mapper/BusiAssessParameterMapper.xml new file mode 100644 index 0000000..4ca5f18 --- /dev/null +++ b/src/main/resources/mapper/BusiAssessParameterMapper.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + INSERT INTO busi_assess_parameter + ( + id, + main_id, + amplitude, + ins_time + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.amplitude}, + #{entity.insTime} + ) + + + + diff --git a/src/main/resources/mapper/BusiCalcParamConfMapper.xml b/src/main/resources/mapper/BusiCalcParamConfMapper.xml new file mode 100644 index 0000000..a45cd37 --- /dev/null +++ b/src/main/resources/mapper/BusiCalcParamConfMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + main_id, + weight_level, + hltype, + name, + pname, + description, + value, + ab_value_flag, + a_value, + b_value, + warning_value, + model, + is_attend, + create_time, + create_user, + sort_num + FROM + busi_calc_param_conf + + + + + INSERT INTO busi_calc_param_conf + ( + id, + main_id, + weight_level, + hltype, + name, + pname, + description, + value, + ab_value_flag, + a_value, + b_value, + warning_value, + model, + is_attend, + create_time, + create_user, + sort_num + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.weightLevel}, + #{entity.hltype}, + #{entity.name}, + #{entity.pname}, + #{entity.description}, + #{entity.value}, + #{entity.abValueFlag}, + #{entity.aValue}, + #{entity.bValue}, + #{entity.warningValue}, + #{entity.model}, + #{entity.isAttend}, + #{entity.createTime}, + #{entity.createUser}, + #{entity.sortNum} + ) + + + + + + + + + delete from busi_calc_param_conf where main_id = #{mainId} + + + + + + UPDATE busi_calc_param_conf + SET value = #{entity.value} + WHERE id = #{entity.id}; + + + + + + + + + + diff --git a/src/main/resources/mapper/BusiCenterRealMapper.xml b/src/main/resources/mapper/BusiCenterRealMapper.xml new file mode 100644 index 0000000..8d0bed4 --- /dev/null +++ b/src/main/resources/mapper/BusiCenterRealMapper.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + SELECT id,main_id,load_type,max_amplitude,ins_time,hbase_rowkey + FROM busi_center_real + + + + + INSERT INTO busi_center_real + ( + id, + main_id, + max_amplitude, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.maxAmplitude}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/BusiCenterRealStatisticsMapper.xml b/src/main/resources/mapper/BusiCenterRealStatisticsMapper.xml new file mode 100644 index 0000000..be4d2d7 --- /dev/null +++ b/src/main/resources/mapper/BusiCenterRealStatisticsMapper.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/main/resources/mapper/BusiCenterThresholdConfMapper.xml b/src/main/resources/mapper/BusiCenterThresholdConfMapper.xml new file mode 100644 index 0000000..f629566 --- /dev/null +++ b/src/main/resources/mapper/BusiCenterThresholdConfMapper.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + SELECT + bctc.id, + bctc.main_id, + bctc.sub_id, + bmd.device_name, + bctc.positive, + bctc.negative, + bctc.day_rate, + bctc.month_rate, + bctc.deviation_rate, + bctc.ins_time + FROM + busi_center_threshold_conf bctc + INNER JOIN busi_main_device bmd ON bctc.main_id = bmd.id + + + + id, + main_id, + sub_id, + positive, + negative, + day_rate, + month_rate, + deviation_rate, + ins_time + + + #{id}, + #{mainId}, + #{subId}, + #{positive}, + #{negative}, + #{dayRate}, + #{monthRate}, + #{deviationRate}, + #{insTime} + + + main_id = #{mainId}, + sub_id = #{subId}, + positive = #{positive}, + negative = #{negative}, + day_rate = #{dayRate}, + month_rate = #{monthRate}, + deviation_rate = #{deviationRate}, + ins_time = #{insTime} + + + + + + + + insert into busi_center_threshold_conf () values + () + + + + + update busi_center_threshold_conf set where ID=#{id} + + + + + + + + delete from busi_center_threshold_conf where main_id = #{mainId} + + + + + update busi_center_threshold_conf set main_id=null where main_id = #{mainId} + + + + + delete from busi_center_threshold_conf where id = #{id} + + + diff --git a/src/main/resources/mapper/BusiCommunicationParametersMapper.xml b/src/main/resources/mapper/BusiCommunicationParametersMapper.xml new file mode 100644 index 0000000..22f3139 --- /dev/null +++ b/src/main/resources/mapper/BusiCommunicationParametersMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + protocol, + communication_interface, + serial_number, + baud_rate, + check_bit, + data_bit, + stop_bit, + sub_device_id, + ip_addr, + port, + password, + confirm_password + FROM + busi_communication_parameters + + + + id, + protocol, + communication_interface, + serial_number, + baud_rate, + check_bit, + data_bit, + stop_bit, + sub_device_id, + ip_addr, + port, + password, + confirm_password + + + #{id}, + #{protocol}, + #{communicationInterface}, + #{serialNumber}, + #{baudRate}, + #{checkBit}, + #{dataBit}, + #{stopBit}, + #{subDeviceId}, + #{ipAddr}, + #{port}, + #{password}, + #{confirmPassword} + + + protocol = #{protocol}, + communication_interface = #{communicationInterface}, + serial_number = #{serialNumber}, + baud_rate = #{baudRate}, + check_bit = #{checkBit}, + data_bit = #{dataBit}, + stop_bit = #{stopBit}, + sub_device_id = #{subDeviceId}, + ip_addr = #{ipAddr}, + port = #{port}, + password = #{password}, + confirm_password = #{confirmPassword} + + + + + + + + insert into busi_communication_parameters () values + () + + + + + update busi_communication_parameters set where ID=#{id} + + + + + + delete from busi_communication_parameters where id = #{id} + + + + + diff --git a/src/main/resources/mapper/BusiControlConfigMapper.xml b/src/main/resources/mapper/BusiControlConfigMapper.xml new file mode 100644 index 0000000..434a414 --- /dev/null +++ b/src/main/resources/mapper/BusiControlConfigMapper.xml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + bcc.*, + t.deviceName, + t.subDeviceName + FROM + ( + SELECT + bmd.id AS main_id, + bsd.id AS sub_id, + bmd.device_name AS deviceName, + bsd.sub_device_name AS subDeviceName + FROM + busi_sub_device bsd + LEFT JOIN busi_main_device bmd ON bsd.main_id = bmd.id + ) t + INNER JOIN busi_control_conf bcc ON bcc.sub_id = t.sub_id AND bcc.main_id = t.main_id + + + + + + + + + + + INSERT INTO busi_control_conf + ( + id, + main_id, + sub_id, + isenable, + intervals, + gather_time, + alone_test, + smpprod, + update_time, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.subId}, + #{entity.isEnable}, + #{entity.intervals}, + #{entity.gatherTime}, + #{entity.aloneTest}, + #{entity.smpprod}, + #{entity.updateTime}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + UPDATE busi_control_conf + SET + main_id = #{entity.mainId}, + sub_id = #{entity.subId}, + isenable = #{entity.isEnable}, + intervals = #{entity.intervals}, + gather_time = #{entity.gatherTime}, + alone_test = #{entity.aloneTest}, + smpprod = #{entity.smpprod}, + update_time = #{entity.updateTime}, + ins_time = #{entity.insTime}, + hbase_rowkey = #{entity.hbaseRowkey} + WHERE + id = #{entity.id}; + + + + + + + delete from busi_control_conf where id = #{id} + + + + delete from busi_control_conf where main_id = #{mainId} + + + + + + diff --git a/src/main/resources/mapper/BusiDeviceCalibrationMapper.xml b/src/main/resources/mapper/BusiDeviceCalibrationMapper.xml new file mode 100644 index 0000000..25275c8 --- /dev/null +++ b/src/main/resources/mapper/BusiDeviceCalibrationMapper.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/src/main/resources/mapper/BusiFrequencyConfMapper.xml b/src/main/resources/mapper/BusiFrequencyConfMapper.xml new file mode 100644 index 0000000..8b35900 --- /dev/null +++ b/src/main/resources/mapper/BusiFrequencyConfMapper.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + SELECT + id, + frequency, + state, + ins_time + FROM + busi_frequency_conf + + + + id, + frequency, + state, + ins_time + + + #{id}, + #{frequency}, + #{state}, + #{insTime} + + + frequency = #{frequency}, + state = #{state}, + ins_time = #{insTime} + + + + + + + + insert into busi_frequency_conf () values + () + + + + + update busi_frequency_conf set where ID=#{id} + + + + + + + + + + delete from busi_frequency_conf where id = #{id} + + + + diff --git a/src/main/resources/mapper/BusiIedparamMapper.xml b/src/main/resources/mapper/BusiIedparamMapper.xml new file mode 100644 index 0000000..ebfbda3 --- /dev/null +++ b/src/main/resources/mapper/BusiIedparamMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/BusiMainDeviceMapper.xml b/src/main/resources/mapper/BusiMainDeviceMapper.xml new file mode 100644 index 0000000..28c02c2 --- /dev/null +++ b/src/main/resources/mapper/BusiMainDeviceMapper.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + SELECT + id, + device_name, + state, + delivery_time, + device_model, + manufacturer, + factory_time, + factory_number, + design_life, + system_code, + hbase_rowkey + FROM + busi_main_device + + + + id, + device_name, + state, + delivery_time, + device_model, + manufacturer, + factory_time, + factory_number, + design_life, + system_code, + hbase_rowkey, + sort + + + #{id}, + #{deviceName}, + #{state}, + #{deliveryTime}, + #{deviceModel}, + #{manufacturer}, + #{factoryTime}, + #{factoryNumber}, + #{designLife}, + #{systemCode}, + #{hbaseRowkey}, + (SELECT s.sort FROM(SELECT IFNULL( MAX( CAST( sort AS UNSIGNED ) ), 0 ) + 1 as sort FROM busi_main_device )s) + + + device_name = #{deviceName}, + state = #{state}, + delivery_time = #{deliveryTime}, + device_model = #{deviceModel}, + manufacturer = #{manufacturer}, + factory_time = #{factoryTime}, + factory_number = #{factoryNumber}, + design_life = #{designLife}, + system_code = #{systemCode}, + hbase_rowkey = #{hbaseRowkey} + + + + + + + + + + insert into busi_main_device () values + () + + + + + update busi_main_device set where ID=#{id} + + + + + + delete from busi_main_device where id = #{id} + + + + + + + + + diff --git a/src/main/resources/mapper/BusiNoiseRealMapper.xml b/src/main/resources/mapper/BusiNoiseRealMapper.xml new file mode 100644 index 0000000..628adbc --- /dev/null +++ b/src/main/resources/mapper/BusiNoiseRealMapper.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + SELECT id,main_id,load_type,max_amplitude,ins_time,hbase_rowkey + FROM busi_noise_real + + + + + INSERT INTO busi_noise_real + ( + id, + main_id, + frequency, + max_amplitude, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.frequency}, + #{entity.maxAmplitude}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/BusiNoiseRealStatisticsMapper.xml b/src/main/resources/mapper/BusiNoiseRealStatisticsMapper.xml new file mode 100644 index 0000000..1898305 --- /dev/null +++ b/src/main/resources/mapper/BusiNoiseRealStatisticsMapper.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/main/resources/mapper/BusiNoiseThresholdConfMapper.xml b/src/main/resources/mapper/BusiNoiseThresholdConfMapper.xml new file mode 100644 index 0000000..ff451fb --- /dev/null +++ b/src/main/resources/mapper/BusiNoiseThresholdConfMapper.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + SELECT + bntc.id, + bntc.main_id, + bntc.sub_id, + bmd.device_name, + bntc.noise, + bntc.day_rate, + bntc.month_rate, + bntc.deviation_rate, + bntc.ins_time + FROM + busi_noise_threshold_conf bntc + INNER JOIN busi_main_device bmd ON bmd.id = bntc.main_id + + + + id, + main_id, + sub_id, + noise, + day_rate, + month_rate, + deviation_rate, + ins_time + + + #{id}, + #{mainId}, + #{subId}, + #{noise}, + #{dayRate}, + #{monthRate}, + #{deviationRate}, + #{insTime} + + + main_id = #{mainId}, + sub_id = #{subId}, + noise = #{noise}, + day_rate = #{dayRate}, + month_rate = #{monthRate}, + deviation_rate = #{deviationRate}, + ins_time = #{insTime} + + + + + + + + insert into busi_noise_threshold_conf () values + () + + + + + update busi_noise_threshold_conf set where ID=#{id} + + + + + + + + delete from busi_noise_threshold_conf where main_id = #{mainId} + + + + + update busi_noise_threshold_conf set main_id=null where main_id = #{mainId} + + + + + delete from busi_noise_threshold_conf where id = #{id} + + + diff --git a/src/main/resources/mapper/BusiParamBindMapper.xml b/src/main/resources/mapper/BusiParamBindMapper.xml new file mode 100644 index 0000000..870142b --- /dev/null +++ b/src/main/resources/mapper/BusiParamBindMapper.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + insert into busi_param_bind ( + main_id, + sub_id, + sensor_code, + node_id, + node_name, + frequency + ) values + ( + #{mainId}, + #{subId}, + #{sensorCode}, + #{nodeId}, + #{nodeName}, + #{frequency} + ) + + + + + + + + delete from busi_param_bind where id in + + #{ids} + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/BusiParamGisMapper.xml b/src/main/resources/mapper/BusiParamGisMapper.xml new file mode 100644 index 0000000..e5a09d8 --- /dev/null +++ b/src/main/resources/mapper/BusiParamGisMapper.xml @@ -0,0 +1,41 @@ + + + + + + id as id, + main_id as mainEquipmentId, + weight_level as weightLevel, + name as name, + pname as pname, + description as description, + value as value, + ab_value_flag as abValueFlag, + a_value as aValue, + b_value as bValue, + warning_value as warningValue, + model as model, + is_attend as isAttend, + create_time as createTime, + create_user as createUser, + sort_num as sortNum + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/BusiSubDeviceMapper.xml b/src/main/resources/mapper/BusiSubDeviceMapper.xml new file mode 100644 index 0000000..537fc4f --- /dev/null +++ b/src/main/resources/mapper/BusiSubDeviceMapper.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + SELECT + bsd.id, + bsd.main_id, + bmd.device_name, + bsd.sub_device_name, + bsd.sensor_code, + bsd.device_type, + bsd.side, + bsd.phase, + bsd.in_out, + bsd.ins_time + FROM + busi_sub_device bsd + LEFT JOIN busi_main_device bmd ON bsd.main_id = bmd.id + + + + SELECT + id, + main_id, + sub_device_name, + sensor_code, + device_type, + side, + phase, + in_out, + ins_time + FROM busi_sub_device + + + + id, + main_id, + sub_device_name, + sensor_code, + device_type, + side, + phase, + in_out, + ins_time + + + #{id}, + #{mainId}, + #{subDeviceName}, + #{sensorCode}, + #{deviceType}, + #{side}, + #{phase}, + #{inOut}, + #{insTime} + + + main_id = #{mainId}, + sub_device_name = #{subDeviceName}, + sensor_code = #{sensorCode}, + device_type = #{deviceType}, + side = #{side}, + phase = #{phase}, + in_out = #{inOut} + + + + + + + + + + + + insert into busi_sub_device () values + () + + + + + update busi_sub_device set where ID=#{id} + + + + + + + + + + + + + + + + + + + delete from busi_sub_device where main_id = #{mainId} + + + + + delete from busi_sub_device where id = #{id} + + + + + update busi_sub_device set main_id=null where main_id = #{mainId} + + + diff --git a/src/main/resources/mapper/BusiTransformerConfMapper.xml b/src/main/resources/mapper/BusiTransformerConfMapper.xml new file mode 100644 index 0000000..194eeb2 --- /dev/null +++ b/src/main/resources/mapper/BusiTransformerConfMapper.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + SELECT + btc.id, + btc.main_id, + bmd.device_name, + btc.side, + btc.voltage, + btc.current, + btc.conf_flag, + btc.ins_time, + btc.hbase_rowkey + FROM + busi_transformer_conf btc + INNER JOIN busi_main_device bmd ON bmd.id = btc.main_id + + + + + + + + + + + INSERT INTO busi_transformer_conf + ( + id, + main_id, + side, + voltage, + current, + conf_flag, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.side}, + #{entity.voltage}, + #{entity.current}, + #{entity.confFlag}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + + + UPDATE busi_transformer_conf + SET + voltage = #{item.voltage}, + current = #{item.current}, + conf_flag = #{item.confFlag}, + ins_time = #{item.insTime}, + hbase_rowkey = #{item.hbaseRowkey} + WHERE + main_id = #{item.mainId} AND side = #{item.side}; + + + + + + + delete from busi_transformer_conf where id = #{id} + + + + delete from busi_transformer_conf where main_id = #{mainId} + + + + update busi_transformer_conf set main_id=null where main_id = #{mainId} + + + diff --git a/src/main/resources/mapper/BusiTransformerRealMapper.xml b/src/main/resources/mapper/BusiTransformerRealMapper.xml new file mode 100644 index 0000000..ce3fe64 --- /dev/null +++ b/src/main/resources/mapper/BusiTransformerRealMapper.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO busi_transformer_real + ( + id, + main_id, + side, + voltage, + current, + ins_time, + hbase_rowkey + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.side}, + #{entity.voltage}, + #{entity.current}, + #{entity.insTime}, + #{entity.hbaseRowkey} + ) + + + + + delete from busi_transformer_real where main_id = #{mainId} + + diff --git a/src/main/resources/mapper/BusiVibrationSeparationMapper.xml b/src/main/resources/mapper/BusiVibrationSeparationMapper.xml new file mode 100644 index 0000000..ed02015 --- /dev/null +++ b/src/main/resources/mapper/BusiVibrationSeparationMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + SELECT id, main_id, comtrad_id, phase, mech_amplitude, winding_amplitude, + iron_core_amplitude, primary_side_amplitude, sec_side_amplitude, ins_time + FROM busi_vibration_separation + + + + + INSERT INTO busi_vibration_separation + ( + id, + main_id, + comtrad_id, + phase, + mech_amplitude, + winding_amplitude, + iron_core_amplitude, + primary_side_amplitude, + sec_side_amplitude, + sort, + ins_time + ) + VALUES + + ( + #{entity.id}, + #{entity.mainId}, + #{entity.comtradId}, + #{entity.phase}, + #{entity.mechAmplitude}, + #{entity.windingAmplitude}, + #{entity.ironCoreAmplitude}, + #{entity.primarySideAmplitude}, + #{entity.secSideAmplitude}, + #{entity.sort}, + #{entity.insTime} + ) + + + + + + + diff --git a/src/main/resources/mapper/BusiWarningMapper.xml b/src/main/resources/mapper/BusiWarningMapper.xml new file mode 100644 index 0000000..8c2cb86 --- /dev/null +++ b/src/main/resources/mapper/BusiWarningMapper.xml @@ -0,0 +1,251 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + bsd.main_id AS mainId, + bsd.device_type AS deviceType, + bsd.sub_device_name AS deviceName, + concat_ws('/',bmd.device_name, + CASE WHEN bsd.side = 'P' THEN '原边' WHEN bsd.side = 'S' THEN '副边' END, + CASE WHEN bsd.phase = 'A' THEN 'A相' WHEN bsd.phase = 'B' THEN 'B相' WHEN bsd.phase = 'C' THEN 'C相' END, + CASE WHEN bsd.in_out='U' THEN '上侧' WHEN bsd.in_out='D' THEN '下侧' END) AS deviceLocation, + concat('',batc.amplitude,'(mm/s2)') AS amplitudeThreshold, + concat(batc.day_rate,'/',batc.month_rate) AS amplitudeRate, + concat(bctc.positive,'(A)/',bctc.negative,'(A)') AS currentThreshold, + concat(bctc.day_rate,'/',bctc.month_rate) AS currentRate, + concat(bntc.noise,'(dB)') AS noiseThreshold, + concat(bntc.day_rate,'/',bntc.month_rate) AS noiseRate, + concat(bw.sample_value,'(dB)') AS sampleValue, + u.user_name AS processUserName, + bw.* + FROM + busi_sub_device bsd + LEFT JOIN busi_ampli_threshold_conf batc ON bsd.id = batc.sub_id + LEFT JOIN busi_center_threshold_conf bctc ON bctc.sub_id = bsd.id + LEFT JOIN busi_noise_threshold_conf bntc ON bntc.sub_id = bsd.id + INNER JOIN busi_main_device bmd ON bmd.id = bsd.main_id + INNER JOIN busi_warning bw ON bsd.id = bw.sub_id + LEFT JOIN sys_user u ON bw.process_user = u.user_id + + + + id, + sub_id, + warn_time, + warn_type, + load_type, + sample_value, + value_unit, + warn_desc, + warn_level, + state, + process, + process_user, + process_time, + hbase_key + + + + #{id}, + #{subId}, + #{warnTime}, + #{warnType}, + #{loadType}, + #{sampleValue}, + #{valueUnit}, + #{warnDesc}, + #{warnLevel}, + #{state}, + #{process}, + #{processUser}, + #{processTime}, + #{hbaseKey} + + + + + + + + + + + + + + + + INSERT INTO busi_warning + ( + id, + sub_id, + warn_time, + warn_type, + load_type, + sample_value, + value_unit, + warn_desc, + warn_level, + state, + process, + process_user, + process_time, + hbase_key + ) + VALUES + + ( + #{entity.id}, + #{entity.subId}, + #{entity.warnTime}, + #{entity.warnType}, + #{entity.loadType}, + #{entity.sampleValue}, + #{entity.valueUnit}, + #{entity.warnDesc}, + #{entity.warnLevel}, + #{entity.state}, + #{entity.process}, + #{entity.processUser}, + #{entity.processTime}, + #{entity.hbaseKey} + ) + + + + + + UPDATE busi_warning + + + state=#{bean.state}, + + + process=#{bean.process}, + + + process_user=#{bean.processUser}, + + + process_time=#{bean.processTime}, + + + WHERE id = #{bean.id} + + + + + UPDATE busi_warning + + + state=#{bean.state}, + + + process=#{bean.process}, + + + process_user=#{bean.processUser}, + + + process_time=#{bean.processTime}, + + + + + sub_id=#{bean.subId} + + + AND warn_type=#{bean.warnType} + + + + + diff --git a/src/main/resources/mapper/ScheduleJobMapper.xml b/src/main/resources/mapper/ScheduleJobMapper.xml new file mode 100644 index 0000000..8af527c --- /dev/null +++ b/src/main/resources/mapper/ScheduleJobMapper.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + SELECT + job_id, + bean_name, + cron_expression, + method_name, + method_params, + status, + create_by, + create_time, + update_by, + update_time, + remark + FROM + sys_job + + + + update sys_job set `status` = #{status} + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SysConfigMapper.xml b/src/main/resources/mapper/SysConfigMapper.xml new file mode 100644 index 0000000..d8b16cf --- /dev/null +++ b/src/main/resources/mapper/SysConfigMapper.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + SELECT + config_id, + config_name, + config_key, + config_value, + config_type, + create_by, + create_time, + update_by, + update_time, + remark + FROM + sys_config + + + + + + + and config_id = #{configId} + + + and config_key = #{configKey} + + + + + + + + + + + + + delete from sys_config where config_id = #{configId} + + + + delete from sys_config where config_id in + + #{configId} + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysDeptMapper.xml b/src/main/resources/mapper/SysDeptMapper.xml new file mode 100644 index 0000000..d5ae52b --- /dev/null +++ b/src/main/resources/mapper/SysDeptMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + d.dept_id, + d.parent_id, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.phone, + d.email, + d.`status`, + d.del_flag, + d.create_by, + d.create_time + FROM + sys_dept d + + + + + + + + + + + + + + + update sys_dept set ancestors = + + when #{item.deptId} then #{item.ancestors} + + where dept_id in + + #{item.deptId} + + + + + update sys_dept + + status = #{status}, + update_by = #{updateBy}, + update_time = sysdate() + + where dept_id in (${ancestors}) + + + + + + + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + + + + + diff --git a/src/main/resources/mapper/SysDictDataMapper.xml b/src/main/resources/mapper/SysDictDataMapper.xml new file mode 100644 index 0000000..f447d1a --- /dev/null +++ b/src/main/resources/mapper/SysDictDataMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + dict_code, + dict_sort, + dict_label, + dict_value, + dict_type, + css_class, + list_class, + is_default, + `status`, + create_by, + create_time, + remark + FROM + sys_dict_data + + + + + + + + + + + + + + delete from sys_dict_data where dict_code = #{dictCode} + + + + delete from sys_dict_data where dict_code in + + #{dictCode} + + + + + + update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} + + + + diff --git a/src/main/resources/mapper/SysDictTypeMapper.xml b/src/main/resources/mapper/SysDictTypeMapper.xml new file mode 100644 index 0000000..2e5f231 --- /dev/null +++ b/src/main/resources/mapper/SysDictTypeMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + SELECT + dict_id, + dict_name, + dict_type, + STATUS, + create_by, + create_time, + remark + FROM + sys_dict + + + + + + + + + + + + + delete from sys_dict where dict_id = #{dictId} + + + + delete from sys_dict where dict_id in + + #{dictId} + + + + diff --git a/src/main/resources/mapper/SysLoginLogMapper.xml b/src/main/resources/mapper/SysLoginLogMapper.xml new file mode 100644 index 0000000..7f7bb1d --- /dev/null +++ b/src/main/resources/mapper/SysLoginLogMapper.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + delete from sys_login_log where login_id in + + #{infoId} + + + + + truncate table sys_login_log + + + diff --git a/src/main/resources/mapper/SysMenuMapper.xml b/src/main/resources/mapper/SysMenuMapper.xml new file mode 100644 index 0000000..5b6536a --- /dev/null +++ b/src/main/resources/mapper/SysMenuMapper.xml @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + menu_id, + menu_name, + parent_id, + order_num, + path, + component, + is_frame, + menu_type, + visible, + ifnull(perms, '') AS perms, + icon, + create_time + FROM + sys_menu + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SysOperLogMapper.xml b/src/main/resources/mapper/SysOperLogMapper.xml new file mode 100644 index 0000000..e46acd5 --- /dev/null +++ b/src/main/resources/mapper/SysOperLogMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + oper_id, + title, + business_type, + method, + request_method, + operator_type, + oper_name, + dept_name, + oper_url, + oper_ip, + oper_location, + oper_param, + json_result, + status, + error_msg, + oper_time + FROM + sys_oper_log + + + + + + + + + + + delete from sys_oper_log where oper_id in + + #{operId} + + + + + truncate table sys_oper_log + + + diff --git a/src/main/resources/mapper/SysPostMapper.xml b/src/main/resources/mapper/SysPostMapper.xml new file mode 100644 index 0000000..4068222 --- /dev/null +++ b/src/main/resources/mapper/SysPostMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + SELECT + post_id, + post_code, + post_name, + post_sort, + `status`, + create_by, + create_time, + remark + FROM + sys_post + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SysRoleDeptMapper.xml b/src/main/resources/mapper/SysRoleDeptMapper.xml new file mode 100644 index 0000000..a2f0157 --- /dev/null +++ b/src/main/resources/mapper/SysRoleDeptMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_role_dept where role_id=#{roleId} + + + + + + delete from sys_role_dept where role_id in + + #{roleId} + + + + + insert into sys_role_dept(role_id, dept_id) values + + (#{item.roleId},#{item.deptId}) + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysRoleMapper.xml b/src/main/resources/mapper/SysRoleMapper.xml new file mode 100644 index 0000000..6c4f73b --- /dev/null +++ b/src/main/resources/mapper/SysRoleMapper.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + SELECT DISTINCT + r.role_id, + r.role_name, + r.role_key, + r.role_sort, + r.data_scope, + r.`status`, + r.del_flag, + r.create_time, + r.remark + FROM + sys_role r + LEFT JOIN sys_user_role ur ON ur.role_id = r.role_id + LEFT JOIN sys_user u ON u.user_id = ur.user_id + LEFT JOIN sys_dept d ON u.dept_id = d.dept_id + + + + + + + + + + + + + UPDATE sys_role set del_flag = '2' where role_id in + + #{roleId} + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SysRoleMenuMapper.xml b/src/main/resources/mapper/SysRoleMenuMapper.xml new file mode 100644 index 0000000..e18649c --- /dev/null +++ b/src/main/resources/mapper/SysRoleMenuMapper.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + delete from sys_role_menu where role_id=#{roleId} + + + + insert into sys_role_menu(role_id, menu_id) values + + (#{item.roleId},#{item.menuId}) + + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysUserMapper.xml b/src/main/resources/mapper/SysUserMapper.xml new file mode 100644 index 0000000..6a6d595 --- /dev/null +++ b/src/main/resources/mapper/SysUserMapper.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT + u.user_id, + u.dept_id, + u.user_name, + u.nick_name, + u.email, + u.avatar, + u.phone, + u.password_salt, + u.`password`, + u.sex, + u.`status` , + u.del_flag, + u.create_by, + u.create_time, + u.remark, + d.parent_id, + d.dept_name, + d.order_num, + d.leader, + d.`status` AS dept_status, + r.role_id, + r.role_name, + r.role_key, + r.role_sort, + r.data_scope, + r.`status` AS role_status + FROM + sys_user u + LEFT JOIN sys_dept d ON u.dept_id = d.dept_id + LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id + LEFT JOIN sys_role r ON r.role_id = ur.role_id + + + + + + + + + + + + + + + + + + + + update sys_user set avatar = #{avatar} where user_name = #{userName} + + + + update sys_user set password = #{password} where user_name = #{userName} + + + + update sys_user set del_flag = '2' where user_id in + + #{userId} + + + diff --git a/src/main/resources/mapper/SysUserPostMapper.xml b/src/main/resources/mapper/SysUserPostMapper.xml new file mode 100644 index 0000000..ef6e83d --- /dev/null +++ b/src/main/resources/mapper/SysUserPostMapper.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + delete from sys_user_post where user_id=#{userId} + + + + + + delete from sys_user_post where user_id in + + #{userId} + + + + + insert into sys_user_post(user_id, post_id) values + + (#{item.userId},#{item.postId}) + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/SysUserRoleMapper.xml b/src/main/resources/mapper/SysUserRoleMapper.xml new file mode 100644 index 0000000..9b4706a --- /dev/null +++ b/src/main/resources/mapper/SysUserRoleMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + delete from sys_user_role where user_id=#{userId} + + + + + + delete from sys_user_role where user_id in + + #{userId} + + + + + insert into sys_user_role(user_id, role_id) values + + (#{item.userId},#{item.roleId}) + + + + + delete from sys_user_role where user_id=#{userId} and role_id=#{roleId} + + + + delete from sys_user_role where role_id=#{roleId} and user_id in + + #{userId} + + + \ No newline at end of file diff --git a/src/main/resources/quartz.properties b/src/main/resources/quartz.properties new file mode 100644 index 0000000..ab3124a --- /dev/null +++ b/src/main/resources/quartz.properties @@ -0,0 +1,48 @@ +#============================================================================ +# \u914D\u7F6EJobStore +#============================================================================ + +# JobDataMaps\u662F\u5426\u90FD\u4E3AString\u7C7B\u578B\uFF0C\u9ED8\u8BA4false +org.quartz.jobStore.useProperties=false + +# \u8868\u7684\u524D\u7F00\uFF0C\u9ED8\u8BA4QRTZ_ +org.quartz.jobStore.tablePrefix = qrtz_ + +# \u662F\u5426\u52A0\u5165\u96C6\u7FA4 +org.quartz.jobStore.isClustered = true + +# \u8C03\u5EA6\u5B9E\u4F8B\u5931\u6548\u7684\u68C0\u67E5\u65F6\u95F4\u95F4\u9694 ms +org.quartz.jobStore.clusterCheckinInterval = 5000 +org.quartz.jobStore.misfireThreshold = 60000 + +# \u5F53\u8BBE\u7F6E\u4E3A\u201Ctrue\u201D\u65F6\uFF0C\u6B64\u5C5E\u6027\u544A\u8BC9Quartz \u5728\u975E\u6258\u7BA1JDBC\u8FDE\u63A5\u4E0A\u8C03\u7528setTransactionIsolation\uFF08Connection.TRANSACTION_READ_COMMITTED\uFF09\u3002 +org.quartz.jobStore.txIsolationLevelReadCommitted = true + +# \u6570\u636E\u4FDD\u5B58\u65B9\u5F0F\u4E3A\u6570\u636E\u5E93\u6301\u4E45\u5316 +org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX + +# \u6570\u636E\u5E93\u4EE3\u7406\u7C7B\uFF0C\u4E00\u822Corg.quartz.impl.jdbcjobstore.StdJDBCDelegate\u53EF\u4EE5\u6EE1\u8DB3\u5927\u90E8\u5206\u6570\u636E\u5E93 +org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate + +#============================================================================ +# Scheduler \u8C03\u5EA6\u5668\u5C5E\u6027\u914D\u7F6E +#============================================================================ +# \u8C03\u5EA6\u6807\u8BC6\u540D \u96C6\u7FA4\u4E2D\u6BCF\u4E00\u4E2A\u5B9E\u4F8B\u90FD\u5FC5\u987B\u4F7F\u7528\u76F8\u540C\u7684\u540D\u79F0 +org.quartz.scheduler.instanceName = ClusterQuartz +# ID\u8BBE\u7F6E\u4E3A\u81EA\u52A8\u83B7\u53D6 \u6BCF\u4E00\u4E2A\u5FC5\u987B\u4E0D\u540C +org.quartz.scheduler.instanceId= AUTO +org.quartz.scheduler.rmi.export = false +org.quartz.scheduler.rmi.proxy = false +org.quartz.scheduler.wrapJobExecutionInUserTransaction = false + +#============================================================================ +# \u914D\u7F6EThreadPool +#============================================================================ +# \u7EBF\u7A0B\u6C60\u7684\u5B9E\u73B0\u7C7B\uFF08\u4E00\u822C\u4F7F\u7528SimpleThreadPool\u5373\u53EF\u6EE1\u8DB3\u51E0\u4E4E\u6240\u6709\u7528\u6237\u7684\u9700\u6C42\uFF09 +org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool + +# \u6307\u5B9A\u7EBF\u7A0B\u6570\uFF0C\u4E00\u822C\u8BBE\u7F6E\u4E3A1-100\u76F4\u63A5\u7684\u6574\u6570\uFF0C\u6839\u636E\u7CFB\u7EDF\u8D44\u6E90\u914D\u7F6E +org.quartz.threadPool.threadCount = 15 + +# \u8BBE\u7F6E\u7EBF\u7A0B\u7684\u4F18\u5148\u7EA7(\u53EF\u4EE5\u662FThread.MIN_PRIORITY\uFF08\u53731\uFF09\u548CThread.MAX_PRIORITY\uFF08\u8FD9\u662F10\uFF09\u4E4B\u95F4\u7684\u4EFB\u4F55int \u3002\u9ED8\u8BA4\u503C\u4E3AThread.NORM_PRIORITY\uFF085\uFF09\u3002) +org.quartz.threadPool.threadPriority = 5 \ No newline at end of file