给的代码没有git
commit
29d9bbe22e
|
|
@ -0,0 +1,33 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.3/apache-maven-3.8.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# h5es
|
||||
|
||||
#### Description
|
||||
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# h5es
|
||||
|
||||
#### 介绍
|
||||
{**以下是 Gitee 平台说明,您可以替换此简介**
|
||||
Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台
|
||||
无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)}
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
|
@ -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.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# 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 "$@"
|
||||
|
|
@ -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%
|
||||
|
|
@ -0,0 +1,373 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.6.RELEASE</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>senlinfanghuo</artifactId>
|
||||
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<java.version>1.8</java.version>
|
||||
<mybatis-plus-boot-starter.version>3.2.0</mybatis-plus-boot-starter.version>
|
||||
<druid.version>1.1.10</druid.version>
|
||||
<mapstruct.version>1.2.0.Final</mapstruct.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>net.sf.ucanaccess</groupId>-->
|
||||
<!-- <artifactId>ucanaccess</artifactId>-->
|
||||
<!-- <version>5.0.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>0.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
</dependency>
|
||||
<!--swagger-ui-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||
<version>1.3.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus-boot-starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>mysql</groupId>-->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.14.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>2.10.2</version>
|
||||
</dependency>
|
||||
<!-- druid数据源驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
<!--logStash-->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>7.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.httpcomponents</groupId>-->
|
||||
<!-- <artifactId>httpclient</artifactId>-->
|
||||
<!-- <version>4.5.2</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.httpcomponents</groupId>-->
|
||||
<!-- <artifactId>httpcore</artifactId>-->
|
||||
<!-- <version>4.4.5</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.httpcomponents</groupId>-->
|
||||
<!-- <artifactId>httpcore</artifactId>-->
|
||||
<!-- <version>4.0.1</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.bgee.log4jdbc-log4j2</groupId>-->
|
||||
<!-- <artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>-->
|
||||
<!-- <version>1.16</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!--mapStruct依赖-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.mapstruct</groupId>-->
|
||||
<!-- <artifactId>mapstruct-jdk8</artifactId>-->
|
||||
<!-- <version>${mapstruct.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.mapstruct</groupId>-->
|
||||
<!-- <artifactId>mapstruct-processor</artifactId>-->
|
||||
<!-- <version>${mapstruct.version}</version>-->
|
||||
<!-- <scope>provided</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!--hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>5.9.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.6</version>
|
||||
</dependency>
|
||||
<!-- Apache Lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Commons Io -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-metadata</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-referencing</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-epsg-wkt</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-shapefile</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vividsolutions</groupId>
|
||||
<artifactId>jts</artifactId>
|
||||
<version>1.11</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<groupId>xerces</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-data</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.measure</groupId>
|
||||
<artifactId>jsr-275</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-api</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-main</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-swing</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-jdbc</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools.jdbc</groupId>
|
||||
<artifactId>gt-jdbc-postgis</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-opengis</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geotools</groupId>
|
||||
<artifactId>gt-epsg-hsql</artifactId>
|
||||
<version>20.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>nl.pdok</groupId>
|
||||
<artifactId>geoserver-manager</artifactId>
|
||||
<version>1.7.0-pdok2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.toile-libre.libe</groupId>
|
||||
<artifactId>curl</artifactId>
|
||||
<version>0.0.40</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.25</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>osgeo</id>
|
||||
<name>OSGeo Release Repository</name>
|
||||
<url>https://repo.osgeo.org/repository/release/</url>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>osgeo-snapshot</id>
|
||||
<name>OSGeo Snapshot Repository</name>
|
||||
<url>https://repo.osgeo.org/repository/snapshot/</url>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
<releases><enabled>false</enabled></releases>
|
||||
</repository>
|
||||
<!-- <repository>-->
|
||||
<!-- <id>aliyun</id>-->
|
||||
<!-- <name>aliyun Maven</name>-->
|
||||
<!-- <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>-->
|
||||
<!-- <snapshots><enabled>false</enabled></snapshots>-->
|
||||
<!-- <releases><enabled>true</enabled></releases>-->
|
||||
<!-- </repository>-->
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 打包时跳过测试 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.zzlh.es;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties
|
||||
@MapperScan(basePackages = "com.zzlh.es.mapper")
|
||||
public class EsApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EsApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
package com.zzlh.es.annotation;
|
||||
|
||||
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 自定义导出Excel数据注解
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface Excel
|
||||
{
|
||||
/**
|
||||
* 导出时在excel中排序
|
||||
*/
|
||||
public int sort() default Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* 导出到Excel中的名字.
|
||||
*/
|
||||
public String name() default "";
|
||||
|
||||
/**
|
||||
* 日期格式, 如: yyyy-MM-dd
|
||||
*/
|
||||
public String dateFormat() default "";
|
||||
|
||||
/**
|
||||
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
|
||||
*/
|
||||
public String readConverterExp() default "";
|
||||
|
||||
/**
|
||||
* 分隔符,读取字符串组内容
|
||||
*/
|
||||
public String separator() default ",";
|
||||
|
||||
/**
|
||||
* BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化)
|
||||
*/
|
||||
public int scale() default -1;
|
||||
|
||||
/**
|
||||
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
|
||||
*/
|
||||
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的高度 单位为字符
|
||||
*/
|
||||
public double height() default 14;
|
||||
|
||||
/**
|
||||
* 导出时在excel中每个列的宽 单位为字符
|
||||
*/
|
||||
public double width() default 16;
|
||||
|
||||
/**
|
||||
* 文字后缀,如% 90 变成90%
|
||||
*/
|
||||
public String suffix() default "";
|
||||
|
||||
/**
|
||||
* 当值为空时,字段的默认值
|
||||
*/
|
||||
public String defaultValue() default "";
|
||||
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
public String prompt() default "";
|
||||
|
||||
/**
|
||||
* 设置只能选择不能输入的列内容.
|
||||
*/
|
||||
public String[] combo() default {};
|
||||
|
||||
/**
|
||||
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||
*/
|
||||
public boolean needMerge() default false;
|
||||
|
||||
/**
|
||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||
*/
|
||||
public boolean isExport() default true;
|
||||
|
||||
/**
|
||||
* 另一个类中的属性名称,支持多级获取,以小数点隔开
|
||||
*/
|
||||
public String targetAttr() default "";
|
||||
|
||||
/**
|
||||
* 是否自动统计数据,在最后追加一行统计数据总和
|
||||
*/
|
||||
public boolean isStatistics() default false;
|
||||
|
||||
/**
|
||||
* 导出类型(0数字 1字符串)
|
||||
*/
|
||||
public ColumnType cellType() default ColumnType.STRING;
|
||||
|
||||
/**
|
||||
* 导出列头背景色
|
||||
*/
|
||||
public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
|
||||
|
||||
/**
|
||||
* 导出列头字体颜色
|
||||
*/
|
||||
public IndexedColors headerColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格背景色
|
||||
*/
|
||||
public IndexedColors backgroundColor() default IndexedColors.WHITE;
|
||||
|
||||
/**
|
||||
* 导出单元格字体颜色
|
||||
*/
|
||||
public IndexedColors color() default IndexedColors.BLACK;
|
||||
|
||||
/**
|
||||
* 导出字段对齐方式
|
||||
*/
|
||||
public HorizontalAlignment align() default HorizontalAlignment.CENTER;
|
||||
|
||||
/**
|
||||
* 自定义数据处理器
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 自定义数据处理器参数
|
||||
*/
|
||||
public String[] args() default {};
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
*/
|
||||
Type type() default Type.ALL;
|
||||
|
||||
public enum Type
|
||||
{
|
||||
ALL(0), EXPORT(1), IMPORT(2);
|
||||
private final int value;
|
||||
|
||||
Type(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
NUMERIC(0), STRING(1), IMAGE(2);
|
||||
private final int value;
|
||||
|
||||
ColumnType(int value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zzlh.es.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Excel注解集
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Excels
|
||||
{
|
||||
Excel[] value();
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
public class CalPoint {
|
||||
|
||||
public static Bounds calculateTileBounds(int tileX, int tileY, int zoomLevel) {
|
||||
double tileRes = 360.0 / (1 << zoomLevel);
|
||||
double minLat = (tileY * tileRes - 90);
|
||||
double maxLat = ((tileY + 1) * tileRes - 90);
|
||||
double minLon = (tileX * tileRes - 180);
|
||||
double maxLon = ((tileX + 1) * tileRes - 180);
|
||||
return new Bounds(minLon, minLat, maxLon, maxLat);
|
||||
}
|
||||
|
||||
// 表示经纬度范围的类
|
||||
public static class Bounds {
|
||||
public double minLon;
|
||||
public double minLat;
|
||||
public double maxLon;
|
||||
public double maxLat;
|
||||
|
||||
public Bounds(double minLon, double minLat, double maxLon, double maxLat) {
|
||||
this.minLon = minLon;
|
||||
this.minLat = minLat;
|
||||
this.maxLon = maxLon;
|
||||
this.maxLat = maxLat;
|
||||
}
|
||||
|
||||
// 输出函数,方便打印查看
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Bounds{" +
|
||||
"minLon=" + minLon +
|
||||
", minLat=" + minLat +
|
||||
", maxLon=" + maxLon +
|
||||
", maxLat=" + maxLat +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
// 使用示例
|
||||
public static void main(String[] args) {
|
||||
int tileX = 13556;
|
||||
int tileY = 6461;
|
||||
int zoomLevel = 14;
|
||||
Bounds bounds = calculateTileBounds(tileX, tileY, zoomLevel);
|
||||
System.out.println(bounds);
|
||||
System.out.println((tileX + 1) * (360 / (2^zoomLevel)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
@Component
|
||||
@Configuration
|
||||
public class CrossConfig {
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
// 1.添加CORS配置信息
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// 放行哪些原始域
|
||||
config.addAllowedOrigin("*");
|
||||
// 是否发送Cookie信息
|
||||
config.setAllowCredentials(true);
|
||||
// 放行哪些原始域(请求方式)
|
||||
config.addAllowedMethod("*");
|
||||
// 放行哪些原始域(头部信息)
|
||||
config.addAllowedHeader("*");
|
||||
// 暴露哪些头部信息(因为跨域访问默认不能获取全部头部信息)springboot配置此项会报错,不允许设置*
|
||||
// 2.添加映射路径
|
||||
UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
|
||||
configSource.registerCorsConfiguration("/**", config);
|
||||
// 3.返回新的CorsFilter.
|
||||
return new CorsFilter(configSource);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author haijun
|
||||
* @Date 2019/12/30 13:57
|
||||
* @ClassName FileMvcConfig
|
||||
***/
|
||||
@Configuration
|
||||
public class FileMvcConfig implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 网络路径配置
|
||||
*/
|
||||
@Value("${fileupload.config.staticAccessPath}")
|
||||
private String staticAccessPath;
|
||||
|
||||
/**
|
||||
* 服务器储存路径(带盘符,liunx不用)
|
||||
*/
|
||||
@Value("${fileupload.config.uploadFolder}")
|
||||
private String uploadFolder;
|
||||
|
||||
/**
|
||||
* 服务器储存子路径
|
||||
*/
|
||||
@Value("${fileupload.config.localPath}")
|
||||
private String localPath;
|
||||
/**
|
||||
* 用户头像
|
||||
**/
|
||||
@Value("${fileupload.config.uploadFolder}")
|
||||
private String userHeaderPic;
|
||||
/**
|
||||
* 档案文件数据
|
||||
*/
|
||||
@Value("${fileupload.config.archivesFilePath}")
|
||||
private String archivesFilePath;
|
||||
//
|
||||
// @Autowired
|
||||
// private IConfigService configService;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//配置server虚拟路径,handler为前台访问的目录,locations为files相对应的本地路径
|
||||
registry.addResourceHandler(staticAccessPath)
|
||||
.addResourceLocations("file:"+getUploadFolder()+localPath);
|
||||
}
|
||||
|
||||
public String getUploadFolder(){
|
||||
// String uploadFolderdb = configService.getValueByKey("uploadFolder");
|
||||
// System.out.println("uploadFolderdb:"+uploadFolderdb);
|
||||
// if(uploadFolderdb==null||uploadFolderdb.trim().length()==0){
|
||||
// return uploadFolder;
|
||||
// }
|
||||
// return uploadFolderdb;
|
||||
return uploadFolder;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.properties.JwtProperties;
|
||||
import com.zzlh.es.utils.JwtTokenUtil;
|
||||
import com.zzlh.es.utils.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
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;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.*;
|
||||
import static com.zzlh.es.utils.RequestUtil.matchers;
|
||||
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
||||
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
|
||||
@Autowired
|
||||
private JwtProperties jwtProperties;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
|
||||
if (matchers("/druid/**", request)){
|
||||
response.getWriter().write(JSON.toJSONString(AjaxResult.error(AUTH_FAILED, "身份认证失败")));
|
||||
return;
|
||||
}else {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
/*String authorization = request.getHeader("Authorization");
|
||||
|
||||
if (matchers("/getVerifyCode", request)
|
||||
|| matchers("/auth/login", request)
|
||||
||matchers("/swagger-ui.html", request)
|
||||
||matchers("/swagger-resources/**", request)
|
||||
||matchers("/webjars/**", request)
|
||||
||matchers("/v2/**", request)
|
||||
||matchers("/swagger-ui.html/**", request)
|
||||
) {
|
||||
chain.doFilter(request, response);
|
||||
return;
|
||||
}else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
if (StringUtils.isEmpty(authorization)) {
|
||||
response.getWriter().write(JSON.toJSONString(AjaxResult.error(AUTH_FAILED, "身份认证失败")));
|
||||
return;
|
||||
}
|
||||
if(!authorization.startsWith(jwtProperties.getTokenHead())){
|
||||
response.getWriter().write(JSON.toJSONString(AjaxResult.error(TOKEN_CAST_ERROR, "身份认证失败")));
|
||||
return;
|
||||
}
|
||||
final String token = authorization.replace(jwtProperties.getTokenHead(), "");
|
||||
String username = jwtTokenUtil.getUsernameFromToken(token);
|
||||
if(null == username){
|
||||
response.getWriter().write(JSON.toJSONString(AjaxResult.error(LOSE_TOKEN, "身份认证失败")));
|
||||
return;
|
||||
}
|
||||
SecurityContextHolder.getContext().getAuthentication();
|
||||
if(null == redisUtil.get(username+authorization)){
|
||||
log.info("token verify key:"+username+token);
|
||||
response.getWriter().write(JSON.toJSONString(AjaxResult.error(LIMIT_TOKEN_ERROR, "身份认证失败")));
|
||||
return;
|
||||
}
|
||||
UserDetails userDetails = this.userDetailsService.loadUserByUsername(username);
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||
userDetails, null, userDetails.getAuthorities());
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
//重置 token 过期时间
|
||||
//redisUtil.expire(username+authorization, jwtProperties.getExpiration());
|
||||
}
|
||||
chain.doFilter(request, response);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
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.Jackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* redis配置
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||
public class RedisConfig extends CachingConfigurerSupport
|
||||
{
|
||||
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
@Bean(name = "myRedisTemplate")
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
|
||||
RedisSerializer<String> stringSerializer = new StringRedisSerializer();
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||
|
||||
template.setValueSerializer(stringSerializer);
|
||||
template.setKeySerializer(stringSerializer);
|
||||
|
||||
template.setHashKeySerializer(stringSerializer);
|
||||
template.setHashValueSerializer(stringSerializer);
|
||||
template.afterPropertiesSet();
|
||||
return template;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
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.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
|
||||
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("com.zzlh.es.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("接口文档")
|
||||
.termsOfServiceUrl("http://localhost:8080/")
|
||||
.version("1.0")
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
public class TileToLatLongConverter2 {
|
||||
// 瓦片的像素尺寸(常见的Web Mercator瓦片大小为256x256像素)
|
||||
private static final int TILE_SIZE = 256;
|
||||
|
||||
// 地球半径(单位:米)
|
||||
private static final double EARTH_RADIUS = 6378137.0;
|
||||
|
||||
// 初始偏移量(用于将经纬度转换为像素坐标)
|
||||
private static final double INITIAL_RESOLUTION = TILE_SIZE * 0.5 / (Math.PI * EARTH_RADIUS);
|
||||
|
||||
/**
|
||||
* 将经纬度转换为像素坐标。
|
||||
*
|
||||
* @param lat 纬度(范围:-90到90)
|
||||
* @param lng 经度(范围:-180到180)
|
||||
* @param zoom 缩放级别
|
||||
* @return 像素坐标(px, py)
|
||||
*/
|
||||
private static double[] latLngToPixel(double lat, double lng, int zoom) {
|
||||
double sinLat = Math.sin(lat * Math.PI / 180);
|
||||
|
||||
// 墨卡托投影的公式
|
||||
double pixelX = ((lng + 180) / 360) * TILE_SIZE * Math.pow(2, zoom);
|
||||
double pixelY = (1 + Math.sin(lat * Math.PI / 180)) / 2 * TILE_SIZE * Math.pow(2, zoom);
|
||||
|
||||
return new double[]{pixelX, pixelY};
|
||||
}
|
||||
|
||||
/**
|
||||
* 将像素坐标转换为经纬度。
|
||||
*
|
||||
* @param px 像素X坐标
|
||||
* @param py 像素Y坐标
|
||||
* @param zoom 缩放级别
|
||||
* @return 经纬度(lat, lng)
|
||||
*/
|
||||
private static double[] pixelToLatLng(double px, double py, int zoom) {
|
||||
double n = Math.PI - (2 * Math.PI * py) / (TILE_SIZE * Math.pow(2, zoom));
|
||||
|
||||
double lat = (Math.toDegrees(Math.atan(Math.sinh(n))));
|
||||
double lng = (px / (TILE_SIZE * Math.pow(2, zoom))) * 360 - 180;
|
||||
// System.out.println(lat +" "+ lng);
|
||||
return new double[]{lat, lng};
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算瓦片边界的经纬度范围。
|
||||
*
|
||||
* @param tileX 瓦片X坐标
|
||||
* @param tileY 瓦片Y坐标
|
||||
* @param zoom 缩放级别
|
||||
* @return 瓦片边界的经纬度范围(minLat, minLng, maxLat, maxLng)
|
||||
*/
|
||||
public static double[] calculateTileBounds(int tileX, int tileY, int zoom) {
|
||||
// 计算瓦片左上角的经纬度
|
||||
double[] topLeftLatLng = pixelToLatLng(tileX * TILE_SIZE, tileY * TILE_SIZE, zoom);
|
||||
double minLat = topLeftLatLng[0];
|
||||
double minLng = topLeftLatLng[1];
|
||||
System.out.println(minLat+":"+minLng);
|
||||
// 计算瓦片右上角的经纬度
|
||||
double[] topRightLatLng = pixelToLatLng((tileX + 1) * TILE_SIZE, tileY * TILE_SIZE, zoom);
|
||||
double maxLat = topRightLatLng[0];
|
||||
double maxLng = topRightLatLng[1];
|
||||
|
||||
// 计算瓦片左下角的经纬度
|
||||
double[] bottomLeftLatLng = pixelToLatLng(tileX * TILE_SIZE, (tileY + 1) * TILE_SIZE, zoom);
|
||||
double bottomLat = bottomLeftLatLng[0];
|
||||
System.out.println(bottomLat+":"+bottomLeftLatLng[1]);
|
||||
// 瓦片在纬度上不是等宽的,因此我们需要取左下角和左上角的纬度中的最小值作为minLat
|
||||
minLat = Math.min(minLat, bottomLat);
|
||||
|
||||
// 瓦片在经度上是等宽的,所以maxLng已经在计算右上角时得到
|
||||
|
||||
// 返回瓦片边界的经纬度范围
|
||||
return new double[]{minLat, minLng, maxLat, maxLng};
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
double[] a = {117.861328125,35.49645605658416,117.861328125,35.51434313431818};
|
||||
double b = 35.42486791930557;
|
||||
double c = 117.59765625;
|
||||
double d = 117.61962890625;
|
||||
double[] doubles = latLngToPixel(35.40696093270201, 117.88330078125, 14);
|
||||
double[] tileNumber2 = getTileNumber2(a, 14);
|
||||
System.out.println(doubles[0]/256);
|
||||
System.out.println(doubles[1]/512);
|
||||
//System.out.println(doubles[0]);
|
||||
//System.out.println(doubles[1]);
|
||||
sout(13557, 6467, 14,calculateTileBounds(13557, 6467, 14));
|
||||
// sout(6737, 3098, 13,calculateTileBounds(6737, 3098, 13));
|
||||
// sout(53901, 24785, 16,calculateTileBounds(53901, 24785, 16));
|
||||
// sout(1724854, 793148, 21,calculateTileBounds(53901, 24785, 16));
|
||||
}
|
||||
|
||||
private static void sout(int tileX, int tileY, int zoom, double[] bounds) {
|
||||
System.out.println(tileX+" "+tileY+" "+zoom+" "+bounds[0]+" "+bounds[1]+" "+bounds[2]+" "+bounds[3]);
|
||||
}
|
||||
|
||||
|
||||
// 转回去
|
||||
public static String getTileNumber(final double lat, final double lon, final int zoom) {
|
||||
int xtile = (int) Math.floor((lon + 180) / 360 * (1 << zoom));
|
||||
int ytile = (int) Math.floor((1 - Math.log(Math.tan(Math.toRadians(lat)) + 1 / Math.cos(Math.toRadians(lat))) / Math.PI) / 2 * (1 << zoom));
|
||||
if (xtile < 0)
|
||||
xtile = 0;
|
||||
if (xtile >= (1 << zoom))
|
||||
xtile = ((1 << zoom) - 1);
|
||||
if (ytile < 0)
|
||||
ytile = 0;
|
||||
if (ytile >= (1 << zoom))
|
||||
ytile = ((1 << zoom) - 1);
|
||||
return ("" + zoom + "/" + xtile + "/" + ytile);
|
||||
}
|
||||
public static double[] getTileNumber2(double[] rectPts, int level) {
|
||||
|
||||
//瓦片的级别分辨率(1-18)
|
||||
double[] resolution = {5.36441802978515E-06,
|
||||
1.07288360595703E-05,
|
||||
2.1457672119140625E-05,
|
||||
4.29153442382814E-05,
|
||||
8.58306884765629E-05,
|
||||
0.000171661376953125,
|
||||
0.00034332275390625,
|
||||
0.0006866455078125,
|
||||
0.001373291015625,
|
||||
0.00274658203125,
|
||||
0.0054931640625,
|
||||
0.010986328125,
|
||||
0.02197265625,
|
||||
0.0439453125,
|
||||
0.087890625,
|
||||
0.17578125,
|
||||
0.3515625,
|
||||
0.703125};
|
||||
|
||||
|
||||
double startX = Math.floor((rectPts[0] + 180.0) / (resolution[18 - level] * 256));
|
||||
double startY = Math.floor((90.0 - rectPts[1]) / (resolution[18 - level] * 256));
|
||||
double endX = Math.ceil((rectPts[2] + 180.0) / (resolution[18 - level] * 256));
|
||||
double endY = Math.ceil((90.0 - rectPts[3]) / (resolution[18 - level] * 256));
|
||||
//左上角瓦片坐标和左下角瓦片坐标
|
||||
double[] result = new double[]{startX, startY, endX, endY};
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.zzlh.es.config;
|
||||
|
||||
|
||||
import com.zzlh.es.entity.properties.JwtProperties;
|
||||
import com.zzlh.es.security.auth.CustomAuthenticationEntryPoint;
|
||||
import com.zzlh.es.security.auth.CustomUserDetailsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
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.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@EnableConfigurationProperties(JwtProperties.class)
|
||||
@Slf4j
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private CustomUserDetailsService customUserDetailsService;
|
||||
|
||||
@Autowired
|
||||
private CustomAuthenticationEntryPoint authenticationEntryPoint;
|
||||
|
||||
|
||||
//JWT
|
||||
@Autowired
|
||||
private JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
//将自定的CustomUserDetailsService装配到AuthenticationManagerBuilder
|
||||
auth.userDetailsService(customUserDetailsService).passwordEncoder(new BCryptPasswordEncoder());
|
||||
}
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
http.cors().and().csrf().disable();//开启跨域
|
||||
http.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
/*匿名请求:不需要进行登录拦截的url*/
|
||||
.authorizeRequests()
|
||||
//.antMatchers("/getVerifyCode", "/auth/login","/swagger-ui.html","/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**").permitAll()
|
||||
.anyRequest().anonymous()//其他的路径都是登录后才可访问
|
||||
.and()
|
||||
.exceptionHandling()
|
||||
.authenticationEntryPoint(authenticationEntryPoint);
|
||||
|
||||
http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||
http.headers().cacheControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* security检验忽略的请求,比如静态资源不需要登录的可在本处配置
|
||||
* @param web
|
||||
*/
|
||||
@Override
|
||||
public void configure(WebSecurity web){
|
||||
// platform.ignoring().antMatchers("/login");
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
|
||||
auth.eraseCredentials(false);
|
||||
}
|
||||
//密码加密配置
|
||||
@Bean
|
||||
public BCryptPasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.zzlh.es.constant;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
/**
|
||||
* UTF-8 字符集
|
||||
*/
|
||||
public static final String UTF8 = "UTF-8";
|
||||
|
||||
/**
|
||||
* GBK 字符集
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/**
|
||||
* www主域
|
||||
*/
|
||||
public static final String WWW = "www.";
|
||||
|
||||
/**
|
||||
* RMI 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_RMI = "rmi:";
|
||||
|
||||
/**
|
||||
* LDAP 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAP = "ldap:";
|
||||
|
||||
/**
|
||||
* LDAPS 远程方法调用
|
||||
*/
|
||||
public static final String LOOKUP_LDAPS = "ldaps:";
|
||||
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
public static final String HTTP = "http://";
|
||||
|
||||
/**
|
||||
* https请求
|
||||
*/
|
||||
public static final String HTTPS = "https://";
|
||||
|
||||
/**
|
||||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 失败标记
|
||||
*/
|
||||
public static final Integer FAIL = 500;
|
||||
|
||||
/**
|
||||
* 登录成功状态
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS_STATUS = "0";
|
||||
|
||||
/**
|
||||
* 登录失败状态
|
||||
*/
|
||||
public static final String LOGIN_FAIL_STATUS = "1";
|
||||
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LOGIN_SUCCESS = "Success";
|
||||
|
||||
/**
|
||||
* 注销
|
||||
*/
|
||||
public static final String LOGOUT = "Logout";
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public static final String REGISTER = "Register";
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public static final String LOGIN_FAIL = "Error";
|
||||
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
/**
|
||||
* 验证码有效期(分钟)
|
||||
*/
|
||||
public static final long CAPTCHA_EXPIRATION = 2;
|
||||
|
||||
/**
|
||||
* 资源映射路径 前缀
|
||||
*/
|
||||
public static final String RESOURCE_PREFIX = "/profile";
|
||||
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = { "com.hckj" };
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
*/
|
||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||
"org.springframework", "org.apache", "com.hckj.common.core.utils.file" };
|
||||
|
||||
/**
|
||||
* 封禁
|
||||
*/
|
||||
public static final String BAN = "1";
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package com.zzlh.es.constant;
|
||||
|
||||
/**
|
||||
* 返回状态码
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class HttpStatus
|
||||
{
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 系统内部错误
|
||||
*/
|
||||
public static final int ERROR = 500;
|
||||
|
||||
|
||||
/**
|
||||
* 系统警告消息
|
||||
*/
|
||||
public static final int WARN = 601;
|
||||
|
||||
/**
|
||||
* 未提供token
|
||||
*/
|
||||
public static final int AUTH_FAILED= 10000001;
|
||||
/**
|
||||
* token格式不正确
|
||||
*/
|
||||
public static final int TOKEN_CAST_ERROR= 10000002;
|
||||
/**
|
||||
*无效的Token
|
||||
*/
|
||||
public static final int LOSE_TOKEN= 10000003;
|
||||
/**
|
||||
*Token已过期
|
||||
*/
|
||||
public static final int LIMIT_TOKEN_ERROR= 10000004;
|
||||
/**
|
||||
*当前用户被禁止
|
||||
*/
|
||||
public static final int USER_BAN= 10000005;
|
||||
/**
|
||||
*账号密码不为空
|
||||
*/
|
||||
public static final int USERNAME_PASSWORD_NOT_NULL= 10000006;
|
||||
/**
|
||||
*登录失败
|
||||
*/
|
||||
public static final int LOGIN_FAILED= 10000007;
|
||||
|
||||
/**
|
||||
*图层发布失败
|
||||
*/
|
||||
public static final int PASSWORD_ERROR= 10000012;
|
||||
|
||||
/**
|
||||
*验证码生成失败
|
||||
*/
|
||||
public static final int IMAGE_FAILED= 10000008;
|
||||
|
||||
/**
|
||||
*输入正确的二维码
|
||||
*/
|
||||
public static final int IMAGE_ERROR= 10000009;
|
||||
|
||||
/**
|
||||
*退出失败
|
||||
*/
|
||||
public static final int LOGOUT_ERROR= 10000010;
|
||||
|
||||
/**
|
||||
*图层发布失败
|
||||
*/
|
||||
public static final int PUBLISH_ERROR= 10000011;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 应用相关code
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 图层发布失败
|
||||
*/
|
||||
public static final int APPLICATION_EXIST= 20000001;
|
||||
|
||||
/**
|
||||
* 服务不存在
|
||||
*/
|
||||
public static final int SERVER_NOT_EXIST= 20000002;
|
||||
|
||||
|
||||
/**
|
||||
* 图层服务名称不能为空
|
||||
*/
|
||||
public static final int SERVER_NAME_NULL= 20000003;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*应用名称不能为空
|
||||
*/
|
||||
public static final int APPLICATION_NAME_NULL= 20000004;
|
||||
|
||||
/**
|
||||
*坐标系不能为空
|
||||
*/
|
||||
public static final int SPACE_TYPE_NULL= 20000005;
|
||||
|
||||
/**
|
||||
*地图框架不能为空
|
||||
*/
|
||||
public static final int MAP_FRAME_NULL= 20000006;
|
||||
|
||||
/**
|
||||
*底图信息不能为空
|
||||
*/
|
||||
public static final int UNDERLAY_NULL= 20000007;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*项目组名称不能为空
|
||||
*/
|
||||
public static final int PROJECT_NAME_NULL= 20000008;
|
||||
|
||||
/**
|
||||
*应用id不能为空
|
||||
*/
|
||||
public static final int APPLICATION_ID_NULL= 20000009;
|
||||
|
||||
/**
|
||||
*请选中对应项目组或图层再删除(id空了)
|
||||
*/
|
||||
public static final int ID_NULL= 20000010;
|
||||
|
||||
/**
|
||||
* 服务id不能为空
|
||||
*/
|
||||
public static final int SERVER_ID_NULL= 20000011;
|
||||
|
||||
|
||||
/**
|
||||
*项目组不存在
|
||||
*/
|
||||
public static final int PROJECT_NULL= 20000012;
|
||||
|
||||
/**
|
||||
*请选中对应图标
|
||||
*/
|
||||
public static final int ID_NULL_STYLE= 20000013;
|
||||
|
||||
|
||||
/**
|
||||
*文件不能为空
|
||||
*/
|
||||
public static final int FILE_NULL= 20000014;
|
||||
|
||||
/**
|
||||
*重复上传
|
||||
*/
|
||||
public static final int REPEAT_UPLOAD= 20000015;
|
||||
|
||||
/**
|
||||
*选中不存在
|
||||
*/
|
||||
public static final int SELECTED_NOT_EXIST= 20000016;
|
||||
|
||||
|
||||
/**
|
||||
*当前选中图标存在已经绑定图层服务
|
||||
*/
|
||||
public static final int IMAGE_USED= 20000017;
|
||||
|
||||
/**
|
||||
*当前选中图标存在已经绑定图层服务
|
||||
*/
|
||||
public static final int UPLOAD_ERROR= 20000017;
|
||||
|
||||
/**
|
||||
*重复添加
|
||||
*/
|
||||
public static final int REPEAT_ADD= 20000015;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.ApplicationData;
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
import com.zzlh.es.service.IApplicationDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.*;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/application")
|
||||
@Api(value = "/application", tags = "应用创建管理", description = "提供应用创建的管理")
|
||||
public class ApplicationController extends BaseController {
|
||||
@Autowired
|
||||
private IApplicationDataService iApplicationDataService;
|
||||
|
||||
/**
|
||||
* 获取应用列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
@GetMapping("/getAllApplication")
|
||||
@ApiOperation(value = "/getAllApplication", notes = "获取应用列表")
|
||||
public AjaxResult getApplicationInfo(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<ApplicationData> list = iApplicationDataService.getAllApplication();
|
||||
if (list == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
PageInfo<ApplicationData> pageInfo = new PageInfo<>(list);
|
||||
PageHelper.clearPage();
|
||||
return AjaxResult.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用id获取项目组和服务的信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getApplicationInfo/{id}")
|
||||
@ApiOperation(value = "/getApplicationInfo/{id}", notes = "根据id获取树结构")
|
||||
public AjaxResult getApplicationInfo(@PathVariable Integer id) {
|
||||
return iApplicationDataService.getApplicationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用id获取所有项目组名称
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getProjectName/{id}")
|
||||
@ApiOperation(value = "/getProjectName/{id}", notes = "根据应用id获取所有项目组名称")
|
||||
public AjaxResult getProjectName(@PathVariable Integer id) {
|
||||
return iApplicationDataService.getProjectName(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建应用
|
||||
*
|
||||
* @param applicationData
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/createApplication")
|
||||
@ApiOperation(value = "/createApplication", notes = "创建应用")
|
||||
public AjaxResult createApplication(@RequestBody ApplicationData applicationData) {
|
||||
if (StringUtils.isEmpty(applicationData.getApplicationName())) {
|
||||
return AjaxResult.error(APPLICATION_NAME_NULL, "应用名称不能为空");
|
||||
} else if (StringUtils.isEmpty(applicationData.getSpaceType())) {
|
||||
return AjaxResult.error(SPACE_TYPE_NULL, "坐标系不能为空");
|
||||
} else if (StringUtils.isEmpty(applicationData.getMapFrame())) {
|
||||
return AjaxResult.error(MAP_FRAME_NULL, "地图框架不能为空");
|
||||
} else if (StringUtils.isEmpty(applicationData.getUnderlay())) {
|
||||
return AjaxResult.error(UNDERLAY_NULL, "底图信息不能为空");
|
||||
}
|
||||
return iApplicationDataService.createApplication(applicationData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建项目组
|
||||
*
|
||||
* @param projectDataRelation
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/createProject")
|
||||
@ApiOperation(value = "/createProject", notes = "创建项目组")
|
||||
public AjaxResult createProject(@RequestBody ProjectDataRelation projectDataRelation) {
|
||||
if (StringUtils.isEmpty(projectDataRelation.getProjectTeamName())) {
|
||||
return AjaxResult.error(PROJECT_NAME_NULL, "项目组名称不能为空");
|
||||
}
|
||||
return iApplicationDataService.createProject(projectDataRelation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在对应的项目组下添加图层服务
|
||||
*
|
||||
* @param projectDataRelation
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/addServer")
|
||||
@ApiOperation(value = "/addServer", notes = "项目组添加图层服务")
|
||||
public AjaxResult addServer(@RequestBody ProjectDataRelation projectDataRelation) {
|
||||
return iApplicationDataService.addServer(projectDataRelation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据坐标系查找对应的图层服务
|
||||
*
|
||||
* @param spaceType
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getServerByType")
|
||||
@ApiOperation(value = "/getServerByType", notes = "根据坐标系查找对应的图层服务")
|
||||
public AjaxResult getServerByType(@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize, String spaceType) {
|
||||
if (StringUtils.isEmpty(spaceType)) {
|
||||
return AjaxResult.error(SPACE_TYPE_NULL, "坐标系类型不能为空");
|
||||
}
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<DataStore> list = iApplicationDataService.getServerByType(spaceType);
|
||||
if (list == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
PageInfo<DataStore> pageInfo = new PageInfo<>(list);
|
||||
PageHelper.clearPage();
|
||||
return AjaxResult.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目组
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deleteIds/{ids}")
|
||||
@ApiOperation(value = "/deleteIds/{ids}", notes = "根据id删除项目组或图层")
|
||||
public AjaxResult deleteIds(@PathVariable int[] ids) {
|
||||
if (ids.length < 1) {
|
||||
return AjaxResult.error(ID_NULL, "请选中对应项目组或图层再删除");
|
||||
}
|
||||
return iApplicationDataService.deleteIds(ids);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.ProjectDataRelationMars;
|
||||
import com.zzlh.es.service.IProjectDataRelationMarsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.ID_NULL;
|
||||
import static com.zzlh.es.constant.HttpStatus.PROJECT_NAME_NULL;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/applicationMars")
|
||||
@Api(value = "/applicationMars", tags = "火星应用创建管理", description = "提供火星应用创建管理api")
|
||||
public class ApplicationMarsController {
|
||||
|
||||
@Autowired
|
||||
private IProjectDataRelationMarsService iProjectDataRelationMarsService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建项目组(火星)
|
||||
*
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/createMars")
|
||||
@ApiOperation(value = "/createMars", notes = "创建项目组")
|
||||
public AjaxResult createMars(@RequestBody ProjectDataRelationMars projectDataRelationMars) {
|
||||
if (StringUtils.isEmpty(projectDataRelationMars.getProjectTeamName())) {
|
||||
return AjaxResult.error(PROJECT_NAME_NULL, "项目组名称不能为空");
|
||||
}
|
||||
return iProjectDataRelationMarsService.createMars(projectDataRelationMars);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目组添加图层服务
|
||||
*
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addMarsServer")
|
||||
@ApiOperation(value = "/addMarsServer", notes = "项目组添加图层服务")
|
||||
public AjaxResult addMarsServer(@RequestBody ProjectDataRelationMars projectDataRelationMars) {
|
||||
return iProjectDataRelationMarsService.addMarsServer(projectDataRelationMars);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取树结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getApplicationInfo/{areaName}")
|
||||
@ApiOperation(value = "/getApplicationInfo", notes = "获取树结构")
|
||||
public AjaxResult getApplicationInfo(@PathVariable("areaName")String areaName) {
|
||||
return iProjectDataRelationMarsService.getTree(areaName);
|
||||
}
|
||||
|
||||
@GetMapping("/getApplicationInfoApp/{areaName}")
|
||||
@ApiOperation(value = "/getApplicationInfo", notes = "获取树结构")
|
||||
public AjaxResult getApplicationInfoApp(@PathVariable("areaName")String areaName) {
|
||||
return iProjectDataRelationMarsService.getApplicationTree(areaName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除项目组或图层
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deleteIds/{ids}")
|
||||
@ApiOperation(value = "/deleteIds/{ids}", notes = "根据id删除项目组或图层")
|
||||
public AjaxResult deleteIds(@PathVariable int[] ids) {
|
||||
if (ids.length < 1) {
|
||||
return AjaxResult.error(ID_NULL, "请选中对应项目组或图层再删除");
|
||||
}
|
||||
return iProjectDataRelationMarsService.deleteIds(ids);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有项目组名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getProjectName/{areaName}")
|
||||
@ApiOperation(value = "/getProjectName", notes = "获取所有项目组名称")
|
||||
public AjaxResult getProjectName(@PathVariable("areaName")String areaName) {
|
||||
return iProjectDataRelationMarsService.getProjectName(areaName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据id获取样式信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getStyle")
|
||||
@ApiOperation(value = "/getStyle", notes = "根据id获取样式信息")
|
||||
public AjaxResult getStyle(Long id) {
|
||||
return iProjectDataRelationMarsService.findStyleById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据服务id查询列名
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getTableName")
|
||||
@ApiOperation(value = "/getTableName", notes = "根据服务id查询列名")
|
||||
public AjaxResult getTableName(Long id) {
|
||||
return iProjectDataRelationMarsService.getTableName(id);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* @param style json样式
|
||||
* @param type 1是修改父样式 2是修改子样式
|
||||
* @param updateName 修改的名称
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@ApiOperation(value = "/update", notes = "根据id更新样式")
|
||||
public AjaxResult updateStyle(Long id, String style,String type,String updateName,String properties,Integer sort) {
|
||||
return iProjectDataRelationMarsService.updateStyle(id,style,type,updateName,properties,sort);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
import com.zzlh.es.constant.HttpStatus;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.page.TableDataInfo;
|
||||
import com.zzlh.es.utils.DateUtils;
|
||||
import com.zzlh.es.utils.PageUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
|
||||
*/
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder binder) {
|
||||
// Date 类型转换
|
||||
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
|
||||
@Override
|
||||
public void setAsText(String text) {
|
||||
setValue(DateUtils.parseDate(text));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage() {
|
||||
PageUtils.startPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理分页的线程变量
|
||||
*/
|
||||
protected void clearPage() {
|
||||
PageUtils.clearPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected TableDataInfo getDataTable(List<?> list) {
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setRows(list);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功
|
||||
*/
|
||||
public AjaxResult success() {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public AjaxResult success(String message) {
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*/
|
||||
public AjaxResult success(Object data) {
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public AjaxResult error() {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败消息
|
||||
*/
|
||||
public AjaxResult error(String message) {
|
||||
return AjaxResult.error(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*/
|
||||
public AjaxResult warn(String message) {
|
||||
return AjaxResult.warn(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param rows 影响行数
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(int rows) {
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应返回结果
|
||||
*
|
||||
* @param result 结果
|
||||
* @return 操作结果
|
||||
*/
|
||||
protected AjaxResult toAjax(boolean result) {
|
||||
return result ? success() : error();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
import com.zzlh.es.entity.vo.TableDataVo;
|
||||
import com.zzlh.es.page.TableDataInfo;
|
||||
import com.zzlh.es.service.IDataStoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图层存储表Controller
|
||||
*
|
||||
* @author LGD
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/store")
|
||||
@Api(tags = "文件数据相关接口")
|
||||
public class DataStoreController extends BaseController {
|
||||
@Autowired
|
||||
private IDataStoreService dataStoreService;
|
||||
|
||||
/**
|
||||
* 查询图层存储表列表
|
||||
*/
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DataStore dataStore) {
|
||||
startPage();
|
||||
List<DataStore> list = dataStoreService.selectDataStoreList(dataStore);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出图层存储表列表
|
||||
*/
|
||||
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DataStore dataStore) {
|
||||
List<DataStore> list = dataStoreService.selectDataStoreList(dataStore);
|
||||
// ExcelUtil<DataStore> util = new ExcelUtil<DataStore>(DataStore.class);
|
||||
// util.exportExcel(response, list, "图层存储表数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图层存储表详细信息
|
||||
*/
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(dataStoreService.selectDataStoreById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图层存储表
|
||||
*/
|
||||
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DataStore dataStore) {
|
||||
return toAjax(dataStoreService.insertDataStore(dataStore));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图层存储表
|
||||
*/
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody DataStore dataStore) {
|
||||
return toAjax(dataStoreService.updateDataStore(dataStore));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图层存储表
|
||||
*/
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(dataStoreService.deleteDataStoreByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
public AjaxResult delete(@PathVariable("id") Integer id) throws Exception{
|
||||
return toAjax(dataStoreService.deleteDataStoreById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/listData")
|
||||
public TableDataInfo listData(TableDataVo tableDataVo) {
|
||||
System.out.println(tableDataVo.toString());
|
||||
startPage();
|
||||
List<Map> list = dataStoreService.selectDataStoreListByTableName(tableDataVo.getTableName());
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.vo.PartFileVo;
|
||||
import com.zzlh.es.entity.vo.StyleDataVo;
|
||||
import com.zzlh.es.exception.BusinessException;
|
||||
import com.zzlh.es.service.GeoServer;
|
||||
import com.zzlh.es.service.LayerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/geoserver")
|
||||
@Api(tags = "geoserver相关接口")
|
||||
public class GeoServerController {
|
||||
|
||||
@Autowired
|
||||
private GeoServer geoServer;
|
||||
|
||||
@Autowired
|
||||
private LayerService layerService;
|
||||
|
||||
@PostMapping("/uploadFile")
|
||||
public AjaxResult uploadShpFile(PartFileVo data) throws Exception {
|
||||
System.out.println(data.getSpaceType());
|
||||
System.out.println(data.toString());
|
||||
Map map = layerService.fileTransfer(data.getFile(), data.getSpaceType(), data.getTableName());
|
||||
map.put("styleName", data.getStyleName());
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@PostMapping("/uploadFileAdd")
|
||||
public AjaxResult uploadShpFileAdd(PartFileVo data) throws Exception {
|
||||
Map map = layerService.fileTransferAdd(data.getFile(), data.getTableName());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/saveData")
|
||||
public AjaxResult saveData(@RequestBody Map map) throws Exception {
|
||||
System.out.println(map.toString());
|
||||
Map result = layerService.insertIntoData(map);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/cancelSave/{tableValue}")
|
||||
public AjaxResult canCelSave(@PathVariable("tableValue") String tableValue) {
|
||||
Map result = layerService.cancelSave(tableValue);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/checkServerName/{serverName}")
|
||||
public AjaxResult checkServerName(@PathVariable("serverName") String tableValue) {
|
||||
Integer result = layerService.checkServerName(tableValue);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/checkTableName/{tableName}")
|
||||
public AjaxResult checkTableName(@PathVariable("tableName") String tableName) {
|
||||
Integer result = layerService.checkTableName(tableName);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/getDict/{dictType}")
|
||||
public AjaxResult getDictData(@PathVariable("dictType") String dictType) {
|
||||
List<Map> dictList = layerService.getDictList(dictType);
|
||||
return AjaxResult.success(dictList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/publishLayer/{tableValue}")
|
||||
public AjaxResult publishLayer(@PathVariable("tableValue") String tableValue) {
|
||||
layerService.addLayer(tableValue);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/publishLayer")
|
||||
public AjaxResult publishLayer(@RequestBody Map param) {
|
||||
layerService.publishLayer(param);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/getLayer")
|
||||
public AjaxResult getLayer(@RequestBody Map map) throws Exception {
|
||||
Map layer = layerService.getLayer(map.get("tableName").toString(), map.get("spaceType").toString());
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
@GetMapping("/getLayerStyle")
|
||||
public AjaxResult getLayerStyle() {
|
||||
Map layer = layerService.getLayerStyle();
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getLayerStyleAndType")
|
||||
public AjaxResult getLayerStyles() {
|
||||
Map layer = layerService.getLayerStyles();
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
@PostMapping("/saveLayerStyle")
|
||||
public AjaxResult saveLayerStyle(@RequestBody StyleDataVo styleDataVo) throws Exception {
|
||||
System.out.println(styleDataVo.toString());
|
||||
Map map = layerService.saveLayerStyle(styleDataVo);
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@PostMapping("/updateLayerStyle")
|
||||
public AjaxResult updateLayerStyle(@RequestBody StyleDataVo styleDataVo) throws Exception {
|
||||
Map map = layerService.updateLayerStyle(styleDataVo);
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@GetMapping("/deleteLayerStyle/{styleName}")
|
||||
public AjaxResult deleteLayerStyle(@PathVariable("styleName") String styleName) {
|
||||
Map layer = layerService.deleteLayerStyle(styleName);
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
@PostMapping("/getLayerData")
|
||||
public AjaxResult getLayerStyle(@RequestBody Map map) {
|
||||
Map layer = layerService.getLayerDataList(map);
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
@PostMapping("/transWkb")
|
||||
public AjaxResult wkbToWkt(@RequestBody Map map) throws Exception {
|
||||
String layer = layerService.wkbToWkt(map.get("geom").toString());
|
||||
return AjaxResult.success(layer);
|
||||
}
|
||||
|
||||
@PostMapping("/getSingleDate")
|
||||
public AjaxResult getSingleDate(@RequestBody Map map) throws Exception {
|
||||
Map map1 = layerService.getSingleData(map);
|
||||
return AjaxResult.success(map1);
|
||||
}
|
||||
|
||||
@PostMapping("/updateLayerData")
|
||||
public AjaxResult updateLayerData(@RequestBody Map map) {
|
||||
layerService.updateShpData(map);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/insertLayerData")
|
||||
public AjaxResult insertLayerData(@RequestBody Map map) {
|
||||
layerService.insertShpData(map);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteData")
|
||||
public AjaxResult deleteLayerData(@RequestBody Map map) {
|
||||
layerService.deleteShpData(map);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/uploadExcelFile")
|
||||
public AjaxResult uploadFile(PartFileVo fileVo) throws Exception {
|
||||
if (!fileVo.getFile().isEmpty()) {
|
||||
Map tableName = layerService.uploadExcelFile(fileVo);
|
||||
return AjaxResult.success(tableName);
|
||||
}
|
||||
return AjaxResult.error("上传文件失败,请联系管理员");
|
||||
}
|
||||
|
||||
@GetMapping("/getGeomData/{tableValue}")
|
||||
public AjaxResult getGeomData(@PathVariable("tableValue") String tableValue) {
|
||||
String geomData = layerService.getGeomData(tableValue);
|
||||
return AjaxResult.success(geomData);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/downloadColumn/{tableName}")
|
||||
public void downloadColumn(@PathVariable("tableName") String tableName, HttpServletResponse response) {
|
||||
layerService.downloadModel(tableName, response);
|
||||
}
|
||||
|
||||
@GetMapping("/downloadRelation/{tableName}")
|
||||
public AjaxResult downloadRelation(@PathVariable("tableName") String tableName, HttpServletResponse response) {
|
||||
Boolean aBoolean = layerService.downloadRelation(tableName, response);
|
||||
if (aBoolean) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error("数据有误!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/uploadModelData")
|
||||
public AjaxResult uploadModelData(MultipartFile file) throws Exception {
|
||||
Map tableName = layerService.uploadModelData(file);
|
||||
return AjaxResult.success(tableName);
|
||||
}
|
||||
|
||||
@PostMapping("/createDataStore")
|
||||
public AjaxResult createDataStore(@RequestBody Map map) throws Exception {
|
||||
Map result = layerService.insertIntoDataStore(map);
|
||||
String tableName = result.get("tableName").toString();
|
||||
layerService.addLayer(tableName);
|
||||
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getShpRelation/{tableName}")
|
||||
public AjaxResult createDataStore(@PathVariable("tableName") String tableName) throws Exception {
|
||||
String result = layerService.getShpRelation(tableName);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/getColumnByName")
|
||||
public AjaxResult getColumnByName(@RequestBody Map map) throws Exception {
|
||||
List<String> result = layerService.getColumnByName(map);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/downLoadShpZip/{tableName}")
|
||||
public AjaxResult downLoadShpZip(@PathVariable("tableName") String tableName) throws Exception {
|
||||
String result = layerService.downLoadShpZipFile(tableName);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/downLoadDataShpZip/{tableName}")
|
||||
public AjaxResult downLoadDataShpZip(@PathVariable("tableName") String tableName) throws Exception {
|
||||
layerService.downLoadShpZipFile(tableName);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/publishLayerLocal/{tableValue}")
|
||||
public AjaxResult publishLayerLocal(@PathVariable("tableValue") String tableValue) {
|
||||
layerService.addLayerLocal(tableValue);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/uploadStyle")
|
||||
public AjaxResult uploadStyle(PartFileVo data) throws Exception {
|
||||
|
||||
Boolean aBoolean = layerService.publishStyle(data);
|
||||
if (aBoolean) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error("发布样式失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.TUser;
|
||||
import com.zzlh.es.service.LoginService;
|
||||
import com.zzlh.es.service.TUserService;
|
||||
import com.zzlh.es.exception.BusinessException;
|
||||
import com.zzlh.es.utils.RedisUtil;
|
||||
import com.zzlh.es.utils.VerifyCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.zzlh.es.constant.Constants.BAN;
|
||||
import static com.zzlh.es.constant.HttpStatus.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "登录相关接口")
|
||||
public class LoginController {
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private TUserService tUserService;
|
||||
|
||||
@PostMapping("/getVerifyCode")
|
||||
@ApiOperation(value = "/getVerifyCode", notes = "获取二维码")
|
||||
public void getVerifyCode(HttpServletResponse response, String username, String password) {
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
|
||||
throw new BusinessException(USERNAME_PASSWORD_NOT_NULL, "请先输入正确的账号和密码");
|
||||
}
|
||||
TUser user = tUserService.findByName(username);
|
||||
if (user == null || user.getState().equals("1")) {
|
||||
throw new BusinessException(USER_BAN, "用户不存在或被封禁");
|
||||
}
|
||||
Map<String, Object> map = VerifyCodeUtil.getVerifyCode();
|
||||
// 禁止图像缓存。
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setContentType("image/jpeg");
|
||||
// 将图像输出到Servlet输出流中。
|
||||
if (!redisUtil.set(username + VerifyCodeUtil.SESSION_KEY, map.get(VerifyCodeUtil.SESSION_KEY), 60000)) {
|
||||
throw new BusinessException(IMAGE_FAILED, "图片验证码生成失败请刷新重试");
|
||||
}
|
||||
try {
|
||||
ServletOutputStream sos = response.getOutputStream();
|
||||
ImageIO.write((RenderedImage) map.get(VerifyCodeUtil.BUFFIMG_KEY), "jpeg", sos);
|
||||
sos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/auth/login")
|
||||
@ApiOperation(value = "/auth/login", notes = "登录")
|
||||
public AjaxResult getToken(String username, String password, String verifyCode) {
|
||||
if (!StringUtils.isEmpty(username) || !StringUtils.isEmpty(password)) {
|
||||
TUser user = tUserService.findByName(username);
|
||||
if (user == null || user.getState().equals(BAN)) {
|
||||
return AjaxResult.error(USER_BAN, "用户被封禁");
|
||||
} else {
|
||||
// if (StringUtils.isEmpty(verifyCode)) {
|
||||
// return AjaxResult.error(IMAGE_ERROR, "请输入正确的图片验证信息");
|
||||
// } else {
|
||||
// if (!verifyCode.equals(redisUtil.get(username + VerifyCodeUtil.SESSION_KEY))) {
|
||||
// return AjaxResult.error(IMAGE_ERROR, "图片验证码不正确或已经过期");
|
||||
// }
|
||||
String token = loginService.login(username, password);
|
||||
//if (token != null && redisUtil.del(username + VerifyCodeUtil.SESSION_KEY)) {
|
||||
return AjaxResult.success(token);
|
||||
//}
|
||||
// return AjaxResult.error(LOGIN_FAILED, "登录失败");
|
||||
// }
|
||||
}
|
||||
}
|
||||
return AjaxResult.error(USERNAME_PASSWORD_NOT_NULL, "请先输入正确的账号和密码");
|
||||
}
|
||||
|
||||
@PostMapping("/auth/logout")
|
||||
@ApiOperation(value = "/auth/logout", notes = "登出")
|
||||
public AjaxResult getToken(HttpServletRequest request) {
|
||||
|
||||
String authorization = request.getHeader("Authorization");
|
||||
return loginService.logout(authorization);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.zzlh.es.controller;
|
||||
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.StyleServerMapbox;
|
||||
import com.zzlh.es.service.IStyleImageService;
|
||||
import com.zzlh.es.service.IStyleServerMapboxService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.ID_NULL_STYLE;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/style")
|
||||
@Api(value = "/style", tags = "样式管理", description = "提供样式管理的api")
|
||||
public class StyleManagerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IStyleImageService iStyleImageService;
|
||||
|
||||
@Autowired
|
||||
private IStyleServerMapboxService iStyleServerMapboxService;
|
||||
|
||||
/**
|
||||
* 根据serverName修改样式内容
|
||||
*
|
||||
* @param styleServerMapbox
|
||||
* @return
|
||||
*/
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation(value = "/update", notes = "更新样式")
|
||||
public AjaxResult updateStyle(@RequestBody StyleServerMapbox styleServerMapbox) {
|
||||
return iStyleServerMapboxService.updateStyle(styleServerMapbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取样式信息
|
||||
*
|
||||
* @param serverName
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getInfo")
|
||||
@ApiOperation(value = "/getInfo", notes = "根据serverName获取样式")
|
||||
public AjaxResult getInfo(String serverName) {
|
||||
return iStyleServerMapboxService.findStyleById(serverName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据severName获取拼接url
|
||||
*
|
||||
* @param serverName
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getUrlByServerName")
|
||||
@ApiOperation(value = "/getUrlByServerName", notes = "根据serverName获取url")
|
||||
public AjaxResult getUrlByServerName(String serverName) {
|
||||
return iStyleServerMapboxService.getUrlByServerName(serverName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传图标文件
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadStyleImage")
|
||||
@ApiOperation(value = "/uploadStyleImage", notes = "上传图标文件")
|
||||
public AjaxResult uploadStyleImage(HttpServletRequest request) throws IOException {
|
||||
return iStyleImageService.uploadStyleImage(request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取资料库所有的图标url
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getAllStyleImage")
|
||||
@ApiOperation(value = "/getAllStyleImage", notes = "获取资料库所有的图标url")
|
||||
public AjaxResult getAllStyleImage() {
|
||||
return iStyleImageService.getAllStyleImage();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除选中图标
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/deleteIds/{ids}")
|
||||
@ApiOperation(value = "/deleteIds/{ids}", notes = "请选中图标或图标已删除")
|
||||
public AjaxResult deleteIds(@PathVariable int[] ids) {
|
||||
if (ids.length < 1) {
|
||||
return AjaxResult.error(ID_NULL_STYLE, "请选中图标或图标已删除");
|
||||
}
|
||||
return iStyleImageService.deleteIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package com.zzlh.es.controller;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTManager;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSLayerGroupEncoder;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Base64;
|
||||
|
||||
public class Test {
|
||||
|
||||
private static final String GEOSERVER_URL = "http://localhost:8180/geoserver/rest";
|
||||
private static final String GEOSERVER_USERNAME = "admin";
|
||||
private static final String GEOSERVER_PASSWORD = "geoserver";
|
||||
|
||||
|
||||
public static void exist(String workspace) throws Exception{
|
||||
String url = GEOSERVER_URL+ "/workspaces/"+workspace+".xml";
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
httpGet.setHeader("Authorization", getBasicAuthHeader(GEOSERVER_USERNAME, GEOSERVER_PASSWORD));
|
||||
|
||||
|
||||
httpClient.execute(httpGet, response -> {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
System.out.println("图层组创建成功");
|
||||
} else {
|
||||
System.out.println("图层组创建失败: " + EntityUtils.toString(response.getEntity()));
|
||||
}
|
||||
return statusCode;
|
||||
});
|
||||
}
|
||||
|
||||
public static void ceshi() throws Exception{
|
||||
URL u = new URL("http://localhost:8180/geoserver");
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, GEOSERVER_USERNAME, GEOSERVER_PASSWORD);
|
||||
GeoServerRESTPublisher publisher = manager.getPublisher();
|
||||
GSLayerGroupEncoder groupEncoder = new GSLayerGroupEncoder();
|
||||
groupEncoder.setName("my_workspace:geoserver371212");
|
||||
groupEncoder.setWorkspace("my_workspace");
|
||||
boolean myWorkspace = publisher.createLayerGroup("my_workspace","my_workspace:geoserver371212", groupEncoder);
|
||||
}
|
||||
public static void publishLayerGroup(String workspace, String storeName, String layerGroupName) throws Exception {
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
String layerGroupUrl = GEOSERVER_URL + "/workspaces/" + workspace + "/layergroups";
|
||||
// 创建图层组
|
||||
String createLayerGroupPayload = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||
"<layerGroup>" +
|
||||
" <name>" + layerGroupName + "</name>" +
|
||||
" <workspace>" +
|
||||
" <name>" + workspace + "</name>" +
|
||||
" </workspace>" +
|
||||
" <layers>" +
|
||||
" <layer>my_workspace:geoserver371302</layer>" +
|
||||
" <layer>my_workspace:geoserver371212</layer>" +
|
||||
" </layers>" +
|
||||
"</layerGroup>";
|
||||
|
||||
HttpPost createLayerGroupRequest = new HttpPost(layerGroupUrl);
|
||||
createLayerGroupRequest.setHeader("Content-Type", "text/xml");
|
||||
createLayerGroupRequest.setHeader("Authorization", getBasicAuthHeader(GEOSERVER_USERNAME, GEOSERVER_PASSWORD));
|
||||
createLayerGroupRequest.setEntity(new StringEntity(createLayerGroupPayload, ContentType.APPLICATION_XML));
|
||||
|
||||
httpClient.execute(createLayerGroupRequest, response -> {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
System.out.println("图层组创建成功");
|
||||
} else {
|
||||
System.out.println("图层组创建失败: " + EntityUtils.toString(response.getEntity()));
|
||||
}
|
||||
return statusCode;
|
||||
});
|
||||
|
||||
// 添加图层到组
|
||||
String addLayerToGroupPayload = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||
"<layerGroup>" +
|
||||
" <layer>" +
|
||||
" <name>my_workspace:geoserver371212</name>" +
|
||||
" </layer>" +
|
||||
"</layerGroup>";
|
||||
|
||||
HttpPost addLayerToGroupRequest = new HttpPost(GEOSERVER_URL + "/layers/" + workspace + ":" + storeName + "/group/" + layerGroupName + ".xml");
|
||||
addLayerToGroupRequest.setHeader("Content-Type", "text/xml");
|
||||
addLayerToGroupRequest.setHeader("Authorization", getBasicAuthHeader(GEOSERVER_USERNAME, GEOSERVER_PASSWORD));
|
||||
addLayerToGroupRequest.setEntity(new StringEntity(addLayerToGroupPayload, ContentType.APPLICATION_XML));
|
||||
|
||||
httpClient.execute(addLayerToGroupRequest, response -> {
|
||||
int statusCode = response.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
System.out.println("图层添加到组成功");
|
||||
} else {
|
||||
System.out.println("图层添加到组失败: " + EntityUtils.toString(response.getEntity()));
|
||||
}
|
||||
return statusCode;
|
||||
});
|
||||
|
||||
httpClient.close();
|
||||
}
|
||||
|
||||
private static String getBasicAuthHeader(String username, String password) {
|
||||
String credentials = username + ":" + password;
|
||||
String encodedCredentials = new String(Base64.getEncoder().encode(credentials.getBytes()));
|
||||
return "Basic " + encodedCredentials;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
try {
|
||||
publishLayerGroup("my_workspace", "ceshi2", "ceshi2");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// ceshi();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,208 @@
|
|||
package com.zzlh.es.domain;
|
||||
|
||||
|
||||
|
||||
import com.zzlh.es.constant.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 操作消息提醒
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class AjaxResult extends HashMap<String, Object>
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 状态码 */
|
||||
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(HttpStatus.SUCCESS, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static AjaxResult warn(String msg)
|
||||
{
|
||||
return AjaxResult.warn(msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回警告消息
|
||||
*
|
||||
* @param msg 返回内容
|
||||
* @param data 数据对象
|
||||
* @return 警告消息
|
||||
*/
|
||||
public static AjaxResult warn(String msg, Object data)
|
||||
{
|
||||
return new AjaxResult(HttpStatus.WARN, 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(HttpStatus.ERROR, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param msg 返回内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult error(int code, String msg)
|
||||
{
|
||||
return new AjaxResult(code, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为成功消息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isSuccess()
|
||||
{
|
||||
return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为错误消息
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean isError()
|
||||
{
|
||||
return !isSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 方便链式调用
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult put(String key, Object value)
|
||||
{
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.zzlh.es.domain;
|
||||
|
||||
|
||||
|
||||
import com.zzlh.es.constant.Constants;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 成功 */
|
||||
public static final int SUCCESS = Constants.SUCCESS;
|
||||
|
||||
/** 失败 */
|
||||
public static final int FAIL = Constants.FAIL;
|
||||
|
||||
private int code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
{
|
||||
return restResult(null, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data)
|
||||
{
|
||||
return restResult(data, SUCCESS, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> ok(T data, String msg)
|
||||
{
|
||||
return restResult(data, SUCCESS, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail()
|
||||
{
|
||||
return restResult(null, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(String msg)
|
||||
{
|
||||
return restResult(null, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data)
|
||||
{
|
||||
return restResult(data, FAIL, null);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(T data, String msg)
|
||||
{
|
||||
return restResult(data, FAIL, msg);
|
||||
}
|
||||
|
||||
public static <T> R<T> fail(int code, String msg)
|
||||
{
|
||||
return restResult(null, code, msg);
|
||||
}
|
||||
|
||||
private static <T> R<T> restResult(T data, int code, String msg)
|
||||
{
|
||||
R<T> apiResult = new R<>();
|
||||
apiResult.setCode(code);
|
||||
apiResult.setData(data);
|
||||
apiResult.setMsg(msg);
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public T getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> Boolean isError(R<T> ret)
|
||||
{
|
||||
return !isSuccess(ret);
|
||||
}
|
||||
|
||||
public static <T> Boolean isSuccess(R<T> ret)
|
||||
{
|
||||
return R.SUCCESS == ret.getCode();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Data
|
||||
public class ApplicationBo {
|
||||
/**
|
||||
* 应用id
|
||||
*/
|
||||
private Integer applicationId;
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String applicationName;
|
||||
|
||||
/**
|
||||
* 服务id
|
||||
*/
|
||||
private String serverStoreId;
|
||||
/**
|
||||
* 项目组id
|
||||
*/
|
||||
private Integer projectDataRelationId;
|
||||
|
||||
/**
|
||||
* 项目组名称
|
||||
*/
|
||||
private String projectTeamName;
|
||||
/**
|
||||
* 图层名称
|
||||
*/
|
||||
private String serverName;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("application_data")
|
||||
@ApiModel(value="ApplicationData对象", description="")
|
||||
public class ApplicationData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "应用名称")
|
||||
@TableField("application_name")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "空间坐标(4326)")
|
||||
@TableField("space_type")
|
||||
private String spaceType;
|
||||
|
||||
@ApiModelProperty(value = "Cesium Mapbox Mars3d")
|
||||
@TableField("map_frame")
|
||||
private String mapFrame;
|
||||
|
||||
@ApiModelProperty(value = "底图(天地图)")
|
||||
@TableField("underlay")
|
||||
private String underlay;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Entity基类
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
@Data
|
||||
public class BaseEntity implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 搜索值 */
|
||||
@JsonIgnore
|
||||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 请求参数 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private Map<String, Object> params;
|
||||
|
||||
|
||||
public Map<String, Object> getParams()
|
||||
{
|
||||
if (params == null)
|
||||
{
|
||||
params = new HashMap<>();
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zzlh.es.annotation.Excel;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
/**
|
||||
* 图层存储表对象 data_store
|
||||
*
|
||||
* @author LGD
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
@TableName(value = "data_store")
|
||||
public class DataStore extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
/** 服务名称 */
|
||||
@Excel(name = "服务名称")
|
||||
private String severName;
|
||||
|
||||
/** 空间坐标 */
|
||||
@Excel(name = "空间坐标")
|
||||
private String spaceType;
|
||||
|
||||
/** 服务类型 */
|
||||
@Excel(name = "服务类型")
|
||||
private String severType;
|
||||
|
||||
/** 存储类型 */
|
||||
@Excel(name = "存储类型")
|
||||
private String storeType;
|
||||
|
||||
/** 数据源类型 */
|
||||
@Excel(name = "数据源类型")
|
||||
private String datasourceType;
|
||||
|
||||
/** 关联数据表 */
|
||||
@Excel(name = "关联数据表")
|
||||
private String tableRef;
|
||||
|
||||
/** 是否发布 */
|
||||
@Excel(name = "是否发布")
|
||||
private Long isDisplay;
|
||||
|
||||
@Excel(name = "点线面")
|
||||
private String dataType;
|
||||
|
||||
private String styleName;
|
||||
|
||||
private String nameRef;
|
||||
|
||||
private String areaName;
|
||||
|
||||
private String relation;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setSeverName(String severName)
|
||||
{
|
||||
this.severName = severName;
|
||||
}
|
||||
|
||||
public String getSeverName()
|
||||
{
|
||||
return severName;
|
||||
}
|
||||
public void setSpaceType(String spaceType)
|
||||
{
|
||||
this.spaceType = spaceType;
|
||||
}
|
||||
|
||||
public String getSpaceType()
|
||||
{
|
||||
return spaceType;
|
||||
}
|
||||
public void setSeverType(String severType)
|
||||
{
|
||||
this.severType = severType;
|
||||
}
|
||||
|
||||
public String getSeverType()
|
||||
{
|
||||
return severType;
|
||||
}
|
||||
public void setStoreType(String storeType)
|
||||
{
|
||||
this.storeType = storeType;
|
||||
}
|
||||
|
||||
public String getStoreType()
|
||||
{
|
||||
return storeType;
|
||||
}
|
||||
public void setDatasourceType(String datasourceType)
|
||||
{
|
||||
this.datasourceType = datasourceType;
|
||||
}
|
||||
|
||||
public String getDatasourceType()
|
||||
{
|
||||
return datasourceType;
|
||||
}
|
||||
public void setTableRef(String tableRef)
|
||||
{
|
||||
this.tableRef = tableRef;
|
||||
}
|
||||
|
||||
public String getTableRef()
|
||||
{
|
||||
return tableRef;
|
||||
}
|
||||
public void setIsDisplay(Long isDisplay)
|
||||
{
|
||||
this.isDisplay = isDisplay;
|
||||
}
|
||||
|
||||
public Long getIsDisplay()
|
||||
{
|
||||
return isDisplay;
|
||||
}
|
||||
|
||||
|
||||
public void setDataType(String dataType)
|
||||
{
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDataType()
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setStyleName(String styleName)
|
||||
{
|
||||
this.styleName = styleName;
|
||||
}
|
||||
|
||||
public String getStyleName()
|
||||
{
|
||||
return styleName;
|
||||
}
|
||||
|
||||
public void setNameRef(String nameRef)
|
||||
{
|
||||
this.nameRef = nameRef;
|
||||
}
|
||||
|
||||
public String getNameRef()
|
||||
{
|
||||
return nameRef;
|
||||
}
|
||||
|
||||
public void setAreaName(String areaName)
|
||||
{
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public String getAreaName()
|
||||
{
|
||||
return areaName;
|
||||
}
|
||||
|
||||
public void setRelation(String relation)
|
||||
{
|
||||
this.relation = relation;
|
||||
}
|
||||
|
||||
public String getRelation()
|
||||
{
|
||||
return relation;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("severName", getSeverName())
|
||||
.append("spaceType", getSpaceType())
|
||||
.append("severType", getSeverType())
|
||||
.append("storeType", getStoreType())
|
||||
.append("datasourceType", getDatasourceType())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("tableRef", getTableRef())
|
||||
.append("isDisplay", getIsDisplay())
|
||||
.append("dataType",getDataType())
|
||||
.append("styleName",getStyleName())
|
||||
.append("nameRef",getNameRef())
|
||||
.append("areaName",getAreaName())
|
||||
.append("relation",getRelation())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("dict_data")
|
||||
@ApiModel(value="DictData对象", description="")
|
||||
public class DictData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private BigDecimal id;
|
||||
|
||||
@ApiModelProperty(value = "字典名称")
|
||||
private String dictLabel;
|
||||
|
||||
@ApiModelProperty(value = "字典值")
|
||||
private String dictValue;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String dictType;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件上传记录
|
||||
* </p>
|
||||
*
|
||||
* @author haijun
|
||||
* @since 2020-02-14
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_file_record")
|
||||
public class FileRecord extends Model<FileRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 记录ID
|
||||
*/
|
||||
@TableId(value="id",type=IdType.ID_WORKER_STR)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 源文件名
|
||||
*/
|
||||
@TableField("org_name")
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 服务器生成的文件名
|
||||
*/
|
||||
@TableField("server_local_name")
|
||||
private String serverLocalName;
|
||||
|
||||
/**
|
||||
* 服务器储存路径
|
||||
*/
|
||||
@TableField("server_local_path")
|
||||
private String serverLocalPath;
|
||||
|
||||
/**
|
||||
* 网络路径,生成的文件夹+系统生成文件名
|
||||
*/
|
||||
@TableField("network_path")
|
||||
private String networkPath;
|
||||
|
||||
/**
|
||||
* 上传类型
|
||||
*/
|
||||
@TableField("upload_type")
|
||||
private Integer uploadType;
|
||||
|
||||
/**
|
||||
* 文件MD5值
|
||||
*/
|
||||
@TableField("md5_value")
|
||||
private String md5Value;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
@TableField("file_size")
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* 是否分片 0 否 1是
|
||||
*/
|
||||
@TableField("is_zone")
|
||||
private Integer isZone;
|
||||
|
||||
/**
|
||||
* 分片总数
|
||||
*/
|
||||
@TableField("zone_total")
|
||||
private Integer zoneTotal;
|
||||
|
||||
/**
|
||||
* 分片时间
|
||||
*/
|
||||
@TableField("zone_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zoneDate;
|
||||
|
||||
/**
|
||||
* 分片合并时间
|
||||
*/
|
||||
@TableField("zone_merge_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zoneMergeDate;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
@TableField("file_type")
|
||||
private String fileType;
|
||||
|
||||
/**
|
||||
* 设备信息
|
||||
*/
|
||||
@TableField("upload_device")
|
||||
private String uploadDevice;
|
||||
|
||||
/**
|
||||
* 上传设备IP
|
||||
*/
|
||||
@TableField("upload_ip")
|
||||
private String uploadIp;
|
||||
|
||||
/**
|
||||
* 储存日期
|
||||
*/
|
||||
@TableField("storage_date")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date storageDate;
|
||||
|
||||
/**
|
||||
* 下载统计
|
||||
*/
|
||||
@TableField("download_count")
|
||||
private Integer downloadCount;
|
||||
|
||||
/**
|
||||
* 上传统计
|
||||
*/
|
||||
@TableField("upload_count")
|
||||
private Integer uploadCount;
|
||||
|
||||
/**
|
||||
* 是否合并
|
||||
*/
|
||||
@TableField("is_merge")
|
||||
private Integer isMerge;
|
||||
|
||||
/**
|
||||
* 上传人员
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 上传日期
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 1正常 -1删除
|
||||
*/
|
||||
@TableField("del_flag")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
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 lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件分片记录
|
||||
* </p>
|
||||
*
|
||||
* @author haijun
|
||||
* @since 2020-02-14
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_file_zone_record")
|
||||
//@ApiModel(value = "文件分片记录,FileZoneRecord")
|
||||
public class FileZoneRecord extends Model<FileZoneRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 分片ID
|
||||
*/
|
||||
@TableId(value="id",type=IdType.ID_WORKER_STR)
|
||||
//@ApiModelProperty(value = "分片ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 分片名称
|
||||
*/
|
||||
@TableField("zone_name")
|
||||
//@ApiModelProperty(value = "分片名称")
|
||||
private String zoneName;
|
||||
|
||||
/**
|
||||
* 分片的文件路径
|
||||
*/
|
||||
@TableField("zone_path")
|
||||
//@ApiModelProperty(value = "分片的文件路径")
|
||||
private String zonePath;
|
||||
|
||||
/**
|
||||
* 分片MD5
|
||||
*/
|
||||
@TableField("zone_md5")
|
||||
//@ApiModelProperty(value = "分片MD5")
|
||||
private String zoneMd5;
|
||||
|
||||
/**
|
||||
* 分片记录MD5值
|
||||
*/
|
||||
@TableField("zone_record_date")
|
||||
//@ApiModelProperty(value = "分片记录MD5值")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zoneRecordDate;
|
||||
|
||||
/**
|
||||
* 上传完成校验日期
|
||||
*/
|
||||
@TableField("zone_check_date")
|
||||
//@ApiModelProperty(value = "上传完成校验日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date zoneCheckDate;
|
||||
|
||||
/**
|
||||
* 总的分片数
|
||||
*/
|
||||
@TableField("zone_total_count")
|
||||
//@ApiModelProperty(value = "总的分片数")
|
||||
private Integer zoneTotalCount;
|
||||
|
||||
/**
|
||||
* 总文件的MD5值
|
||||
*/
|
||||
@TableField("zone_total_md5")
|
||||
//@ApiModelProperty(value = "总文件的MD5值")
|
||||
private String zoneTotalMd5;
|
||||
|
||||
/**
|
||||
* 当前分片索引
|
||||
*/
|
||||
@TableField("zone_now_index")
|
||||
//@ApiModelProperty(value = "当前分片索引")
|
||||
private Integer zoneNowIndex;
|
||||
|
||||
/**
|
||||
* 文件开始位置
|
||||
*/
|
||||
@TableField("zone_start_size")
|
||||
//@ApiModelProperty(value = "文件开始位置")
|
||||
private Long zoneStartSize;
|
||||
|
||||
/**
|
||||
* 文件结束位置
|
||||
*/
|
||||
@TableField("zone_end_size")
|
||||
//@ApiModelProperty(value = "文件结束位置")
|
||||
private Long zoneEndSize;
|
||||
|
||||
/**
|
||||
* 文件总大小
|
||||
*/
|
||||
@TableField("zone_total_size")
|
||||
//@ApiModelProperty(value = "文件总大小")
|
||||
private Long zoneTotalSize;
|
||||
/**
|
||||
* 分片文件后缀
|
||||
*/
|
||||
@TableField("zone_suffix")
|
||||
//@ApiModelProperty(value = "分片文件后缀")
|
||||
private String zoneSuffix;
|
||||
|
||||
/**
|
||||
* 文件记录ID
|
||||
*/
|
||||
@TableField("file_record_id")
|
||||
//@ApiModelProperty(value = "文件记录ID")
|
||||
private String fileRecordId;
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("project_data_relation")
|
||||
@ApiModel(value="ProjectDataRelation对象", description="")
|
||||
public class ProjectDataRelation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "项目组名称")
|
||||
@TableField("project_team_name")
|
||||
private String projectTeamName;
|
||||
|
||||
@ApiModelProperty(value = "应用id")
|
||||
@TableField("application_id")
|
||||
private Integer applicationId;
|
||||
|
||||
@ApiModelProperty(value = "服务id")
|
||||
@TableField("server_store_id")
|
||||
private String serverStoreId;
|
||||
|
||||
@ApiModelProperty(value = "项目组id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "图层服务名称")
|
||||
@TableField("server_name")
|
||||
private String serverName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.zzlh.es.entity.vo.DataRelationMarsVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("project_data_relation_mars")
|
||||
@ApiModel(value="ProjectDataRelationMars对象", description="")
|
||||
public class ProjectDataRelationMars implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "项目组名称")
|
||||
private String projectTeamName;
|
||||
|
||||
@ApiModelProperty(value = "服务id")
|
||||
private String serverStoreId;
|
||||
|
||||
@ApiModelProperty(value = "项目组id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "图层服务名称")
|
||||
private String serverName;
|
||||
|
||||
@ApiModelProperty(value = "json属性")
|
||||
private String attribute;
|
||||
|
||||
@ApiModelProperty(value = "父json属性")
|
||||
private String pAttribute;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "样式属性")
|
||||
private String properties;
|
||||
|
||||
private String areaName;
|
||||
|
||||
private Integer sort;
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
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.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("style_image")
|
||||
@ApiModel(value="StyleImage对象", description="")
|
||||
public class StyleImage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "记录ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "源文件名")
|
||||
private String orgName;
|
||||
|
||||
@ApiModelProperty(value = "服务器生成的文件名")
|
||||
private String serverLocalName;
|
||||
|
||||
@ApiModelProperty(value = "服务器储存路径")
|
||||
private String serverLocalPath;
|
||||
|
||||
@ApiModelProperty(value = "网络路径,生成的文件夹+系统生成文件名")
|
||||
private String networkPath;
|
||||
|
||||
@ApiModelProperty(value = "文件MD5值")
|
||||
private String md5Value;
|
||||
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
@ApiModelProperty(value = "文件类型")
|
||||
private String fileType;
|
||||
|
||||
@ApiModelProperty(value = "设备信息")
|
||||
private String uploadDevice;
|
||||
|
||||
@ApiModelProperty(value = "上传设备IP")
|
||||
private String uploadIp;
|
||||
|
||||
@ApiModelProperty(value = "上传统计")
|
||||
private Integer uploadCount;
|
||||
|
||||
@ApiModelProperty(value = "上传人员")
|
||||
private String createBy;
|
||||
|
||||
@TableField("create_time")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("style_parameter_mapbox")
|
||||
@ApiModel(value="StyleParameterMapbox对象", description="")
|
||||
public class StyleParameterMapbox implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "点属性")
|
||||
private String symbol;
|
||||
|
||||
@ApiModelProperty(value = "线属性")
|
||||
private String line;
|
||||
|
||||
@ApiModelProperty(value = "面 多面属性")
|
||||
private String fill;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("style_parameter_mars")
|
||||
@ApiModel(value="StyleParameterMars对象", description="")
|
||||
public class StyleParameterMars implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "点属性json")
|
||||
private String symbol;
|
||||
|
||||
@ApiModelProperty(value = "线 面 多面属性")
|
||||
private String lineAndFill;
|
||||
|
||||
@ApiModelProperty(value = "父 json")
|
||||
private String pattr;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.zzlh.es.annotation.Excel;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 样式对象 style_record
|
||||
*
|
||||
* @author lgd
|
||||
* @date 2023-08-09
|
||||
*/
|
||||
public class StyleRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 样式名称 */
|
||||
@Excel(name = "样式名称")
|
||||
private String styleName;
|
||||
|
||||
/** 样式类型 */
|
||||
@Excel(name = "样式类型")
|
||||
private Integer type;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String fillColor;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String fillOpacity;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String strokeColor;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Double strokeWidth;
|
||||
|
||||
public void setStyleName(String styleName)
|
||||
{
|
||||
this.styleName = styleName;
|
||||
}
|
||||
|
||||
public String getStyleName()
|
||||
{
|
||||
return styleName;
|
||||
}
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setFillColor(String fillColor)
|
||||
{
|
||||
this.fillColor = fillColor;
|
||||
}
|
||||
|
||||
public String getFillColor()
|
||||
{
|
||||
return fillColor;
|
||||
}
|
||||
public void setFillOpacity(String fillOpacity)
|
||||
{
|
||||
this.fillOpacity = fillOpacity;
|
||||
}
|
||||
|
||||
public String getFillOpacity()
|
||||
{
|
||||
return fillOpacity;
|
||||
}
|
||||
public void setStrokeColor(String strokeColor)
|
||||
{
|
||||
this.strokeColor = strokeColor;
|
||||
}
|
||||
|
||||
public String getStrokeColor()
|
||||
{
|
||||
return strokeColor;
|
||||
}
|
||||
public void setStrokeWidth(Double strokeWidth)
|
||||
{
|
||||
this.strokeWidth = strokeWidth;
|
||||
}
|
||||
|
||||
public Double getStrokeWidth()
|
||||
{
|
||||
return strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("styleName", getStyleName())
|
||||
.append("type", getType())
|
||||
.append("fillColor", getFillColor())
|
||||
.append("fillOpacity", getFillOpacity())
|
||||
.append("strokeColor", getStrokeColor())
|
||||
.append("strokeWidth", getStrokeWidth())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("style_server_mapbox")
|
||||
@ApiModel(value="StyleServerMapbox对象", description="")
|
||||
public class StyleServerMapbox implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "点属性")
|
||||
private String symbol;
|
||||
|
||||
@ApiModelProperty(value = "线属性")
|
||||
private String line;
|
||||
|
||||
@ApiModelProperty(value = "面 多面属性")
|
||||
private String fill;
|
||||
|
||||
@ApiModelProperty(value = "图层服务名称")
|
||||
private String serverName;
|
||||
|
||||
@ApiModelProperty(value = "图标url")
|
||||
private String imgUrl;
|
||||
|
||||
@ApiModelProperty(value = "x位移数据")
|
||||
private String x;
|
||||
|
||||
@ApiModelProperty(value = "y位移数据")
|
||||
private String y;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
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 lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 描述:用户表实体
|
||||
* @author: shf
|
||||
* @date: 2019-04-19 16:24:04
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("t_user")
|
||||
public class TUser extends Model<TUser> {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id",type= IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@TableField("username")
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@TableField("password")
|
||||
private String password;
|
||||
/**
|
||||
* 用户角色
|
||||
*/
|
||||
@TableField("salt")
|
||||
private String salt;
|
||||
/**
|
||||
* 账号状态
|
||||
*/
|
||||
@TableField("state")
|
||||
private String state;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import com.zzlh.es.entity.vo.DataRelationMarsVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 封装图层树的业务bo
|
||||
*
|
||||
* @author soeasy
|
||||
*/
|
||||
@Data
|
||||
public class TreeLabelMarsApp {
|
||||
public String serverName;
|
||||
|
||||
public List<Long> ids;
|
||||
|
||||
public Long id;
|
||||
public List<DataRelationMarsVo> children;
|
||||
|
||||
public String attr;
|
||||
|
||||
public Integer sort;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 封装图层树的业务bo
|
||||
* @author soeasy
|
||||
*/
|
||||
@Data
|
||||
public class TreeLableBo {
|
||||
public String serverName;
|
||||
|
||||
public List<Integer> ids;
|
||||
public List<ApplicationBo> children;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.zzlh.es.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 封装图层树的业务bo
|
||||
*
|
||||
* @author soeasy
|
||||
*/
|
||||
@Data
|
||||
public class TreeLableMarsBo {
|
||||
public String serverName;
|
||||
|
||||
public List<Long> ids;
|
||||
|
||||
public Long id;
|
||||
public List<ProjectDataRelationMars> children;
|
||||
|
||||
public String attr;
|
||||
|
||||
public Integer sort;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.zzlh.es.entity.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@ConfigurationProperties(prefix = "jwt")
|
||||
@Data
|
||||
@Component
|
||||
public class JwtProperties {
|
||||
/**
|
||||
* request header key
|
||||
*/
|
||||
private String Header;
|
||||
/**
|
||||
* 秘钥
|
||||
*/
|
||||
private String Secret;
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private long Expiration;
|
||||
/**
|
||||
* token 的header
|
||||
*/
|
||||
private String TokenHead;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.zzlh.es.entity.vo;
|
||||
|
||||
import com.zzlh.es.entity.ProjectDataRelationMars;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataRelationMarsVo extends ProjectDataRelationMars {
|
||||
|
||||
private String url;
|
||||
|
||||
private String layers;
|
||||
|
||||
private String type;
|
||||
|
||||
private String image;
|
||||
|
||||
private String geomType;
|
||||
|
||||
private String label;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@Data
|
||||
public class PartFileVo {
|
||||
|
||||
private MultipartFile file;
|
||||
|
||||
private String spaceType;
|
||||
|
||||
private String tableName;
|
||||
private String styleName;
|
||||
|
||||
private String serverName;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.zzlh.es.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StyleDataVo {
|
||||
|
||||
private String styleName;
|
||||
|
||||
private String fillColor;
|
||||
|
||||
private String fillOpacity;
|
||||
|
||||
private String strokeColor;
|
||||
|
||||
private String strokeWidth;
|
||||
|
||||
//0 点 1线 2面
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.zzlh.es.entity.vo;
|
||||
|
||||
import com.zzlh.es.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TableDataVo extends BaseEntity {
|
||||
|
||||
private String tableName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.zzlh.es.exception;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 业务异常处理
|
||||
*
|
||||
* @author soeasy
|
||||
*/
|
||||
@Data
|
||||
public class BusinessException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* 异常对应的返回码
|
||||
*/
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* 异常对应的描述信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
private Throwable throwable;
|
||||
|
||||
public BusinessException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BusinessException(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BusinessException(Integer code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BusinessException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
this.message = String.format("%s %s", message, cause.getMessage());
|
||||
}
|
||||
|
||||
public BusinessException(int code, String message, Throwable throwable) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.throwable = throwable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zzlh.es.exception;
|
||||
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
@SuppressWarnings("unchecked")
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
/**
|
||||
* 处理所有不可知的异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Map handleException(Exception e){
|
||||
// 打印堆栈信息
|
||||
e.printStackTrace();
|
||||
Map map = new HashMap();
|
||||
map.put("code",e.hashCode());
|
||||
map.put("msg","系统错误,请联系管理员");
|
||||
return map;
|
||||
}
|
||||
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public AjaxResult handleBadRequestException(BusinessException e){
|
||||
// 打印堆栈信息
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error(e.getCode(),e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.zzlh.es.exception;
|
||||
|
||||
/**
|
||||
* 工具类异常
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.ApplicationBo;
|
||||
import com.zzlh.es.entity.ApplicationData;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
public interface ApplicationDataMapper extends BaseMapper<ApplicationData>{
|
||||
|
||||
boolean insertApplicationData(ApplicationData applicationData);
|
||||
@Select("select*from application_data")
|
||||
List<ApplicationData> getAllApplication();
|
||||
|
||||
@Select("select application_data.id application_id,application_data.application_name,project_data_relation.server_store_id,project_data_relation.id project_data_relation_id,project_data_relation.project_team_name,project_data_relation.server_name from application_data,project_data_relation where application_data.id= project_data_relation.application_id and application_data.id=#{id}")
|
||||
@ResultMap("applicationBo")
|
||||
List<ApplicationBo> getApplicationById(@Param("id") Integer id);
|
||||
|
||||
@Select("select project_data_relation.server_store_id,project_data_relation.id project_data_relation_id,project_data_relation.project_team_name,project_data_relation.server_name from project_data_relation ")
|
||||
@ResultMap("applicationBo")
|
||||
List<ApplicationBo> getProjectById();
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
|
||||
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图层存储表Mapper接口
|
||||
*
|
||||
* @author LGD
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataStoreMapper
|
||||
{
|
||||
/**
|
||||
* 查询图层存储表
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 图层存储表
|
||||
*/
|
||||
public DataStore selectDataStoreById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图层存储表列表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 图层存储表集合
|
||||
*/
|
||||
public List<DataStore> selectDataStoreList(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 新增图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataStore(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 修改图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataStore(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 删除图层存储表
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataStoreById(Long id);
|
||||
|
||||
public int deleteMapBoxByName(String name);
|
||||
public int selectCountMapBoxById(String id);
|
||||
|
||||
public int selectCountMarsById(String id);
|
||||
/**
|
||||
* 批量删除图层存储表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataStoreByIds(Long[] ids);
|
||||
|
||||
public List<Map> selectDataStoreListByTableName(@Param("value") String value);
|
||||
|
||||
/**
|
||||
* 根据坐标系查询对应的图层服务
|
||||
* @param serverType
|
||||
* @return
|
||||
*/
|
||||
@Select("select *from data_store where space_type=#{spaceType}")
|
||||
List<DataStore> selectDataStore(@Param("dataType") String serverType);
|
||||
|
||||
@Select("select * from data_store where table_ref=#{sever_name}")
|
||||
DataStore selectDataStoreByName(@Param("sever_name") String sever_name);
|
||||
|
||||
@Select("select ${value} ,ST_X(ST_Centroid(geom)) AS lng, ST_Y(ST_Centroid(geom)) AS lat from ${sever_name}")
|
||||
List<Map> selectDataByName(@Param("value") String value,@Param("sever_name") String sever_name);
|
||||
|
||||
@Select("select count(*) from data_store where sever_name=#{sever_name}")
|
||||
Integer selectDataStoreCount(@Param("sever_name") String sever_name);
|
||||
|
||||
|
||||
@Select("SELECT COUNT(*) FROM information_schema.tables WHERE table_name =#{sever_name}")
|
||||
Integer selectDataStoreCountTemp(@Param("sever_name") String sever_name);
|
||||
@Select("SELECT COUNT(*) FROM information_schema.tables WHERE table_name =#{tableValue}")
|
||||
Integer selectDataStoreCountByTableRef(@Param("tableValue") String tableValue);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.DictData;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-07
|
||||
*/
|
||||
public interface DictDataMapper extends BaseMapper<DictData> {
|
||||
|
||||
@Select("select * from dict_data")
|
||||
List<DictData> getDictData();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface EntityMapper<D, E> {
|
||||
|
||||
/**
|
||||
* DTO转Entity
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
E toEntity(D dto);
|
||||
|
||||
/**
|
||||
* Entity转DTO
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
D toDto(E entity);
|
||||
|
||||
/**
|
||||
* DTO集合转Entity集合
|
||||
* @param dtoList
|
||||
* @return
|
||||
*/
|
||||
List <E> toEntity(List<D> dtoList);
|
||||
|
||||
/**
|
||||
* Entity集合转DTO集合
|
||||
* @param entityList
|
||||
* @return
|
||||
*/
|
||||
List <D> toDto(List<E> entityList);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.FileRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件上传记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author haijun
|
||||
* @since 2020-02-14
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface FileRecordMapper extends BaseMapper<FileRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.FileZoneRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文件分片记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author haijun
|
||||
* @since 2020-02-14
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface FileZoneRecordMapper extends BaseMapper<FileZoneRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface GeoServerDao {
|
||||
|
||||
@Update("CREATE SEQUENCE \"public\".\"${value}_seq\" ")
|
||||
public void createSequence(@Param("value")String value);
|
||||
|
||||
@Select("select * from \"public\".\"${value}\" ")
|
||||
public List<Map> selectList(@Param("value")String value);
|
||||
|
||||
@Select("select count(*) from \"public\".\"${tableName}\" where " +
|
||||
" ${keyWord} like concat('%',#{value},'%')" )
|
||||
public Integer selectLayerDataListCount(Map map);
|
||||
|
||||
@Select("select count(*) from \"public\".\"${tableName}\" ")
|
||||
public Integer selectLayerDataListCountNoParam(Map map);
|
||||
|
||||
|
||||
|
||||
@Select("select * from \"public\".\"${tableName}\" where " +
|
||||
" ${keyWord} like concat('%',#{value},'%')" +
|
||||
" limit #{pageSize} offset #{pageNum} ")
|
||||
public List<Map> selectLayerDataList(Map map);
|
||||
|
||||
@Select("select * from \"public\".\"${tableName}\" " +
|
||||
" limit #{pageSize} offset #{pageNum} ")
|
||||
public List<Map> selectLayerDataListNoParam(Map map);
|
||||
@Update("<script>" +
|
||||
"CREATE TABLE if not exists \"public\".\"${tableName}\" (" +
|
||||
"id numeric(8) NOT NULL PRIMARY KEY DEFAULT nextval('${tableName}_seq'::regclass),"+
|
||||
"<foreach collection=\"heads\" item=\"item\" separator=\"\" >"+
|
||||
"${item.name} ${item.type}"+
|
||||
"<if test=\"item.length != 0\">" +
|
||||
"(${item.length})" +
|
||||
"</if>" +
|
||||
","+
|
||||
"</foreach>" +
|
||||
"is_del numeric(8)" +
|
||||
")" +
|
||||
"</script>")
|
||||
public void createTable(@Param("tableName")String tableName,@Param("heads")List<Map<String, Object>> heads);
|
||||
|
||||
@Update("<script>" +
|
||||
"CREATE TABLE if not exists \"public\".\"${tableName}\" (" +
|
||||
"id numeric(8) NOT NULL PRIMARY KEY DEFAULT nextval('${tableName}_seq'::regclass),"+
|
||||
"<foreach collection=\"heads\" item=\"item\" separator=\"\" >"+
|
||||
"${item.refName} ${item.type}"+
|
||||
"<if test=\"item.length != 0\">" +
|
||||
"(${item.length})" +
|
||||
"</if>" +
|
||||
","+
|
||||
"</foreach>" +
|
||||
"is_del numeric(8)" +
|
||||
")" +
|
||||
"</script>")
|
||||
public void createNewTable(@Param("tableName")String tableName,@Param("heads")List<Map<String, Object>> heads);
|
||||
|
||||
@Insert("<script>" +
|
||||
"INSERT INTO \"public\".\"${tableName}\" ( " +
|
||||
"<foreach collection=\"heads\" item=\"item\" separator=\"\">"+
|
||||
"${item.name},"+
|
||||
"</foreach>" +
|
||||
"is_del) " +
|
||||
"VALUES ( "+
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"<if test=\"key == 'geom' \"> " +
|
||||
"ST_GeomFromText(${value},${spaceType})"+
|
||||
"</if>" +
|
||||
"<if test=\"key != 'geom' \"> " +
|
||||
"#{value}" +
|
||||
"</if>" +
|
||||
"</foreach>"+
|
||||
" ) "+
|
||||
"</script>")
|
||||
public void addTableDateList(@Param("tableName")String tableName, @Param("heads") List<Map<String, Object>> heads,
|
||||
@Param("data") LinkedHashMap<String, Object> data,@Param("spaceType")String spaceType);
|
||||
|
||||
|
||||
@Insert("<script>" +
|
||||
"INSERT INTO \"public\".\"${tableName}\" ( " +
|
||||
"<foreach collection=\"heads\" item=\"item\" separator=\"\">"+
|
||||
"${item.name},"+
|
||||
"</foreach>" +
|
||||
"is_del) " +
|
||||
"VALUES ( "+
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"<if test=\"key == 'geom' \"> " +
|
||||
"ST_GeomFromText('${value}',${spaceType})"+
|
||||
"</if>" +
|
||||
"<if test=\"key != 'geom' \"> " +
|
||||
"#{value}" +
|
||||
"</if>" +
|
||||
"</foreach>"+
|
||||
" ) "+
|
||||
"</script>")
|
||||
public void addTableDateList1(@Param("tableName")String tableName, @Param("heads") List<Map<String, Object>> heads,
|
||||
@Param("data") LinkedHashMap<String, Object> data,@Param("spaceType")String spaceType);
|
||||
@Insert("<script>" +
|
||||
"INSERT INTO \"public\".\"${tableName}\" ( " +
|
||||
"<foreach collection=\"heads\" item=\"item\" separator=\"\">"+
|
||||
"${item.refName},"+
|
||||
"</foreach>" +
|
||||
"is_del) " +
|
||||
"VALUES ( "+
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"<if test=\"key == 'geom' \"> " +
|
||||
"ST_GeomFromText('${value}',${spaceType})"+
|
||||
"</if>" +
|
||||
"<if test=\"key != 'geom' \"> " +
|
||||
"#{value}" +
|
||||
"</if>" +
|
||||
"</foreach>"+
|
||||
" ) "+
|
||||
"</script>")
|
||||
public void addNewTableDateList(@Param("tableName")String tableName, @Param("heads") List<Map<String, Object>> heads,
|
||||
@Param("data") LinkedHashMap<String, Object> data,@Param("spaceType")String spaceType);
|
||||
|
||||
|
||||
@Select("select dict_label dictLabel,dict_value dictValue from dict_data where dict_type=#{dictType}")
|
||||
public List<Map> getDictData(@Param("dictType")String dictType);
|
||||
|
||||
@Select("select sever_name from data_store where sever_name=#{serverName}")
|
||||
String selectByName(@Param("serverName")String serverName);
|
||||
|
||||
@Insert("<script>" +
|
||||
"INSERT INTO \"public\".data_store ( " +
|
||||
"sever_name,space_type,sever_type,store_type,datasource_type," +
|
||||
"table_ref,create_time,is_display,data_type,style_name,name_ref,area_name,relation) " +
|
||||
"VALUES ( "+
|
||||
"#{severName},#{spaceType},#{severType},#{storeType},#{datasourceType},#{tableName},now(),1,#{dataType},#{styleName}" +
|
||||
",#{nameRef},#{areaName},#{relation} ) "+
|
||||
"</script>")
|
||||
public void addTableDataStore(@Param("tableName")String tableName,@Param("severName")String severName,@Param("spaceType")String spaceType,
|
||||
@Param("severType")String severType,@Param("storeType")String storeType,
|
||||
@Param("datasourceType")String datasourceType,@Param("dataType")String dataType,
|
||||
@Param("styleName")String styleName, @Param("nameRef")String nameRef,@Param("areaName")String areaName,
|
||||
@Param("relation")String relation);
|
||||
|
||||
|
||||
@Select("select style_name,space_type from \"public\".data_store where table_ref =#{value}")
|
||||
Map selectStyleName(@Param("value")String value);
|
||||
|
||||
@Select("select count(*) from information_schema.tables where table_name =#{value}")
|
||||
int selectTableCount(@Param("value")String value);
|
||||
|
||||
@Select("select count(*) from pg_class where relname =#{value}")
|
||||
int selectSeqCount(@Param("value")String value);
|
||||
|
||||
@Update("Drop table \"public\".\"${value}\" ")
|
||||
void deleteTable(@Param("value")String value);
|
||||
|
||||
@Update("Drop sequence \"${value}\" ")
|
||||
void deleteSequence(@Param("value")String value);
|
||||
|
||||
|
||||
@Insert("<script>" +
|
||||
"update \"public\".\"${tableName}\" set " +
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"<if test=\"key == 'geom' \"> " +
|
||||
"${key}=ST_GeomFromText('${value}',${spaceType})"+
|
||||
"</if>" +
|
||||
"<if test=\"key != 'geom' \"> " +
|
||||
"${key}=#{value}" +
|
||||
"</if>" +
|
||||
"</foreach>"+
|
||||
" where id=#{id}" +
|
||||
"</script>")
|
||||
public void updateTableDateList1(@Param("tableName")String tableName,
|
||||
@Param("data") LinkedHashMap<String, Object> data,@Param("id")Integer id,@Param("spaceType")String spaceType);
|
||||
|
||||
|
||||
@Insert("<script>" +
|
||||
"INSERT INTO \"public\".\"${tableName}\" ( " +
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"${key}" +
|
||||
"</foreach> ) "+
|
||||
"VALUES ( "+
|
||||
"<foreach collection=\"data.entrySet()\" item=\"value\" index=\"key\" separator=\",\">" +
|
||||
"<if test=\"key == 'geom' \"> " +
|
||||
"ST_GeomFromText('${value}',${spaceType})"+
|
||||
"</if>" +
|
||||
"<if test=\"key != 'geom' \"> " +
|
||||
"#{value}" +
|
||||
"</if>" +
|
||||
"</foreach>"+
|
||||
" ) "+
|
||||
"</script>")
|
||||
public void insertTableDateList(@Param("tableName")String tableName,
|
||||
@Param("data") LinkedHashMap<String, Object> data,@Param("spaceType")String spaceType);
|
||||
|
||||
|
||||
@Delete("delete from \"public\".\"${tableName}\" where id=#{id}")
|
||||
public void deleteTableDateList(@Param("tableName")String tableName, @Param("id")Integer id);
|
||||
|
||||
|
||||
@Update("update \"public\".\"${tableName}\" set is_del=1 where id=#{id}")
|
||||
public void updateTableDateList(@Param("tableName")String tableName, @Param("id")Integer id);
|
||||
|
||||
@Select("select * from \"public\".\"${tableName}\" where id=#{id}")
|
||||
public Map selectSingleData(@Param("tableName")String tableName, @Param("id")Integer id);
|
||||
|
||||
@Select("select ST_AsText(ST_Centroid(ST_Extent(geom))) from \"public\".\"${value}\"")
|
||||
public String selectGeomData(String shpName);
|
||||
|
||||
@Select("select count(*) from \"public\".\"data_store\" where style_name=#{value} ")
|
||||
public Integer selectStyleCount(@Param("value")String value);
|
||||
|
||||
@Select("select column_name from information_schema.columns\n" +
|
||||
" where table_schema='public' and table_name=#{value} ")
|
||||
public List<String> selectTableCloumn(@Param("value")String value);
|
||||
|
||||
|
||||
@Select("select DISTINCT ${columnName} from \"public\".\"${tableName}\"")
|
||||
public List<String> selectDataByColumn(@Param("columnName")String columnName,@Param("tableName")String tableName);
|
||||
|
||||
@Select("select count(*) from \"public\".\"${value}\" ")
|
||||
public Integer selectTableDataCount(@Param("value")String value);
|
||||
|
||||
@Select("select sever_name from data_store where table_ref=#{value}")
|
||||
String selectSeverNameByTableRef(@Param("value")String value);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-06
|
||||
*/
|
||||
public interface ProjectDataRelationMapper extends BaseMapper<ProjectDataRelation>{
|
||||
|
||||
|
||||
@Select("select * from project_data_relation where project_team_name=#{projectTeamName} and application_id=#{applicationId}")
|
||||
@ResultMap("projectDataRelation")
|
||||
ProjectDataRelation findExist(@Param("projectTeamName") String projectTeamName,@Param("applicationId") Integer applicationId);
|
||||
|
||||
Integer updateProject(ProjectDataRelation projectDataRelation);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
import com.zzlh.es.entity.ProjectDataRelationMars;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
public interface ProjectDataRelationMarsMapper extends BaseMapper<ProjectDataRelationMars> {
|
||||
boolean insertMars(ProjectDataRelationMars projectDataRelationMars);
|
||||
|
||||
@Select("select * from project_data_relation_mars where project_team_name=#{projectTeamName} limit 1")
|
||||
@ResultMap("projectDataRelationMars")
|
||||
ProjectDataRelationMars findExist(@Param("projectTeamName") String projectTeamName);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.zzlh.es.entity.StyleImage;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
public interface StyleImageMapper extends BaseMapper<StyleImage> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.StyleParameterMapbox;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-07
|
||||
*/
|
||||
public interface StyleParameterMapboxMapper extends BaseMapper<StyleParameterMapbox> {
|
||||
@Select("select * from style_parameter_mapbox")
|
||||
@ResultMap("styleParameterMapbox")
|
||||
StyleParameterMapbox getStyleByMapbox();
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.zzlh.es.entity.StyleParameterMars;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
public interface StyleParameterMarsMapper extends BaseMapper<StyleParameterMars> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.zzlh.es.entity.StyleRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 样式Mapper接口
|
||||
*
|
||||
* @author lgd
|
||||
* @date 2023-08-09
|
||||
*/
|
||||
public interface StyleRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询样式
|
||||
*
|
||||
* @param styleName 样式主键
|
||||
* @return 样式
|
||||
*/
|
||||
public StyleRecord selectStyleRecordByStyleName(String styleName);
|
||||
|
||||
/**
|
||||
* 查询样式列表
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 样式集合
|
||||
*/
|
||||
public List<StyleRecord> selectStyleRecordList(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 新增样式
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStyleRecord(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 修改样式
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStyleRecord(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 删除样式
|
||||
*
|
||||
* @param styleName 样式主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStyleRecordByStyleName(String styleName);
|
||||
|
||||
/**
|
||||
* 批量删除样式
|
||||
*
|
||||
* @param styleNames 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStyleRecordByStyleNames(String[] styleNames);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.StyleServerMapbox;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
public interface StyleServerMapboxMapper extends BaseMapper<StyleServerMapbox>{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzlh.es.entity.TUser;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Mapper
|
||||
public interface TUserMapper extends BaseMapper<TUser> {
|
||||
|
||||
|
||||
TUser findByName(String username);
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.zzlh.es.page;
|
||||
|
||||
|
||||
import com.zzlh.es.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 分页数据
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class PageDomain
|
||||
{
|
||||
/** 当前记录起始索引 */
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页显示记录数 */
|
||||
private Integer pageSize;
|
||||
|
||||
/** 排序列 */
|
||||
private String orderByColumn;
|
||||
|
||||
/** 排序的方向desc或者asc */
|
||||
private String isAsc = "asc";
|
||||
|
||||
/** 分页参数合理化 */
|
||||
private Boolean reasonable = true;
|
||||
|
||||
public String getOrderBy()
|
||||
{
|
||||
if (StringUtils.isEmpty(orderByColumn))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
|
||||
}
|
||||
|
||||
public Integer getPageNum()
|
||||
{
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum)
|
||||
{
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize()
|
||||
{
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize)
|
||||
{
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getOrderByColumn()
|
||||
{
|
||||
return orderByColumn;
|
||||
}
|
||||
|
||||
public void setOrderByColumn(String orderByColumn)
|
||||
{
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc()
|
||||
{
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(isAsc))
|
||||
{
|
||||
// 兼容前端排序类型
|
||||
if ("ascending".equals(isAsc))
|
||||
{
|
||||
isAsc = "asc";
|
||||
}
|
||||
else if ("descending".equals(isAsc))
|
||||
{
|
||||
isAsc = "desc";
|
||||
}
|
||||
this.isAsc = isAsc;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getReasonable()
|
||||
{
|
||||
if (StringUtils.isNull(reasonable))
|
||||
{
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return reasonable;
|
||||
}
|
||||
|
||||
public void setReasonable(Boolean reasonable)
|
||||
{
|
||||
this.reasonable = reasonable;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.zzlh.es.page;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class TableDataInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 总记录数 */
|
||||
private long total;
|
||||
|
||||
/** 列表数据 */
|
||||
private List<?> rows;
|
||||
|
||||
/** 消息状态码 */
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 表格数据对象
|
||||
*/
|
||||
public TableDataInfo()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public TableDataInfo(List<?> list, int total)
|
||||
{
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(long total)
|
||||
{
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<?> getRows()
|
||||
{
|
||||
return rows;
|
||||
}
|
||||
|
||||
public void setRows(List<?> rows)
|
||||
{
|
||||
this.rows = rows;
|
||||
}
|
||||
|
||||
public int getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg()
|
||||
{
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg)
|
||||
{
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package com.zzlh.es.page;
|
||||
|
||||
|
||||
import com.zzlh.es.text.Convert;
|
||||
import com.zzlh.es.utils.ServletUtils;
|
||||
|
||||
/**
|
||||
* 表格数据处理
|
||||
*
|
||||
* @author hckj
|
||||
*/
|
||||
public class TableSupport
|
||||
{
|
||||
/**
|
||||
* 当前记录起始索引
|
||||
*/
|
||||
public static final String PAGE_NUM = "pageNum";
|
||||
|
||||
/**
|
||||
* 每页显示记录数
|
||||
*/
|
||||
public static final String PAGE_SIZE = "pageSize";
|
||||
|
||||
/**
|
||||
* 排序列
|
||||
*/
|
||||
public static final String ORDER_BY_COLUMN = "orderByColumn";
|
||||
|
||||
/**
|
||||
* 排序的方向 "desc" 或者 "asc".
|
||||
*/
|
||||
public static final String IS_ASC = "isAsc";
|
||||
|
||||
/**
|
||||
* 分页参数合理化
|
||||
*/
|
||||
public static final String REASONABLE = "reasonable";
|
||||
|
||||
/**
|
||||
* 封装分页对象
|
||||
*/
|
||||
public static PageDomain getPageDomain()
|
||||
{
|
||||
PageDomain pageDomain = new PageDomain();
|
||||
pageDomain.setPageNum(Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1));
|
||||
pageDomain.setPageSize(Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10));
|
||||
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
|
||||
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
|
||||
pageDomain.setReasonable(ServletUtils.getParameterToBool(REASONABLE));
|
||||
return pageDomain;
|
||||
}
|
||||
|
||||
public static PageDomain buildPageRequest()
|
||||
{
|
||||
return getPageDomain();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.zzlh.es.security.auth;
|
||||
|
||||
|
||||
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;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* 描述:访问未授权资源处理
|
||||
*
|
||||
*
|
||||
* @author soeasy*/
|
||||
@Component
|
||||
public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
@Override
|
||||
public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException {
|
||||
httpServletResponse.setContentType("application/json;charset=utf-8");
|
||||
PrintWriter out = httpServletResponse.getWriter();
|
||||
if(e.getMessage().contains("Bad credentials")){
|
||||
out.write("{\"status\":\"error\",\"msg\":\"用户名或密码错误\"}");
|
||||
}else{
|
||||
out.write("{\"status\":\"error\",\"msg\":\"请登录\"}");
|
||||
}
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.zzlh.es.security.auth;
|
||||
|
||||
|
||||
import com.zzlh.es.entity.TUser;
|
||||
import lombok.Data;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 描述:自定义UserDetails,使UserDetails具有TUser的实体结构
|
||||
*
|
||||
|
||||
*
|
||||
* @author soeasy*/
|
||||
@Data
|
||||
public class CustomUserDetails extends TUser implements UserDetails {
|
||||
public CustomUserDetails(TUser tUser){
|
||||
if(null != tUser){
|
||||
this.setId(tUser.getId());
|
||||
this.setUsername(tUser.getUsername());
|
||||
this.setPassword(tUser.getPassword());
|
||||
this.setState(tUser.getState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.zzlh.es.security.auth;
|
||||
|
||||
|
||||
import com.zzlh.es.entity.TUser;
|
||||
import com.zzlh.es.service.TUserService;
|
||||
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.Component;
|
||||
|
||||
/**
|
||||
* 描述:自定义UserDetailsService,从数据库读取用户信息,实现登录验证
|
||||
*
|
||||
|
||||
*
|
||||
* @author soeasy*/
|
||||
@Component
|
||||
public class CustomUserDetailsService implements UserDetailsService {
|
||||
@Autowired
|
||||
private TUserService userService;
|
||||
|
||||
/**
|
||||
* 认证过程中 - 根据登录信息获取用户详细信息
|
||||
*
|
||||
* @param s 登录用户输入的用户名
|
||||
* @return
|
||||
* @throws UsernameNotFoundException
|
||||
*/
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
|
||||
//根据用户输入的用户信息,查询数据库中已注册用户信息
|
||||
TUser user = userService.findByName(s);
|
||||
//如果用户不存在直接抛出UsernameNotFoundException异常
|
||||
if (user == null) throw new UsernameNotFoundException("用户名为" + s + "的用户不存在");
|
||||
|
||||
return new CustomUserDetails(user);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,528 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.entity.vo.PartFileVo;
|
||||
import com.zzlh.es.entity.vo.StyleDataVo;
|
||||
import com.zzlh.es.webupload.util.FileUploadConfig;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTManager;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
|
||||
import it.geosolutions.geoserver.rest.GeoServerRESTReader;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTDataStore;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTLayer;
|
||||
import it.geosolutions.geoserver.rest.decoder.RESTStyleList;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSAbstractStoreEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.datastore.GSPostGISDatastoreEncoder;
|
||||
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
|
||||
import it.geosolutions.geoserver.rest.manager.GeoServerRESTStoreManager;
|
||||
import org.apache.commons.httpclient.NameValuePair;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class GeoServer {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(GeoServer.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private FileUploadConfig fileUploadConfig;
|
||||
/**
|
||||
* geoServer配置
|
||||
*/
|
||||
public static String url;
|
||||
|
||||
private static String geoUsername;
|
||||
|
||||
private static String geoPassword;
|
||||
|
||||
//待发布矢量图层的工作区间
|
||||
public static String shpWorkspace;
|
||||
|
||||
//待发布矢量图层的数据储存
|
||||
public static String shpStorename;
|
||||
|
||||
//待发布影像图层的工作空间
|
||||
public static String imageWorkspace;
|
||||
|
||||
public static String stylePath;
|
||||
|
||||
@Value("${geoserver.url}")
|
||||
public void setUrl(String url) {
|
||||
GeoServer.url = url;
|
||||
}
|
||||
|
||||
@Value("${geoserver.username}")
|
||||
public void setGeoUsername(String geoUsername) {
|
||||
GeoServer.geoUsername = geoUsername;
|
||||
}
|
||||
|
||||
@Value("${geoserver.password}")
|
||||
public void setGeoPassword(String geoPassword) {
|
||||
GeoServer.geoPassword = geoPassword;
|
||||
}
|
||||
|
||||
@Value("${geoserver.shpworkspace}")
|
||||
public void setShpWorkspace(String shpWorkspace) {
|
||||
GeoServer.shpWorkspace = shpWorkspace;
|
||||
}
|
||||
|
||||
@Value("${geoserver.shpstorename}")
|
||||
public void setShpStorename(String shpStorename) {
|
||||
GeoServer.shpStorename = shpStorename;
|
||||
}
|
||||
|
||||
@Value("${geoserver.imageworkspace}")
|
||||
public void setImageWorkspace(String imageWorkspace) {
|
||||
GeoServer.imageWorkspace = imageWorkspace;
|
||||
}
|
||||
|
||||
@Value("${localdir.style}")
|
||||
public void setStylePath(String stylePath) {
|
||||
GeoServer.stylePath = stylePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断工作区(workspace)是否存在,不存在则创建
|
||||
*/
|
||||
public Boolean judgeWorkSpace(String workspace){
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
GeoServerRESTPublisher publisher = manager.getPublisher();
|
||||
List<String> workspaces = manager.getReader().getWorkspaceNames();
|
||||
if (!workspaces.contains(workspace)) {
|
||||
boolean createWorkspace = publisher.createWorkspace(workspace);
|
||||
logger.info("create workspace : " + createWorkspace);
|
||||
return createWorkspace;
|
||||
} else {
|
||||
logger.info("workspace已经存在了,workspace :" + workspace);
|
||||
return true;
|
||||
}
|
||||
}catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断存储是否存在
|
||||
* @param store 存储名
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean shpJudgeDatabase(String store) {
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
GeoServerRESTPublisher publisher = manager.getPublisher();
|
||||
RESTDataStore restStore = manager.getReader().getDatastore(shpWorkspace, store);
|
||||
if (restStore == null) {
|
||||
logger.info("数据存储不存在,可以创建!");
|
||||
return true;
|
||||
} else {
|
||||
logger.info("数据存储已经存在了,store:" + store);
|
||||
}
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 方法一
|
||||
* 直接发布shp文件到geoServer
|
||||
* 将shp.zip通过http传递过去
|
||||
* 不主动设置样式和编码
|
||||
* <p>
|
||||
*
|
||||
* @param fileUrl 本地文件地址 zip格式
|
||||
* @param geocode 地理编码
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean releaseShpByHttp(String fileUrl, String geocode) {
|
||||
try {
|
||||
File zipFile = new File(fileUrl);
|
||||
//存储名/图层名
|
||||
// String storeName = FileUtil.getFileNameNoEx(zipFile.getName());
|
||||
String storeName = zipFile.getName();
|
||||
GeoServerRESTReader reader = new GeoServerRESTReader(url, geoUsername, geoPassword);
|
||||
GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(url, geoUsername, geoPassword);
|
||||
|
||||
RESTLayer layer = reader.getLayer(shpWorkspace, storeName);
|
||||
if (layer == null) {
|
||||
if (publisher.publishShp(shpWorkspace, storeName, storeName, zipFile, geocode)) {
|
||||
logger.info("图层发布成功:" + storeName);
|
||||
return true;
|
||||
} else {
|
||||
logger.info("图层发布失败:" + storeName);
|
||||
}
|
||||
} else {
|
||||
logger.info("图层已经发布过了:" + storeName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 方法二
|
||||
* 向geoServer上传shp,并设置存储、图层名、样式和坐标系
|
||||
*
|
||||
* @param zipFilePath 压缩文件夹位置 完整文件地址
|
||||
* @param storeName 存储、图层名 英文
|
||||
* @param styleType 图层样式 shp工作空间下的对应样式
|
||||
* @param coordinateSystem 坐标系 EPSG:4326
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean publishShp(String zipFilePath, String storeName, String styleType, String coordinateSystem) {
|
||||
if (coordinateSystem == null) {
|
||||
coordinateSystem = GeoServerRESTPublisher.DEFAULT_CRS;
|
||||
}
|
||||
try {
|
||||
//创建发布类,放入用户名密码和url
|
||||
GeoServerRESTPublisher geoServerRESTPublisher = new GeoServerRESTPublisher(url, geoUsername, geoPassword);
|
||||
boolean b = geoServerRESTPublisher.publishShp(shpWorkspace, storeName,
|
||||
new NameValuePair[]{new NameValuePair("charset", "GBK")},
|
||||
//图层名称 指定用于发布资源的方法
|
||||
storeName, GeoServerRESTPublisher.UploadMethod.FILE,
|
||||
//zip图集的地址,直接压缩不要文件夹 坐标系 样式
|
||||
new File(zipFilePath).toURI(), coordinateSystem, styleType);
|
||||
if (b) {
|
||||
return true;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断图层是否已经存在,不存在则创建并发布
|
||||
* @param workspace 工作区
|
||||
* @param storeName 数据存储
|
||||
* @param tableName 表名
|
||||
* @param spaceType 坐标系 EPSG:4326
|
||||
*/
|
||||
public Boolean addLayer(String workspace,String storeName,String tableName,String style,String spaceType){
|
||||
if(workspace == null){
|
||||
workspace = shpWorkspace;
|
||||
}
|
||||
if(StringUtils.isEmpty(storeName)){
|
||||
storeName = shpStorename;
|
||||
}
|
||||
try {
|
||||
GeoServerRESTManager geoServerRESTManager = new GeoServerRESTManager(new URL(url), geoUsername, geoPassword);
|
||||
GeoServerRESTPublisher geoServerRESTPublisher = geoServerRESTManager.getPublisher();
|
||||
GeoServerRESTReader geoServerRESTReader=geoServerRESTManager.getReader();
|
||||
RESTDataStore restStore =geoServerRESTReader.getDatastore(shpWorkspace, storeName);
|
||||
if (restStore == null) {
|
||||
GSPostGISDatastoreEncoder store = new GSPostGISDatastoreEncoder(storeName);
|
||||
store.setHost("localhost");
|
||||
store.setPort(5432);
|
||||
store.setUser("postgres");
|
||||
store.setPassword("123456");
|
||||
store.setDatabase("postgres");
|
||||
store.setSchema("public");
|
||||
store.setConnectionTimeout(300);
|
||||
store.setMaxConnections(20);
|
||||
store.setMinConnections(1);
|
||||
store.setExposePrimaryKeys(true);
|
||||
boolean isCreateStore = geoServerRESTManager.getStoreManager().create(shpWorkspace, store);
|
||||
}
|
||||
// URL u = new URL(url);
|
||||
//GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
RESTLayer layer = geoServerRESTReader.getLayer(shpWorkspace, tableName);
|
||||
GSFeatureTypeEncoder pds = new GSFeatureTypeEncoder();
|
||||
System.out.println(pds.toString());
|
||||
pds.setTitle(tableName);
|
||||
pds.setName(tableName);
|
||||
pds.setSRS(spaceType);
|
||||
pds.setDescription(tableName);
|
||||
GSLayerEncoder layerEncoder = new GSLayerEncoder();
|
||||
if (!StringUtils.isEmpty(style)){
|
||||
layerEncoder.setDefaultStyle(shpWorkspace,style);
|
||||
}
|
||||
if(layer == null){//图层不存在
|
||||
boolean b = geoServerRESTPublisher.unpublishFeatureType(shpWorkspace, storeName, tableName);
|
||||
geoServerRESTPublisher.removeLayer(shpWorkspace,tableName);
|
||||
boolean publish = geoServerRESTPublisher.publishDBLayer(shpWorkspace, storeName, pds, layerEncoder);
|
||||
System.out.println("图层发布publish : " + publish);
|
||||
return publish;
|
||||
}else {
|
||||
|
||||
geoServerRESTPublisher.unpublishFeatureType(shpWorkspace, storeName, tableName);
|
||||
geoServerRESTPublisher.removeLayer(shpWorkspace,tableName);
|
||||
boolean publish = geoServerRESTPublisher.publishDBLayer(shpWorkspace, storeName, pds, layerEncoder);
|
||||
System.out.println("图层发布publish : " + publish);
|
||||
return publish;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Boolean removeLayer(String tableName) throws Exception{
|
||||
GeoServerRESTManager geoServerRESTManager = new GeoServerRESTManager(new URL(url), geoUsername, geoPassword);
|
||||
GeoServerRESTPublisher geoServerRESTPublisher = geoServerRESTManager.getPublisher();
|
||||
geoServerRESTPublisher.unpublishFeatureType(shpWorkspace, shpStorename, tableName);
|
||||
boolean b = geoServerRESTPublisher.removeLayer(shpWorkspace, tableName);
|
||||
return b;
|
||||
}
|
||||
|
||||
public Map getLayer( String tableName, String spaceType) throws Exception{
|
||||
String[] split = spaceType.split(":");
|
||||
// String substring = spaceType.substring(spaceType.length() - 4);
|
||||
String rootUrl = url + "/gwc/service/tms/1.0.0/"+shpWorkspace+":"+tableName+"@EPSG:"+split[1]+"@";
|
||||
String[] formats = {"pbf","utfgrid","png","jpeg","geojson","topojson"};
|
||||
List<Map> stringList = new ArrayList<>();
|
||||
for(int i=0;i<formats.length;i++){
|
||||
Map map = new HashMap();
|
||||
String s = rootUrl + formats[i];
|
||||
map.put("url",s);
|
||||
stringList.add(map);
|
||||
}
|
||||
Map point = new HashMap();
|
||||
String pointUrl = url + "/ksp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName="+shpWorkspace+":"+tableName+"&outputFormat=application@json";
|
||||
point.put("url",pointUrl);
|
||||
stringList.add(point);
|
||||
Map map = new HashMap();
|
||||
map.put("data",stringList);
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
public Map getLayerStyle(){
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
RESTStyleList styles = manager.getStyleManager().getStyles(shpWorkspace);
|
||||
map.put("style",styles);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map getLayerStyles(){
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
RESTStyleList styles = manager.getStyleManager().getStyles(shpWorkspace);
|
||||
map.put("style",styles);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Boolean saveLayerStyle(StyleDataVo styleDataVo){
|
||||
String head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sld:StyledLayerDescriptor xmlns=\"http://www.opengis.net/sld\" xmlns:sld=\"http://www.opengis.net/sld\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:ogc=\"http://www.opengis.net/ogc\" version=\"1.0.0\"><sld:NamedLayer><sld:Name>styleName</sld:Name><sld:UserStyle><sld:Name>styleName</sld:Name><sld:FeatureTypeStyle><sld:Name>name</sld:Name><sld:Rule><sld:Name>Single symbol</sld:Name><sld:PolygonSymbolizer>";
|
||||
String end = "<sld:Stroke><sld:CssParameter name=\"stroke\">strokeColor</sld:CssParameter><sld:CssParameter name=\"stroke-width\">strokeWidth</sld:CssParameter><sld:CssParameter name=\"stroke-linejoin\">bevel</sld:CssParameter></sld:Stroke></sld:PolygonSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>";
|
||||
String xml = "<sld:Fill><sld:CssParameter name=\"fill\">fillColor</sld:CssParameter><sld:CssParameter name=\"fill-opacity\">fillOpacity</sld:CssParameter></sld:Fill>";
|
||||
String styleName = head.replaceAll("styleName", styleDataVo.getStyleName());
|
||||
String s = end.replaceAll("strokeColor", styleDataVo.getStrokeColor()).replaceAll("strokeWidth", styleDataVo.getStrokeWidth());
|
||||
String publishStyle = "";
|
||||
if (styleDataVo.getType()==1){
|
||||
publishStyle = styleName + s;
|
||||
}else if (styleDataVo.getType()==2){
|
||||
String s1 = xml.replaceAll("fillColor", styleDataVo.getFillColor()).replaceAll("fillOpacity", styleDataVo.getFillOpacity());
|
||||
publishStyle = styleName + s1 + s;
|
||||
}
|
||||
boolean flag = false;
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
flag = manager.getStyleManager().publishStyleInWorkspace(shpWorkspace, publishStyle, styleDataVo.getStyleName());
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
public Boolean updateLayerStyle(StyleDataVo styleDataVo){
|
||||
String head = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sld:StyledLayerDescriptor xmlns=\"http://www.opengis.net/sld\" xmlns:sld=\"http://www.opengis.net/sld\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:ogc=\"http://www.opengis.net/ogc\" version=\"1.0.0\"><sld:NamedLayer><sld:Name>styleName</sld:Name><sld:UserStyle><sld:Name>styleName</sld:Name><sld:FeatureTypeStyle><sld:Name>name</sld:Name><sld:Rule><sld:Name>Single symbol</sld:Name><sld:PolygonSymbolizer>";
|
||||
String end = "<sld:Stroke><sld:CssParameter name=\"stroke\">strokeColor</sld:CssParameter><sld:CssParameter name=\"stroke-width\">strokeWidth</sld:CssParameter><sld:CssParameter name=\"stroke-linejoin\">bevel</sld:CssParameter></sld:Stroke></sld:PolygonSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>";
|
||||
String xml = "<sld:Fill><sld:CssParameter name=\"fill\">fillColor</sld:CssParameter><sld:CssParameter name=\"fill-opacity\">fillOpacity</sld:CssParameter></sld:Fill>";
|
||||
String styleName = head.replaceAll("styleName", styleDataVo.getStyleName());
|
||||
String s = end.replaceAll("strokeColor", styleDataVo.getStrokeColor()).replaceAll("strokeWidth", styleDataVo.getStrokeWidth());
|
||||
String publishStyle = "";
|
||||
if (styleDataVo.getType()==1){
|
||||
publishStyle = styleName + s;
|
||||
}else if (styleDataVo.getType()==2){
|
||||
String s1 = xml.replaceAll("fillColor", styleDataVo.getFillColor()).replaceAll("fillOpacity", styleDataVo.getFillOpacity());
|
||||
publishStyle = styleName + s1 + s;
|
||||
}
|
||||
boolean flag = false;
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
flag = manager.getStyleManager().updateStyleInWorkspace(shpWorkspace, publishStyle, styleDataVo.getStyleName());
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public Map deleteLayerStyle(String styleName){
|
||||
Map map = new HashMap();
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
boolean pingyuan = manager.getStyleManager().removeStyleInWorkspace(shpWorkspace, styleName);
|
||||
map.put("result",pingyuan);
|
||||
map.put("code",200);
|
||||
map.put("msg","删除成功");
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 删除图层
|
||||
* @param workspace 工作区
|
||||
* @param layerName 图层名
|
||||
* @return
|
||||
*/
|
||||
public Boolean removeLayer(String workspace, String layerName){
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
RESTLayer layer = manager.getReader().getLayer(workspace, layerName);
|
||||
if(layer != null){
|
||||
boolean removeLayer = manager.getPublisher().removeLayer(workspace, layerName);
|
||||
return removeLayer;
|
||||
}else{
|
||||
System.out.println("图层不存在, layer: " + layerName);
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 上传图层样式文件到geoServer,sld文件
|
||||
* 需要放入指定文件夹下
|
||||
*
|
||||
* @param partFileVo 样式文件名(不包含sld后缀)
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean publishStyle(PartFileVo partFileVo) {
|
||||
try {
|
||||
MultipartFile file1 = partFileVo.getFile();
|
||||
String originalFilename = file1.getOriginalFilename();
|
||||
if (!"sld".equals(originalFilename.substring(originalFilename.lastIndexOf(".")+1))){
|
||||
return false;
|
||||
}
|
||||
String uploadFolder = fileUploadConfig.getUploadFolder()+fileUploadConfig.getArchivesFilePath();
|
||||
File folder = new File(uploadFolder);
|
||||
if (!folder.exists()) {
|
||||
folder.mkdirs();
|
||||
}
|
||||
String fileName = "YS"+System.currentTimeMillis()+".sld";
|
||||
String absolutePath = uploadFolder + fileName;
|
||||
file1.transferTo(new File(absolutePath));
|
||||
URL u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
GeoServerRESTReader reader = manager.getReader();
|
||||
GeoServerRESTPublisher publisher = manager.getPublisher();
|
||||
//读取style文件
|
||||
//String styleFile = stylePath + File.separator + styleType + ".sld";
|
||||
File file = new File(absolutePath);
|
||||
//是否已经发布了改style
|
||||
if (!reader.existsStyle(shpWorkspace, partFileVo.getStyleName())) {
|
||||
publisher.publishStyleInWorkspace(shpWorkspace, file, partFileVo.getStyleName());
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除指定的数据存储
|
||||
*
|
||||
* @param workspace 工作区
|
||||
* @param storeName 数据存储
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean removeStore(String workspace, String storeName) {
|
||||
URL u = null;
|
||||
try {
|
||||
u = new URL(url);
|
||||
GeoServerRESTManager manager = new GeoServerRESTManager(u, geoUsername, geoPassword);
|
||||
GeoServerRESTStoreManager storeManager = manager.getStoreManager();
|
||||
GSAbstractStoreEncoder gsAbstractStoreEncoder;
|
||||
// manager.getPublisher().removeWorkspace();
|
||||
if (shpWorkspace.equals(workspace)) {
|
||||
gsAbstractStoreEncoder = new GSAbstractStoreEncoder(GeoServerRESTPublisher.StoreType.DATASTORES, storeName) {
|
||||
@Override
|
||||
protected String getValidType() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
gsAbstractStoreEncoder.setName(storeName);
|
||||
return storeManager.remove(workspace, gsAbstractStoreEncoder, true);
|
||||
}
|
||||
|
||||
if (imageWorkspace.equals(workspace)) {
|
||||
gsAbstractStoreEncoder = new GSAbstractStoreEncoder(GeoServerRESTPublisher.StoreType.COVERAGESTORES, storeName) {
|
||||
@Override
|
||||
protected String getValidType() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
gsAbstractStoreEncoder.setName(storeName);
|
||||
return storeManager.remove(workspace, gsAbstractStoreEncoder, true);
|
||||
}
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public String downloadShpZip(Integer count,String tableName){
|
||||
String downUrl = url+ "/ksp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ksp:"+tableName+"&maxFeatures="+count+"&outputFormat=SHAPE-ZIP";
|
||||
return downUrl;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GSFeatureTypeEncoder pds = new GSFeatureTypeEncoder();
|
||||
pds.setTitle("abc");
|
||||
pds.setName("abc");
|
||||
pds.setSRS("4326");
|
||||
pds.setDescription("abc");
|
||||
GSLayerEncoder layerEncoder = new GSLayerEncoder();
|
||||
System.out.println(pds.toString());
|
||||
System.out.println(layerEncoder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.toilelibre.libe.curl.Curl.curl;
|
||||
|
||||
@Component
|
||||
public class GeoWebCache {
|
||||
|
||||
private static String url;
|
||||
private static String geoUsername;
|
||||
private static String geoPassword;
|
||||
//待发布矢量图层的工作区间
|
||||
public static String shpWorkspace; //待发布影像图层的工作空间
|
||||
public static String imageWorkspace;
|
||||
|
||||
@Value("${geoserver.url}")
|
||||
public void setUrl(String url) {
|
||||
GeoWebCache.url = url;
|
||||
}
|
||||
|
||||
@Value("${geoserver.username}")
|
||||
public void setGeoUsername(String geoUsername) {
|
||||
GeoWebCache.geoUsername = geoUsername;
|
||||
}
|
||||
|
||||
@Value("${geoserver.password}")
|
||||
public void setGeoPassword(String geoPassword) {
|
||||
GeoWebCache.geoPassword = geoPassword;
|
||||
}
|
||||
|
||||
@Value("${geoserver.shpworkspace}")
|
||||
public void setShpWorkspace(String shpWorkspace) {
|
||||
GeoWebCache.shpWorkspace = shpWorkspace;
|
||||
}
|
||||
|
||||
@Value("${geoserver.imageworkspace}")
|
||||
public void setImageWorkspace(String imageWorkspace) {
|
||||
GeoWebCache.imageWorkspace = imageWorkspace;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
// String xmlString = "<root><person><name>Tom</name><age>18</age></person></root>";
|
||||
//
|
||||
// // 创建DocumentBuilderFactory对象
|
||||
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
// // 创建DocumentBuilder对象
|
||||
// DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
// // 解析xml字符串,得到Document对象
|
||||
// Document doc = builder.parse(new InputSource(new StringReader(xmlString)));
|
||||
//
|
||||
// // 获取根节点
|
||||
// Element root = doc.getDocumentElement();
|
||||
//
|
||||
// // 遍历子节点
|
||||
// NodeList personList = root.getElementsByTagName("person");
|
||||
// for (int i = 0; i < personList.getLength(); i++) {
|
||||
// Node personNode = personList.item(i);
|
||||
// if (personNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// Element personElement = (Element) personNode;
|
||||
// // 获取name节点的值
|
||||
// String name = personElement.getElementsByTagName("name").item(0).getTextContent();
|
||||
// // 获取age节点的值
|
||||
// String age = personElement.getElementsByTagName("age").item(0).getTextContent();
|
||||
// System.out.println("name: " + name + ", age: " + age);
|
||||
// }
|
||||
// }
|
||||
String cmd = "curl -u " + "admin" + ":" + "Hopetry@A1406" + " -X DELETE http://123.132.248.154:9235/geoserver/rest/workspaces/ksp/datastores/ksp_shp/featuretypes/shp_1692064004 -H "+ "\"accept: application/json\""+ " -H "+ "\"content-type: application/json\"";
|
||||
//String cmd = "curl -u " + "admin" + ":" + "Hopetry@A1406" + " -X DELETE " + "http://123.132.248.154:9235/geoserver" + "/rest/"+"ksp/datastores/ksp_shp/featuretypes/shp_1692064004";
|
||||
HttpResponse curl = curl(cmd);
|
||||
HttpEntity entity = curl.getEntity();
|
||||
System.out.println(entity.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取geoWebCache中的图层 * 并按shp和image 分类 * * @return Map
|
||||
*/
|
||||
public static Map<String, List<String>> getLayers(String layerName) {
|
||||
Map<String, List<String>> map = new HashMap();
|
||||
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " \"" + url + "/gwc/rest/layers/"+shpWorkspace+":"+layerName+".xml\"";
|
||||
List<String> shp = new ArrayList<>();
|
||||
List<String> image = new ArrayList<>();
|
||||
HttpResponse curl = curl(cmd);
|
||||
HttpEntity entity = curl.getEntity();
|
||||
if (entity != null) {
|
||||
String result = null;
|
||||
try {
|
||||
result = EntityUtils.toString(entity, "UTF-8");
|
||||
String[] split = result.split("<mimeFormats>");
|
||||
String s1 = split[0] + "<mimeFormats>\n" +
|
||||
"<string>application/json;type=geojson</string>\n" +
|
||||
" <string>application/json;type=topojson</string>\n" +
|
||||
"<string>application/vnd.mapbox-vector-tile</string>\n" +
|
||||
" <string>application/json;type=utfgrid</string>" + split[1];
|
||||
System.out.println("--------------------------");
|
||||
System.out.println(result);
|
||||
// DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
// // 创建DocumentBuilder对象
|
||||
// DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
// // 解析xml字符串,得到Document对象
|
||||
// Document doc = builder.parse(new InputSource(new StringReader(result)));
|
||||
// System.out.println(doc.toString());
|
||||
// 获取根节点
|
||||
|
||||
//
|
||||
// Element root = doc.getDocumentElement();
|
||||
// NodeList geoServerLayer1 = root.getElementsByTagName("mimeFormats");
|
||||
// Element item1 =(Element) geoServerLayer1.item(0);
|
||||
// NodeList string = item1.getElementsByTagName("string");
|
||||
// for (int i = 0; i < string.getLength(); i++) {
|
||||
// Node item = string.item(i);
|
||||
// String nodeName = item.getTextContent();
|
||||
//
|
||||
// System.out.println(nodeName);
|
||||
// }
|
||||
// JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
// System.out.println(jsonObject.toString());
|
||||
// JSONObject geoServerLayer = jsonObject.getJSONObject("GeoServerLayer");
|
||||
// JSONArray mimeFormats = geoServerLayer.getJSONArray("mimeFormats");
|
||||
// mimeFormats.remove(0);
|
||||
// geoServerLayer.put("mimeFormats",mimeFormats);
|
||||
// jsonObject.put("GeoServerLayer",geoServerLayer);
|
||||
//// JSONArray jsonArray = JSONArray.from(result);
|
||||
// for (Object o : jsonArray) {
|
||||
// String str = o.toString();
|
||||
// String str1 = str.substring(0, str.indexOf(":"));
|
||||
// if ("shp".equals(str1)) {
|
||||
// shp.add(str);
|
||||
// }
|
||||
// if ("image".equals(str1)) {
|
||||
// image.add(str);
|
||||
// }
|
||||
// }
|
||||
// ObjectMapper jsonMapper = new ObjectMapper();
|
||||
// JsonNode rootNode = jsonMapper.readTree(jsonObject.toString());
|
||||
// XmlMapper xmlMapper = new XmlMapper();
|
||||
// xmlMapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||
// String xmlString = xmlMapper.writeValueAsString(rootNode);
|
||||
//
|
||||
// System.out.println(jsonObject.toString());
|
||||
String cmd1 = "curl -u " + geoUsername + ":" + geoPassword +" -X POST -H \"Content-type: application/xml\" "+ "\"" + url + "/gwc/rest/layers/"+shpWorkspace+":"+layerName+"\" " + "-d" +" '"+s1+"'";
|
||||
HttpResponse curl1 = curl(cmd1);
|
||||
HttpEntity entity1 = curl1.getEntity();
|
||||
String s = EntityUtils.toString(entity1, "UTF-8");
|
||||
map.put("shp", shp);
|
||||
map.put("image", image);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定图层进行切片操作 * * @param layer 指定图层 shp:test * @param zoomStart 1 切片开始层级 * @param zoomStop 15 切片结束层级 * @return boolean
|
||||
*/
|
||||
public static boolean slice(String layer, int zoomStart, int zoomStop) {
|
||||
int threadCount = 2;
|
||||
String res = "";
|
||||
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -XPOST -H \"Content-type: text/xml\" -d '" + layer + "4326" + zoomStart + "" + zoomStop + "image/png" + layer + "" + threadCount + "' \"" + url + "/gwc/rest/seed/" + layer + ".xml\"";
|
||||
HttpResponse curl = curl(cmd);
|
||||
StatusLine statusLine = curl.getStatusLine();
|
||||
return "HTTP/1.1 200 ".equals(statusLine.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取切片的情况 * * @param layer 指定图层 * @return Map
|
||||
*/
|
||||
public static Map getSliceType(String layer) {
|
||||
Map map = new HashMap();
|
||||
//返回所有图层切片情况 curl -u : -XGET http://localhost:8080/geoserver/gwc/rest/seed.json //返回指定图层的切片情况
|
||||
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -XGET " + url + "/gwc/rest/seed/" + layer + ".json";
|
||||
HttpResponse curl = curl(cmd);
|
||||
StatusLine statusLine = curl.getStatusLine();
|
||||
if ("HTTP/1.1 200 ".equals(statusLine.toString())) {
|
||||
HttpEntity entity = curl.getEntity();
|
||||
try {
|
||||
String result = EntityUtils.toString(entity, "UTF-8");
|
||||
System.out.println(result);
|
||||
JSONArray jsonArray = JSONArray.from(result);
|
||||
map.put("res", jsonArray);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止所有正在进行的切片任务 * * @return boolean
|
||||
*/
|
||||
public static boolean stopAllSlice() {
|
||||
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -d \"kill_all=all\" \"" + url + "/gwc/rest/seed\"";
|
||||
HttpResponse curl = curl(cmd);
|
||||
StatusLine statusLine = curl.getStatusLine();
|
||||
return "HTTP/1.1 200 ".equals(statusLine.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止指定图层的切片任务 * * @return boolean
|
||||
*/
|
||||
public static boolean stopSliceByLayer(String layer) {
|
||||
String cmd = "curl -u " + geoUsername + ":" + geoPassword + " -d \"kill_all=all\" \"" + url + "/gwc/rest/seed/" + layer + "\"";
|
||||
HttpResponse curl = curl(cmd);
|
||||
StatusLine statusLine = curl.getStatusLine();
|
||||
return "HTTP/1.1 200 ".equals(statusLine.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.ApplicationData;
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023_04_06
|
||||
*/
|
||||
public interface IApplicationDataService {
|
||||
|
||||
AjaxResult createApplication(ApplicationData applicationData);
|
||||
|
||||
AjaxResult createProject(ProjectDataRelation projectDataRelation);
|
||||
|
||||
List<ApplicationData> getAllApplication();
|
||||
|
||||
AjaxResult getApplicationById(Integer id);
|
||||
|
||||
List<DataStore> getServerByType(String spaceType);
|
||||
|
||||
AjaxResult addServer(ProjectDataRelation projectDataRelation);
|
||||
|
||||
AjaxResult deleteIds(int[] ids);
|
||||
|
||||
AjaxResult getProjectName(Integer id);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
|
||||
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图层存储表Service接口
|
||||
*
|
||||
* @author LGD
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
public interface IDataStoreService
|
||||
{
|
||||
/**
|
||||
* 查询图层存储表
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 图层存储表
|
||||
*/
|
||||
public DataStore selectDataStoreById(Long id);
|
||||
|
||||
/**
|
||||
* 查询图层存储表列表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 图层存储表集合
|
||||
*/
|
||||
public List<DataStore> selectDataStoreList(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 新增图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDataStore(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 修改图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDataStore(DataStore dataStore);
|
||||
|
||||
/**
|
||||
* 批量删除图层存储表
|
||||
*
|
||||
* @param ids 需要删除的图层存储表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataStoreByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除图层存储表信息
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDataStoreById(Integer id) throws Exception;
|
||||
|
||||
|
||||
public List<Map> selectDataStoreListByTableName(String tableName);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.ProjectDataRelationMars;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
public interface IProjectDataRelationMarsService extends IService<ProjectDataRelationMars> {
|
||||
/**
|
||||
* 创建项目组火星
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
AjaxResult createMars(ProjectDataRelationMars projectDataRelationMars);
|
||||
|
||||
/**
|
||||
* 项目组添加图层服务
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addMarsServer(ProjectDataRelationMars projectDataRelationMars);
|
||||
|
||||
AjaxResult getTree(String areaName);
|
||||
|
||||
AjaxResult deleteIds(int[] ids);
|
||||
|
||||
AjaxResult getProjectName(String areaName);
|
||||
|
||||
AjaxResult findStyleById(Long id);
|
||||
|
||||
AjaxResult updateStyle(Long id, String style,String type,String updateStyle,String properties,Integer sort);
|
||||
|
||||
AjaxResult getTableName(Long id);
|
||||
|
||||
AjaxResult getApplicationTree(String areaName);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.StyleImage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
public interface IStyleImageService extends IService<StyleImage> {
|
||||
|
||||
AjaxResult uploadStyleImage(HttpServletRequest request)throws IOException;
|
||||
|
||||
AjaxResult getAllStyleImage();
|
||||
|
||||
AjaxResult deleteIds(int[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.entity.StyleRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 样式Service接口
|
||||
*
|
||||
* @author lgd
|
||||
* @date 2023-08-09
|
||||
*/
|
||||
public interface IStyleRecordService
|
||||
{
|
||||
/**
|
||||
* 查询样式
|
||||
*
|
||||
* @param styleName 样式主键
|
||||
* @return 样式
|
||||
*/
|
||||
public StyleRecord selectStyleRecordByStyleName(String styleName);
|
||||
|
||||
/**
|
||||
* 查询样式列表
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 样式集合
|
||||
*/
|
||||
public List<StyleRecord> selectStyleRecordList(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 新增样式
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStyleRecord(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 修改样式
|
||||
*
|
||||
* @param styleRecord 样式
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateStyleRecord(StyleRecord styleRecord);
|
||||
|
||||
/**
|
||||
* 批量删除样式
|
||||
*
|
||||
* @param styleNames 需要删除的样式主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStyleRecordByStyleNames(String[] styleNames);
|
||||
|
||||
/**
|
||||
* 删除样式信息
|
||||
*
|
||||
* @param styleName 样式主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStyleRecordByStyleName(String styleName);
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.StyleServerMapbox;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
public interface IStyleServerMapboxService extends IService<StyleServerMapbox> {
|
||||
boolean saveStyleServerMapbox(StyleServerMapbox styleServerMapbox);
|
||||
|
||||
AjaxResult findStyleById(String serverName);
|
||||
|
||||
AjaxResult updateStyle(StyleServerMapbox styleServerMapbox);
|
||||
|
||||
AjaxResult getUrlByServerName(String serverName);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,10 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
|
||||
public interface LoginService {
|
||||
String login(String username, String password);
|
||||
|
||||
|
||||
AjaxResult logout(String token);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.zzlh.es.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zzlh.es.entity.TUser;
|
||||
|
||||
public interface TUserService extends IService<TUser> {
|
||||
/**
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
public TUser findByName(String username);
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.*;
|
||||
import com.zzlh.es.mapper.ApplicationDataMapper;
|
||||
import com.zzlh.es.mapper.DataStoreMapper;
|
||||
import com.zzlh.es.mapper.ProjectDataRelationMapper;
|
||||
import com.zzlh.es.service.IApplicationDataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023_04_06
|
||||
*/
|
||||
@Service
|
||||
public class ApplicationDataServiceImpl extends ServiceImpl<ApplicationDataMapper, ApplicationData> implements IApplicationDataService {
|
||||
@Autowired
|
||||
private DataStoreMapper dataStoreMapper;
|
||||
@Autowired
|
||||
private ApplicationDataMapper applicationDataMapper;
|
||||
@Autowired
|
||||
private ProjectDataRelationMapper projectDataRelationMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult createApplication(ApplicationData applicationData) {
|
||||
QueryWrapper<ApplicationData> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("application_name", applicationData.getApplicationName());
|
||||
if (applicationDataMapper.selectOne(queryWrapper) != null) {
|
||||
return AjaxResult.error(APPLICATION_EXIST, "应用已经存在,请重新命名");
|
||||
}
|
||||
if (applicationDataMapper.insertApplicationData(applicationData)) {
|
||||
return AjaxResult.success(applicationData.getId());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult createProject(ProjectDataRelation projectDataRelation) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("application_id", projectDataRelation.getApplicationId());
|
||||
queryWrapper.eq("project_team_name", projectDataRelation.getProjectTeamName());
|
||||
List<ProjectDataRelation> list = projectDataRelationMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list) && list.size() > 0) {
|
||||
return AjaxResult.error(REPEAT_ADD, "重复添加");
|
||||
}
|
||||
if (projectDataRelationMapper.insert(projectDataRelation) > 0) {
|
||||
return AjaxResult.success(projectDataRelation.getApplicationId());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationData> getAllApplication() {
|
||||
List<ApplicationData> applicationDataList = applicationDataMapper.getAllApplication();
|
||||
if (!CollectionUtils.isEmpty(applicationDataList)) {
|
||||
return applicationDataList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getApplicationById(Integer id) {
|
||||
|
||||
|
||||
List<ApplicationBo> applicationBoList = applicationDataMapper.getApplicationById(id);
|
||||
if (!CollectionUtils.isEmpty(applicationBoList)) {
|
||||
Map<String, List<ApplicationBo>> groupMap = applicationBoList.stream().collect(Collectors.groupingBy(ApplicationBo::getProjectTeamName));
|
||||
ArrayList<TreeLableBo> arrayList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<ApplicationBo>> map : groupMap.entrySet()) {
|
||||
TreeLableBo treeLableBo = new TreeLableBo();
|
||||
treeLableBo.setServerName(map.getKey());
|
||||
if(StringUtils.isEmpty(map.getValue().get(0).getServerStoreId())){
|
||||
treeLableBo.setChildren(null);
|
||||
}else{
|
||||
treeLableBo.setChildren(map.getValue());
|
||||
}
|
||||
List<Integer> ids = map.getValue().stream().map(ApplicationBo::getProjectDataRelationId).collect(Collectors.toList());
|
||||
treeLableBo.setIds(ids);
|
||||
arrayList.add(treeLableBo);
|
||||
}
|
||||
return AjaxResult.success(arrayList);
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataStore> getServerByType(String spaceType) {
|
||||
List<DataStore> dataStores = dataStoreMapper.selectDataStore(spaceType);
|
||||
if (!CollectionUtils.isEmpty(dataStores)) {
|
||||
return dataStores;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addServer(ProjectDataRelation projectDataRelation) {
|
||||
|
||||
//根据项目组id查看是否已经存在项目组 没有则创建
|
||||
ProjectDataRelation projectData = projectDataRelationMapper.findExist(projectDataRelation.getProjectTeamName(),projectDataRelation.getApplicationId());
|
||||
if (projectData == null) {
|
||||
return AjaxResult.error(PROJECT_NULL, "当前项目组不存在,请刷新页面重试");
|
||||
}
|
||||
//如果当前id的项目组ServerStoreId是空的 则判定这是一个新的项目组还未添加信息 修改项目组信息
|
||||
if (projectData.getServerStoreId() == null) {
|
||||
Integer integer = projectDataRelationMapper.updateProject(projectDataRelation);
|
||||
if (integer == null || integer != 1) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else {//如果当前id的项目组ServerStoreId不为空的 则创建一个项目组与当前项目组名称一致的
|
||||
if (projectDataRelation.getApplicationId() == null) {
|
||||
return AjaxResult.error(APPLICATION_ID_NULL, "应用id不能为空");
|
||||
} else if (projectDataRelation.getServerStoreId() == null) {
|
||||
return AjaxResult.error(SERVER_ID_NULL, "服务id不能为空");
|
||||
} else if (StringUtils.isEmpty(projectDataRelation.getServerName())) {
|
||||
return AjaxResult.error(SERVER_NAME_NULL, "服务名称不能为空");
|
||||
} else if (StringUtils.isEmpty(projectDataRelation.getProjectTeamName())) {
|
||||
return AjaxResult.error(PROJECT_NAME_NULL, "项目组名称不能为空");
|
||||
}
|
||||
//项目组不为空 为项目组添加新的图层服务
|
||||
Integer insert = projectDataRelationMapper.insert(projectDataRelation);
|
||||
if (insert != null && insert > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteIds(int[] ids) {
|
||||
List<Integer> list = Arrays.stream(ids).boxed().collect(Collectors.toList());
|
||||
int count = projectDataRelationMapper.deleteBatchIds(list);
|
||||
if (count > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProjectName(Integer id) {
|
||||
List<ProjectDataRelation> list = projectDataRelationMapper.selectList(null);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
List<String> collect = list.stream()
|
||||
.filter(distinctByKey(e -> e.getProjectTeamName())).map(ProjectDataRelation::getProjectTeamName)
|
||||
.collect(Collectors.toList());
|
||||
return AjaxResult.success(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义比较方法
|
||||
*
|
||||
* @param keyExtractor
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||
Map<Object, Boolean> map = new ConcurrentHashMap<>();
|
||||
return t -> map.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
|
||||
import com.zzlh.es.entity.DataStore;
|
||||
import com.zzlh.es.mapper.DataStoreMapper;
|
||||
import com.zzlh.es.mapper.GeoServerDao;
|
||||
import com.zzlh.es.service.GeoServer;
|
||||
import com.zzlh.es.service.IDataStoreService;
|
||||
import com.zzlh.es.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 图层存储表Service业务层处理
|
||||
*
|
||||
* @author LGD
|
||||
* @date 2023-03-27
|
||||
*/
|
||||
@Service
|
||||
public class DataStoreServiceImpl implements IDataStoreService
|
||||
{
|
||||
@Autowired
|
||||
private DataStoreMapper dataStoreMapper;
|
||||
|
||||
@Autowired
|
||||
private GeoServer geoServer;
|
||||
|
||||
@Autowired
|
||||
private GeoServerDao geoServerDao;
|
||||
/**
|
||||
* 查询图层存储表
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 图层存储表
|
||||
*/
|
||||
@Override
|
||||
public DataStore selectDataStoreById(Long id)
|
||||
{
|
||||
return dataStoreMapper.selectDataStoreById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询图层存储表列表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 图层存储表
|
||||
*/
|
||||
@Override
|
||||
public List<DataStore> selectDataStoreList(DataStore dataStore)
|
||||
{
|
||||
return dataStoreMapper.selectDataStoreList(dataStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDataStore(DataStore dataStore)
|
||||
{
|
||||
dataStore.setCreateTime(DateUtils.getNowDate());
|
||||
return dataStoreMapper.insertDataStore(dataStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改图层存储表
|
||||
*
|
||||
* @param dataStore 图层存储表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDataStore(DataStore dataStore)
|
||||
{
|
||||
return dataStoreMapper.updateDataStore(dataStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除图层存储表
|
||||
*
|
||||
* @param ids 需要删除的图层存储表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataStoreByIds(Long[] ids)
|
||||
{
|
||||
return dataStoreMapper.deleteDataStoreByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图层存储表信息
|
||||
*
|
||||
* @param id 图层存储表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDataStoreById(Integer id) throws Exception
|
||||
{
|
||||
int i = dataStoreMapper.selectCountMapBoxById(id.toString());
|
||||
int i1 = dataStoreMapper.selectCountMarsById(id.toString());
|
||||
if (i>0||i1>0){
|
||||
return 0;
|
||||
}
|
||||
DataStore dataStore = dataStoreMapper.selectDataStoreById(Long.valueOf(id));
|
||||
geoServer.removeLayer(dataStore.getTableRef());
|
||||
dataStoreMapper.deleteMapBoxByName(dataStore.getSeverName());
|
||||
dataStoreMapper.deleteDataStoreById(Long.valueOf(id));
|
||||
int i2 = geoServerDao.selectTableCount(dataStore.getTableRef());
|
||||
if (i2 > 0) geoServerDao.deleteTable(dataStore.getTableRef());
|
||||
|
||||
int i3 = geoServerDao.selectSeqCount(dataStore.getTableRef() + "_seq");
|
||||
if (i3 > 0) geoServerDao.deleteSequence(dataStore.getTableRef() + "_seq");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> selectDataStoreListByTableName(String tableName) {
|
||||
return dataStoreMapper.selectDataStoreListByTableName(tableName);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzlh.es.entity.DictData;
|
||||
import com.zzlh.es.mapper.DictDataMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
@Service
|
||||
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements IDictDataService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.zzlh.es.entity.DictData;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
public interface IDictDataService extends IService<DictData> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
public interface IProjectDataRelationService extends IService<ProjectDataRelation> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.zzlh.es.entity.StyleParameterMapbox;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
public interface IStyleParameterMapboxService extends IService<StyleParameterMapbox> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.properties.JwtProperties;
|
||||
import com.zzlh.es.exception.BusinessException;
|
||||
import com.zzlh.es.service.LoginService;
|
||||
import com.zzlh.es.utils.JwtTokenUtil;
|
||||
import com.zzlh.es.utils.RedisUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.LOGOUT_ERROR;
|
||||
import static com.zzlh.es.constant.HttpStatus.PASSWORD_ERROR;
|
||||
|
||||
/**
|
||||
* @author soeasy
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@Autowired
|
||||
private AuthenticationManagerBuilder authenticationManager;
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
@Autowired
|
||||
private JwtTokenUtil jwtTokenUtil;
|
||||
@Autowired
|
||||
private JwtProperties jwtProperties;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
/**
|
||||
* token规范前缀
|
||||
*/
|
||||
|
||||
private static final String HAND = "Bearer ";
|
||||
|
||||
@Override
|
||||
public String login(String username, String password) {
|
||||
UsernamePasswordAuthenticationToken upToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
//验证用户名和密码
|
||||
try{
|
||||
final Authentication authentication = authenticationManager.getOrBuild().authenticate(upToken);
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}catch (AuthenticationException e){
|
||||
if(e.getMessage().contains("Bad credentials")){
|
||||
throw new BusinessException(PASSWORD_ERROR,"密码错误");
|
||||
}
|
||||
}
|
||||
final UserDetails userDetails = userDetailsService.loadUserByUsername(username);
|
||||
final String token = HAND + jwtTokenUtil.generateToken(userDetails);
|
||||
//将 token 保存到redis
|
||||
if (redisUtil.set(userDetails.getUsername()+token, token, jwtProperties.getExpiration())) {
|
||||
log.info("token save key:"+userDetails.getUsername()+token);
|
||||
return token;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult logout(String authorization) {
|
||||
final String token = authorization.replace(jwtProperties.getTokenHead(), "");
|
||||
String username = jwtTokenUtil.getUsernameFromToken(token);
|
||||
if (redisUtil.del(username+authorization)) {
|
||||
return AjaxResult.success("退出成功");
|
||||
}
|
||||
return AjaxResult.error(LOGOUT_ERROR, "退出失败,请重试");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,400 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.*;
|
||||
import com.zzlh.es.entity.vo.DataRelationMarsVo;
|
||||
import com.zzlh.es.mapper.DataStoreMapper;
|
||||
import com.zzlh.es.mapper.ProjectDataRelationMarsMapper;
|
||||
import com.zzlh.es.mapper.StyleParameterMarsMapper;
|
||||
import com.zzlh.es.service.IProjectDataRelationMarsService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.PROJECT_NULL;
|
||||
import static com.zzlh.es.constant.HttpStatus.REPEAT_ADD;
|
||||
import static com.zzlh.es.service.GeoServer.shpWorkspace;
|
||||
import static com.zzlh.es.service.GeoServer.url;
|
||||
import static com.zzlh.es.service.ipml.ApplicationDataServiceImpl.distinctByKey;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-05-19
|
||||
*/
|
||||
@Service
|
||||
public class ProjectDataRelationMarsServiceImpl extends ServiceImpl<ProjectDataRelationMarsMapper, ProjectDataRelationMars> implements IProjectDataRelationMarsService {
|
||||
|
||||
@Autowired
|
||||
private DataStoreMapper dataStoreMapper;
|
||||
@Autowired
|
||||
private ProjectDataRelationMarsMapper projectDataRelationMarsMapper;
|
||||
@Autowired
|
||||
private StyleParameterMarsMapper styleParameterMarsMapper;
|
||||
|
||||
|
||||
@Value("${geoserver.shpworkspace}")
|
||||
private String shpworkspace;
|
||||
/**
|
||||
* 创建项目组
|
||||
*
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult createMars(ProjectDataRelationMars projectDataRelationMars) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("project_team_name", projectDataRelationMars.getProjectTeamName());
|
||||
queryWrapper.eq("area_name",projectDataRelationMars.getAreaName());
|
||||
List<ProjectDataRelationMars> list = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.error(REPEAT_ADD, "重复添加");
|
||||
}
|
||||
if (projectDataRelationMarsMapper.insertMars(projectDataRelationMars)) {
|
||||
Long id = projectDataRelationMars.getId();
|
||||
StyleParameterMars styleParameterMars = styleParameterMarsMapper.selectOne(null);
|
||||
String json = styleParameterMars.getPattr();
|
||||
//替换id
|
||||
json = json.replace("1", id.toString());
|
||||
//替换名称
|
||||
json = json.replace("names", projectDataRelationMars.getProjectTeamName());
|
||||
projectDataRelationMars.setPAttribute(json);
|
||||
if (projectDataRelationMarsMapper.updateById(projectDataRelationMars) > 0) {
|
||||
return AjaxResult.success(projectDataRelationMars.getAttribute());
|
||||
}
|
||||
return AjaxResult.error();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加服务
|
||||
*
|
||||
* @param projectDataRelationMars
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult addMarsServer(ProjectDataRelationMars projectDataRelationMars) {
|
||||
System.out.println(projectDataRelationMars.toString());
|
||||
//根据项目组id查看是否已经存在项目组
|
||||
ProjectDataRelationMars projectData = projectDataRelationMarsMapper.findExist(projectDataRelationMars.getProjectTeamName());
|
||||
if (projectData == null) {
|
||||
return AjaxResult.error(PROJECT_NULL, "当前项目组不存在,请刷新页面重试");
|
||||
}
|
||||
if (StringUtils.isEmpty(projectDataRelationMars.getServerStoreId())) {
|
||||
return AjaxResult.error("服务id不能为空");
|
||||
}
|
||||
DataStore dataStore = dataStoreMapper.selectDataStoreById(Long.valueOf(projectDataRelationMars.getServerStoreId()));
|
||||
if (dataStore == null) {
|
||||
return AjaxResult.error("当前服务不存在");
|
||||
}
|
||||
StyleParameterMars styleParameterMars = styleParameterMarsMapper.selectOne(null);
|
||||
String json;
|
||||
String pattr=projectData.getPAttribute();
|
||||
//截取父ID
|
||||
String p=pattr.substring(pattr.indexOf(":")+1,pattr.indexOf(","));
|
||||
if (dataStore.getDataType().equals("点")) {
|
||||
json = styleParameterMars.getSymbol();
|
||||
//id
|
||||
json = json.replace("111", projectDataRelationMars.getServerStoreId());
|
||||
//pid
|
||||
json = json.replace("222", p);
|
||||
json = json.replace("names", projectDataRelationMars.getServerName());
|
||||
String u = "geoserver"+"/"+shpWorkspace + "/ows?service=WFS&version=1.0.0" +
|
||||
"&request=GetFeature&typeName=" + shpWorkspace + "%3A" + dataStore.getTableRef() + "&maxFeatures=1000000&outputFormat=application%2Fjson";
|
||||
json = json.replace("symbolUrl", u);
|
||||
|
||||
} else {
|
||||
json = styleParameterMars.getLineAndFill();
|
||||
//id
|
||||
json = json.replace("111", projectDataRelationMars.getServerStoreId());
|
||||
//pid
|
||||
json = json.replace("222", p);
|
||||
//name
|
||||
json = json.replace("names", projectDataRelationMars.getServerName());
|
||||
String u ="geoserver"+"/"+ shpWorkspace + "/wms";
|
||||
json = json.replace("lineAndFillUrl", u);
|
||||
json = json.replace("layerss", shpWorkspace + ":" + dataStore.getTableRef());
|
||||
}
|
||||
projectDataRelationMars.setPAttribute(projectData.getPAttribute());
|
||||
//如果当前id的项目组ServerStoreId是空的 则判定这是一个新的项目组还未添加信息 修改项目组信息
|
||||
// if (projectData.getServerStoreId() == null) {
|
||||
// projectDataRelationMars.setAttribute(json);
|
||||
// projectDataRelationMars.setId(projectData.getId());
|
||||
// if (projectDataRelationMarsMapper.updateById(projectDataRelationMars) > 0) {
|
||||
// return AjaxResult.success(projectDataRelationMars.getAttribute());
|
||||
// }
|
||||
// return AjaxResult.error("添加失败");
|
||||
// } else {//如果当前id的项目组ServerStoreId不为空的 则创建一个项目组
|
||||
projectDataRelationMars.setAttribute(json);
|
||||
int insert = 0;
|
||||
try {
|
||||
insert = projectDataRelationMarsMapper.insert(projectDataRelationMars);
|
||||
} catch (DuplicateKeyException e){
|
||||
e.printStackTrace();
|
||||
return AjaxResult.success(projectDataRelationMars.getAttribute());
|
||||
}
|
||||
//项目组不为空 为项目组添加新的图层服务
|
||||
if (insert > 0) {
|
||||
return AjaxResult.success(projectDataRelationMars.getAttribute());
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getTree(String areaName) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<ProjectDataRelationMars>();
|
||||
queryWrapper.eq("area_name",areaName);
|
||||
|
||||
List<ProjectDataRelationMars> applicationBoList = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(applicationBoList)) {
|
||||
Map<String, List<ProjectDataRelationMars>> groupMap = applicationBoList.stream().collect(Collectors.groupingBy(ProjectDataRelationMars::getProjectTeamName));
|
||||
ArrayList<TreeLableMarsBo> arrayList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<ProjectDataRelationMars>> map : groupMap.entrySet()) {
|
||||
TreeLableMarsBo treeLableBo = new TreeLableMarsBo();
|
||||
treeLableBo.setServerName(map.getKey());
|
||||
|
||||
if (!StringUtils.isEmpty(map.getValue().get(0).getPAttribute())) {
|
||||
treeLableBo.setAttr(map.getValue().get(0).getPAttribute());
|
||||
}
|
||||
if (map.getValue().size()==1) {
|
||||
treeLableBo.setId(map.getValue().get(0).getId());
|
||||
treeLableBo.setSort(map.getValue().get(0).getSort());
|
||||
treeLableBo.setChildren(null);
|
||||
} else {
|
||||
List<ProjectDataRelationMars> value = map.getValue();
|
||||
for (int i = 0; i < value.size(); i++) {
|
||||
if (StringUtils.isEmpty(value.get(i).getServerStoreId())){
|
||||
treeLableBo.setId(value.get(i).getId());
|
||||
treeLableBo.setSort(value.get(i).getSort());
|
||||
value.remove(i);
|
||||
}
|
||||
}
|
||||
List<ProjectDataRelationMars> collect = value.stream().sorted(Comparator.comparing(ProjectDataRelationMars::getSort,Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||
treeLableBo.setChildren(collect);
|
||||
}
|
||||
List<Long> ids = map.getValue().stream().map(ProjectDataRelationMars::getId).collect(Collectors.toList());
|
||||
treeLableBo.setIds(ids);
|
||||
arrayList.add(treeLableBo);
|
||||
}
|
||||
List<TreeLableMarsBo> collect = arrayList.stream().sorted(Comparator.comparing(TreeLableMarsBo::getSort, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||
return AjaxResult.success(collect);
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteIds(int[] ids) {
|
||||
List<Integer> list = Arrays.stream(ids).boxed().collect(Collectors.toList());
|
||||
if (projectDataRelationMarsMapper.deleteBatchIds(list) > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getProjectName(String areaName) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<ProjectDataRelationMars>();
|
||||
queryWrapper.eq("area_name",areaName);
|
||||
List<ProjectDataRelationMars> list = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
List<String> collect = list.stream()
|
||||
.filter(distinctByKey(e -> e.getProjectTeamName())).map(ProjectDataRelationMars::getProjectTeamName)
|
||||
.collect(Collectors.toList());
|
||||
return AjaxResult.success(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult findStyleById(Long id) {
|
||||
return AjaxResult.success(projectDataRelationMarsMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public AjaxResult updateStyle(Long id, String style, String type,String updateStyle,String properties,Integer sort) {
|
||||
ProjectDataRelationMars mars=projectDataRelationMarsMapper.selectById(id);
|
||||
mars.setSort(sort);
|
||||
if ( mars== null) {
|
||||
return AjaxResult.error("当前树结构不存在");
|
||||
}
|
||||
if(StringUtils.isEmpty(updateStyle)){
|
||||
return AjaxResult.error("修改名称不能为空");
|
||||
}
|
||||
|
||||
if (type.equals("1") || type.equals("2")) {
|
||||
ProjectDataRelationMars projectDataRelationMars = new ProjectDataRelationMars();
|
||||
projectDataRelationMars.setSort(sort);
|
||||
if(!StringUtils.isEmpty(properties)){
|
||||
projectDataRelationMars.setProperties(properties);
|
||||
}
|
||||
if (type.equals("1")) {
|
||||
projectDataRelationMars.setId(id);
|
||||
projectDataRelationMars.setPAttribute(style);
|
||||
if(!updateStyle.trim().equals(mars.getProjectTeamName().trim())){
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("project_team_name", updateStyle);
|
||||
List<ProjectDataRelationMars> list = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.error( "当前名称已经存在,请重新编辑名称");
|
||||
}
|
||||
if(updateStyle.contains(mars.getPAttribute())){
|
||||
return AjaxResult.error("当前名称已经存在,或存在字串冲突");
|
||||
}
|
||||
String pAttr=mars.getPAttribute();
|
||||
projectDataRelationMars.setPAttribute(pAttr.replace(mars.getProjectTeamName(),updateStyle));
|
||||
projectDataRelationMars.setProjectTeamName(updateStyle);
|
||||
}
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("project_team_name", mars.getProjectTeamName());
|
||||
List<ProjectDataRelationMars> list = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
for (ProjectDataRelationMars project:list) {
|
||||
if (id.longValue()==project.getId().longValue()){
|
||||
project.setSort(sort);
|
||||
}
|
||||
project.setProjectTeamName(updateStyle);
|
||||
project.setPAttribute(project.getPAttribute().replace(mars.getProjectTeamName(),updateStyle));
|
||||
projectDataRelationMarsMapper.updateById(project);
|
||||
}
|
||||
|
||||
return AjaxResult.success(mars.getServerName());
|
||||
} else {
|
||||
projectDataRelationMars.setId(id);
|
||||
projectDataRelationMars.setAttribute(style);
|
||||
projectDataRelationMars.setServerName(updateStyle);
|
||||
if (projectDataRelationMarsMapper.updateById(projectDataRelationMars) > 0) {
|
||||
return AjaxResult.success(mars.getServerName());
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error("样式类型不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getTableName(Long id) {
|
||||
return AjaxResult.success(dataStoreMapper.selectDataStoreById(id));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult getApplicationTree(String areaName) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<ProjectDataRelationMars>();
|
||||
queryWrapper.eq("area_name",areaName);
|
||||
|
||||
List<ProjectDataRelationMars> applicationBoList = projectDataRelationMarsMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(applicationBoList)) {
|
||||
Map<String, List<ProjectDataRelationMars>> groupMap = applicationBoList.stream().collect(Collectors.groupingBy(ProjectDataRelationMars::getProjectTeamName));
|
||||
ArrayList<TreeLabelMarsApp> arrayList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<ProjectDataRelationMars>> map : groupMap.entrySet()) {
|
||||
TreeLabelMarsApp treeLableBo = new TreeLabelMarsApp();
|
||||
treeLableBo.setServerName(map.getKey());
|
||||
|
||||
if (!StringUtils.isEmpty(map.getValue().get(0).getPAttribute())) {
|
||||
|
||||
treeLableBo.setAttr(map.getValue().get(0).getPAttribute());
|
||||
}
|
||||
|
||||
|
||||
if (map.getValue().size()==1) {
|
||||
treeLableBo.setId(map.getValue().get(0).getId());
|
||||
treeLableBo.setSort(map.getValue().get(0).getSort());
|
||||
treeLableBo.setChildren(null);
|
||||
} else {
|
||||
List<ProjectDataRelationMars> value = map.getValue();
|
||||
List<DataRelationMarsVo> dataRelationMarsVos = new ArrayList<>();
|
||||
for (int k = 0; k < value.size(); k++) {
|
||||
DataRelationMarsVo dataRelationMarsVo = new DataRelationMarsVo();
|
||||
BeanUtils.copyProperties(value.get(k),dataRelationMarsVo);
|
||||
if (!StringUtils.isEmpty(value.get(k).getAttribute())) {
|
||||
ProjectDataRelationMars projectDataRelationMars = value.get(k);
|
||||
DataStore dataStore = dataStoreMapper.selectDataStoreById(Long.parseLong(projectDataRelationMars.getServerStoreId()));
|
||||
if (dataStore==null)continue;
|
||||
JSONObject jsonObject = JSON.parseObject(value.get(k).getAttribute());
|
||||
dataRelationMarsVo.setUrl(jsonObject.getString("url"));
|
||||
dataRelationMarsVo.setType(jsonObject.getString("type"));
|
||||
JSONObject symbol = jsonObject.getJSONObject("symbol");
|
||||
if (symbol==null){
|
||||
dataRelationMarsVo.setImage("");
|
||||
dataRelationMarsVo.setLabel("");
|
||||
}else {
|
||||
JSONObject styleOptions = symbol.getJSONObject("styleOptions");
|
||||
if (styleOptions==null){
|
||||
dataRelationMarsVo.setImage("");
|
||||
dataRelationMarsVo.setLabel("");
|
||||
}else {
|
||||
dataRelationMarsVo.setImage(styleOptions.getString("image"));
|
||||
JSONObject label = styleOptions.getJSONObject("label");
|
||||
if (label==null){
|
||||
dataRelationMarsVo.setLabel("");
|
||||
}else {
|
||||
dataRelationMarsVo.setLabel(label.getString("text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String layers = "";
|
||||
if (StringUtils.isEmpty(jsonObject.getString("layers"))){
|
||||
layers = shpworkspace+":"+dataStore.getTableRef();
|
||||
}else {
|
||||
layers = jsonObject.getString("layers");
|
||||
}
|
||||
dataRelationMarsVo.setLayers(layers);
|
||||
String type = "";
|
||||
if ("点".equals(dataStore.getDataType())){
|
||||
type = "POINT";
|
||||
}else if ("面".equals(dataStore.getDataType())){
|
||||
type = "MULTIPOLYGON";
|
||||
}else if ("线".equals(dataStore.getDataType())){
|
||||
type = "MULTILINESTRING";
|
||||
}
|
||||
dataRelationMarsVo.setGeomType(type);
|
||||
System.out.println(jsonObject.toJSONString());
|
||||
}
|
||||
dataRelationMarsVo.setAttribute("");
|
||||
dataRelationMarsVos.add(dataRelationMarsVo);
|
||||
}
|
||||
for (int i = 0; i < dataRelationMarsVos.size(); i++) {
|
||||
if (StringUtils.isEmpty(dataRelationMarsVos.get(i).getServerStoreId())){
|
||||
treeLableBo.setId(dataRelationMarsVos.get(i).getId());
|
||||
treeLableBo.setSort(dataRelationMarsVos.get(i).getSort());
|
||||
dataRelationMarsVos.remove(i);
|
||||
}
|
||||
}
|
||||
List<DataRelationMarsVo> collect = dataRelationMarsVos.stream().sorted(Comparator.comparing(ProjectDataRelationMars::getSort,Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||
treeLableBo.setChildren(collect);
|
||||
}
|
||||
List<Long> ids = map.getValue().stream().map(ProjectDataRelationMars::getId).collect(Collectors.toList());
|
||||
treeLableBo.setIds(ids);
|
||||
arrayList.add(treeLableBo);
|
||||
}
|
||||
List<TreeLabelMarsApp> collect = arrayList.stream().sorted(Comparator.comparing(TreeLabelMarsApp::getSort, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||
return AjaxResult.success(collect);
|
||||
} else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzlh.es.entity.ProjectDataRelation;
|
||||
import com.zzlh.es.mapper.ProjectDataRelationMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-08
|
||||
*/
|
||||
@Service
|
||||
public class ProjectDataRelationServiceImpl extends ServiceImpl<ProjectDataRelationMapper, ProjectDataRelation> implements IProjectDataRelationService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,168 @@
|
|||
package com.zzlh.es.service.ipml;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzlh.es.domain.AjaxResult;
|
||||
import com.zzlh.es.entity.StyleImage;
|
||||
import com.zzlh.es.exception.BusinessException;
|
||||
import com.zzlh.es.mapper.StyleImageMapper;
|
||||
import com.zzlh.es.mapper.StyleServerMapboxMapper;
|
||||
import com.zzlh.es.service.IStyleImageService;
|
||||
import com.zzlh.es.webupload.util.FileHandleUtil;
|
||||
import com.zzlh.es.webupload.util.FileUploadConfig;
|
||||
import com.zzlh.es.webupload.util.IPUtils;
|
||||
import com.zzlh.es.webupload.util.IdWorker;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zzlh.es.constant.HttpStatus.*;
|
||||
import static com.zzlh.es.utils.UserHolder.getUserDetail;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wyl
|
||||
* @since 2023-04-12
|
||||
*/
|
||||
@Service
|
||||
public class StyleImageServiceImpl extends ServiceImpl<StyleImageMapper, StyleImage> implements IStyleImageService {
|
||||
|
||||
@Autowired
|
||||
private IdWorker idWorker;
|
||||
|
||||
@Autowired
|
||||
private FileUploadConfig fileUploadConfig;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StyleImageMapper styleImageMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private StyleServerMapboxMapper styleServerMapboxMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult uploadStyleImage(HttpServletRequest request) throws IOException {
|
||||
Long nowtime = System.currentTimeMillis();
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> files = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entry : files.entrySet()) {
|
||||
MultipartFile multipartFile = entry.getValue();
|
||||
if (multipartFile.isEmpty()) {
|
||||
return AjaxResult.error(FILE_NULL,"文件不能为空");
|
||||
}
|
||||
String contentType = multipartFile.getContentType();
|
||||
System.out.println("contentType:" + contentType);
|
||||
|
||||
String fileName = multipartFile.getOriginalFilename();
|
||||
Long size = multipartFile.getSize();
|
||||
System.out.println(fileName + "-->" + size);
|
||||
|
||||
|
||||
//计算MD5值
|
||||
String filemd5 = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
|
||||
//查询数据库是否已经有了,有直接写入,没有,写入磁盘
|
||||
StyleImage style = null;
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("md5_value", filemd5);
|
||||
List<StyleImage> list = styleImageMapper.selectList(queryWrapper);
|
||||
if (list.size() > 0) {
|
||||
style = list.get(0);
|
||||
}
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String fileType = contentType.split("/")[0];
|
||||
|
||||
if (style == null) {
|
||||
String pathTypeDir = fileUploadConfig.getStyleImage() + fileType + "/";
|
||||
String localPath = fileUploadConfig.getUploadFolder() + fileUploadConfig.getLocalPath() + pathTypeDir;
|
||||
String fileSuffix = "";
|
||||
if (!StringUtils.isEmpty(fileName)) {
|
||||
//随机生成服务器本地路径
|
||||
fileSuffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
}
|
||||
String serverFileName = idWorker.nextId() + fileSuffix;
|
||||
FileHandleUtil.upload(multipartFile.getInputStream(), localPath, serverFileName);
|
||||
String netWorkPath = "/" + pathTypeDir + serverFileName;
|
||||
StyleImage styleImage = new StyleImage();
|
||||
styleImage.setUploadCount(1);
|
||||
styleImage.setFileSize(size);
|
||||
styleImage.setFileType(fileType);
|
||||
styleImage.setMd5Value(filemd5);
|
||||
styleImage.setOrgName(fileName);
|
||||
styleImage.setServerLocalName(serverFileName);
|
||||
styleImage.setServerLocalPath(localPath + serverFileName);
|
||||
styleImage.setNetworkPath(netWorkPath);
|
||||
styleImage.setCreateTime(new Date());
|
||||
styleImage.setCreateBy("admin");
|
||||
String device = request.getHeader("User-Agent");
|
||||
styleImage.setUploadDevice(device);
|
||||
String ipAddr = IPUtils.getIpAddr(request);
|
||||
styleImage.setUploadIp(ipAddr);
|
||||
map.put("network",fileUploadConfig.getImageServerIp()+styleImage.getNetworkPath());
|
||||
this.save(styleImage);
|
||||
} else {
|
||||
|
||||
return AjaxResult.error(REPEAT_UPLOAD,"重复上传");
|
||||
}
|
||||
System.out.println("耗时: " + (System.currentTimeMillis() - nowtime) + " ms");
|
||||
return AjaxResult.success(map);
|
||||
|
||||
}
|
||||
return AjaxResult.error(UPLOAD_ERROR,"文件上传错误");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getAllStyleImage() {
|
||||
|
||||
|
||||
List<StyleImage> list = styleImageMapper.selectList(new QueryWrapper<>());
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<Object> data = new ArrayList<>();
|
||||
for (StyleImage styleImage : list) {
|
||||
Integer id = styleImage.getId();
|
||||
String networkPath = fileUploadConfig.getImageServerIp() + styleImage.getNetworkPath();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", id);
|
||||
map.put("networkPath", networkPath);
|
||||
data.add(map);
|
||||
}
|
||||
return AjaxResult.success(data);
|
||||
|
||||
}
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult deleteIds(int[] ids) {
|
||||
List<Integer> list = Arrays.stream(ids).boxed().collect(Collectors.toList());
|
||||
List<StyleImage> lists=styleImageMapper.selectBatchIds(list);
|
||||
if(CollectionUtils.isEmpty(lists)){
|
||||
return AjaxResult.error(SELECTED_NOT_EXIST,"当前选中的图标不存在或已删除");
|
||||
}
|
||||
for(StyleImage styleImage:lists){
|
||||
QueryWrapper queryWrapper=new QueryWrapper();
|
||||
queryWrapper.eq("img_url",fileUploadConfig.getImageServerIp() +styleImage.getNetworkPath());
|
||||
if(!CollectionUtils.isEmpty(styleServerMapboxMapper.selectList(queryWrapper))){
|
||||
throw new BusinessException(IMAGE_USED,"当前选中图标存在已经绑定图层服务");
|
||||
}
|
||||
if(FileHandleUtil.delete(styleImage.getServerLocalPath())){
|
||||
styleImageMapper.deleteById(styleImage.getId());
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue