First commit
This commit is contained in:
commit
51c30536fb
259
mvnw
vendored
Executable file
259
mvnw
vendored
Executable file
@ -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
|
||||||
|
#
|
||||||
|
# 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
Normal file
149
mvnw.cmd
vendored
Normal file
@ -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 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"
|
||||||
190
pom.xml
Normal file
190
pom.xml
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<?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.veve-plus</groupId>
|
||||||
|
<artifactId>root</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>root</name>
|
||||||
|
<description>Veve API for TMS</description>
|
||||||
|
<url/>
|
||||||
|
<licenses>
|
||||||
|
<license/>
|
||||||
|
</licenses>
|
||||||
|
<developers>
|
||||||
|
<developer/>
|
||||||
|
</developers>
|
||||||
|
<scm>
|
||||||
|
<connection/>
|
||||||
|
<developerConnection/>
|
||||||
|
<tag/>
|
||||||
|
<url/>
|
||||||
|
</scm>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- core 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.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- support 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.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
<version>1.5.5.Final</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.32</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||||
|
<version>3.0.3</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jcraft</groupId>
|
||||||
|
<artifactId>jsch</artifactId>
|
||||||
|
<version>0.1.55</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.5.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20210307</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.api-client</groupId>
|
||||||
|
<artifactId>google-api-client</artifactId>
|
||||||
|
<version>2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.oauth-client</groupId>
|
||||||
|
<artifactId>google-oauth-client-jetty</artifactId>
|
||||||
|
<version>1.34.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.apis</groupId>
|
||||||
|
<artifactId>google-api-services-sheets</artifactId>
|
||||||
|
<version>v4-rev20220927-2.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</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>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-jackson</artifactId> <!-- or jjwt-gson if you prefer Gson -->
|
||||||
|
<version>0.12.5</version>
|
||||||
|
<scope>runtime</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>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.32</version>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<version>1.5.5.Final</version>
|
||||||
|
</path>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||||
|
<version>0.2.0</version>
|
||||||
|
</path>
|
||||||
|
<!-- other annotation processors -->
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs>
|
||||||
|
<compilerArg>
|
||||||
|
-Amapstruct.defaultComponentModel=spring
|
||||||
|
</compilerArg>
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
15
src/main/java/com/veve_plus/root/RootApplication.java
Normal file
15
src/main/java/com/veve_plus/root/RootApplication.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.veve_plus.root;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
|
public class RootApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(RootApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/veve_plus/root/ServletInitializer.java
Normal file
13
src/main/java/com/veve_plus/root/ServletInitializer.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.veve_plus.root;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(RootApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
src/main/java/com/veve_plus/root/config/CorsConfig.java
Normal file
29
src/main/java/com/veve_plus/root/config/CorsConfig.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.veve_plus.root.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
import org.springframework.web.filter.CorsFilter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsFilter corsFilter(){
|
||||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||||
|
corsConfiguration.setAllowedOrigins(Arrays.asList("http://localhost:3000"
|
||||||
|
, "http://18.143.143.117:3001"
|
||||||
|
, "http://veve.dnkinno.com:3001"));
|
||||||
|
corsConfiguration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
|
||||||
|
corsConfiguration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type"));
|
||||||
|
corsConfiguration.setAllowCredentials(true); // If credentials are needed
|
||||||
|
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", corsConfiguration);
|
||||||
|
|
||||||
|
return new CorsFilter(source);
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/main/java/com/veve_plus/root/config/JwtFilter.java
Normal file
60
src/main/java/com/veve_plus/root/config/JwtFilter.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package com.veve_plus.root.config;
|
||||||
|
|
||||||
|
import com.veve_plus.root.service.CustomUserDetailService;
|
||||||
|
import com.veve_plus.root.service.JwtService;
|
||||||
|
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.context.ApplicationContext;
|
||||||
|
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.WebAuthenticationDetails;
|
||||||
|
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JwtFilter extends OncePerRequestFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtService jwtService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||||
|
String authHeader = request.getHeader("Authorization");
|
||||||
|
String reqToken = null;
|
||||||
|
String username = null;
|
||||||
|
|
||||||
|
//extract token & username from header
|
||||||
|
if(authHeader != null && authHeader.startsWith("Bearer ")){
|
||||||
|
reqToken = authHeader.substring(7);
|
||||||
|
username = jwtService.extractUsername(reqToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
//getAuthentication() == null mean the request is not authenticated yet
|
||||||
|
if(username != null && SecurityContextHolder.getContext().getAuthentication() == null){
|
||||||
|
//get user info by username
|
||||||
|
UserDetails userDetails = applicationContext.getBean(CustomUserDetailService.class).loadUserByUsername(username);
|
||||||
|
//validate token, if token is valid then create authentication obj
|
||||||
|
if(jwtService.validateToken(reqToken, userDetails)){
|
||||||
|
//if token is valid then it will run next filter: UsernamePasswordAuthenticationFilter
|
||||||
|
//create authToken to make next filter work
|
||||||
|
UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||||
|
//passing request data to the new token
|
||||||
|
authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||||
|
//set token to context, marking the request as authenticated
|
||||||
|
SecurityContextHolder.getContext().setAuthentication(authToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/main/java/com/veve_plus/root/config/MyBatisConfig.java
Normal file
34
src/main/java/com/veve_plus/root/config/MyBatisConfig.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package com.veve_plus.root.config;
|
||||||
|
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@MapperScan("com.veve_plus.root.") // Specify the package where your mapper interfaces are located
|
||||||
|
public class MyBatisConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
|
||||||
|
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
|
||||||
|
factoryBean.setDataSource(dataSource);
|
||||||
|
|
||||||
|
// Set the package where your entity classes are located
|
||||||
|
factoryBean.setTypeAliasesPackage("com.veve_plus.root.**");
|
||||||
|
|
||||||
|
// Set the package where your mapper interfaces are located
|
||||||
|
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath*:mapper/*.xml"));
|
||||||
|
|
||||||
|
// Enable MyBatis logging of SQL statements
|
||||||
|
org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
|
||||||
|
configuration.setLogImpl(org.apache.ibatis.logging.stdout.StdOutImpl.class);
|
||||||
|
factoryBean.setConfiguration(configuration);
|
||||||
|
|
||||||
|
return factoryBean.getObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
package com.veve_plus.root.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.authentication.AuthenticationProvider;
|
||||||
|
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||||
|
import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
|
||||||
|
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.core.userdetails.UserDetailsService;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.provisioning.JdbcUserDetailsManager;
|
||||||
|
import org.springframework.security.provisioning.UserDetailsManager;
|
||||||
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
|
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import static org.springframework.security.config.Customizer.withDefaults;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableWebSecurity
|
||||||
|
public class WebSecurityConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserDetailsService userDetailsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JwtFilter jwtFilter;
|
||||||
|
|
||||||
|
private static final String[] WHITE_LIST_URL = { "/api/v1/auth/**", "/v2/api-docs", "/v3/api-docs",
|
||||||
|
"/v3/api-docs/**", "/api-docs", "/api-docs/**", "/swagger-resources", "/swagger-resources/**", "/configuration/ui",
|
||||||
|
"/configuration/security", "/swagger-ui/**", "/webjars/**", "/swagger-ui.html", "/api/auth/**",
|
||||||
|
"/api/test/**", "/authenticate", "/tms/**", "/material/**", "/title/**", "/logout", "/login"};
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{
|
||||||
|
http.httpBasic(withDefaults())
|
||||||
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
|
.cors(withDefaults())
|
||||||
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
|
.authorizeHttpRequests(authorize -> authorize
|
||||||
|
.requestMatchers(WHITE_LIST_URL).permitAll()
|
||||||
|
.anyRequest().permitAll())
|
||||||
|
.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class)
|
||||||
|
;
|
||||||
|
return http.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public AuthenticationProvider authenticationProvider(){
|
||||||
|
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
||||||
|
provider.setPasswordEncoder(new BCryptPasswordEncoder(12));
|
||||||
|
provider.setUserDetailsService(userDetailsService);
|
||||||
|
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception{
|
||||||
|
return config.getAuthenticationManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
54
src/main/java/com/veve_plus/root/constant/TmsSheetConst.java
Normal file
54
src/main/java/com/veve_plus/root/constant/TmsSheetConst.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package com.veve_plus.root.constant;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class TmsSheetConst {
|
||||||
|
public static final String CONST_TASK_DATA_TYPE = "05";
|
||||||
|
public static final String CONST_FILE_DATA_TYPE = "02";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value Default
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum Template {
|
||||||
|
|
||||||
|
SHEET_US("US", "Default", "US!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_FR("FR", "Default", "FR!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_ES("ES", "Default", "ES!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_DE("DE", "Default", "DE!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_TW("TW", "Default", "TW!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_JP("JP", "Default", "JP!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
// SHEET_AR("AR", "Default", "AR!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_TH("TH", "Default", "TH!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_URGENT("Urgent", "Default", "Urgent!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_TN("TN", "Default", "TN!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
SHEET_YL("YL", "Default", "YL!A8:Z10000", 0, 0, 0, 0),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String sheetCode;
|
||||||
|
private final String info;
|
||||||
|
private final String dataRange;
|
||||||
|
private final int idxRowStart;
|
||||||
|
private final int idxRowEnd;
|
||||||
|
private final int idxColStart;
|
||||||
|
private final int idxColEnd;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum FileSheet {
|
||||||
|
SHEET_FILE_REAL("작품_자료", "Default", "작품_자료!A3:AD10000", 0, 0, 0, 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String sheetCode;
|
||||||
|
private final String info;
|
||||||
|
private final String dataRange;
|
||||||
|
private final int idxRowStart;
|
||||||
|
private final int idxRowEnd;
|
||||||
|
private final int idxColStart;
|
||||||
|
private final int idxColEnd;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.auth.LoginDto;
|
||||||
|
import com.veve_plus.root.service.UserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthController {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@PostMapping("/login")
|
||||||
|
@CrossOrigin
|
||||||
|
public Object login(@RequestBody LoginDto user){
|
||||||
|
return userService.verify(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.code.CodeDto;
|
||||||
|
import com.veve_plus.root.service.CodeService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Code Controller.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping("/code")
|
||||||
|
@Tag(name = "Code APIs")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CodeController {
|
||||||
|
|
||||||
|
private final CodeService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List content response entity.
|
||||||
|
*
|
||||||
|
* @return the response entity
|
||||||
|
*/
|
||||||
|
@Operation(description = "Get codes information")
|
||||||
|
@GetMapping("/find-group/{groupId}")
|
||||||
|
public ResponseEntity<List<CodeDto>> getCodes(@PathVariable("groupId") String groupId,
|
||||||
|
@RequestParam("lang") String lang) {
|
||||||
|
return ResponseEntity.ok(service.getCodes(groupId, lang));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.content.ContentReqDto;
|
||||||
|
import com.veve_plus.root.dto.tms.ProjectDto;
|
||||||
|
import com.veve_plus.root.entity.Content;
|
||||||
|
import com.veve_plus.root.service.ContentService;
|
||||||
|
import com.veve_plus.root.service.TmsService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping("/content")
|
||||||
|
@Tag(name = "Content APIs")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ContentController {
|
||||||
|
|
||||||
|
private final ContentService contentService;
|
||||||
|
private final TmsService tmsService;
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(description = "Add new content")
|
||||||
|
public ResponseEntity<Boolean> addContent(@RequestBody Content content){
|
||||||
|
contentService.insertContent(content);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-content")
|
||||||
|
@Operation(description = "List all content")
|
||||||
|
public ResponseEntity<List<Content>> listContent(){
|
||||||
|
return ResponseEntity.ok(contentService.listContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-tms-title")
|
||||||
|
@Operation(description = "Find project by title")
|
||||||
|
public ResponseEntity<List<ProjectDto>> listProject(@RequestParam("title") String title){
|
||||||
|
return ResponseEntity.ok(tmsService.findProjectByTitle(title));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/map-content")
|
||||||
|
@Operation(description = "Map Tms id to content")
|
||||||
|
public ResponseEntity<Object> mapContent(@RequestBody ContentReqDto dto){
|
||||||
|
contentService.mapContent(dto);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/unmap-content")
|
||||||
|
@Operation(description = "Unmap Tms id to content")
|
||||||
|
public ResponseEntity<Object> unMapContent(@RequestBody ContentReqDto dto){
|
||||||
|
contentService.unMapContent(dto);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.material.MaterialDto;
|
||||||
|
import com.veve_plus.root.dto.material.MaterialTypingStatusDto;
|
||||||
|
import com.veve_plus.root.service.MaterialService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/material")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "Material APIs")
|
||||||
|
@CrossOrigin
|
||||||
|
public class MaterialController {
|
||||||
|
|
||||||
|
private final MaterialService materialService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(description = "Get list material")
|
||||||
|
public ResponseEntity<List<MaterialDto>> listMaterial(){
|
||||||
|
return ResponseEntity.ok(materialService.listMaterial());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/edit")
|
||||||
|
@Operation(description = "Update material")
|
||||||
|
public ResponseEntity<Boolean> updateMaterial(@RequestBody MaterialDto dto){
|
||||||
|
return ResponseEntity.ok(materialService.updateMaterial(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-typing-status")
|
||||||
|
@Operation(description = "Update typing status")
|
||||||
|
public ResponseEntity<Boolean> updateTypingStatus(@RequestBody MaterialTypingStatusDto dto){
|
||||||
|
return ResponseEntity.ok(materialService.updateTypingStatus(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update-tn-typing-status")
|
||||||
|
@Operation(description = "Update typing status")
|
||||||
|
public ResponseEntity<Boolean> updateTooningTypingStatus(@RequestBody MaterialTypingStatusDto dto){
|
||||||
|
return ResponseEntity.ok(materialService.updateTooningTypingStatus(dto));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.menu.Menu;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuResponse;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuSearchRequest;
|
||||||
|
import com.veve_plus.root.service.MenuService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/menu")
|
||||||
|
@Tag(name = "Menu APIs")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@CrossOrigin
|
||||||
|
public class MenuController {
|
||||||
|
|
||||||
|
private final MenuService menuService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(description = "List all menu")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<List<MenuResponse>> list(MenuSearchRequest menuSearchRequest) {
|
||||||
|
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
return ResponseEntity.ok(this.menuService.getMenus(menuSearchRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(description = "Add new menu")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Menu> add(@RequestBody Menu menu) {
|
||||||
|
this.menuService.add(menu);
|
||||||
|
return ResponseEntity.ok(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/edit")
|
||||||
|
@Operation(description = "Edit menu")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Menu> edit(@RequestBody Menu menu) throws SQLException {
|
||||||
|
this.menuService.update(menu);
|
||||||
|
return ResponseEntity.ok(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.role.RoleRequest;
|
||||||
|
import com.veve_plus.root.dto.role.RoleResponse;
|
||||||
|
import com.veve_plus.root.dto.role.RoleSearchRequest;
|
||||||
|
import com.veve_plus.root.service.RoleService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/role")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "Role APIs")
|
||||||
|
@CrossOrigin
|
||||||
|
public class RoleController {
|
||||||
|
private final RoleService roleService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(description = "List all role")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<List<RoleResponse>> list(RoleSearchRequest roleSearchRequest) {
|
||||||
|
return ResponseEntity.ok(this.roleService.findAll(roleSearchRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(description = "Add role")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Boolean> add(@RequestBody RoleRequest roleRequest) {
|
||||||
|
roleService.add(roleRequest);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
@PutMapping("/edit")
|
||||||
|
@Operation(description = "Update role")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<Boolean> edit(@RequestBody RoleRequest roleRequest) throws SQLException {
|
||||||
|
roleService.update(roleRequest);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.task.TaskDto;
|
||||||
|
import com.veve_plus.root.service.TaskService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping("/task")
|
||||||
|
@Tag(name = "Task API")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TaskController {
|
||||||
|
|
||||||
|
private final TaskService taskService;
|
||||||
|
|
||||||
|
@GetMapping("/list-designer-task")
|
||||||
|
@Operation(description = "Get task list of login designer")
|
||||||
|
public ResponseEntity<List<TaskDto>> listDesignerTask(){
|
||||||
|
return ResponseEntity.ok(taskService.listDesignerTask());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("{taskId}/status")
|
||||||
|
@Operation(description = "Update edit status api")
|
||||||
|
public ResponseEntity<Boolean> updateEditStatus(
|
||||||
|
@RequestBody TaskDto dto
|
||||||
|
, @PathVariable("taskId") String taskId){
|
||||||
|
return ResponseEntity.ok(taskService.updateEditStatus(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GetMapping("/confirm-task")
|
||||||
|
// @Operation(description = "Confirm and insert data to task table")
|
||||||
|
// public ResponseEntity<Boolean> confirmTask(){
|
||||||
|
// return ResponseEntity.ok(taskService.confirmTask());
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.content.ContentTitleDto;
|
||||||
|
import com.veve_plus.root.dto.title.TitleDto;
|
||||||
|
import com.veve_plus.root.dto.title.TitleUpdDto;
|
||||||
|
import com.veve_plus.root.service.TitleService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Controller.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping("/title")
|
||||||
|
@Tag(name = "Title APIs")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TitleController {
|
||||||
|
|
||||||
|
private final TitleService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List content response entity.
|
||||||
|
*
|
||||||
|
* @return the response entity
|
||||||
|
*/
|
||||||
|
@Operation(description = "Get title information")
|
||||||
|
@GetMapping("/list-all")
|
||||||
|
public ResponseEntity<List<TitleDto>> listContent() {
|
||||||
|
return ResponseEntity.ok(service.getTitleList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List content response entity.
|
||||||
|
*
|
||||||
|
* @param id the id
|
||||||
|
* @param updDto the upd dto
|
||||||
|
* @return the response entity
|
||||||
|
*/
|
||||||
|
@Operation(description = "User can update “font_type_code”,“font_size” ")
|
||||||
|
@PutMapping("/{id}")
|
||||||
|
public ResponseEntity<Boolean> modifyTitle(@PathVariable("id") String id,
|
||||||
|
@Validated @RequestBody TitleUpdDto updDto) {
|
||||||
|
return ResponseEntity.ok(service.modifyTitle(id, updDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List content title response entity.
|
||||||
|
*
|
||||||
|
* @param keywordSearch the keyword search
|
||||||
|
* @return the response entity
|
||||||
|
*/
|
||||||
|
@Operation(description = "Get list of contents.. front will send name")
|
||||||
|
@GetMapping("/find-all")
|
||||||
|
public ResponseEntity<List<ContentTitleDto>> listContentTitle(@RequestParam("keywordSearch") String keywordSearch) {
|
||||||
|
return ResponseEntity.ok(service.getContentTitleList(keywordSearch));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(description = "Find title Ge-id")
|
||||||
|
@GetMapping("/find-ge-id")
|
||||||
|
public ResponseEntity<TitleDto> findTitleGeId(@RequestParam("language") String language
|
||||||
|
, @RequestParam("tmsId") String tmsId, @RequestParam("chapter") String chapter){
|
||||||
|
return ResponseEntity.ok(service.findTitleGeId(language, tmsId, chapter));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(description = "Find title Ge-id")
|
||||||
|
@GetMapping("/find-tn-ge-id")
|
||||||
|
public ResponseEntity<TitleDto> findTNTitleGeId(@RequestParam("language") String language
|
||||||
|
, @RequestParam("tmsId") String tmsId, @RequestParam("chapter") String chapter){
|
||||||
|
return ResponseEntity.ok(service.findTNTitleGeId(language, tmsId, chapter));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.veve_plus.root.dto.tms.TmsReqDto;
|
||||||
|
import com.veve_plus.root.dto.tms.TranslationDto;
|
||||||
|
import com.veve_plus.root.schedule.GSheetSchedule;
|
||||||
|
import com.veve_plus.root.service.TmsService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@CrossOrigin
|
||||||
|
@Tag(name = "TMS APIs")
|
||||||
|
@RequestMapping("/tms")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TmsController {
|
||||||
|
|
||||||
|
private final TmsService tmsService;
|
||||||
|
private final GSheetSchedule gSheetSchedule;
|
||||||
|
|
||||||
|
//TODO change parameter
|
||||||
|
// @GetMapping("/get-translation/{language}/{tmsId}/{chapter}/{platform}")
|
||||||
|
@GetMapping("/get-translation/{language}/{tmsId}/{chapter}")
|
||||||
|
@Operation(description = "Get translation")
|
||||||
|
public ResponseEntity<Object> getTranslation(@PathVariable("language") String language
|
||||||
|
, @PathVariable("tmsId") String tmsId
|
||||||
|
, @PathVariable("chapter") String chapter
|
||||||
|
// , @PathVariable("platform") String platform
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
// List<TranslationDto> translationResult = tmsService.getTranslation(language, tmsId, chapter, platform);
|
||||||
|
List<TranslationDto> translationResult = tmsService.getTranslation(language, tmsId, chapter, "TMS");
|
||||||
|
return ResponseEntity.ok(translationResult);
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new ResponseStatusException(HttpStatus.NO_CONTENT, "Can not get translation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/get-tms")
|
||||||
|
@Operation(description = "Get TMS")
|
||||||
|
public ResponseEntity<Boolean> getTmsData(@RequestBody TmsReqDto dto) {
|
||||||
|
try {
|
||||||
|
return ResponseEntity.ok(tmsService.getTmsData(dto));
|
||||||
|
} catch (Exception e){
|
||||||
|
return ResponseEntity.ok(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-tn-translation/{language}/{tmsId}/{chapter}")
|
||||||
|
@Operation(description = "Get tooning translation")
|
||||||
|
public ResponseEntity<Object> getTooningTranslation(@PathVariable("language") String language
|
||||||
|
, @PathVariable("tmsId") String tmsId
|
||||||
|
, @PathVariable("chapter") String chapter) {
|
||||||
|
try {
|
||||||
|
List<TranslationDto> translationResult = tmsService.getTranslation(language, tmsId, chapter, "TN");
|
||||||
|
return ResponseEntity.ok(translationResult);
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new ResponseStatusException(HttpStatus.NO_CONTENT, "Can not get translation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/manual")
|
||||||
|
public void test() throws JsonProcessingException {
|
||||||
|
gSheetSchedule.syncKstTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package com.veve_plus.root.controller;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.user.UserRequest;
|
||||||
|
import com.veve_plus.root.dto.user.UserResponse;
|
||||||
|
import com.veve_plus.root.dto.user.UserSearchRequest;
|
||||||
|
import com.veve_plus.root.service.UserService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/user")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Tag(name = "User APIs")
|
||||||
|
@CrossOrigin
|
||||||
|
public class UserController {
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(description = "List all users")
|
||||||
|
@ResponseBody
|
||||||
|
public ResponseEntity<List<UserResponse>> getAllUsersByCondition(UserSearchRequest userSearchRequest){
|
||||||
|
return ResponseEntity.ok(userService.getAllUsersByCondition(userSearchRequest));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
@Operation(description = "Add user")
|
||||||
|
public ResponseEntity<Boolean> addUser(@RequestBody UserRequest userRequest){
|
||||||
|
userService.addUser(userRequest);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/edit")
|
||||||
|
@Operation(description = "Edit user")
|
||||||
|
public ResponseEntity<Boolean> editUser(@RequestBody UserRequest userRequest){
|
||||||
|
userService.editUser(userRequest);
|
||||||
|
return ResponseEntity.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@ResponseBody
|
||||||
|
@Operation(description = "Get user detail")
|
||||||
|
public ResponseEntity<UserResponse> getInfoUsername(@RequestParam("userId") String userId) {
|
||||||
|
return ResponseEntity.ok(this.userService.getInfoUser(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.veve_plus.root.dto.auth;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AuthResponseDto {
|
||||||
|
private String userId;
|
||||||
|
private String username;
|
||||||
|
private List<String> role;
|
||||||
|
private List<String> menuAccess;
|
||||||
|
private String token;
|
||||||
|
private String email;
|
||||||
|
}
|
||||||
9
src/main/java/com/veve_plus/root/dto/auth/LoginDto.java
Normal file
9
src/main/java/com/veve_plus/root/dto/auth/LoginDto.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package com.veve_plus.root.dto.auth;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LoginDto {
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
}
|
||||||
52
src/main/java/com/veve_plus/root/dto/auth/UserPrincipal.java
Normal file
52
src/main/java/com/veve_plus/root/dto/auth/UserPrincipal.java
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package com.veve_plus.root.dto.auth;
|
||||||
|
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public class UserPrincipal implements UserDetails {
|
||||||
|
|
||||||
|
private LoginDto user;
|
||||||
|
private Collection<GrantedAuthority> authorities;
|
||||||
|
|
||||||
|
public UserPrincipal(LoginDto user, Collection<GrantedAuthority> authorities) {
|
||||||
|
this.user = user;
|
||||||
|
this.authorities = authorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
|
return authorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPassword() {
|
||||||
|
return user.getPassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsername() {
|
||||||
|
return user.getEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonExpired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonLocked() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCredentialsNonExpired() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/main/java/com/veve_plus/root/dto/code/CodeDto.java
Normal file
44
src/main/java/com/veve_plus/root/dto/code/CodeDto.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.veve_plus.root.dto.code;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Code Dto.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CodeDto {
|
||||||
|
/**
|
||||||
|
* The unique identifier for the code information.
|
||||||
|
*/
|
||||||
|
private String idx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The group ID associated with the code.
|
||||||
|
*/
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ID of the code.
|
||||||
|
*/
|
||||||
|
private String codeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the code.
|
||||||
|
*/
|
||||||
|
private String codeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language associated with the code information.
|
||||||
|
*/
|
||||||
|
private String lang;
|
||||||
|
}
|
||||||
17
src/main/java/com/veve_plus/root/dto/content/ContentDto.java
Normal file
17
src/main/java/com/veve_plus/root/dto/content/ContentDto.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.veve_plus.root.dto.content;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ContentDto {
|
||||||
|
private String idx;
|
||||||
|
private String content;
|
||||||
|
private String tmsId;
|
||||||
|
private String tmsTitle;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.veve_plus.root.dto.content;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class ContentReqDto {
|
||||||
|
private String content;
|
||||||
|
private String tmsId;
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package com.veve_plus.root.dto.content;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Dto.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ContentTitleDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The project ID associated with the title.
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The content ID of the title.
|
||||||
|
*/
|
||||||
|
private String contentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The content of the title.
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title ID.
|
||||||
|
*/
|
||||||
|
private String titleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language code of the title.
|
||||||
|
*/
|
||||||
|
private String languageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The TMS (Translation Management System) language of the title.
|
||||||
|
*/
|
||||||
|
private String tmsLang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font type code used in the title.
|
||||||
|
*/
|
||||||
|
private String fontTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font size of the title.
|
||||||
|
*/
|
||||||
|
private Long fontSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title content.
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.veve_plus.root.dto.material;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MaterialDto {
|
||||||
|
private String id;
|
||||||
|
private String title;
|
||||||
|
private String language;
|
||||||
|
private String chapter;
|
||||||
|
private String kstDl;
|
||||||
|
private String dkiDl;
|
||||||
|
private String nasUrl;
|
||||||
|
private String tmsUrl;
|
||||||
|
private String downloadStatus;
|
||||||
|
private String downloadDate;
|
||||||
|
private String downloadUser;
|
||||||
|
private String translateStatus;
|
||||||
|
private String trConfirmTime;
|
||||||
|
private String trConfirmBy;
|
||||||
|
private String editorNote;
|
||||||
|
private String kstNote;
|
||||||
|
private String qcNote;
|
||||||
|
private String tmsId;
|
||||||
|
private String typingStatus;
|
||||||
|
private String translationReady;
|
||||||
|
private String transType;
|
||||||
|
private String tmsChapter;
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.veve_plus.root.dto.material;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class MaterialTypingStatusDto {
|
||||||
|
private String tmsId;
|
||||||
|
private String language;
|
||||||
|
private String chapter;
|
||||||
|
private String typingStatus;
|
||||||
|
}
|
||||||
25
src/main/java/com/veve_plus/root/dto/menu/Menu.java
Normal file
25
src/main/java/com/veve_plus/root/dto/menu/Menu.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.veve_plus.root.dto.menu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Menu implements Serializable {
|
||||||
|
private Long menuId;
|
||||||
|
private Long pid;
|
||||||
|
private String type;
|
||||||
|
private String name;
|
||||||
|
private String url;
|
||||||
|
private Integer menuSort;
|
||||||
|
private String icon;
|
||||||
|
private Boolean status;
|
||||||
|
private String permission;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp createdTime;
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.veve_plus.root.dto.menu;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MenuHierarchyResponse {
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
private Long value;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String text;
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private Integer menuSort;
|
||||||
|
|
||||||
|
private String permission;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
private List<MenuHierarchyResponse> children;
|
||||||
|
|
||||||
|
private Boolean hasChildren;
|
||||||
|
}
|
||||||
36
src/main/java/com/veve_plus/root/dto/menu/MenuResponse.java
Normal file
36
src/main/java/com/veve_plus/root/dto/menu/MenuResponse.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package com.veve_plus.root.dto.menu;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MenuResponse {
|
||||||
|
private Long menuId;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String permission;
|
||||||
|
|
||||||
|
private Long pid;
|
||||||
|
|
||||||
|
private Integer menuSort;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
@JsonProperty("_children")
|
||||||
|
private List<MenuResponse> children;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.veve_plus.root.dto.menu;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MenuSearchRequest{
|
||||||
|
private String keyword;
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
26
src/main/java/com/veve_plus/root/dto/role/Role.java
Normal file
26
src/main/java/com/veve_plus/root/dto/role/Role.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class Role {
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
}
|
||||||
27
src/main/java/com/veve_plus/root/dto/role/RoleMenu.java
Normal file
27
src/main/java/com/veve_plus/root/dto/role/RoleMenu.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RoleMenu {
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private Long menuId;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
|
||||||
|
}
|
||||||
33
src/main/java/com/veve_plus/root/dto/role/RoleRequest.java
Normal file
33
src/main/java/com/veve_plus/root/dto/role/RoleRequest.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RoleRequest {
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private List<Long> menuIds;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
}
|
||||||
33
src/main/java/com/veve_plus/root/dto/role/RoleResponse.java
Normal file
33
src/main/java/com/veve_plus/root/dto/role/RoleResponse.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RoleResponse {
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
private List<Long> menuIds;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RoleSearchRequest {
|
||||||
|
private String keyword;
|
||||||
|
private Boolean status;
|
||||||
|
}
|
||||||
27
src/main/java/com/veve_plus/root/dto/role/RoleUser.java
Normal file
27
src/main/java/com/veve_plus/root/dto/role/RoleUser.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.veve_plus.root.dto.role;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RoleUser {
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.veve_plus.root.dto.task;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class KstTaskHistoryDto {
|
||||||
|
private String idx;
|
||||||
|
private String version;
|
||||||
|
private String geId;
|
||||||
|
private String title;
|
||||||
|
private String language;
|
||||||
|
private String chapter;
|
||||||
|
}
|
||||||
21
src/main/java/com/veve_plus/root/dto/task/TaskDto.java
Normal file
21
src/main/java/com/veve_plus/root/dto/task/TaskDto.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package com.veve_plus.root.dto.task;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TaskDto {
|
||||||
|
private String taskId;
|
||||||
|
private String editorId;
|
||||||
|
private String title;
|
||||||
|
private String language;
|
||||||
|
private String chapter;
|
||||||
|
private String dkiDeadline;
|
||||||
|
private String designerDeadline;
|
||||||
|
private String editStatus;
|
||||||
|
private String startTime;
|
||||||
|
private String endTime;
|
||||||
|
private String duration;
|
||||||
|
private String tmsDate;
|
||||||
|
private String geId;
|
||||||
|
private String downloadUrl;
|
||||||
|
}
|
||||||
80
src/main/java/com/veve_plus/root/dto/title/TitleDto.java
Normal file
80
src/main/java/com/veve_plus/root/dto/title/TitleDto.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package com.veve_plus.root.dto.title;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Dto.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TitleDto {
|
||||||
|
/**
|
||||||
|
* The content of the title.
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The TMS ID associated with the title.
|
||||||
|
*/
|
||||||
|
private String tmsId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The content ID of the title.
|
||||||
|
*/
|
||||||
|
private String contentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title ID of the title.
|
||||||
|
*/
|
||||||
|
private String titleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The project ID of the title.
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The NAS path for the title.
|
||||||
|
*/
|
||||||
|
private String kstNasPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language code of the title.
|
||||||
|
*/
|
||||||
|
private String languageCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title GE ID of the title.
|
||||||
|
*/
|
||||||
|
private String titleGeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font type code of the title.
|
||||||
|
*/
|
||||||
|
private String fontTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font size of the title.
|
||||||
|
*/
|
||||||
|
private Long fontSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title text.
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The locale of the title.
|
||||||
|
*/
|
||||||
|
private String locale;
|
||||||
|
}
|
||||||
37
src/main/java/com/veve_plus/root/dto/title/TitleUpdDto.java
Normal file
37
src/main/java/com/veve_plus/root/dto/title/TitleUpdDto.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package com.veve_plus.root.dto.title;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Dto.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TitleUpdDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font type code used in the title.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@NotEmpty
|
||||||
|
private String fontTypeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The font size of the title.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long fontSize;
|
||||||
|
|
||||||
|
}
|
||||||
27
src/main/java/com/veve_plus/root/dto/tms/ProjectDto.java
Normal file
27
src/main/java/com/veve_plus/root/dto/tms/ProjectDto.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.veve_plus.root.dto.tms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ProjectDto {
|
||||||
|
private String projectId;
|
||||||
|
private String title;
|
||||||
|
private String version;
|
||||||
|
private String locale;
|
||||||
|
private int delFlg;
|
||||||
|
private int archivedFlg;
|
||||||
|
private int bookmarkFlg;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp createdTime = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedTime = Timestamp.from(Instant.now());
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package com.veve_plus.root.dto.tms;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
public class ProjectLocaleDto {
|
||||||
|
private String projectId;
|
||||||
|
private String locale;
|
||||||
|
}
|
||||||
17
src/main/java/com/veve_plus/root/dto/tms/TmsReqDto.java
Normal file
17
src/main/java/com/veve_plus/root/dto/tms/TmsReqDto.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.veve_plus.root.dto.tms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TmsReqDto {
|
||||||
|
private String tmsId;
|
||||||
|
private String chapter;
|
||||||
|
private String languageCode;
|
||||||
|
private String translationType;
|
||||||
|
}
|
||||||
35
src/main/java/com/veve_plus/root/dto/tms/TranslationDto.java
Normal file
35
src/main/java/com/veve_plus/root/dto/tms/TranslationDto.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package com.veve_plus.root.dto.tms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TranslationDto {
|
||||||
|
private String tmsId;
|
||||||
|
private String chapter;
|
||||||
|
private String languageCode;
|
||||||
|
private String seqNo;
|
||||||
|
private String positionX;
|
||||||
|
private String positionY;
|
||||||
|
private String width;
|
||||||
|
private String height;
|
||||||
|
private String colorCode;
|
||||||
|
private String textContent;
|
||||||
|
private String fontSize;
|
||||||
|
private String fontTypeCode;
|
||||||
|
private String fontName;
|
||||||
|
private String platform;
|
||||||
|
private String delFlg;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp createdTime = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedTime = Timestamp.from(Instant.now());
|
||||||
|
}
|
||||||
98
src/main/java/com/veve_plus/root/dto/user/UserDto.java
Normal file
98
src/main/java/com/veve_plus/root/dto/user/UserDto.java
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
package com.veve_plus.root.dto.user;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuResponse;
|
||||||
|
import lombok.*;
|
||||||
|
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.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class UserDto implements UserDetails, Serializable {
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
private Long deptId;
|
||||||
|
private Long managerId;
|
||||||
|
private String username;
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
|
private String gender;
|
||||||
|
private String phone;
|
||||||
|
private String email;
|
||||||
|
private String contractNo;
|
||||||
|
private String contractDate;
|
||||||
|
private String identityNo;
|
||||||
|
private String issuedDate;
|
||||||
|
private String issuedPlace;
|
||||||
|
private String taxCode;
|
||||||
|
private String avatarName;
|
||||||
|
private String avatarPath;
|
||||||
|
private String password;
|
||||||
|
private String downloadPassword;
|
||||||
|
private Boolean isAdmin;
|
||||||
|
private Boolean isManager;
|
||||||
|
private Boolean isLocked = false;
|
||||||
|
private Boolean isExpired = false;
|
||||||
|
private Boolean isCredentialExpired = false;
|
||||||
|
private Boolean status = true;
|
||||||
|
private String level;
|
||||||
|
private String bank;
|
||||||
|
private String bankAccount;
|
||||||
|
private String classification;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp pwdResetTime;
|
||||||
|
private Timestamp createdTime = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedTime = Timestamp.from(Instant.now());
|
||||||
|
|
||||||
|
private Set<GrantedAuthority> authorities;
|
||||||
|
|
||||||
|
private List<MenuResponse> menus;
|
||||||
|
|
||||||
|
public void setAuthorities(Collection<String> roles) {
|
||||||
|
Set<GrantedAuthority> authorities = new HashSet<>();
|
||||||
|
for (String role : roles) {
|
||||||
|
authorities.add(new SimpleGrantedAuthority(role));
|
||||||
|
}
|
||||||
|
this.authorities = authorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
|
return authorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonExpired() {
|
||||||
|
return !this.isExpired;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonLocked() {
|
||||||
|
return !this.isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCredentialsNonExpired() {
|
||||||
|
return !this.isCredentialExpired;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return this.status;
|
||||||
|
}
|
||||||
|
}
|
||||||
95
src/main/java/com/veve_plus/root/dto/user/UserRequest.java
Normal file
95
src/main/java/com/veve_plus/root/dto/user/UserRequest.java
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
package com.veve_plus.root.dto.user;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class UserRequest {
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
private Long deptId;
|
||||||
|
private String deptName;
|
||||||
|
private Long managerId;
|
||||||
|
private String username;
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
|
private String gender;
|
||||||
|
private String phone;
|
||||||
|
private String email;
|
||||||
|
private String contractNo;
|
||||||
|
private String contractDate;
|
||||||
|
private String identityNo;
|
||||||
|
private String issuedDate;
|
||||||
|
private String issuedPlace;
|
||||||
|
private String taxCode;
|
||||||
|
private String avatarName;
|
||||||
|
private String avatarPath;
|
||||||
|
private String password;
|
||||||
|
private String downloadPassword;
|
||||||
|
private Boolean isAdmin;
|
||||||
|
private Boolean isManager;
|
||||||
|
private List<Long> roleIds = new ArrayList<>();
|
||||||
|
private Boolean isLocked = false;
|
||||||
|
private Boolean isExpired = false;
|
||||||
|
private Boolean isCredentialExpired = false;
|
||||||
|
private Boolean status = true;
|
||||||
|
private Timestamp pwdResetTime;
|
||||||
|
private String level;
|
||||||
|
private String bank;
|
||||||
|
private String bankAccount;
|
||||||
|
private String classification;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp createdTime = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedTime = Timestamp.from(Instant.now());
|
||||||
|
|
||||||
|
public UserDto toUser(){
|
||||||
|
return UserDto.builder()
|
||||||
|
.userId(this.userId)
|
||||||
|
.deptId(this.deptId)
|
||||||
|
.managerId(this.managerId)
|
||||||
|
.username(this.username)
|
||||||
|
.firstName(this.firstName)
|
||||||
|
.lastName(this.lastName)
|
||||||
|
.gender(this.gender)
|
||||||
|
.phone(this.phone)
|
||||||
|
.email(this.email)
|
||||||
|
.contractNo(this.contractNo)
|
||||||
|
.contractDate(this.contractDate)
|
||||||
|
.identityNo(this.identityNo)
|
||||||
|
.issuedDate(this.issuedDate)
|
||||||
|
.issuedPlace(this.issuedPlace)
|
||||||
|
.taxCode(this.taxCode)
|
||||||
|
.avatarName(this.avatarName)
|
||||||
|
.avatarPath(this.avatarPath)
|
||||||
|
.password(this.password)
|
||||||
|
.downloadPassword(this.downloadPassword)
|
||||||
|
.isAdmin(this.isAdmin)
|
||||||
|
.isManager(this.isManager)
|
||||||
|
.isLocked(this.isLocked)
|
||||||
|
.isExpired(this.isExpired)
|
||||||
|
.isCredentialExpired(this.isCredentialExpired)
|
||||||
|
.status(this.status)
|
||||||
|
.level(this.level)
|
||||||
|
.bank(this.bank)
|
||||||
|
.bankAccount(this.bankAccount)
|
||||||
|
.classification(this.classification)
|
||||||
|
.createdBy(this.createdBy)
|
||||||
|
.updatedBy(this.updatedBy)
|
||||||
|
.pwdResetTime(this.pwdResetTime)
|
||||||
|
.createdTime(this.createdTime)
|
||||||
|
.updatedTime(this.updatedTime)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
58
src/main/java/com/veve_plus/root/dto/user/UserResponse.java
Normal file
58
src/main/java/com/veve_plus/root/dto/user/UserResponse.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package com.veve_plus.root.dto.user;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class UserResponse{
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
private Long deptId;
|
||||||
|
private String deptName;
|
||||||
|
private Long managerId;
|
||||||
|
private String managerName;
|
||||||
|
private String username;
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
|
private String gender;
|
||||||
|
private String phone;
|
||||||
|
private String email;
|
||||||
|
private String contractNo;
|
||||||
|
private LocalDateTime contractDate;
|
||||||
|
private String identityNo;
|
||||||
|
private LocalDateTime issuedDate;
|
||||||
|
private String issuedPlace;
|
||||||
|
private String taxCode;
|
||||||
|
private String avatarName;
|
||||||
|
private String avatarPath;
|
||||||
|
private String password;
|
||||||
|
private Boolean isAdmin;
|
||||||
|
private Boolean isManager;
|
||||||
|
private String roleIds;
|
||||||
|
private String roleNames;
|
||||||
|
private Boolean isLocked = false;
|
||||||
|
private Boolean isExpired = false;
|
||||||
|
private Boolean isCredentialExpired = false;
|
||||||
|
private Boolean status = true;
|
||||||
|
private String level;
|
||||||
|
private String levelName;
|
||||||
|
private String bank;
|
||||||
|
private String bankAccount;
|
||||||
|
private String classification;
|
||||||
|
private String classificationName;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private Timestamp pwdResetTime;
|
||||||
|
private Timestamp createdTime = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedTime = Timestamp.from(Instant.now());
|
||||||
|
}
|
||||||
26
src/main/java/com/veve_plus/root/dto/user/UserRole.java
Normal file
26
src/main/java/com/veve_plus/root/dto/user/UserRole.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.veve_plus.root.dto.user;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserRole {
|
||||||
|
private Long userId;
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
private String updatedBy;
|
||||||
|
|
||||||
|
private Timestamp createdTime;
|
||||||
|
|
||||||
|
private Timestamp updatedTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.veve_plus.root.dto.user;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class UserSearchRequest {
|
||||||
|
private String keyword;
|
||||||
|
private String classification;
|
||||||
|
private String deptId;
|
||||||
|
private String level;
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
}
|
||||||
18
src/main/java/com/veve_plus/root/entity/Content.java
Normal file
18
src/main/java/com/veve_plus/root/entity/Content.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package com.veve_plus.root.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Content {
|
||||||
|
private String idx;
|
||||||
|
private String content;
|
||||||
|
private String delYn;
|
||||||
|
private String tmsId;
|
||||||
|
private Timestamp createdDate = Timestamp.from(Instant.now());
|
||||||
|
private Timestamp updatedDate = Timestamp.from(Instant.now());
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
}
|
||||||
46
src/main/java/com/veve_plus/root/entity/GSheetData.java
Normal file
46
src/main/java/com/veve_plus/root/entity/GSheetData.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package com.veve_plus.root.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GSheetData implements Serializable {
|
||||||
|
private String idx;
|
||||||
|
private String geId;
|
||||||
|
private String version;
|
||||||
|
private String diskType;
|
||||||
|
private String platformCode;
|
||||||
|
private String title;
|
||||||
|
private String chapter;
|
||||||
|
private String openDate;
|
||||||
|
private String transDeliveryDate;
|
||||||
|
private String transReviewDate;
|
||||||
|
private String isTransReview;
|
||||||
|
private String affectedDeliveryDate;
|
||||||
|
private String affectedMonth;
|
||||||
|
private String affectedChapter;
|
||||||
|
private String dkiDeliveryDate;
|
||||||
|
private String isModify;
|
||||||
|
private String psdUploadDealine;
|
||||||
|
private String finalSubsetUpload;
|
||||||
|
private String tmsPsdUpload;
|
||||||
|
private String qcUserId;
|
||||||
|
private String issuedDate;
|
||||||
|
private String writer;
|
||||||
|
private String scheduleChangeReason;
|
||||||
|
private String isConfirmed;
|
||||||
|
private String idConFirmHistory;
|
||||||
|
private String note;
|
||||||
|
private String contentKey;
|
||||||
|
private String googleApiId;
|
||||||
|
private int googleRow;
|
||||||
|
private String googleSheetName;
|
||||||
|
private String language;
|
||||||
|
private String createdDate;
|
||||||
|
private String updatedDate;
|
||||||
|
private String createdBy;
|
||||||
|
private String updatedBy;
|
||||||
|
private String isUrgent;
|
||||||
|
}
|
||||||
|
|
||||||
27
src/main/java/com/veve_plus/root/entity/GSheetFileData.java
Normal file
27
src/main/java/com/veve_plus/root/entity/GSheetFileData.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.veve_plus.root.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GSheetFileData {
|
||||||
|
private String idx;
|
||||||
|
private String version;
|
||||||
|
private String language;
|
||||||
|
private String tms;
|
||||||
|
private String content;
|
||||||
|
private String isCensored;
|
||||||
|
private String fileSpec;
|
||||||
|
private String useUsPsd;
|
||||||
|
private String is_set;
|
||||||
|
private String is_logo;
|
||||||
|
private String dm_name;
|
||||||
|
private String psd_url_kr;
|
||||||
|
private String psd_url_en;
|
||||||
|
private String tr_url;
|
||||||
|
private String note;
|
||||||
|
private String memo;
|
||||||
|
private String created_by;
|
||||||
|
private String updated_by;
|
||||||
|
private String created_time;
|
||||||
|
private String updated_time;
|
||||||
|
}
|
||||||
23
src/main/java/com/veve_plus/root/entity/User.java
Normal file
23
src/main/java/com/veve_plus/root/entity/User.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package com.veve_plus.root.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class User {
|
||||||
|
private String userId;
|
||||||
|
private String deptId;
|
||||||
|
private String username;
|
||||||
|
private String firstName;
|
||||||
|
private String lastName;
|
||||||
|
private String gender;
|
||||||
|
private String phone;
|
||||||
|
private String email;
|
||||||
|
}
|
||||||
29
src/main/java/com/veve_plus/root/mapper/CodeMapper.java
Normal file
29
src/main/java/com/veve_plus/root/mapper/CodeMapper.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.code.CodeDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Code Mapper.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CodeMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update title by idx.
|
||||||
|
*
|
||||||
|
* @param groupId the group id
|
||||||
|
* @param lang the lang
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
List<CodeDto> findCodesByGroupId(@Param("groupId") String groupId,
|
||||||
|
@Param("lang") String lang);
|
||||||
|
|
||||||
|
}
|
||||||
14
src/main/java/com/veve_plus/root/mapper/ContentMapper.java
Normal file
14
src/main/java/com/veve_plus/root/mapper/ContentMapper.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.entity.Content;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ContentMapper {
|
||||||
|
void mapContent(String tmsId, String content);
|
||||||
|
void insertContent(Content content);
|
||||||
|
List<Content> listContent();
|
||||||
|
void unMapContent(String content);
|
||||||
|
}
|
||||||
14
src/main/java/com/veve_plus/root/mapper/GSheetMapper.java
Normal file
14
src/main/java/com/veve_plus/root/mapper/GSheetMapper.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.entity.GSheetData;
|
||||||
|
import com.veve_plus.root.entity.GSheetFileData;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GSheetMapper {
|
||||||
|
void insertTaskListHistory(List<GSheetData> lst);
|
||||||
|
String getGoogleSheetSpreadId(String dataType);
|
||||||
|
void insertFileListHistory(List<GSheetFileData> lst);
|
||||||
|
}
|
||||||
19
src/main/java/com/veve_plus/root/mapper/MaterialMapper.java
Normal file
19
src/main/java/com/veve_plus/root/mapper/MaterialMapper.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.material.MaterialDto;
|
||||||
|
import com.veve_plus.root.dto.material.MaterialTypingStatusDto;
|
||||||
|
import com.veve_plus.root.entity.GSheetData;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MaterialMapper {
|
||||||
|
List<MaterialDto> listMaterial();
|
||||||
|
void updateMaterial(MaterialDto dto);
|
||||||
|
void insertMaterial(GSheetData dto);
|
||||||
|
void updateTypingStatus(MaterialTypingStatusDto dto);
|
||||||
|
void updateTooningTypingStatus(MaterialTypingStatusDto dto);
|
||||||
|
void updateTransType(String transType, String language, String tmsId, String chapter);
|
||||||
|
String findMaterialCategory(String tmsId, String language, String chapter);
|
||||||
|
}
|
||||||
17
src/main/java/com/veve_plus/root/mapper/MenuMapper.java
Normal file
17
src/main/java/com/veve_plus/root/mapper/MenuMapper.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.menu.Menu;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuResponse;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuSearchRequest;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MenuMapper {
|
||||||
|
List<MenuResponse> findAll(MenuSearchRequest menuSearchRequest);
|
||||||
|
void insert(Menu menu);
|
||||||
|
void update(Menu menu);
|
||||||
|
List<String> getMenusByEmail(String email);
|
||||||
|
|
||||||
|
}
|
||||||
16
src/main/java/com/veve_plus/root/mapper/RoleMapper.java
Normal file
16
src/main/java/com/veve_plus/root/mapper/RoleMapper.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.role.*;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface RoleMapper {
|
||||||
|
List<RoleResponse> findAllRolesByCondition(RoleSearchRequest request);
|
||||||
|
void insert(Role role);
|
||||||
|
void update(Role role);
|
||||||
|
void insertRoleMenu(RoleMenu roleMenu);
|
||||||
|
void deleteByRoleId(Long roleId);
|
||||||
|
List<RoleUser> findRolesByEmail(String email);
|
||||||
|
}
|
||||||
17
src/main/java/com/veve_plus/root/mapper/TaskMapper.java
Normal file
17
src/main/java/com/veve_plus/root/mapper/TaskMapper.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.task.KstTaskHistoryDto;
|
||||||
|
import com.veve_plus.root.dto.task.TaskDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TaskMapper {
|
||||||
|
|
||||||
|
List<TaskDto> listDesignerTask(String pic);
|
||||||
|
boolean updateEditStatus(TaskDto dto);
|
||||||
|
List<KstTaskHistoryDto> getLatestVersion(String language);
|
||||||
|
void createVeveInfo(String title, String language, String chapter, String note, int userId);
|
||||||
|
void autoAssignDesigner(String language);
|
||||||
|
}
|
||||||
49
src/main/java/com/veve_plus/root/mapper/TitleMapper.java
Normal file
49
src/main/java/com/veve_plus/root/mapper/TitleMapper.java
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.content.ContentTitleDto;
|
||||||
|
import com.veve_plus.root.dto.title.TitleDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Mapper.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TitleMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find title list.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
List<TitleDto> findTitleList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update title by idx.
|
||||||
|
*
|
||||||
|
* @param idx the idx
|
||||||
|
* @return the int
|
||||||
|
*/
|
||||||
|
int updateTitleByIdx(@Param("id") String idx,
|
||||||
|
@Param("fontSize") Long fontSize,
|
||||||
|
@Param("fontTypeCode") String fontTypeCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find title list by content list.
|
||||||
|
*
|
||||||
|
* @param keywordSearch the keyword search
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
List<ContentTitleDto> findContentTitleList(@Param("keywordSearch") String keywordSearch);
|
||||||
|
|
||||||
|
TitleDto findTmsTitleGeId(String language, String tmsId, String chapter);
|
||||||
|
|
||||||
|
TitleDto findTooningTitleGeId(String language, String tmsId, String chapter);
|
||||||
|
}
|
||||||
19
src/main/java/com/veve_plus/root/mapper/TmsMapper.java
Normal file
19
src/main/java/com/veve_plus/root/mapper/TmsMapper.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.tms.ProjectDto;
|
||||||
|
import com.veve_plus.root.dto.tms.ProjectLocaleDto;
|
||||||
|
import com.veve_plus.root.dto.tms.TranslationDto;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TmsMapper {
|
||||||
|
void insertTranslation(TranslationDto dto);
|
||||||
|
|
||||||
|
void insertProject(ProjectDto dto);
|
||||||
|
|
||||||
|
void insertProjectLocale(ProjectLocaleDto dto);
|
||||||
|
List<ProjectDto> findProjectByTitle(String title);
|
||||||
|
List<TranslationDto> getTranslationList(String tmsId, String languageCode, String chapter, String platform);
|
||||||
|
}
|
||||||
23
src/main/java/com/veve_plus/root/mapper/UserMapper.java
Normal file
23
src/main/java/com/veve_plus/root/mapper/UserMapper.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package com.veve_plus.root.mapper;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.auth.LoginDto;
|
||||||
|
import com.veve_plus.root.dto.user.UserDto;
|
||||||
|
import com.veve_plus.root.dto.user.UserResponse;
|
||||||
|
import com.veve_plus.root.dto.user.UserRole;
|
||||||
|
import com.veve_plus.root.dto.user.UserSearchRequest;
|
||||||
|
import com.veve_plus.root.entity.User;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface UserMapper {
|
||||||
|
LoginDto findByEmail(String email);
|
||||||
|
User findUserInfoByEmail(String email);
|
||||||
|
List<UserResponse> findAllUsersByCondition(UserSearchRequest req);
|
||||||
|
void insert(UserDto user);
|
||||||
|
void insertRole(UserRole build);
|
||||||
|
void update(UserDto user);
|
||||||
|
void deleteRolesByUserId(Long userId);
|
||||||
|
UserResponse getInfoUserById(String userId);
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package com.veve_plus.root.schedule;
|
||||||
|
|
||||||
|
import com.veve_plus.root.constant.TmsSheetConst;
|
||||||
|
import com.veve_plus.root.service.TaskService;
|
||||||
|
import com.veve_plus.root.service.TmsGSheetService;
|
||||||
|
import com.veve_plus.root.utils.DateTimeUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Log4j2
|
||||||
|
public class GSheetSchedule {
|
||||||
|
|
||||||
|
private final TmsGSheetService tmsGSheetService;
|
||||||
|
private final TaskService taskService;
|
||||||
|
|
||||||
|
//private final String CRON_TASK_KIDARI = "0 0 7-20 * * *";
|
||||||
|
private final String CRON_TASK_KIDARI = "0 */1 * * * *";
|
||||||
|
private final String CRON_SCHEDULE_ZONE = "Asia/Bangkok";
|
||||||
|
|
||||||
|
// @Scheduled(cron = CRON_TASK_KIDARI, zone = CRON_SCHEDULE_ZONE)
|
||||||
|
public void syncKstTask(){
|
||||||
|
String taskSpreadId = tmsGSheetService.getGoogleSheetSpreadId(TmsSheetConst.CONST_TASK_DATA_TYPE);
|
||||||
|
String fileSpreadId = tmsGSheetService.getGoogleSheetSpreadId(TmsSheetConst.CONST_FILE_DATA_TYPE);
|
||||||
|
String runVersion = DateTimeUtils.getVersionFormatDate();
|
||||||
|
if (taskSpreadId == null || taskSpreadId.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fileSpreadId == null || fileSpreadId.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EnumSet.allOf(TmsSheetConst.Template.class).forEach(i -> {
|
||||||
|
try {
|
||||||
|
tmsGSheetService.insertTaskData(i.getSheetCode(), i.getDataRange(), taskSpreadId, runVersion);
|
||||||
|
// taskService.confirmTask(i.getSheetCode());
|
||||||
|
// taskService.autoAssignDesigner(i.getSheetCode());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
tmsGSheetService.insertFileData(TmsSheetConst.FileSheet.SHEET_FILE_REAL.getDataRange(), fileSpreadId, runVersion);
|
||||||
|
} catch (GeneralSecurityException | IOException | URISyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/main/java/com/veve_plus/root/schedule/TmsScheduler.java
Normal file
26
src/main/java/com/veve_plus/root/schedule/TmsScheduler.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.veve_plus.root.schedule;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.veve_plus.root.service.TmsService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Log4j2
|
||||||
|
public class TmsScheduler {
|
||||||
|
private final TmsService tmsService;
|
||||||
|
|
||||||
|
private final String CRON_TMS_SYNC = "0 5 * * * *";
|
||||||
|
|
||||||
|
private final String CRON_SCHEDULE_ZONE = "Asia/Bangkok";
|
||||||
|
|
||||||
|
public void syncTmsData() throws JsonProcessingException {
|
||||||
|
log.info("TMS Batch run");
|
||||||
|
tmsService.insertProjects("01");
|
||||||
|
tmsService.insertProjects("02");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
44
src/main/java/com/veve_plus/root/service/CodeService.java
Normal file
44
src/main/java/com/veve_plus/root/service/CodeService.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.code.CodeDto;
|
||||||
|
import com.veve_plus.root.mapper.CodeMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Service.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CodeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title mapper
|
||||||
|
*/
|
||||||
|
private final CodeMapper mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets title list.
|
||||||
|
*
|
||||||
|
* @param groupId the group id
|
||||||
|
* @param lang the lang
|
||||||
|
* @return the title list
|
||||||
|
*/
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<CodeDto> getCodes(String groupId, String lang) {
|
||||||
|
if (StringUtils.isBlank(lang)){
|
||||||
|
lang = "EN";
|
||||||
|
}
|
||||||
|
return mapper.findCodesByGroupId(groupId, lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
33
src/main/java/com/veve_plus/root/service/ContentService.java
Normal file
33
src/main/java/com/veve_plus/root/service/ContentService.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.content.ContentReqDto;
|
||||||
|
import com.veve_plus.root.entity.Content;
|
||||||
|
import com.veve_plus.root.mapper.ContentMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ContentService {
|
||||||
|
private final ContentMapper contentMapper;
|
||||||
|
|
||||||
|
public void insertContent(Content content){
|
||||||
|
contentMapper.insertContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Content> listContent(){
|
||||||
|
return contentMapper.listContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mapContent(ContentReqDto dto){
|
||||||
|
contentMapper.mapContent(dto.getTmsId(), dto.getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unMapContent(ContentReqDto dto){
|
||||||
|
contentMapper.unMapContent(dto.getContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.auth.LoginDto;
|
||||||
|
import com.veve_plus.root.dto.auth.UserPrincipal;
|
||||||
|
import com.veve_plus.root.dto.role.RoleUser;
|
||||||
|
import com.veve_plus.root.mapper.RoleMapper;
|
||||||
|
import com.veve_plus.root.mapper.UserMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||||
|
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 java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CustomUserDetailService implements UserDetailsService {
|
||||||
|
|
||||||
|
private final UserMapper userMapper;
|
||||||
|
private final RoleMapper roleMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
|
|
||||||
|
LoginDto dto = userMapper.findByEmail(username);
|
||||||
|
|
||||||
|
if (dto == null){
|
||||||
|
throw new UsernameNotFoundException("User not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RoleUser> roles = roleMapper.findRolesByEmail(username);
|
||||||
|
if (roles == null){
|
||||||
|
throw new UsernameNotFoundException("User role not found");
|
||||||
|
}
|
||||||
|
Collection<GrantedAuthority> authorities = convertToGrantedAuthorities(roles);
|
||||||
|
|
||||||
|
return new UserPrincipal(dto, authorities);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<GrantedAuthority> convertToGrantedAuthorities(List<RoleUser> userRoles) {
|
||||||
|
return userRoles.stream()
|
||||||
|
.map(role -> new SimpleGrantedAuthority(role.getRoleId().toString()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
81
src/main/java/com/veve_plus/root/service/JwtService.java
Normal file
81
src/main/java/com/veve_plus/root/service/JwtService.java
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
import io.jsonwebtoken.Jwts;
|
||||||
|
import io.jsonwebtoken.io.Decoders;
|
||||||
|
import io.jsonwebtoken.security.Keys;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.crypto.KeyGenerator;
|
||||||
|
import javax.crypto.SecretKey;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class JwtService {
|
||||||
|
|
||||||
|
private String secretKey = "";
|
||||||
|
|
||||||
|
public JwtService() {
|
||||||
|
try {
|
||||||
|
//avoid hardcode secret key, server generate secret key everytime
|
||||||
|
KeyGenerator keygen = KeyGenerator.getInstance("HmacSHA256");
|
||||||
|
SecretKey k = keygen.generateKey();
|
||||||
|
secretKey = Base64.getEncoder().encodeToString(k.getEncoded());
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String generateToken(String username){
|
||||||
|
Map<String, Object> claims = new HashMap<>();
|
||||||
|
return Jwts.builder()
|
||||||
|
.claims()
|
||||||
|
.add(claims)
|
||||||
|
.subject(username)
|
||||||
|
.issuedAt(new Date(System.currentTimeMillis()))
|
||||||
|
.expiration(new Date(System.currentTimeMillis() + 3 * 60 * 60 * 1000))
|
||||||
|
.and()
|
||||||
|
.signWith(getKey())
|
||||||
|
.compact();
|
||||||
|
}
|
||||||
|
|
||||||
|
private SecretKey getKey(){
|
||||||
|
byte[] keyBytes = Decoders.BASE64.decode(secretKey);
|
||||||
|
return Keys.hmacShaKeyFor(keyBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String extractUsername(String token) {
|
||||||
|
// extract the username from jwt token
|
||||||
|
return extractClaim(token, Claims::getSubject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T extractClaim(String token, Function<Claims, T> claimResolver) {
|
||||||
|
final Claims claims = extractAllClaims(token);
|
||||||
|
return claimResolver.apply(claims);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Claims extractAllClaims(String token) {
|
||||||
|
return Jwts.parser()
|
||||||
|
.verifyWith(getKey())
|
||||||
|
.build()
|
||||||
|
.parseSignedClaims(token)
|
||||||
|
.getPayload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean validateToken(String token, UserDetails userDetails) {
|
||||||
|
final String userName = extractUsername(token);
|
||||||
|
return (userName.equals(userDetails.getUsername()) && !isTokenExpired(token));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTokenExpired(String token) {
|
||||||
|
return extractExpiration(token).before(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Date extractExpiration(String token) {
|
||||||
|
return extractClaim(token, Claims::getExpiration);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.material.MaterialDto;
|
||||||
|
import com.veve_plus.root.dto.material.MaterialTypingStatusDto;
|
||||||
|
import com.veve_plus.root.mapper.MaterialMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MaterialService {
|
||||||
|
private final MaterialMapper materialMapper;
|
||||||
|
|
||||||
|
public List<MaterialDto> listMaterial(){
|
||||||
|
return materialMapper.listMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateMaterial(MaterialDto dto){
|
||||||
|
materialMapper.updateMaterial(dto);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateTypingStatus(MaterialTypingStatusDto dto){
|
||||||
|
materialMapper.updateTypingStatus(dto);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateTooningTypingStatus(MaterialTypingStatusDto dto){
|
||||||
|
materialMapper.updateTooningTypingStatus(dto);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/main/java/com/veve_plus/root/service/MenuService.java
Normal file
50
src/main/java/com/veve_plus/root/service/MenuService.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.menu.Menu;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuResponse;
|
||||||
|
import com.veve_plus.root.dto.menu.MenuSearchRequest;
|
||||||
|
import com.veve_plus.root.mapper.MenuMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Transactional
|
||||||
|
public class MenuService {
|
||||||
|
private final MenuMapper menuMapper;
|
||||||
|
|
||||||
|
public List<MenuResponse> getMenus(MenuSearchRequest menuSearchRequest){
|
||||||
|
var menuList = this.menuMapper.findAll(menuSearchRequest);
|
||||||
|
// Build a department hierarchy using a map for quick access
|
||||||
|
var menuMap = menuList.stream()
|
||||||
|
.collect(Collectors.groupingBy(MenuResponse::getPid));
|
||||||
|
// Set the hasChildren flag and populate the children list
|
||||||
|
menuList.forEach(menu -> {
|
||||||
|
List<MenuResponse> children = menuMap.getOrDefault(menu.getMenuId(), Collections.emptyList());
|
||||||
|
menu.setChildren(children);
|
||||||
|
});
|
||||||
|
// Get the root departments (those without a parent)
|
||||||
|
return menuList.stream()
|
||||||
|
.filter(menu -> menu.getPid() == -1)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean add(Menu menu){
|
||||||
|
this.menuMapper.insert(menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public boolean update(Menu menu) throws SQLException {
|
||||||
|
// var exists = this.menuMapper.recursiveHierarchyCheck(menu);
|
||||||
|
// if(exists){
|
||||||
|
// throw new SQLException("Invalid menu hierarchy: Recursive relationship detected.");
|
||||||
|
// }
|
||||||
|
this.menuMapper.update(menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
66
src/main/java/com/veve_plus/root/service/RoleService.java
Normal file
66
src/main/java/com/veve_plus/root/service/RoleService.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.role.*;
|
||||||
|
import com.veve_plus.root.mapper.RoleMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Transactional
|
||||||
|
public class RoleService {
|
||||||
|
private final RoleMapper roleMapper;
|
||||||
|
|
||||||
|
public List<RoleResponse> findAll(RoleSearchRequest roleSearchRequest){
|
||||||
|
return roleMapper.findAllRolesByCondition(roleSearchRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(RoleRequest roleRequest){
|
||||||
|
var role = Role.builder()
|
||||||
|
.name(roleRequest.getName())
|
||||||
|
.description(roleRequest.getDescription())
|
||||||
|
.status(roleRequest.getStatus())
|
||||||
|
.createdBy(roleRequest.getCreatedBy())
|
||||||
|
.updatedTime(roleRequest.getUpdatedTime())
|
||||||
|
.createdTime(roleRequest.getCreatedTime())
|
||||||
|
.updatedBy(roleRequest.getUpdatedBy())
|
||||||
|
.build();
|
||||||
|
this.roleMapper.insert(role);
|
||||||
|
for(var menuId : roleRequest.getMenuIds()){
|
||||||
|
this.roleMapper.insertRoleMenu(RoleMenu.builder()
|
||||||
|
.roleId(role.getRoleId())
|
||||||
|
.menuId(menuId)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(RoleRequest roleRequest){
|
||||||
|
var role = Role.builder()
|
||||||
|
.roleId(roleRequest.getRoleId())
|
||||||
|
.name(roleRequest.getName())
|
||||||
|
.status(roleRequest.getStatus())
|
||||||
|
.description(roleRequest.getDescription())
|
||||||
|
.createdBy(roleRequest.getCreatedBy())
|
||||||
|
.updatedTime(roleRequest.getUpdatedTime())
|
||||||
|
.createdTime(roleRequest.getCreatedTime())
|
||||||
|
.updatedBy(roleRequest.getUpdatedBy())
|
||||||
|
.build();
|
||||||
|
this.roleMapper.update(role);
|
||||||
|
this.roleMapper.deleteByRoleId(role.getRoleId());
|
||||||
|
for(var menuId : roleRequest.getMenuIds()){
|
||||||
|
this.roleMapper.insertRoleMenu(RoleMenu.builder()
|
||||||
|
.roleId(role.getRoleId())
|
||||||
|
.menuId(menuId)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> findRolesByEmail(String email){
|
||||||
|
List<RoleUser> roleUsers = roleMapper.findRolesByEmail(email);
|
||||||
|
return roleUsers.stream().map(role -> String.valueOf(role.getRoleId())).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
94
src/main/java/com/veve_plus/root/service/TaskService.java
Normal file
94
src/main/java/com/veve_plus/root/service/TaskService.java
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.task.KstTaskHistoryDto;
|
||||||
|
import com.veve_plus.root.dto.task.TaskDto;
|
||||||
|
import com.veve_plus.root.mapper.TaskMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TaskService {
|
||||||
|
|
||||||
|
private final TaskMapper taskMapper;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
public List<TaskDto> listDesignerTask(){
|
||||||
|
|
||||||
|
//get list task
|
||||||
|
List<TaskDto> tasks = taskMapper.listDesignerTask(userService.getCurrentAuditor());
|
||||||
|
//get login token
|
||||||
|
String token = getSynologyToken();
|
||||||
|
|
||||||
|
for(TaskDto dto : tasks){
|
||||||
|
String folderName = "/RAW/" + dto.getGeId() + "_" + dto.getLanguage() + "/" + dto.getChapter();
|
||||||
|
|
||||||
|
String downloadUrl = "https://disk.dnkinno.vn:5001/webapi/entry.cgi?api=SYNO.FileStation.Sharing&method=create&version=3&path=" + folderName + "&sid=" + token;
|
||||||
|
HttpHeaders header = new HttpHeaders();
|
||||||
|
//set token to cookie
|
||||||
|
header.add("Cookie", "id=" + token);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<>(header);
|
||||||
|
|
||||||
|
RestTemplate downloadTemplate = new RestTemplate();
|
||||||
|
//send get request to NAS
|
||||||
|
ResponseEntity<String> downloadResponse = downloadTemplate.exchange(downloadUrl, HttpMethod.GET, entity, String.class);
|
||||||
|
String responseStr = downloadResponse.getBody();
|
||||||
|
|
||||||
|
JSONObject dlRes = new JSONObject(responseStr);
|
||||||
|
if(!dlRes.getBoolean("success")){
|
||||||
|
dto.setDownloadUrl("There is an error when getting download url");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//extract url from response
|
||||||
|
dto.setDownloadUrl(new JSONObject(dlRes.getJSONObject("data").getJSONArray("links").get(0).toString()).getString("url"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSynologyToken(){
|
||||||
|
String loginUrl = "https://disk.dnkinno.vn:5001/webapi/entry.cgi?api=SYNO.API.Auth&version=6&method=login&account=DKI-veve&passwd=Dki@2025&session=FileStation&format=cookie";
|
||||||
|
|
||||||
|
HttpHeaders header = new HttpHeaders();
|
||||||
|
header.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<>("{}", header);
|
||||||
|
|
||||||
|
RestTemplate loginTemplate = new RestTemplate();
|
||||||
|
ResponseEntity<String> loginResponse = loginTemplate.exchange(loginUrl, HttpMethod.GET, entity, String.class);
|
||||||
|
String responseStr = loginResponse.getBody();
|
||||||
|
|
||||||
|
//extract auth token
|
||||||
|
JSONObject jsonResponse = new JSONObject(responseStr);
|
||||||
|
|
||||||
|
return jsonResponse.getJSONObject("data").getString("sid");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public boolean updateEditStatus(TaskDto dto){
|
||||||
|
return taskMapper.updateEditStatus(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public boolean confirmTask(String language){
|
||||||
|
//get latest version
|
||||||
|
List<KstTaskHistoryDto> latestTaskHistory = taskMapper.getLatestVersion(language);
|
||||||
|
//insert content, title, task. Update them if already exist
|
||||||
|
//old veve use procedure: sp_01_create_content, sp_02_create_content_title, sp_03_create_task
|
||||||
|
for (KstTaskHistoryDto dto : latestTaskHistory) {
|
||||||
|
taskMapper.createVeveInfo(dto.getTitle(), language, dto.getChapter(), "", 2);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void autoAssignDesigner(String language){
|
||||||
|
taskMapper.autoAssignDesigner(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
74
src/main/java/com/veve_plus/root/service/TitleService.java
Normal file
74
src/main/java/com/veve_plus/root/service/TitleService.java
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.content.ContentTitleDto;
|
||||||
|
import com.veve_plus.root.dto.title.TitleDto;
|
||||||
|
import com.veve_plus.root.dto.title.TitleUpdDto;
|
||||||
|
import com.veve_plus.root.mapper.TitleMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type Title Service.
|
||||||
|
*
|
||||||
|
* @author : SG.Yesterme
|
||||||
|
* @version : 1.0.0
|
||||||
|
* @date : 2024. 8. 23.
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TitleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Title mapper
|
||||||
|
*/
|
||||||
|
private final TitleMapper mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets title list.
|
||||||
|
*
|
||||||
|
* @return the title list
|
||||||
|
*/
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<TitleDto> getTitleList() {
|
||||||
|
return mapper.findTitleList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify title boolean.
|
||||||
|
*
|
||||||
|
* @param idx the idx
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean modifyTitle(String idx, TitleUpdDto updDto) {
|
||||||
|
return mapper.updateTitleByIdx(idx, updDto.getFontSize(), updDto.getFontTypeCode()) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets content title list.
|
||||||
|
*
|
||||||
|
* @param keywordSearch the keyword search
|
||||||
|
* @return the content title list
|
||||||
|
*/
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public List<ContentTitleDto> getContentTitleList(String keywordSearch) {
|
||||||
|
return mapper.findContentTitleList(keywordSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TitleDto findTitleGeId(String language, String tmsId, String chapter){
|
||||||
|
|
||||||
|
return mapper.findTmsTitleGeId(language, tmsId, chapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public TitleDto findTNTitleGeId(String language, String tmsId, String chapter){
|
||||||
|
|
||||||
|
return mapper.findTooningTitleGeId(language, tmsId, chapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
149
src/main/java/com/veve_plus/root/service/TmsGSheetService.java
Normal file
149
src/main/java/com/veve_plus/root/service/TmsGSheetService.java
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.entity.GSheetData;
|
||||||
|
import com.veve_plus.root.entity.GSheetFileData;
|
||||||
|
import com.veve_plus.root.mapper.GSheetMapper;
|
||||||
|
import com.veve_plus.root.mapper.MaterialMapper;
|
||||||
|
import com.veve_plus.root.utils.CustomStringUtils;
|
||||||
|
import com.veve_plus.root.utils.GSheetsUtils;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TmsGSheetService {
|
||||||
|
|
||||||
|
private final GSheetsUtils googleSheetsUtil;
|
||||||
|
private final GSheetMapper GSheetMapper;
|
||||||
|
private final MaterialMapper materialMapper;
|
||||||
|
|
||||||
|
public void insertTaskData(String sheetName, String range, String spreadId, String runVersion) throws GeneralSecurityException, IOException, URISyntaxException {
|
||||||
|
String hostName = InetAddress.getLocalHost().getHostName();
|
||||||
|
|
||||||
|
List<LinkedHashMap<String, Object>> result = googleSheetsUtil.getKSTData(spreadId, range);
|
||||||
|
if(result == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rowNo = 7;
|
||||||
|
List<GSheetData> insertList = new ArrayList<>();
|
||||||
|
System.out.println("Processing on sheet: " + sheetName);
|
||||||
|
for (LinkedHashMap<String, Object> i : result) {
|
||||||
|
GSheetData sheet = new GSheetData();
|
||||||
|
sheet.setDiskType(CustomStringUtils.valueOf(i.get("TMS")));
|
||||||
|
sheet.setGeId(CustomStringUtils.valueOf(i.get("GeId")));
|
||||||
|
sheet.setPlatformCode(CustomStringUtils.valueOf(i.get("Platform")));
|
||||||
|
sheet.setTitle(CustomStringUtils.valueOf(i.get("Title")));
|
||||||
|
sheet.setChapter(CustomStringUtils.valueOf(i.get("Chap")));
|
||||||
|
sheet.setOpenDate(CustomStringUtils.convertSheetStringDate(i.get("Open Day")));
|
||||||
|
sheet.setTransDeliveryDate(CustomStringUtils.convertSheetStringDate(i.get("Translation delivery date")));
|
||||||
|
sheet.setTransReviewDate(CustomStringUtils.convertSheetStringDate(i.get("TR")));
|
||||||
|
sheet.setIsTransReview((CustomStringUtils.valueOf(i.get("TR ready"))));
|
||||||
|
sheet.setAffectedDeliveryDate(CustomStringUtils.convertSheetStringDate(i.get("Delivery date")));
|
||||||
|
sheet.setAffectedChapter(CustomStringUtils.removeSpecialChar(i.get("Affected chapter")));
|
||||||
|
sheet.setDkiDeliveryDate(CustomStringUtils.convertSheetStringDate(i.get("DL")));
|
||||||
|
sheet.setIsModify(CustomStringUtils.validBoolean(CustomStringUtils.valueOf(i.get("Necessity of modification (TMS)"))));
|
||||||
|
sheet.setPsdUploadDealine(CustomStringUtils.convertSheetStringDate(i.get("PSD upload deadline")));
|
||||||
|
sheet.setFinalSubsetUpload(CustomStringUtils.validBoolean(CustomStringUtils.valueOf(i.get("Final Subset upload"))));
|
||||||
|
sheet.setTmsPsdUpload(CustomStringUtils.validBoolean(CustomStringUtils.valueOf(i.get("PSD upload check"))));
|
||||||
|
sheet.setQcUserId(CustomStringUtils.valueOf(i.get("worker")));
|
||||||
|
sheet.setIssuedDate(CustomStringUtils.convertSheetStringDate(i.get("Date of issue")));
|
||||||
|
sheet.setWriter(CustomStringUtils.valueOf(i.get("Writer")));
|
||||||
|
sheet.setScheduleChangeReason(CustomStringUtils.valueOf(i.get("Reason for schedule change")));
|
||||||
|
sheet.setIsConfirmed(CustomStringUtils.validBoolean(CustomStringUtils.valueOf(i.get("DKI schedule change confirmation"))));
|
||||||
|
sheet.setNote(CustomStringUtils.valueOf(i.get("Reason")));
|
||||||
|
if("TN".equals(sheetName)){
|
||||||
|
sheet.setLanguage(CustomStringUtils.valueOf(i.get("Lang")).substring(2,4));
|
||||||
|
}
|
||||||
|
else if("YL".equals(sheetName)){
|
||||||
|
sheet.setLanguage(CustomStringUtils.valueOf(i.get("Lang")).substring(2,4));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sheet.setLanguage(CustomStringUtils.valueOf(i.get("Lang")));
|
||||||
|
}
|
||||||
|
sheet.setGoogleSheetName(sheetName);
|
||||||
|
if("Urgent".equals(sheetName)){
|
||||||
|
sheet.setIsUrgent("01");
|
||||||
|
} else if("TN".equals(sheetName)) {
|
||||||
|
sheet.setIsUrgent("02");
|
||||||
|
} else if("YL".equals(sheetName)){
|
||||||
|
sheet.setIsUrgent("04");
|
||||||
|
} else {
|
||||||
|
sheet.setIsUrgent("03");
|
||||||
|
}
|
||||||
|
sheet.setGoogleApiId(spreadId);
|
||||||
|
sheet.setGoogleRow(rowNo);
|
||||||
|
sheet.setVersion(runVersion);
|
||||||
|
sheet.setCreatedBy(hostName);
|
||||||
|
|
||||||
|
insertList.add(sheet);
|
||||||
|
rowNo++;
|
||||||
|
|
||||||
|
if (insertList.size() >= 1000) {
|
||||||
|
insertTaskList(insertList);
|
||||||
|
insertList.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
insertTaskList(insertList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
private void insertTaskList(List<GSheetData> insertList) {
|
||||||
|
if (insertList.size() > 0) {
|
||||||
|
GSheetMapper.insertTaskListHistory(insertList);
|
||||||
|
for(GSheetData data : insertList){
|
||||||
|
materialMapper.insertMaterial(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public String getGoogleSheetSpreadId(String dataType) {
|
||||||
|
return GSheetMapper.getGoogleSheetSpreadId(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertFileData(String range, String spreadId, String runVersion) throws GeneralSecurityException, IOException, URISyntaxException {
|
||||||
|
String hostName = InetAddress.getLocalHost().getHostName();
|
||||||
|
List<LinkedHashMap<String, Object>> result = googleSheetsUtil.getFileData(spreadId, range);
|
||||||
|
List<GSheetFileData> targetLst = new ArrayList<>();
|
||||||
|
int rowNo = 3;
|
||||||
|
for (LinkedHashMap<String, Object> i : result) {
|
||||||
|
GSheetFileData sheet = new GSheetFileData();
|
||||||
|
sheet.setVersion(runVersion);
|
||||||
|
sheet.setLanguage(CustomStringUtils.valueOf(i.get("언어")));
|
||||||
|
sheet.setTms(CustomStringUtils.valueOf(i.get("TMS")));
|
||||||
|
sheet.setContent(CustomStringUtils.valueOf(i.get("작품명")));
|
||||||
|
sheet.setIsCensored(CustomStringUtils.valueOf(i.get("우선 순위")));
|
||||||
|
sheet.setFileSpec(CustomStringUtils.valueOf(i.get("파일규격")));
|
||||||
|
sheet.setUseUsPsd(CustomStringUtils.valueOf(i.get("US PSD 작업")));
|
||||||
|
sheet.setIs_set(CustomStringUtils.valueOf(i.get("식자 세팅")));
|
||||||
|
sheet.setIs_logo(CustomStringUtils.valueOf(i.get("로고 전달")));
|
||||||
|
sheet.setDm_name(CustomStringUtils.valueOf(i.get("담당 DM")));
|
||||||
|
sheet.setPsd_url_kr(CustomStringUtils.valueOf(i.get("국문 PSD")));
|
||||||
|
sheet.setPsd_url_en(CustomStringUtils.valueOf(i.get("영문 PSD")));
|
||||||
|
sheet.setNote(CustomStringUtils.valueOf(i.get("특이사항 (식자가 전달)")));
|
||||||
|
sheet.setTr_url(CustomStringUtils.valueOf(i.get("번역문 링크")));
|
||||||
|
sheet.setMemo(CustomStringUtils.valueOf(i.get("비고 (레진 내부 정보 공유)")));
|
||||||
|
rowNo++;
|
||||||
|
targetLst.add(sheet);
|
||||||
|
if (targetLst.size() >= 1000) {
|
||||||
|
GSheetMapper.insertFileListHistory(targetLst);
|
||||||
|
targetLst.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (targetLst.size() > 0) {
|
||||||
|
GSheetMapper.insertFileListHistory(targetLst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
237
src/main/java/com/veve_plus/root/service/TmsService.java
Normal file
237
src/main/java/com/veve_plus/root/service/TmsService.java
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.veve_plus.root.dto.tms.ProjectDto;
|
||||||
|
import com.veve_plus.root.dto.tms.ProjectLocaleDto;
|
||||||
|
import com.veve_plus.root.dto.tms.TmsReqDto;
|
||||||
|
import com.veve_plus.root.dto.tms.TranslationDto;
|
||||||
|
import com.veve_plus.root.mapper.ContentMapper;
|
||||||
|
import com.veve_plus.root.mapper.MaterialMapper;
|
||||||
|
import com.veve_plus.root.mapper.TmsMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TmsService {
|
||||||
|
private final TmsMapper tmsMapper;
|
||||||
|
private final ContentMapper contentMapper;
|
||||||
|
private final MaterialMapper materialMapper;
|
||||||
|
|
||||||
|
private String TMS_URL = "https://tms.kiledel.com";
|
||||||
|
private String TOONING_URL = " https://ailosy.com/";
|
||||||
|
|
||||||
|
public List<TranslationDto> getTranslation(String language, String tmsId, String chapter, String platform) {
|
||||||
|
return tmsMapper.getTranslationList(tmsId,language,chapter,platform);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getTmsData(TmsReqDto dto) throws JsonProcessingException {
|
||||||
|
|
||||||
|
//check platform
|
||||||
|
String category = materialMapper.findMaterialCategory(dto.getTmsId(), dto.getLanguageCode(), dto.getChapter());
|
||||||
|
String url = "";
|
||||||
|
if("02".equals(category)){
|
||||||
|
url = TOONING_URL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
url = TMS_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1.CALL API LOGIN TO GET TOKEN
|
||||||
|
String loginToken = getLoginToken(url);
|
||||||
|
|
||||||
|
// 2. USE TOKEN TO SEND GET REQUEST
|
||||||
|
String getUrl = url + "/api/translate/" + dto.getTmsId() + "/" + dto.getChapter();
|
||||||
|
RestTemplate template2 = new RestTemplate();
|
||||||
|
|
||||||
|
HttpHeaders header2 = new HttpHeaders();
|
||||||
|
header2.set("authToken", loginToken);
|
||||||
|
header2.set("Cookie", "authToken=" + loginToken);
|
||||||
|
|
||||||
|
// Create the HttpEntity
|
||||||
|
HttpEntity<String> entity2 = new HttpEntity<>(header2);
|
||||||
|
|
||||||
|
// Make the GET request and get the response
|
||||||
|
ResponseEntity<String> data = template2.exchange(getUrl, HttpMethod.GET, entity2, String.class);
|
||||||
|
|
||||||
|
//3. INSERT TRANSLATION TO VEVE
|
||||||
|
JSONObject languageObject = new JSONObject(data.getBody())
|
||||||
|
.getJSONObject("payload")
|
||||||
|
.getJSONObject(dto.getLanguageCode());
|
||||||
|
|
||||||
|
JSONObject translationObject;
|
||||||
|
boolean isTranslation = true;
|
||||||
|
try {
|
||||||
|
isTranslation = languageObject.has(dto.getTranslationType());
|
||||||
|
}catch (Exception e){
|
||||||
|
isTranslation = false;
|
||||||
|
}
|
||||||
|
if(isTranslation){
|
||||||
|
translationObject = languageObject
|
||||||
|
.getJSONObject(dto.getTranslationType());
|
||||||
|
|
||||||
|
}else{
|
||||||
|
translationObject = languageObject
|
||||||
|
.getJSONObject("5");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//if there is chapter but no translate data then return false
|
||||||
|
if(translationObject.keySet().isEmpty()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//loop through all sequence number
|
||||||
|
for(String key : translationObject.keySet()){
|
||||||
|
var translation = TranslationDto.builder()
|
||||||
|
.tmsId(dto.getTmsId())
|
||||||
|
.chapter(dto.getChapter())
|
||||||
|
.languageCode(dto.getLanguageCode())
|
||||||
|
.seqNo(key)
|
||||||
|
.positionX(translationObject.getJSONObject(key).getJSONObject("position").getNumber("x").toString())
|
||||||
|
.positionY(translationObject.getJSONObject(key).getJSONObject("position").getNumber("y").toString())
|
||||||
|
.width(translationObject.getJSONObject(key).getJSONObject("size").getNumber("width").toString())
|
||||||
|
.height(translationObject.getJSONObject(key).getJSONObject("size").getNumber("height").toString())
|
||||||
|
.colorCode(translationObject.getJSONObject(key).getString("color"))
|
||||||
|
.textContent(translationObject.getJSONObject(key).getString("content")
|
||||||
|
.replaceAll("</p><p>", "\r") //replace with linebreak
|
||||||
|
.replaceAll("<[^>]+>", "") //replace all tags
|
||||||
|
.replaceAll(" ", " ") //replace special char with space
|
||||||
|
.replaceAll("<", "<")
|
||||||
|
.replaceAll(">", ">")
|
||||||
|
.replaceAll("&", "&")
|
||||||
|
.replaceAll(""", "\"")
|
||||||
|
.replaceAll("'", "'")
|
||||||
|
)
|
||||||
|
.createdBy("SYSTEM")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
tmsMapper.insertTranslation(translation);
|
||||||
|
materialMapper.updateTransType(dto.getTranslationType(), dto.getLanguageCode(), dto.getTmsId(), dto.getChapter());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<Object> insertProjects(String category) throws JsonProcessingException {
|
||||||
|
//check platform
|
||||||
|
String url = "";
|
||||||
|
if("02".equals(category)){
|
||||||
|
url = TOONING_URL;
|
||||||
|
} else {
|
||||||
|
url = TMS_URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1.CALL API LOGIN TO GET TOKEN
|
||||||
|
String loginToken = getLoginToken(category);
|
||||||
|
|
||||||
|
// 2. USE TOKEN TO SEND GET REQUEST
|
||||||
|
String getUrl = url + "/api/projects";
|
||||||
|
RestTemplate template2 = new RestTemplate();
|
||||||
|
|
||||||
|
HttpHeaders header2 = new HttpHeaders();
|
||||||
|
header2.set("authToken", loginToken);
|
||||||
|
header2.set("Cookie", "authToken=" + loginToken);
|
||||||
|
|
||||||
|
// Create the HttpEntity
|
||||||
|
HttpEntity<String> entity2 = new HttpEntity<>(header2);
|
||||||
|
|
||||||
|
// Make the GET request and get the response
|
||||||
|
ResponseEntity<String> data = template2.exchange(getUrl, HttpMethod.GET, entity2, String.class);
|
||||||
|
|
||||||
|
//3. INSERT TRANSLATION TO DB
|
||||||
|
JSONObject translationObject = new JSONObject(data.getBody())
|
||||||
|
.getJSONObject("payload");
|
||||||
|
|
||||||
|
List<String> locale = translationObject.keySet().stream().toList();
|
||||||
|
for(String l : locale){
|
||||||
|
//insert data to table tms_project
|
||||||
|
JSONArray projects = translationObject.getJSONArray(l);
|
||||||
|
for(Object p : projects){
|
||||||
|
JSONObject obj = new JSONObject(p.toString());
|
||||||
|
var dto = ProjectDto.builder()
|
||||||
|
.projectId(obj.getNumber("projectId").toString())
|
||||||
|
.title(obj.getString("title"))
|
||||||
|
.version(obj.getNumber("version").toString())
|
||||||
|
.locale(obj.getJSONArray("hasLocale").toString())
|
||||||
|
.delFlg(obj.getBoolean("deleted")?1:0)
|
||||||
|
.archivedFlg(obj.getBoolean("archived")?1:0)
|
||||||
|
.bookmarkFlg(obj.getBoolean("bookmarked")?1:0)
|
||||||
|
.createdBy("SYSTEM")
|
||||||
|
.updatedBy("SYSTEM")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
tmsMapper.insertProject(dto);
|
||||||
|
|
||||||
|
//insert data to table tms_project_locale
|
||||||
|
var localeDto = ProjectLocaleDto.builder()
|
||||||
|
.projectId(obj.getNumber("projectId").toString())
|
||||||
|
.locale(l)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
tmsMapper.insertProjectLocale(localeDto);
|
||||||
|
contentMapper.mapContent(dto.getProjectId(), dto.getTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.ok(data.getBody());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String extractAuthToken(String input){
|
||||||
|
String prefix = "authToken=";
|
||||||
|
int startIndex = input.indexOf(prefix);
|
||||||
|
startIndex += prefix.length();
|
||||||
|
int endIndex = input.indexOf(";",startIndex);
|
||||||
|
|
||||||
|
return input.substring(startIndex, endIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLoginToken(String category) throws JsonProcessingException {
|
||||||
|
String url = "";
|
||||||
|
String authToken = "";
|
||||||
|
String domain = "";
|
||||||
|
String body = "";
|
||||||
|
|
||||||
|
if("02".equals(category)){
|
||||||
|
domain = TOONING_URL;
|
||||||
|
body = "{\"email\": \"hanhn@dnkinno.com\", \"password\": \"e10adc3949ba59abbe56e057f20f883e\"}";
|
||||||
|
} else {
|
||||||
|
domain = TMS_URL;
|
||||||
|
body = "{\"email\": \"loctran@dnkinno.com\", \"password\": \"0ea63c6f95b339b5b25768c408a2a3d1\"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
url = domain + "/api/auth/tooning";
|
||||||
|
|
||||||
|
// Set headers
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
|
||||||
|
// Create the HttpEntity
|
||||||
|
HttpEntity<String> entity = new HttpEntity<>(body, headers);
|
||||||
|
|
||||||
|
// Make the POST request
|
||||||
|
RestTemplate template = new RestTemplate();
|
||||||
|
ResponseEntity<String> response = template.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
|
||||||
|
//extract auth token
|
||||||
|
JSONObject jsonResponse = new JSONObject(response);
|
||||||
|
JSONObject jsonBody = new JSONObject(jsonResponse.getString("body"));
|
||||||
|
if(jsonBody.getBoolean("r")){
|
||||||
|
String cookie = jsonResponse.getJSONObject("headers").getJSONArray("set-cookie").get(0).toString();
|
||||||
|
authToken = extractAuthToken(cookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
return authToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProjectDto> findProjectByTitle(String title){
|
||||||
|
return tmsMapper.findProjectByTitle(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
91
src/main/java/com/veve_plus/root/service/UserService.java
Normal file
91
src/main/java/com/veve_plus/root/service/UserService.java
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
package com.veve_plus.root.service;
|
||||||
|
|
||||||
|
import com.veve_plus.root.dto.auth.AuthResponseDto;
|
||||||
|
import com.veve_plus.root.dto.auth.LoginDto;
|
||||||
|
import com.veve_plus.root.dto.auth.UserPrincipal;
|
||||||
|
import com.veve_plus.root.dto.menu.Menu;
|
||||||
|
import com.veve_plus.root.dto.user.UserRequest;
|
||||||
|
import com.veve_plus.root.dto.user.UserResponse;
|
||||||
|
import com.veve_plus.root.dto.user.UserRole;
|
||||||
|
import com.veve_plus.root.dto.user.UserSearchRequest;
|
||||||
|
import com.veve_plus.root.mapper.MenuMapper;
|
||||||
|
import com.veve_plus.root.mapper.UserMapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UserService {
|
||||||
|
private final AuthenticationManager authenticationManager;
|
||||||
|
private final JwtService jwtService;
|
||||||
|
private final RoleService roleService;
|
||||||
|
private final MenuMapper menuMapper;
|
||||||
|
private final UserMapper userMapper;
|
||||||
|
|
||||||
|
public Object verify(LoginDto user) {
|
||||||
|
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(user.getEmail(), user.getPassword()));
|
||||||
|
|
||||||
|
if(authentication.isAuthenticated()){
|
||||||
|
AuthResponseDto rs = new AuthResponseDto();
|
||||||
|
List<String> roles = roleService.findRolesByEmail(user.getEmail());
|
||||||
|
List<String> menuAuthority = menuMapper.getMenusByEmail(user.getEmail());
|
||||||
|
|
||||||
|
rs.setRole(roles);
|
||||||
|
rs.setToken(jwtService.generateToken(user.getEmail()));
|
||||||
|
rs.setUsername(userMapper.findUserInfoByEmail(user.getEmail()).getUsername());
|
||||||
|
rs.setMenuAccess(menuAuthority);
|
||||||
|
rs.setEmail(user.getEmail());
|
||||||
|
return rs;
|
||||||
|
} else {
|
||||||
|
return "FAIL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentAuditor() {
|
||||||
|
var authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
if(authentication != null){
|
||||||
|
var principal = authentication.getPrincipal();
|
||||||
|
|
||||||
|
var user = (UserPrincipal)principal;
|
||||||
|
return userMapper.findUserInfoByEmail(user.getUsername()).getUserId();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UserResponse> getAllUsersByCondition(UserSearchRequest userSearchRequest){
|
||||||
|
return userMapper.findAllUsersByCondition(userSearchRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addUser(UserRequest userRequest) {
|
||||||
|
var user = userRequest.toUser();
|
||||||
|
userMapper.insert(user);
|
||||||
|
for (Long roleId : userRequest.getRoleIds()){
|
||||||
|
this.userMapper.insertRole(UserRole.builder()
|
||||||
|
.userId(user.getUserId())
|
||||||
|
.roleId(roleId)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void editUser(UserRequest userRequest) {
|
||||||
|
var user = userRequest.toUser();
|
||||||
|
this.userMapper.update(user);
|
||||||
|
this.userMapper.deleteRolesByUserId(user.getUserId());
|
||||||
|
for (Long roleId : userRequest.getRoleIds()){
|
||||||
|
this.userMapper.insertRole(UserRole.builder()
|
||||||
|
.userId(user.getUserId())
|
||||||
|
.roleId(roleId)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserResponse getInfoUser(String userId) {
|
||||||
|
return userMapper.getInfoUserById(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.veve_plus.root.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class CustomStringUtils {
|
||||||
|
|
||||||
|
public static final String[] ARR_DATE_SPECIAL_CHAR = {"\\.", "/", ""};
|
||||||
|
|
||||||
|
public static String removeSpecialChar(Object o) {
|
||||||
|
if (Objects.isNull(o)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (o instanceof String) {
|
||||||
|
return String.valueOf(o).replaceAll("[^0-9a-zA-Z]", "");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertSheetStringDate(Object o) {
|
||||||
|
if (Objects.isNull(o)) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
String result = "";
|
||||||
|
if (o instanceof String) {
|
||||||
|
String input = o.toString().replaceAll("\\s", "");
|
||||||
|
if (input.isEmpty()) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
String[] partsDt = {};
|
||||||
|
while (i < ARR_DATE_SPECIAL_CHAR.length && partsDt.length != 3) {
|
||||||
|
partsDt = input.split(ARR_DATE_SPECIAL_CHAR[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (partsDt.length == 3) {
|
||||||
|
for (String part : partsDt) {
|
||||||
|
if (part.length() < 2) {
|
||||||
|
part = "0" + part;
|
||||||
|
}
|
||||||
|
if (part.length() == 4) {
|
||||||
|
result = part + result;
|
||||||
|
} else {
|
||||||
|
result += part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String validBoolean(Object o) {
|
||||||
|
if (Objects.isNull(o)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (o instanceof String) {
|
||||||
|
return String.valueOf(o).equalsIgnoreCase("TRUE")
|
||||||
|
|| String.valueOf(o).equalsIgnoreCase("FALSE") ? String.valueOf(o) : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String valueOf(Object obj) {
|
||||||
|
return (obj == null) ? null : obj.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isObjectNullOrEmpty(Object obj) {
|
||||||
|
return obj == null || (obj instanceof String && ((String) obj).isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer intValueOf(Object obj) {
|
||||||
|
String value = (obj == null) ? null : obj.toString();
|
||||||
|
if (!value.isEmpty()){
|
||||||
|
try {
|
||||||
|
return Integer.valueOf(value);
|
||||||
|
}catch (NumberFormatException e){}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/java/com/veve_plus/root/utils/DateTimeUtils.java
Normal file
15
src/main/java/com/veve_plus/root/utils/DateTimeUtils.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.veve_plus.root.utils;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
public class DateTimeUtils {
|
||||||
|
|
||||||
|
public static final String DATETIME_FORMAT_HOUR = "yyyyMMddHHmm";
|
||||||
|
public static String getVersionFormatDate(){
|
||||||
|
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DATETIME_FORMAT_HOUR);
|
||||||
|
ZonedDateTime dateTime = ZonedDateTime.now(ZoneId.of("Asia/Ho_Chi_Minh"));
|
||||||
|
return dtf.format(dateTime) + "0000";
|
||||||
|
}
|
||||||
|
}
|
||||||
198
src/main/java/com/veve_plus/root/utils/GSheetsUtils.java
Normal file
198
src/main/java/com/veve_plus/root/utils/GSheetsUtils.java
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
package com.veve_plus.root.utils;
|
||||||
|
|
||||||
|
import com.google.api.client.auth.oauth2.Credential;
|
||||||
|
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
|
||||||
|
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
|
||||||
|
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
|
||||||
|
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
|
||||||
|
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
|
||||||
|
import com.google.api.client.http.javanet.NetHttpTransport;
|
||||||
|
import com.google.api.client.json.JsonFactory;
|
||||||
|
import com.google.api.client.json.gson.GsonFactory;
|
||||||
|
import com.google.api.client.util.store.FileDataStoreFactory;
|
||||||
|
import com.google.api.services.sheets.v4.Sheets;
|
||||||
|
import com.google.api.services.sheets.v4.SheetsScopes;
|
||||||
|
import com.google.api.services.sheets.v4.model.ValueRange;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.GeneralSecurityException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GSheetsUtils {
|
||||||
|
|
||||||
|
private static final String APPLICATION_NAME = "GE Plus";
|
||||||
|
private static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance();
|
||||||
|
private static final String CREDENTIALS_FILE_PATH = "/googleCredentials.json";
|
||||||
|
private static final String TOKENS_DIRECTORY_PATH = "tokens";
|
||||||
|
private static final List<String> SCOPES
|
||||||
|
= Collections.singletonList(SheetsScopes.SPREADSHEETS);
|
||||||
|
|
||||||
|
public List<LinkedHashMap<String, Object>> getKSTData(String sheetId, String dataRange) throws IOException, GeneralSecurityException, URISyntaxException {
|
||||||
|
List<List<Object>> values = getValueRange(sheetId, dataRange).getValues();
|
||||||
|
List<LinkedHashMap<String, Object>> resultData = new ArrayList<>();
|
||||||
|
if (values == null || values.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
for (List<Object> row : values) {
|
||||||
|
int colIndex = 0;
|
||||||
|
if (row.size() < 3 || ("".equals(row.get(4)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
while (row.size() < 26) {
|
||||||
|
row.add("");
|
||||||
|
}
|
||||||
|
LinkedHashMap<String, Object> i = new LinkedHashMap<>();
|
||||||
|
//columns B
|
||||||
|
i.put("TMS", row.get(++colIndex));
|
||||||
|
//columns B
|
||||||
|
//TODO confirm geid
|
||||||
|
i.put("GeId", null);
|
||||||
|
//columns E
|
||||||
|
i.put("Lang", row.get(colIndex+=3));
|
||||||
|
//columns F
|
||||||
|
i.put("Title", row.get(++colIndex));
|
||||||
|
//columns G
|
||||||
|
i.put("Chap", row.get(++colIndex));
|
||||||
|
//columns I
|
||||||
|
i.put("Translation delivery date", row.get(colIndex+=2));
|
||||||
|
//columns J
|
||||||
|
i.put("TR", row.get(++colIndex));
|
||||||
|
//columns K
|
||||||
|
i.put("Translation Review", row.get(++colIndex));
|
||||||
|
//columns O
|
||||||
|
i.put("Delivery date", row.get(colIndex+=4));
|
||||||
|
//columns P
|
||||||
|
i.put("Affected month", row.get(++colIndex));
|
||||||
|
//column Q
|
||||||
|
i.put("DL", null);
|
||||||
|
//columns R
|
||||||
|
i.put("Necessity of modification (TMS)", row.get(colIndex+=2));
|
||||||
|
//columns S
|
||||||
|
i.put("PSD upload deadline", row.get(++colIndex));
|
||||||
|
//columns U
|
||||||
|
i.put("Date of issue", row.get(colIndex+=2));
|
||||||
|
//columns W
|
||||||
|
i.put("Reason for schedule change", row.get(colIndex+=2));
|
||||||
|
//columns O
|
||||||
|
//TODO
|
||||||
|
i.put("Done", null);
|
||||||
|
//columns X
|
||||||
|
i.put("Reason", row.get(++colIndex));
|
||||||
|
//columns T
|
||||||
|
//TODO
|
||||||
|
i.put("Combine check note", null);
|
||||||
|
//columns U
|
||||||
|
//TODO
|
||||||
|
i.put("TR ready", null);
|
||||||
|
//columns P
|
||||||
|
resultData.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get value from Google Sheet by range
|
||||||
|
*/
|
||||||
|
public ValueRange getValueRange(String spreadId, String range) throws GeneralSecurityException, IOException, URISyntaxException {
|
||||||
|
final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
|
||||||
|
Sheets service = new Sheets.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
|
||||||
|
.setApplicationName(APPLICATION_NAME)
|
||||||
|
.build();
|
||||||
|
return service.spreadsheets().values()
|
||||||
|
.get(spreadId, range)
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an authorized Credential object.
|
||||||
|
*
|
||||||
|
* @param HTTP_TRANSPORT The network HTTP Transport.
|
||||||
|
* @return An authorized Credential object.
|
||||||
|
* @throws IOException If the googleCredentials.json file cannot be found.
|
||||||
|
*/
|
||||||
|
private Credential getCredentials(final NetHttpTransport HTTP_TRANSPORT)
|
||||||
|
throws IOException, URISyntaxException {
|
||||||
|
// Load client secrets.
|
||||||
|
InputStream in = GSheetsUtils.class.getResourceAsStream(CREDENTIALS_FILE_PATH);
|
||||||
|
if (in == null) {
|
||||||
|
throw new FileNotFoundException("Resource not found: " + CREDENTIALS_FILE_PATH);
|
||||||
|
}
|
||||||
|
GoogleClientSecrets clientSecrets =
|
||||||
|
GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
|
||||||
|
|
||||||
|
URL url = this.getClass().getClassLoader().getResource(TOKENS_DIRECTORY_PATH);
|
||||||
|
// Build flow and trigger user authorization request.
|
||||||
|
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
|
||||||
|
HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
|
||||||
|
.setDataStoreFactory(new FileDataStoreFactory(new java.io.File(url.toURI())))
|
||||||
|
.setAccessType("offline")
|
||||||
|
.build();
|
||||||
|
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build();
|
||||||
|
return new AuthorizationCodeInstalledApp(flow, receiver).authorize("user");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch data to map
|
||||||
|
*/
|
||||||
|
public List<LinkedHashMap<String, Object>> getFileData(String sheetId, String dataRange) throws IOException, GeneralSecurityException, URISyntaxException {
|
||||||
|
List<List<Object>> values = getValueRange(sheetId, dataRange).getValues();
|
||||||
|
List<LinkedHashMap<String, Object>> resultData = new ArrayList<>();
|
||||||
|
if (values == null || values.isEmpty()) {
|
||||||
|
throw new IOException("Data not found");
|
||||||
|
} else {
|
||||||
|
for (List<Object> row : values) {
|
||||||
|
int colIndex = 0;
|
||||||
|
if (row.size() < 3 || ("".equals(row.get(1)) && "".equals(row.get(2)) && "".equals(row.get(3)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
while (row.size() < 30) {
|
||||||
|
row.add("");
|
||||||
|
}
|
||||||
|
LinkedHashMap<String, Object> i = new LinkedHashMap<>();
|
||||||
|
//A
|
||||||
|
i.put("언어", row.get(colIndex));
|
||||||
|
//B
|
||||||
|
i.put("TMS", row.get(++colIndex));
|
||||||
|
//C
|
||||||
|
i.put("작품명", row.get(++colIndex));
|
||||||
|
//D
|
||||||
|
i.put("언센 서링", row.get(++colIndex));
|
||||||
|
//E
|
||||||
|
i.put("파일규격", row.get(++colIndex));
|
||||||
|
//F
|
||||||
|
i.put("US PSD 작업", row.get(++colIndex));
|
||||||
|
//O
|
||||||
|
i.put("식자 세팅", row.get(colIndex+=10));
|
||||||
|
//P
|
||||||
|
i.put("로고 전달", row.get(++colIndex));
|
||||||
|
//R
|
||||||
|
i.put("담당 DM", row.get(colIndex+=2));
|
||||||
|
//X
|
||||||
|
i.put("국문 PSD", row.get(colIndex+=5));
|
||||||
|
//Y
|
||||||
|
i.put("영문 PSD", row.get(++colIndex));
|
||||||
|
//Z
|
||||||
|
i.put("특이사항 (식자가 전달)", row.get(++colIndex));
|
||||||
|
//AA
|
||||||
|
i.put("비고 (레진 내부 정보 공유)", row.get(++colIndex));
|
||||||
|
//AB
|
||||||
|
i.put("번역문 링크", row.get(++colIndex));
|
||||||
|
resultData.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/main/resources/application.properties
Normal file
50
src/main/resources/application.properties
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
spring.application.name=admin
|
||||||
|
|
||||||
|
#Server port
|
||||||
|
server.port = 8080
|
||||||
|
|
||||||
|
# JDBC properties
|
||||||
|
spring.datasource.url=jdbc:mysql://61.28.226.9:3306/gone
|
||||||
|
spring.datasource.username=geuser1
|
||||||
|
spring.datasource.password=Dki@2023
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
#spring.security.user.name=admin
|
||||||
|
#spring.security.user.password=password
|
||||||
|
# Logging
|
||||||
|
logging.level.org.springframework.security=TRACE
|
||||||
|
logging.level.org.springframework.web=TRACE
|
||||||
|
logging.level.org.hibernate.SQL=TRACE
|
||||||
|
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||||
|
|
||||||
|
# MyBatis configuration
|
||||||
|
mybatis.mapper-locations=classpath:mapper/*.xml
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
mybatis.configuration.default-fetch-size=100
|
||||||
|
mybatis.configuration.default-statement-timeout=30
|
||||||
|
# MyBatis Configuration
|
||||||
|
mybatis.configuration.cache-enabled=true
|
||||||
|
mybatis.configuration.lazy-loading-enabled=true
|
||||||
|
mybatis.configuration.aggressive-lazy-loading=true
|
||||||
|
mybatis.configuration.multiple-result-sets-enabled=true
|
||||||
|
mybatis.configuration.use-column-label=true
|
||||||
|
mybatis.configuration.use-generated-keys=false
|
||||||
|
mybatis.configuration.auto-mapping-behavior=PARTIAL
|
||||||
|
mybatis.configuration.auto-mapping-unknown-column-behavior=NONE
|
||||||
|
mybatis.configuration.default-executor-type=SIMPLE
|
||||||
|
mybatis.configuration.safe-row-bounds-enabled=false
|
||||||
|
mybatis.configuration.safe-result-handler-enabled=true
|
||||||
|
mybatis.configuration.local-cache-scope=SESSION
|
||||||
|
mybatis.configuration.jdbc-type-for-null=OTHER
|
||||||
|
mybatis.configuration.lazy-load-trigger-methods=equals,clone,hashCode,toString
|
||||||
|
mybatis.configuration.default-enum-type-handler=org.apache.ibatis.type.EnumTypeHandler
|
||||||
|
mybatis.configuration.call-setters-on-nulls=false
|
||||||
|
mybatis.configuration.return-instance-for-empty-row=false
|
||||||
|
mybatis.configuration.log-prefix=exampleLogPreFix_
|
||||||
|
|
||||||
|
spring.servlet.multipart.max-file-size=20MB
|
||||||
|
spring.servlet.multipart.max-request-size=20MB
|
||||||
|
|
||||||
|
#Schedule config
|
||||||
|
scheduler.enabled=true
|
||||||
|
|
||||||
13
src/main/resources/googleCredentials.json
Normal file
13
src/main/resources/googleCredentials.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"web": {
|
||||||
|
"client_id": "1005980214427-7u7ui56hoc592epchsu2bvrtcjmntah1.apps.googleusercontent.com",
|
||||||
|
"project_id": "wide-brook-398209",
|
||||||
|
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
||||||
|
"token_uri": "https://oauth2.googleapis.com/token",
|
||||||
|
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
||||||
|
"client_secret": "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",
|
||||||
|
"redirect_uris": [
|
||||||
|
"http://localhost:8888/Callback"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
18
src/main/resources/mapper/CodeMapper.xml
Normal file
18
src/main/resources/mapper/CodeMapper.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.CodeMapper">
|
||||||
|
|
||||||
|
<select id="findCodesByGroupId" resultType="com.veve_plus.root.dto.code.CodeDto">
|
||||||
|
SELECT
|
||||||
|
IFNULL(idx ,'') as idx
|
||||||
|
, IFNULL(group_id ,'') as groupId
|
||||||
|
, IFNULL(code_id ,'') as codeId
|
||||||
|
, IFNULL(code_name ,'') as codeName
|
||||||
|
, IFNULL(`language` ,'') as lang
|
||||||
|
FROM tb_code
|
||||||
|
WHERE group_id = #{groupId}
|
||||||
|
AND `language` = #{lang}
|
||||||
|
AND status = 1
|
||||||
|
ORDER BY sort ASC
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
51
src/main/resources/mapper/ContentMapper.xml
Normal file
51
src/main/resources/mapper/ContentMapper.xml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.ContentMapper">
|
||||||
|
<update id="mapContent">
|
||||||
|
UPDATE tb_content
|
||||||
|
SET tms_id = #{tmsId}
|
||||||
|
WHERE content = #{content}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="unMapContent">
|
||||||
|
UPDATE tb_content
|
||||||
|
SET tms_id = NULL
|
||||||
|
WHERE content = #{content}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertContent" parameterType="com.veve_plus.root.entity.Content">
|
||||||
|
INSERT INTO tb_content (
|
||||||
|
content,
|
||||||
|
del_yn,
|
||||||
|
tms_id,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
#{content},
|
||||||
|
#{locale},
|
||||||
|
#{tmsId},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
#{createdTime},
|
||||||
|
#{updatedTime}
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT *
|
||||||
|
FROM tb_content
|
||||||
|
WHERE content = #{content}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="listContent" resultType="com.veve_plus.root.dto.content.ContentDto">
|
||||||
|
SELECT tc.idx
|
||||||
|
, tc.content
|
||||||
|
, tc.tms_id AS tmsId
|
||||||
|
, ttp.title AS tmsTitle
|
||||||
|
FROM tb_content tc
|
||||||
|
LEFT JOIN tb_tms_project ttp
|
||||||
|
ON tc.tms_id = ttp.project_id
|
||||||
|
ORDER BY ttp.title, tc.content
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
131
src/main/resources/mapper/GSheetMapper.xml
Normal file
131
src/main/resources/mapper/GSheetMapper.xml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.GSheetMapper">
|
||||||
|
|
||||||
|
<insert id="insertTaskListHistory" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="idx" >
|
||||||
|
INSERT INTO tb_kst_task_history (
|
||||||
|
`version`
|
||||||
|
,`title_ge_id`
|
||||||
|
,disk_type
|
||||||
|
,platform_code
|
||||||
|
,title
|
||||||
|
,chapter
|
||||||
|
,open_date
|
||||||
|
,trans_delivery_date
|
||||||
|
,trans_review_date
|
||||||
|
,is_trans_review
|
||||||
|
,affected_delivery_date
|
||||||
|
,affected_date
|
||||||
|
,dki_delivery_date
|
||||||
|
,is_modify
|
||||||
|
,psd_upload_dealine
|
||||||
|
,final_subset_upload
|
||||||
|
,tms_psd_upload
|
||||||
|
,qc_user_id
|
||||||
|
,issued_date
|
||||||
|
,writer
|
||||||
|
,schedule_change_reason
|
||||||
|
,is_confirmed
|
||||||
|
,note
|
||||||
|
,content_key
|
||||||
|
,google_api_id
|
||||||
|
,google_row
|
||||||
|
,google_sheet_name
|
||||||
|
,is_urgent
|
||||||
|
,created_date
|
||||||
|
,created_by
|
||||||
|
,updated_date
|
||||||
|
,updated_by
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="element" index="index" open="(" separator="),(" close=")">
|
||||||
|
#{element.version}
|
||||||
|
,#{element.geId}
|
||||||
|
,#{element.diskType}
|
||||||
|
,#{element.platformCode}
|
||||||
|
,#{element.title}
|
||||||
|
,#{element.chapter}
|
||||||
|
,#{element.openDate}
|
||||||
|
,#{element.transDeliveryDate}
|
||||||
|
,#{element.transReviewDate}
|
||||||
|
,#{element.isTransReview}
|
||||||
|
,#{element.affectedDeliveryDate}
|
||||||
|
,#{element.affectedMonth}
|
||||||
|
,#{element.dkiDeliveryDate}
|
||||||
|
,#{element.isModify}
|
||||||
|
,#{element.psdUploadDealine}
|
||||||
|
,#{element.finalSubsetUpload}
|
||||||
|
,#{element.tmsPsdUpload}
|
||||||
|
,#{element.qcUserId}
|
||||||
|
,#{element.issuedDate}
|
||||||
|
,#{element.writer}
|
||||||
|
,#{element.scheduleChangeReason}
|
||||||
|
,#{element.isConfirmed}
|
||||||
|
,#{element.note}
|
||||||
|
,#{element.contentKey}
|
||||||
|
,#{element.googleApiId}
|
||||||
|
,#{element.googleRow}
|
||||||
|
,#{element.language}
|
||||||
|
,#{element.isUrgent}
|
||||||
|
,SYSDATE()
|
||||||
|
,#{element.createdBy}
|
||||||
|
,SYSDATE()
|
||||||
|
,'BATCH'
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getGoogleSheetSpreadId" resultType="java.lang.String">
|
||||||
|
SELECT spread_id
|
||||||
|
FROM tb_google_sheet
|
||||||
|
WHERE apply_day <= DATE_FORMAT(sysdate(), '%Y%m%d')
|
||||||
|
AND data_type = #{dataType}
|
||||||
|
ORDER BY apply_day DESC, idx DESC
|
||||||
|
LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertFileListHistory" parameterType="com.veve_plus.root.entity.GSheetFileData" useGeneratedKeys="true" keyProperty="idx" >
|
||||||
|
INSERT INTO tb_kidari_file_history (
|
||||||
|
version
|
||||||
|
,language
|
||||||
|
,tms
|
||||||
|
,content
|
||||||
|
,is_censored
|
||||||
|
,file_spec
|
||||||
|
,use_us_psd
|
||||||
|
,is_set
|
||||||
|
,is_logo
|
||||||
|
,dm_name
|
||||||
|
,psd_url_kr
|
||||||
|
,psd_url_en
|
||||||
|
,tr_url
|
||||||
|
,note
|
||||||
|
,memo
|
||||||
|
,created_by
|
||||||
|
,updated_by
|
||||||
|
,created_time
|
||||||
|
,updated_time
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="element" index="index" open="(" separator="),(" close=")">
|
||||||
|
#{element.version}
|
||||||
|
,#{element.language}
|
||||||
|
,#{element.tms}
|
||||||
|
,#{element.content}
|
||||||
|
,#{element.isCensored}
|
||||||
|
,#{element.fileSpec}
|
||||||
|
,#{element.useUsPsd}
|
||||||
|
,#{element.is_set}
|
||||||
|
,#{element.is_logo}
|
||||||
|
,#{element.dm_name}
|
||||||
|
,#{element.psd_url_kr}
|
||||||
|
,#{element.psd_url_en}
|
||||||
|
,#{element.tr_url}
|
||||||
|
,#{element.note}
|
||||||
|
,#{element.memo}
|
||||||
|
,'BATCH'
|
||||||
|
,'BATCH'
|
||||||
|
,SYSDATE()
|
||||||
|
,SYSDATE()
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
||||||
165
src/main/resources/mapper/MaterialMapper.xml
Normal file
165
src/main/resources/mapper/MaterialMapper.xml
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.MaterialMapper">
|
||||||
|
<select id="listMaterial" resultType="com.veve_plus.root.dto.material.MaterialDto">
|
||||||
|
SELECT
|
||||||
|
tkt.idx as id
|
||||||
|
, tkt.title
|
||||||
|
, tkt.chapter
|
||||||
|
, CASE WHEN tkt.language = 'DE' THEN 'de_DE'
|
||||||
|
WHEN tkt.language = 'US' THEN 'en_US'
|
||||||
|
WHEN tkt.language = 'ES' THEN 'es_ES'
|
||||||
|
WHEN tkt.language = 'FR' THEN 'fr_FR'
|
||||||
|
WHEN tkt.language = 'JP' THEN 'ja_JP'
|
||||||
|
WHEN tkt.language = 'KR' THEN 'ko_KR'
|
||||||
|
WHEN tkt.language = 'CN' THEN 'zh_CN'
|
||||||
|
WHEN tkt.language = 'TW' THEN 'zh_TW'
|
||||||
|
WHEN tkt.language = 'TH' THEN 'th_TH'
|
||||||
|
WHEN tkt.language = 'TR' THEN 'tr_TR'
|
||||||
|
WHEN tkt.language = 'AR' THEN 'ar_AR'
|
||||||
|
END AS language
|
||||||
|
, tkt.affected_delivery_date AS kstDl
|
||||||
|
, tkt.dki_delivery_date AS dkiDl
|
||||||
|
, tkt.download_status AS downloadStatus
|
||||||
|
, tkt.download_date AS downloadDate
|
||||||
|
, tkt.download_user AS downloadUser
|
||||||
|
, tkt.is_trans_review AS translateStatus
|
||||||
|
, tct.tr_confirm_time AS trConfirmTime
|
||||||
|
, tct.tr_confirm_by AS trConfirmBy
|
||||||
|
, tkt.editor_note AS editorNote
|
||||||
|
, tkt.qc_note AS qcNote
|
||||||
|
, tkt.kst_note AS kstNote
|
||||||
|
, tc.tms_id AS tmsId
|
||||||
|
, code.code_name AS typingStatus
|
||||||
|
, tkt.translation_download_status AS translationReady
|
||||||
|
, tkt.trans_type AS transType
|
||||||
|
, tkt.tms_chapter AS tmsChapter
|
||||||
|
FROM tb_kst_task tkt
|
||||||
|
LEFT JOIN tb_content tc
|
||||||
|
ON tc.content = tkt.title
|
||||||
|
LEFT JOIN tb_content_title tct
|
||||||
|
ON tc.idx = tct.content_id
|
||||||
|
AND tct.language_code = tkt.language
|
||||||
|
LEFT JOIN tb_code code
|
||||||
|
ON tkt.typing_status = code_id
|
||||||
|
AND code.group_id = 29
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateMaterial" parameterType="com.veve_plus.root.dto.material.MaterialDto">
|
||||||
|
UPDATE tb_kst_task
|
||||||
|
SET download_status = #{downloadStatus}
|
||||||
|
, download_date = #{downloadDate}
|
||||||
|
, download_user = #{downloadUser}
|
||||||
|
, is_trans_review = #{translateStatus}
|
||||||
|
, editor_note = #{editorNote}
|
||||||
|
, kst_note = #{kstNote}
|
||||||
|
, qc_note = #{qcNote}
|
||||||
|
, tms_chapter = #{tmsChapter}
|
||||||
|
WHERE idx = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateTransType">
|
||||||
|
UPDATE tb_kst_task tkt
|
||||||
|
INNER JOIN (
|
||||||
|
SELECT tkt.idx
|
||||||
|
FROM tb_kst_task tkt
|
||||||
|
INNER JOIN tb_content tc
|
||||||
|
ON tc.content = tkt.title
|
||||||
|
AND tc.tms_id = #{tmsId}
|
||||||
|
WHERE tkt.language = CASE WHEN #{language} = 'de_DE' THEN 'DE'
|
||||||
|
WHEN #{language} = 'en_US' THEN 'US'
|
||||||
|
WHEN #{language} = 'es_ES' THEN 'ES'
|
||||||
|
WHEN #{language} = 'fr_FR' THEN 'FR'
|
||||||
|
WHEN #{language} = 'ja_JP' THEN 'JP'
|
||||||
|
WHEN #{language} = 'ko_KR' THEN 'KR'
|
||||||
|
WHEN #{language} = 'zh_CN' THEN 'CN'
|
||||||
|
WHEN #{language} = 'zh_TW' THEN 'TW'
|
||||||
|
WHEN #{language} = 'th_TH' THEN 'TH'
|
||||||
|
WHEN #{language} = 'tr_TR' THEN 'TR'
|
||||||
|
WHEN #{language} = 'ar_001' THEN 'AR'
|
||||||
|
END
|
||||||
|
AND tkt.chapter = #{chapter}
|
||||||
|
) target_task
|
||||||
|
ON tkt.idx = target_task.idx
|
||||||
|
SET tkt.trans_type = #{transType},
|
||||||
|
tkt.translation_download_status = '01'
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertMaterial" parameterType="com.veve_plus.root.entity.GSheetData">
|
||||||
|
INSERT INTO tb_kst_task (
|
||||||
|
language
|
||||||
|
, title
|
||||||
|
, chapter
|
||||||
|
, tms_chapter
|
||||||
|
, affected_delivery_date
|
||||||
|
, dki_delivery_date
|
||||||
|
, is_trans_review
|
||||||
|
, is_urgent
|
||||||
|
, created_date
|
||||||
|
, created_by
|
||||||
|
, updated_date
|
||||||
|
, updated_by
|
||||||
|
) VALUES (
|
||||||
|
#{language}
|
||||||
|
, #{title}
|
||||||
|
, #{chapter}
|
||||||
|
, #{chapter}
|
||||||
|
, #{affectedDeliveryDate}
|
||||||
|
, #{dkiDeliveryDate}
|
||||||
|
, #{isTransReview}
|
||||||
|
, #{isUrgent}
|
||||||
|
, SYSDATE()
|
||||||
|
, 'SYSTEM'
|
||||||
|
, SYSDATE()
|
||||||
|
, 'SYSTEM'
|
||||||
|
)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
language = #{language}
|
||||||
|
, title = #{title}
|
||||||
|
, chapter = #{chapter}
|
||||||
|
, affected_delivery_date = #{affectedDeliveryDate}
|
||||||
|
, dki_delivery_date = #{dkiDeliveryDate}
|
||||||
|
, is_trans_review = #{isTransReview}
|
||||||
|
, updated_date = SYSDATE()
|
||||||
|
, updated_by = 'SYSTEM'
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateTypingStatus" parameterType="com.veve_plus.root.dto.material.MaterialTypingStatusDto">
|
||||||
|
UPDATE tb_kst_task
|
||||||
|
SET typing_status = #{typingStatus}
|
||||||
|
, type_complete_time = CASE WHEN #{typingStatus} = 2
|
||||||
|
THEN DATE_FORMAT(SYSDATE(), '%Y%m%d%H%i%s')
|
||||||
|
ELSE NULL
|
||||||
|
END
|
||||||
|
, updated_date = SYSDATE()
|
||||||
|
, updated_by = 'SYSTEM'
|
||||||
|
WHERE language = #{language}
|
||||||
|
AND chapter = #{chapter}
|
||||||
|
AND title = (select content from tb_content where tms_id = #{tmsId})
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateTooningTypingStatus" parameterType="com.veve_plus.root.dto.material.MaterialTypingStatusDto">
|
||||||
|
UPDATE tb_kst_task
|
||||||
|
SET typing_status = #{typingStatus}
|
||||||
|
, type_complete_time = CASE WHEN #{typingStatus} = 2
|
||||||
|
THEN DATE_FORMAT(SYSDATE(), '%Y%m%d%H%i%s')
|
||||||
|
ELSE NULL
|
||||||
|
END
|
||||||
|
, updated_date = SYSDATE()
|
||||||
|
, updated_by = 'SYSTEM'
|
||||||
|
WHERE language = #{language}
|
||||||
|
AND chapter = #{chapter}
|
||||||
|
AND title = (select content from tb_content where tooning_id = #{tmsId})
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="findMaterialCategory">
|
||||||
|
SELECT tkt.is_urgent
|
||||||
|
FROM tb_kst_task tkt
|
||||||
|
INNER JOIN tb_content tc
|
||||||
|
ON tkt.title = tc.content
|
||||||
|
WHERE tc.tms_id = #{tmsId}
|
||||||
|
AND tkt.chapter = #{chapter}
|
||||||
|
AND tkt.language = #{language}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
87
src/main/resources/mapper/MenuMapper.xml
Normal file
87
src/main/resources/mapper/MenuMapper.xml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.MenuMapper">
|
||||||
|
|
||||||
|
<resultMap id="menuResultMap" type="com.veve_plus.root.dto.menu.MenuResponse">
|
||||||
|
<id property="menuId" column="menu_id" />
|
||||||
|
<result property="deptId" column="dept_id" />
|
||||||
|
<result property="type" column="type" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="icon" column="icon" />
|
||||||
|
<result property="url" column="url" />
|
||||||
|
<result property="permission" column="permission" />
|
||||||
|
<result property="pid" column="pid" />
|
||||||
|
<result property="menuSort" column="menu_sort" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.veve_plus.root.dto.menu.Menu" useGeneratedKeys="true" keyProperty="menuId" >
|
||||||
|
INSERT INTO tb_menu (pid, type, name, url, menu_sort, icon, status, permission, created_by, updated_by, created_time, updated_time)
|
||||||
|
VALUES (
|
||||||
|
#{pid},
|
||||||
|
#{type},
|
||||||
|
#{name},
|
||||||
|
#{url},
|
||||||
|
#{menuSort},
|
||||||
|
#{icon},
|
||||||
|
#{status},
|
||||||
|
#{permission},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
#{createdTime},
|
||||||
|
#{updatedTime}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<update id="update" parameterType="com.veve_plus.root.dto.menu.Menu">
|
||||||
|
UPDATE tb_menu
|
||||||
|
SET
|
||||||
|
pid = #{pid},
|
||||||
|
type = #{type},
|
||||||
|
name = #{name},
|
||||||
|
url = #{url},
|
||||||
|
menu_sort = #{menuSort},
|
||||||
|
icon = #{icon},
|
||||||
|
status= #{status},
|
||||||
|
permission = #{permission},
|
||||||
|
updated_by = #{updatedBy},
|
||||||
|
updated_time = #{updatedTime}
|
||||||
|
WHERE
|
||||||
|
menu_id = #{menuId}
|
||||||
|
</update>
|
||||||
|
<select id="findAll" parameterType="com.veve_plus.root.dto.menu.MenuSearchRequest" resultType="com.veve_plus.root.dto.menu.MenuResponse">
|
||||||
|
WITH RECURSIVE menu_hierarchy AS (
|
||||||
|
SELECT menu_id as menuId, pid, name, menu_sort as menuSort, status, url, permission, type, icon
|
||||||
|
FROM tb_menu
|
||||||
|
<where>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND name LIKE CONCAT('%', #{keyword}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
UNION ALL
|
||||||
|
SELECT d.menu_id as menuId, d.pid, d.name, d.menu_sort as menuSort, d.status, d.url, d.permission, d.type, d.icon
|
||||||
|
FROM tb_menu d
|
||||||
|
JOIN menu_hierarchy h ON d.menu_id = h.pid
|
||||||
|
)
|
||||||
|
SELECT distinct *
|
||||||
|
FROM menu_hierarchy
|
||||||
|
ORDER BY menuSort
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getMenusByEmail">
|
||||||
|
SELECT distinct C.menu_id
|
||||||
|
FROM
|
||||||
|
tb_users_roles A,
|
||||||
|
tb_roles_menus B,
|
||||||
|
tb_menu C,
|
||||||
|
tb_user D
|
||||||
|
WHERE A.role_id = B.role_id
|
||||||
|
AND B.menu_id = C.menu_id
|
||||||
|
AND C.status = 1
|
||||||
|
AND A.user_id = D.user_id
|
||||||
|
AND D.email = #{email}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
108
src/main/resources/mapper/RoleMapper.xml
Normal file
108
src/main/resources/mapper/RoleMapper.xml
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.RoleMapper">
|
||||||
|
<resultMap id="roleResponseResultMap" type="com.veve_plus.root.dto.role.RoleResponse">
|
||||||
|
<id property="roleId" column="role_id" />
|
||||||
|
<result property="name" column="name" />
|
||||||
|
<result property="description" column="description" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createdBy" column="created_by" />
|
||||||
|
<result property="updatedBy" column="updated_by" />
|
||||||
|
<result property="createdTime" column="created_time" />
|
||||||
|
<result property="updatedTime" column="updated_time" />
|
||||||
|
<collection property="menuIds" ofType="java.lang.Long">
|
||||||
|
<result column="menu_id" javaType="java.lang.Long" />
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
<select id="findAllRolesByCondition" parameterType="com.veve_plus.root.dto.role.RoleSearchRequest" resultMap="roleResponseResultMap">
|
||||||
|
SELECT
|
||||||
|
r.role_id,
|
||||||
|
r.name,
|
||||||
|
r.description,
|
||||||
|
r.status,
|
||||||
|
rm.menu_id,
|
||||||
|
r.created_by,
|
||||||
|
r.updated_by,
|
||||||
|
r.created_time,
|
||||||
|
r.updated_time
|
||||||
|
FROM
|
||||||
|
tb_role r
|
||||||
|
LEFT JOIN
|
||||||
|
tb_roles_menus rm ON r.role_id = rm.role_id
|
||||||
|
<where>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (
|
||||||
|
r.name LIKE concat('%',#{keyword},'%')
|
||||||
|
OR rm.name LIKE concat('%',#{keyword},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND r.status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<insert id="insert" parameterType="com.veve_plus.root.dto.role.Role" useGeneratedKeys="true" keyProperty="roleId">
|
||||||
|
INSERT INTO tb_role (
|
||||||
|
role_id,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
status,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
) VALUES (
|
||||||
|
#{roleId},
|
||||||
|
#{name},
|
||||||
|
#{description},
|
||||||
|
#{status},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
#{createdTime},
|
||||||
|
#{updatedTime}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<update id="update" parameterType="com.veve_plus.root.dto.role.Role">
|
||||||
|
UPDATE tb_role
|
||||||
|
SET
|
||||||
|
name = #{name},
|
||||||
|
description = #{description},
|
||||||
|
status = #{status},
|
||||||
|
updated_by = #{updatedBy},
|
||||||
|
updated_time = #{updatedTime}
|
||||||
|
WHERE
|
||||||
|
role_id = #{roleId}
|
||||||
|
</update>
|
||||||
|
<insert id="insertRoleMenu" parameterType="com.veve_plus.root.dto.role.RoleMenu">
|
||||||
|
INSERT INTO tb_roles_menus (
|
||||||
|
role_id,
|
||||||
|
menu_id,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
) VALUES (
|
||||||
|
#{roleId},
|
||||||
|
#{menuId},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
#{createdTime},
|
||||||
|
#{updatedTime}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<delete id="deleteByRoleId">
|
||||||
|
DELETE FROM tb_roles_menus WHERE role_id = #{roleId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="findRolesByEmail" resultType="com.veve_plus.root.dto.role.RoleUser">
|
||||||
|
SELECT tu.user_id AS userId
|
||||||
|
, tr.role_id AS roleId
|
||||||
|
FROM tb_user tu
|
||||||
|
INNER JOIN tb_users_roles tur
|
||||||
|
ON tur.user_id = tu.user_id
|
||||||
|
INNER JOIN tb_role tr
|
||||||
|
ON tr.role_id = tur.role_id
|
||||||
|
WHERE tu.email = #{email}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
63
src/main/resources/mapper/TaskMapper.xml
Normal file
63
src/main/resources/mapper/TaskMapper.xml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.TaskMapper">
|
||||||
|
|
||||||
|
<select id="listDesignerTask">
|
||||||
|
SELECT tt.idx AS taskId
|
||||||
|
, tt.editor_id AS editorId
|
||||||
|
, tt.korea_title AS title
|
||||||
|
, tt.language_code AS language
|
||||||
|
, tt.chapter AS chapter
|
||||||
|
, tt.dki_delivery_date AS dkiDeadline
|
||||||
|
, tt.designer_deadline AS designerDeadline
|
||||||
|
, code_edit_status.code_name AS editStatus
|
||||||
|
, tt.tms_date AS tmsDate
|
||||||
|
, tct.title_ge_id AS geId
|
||||||
|
FROM tb_task tt
|
||||||
|
LEFT JOIN tb_code code_edit_status
|
||||||
|
ON tt.edit_status = code_edit_status.code_id
|
||||||
|
AND code_edit_status.group_id = 11
|
||||||
|
INNER JOIN tb_content tc
|
||||||
|
ON tc.content = tt.korea_title
|
||||||
|
LEFT JOIN tb_content_title tct
|
||||||
|
ON tct.content_id = tc.idx
|
||||||
|
AND tct.language_code = tt.language_code
|
||||||
|
WHERE tt.dki_delivery_date <= DATE_FORMAT(DATE_ADD(SYSDATE(), INTERVAL 2 DAY), '%Y%m%d')
|
||||||
|
AND tt.edit_status NOT IN ('08', '09')
|
||||||
|
AND tt.editor_id = #{pic}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateEditStatus" parameterType="com.veve_plus.root.dto.task.TaskDto">
|
||||||
|
UPDATE tb_task
|
||||||
|
SET edit_status = #{editStatus}
|
||||||
|
WHERE idx = #{taskId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getLatestVersion" resultType="com.veve_plus.root.dto.task.KstTaskHistoryDto">
|
||||||
|
WITH history_version AS (
|
||||||
|
SELECT version
|
||||||
|
FROM tb_kst_task_history
|
||||||
|
GROUP BY version,created_by
|
||||||
|
ORDER BY version DESC
|
||||||
|
LIMIT 0,1
|
||||||
|
)
|
||||||
|
SELECT tkth.idx
|
||||||
|
, tkth.version
|
||||||
|
, tkth.title_ge_id AS geId
|
||||||
|
, tkth.title
|
||||||
|
, tkth.google_sheet_name AS language
|
||||||
|
, tkth.chapter
|
||||||
|
FROM tb_kst_task_history tkth
|
||||||
|
INNER JOIN history_version hv
|
||||||
|
ON tkth.version = hv.version
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="createVeveInfo" statementType="CALLABLE">
|
||||||
|
{call sp_create_veve_data(#{title}, #{language}, #{chapter}, #{note}, #{userId})}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="autoAssignDesigner" statementType="CALLABLE">
|
||||||
|
{call sp_auto_assign_designer(#{language})}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
88
src/main/resources/mapper/TitleMapper.xml
Normal file
88
src/main/resources/mapper/TitleMapper.xml
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.TitleMapper">
|
||||||
|
|
||||||
|
<select id="findTitleList" resultType="com.veve_plus.root.dto.title.TitleDto">
|
||||||
|
WITH title_list as (
|
||||||
|
SELECT
|
||||||
|
c.content
|
||||||
|
, c.tms_id
|
||||||
|
, ct.*
|
||||||
|
FROM tb_content c, tb_content_title ct
|
||||||
|
WHERE c.idx = ct.content_id
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
IFNULL(tl.content ,'') as content
|
||||||
|
, IFNULL(tl.tms_id ,'') as tmsId
|
||||||
|
, IFNULL(tl.content_id ,'') as contentId
|
||||||
|
, IFNULL(tl.idx ,'') as titleId
|
||||||
|
, IFNULL(tp.project_id ,'') as projectId
|
||||||
|
, IFNULL(tl.kst_nas_path ,'') as kstNasPath
|
||||||
|
, IFNULL(tl.language_code ,'') as languageCode
|
||||||
|
, IFNULL(tl.title_ge_id ,'') as titleGeId
|
||||||
|
, IFNULL(tl.font_type_code,'') as fontTypeCode
|
||||||
|
, IFNULL(tl.font_size ,0) as fontSize
|
||||||
|
, IFNULL(tp.title ,'') as title
|
||||||
|
, IFNULL(tp.locale ,'') as locale
|
||||||
|
FROM title_list tl
|
||||||
|
LEFT JOIN tb_tms_project tp ON tl.tms_id = tp.project_id
|
||||||
|
ORDER BY tms_id ASC, tl.font_type_code
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateTitleByIdx">
|
||||||
|
UPDATE tb_content_title
|
||||||
|
SET font_size = #{fontSize}
|
||||||
|
, font_type_code = #{fontTypeCode}
|
||||||
|
, updated_time = now()
|
||||||
|
, updated_by = '000'
|
||||||
|
WHERE idx = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="findContentTitleList" resultType="com.veve_plus.root.dto.content.ContentTitleDto">
|
||||||
|
SELECT
|
||||||
|
IFNULL(tp.project_id ,'') as projectId
|
||||||
|
, IFNULL(c.idx ,'') as contentId
|
||||||
|
, IFNULL(c.content ,'') as content
|
||||||
|
, IFNULL(ct.idx ,'') as titleId
|
||||||
|
, IFNULL(ct.language_code ,'') as languageCode
|
||||||
|
, ( SELECT code_name
|
||||||
|
FROM tb_code tc
|
||||||
|
WHERE group_id = 27
|
||||||
|
AND code_id = ct.language_code) as tmsLang
|
||||||
|
, IFNULL(ct.font_type_code ,'') as fontTypeCode
|
||||||
|
, IFNULL(ct.font_size ,0) as fontSize
|
||||||
|
, IFNULL(tp.title ,'') as title
|
||||||
|
FROM tb_content c, tb_content_title ct, tb_tms_project tp
|
||||||
|
WHERE c.idx = ct.content_id
|
||||||
|
AND tp.project_id = c.tms_id
|
||||||
|
AND c.content LIKE CONCAT('%', #{keywordSearch}, '%')
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findTmsTitleGeId" resultType="com.veve_plus.root.dto.title.TitleDto">
|
||||||
|
SELECT tct.title_ge_id AS titleGeId
|
||||||
|
, tct.language_code AS languageCode
|
||||||
|
, tct.idx AS titleId
|
||||||
|
FROM tb_kst_task a, tb_content tc, tb_content_title tct
|
||||||
|
WHERE a.title = tc.content
|
||||||
|
AND tc.idx = tct.content_id
|
||||||
|
AND tc.tms_id = #{tmsId}
|
||||||
|
AND tct.language_code = #{language}
|
||||||
|
AND a.language = #{language}
|
||||||
|
AND a.tms_chapter = #{chapter}
|
||||||
|
AND tct.del_yn = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findTooningTitleGeId" resultType="com.veve_plus.root.dto.title.TitleDto">
|
||||||
|
SELECT tct.title_ge_id AS titleGeId
|
||||||
|
, tct.language_code AS languageCode
|
||||||
|
, tct.idx AS titleId
|
||||||
|
FROM tb_kst_task a, tb_content tc, tb_content_title tct
|
||||||
|
WHERE a.title = tc.content
|
||||||
|
AND tc.idx = tct.content_id
|
||||||
|
AND tc.tooning_id = #{tmsId}
|
||||||
|
AND tct.language_code = #{language}
|
||||||
|
AND a.language = #{language}
|
||||||
|
AND a.tms_chapter = #{chapter}
|
||||||
|
AND tct.del_yn = 0
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
165
src/main/resources/mapper/TmsMapper.xml
Normal file
165
src/main/resources/mapper/TmsMapper.xml
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.TmsMapper">
|
||||||
|
<insert id="insertTranslation" parameterType="com.veve_plus.root.dto.tms.TranslationDto">
|
||||||
|
INSERT INTO tb_translation (
|
||||||
|
tms_id,
|
||||||
|
chapter,
|
||||||
|
language_code,
|
||||||
|
seq_no,
|
||||||
|
coordinate_x,
|
||||||
|
coordinate_y,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
text_content,
|
||||||
|
color_code,
|
||||||
|
del_flg,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
) VALUES (
|
||||||
|
#{tmsId},
|
||||||
|
#{chapter},
|
||||||
|
#{languageCode},
|
||||||
|
#{seqNo},
|
||||||
|
#{positionX},
|
||||||
|
#{positionY},
|
||||||
|
#{width},
|
||||||
|
#{height},
|
||||||
|
#{textContent},
|
||||||
|
#{colorCode},
|
||||||
|
#{delFlg},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
SYSDATE(),
|
||||||
|
SYSDATE()
|
||||||
|
)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
coordinate_x = #{positionX},
|
||||||
|
coordinate_y = #{positionY},
|
||||||
|
width = #{width},
|
||||||
|
height = #{height},
|
||||||
|
text_content = #{textContent},
|
||||||
|
color_code = #{colorCode},
|
||||||
|
del_flg = #{delFlg},
|
||||||
|
created_by = #{createdBy},
|
||||||
|
updated_by = #{updatedBy},
|
||||||
|
updated_time = SYSDATE()
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertProject" parameterType="com.veve_plus.root.dto.tms.ProjectDto">
|
||||||
|
INSERT INTO tb_tms_project (
|
||||||
|
project_id,
|
||||||
|
title,
|
||||||
|
version,
|
||||||
|
locale,
|
||||||
|
del_flg,
|
||||||
|
archived_flg,
|
||||||
|
bookmark_flg,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
) VALUES (
|
||||||
|
#{projectId},
|
||||||
|
#{title},
|
||||||
|
#{version},
|
||||||
|
#{locale},
|
||||||
|
#{delFlg},
|
||||||
|
#{archivedFlg},
|
||||||
|
#{bookmarkFlg},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
SYSDATE(),
|
||||||
|
SYSDATE()
|
||||||
|
)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
title = #{title},
|
||||||
|
version = #{version},
|
||||||
|
locale = #{locale},
|
||||||
|
del_flg = #{delFlg},
|
||||||
|
archived_flg = #{archivedFlg},
|
||||||
|
bookmark_flg = #{bookmarkFlg},
|
||||||
|
created_by = #{createdBy},
|
||||||
|
updated_by = #{updatedBy},
|
||||||
|
updated_time = SYSDATE()
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertProjectLocale" parameterType="com.veve_plus.root.dto.tms.ProjectLocaleDto">
|
||||||
|
INSERT INTO tb_tms_project_locale (
|
||||||
|
project_id,
|
||||||
|
locale
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
#{projectId},
|
||||||
|
#{locale}
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT *
|
||||||
|
FROM tb_tms_project_locale
|
||||||
|
WHERE project_id = #{projectId}
|
||||||
|
AND locale = #{locale}
|
||||||
|
)
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="findProjectByTitle" resultType="com.veve_plus.root.dto.tms.ProjectDto">
|
||||||
|
SELECT project_id AS projectId
|
||||||
|
, title
|
||||||
|
FROM tb_tms_project
|
||||||
|
WHERE del_flg = 0
|
||||||
|
<if test="title != null and title != ''">
|
||||||
|
AND title LIKE CONCAT('%', #{title}, '%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTranslationList" resultType="com.veve_plus.root.dto.tms.TranslationDto">
|
||||||
|
WITH title_lang AS
|
||||||
|
(
|
||||||
|
SELECT c.content, c.tms_id, b.code_id, b.code_name, c.tooning_id, a.*
|
||||||
|
FROM tb_content_title a, tb_code b, tb_content c
|
||||||
|
WHERE a.language_code = b.code_id
|
||||||
|
AND c.idx = a.content_id
|
||||||
|
AND b.group_id = 27
|
||||||
|
<if test="platform == 'TMS'">
|
||||||
|
AND c.tms_id = #{tmsId}
|
||||||
|
</if>
|
||||||
|
<if test="platform == 'TN'">
|
||||||
|
AND c.tooning_id = #{tmsId}
|
||||||
|
</if>
|
||||||
|
AND b.code_name = #{languageCode}
|
||||||
|
LIMIT 0,1
|
||||||
|
)
|
||||||
|
SELECT tt.tms_id AS tmsId
|
||||||
|
, tt.chapter
|
||||||
|
, tt.language_code AS languageCode
|
||||||
|
, tt.seq_no AS seqNo
|
||||||
|
, tt.coordinate_x AS positionX
|
||||||
|
, tt.coordinate_y AS positionY
|
||||||
|
, tt.width
|
||||||
|
, tt.height
|
||||||
|
, tt.text_content AS textContent
|
||||||
|
, tt.color_code AS colorCode
|
||||||
|
, tc.font_size AS fontSize
|
||||||
|
, tc.font_type_code AS fontTypeCode
|
||||||
|
, tcc.code_name AS fontName
|
||||||
|
FROM title_lang tc
|
||||||
|
INNER JOIN tb_translation tt
|
||||||
|
ON tt.language_code = tc.code_name
|
||||||
|
AND tt.chapter = #{chapter}
|
||||||
|
<if test="platform == 'TMS'">
|
||||||
|
AND tt.tms_id = tc.tms_id
|
||||||
|
</if>
|
||||||
|
<if test="platform == 'TN'">
|
||||||
|
AND tt.tms_id = tc.tooning_id
|
||||||
|
</if>
|
||||||
|
AND tt.platform = #{platform}
|
||||||
|
LEFT JOIN tb_code tcc
|
||||||
|
ON tc.font_type_code = tcc.code_id
|
||||||
|
AND tcc.group_id = '28'
|
||||||
|
WHERE tc.del_yn = 0
|
||||||
|
ORDER BY tt.coordinate_y DESC;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
260
src/main/resources/mapper/UserMapper.xml
Normal file
260
src/main/resources/mapper/UserMapper.xml
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
<?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="com.veve_plus.root.mapper.UserMapper">
|
||||||
|
<resultMap id="userResultMap" type="com.veve_plus.root.dto.user.UserResponse">
|
||||||
|
<id property="userId" column="user_id" />
|
||||||
|
<result property="deptId" column="dept_id" />
|
||||||
|
<result property="deptName" column="dept_name" />
|
||||||
|
<result property="managerId" column="manager_id" />
|
||||||
|
<result property="managerName" column="manager_name" />
|
||||||
|
<result property="username" column="username" />
|
||||||
|
<result property="firstName" column="first_name" />
|
||||||
|
<result property="lastName" column="last_name" />
|
||||||
|
<result property="gender" column="gender" />
|
||||||
|
<result property="phone" column="phone" />
|
||||||
|
<result property="email" column="email" />
|
||||||
|
<result property="contractNo" column="contract_no" />
|
||||||
|
<result property="contractDate" column="contract_date" />
|
||||||
|
<result property="identityNo" column="identity_no" />
|
||||||
|
<result property="issuedDate" column="issued_date" />
|
||||||
|
<result property="issuedPlace" column="issued_place" />
|
||||||
|
<result property="taxCode" column="tax_code" />
|
||||||
|
<result property="avatarName" column="avatar_name" />
|
||||||
|
<result property="avatarPath" column="avatar_path" />
|
||||||
|
<result property="password" column="password" />
|
||||||
|
<result property="isAdmin" column="is_admin" />
|
||||||
|
<result property="isManager" column="is_manager" />
|
||||||
|
<result property="isLocked" column="is_locked" />
|
||||||
|
<result property="isExpired" column="is_expired" />
|
||||||
|
<result property="isCredentialExpired" column="is_credential_expired" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="level" column="level" />
|
||||||
|
<result property="bank" column="bank" />
|
||||||
|
<result property="bankAccount" column="bank_account" />
|
||||||
|
<result property="createdBy" column="created_by" />
|
||||||
|
<result property="updatedBy" column="updated_by" />
|
||||||
|
<result property="pwdResetTime" column="pwd_reset_time" />
|
||||||
|
<result property="createdTime" column="created_time" />
|
||||||
|
<result property="updatedTime" column="updated_time" />
|
||||||
|
<result property="roleIds" column="role_ids" />
|
||||||
|
</resultMap>
|
||||||
|
<select id="findByEmail" resultType="com.veve_plus.root.dto.auth.LoginDto">
|
||||||
|
SELECT email
|
||||||
|
, password
|
||||||
|
, status
|
||||||
|
FROM tb_user
|
||||||
|
WHERE email = #{email}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findUserInfoByEmail" resultType="com.veve_plus.root.entity.User">
|
||||||
|
SELECT user_id as userId
|
||||||
|
, dept_id as deptId
|
||||||
|
, username
|
||||||
|
, first_name as firstName
|
||||||
|
, last_name as lastName
|
||||||
|
, gender
|
||||||
|
, phone
|
||||||
|
, email
|
||||||
|
FROM tb_user
|
||||||
|
WHERE email = #{email}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findAllUsersByCondition" resultMap="userResultMap">
|
||||||
|
SELECT a.*,
|
||||||
|
CONCAT(c.first_name,' ',c.last_name) as manager_name,
|
||||||
|
b.name as dept_name,
|
||||||
|
(
|
||||||
|
SELECT GROUP_CONCAT(d.role_id) FROM tb_users_roles d WHERE a.user_id = d.user_id
|
||||||
|
) AS role_ids,
|
||||||
|
(
|
||||||
|
SELECT GROUP_CONCAT(f.name) FROM tb_role f LEFT JOIN tb_users_roles g ON f.role_id = g.role_id WHERE a.user_id = g.user_id
|
||||||
|
) AS roleNames,
|
||||||
|
e.code_name as levelName,
|
||||||
|
f.code_name as classificationName
|
||||||
|
FROM tb_user a
|
||||||
|
LEFT JOIN tb_dept b on a.dept_id = b.dept_id
|
||||||
|
LEFT JOIN tb_user c on b.manager_id = c.user_id
|
||||||
|
LEFT JOIN tb_code e on a.`level` = e.code_id AND e.group_id = '9'
|
||||||
|
LEFT JOIN tb_code f on a.`classification` = f.code_id AND f.group_id = '10'
|
||||||
|
<where>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND ( a.username LIKE concat('%',#{keyword},'%')
|
||||||
|
OR a.first_name LIKE concat('%',#{keyword},'%')
|
||||||
|
OR a.last_name LIKE concat('%',#{keyword},'%')
|
||||||
|
OR a.email LIKE concat('%',#{keyword},'%')
|
||||||
|
OR a.phone LIKE concat('%',#{keyword},'%')
|
||||||
|
OR CONCAT(c.first_name,' ',c.last_name) LIKE concat('%',#{keyword},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="classification != null and !classification.isEmpty()">
|
||||||
|
AND f.code_id IN
|
||||||
|
<foreach item="id" collection="classification.split(',')" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null and !deptId.isEmpty()">
|
||||||
|
AND b.dept_id IN
|
||||||
|
<foreach item="id" collection="deptId.split(',')" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="level != null and !level.isEmpty()">
|
||||||
|
AND e.code_id IN
|
||||||
|
<foreach item="id" collection="level.split(',')" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND a.status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.veve_plus.root.dto.user.UserDto" useGeneratedKeys="true" keyProperty="userId" >
|
||||||
|
INSERT INTO tb_user (
|
||||||
|
user_id,
|
||||||
|
dept_id,
|
||||||
|
username,
|
||||||
|
first_name,
|
||||||
|
last_name,
|
||||||
|
gender,
|
||||||
|
phone,
|
||||||
|
email,
|
||||||
|
contract_no,
|
||||||
|
contract_date,
|
||||||
|
identity_no,
|
||||||
|
issued_date,
|
||||||
|
issued_place,
|
||||||
|
tax_code,
|
||||||
|
avatar_name,
|
||||||
|
avatar_path,
|
||||||
|
password,
|
||||||
|
download_password,
|
||||||
|
is_admin,
|
||||||
|
is_manager,
|
||||||
|
is_locked,
|
||||||
|
is_expired,
|
||||||
|
is_credential_expired,
|
||||||
|
status,
|
||||||
|
level,
|
||||||
|
bank,
|
||||||
|
bank_account,
|
||||||
|
classification,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
pwd_reset_time,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
)
|
||||||
|
VALUES (
|
||||||
|
#{userId},
|
||||||
|
#{deptId},
|
||||||
|
#{username},
|
||||||
|
#{firstName},
|
||||||
|
#{lastName},
|
||||||
|
#{gender},
|
||||||
|
#{phone},
|
||||||
|
#{email},
|
||||||
|
#{contractNo},
|
||||||
|
#{contractDate},
|
||||||
|
#{identityNo},
|
||||||
|
#{issuedDate},
|
||||||
|
#{issuedPlace},
|
||||||
|
#{taxCode},
|
||||||
|
#{avatarName},
|
||||||
|
#{avatarPath},
|
||||||
|
#{password},
|
||||||
|
SHA2(#{downloadPassword}, '512'),
|
||||||
|
#{isAdmin},
|
||||||
|
#{isManager},
|
||||||
|
#{isLocked},
|
||||||
|
#{isExpired},
|
||||||
|
#{isCredentialExpired},
|
||||||
|
#{status},
|
||||||
|
#{level},
|
||||||
|
#{bank},
|
||||||
|
#{bankAccount},
|
||||||
|
#{classification},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
#{pwdResetTime},
|
||||||
|
SYSDATE(),
|
||||||
|
SYSDATE()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertRole" parameterType="com.veve_plus.root.dto.user.UserRole">
|
||||||
|
INSERT INTO tb_users_roles (
|
||||||
|
user_id,
|
||||||
|
role_id,
|
||||||
|
created_by,
|
||||||
|
updated_by,
|
||||||
|
created_time,
|
||||||
|
updated_time
|
||||||
|
) VALUES (
|
||||||
|
#{userId},
|
||||||
|
#{roleId},
|
||||||
|
#{createdBy},
|
||||||
|
#{updatedBy},
|
||||||
|
SYSDATE(),
|
||||||
|
SYSDATE()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.veve_plus.root.dto.user.UserDto">
|
||||||
|
UPDATE tb_user
|
||||||
|
SET
|
||||||
|
dept_id = #{deptId},
|
||||||
|
username = #{username},
|
||||||
|
first_name = #{firstName},
|
||||||
|
last_name = #{lastName},
|
||||||
|
gender = #{gender},
|
||||||
|
phone = #{phone},
|
||||||
|
<!--email = #{email},-->
|
||||||
|
contract_no = #{contractNo},
|
||||||
|
contract_date = #{contractDate},
|
||||||
|
identity_no = #{identityNo},
|
||||||
|
issued_date = #{issuedDate},
|
||||||
|
issued_place = #{issuedPlace},
|
||||||
|
tax_code = #{taxCode},
|
||||||
|
is_manager = #{isManager},
|
||||||
|
classification = #{classification},
|
||||||
|
status = #{status},
|
||||||
|
level = #{level},
|
||||||
|
bank = #{bank},
|
||||||
|
bank_account = #{bankAccount},
|
||||||
|
updated_by = #{updatedBy},
|
||||||
|
updated_time = SYSDATE()
|
||||||
|
WHERE user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteRolesByUserId">
|
||||||
|
DELETE FROM tb_users_roles WHERE user_id = #{userId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getInfoUserById" resultType="com.veve_plus.root.dto.user.UserResponse">
|
||||||
|
SELECT
|
||||||
|
user_id as userId,
|
||||||
|
dept_id as deptId,
|
||||||
|
username,
|
||||||
|
first_name as firstName,
|
||||||
|
last_name as lastName,
|
||||||
|
gender,
|
||||||
|
phone,
|
||||||
|
email,
|
||||||
|
classification,
|
||||||
|
contract_no as contractNo,
|
||||||
|
contract_date as contractDate,
|
||||||
|
identity_no as identityNo,
|
||||||
|
issued_date as issuedDate,
|
||||||
|
issued_place as issuedPlace,
|
||||||
|
tax_code as taxCode,
|
||||||
|
avatar_name as avatarName,
|
||||||
|
avatar_path as avatarPath,
|
||||||
|
e.code_name as levelName
|
||||||
|
FROM tb_user
|
||||||
|
LEFT JOIN tb_code e on tb_user.level = e.code_id
|
||||||
|
WHERE user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
BIN
src/main/resources/tokens/StoredCredential
Normal file
BIN
src/main/resources/tokens/StoredCredential
Normal file
Binary file not shown.
13
src/test/java/com/veve_plus/root/RootApplicationTests.java
Normal file
13
src/test/java/com/veve_plus/root/RootApplicationTests.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.veve_plus.root;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class RootApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
50
target/classes/application.properties
Normal file
50
target/classes/application.properties
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
spring.application.name=admin
|
||||||
|
|
||||||
|
#Server port
|
||||||
|
server.port = 8080
|
||||||
|
|
||||||
|
# JDBC properties
|
||||||
|
spring.datasource.url=jdbc:mysql://61.28.226.9:3306/gone
|
||||||
|
spring.datasource.username=geuser1
|
||||||
|
spring.datasource.password=Dki@2023
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
#spring.security.user.name=admin
|
||||||
|
#spring.security.user.password=password
|
||||||
|
# Logging
|
||||||
|
logging.level.org.springframework.security=TRACE
|
||||||
|
logging.level.org.springframework.web=TRACE
|
||||||
|
logging.level.org.hibernate.SQL=TRACE
|
||||||
|
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||||
|
|
||||||
|
# MyBatis configuration
|
||||||
|
mybatis.mapper-locations=classpath:mapper/*.xml
|
||||||
|
mybatis.configuration.map-underscore-to-camel-case=true
|
||||||
|
mybatis.configuration.default-fetch-size=100
|
||||||
|
mybatis.configuration.default-statement-timeout=30
|
||||||
|
# MyBatis Configuration
|
||||||
|
mybatis.configuration.cache-enabled=true
|
||||||
|
mybatis.configuration.lazy-loading-enabled=true
|
||||||
|
mybatis.configuration.aggressive-lazy-loading=true
|
||||||
|
mybatis.configuration.multiple-result-sets-enabled=true
|
||||||
|
mybatis.configuration.use-column-label=true
|
||||||
|
mybatis.configuration.use-generated-keys=false
|
||||||
|
mybatis.configuration.auto-mapping-behavior=PARTIAL
|
||||||
|
mybatis.configuration.auto-mapping-unknown-column-behavior=NONE
|
||||||
|
mybatis.configuration.default-executor-type=SIMPLE
|
||||||
|
mybatis.configuration.safe-row-bounds-enabled=false
|
||||||
|
mybatis.configuration.safe-result-handler-enabled=true
|
||||||
|
mybatis.configuration.local-cache-scope=SESSION
|
||||||
|
mybatis.configuration.jdbc-type-for-null=OTHER
|
||||||
|
mybatis.configuration.lazy-load-trigger-methods=equals,clone,hashCode,toString
|
||||||
|
mybatis.configuration.default-enum-type-handler=org.apache.ibatis.type.EnumTypeHandler
|
||||||
|
mybatis.configuration.call-setters-on-nulls=false
|
||||||
|
mybatis.configuration.return-instance-for-empty-row=false
|
||||||
|
mybatis.configuration.log-prefix=exampleLogPreFix_
|
||||||
|
|
||||||
|
spring.servlet.multipart.max-file-size=20MB
|
||||||
|
spring.servlet.multipart.max-request-size=20MB
|
||||||
|
|
||||||
|
#Schedule config
|
||||||
|
scheduler.enabled=true
|
||||||
|
|
||||||
BIN
target/classes/com/veve_plus/root/RootApplication.class
Normal file
BIN
target/classes/com/veve_plus/root/RootApplication.class
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user