diff --git a/fsrcs/.gitignore b/fsrcs/.gitignore
new file mode 100644
index 0000000..a2a3040
--- /dev/null
+++ b/fsrcs/.gitignore
@@ -0,0 +1,31 @@
+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/fsrcs/.mvn/wrapper/MavenWrapperDownloader.java b/fsrcs/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100644
index 0000000..a45eb6b
--- /dev/null
+++ b/fsrcs/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * 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.
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+ private static final String WRAPPER_VERSION = "0.5.6";
+ /**
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+ */
+ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+ /**
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+ * use instead of the default one.
+ */
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+ ".mvn/wrapper/maven-wrapper.properties";
+
+ /**
+ * Path where the maven-wrapper.jar will be saved to.
+ */
+ private static final String MAVEN_WRAPPER_JAR_PATH =
+ ".mvn/wrapper/maven-wrapper.jar";
+
+ /**
+ * Name of the property which should be used to override the default download url for the wrapper.
+ */
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+ public static void main(String args[]) {
+ System.out.println("- Downloader started");
+ File baseDirectory = new File(args[0]);
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
+ // wrapperUrl parameter.
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+ String url = DEFAULT_DOWNLOAD_URL;
+ if (mavenWrapperPropertyFile.exists()) {
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
+ try {
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+ Properties mavenWrapperProperties = new Properties();
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+ } catch (IOException e) {
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+ } finally {
+ try {
+ if (mavenWrapperPropertyFileInputStream != null) {
+ mavenWrapperPropertyFileInputStream.close();
+ }
+ } catch (IOException e) {
+ // Ignore ...
+ }
+ }
+ }
+ System.out.println("- Downloading from: " + url);
+
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+ if (!outputFile.getParentFile().exists()) {
+ if (!outputFile.getParentFile().mkdirs()) {
+ System.out.println(
+ "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+ }
+ }
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+ try {
+ downloadFileFromURL(url, outputFile);
+ System.out.println("Done");
+ System.exit(0);
+ } catch (Throwable e) {
+ System.out.println("- Error downloading");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+ if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+ String username = System.getenv("MVNW_USERNAME");
+ char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+ Authenticator.setDefault(new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(username, password);
+ }
+ });
+ }
+ URL website = new URL(urlString);
+ ReadableByteChannel rbc;
+ rbc = Channels.newChannel(website.openStream());
+ FileOutputStream fos = new FileOutputStream(destination);
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ fos.close();
+ rbc.close();
+ }
+
+}
diff --git a/fsrcs/.mvn/wrapper/maven-wrapper.jar b/fsrcs/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 0000000..2cc7d4a
Binary files /dev/null and b/fsrcs/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/fsrcs/.mvn/wrapper/maven-wrapper.properties b/fsrcs/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 0000000..642d572
--- /dev/null
+++ b/fsrcs/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git a/fsrcs/mvnw b/fsrcs/mvnw
new file mode 100644
index 0000000..3c8a553
--- /dev/null
+++ b/fsrcs/mvnw
@@ -0,0 +1,322 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ]; then
+
+ if [ -f /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.6/maven-wrapper-0.5.6.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.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/fsrcs/mvnw.cmd b/fsrcs/mvnw.cmd
new file mode 100644
index 0000000..c8d4337
--- /dev/null
+++ b/fsrcs/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 Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%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.6/maven-wrapper-0.5.6.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.6/maven-wrapper-0.5.6.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/fsrcs/pom.xml b/fsrcs/pom.xml
new file mode 100644
index 0000000..86e0894
--- /dev/null
+++ b/fsrcs/pom.xml
@@ -0,0 +1,84 @@
+
+
+ 4.0.0
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.7.RELEASE
+
+
+ edu.guat
+ fsrcs
+ 0.0.1-SNAPSHOT
+ fsrcs
+ Folk Small Recipe Cornucopia System
+
+
+ 1.8
+
+
+
+
+ cn.hutool
+ hutool-all
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.1.2
+
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.apache.shiro
+ shiro-spring
+ 1.4.0
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+ true
+
+
+
+
+
+ src/main/java
+
+ **/*.xml
+
+ false
+
+
+
+
+
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/FsrcsApplication.java b/fsrcs/src/main/java/edu/wbu/fsrcs/FsrcsApplication.java
new file mode 100644
index 0000000..52e8969
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/FsrcsApplication.java
@@ -0,0 +1,23 @@
+package edu.wbu.fsrcs;
+
+import edu.wbu.fsrcs.utils.AesEncryptUtil;
+import edu.wbu.fsrcs.utils.IdWorker;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+@MapperScan(value = "edu.wbu.fsrcs.dao")
+@SpringBootApplication
+public class FsrcsApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(FsrcsApplication.class, args);
+ }
+
+ @Bean
+ public IdWorker idWorker() {
+ return new IdWorker();
+ }
+
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/config/MyShiroRealm.java b/fsrcs/src/main/java/edu/wbu/fsrcs/config/MyShiroRealm.java
new file mode 100644
index 0000000..7742104
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/config/MyShiroRealm.java
@@ -0,0 +1,79 @@
+package edu.wbu.fsrcs.config;
+
+import edu.wbu.fsrcs.entity.Permission;
+import edu.wbu.fsrcs.entity.Role;
+import edu.wbu.fsrcs.entity.User;
+import edu.wbu.fsrcs.service.PermissionService;
+import edu.wbu.fsrcs.service.RoleService;
+import edu.wbu.fsrcs.service.UserService;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.authz.AuthorizationInfo;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
+import org.apache.shiro.realm.AuthorizingRealm;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public class MyShiroRealm extends AuthorizingRealm {
+ @Autowired
+ UserService userService;
+ @Autowired
+ RoleService roleService;
+
+ @Autowired
+ PermissionService permissionService;
+ @Override
+ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
+ throws AuthenticationException {
+ System.out.println("MyShiroRealm.doGetAuthenticationInfo()");
+ //获取用户的输入的账号.
+ String username = (String)token.getPrincipal();
+ System.out.println(token.getCredentials());
+ //通过username从数据库中查找 User对象,如果找到,没找到.
+ //实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法
+ User userInfo = userService.queryUserByUsername(username);
+ System.out.println("----->>userInfo="+userInfo);
+ if(userInfo == null){
+ return null;
+ }
+ //账户冻结
+ if (userInfo.getAccountStatus().equals("00")) {
+ throw new LockedAccountException();
+ }
+ SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
+ userInfo.getUsername(),
+ userInfo.getPassword(),
+ getName()
+ );
+ return authenticationInfo;
+ }
+
+ @Override
+ protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
+ System.out.println("权限配置-->MyShiroRealm.doGetAuthorizationInfo()");
+ SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
+ String username = (String) principals.getPrimaryPrincipal();
+ User userInfo = userService.queryUserByUsername(username);
+ String userRole = userInfo.getUserFlag();
+ // 1:普通用户,2:医师,3:管理员.
+ String[] role = userRole.split(",");
+ if ( role.length > 0) {
+ for (int i = 0; i< role.length; i++) {
+ Role role1 = new Role();
+ role1.setRole(role[i]);
+ authorizationInfo.addRole(role[i]);
+ Role role2 = roleService.queryRoleIdByRole(role1);
+ // 通过角色Id拿到权限Id
+ String roleId = role2.getRoleId().toString();
+ List permissionList = permissionService.queryPermissionId(roleId);
+ // 通过权限Id拿到权限
+ for (int j = 0; j filterChainDefinitionMap = new LinkedHashMap();
+ // 配置不会被拦截的链接 顺序判断
+ filterChainDefinitionMap.put("/fsrcs/login", "anon");
+ filterChainDefinitionMap.put("/**", "authc");
+ // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面
+ shiroFilterFactoryBean.setLoginUrl("/fsrcs/login");
+ // 登录成功后要跳转的链接
+ shiroFilterFactoryBean.setSuccessUrl("/index");
+
+ //未授权界面;
+ shiroFilterFactoryBean.setUnauthorizedUrl("/403");
+ shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
+ return shiroFilterFactoryBean;
+ }
+
+ @Bean
+ public MyShiroRealm myShiroRealm(){
+ MyShiroRealm myShiroRealm = new MyShiroRealm();
+ return myShiroRealm;
+ }
+ @Bean
+ public DefaultWebSecurityManager securityManager(){
+ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
+ securityManager.setRealm(myShiroRealm());
+ return securityManager;
+ }
+
+ /**
+ * 开启shiro aop注解支持.
+ * 使用代理方式;所以需要开启代码支持;
+ * @param securityManager
+ * @return
+ */
+ @Bean
+ public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){
+ AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
+ authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
+ return authorizationAttributeSourceAdvisor;
+ }
+}
\ No newline at end of file
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/controller/CommentController.java b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/CommentController.java
new file mode 100644
index 0000000..00742f0
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/CommentController.java
@@ -0,0 +1,27 @@
+package edu.wbu.fsrcs.controller;
+
+import edu.wbu.fsrcs.entity.Comment;
+import edu.wbu.fsrcs.entity.Result;
+import edu.wbu.fsrcs.entity.ResultCode;
+import edu.wbu.fsrcs.service.CommentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/fsrcs/comment")
+public class CommentController {
+ @Autowired
+ CommentService commentService;
+
+ @PostMapping("/insert")
+ public Result insertComment(@RequestBody Comment comment){
+ commentService.insertComment(comment);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/query")
+ public Result queryComments(@RequestParam("remedyId") String remedyId){
+ commentService.queryComments(remedyId);
+ return new Result(ResultCode.SUCCESS);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/controller/DynamicController.java b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/DynamicController.java
new file mode 100644
index 0000000..5ad3cc2
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/DynamicController.java
@@ -0,0 +1,70 @@
+package edu.wbu.fsrcs.controller;
+
+import edu.wbu.fsrcs.entity.Dynamic;
+import edu.wbu.fsrcs.entity.Result;
+import edu.wbu.fsrcs.entity.ResultCode;
+import edu.wbu.fsrcs.entity.User;
+import edu.wbu.fsrcs.service.DynamicService;
+import edu.wbu.fsrcs.service.UserService;
+import edu.wbu.fsrcs.utils.IdWorker;
+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.Map;
+
+@RestController
+@RequestMapping("/fsrcs/dynamic")
+public class DynamicController {
+
+ public static final String MEDICINE = "医师";
+ @Autowired
+ DynamicService dynamicService;
+ @Autowired
+ UserService userService;
+
+ @PostMapping("/create")
+ public Result create(@RequestBody Dynamic dynamic){
+ dynamic.setDynamicId((new IdWorker()).nextId());
+ String userId = dynamic.getUserId();
+ User user = userService.queryUserById(userId);
+ if (MEDICINE.equals(user.getUserFlag())) {
+ dynamic.setDynamicTitle(dynamic.getDynamicTitle() + "(医用小偏方)");
+ } else {
+ dynamic.setDynamicTitle(dynamic.getDynamicTitle() + "(非医用小偏方)");
+ }
+ dynamicService.addDynamic(dynamic);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/update")
+ public Result update(@RequestBody Dynamic dynamic){
+ dynamicService.updateDynamic(dynamic);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/delete")
+ public Result delete(@RequestBody Dynamic dynamic){
+ dynamicService.deleteDynamic(dynamic);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/query")
+ public Result query(){
+ Map dynamics = dynamicService.queryDynamic();
+ Result result = new Result(ResultCode.SUCCESS);
+ result.setData(dynamics);
+ return result;
+ }
+
+ @PostMapping("/select")
+ public Result select(@RequestBody Dynamic dynamic){
+ Map dynamics = dynamicService.queryDynamicByUserId(dynamic);
+ Result result = new Result(ResultCode.SUCCESS);
+ result.setData(dynamics);
+ return result;
+ }
+
+
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/controller/LoginController.java b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/LoginController.java
new file mode 100644
index 0000000..7625678
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/LoginController.java
@@ -0,0 +1,79 @@
+package edu.wbu.fsrcs.controller;
+
+import edu.wbu.fsrcs.entity.*;
+import edu.wbu.fsrcs.service.PermissionService;
+import edu.wbu.fsrcs.service.RoleService;
+import edu.wbu.fsrcs.service.UserService;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.authc.*;
+import org.apache.shiro.subject.Subject;
+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.LinkedList;
+import java.util.List;
+
+
+@RestController
+@RequestMapping("/fsrcs")
+public class LoginController {
+
+ @Autowired
+ UserService userService;
+
+ @Autowired
+ RoleService roleService;
+
+ @Autowired
+ PermissionService permissionService;
+
+ @PostMapping("/login")
+ public Result login(@RequestBody User user) throws Exception {
+ Subject subject = SecurityUtils.getSubject();
+ UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword());
+ try {
+ subject.login(token);
+ User loginInfo = userService.queryUser(user.getUsername(), user.getPassword());
+ String userRole = loginInfo.getUserFlag();
+ List permission = new LinkedList<>();
+ // 1:普通用户,2:医师,3:管理员.
+ String[] role = userRole.split(",");
+ if ( role.length > 0) {
+ for (int i = 0; i< role.length; i++) {
+ System.out.println(role[i]);
+ Role role1 = new Role();
+ role1.setRole(role[i]);
+ Role role2 = roleService.queryRoleIdByRole(role1);
+ // 通过角色Id拿到权限Id
+ String roleId = role2.getRoleId().toString();
+ List permissionList = permissionService.queryPermissionId(roleId);
+ // 通过权限Id拿到权限
+ for (int j = 0; j roles = roleService.queryAllRole();
+ for (Role role:roles) {
+ List permissionStr = new LinkedList();
+ String roleId = role.getRoleId();
+ List permissions = permissionService.queryPermissionId(roleId);
+ for (Permission permission:permissions) {
+ String permissionId = permission.getPermissionId().toString();
+ Permission pers = permissionService.queryPermission(permissionId);
+ permissionStr.add(pers.getPermissionName());
+ }
+ role.setPermissions(permissionStr.toString());
+ }
+ Result result = new Result(ResultCode.SUCCESS);
+ result.setData(roles);
+ return result;
+ }
+ @PostMapping("/update")
+ public Result updateRole(@RequestBody Role role){
+ String roleId = role.getRoleId().toString();
+ roleService.deleteRoleAndPermissions(role);
+ String[] permissions = role.getPermissions().split(",");
+ for (int i = 0; i< permissions.length;i++){
+ roleService.insertRoleAndPermissions(roleId,permissions[i]);
+ }
+ return new Result(ResultCode.SUCCESS);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/controller/UserController.java b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/UserController.java
new file mode 100644
index 0000000..887cfa2
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/controller/UserController.java
@@ -0,0 +1,65 @@
+package edu.wbu.fsrcs.controller;
+
+import edu.wbu.fsrcs.entity.Result;
+import edu.wbu.fsrcs.entity.ResultCode;
+import edu.wbu.fsrcs.entity.User;
+import edu.wbu.fsrcs.service.UserService;
+import edu.wbu.fsrcs.utils.AesEncryptUtil;
+import edu.wbu.fsrcs.utils.IdWorker;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/fsrcs/user")
+public class UserController {
+ @Autowired
+ UserService userService;
+ @Autowired
+ IdWorker idWorker;
+ @RequestMapping("/{userId}")
+ public Result queryUserById(@PathVariable String userId){
+ User user = userService.queryUserById(userId);
+ Result result = new Result(ResultCode.SUCCESS);
+ result.setData(user);
+ return result;
+ }
+ @GetMapping("")
+ public Result queryAllUser(){
+ List list = userService.queryAllUser();
+ Result result = new Result(ResultCode.SUCCESS);
+ result.setData(list);
+ return result;
+ }
+
+ @PostMapping("/insert")
+ public Result insertUser(@RequestBody User user) throws Exception {
+ String username = user.getUsername();
+ String password = user.getPassword();
+ if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
+ throw new Exception("用户名或者密码不能为空");
+ }
+ User user1 = userService.queryUserByUsername(username);
+ if (username == user1.getUsername()) {
+ throw new Exception("用户名已存在");
+ }
+ user.setUserId(idWorker.nextId());
+ userService.addUser(user);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/update")
+ public Result updateUser(@RequestBody User user) throws Exception {
+ userService.updateUser(user);
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ @PostMapping("/delete")
+ public Result deleteUser(@RequestBody User user){
+ userService.deleteUser(user);
+ return new Result(ResultCode.SUCCESS);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/CommentDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/CommentDao.java
new file mode 100644
index 0000000..6a731c7
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/CommentDao.java
@@ -0,0 +1,59 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.Comment;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * (Comment)表数据库访问层
+ *
+ * @author makejava
+ * @since 2020-04-01 15:21:30
+ */
+public interface CommentDao {
+
+ /**
+ * 通过ID查询单条数据
+ *
+ * @param 主键
+ * @return 实例对象
+ */
+ List queryById(@Param("dynamicId") String dynamicId);
+
+ /**
+ * 查询指定行数据
+ *
+ * @param offset 查询起始位置
+ * @param limit 查询条数
+ * @return 对象列表
+ */
+ List queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit);
+
+
+ /**
+ * 通过实体作为筛选条件查询
+ *
+ * @param comment 实例对象
+ * @return 对象列表
+ */
+ List queryAll(Comment comment);
+
+ /**
+ * 新增数据
+ *
+ * @param comment 实例对象
+ * @return 影响行数
+ */
+ int insert(Comment comment);
+
+
+ /**
+ * 通过主键删除数据
+ *
+ * @param 主键
+ * @return 影响行数
+ */
+ int deleteById( @Param("remedyId") String remedyId);
+
+}
\ No newline at end of file
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/DynamicDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/DynamicDao.java
new file mode 100644
index 0000000..e54b123
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/DynamicDao.java
@@ -0,0 +1,16 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.Dynamic;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface DynamicDao {
+ int add(Dynamic dynamic);
+ int delete(Dynamic dynamic);
+ int update(Dynamic dynamic);
+ List query();
+ int queryTotal();
+ List queryByUserId(@Param("userId") String userId, @Param("offset") int offset, @Param("pageSize") int pageSize);
+ int queryTotalByUserId(@Param("userId") String userId);
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/PermissionDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/PermissionDao.java
new file mode 100644
index 0000000..91571ef
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/PermissionDao.java
@@ -0,0 +1,11 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.Permission;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface PermissionDao {
+ List queryPermissionId(@Param("roleId") String roleId);
+ Permission queryPermission(@Param("permissionId") String permissionId);
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RewardDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RewardDao.java
new file mode 100644
index 0000000..c514a3c
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RewardDao.java
@@ -0,0 +1,8 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.Reward;
+
+public interface RewardDao {
+ Reward query(Reward reward);
+ int add(Reward reward);
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RoleDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RoleDao.java
new file mode 100644
index 0000000..6fbd421
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/RoleDao.java
@@ -0,0 +1,16 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.Role;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface RoleDao {
+ List queryAllRole();
+ Role queryRoleIdByRole(Role role);
+ int add(Role role);
+ int update(Role role);
+ int delete(Role role);
+ void deleteRoleAndPermissions(Role role);
+ void insertRoleAndPermissions(@Param("roleId") String roleId,@Param("permissionId") String permissionId);
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/dao/UserDao.java b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/UserDao.java
new file mode 100644
index 0000000..95cec5e
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/dao/UserDao.java
@@ -0,0 +1,53 @@
+package edu.wbu.fsrcs.dao;
+
+import edu.wbu.fsrcs.entity.User;
+import java.util.List;
+
+public interface UserDao {
+
+ /**
+ * 查询用户
+ * @return
+ */
+ User queryUser(String username, String password);
+
+ /**
+ * 查询所有用户
+ * @return
+ */
+ List queryAllUser();
+
+ /**
+ * 通过Id查询用户
+ * @param userId
+ * @return
+ */
+ User queryUserById(String userId);
+
+ /**
+ * 通过username查询用户
+ * @param username
+ * @return
+ */
+ User queryUserByUsername(String username);
+ /**
+ * 新建用户
+ * @param user
+ * @return
+ */
+ int addUser(User user);
+
+ /**
+ * 修改用户
+ * @param user
+ * @return
+ */
+ int updateUser(User user);
+
+ /**
+ * 删除用户
+ * @param user
+ * @return
+ */
+ int deleteUser(User user);
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Comment.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Comment.java
new file mode 100644
index 0000000..36034b5
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Comment.java
@@ -0,0 +1,19 @@
+package edu.wbu.fsrcs.entity;
+
+import edu.wbu.fsrcs.utils.IdWorker;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Comment {
+ private String commentId;
+ private String userId;
+ private String comment;
+ private String remedyId;
+ private Date createDate;
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Dynamic.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Dynamic.java
new file mode 100644
index 0000000..7f4c83d
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Dynamic.java
@@ -0,0 +1,22 @@
+package edu.wbu.fsrcs.entity;
+
+import edu.wbu.fsrcs.utils.IdWorker;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Dynamic extends Page {
+ private String dynamicId;
+ private String userId;
+ private String dynamicTitle;
+ private String dynamicContent;
+ private List comments;
+ private Date createDate;
+ private Date updateDate;
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Page.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Page.java
new file mode 100644
index 0000000..4f42557
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Page.java
@@ -0,0 +1,15 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Page {
+ private int offset;
+ private int limit;
+ private int currentPage;
+ private int pageSize;
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Permission.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Permission.java
new file mode 100644
index 0000000..d607fae
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Permission.java
@@ -0,0 +1,20 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.HashSet;
+import java.util.Set;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Permission {
+ private String permissionId;
+ private String permissionName;
+ private String url;
+ private Boolean available;
+ private String roles;
+ private Set roleSet = new HashSet();
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ProfileResult.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ProfileResult.java
new file mode 100644
index 0000000..ab0f253
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ProfileResult.java
@@ -0,0 +1,58 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.util.*;
+
+@Setter
+@Getter
+public class ProfileResult implements Serializable {
+ private String userId;
+ private String username;
+ private String nickname;
+ private Map roles = new HashMap<>();
+
+ /**
+ * @param user
+ */
+ public ProfileResult(User user, List list) {
+ this.userId = user.getUserId();
+ this.username = user.getUsername();
+ this.nickname = user.getNickName();
+ Set menus = new HashSet<>();
+ Set apis = new HashSet<>();
+
+ for (Permission perm : list) {
+ String code = perm.getPermissionId().toString();
+ String url = perm.getPermissionName();
+ menus.add(code);
+ apis.add(url);
+ }
+ this.roles.put("menus", menus);
+ this.roles.put("apis", apis);
+ }
+
+
+ public ProfileResult(User user) {
+ this.userId = user.getUserId();
+ this.username = user.getUsername();
+ this.nickname = user.getNickName();
+ Set roles = user.getRoleSet();
+ Set menus = new HashSet<>();
+ Set apis = new HashSet<>();
+ for (Role role : roles) {
+ Set perms = role.getPermissionSet();
+ for (Permission perm : perms) {
+ String code = perm.getPermissionId().toString();
+ String url = perm.getPermissionName();
+ menus.add(code);
+ apis.add(url);
+ }
+ }
+
+ this.roles.put("menus", menus);
+ this.roles.put("apis", apis);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Result.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Result.java
new file mode 100644
index 0000000..93d4ce8
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Result.java
@@ -0,0 +1,57 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+/**
+ * 数据响应对象
+ * {
+ * "success":是否成功
+ * "code":返回码
+ * "message":返回信息
+ * "data":{
+ * 返回数据
+ * }
+ * }
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class Result {
+
+ private boolean success;
+ private Integer code;// 返回码
+ private String message;//返回信息
+ private Object data;// 返回数据
+
+ public Result(ResultCode code) {
+ this.success = code.success;
+ this.code = code.code;
+ this.message = code.message;
+ }
+
+ public Result(ResultCode code, Object data) {
+ this.success = code.success;
+ this.code = code.code;
+ this.message = code.message;
+ this.data = data;
+ }
+
+ public Result(Integer code, String message, boolean success) {
+ this.code = code;
+ this.message = message;
+ this.success = success;
+ }
+
+ public static Result SUCCESS() {
+ return new Result(ResultCode.SUCCESS);
+ }
+
+ public static Result ERROR() {
+ return new Result(ResultCode.SERVER_ERROR);
+ }
+
+ public static Result FAIL() {
+ return new Result(ResultCode.FAIL);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ResultCode.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ResultCode.java
new file mode 100644
index 0000000..1d95fb1
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/ResultCode.java
@@ -0,0 +1,41 @@
+package edu.wbu.fsrcs.entity;
+
+public enum ResultCode {
+
+ SUCCESS(true, 10000, "操作成功!"),
+ //---系统错误返回码-----
+ FAIL(false, 10001, "操作失败"),
+ UNAUTHENTICATED(false, 10002, "您还未登录"),
+ UNAUTHORISE(false, 10003, "权限不足"),
+ SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"),
+ DISABLED(false, 10003, "账号已被禁用"),
+ UnknownAccount(false, 10004,"账户不存在"),
+ //---用户操作返回码----
+ USERNAMEORPASSWORDERROR(false, 20001, "用户名或密码错误");
+
+ //操作是否成功
+ boolean success;
+ //操作代码
+ int code;
+ //提示信息
+ String message;
+
+ ResultCode(boolean success, int code, String message) {
+ this.success = success;
+ this.code = code;
+ this.message = message;
+ }
+
+ public boolean success() {
+ return success;
+ }
+
+ public int code() {
+ return code;
+ }
+
+ public String message() {
+ return message;
+ }
+
+}
\ No newline at end of file
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Reward.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Reward.java
new file mode 100644
index 0000000..fcf2bf9
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Reward.java
@@ -0,0 +1,17 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Reward {
+ private String dynamicId;
+ private String userId;
+ private Date rewardDate;
+ private Date rewardAmount;
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Role.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Role.java
new file mode 100644
index 0000000..2a6cc75
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/Role.java
@@ -0,0 +1,21 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import java.util.HashSet;
+import java.util.Set;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class Role {
+ private String roleId;
+ private String role;
+ private String description;
+ private Boolean available;
+ private String users;
+ private String permissions;
+ private Set userSet = new HashSet();
+ private Set permissionSet = new HashSet();
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/RoleResult.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/RoleResult.java
new file mode 100644
index 0000000..2cbec28
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/RoleResult.java
@@ -0,0 +1,29 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.beans.BeanUtils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@Getter
+@Setter
+public class RoleResult implements Serializable {
+ private Long roleId;
+ private String role;
+ private String description;
+ private Boolean available;
+
+ private List permIds = new ArrayList<>();
+
+ public RoleResult(Role role) {
+ BeanUtils.copyProperties(role, this);
+ for (Permission perm : role.getPermissionSet()) {
+ this.permIds.add(perm.getPermissionId());
+ }
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/User.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/User.java
new file mode 100644
index 0000000..9ae8db8
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/User.java
@@ -0,0 +1,51 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class User {
+ private String userId;
+ private String username;
+ private String nickName;
+ private String password;
+ private Date createDate;
+ private Date updateDate;
+ /**
+ * 用户角色
+ * 1:用户,2:医师,3:管理员.
+ */
+ private String userFlag;
+ private Set roleSet = new HashSet();
+ /**
+ * 1:正常状态,2:用户被锁定.
+ */
+ private String accountStatus;
+ private String physicianLicense;
+
+ private Object data;
+
+ private Object token;
+
+ /*public List getRoleList() {
+ String[] arr = this.userFlag.split(",");
+ for(int i = 0; i< arr.length; i++){
+ Role role = new Role();
+ role.setRoleId(Long.parseLong(arr[i]));
+ roleList.add(role);
+ }
+ return roleList;
+ }
+
+ public void setRoleList(List roleList) {
+ this.roleList = roleList;
+ }*/
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserResult.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserResult.java
new file mode 100644
index 0000000..9163ac7
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserResult.java
@@ -0,0 +1,41 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.springframework.beans.BeanUtils;
+
+import java.io.Serializable;
+import java.util.*;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class UserResult implements Serializable {
+ private String userId;
+ private String username;
+ private String nickName;
+ private Date createDate;
+ private Date updateDate;
+ Object token;
+ /**
+ * 用户角色
+ * 1:普通用户,2:医师,3:管理员.
+ */
+ private String userFlag;
+ private List roleIds = new ArrayList<>();
+ /**
+ * 1:正常状态,2:用户被锁定.
+ */
+ private String accountStatus;
+ private String physicianLicense;
+
+ public UserResult(User user) {
+ BeanUtils.copyProperties(user, this);
+ for (Role role : user.getRoleSet()) {
+ this.roleIds.add(role.getRoleId());
+ }
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserSimpleResult.java b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserSimpleResult.java
new file mode 100644
index 0000000..754cadd
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/entity/UserSimpleResult.java
@@ -0,0 +1,15 @@
+package edu.wbu.fsrcs.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+public class UserSimpleResult {
+ private String id;
+ private String username;
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/exception/CommonException.java b/fsrcs/src/main/java/edu/wbu/fsrcs/exception/CommonException.java
new file mode 100644
index 0000000..f7d5667
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/exception/CommonException.java
@@ -0,0 +1,14 @@
+package edu.wbu.fsrcs.exception;
+
+import edu.wbu.fsrcs.entity.ResultCode;
+
+/**
+ * 自定义异常
+ */
+public class CommonException extends Exception {
+ private ResultCode resultCode;
+
+ public CommonException(ResultCode resultCode) {
+ this.resultCode = resultCode;
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/CommentService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/CommentService.java
new file mode 100644
index 0000000..f82b3a0
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/CommentService.java
@@ -0,0 +1,26 @@
+package edu.wbu.fsrcs.service;
+
+import edu.wbu.fsrcs.dao.CommentDao;
+import edu.wbu.fsrcs.entity.Comment;
+import edu.wbu.fsrcs.utils.IdWorker;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class CommentService {
+ @Autowired
+ CommentDao commentDao;
+
+ public List queryComments(String remedyId){
+ return commentDao.queryById(remedyId);
+ }
+
+ public void insertComment(Comment comment){
+ comment.setCommentId(new IdWorker().nextId());
+ comment.setCreateDate(new Date(System.currentTimeMillis()));
+ commentDao.insert(comment);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/DynamicService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/DynamicService.java
new file mode 100644
index 0000000..5d58111
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/DynamicService.java
@@ -0,0 +1,69 @@
+package edu.wbu.fsrcs.service;
+
+import edu.wbu.fsrcs.dao.CommentDao;
+import edu.wbu.fsrcs.dao.DynamicDao;
+import edu.wbu.fsrcs.dao.UserDao;
+import edu.wbu.fsrcs.entity.Comment;
+import edu.wbu.fsrcs.entity.Dynamic;
+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;
+
+@Service
+public class DynamicService {
+ @Autowired
+ DynamicDao dynamicDao;
+ @Autowired
+ CommentDao commentDao;
+ @Autowired
+ UserDao userDao;
+
+ public void addDynamic(Dynamic dynamic){
+ dynamic.setCreateDate(new Date());
+ dynamicDao.add(dynamic);
+ }
+ public Map queryDynamic(){
+ int total = dynamicDao.queryTotal();
+ List list = dynamicDao.query();
+ for (Dynamic dynamic:list){
+ String dynamicId = dynamic.getDynamicId();
+ List comments = commentDao.queryById(dynamicId);
+ for (Comment c: comments) {
+ String userId = c.getUserId();
+ c.setUserId(userDao.queryUserById(userId).getNickName());
+ }
+ dynamic.setComments(comments);
+ }
+ Map map = new HashMap<>(2);
+ map.put("total", total);
+ map.put("list", list);
+ return map;
+ }
+ public Map queryDynamicByUserId(Dynamic dynamic){
+ String userId = dynamic.getUserId();
+ int offset = dynamic.getOffset();
+ int pageSize = dynamic.getPageSize();
+ int total = dynamicDao.queryTotalByUserId(userId);
+ List list = dynamicDao.queryByUserId(userId, offset, pageSize);
+ for (Dynamic dy:list){
+ String dynamicId = dy.getDynamicId();
+ List comments = commentDao.queryById(dynamicId);
+ dy.setComments(comments);
+ }
+ Map map = new HashMap<>(2);
+ map.put("total", total);
+ map.put("list", list);
+ return map;
+ }
+ public void updateDynamic(Dynamic dynamic){
+ dynamic.setUpdateDate(new Date());
+ dynamicDao.update(dynamic);
+ }
+ public void deleteDynamic(Dynamic dynamic){
+ dynamicDao.delete(dynamic);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/PermissionService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/PermissionService.java
new file mode 100644
index 0000000..501ed46
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/PermissionService.java
@@ -0,0 +1,23 @@
+package edu.wbu.fsrcs.service;
+
+import edu.wbu.fsrcs.dao.PermissionDao;
+import edu.wbu.fsrcs.entity.Permission;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class PermissionService {
+
+ @Autowired
+ PermissionDao permissionDao;
+
+ public List queryPermissionId(String roleId){
+ return permissionDao.queryPermissionId(roleId);
+ }
+
+ public Permission queryPermission(String permissionId){
+ return permissionDao.queryPermission(permissionId);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/RemedyService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/RemedyService.java
new file mode 100644
index 0000000..6d98b96
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/RemedyService.java
@@ -0,0 +1,7 @@
+package edu.wbu.fsrcs.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class RemedyService {
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/RoleService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/RoleService.java
new file mode 100644
index 0000000..54a6d3c
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/RoleService.java
@@ -0,0 +1,36 @@
+package edu.wbu.fsrcs.service;
+
+import edu.wbu.fsrcs.dao.RoleDao;
+import edu.wbu.fsrcs.entity.Role;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class RoleService {
+
+ @Autowired
+ RoleDao roleDao;
+
+ /**
+ * 通过角色查询角色Id
+ * @param role
+ * @return
+ */
+ public Role queryRoleIdByRole(Role role){
+ return roleDao.queryRoleIdByRole(role);
+ }
+
+ public List queryAllRole(){
+ return roleDao.queryAllRole();
+ }
+
+ public void deleteRoleAndPermissions(Role role){
+ roleDao.deleteRoleAndPermissions(role);
+ }
+
+ public void insertRoleAndPermissions(String roleId,String permissionId){
+ roleDao.insertRoleAndPermissions(roleId,permissionId);
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/service/UserService.java b/fsrcs/src/main/java/edu/wbu/fsrcs/service/UserService.java
new file mode 100644
index 0000000..ae2f9e7
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/service/UserService.java
@@ -0,0 +1,46 @@
+package edu.wbu.fsrcs.service;
+
+import edu.wbu.fsrcs.dao.UserDao;
+import edu.wbu.fsrcs.entity.User;
+import org.apache.ibatis.annotations.Param;
+import org.apache.shiro.authz.annotation.RequiresRoles;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.List;
+
+@Service
+public class UserService {
+
+ @Autowired
+ UserDao userDao;
+
+ public User queryUser(@Param("username") String username, @Param("password")String password) throws Exception {
+ return userDao.queryUser(username, password);
+ }
+
+ public List queryAllUser(){
+ return userDao.queryAllUser();
+ }
+
+ public User queryUserById(@Param("userId") String userId){
+ return userDao.queryUserById(userId);
+ }
+
+ public User queryUserByUsername(@Param("username") String username){
+ return userDao.queryUserByUsername(username);
+ }
+ public int addUser(User user) throws Exception {
+ return userDao.addUser(user);
+ }
+ public int updateUser(User user) throws Exception {
+ return userDao.updateUser(user);
+ }
+
+ public int deleteUser(User user){
+ return userDao.deleteUser(user);
+ }
+
+ /**
+ * 获取用户权限
+ */
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/utils/AesEncryptUtil.java b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/AesEncryptUtil.java
new file mode 100644
index 0000000..896e4d0
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/AesEncryptUtil.java
@@ -0,0 +1,124 @@
+package edu.wbu.fsrcs.utils;
+
+import org.apache.tomcat.util.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+
+public class AesEncryptUtil {
+
+ //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
+ private static String KEY = "1234567890123456";
+
+ private static String IV = "1234567890123456";
+
+
+ /**
+ * 加密方法
+ * @param data 要加密的数据
+ * @param key 加密key
+ * @param iv 加密iv
+ * @return 加密的结果
+ * @throws Exception
+ */
+ public static String encrypt(String data, String key, String iv) throws Exception {
+ try {
+
+ Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
+ int blockSize = cipher.getBlockSize();
+
+ byte[] dataBytes = data.getBytes();
+ int plaintextLength = dataBytes.length;
+ if (plaintextLength % blockSize != 0) {
+ plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
+ }
+
+ byte[] plaintext = new byte[plaintextLength];
+ System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+
+ SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+ IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+ cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+ byte[] encrypted = cipher.doFinal(plaintext);
+
+ return new Base64().encodeToString(encrypted);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 解密方法
+ * @param data 要解密的数据
+ * @param key 解密key
+ * @param iv 解密iv
+ * @return 解密的结果
+ * @throws Exception
+ */
+ public static String desEncrypt(String data, String key, String iv) throws Exception {
+ try {
+ byte[] encrypted1 = new Base64().decode(data);
+
+ Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+ SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+ IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+ cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
+
+ byte[] original = cipher.doFinal(encrypted1);
+ String originalString = new String(original);
+ return originalString;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 使用默认的key和iv加密
+ * @param data
+ * @return
+ * @throws Exception
+ */
+ public static String encrypt(String data) throws Exception {
+ return encrypt(data, KEY, IV);
+ }
+
+ /**
+ * 使用默认的key和iv解密
+ * @param data
+ * @return
+ * @throws Exception
+ */
+ public static String desEncrypt(String data) throws Exception {
+ return desEncrypt(data, KEY, IV);
+ }
+
+
+
+ /**
+ * 测试
+ */
+ public static void main(String args[]) throws Exception {
+
+ String test1 = "qwerasdf.";
+ String test =new String(test1.getBytes(),"UTF-8");
+ String data = null;
+ String key = KEY;
+ String iv = IV;
+ // /g2wzfqvMOeazgtsUVbq1kmJawROa6mcRAzwG1/GeJ4=
+ data = encrypt(test, key, iv);
+ System.out.println("数据:"+test);
+ System.out.println("加密:"+data);
+ String jiemi =desEncrypt(data, key, iv).trim();
+ System.out.println("解密:"+jiemi);
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/utils/BeanMapUtils.java b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/BeanMapUtils.java
new file mode 100644
index 0000000..e40b2ed
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/BeanMapUtils.java
@@ -0,0 +1,33 @@
+package edu.wbu.fsrcs.utils;
+
+import org.springframework.cglib.beans.BeanMap;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BeanMapUtils {
+
+ /**
+ * 将对象属性转化为map结合
+ */
+ public static Map beanToMap(T bean) {
+ Map map = new HashMap<>();
+ if (bean != null) {
+ BeanMap beanMap = BeanMap.create(bean);
+ for (Object key : beanMap.keySet()) {
+ map.put(key + "", beanMap.get(key));
+ }
+ }
+ return map;
+ }
+
+ /**
+ * 将map集合中的数据转化为指定对象的同名属性中
+ */
+ public static T mapToBean(Map map, Class clazz) throws Exception {
+ T bean = clazz.newInstance();
+ BeanMap beanMap = BeanMap.create(bean);
+ beanMap.putAll(map);
+ return bean;
+ }
+}
diff --git a/fsrcs/src/main/java/edu/wbu/fsrcs/utils/IdWorker.java b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/IdWorker.java
new file mode 100644
index 0000000..802bad4
--- /dev/null
+++ b/fsrcs/src/main/java/edu/wbu/fsrcs/utils/IdWorker.java
@@ -0,0 +1,149 @@
+package edu.wbu.fsrcs.utils;
+
+import java.lang.management.ManagementFactory;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+
+//雪花算法代码实现
+public class IdWorker {
+ // 时间起始标记点,作为基准,一般取系统的最近时间(一旦确定不能变动)
+ private final static long twepoch = 1288834974657L;
+ // 机器标识位数
+ private final static long workerIdBits = 5L;
+ // 数据中心标识位数
+ private final static long datacenterIdBits = 5L;
+ // 机器ID最大值
+ private final static long maxWorkerId = -1L ^ (-1L << workerIdBits);
+ // 数据中心ID最大值
+ private final static long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
+ // 毫秒内自增位
+ private final static long sequenceBits = 12L;
+ // 机器ID偏左移12位
+ private final static long workerIdShift = sequenceBits;
+ // 数据中心ID左移17位
+ private final static long datacenterIdShift = sequenceBits + workerIdBits;
+ // 时间毫秒左移22位
+ private final static long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+
+ private final static long sequenceMask = -1L ^ (-1L << sequenceBits);
+ /* 上次生产id时间戳 */
+ private static long lastTimestamp = -1L;
+ // 0,并发控制
+ private long sequence = 0L;
+
+ private final long workerId;
+ // 数据标识id部分
+ private final long datacenterId;
+
+ public IdWorker() {
+ this.datacenterId = getDatacenterId(maxDatacenterId);
+ this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
+ }
+
+ /**
+ * @param workerId 工作机器ID
+ * @param datacenterId 序列号
+ */
+ public IdWorker(long workerId, long datacenterId) {
+ if (workerId > maxWorkerId || workerId < 0) {
+ throw new IllegalArgumentException(String.format("worker Id can't be greater than %d or less than 0", maxWorkerId));
+ }
+ if (datacenterId > maxDatacenterId || datacenterId < 0) {
+ throw new IllegalArgumentException(String.format("datacenter Id can't be greater than %d or less than 0", maxDatacenterId));
+ }
+ this.workerId = workerId;
+ this.datacenterId = datacenterId;
+ }
+
+ /**
+ * 获取下一个ID
+ *
+ * @return
+ */
+ public synchronized String nextId() {
+ long timestamp = timeGen();
+ if (timestamp < lastTimestamp) {
+ throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
+ }
+
+ if (lastTimestamp == timestamp) {
+ // 当前毫秒内,则+1
+ sequence = (sequence + 1) & sequenceMask;
+ if (sequence == 0) {
+ // 当前毫秒内计数满了,则等待下一秒
+ timestamp = tilNextMillis(lastTimestamp);
+ }
+ } else {
+ sequence = 0L;
+ }
+ lastTimestamp = timestamp;
+ // ID偏移组合生成最终的ID,并返回ID
+ long nextId = ((timestamp - twepoch) << timestampLeftShift)
+ | (datacenterId << datacenterIdShift)
+ | (workerId << workerIdShift) | sequence;
+
+ return String.valueOf(nextId);
+ }
+
+ private long tilNextMillis(final long lastTimestamp) {
+ long timestamp = this.timeGen();
+ while (timestamp <= lastTimestamp) {
+ timestamp = this.timeGen();
+ }
+ return timestamp;
+ }
+
+ private long timeGen() {
+ return System.currentTimeMillis();
+ }
+
+ /**
+ *
+ * 获取 maxWorkerId
+ *
+ */
+ protected static long getMaxWorkerId(long datacenterId, long maxWorkerId) {
+ StringBuffer mpid = new StringBuffer();
+ mpid.append(datacenterId);
+ String name = ManagementFactory.getRuntimeMXBean().getName();
+ if (!name.isEmpty()) {
+ /*
+ * GET jvmPid
+ */
+ mpid.append(name.split("@")[0]);
+ }
+ /*
+ * MAC + PID 的 hashcode 获取16个低位
+ */
+ return (mpid.toString().hashCode() & 0xffff) % (maxWorkerId + 1);
+ }
+
+ /**
+ *
+ * 数据标识id部分
+ *
+ */
+ protected static long getDatacenterId(long maxDatacenterId) {
+ long id = 0L;
+ try {
+ InetAddress ip = InetAddress.getLocalHost();
+ NetworkInterface network = NetworkInterface.getByInetAddress(ip);
+ if (network == null) {
+ id = 1L;
+ } else {
+ byte[] mac = network.getHardwareAddress();
+ id = ((0x000000FF & (long) mac[mac.length - 1])
+ | (0x0000FF00 & (((long) mac[mac.length - 2]) << 8))) >> 6;
+ id = id % (maxDatacenterId + 1);
+ }
+ } catch (Exception e) {
+ System.out.println(" getDatacenterId: " + e.getMessage());
+ }
+ return id;
+ }
+
+ public static void main(String[] args) {
+ IdWorker idWorker = new IdWorker();
+ System.out.println(idWorker.nextId());
+ }
+}
diff --git a/fsrcs/src/main/resources/application.yaml b/fsrcs/src/main/resources/application.yaml
new file mode 100644
index 0000000..5860695
--- /dev/null
+++ b/fsrcs/src/main/resources/application.yaml
@@ -0,0 +1,18 @@
+server:
+ port: 8280
+spring:
+ datasource:
+ url: jdbc:mysql://localhost:3306/fsrcs?serverTimezone=GMT%2B8
+ username: root
+ password: 123456
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ devtools:
+ restart:
+ enabled: true
+ additional-paths: src/main/**
+mybatis:
+ configuration:
+ log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
+ cache-enabled: true
+ type-aliases-package: edu.wbu.fsrcs
+ mapper-locations: classpath*:mapper/*.xml
diff --git a/fsrcs/src/main/resources/mapper/CommentDao.xml b/fsrcs/src/main/resources/mapper/CommentDao.xml
new file mode 100644
index 0000000..aba2b12
--- /dev/null
+++ b/fsrcs/src/main/resources/mapper/CommentDao.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into fsrcs.comment(remedy_id, user_id, create_date, comment, comment_id)
+ values (#{remedyId}, #{userId}, #{createDate}, #{comment}, #{commentId})
+
+
+
+
+ delete from fsrcs.comment where comment_id = #{commentId}
+
+
+
\ No newline at end of file
diff --git a/fsrcs/src/main/resources/mapper/DynamicMapper.xml b/fsrcs/src/main/resources/mapper/DynamicMapper.xml
new file mode 100644
index 0000000..1925d12
--- /dev/null
+++ b/fsrcs/src/main/resources/mapper/DynamicMapper.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into remedy(remedy_id,user_id,remedy_title,remedy_content,create_Date)
+ values (#{dynamicId},#{userId},#{dynamicTitle},#{dynamicContent},#{createDate})
+
+
+ update remedy set update_date = #{updateDate}
+
+ ,remedy_title=#{dynamicTitle}
+
+
+ ,remedy_content=#{dynamicContent}
+
+ where remedy_id = #{dynamicId}
+
+
+ delete from remedy where remedy_id = #{dynamicId}
+
+
\ No newline at end of file
diff --git a/fsrcs/src/main/resources/mapper/PermissionMapper.xml b/fsrcs/src/main/resources/mapper/PermissionMapper.xml
new file mode 100644
index 0000000..b46f8df
--- /dev/null
+++ b/fsrcs/src/main/resources/mapper/PermissionMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fsrcs/src/main/resources/mapper/RoleMapper.xml b/fsrcs/src/main/resources/mapper/RoleMapper.xml
new file mode 100644
index 0000000..63d09d2
--- /dev/null
+++ b/fsrcs/src/main/resources/mapper/RoleMapper.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into role(role_id,role,description,available)
+ values (#{roleId},#{role},#{description},#{available})
+
+
+ update role set available = 1
+
+ ,role=#{role}
+
+
+ ,description=#{description}
+
+
+ ,permissions = #{permissions}
+
+ where role_id = #{roleId}
+
+
+ delete from role where role_id = #{roleId}
+
+
+ delete from role_permission where role_id = #{roleId}
+
+
+
+ insert into role_permission(role_id, permission_id) values (#{roleId},#{permissionId})
+
+
\ No newline at end of file
diff --git a/fsrcs/src/main/resources/mapper/UserMapper.xml b/fsrcs/src/main/resources/mapper/UserMapper.xml
new file mode 100644
index 0000000..f4608a4
--- /dev/null
+++ b/fsrcs/src/main/resources/mapper/UserMapper.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into User(user_id,username,password,nick_name,create_date,update_date,user_flag,account_status,physician_license)
+ values (#{userId},#{username},#{password},#{nickName},#{createDate},#{updateDate},#{userFlag},#{accountStatus},#{physicianLicense})
+
+
+ update User set update_date = #{updateDate}
+
+ ,password=#{password}
+
+
+ ,nick_name=#{nickName}
+
+
+ ,user_flag = #{userFlag}
+
+
+ ,account_status = #{accountStatus}
+
+
+ ,physician_license = #{physicianLicense}
+
+ where user_id = #{userId}
+
+
+ delete from user where user_id = #{userId}
+
+
\ No newline at end of file
diff --git a/fsrcs/src/main/test/MyTest.java b/fsrcs/src/main/test/MyTest.java
new file mode 100644
index 0000000..e24a0f0
--- /dev/null
+++ b/fsrcs/src/main/test/MyTest.java
@@ -0,0 +1,47 @@
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class MyTest {
+public static String DF_AA;
+
+ public static void main(String[] args) {
+ int x=4;
+
+ System.out.println(++x);
+ System.out.println(DF_AA);
+ System.out.println(DF_AA);
+ System.out.println(MyTest.DF_AA);
+ Map map = new HashMap();
+ Person person = new Person("123", "234");
+ map.put(person, "a");
+ System.out.println(person);
+ System.out.println(map.get(person));
+ System.out.println(new Person("123", "234"));
+ System.out.println(map.get(new Person("123", "234")));
+ }
+
+ @Data
+ @AllArgsConstructor
+ @NoArgsConstructor
+ private static class Person{
+ private String idCard;
+ private String username;
+
+ @Override
+ public boolean equals(Object o){
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()){
+ return false;
+ }
+ Person person = (Person)o;
+ return this.idCard == person.idCard;
+ }
+ }
+
+}
diff --git a/fsrcs/src/main/test/TestInteger.java b/fsrcs/src/main/test/TestInteger.java
new file mode 100644
index 0000000..ae0e22e
--- /dev/null
+++ b/fsrcs/src/main/test/TestInteger.java
@@ -0,0 +1,11 @@
+class Main
+{
+ public static void main(String[] args)
+ {
+ String str = "runoob";
+ str += "wwwrunoobcom";
+ String string = str.substring(2,13);
+ string = string + str.charAt(4);
+ System.out.println(string);
+ }
+}
\ No newline at end of file
diff --git a/fsrcs/src/main/test/TestIt.java b/fsrcs/src/main/test/TestIt.java
new file mode 100644
index 0000000..16e0792
--- /dev/null
+++ b/fsrcs/src/main/test/TestIt.java
@@ -0,0 +1,22 @@
+class TestIt
+{
+ public static void main ( String[] args )
+ {
+ int[] myArray = {1, 2, 3, 4, 5};
+ System.out.println("1:"+myArray);
+ ChangeIt.doIt( myArray );
+ System.out.println("4:"+myArray);
+ for(int j=0; j
+
+ 4.0.0
+
+ edu.guat
+ FSRCS
+ pom
+ 1.0-SNAPSHOT
+
+ fsrcs-common
+
+
+
+
+ cn.hutool
+ hutool-all
+ 5.3.2
+
+
+
+
\ No newline at end of file