Compare commits
25 Commits
-
2demo/.gitattributes
-
33demo/.gitignore
-
19demo/.mvn/wrapper/maven-wrapper.properties
-
BINdemo/D/gold1/28e9edfd-aa22-4c31-a74e-ae68c8b66a59.jpg
-
BINdemo/D/gold1/2b025217-b7eb-4818-b513-889c08b2c983.jpg
-
BINdemo/D/gold1/4c824a9a-83df-4112-a1df-1f40f2f4c2bd.jpg
-
BINdemo/D/gold1/5e764b09-b20c-4343-9fe9-b1708eafcba4.jpg
-
BINdemo/D/gold1/6d4f9126-0d3a-4660-82cc-e67f06903c5b.jpg
-
BINdemo/D/gold1/7fc2344d-af91-4a44-b335-8776d695c784.jpg
-
BINdemo/D/gold1/8f9f5b4e-1fdb-4daf-b694-9c7896c2257b.jpg
-
BINdemo/D/gold1/91a6a1e2-4ecb-4cb4-96fa-110ff32ab76f.jpg
-
BINdemo/D/gold1/a03c0819-007c-4a3a-8680-7c4bf2873851.jpg
-
BINdemo/D/gold1/b2aaf655-e021-40fd-bfb5-25995e577597.jpg
-
BINdemo/D/gold1/b898e8f2-3fec-403b-9fc8-fb5dbe796855.jpg
-
BINdemo/D/gold1/b9aac9b5-3d06-48d6-8d02-61145d81adb0.jpg
-
BINdemo/D/gold1/c864ab82-2218-428c-8493-2006afa049c1.jpg
-
2demo/admin/.gitattributes
-
33demo/admin/.gitignore
-
19demo/admin/.mvn/wrapper/maven-wrapper.properties
-
259demo/admin/mvnw
-
149demo/admin/mvnw.cmd
-
83demo/admin/pom.xml
-
16demo/admin/src/main/java/com/example/admin/AdminApplication.java
-
60demo/admin/src/main/java/com/example/admin/controller/AdminController.java
-
57demo/admin/src/main/java/com/example/admin/mapper/AdminMapper.java
-
12demo/admin/src/main/java/com/example/admin/mian/qwe.java
-
82demo/admin/src/main/java/com/example/admin/service/AdminServiceImpl.java
-
26demo/admin/src/main/java/com/example/admin/service/UserDetailServiceImpl.java
-
23demo/admin/src/main/resources/application.yml
-
13demo/admin/src/test/java/com/example/admin/AdminApplicationTests.java
-
2demo/audit/.gitattributes
-
33demo/audit/.gitignore
-
19demo/audit/.mvn/wrapper/maven-wrapper.properties
-
259demo/audit/mvnw
-
149demo/audit/mvnw.cmd
-
78demo/audit/pom.xml
-
16demo/audit/src/main/java/com/example/audit/AuditApplication.java
-
62demo/audit/src/main/java/com/example/audit/controller/AuditController.java
-
70demo/audit/src/main/java/com/example/audit/mapper/AuditMapper.java
-
54demo/audit/src/main/java/com/example/audit/service/AuditServiceImpl.java
-
22demo/audit/src/main/resources/application.yml
-
13demo/audit/src/test/java/com/example/audit/AuditApplicationTests.java
-
2demo/commons/.gitattributes
-
33demo/commons/.gitignore
-
19demo/commons/.mvn/wrapper/maven-wrapper.properties
-
259demo/commons/mvnw
-
149demo/commons/mvnw.cmd
-
67demo/commons/pom.xml
-
203demo/commons/src/main/java/com/example/commons/Util/CaptchaUtil.java
-
190demo/commons/src/main/java/com/example/commons/Util/JWTUtil.java
-
39demo/commons/src/main/java/com/example/commons/Util/MD5Util.java
-
54demo/commons/src/main/java/com/example/commons/Util/UploadUtil.java
-
31demo/commons/src/main/java/com/example/commons/domain/entity/Activity.java
-
65demo/commons/src/main/java/com/example/commons/domain/entity/Admin.java
-
27demo/commons/src/main/java/com/example/commons/domain/entity/Audit.java
-
59demo/commons/src/main/java/com/example/commons/domain/entity/Detail.java
-
26demo/commons/src/main/java/com/example/commons/domain/entity/Product.java
-
23demo/commons/src/main/java/com/example/commons/domain/entity/Rate.java
-
34demo/commons/src/main/java/com/example/commons/domain/entity/Recharge.java
-
27demo/commons/src/main/java/com/example/commons/domain/entity/User.java
-
42demo/commons/src/main/java/com/example/commons/domain/vo/ConsumeDetail.java
-
52demo/commons/src/main/java/com/example/commons/domain/vo/DetailVo.java
-
21demo/commons/src/main/java/com/example/commons/domain/vo/Page.java
-
40demo/commons/src/main/java/com/example/commons/domain/vo/RechargeVo.java
-
45demo/commons/src/main/java/com/example/commons/domain/vo/Result.java
-
46demo/commons/src/main/java/com/example/commons/domain/vo/Statistics.java
-
18demo/commons/src/main/java/com/example/commons/domain/vo/Statisticss.java
-
73demo/commons/src/main/java/com/example/commons/domain/vo/SumCoin.java
-
144demo/commons/src/main/java/com/example/commons/security/SecurityConfig.java
-
52demo/commons/src/main/java/com/example/commons/security/TokenFilter.java
-
17demo/commons/src/main/java/com/example/commons/sevice/ActivityService.java
-
16demo/commons/src/main/java/com/example/commons/sevice/AdminService.java
-
18demo/commons/src/main/java/com/example/commons/sevice/AuditService.java
-
22demo/commons/src/main/java/com/example/commons/sevice/ConsumeService.java
-
14demo/commons/src/main/java/com/example/commons/sevice/DetailService.java
-
9demo/commons/src/main/java/com/example/commons/sevice/ProductService.java
-
16demo/commons/src/main/java/com/example/commons/sevice/RateService.java
-
20demo/commons/src/main/java/com/example/commons/sevice/RechargeService.java
-
21demo/commons/src/main/java/com/example/commons/sevice/RefundService.java
-
25demo/commons/src/main/java/com/example/commons/sevice/StatisticsService.java
-
13demo/commons/src/main/java/com/example/commons/sevice/UserSevice.java
-
13demo/commons/src/test/java/com/example/commons/CommonsApplicationTests.java
-
2demo/consume/.gitattributes
-
33demo/consume/.gitignore
-
19demo/consume/.mvn/wrapper/maven-wrapper.properties
-
259demo/consume/mvnw
-
149demo/consume/mvnw.cmd
-
81demo/consume/pom.xml
-
15demo/consume/src/main/java/com/example/consume/ConsumeApplication.java
-
73demo/consume/src/main/java/com/example/consume/controller/ConsumeController.java
-
80demo/consume/src/main/java/com/example/consume/mapper/ConsumeMapper.java
-
63demo/consume/src/main/java/com/example/consume/service/ConsumeServiceImpl.java
-
22demo/consume/src/main/resources/application.yml
-
13demo/consume/src/test/java/com/example/consume/ConsumeApplicationTests.java
-
259demo/mvnw
-
149demo/mvnw.cmd
-
140demo/pom.xml
-
2demo/recharge/.gitattributes
-
33demo/recharge/.gitignore
-
19demo/recharge/.mvn/wrapper/maven-wrapper.properties
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
After Width: 1080 | Height: 1386 | Size: 477 KiB |
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
@ -0,0 +1,259 @@ |
|||||
|
#!/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 |
||||
|
# |
||||
|
# http://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. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
set -euf |
||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
||||
|
|
||||
|
# OS specific support. |
||||
|
native_path() { printf %s\\n "$1"; } |
||||
|
case "$(uname)" in |
||||
|
CYGWIN* | MINGW*) |
||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
||||
|
native_path() { cygpath --path --windows "$1"; } |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# set JAVACMD and JAVACCMD |
||||
|
set_java_home() { |
||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
||||
|
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" |
||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
JAVACCMD="$JAVA_HOME/bin/javac" |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v java |
||||
|
)" || : |
||||
|
JAVACCMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v javac |
||||
|
)" || : |
||||
|
|
||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# hash string like Java String::hashCode |
||||
|
hash_string() { |
||||
|
str="${1:-}" h=0 |
||||
|
while [ -n "$str" ]; do |
||||
|
char="${str%"${str#?}"}" |
||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
||||
|
str="${str#?}" |
||||
|
done |
||||
|
printf %x\\n $h |
||||
|
} |
||||
|
|
||||
|
verbose() { :; } |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
||||
|
|
||||
|
die() { |
||||
|
printf %s\\n "$1" >&2 |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
trim() { |
||||
|
# MWRAPPER-139: |
||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
||||
|
# Needed for removing poorly interpreted newline sequences when running in more |
||||
|
# exotic environments such as mingw bash on Windows. |
||||
|
printf "%s" "${1}" | tr -d '[:space:]' |
||||
|
} |
||||
|
|
||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
while IFS="=" read -r key value; do |
||||
|
case "${key-}" in |
||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
||||
|
esac |
||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
|
||||
|
case "${distributionUrl##*/}" in |
||||
|
maven-mvnd-*bin.*) |
||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
||||
|
*) |
||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
||||
|
distributionPlatform=linux-amd64 |
||||
|
;; |
||||
|
esac |
||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
||||
|
;; |
||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
||||
|
esac |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
distributionUrlNameMain="${distributionUrlName%.*}" |
||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
||||
|
|
||||
|
exec_maven() { |
||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
||||
|
} |
||||
|
|
||||
|
if [ -d "$MAVEN_HOME" ]; then |
||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
exec_maven "$@" |
||||
|
fi |
||||
|
|
||||
|
case "${distributionUrl-}" in |
||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
||||
|
esac |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
||||
|
trap clean HUP INT TERM EXIT |
||||
|
else |
||||
|
die "cannot create temp dir" |
||||
|
fi |
||||
|
|
||||
|
mkdir -p -- "${MAVEN_HOME%/*}" |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
verbose "Downloading from: $distributionUrl" |
||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
# select .zip or .tar.gz |
||||
|
if ! command -v unzip >/dev/null; then |
||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
fi |
||||
|
|
||||
|
# verbose opt |
||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
||||
|
|
||||
|
# normalize http auth |
||||
|
case "${MVNW_PASSWORD:+has-password}" in |
||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
||||
|
verbose "Found wget ... using wget" |
||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
||||
|
verbose "Found curl ... using curl" |
||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
||||
|
elif set_java_home; then |
||||
|
verbose "Falling back to use Java to download" |
||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
cat >"$javaSource" <<-END |
||||
|
public class Downloader extends java.net.Authenticator |
||||
|
{ |
||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication() |
||||
|
{ |
||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
||||
|
} |
||||
|
public static void main( String[] args ) throws Exception |
||||
|
{ |
||||
|
setDefault( new Downloader() ); |
||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
||||
|
} |
||||
|
} |
||||
|
END |
||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
||||
|
verbose " - Compiling Downloader.java ..." |
||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
||||
|
verbose " - Running Downloader.java ..." |
||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
||||
|
fi |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
if [ -n "${distributionSha256Sum-}" ]; then |
||||
|
distributionSha256Result=false |
||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then |
||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2 |
||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
elif command -v sha256sum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
elif command -v shasum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
else |
||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ $distributionSha256Result = false ]; then |
||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
# unzip and move |
||||
|
if command -v unzip >/dev/null; then |
||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
||||
|
else |
||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
||||
|
fi |
||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
||||
|
|
||||
|
clean || : |
||||
|
exec_maven "$@" |
@ -0,0 +1,149 @@ |
|||||
|
<# : batch portion |
||||
|
@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
||||
|
@SET __MVNW_CMD__= |
||||
|
@SET __MVNW_ERROR__= |
||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
||||
|
@SET PSModulePath= |
||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
||||
|
) |
||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
||||
|
@SET __MVNW_PSMODULEP_SAVE= |
||||
|
@SET __MVNW_ARG0_NAME__= |
||||
|
@SET MVNW_USERNAME= |
||||
|
@SET MVNW_PASSWORD= |
||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
||||
|
@GOTO :EOF |
||||
|
: end batch / begin powershell #> |
||||
|
|
||||
|
$ErrorActionPreference = "Stop" |
||||
|
if ($env:MVNW_VERBOSE -eq "true") { |
||||
|
$VerbosePreference = "Continue" |
||||
|
} |
||||
|
|
||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
||||
|
if (!$distributionUrl) { |
||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
||||
|
} |
||||
|
|
||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
||||
|
"maven-mvnd-*" { |
||||
|
$USE_MVND = $true |
||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
||||
|
$MVN_CMD = "mvnd.cmd" |
||||
|
break |
||||
|
} |
||||
|
default { |
||||
|
$USE_MVND = $false |
||||
|
$MVN_CMD = $script -replace '^mvnw','mvn' |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
if ($env:MVNW_REPOURL) { |
||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
||||
|
} |
||||
|
$distributionUrlName = $distributionUrl -replace '^.*/','' |
||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
||||
|
if ($env:MAVEN_USER_HOME) { |
||||
|
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
||||
|
} |
||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
||||
|
|
||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
||||
|
exit $? |
||||
|
} |
||||
|
|
||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
||||
|
} |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
||||
|
trap { |
||||
|
if ($TMP_DOWNLOAD_DIR.Exists) { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
Write-Verbose "Downloading from: $distributionUrl" |
||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
$webclient = New-Object System.Net.WebClient |
||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
||||
|
} |
||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
||||
|
if ($distributionSha256Sum) { |
||||
|
if ($USE_MVND) { |
||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
||||
|
} |
||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# unzip and move |
||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
||||
|
try { |
||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
||||
|
} catch { |
||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
||||
|
Write-Error "fail to move MAVEN_HOME" |
||||
|
} |
||||
|
} finally { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
|
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
@ -0,0 +1,83 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>admin</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
<name>admin</name> |
||||
|
<description>admin</description> |
||||
|
<parent> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>demo</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>commons</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-devtools</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.mysql</groupId> |
||||
|
<artifactId>mysql-connector-j</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter-test</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||
|
<artifactId>maven-compiler-plugin</artifactId> |
||||
|
</plugin> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<excludes> |
||||
|
<exclude> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
</exclude> |
||||
|
</excludes> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,16 @@ |
|||||
|
package com.example.admin; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.context.annotation.ComponentScan; |
||||
|
|
||||
|
@SpringBootApplication |
||||
|
@ComponentScan(basePackages = {"com.example.commons.security","com.example.admin"}) |
||||
|
|
||||
|
public class AdminApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(AdminApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
package com.example.admin.controller; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.Util.JWTUtil; |
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import com.example.commons.domain.vo.Page; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.commons.sevice.AdminService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/admin") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class AdminController { |
||||
|
|
||||
|
|
||||
|
private final AdminService adminService; |
||||
|
|
||||
|
@PostMapping("/search") |
||||
|
public Result search(@RequestBody Page page){ |
||||
|
if(ObjectUtils.isEmpty(page.getPageNum())){ |
||||
|
return Result.success(adminService.search(page.getAdmin())); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(adminService.searchForPage(page.getPageNum(), page.getPageSize(), page.getAdmin())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/login") |
||||
|
public Result login(@RequestBody Admin admin){ |
||||
|
|
||||
|
try { |
||||
|
admin = adminService.login(admin); |
||||
|
String token = JWTUtil.createJWT(admin); |
||||
|
admin.setPassword(null); |
||||
|
return Result.success(token,admin); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
log.error(e.getMessage()); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
@PostMapping("/userinfo") |
||||
|
public UserDetails getUserInfo(@RequestHeader("token") String token) { |
||||
|
try { |
||||
|
return JWTUtil.getUserDetailsList(token,Admin.class); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,57 @@ |
|||||
|
package com.example.admin.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface AdminMapper { |
||||
|
@Insert({ |
||||
|
"insert into admin", |
||||
|
"(name,username,password,permission,area,admin_flag,create_time)", |
||||
|
"values", |
||||
|
"(#{name},#{username},,#{password},#{permission},#{area},#{admin_flag},now())" |
||||
|
}) |
||||
|
@Options(useGeneratedKeys = true,keyColumn = "admin_id",keyProperty = "adminId") |
||||
|
int insert(Admin admin); |
||||
|
|
||||
|
@Update({ |
||||
|
"<script>", |
||||
|
"UPDATE admin", |
||||
|
"<set>", |
||||
|
"<if test='name!=null and name.length()>0'>name =#{name},</if>", |
||||
|
"<if test='username!=null and username.length()>0'>username =#{username},</if>", |
||||
|
"<if test='password!=null and password.length()>0'>password =#{password},</if>", |
||||
|
"<if test='permission!=null and permission.length()>0'>permission =#{permission},</if>", |
||||
|
"<if test='area!=null and area.length()>0'>area =#{area},</if>", |
||||
|
"<if test='adminFlag!=null and adminFlag.length()>0'>admin_flag =#{adminFlag},</if>", |
||||
|
"</set>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
int update(Admin admin); |
||||
|
@Select({ |
||||
|
"select * from admin", |
||||
|
"where admin_id=#{adminId}" |
||||
|
}) |
||||
|
Admin selectById(Integer adminId); |
||||
|
@Select({ |
||||
|
"select * from admin", |
||||
|
"where username=#{username}" |
||||
|
}) |
||||
|
Admin selectByName(String username); |
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"SELECT * from admin", |
||||
|
"<where>", |
||||
|
"<if test='name!=null and name.length()>0'> and `name` like concat('%',#{name},'%'),</if>", |
||||
|
"<if test='username!=null and username.length()>0'> and `username` like concat('%',#{username},'%'),</if>", |
||||
|
"<if test='permission!=null'> and permission=#{permission},</if>", |
||||
|
"<if test='area!=null and area.length()>0'> and `area` like concat('%',#{area},'%'),</if>", |
||||
|
"<if test='adminFlag!=null'> and admin_flag =#{adminFlag},</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<Admin> select(Admin admin); |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.example.admin.mian; |
||||
|
|
||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||
|
|
||||
|
public class qwe { |
||||
|
public static void main(String[] args) { |
||||
|
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); |
||||
|
String rawPassword = "123"; |
||||
|
String encodedPassword = encoder.encode(rawPassword); |
||||
|
System.out.println("Encoded password: " + encodedPassword); |
||||
|
} |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.example.admin.service; |
||||
|
|
||||
|
import com.example.admin.mapper.AdminMapper; |
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import com.example.commons.security.SecurityConfig; |
||||
|
import com.example.commons.security.TokenFilter; |
||||
|
import com.example.commons.sevice.AdminService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
|
||||
|
|
||||
|
import org.springframework.security.authentication.AuthenticationManager; |
||||
|
import org.springframework.security.authentication.BadCredentialsException; |
||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
||||
|
import org.springframework.security.core.Authentication; |
||||
|
import org.springframework.security.crypto.password.PasswordEncoder; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class AdminServiceImpl implements AdminService { |
||||
|
@Autowired |
||||
|
private SecurityConfig securityConfig; |
||||
|
private final AdminMapper adminMapper; |
||||
|
@Autowired |
||||
|
private AuthenticationManager authenticationManager; |
||||
|
@Autowired |
||||
|
private PasswordEncoder passwordEncoder; |
||||
|
|
||||
|
@Override |
||||
|
public int add(Admin admin) { |
||||
|
return adminMapper.insert(admin); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int edit(Admin admin) { |
||||
|
return adminMapper.update(admin); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Admin findById(Integer adminId) { |
||||
|
return adminMapper.selectById(adminId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Admin findByUsername(String username) { |
||||
|
return adminMapper.selectByName(username); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Admin> search(Admin admin) { |
||||
|
return adminMapper.select(admin); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<Admin> searchForPage(Integer pageNum, Integer pageSize, Admin admin) { |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
List<Admin> list = adminMapper.select(admin); |
||||
|
return new PageInfo<>(list); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Admin login(Admin admin) throws Exception { |
||||
|
UsernamePasswordAuthenticationToken token = |
||||
|
new UsernamePasswordAuthenticationToken(admin.getUsername(),admin.getPassword()); |
||||
|
try { |
||||
|
Authentication authentication = authenticationManager.authenticate(token); |
||||
|
Admin loginAdmin = (Admin) authentication.getPrincipal(); |
||||
|
|
||||
|
return loginAdmin; |
||||
|
}catch (BadCredentialsException exception){ |
||||
|
throw new BadCredentialsException("用户或密码错误"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.example.admin.service; |
||||
|
|
||||
|
import com.example.admin.mapper.AdminMapper; |
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
import org.springframework.security.core.userdetails.UserDetailsService; |
||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class UserDetailServiceImpl implements UserDetailsService { |
||||
|
@Autowired |
||||
|
private AdminMapper adminMapper; |
||||
|
@Override |
||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
||||
|
Admin admin=adminMapper.selectByName(username); |
||||
|
if(ObjectUtils.isEmpty(admin)){ |
||||
|
throw new UsernameNotFoundException("用户名不存在"); |
||||
|
} |
||||
|
return admin; |
||||
|
} |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
server: |
||||
|
port: 10070 |
||||
|
|
||||
|
spring: |
||||
|
datasource: |
||||
|
hikari: # HikariCP连接池配置 |
||||
|
maximum-pool-size: 10 # 最大连接数 |
||||
|
minimum-idle: 5 # 最小空闲连接数 |
||||
|
idle-timeout: 30000 # 空闲连接超时时间(毫秒) |
||||
|
max-lifetime: 1800000 # 连接最大存活时间(毫秒) |
||||
|
connection-timeout: 30000 # 连接超时时间(毫秒) |
||||
|
pool-name: HwgoldHikariCP # 连接池名称 |
||||
|
driver-class-name: com.mysql.cj.jdbc.Driver |
||||
|
url: jdbc:mysql://39.101.133.168/hwgold?serverTimezone=GMT%2b8 |
||||
|
username: hwgold |
||||
|
password: 'AGX4Z3YMxiCG3GR2' |
||||
|
application: |
||||
|
name: recharge |
||||
|
mybatis: |
||||
|
configuration: |
||||
|
map-underscore-to-camel-case: true |
||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
||||
|
|
@ -0,0 +1,13 @@ |
|||||
|
package com.example.admin; |
||||
|
|
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
class AdminApplicationTests { |
||||
|
|
||||
|
@Test |
||||
|
void contextLoads() { |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
@ -0,0 +1,259 @@ |
|||||
|
#!/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 |
||||
|
# |
||||
|
# http://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. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
set -euf |
||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
||||
|
|
||||
|
# OS specific support. |
||||
|
native_path() { printf %s\\n "$1"; } |
||||
|
case "$(uname)" in |
||||
|
CYGWIN* | MINGW*) |
||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
||||
|
native_path() { cygpath --path --windows "$1"; } |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# set JAVACMD and JAVACCMD |
||||
|
set_java_home() { |
||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
||||
|
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" |
||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
JAVACCMD="$JAVA_HOME/bin/javac" |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v java |
||||
|
)" || : |
||||
|
JAVACCMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v javac |
||||
|
)" || : |
||||
|
|
||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# hash string like Java String::hashCode |
||||
|
hash_string() { |
||||
|
str="${1:-}" h=0 |
||||
|
while [ -n "$str" ]; do |
||||
|
char="${str%"${str#?}"}" |
||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
||||
|
str="${str#?}" |
||||
|
done |
||||
|
printf %x\\n $h |
||||
|
} |
||||
|
|
||||
|
verbose() { :; } |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
||||
|
|
||||
|
die() { |
||||
|
printf %s\\n "$1" >&2 |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
trim() { |
||||
|
# MWRAPPER-139: |
||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
||||
|
# Needed for removing poorly interpreted newline sequences when running in more |
||||
|
# exotic environments such as mingw bash on Windows. |
||||
|
printf "%s" "${1}" | tr -d '[:space:]' |
||||
|
} |
||||
|
|
||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
while IFS="=" read -r key value; do |
||||
|
case "${key-}" in |
||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
||||
|
esac |
||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
|
||||
|
case "${distributionUrl##*/}" in |
||||
|
maven-mvnd-*bin.*) |
||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
||||
|
*) |
||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
||||
|
distributionPlatform=linux-amd64 |
||||
|
;; |
||||
|
esac |
||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
||||
|
;; |
||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
||||
|
esac |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
distributionUrlNameMain="${distributionUrlName%.*}" |
||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
||||
|
|
||||
|
exec_maven() { |
||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
||||
|
} |
||||
|
|
||||
|
if [ -d "$MAVEN_HOME" ]; then |
||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
exec_maven "$@" |
||||
|
fi |
||||
|
|
||||
|
case "${distributionUrl-}" in |
||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
||||
|
esac |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
||||
|
trap clean HUP INT TERM EXIT |
||||
|
else |
||||
|
die "cannot create temp dir" |
||||
|
fi |
||||
|
|
||||
|
mkdir -p -- "${MAVEN_HOME%/*}" |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
verbose "Downloading from: $distributionUrl" |
||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
# select .zip or .tar.gz |
||||
|
if ! command -v unzip >/dev/null; then |
||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
fi |
||||
|
|
||||
|
# verbose opt |
||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
||||
|
|
||||
|
# normalize http auth |
||||
|
case "${MVNW_PASSWORD:+has-password}" in |
||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
||||
|
verbose "Found wget ... using wget" |
||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
||||
|
verbose "Found curl ... using curl" |
||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
||||
|
elif set_java_home; then |
||||
|
verbose "Falling back to use Java to download" |
||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
cat >"$javaSource" <<-END |
||||
|
public class Downloader extends java.net.Authenticator |
||||
|
{ |
||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication() |
||||
|
{ |
||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
||||
|
} |
||||
|
public static void main( String[] args ) throws Exception |
||||
|
{ |
||||
|
setDefault( new Downloader() ); |
||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
||||
|
} |
||||
|
} |
||||
|
END |
||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
||||
|
verbose " - Compiling Downloader.java ..." |
||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
||||
|
verbose " - Running Downloader.java ..." |
||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
||||
|
fi |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
if [ -n "${distributionSha256Sum-}" ]; then |
||||
|
distributionSha256Result=false |
||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then |
||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2 |
||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
elif command -v sha256sum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
elif command -v shasum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
else |
||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ $distributionSha256Result = false ]; then |
||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
# unzip and move |
||||
|
if command -v unzip >/dev/null; then |
||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
||||
|
else |
||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
||||
|
fi |
||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
||||
|
|
||||
|
clean || : |
||||
|
exec_maven "$@" |
@ -0,0 +1,149 @@ |
|||||
|
<# : batch portion |
||||
|
@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
||||
|
@SET __MVNW_CMD__= |
||||
|
@SET __MVNW_ERROR__= |
||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
||||
|
@SET PSModulePath= |
||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
||||
|
) |
||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
||||
|
@SET __MVNW_PSMODULEP_SAVE= |
||||
|
@SET __MVNW_ARG0_NAME__= |
||||
|
@SET MVNW_USERNAME= |
||||
|
@SET MVNW_PASSWORD= |
||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
||||
|
@GOTO :EOF |
||||
|
: end batch / begin powershell #> |
||||
|
|
||||
|
$ErrorActionPreference = "Stop" |
||||
|
if ($env:MVNW_VERBOSE -eq "true") { |
||||
|
$VerbosePreference = "Continue" |
||||
|
} |
||||
|
|
||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
||||
|
if (!$distributionUrl) { |
||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
||||
|
} |
||||
|
|
||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
||||
|
"maven-mvnd-*" { |
||||
|
$USE_MVND = $true |
||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
||||
|
$MVN_CMD = "mvnd.cmd" |
||||
|
break |
||||
|
} |
||||
|
default { |
||||
|
$USE_MVND = $false |
||||
|
$MVN_CMD = $script -replace '^mvnw','mvn' |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
if ($env:MVNW_REPOURL) { |
||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
||||
|
} |
||||
|
$distributionUrlName = $distributionUrl -replace '^.*/','' |
||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
||||
|
if ($env:MAVEN_USER_HOME) { |
||||
|
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
||||
|
} |
||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
||||
|
|
||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
||||
|
exit $? |
||||
|
} |
||||
|
|
||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
||||
|
} |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
||||
|
trap { |
||||
|
if ($TMP_DOWNLOAD_DIR.Exists) { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
Write-Verbose "Downloading from: $distributionUrl" |
||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
$webclient = New-Object System.Net.WebClient |
||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
||||
|
} |
||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
||||
|
if ($distributionSha256Sum) { |
||||
|
if ($USE_MVND) { |
||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
||||
|
} |
||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# unzip and move |
||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
||||
|
try { |
||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
||||
|
} catch { |
||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
||||
|
Write-Error "fail to move MAVEN_HOME" |
||||
|
} |
||||
|
} finally { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
|
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
@ -0,0 +1,78 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>audit</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
<name>audit</name> |
||||
|
<description>audit</description> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>demo</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-devtools</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.mysql</groupId> |
||||
|
<artifactId>mysql-connector-j</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter-test</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>commons</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<excludes> |
||||
|
|
||||
|
</excludes> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,16 @@ |
|||||
|
package com.example.audit; |
||||
|
|
||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.context.annotation.ComponentScan; |
||||
|
|
||||
|
@SpringBootApplication |
||||
|
@ComponentScan(basePackages = {"com.example.commons.security","com.example.audit"}) |
||||
|
public class AuditApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(AuditApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package com.example.audit.controller; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.vo.Page; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.commons.sevice.AuditService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/audit/audit") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class AuditController { |
||||
|
|
||||
|
private final AuditService auditService; |
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody Audit audit){ |
||||
|
try { |
||||
|
auditService.add(audit); |
||||
|
return Result.success(); |
||||
|
}catch (Exception e){ |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping("/edit") |
||||
|
public Result edit(@RequestBody Audit audit){ |
||||
|
try { |
||||
|
auditService.edit(audit); |
||||
|
return Result.success(); |
||||
|
}catch (Exception e){ |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping |
||||
|
public Result search(@RequestBody Page page){ |
||||
|
if(ObjectUtils.isEmpty(page.getPageNum())){ |
||||
|
return Result.success(auditService.search(page.getAudit())); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(auditService.searchForPage(page.getPageNum(),page.getPageSize(),page.getAudit())); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping("/refund") |
||||
|
public Result searchForPage(@RequestBody Page page){ |
||||
|
if(ObjectUtils.isEmpty(page.getPageNum())){ |
||||
|
return Result.success(auditService.searchForDetail(page.getConsumeDetail())); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(auditService.searchForConsumeDetail(page.getPageNum(), page.getPageSize(), page.getConsumeDetail())); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,70 @@ |
|||||
|
package com.example.audit.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.vo.ConsumeDetail; |
||||
|
import org.apache.ibatis.annotations.Insert; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
import org.apache.ibatis.annotations.Update; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface AuditMapper { |
||||
|
|
||||
|
@Insert({ |
||||
|
"INSERT INTO audit", |
||||
|
"(jwcode,recharge_id,refund_id,admin_id,reson,detail_id,status,audit_flag)", |
||||
|
"values", |
||||
|
"(#{jwcode},#{rechargeId},#{refundId},#{adminId},#{reson},#{detailId},0,1)" |
||||
|
}) |
||||
|
|
||||
|
int insert(Audit audit); |
||||
|
@Update({ |
||||
|
"<script>", |
||||
|
"update audit", |
||||
|
"<set>", |
||||
|
"<if test='adminId!=null'>admin_id=#{adminId},</if>", |
||||
|
"<if test='rechargeId!=null'>recharge_id=#{rechargeId},</if>", |
||||
|
"<if test='status!=null'>status=#{status},</if>", |
||||
|
"<if test='reson!=null and reson.length>0'>`reson`=#{reson}</if>", |
||||
|
"</set>", |
||||
|
"where audit_id=#{auditId}", |
||||
|
"</script>" |
||||
|
}) |
||||
|
int update(Audit audit); |
||||
|
|
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select * from audit", |
||||
|
"<where>", |
||||
|
|
||||
|
"<if test='jwcode!=null'>and jwcode=#{jwcode}</if>", |
||||
|
"<if test='startDate != null and endDate != null'>AND create_time BETWEEN #{startDate} AND #{endDate}</if>", |
||||
|
"<if test='rechargeId!=null'>and refund_id=#{fefundId}</if>", |
||||
|
"<if test='refundId!=null'>and refund_id=#{fefundId}</if>", |
||||
|
"<if test='status!=null'>and status=#{status}</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<Audit> select(Audit Audit); |
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select detail.*,audit.status,audit.reson,audit.audit_id,admin.*,user.name as user from detail", |
||||
|
"inner join audit on detail.detail_id = audit.refund_id", |
||||
|
"inner join `admin` on detail.admin_id = `admin`.admin_id", |
||||
|
"inner join `user` on detail.jwcode = user.jwcode", |
||||
|
"<where>", |
||||
|
|
||||
|
"<if test='activityId!=null'>and activity_id=#{activityId}</if>", |
||||
|
"<if test='adminId!=null'>and recharge.admin_id=#{adminId}</if>", |
||||
|
"<if test='startDate != null and endDate != null'>AND detail.create_time BETWEEN #{startDate} AND #{endDate}</if>", |
||||
|
"<if test='refundGoods!=null and refundGoods.length>0 '>and refund_goods like concat('%',#{refundGoods},'%')</if>", |
||||
|
"<if test='refundType!=null and refundType.length>0 '>and refund_type like concat('%',#{refundType},'%')</if>", |
||||
|
"<if test='area!=null and area.length>0'>and area like concat('%',#{area},'%')</if>", |
||||
|
"<if test='status!=null'>and audit.status=#{status}</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<ConsumeDetail> selectCon(ConsumeDetail consumeDetail); |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.example.audit.service; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.example.audit.mapper.AuditMapper; |
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.vo.ConsumeDetail; |
||||
|
import com.example.commons.sevice.AuditService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class AuditServiceImpl implements AuditService { |
||||
|
private final AuditMapper auditMapper; |
||||
|
|
||||
|
@Override |
||||
|
public int add(Audit audit) { |
||||
|
return auditMapper.insert(audit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int edit(Audit audit) { |
||||
|
return auditMapper.update(audit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Audit> search(Audit audit) { |
||||
|
return auditMapper.select(audit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<Audit> searchForPage(Integer pageNum, Integer pageSize, Audit audit) { |
||||
|
PageHelper.startPage(pageNum,pageSize); |
||||
|
List<Audit> list= auditMapper.select(audit); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<ConsumeDetail> searchForDetail(ConsumeDetail consumeDetail) { |
||||
|
return auditMapper.selectCon(consumeDetail); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<ConsumeDetail> searchForConsumeDetail(Integer pageNum, Integer pageSize, ConsumeDetail consumeDetail) { |
||||
|
PageHelper.startPage(pageNum,pageSize); |
||||
|
List<ConsumeDetail> list= auditMapper.selectCon(consumeDetail); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
server: |
||||
|
port: 10030 |
||||
|
|
||||
|
spring: |
||||
|
datasource: |
||||
|
hikari: # HikariCP连接池配置 |
||||
|
maximum-pool-size: 10 # 最大连接数 |
||||
|
minimum-idle: 5 # 最小空闲连接数 |
||||
|
idle-timeout: 30000 # 空闲连接超时时间(毫秒) |
||||
|
max-lifetime: 1800000 # 连接最大存活时间(毫秒) |
||||
|
connection-timeout: 30000 # 连接超时时间(毫秒) |
||||
|
pool-name: HwgoldHikariCP # 连接池名称 |
||||
|
driver-class-name: com.mysql.cj.jdbc.Driver |
||||
|
url: jdbc:mysql://39.101.133.168/hwgold?serverTimezone=GMT%2b8 |
||||
|
username: hwgold |
||||
|
password: 'AGX4Z3YMxiCG3GR2' |
||||
|
application: |
||||
|
name: recharge |
||||
|
mybatis: |
||||
|
configuration: |
||||
|
map-underscore-to-camel-case: true |
||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
@ -0,0 +1,13 @@ |
|||||
|
package com.example.audit; |
||||
|
|
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
class AuditApplicationTests { |
||||
|
|
||||
|
@Test |
||||
|
void contextLoads() { |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
@ -0,0 +1,259 @@ |
|||||
|
#!/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 |
||||
|
# |
||||
|
# http://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. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
set -euf |
||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
||||
|
|
||||
|
# OS specific support. |
||||
|
native_path() { printf %s\\n "$1"; } |
||||
|
case "$(uname)" in |
||||
|
CYGWIN* | MINGW*) |
||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
||||
|
native_path() { cygpath --path --windows "$1"; } |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# set JAVACMD and JAVACCMD |
||||
|
set_java_home() { |
||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
||||
|
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" |
||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
JAVACCMD="$JAVA_HOME/bin/javac" |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v java |
||||
|
)" || : |
||||
|
JAVACCMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v javac |
||||
|
)" || : |
||||
|
|
||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# hash string like Java String::hashCode |
||||
|
hash_string() { |
||||
|
str="${1:-}" h=0 |
||||
|
while [ -n "$str" ]; do |
||||
|
char="${str%"${str#?}"}" |
||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
||||
|
str="${str#?}" |
||||
|
done |
||||
|
printf %x\\n $h |
||||
|
} |
||||
|
|
||||
|
verbose() { :; } |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
||||
|
|
||||
|
die() { |
||||
|
printf %s\\n "$1" >&2 |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
trim() { |
||||
|
# MWRAPPER-139: |
||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
||||
|
# Needed for removing poorly interpreted newline sequences when running in more |
||||
|
# exotic environments such as mingw bash on Windows. |
||||
|
printf "%s" "${1}" | tr -d '[:space:]' |
||||
|
} |
||||
|
|
||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
while IFS="=" read -r key value; do |
||||
|
case "${key-}" in |
||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
||||
|
esac |
||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
|
||||
|
case "${distributionUrl##*/}" in |
||||
|
maven-mvnd-*bin.*) |
||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
||||
|
*) |
||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
||||
|
distributionPlatform=linux-amd64 |
||||
|
;; |
||||
|
esac |
||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
||||
|
;; |
||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
||||
|
esac |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
distributionUrlNameMain="${distributionUrlName%.*}" |
||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
||||
|
|
||||
|
exec_maven() { |
||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
||||
|
} |
||||
|
|
||||
|
if [ -d "$MAVEN_HOME" ]; then |
||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
exec_maven "$@" |
||||
|
fi |
||||
|
|
||||
|
case "${distributionUrl-}" in |
||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
||||
|
esac |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
||||
|
trap clean HUP INT TERM EXIT |
||||
|
else |
||||
|
die "cannot create temp dir" |
||||
|
fi |
||||
|
|
||||
|
mkdir -p -- "${MAVEN_HOME%/*}" |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
verbose "Downloading from: $distributionUrl" |
||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
# select .zip or .tar.gz |
||||
|
if ! command -v unzip >/dev/null; then |
||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
fi |
||||
|
|
||||
|
# verbose opt |
||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
||||
|
|
||||
|
# normalize http auth |
||||
|
case "${MVNW_PASSWORD:+has-password}" in |
||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
||||
|
verbose "Found wget ... using wget" |
||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
||||
|
verbose "Found curl ... using curl" |
||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
||||
|
elif set_java_home; then |
||||
|
verbose "Falling back to use Java to download" |
||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
cat >"$javaSource" <<-END |
||||
|
public class Downloader extends java.net.Authenticator |
||||
|
{ |
||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication() |
||||
|
{ |
||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
||||
|
} |
||||
|
public static void main( String[] args ) throws Exception |
||||
|
{ |
||||
|
setDefault( new Downloader() ); |
||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
||||
|
} |
||||
|
} |
||||
|
END |
||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
||||
|
verbose " - Compiling Downloader.java ..." |
||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
||||
|
verbose " - Running Downloader.java ..." |
||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
||||
|
fi |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
if [ -n "${distributionSha256Sum-}" ]; then |
||||
|
distributionSha256Result=false |
||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then |
||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2 |
||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
elif command -v sha256sum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
elif command -v shasum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
else |
||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ $distributionSha256Result = false ]; then |
||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
# unzip and move |
||||
|
if command -v unzip >/dev/null; then |
||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
||||
|
else |
||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
||||
|
fi |
||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
||||
|
|
||||
|
clean || : |
||||
|
exec_maven "$@" |
@ -0,0 +1,149 @@ |
|||||
|
<# : batch portion |
||||
|
@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
||||
|
@SET __MVNW_CMD__= |
||||
|
@SET __MVNW_ERROR__= |
||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
||||
|
@SET PSModulePath= |
||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
||||
|
) |
||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
||||
|
@SET __MVNW_PSMODULEP_SAVE= |
||||
|
@SET __MVNW_ARG0_NAME__= |
||||
|
@SET MVNW_USERNAME= |
||||
|
@SET MVNW_PASSWORD= |
||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
||||
|
@GOTO :EOF |
||||
|
: end batch / begin powershell #> |
||||
|
|
||||
|
$ErrorActionPreference = "Stop" |
||||
|
if ($env:MVNW_VERBOSE -eq "true") { |
||||
|
$VerbosePreference = "Continue" |
||||
|
} |
||||
|
|
||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
||||
|
if (!$distributionUrl) { |
||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
||||
|
} |
||||
|
|
||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
||||
|
"maven-mvnd-*" { |
||||
|
$USE_MVND = $true |
||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
||||
|
$MVN_CMD = "mvnd.cmd" |
||||
|
break |
||||
|
} |
||||
|
default { |
||||
|
$USE_MVND = $false |
||||
|
$MVN_CMD = $script -replace '^mvnw','mvn' |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
if ($env:MVNW_REPOURL) { |
||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
||||
|
} |
||||
|
$distributionUrlName = $distributionUrl -replace '^.*/','' |
||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
||||
|
if ($env:MAVEN_USER_HOME) { |
||||
|
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
||||
|
} |
||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
||||
|
|
||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
||||
|
exit $? |
||||
|
} |
||||
|
|
||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
||||
|
} |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
||||
|
trap { |
||||
|
if ($TMP_DOWNLOAD_DIR.Exists) { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
Write-Verbose "Downloading from: $distributionUrl" |
||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
$webclient = New-Object System.Net.WebClient |
||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
||||
|
} |
||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
||||
|
if ($distributionSha256Sum) { |
||||
|
if ($USE_MVND) { |
||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
||||
|
} |
||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# unzip and move |
||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
||||
|
try { |
||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
||||
|
} catch { |
||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
||||
|
Write-Error "fail to move MAVEN_HOME" |
||||
|
} |
||||
|
} finally { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
|
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
@ -0,0 +1,67 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>commons</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
<name>commons</name> |
||||
|
<description>commons</description> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>demo</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<dependencies> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
|
<version>3.0.3</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-devtools</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.mysql</groupId> |
||||
|
<artifactId>mysql-connector-j</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter-test</artifactId> |
||||
|
<version>3.0.3</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<excludes> |
||||
|
<exclude> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
</exclude> |
||||
|
</excludes> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,203 @@ |
|||||
|
package com.example.commons.Util; |
||||
|
|
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import org.apache.tomcat.util.codec.binary.Base64; |
||||
|
|
||||
|
import javax.imageio.ImageIO; |
||||
|
import java.awt.*; |
||||
|
import java.awt.image.BufferedImage; |
||||
|
import java.io.ByteArrayOutputStream; |
||||
|
import java.io.IOException; |
||||
|
import java.util.Random; |
||||
|
|
||||
|
/** |
||||
|
* Verification Code, 支持Base64 |
||||
|
* @author bobzyh |
||||
|
* |
||||
|
*/ |
||||
|
public class CaptchaUtil { |
||||
|
/* |
||||
|
* 宽度 |
||||
|
* 高度 |
||||
|
* 长度 |
||||
|
* 字符集 |
||||
|
*/ |
||||
|
private static final int WIDTH = 100; |
||||
|
private static final int HEIGHT = 38; |
||||
|
private static final int CODE_LENGTH = 4; |
||||
|
private static final String CODES = "1234567890ABCDEFGHJKLMNPQRSTUVWXYZ"; |
||||
|
private static final int LINE_COUNT = 15; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* @param response 向客户端返回图片 |
||||
|
* @return 返回验证码的字符串 |
||||
|
*/ |
||||
|
public static String createCaptcha(HttpServletResponse response) { |
||||
|
return createCaptcha(WIDTH, HEIGHT, CODE_LENGTH, response); |
||||
|
} |
||||
|
/** |
||||
|
* |
||||
|
* @param width |
||||
|
* @param height |
||||
|
* @param codeLength |
||||
|
* @param response |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createCaptcha(int width, int height, int codeLength, HttpServletResponse response) { |
||||
|
// 生成字符串 |
||||
|
String captcha = randomCode(codeLength); |
||||
|
|
||||
|
// 生成图片 1+1=? |
||||
|
BufferedImage image = createImage(width, height, captcha); |
||||
|
|
||||
|
// 写入Response |
||||
|
try { |
||||
|
ImageIO.write(image, "jpeg", response.getOutputStream()); |
||||
|
|
||||
|
return captcha; |
||||
|
|
||||
|
} catch (IOException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 只创建图片 |
||||
|
* @param captcha |
||||
|
* @return |
||||
|
*/ |
||||
|
public static BufferedImage createImage(String captcha){ |
||||
|
return createImage(WIDTH, HEIGHT, captcha); |
||||
|
} |
||||
|
|
||||
|
public static BufferedImage createImage(int width, int height, String captcha) { |
||||
|
int codeLength = captcha.length(); |
||||
|
|
||||
|
// 生成图片 1+1=? |
||||
|
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); |
||||
|
|
||||
|
// 获取画板 |
||||
|
Graphics graphics = image.getGraphics(); |
||||
|
|
||||
|
// 绘制背景颜色 |
||||
|
graphics.setColor(randomBgColor()); |
||||
|
graphics.fillRect(0, 0, width, height); |
||||
|
|
||||
|
// 在 "画板"上生成干扰线条 |
||||
|
drawLine(width, height, graphics, LINE_COUNT); |
||||
|
|
||||
|
|
||||
|
// 绘制字符串 |
||||
|
graphics.setFont(new Font("Comic Sans MS", Font.BOLD, 30)); |
||||
|
for (int i = 0; i < captcha.length(); i++) { |
||||
|
graphics.setColor(randomFontColor()); |
||||
|
graphics.drawString(captcha.substring(i, i+1), i*(width/codeLength), (height)/2+30/6*2); |
||||
|
} |
||||
|
|
||||
|
// 释放资源 |
||||
|
graphics.dispose(); |
||||
|
|
||||
|
return image; |
||||
|
} |
||||
|
|
||||
|
public static String createBase64(String captcha){ |
||||
|
BufferedImage imgae = createImage(captcha); |
||||
|
return getBase64(imgae); |
||||
|
} |
||||
|
|
||||
|
public static String getBase64(BufferedImage image){ |
||||
|
String base64 = null; |
||||
|
|
||||
|
try { |
||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream(); |
||||
|
ImageIO.write(image, "jpeg", stream); |
||||
|
base64 = "data:image/jpeg;base64," + Base64.encodeBase64String(stream.toByteArray()); |
||||
|
} catch (IOException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return base64; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 绘制干扰线 |
||||
|
* @param width |
||||
|
* @param height |
||||
|
* @param graphics |
||||
|
* @param count |
||||
|
*/ |
||||
|
private static void drawLine(int width, int height, Graphics graphics, int count) { |
||||
|
Random random = new Random(); |
||||
|
|
||||
|
for (int i = 0; i < count; i++) { |
||||
|
graphics.setColor(randomFontColor()); |
||||
|
final int x = random.nextInt(width); |
||||
|
final int y = random.nextInt(height); |
||||
|
final int w = random.nextInt(width); |
||||
|
final int h = random.nextInt(height); |
||||
|
graphics.drawLine(x, y, w, h); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private static Color randomFontColor() { |
||||
|
return randomColor(150, 0); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 随机生成背景 |
||||
|
* @return |
||||
|
*/ |
||||
|
private static Color randomBgColor() { |
||||
|
return randomColor(256, 200); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 随机生成颜色 |
||||
|
* @param maxValue |
||||
|
* @param minValue |
||||
|
* @return |
||||
|
*/ |
||||
|
private static Color randomColor(int maxValue, int minValue) { |
||||
|
Random random = new Random(); |
||||
|
|
||||
|
int r = minValue+random.nextInt(maxValue-minValue); |
||||
|
int g = minValue+random.nextInt(maxValue-minValue); |
||||
|
int b = minValue+random.nextInt(maxValue-minValue); |
||||
|
|
||||
|
Color color = new Color(r, g, b); |
||||
|
|
||||
|
return color; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成验证码,默认长度4 |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String randomCode(){ |
||||
|
return randomCode(CODE_LENGTH); |
||||
|
} |
||||
|
/** |
||||
|
* 生成字符串 |
||||
|
* @param codeLength |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String randomCode(int codeLength) { |
||||
|
|
||||
|
StringBuilder captcha = new StringBuilder(); |
||||
|
Random random = new Random(); |
||||
|
|
||||
|
for (int i = 0; i < codeLength; i++) { |
||||
|
int index = random.nextInt(CODES.length());//生成0-字符串长度的数字 |
||||
|
captcha.append(CODES.charAt(index)); |
||||
|
} |
||||
|
|
||||
|
return captcha.toString(); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,190 @@ |
|||||
|
package com.example.commons.Util; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import io.jsonwebtoken.Claims; |
||||
|
import io.jsonwebtoken.JwtBuilder; |
||||
|
import io.jsonwebtoken.Jwts; |
||||
|
import io.jsonwebtoken.SignatureAlgorithm; |
||||
|
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
|
||||
|
import javax.crypto.SecretKey; |
||||
|
import javax.crypto.spec.SecretKeySpec; |
||||
|
import java.util.Base64; |
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* JWT的工具类 |
||||
|
*/ |
||||
|
public class JWTUtil { |
||||
|
|
||||
|
//有效期为 |
||||
|
public static final Long JWT_TTL = 60 * 60 *1000L;// 60 * 60 *1000 一个小时 |
||||
|
|
||||
|
//设置 密钥 |
||||
|
public static final String JWT_KEY = "bobzyh"; |
||||
|
|
||||
|
public static String getUUID(){ |
||||
|
String token = UUID.randomUUID().toString().replaceAll("-", ""); |
||||
|
return token; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用户信息创建JWT,默认有效期30分钟 |
||||
|
* @param user |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createJWT(UserDetails user) { |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
try { |
||||
|
String json = mapper.writeValueAsString(user); |
||||
|
System.out.println("用户的JSON"); |
||||
|
System.out.println(json); |
||||
|
return createJWT(json, JWT_TTL); |
||||
|
} catch (JsonProcessingException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用户信息创建JWT, 指定有效期,单位秒 |
||||
|
* @param user |
||||
|
* @param ttlMillis |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createJWT(UserDetails user, Long ttlMillis) { |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
try { |
||||
|
String json = mapper.writeValueAsString(user); |
||||
|
return createJWT(json, ttlMillis); |
||||
|
} catch (JsonProcessingException e) { |
||||
|
throw new RuntimeException(e); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成jtw |
||||
|
* @param subject token中要存放的数据(json格式) |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createJWT(String subject) { |
||||
|
JwtBuilder builder = getJwtBuilder(subject, 30*60*1000L, getUUID());// 设置过期时间 |
||||
|
return builder.compact(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成jtw |
||||
|
* @param subject token中要存放的数据(json格式) |
||||
|
* @param ttlMillis token超时时间 |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createJWT(String subject, Long ttlMillis) { |
||||
|
JwtBuilder builder = getJwtBuilder(subject, ttlMillis, getUUID());// 设置过期时间 |
||||
|
return builder.compact(); |
||||
|
} |
||||
|
|
||||
|
private static JwtBuilder getJwtBuilder(String subject, Long ttlMillis, String uuid) { |
||||
|
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; //加密算法 |
||||
|
SecretKey secretKey = generalKey(); //密钥 |
||||
|
long nowMillis = System.currentTimeMillis(); //当前时间 |
||||
|
Date now = new Date(nowMillis); |
||||
|
if(ttlMillis==null){ |
||||
|
ttlMillis= JWTUtil.JWT_TTL; |
||||
|
} |
||||
|
long expMillis = nowMillis + ttlMillis; |
||||
|
Date expDate = new Date(expMillis); //过期时间 |
||||
|
return Jwts.builder() |
||||
|
.setId(uuid) //唯一的ID |
||||
|
.setSubject(subject) // 主题 可以是JSON数据 |
||||
|
.setIssuer("sg") // 签发者 |
||||
|
.setIssuedAt(now) // 签发时间 |
||||
|
.signWith(signatureAlgorithm, secretKey) //使用HS256对称加密算法签名, 第二个参数为秘钥 |
||||
|
.setExpiration(expDate); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 创建token |
||||
|
* @param id |
||||
|
* @param subject |
||||
|
* @param ttlMillis |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String createJWT(String id, String subject, Long ttlMillis) { |
||||
|
JwtBuilder builder = getJwtBuilder(subject, ttlMillis, id);// 设置过期时间 |
||||
|
return builder.compact(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 生成加密后的秘钥 secretKey |
||||
|
* @return |
||||
|
*/ |
||||
|
public static SecretKey generalKey() { |
||||
|
byte[] encodedKey = Base64.getDecoder().decode(JWTUtil.JWT_KEY); |
||||
|
SecretKey key = new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); |
||||
|
return key; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 解析 |
||||
|
* |
||||
|
* @param jwt |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
public static Claims parseJWT(String jwt) throws Exception { |
||||
|
SecretKey secretKey = generalKey(); |
||||
|
return Jwts.parser() |
||||
|
.setSigningKey(secretKey) |
||||
|
.parseClaimsJws(jwt) |
||||
|
.getBody(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 解析为用户 |
||||
|
* @param jwt |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
public static UserDetails getUserDetails(String jwt, Class<? extends UserDetails> cls) throws Exception { |
||||
|
Claims claims = JWTUtil.parseJWT(jwt); |
||||
|
String json = claims.getSubject(); |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
UserDetails user = null; |
||||
|
user = mapper.readValue(json, cls); |
||||
|
|
||||
|
return user; |
||||
|
} |
||||
|
|
||||
|
public static UserDetails getUserDetailsList(String jwt, Class<? extends UserDetails> ...cls) throws Exception { |
||||
|
Claims claims = JWTUtil.parseJWT(jwt); |
||||
|
String json = claims.getSubject(); |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
if (cls != null && cls.length > 0) { |
||||
|
for (Class<? extends UserDetails> cl : cls) { |
||||
|
try { |
||||
|
UserDetails user = mapper.readValue(json, cl); |
||||
|
return user; |
||||
|
} catch (JsonProcessingException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// public static void main(String[] args) throws Exception { |
||||
|
// |
||||
|
// // 加密 |
||||
|
// String jwt = createJWT("2123"); |
||||
|
// System.out.println(jwt); |
||||
|
// |
||||
|
// // 解密 |
||||
|
// Claims claims = parseJWT("eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2Y2QzZGU0NWRiN2I0MjVlOWJlZTAzYzUyNjY2ODhhYiIsInN1YiI6IjIxMjMiLCJpc3MiOiJzZyIsImlhdCI6MTcxMDgzMTc4NCwiZXhwIjoxNzEwODM1Mzg0fQ.k6RPyIvKX-mrS26YbyaDNVLlihGqTQDeLj2gsrNokCk"); |
||||
|
// String subject = claims.getSubject(); |
||||
|
// System.out.println(subject); |
||||
|
// |
||||
|
// } |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.example.commons.Util; |
||||
|
|
||||
|
import java.security.MessageDigest; |
||||
|
import java.util.Base64; |
||||
|
import java.util.Base64.Encoder; |
||||
|
|
||||
|
public class MD5Util { |
||||
|
// MD5双重加密 使用salt |
||||
|
public static String getDBMD5(String str, String salt){ |
||||
|
return getMD5(getMD5(str)+salt); |
||||
|
} |
||||
|
|
||||
|
// MD5加密 |
||||
|
public static String getMD5(String str) { |
||||
|
|
||||
|
String newstr = null; |
||||
|
try { |
||||
|
//确定计算方法 |
||||
|
MessageDigest md5=MessageDigest.getInstance("MD5"); |
||||
|
|
||||
|
//加密后的字符串 |
||||
|
newstr=encryptBASE64(md5.digest(str.getBytes("utf-8"))); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
// TODO: handle exception |
||||
|
} |
||||
|
|
||||
|
return newstr; |
||||
|
} |
||||
|
|
||||
|
private static String encryptBASE64(byte[] data) { |
||||
|
// BASE64Encoder encoder = new BASE64Encoder(); |
||||
|
// String encode = encoder.encode(data); |
||||
|
// 从JKD 9开始rt.jar包已废除,从JDK 1.8开始使用java.util.Base64.Encoder |
||||
|
Encoder encoder = Base64.getEncoder(); |
||||
|
String encode = encoder.encodeToString(data); |
||||
|
return encode; |
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.example.commons.Util; |
||||
|
|
||||
|
import org.springframework.web.multipart.MultipartFile; |
||||
|
|
||||
|
import java.io.*; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
public class UploadUtil { |
||||
|
|
||||
|
/** |
||||
|
* 将文件保存到指定路径 |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String save(MultipartFile file, String path) { |
||||
|
|
||||
|
// 验证文件是不是传了 |
||||
|
if (file.getSize() <= 0) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
// 验证文件夹是否存在 |
||||
|
File pathFile = new File(path); |
||||
|
if (!pathFile.exists()) { |
||||
|
// 创建 |
||||
|
if (!pathFile.mkdirs()) { |
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 生UUID作为新的文件名 |
||||
|
String fileName = UUID.randomUUID().toString(); |
||||
|
String oldName = file.getOriginalFilename(); |
||||
|
|
||||
|
if (oldName.lastIndexOf(".")>=0) { |
||||
|
String suffix = oldName.substring(oldName.lastIndexOf(".")); |
||||
|
fileName += suffix; |
||||
|
} |
||||
|
|
||||
|
// 创建一个文件流 |
||||
|
try (OutputStream out = new FileOutputStream(path + fileName) ){ |
||||
|
// 把上传的文件,写到这个流里面 |
||||
|
out.write(file.getBytes()); |
||||
|
|
||||
|
// 写成功了 |
||||
|
return fileName; |
||||
|
} catch (FileNotFoundException e) { |
||||
|
e.printStackTrace(); |
||||
|
} catch (IOException e1) { |
||||
|
e1.printStackTrace(); |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
|
||||
|
public class Activity { |
||||
|
private Integer activityId ; |
||||
|
private Integer adminId; |
||||
|
private String dept; |
||||
|
private LocalDate startTime; |
||||
|
private LocalDate endTime; |
||||
|
private String activityName; |
||||
|
private BigDecimal rechargeRatio; |
||||
|
private LocalDateTime createTime; |
||||
|
private Integer activityFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private String name; |
||||
|
private Integer status; |
||||
|
private Date startDate; |
||||
|
private Date endDate; |
||||
|
|
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.fasterxml.jackson.annotation.JsonIgnore; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
import org.springframework.security.core.GrantedAuthority; |
||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority; |
||||
|
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.*; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Admin implements UserDetails, Serializable { |
||||
|
private Integer adminId; |
||||
|
private String name; |
||||
|
private String username; |
||||
|
private String password; |
||||
|
private Integer permission; |
||||
|
private String area; |
||||
|
private String adminFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
|
||||
|
@Override |
||||
|
@JsonIgnore |
||||
|
public Collection<? extends GrantedAuthority> getAuthorities() { |
||||
|
Set<GrantedAuthority>authorities = new HashSet<>(); |
||||
|
if(permission == 1){ |
||||
|
|
||||
|
authorities.add(new SimpleGrantedAuthority("ROLE_SUPER_ADMIN")); |
||||
|
}else if(permission == 2){ |
||||
|
authorities.add(new SimpleGrantedAuthority("ROLE_ADMIN")); |
||||
|
} |
||||
|
return authorities; |
||||
|
} |
||||
|
@Override |
||||
|
@JsonIgnore |
||||
|
public boolean isAccountNonExpired() { |
||||
|
return UserDetails.super.isAccountNonExpired(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@JsonIgnore |
||||
|
public boolean isAccountNonLocked() { |
||||
|
return UserDetails.super.isAccountNonLocked(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@JsonIgnore |
||||
|
public boolean isCredentialsNonExpired() { |
||||
|
return UserDetails.super.isCredentialsNonExpired(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@JsonIgnore |
||||
|
public boolean isEnabled() { |
||||
|
return UserDetails.super.isEnabled(); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,27 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Audit { |
||||
|
private Integer auditId; |
||||
|
private Integer jwcode; |
||||
|
private Integer rechargeId; |
||||
|
private Integer refundId; |
||||
|
private Integer adminId; |
||||
|
private String status; |
||||
|
private Integer AuditFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
private Date startDate; |
||||
|
private Date endDate; |
||||
|
private String reson; |
||||
|
private Integer detailId; |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Detail { |
||||
|
private Integer detailId; |
||||
|
private String name; |
||||
|
private String jwcode; |
||||
|
private String area; |
||||
|
private Integer activityId; |
||||
|
private String rechargeWay; |
||||
|
private Integer productId; |
||||
|
private String consumePlatform; |
||||
|
private String consumeType; |
||||
|
private String refundType; |
||||
|
private String refundGoods; |
||||
|
private Integer contactId; |
||||
|
private String remark; |
||||
|
private BigDecimal rechargeCoin; |
||||
|
private BigDecimal freeCoin; |
||||
|
private BigDecimal taskCoin; |
||||
|
|
||||
|
private Integer adminId; |
||||
|
private Integer status; |
||||
|
private String updateType; |
||||
|
private Integer detailFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
|
||||
|
private Date endDate; |
||||
|
private Date startDate; |
||||
|
private String uname; |
||||
|
private Integer firstRecharge; |
||||
|
|
||||
|
private String adminArea; |
||||
|
private String adminName; |
||||
|
private String userName; |
||||
|
private String auditStatus; |
||||
|
private String auditReson; |
||||
|
|
||||
|
|
||||
|
|
||||
|
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private String productName; |
||||
|
private Integer refundId; |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Product { |
||||
|
private int productId; |
||||
|
private BigDecimal price; |
||||
|
private String name; |
||||
|
private Date listed_time; |
||||
|
private Date down_time; |
||||
|
private String remark; |
||||
|
private String subjects; |
||||
|
private String type; |
||||
|
private String productFlag; |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Rate { |
||||
|
private Integer rateId; |
||||
|
private Date startTime; |
||||
|
private Date endTime; |
||||
|
private String currency; |
||||
|
private String exchangeRate; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
private Date updateTime; |
||||
|
private Integer adminId; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Recharge { |
||||
|
private Integer rechargeId; |
||||
|
private String jwcode; |
||||
|
private Integer activityId; |
||||
|
private Double paidGold; |
||||
|
private Double freeGold; |
||||
|
private Double rechargeGold; |
||||
|
private String payWay; |
||||
|
private String rechargeWay; |
||||
|
private Date rechargeTime; |
||||
|
private String rechargeVoucher; |
||||
|
private Integer adminId; |
||||
|
private String area; |
||||
|
|
||||
|
private String remark; |
||||
|
private Integer flag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
private Date startDate; |
||||
|
private Date endDate; |
||||
|
|
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class User { |
||||
|
private Integer userId; |
||||
|
private String name; |
||||
|
private String jwcode; |
||||
|
private String password; |
||||
|
private String phone; |
||||
|
private String email; |
||||
|
private String gender; |
||||
|
private Date birthday; |
||||
|
private String head; |
||||
|
private Integer UserFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
private String signature; |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class ConsumeDetail { |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Integer detailId; |
||||
|
private String name; |
||||
|
private String jwcode; |
||||
|
private String area; |
||||
|
private Integer activityId; |
||||
|
private String rechargeWay; |
||||
|
private String goods; |
||||
|
private String consumePlatform; |
||||
|
private String consumeType; |
||||
|
private String refundType; |
||||
|
private String refundGoods; |
||||
|
private Integer contactId; |
||||
|
private String remark; |
||||
|
private Double rechargeCoin; |
||||
|
private Double freeCoin; |
||||
|
private Double taskCoin; |
||||
|
private String conmmitName; |
||||
|
private Integer status; |
||||
|
private String updateType; |
||||
|
private Integer detailFlag; |
||||
|
private Date createTime; |
||||
|
private Integer adminId; |
||||
|
private String reson; |
||||
|
private String user; |
||||
|
private Date startDate; |
||||
|
private Date endDate; |
||||
|
private Integer auditId; |
||||
|
|
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class DetailVo { |
||||
|
private Integer detailId; |
||||
|
private String name; |
||||
|
private String jwcode; |
||||
|
private String area; |
||||
|
private Integer activityId; |
||||
|
private String rechargeWay; |
||||
|
private String goods; |
||||
|
private String consumePlatform; |
||||
|
private String consumeType; |
||||
|
private String refundType; |
||||
|
private String refundGoods; |
||||
|
private Integer contactId; |
||||
|
private String remark; |
||||
|
private Double rechargeCoin; |
||||
|
private Double freeCoin; |
||||
|
private Double taskCoin; |
||||
|
private Integer adminId; |
||||
|
private Integer status; |
||||
|
private String updateType; |
||||
|
private Integer detailFlag; |
||||
|
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
//搜索消费时间 |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime searchStartTime; |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime searchEndTime; |
||||
|
|
||||
|
//提交人姓名 |
||||
|
private String adminName; |
||||
|
|
||||
|
//消费金币总数 |
||||
|
private Integer totalCoin; |
||||
|
|
||||
|
// |
||||
|
private String productName; |
||||
|
private String userName; |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import com.example.commons.domain.entity.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Page { |
||||
|
private Integer pageNum; |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
private RechargeVo rechargeVo; |
||||
|
private Activity activity; |
||||
|
private Rate rate; |
||||
|
private Audit audit; |
||||
|
private ConsumeDetail consumeDetail; |
||||
|
private Detail detail; |
||||
|
private DetailVo detailVo; |
||||
|
private Admin admin; |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class RechargeVo { |
||||
|
|
||||
|
private Integer rechargeId; |
||||
|
private String jwcode; |
||||
|
private Integer activityId; |
||||
|
private Double paidGold; |
||||
|
private Double freeGold; |
||||
|
private Double rechargeGold; |
||||
|
private String payWay; |
||||
|
private String rechargeWay; |
||||
|
private Date rechargeTime; |
||||
|
private String rechargeVoucher; |
||||
|
private Integer adminId; |
||||
|
private String area; |
||||
|
|
||||
|
|
||||
|
private String remark; |
||||
|
private Integer flag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
private Date startDate; |
||||
|
private Date endDate; |
||||
|
private String username; |
||||
|
private String activityName; |
||||
|
private Integer status; |
||||
|
private String reson; |
||||
|
private String name; |
||||
|
private Integer auditId; |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.core.JsonProcessingException; |
||||
|
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class Result { |
||||
|
private Integer code; |
||||
|
private String msg; |
||||
|
private Object data; |
||||
|
|
||||
|
public static Result success(Integer code, String msg, Object data) { |
||||
|
return new Result(code, msg, data); |
||||
|
} |
||||
|
public static Result success(Integer code, Object data) { |
||||
|
return success(code, "操作成功", data); |
||||
|
} |
||||
|
public static Result success(String msg, Object data) {return success(200, msg, data);} |
||||
|
public static Result success(Object data){ |
||||
|
return success(200, data); |
||||
|
} |
||||
|
public static Result success(){ |
||||
|
return success(null); |
||||
|
} |
||||
|
|
||||
|
public static Result error(Integer code, String msg, Object data){ |
||||
|
return new Result(code, msg, data); |
||||
|
} |
||||
|
public static Result error(Integer code, String msg){ |
||||
|
return error(code, msg, null); |
||||
|
} |
||||
|
public static Result error(String msg){ |
||||
|
return error(0, msg); |
||||
|
} |
||||
|
|
||||
|
public String toJson() throws JsonProcessingException { |
||||
|
ObjectMapper mapper = new ObjectMapper(); |
||||
|
return mapper.writeValueAsString(this); |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Statistics { |
||||
|
private BigDecimal rechargeSumCoin; |
||||
|
private BigDecimal freeSumCoin; |
||||
|
private BigDecimal taskSumCoin; |
||||
|
private BigDecimal totalSumCoin; |
||||
|
private BigDecimal rechargeYesterdaySumCoin; |
||||
|
private BigDecimal freeYesterdaySumCoin; |
||||
|
private BigDecimal taskYesterdaySumCoin; |
||||
|
private BigDecimal totalYesterdaySumCoin; |
||||
|
private Integer rechargeCount; |
||||
|
private Integer rechargeCountThisWeek ; |
||||
|
private Integer rechargeCountLastWeek ; |
||||
|
private BigDecimal weekOverWeekRate; |
||||
|
private Integer rechargeCountToday; |
||||
|
private Integer rechargeCountYesterday; |
||||
|
private BigDecimal dayOverDayRate; |
||||
|
private BigDecimal totalCoinSystemSum; |
||||
|
private BigDecimal totalERPSum; |
||||
|
private BigDecimal totalHomilyChartSum; |
||||
|
private BigDecimal totalHomilyLinkSum; |
||||
|
private BigDecimal rechargeCoinSystemSum; |
||||
|
private BigDecimal freeCoinSystemSum; |
||||
|
private BigDecimal taskCoinSystemSum; |
||||
|
private BigDecimal rechargeERPSum; |
||||
|
private BigDecimal freeERPSum; |
||||
|
private BigDecimal taskERPSum; |
||||
|
private BigDecimal rechargeHomilyChartSum; |
||||
|
private BigDecimal freeHomilyChartSum; |
||||
|
private BigDecimal taskHomilyChartSum; |
||||
|
private BigDecimal rechargeHomilyLinkSum; |
||||
|
private BigDecimal freeHomilyLinkSum; |
||||
|
private BigDecimal taskHomilyLinkSum; |
||||
|
private String subject; |
||||
|
private String consumePlatform; |
||||
|
private Integer firstRechargeCountYesterday; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Statisticss { |
||||
|
|
||||
|
private List<Statistics> CoinSystemSum; |
||||
|
private List<Statistics> ERPSum; |
||||
|
private List<Statistics> HomilyChartSum; |
||||
|
private List<Statistics> HomilyLinkSum; |
||||
|
|
||||
|
} |
@ -0,0 +1,73 @@ |
|||||
|
package com.example.commons.domain.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class SumCoin { |
||||
|
|
||||
|
//当前金币余量 充值金币 |
||||
|
private Double todayRecharge; |
||||
|
//当前金币余量 免费金币 |
||||
|
private Double todayFree; |
||||
|
//当前金币余量 任务金币 |
||||
|
private Double todayTask; |
||||
|
//当前金币余量 总金币 |
||||
|
private Double todayTotalCoin; |
||||
|
//前一天金币余量 充值金币 |
||||
|
private Double yesterdayRecharge; |
||||
|
//前一天金币余量 免费金币 |
||||
|
private Double yesterdayFree; |
||||
|
//前一天金币余量 任务金币 |
||||
|
private Double yesterdayTask; |
||||
|
//前一天金币余量 总金币 |
||||
|
private Double yesterdayTotalCoin; |
||||
|
//当前金币余量与前一天金币余量之差 |
||||
|
private Double coinDifference; |
||||
|
|
||||
|
|
||||
|
//全年累计消耗金币数 消费总数 |
||||
|
private Double yearConsumeCoin; |
||||
|
//全年累计消耗金币数 退款金币 |
||||
|
private Double yearRefundCoin; |
||||
|
//全年累计消耗金币数 消耗总金币 |
||||
|
private Double yearsumCoin; |
||||
|
|
||||
|
|
||||
|
//全年累计消耗金币数--昨日新增消耗 消费金币 |
||||
|
private Double dayConsumeCoin; |
||||
|
//全年累计消耗金币数--昨日新增消耗 退款总金币 |
||||
|
private Double dayRefundCoin; |
||||
|
//全年累计消耗金币数--昨日新增消耗 消耗总金币 |
||||
|
private Double daysumCoin; |
||||
|
|
||||
|
|
||||
|
//全年累计消耗金币数--下面 消耗充值金币 |
||||
|
private Double yearSumRechargeCoin; |
||||
|
//全年累计消耗金币数--下面 消耗免费金币 |
||||
|
private Double yearSumFreeCoin; |
||||
|
//全年累计消耗金币数--下面 消耗任务金币 |
||||
|
private Double yearSumTaskCoin; |
||||
|
|
||||
|
|
||||
|
//中间-11个月 每月充值金币 |
||||
|
private Double rechargeSumCoin; |
||||
|
//中间-11个月 每月免费金币 |
||||
|
private Double freeSumCoin; |
||||
|
//中间-11个月 每月任务金币 |
||||
|
private Double taskSumCoin; |
||||
|
private String month; |
||||
|
|
||||
|
|
||||
|
private Integer jwcode; |
||||
|
private String area; |
||||
|
|
||||
|
|
||||
|
private Double totalRechargeRefund; |
||||
|
private Double totalTaskRefund; |
||||
|
private Double totalFreeRefund; |
||||
|
private Double totalRecharge; |
||||
|
private Double totalFree; |
||||
|
private Double totalTask; |
||||
|
} |
@ -0,0 +1,144 @@ |
|||||
|
package com.example.commons.security; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import org.springframework.http.HttpMethod; |
||||
|
import org.springframework.security.authentication.AuthenticationManager; |
||||
|
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; |
||||
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
||||
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
||||
|
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; |
||||
|
import org.springframework.security.config.http.SessionCreationPolicy; |
||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||
|
import org.springframework.security.crypto.password.PasswordEncoder; |
||||
|
import org.springframework.security.web.AuthenticationEntryPoint; |
||||
|
import org.springframework.security.web.SecurityFilterChain; |
||||
|
import org.springframework.security.web.access.AccessDeniedHandler; |
||||
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
||||
|
import org.springframework.web.cors.CorsConfiguration; |
||||
|
import org.springframework.web.cors.CorsConfigurationSource; |
||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||
|
|
||||
|
/** |
||||
|
* SpringSecurity的配置文件 |
||||
|
*/ |
||||
|
@Configuration |
||||
|
|
||||
|
@EnableWebSecurity // 开启Security的支持 |
||||
|
@EnableGlobalMethodSecurity(prePostEnabled = true) // 开启方法注解 |
||||
|
|
||||
|
public class SecurityConfig { |
||||
|
|
||||
|
|
||||
|
@Autowired |
||||
|
TokenFilter tokenFilter; |
||||
|
|
||||
|
// 核心配置 配置一个过滤器链 |
||||
|
@Bean |
||||
|
public SecurityFilterChain configure(HttpSecurity http) throws Exception { |
||||
|
// 这里可以对httpSecurity进行详细的配置 链式调用的配置方式 |
||||
|
http.formLogin(AbstractHttpConfigurer::disable) // 方法引用,禁用表单登录 |
||||
|
.logout(AbstractHttpConfigurer::disable) // 禁用默认退出 |
||||
|
.csrf(AbstractHttpConfigurer::disable) // 禁用csrf的保护,分布式的前后端分离的项目 |
||||
|
// 设定CORS |
||||
|
.cors(cors -> cors.configurationSource(corsConfigurationSource())) |
||||
|
// 禁用Session, |
||||
|
.sessionManagement( session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) |
||||
|
// 用户未登录的处理 |
||||
|
.exceptionHandling( exception -> exception.authenticationEntryPoint(authenticationEntryPoint())) |
||||
|
// 用户权限不足的处理 |
||||
|
.exceptionHandling( exception -> exception.accessDeniedHandler(accessDeniedHandler())) |
||||
|
// 配置路径拦截 |
||||
|
.authorizeHttpRequests( request -> |
||||
|
request.requestMatchers( HttpMethod.GET, |
||||
|
// 用户不登录可以访问的路径 |
||||
|
"/captcha", |
||||
|
"/category", |
||||
|
"/product/**", |
||||
|
"/upload/**").permitAll() |
||||
|
.requestMatchers( HttpMethod.POST, |
||||
|
// 用户不登录就可以访问的路径 |
||||
|
"/user/login", "/user", |
||||
|
"/admin/login","/upload/**").permitAll() |
||||
|
.requestMatchers( |
||||
|
"/error","alipay/**" |
||||
|
).permitAll() |
||||
|
.anyRequest().authenticated() // 其它路径,必须要登录后才能访问 |
||||
|
); |
||||
|
// 配置Token过滤器, 将过滤器加入到执行链中 |
||||
|
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class); |
||||
|
|
||||
|
return http.build(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 1. 配置认证管理器 |
||||
|
* @param config |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@Bean |
||||
|
protected AuthenticationManager authenticationManager( |
||||
|
AuthenticationConfiguration config ) throws Exception { |
||||
|
return config.getAuthenticationManager(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 2. 密码编码器 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Bean |
||||
|
public PasswordEncoder passwordEncoder() { |
||||
|
return new BCryptPasswordEncoder(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 3. 用户未登录时的错误处理 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Bean |
||||
|
public AuthenticationEntryPoint authenticationEntryPoint() { |
||||
|
return ( request, response, authException) -> { |
||||
|
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); // 401 |
||||
|
response.setContentType("application/json; charset=utf-8"); |
||||
|
response.getWriter().write(Result.error("用户未登录").toJson()); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 4. 权限不足时的处理 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Bean |
||||
|
public AccessDeniedHandler accessDeniedHandler() { |
||||
|
return ( request, response, authException) -> { |
||||
|
response.setStatus(HttpServletResponse.SC_FORBIDDEN); // 403 |
||||
|
response.setContentType("application/json; charset=utf-8"); |
||||
|
response.getWriter().write(Result.error("当前用户权限不足!").toJson()); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 5. 配置跨域请求 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Bean |
||||
|
public CorsConfigurationSource corsConfigurationSource() { |
||||
|
CorsConfiguration config = new CorsConfiguration(); |
||||
|
config.addAllowedOriginPattern("*"); // 允许任何的源 |
||||
|
config.addAllowedMethod("*"); // 允许任何的HTTP请求方式 |
||||
|
config.addAllowedHeader("*"); // 允许任何的HTTP头 |
||||
|
config.setAllowCredentials(true); // 允许证书 |
||||
|
config.setMaxAge(3600L); // 设置浏览器预检的时间 |
||||
|
|
||||
|
// 生成源 |
||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||
|
source.registerCorsConfiguration("/**", config); |
||||
|
return source; |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.example.commons.security; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.Util.JWTUtil; |
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import jakarta.servlet.FilterChain; |
||||
|
import jakarta.servlet.ServletException; |
||||
|
import jakarta.servlet.http.HttpServletRequest; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
|
||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
||||
|
import org.springframework.security.core.context.SecurityContextHolder; |
||||
|
import org.springframework.security.core.userdetails.UserDetails; |
||||
|
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
||||
|
|
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.filter.OncePerRequestFilter; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
|
||||
|
@Component |
||||
|
public class TokenFilter extends OncePerRequestFilter { |
||||
|
@Override |
||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
||||
|
// 取Token 生成登录信息 |
||||
|
String token = request.getHeader("token"); |
||||
|
// token不为空 |
||||
|
if (StringUtils.hasText(token)){ |
||||
|
// jwt解密 |
||||
|
try { |
||||
|
UserDetails userDetails = JWTUtil.getUserDetailsList(token,Admin.class); |
||||
|
if ( ! ObjectUtils.isEmpty(userDetails)) { |
||||
|
// 将这个用户注册到Security中 |
||||
|
UsernamePasswordAuthenticationToken authenticationToken |
||||
|
|
||||
|
= new UsernamePasswordAuthenticationToken( |
||||
|
userDetails, null, |
||||
|
userDetails.getAuthorities()); |
||||
|
authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); |
||||
|
SecurityContextHolder.getContext().setAuthentication(authenticationToken); |
||||
|
} |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
// Token无效, |
||||
|
} |
||||
|
} |
||||
|
// 过滤器放行 |
||||
|
filterChain.doFilter(request, response); |
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Activity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ActivityService { |
||||
|
|
||||
|
int add(Activity activity); |
||||
|
|
||||
|
int edit(Activity activity); |
||||
|
|
||||
|
List<Activity> search(Activity activity); |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface AdminService { |
||||
|
int add(Admin admin); |
||||
|
int edit(Admin admin); |
||||
|
Admin findById(Integer adminId); |
||||
|
Admin findByUsername(String username); |
||||
|
List<Admin> search(Admin admin); |
||||
|
PageInfo<Admin> searchForPage(Integer pageNum, Integer pageSize,Admin admin); |
||||
|
Admin login(Admin admin)throws Exception; |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.domain.vo.ConsumeDetail; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface AuditService { |
||||
|
int add (Audit audit); |
||||
|
int edit(Audit audit); |
||||
|
List<Audit> search(Audit audit) ; |
||||
|
PageInfo<Audit> searchForPage(Integer pageNum, Integer pageSize, Audit audit); |
||||
|
List<ConsumeDetail> searchForDetail(ConsumeDetail consumeDetail); |
||||
|
PageInfo<ConsumeDetail> searchForConsumeDetail(Integer pageNum, Integer pageSize, ConsumeDetail consumeDetail); |
||||
|
} |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import com.example.commons.domain.entity.Detail; |
||||
|
import com.example.commons.domain.entity.User; |
||||
|
import com.example.commons.domain.vo.DetailVo; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ConsumeService { |
||||
|
//新增消费记录 |
||||
|
int insert(Detail detail); |
||||
|
|
||||
|
User getByUserId(Integer userId); |
||||
|
|
||||
|
Admin getByadminId(Integer adminId); |
||||
|
|
||||
|
List<DetailVo> search(DetailVo detailVo); |
||||
|
|
||||
|
PageInfo<DetailVo> searchForPage(Integer pageNum, Integer pageSize, DetailVo detailVo); |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Detail; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface DetailService { |
||||
|
int add(Detail detail); |
||||
|
int edit(Detail detail); |
||||
|
Detail getDetail(int id); |
||||
|
List<Detail> getAllDetail(Detail detail); |
||||
|
PageInfo<Detail> getDetailByPage(int pageNum, int pageSize,Detail detail); |
||||
|
} |
@ -0,0 +1,9 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Product; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ProductService { |
||||
|
List<Product> findAll(Product product); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface RateService { |
||||
|
int add(Rate rate) throws Exception; |
||||
|
int edit(Rate rate) throws Exception; |
||||
|
void delete(Integer rateId) throws Exception; |
||||
|
Rate getById(Integer rateId); |
||||
|
List<Rate> search(Rate rate); |
||||
|
PageInfo<Rate> searchForPage(Integer pageNum, Integer pageSize,Rate rate); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.domain.vo.RechargeVo; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface RechargeService { |
||||
|
@Transactional |
||||
|
int add(Recharge recharge) throws Exception; |
||||
|
int edit(Recharge recharge) throws Exception; |
||||
|
|
||||
|
Recharge findById(int id) throws Exception; |
||||
|
List<RechargeVo> search(RechargeVo rechargeVo) ; |
||||
|
PageInfo<RechargeVo> searchForPage(Integer pageNum, Integer pageSize, RechargeVo rechargeVo); |
||||
|
|
||||
|
int getAllByjwAndup(String jwcode); |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Detail; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
public interface RefundService { |
||||
|
int add(Detail detail) ; |
||||
|
int addAudit(Detail detail); |
||||
|
void edit(Detail newDetail) ; |
||||
|
boolean existsByContactId(Integer contactId); |
||||
|
int softDelete(Integer detailId) ; |
||||
|
Detail selectByDetailId(Integer detailId); |
||||
|
List<Detail> search(Detail detail); |
||||
|
PageInfo<Detail> searchForPage(Integer pageNum, Integer pageSize, Detail detail); |
||||
|
|
||||
|
} |
@ -0,0 +1,25 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.vo.Statistics; |
||||
|
import com.example.commons.domain.vo.Statisticss; |
||||
|
import com.example.commons.domain.vo.SumCoin; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
@Service |
||||
|
public interface StatisticsService { |
||||
|
|
||||
|
Statistics getStatistics(); |
||||
|
Statisticss stats(); |
||||
|
|
||||
|
SumCoin getSumCoin(); |
||||
|
SumCoin getYearConsumeCoin(); |
||||
|
SumCoin getDayConsumeCoin(); |
||||
|
List<SumCoin> getMediuPayCoin(); |
||||
|
List<SumCoin> getMediuConsumeCoin(); |
||||
|
SumCoin getMess(Integer jwcode); |
||||
|
List<SumCoin> getMediumAreaPay(); |
||||
|
List<SumCoin> getMediumAreaConsume(); |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.domain.entity.User; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface UserSevice { |
||||
|
List<User> search(User user) throws Exception; |
||||
|
PageInfo<User> searchForPage(Integer pageNum, Integer pageSize, User User); |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.example.commons; |
||||
|
|
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
class CommonsApplicationTests { |
||||
|
|
||||
|
@Test |
||||
|
void contextLoads() { |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
@ -0,0 +1,259 @@ |
|||||
|
#!/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 |
||||
|
# |
||||
|
# http://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. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
set -euf |
||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
||||
|
|
||||
|
# OS specific support. |
||||
|
native_path() { printf %s\\n "$1"; } |
||||
|
case "$(uname)" in |
||||
|
CYGWIN* | MINGW*) |
||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
||||
|
native_path() { cygpath --path --windows "$1"; } |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# set JAVACMD and JAVACCMD |
||||
|
set_java_home() { |
||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
||||
|
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" |
||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
JAVACCMD="$JAVA_HOME/bin/javac" |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v java |
||||
|
)" || : |
||||
|
JAVACCMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v javac |
||||
|
)" || : |
||||
|
|
||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# hash string like Java String::hashCode |
||||
|
hash_string() { |
||||
|
str="${1:-}" h=0 |
||||
|
while [ -n "$str" ]; do |
||||
|
char="${str%"${str#?}"}" |
||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
||||
|
str="${str#?}" |
||||
|
done |
||||
|
printf %x\\n $h |
||||
|
} |
||||
|
|
||||
|
verbose() { :; } |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
||||
|
|
||||
|
die() { |
||||
|
printf %s\\n "$1" >&2 |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
trim() { |
||||
|
# MWRAPPER-139: |
||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
||||
|
# Needed for removing poorly interpreted newline sequences when running in more |
||||
|
# exotic environments such as mingw bash on Windows. |
||||
|
printf "%s" "${1}" | tr -d '[:space:]' |
||||
|
} |
||||
|
|
||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
while IFS="=" read -r key value; do |
||||
|
case "${key-}" in |
||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
||||
|
esac |
||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
|
||||
|
case "${distributionUrl##*/}" in |
||||
|
maven-mvnd-*bin.*) |
||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
||||
|
*) |
||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
||||
|
distributionPlatform=linux-amd64 |
||||
|
;; |
||||
|
esac |
||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
||||
|
;; |
||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
||||
|
esac |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
distributionUrlNameMain="${distributionUrlName%.*}" |
||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
||||
|
|
||||
|
exec_maven() { |
||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
||||
|
} |
||||
|
|
||||
|
if [ -d "$MAVEN_HOME" ]; then |
||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
exec_maven "$@" |
||||
|
fi |
||||
|
|
||||
|
case "${distributionUrl-}" in |
||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
||||
|
esac |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
||||
|
trap clean HUP INT TERM EXIT |
||||
|
else |
||||
|
die "cannot create temp dir" |
||||
|
fi |
||||
|
|
||||
|
mkdir -p -- "${MAVEN_HOME%/*}" |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
verbose "Downloading from: $distributionUrl" |
||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
# select .zip or .tar.gz |
||||
|
if ! command -v unzip >/dev/null; then |
||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
fi |
||||
|
|
||||
|
# verbose opt |
||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
||||
|
|
||||
|
# normalize http auth |
||||
|
case "${MVNW_PASSWORD:+has-password}" in |
||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
||||
|
verbose "Found wget ... using wget" |
||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
||||
|
verbose "Found curl ... using curl" |
||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
||||
|
elif set_java_home; then |
||||
|
verbose "Falling back to use Java to download" |
||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
cat >"$javaSource" <<-END |
||||
|
public class Downloader extends java.net.Authenticator |
||||
|
{ |
||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication() |
||||
|
{ |
||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
||||
|
} |
||||
|
public static void main( String[] args ) throws Exception |
||||
|
{ |
||||
|
setDefault( new Downloader() ); |
||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
||||
|
} |
||||
|
} |
||||
|
END |
||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
||||
|
verbose " - Compiling Downloader.java ..." |
||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
||||
|
verbose " - Running Downloader.java ..." |
||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
||||
|
fi |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
if [ -n "${distributionSha256Sum-}" ]; then |
||||
|
distributionSha256Result=false |
||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then |
||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2 |
||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
elif command -v sha256sum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
elif command -v shasum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
else |
||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ $distributionSha256Result = false ]; then |
||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
# unzip and move |
||||
|
if command -v unzip >/dev/null; then |
||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
||||
|
else |
||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
||||
|
fi |
||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
||||
|
|
||||
|
clean || : |
||||
|
exec_maven "$@" |
@ -0,0 +1,149 @@ |
|||||
|
<# : batch portion |
||||
|
@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
||||
|
@SET __MVNW_CMD__= |
||||
|
@SET __MVNW_ERROR__= |
||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
||||
|
@SET PSModulePath= |
||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
||||
|
) |
||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
||||
|
@SET __MVNW_PSMODULEP_SAVE= |
||||
|
@SET __MVNW_ARG0_NAME__= |
||||
|
@SET MVNW_USERNAME= |
||||
|
@SET MVNW_PASSWORD= |
||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
||||
|
@GOTO :EOF |
||||
|
: end batch / begin powershell #> |
||||
|
|
||||
|
$ErrorActionPreference = "Stop" |
||||
|
if ($env:MVNW_VERBOSE -eq "true") { |
||||
|
$VerbosePreference = "Continue" |
||||
|
} |
||||
|
|
||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
||||
|
if (!$distributionUrl) { |
||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
||||
|
} |
||||
|
|
||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
||||
|
"maven-mvnd-*" { |
||||
|
$USE_MVND = $true |
||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
||||
|
$MVN_CMD = "mvnd.cmd" |
||||
|
break |
||||
|
} |
||||
|
default { |
||||
|
$USE_MVND = $false |
||||
|
$MVN_CMD = $script -replace '^mvnw','mvn' |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
if ($env:MVNW_REPOURL) { |
||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
||||
|
} |
||||
|
$distributionUrlName = $distributionUrl -replace '^.*/','' |
||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
||||
|
if ($env:MAVEN_USER_HOME) { |
||||
|
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
||||
|
} |
||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
||||
|
|
||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
||||
|
exit $? |
||||
|
} |
||||
|
|
||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
||||
|
} |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
||||
|
trap { |
||||
|
if ($TMP_DOWNLOAD_DIR.Exists) { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
Write-Verbose "Downloading from: $distributionUrl" |
||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
$webclient = New-Object System.Net.WebClient |
||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
||||
|
} |
||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
||||
|
if ($distributionSha256Sum) { |
||||
|
if ($USE_MVND) { |
||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
||||
|
} |
||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# unzip and move |
||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
||||
|
try { |
||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
||||
|
} catch { |
||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
||||
|
Write-Error "fail to move MAVEN_HOME" |
||||
|
} |
||||
|
} finally { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
|
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
@ -0,0 +1,81 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>consume</artifactId> |
||||
|
<version>0.0.1-SNAPSHOT</version> |
||||
|
<name>consume</name> |
||||
|
<description>consume</description> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>demo</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</parent> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>commons</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-devtools</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.mysql</groupId> |
||||
|
<artifactId>mysql-connector-j</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.mybatis.spring.boot</groupId> |
||||
|
<artifactId>mybatis-spring-boot-starter-test</artifactId> |
||||
|
<version>3.0.4</version> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
<configuration> |
||||
|
<excludes> |
||||
|
<exclude> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
</exclude> |
||||
|
</excludes> |
||||
|
</configuration> |
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,15 @@ |
|||||
|
package com.example.consume; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.context.annotation.ComponentScan; |
||||
|
|
||||
|
@SpringBootApplication |
||||
|
@ComponentScan(basePackages = {"com.example.commons.security","com.example.consume"}) |
||||
|
public class ConsumeApplication { |
||||
|
|
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(ConsumeApplication.class, args); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,73 @@ |
|||||
|
package com.example.consume.controller; |
||||
|
|
||||
|
import com.example.commons.domain.entity.*; |
||||
|
|
||||
|
import com.example.commons.domain.vo.DetailVo; |
||||
|
import com.example.commons.domain.vo.Page; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.consume.service.ConsumeServiceImpl; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/consume") |
||||
|
//SpringMVC的,为当前类的所有处理器方法,添加路径映射的前缀 |
||||
|
@RequiredArgsConstructor |
||||
|
// lombok的,添加一个包含所有final属性的构造器 |
||||
|
@Slf4j //lombok的,自动添加log的对象,用于日志打印 |
||||
|
@CrossOrigin |
||||
|
public class ConsumeController { |
||||
|
@Autowired |
||||
|
ConsumeServiceImpl consumeService; |
||||
|
@PostMapping("/add") |
||||
|
// public Result add(@RequestParam("userId") Integer userId, @RequestBody Detail detail){ |
||||
|
public Result add(@RequestBody Detail detail){ |
||||
|
// try { |
||||
|
// System.out.println(userId+"-----------"); |
||||
|
//通过userid获取username,插入到detail |
||||
|
// User user=consumeService.getByUserId(userId); |
||||
|
// detail.setName(user.getName()); |
||||
|
// //添加所属地区 |
||||
|
// Admin admin=consumeService.getByadminId(detail.getAdminId()); |
||||
|
// detail.setArea(admin.getArea()); |
||||
|
Integer result= consumeService.insert(detail); |
||||
|
return Result.success(result); |
||||
|
// } catch (Exception e) { |
||||
|
// log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
// return Result.error(e.getMessage()); |
||||
|
// } |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
@PostMapping("/select") |
||||
|
public Result search(@RequestBody Page page){ |
||||
|
Integer pageNum = page.getPageNum(); |
||||
|
Integer pageSize = page.getPageSize(); |
||||
|
DetailVo detailVo = page.getDetailVo(); |
||||
|
if(ObjectUtils.isEmpty(pageNum)){ |
||||
|
return Result.success(consumeService.search(detailVo)); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(consumeService.searchForPage(pageNum,pageSize,detailVo)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@PostMapping("/getDeatil/{jwcode}") |
||||
|
public Result getDeatil(@PathVariable("jwcode") Integer jwcode){ |
||||
|
|
||||
|
return Result.success(consumeService.getDeatil(jwcode)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/getProduct") |
||||
|
public Result getProduct(@RequestParam("name") String name){ |
||||
|
System.out.println(name+"name"); |
||||
|
return Result.success( consumeService.getProduct(name)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
package com.example.consume.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.*; |
||||
|
import com.example.commons.domain.vo.DetailVo; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface ConsumeMapper { |
||||
|
|
||||
|
//通过id查询user全部信息 |
||||
|
@Select({ |
||||
|
"select * from user where user_id=#{userId}" |
||||
|
}) |
||||
|
User getByUserId(Integer userId); |
||||
|
|
||||
|
//通过id查询admin全部信息 |
||||
|
@Select({ |
||||
|
"select * from admin where admin_id=#{adminId}" |
||||
|
}) |
||||
|
Admin getByadminId(@Param("adminId") Integer adminId); |
||||
|
//新增消费记录 |
||||
|
@Insert({ |
||||
|
"insert into detail", |
||||
|
"(jwcode,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods,contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,create_time)", |
||||
|
"values", |
||||
|
"(#{jwcode},#{activityId},#{rechargeWay},#{productId},'金币系统','购买商品',#{refundType},#{refundGoods},#{contactId},#{remark},#{rechargeCoin},#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now())" |
||||
|
}) |
||||
|
// 获取自增主键 |
||||
|
@Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId") |
||||
|
int insert(Detail detail); |
||||
|
|
||||
|
|
||||
|
|
||||
|
//userName |
||||
|
//模糊分页查询,查询消费明细 |
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select detail.*,admin.name as adminName ,admin.area as area ,user.name as userName,product.name as productName from detail ", |
||||
|
"inner join admin on detail.admin_id=admin.admin_id ", |
||||
|
"inner join user on detail.jwcode= user.jwcode ", |
||||
|
"inner join product on detail.product_id= product.product_id ", |
||||
|
"<where>", |
||||
|
"`detail_flag`=1 AND update_type = '消费'", |
||||
|
"<if test='jwcode!=null'>and detail.jwcode =#{jwcode}</if>", |
||||
|
"<if test='productName!=null'>and product.name like concat('%',#{productName},'%')</if>", |
||||
|
"<if test='consumePlatform!=null'>and detail.consume_platform like concat('%',#{consumePlatform},'%')</if>", |
||||
|
"<if test='consumeType!=null'>and detail.consume_type like concat('%',#{consumeType},'%')</if>", |
||||
|
"<if test='searchStartTime != null and searchEndTime != null'>", |
||||
|
"and detail.create_time between #{searchStartTime} and #{searchEndTime}", |
||||
|
"</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<DetailVo> select(DetailVo detailVo); |
||||
|
|
||||
|
|
||||
|
//查询消费信息 |
||||
|
@Select({ |
||||
|
"select * ,product.name as productName from detail " , |
||||
|
"inner join product on detail.product_id= product.product_id ", |
||||
|
"where `detail_flag`=1 AND update_type = '消费' and jwcode=#{jwcode}" |
||||
|
}) |
||||
|
List<Detail> getDeatil(Integer jwcode); |
||||
|
|
||||
|
|
||||
|
//查询消费信息 |
||||
|
@Select({ |
||||
|
"select * from product", |
||||
|
" where product_flag=1 and name=#{name}", |
||||
|
"GROUP BY name" |
||||
|
}) |
||||
|
List<Product> getProduct(String name); |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
package com.example.consume.service; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Admin; |
||||
|
import com.example.commons.domain.entity.Detail; |
||||
|
import com.example.commons.domain.entity.Product; |
||||
|
import com.example.commons.domain.entity.User; |
||||
|
import com.example.commons.domain.vo.DetailVo; |
||||
|
import com.example.commons.sevice.ConsumeService; |
||||
|
import com.example.consume.mapper.ConsumeMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@Transactional |
||||
|
@RequiredArgsConstructor |
||||
|
public class ConsumeServiceImpl implements ConsumeService { |
||||
|
@Autowired |
||||
|
ConsumeMapper consumeMapper; |
||||
|
|
||||
|
@Override |
||||
|
//新增消费记录 |
||||
|
public int insert(Detail detail) { |
||||
|
|
||||
|
//添加表单数据 |
||||
|
return consumeMapper.insert(detail); |
||||
|
} |
||||
|
@Override |
||||
|
public User getByUserId(Integer userId) { |
||||
|
return consumeMapper.getByUserId(userId); |
||||
|
} |
||||
|
@Override |
||||
|
public Admin getByadminId(Integer adminId) { |
||||
|
return consumeMapper.getByadminId(adminId); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<DetailVo> search(DetailVo detailVo) { |
||||
|
return consumeMapper.select(detailVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<DetailVo> searchForPage(Integer pageNum, Integer pageSize, DetailVo detailVo) { |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
List<DetailVo> list = consumeMapper.select(detailVo); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
|
||||
|
public List<Detail> getDeatil(Integer jwcode){ |
||||
|
return consumeMapper.getDeatil(jwcode); |
||||
|
} |
||||
|
|
||||
|
public List<Product> getProduct(String name){ |
||||
|
return consumeMapper.getProduct(name); |
||||
|
} |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
server: |
||||
|
port: 10050 |
||||
|
|
||||
|
spring: |
||||
|
datasource: |
||||
|
hikari: # HikariCP连接池配置 |
||||
|
maximum-pool-size: 10 # 最大连接数 |
||||
|
minimum-idle: 5 # 最小空闲连接数 |
||||
|
idle-timeout: 30000 # 空闲连接超时时间(毫秒) |
||||
|
max-lifetime: 1800000 # 连接最大存活时间(毫秒) |
||||
|
connection-timeout: 30000 # 连接超时时间(毫秒) |
||||
|
pool-name: HwgoldHikariCP # 连接池名称 |
||||
|
driver-class-name: com.mysql.cj.jdbc.Driver |
||||
|
url: jdbc:mysql://39.101.133.168:3306/hwgold?serverTimezone=GMT%2b8&serverTimezone=Asia/Shanghai |
||||
|
username: hwgold |
||||
|
password: 'AGX4Z3YMxiCG3GR2' |
||||
|
application: |
||||
|
name: consume |
||||
|
mybatis: |
||||
|
configuration: |
||||
|
map-underscore-to-camel-case: true |
||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
@ -0,0 +1,13 @@ |
|||||
|
package com.example.consume; |
||||
|
|
||||
|
import org.junit.jupiter.api.Test; |
||||
|
import org.springframework.boot.test.context.SpringBootTest; |
||||
|
|
||||
|
@SpringBootTest |
||||
|
class ConsumeApplicationTests { |
||||
|
|
||||
|
@Test |
||||
|
void contextLoads() { |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,259 @@ |
|||||
|
#!/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 |
||||
|
# |
||||
|
# http://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. |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
# ---------------------------------------------------------------------------- |
||||
|
# Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
# |
||||
|
# Optional ENV vars |
||||
|
# ----------------- |
||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source |
||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output |
||||
|
# ---------------------------------------------------------------------------- |
||||
|
|
||||
|
set -euf |
||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x |
||||
|
|
||||
|
# OS specific support. |
||||
|
native_path() { printf %s\\n "$1"; } |
||||
|
case "$(uname)" in |
||||
|
CYGWIN* | MINGW*) |
||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" |
||||
|
native_path() { cygpath --path --windows "$1"; } |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# set JAVACMD and JAVACCMD |
||||
|
set_java_home() { |
||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched |
||||
|
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" |
||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac" |
||||
|
else |
||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||
|
JAVACCMD="$JAVA_HOME/bin/javac" |
||||
|
|
||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then |
||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 |
||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
else |
||||
|
JAVACMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v java |
||||
|
)" || : |
||||
|
JAVACCMD="$( |
||||
|
'set' +e |
||||
|
'unset' -f command 2>/dev/null |
||||
|
'command' -v javac |
||||
|
)" || : |
||||
|
|
||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then |
||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 |
||||
|
return 1 |
||||
|
fi |
||||
|
fi |
||||
|
} |
||||
|
|
||||
|
# hash string like Java String::hashCode |
||||
|
hash_string() { |
||||
|
str="${1:-}" h=0 |
||||
|
while [ -n "$str" ]; do |
||||
|
char="${str%"${str#?}"}" |
||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) |
||||
|
str="${str#?}" |
||||
|
done |
||||
|
printf %x\\n $h |
||||
|
} |
||||
|
|
||||
|
verbose() { :; } |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } |
||||
|
|
||||
|
die() { |
||||
|
printf %s\\n "$1" >&2 |
||||
|
exit 1 |
||||
|
} |
||||
|
|
||||
|
trim() { |
||||
|
# MWRAPPER-139: |
||||
|
# Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. |
||||
|
# Needed for removing poorly interpreted newline sequences when running in more |
||||
|
# exotic environments such as mingw bash on Windows. |
||||
|
printf "%s" "${1}" | tr -d '[:space:]' |
||||
|
} |
||||
|
|
||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
while IFS="=" read -r key value; do |
||||
|
case "${key-}" in |
||||
|
distributionUrl) distributionUrl=$(trim "${value-}") ;; |
||||
|
distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; |
||||
|
esac |
||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" |
||||
|
|
||||
|
case "${distributionUrl##*/}" in |
||||
|
maven-mvnd-*bin.*) |
||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ |
||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in |
||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; |
||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;; |
||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;; |
||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;; |
||||
|
*) |
||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 |
||||
|
distributionPlatform=linux-amd64 |
||||
|
;; |
||||
|
esac |
||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" |
||||
|
;; |
||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; |
||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; |
||||
|
esac |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
distributionUrlNameMain="${distributionUrlName%.*}" |
||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}" |
||||
|
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" |
||||
|
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" |
||||
|
|
||||
|
exec_maven() { |
||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : |
||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" |
||||
|
} |
||||
|
|
||||
|
if [ -d "$MAVEN_HOME" ]; then |
||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
exec_maven "$@" |
||||
|
fi |
||||
|
|
||||
|
case "${distributionUrl-}" in |
||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; |
||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; |
||||
|
esac |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then |
||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } |
||||
|
trap clean HUP INT TERM EXIT |
||||
|
else |
||||
|
die "cannot create temp dir" |
||||
|
fi |
||||
|
|
||||
|
mkdir -p -- "${MAVEN_HOME%/*}" |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
verbose "Downloading from: $distributionUrl" |
||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
# select .zip or .tar.gz |
||||
|
if ! command -v unzip >/dev/null; then |
||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz" |
||||
|
distributionUrlName="${distributionUrl##*/}" |
||||
|
fi |
||||
|
|
||||
|
# verbose opt |
||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' |
||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v |
||||
|
|
||||
|
# normalize http auth |
||||
|
case "${MVNW_PASSWORD:+has-password}" in |
||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; |
||||
|
esac |
||||
|
|
||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then |
||||
|
verbose "Found wget ... using wget" |
||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" |
||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then |
||||
|
verbose "Found curl ... using curl" |
||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" |
||||
|
elif set_java_home; then |
||||
|
verbose "Falling back to use Java to download" |
||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" |
||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
cat >"$javaSource" <<-END |
||||
|
public class Downloader extends java.net.Authenticator |
||||
|
{ |
||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication() |
||||
|
{ |
||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); |
||||
|
} |
||||
|
public static void main( String[] args ) throws Exception |
||||
|
{ |
||||
|
setDefault( new Downloader() ); |
||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); |
||||
|
} |
||||
|
} |
||||
|
END |
||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java |
||||
|
verbose " - Compiling Downloader.java ..." |
||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" |
||||
|
verbose " - Running Downloader.java ..." |
||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" |
||||
|
fi |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
if [ -n "${distributionSha256Sum-}" ]; then |
||||
|
distributionSha256Result=false |
||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then |
||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2 |
||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
elif command -v sha256sum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
elif command -v shasum >/dev/null; then |
||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then |
||||
|
distributionSha256Result=true |
||||
|
fi |
||||
|
else |
||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 |
||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
if [ $distributionSha256Result = false ]; then |
||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 |
||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 |
||||
|
exit 1 |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
# unzip and move |
||||
|
if command -v unzip >/dev/null; then |
||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" |
||||
|
else |
||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" |
||||
|
fi |
||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" |
||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" |
||||
|
|
||||
|
clean || : |
||||
|
exec_maven "$@" |
@ -0,0 +1,149 @@ |
|||||
|
<# : batch portion |
||||
|
@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 http://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 Apache Maven Wrapper startup batch script, version 3.3.2 |
||||
|
@REM |
||||
|
@REM Optional ENV vars |
||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution |
||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven |
||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output |
||||
|
@REM ---------------------------------------------------------------------------- |
||||
|
|
||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) |
||||
|
@SET __MVNW_CMD__= |
||||
|
@SET __MVNW_ERROR__= |
||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% |
||||
|
@SET PSModulePath= |
||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( |
||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) |
||||
|
) |
||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% |
||||
|
@SET __MVNW_PSMODULEP_SAVE= |
||||
|
@SET __MVNW_ARG0_NAME__= |
||||
|
@SET MVNW_USERNAME= |
||||
|
@SET MVNW_PASSWORD= |
||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) |
||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1 |
||||
|
@GOTO :EOF |
||||
|
: end batch / begin powershell #> |
||||
|
|
||||
|
$ErrorActionPreference = "Stop" |
||||
|
if ($env:MVNW_VERBOSE -eq "true") { |
||||
|
$VerbosePreference = "Continue" |
||||
|
} |
||||
|
|
||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties |
||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl |
||||
|
if (!$distributionUrl) { |
||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" |
||||
|
} |
||||
|
|
||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { |
||||
|
"maven-mvnd-*" { |
||||
|
$USE_MVND = $true |
||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" |
||||
|
$MVN_CMD = "mvnd.cmd" |
||||
|
break |
||||
|
} |
||||
|
default { |
||||
|
$USE_MVND = $false |
||||
|
$MVN_CMD = $script -replace '^mvnw','mvn' |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME |
||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash> |
||||
|
if ($env:MVNW_REPOURL) { |
||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } |
||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" |
||||
|
} |
||||
|
$distributionUrlName = $distributionUrl -replace '^.*/','' |
||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' |
||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" |
||||
|
if ($env:MAVEN_USER_HOME) { |
||||
|
$MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" |
||||
|
} |
||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' |
||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" |
||||
|
|
||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { |
||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" |
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
||||
|
exit $? |
||||
|
} |
||||
|
|
||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { |
||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" |
||||
|
} |
||||
|
|
||||
|
# prepare tmp dir |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile |
||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" |
||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null |
||||
|
trap { |
||||
|
if ($TMP_DOWNLOAD_DIR.Exists) { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null |
||||
|
|
||||
|
# Download and Install Apache Maven |
||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." |
||||
|
Write-Verbose "Downloading from: $distributionUrl" |
||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" |
||||
|
|
||||
|
$webclient = New-Object System.Net.WebClient |
||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { |
||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) |
||||
|
} |
||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null |
||||
|
|
||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file |
||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum |
||||
|
if ($distributionSha256Sum) { |
||||
|
if ($USE_MVND) { |
||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." |
||||
|
} |
||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash |
||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { |
||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
# unzip and move |
||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null |
||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null |
||||
|
try { |
||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null |
||||
|
} catch { |
||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { |
||||
|
Write-Error "fail to move MAVEN_HOME" |
||||
|
} |
||||
|
} finally { |
||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } |
||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } |
||||
|
} |
||||
|
|
||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" |
@ -0,0 +1,140 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
|
<modelVersion>4.0.0</modelVersion> |
||||
|
|
||||
|
<groupId>com.example</groupId> |
||||
|
<artifactId>demo</artifactId> |
||||
|
<version>0.0.1</version> |
||||
|
<name>demo</name> |
||||
|
<description>demo</description> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||
|
<version>3.3.6</version> |
||||
|
</parent> |
||||
|
|
||||
|
<packaging>pom</packaging> |
||||
|
|
||||
|
<modules> |
||||
|
<module>recharge</module> |
||||
|
<module>commons</module> |
||||
|
<module>user</module> |
||||
|
<module>audit</module> |
||||
|
<module>statistics</module> |
||||
|
<module>consume</module> |
||||
|
<module>refund</module> |
||||
|
<module>admin</module> |
||||
|
</modules> |
||||
|
|
||||
|
<properties> |
||||
|
|
||||
|
<java.version>21</java.version> |
||||
|
|
||||
|
<spring-boot.version>3.3.6</spring-boot.version> |
||||
|
|
||||
|
<dubbo.version>3.3.0-beta.2</dubbo.version> |
||||
|
|
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>com.101tec</groupId> |
||||
|
<artifactId>zkclient</artifactId> |
||||
|
<version>0.11</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>io.jsonwebtoken</groupId> |
||||
|
<artifactId>jjwt</artifactId> |
||||
|
<version>0.9.1</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>javax.xml.bind</groupId> |
||||
|
<artifactId>jaxb-api</artifactId> |
||||
|
<version>2.3.1</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-security</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-data-elasticsearch</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>com.github.pagehelper</groupId> |
||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId> |
||||
|
<version>1.4.6</version> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.slf4j</groupId> |
||||
|
<artifactId>slf4j-simple</artifactId> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
|
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
|
||||
|
</dependencies> |
||||
|
|
||||
|
|
||||
|
<dependencyManagement> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-dependencies</artifactId> |
||||
|
<version>${spring-boot.version}</version> |
||||
|
<type>pom</type> |
||||
|
<scope>import</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter</artifactId> |
||||
|
<version>${spring-boot.version}</version> |
||||
|
<exclusions> |
||||
|
<exclusion> |
||||
|
<artifactId>spring-boot-starter-logging</artifactId> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
</exclusion> |
||||
|
</exclusions> |
||||
|
</dependency> |
||||
|
|
||||
|
</dependencies> |
||||
|
</dependencyManagement> |
||||
|
<build> |
||||
|
<plugins> |
||||
|
<plugin> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||
|
|
||||
|
</plugin> |
||||
|
</plugins> |
||||
|
</build> |
||||
|
|
||||
|
</project> |
@ -0,0 +1,2 @@ |
|||||
|
/mvnw text eol=lf |
||||
|
*.cmd text eol=crlf |
@ -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,19 @@ |
|||||
|
# 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 |
||||
|
# |
||||
|
# http://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. |
||||
|
wrapperVersion=3.3.2 |
||||
|
distributionType=only-script |
||||
|
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |