Compare commits

...

No commits in common. "f3907fcbcc4952af7e2ca66cc54f4fc718a29a6f" and "main" have entirely different histories.

59 changed files with 24 additions and 2127 deletions

51
.gitignore vendored
View File

@ -1,33 +1,26 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
# ---> Java
# Compiled class file
*.class
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
# Log file
*.log
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
# BlueJ files
*.ctxt
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### VS Code ###
.vscode/

View File

@ -1,19 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# pupu_ups

259
mvnw vendored
View File

@ -1,259 +0,0 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# 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 "$@"

149
mvnw.cmd vendored
View File

@ -1,149 +0,0 @@
<# : 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 https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM 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"

157
pom.xml
View File

@ -1,157 +0,0 @@
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.nkkj</groupId>
<artifactId>ups</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ups</name>
<description>ups</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>3.5.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.12.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.12.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.12.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.12.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>3.1.8</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</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.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</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-cache</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.78</version>
</dependency>
<!--okhttp3-->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- Pull in as a traditional 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>

View File

@ -1,28 +0,0 @@
package com.nkkj.ups;
import okhttp3.*;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.IOException;
@SpringBootApplication
@EnableCaching
@EnableScheduling
@MapperScan("generator.mapper")
public class UpsApplication {
public static void main(String[] args) throws IOException {
SpringApplication.run(UpsApplication.class, args);
}
}

View File

@ -1,20 +0,0 @@
package com.nkkj.ups.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("generator.mapper")
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
return interceptor;
}
}

View File

@ -1,5 +0,0 @@
package com.nkkj.ups.config;
public class OneNetConfig {
private String PRODUCT_ID="";
}

View File

@ -1,30 +0,0 @@
package com.nkkj.ups.config;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
//@EnableCaching
@Configuration
public class RedisConfig {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(connectionFactory);
template.setKeySerializer(new StringRedisSerializer());
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
return template;
}
}

View File

@ -1,44 +0,0 @@
package com.nkkj.ups.config;
import com.nkkj.ups.security.filter.JwtAuthenticationTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
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.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Autowired
JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http
.formLogin(form -> form.disable())//禁用默认登录页面
.logout(config->config.disable())//禁用默认登出页面
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))//禁用session 后端分离不需要
.httpBasic(httpBasic -> httpBasic.disable())//
.authorizeHttpRequests(
auth -> auth.requestMatchers("/login", "*/logout","/echo/*","/echo","/all").permitAll().anyRequest().authenticated()//设置权限除了登录登出不需要认证其余均需要认证
).csrf(c->c.disable())
.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)//添加JWT的处理过滤器用于从JWT中解析 用户信息
.build();
}
// @Bean
// WebSecurityCustomizer webSecurityCustomizer() {
// return new WebSecurityCustomizer() {
// @Override
// public void customize(WebSecurity web) {
// web.ignoring().requestMatchers("**/**");
// }
// };
// }
}

View File

@ -1,5 +0,0 @@
package com.nkkj.ups.config;
public class Signature {
public static final String JWT_SIGNATURE="FJNKKJ";
}

View File

@ -1,25 +0,0 @@
package com.nkkj.ups.controller;
import com.nkkj.ups.result.R;
import com.nkkj.ups.service.AlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DataController {
@Autowired
AlarmService alarmService;
@Autowired
@GetMapping("/all")
public R saveData() {
try{
alarmService.UpsAlarm();
}
catch (Exception e){
e.printStackTrace();
}
return R.success();
}
}

View File

@ -1,13 +0,0 @@
package com.nkkj.ups.controller;
import com.nkkj.ups.result.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HistoryDataController {
@GetMapping("getHistory")
public R getHistory() {
return null;
}
}

View File

@ -1,37 +0,0 @@
package com.nkkj.ups.controller;
import com.nkkj.ups.result.R;
import com.nkkj.ups.service.LoginService;
import com.nkkj.ups.utils.JWT.JwtUtils;
import generator.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginController {
@Autowired
LoginService loginService;
@Autowired
JwtUtils jwtUtils;
@PostMapping("/login")
public R Login(@RequestBody User user) {
User userOne=loginService.login(user.getName(), user.getPassword());
if(userOne != null) {
String token=jwtUtils.createToken(userOne);
return R.success(token);
}
return R.fail("登录信息错误");
}
@GetMapping("/")
public R test() {
return R.success("ok");
}
@GetMapping("/test")
public R test1(){
return R.success("test");
}
}

View File

@ -1,22 +0,0 @@
package com.nkkj.ups.controller;
import com.nkkj.ups.result.R;
import com.nkkj.ups.service.UpsService;
import com.nkkj.ups.service.impl.UpsServiceImpl;
import generator.domain.UpsHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class MqttController {
@Autowired
UpsService upsService;
@PostMapping("/getHistory")
public R getHistory(String id,String ups_id){
List<UpsHistory> upsHistory=upsService.getUpsHistory();
return R.success(upsHistory);
}
}

View File

@ -1,15 +0,0 @@
package com.nkkj.ups.controller;
import com.nkkj.ups.result.R;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class SignController {
@PostMapping("/sign")
public R sign(){
return R.success();
}
}

View File

@ -1,10 +0,0 @@
package com.nkkj.ups.param.request;
import lombok.Data;
@Data
public class GetHistoryParams {
//门店id
private String id;
private String ups_id;
}

View File

@ -1,9 +0,0 @@
package com.nkkj.ups.param.request;
import lombok.Data;
@Data
public class OneNetDevice {
private String product_id;
private String device_name;
}

View File

@ -1,13 +0,0 @@
package com.nkkj.ups.param.request;
import lombok.Data;
@Data
public class UpsData<T> {
//upsid
private String id;
private String dataType;
private T value;
private String identifier;
private String name;
}

View File

@ -1,12 +0,0 @@
package com.nkkj.ups.param.response;
import lombok.Data;
import java.util.List;
@Data
public class OneNetQueryDeviceProperty {
private int code;
private List<OneNetQueryDevicePropertyData> data;
private String msg;
private String request_id;
}

View File

@ -1,13 +0,0 @@
package com.nkkj.ups.param.response;
import lombok.Data;
@Data
public class OneNetQueryDevicePropertyData {
private String identifier;
private String value;
private String data_type;
private String name;
private String access_mode;
private long time;
}

View File

@ -1,58 +0,0 @@
package com.nkkj.ups.result;
import jakarta.servlet.http.HttpServletResponse;
import lombok.Data;
@Data
public class R<T> {
private int status;
/**
* 异常编号
*/
private String errorCode;
/**
* 异常信息
*/
private String message;
/**
* 响应数据
*/
private T data;
public static <T> R<T> success() {
return success(200, null, null);
}
public static <T> R<T> success(T data) {
return success(HttpServletResponse.SC_OK, null, data);
}
public static <T> R<T> fail(String message) {
return fail(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null, message, null);
}
public static <T> R<T> fail(String errorCode, String message) {
return fail(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, errorCode, message, null);
}
public static <T> R<T> success(int status, String message, T data) {
R<T> r = new R<>();
r.setStatus(status);
r.setMessage(message);
r.setData(data);
return r;
}
public static <T> R<T> fail(int status, String errorCode, String message) {
return fail(status, errorCode, message, null);
}
public static <T> R<T> fail(int status, String errorCode, String message, T data) {
R<T> r = new R<>();
r.setStatus(status);
r.setErrorCode(errorCode);
r.setMessage(message);
r.setData(data);
return r;
}
}

View File

@ -1,22 +0,0 @@
package com.nkkj.ups.schedule;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class IsOnline {
public static Map<String, Long> onlineMap = new ConcurrentHashMap<String, Long>();
@Scheduled(cron = "0/10 * * * * ? ")
public void isOnline() throws InterruptedException {
for (String s : onlineMap.keySet()) {
long now = new Date().getTime();
if(now-onlineMap.get(s)>30) {
System.out.println("超市");
}
}
}
}

View File

@ -1,2 +0,0 @@
package com.nkkj.ups.security;

View File

@ -1,49 +0,0 @@
package com.nkkj.ups.security.filter;
import com.nkkj.ups.utils.JWT.JwtUtils;
import io.jsonwebtoken.Claims;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
@Component
public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
@Autowired
JwtUtils jwtUtils;
@Autowired
UserDetailsService userDetailsService;
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
String token=request.getHeader("Authorization");
if (token == null || token.isEmpty()) {
// 没有携带 token 放行
filterChain.doFilter(request, response);
return;
}
Claims claims =jwtUtils.decodeToken(token);
String username = claims.getSubject();
System.out.println(claims.getSubject());
if(SecurityContextHolder.getContext().getAuthentication()==null)
{
// UserDetails userDetails = userDetailsService.loadUserByUsername(username);
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, null, null);
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
}
filterChain.doFilter(request, response);
}
}

View File

@ -1,14 +0,0 @@
package com.nkkj.ups.service;
import com.nkkj.ups.websocket.WsServerEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AlarmService {
@Autowired
WsServerEndpoint endpoint;
public void UpsAlarm() throws Exception {
endpoint.sendAllUser("测试");
}
}

View File

@ -1,7 +0,0 @@
package com.nkkj.ups.service;
import generator.domain.User;
public interface LoginService {
User login(String username, String password);
}

View File

@ -1,9 +0,0 @@
package com.nkkj.ups.service;
import generator.domain.UpsHistory;
import java.util.List;
public interface UpsService {
List<UpsHistory> getUpsHistory();
}

View File

@ -1,27 +0,0 @@
package com.nkkj.ups.service.impl;
import com.nkkj.ups.service.LoginService;
import com.nkkj.ups.utils.JWT.JwtUtils;
import generator.domain.User;
import generator.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.stereotype.Service;
@Service
public class LoginServiceImpl implements LoginService {
@Autowired
UserMapper userMapper;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Override
public User login(String username, String password) {
redisTemplate.opsForValue().set(username,password);
String value = (String) redisTemplate.opsForValue().get("run_id");
System.out.println(value);
User user=userMapper.selectOneByNameAndPassword(username,password);
return user;
}
}

View File

@ -1,20 +0,0 @@
package com.nkkj.ups.service.impl;
import com.nkkj.ups.service.UpsService;
import generator.domain.UpsHistory;
import generator.mapper.UpsHistoryMapper;
import generator.mapper.UpsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UpsServiceImpl implements UpsService {
@Autowired
UpsHistoryMapper upsHistoryMapper;
@Override
public List<UpsHistory> getUpsHistory() {
return upsHistoryMapper.selectList(null);
}
}

View File

@ -1,33 +0,0 @@
package com.nkkj.ups.utils.JWT;
import generator.domain.User;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties;
import org.springframework.stereotype.Component;
import javax.crypto.SecretKey;
import java.util.Date;
@Component
public class JwtUtils {
public static SecretKey secretKey=getSigningKey();
public String createToken(User user) {
return Jwts.builder()
.subject(user.getName())
.issuedAt(new Date())
.expiration(new Date(new Date().getTime()+1000*60*60*24))
.signWith(secretKey)
.compact();
}
public Claims decodeToken(String token) {
return Jwts.parser().verifyWith(secretKey).build().parseSignedClaims(token).getPayload();
// Jwts.claims().
// Jwts.parser().setSigningKey().
}
public static SecretKey getSigningKey() {
return Jwts.SIG.HS256.key().build();
}
}

View File

@ -1,8 +0,0 @@
package com.nkkj.ups.utils;
import org.springframework.stereotype.Component;
@Component
public class MqttInfoUtils {
}

View File

@ -1,26 +0,0 @@
package com.nkkj.ups.utils;
import com.nkkj.ups.param.request.OneNetDevice;
import com.nkkj.ups.param.response.OneNetQueryDeviceProperty;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
@Component
public class OneNetUtils {
public OneNetQueryDeviceProperty QueryDeviceProperty(OneNetDevice oneNetDevice) throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
String urlString="https://iot-api.heclouds.com/thingmodel/query-device-property?product_id="+oneNetDevice.getProduct_id()+"device_name="+oneNetDevice.getDevice_name();
HttpRequest request=HttpRequest.newBuilder()
.uri(URI.create(urlString))
.header("athorization","version=2018-10-31&res=products%2FTz9a5iUEkS%2Fdevices%2Fshante&et=1824228600&method=md5&sign=19EMD1rm2JVaRWvcCcxH6A%3D%3D")
.build();
HttpResponse<String> response=client.send(request,HttpResponse.BodyHandlers.ofString());
// OneNetQueryDeviceProperty oneNetQueryDeviceProperty=response.body();
return null;
}
}

View File

@ -1,14 +0,0 @@
package com.nkkj.ups.websocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
@EnableWebSocket
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpoint() {
return new ServerEndpointExporter();
}
}

View File

@ -1,89 +0,0 @@
package com.nkkj.ups.websocket;
import com.alibaba.fastjson.JSONObject;
import jakarta.websocket.*;
import jakarta.websocket.server.PathParam;
import jakarta.websocket.server.ServerEndpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.time.Instant;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ServerEndpoint("/echo/{id}")
@Component
public class WsServerEndpoint {
public static Map<String,WsServerEndpoint> wsServerEndpointMap = new ConcurrentHashMap<>();
private Session session;
private String id;
// 收到消息
@OnMessage
public void onMessage(String message) throws Exception {
JSONObject jsonObject = JSONObject.parseObject(message);
String id= (String) jsonObject.get("id");
String msg=(String) jsonObject.get("msg");
if (message.equalsIgnoreCase("bye")) {
// 由服务器主动关闭连接状态码为 NORMAL_CLOSURE正常关闭
this.session.close(new CloseReason(CloseReason.CloseCodes.NORMAL_CLOSURE, "Bye"));;
return;
}
if(id!=null)
{
if("-1".equals(id))
{
sendAllUser("1");
}
else {
sendToUser(id, msg);
}
}
// this.session.getAsyncRemote().sendText("["+ Instant.now().toEpochMilli() +"] Hello " + message);
}
// 连接打开
@OnOpen
public void onOpen(@PathParam(value = "id") String id, Session session, EndpointConfig endpointConfig){
System.out.println("开启连接");
// 保存 session 到对象
this.session = session;
this.id = id;
wsServerEndpointMap.put(id,this);
}
// 连接关闭
@OnClose
public void onClose(CloseReason closeReason){
wsServerEndpointMap.remove(this);
System.out.println("断开连接");
}
// 连接异常
@OnError
public void onError(Throwable throwable) throws IOException {
System.out.println(throwable);
// 关闭连接状态码为 UNEXPECTED_CONDITION意料之外的异常
this.session.close(new CloseReason(CloseReason.CloseCodes.UNEXPECTED_CONDITION, throwable.getMessage()));
}
public void sendMessage(String message) throws Exception {
this.session.getAsyncRemote().sendText(message);
}
public void sendToUser(String id, String message) throws Exception {
if(wsServerEndpointMap.containsKey(id)){
wsServerEndpointMap.get(id).session.getAsyncRemote().sendText(message);
}
}
public void sendAllUser(String message) throws Exception{
for (String s : wsServerEndpointMap.keySet()) {
wsServerEndpointMap.get(s).sendMessage(message);
}
}
}

View File

@ -1,76 +0,0 @@
package generator.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
/**
*
* @TableName role
*/
@TableName(value ="role")
@Data
public class Role implements Serializable {
/**
*
*/
@TableId
private Integer id;
/**
*
*/
private String role;
/**
*
*/
private String name;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Role other = (Role) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getRole() == null ? other.getRole() == null : this.getRole().equals(other.getRole()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getRole() == null) ? 0 : getRole().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", role=").append(role);
sb.append(", name=").append(name);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,85 +0,0 @@
package generator.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName ups
*/
@TableName(value ="ups")
@Data
public class Ups implements Serializable {
/**
*
*/
@TableId
private Integer id;
/**
*
*/
private Integer upsId;
/**
*
*/
private Integer serialNumber;
/**
*
*/
private Date createTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Ups other = (Ups) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUpsId() == null ? other.getUpsId() == null : this.getUpsId().equals(other.getUpsId()))
&& (this.getSerialNumber() == null ? other.getSerialNumber() == null : this.getSerialNumber().equals(other.getSerialNumber()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUpsId() == null) ? 0 : getUpsId().hashCode());
result = prime * result + ((getSerialNumber() == null) ? 0 : getSerialNumber().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", upsId=").append(upsId);
sb.append(", serialNumber=").append(serialNumber);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,174 +0,0 @@
package generator.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName ups_history
*/
@TableName(value ="ups_history")
@Data
public class UpsHistory implements Serializable {
/**
*
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
*
*/
private Integer upsId;
/**
*
*/
private String workMode;
/**
*
*/
private String deviceType;
/**
*
*/
private String status;
/**
*
*/
private String cityVol;
/**
*
*/
private String cityFreq;
/**
*
*/
private String cellVol;
/**
*
*/
private String cellCur;
/**
*
*/
private String outVol;
/**
*
*/
private String inVol;
/**
*
*/
private String outCur;
/**
*
*/
private String outFreq;
/**
*
*/
private String outPower;
/**
*
*/
private Timestamp createTime;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
UpsHistory other = (UpsHistory) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUpsId() == null ? other.getUpsId() == null : this.getUpsId().equals(other.getUpsId()))
&& (this.getWorkMode() == null ? other.getWorkMode() == null : this.getWorkMode().equals(other.getWorkMode()))
&& (this.getDeviceType() == null ? other.getDeviceType() == null : this.getDeviceType().equals(other.getDeviceType()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getCityVol() == null ? other.getCityVol() == null : this.getCityVol().equals(other.getCityVol()))
&& (this.getCityFreq() == null ? other.getCityFreq() == null : this.getCityFreq().equals(other.getCityFreq()))
&& (this.getCellVol() == null ? other.getCellVol() == null : this.getCellVol().equals(other.getCellVol()))
&& (this.getCellCur() == null ? other.getCellCur() == null : this.getCellCur().equals(other.getCellCur()))
&& (this.getOutVol() == null ? other.getOutVol() == null : this.getOutVol().equals(other.getOutVol()))
&& (this.getInVol() == null ? other.getInVol() == null : this.getInVol().equals(other.getInVol()))
&& (this.getOutCur() == null ? other.getOutCur() == null : this.getOutCur().equals(other.getOutCur()))
&& (this.getOutFreq() == null ? other.getOutFreq() == null : this.getOutFreq().equals(other.getOutFreq()))
&& (this.getOutPower() == null ? other.getOutPower() == null : this.getOutPower().equals(other.getOutPower()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUpsId() == null) ? 0 : getUpsId().hashCode());
result = prime * result + ((getWorkMode() == null) ? 0 : getWorkMode().hashCode());
result = prime * result + ((getDeviceType() == null) ? 0 : getDeviceType().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getCityVol() == null) ? 0 : getCityVol().hashCode());
result = prime * result + ((getCityFreq() == null) ? 0 : getCityFreq().hashCode());
result = prime * result + ((getCellVol() == null) ? 0 : getCellVol().hashCode());
result = prime * result + ((getCellCur() == null) ? 0 : getCellCur().hashCode());
result = prime * result + ((getOutVol() == null) ? 0 : getOutVol().hashCode());
result = prime * result + ((getInVol() == null) ? 0 : getInVol().hashCode());
result = prime * result + ((getOutCur() == null) ? 0 : getOutCur().hashCode());
result = prime * result + ((getOutFreq() == null) ? 0 : getOutFreq().hashCode());
result = prime * result + ((getOutPower() == null) ? 0 : getOutPower().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", upsId=").append(upsId);
sb.append(", workMode=").append(workMode);
sb.append(", deviceType=").append(deviceType);
sb.append(", status=").append(status);
sb.append(", cityVol=").append(cityVol);
sb.append(", cityFreq=").append(cityFreq);
sb.append(", cellVol=").append(cellVol);
sb.append(", cellCur=").append(cellCur);
sb.append(", outVol=").append(outVol);
sb.append(", inVol=").append(inVol);
sb.append(", outCur=").append(outCur);
sb.append(", outFreq=").append(outFreq);
sb.append(", outPower=").append(outPower);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,76 +0,0 @@
package generator.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
/**
*
* @TableName user
*/
@TableName(value ="user")
@Data
public class User implements Serializable {
/**
*
*/
@TableId
private Integer id;
/**
*
*/
private String name;
/**
*
*/
private String password;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
User other = (User) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", password=").append(password);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,18 +0,0 @@
package generator.mapper;
import generator.domain.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 2511
* @description 针对表role的数据库操作Mapper
* @createDate 2024-08-27 11:58:07
* @Entity generator.domain.Role
*/
public interface RoleMapper extends BaseMapper<Role> {
}

View File

@ -1,18 +0,0 @@
package generator.mapper;
import generator.domain.UpsHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 2511
* @description 针对表ups_history的数据库操作Mapper
* @createDate 2024-08-29 14:57:00
* @Entity generator.domain.UpsHistory
*/
public interface UpsHistoryMapper extends BaseMapper<UpsHistory> {
}

View File

@ -1,18 +0,0 @@
package generator.mapper;
import generator.domain.Ups;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 2511
* @description 针对表ups的数据库操作Mapper
* @createDate 2024-08-27 14:56:20
* @Entity generator.domain.Ups
*/
public interface UpsMapper extends BaseMapper<Ups> {
}

View File

@ -1,19 +0,0 @@
package generator.mapper;
import org.apache.ibatis.annotations.Param;
import generator.domain.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author 2511
* @description 针对表user的数据库操作Mapper
* @createDate 2024-08-22 16:16:55
* @Entity generator.domain.User
*/
public interface UserMapper extends BaseMapper<User> {
User selectOneByNameAndPassword(@Param("name") String name, @Param("password") String password);
}

View File

@ -1,13 +0,0 @@
package generator.service;
import generator.domain.Role;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 2511
* @description 针对表role的数据库操作Service
* @createDate 2024-08-27 11:58:07
*/
public interface RoleService extends IService<Role> {
}

View File

@ -1,13 +0,0 @@
package generator.service;
import generator.domain.UpsHistory;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 2511
* @description 针对表ups_history的数据库操作Service
* @createDate 2024-08-29 14:57:00
*/
public interface UpsHistoryService extends IService<UpsHistory> {
}

View File

@ -1,13 +0,0 @@
package generator.service;
import generator.domain.Ups;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 2511
* @description 针对表ups的数据库操作Service
* @createDate 2024-08-27 14:56:20
*/
public interface UpsService extends IService<Ups> {
}

View File

@ -1,13 +0,0 @@
package generator.service;
import generator.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 2511
* @description 针对表user的数据库操作Service
* @createDate 2024-08-22 16:16:55
*/
public interface UserService extends IService<User> {
}

View File

@ -1,22 +0,0 @@
package generator.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.Role;
import generator.service.RoleService;
import generator.mapper.RoleMapper;
import org.springframework.stereotype.Service;
/**
* @author 2511
* @description 针对表role的数据库操作Service实现
* @createDate 2024-08-27 11:58:07
*/
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role>
implements RoleService{
}

View File

@ -1,22 +0,0 @@
package generator.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.UpsHistory;
import generator.service.UpsHistoryService;
import generator.mapper.UpsHistoryMapper;
import org.springframework.stereotype.Service;
/**
* @author 2511
* @description 针对表ups_history的数据库操作Service实现
* @createDate 2024-08-29 14:57:00
*/
@Service
public class UpsHistoryServiceImpl extends ServiceImpl<UpsHistoryMapper, UpsHistory>
implements UpsHistoryService{
}

View File

@ -1,22 +0,0 @@
package generator.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.Ups;
import generator.service.UpsService;
import generator.mapper.UpsMapper;
import org.springframework.stereotype.Service;
/**
* @author 2511
* @description 针对表ups的数据库操作Service实现
* @createDate 2024-08-27 14:56:20
*/
@Service
public class UpsServiceImpl extends ServiceImpl<UpsMapper, Ups>
implements UpsService{
}

View File

@ -1,22 +0,0 @@
package generator.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import generator.domain.User;
import generator.service.UserService;
import generator.mapper.UserMapper;
import org.springframework.stereotype.Service;
/**
* @author 2511
* @description 针对表user的数据库操作Service实现
* @createDate 2024-08-22 16:16:55
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
implements UserService{
}

View File

@ -1,9 +0,0 @@
spring.application.name=ups
server.port=8089
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://localhost:3306/ups?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
spring.jackson.parser..allow-unquoted-control-chars=true
spring.data.redis.host=127.0.0.1
spring.data.redis.port=6379

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="generator.mapper.RoleMapper">
<resultMap id="BaseResultMap" type="generator.domain.Role">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="role" column="role" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,role,name
</sql>
</mapper>

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="generator.mapper.UpsHistoryMapper">
<resultMap id="BaseResultMap" type="generator.domain.UpsHistory">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="upsId" column="ups_id" jdbcType="INTEGER"/>
<result property="workMode" column="work_mode" jdbcType="VARCHAR"/>
<result property="deviceType" column="device_type" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="cityVol" column="city_vol" jdbcType="VARCHAR"/>
<result property="cityFreq" column="city_freq" jdbcType="VARCHAR"/>
<result property="cellVol" column="cell_vol" jdbcType="VARCHAR"/>
<result property="cellCur" column="cell_cur" jdbcType="VARCHAR"/>
<result property="outVol" column="out_vol" jdbcType="VARCHAR"/>
<result property="inVol" column="in_vol" jdbcType="VARCHAR"/>
<result property="outCur" column="out_cur" jdbcType="VARCHAR"/>
<result property="outFreq" column="out_freq" jdbcType="VARCHAR"/>
<result property="outPower" column="out_power" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,ups_id,work_mode,
device_type,status,city_vol,
city_freq,cell_vol,cell_cur,
out_vol,in_vol,out_cur,
out_freq,out_power,create_time
</sql>
</mapper>

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="generator.mapper.UpsMapper">
<resultMap id="BaseResultMap" type="generator.domain.Ups">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="upsId" column="ups_id" jdbcType="INTEGER"/>
<result property="serialNumber" column="serial_number" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,ups_id,serial_number,
create_time
</sql>
</mapper>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="generator.mapper.UserMapper">
<resultMap id="BaseResultMap" type="generator.domain.User">
<id property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,name,password
</sql>
<select id="selectOneByNameAndPassword" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from user
where
name = #{name,jdbcType=VARCHAR}
AND password = #{password,jdbcType=VARCHAR}
</select>
</mapper>

View File

@ -1,13 +0,0 @@
package com.nkkj.ups;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class UpsApplicationTests {
@Test
void contextLoads() {
}
}

View File

@ -1,99 +0,0 @@
package com.nkkj.ups.test;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nkkj.ups.service.AlarmService;
import com.nkkj.ups.utils.JWT.JwtUtils;
import generator.domain.Ups;
import generator.domain.UpsHistory;
import generator.domain.User;
import generator.mapper.UpsHistoryMapper;
import generator.mapper.UserMapper;
import io.jsonwebtoken.Claims;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SampleTest {
@Autowired
AlarmService alarmService;
@Autowired
private UserMapper userMapper;
@Autowired
private UpsHistoryMapper upsHistoryMapper;
@Autowired
private JwtUtils jwtUtils;
@Test
public void testSelect() throws IOException, InterruptedException {
// OkHttpClient client = new OkHttpClient().newBuilder()
// .build();
// Request request = new Request.Builder()
// .url("https://iot-api.heclouds.com/thingmodel/query-device-property?product_id=Tz9a5iUEkS&device_name=shante")
// .addHeader("Authorization", "version=2022-05-01&res=products%2FTz9a5iUEkS%2Fdevices%2Fshante&et=2079998482&method=md5&sign=Gf925YWwSO7SAlOKY98l2Q%3D%3D")
// .build();
// Response response = client.newCall(request).execute();
// System.out.println(response.body().string());
// HttpClient client = HttpClient.newHttpClient();
//// String urlString="http://localhost:5000";
//
// HttpRequest request=HttpRequest.newBuilder()
// .setHeader("athorization","version=2018-10-31&res=products%2FTz9a5iUEkS%2Fdevices%2Fshante&et=1824228600&method=md5&sign=19EMD1rm2JVaRWvcCcxH6A%3D%3D")
// .setHeader("User-Agent", "Apifox/1.0.0 (https://apifox.com)")
// .setHeader("Accept", "*/*")
// .uri(URI.create(urlString))
// .GET()
// .build();
// System.out.println(request.headers());
// HttpResponse<String> response=client.send(request,HttpResponse.BodyHandlers.ofString());
// System.out.println(response.body());
// User user = new User();
// user.setName("32");
// String token=jwtUtils.createToken(user);
// System.out.println(token);
// System.out.println(("----- selectAll method test ------"));
// Claims claims=jwtUtils.decodeToken(token);
// System.out.println(claims.getSubject());
// List<User> userList = userMapper.selectList(null);
//// Assert.isTrue(5 == userList.size(), "太短");
// userList.forEach(System.out::println);
try{
alarmService.UpsAlarm();
}
catch (Exception e){
e.printStackTrace();
}
UpsHistory upsHistory = new UpsHistory();
upsHistory.setUpsId(3);
upsHistoryMapper.insert(upsHistory);
Page<UpsHistory> page = new Page<>(2,5);
IPage<UpsHistory> ipage =upsHistoryMapper.selectPage(page, null);
List<UpsHistory> list = ipage.getRecords();
list.forEach(System.out::println);
// System.out.println(ipage.getRecords());
// List<UpsHistory> upsHistories = upsHistoryMapper.selectList(null);
// System.out.println(upsHistories);
}
}