초기소스
This commit is contained in:
242
Jenkinsfile
vendored
Normal file
242
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
tools {
|
||||
jdk 'JDK17'
|
||||
}
|
||||
|
||||
// parameters {
|
||||
// choice(name: 'ENVIRONMENT', choices: ['dev'], description: '배포할 어플리케이션 profile 선택')
|
||||
// choice(name: 'DEPLOY_SERVER_IP', choices: ['172.31.14.11'], description: '배포할 WAS 서버 IP 선택')
|
||||
// string(name: 'GIT_REPO', defaultValue: 'http://172.31.18.11:3000/gcone/gconebo.git', description: 'Git 레파지토리 주소')
|
||||
// }
|
||||
|
||||
// parameters {
|
||||
// choice(name: 'ENVIRONMENT', choices: ['stage'], description: '배포할 어플리케이션 profile 선택')
|
||||
// choice(name: 'DEPLOY_SERVER_IP', choices: ['10.100.51.11','10.100.51.12'], description: '배포할 WAS 서버 IP 선택')
|
||||
// string(name: 'GIT_REPO', defaultValue: 'http://172.31.18.11:3000/gcone/gconebo.git', description: 'Git 레파지토리 주소')
|
||||
// }
|
||||
|
||||
environment {
|
||||
SERVER_IP = "${DEPLOY_SERVER_IP}"
|
||||
SERVER_USER = "tomcat"
|
||||
TOMCAT_HOME = "${ENVIRONMENT == 'dev' ? '/var/lib/tomcat' : '/usr/local/tomcat'}"
|
||||
APP_NAME = "sakemall"
|
||||
ROOT_NAME = "ROOT"
|
||||
DEPLOY_PATH = "${TOMCAT_HOME}/webapps"
|
||||
PROPERTY_PATH = "${DEPLOY_PATH}/${APP_NAME}/WEB-INF/classes"
|
||||
BACKUP_PATH = "${DEPLOY_PATH}/backup"
|
||||
WAR_FILE = "${APP_NAME}.war"
|
||||
DEPLOY_FILE = "${DEPLOY_PATH}/${WAR_FILE}"
|
||||
BACKUP_FILE = "${BACKUP_PATH}/${WAR_FILE}.bak"
|
||||
PROPERTY_FILE = "${PROPERTY_PATH}/application-${ENVIRONMENT}.yml"
|
||||
GIT_BRANCH = "${ENVIRONMENT == 'dev' ? 'develop' : 'master'}"
|
||||
// SSH_KEY_PATH = "C:/Users/CHAMDAHAN-41/.ssh/id_rsa"
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Setup parameters') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
echo "Setup parameters ${ENVIRONMENT}"
|
||||
echo "tomcat home here ${env.TOMCAT_HOME}"
|
||||
|
||||
|
||||
if("${ENVIRONMENT}" == "dev" ) {
|
||||
properties([
|
||||
parameters([
|
||||
choice(name: 'ENVIRONMENT', choices: ['dev'], description: '배포할 어플리케이션 profile 선택'),
|
||||
choice(name: 'DEPLOY_SERVER_IP', choices: ['172.31.14.11'], description: '배포할 WAS 서버 IP 선택'),
|
||||
choice(name: 'DEPLOY_TARGET', choices: ['ALL', 'WEB_ONLY', 'WAS_ONLY', 'PROPERTY_ONLY'], description: '배포 대상 선택'),
|
||||
string(name: 'GIT_REPO', defaultValue: 'http://172.31.18.11:3000/gcone/gconebo.git', description: 'Git 레파지토리 주소')
|
||||
])
|
||||
])
|
||||
}else{
|
||||
properties([
|
||||
parameters([
|
||||
choice(name: 'ENVIRONMENT', choices: ['stage'], description: '배포할 어플리케이션 profile 선택'),
|
||||
choice(name: 'DEPLOY_SERVER_IP', choices: ['10.100.51.11','10.100.51.12'], description: '배포할 WAS 서버 IP 선택'),
|
||||
choice(name: 'DEPLOY_TARGET', choices: ['ALL', 'WEB_ONLY', 'WAS_ONLY', 'PROPERTY_ONLY'], description: '배포 대상 선택'),
|
||||
string(name: 'GIT_REPO', defaultValue: 'http://172.31.18.11:3000/gcone/gconebo.git', description: 'Git 레파지토리 주소')
|
||||
])
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
error "Checkout 실패: ${e.getMessage()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
echo "Checking out ${env.GIT_BRANCH} branch for ${params.ENVIRONMENT} environment"
|
||||
git branch: "${env.GIT_BRANCH}", url: "${params.GIT_REPO}"
|
||||
echo "Checkout 성공: 브랜치 ${env.GIT_BRANCH}, 저장소 ${params.GIT_REPO}"
|
||||
} catch (Exception e) {
|
||||
error "Checkout 실패: ${e.getMessage()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy only property') {
|
||||
when {
|
||||
expression { params.DEPLOY_TARGET in ['PROPERTY_ONLY'] }
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
sshPut remote: [
|
||||
name: 'WAS Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], from: "src/main/resources/application-${params.ENVIRONMENT}.yml", into: "${env.PROPERTY_FILE}"
|
||||
|
||||
// acutuator 호출
|
||||
sshCommand remote: [
|
||||
name: 'Nginx Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], command: "curl -X POST http://${env.SERVER_IP}:18210/actuator/refresh"
|
||||
|
||||
echo "application-${params.ENVIRONMENT}.yml 배포 완료"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// sh 'chmod +x gradlew'
|
||||
// sh "./gradlew clean war -x test -Pprofile=${params.ENVIRONMENT}"
|
||||
bat "./gradlew.bat clean build -Pprofile=${params.ENVIRONMENT}"
|
||||
echo "Build 성공"
|
||||
} catch (Exception e) {
|
||||
error "Build 실패: ${e.getMessage()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Unit Tests') {
|
||||
steps {
|
||||
script {
|
||||
try {
|
||||
// sh "./gradlew test"
|
||||
bat "./gradlew.bat test"
|
||||
echo "Unit Tests 성공"
|
||||
} catch (Exception e) {
|
||||
error "Unit Tests 실패: ${e.getMessage()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Backup') {
|
||||
steps {
|
||||
script {
|
||||
sshCommand remote: [
|
||||
name: 'WAS Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], command: """
|
||||
if [ -f ${env.DEPLOY_FILE} ]; then
|
||||
mkdir -p ${env.BACKUP_PATH}
|
||||
cp ${env.DEPLOY_FILE} ${env.BACKUP_FILE}
|
||||
rm -rf ${env.TOMCAT_HOME}/webapps/${env.WAR_FILE}
|
||||
echo "기존 WAR 파일 백업 완료"
|
||||
else
|
||||
echo "백업할 WAR 파일이 없습니다"
|
||||
fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy to Tomcat') {
|
||||
steps {
|
||||
script {
|
||||
sshPut remote: [
|
||||
name: 'WAS Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], from: "build/libs/${env.WAR_FILE}", into: "${env.DEPLOY_FILE}"
|
||||
|
||||
sshCommand remote: [
|
||||
name: 'WAS Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], command: """
|
||||
if nc -z localhost 8006; then
|
||||
echo "Tomcat이 실행 중입니다. 종료 중..."
|
||||
${env.TOMCAT_HOME}/bin/shutdown.sh
|
||||
sleep 60
|
||||
rm -rf ${env.TOMCAT_HOME}/webapps/${env.APP_NAME}
|
||||
rm -rf ${env.TOMCAT_HOME}/webapps/${env.ROOT_NAME}
|
||||
sleep 60
|
||||
else
|
||||
echo "Tomcat이 실행 중이지 않습니다."
|
||||
fi
|
||||
${env.TOMCAT_HOME}/bin/startup.sh
|
||||
"""
|
||||
|
||||
echo "Deploy 완료 (${params.ENVIRONMENT} 환경, ${env.GIT_BRANCH} 브랜치)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo '배포가 성공적으로 완료되었습니다.'
|
||||
}
|
||||
failure {
|
||||
script {
|
||||
echo '배포에 실패했습니다. 이전 버전으로 롤백을 시도합니다.'
|
||||
sshCommand remote: [
|
||||
name: 'WAS Server',
|
||||
host: "${env.SERVER_IP}",
|
||||
user: "${env.SERVER_USER}",
|
||||
identityFile: "${env.SSH_KEY_PATH}",
|
||||
allowAnyHosts: true
|
||||
], command: """
|
||||
if [ -f ${env.BACKUP_FILE} ]; then
|
||||
cp ${env.BACKUP_FILE} ${env.DEPLOY_FILE}
|
||||
if nc -z localhost 8006; then
|
||||
echo "Tomcat이 실행 중입니다. 종료 중..."
|
||||
${env.TOMCAT_HOME}/bin/shutdown.sh
|
||||
sleep 10
|
||||
else
|
||||
echo "Tomcat이 실행 중이지 않습니다."
|
||||
fi
|
||||
${env.TOMCAT_HOME}/bin/startup.sh
|
||||
echo "롤백 완료"
|
||||
else
|
||||
echo "백업 파일이 존재하지 않아 롤백할 수 없습니다."
|
||||
fi
|
||||
"""
|
||||
}
|
||||
}
|
||||
always {
|
||||
echo '파이프라인 실행이 종료되었습니다.'
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
248
gradlew
vendored
Normal file
248
gradlew
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
92
gradlew.bat
vendored
Normal file
92
gradlew.bat
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem 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, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
BIN
lib/SimpleCryptLib-1.1.0.jar
Normal file
BIN
lib/SimpleCryptLib-1.1.0.jar
Normal file
Binary file not shown.
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
||||
rootProject.name = 'gconebo'
|
||||
@@ -0,0 +1,274 @@
|
||||
|
||||
/**
|
||||
* MallServiceCallbackHandler.java
|
||||
*
|
||||
* This file was auto-generated from WSDL
|
||||
* by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST)
|
||||
*/
|
||||
|
||||
package com.nhncorp.platform.checkout;
|
||||
|
||||
/**
|
||||
* MallServiceCallbackHandler Callback class, Users can extend this class and implement
|
||||
* their own receiveResult and receiveError methods.
|
||||
*/
|
||||
public abstract class MallServiceCallbackHandler{
|
||||
|
||||
|
||||
|
||||
protected Object clientData;
|
||||
|
||||
/**
|
||||
* User can pass in any object that needs to be accessed once the NonBlocking
|
||||
* Web service call is finished and appropriate method of this CallBack is called.
|
||||
* @param clientData Object mechanism by which the user can pass in user data
|
||||
* that will be avilable at the time this callback is called.
|
||||
*/
|
||||
public MallServiceCallbackHandler(Object clientData){
|
||||
this.clientData = clientData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Please use this constructor if you don't want to set any clientData
|
||||
*/
|
||||
public MallServiceCallbackHandler(){
|
||||
this.clientData = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the client data
|
||||
*/
|
||||
|
||||
public Object getClientData() {
|
||||
return clientData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for reDeliveryExchange method
|
||||
* override this method for handling normal response from reDeliveryExchange operation
|
||||
*/
|
||||
public void receiveResultreDeliveryExchange(
|
||||
MallServiceStub.ReDeliveryExchangeResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from reDeliveryExchange operation
|
||||
*/
|
||||
public void receiveErrorreDeliveryExchange(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for shipProductOrder method
|
||||
* override this method for handling normal response from shipProductOrder operation
|
||||
*/
|
||||
public void receiveResultshipProductOrder(
|
||||
MallServiceStub.ShipProductOrderResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from shipProductOrder operation
|
||||
*/
|
||||
public void receiveErrorshipProductOrder(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for cancelSale method
|
||||
* override this method for handling normal response from cancelSale operation
|
||||
*/
|
||||
public void receiveResultcancelSale(
|
||||
MallServiceStub.CancelSaleResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from cancelSale operation
|
||||
*/
|
||||
public void receiveErrorcancelSale(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for requestReturn method
|
||||
* override this method for handling normal response from requestReturn operation
|
||||
*/
|
||||
public void receiveResultrequestReturn(
|
||||
MallServiceStub.RequestReturnResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from requestReturn operation
|
||||
*/
|
||||
public void receiveErrorrequestReturn(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for getMigratedProductOrderList method
|
||||
* override this method for handling normal response from getMigratedProductOrderList operation
|
||||
*/
|
||||
public void receiveResultgetMigratedProductOrderList(
|
||||
MallServiceStub.GetMigratedProductOrderListResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from getMigratedProductOrderList operation
|
||||
*/
|
||||
public void receiveErrorgetMigratedProductOrderList(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for approveCollectedExchange method
|
||||
* override this method for handling normal response from approveCollectedExchange operation
|
||||
*/
|
||||
public void receiveResultapproveCollectedExchange(
|
||||
MallServiceStub.ApproveCollectedExchangeResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from approveCollectedExchange operation
|
||||
*/
|
||||
public void receiveErrorapproveCollectedExchange(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for getProductOrderInfoList method
|
||||
* override this method for handling normal response from getProductOrderInfoList operation
|
||||
*/
|
||||
public void receiveResultgetProductOrderInfoList(
|
||||
MallServiceStub.GetProductOrderInfoListResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from getProductOrderInfoList operation
|
||||
*/
|
||||
public void receiveErrorgetProductOrderInfoList(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for approveExchangeApplication method
|
||||
* override this method for handling normal response from approveExchangeApplication operation
|
||||
*/
|
||||
public void receiveResultapproveExchangeApplication(
|
||||
MallServiceStub.ApproveExchangeApplicationResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from approveExchangeApplication operation
|
||||
*/
|
||||
public void receiveErrorapproveExchangeApplication(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for getPurchaseReviewList method
|
||||
* override this method for handling normal response from getPurchaseReviewList operation
|
||||
*/
|
||||
public void receiveResultgetPurchaseReviewList(
|
||||
MallServiceStub.GetPurchaseReviewListResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from getPurchaseReviewList operation
|
||||
*/
|
||||
public void receiveErrorgetPurchaseReviewList(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for getChangedProductOrderList method
|
||||
* override this method for handling normal response from getChangedProductOrderList operation
|
||||
*/
|
||||
public void receiveResultgetChangedProductOrderList(
|
||||
MallServiceStub.GetChangedProductOrderListResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from getChangedProductOrderList operation
|
||||
*/
|
||||
public void receiveErrorgetChangedProductOrderList(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for placeProductOrder method
|
||||
* override this method for handling normal response from placeProductOrder operation
|
||||
*/
|
||||
public void receiveResultplaceProductOrder(
|
||||
MallServiceStub.PlaceProductOrderResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from placeProductOrder operation
|
||||
*/
|
||||
public void receiveErrorplaceProductOrder(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for approveReturnApplication method
|
||||
* override this method for handling normal response from approveReturnApplication operation
|
||||
*/
|
||||
public void receiveResultapproveReturnApplication(
|
||||
MallServiceStub.ApproveReturnApplicationResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from approveReturnApplication operation
|
||||
*/
|
||||
public void receiveErrorapproveReturnApplication(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for approveCancelApplication method
|
||||
* override this method for handling normal response from approveCancelApplication operation
|
||||
*/
|
||||
public void receiveResultapproveCancelApplication(
|
||||
MallServiceStub.ApproveCancelApplicationResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from approveCancelApplication operation
|
||||
*/
|
||||
public void receiveErrorapproveCancelApplication(Exception e) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 call back method for delayProductOrder method
|
||||
* override this method for handling normal response from delayProductOrder operation
|
||||
*/
|
||||
public void receiveResultdelayProductOrder(
|
||||
MallServiceStub.DelayProductOrderResponseE result
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* auto generated Axis2 Error handler
|
||||
* override this method for handling error response from delayProductOrder operation
|
||||
*/
|
||||
public void receiveErrordelayProductOrder(Exception e) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
71435
src/main/java/com/nhncorp/platform/checkout/MallServiceStub.java
Normal file
71435
src/main/java/com/nhncorp/platform/checkout/MallServiceStub.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
||||
package com.wb.domainserver;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
public class DomainserverApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(DomainserverApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DomainserverApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
|
||||
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
|
||||
|
||||
@Configuration
|
||||
@EnableSchedulerLock(defaultLockAtMostFor = "10m") // 최대 잠금 시간
|
||||
public class BnftShedLockConfig {
|
||||
|
||||
@Bean
|
||||
public JdbcTemplateLockProvider lockProvider(DataSource dataSource) {
|
||||
return new JdbcTemplateLockProvider(
|
||||
JdbcTemplateLockProvider.Configuration.builder()
|
||||
.withTableName("gc_benefit_shedlock")
|
||||
.withJdbcTemplate(new JdbcTemplate(dataSource))
|
||||
.usingDbTime()
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import com.google.auth.oauth2.GoogleCredentials;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.FirebaseOptions;
|
||||
import com.google.firebase.messaging.FirebaseMessaging;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class FCMConfig {
|
||||
|
||||
@Bean(name = "NCFirebaseMessaging")
|
||||
public FirebaseMessaging nutricoreFirebaseMessaging() throws IOException {
|
||||
return createFirebaseMessaging(
|
||||
"nutricoreeventapp-firebase-adminsdk-iliil-bd9d39ca9c.json",
|
||||
"nutricore"
|
||||
);
|
||||
}
|
||||
|
||||
@Bean(name = "DTFirebaseMessaging")
|
||||
public FirebaseMessaging doctorleanFirebaseMessaging() throws IOException {
|
||||
return createFirebaseMessaging(
|
||||
"doctorleaneventapp-firebase-adminsdk-ysdbz-3e5496cb84.json",
|
||||
"doctorlean"
|
||||
);
|
||||
}
|
||||
|
||||
private FirebaseMessaging createFirebaseMessaging(String fileName, String appName) throws IOException {
|
||||
ClassPathResource serviceAccount = new ClassPathResource("firebase/" + fileName);
|
||||
|
||||
FirebaseOptions options = new FirebaseOptions.Builder()
|
||||
.setCredentials(GoogleCredentials.fromStream(serviceAccount.getInputStream()))
|
||||
.build();
|
||||
|
||||
FirebaseApp firebaseApp;
|
||||
if (FirebaseApp.getApps().stream().noneMatch(app -> app.getName().equals(appName))) {
|
||||
// FirebaseApp이 존재하지 않으면 새로 초기화
|
||||
firebaseApp = FirebaseApp.initializeApp(options, appName);
|
||||
} else {
|
||||
// 이미 초기화된 FirebaseApp 사용
|
||||
firebaseApp = FirebaseApp.getInstance(appName);
|
||||
}
|
||||
|
||||
return FirebaseMessaging.getInstance(firebaseApp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 멀티 DataSource 구성을 위한 설정 파일
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(
|
||||
basePackages = {
|
||||
"com.wb.domainserver.domain.admin"
|
||||
,"com.wb.domainserver.domain.gcone"
|
||||
,"com.wb.domainserver.domain.itrnt"
|
||||
,"com.wb.domainserver.domain.extra"
|
||||
,"com.wb.domainserver.domain.sample"
|
||||
,"com.wb.domainserver.domain.auth"
|
||||
,"com.wb.domainserver.domain.crm"
|
||||
,"com.wb.domainserver.domain.frstlogin"
|
||||
,"com.wb.domainserver.domain.log"
|
||||
,"com.wb.domainserver.domain.mngr"
|
||||
,"com.wb.domainserver.domain.oper"
|
||||
,"com.wb.domainserver.domain.sopmal"
|
||||
,"com.wb.domainserver.security.user"
|
||||
,"com.wb.domainserver.security.jwt"
|
||||
// ,"com.wb.domainserver.domain.ntcn"
|
||||
// ,"com.wb.domainserver.batch.atmcsetle"
|
||||
},
|
||||
sqlSessionFactoryRef = "ASqlSessionFactory"
|
||||
)
|
||||
public class GconeDataSourceConfig {
|
||||
|
||||
private final String G_DATA_SOURCE = "GconeDataSource";
|
||||
|
||||
@Primary
|
||||
@Bean(name = G_DATA_SOURCE)
|
||||
@ConfigurationProperties(prefix = "spring.datasource.gcone.hikari")
|
||||
public DataSource ADataSource() {
|
||||
return DataSourceBuilder.create()
|
||||
.type(HikariDataSource.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "ASqlSessionFactory")
|
||||
public SqlSessionFactory ASqlSessionFactory(@Qualifier(G_DATA_SOURCE) DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource[] resources1 = resolver.getResources("classpath:mybatis/xml/mapper/admin/**/*.xml");
|
||||
Resource[] resources2 = resolver.getResources("classpath:mybatis/xml/mapper/gcone/**/*.xml");
|
||||
Resource[] resources3 = resolver.getResources("classpath:mybatis/xml/mapper/itrnt/**/*.xml");
|
||||
Resource[] resources4 = resolver.getResources("classpath:mybatis/xml/mapper/*.xml");
|
||||
// Resource[] resources4 = resolver.getResources("classpath:mybatis/xml/mapper/SecurityMapper.xml");
|
||||
Resource[] resources5 = resolver.getResources("classpath:mybatis/xml/mapper/extra/**/*.xml");
|
||||
|
||||
Resource[] allResources = new Resource[resources1.length + resources2.length + resources3.length + resources4.length + resources5.length];
|
||||
System.arraycopy(resources1, 0, allResources, 0, resources1.length);
|
||||
System.arraycopy(resources2, 0, allResources, resources1.length, resources2.length);
|
||||
System.arraycopy(resources3, 0, allResources, resources1.length + resources2.length, resources3.length);
|
||||
System.arraycopy(resources4, 0, allResources, resources1.length + resources2.length + resources3.length, resources4.length);
|
||||
System.arraycopy(resources5, 0, allResources, resources1.length + resources2.length + resources3.length + resources4.length, resources5.length);
|
||||
|
||||
sessionFactoryBean.setMapperLocations(allResources);
|
||||
|
||||
Resource myBatisConfig = new PathMatchingResourcePatternResolver().getResource("classpath:mybatis/xml/config/mapper-config.xml");
|
||||
sessionFactoryBean.setConfigLocation(myBatisConfig);
|
||||
|
||||
return sessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Primary
|
||||
@Bean(name = "ATransactionManager")
|
||||
public DataSourceTransactionManager ATransactionManager(@Qualifier(G_DATA_SOURCE) DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
public class RefreshableSqlSessionFactoryBean extends SqlSessionFactoryBean implements DisposableBean {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(RefreshableSqlSessionFactoryBean.class);
|
||||
private SqlSessionFactory proxy;
|
||||
private int interval = 1000;
|
||||
private Timer timer;
|
||||
private TimerTask task;
|
||||
private Resource[] mapperLocations;
|
||||
private boolean running = false;
|
||||
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
|
||||
private final Lock r = rwl.readLock();
|
||||
private final Lock w = rwl.writeLock();
|
||||
|
||||
public void setMapperLocations(Resource[] mapperLocations) {
|
||||
super.setMapperLocations(mapperLocations);
|
||||
this.mapperLocations = mapperLocations;
|
||||
}
|
||||
|
||||
public void setInterval(int interval) {
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
public void refresh() throws Exception {
|
||||
w.lock();
|
||||
try {
|
||||
super.afterPropertiesSet();
|
||||
} finally {
|
||||
w.unlock();
|
||||
}
|
||||
LOG.info("sqlMapClient refreshed.");
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
private void setRefreshable() {
|
||||
proxy = (SqlSessionFactory) Proxy.newProxyInstance(SqlSessionFactory.class.getClassLoader(), new Class[]{SqlSessionFactory.class}, new InvocationHandler() {
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
return method.invoke(getParentObject(), args);
|
||||
}
|
||||
});
|
||||
task = new TimerTask() {
|
||||
private Map<Resource, Long> map = new HashMap<Resource, Long>();
|
||||
|
||||
public void run() {
|
||||
if (isModified()) {
|
||||
try {
|
||||
refresh();
|
||||
} catch (Exception e) {
|
||||
LOG.error("caught exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isModified() {
|
||||
boolean retVal = false;
|
||||
if (mapperLocations != null) {
|
||||
for (int i = 0; i < mapperLocations.length; i++) {
|
||||
Resource mappingLocation = mapperLocations[i];
|
||||
retVal |= findModifiedResource(mappingLocation);
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private boolean findModifiedResource(Resource resource) {
|
||||
boolean retVal = false;
|
||||
List<String> modifiedResources = new ArrayList<String>();
|
||||
try {
|
||||
long modified = resource.lastModified();
|
||||
if (map.containsKey(resource)) {
|
||||
long lastModified = map.get(resource).longValue();
|
||||
if (lastModified != modified) {
|
||||
map.put(resource, modified);
|
||||
modifiedResources.add(resource.getDescription());
|
||||
retVal = true;
|
||||
}
|
||||
} else {
|
||||
map.put(resource, modified);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("caught exception", e);
|
||||
}
|
||||
if (retVal) {
|
||||
LOG.info("modified files : " + modifiedResources);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
};
|
||||
timer = new Timer(true);
|
||||
resetInterval();
|
||||
}
|
||||
|
||||
private Object getParentObject() throws Exception {
|
||||
r.lock();
|
||||
try {
|
||||
return super.getObject();
|
||||
} finally {
|
||||
r.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public SqlSessionFactory getObject() throws Exception {
|
||||
if (this.proxy == null) {
|
||||
setRefreshable();
|
||||
}
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
public Class<? extends SqlSessionFactory> getObjectType() {
|
||||
return (this.proxy != null ? this.proxy.getClass() : SqlSessionFactory.class);
|
||||
}
|
||||
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setCheckInterval(int ms) {
|
||||
interval = ms;
|
||||
if (timer != null) {
|
||||
resetInterval();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetInterval() {
|
||||
if (running) {
|
||||
timer.cancel();
|
||||
running = false;
|
||||
}
|
||||
if (interval > 0) {
|
||||
timer.schedule(task, 0, interval);
|
||||
running = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() throws Exception {
|
||||
timer.cancel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import com.wb.domainserver.security.config.AdminWebMvcConfig;
|
||||
import com.wb.domainserver.security.config.CommWebMvcConfig;
|
||||
import com.wb.domainserver.security.config.WebMvcConfig;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
import org.springframework.web.servlet.DispatcherServlet;
|
||||
|
||||
@Configuration
|
||||
public class ServletContextConfig {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<DispatcherServlet> sopmalServlet(ApplicationContext parent) {
|
||||
AnnotationConfigWebApplicationContext sopmalContext = new AnnotationConfigWebApplicationContext();
|
||||
sopmalContext.setParent(parent); // Root Context 상속
|
||||
sopmalContext.register(CommWebMvcConfig.class);
|
||||
sopmalContext.register(WebMvcConfig.class);
|
||||
|
||||
DispatcherServlet servlet = new DispatcherServlet(sopmalContext);
|
||||
ServletRegistrationBean<DispatcherServlet> registration = new ServletRegistrationBean<>(servlet, "/sopmal","/sopmal/**");
|
||||
registration.setName("sopmalServlet");
|
||||
return registration;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean<DispatcherServlet> adminServlet(ApplicationContext parent) {
|
||||
AnnotationConfigWebApplicationContext adminContext = new AnnotationConfigWebApplicationContext();
|
||||
adminContext.setParent(parent); // Root Context 상속
|
||||
adminContext.register(CommWebMvcConfig.class);
|
||||
adminContext.register(AdminWebMvcConfig.class);
|
||||
|
||||
DispatcherServlet servlet = new DispatcherServlet(adminContext);
|
||||
ServletRegistrationBean<DispatcherServlet> registration = new ServletRegistrationBean<>(servlet, "/admin/**", "/mngr/**", "/mngr","/admin");
|
||||
registration.setName("adminServlet");
|
||||
return registration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.wb.domainserver.common.config;
|
||||
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 멀티 DataSource 구성을 위한 설정 파일
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = "com.wb.domainserver.domain.sure", sqlSessionFactoryRef = "BSqlSessionFactory")
|
||||
public class SureDataSourceConfig {
|
||||
|
||||
private final String B_DATA_SOURCE = "BDataSource";
|
||||
|
||||
@Bean(name = B_DATA_SOURCE)
|
||||
@ConfigurationProperties(prefix = "spring.datasource.sure.hikari")
|
||||
public DataSource BDataSource() {
|
||||
return DataSourceBuilder.create()
|
||||
.type(HikariDataSource.class)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean(name = "BSqlSessionFactory")
|
||||
public SqlSessionFactory BSqlSessionFactory(@Qualifier(B_DATA_SOURCE) DataSource dataSource) throws Exception {
|
||||
SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
|
||||
sessionFactoryBean.setDataSource(dataSource);
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource configLocation = resolver.getResource("classpath:mybatis/xml/config/mapper-config.xml");
|
||||
sessionFactoryBean.setConfigLocation(configLocation);
|
||||
|
||||
Resource[] resources = resolver.getResources("classpath*:mybatis/xml/mapper/sure/**/*.xml");
|
||||
sessionFactoryBean.setMapperLocations(resources);
|
||||
|
||||
return sessionFactoryBean.getObject();
|
||||
}
|
||||
|
||||
@Bean(name = "BTransactionManager")
|
||||
public DataSourceTransactionManager BTransactionManager(@Qualifier(B_DATA_SOURCE) DataSource dataSource) {
|
||||
return new DataSourceTransactionManager(dataSource);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//@Configuration
|
||||
//@MapperScan(value = "com.wb.domainserver.domain.sure", sqlSessionFactoryRef = "BSqlSessionFactory")
|
||||
//public class SureDataSourceConfig {
|
||||
//
|
||||
//
|
||||
// private final String sureDataSource = "SureDataSource";
|
||||
//
|
||||
// @Bean(sureDataSource)
|
||||
// @ConfigurationProperties(prefix = "spring.datasource.sure.hikari")
|
||||
// public DataSource BDataSource() {
|
||||
// return DataSourceBuilder.create()
|
||||
// .type(HikariDataSource.class)
|
||||
// .build();
|
||||
// }
|
||||
//
|
||||
// @Bean
|
||||
// public SqlSessionFactory BSqlSessionFactory(@Qualifier(sureDataSource) DataSource dataSource) throws Exception {
|
||||
// /*
|
||||
// * MyBatis 는 JdbcTemplate 대신 Connection 객체를 통한 질의를 위해서 SqlSession 을 사용한다.
|
||||
// * 내부적으로 SqlSessionTemplate 가 SqlSession 을 구현한다.
|
||||
// * Thread-Safe 하고 여러 개의 Mapper 에서 공유할 수 있다.
|
||||
// */
|
||||
// SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
|
||||
// bean.setDataSource(dataSource);
|
||||
//
|
||||
// // MyBatis Mapper Source
|
||||
// // MyBatis 의 SqlSession 에서 불러올 쿼리 정보
|
||||
// Resource[] res = new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/xml/mapper/sure/**/*.xml");
|
||||
// bean.setMapperLocations(res);
|
||||
//
|
||||
// // MyBatis Config Setting
|
||||
// // MyBatis 설정 파일
|
||||
// Resource myBatisConfig = new PathMatchingResourcePatternResolver().getResource("classpath:mybatis/xml/config/mapper-config.xml");
|
||||
// bean.setConfigLocation(myBatisConfig);
|
||||
//
|
||||
// return bean.getObject();
|
||||
// }
|
||||
//
|
||||
// // DataSource 에서 Transaction 관리를 위한 Manager 클래스 등록
|
||||
// @Bean(name = "sureTransactionManager")
|
||||
// public DataSourceTransactionManager BTransactionManager(@Qualifier(sureDataSource) DataSource dataSource) {
|
||||
// return new DataSourceTransactionManager(dataSource);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.wb.domainserver.common.msg;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 메세지 처리를 지원하는 Object
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-28
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-28 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class GconeMessageSource extends ReloadableResourceBundleMessageSource implements MessageSource {
|
||||
|
||||
private ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @param reloadableResourceBundleMessageSource - resource MessageSource
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public void setReloadableResourceBundleMessageSource(ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource) {
|
||||
this.reloadableResourceBundleMessageSource = reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
||||
return reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 정의된 메세지 조회
|
||||
* @param code - 메세지 코드
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage(String code) {
|
||||
return getReloadableResourceBundleMessageSource().getMessage(code, null, Locale.getDefault());
|
||||
}
|
||||
|
||||
/**
|
||||
* 정의된 메세지 조회
|
||||
* @param code 메시지 코드
|
||||
* @param args 변환 변수
|
||||
* @return String 메시지문자열
|
||||
*/
|
||||
public String getMessage(String code, Object[] args) {
|
||||
return getReloadableResourceBundleMessageSource().getMessage(code, args, Locale.getDefault());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.wb.domainserver.common.mvc.tags.ui.pagination;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 페이징 처리를 위한 데이터 처리용 Bean
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class PaginationInfo implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 현재 페이지 번호. */
|
||||
private int currentPageNo;
|
||||
/** 한 페이지당 게시되는 게시물 건 수 */
|
||||
private int recordCountPerPage;
|
||||
/** 한 페이지당 게시되는 게시물 건 수 */
|
||||
private int pageSize;
|
||||
/** 페이지 리스트에 게시되는 페이지 건수 */
|
||||
private int totalRecordCount;
|
||||
|
||||
public int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
public void setRecordCountPerPage(int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getCurrentPageNo() {
|
||||
return currentPageNo;
|
||||
}
|
||||
|
||||
public void setCurrentPageNo(int currentPageNo) {
|
||||
this.currentPageNo = currentPageNo;
|
||||
}
|
||||
|
||||
public void setTotalRecordCount(int totalRecordCount) {
|
||||
this.totalRecordCount = totalRecordCount;
|
||||
}
|
||||
|
||||
public int getTotalRecordCount() {
|
||||
return totalRecordCount;
|
||||
}
|
||||
|
||||
/** 페이지 개수 */
|
||||
private int totalPageCount;
|
||||
/** 페이지 리스트의 첫 페이지 번호 */
|
||||
private int firstPageNoOnPageList;
|
||||
/** 페이지 리스트의 마지막 페이지 번호 */
|
||||
private int lastPageNoOnPageList;
|
||||
/** 페이징 SQL의 조건절에 사용되는 시작 rownum */
|
||||
private int firstRecordIndex;
|
||||
/** 페이징 SQL의 조건절에 사용되는 마지막 rownum */
|
||||
private int lastRecordIndex;
|
||||
|
||||
public int getTotalPageCount() {
|
||||
BigDecimal totalRecordCount = new BigDecimal(getTotalRecordCount());
|
||||
BigDecimal recordCountPerPage = new BigDecimal(getRecordCountPerPage());
|
||||
|
||||
BigDecimal totalPageCount = totalRecordCount.divide(recordCountPerPage, RoundingMode.CEILING);
|
||||
return totalPageCount.intValue();
|
||||
}
|
||||
|
||||
public int getFirstPageNo() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getLastPageNo() {
|
||||
return getTotalPageCount();
|
||||
}
|
||||
|
||||
public int getFirstPageNoOnPageList() {
|
||||
firstPageNoOnPageList = ((getCurrentPageNo() - 1) / getPageSize()) * getPageSize() + 1;
|
||||
return firstPageNoOnPageList;
|
||||
}
|
||||
|
||||
public int getLastPageNoOnPageList() {
|
||||
lastPageNoOnPageList = getFirstPageNoOnPageList() + getPageSize() - 1;
|
||||
if (lastPageNoOnPageList > getTotalPageCount()) {
|
||||
lastPageNoOnPageList = getTotalPageCount();
|
||||
}
|
||||
return lastPageNoOnPageList;
|
||||
}
|
||||
|
||||
public int getFirstRecordIndex() {
|
||||
firstRecordIndex = (getCurrentPageNo() - 1) * getRecordCountPerPage();
|
||||
return firstRecordIndex;
|
||||
}
|
||||
|
||||
public int getLastRecordIndex() {
|
||||
lastRecordIndex = getCurrentPageNo() * getRecordCountPerPage();
|
||||
return lastRecordIndex;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.wb.domainserver.common.prop;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 페이징 처리를 위한 properties
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-27
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-27 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "pagination")
|
||||
@Component
|
||||
public class PaginationProperties {
|
||||
/** 한 페이지당 게시되는 게시물 건 수 */
|
||||
private Integer pageUnit;
|
||||
/** 한 페이지당 노출되는 페이지 수 */
|
||||
private Integer pageSize;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.wb.domainserver.common.prop;
|
||||
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RefreshScope
|
||||
@Component
|
||||
public class PropertyService {
|
||||
|
||||
private static Environment env = null;
|
||||
|
||||
@Autowired
|
||||
public PropertyService(Environment env) {
|
||||
PropertyService.env = env;
|
||||
}
|
||||
|
||||
public static String getProperty() {
|
||||
return env.getProperty("prop.test");
|
||||
}
|
||||
|
||||
/**
|
||||
* pos-milege 프로퍼티 조회
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyMlgValue(String corpNm, String propertyNm) {
|
||||
String propertyPath = String.format("pos-mileage.%s.%s", corpNm, propertyNm);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* pos-milege 프로퍼티 List<DataMap> 형식으로 전환
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static List<DataMap> getPropertyValueToMapList(String corpNm, String propertyNm) {
|
||||
String propertyPath = String.format("pos-mileage.%s.%s", corpNm, propertyNm);
|
||||
String propertyValue = env.getProperty(propertyPath);
|
||||
|
||||
List<DataMap> resultList = new ArrayList<DataMap>();
|
||||
|
||||
String[] entries = propertyValue.split(",\\s*");
|
||||
for (String entry : entries) {
|
||||
DataMap resultMap = new DataMap();
|
||||
String[] keyValue = entry.split(":\\s*");
|
||||
if (keyValue.length == 2) {
|
||||
resultMap.put(keyValue[0], keyValue[1]);
|
||||
resultList.add(resultMap);
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* surem yaml 프로퍼티 조회
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertySuremSopMal(String sopmalCd, String propertyNm) {
|
||||
String propertyPath = String.format("surem.sopmal.%s.%s", sopmalCd, propertyNm);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 기본
|
||||
* basePath depth1.depth2....
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getProperty(String basePath) {
|
||||
return env.getProperty(basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 1개
|
||||
* basePath depth1.%s
|
||||
* path depth2
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyOne(String basePath, String path) {
|
||||
String propertyPath = String.format(basePath, path);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 2개
|
||||
* basePath depth1.%s.%s
|
||||
* path depth2, depth3
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyTwo(String basePath, String path1, String path2) {
|
||||
String propertyPath = String.format(basePath, path1, path2);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 3개
|
||||
* basePath depth1.%s.%s.%s
|
||||
* path depth2, depth3, depth4
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyThree(String basePath, String path1, String path2, String path3) {
|
||||
String propertyPath = String.format(basePath, path1, path2, path3);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 4개
|
||||
* basePath depth1.%s.%s.%s.%s
|
||||
* path depth2, depth3, depth4, depth5
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyFour(String basePath, String path1, String path2, String path3, String path4) {
|
||||
String propertyPath = String.format(basePath, path1, path2, path3, path4);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 공통 yaml 프로퍼티 조회 파라미터 4개
|
||||
* basePath depth1.%s.%s.%s.%s
|
||||
* path depth2, depth3, depth4, depth5
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static String getPropertyBankdaAccount(String key) {
|
||||
String propertyPath = String.format("bankda.%s", key);
|
||||
return env.getProperty(propertyPath);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.wb.domainserver.common.ui;
|
||||
|
||||
import com.wb.domainserver.common.ui.pagination.*;
|
||||
import com.wb.domainserver.common.ui.pagination.DefaultPaginationManager;
|
||||
import com.wb.domainserver.common.ui.pagination.DefaultPaginationRenderer;
|
||||
import com.wb.domainserver.common.ui.pagination.PaginationManager;
|
||||
import com.wb.domainserver.common.ui.pagination.PaginationRenderer;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.jsp.JspException;
|
||||
import jakarta.servlet.jsp.JspWriter;
|
||||
import jakarta.servlet.jsp.tagext.TagSupport;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
import org.springframework.web.servlet.support.RequestContextUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PaginationTag extends TagSupport {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private PaginationInfo paginationInfo;
|
||||
private String type;
|
||||
private String jsFunction;
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
|
||||
try {
|
||||
JspWriter out = pageContext.getOut();
|
||||
PaginationManager paginationManager;
|
||||
WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());
|
||||
WebApplicationContext ctxd = RequestContextUtils.findWebApplicationContext((HttpServletRequest) pageContext.getRequest(), pageContext.getServletContext());
|
||||
|
||||
if (ctx.containsBean("paginationManager")) {
|
||||
paginationManager = (PaginationManager) ctx.getBean("paginationManager");
|
||||
} else if (ctxd.containsBean("paginationManager")) {
|
||||
paginationManager = (PaginationManager) ctxd.getBean("paginationManager");
|
||||
} else {
|
||||
//bean 정의가 없다면 DefaultPaginationManager를 사용. 빈설정이 없으면 기본 적인 페이징 리스트라도 보여주기 위함.
|
||||
paginationManager = new DefaultPaginationManager();
|
||||
}
|
||||
PaginationRenderer paginationRenderer = null;
|
||||
String rentererType = !StringUtil.isEmpty(type)? type :"";
|
||||
paginationRenderer = paginationManager.getRendererType(rentererType);
|
||||
|
||||
if(paginationRenderer!=null){
|
||||
String contents = paginationRenderer.renderPagination(paginationInfo, jsFunction);
|
||||
out.println(contents);
|
||||
}else{
|
||||
paginationRenderer = new DefaultPaginationRenderer();
|
||||
String contents = paginationRenderer.renderPagination(paginationInfo, jsFunction);
|
||||
out.println(contents);
|
||||
}
|
||||
|
||||
return EVAL_PAGE;
|
||||
} catch (IOException e) {
|
||||
throw new JspException();
|
||||
}
|
||||
}
|
||||
|
||||
public void setJsFunction(String jsFunction) {
|
||||
this.jsFunction = jsFunction;
|
||||
}
|
||||
|
||||
public void setPaginationInfo(PaginationInfo paginationInfo) {
|
||||
this.paginationInfo = paginationInfo;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* 인터페이스 PaginationRenderer의 구현 추상클래스.
|
||||
* 기본적인 페이징 기능이 구현되어 있으며, 화면에서 아래와 같이 display 된다.
|
||||
*
|
||||
* [처음][이전] 1 2 3 4 5 6 7 8 [다음][마지막]
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public abstract class AbstractPaginationRenderer implements PaginationRenderer {
|
||||
|
||||
/** [처음] 영역에 노출될 문자 */
|
||||
protected String firstPageLabel;
|
||||
/** [이전] 영역에 노출될 문자 */
|
||||
protected String previousPageLabel;
|
||||
/** 현재페이지 영역에 노출될 문자 */
|
||||
protected String currentPageLabel;
|
||||
/** 다른페이지 영역에 노출될 문자 */
|
||||
protected String otherPageLabel;
|
||||
/** [다음] 영역에 노출될 문자 */
|
||||
protected String nextPageLabel;
|
||||
/** [마지막] 영역에 노출될 문자 */
|
||||
protected String lastPageLabel;
|
||||
|
||||
/**
|
||||
* 페이징영역 렌더링
|
||||
* @param PaginationInfo 페이징처리정보
|
||||
* @param String 페이지 이동 스크립트 함수명
|
||||
* @return String 화면에 노출될 Tag 문자열
|
||||
*/
|
||||
public String renderPagination(PaginationInfo paginationInfo, String jsFunction) {
|
||||
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
|
||||
strBuff.append("<div class=\"pagination\">");
|
||||
|
||||
int firstPageNo = paginationInfo.getFirstPageNo();
|
||||
int firstPageNoOnPageList = paginationInfo.getFirstPageNoOnPageList();
|
||||
int totalPageCount = paginationInfo.getTotalPageCount();
|
||||
int pageSize = paginationInfo.getPageSize();
|
||||
int lastPageNoOnPageList = paginationInfo.getLastPageNoOnPageList();
|
||||
int currentPageNo = paginationInfo.getCurrentPageNo();
|
||||
int lastPageNo = paginationInfo.getLastPageNo();
|
||||
|
||||
if (totalPageCount > pageSize) {
|
||||
if (firstPageNoOnPageList > pageSize) {
|
||||
strBuff.append(MessageFormat.format(firstPageLabel, new Object[] { jsFunction, Integer.toString(firstPageNo) }));
|
||||
strBuff.append(MessageFormat.format(previousPageLabel, new Object[] { jsFunction, Integer.toString(firstPageNoOnPageList - 1) }));
|
||||
} else {
|
||||
strBuff.append(MessageFormat.format(firstPageLabel, new Object[] { jsFunction, Integer.toString(firstPageNo) }));
|
||||
strBuff.append(MessageFormat.format(previousPageLabel, new Object[] { jsFunction, Integer.toString(firstPageNo) }));
|
||||
}
|
||||
}
|
||||
|
||||
strBuff.append("<ol class=\"pagination__number-group\">");
|
||||
for (int i = firstPageNoOnPageList; i <= lastPageNoOnPageList; i++) {
|
||||
if (i == currentPageNo) {
|
||||
strBuff.append(MessageFormat.format(currentPageLabel, new Object[] { Integer.toString(i) }));
|
||||
} else {
|
||||
strBuff.append(MessageFormat.format(otherPageLabel, new Object[] { jsFunction, Integer.toString(i), Integer.toString(i) }));
|
||||
}
|
||||
}
|
||||
|
||||
if (totalPageCount > pageSize) {
|
||||
if (lastPageNoOnPageList < totalPageCount) {
|
||||
strBuff.append(MessageFormat.format(nextPageLabel, new Object[] { jsFunction, Integer.toString(firstPageNoOnPageList + pageSize) }));
|
||||
strBuff.append(MessageFormat.format(lastPageLabel, new Object[] { jsFunction, Integer.toString(lastPageNo) }));
|
||||
} else {
|
||||
strBuff.append(MessageFormat.format(nextPageLabel, new Object[] { jsFunction, Integer.toString(lastPageNo) }));
|
||||
strBuff.append(MessageFormat.format(lastPageLabel, new Object[] { jsFunction, Integer.toString(lastPageNo) }));
|
||||
}
|
||||
}
|
||||
strBuff.append("</ol>");
|
||||
strBuff.append("</div>");
|
||||
return strBuff.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DefaultPaginationManager implements PaginationManager {
|
||||
|
||||
private Map<String, PaginationRenderer> rendererType;
|
||||
|
||||
/**
|
||||
* Set PaginationRenderer 구현 클래스
|
||||
* @param rendererType - PaginationRenderer 구현 클래스 집합 Map.
|
||||
*/
|
||||
public void setRendererType(Map<String, PaginationRenderer> rendererType) {
|
||||
this.rendererType = rendererType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type - tag의 파라미터 값.
|
||||
*/
|
||||
public PaginationRenderer getRendererType(String type) {
|
||||
return (rendererType != null && rendererType.containsKey(type)) ? (PaginationRenderer) rendererType.get(type) : new DefaultPaginationRenderer();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
/**
|
||||
* 페이징 리스트의 기본적인 포맷을 제공한다.
|
||||
* 이를 위해 AbstractPaginationRenderer의 클래스 변수들의 값을 세팅한다.
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class DefaultPaginationRenderer extends AbstractPaginationRenderer {
|
||||
|
||||
public DefaultPaginationRenderer() {
|
||||
firstPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">[처음]</a> ";
|
||||
previousPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">[이전]</a> ";
|
||||
currentPageLabel = "<strong>{0}</strong> ";
|
||||
otherPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">{2}</a> ";
|
||||
nextPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">[다음]</a> ";
|
||||
lastPageLabel = "<a href=\"#\" onclick=\"{0}({1}); return false;\">[마지막]</a> ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String renderPagination(PaginationInfo paginationInfo, String jsFunction) {
|
||||
return super.renderPagination(paginationInfo, jsFunction);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
import jakarta.servlet.ServletContext;
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
|
||||
/**
|
||||
* image pagination renderer Bean
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware {
|
||||
|
||||
// private ServletContext servletContext;
|
||||
|
||||
public ImagePaginationRenderer() {
|
||||
|
||||
}
|
||||
|
||||
public void initVariables(){
|
||||
//firstPageLabel = "<li> </li><li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prevend.gif\" alt=\"처음\" border=\"0\"/></a></li>";
|
||||
firstPageLabel = "<button class=\"pagination__item first\" onclick=\"{0}({1});return false; \"><span class=\"visually-hidden\">첫 페이지로</span></button>";
|
||||
//previousPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prev.gif\" alt=\"이전\" border=\"0\"/></a></li>";
|
||||
previousPageLabel = "<button class=\"pagination__item prev\" onclick=\"{0}({1});return false; \"><span class=\"visually-hidden\">이전 페이지로</span></button>";
|
||||
//currentPageLabel = "<li><strong>{0}</strong></li>";
|
||||
currentPageLabel = "<li><button class=\"pagination__item active\"><span>{0}</span></button></li>";
|
||||
//otherPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \">{2}</a></li>";
|
||||
otherPageLabel = "<li><button class=\"pagination__item\" onclick=\"{0}({1});return false; \"><span>{2}</span></button></li>";
|
||||
//nextPageLabel = "<li> <a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_next.gif\" alt=\"다음\" border=\"0\"/></a></li>";
|
||||
nextPageLabel = "<button class=\"pagination__item next\" onclick=\"{0}({1});return false; \"><span class=\"visually-hidden\">다음 페이지로</span></button>";
|
||||
//lastPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_nextend.gif\" alt=\"마지막\" border=\"0\"/></a></li>";
|
||||
lastPageLabel = "<button class=\"pagination__item last\" onclick=\"{0}({1});return false; \"><span class=\"visually-hidden\">마지막 페이지로</span></button>";
|
||||
}
|
||||
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
// this.servletContext = servletContext;
|
||||
initVariables();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 페이징 처리를 위한 데이터 처리용 Bean
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class PaginationInfo {
|
||||
/** 현재 페이지 번호. */
|
||||
private int currentPageNo;
|
||||
/** 한 페이지당 게시되는 게시물 건 수 */
|
||||
private int recordCountPerPage;
|
||||
/** 한 페이지당 게시되는 게시물 건 수 */
|
||||
private int pageSize;
|
||||
/** 페이지 리스트에 게시되는 페이지 건수 */
|
||||
private int totalRecordCount;
|
||||
|
||||
private Integer[] pageUnitArr = {10, 50, 100, 200};
|
||||
|
||||
public int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
public void setRecordCountPerPage(int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public int getCurrentPageNo() {
|
||||
return currentPageNo;
|
||||
}
|
||||
|
||||
public void setCurrentPageNo(int currentPageNo) {
|
||||
this.currentPageNo = currentPageNo;
|
||||
}
|
||||
|
||||
public void setTotalRecordCount(int totalRecordCount) {
|
||||
this.totalRecordCount = totalRecordCount;
|
||||
}
|
||||
|
||||
public int getTotalRecordCount() {
|
||||
return totalRecordCount;
|
||||
}
|
||||
|
||||
/** 페이지 개수 */
|
||||
private int totalPageCount;
|
||||
/** 페이지 리스트의 첫 페이지 번호 */
|
||||
private int firstPageNoOnPageList;
|
||||
/** 페이지 리스트의 마지막 페이지 번호 */
|
||||
private int lastPageNoOnPageList;
|
||||
/** 페이징 SQL의 조건절에 사용되는 시작 rownum */
|
||||
private int firstRecordIndex;
|
||||
/** 페이징 SQL의 조건절에 사용되는 마지막 rownum */
|
||||
private int lastRecordIndex;
|
||||
|
||||
public int getTotalPageCount() {
|
||||
totalPageCount = ((getTotalRecordCount() - 1) / getRecordCountPerPage()) + 1;
|
||||
return totalPageCount;
|
||||
}
|
||||
|
||||
public int getFirstPageNo() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getLastPageNo() {
|
||||
return getTotalPageCount();
|
||||
}
|
||||
|
||||
public int getFirstPageNoOnPageList() {
|
||||
firstPageNoOnPageList = ((getCurrentPageNo() - 1) / getPageSize()) * getPageSize() + 1;
|
||||
return firstPageNoOnPageList;
|
||||
}
|
||||
|
||||
public int getLastPageNoOnPageList() {
|
||||
lastPageNoOnPageList = getFirstPageNoOnPageList() + getPageSize() - 1;
|
||||
if (lastPageNoOnPageList > getTotalPageCount()) {
|
||||
lastPageNoOnPageList = getTotalPageCount();
|
||||
}
|
||||
return lastPageNoOnPageList;
|
||||
}
|
||||
|
||||
public int getFirstRecordIndex() {
|
||||
firstRecordIndex = (getCurrentPageNo() - 1) * getRecordCountPerPage();
|
||||
return firstRecordIndex;
|
||||
}
|
||||
|
||||
public int getLastRecordIndex() {
|
||||
lastRecordIndex = getCurrentPageNo() * getRecordCountPerPage();
|
||||
return lastRecordIndex;
|
||||
}
|
||||
|
||||
public Integer[] getPageUnitArr() {
|
||||
return pageUnitArr.clone();
|
||||
}
|
||||
|
||||
public void setPageUnitArr(Integer[] pageUnitArr) {
|
||||
this.pageUnitArr = Arrays.copyOf(pageUnitArr, pageUnitArr.length);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
/**
|
||||
* PaginationRenderer의 구현체를 빈설정 파일을 참조하여 반환한다.
|
||||
* 이는 이미지, 텍스트등 여러 포맷으로 보여줄 필요성이 있을 경우, 각 type의 구현클래스를 사용자가 지정하고
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface PaginationManager {
|
||||
|
||||
public PaginationRenderer getRendererType(String type);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.wb.domainserver.common.ui.pagination;
|
||||
|
||||
/**
|
||||
* PaginationRenderer의 interface
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-22
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-22 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface PaginationRenderer {
|
||||
|
||||
public String renderPagination(PaginationInfo paginationInfo, String jsFunction);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 아이디 정합성을 체크한다.
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2024-01-13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-13 최범식 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = BoardId.BoardIdValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface BoardId {
|
||||
|
||||
String message() default "영문/숫자/언더스코어(_)/하이픈(-)만 사용하여 6~30자로 입력해 주세요.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class BoardIdValidator implements ConstraintValidator<BoardId, String> {
|
||||
|
||||
private final String REGEX_ID = "^[A-Za-z[0-9]-_$]{4,30}$";
|
||||
|
||||
public Pattern boardId = Pattern.compile(REGEX_ID);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return !boardId.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 영문만 입력되었는지 정합성을 체크한다.
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2024-01-04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-04 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = English.EnglishValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface English {
|
||||
|
||||
String message() default "영문을 입력하셔야 합니다.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class EnglishValidator implements ConstraintValidator<English, String> {
|
||||
|
||||
private final String REGEX_ENGLISH = "^[a-zA-Z\\s]*$";
|
||||
|
||||
public Pattern english = Pattern.compile(REGEX_ENGLISH);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return english.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
src/main/java/com/wb/domainserver/common/validate/Id.java
Normal file
61
src/main/java/com/wb/domainserver/common/validate/Id.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 아이디 정합성을 체크한다.
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2024-01-13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-13 최범식 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = Id.IdValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface Id {
|
||||
|
||||
String message() default "영문/숫자 조합 6~20자로 입력해 주세요.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class IdValidator implements ConstraintValidator<Id, String> {
|
||||
|
||||
private final String REGEX_ID = "^[A-Za-z[0-9]$]{6,20}$";
|
||||
|
||||
public Pattern id = Pattern.compile(REGEX_ID);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return id.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 한글만 입력되었는지 정합성을 체크한다.
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2024-01-04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-04 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = Korean.KoreanValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface Korean {
|
||||
|
||||
String message() default "한글을 입력하셔야 합니다.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class KoreanValidator implements ConstraintValidator<Korean, String> {
|
||||
|
||||
private final String REGEX_KOREAN = "^[가-힣\\s]*$";
|
||||
|
||||
public Pattern korean = Pattern.compile(REGEX_KOREAN);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return korean.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 비밀번호 정합성을 체크한다.
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2024-01-12
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-12 최범식 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = MngrPassword.MngrPasswordValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface MngrPassword {
|
||||
|
||||
String message() default "영문/숫자/특수문자 조합 10~20로 입력해 주세요.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class MngrPasswordValidator implements ConstraintValidator<MngrPassword, String> {
|
||||
|
||||
private final String REGEX_PASSWORD = "^(?=.*[A-Za-z])(?=.*[0-9])(?=.*[$@$!%*#?&{}()~_*\\\\^+-:><=\\[\\]])[A-Za-z[0-9]@$!%*#?&{}()~_*\\^+-:><=\\[\\]]{10,20}$";
|
||||
|
||||
public Pattern mngrPassword = Pattern.compile(REGEX_PASSWORD);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return mngrPassword.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 숫자(정수)만 입력되었는지 정합성을 체크한다.
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2024-01-04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-04 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = NumberOnly.NumberOnlyValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface NumberOnly {
|
||||
|
||||
String message() default " 숫자(정수)를 입력하셔야 합니다.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class NumberOnlyValidator implements ConstraintValidator<NumberOnly, String> {
|
||||
|
||||
private final String REGEX_NUMBER_ONLY = "^[0-9]*$";
|
||||
|
||||
public Pattern numberonly = Pattern.compile(REGEX_NUMBER_ONLY);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return numberonly.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 숫자와하이픈만 입력되었는지 정합성을 체크한다.
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2024-01-04
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-04 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = NumberWithHyphen.NumberWithHyphenValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface NumberWithHyphen {
|
||||
|
||||
String message() default "숫자와 하이픈(-)만 입력하셔야 합니다.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class NumberWithHyphenValidator implements ConstraintValidator<NumberWithHyphen, String> {
|
||||
|
||||
private final String REGEX_NUMBER_WIT_HYPEN = "^[0-9-]*$";
|
||||
|
||||
public Pattern NumberWithHyphen = Pattern.compile(REGEX_NUMBER_WIT_HYPEN);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return NumberWithHyphen.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.wb.domainserver.common.validate;
|
||||
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.validation.Constraint;
|
||||
import jakarta.validation.ConstraintValidator;
|
||||
import jakarta.validation.ConstraintValidatorContext;
|
||||
import jakarta.validation.Payload;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
|
||||
/**
|
||||
* 입력값에 패스워드 정합성을 체크한다.
|
||||
*
|
||||
* @author 최범식
|
||||
* @since 2024-01-13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-01-13 최범식 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Constraint(validatedBy = Password.PasswordValidator.class)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(FIELD)
|
||||
public @interface Password {
|
||||
|
||||
String message() default "영문/숫자 조합 6~20자로 입력해 주세요.";
|
||||
Class<?>[] groups() default {};
|
||||
Class<? extends Payload>[] payload() default{};
|
||||
|
||||
class PasswordValidator implements ConstraintValidator<Password, String> {
|
||||
|
||||
private final String REGEX_PASSWORD = "^[A-Za-z[0-9]$]{6,20}$";
|
||||
|
||||
public Pattern password = Pattern.compile(REGEX_PASSWORD);
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if(StringUtil.isEmpty(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return password.matcher(value).matches();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,616 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.service.BOMaMtngService;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOInstcSleVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngSrchVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOPreOrderValidVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.service.BOMbrService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrAppnVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.service.BOOrdrService;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.exception.code.PurchsValidCode;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* 부정판매자 관리 BO controller
|
||||
* @author 김혜인
|
||||
* @since 2024-01-29
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-01-29 김혜인 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/instcSle/mtng")
|
||||
public class BOMaMtngController {
|
||||
@Autowired
|
||||
private BOMaMtngService service;
|
||||
@Autowired
|
||||
private BOMbrService bombrService;
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Autowired
|
||||
private BOOrdrService boOrdrService;
|
||||
|
||||
/**
|
||||
* 부정 판매 대상자 검색 폼 코드 조회
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping("/selectBOItcSleMtngListInqireForm")
|
||||
public ResponseEntity<?> selectBOItcSleMtngListInqireForm(@RequestBody BOMaMtngSrchVO boMaMtngSrchVO) {
|
||||
/*쇼핑몰*/
|
||||
List<DataMap> brand = new ArrayList<>();
|
||||
brand = maSopmalService.selectBOSopmalCdNm();
|
||||
|
||||
/*리셀러지정구분*/
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("RSLR_APPN_DV");
|
||||
List<?> appen = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
/*식별기준*/
|
||||
bOMaComncdVO.setGroupCd("IDNTFC_STDR");
|
||||
List<?> idntfcStdr = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
//브랜드
|
||||
resultMap.put("brand",brand);
|
||||
/*리셀러지정구분*/
|
||||
resultMap.put("appen",appen);
|
||||
/*식별기준*/
|
||||
resultMap.put("idntfcStdr",idntfcStdr);
|
||||
resultMap.put("boMaMtngSrchVO",boMaMtngSrchVO);
|
||||
return ApiResponse.of(resultMap).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 목록 조회
|
||||
* @param boMaMtngSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOItcSleMtngListInqire")
|
||||
public ResponseEntity<?> selectBOItcSleMtngListInqire(@RequestBody BOMaMtngSrchVO boMaMtngSrchVO) {
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(boMaMtngSrchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(boMaMtngSrchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
boMaMtngSrchVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
boMaMtngSrchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
boMaMtngSrchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
boMaMtngSrchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
//시크릿키 set
|
||||
boMaMtngSrchVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
|
||||
//부정 판매 대상자 목록 조회 결과 및 페이징정보 넣기
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("paginationInfo", boMaMtngSrchVO.getPaginationInfo());
|
||||
content.put("boMaMtngSrchVO",boMaMtngSrchVO);
|
||||
content.put("resultMap", service.selectBOItcSleMtngListInqire(boMaMtngSrchVO));
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 상세 조회 (회원 정보)
|
||||
* @param boMaMtngVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOItcSleMtngDtlInqire")
|
||||
public ResponseEntity<?> selectBOItcSleMtngDtlInqire(@RequestBody BOMaMtngVO boMaMtngVO) {
|
||||
BOMbrVO mbrVO = new BOMbrVO();
|
||||
|
||||
DataMap resultData = new DataMap();
|
||||
/*회원고유번호*/
|
||||
mbrVO.setMbrInnb(boMaMtngVO.getIdntfcInfo());
|
||||
/*회원구분코드*/
|
||||
mbrVO.setMbrDvCd(boMaMtngVO.getMbrDvCd());
|
||||
/*쇼핑몰코드*/
|
||||
mbrVO.setSopmalCd(boMaMtngVO.getSopmalCd());
|
||||
resultData = bombrService.selectBOMbrInfoUpdtInqire(mbrVO);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
content.put("mbrInfo", resultData);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 상세 조회(주문 정보)
|
||||
* @param BOMaMtngVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOItcSleOrdrInfoInqire")
|
||||
public ResponseEntity<?> selectBOItcSleOrdrInfoInqire(@RequestBody BOMaMtngVO boMaMtngVO) {
|
||||
log.info("부정 판매 대상 param{} 주문 정보",boMaMtngVO.getIdntfcInfo());
|
||||
log.info("부정 판매 대상 param{} 주문 정보",boMaMtngVO.getMbrDvCd());
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(boMaMtngVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(boMaMtngVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
boMaMtngVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
boMaMtngVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
boMaMtngVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
boMaMtngVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
List<DataMap> ordrInfo = new ArrayList<>();
|
||||
ordrInfo = service.selectBOItcSleOrdrInfoInqire(boMaMtngVO);
|
||||
|
||||
//부정 판매 대상자 목록 조회 결과 및 페이징정보 넣기
|
||||
content.put("paginationInfo", boMaMtngVO.getPaginationInfo());
|
||||
|
||||
content.put("boMaMtngVO", boMaMtngVO);
|
||||
|
||||
content.put("ordrInfo", ordrInfo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 상세 조회 (지정 이력 정보)
|
||||
* @param BOMaMtngVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOItcSleHistInfoInqire")
|
||||
public ResponseEntity<?> selectBOItcSleHistInfoInqire(@RequestBody BOMaMtngVO boMaMtngVO) {
|
||||
log.debug("부정 판매 대상 지정 이력 정보 param{}",boMaMtngVO.getAppnInnb());
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(boMaMtngVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(boMaMtngVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
boMaMtngVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
boMaMtngVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
boMaMtngVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
boMaMtngVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
//부정 판매 대상자 목록 조회 결과 및 페이징정보 넣기
|
||||
content.put("paginationInfo", boMaMtngVO.getPaginationInfo());
|
||||
|
||||
content.put("histInfo", service.selectBOItcSleHistInfoInqire(boMaMtngVO));
|
||||
|
||||
content.put("boMaMtngVO", boMaMtngVO);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 블랙리스트체크 + 구매 전 요청된 구매정보에 따른 구매가능여부 재확인
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectBOBlclist")
|
||||
public ResponseEntity<?> selectBlclist(@RequestBody DataMap param) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
String temp = user.getSopmalCd();
|
||||
|
||||
param.put("sopmalCd", temp);
|
||||
|
||||
|
||||
LinkedHashMap purchsr = (LinkedHashMap) param.get("purchsr"); // 구매자 정보
|
||||
LinkedHashMap<String, Object> shipping = (LinkedHashMap) param.get("shipping"); // 배송지 정보
|
||||
LinkedHashMap<String, Object> multiOrdrDlvylc = (LinkedHashMap) param.get("multiOrdrDlvylc"); // 주문배송정보 (여러곳 배송)
|
||||
// 결제 예정 금액 계산시 배송정보를 'dlvylc' 객체를 사용
|
||||
param.put("dlvylc", shipping);
|
||||
List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList"); // 상품정보
|
||||
LinkedHashMap enuri = null;
|
||||
LinkedHashMap setle = null;
|
||||
|
||||
//회원일 경우에만 enuri정보 존재
|
||||
if(user.getUserInnb() > 0){
|
||||
enuri = (LinkedHashMap) param.get("enuri"); //할인정보
|
||||
setle = (LinkedHashMap) param.get("setle"); //결제정보
|
||||
}else{
|
||||
//비회원일 경우 enuri 없고 setle만 존재
|
||||
enuri = (LinkedHashMap) param.get("setle"); //결제정보
|
||||
setle = (LinkedHashMap) param.get("setle"); //결제정보
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(purchsr)) {
|
||||
log.info("구매자 정보를 찾을 수 없습니다.");
|
||||
content.put("result","Y");
|
||||
content.put("message", "구매자 정보를 찾을 수 없습니다.");
|
||||
// throw new WnbtRestException("구매자 정보를 찾을 수 없습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
if ("05".equals(param.get("ordrTyCd"))) {
|
||||
if (CollectionUtils.isEmpty(multiOrdrDlvylc)) {
|
||||
log.info("배송지 정보를 찾을 수 없습니다.");
|
||||
content.put("result","Y");
|
||||
content.put("message", "배송지 정보를 찾을 수 없습니다.");
|
||||
// throw new WnbtRestException("주문유형 정보를 찾을 수 없습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
} else {
|
||||
if (CollectionUtils.isEmpty(shipping)) {
|
||||
log.info("배송지 정보를 찾을 수 없습니다.");
|
||||
content.put("result","Y");
|
||||
content.put("message", "배송지 정보를 찾을 수 없습니다.");
|
||||
// throw new WnbtRestException("주문유형 정보를 찾을 수 없습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(goodsList)) {
|
||||
log.info("상품 정보를 찾을 수 없습니다.");
|
||||
content.put("result","Y");
|
||||
content.put("message", "상품 정보를 찾을 수 없습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
if (CollectionUtils.isEmpty(enuri)) {
|
||||
log.info("할인 또는 결제 정보를 찾을 수 없습니다.");
|
||||
content.put("result","Y");
|
||||
content.put("message", "할인 또는 결제 정보를 찾을 수 없습니다.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
String sopmalCd = (String) param.get("sopmalCd");
|
||||
String ordrTyCd = (String) param.get("ordrTyCd");
|
||||
String mbrInnb = (String) goodsList.get(0).get("mbrInnb");
|
||||
String mbrDvCd = (String) goodsList.get(0).get("mbrDvCd");
|
||||
String ordrrMbtlnb = (String) purchsr.get("mbtlnb");
|
||||
|
||||
String adres = "";
|
||||
String[] adresArray = null; // 배송지별 배송지 주소
|
||||
String[] receptMbtlnbArray = null; // 배송지 받는이 휴대폰번호
|
||||
|
||||
if ("01".equals(ordrTyCd) || "03".equals(ordrTyCd) || "06".equals(ordrTyCd)) { // 일반주문, 회원개인결제, 정기배송
|
||||
if (
|
||||
StringUtil.isEmpty((String) shipping.get("dlvylcZip")) ||
|
||||
StringUtil.isEmpty((String) shipping.get("dlvylcAdresDvCd")) ||
|
||||
( "01".equals(shipping.get("dlvylcAdresDvCd")) && StringUtil.isEmpty((String) shipping.get("dlvylcRnmAdres")) ) ||
|
||||
( "02".equals(shipping.get("dlvylcAdresDvCd")) && StringUtil.isEmpty((String) shipping.get("dlvylcLnbAdres")) ) ||
|
||||
StringUtil.isEmpty((String) shipping.get("dlvylcAdresDtl"))
|
||||
) {
|
||||
content.put("result","Y");
|
||||
content.put("message", "배송지 정보를 찾을 수 없습니다. 다시 시도해 주세요.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
String dlvylcAdresDvCd = (String) shipping.get("dlvylcAdresDvCd");
|
||||
String dlvylcLnbAdres = (String) shipping.get("dlvylcLnbAdres");
|
||||
String dlvylcRnmAdres = (String) shipping.get("dlvylcRnmAdres");
|
||||
String dlvylcAdresDtl = (String) shipping.get("dlvylcAdresDtl");
|
||||
|
||||
adres = "01".equals(dlvylcAdresDvCd) ? dlvylcRnmAdres + " " + dlvylcAdresDtl : dlvylcLnbAdres + " " + dlvylcAdresDtl;
|
||||
|
||||
String recpntMbtlnb = StringUtil.isNullToString(shipping.get("recpntMbtlnb"));
|
||||
receptMbtlnbArray = new String[]{recpntMbtlnb};
|
||||
} else if ("05".equals(ordrTyCd)) { // 여러곳 배송
|
||||
if (!CollectionUtils.isEmpty(multiOrdrDlvylc)) {
|
||||
|
||||
// 배송지 리스트
|
||||
List<LinkedHashMap<String, Object>> dlvylcListMulti = (List<LinkedHashMap<String, Object>>) multiOrdrDlvylc.get("dlvylc");
|
||||
|
||||
/** ----------------------------------------------- 배송지별 주문 상품 수량 검사 START ----------------------------------------------- */
|
||||
content = checkDistributedQyMatchesOrder(goodsList, dlvylcListMulti);
|
||||
if (!"0".equals(content.get("status"))) {
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
/** ----------------------------------------------- 배송지별 주문 상품 수량 검사 END ----------------------------------------------- */
|
||||
|
||||
// 부정판매 체크를 위한 배송지 정렬
|
||||
if (!CollectionUtils.isEmpty(dlvylcListMulti)) {
|
||||
|
||||
boolean hasInvalidAddress = dlvylcListMulti.stream().anyMatch(map -> {
|
||||
String dlvylcZip = StringUtil.isNullToString(map.get("dlvylcZip"));
|
||||
String adresDvCd = StringUtil.isNullToString(map.get("dlvylcAdresDvCd"));
|
||||
String dlvylcLnbAdres = StringUtil.isNullToString(map.get("dlvylcLnbAdres"));
|
||||
String dlvylcRnmAdres = StringUtil.isNullToString(map.get("dlvylcRnmAdres"));
|
||||
String adresDtl = StringUtil.isNullToString(map.get("dlvylcAdresDtl"));
|
||||
|
||||
return StringUtil.isEmpty(dlvylcZip)
|
||||
|| StringUtil.isEmpty(adresDvCd)
|
||||
|| ("01".equals(adresDvCd) && StringUtil.isEmpty(dlvylcRnmAdres))
|
||||
|| ("02".equals(adresDvCd) && StringUtil.isEmpty(dlvylcLnbAdres))
|
||||
|| StringUtil.isEmpty(adresDtl);
|
||||
});
|
||||
|
||||
if (hasInvalidAddress) {
|
||||
content.put("result","Y");
|
||||
content.put("message", "배송지 정보를 찾을 수 없습니다. 다시 시도해 주세요.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
List<String> adresList = dlvylcListMulti.stream()
|
||||
.map(map -> {
|
||||
String adresDvCd = StringUtil.isNullToString(map.get("dlvylcAdresDvCd"));
|
||||
String adresDtl = StringUtil.isNullToString(map.get("dlvylcAdresDtl"));
|
||||
String dlvylcLnbAdres = StringUtil.isNullToString(map.get("dlvylcLnbAdres"));
|
||||
String dlvylcRnmAdres = StringUtil.isNullToString(map.get("dlvylcRnmAdres"));
|
||||
String adresMulti;
|
||||
if ("01".equals(adresDvCd)) {
|
||||
adresMulti = dlvylcRnmAdres + " " + adresDtl;
|
||||
} else {
|
||||
adresMulti = dlvylcLnbAdres + " " + adresDtl;
|
||||
}
|
||||
|
||||
return adresMulti;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
adresArray = adresList.toArray(new String[0]);
|
||||
|
||||
List<String> receptMbtlnbList = dlvylcListMulti.stream()
|
||||
.map(map -> {
|
||||
return StringUtil.isNullToString(map.get("recpntMbtlnb"));
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
receptMbtlnbArray = receptMbtlnbList.toArray(new String[0]);
|
||||
|
||||
}
|
||||
}
|
||||
} else if ("04".equals(ordrTyCd)) { // 선물하기
|
||||
if (
|
||||
!StringUtil.isEmpty((String) shipping.get("dlvylcZip")) ||
|
||||
!StringUtil.isEmpty((String) shipping.get("dlvylcAdresDvCd")) ||
|
||||
!StringUtil.isEmpty((String) shipping.get("dlvylcLnbAdres")) ||
|
||||
!StringUtil.isEmpty((String) shipping.get("dlvylcRnmAdres")) ||
|
||||
!StringUtil.isEmpty((String) shipping.get("dlvylcAdresDtl"))
|
||||
) {
|
||||
content.put("result","Y");
|
||||
content.put("message", "구매정보가 변경 되었습니다. 다시 시도해 주세요.");
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
BOInstcSleVO instcSleVO = new BOInstcSleVO();
|
||||
|
||||
String agentId = StringUtil.isNullToString(param.get("agentId"));
|
||||
instcSleVO.setOrdrTyCd(ordrTyCd);
|
||||
instcSleVO.setSopmalCd(sopmalCd);
|
||||
instcSleVO.setMbrInnb(mbrInnb);
|
||||
instcSleVO.setMbrDvCd(mbrDvCd);
|
||||
instcSleVO.setOrdrrMbtlnb(ordrrMbtlnb);
|
||||
instcSleVO.setOrdrrMbtlnb(ordrrMbtlnb);
|
||||
instcSleVO.setAdres(adres);
|
||||
instcSleVO.setAdresMulti(adresArray);
|
||||
instcSleVO.setRecpntMbtlnbArr(receptMbtlnbArray);
|
||||
instcSleVO.setAgentId(agentId);
|
||||
instcSleVO.setAppnDvCd("02"); //02:블랙리스트
|
||||
|
||||
|
||||
//블랙리스트 여부
|
||||
content = service.checkInstcSle(instcSleVO);
|
||||
|
||||
//구매금액재계산 사용여부
|
||||
String useAt = service.selectPurchsValidUseAt(sopmalCd);
|
||||
if("Y".equals(useAt)){
|
||||
//총금액 계산
|
||||
try {
|
||||
|
||||
//계산결과 총결제금액
|
||||
String resultSetleAmt = "";
|
||||
|
||||
//주문요청 총결제금액
|
||||
//회원/비회원 총결제금액
|
||||
String reqSetleAmt = StringUtil.isNullToString(setle.get("rlSetleAmt"));
|
||||
|
||||
|
||||
//재계산된 총결제금액관련정보
|
||||
Map<String, Object> resultAmt = boOrdrService.selectSetleExpectAmt(param);
|
||||
|
||||
|
||||
if(resultAmt.containsKey("setleExpectAmt")){
|
||||
|
||||
LinkedHashMap setleExpectAmt = (LinkedHashMap) resultAmt.get("setleExpectAmt");
|
||||
|
||||
|
||||
if(setleExpectAmt.containsKey("setleAmt")){
|
||||
resultSetleAmt = StringUtil.isNullToString(setleExpectAmt.get("setleAmt"));
|
||||
}
|
||||
|
||||
//주문요청의 총결제금액과 계산된 총결제금액이 서로 다를 경우
|
||||
if(!resultSetleAmt.equals(reqSetleAmt)
|
||||
&& StringUtils.hasText(reqSetleAmt)
|
||||
&& StringUtils.hasText(resultSetleAmt)){
|
||||
content.put("result", "Y");
|
||||
content.put("message", PurchsValidCode.purchsValidMsg("setleAmt"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (WnbtRestException wre) {
|
||||
log.error(wre.getMessage());
|
||||
Map<String, String> wreExetption = new HashMap<>();
|
||||
wreExetption.put("result", "Y");
|
||||
wreExetption.put("message", wre.getMessage());
|
||||
|
||||
return ApiResponse.of(wreExetption).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
Map<String, String> exception = new HashMap<>();
|
||||
exception.put("result", "Y");
|
||||
exception.put("message", "예기치 못한 오류가 발생하였습니다.\n관리자에게 문의하시기 바랍니다.");
|
||||
|
||||
return ApiResponse.of(exception).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
//블랙리스트 여부 및 총금액 계산 통과시 주문정보 재확인
|
||||
if("N".equals(content.get("result"))){
|
||||
//주문 전 요청 주문 정보에 따른 현재 컨디션 재확인관련 데이터(vo) 전처리
|
||||
List<BOPreOrderValidVO> validVOList = service.selectBOPreOrderValidationList(param);
|
||||
|
||||
//주문 전 사용 쿠폰 컨디션 재확인
|
||||
content = service.selectBOPreOrderValidationCouponList(validVOList);
|
||||
|
||||
|
||||
//사용 쿠폰 컨디션 통과시
|
||||
if("N".equals(content.get("result"))) {
|
||||
|
||||
//주문 전 요청 주문 정보에 따른 현재 컨디션 재확인
|
||||
content = service.selectBOPreOrderValidation(validVOList);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 여러곳 배송 > 배송지별 상품 분배 수량 검증
|
||||
* @param goodsList
|
||||
* @param dlvylcListMulti
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> checkDistributedQyMatchesOrder(List<LinkedHashMap> goodsList, List<LinkedHashMap<String, Object>> dlvylcListMulti) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
// (1) 주문 상품 기준: goodsOptnInnb별 총 주문 수량 계산
|
||||
Map<Integer, Integer> requiredQuantityMap = goodsList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
goods -> (Integer) goods.get("goodsOptnInnb"),
|
||||
Collectors.summingInt(goods -> (Integer) goods.get("qy"))
|
||||
));
|
||||
|
||||
log.debug("requiredQuantityMap : {}", requiredQuantityMap);
|
||||
|
||||
// (2) 배송지별 분배 수량 집계
|
||||
Map<Integer, Integer> distributedQuantityMap = new HashMap<>();
|
||||
|
||||
if (!CollectionUtils.isEmpty(dlvylcListMulti)) {
|
||||
|
||||
for (LinkedHashMap<String, Object> dlvylcMapMulti : dlvylcListMulti) {
|
||||
log.debug("dlvylcMapMulti : {}", dlvylcMapMulti);
|
||||
|
||||
// 배송지별 상품 목록
|
||||
List<LinkedHashMap> goodsListMulti = (List<LinkedHashMap>) dlvylcMapMulti.get("goodsList");
|
||||
|
||||
for (LinkedHashMap goods : goodsListMulti) {
|
||||
Integer goodsOptnInnb = (Integer) goods.get("goodsOptnInnb");
|
||||
Integer ordrQy = (Integer) goods.get("qy");
|
||||
|
||||
distributedQuantityMap.merge(goodsOptnInnb, ordrQy, Integer::sum);
|
||||
}
|
||||
}
|
||||
|
||||
// (3) 상품별 분배 수량 검증
|
||||
for (Map.Entry<Integer, Integer> entry : requiredQuantityMap.entrySet()) {
|
||||
Integer goodsOptnInnb = entry.getKey();
|
||||
int requiredQty = entry.getValue();
|
||||
int distributedQty = distributedQuantityMap.getOrDefault(goodsOptnInnb, 0);
|
||||
|
||||
if (requiredQty != distributedQty) {
|
||||
log.info("상품 [{}] 주문 수량: {}, 배송지 분배 수량: {} → 불일치", goodsOptnInnb, requiredQty, distributedQty);
|
||||
content.put("status","1");
|
||||
content.put("result","Y");
|
||||
content.put("message", "배송지별 분배 수량이 맞지 않습니다.");
|
||||
break;
|
||||
} else {
|
||||
content.put("status","0");
|
||||
log.info("상품 [{}] 수량 검증 통과: {}", goodsOptnInnb, requiredQty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return content;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 일반, 블랙리스트, 화이트리스트 변경.
|
||||
* @param BOMbrAppnVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/updateBOMbrRslrList")
|
||||
public ResponseEntity<?> updateBOMbrRslrList(@RequestBody BOMbrAppnVO boMbrAppnVO) {
|
||||
log.info("updateBOMbrRslrList(boMbrAppnVO = {})", boMbrAppnVO.getAppnDvCd());
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
// boMbrAppnVO.setRegusr(user.getUserInnb());
|
||||
boMbrAppnVO.setUpdusr(user.getUserInnb());
|
||||
|
||||
log.info("getId = {}", user.getId());
|
||||
log.info("getUserInnb = {}", user.getUserInnb());
|
||||
log.info("getMbrId = {}", user.getMbrId());
|
||||
|
||||
|
||||
// if(StringUtil.isEmpty(boMbrAppnVO.getSopmalCd())){
|
||||
// boMbrAppnVO.setSopmalCd(user.getSopmalCd());
|
||||
// }
|
||||
String secretKey = boCommonService.selectSecretkey();
|
||||
boMbrAppnVO.setSecretKey(secretKey);
|
||||
|
||||
content = service.updateBOMbrRslrList(boMbrAppnVO);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.MaMtngSrchVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.MaMtngVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.ReplyFromResrc;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 부정판매자 관리 controller
|
||||
* @author 김혜인
|
||||
* @since 2024-01-29
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-01-29 김혜인 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/instcSle/mtng")
|
||||
public class MaMtngController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
/**
|
||||
* 부정판매 대상자 목록 조회
|
||||
* @param maMtngSrchVO
|
||||
* @param model
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectItcSleMtngListInqireForm")
|
||||
public String selectItcSleMtngListInqireForm(ModelMap model,MaMtngSrchVO maMtngSrchVO) {
|
||||
//BO에서 API 호출(부정 판매 대상자 검색 폼 코드 조회)
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleMtngListInqireForm", maMtngSrchVO),
|
||||
model,
|
||||
"resultSrchMap"
|
||||
);
|
||||
|
||||
return "admin/instcSle/mtng/MaItcSleMtngListInqireRForm";
|
||||
}
|
||||
/**
|
||||
* 부정판매 대상자 목록 조회
|
||||
* @param maMtngSrchVO
|
||||
* @param model
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectItcSleMtngListInqire", method = RequestMethod.POST)
|
||||
public String selectItcSleMtngListInqire(ModelMap model,MaMtngSrchVO maMtngSrchVO) {
|
||||
//BO 회원 목록조회 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleMtngListInqire", maMtngSrchVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
model.addAttribute("mbrSrchVO", maMtngSrchVO);
|
||||
return "admin/instcSle/mtng/MaItcSleMtngListInqireR";
|
||||
}
|
||||
/**
|
||||
* 엑셀 다운로드
|
||||
* @param MaMtngSrchVO
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value="/selectItcSleMtngListExcelDwld" , method = RequestMethod.POST)
|
||||
public void selectExcelList(MaMtngSrchVO maMtngSrchVO,HttpServletResponse response) {
|
||||
maMtngSrchVO.setPageIndex(1); //10000건까지 엑셀 출력
|
||||
maMtngSrchVO.setPageUnit(10000); //10000건까지 엑셀 출력
|
||||
|
||||
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleMtngListInqire",maMtngSrchVO)
|
||||
);
|
||||
|
||||
List<Map<String, Object>> resultMapList = (List<Map<String, Object>>) resultMap.get("resultMap");
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
//엑셀 다운로드 다운로드 시간
|
||||
Date date = new Date();
|
||||
SimpleDateFormat excelFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String str = excelFormat.format(date);
|
||||
try {
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
if (resultMapList != null) {
|
||||
BigInteger num = BigInteger.valueOf(resultMapList.size());
|
||||
for (int i = 0; i < resultMapList.size(); i++) {
|
||||
Map<String, Object> row = resultMapList.get(i);
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("rnum", num.subtract(BigInteger.valueOf(i))); //번호 역순 출력
|
||||
dataMap.put("mbrId", row.get("mbrId"));
|
||||
dataMap.put("mbrNm", row.get("mbrNm"));
|
||||
dataMap.put("email", row.get("email"));
|
||||
dataMap.put("mbtlnb", row.get("mbtlnb"));
|
||||
dataMap.put("sopmalNm", row.get("sopmalNm"));
|
||||
dataMap.put("appnDvCdNm", row.get("appnDvCdNm"));
|
||||
dataMap.put("mbrGradNm", row.get("mbrGradNm"));
|
||||
dataMap.put("mileage", row.get("mileage"));
|
||||
dataMap.put("registDt", row.get("registDt"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
}
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("rnum", "번호");
|
||||
headerMap.put("mbrId", "아이디");
|
||||
headerMap.put("mbrNm", "이름");
|
||||
headerMap.put("email", "이메일");
|
||||
headerMap.put("mbtlnb", "휴대폰번호");
|
||||
headerMap.put("sopmalNm", "쇼핑몰");
|
||||
headerMap.put("appnDvCdNm", "구분");
|
||||
headerMap.put("mbrGradNm", "등급");
|
||||
headerMap.put("mileage", "마일리지");
|
||||
headerMap.put("registDt", "지정일");
|
||||
ExcelDownloadUtil.createExcel("injustice_seller_list_" + str, headerMap, dataList, response);
|
||||
} catch (IOException ioe) {
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
} catch (Exception e) {
|
||||
log.error("엑셀다운로드 중 오류가 발생하였습니다.", e);
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 부정판매 대상자 상세 조회
|
||||
* @param MaMtngSrchVO
|
||||
* @param model
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectItcSleMtngDtlInqire")
|
||||
public String selectItcSleMtngDtlInqire(ModelMap model, MaMtngVO maMtngVO) {
|
||||
log.info("부정판매 대상자 고유번호 확인 : {}", maMtngVO.getAppnInnb());
|
||||
//BO 회원 목록조회 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleMtngDtlInqire", maMtngVO),
|
||||
model,
|
||||
"resultFO1"
|
||||
);
|
||||
model.addAttribute("maMtngSrchVO",maMtngVO);
|
||||
return "admin/instcSle/mtng/MaItcSleMtngDtlInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 부정판매 대상자 상세 조회(주문 정보)
|
||||
* @parmam maMtngVO
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectItcSleOrdrInfoInqire")
|
||||
public String selectItcSleOrdrInfoInqire(ModelMap model, MaMtngVO maMtngVO) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleOrdrInfoInqire", maMtngVO),
|
||||
model,
|
||||
"resultFO2"
|
||||
);
|
||||
return "admin/instcSle/mtng/MaItcSleOrdrInfoInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 부정판매 대상자 상세 조회(이력 정보)
|
||||
* @parmam maMtngVO
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectItcSleHistInfoInqire")
|
||||
public String selectItcSleHistInfoInqire(ModelMap model, MaMtngVO maMtngVO) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/selectBOItcSleHistInfoInqire", maMtngVO),
|
||||
model,
|
||||
"resultFO3"
|
||||
);
|
||||
return "admin/instcSle/mtng/MaItcSleHistInfoInqireR";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 일반, 블랙리스트, 화이트리스트 변경.
|
||||
* @parmam maMtngVO
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/updateMbrRslrList")
|
||||
public ResponseEntity<WnbtResponse> updateMbrRslrList(ModelMap model, MaMtngVO maMtngVO) {
|
||||
log.info("appnInnb is {}", maMtngVO.getAppnInnb());
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/instcSle/mtng/updateBOMbrRslrList", maMtngVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOInstcSleVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngSrchVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOPreOrderValidVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* 부정판매자 관리 BO mapper
|
||||
* @author 김혜인
|
||||
* @since 2024-01-29
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-01-29 김혜인 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaMtngMapper {
|
||||
/** 부정 판매 대상자 목록 조회 */
|
||||
public List<DataMap> selectItcSleMtngList(BOMaMtngSrchVO vo);
|
||||
/** 부정 판매 대상자 목록 건수 조회 */
|
||||
public Integer selectItcSleMtngTotCnt(BOMaMtngSrchVO vo);
|
||||
/** 부정 판매 대상자 지정 이력 건수*/
|
||||
public Integer selectBOItcSleMtngDtlTotCnt(BOMaMtngVO vo);
|
||||
/** 부정 판매 대상자 지정 이력 */
|
||||
public List<DataMap> selectBOItcSleMtngDtlInqire(BOMaMtngVO vo);
|
||||
/** 부정 판매 대상자 주문 내역 건수 */
|
||||
Integer selectBOItcSleOrdrInfoTotCnt(BOMaMtngVO boMaMtngVO);
|
||||
/** 부정 판매 대상자 주문 내역 목록 */
|
||||
List<DataMap> selectBOItcSleOrdrInfoInqire(BOMaMtngVO boMaMtngVO);
|
||||
/** 주문시 부정 판매 대상 조회*/
|
||||
BOInstcSleVO checkInstcSle(BOInstcSleVO boInstcSleVO);
|
||||
|
||||
|
||||
/** 주문 전 주문정보 재확인*/
|
||||
public List<DataMap> selectBOPreOrderValidation(BOPreOrderValidVO goods);
|
||||
/** 주문 전 쿠폰정보 재확인*/
|
||||
public List<String> selectBOPreOrderValidationCouponList(BOPreOrderValidVO goods);
|
||||
|
||||
/*쇼핑몰 구매요청 재검증 확인 여부*/
|
||||
public String selectPurchsValidUseAt(String sopmalCd);
|
||||
}
|
||||
@@ -0,0 +1,554 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.mapper.BOMaMtngMapper;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOInstcSleVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngSrchVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOMaMtngVO;
|
||||
import com.wb.domainserver.domain.admin.instcSle.mtng.vo.BOPreOrderValidVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.gcone.goods.goods.service.BOGoodsService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.mapper.BOMbrMapper;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mbr.vo.BOMbrAppnVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.service.BOMlgService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOCashVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgSrchVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.mapper.BOOrdrMapper;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.service.BOOrdrService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.pay.vo.BOPayVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.exception.code.PurchsValidCode;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
/**
|
||||
*
|
||||
* 부정판매자 관리 BO service
|
||||
* @author 김혜인
|
||||
* @since 2024-01-29
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-01-29 김혜인 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BOMaMtngService {
|
||||
@Autowired
|
||||
private BOMaMtngMapper mapper;
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
|
||||
@Autowired
|
||||
private BOOrdrMapper boOrdrMapper;
|
||||
|
||||
@Autowired
|
||||
private BOMbrMapper boMbrMapper;
|
||||
|
||||
@Autowired
|
||||
private BOMlgService boMlgService;
|
||||
|
||||
@Autowired
|
||||
private BOGoodsService boGoodsService;
|
||||
|
||||
/**
|
||||
* 부정 판매 대상자 목록 조회
|
||||
* @param boMaMtngSrchVO
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public List<DataMap> selectBOItcSleMtngListInqire(BOMaMtngSrchVO boMaMtngSrchVO){
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
// 건수 조회
|
||||
Integer totCnt = 0;
|
||||
totCnt = mapper.selectItcSleMtngTotCnt(boMaMtngSrchVO);
|
||||
// 건수 갯수 페이징 vo에 set
|
||||
boMaMtngSrchVO.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
// 건수 > 0 일시 부정 판매 대상자 목록 조회
|
||||
if(totCnt > 0) {
|
||||
resultList = mapper.selectItcSleMtngList(boMaMtngSrchVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 상세 조회 (지정 이력 정보)
|
||||
* @param boMaMtngVO
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOItcSleHistInfoInqire(BOMaMtngVO boMaMtngVO){
|
||||
List<DataMap> resultList = null;
|
||||
/**************************************
|
||||
부정 판매 설정 이력 목록 조회
|
||||
* **************************************/
|
||||
// 건수 조회
|
||||
Integer itcSleTotCnt = mapper.selectBOItcSleMtngDtlTotCnt(boMaMtngVO);
|
||||
// 건수 갯수 페이징 vo에 set
|
||||
boMaMtngVO.getPaginationInfo().setTotalRecordCount(itcSleTotCnt);
|
||||
// 건수 > 0 일시 부정 판매 대상자 목록 조회
|
||||
if(itcSleTotCnt > 0) {
|
||||
resultList = mapper.selectBOItcSleMtngDtlInqire(boMaMtngVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
/**
|
||||
* 부정 판매 대상자 상세 조회 (지정 이력 정보)
|
||||
* @param boMaMtngVO
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOItcSleOrdrInfoInqire(BOMaMtngVO boMaMtngVO) {
|
||||
List<DataMap> resultList = null;
|
||||
/**************************************
|
||||
부정 판매 주문 이력 목록 조회
|
||||
* **************************************/
|
||||
// 건수 조회
|
||||
Integer itcSleTotCnt = mapper.selectBOItcSleOrdrInfoTotCnt(boMaMtngVO);
|
||||
|
||||
boMaMtngVO.getPaginationInfo().setTotalRecordCount(itcSleTotCnt);
|
||||
// 건수 > 0 일시 주문 이력 목록 조회
|
||||
if(itcSleTotCnt > 0) {
|
||||
resultList = mapper.selectBOItcSleOrdrInfoInqire(boMaMtngVO);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 부정 판매 대상자 및 주문 제한 여부 체크
|
||||
* @param instcSleVO
|
||||
* @return
|
||||
*/
|
||||
|
||||
// public void checkInstcSle(BOInstcSleVO instcSleVO) throws Exception {
|
||||
// log.debug("checkInstcSle(instcSleVO = {})", instcSleVO);
|
||||
//
|
||||
// /*주문 제한 여부 체크*/
|
||||
// BOInstcSleVO chkVO = new BOInstcSleVO();
|
||||
// instcSleVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
// chkVO = mapper.checkInstcSle(instcSleVO);
|
||||
// log.debug("chkVO = {}", chkVO);
|
||||
//
|
||||
// //주문 제한 일 시 throw
|
||||
// if ("Y".equals(chkVO.getIsInstcSle())) {
|
||||
// throw new WnbtRestException("고객님께서는 구매 제한 대상자에 해당하므로 상품을 구매하실 수 없습니다.");
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 부정 판매 대상자 및 주문 제한 여부 체크
|
||||
* @param instcSleVO
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> checkInstcSle(BOInstcSleVO instcSleVO) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "N");
|
||||
|
||||
String useAt = "N";
|
||||
BOPayVO payVO = new BOPayVO();
|
||||
payVO.setSopmalCd(instcSleVO.getSopmalCd());
|
||||
|
||||
/** (2025-06-02 CJH) : 부정판매 회의
|
||||
* 부정판매 모티러링 여부는 주문 이후 세팅된 조건에 맞을 경우 부정판매 등록하는 과정에서만 여부에 따라 움직임
|
||||
* 주문 등록시 배송지별 받는자 휴대폰번호, 배송지 모두 체크후 구매대상자 여부 체크
|
||||
*/
|
||||
/*주문 제한 여부 체크*/
|
||||
BOInstcSleVO chkVO = new BOInstcSleVO();
|
||||
instcSleVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
chkVO = mapper.checkInstcSle(instcSleVO);
|
||||
//주문 제한 일 시 throw
|
||||
if ("Y".equals(chkVO.getIsInstcSle())) {
|
||||
result.put("result", "Y");
|
||||
result.put("message", "고객님께서는 구매 대상자가 아닙니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 일반, 블랙리스트, 화이트리스트 변경.
|
||||
* @param instcSleVO
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> updateBOMbrRslrList(BOMbrAppnVO boMbrAppnVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
try {
|
||||
boMbrAppnVO.setOriginDvCd("02"); // 출처구분코드 "02" 수동
|
||||
boMbrMapper.updateBORslrAppn(boMbrAppnVO);
|
||||
|
||||
List<BOMbrAppnVO> list = boMbrMapper.selectBORslrAppn(boMbrAppnVO);
|
||||
log.debug("list = {}", list);
|
||||
|
||||
for(int i=0 ; i<list.size(); i++) {
|
||||
list.get(i).setLogChngDvCd("U");
|
||||
|
||||
boMbrMapper.insertBOAppnLog(list.get(i));
|
||||
}
|
||||
|
||||
content.put("result", "success");
|
||||
|
||||
} catch (WnbtRestException wre) {
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* 주문 전 요청 주문 정보에 따른 쿠폰리스트 확인
|
||||
* 재확인 대상 -> 상품 상태, 구매수량제한, 구매대상자제한, 상품옵션, 쿠폰 ,이벤트, 마일리지, 배송그룹
|
||||
* @param goodsList
|
||||
* @return String
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Map<String, Object> selectBOPreOrderValidationCouponList(List<BOPreOrderValidVO> goodsList){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "N");
|
||||
|
||||
String sopmalCd = goodsList.get(0).getSopmalCd();
|
||||
String mbrInnb = goodsList.get(0).getMbrInnb();
|
||||
String mbrDvCd = goodsList.get(0).getMbrDvCd();
|
||||
|
||||
BOPreOrderValidVO vo = new BOPreOrderValidVO();
|
||||
vo.setSopmalCd(sopmalCd);
|
||||
vo.setMbrInnb(mbrInnb);
|
||||
vo.setMbrDvCd(mbrDvCd);
|
||||
|
||||
//구매자 보유 쿠폰리스트 조회
|
||||
List<String> userCouponList = mapper.selectBOPreOrderValidationCouponList(vo);
|
||||
|
||||
|
||||
//구매자 보유 쿠폰리스트와 요청들어온 쿠폰리스트 비교
|
||||
if(!CollectionUtils.isEmpty(userCouponList)){
|
||||
|
||||
goodsList.forEach(goods -> {
|
||||
|
||||
if(!CollectionUtils.isEmpty(goods.getUsedDwladCouponInnbList())
|
||||
&& !"0".equals(goods.getUsedDwladCouponInnbList().get(0))){// 쿼리 Foreach때문에 아무것도 없을 경우 리스트에 0들어있음
|
||||
List<String> notExistCouponList = goods.getUsedDwladCouponInnbList().stream()
|
||||
.filter(couponInnb -> !userCouponList.contains(couponInnb)).toList();
|
||||
|
||||
if(!CollectionUtils.isEmpty(notExistCouponList)){
|
||||
result.put("notExistCouponList", notExistCouponList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
//존재하지 않는 쿠폰이 있을 경우
|
||||
if(result.containsKey("notExistCouponList")){
|
||||
log.error("보유하지 않은 쿠폰번호 존재로 구매 불가, 보유하지 않은 쿠폰번호 = {} , 요청 대상 = sopmalCd : {} mbrInnb : {} mbrDvCd : {}", result.get("notExistCouponList"), sopmalCd, mbrInnb, mbrDvCd);
|
||||
String resultMsg = PurchsValidCode.DO_NOT_HAVE_COUPON.getMsg();
|
||||
result.put("result", "Y");
|
||||
result.put("message", resultMsg);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 주문 전 요청 주문 정보에 따른 현재 컨디션 재확인
|
||||
* 재확인 대상 -> 상품 상태, 구매수량제한, 구매대상자제한, 상품옵션, 쿠폰 ,이벤트, 마일리지, 배송그룹
|
||||
* @param goodsList
|
||||
* @return String
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public Map<String, Object> selectBOPreOrderValidation(List<BOPreOrderValidVO> goodsList) throws WnbtRestException {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", "N");
|
||||
|
||||
|
||||
String mbrInnb = goodsList.get(0).getMbrInnb();
|
||||
String mbrDvCd = goodsList.get(0).getMbrDvCd();
|
||||
int useMlgAmt = Integer.parseInt(goodsList.get(0).getUseMlgAmt());
|
||||
int useCashMlgAmt = Integer.parseInt(goodsList.get(0).getUseCashMlgAmt());
|
||||
Set<String> validKeys = new HashSet<>(); // 변경 구매정보 리스트
|
||||
|
||||
//마일리지 잔액 확인
|
||||
BOMlgSrchVO mlgVo = new BOMlgSrchVO();
|
||||
mlgVo.setMbrInnb(Integer.parseInt(mbrInnb));
|
||||
mlgVo.setMbrDvCd(mbrDvCd);
|
||||
int restMlgAmt = boMlgService.selectBOMlgBlceSum(mlgVo).intValue();
|
||||
|
||||
//마일리지 잔액보다 사용금액이 더 많으면 메시지 출력
|
||||
if(restMlgAmt < useMlgAmt ){
|
||||
validKeys.add("useMlgAt");
|
||||
}
|
||||
|
||||
//GC 머니 잔액 확인
|
||||
BOCashVO cashVO = new BOCashVO();
|
||||
cashVO.setMbrInnb(mbrInnb);
|
||||
cashVO.setMbrDvCd(mbrDvCd);
|
||||
int restCashAmt = boMlgService.selectBOCashBlce(cashVO).intValue();
|
||||
|
||||
//GC 머니 잔액보다 사용금액이 더 많으면 메시지 출력
|
||||
if(restCashAmt < useCashMlgAmt ){
|
||||
validKeys.add("useCashMlgAt");
|
||||
}
|
||||
|
||||
for(BOPreOrderValidVO goods : goodsList) {
|
||||
|
||||
List<DataMap> resultValid = mapper.selectBOPreOrderValidation(goods);
|
||||
|
||||
//구매정보 변경대상 필터링
|
||||
// 값이 1인 항목 == 변경항목
|
||||
List<String> rs = resultValid.stream()
|
||||
.flatMap(map -> map.entrySet().stream())
|
||||
.filter(entry -> "1".equals(StringUtil.isNullToString(entry.getValue())))
|
||||
.map(entry -> StringUtil.isNullToString(entry.getKey()))
|
||||
.toList();
|
||||
|
||||
//구매정보 변경유형 저장
|
||||
validKeys.addAll(rs);
|
||||
|
||||
}
|
||||
|
||||
//구매정보가 변경되었을 경우
|
||||
if(!CollectionUtils.isEmpty(validKeys)){
|
||||
|
||||
String sopmalCd = goodsList.get(0).getSopmalCd();
|
||||
|
||||
log.error("구매정보변경에 따른 재구매 요청 = {}", validKeys);
|
||||
log.error("구매정보변경에 따른 재구매 요청 대상 = sopmalCd : {} mbrInnb : {} mbrDvCd : {}", sopmalCd, mbrInnb, mbrDvCd);
|
||||
|
||||
|
||||
StringBuilder returnMsg = new StringBuilder();
|
||||
|
||||
//상품구매수량제한걸렸을 경우
|
||||
if(validKeys.contains("purchsQyLmtt")){
|
||||
|
||||
returnMsg.append("구매수량 제한 상품입니다.");
|
||||
returnMsg.append(System.lineSeparator()); //줄바꿈
|
||||
|
||||
|
||||
//상품목록중 해당 구매수량제한이 걸린 상품 조회
|
||||
List<DataMap> purchsLimitGoodsList = boGoodsService.selectBOPreOrderValidPurchsQyLmtt(goodsList);
|
||||
|
||||
log.debug("구매 수량 제한 상품 목록 : {}", purchsLimitGoodsList);
|
||||
|
||||
// 상품 기준으로 병합
|
||||
List<DataMap> mergedList = purchsLimitGoodsList.stream()
|
||||
.collect(Collectors.toMap(
|
||||
dm -> (BigInteger) dm.get("goodsInnb"),
|
||||
dm -> dm,
|
||||
(existing, duplicate) -> existing
|
||||
))
|
||||
.values()
|
||||
.stream()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.debug("구매 수량 제한 상품 목록 mergedList : {}", mergedList);
|
||||
|
||||
for(DataMap purchsLimitGoods : mergedList){
|
||||
|
||||
returnMsg.append(purchsLimitGoods.get("goodsNm"))
|
||||
.append(" (")
|
||||
.append(purchsLimitGoods.get("mummPurchsQy"))
|
||||
.append("개 이상 ")
|
||||
.append(purchsLimitGoods.get("mxmmPurchsQy"))
|
||||
.append("개 이하 까지 구매 가능")
|
||||
.append(")")
|
||||
.append(System.lineSeparator()); //줄바꿈
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
//valudKeys에 첫번째 키 값을 사용자 메세지로 리턴
|
||||
for(String key : validKeys){
|
||||
if(StringUtils.hasText(key)){
|
||||
|
||||
returnMsg.append(PurchsValidCode.purchsValidMsg(key));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
result.put("result", "Y");
|
||||
result.put("message", returnMsg.toString());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 주문 전 요청 주문 정보에 따른 현재 컨디션 재확인관련 데이터(vo) 전처리
|
||||
* @param param 주문요청 데이터
|
||||
* @return List<BOPreOrderValidVO>
|
||||
*/
|
||||
public List<BOPreOrderValidVO> selectBOPreOrderValidationList(DataMap param){
|
||||
|
||||
List<BOPreOrderValidVO> result = new ArrayList<>();
|
||||
|
||||
|
||||
LinkedHashMap shipping = (LinkedHashMap) param.get("shipping"); // 주문유형
|
||||
List<LinkedHashMap> goodsList = (List<LinkedHashMap>) param.get("goodsList"); // 상품정보
|
||||
LinkedHashMap enuri = (LinkedHashMap) param.get("enuri"); // 할인정보
|
||||
|
||||
//사용한 장바구니 쿠폰
|
||||
//비회원의 경우 enuri 자체가 없어서 isEmpty 확인
|
||||
List<LinkedHashMap> usedCartCouponList = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(enuri)){
|
||||
usedCartCouponList = (List<LinkedHashMap>) enuri.get("usedCartCouponList");
|
||||
}
|
||||
|
||||
|
||||
//상품별 총 구매갯수 합계
|
||||
Map<String, Integer> qySums = goodsList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
// goodsInnb기준 키로 묶음
|
||||
goods -> goods.get("goodsInnb").toString(),
|
||||
// qy 값을 합산
|
||||
Collectors.summingInt(goods -> Integer.parseInt(goods.getOrDefault("qy", "0").toString()))
|
||||
));
|
||||
|
||||
|
||||
//사용한 상품금액할인쿠폰
|
||||
// 중복 제거를 위해 Set
|
||||
Set<LinkedHashMap> usedGoodsCouponListSet = goodsList.stream()
|
||||
.map(goods -> (List<LinkedHashMap>) goods.getOrDefault("usedGoodsCouponList", new ArrayList<LinkedHashMap>()))
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
|
||||
//사용한 배송비 쿠폰
|
||||
List<LinkedHashMap> shippingCoupon = (List<LinkedHashMap>) shipping.getOrDefault("usedDlvylcCouponList", new ArrayList<LinkedHashMap>());
|
||||
|
||||
|
||||
//사용하는 다운로드 쿠폰 고유번호 list 생성
|
||||
List<String> usedDwladCouponInnbList = new ArrayList<>();
|
||||
|
||||
//각 쿠폰리스트에서 다운로드쿠폰번호 추출
|
||||
getDwldCouponInnbList(usedCartCouponList, usedDwladCouponInnbList);
|
||||
|
||||
getDwldCouponInnbList(usedGoodsCouponListSet, usedDwladCouponInnbList);
|
||||
|
||||
getDwldCouponInnbList(shippingCoupon, usedDwladCouponInnbList);
|
||||
|
||||
|
||||
|
||||
//이벤트 정보
|
||||
//goodsList안에 goodsDscntDtlsList리스트에 evtInnb가 존재할 경우 이벤트 List 생성
|
||||
List<LinkedHashMap> evtList = goodsList.stream()
|
||||
.filter(goods -> goods.get("goodsDscntDtlsList") != null && !CollectionUtils.isEmpty((List<LinkedHashMap>) goods.get("goodsDscntDtlsList")))
|
||||
.map(dataMap -> {
|
||||
List<LinkedHashMap> goodsDscntDtlsList = (List<LinkedHashMap>) dataMap.get("goodsDscntDtlsList");
|
||||
return goodsDscntDtlsList.stream()
|
||||
.filter(goodsDscntDtls -> goodsDscntDtls.containsKey("evtInnb"))
|
||||
.toList();
|
||||
}).flatMap(Collection::stream).toList();
|
||||
|
||||
|
||||
//데이터 구성
|
||||
goodsList.forEach(goods -> {
|
||||
|
||||
String goodsInnb = StringUtil.isNullToString(goods.get("goodsInnb"));
|
||||
|
||||
|
||||
//상품별 수량합계
|
||||
int goodsTotalQy = 0;
|
||||
if(qySums.containsKey(goodsInnb)){
|
||||
goodsTotalQy = qySums.getOrDefault(goodsInnb, 0);
|
||||
}
|
||||
|
||||
|
||||
//해당 상품이 이벤트에 해당할 경우 이벤트 고유번호 넣기
|
||||
String evtInnb = "0";
|
||||
|
||||
for(LinkedHashMap evt : evtList){
|
||||
if(goods.get("goodsOptnInnb").equals(evt.get("goodsOptnInnb"))){
|
||||
evtInnb = evt.get("evtInnb").toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//사용한 다운로드 쿠폰 목록 빈배열 처리
|
||||
if(CollectionUtils.isEmpty(usedDwladCouponInnbList)){
|
||||
usedDwladCouponInnbList.add("0");
|
||||
}
|
||||
|
||||
String useMlgAmt = "0";
|
||||
|
||||
if(!CollectionUtils.isEmpty(enuri) && enuri.containsKey("useMlgAmt")){
|
||||
useMlgAmt = ObjectUtils.isEmpty(enuri.get("useMlgAmt"))? "0" : String.valueOf(enuri.get("useMlgAmt"));
|
||||
}
|
||||
|
||||
String useCashMlgAmt = "0";
|
||||
|
||||
if(!CollectionUtils.isEmpty(enuri) && enuri.containsKey("useCashMlgAmt")){
|
||||
useCashMlgAmt = ObjectUtils.isEmpty(enuri.get("useCashMlgAmt"))? "0" : String.valueOf(enuri.get("useCashMlgAmt"));
|
||||
}
|
||||
|
||||
result.add(
|
||||
BOPreOrderValidVO.builder()
|
||||
.sopmalCd(StringUtil.isNullToString(goods.get("sopmalCd")))
|
||||
.goodsInnb(StringUtil.isNullToString(goods.get("goodsInnb")))
|
||||
.goodsOptnInnb(StringUtil.isNullToString(goods.get("goodsOptnInnb")))
|
||||
.mbrInnb(StringUtil.isNullToString(goods.get("mbrInnb")))
|
||||
.mbrDvCd(StringUtil.isNullToString(goods.get("mbrDvCd")))
|
||||
.qy(StringUtil.isNullToString(goods.get("qy")))
|
||||
.goodsTotalQy(goodsTotalQy)
|
||||
.slepric(StringUtil.isNullToString(goods.get("slepric")))
|
||||
.compnbDscntAt(StringUtil.isNullToString(goods.get("compnbDscntAt")))
|
||||
.sctnDscntAt(StringUtil.isNullToString(goods.get("sctnDscntAt")))
|
||||
.dlvyGroupInnb(StringUtil.isNullToString(goods.get("dlvyGroupInnb")))
|
||||
.useMlgAmt(StringUtil.isNullToString(useMlgAmt))
|
||||
.useCashMlgAmt(StringUtil.isNullToString(useCashMlgAmt))
|
||||
.evtInnb(evtInnb)
|
||||
.usedDwladCouponInnbList(usedDwladCouponInnbList)
|
||||
.usedDwladCouponInnbListSize(usedDwladCouponInnbList.size())
|
||||
.build()
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/** 쇼핑몰 구매요청 재검증 확인 여부
|
||||
* @parma sopmalCd 쇼핑몰 구분코드
|
||||
* @return Y or N
|
||||
* */
|
||||
public String selectPurchsValidUseAt(String sopmalCd){
|
||||
return mapper.selectPurchsValidUseAt(sopmalCd);
|
||||
}
|
||||
|
||||
|
||||
/** 사용한 쿠폰리스트에 고유번호 추출하여 리스트에 담는 함수
|
||||
* @param usedCouponList 사용한 쿠폰리스트
|
||||
* @param usedDwladCouponInnbList 사용한 쿠폰 리스트에서 고유번호를 담는 리스트
|
||||
*
|
||||
* */
|
||||
private void getDwldCouponInnbList(Collection<LinkedHashMap> usedCouponList, List<String> usedDwladCouponInnbList) {
|
||||
if(!CollectionUtils.isEmpty(usedCouponList)){
|
||||
|
||||
usedCouponList.forEach(usedCoupon -> {
|
||||
if(usedCoupon.containsKey("dwldCouponInnb")){
|
||||
usedDwladCouponInnbList.add(String.valueOf(usedCoupon.get("dwldCouponInnb")));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOInstcSleVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* 쇼핑몰코드(FK) */
|
||||
private String sopmalCd;
|
||||
|
||||
/* 주문 유형 */
|
||||
private String ordrTyCd;
|
||||
|
||||
/* 제한대상자여부 */
|
||||
private String isInstcSle;
|
||||
|
||||
/*대상자 조회 정보*/
|
||||
/*회원고유번호*/
|
||||
private String mbrInnb;
|
||||
|
||||
/*회원구분코드*/
|
||||
private String mbrDvCd;
|
||||
|
||||
/*에이전트id*/
|
||||
private String agentId;
|
||||
|
||||
/*주문자핸드폰번호*/
|
||||
private String ordrrMbtlnb;
|
||||
|
||||
/*주문자핸드폰번호*/
|
||||
private String[] recpntMbtlnbArr;
|
||||
|
||||
/*주소*/
|
||||
private String adres;
|
||||
|
||||
/*주소 배열*/
|
||||
private String[] adresMulti;
|
||||
|
||||
/*부정판매자구분*/
|
||||
private String appnDvCd;
|
||||
|
||||
/*시크릿키*/
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaMtngSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**검색어타입*/
|
||||
private String srchType;
|
||||
/**검색어*/
|
||||
private String srchStr;
|
||||
/**브랜드명*/
|
||||
private String srchShop;
|
||||
/**식별기준검색*/
|
||||
private List<String> srchIdntfcDvCd;
|
||||
/**리셀러구분*/
|
||||
private String srchAppn;
|
||||
/**지정일 검색 시작*/
|
||||
private String srchStrtRegDt;
|
||||
/**지정일 검색 끝*/
|
||||
private String srchEndRegDt;
|
||||
|
||||
/*시크릿키*/
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaMtngVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**이메일 발송 고유번호*/
|
||||
private String emailSndngInnb ;
|
||||
|
||||
/*지정이력고유번호(PK)*/
|
||||
private String appnLogInnb;
|
||||
/*지정고유번호(FK)*/
|
||||
private String appnInnb;
|
||||
/*쇼핑몰코드(FK)*/
|
||||
private String sopmalCd;
|
||||
/*지정구분코드*/
|
||||
private String appnDvCd;
|
||||
/*식별기준코드*/
|
||||
private String idntfcStdrCd;
|
||||
/*식별정보*/
|
||||
private String idntfcInfo;
|
||||
/*회원구분코드*/
|
||||
private String mbrDvCd;
|
||||
/*주문고유번호*/
|
||||
private String ordrInnb;
|
||||
/*메모*/
|
||||
private String appnMemo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BOPreOrderValidVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/*쇼핑몰코드*/
|
||||
private String sopmalCd;
|
||||
|
||||
/*상품고유번호*/
|
||||
private String goodsInnb;
|
||||
|
||||
/*상품옵션고유번호*/
|
||||
private String goodsOptnInnb;
|
||||
|
||||
/*회원고유번호*/
|
||||
private String mbrInnb;
|
||||
|
||||
/*회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
|
||||
/*구매상품옵션 갯수 */
|
||||
private String qy;
|
||||
|
||||
/*상품별 총 구매갯수 합계*/
|
||||
private int goodsTotalQy;
|
||||
|
||||
/*상품옵션 원 판매가*/
|
||||
private String slepric;
|
||||
|
||||
/*복수할인여부*/
|
||||
private String compnbDscntAt;
|
||||
|
||||
/*구간할인여부*/
|
||||
private String sctnDscntAt;
|
||||
|
||||
/*배송그룹고유번호*/
|
||||
private String dlvyGroupInnb;
|
||||
|
||||
/*사용 마일리지 합계*/
|
||||
private String useMlgAmt;
|
||||
|
||||
/*사용 GC 머니 합계*/
|
||||
private String useCashMlgAmt;
|
||||
|
||||
/*이벤트 고유번호*/
|
||||
private String evtInnb;
|
||||
|
||||
/*사용하는 다운로드쿠폰 고유번호 리스트*/
|
||||
private List<String> usedDwladCouponInnbList;
|
||||
|
||||
/*사용하는 다운로드쿠폰 고유번호 리스트 갯수*/
|
||||
private int usedDwladCouponInnbListSize;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaMtngSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**쇼핑몰코드*/
|
||||
private String srchShop;
|
||||
/**검색 시작 주문 금액 날짜 */
|
||||
private String srchStrtRegDt;
|
||||
/**검색 종료 주문 금액 날짜 */
|
||||
private String srchEndRegDt ;
|
||||
|
||||
/**리셀러구분*/
|
||||
private String srchAppn;
|
||||
|
||||
/**이메일 발송 고유번호*/
|
||||
private String emailSndngInnb ;
|
||||
|
||||
/**식별기준검색*/
|
||||
public List<String> srchIdntfcDvCd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.wb.domainserver.domain.admin.instcSle.mtng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaMtngVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**회원식별정보*/
|
||||
public String mbrIdntfcInfo;
|
||||
|
||||
/*페이징 유지*/
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**쇼핑몰코드*/
|
||||
private String srchShop;
|
||||
/**검색 시작 주문 금액 날짜 */
|
||||
private String srchStrtRegDt;
|
||||
/**검색 종료 주문 금액 날짜 */
|
||||
private String srchEndRegDt ;
|
||||
/**검색 종료 주문 금액 날짜 */
|
||||
private List<String> srchIdntfcDvCd ;
|
||||
|
||||
/**리셀러구분*/
|
||||
private String srchAppn;
|
||||
|
||||
/**이메일 발송 고유번호*/
|
||||
private String emailSndngInnb ;
|
||||
|
||||
/*지정이력고유번호(PK)*/
|
||||
private String appnLogInnb;
|
||||
/*지정고유번호(FK)*/
|
||||
private String appnInnb;
|
||||
/*쇼핑몰코드(FK)*/
|
||||
private String sopmalCd;
|
||||
/*지정구분코드*/
|
||||
private String appnDvCd;
|
||||
/*식별기준코드*/
|
||||
private String idntfcStdrCd;
|
||||
/*식별정보*/
|
||||
private String idntfcInfo;
|
||||
/*회원구분코드*/
|
||||
private String mbrDvCd;
|
||||
/*주문고유번호*/
|
||||
private String ordrInnb;
|
||||
/*메모*/
|
||||
private String appnMemo;
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.wb.domainserver.domain.admin.login;
|
||||
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.vo.Shop;
|
||||
import com.wb.domainserver.domain.admin.user.mngr.vo.BOJobUserVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.gcone.login.service.LoginService;
|
||||
import com.wb.domainserver.domain.gcone.login.vo.LoginRequest;
|
||||
import com.wb.domainserver.domain.gcone.login.vo.LoginUser;
|
||||
import com.wb.domainserver.realm.RealmContextHolder;
|
||||
import com.wb.domainserver.realm.util.UrlExtractor;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtResponseBody;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.security.jwt.service.TokenService;
|
||||
import com.wb.domainserver.security.jwt.vo.TokenInfo;
|
||||
import com.wb.domainserver.util.CookieUtils;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin")
|
||||
public class AdminLoginController {
|
||||
|
||||
private final LoginService service;
|
||||
private final TokenService tokenService;
|
||||
private final BOMaSopmalService bomaSopmalService;
|
||||
private final BOCommonService commonService;
|
||||
|
||||
@Value("${jwt.refresh.max-age}")
|
||||
private int refreshTokenMaxAge;
|
||||
|
||||
/**
|
||||
* 사용자 로그인 페이지 진입시 이전 경로 저장 및 로그인 페이지 이동 처리
|
||||
* @return
|
||||
*/
|
||||
@Policy(value = AuthPolicy.PUBLIC)
|
||||
@GetMapping("/login")
|
||||
@ResponseBody
|
||||
public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
|
||||
String realm = RealmContextHolder.getRealm();
|
||||
|
||||
String redirectUri = request.getParameter("redirect_uri");
|
||||
String sopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||
|
||||
response.sendRedirect("/"+realm+"/login/page/"+realm+"?redirect_uri=%s&sopmalCd=%s".formatted(UriUtils.encode(redirectUri, StandardCharsets.UTF_8), UriUtils.encode(sopmalCd, StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 로그인 처리
|
||||
* @return
|
||||
*/
|
||||
@Policy(value = AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/login/admin", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<WnbtResponse> loginProcess(@RequestBody LoginRequest loginRequest,
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response
|
||||
) {
|
||||
|
||||
log.debug("admin loginRequest :: {}", loginRequest);
|
||||
|
||||
//로그인 진행
|
||||
LoginUser loginUser = null;
|
||||
|
||||
String realm = RealmContextHolder.getRealm().toLowerCase();
|
||||
|
||||
loginRequest.setSopmalCd(RealmContextHolder.getSopmalCdRealm());
|
||||
|
||||
loginUser = service.adminLogin(loginRequest);
|
||||
loginUser.setSysDvCd("03");
|
||||
|
||||
|
||||
log.debug("loginUser :: {}", loginUser);
|
||||
|
||||
//토큰 발급
|
||||
service.createLoginToken(loginUser, request, response);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message.put("result", "success");
|
||||
message.put("redirectUri", loginRequest.getRedirectUri());
|
||||
message.put("env", request.getAttribute("env"));
|
||||
|
||||
return ResponseEntity.ok(WnbtResponse.builder()
|
||||
.resBody(new WnbtResponseBody(message))
|
||||
.build());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 로그인 페이지 이동
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/login/page/admin")
|
||||
@Policy(value = AuthPolicy.PUBLIC)
|
||||
public String loginPage(HttpServletRequest request, ModelMap model) {
|
||||
|
||||
String redirectUri = request.getParameter("redirect_uri");
|
||||
String accessUrl = StringUtils.hasText(request.getParameter("access_url"))? request.getParameter("access_url") : RealmContextHolder.getOriginalHostRealm();
|
||||
String sopmalCd = request.getParameter("sopmalCd");
|
||||
|
||||
|
||||
//쇼핑몰 테마 등 정보 조회
|
||||
Shop shopInfo = bomaSopmalService.selectSopmalInfo(sopmalCd);
|
||||
|
||||
model.addAttribute("redirectUri", redirectUri);
|
||||
model.addAttribute("accessUrl", accessUrl);
|
||||
model.addAttribute("sopmalCd", sopmalCd);
|
||||
model.addAttribute("realm", RealmContextHolder.getRealm().toLowerCase());
|
||||
model.addAttribute("shopInfo", shopInfo);
|
||||
|
||||
return "login/login-ADMIN";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/tokens/refresh")
|
||||
public void refreshToken(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
|
||||
String realm = RealmContextHolder.getRealm().toLowerCase();
|
||||
|
||||
String refreshToken = CookieUtils.getCookieValue("RFT", request);
|
||||
|
||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||
if(!StringUtils.hasText(refreshToken)){
|
||||
|
||||
//엑세스토큰 삭제
|
||||
CookieUtils.deleteCookie("ACT","/"+realm, request, response);
|
||||
CookieUtils.deleteCookie("token_expire","/"+realm, request, response);
|
||||
|
||||
response.sendRedirect("/"+realm);
|
||||
|
||||
}
|
||||
|
||||
//리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님)
|
||||
service.createRenewLoginToken(request, response);
|
||||
|
||||
String redirectUri = "/"+realm+"/main";
|
||||
//리다이렉트 url 있을 경우 해당 url로 이동
|
||||
if(StringUtils.hasText(request.getParameter("redirect_uri"))){
|
||||
redirectUri = request.getParameter("redirect_uri");
|
||||
|
||||
}
|
||||
response.sendRedirect(redirectUri);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(request.getCookies() != null){
|
||||
|
||||
for(Cookie cookie: request.getCookies()){
|
||||
|
||||
if("RFT".equals(cookie.getName())){
|
||||
refreshToken = cookie.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//리프레쉬 토큰이 없으면 메인으로 이동 처리
|
||||
if(!StringUtils.hasText(refreshToken)){
|
||||
|
||||
//엑세스토큰 삭제
|
||||
if(request.getCookies() != null){
|
||||
|
||||
for(Cookie cookie: request.getCookies()){
|
||||
|
||||
if("ACT".equals(cookie.getName())){
|
||||
cookie.setMaxAge(0);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
response.sendRedirect("/"+realm.toLowerCase());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//리프레쉬 토큰 있을 경우(존재한다는 자체가 refresh토큰이 만료된 상태가 아님)
|
||||
service.createRenewLoginToken( request, response);
|
||||
|
||||
//리다이렉트 url 있을 경우 해당 url로 이동
|
||||
if(StringUtils.hasText(request.getParameter("redirectUrl"))){
|
||||
|
||||
response.sendRedirect(request.getParameter("redirectUrl"));
|
||||
|
||||
}else{
|
||||
response.sendRedirect(UrlExtractor.getOriginalHost(request)+realm.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그인 2차 인증
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@Policy(value = AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/login/loginCheck", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> loginCheck(@RequestBody LoginRequest loginRequest, HttpServletRequest request, HttpServletResponse response) {
|
||||
BOJobUserVO vo = new BOJobUserVO();
|
||||
vo.setMngrId(loginRequest.getUsername());
|
||||
vo.setPassword(loginRequest.getPassword());
|
||||
|
||||
String secretKey = commonService.selectSecretkey();
|
||||
vo.setSecretKey(secretKey);
|
||||
|
||||
//회원정보 조회
|
||||
DataMap result = service.selectBOJobUserCrtfcInfo(loginRequest, vo);
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("result", result);
|
||||
|
||||
if(result != null){
|
||||
String lmttIp = (String) result.get("lmttIp");
|
||||
String mblphonCrtfcAt = (String) result.get("mblphonCrtfcAt");
|
||||
String mngrNm = (String) result.get("mngrNm");
|
||||
String mbtlnb = (String) result.get("mbtlnb");
|
||||
|
||||
String lmttIpAt = "N";
|
||||
// String clientIp = String.valueOf(request.getAttribute("LoggingClientIp"));
|
||||
String clientIp = request.getHeader("X-Forwarded-For");
|
||||
log.debug("clientIp X-Forwarded-For {}", clientIp);
|
||||
|
||||
if (clientIp != null && clientIp.contains(",")) {
|
||||
clientIp = clientIp.split(",")[0].trim();
|
||||
log.debug("clientIp split {}", clientIp);
|
||||
}
|
||||
if (clientIp == null || clientIp.isEmpty()) {
|
||||
clientIp = request.getRemoteAddr();
|
||||
log.debug("clientIp getRemoteAddr: {}", clientIp);
|
||||
}
|
||||
|
||||
log.debug("whitelist Ips {}", lmttIp);
|
||||
if (lmttIp != null && !lmttIp.isEmpty()) {
|
||||
for (String lmttIpOne : lmttIp.split("\\|")) {
|
||||
if(lmttIpOne.trim().equals(clientIp)) {
|
||||
lmttIpAt = "Y";
|
||||
}
|
||||
log.debug("whitelist Ip {}", lmttIpOne);
|
||||
}
|
||||
} else {
|
||||
lmttIpAt = "Y";
|
||||
}
|
||||
content.put("lmttIpAt", lmttIpAt);
|
||||
|
||||
// 2차인증 여부
|
||||
if (mblphonCrtfcAt.equals("Y")) {
|
||||
content.put("mngrNm", mngrNm);
|
||||
content.put("mbtlnb", mbtlnb);
|
||||
}
|
||||
content.put("mblphonCrtfcAt", mblphonCrtfcAt);
|
||||
} else{
|
||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.wb.domainserver.domain.admin.main.controller;
|
||||
|
||||
import com.wb.domainserver.domain.admin.main.service.BOMaMainService;
|
||||
import com.wb.domainserver.domain.admin.main.vo.BOMaMainVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/main")
|
||||
@Slf4j
|
||||
public class BOMaMainController {
|
||||
|
||||
@Autowired
|
||||
private BOMaMainService service;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMaMainAccessInqire")
|
||||
public ResponseEntity<?> selectBOMaMainAccessInqire(@RequestBody BOMaMainVO boMaMainVO) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
//쇼핑몰 조회
|
||||
resultMap.put("access",service.selectBOMaMainAccessInqire(boMaMainVO));
|
||||
|
||||
return ApiResponse.of(resultMap).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.wb.domainserver.domain.admin.main.controller;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.admin.main.service.BOMaMainService;
|
||||
import com.wb.domainserver.domain.admin.main.vo.BOMaMainVO;
|
||||
import com.wb.domainserver.domain.admin.main.vo.MaMainVO;
|
||||
import com.wb.domainserver.realm.RealmContextHolder;
|
||||
import com.wb.domainserver.realm.util.UrlExtractor;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/admin")
|
||||
@Slf4j
|
||||
public class MaMainController {
|
||||
|
||||
// @Value("${spring.security.oauth2.resourceserver.jwt.issuer-uri}")
|
||||
String issuerUri;
|
||||
|
||||
@Autowired
|
||||
private BOMaMainService service;
|
||||
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
/**
|
||||
* 통합관리자 index 화면
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/main")
|
||||
public String selectAdminMainInqire(MaMainVO maMainVO, ModelMap model) {
|
||||
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
maMainVO.setMngrInnb(String.valueOf(user.getUserInnb()));
|
||||
|
||||
BOMaMainVO boMaMainVO = new BOMaMainVO();
|
||||
boMaMainVO.setMngrInnb(maMainVO.getMngrInnb());
|
||||
|
||||
//쇼핑몰 조회
|
||||
Map<String, Object> resultMap = service.selectBOMaMainAccessInqire(boMaMainVO);
|
||||
|
||||
model.addAttribute("resultMap",resultMap);
|
||||
|
||||
return "admin/index";
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "")
|
||||
public void selectAdminRootInqire(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String realm = RealmContextHolder.getRealm().toLowerCase();
|
||||
String redirectUri = request.getParameter("redirect_uri");
|
||||
String sopmalCd = RealmContextHolder.getSopmalCdRealm();
|
||||
|
||||
response.sendRedirect("/"+realm+"/login/page/"+realm+"?redirect_uri=%s&sopmalCd=%s".formatted(UriUtils.encode(redirectUri, StandardCharsets.UTF_8), UriUtils.encode(sopmalCd, StandardCharsets.UTF_8)));
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@GetMapping("/")
|
||||
public String root(HttpServletRequest request) {
|
||||
return UrlExtractor.redirect(request, "/"+RealmContextHolder.getRealm().toLowerCase());
|
||||
}
|
||||
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/main/selectSopmal")
|
||||
public String selectSopmalInqire(HttpServletRequest request) {
|
||||
return UrlExtractor.redirect(request, "/main");
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 통합관리자 로그아웃
|
||||
// * @return
|
||||
// */
|
||||
// @Policy(AuthPolicy.PUBLIC)
|
||||
// @RequestMapping(value="/admin/logout")
|
||||
// public String adminLogout(HttpServletRequest request, HttpSession session) {
|
||||
// session.invalidate();
|
||||
// request.getSession().invalidate();
|
||||
// request.getSession(true);
|
||||
// String returnUrl = issuerUri+"/login";
|
||||
// return "redirect:"+returnUrl;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.wb.domainserver.domain.admin.main.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.main.vo.BOMaMainVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaMainMapper {
|
||||
|
||||
public Map<String, Object> selectBOMaMainAccessInqire(BOMaMainVO boMaMainVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.wb.domainserver.domain.admin.main.service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.main.mapper.BOMaMainMapper;
|
||||
import com.wb.domainserver.domain.admin.main.vo.BOMaMainVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BOMaMainService {
|
||||
|
||||
@Autowired
|
||||
private BOMaMainMapper mapper;
|
||||
|
||||
public Map<String, Object> selectBOMaMainAccessInqire(BOMaMainVO boMaMainVO) {
|
||||
|
||||
Map<String, Object> result = mapper.selectBOMaMainAccessInqire(boMaMainVO);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.wb.domainserver.domain.admin.main.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaMainVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 통합관리자 이름 */
|
||||
String mngrNm;
|
||||
|
||||
/** 관리자 id */
|
||||
String mngrId;
|
||||
|
||||
/** 등록일 */
|
||||
String registDe;
|
||||
|
||||
/** 등록시간 */
|
||||
String registHms;
|
||||
|
||||
/** 관리자 식별번호 */
|
||||
String mngrInnb;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.wb.domainserver.domain.admin.main.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaMainVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 통합관리자 이름 */
|
||||
String mngrNm;
|
||||
|
||||
/** 관리자 id */
|
||||
String mngrId;
|
||||
|
||||
/** 등록일 */
|
||||
String registDe;
|
||||
|
||||
/** 등록시간 */
|
||||
String registHms;
|
||||
|
||||
/** 관리자 식별번호 */
|
||||
String mngrInnb;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.service.BOMaAtmcSndngService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo.BOMaAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.atmcsndng.service.BOAtmcSndngService;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.atmcsndng.vo.BOAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.vo.BOMssageSrchVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/ntcn/atmcsndng")
|
||||
public class BOMaAtmcSndngController {
|
||||
|
||||
@Autowired
|
||||
private BOMaAtmcSndngService service;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 조회
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOAtmcSndngManageListInqire")
|
||||
public ResponseEntity<?> selectBOAtmcSndngManageListInqire(@RequestBody BOMaAtmcSndngVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
vo.setFormDvCd("FORM_DV_");
|
||||
|
||||
//시스템 02
|
||||
vo.setMngrDv("02");
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//검색 폼 code
|
||||
List<DataMap> sopmal = service.selectBOSopmalAtmcSndng();
|
||||
content.put("sopmal",sopmal);
|
||||
//초기 쇼핑몰 코드 없을 경우 목록의 첫번째 입력
|
||||
if("".equals(StringUtil.isNullToString(vo.getSopmalCd()))) {
|
||||
vo.setSopmalCd(StringUtil.isNullToString(sopmal.get(0).get("sopmalCd")));
|
||||
}
|
||||
content.put("bOAtmcSndngVO", vo);
|
||||
content.put("boCtrlMap", service.selectBOAtmcSndngManageListInqire(vo));
|
||||
content.put("shopAtmcSndntTme", service.selectBOShopAtmcSndngTme(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 수정
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOAtmcSndngManageUpdt")
|
||||
public ResponseEntity<?> updateBOAtmcSndngManageUpdt(@RequestBody BOMaAtmcSndngVO boAtmcSndngVO) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
boAtmcSndngVO.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.updateBOAtmcSndngManageUpdt(boAtmcSndngVO);
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo.MaAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.mngr.ntcn.atmcsndng.vo.AtmcSndngVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.ReplyFromResrc;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.communicate.ValidateResultConverter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 Controller
|
||||
*
|
||||
* @author rvg
|
||||
* @version 1.0
|
||||
* @see <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-03-04 리브가 최초 생성
|
||||
* 2024-05-01 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
* @since 2024-03-04
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/ntcn/atmcsndng")
|
||||
public class MaAtmcSndngController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 페이지
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAtmcSndngManage")
|
||||
public String selectAtmcSndngManage() {
|
||||
log.debug("자동 발송 관리 페이지 진입");
|
||||
return "admin/ntcn/atmcsndng/MaAtmcSndngManage";
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 > 자동 발송 관리 폼
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAtmcSndngManageListInqire")
|
||||
public String selectAtmcSndngManageListInqire(MaAtmcSndngVO vo, ModelMap model) {
|
||||
|
||||
log.debug("자동 발송 관리 진입 =>{}", vo);
|
||||
|
||||
try {
|
||||
|
||||
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/atmcsndng/selectBOAtmcSndngManageListInqire", vo)
|
||||
);
|
||||
|
||||
model.addAttribute("resultListMap", resultMap.get("boCtrlMap"));
|
||||
model.addAttribute("bOAtmcSndngVO",resultMap.get("bOAtmcSndngVO"));
|
||||
model.addAttribute("sopmal", resultMap.get("sopmal"));
|
||||
|
||||
model.addAttribute("shopAtmcSndntTme", resultMap.get("shopAtmcSndntTme"));
|
||||
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/atmcsndng/MaAtmcSndngListR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 페이지 > 자동 발송 관리 - 자동 발송 관리 수정
|
||||
* @param vo
|
||||
* @param bindingResult 바인딩 및 정합성 점검결과 객체
|
||||
* @return ResponseEntity<WnbtResponse>
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/updateAtmcSndngManage", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> updateAtmcSndngManage(@Validated AtmcSndngVO atmcSndngVO, BindingResult bindingResult){
|
||||
|
||||
log.debug("자동 발송 관리 수정 FO 파라미터 vo =>{}", atmcSndngVO);
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/atmcsndng/updateBOAtmcSndngManageUpdt", atmcSndngVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo.BOMaAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.atmcsndng.vo.BOAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.vo.BOMssageSrchVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaAtmcSndngMapper {
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 조회
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOAtmcSndngManageListInqire(BOMaAtmcSndngVO vo);
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 수정
|
||||
* @param voList
|
||||
* @return
|
||||
*/
|
||||
public void updateBOAtmcSndngManageUpdt(List<BOMaAtmcSndngVO> voList);
|
||||
|
||||
/* 이메일 템플릿 사용여부 수정 */
|
||||
public void updateBOEmailTmplatUseAt(List<BOMaAtmcSndngVO> voList);
|
||||
/* 메시지 템플릿 사용여부 수정 */
|
||||
public void updateBOMssageTmplatUseAt(List<BOMaAtmcSndngVO> voList);
|
||||
/* 알림톡 템플릿 사용여부 수정 */
|
||||
public void updateBOKakaoTmplatUseAt(List<BOMaAtmcSndngVO> voList);
|
||||
|
||||
|
||||
/**
|
||||
* 자동발송 가능 시간 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
DataMap selectBOShopAtmcSndngTme(BOMaAtmcSndngVO vo);
|
||||
|
||||
/**
|
||||
* 통합관리자 자동발송관리 쇼핑몰 조회
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOSopmalAtmcSndng();
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.mapper.BOMaAtmcSndngMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo.BOMaAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.mapper.BOMaEmailMapper;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.atmcsndng.mapper.BOAtmcSndngMapper;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.atmcsndng.vo.BOAtmcSndngVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.vo.BOMssageSrchVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BOMaAtmcSndngService {
|
||||
|
||||
@Autowired
|
||||
private BOMaAtmcSndngMapper mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOAtmcSndngManageListInqire(BOMaAtmcSndngVO vo) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOAtmcSndngManageListInqire(vo);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동 발송 관리 수정
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> updateBOAtmcSndngManageUpdt(BOMaAtmcSndngVO boAtmcSndngVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message.put("status", "0");
|
||||
message.put("message", "");
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<BOMaAtmcSndngVO> atmcSndngList = new ArrayList<>();
|
||||
|
||||
String atmcSndngStr = StringUtil.isNullToString(boAtmcSndngVO.getAtmcSndngList());
|
||||
|
||||
//전달된 데이터가 있을 경우
|
||||
if(!"".equals(atmcSndngStr)) {
|
||||
try {
|
||||
atmcSndngList = objectMapper.readValue(boAtmcSndngVO.getAtmcSndngList(),
|
||||
new TypeReference<List<BOMaAtmcSndngVO>>() {});
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//쇼핑몰 코드 세팅
|
||||
atmcSndngList = atmcSndngList.stream()
|
||||
.map(vo -> {
|
||||
vo.setSopmalCd(boAtmcSndngVO.getSopmalCd());
|
||||
return vo;
|
||||
}).toList();
|
||||
|
||||
mapper.updateBOAtmcSndngManageUpdt(atmcSndngList);
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 자동발송 가능 시간 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectBOShopAtmcSndngTme(BOMaAtmcSndngVO vo) {
|
||||
DataMap resultMap = new DataMap();
|
||||
resultMap = mapper.selectBOShopAtmcSndngTme(vo);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 자동발송관리 쇼핑몰 조회
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOSopmalAtmcSndng() {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOSopmalAtmcSndng();
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaAtmcSndngVO extends AbstractVO {
|
||||
/** 메시지 고유번호 */
|
||||
private String messageInnb;
|
||||
/** 이메일 발송양식 고유번호 */
|
||||
private String emailSndngFormInnb;
|
||||
/** SMS발송양식 고유번호 */
|
||||
private String smsSndngFormInnb;
|
||||
/** 알림톡 발송양식 고유번호 */
|
||||
private String ntcntalkSndngFormInnb;
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 양식구분 */
|
||||
private String formDvCd;
|
||||
/** 양식상세구분 */
|
||||
private String formDtlDvCd;
|
||||
|
||||
/** 이메일 사용여부 */
|
||||
private String emailUseAt;
|
||||
/** SMS 사용여부 */
|
||||
private String smsUseAt;
|
||||
/** 알림톡 사용여부 */
|
||||
private String ntcntalkUseAt;
|
||||
|
||||
/** 마케팅 여부 */
|
||||
private String marktAt;
|
||||
|
||||
/** 관리자 구분 */
|
||||
private String mngrDv;
|
||||
/** 노출여부 */
|
||||
private String expsrAt;
|
||||
|
||||
/** 발송기준일자 */
|
||||
private String sndngStdrDe;
|
||||
/** 발송기준시간 */
|
||||
private String sndngStdrTme;
|
||||
|
||||
/** 수집기간 */
|
||||
private String colctPd;
|
||||
/** 충족기준 */
|
||||
private String suffcnStdr;
|
||||
/** 중복발송가능여부 */
|
||||
private String dplctSndngAt;
|
||||
/** 발송일 설명 */
|
||||
private String sndngDc;
|
||||
|
||||
/** 자동발송 목록 */
|
||||
private String atmcSndngList;
|
||||
|
||||
|
||||
public BOMaAtmcSndngVO(String sopmalCd, String formDvCd, String formDtlDvCd, String emailUseAt, String smsUseAt,
|
||||
String ntcntalkUseAt,
|
||||
String marktAt,
|
||||
String sndngStdrDe, String sndngStdrTme) {
|
||||
this.sopmalCd = sopmalCd;
|
||||
this.formDvCd = formDvCd;
|
||||
this.formDtlDvCd = formDtlDvCd;
|
||||
this.emailUseAt = emailUseAt;
|
||||
this.smsUseAt = smsUseAt;
|
||||
this.ntcntalkUseAt = ntcntalkUseAt;
|
||||
this.marktAt = marktAt;
|
||||
this.sndngStdrDe = sndngStdrDe;
|
||||
this.sndngStdrTme = sndngStdrTme;
|
||||
}
|
||||
public BOMaAtmcSndngVO() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.atmcsndng.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaAtmcSndngVO extends AbstractVO {
|
||||
/** 메시지 고유번호 */
|
||||
private String messageInnb;
|
||||
/** 이메일 발송양식 고유번호 */
|
||||
private String emailSndngFormInnb;
|
||||
/** SMS발송양식 고유번호 */
|
||||
private String smsSndngFormInnb;
|
||||
/** 알림톡 발송양식 고유번호 */
|
||||
private String ntcntalkSndngFormInnb;
|
||||
|
||||
/** 쇼핑몰코드 */
|
||||
private String sopmalCd;
|
||||
/** 양식구분 */
|
||||
private String formDvCd;
|
||||
/** 양식상세구분 */
|
||||
private String formDtlDvCd;
|
||||
|
||||
/** 이메일 사용여부 */
|
||||
private String emailUseAt;
|
||||
/** SMS 사용여부 */
|
||||
private String smsUseAt;
|
||||
/** 알림톡 사용여부 */
|
||||
private String ntcntalkUseAt;
|
||||
|
||||
/** 마케팅 여부 */
|
||||
private String marktAt;
|
||||
|
||||
/** 관리자 구분 */
|
||||
private String mngrDv;
|
||||
/** 노출여부 */
|
||||
private String expsrAt;
|
||||
|
||||
/** 발송기준일자 */
|
||||
private String sndngStdrDe;
|
||||
/** 발송기준시간 */
|
||||
private String sndngStdrTme;
|
||||
|
||||
/** 수집기간 */
|
||||
private String colctPd;
|
||||
/** 충족기준 */
|
||||
private String suffcnStdr;
|
||||
/** 중복발송가능여부 */
|
||||
private String dplctSndngAt;
|
||||
/** 발송일 설명 */
|
||||
private String sndngDc;
|
||||
|
||||
|
||||
/** 자동발송 정보 목록 */
|
||||
private String atmcSndngList;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.service.BOMaEmailService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.vo.BOMaEmailSrchVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
/*
|
||||
* 통합관리자 이메일 발송 내역 BO con
|
||||
* @author
|
||||
* @since 2024-04-05
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-04-05 이대환 내용 추가(최초생성)
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/ntcn/email")
|
||||
public class BOMaEmailController {
|
||||
|
||||
@Autowired
|
||||
private BOMaEmailService service;
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 검색 코드 조회
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMaEmailSndngListInqireForm")
|
||||
public ResponseEntity<?> selectBOMaEmailSndngListInqireForm(@RequestBody BOMaEmailSrchVO bOMaEmailSrchVO) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<DataMap> code = null;
|
||||
//검색 폼 paramVO
|
||||
code = maSopmalService.selectBOSopmalCdNm();
|
||||
//검색 폼 code
|
||||
resultMap.put("bOMaEmailSrchVO",bOMaEmailSrchVO);
|
||||
resultMap.put("code", code);
|
||||
return ApiResponse.of(resultMap).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 목록 조회
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMaEmailSndngListInqire")
|
||||
public ResponseEntity<?> selectBOMaEmailSndngListInqire(@RequestBody BOMaEmailSrchVO bOMaEmailSrchVO) {
|
||||
String srchShop = bOMaEmailSrchVO.getSrchShop();
|
||||
if (srchShop == null) {
|
||||
bOMaEmailSrchVO.setSrchShop(MemberJwtContextHolder.getMemberInfo().getSopmalCd());
|
||||
} else if (srchShop.equals("ALL")) {
|
||||
bOMaEmailSrchVO.setSrchShop(null);
|
||||
}
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(bOMaEmailSrchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(bOMaEmailSrchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
bOMaEmailSrchVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
bOMaEmailSrchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
bOMaEmailSrchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
bOMaEmailSrchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
//시크릿 키 설정
|
||||
String secretKey = boCommonService.selectSecretkey();
|
||||
bOMaEmailSrchVO.setSecretKey(secretKey);
|
||||
|
||||
//이메일 발송 내역 조회 결과 및 페이징정보 넣기
|
||||
content.put("paginationInfo", bOMaEmailSrchVO.getPaginationInfo());
|
||||
content.put("boCtrlMap", service.selectBOMaEmailSndngListInqire(bOMaEmailSrchVO));
|
||||
content.put("BOMaEmailSrchVO", bOMaEmailSrchVO);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 상세 조회(수신 정보)
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMaEmailSndngDtlInfo")
|
||||
public ResponseEntity<?> selectBOMaEmailSndngDtlInfo(@RequestBody BOMaEmailSrchVO bOMaEmailSrchVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
//시크릿 키 설정
|
||||
String secretKey = boCommonService.selectSecretkey();
|
||||
bOMaEmailSrchVO.setSecretKey(secretKey);
|
||||
|
||||
content.put("boCtrlMap", service.selectBOMaEmailSndngDtlInfo(bOMaEmailSrchVO));
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 상세 조회(발신자 정보)
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
// @Policy(AuthPolicy.PUBLIC)
|
||||
// @RequestMapping(value = "/selectBOMaEmailSndngMbrInfo")
|
||||
// public ResponseEntity<?> selectBOMaEmailSndngMbrInfo(@RequestBody BOMaEmailSrchVO bOMaEmailSrchVO) {
|
||||
// Map<String, Object> content = new HashMap<>();
|
||||
// //페이징 처리를 위한 pagination 객체 생성
|
||||
// PaginationInfo paginationInfo = new PaginationInfo();
|
||||
// paginationInfo.setCurrentPageNo(bOMaEmailSrchVO.getPageIndex());
|
||||
// paginationInfo.setRecordCountPerPage(bOMaEmailSrchVO.getPageUnit());
|
||||
// paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
// bOMaEmailSrchVO.setPaginationInfo(paginationInfo);
|
||||
//
|
||||
// //페이징 처리를 위한 값 설정
|
||||
// bOMaEmailSrchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
// bOMaEmailSrchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
// bOMaEmailSrchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
//
|
||||
// //회원 목록 조회 결과 및 페이징정보 넣기
|
||||
// content.put("paginationInfo", bOMaEmailSrchVO.getPaginationInfo());
|
||||
// content.put("boCtrlMap", service.selectBOMaEmailSndngMbrInfo(bOMaEmailSrchVO));
|
||||
// content.put("bOMaEmailSrchVO", bOMaEmailSrchVO);
|
||||
// log.debug("이메일 발송 내역 상세 조회(발신자 정보) 조회 내용 => {}", content);
|
||||
// return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.controller;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.vo.MaEmailSrchVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/*
|
||||
* 이메일 발송 목록 FO Controller
|
||||
* @author 김혜인
|
||||
* @since 2024-02-01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-01 김혜인. 최초 생성
|
||||
* 2024-04-04 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/ntcn/email")
|
||||
@Slf4j
|
||||
public class MaEmailController {
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 페이지(폼)
|
||||
* @param model
|
||||
* @param maEmailSrchVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectEmailSndngDtlsListInqireForm")
|
||||
public String selectEmailSndngDtlsListInqireForm(ModelMap model, MaEmailSrchVO maEmailSrchVO) {
|
||||
//BO에서 API 호출(이메일 발송내 목록 조회)
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/email/selectBOMaEmailSndngListInqireForm", maEmailSrchVO),
|
||||
model,
|
||||
"resultSrchMap"
|
||||
);
|
||||
return "admin/ntcn/email/MaEmailSndngDtlsListInqireRForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 - 리스트 조회
|
||||
* @param model
|
||||
* @param maEmailSrchVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectEmailSndngDtlsListInqire")
|
||||
public String selectEmailSndngDtlsListInqire(ModelMap model, MaEmailSrchVO maEmailSrchVO) {
|
||||
//BO 이메일 발송내 목록 조회 API 호출
|
||||
try {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/email/selectBOMaEmailSndngListInqire", maEmailSrchVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
model.addAttribute("emailSrchVO",maEmailSrchVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return "admin/ntcn/email/MaEmailSndngDtlsListInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 - 엑셀 다운로드
|
||||
* @param maEmailSrchVO
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectEmailSndngDtlsListExcelDwld" , method = RequestMethod.POST)
|
||||
public void selectEmailSndngDtlsListExcelDwld(MaEmailSrchVO maEmailSrchVO, HttpServletResponse response) {
|
||||
maEmailSrchVO.setPageIndex(1); //10000건까지 엑셀 출력
|
||||
maEmailSrchVO.setPageUnit(10000); //10000건까지 엑셀 출력
|
||||
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/email/selectBOMaEmailSndngListInqire",maEmailSrchVO)
|
||||
);
|
||||
|
||||
List<Map<String, Object>> resultMapList = new ArrayList<>();
|
||||
if(resultMap != null) {
|
||||
resultMapList = (List<Map<String, Object>>) resultMap.get("boCtrlMap");
|
||||
}
|
||||
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
//엑셀 다운로드 다운로드 시간
|
||||
Date date = new Date();
|
||||
SimpleDateFormat excelFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String str = excelFormat.format(date);
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
if(resultMapList != null && !resultMapList.isEmpty()) {
|
||||
for (int i = 0; i < resultMapList.size(); i++) {
|
||||
Map<String, Object> row = resultMapList.get(i);
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
int caculateSize = calculateSize(resultMapList.size(), i);
|
||||
dataMap.put("rnum", caculateSize); //번호 역순 출력
|
||||
dataMap.put("sj", row.get("sj"));
|
||||
dataMap.put("email", row.get("email"));
|
||||
dataMap.put("sndngEmail", row.get("sndngEmail"));
|
||||
dataMap.put("sopmalNm", row.get("sopmalNm"));
|
||||
dataMap.put("registDt", row.get("registDt"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("rnum", "번호");
|
||||
headerMap.put("sj", "이메일 제목");
|
||||
headerMap.put("email", "발송주소");
|
||||
headerMap.put("sndngEmail", "수신주소");
|
||||
headerMap.put("sopmalNm", "쇼핑몰");
|
||||
headerMap.put("registDt", "발송일시");
|
||||
|
||||
try {
|
||||
ExcelDownloadUtil.createExcel("email_Sndng_list_" + str, headerMap, dataList, response);
|
||||
}catch(IOException ioe) {
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 안전하게 계산 처리 메소드
|
||||
* @param size
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
private int calculateSize(int size, int index) {
|
||||
return size - index;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 - 리스트 조회 > 이메일 상세 조회 팝업 (발신 정보)
|
||||
* @param model
|
||||
* @param maEmailSrchVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectEmailSndngDtlPopup")
|
||||
public String selectEmailSndngDtlPopup(ModelMap model, MaEmailSrchVO maEmailSrchVO) {
|
||||
//BO에서 API 호출(이메일 발송내 목록 조회)
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/email/selectBOMaEmailSndngDtlInfo", maEmailSrchVO),
|
||||
model,
|
||||
"resultMapDtl"
|
||||
);
|
||||
return "admin/ntcn/email/MaEmailSndngDtlPopupR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 - 리스트 조회 > 이메일 상세 조회 팝업 - 수신자 정보
|
||||
* @param model
|
||||
* @param maEmailSrchVO
|
||||
* @return String
|
||||
*/
|
||||
// @Policy(AuthPolicy.RESTRICTED)
|
||||
// @RequestMapping("/selectEmailSndngDtlPopupMbrTb")
|
||||
// public String selectEmailSndngDtlPopupMbrTb(ModelMap model, MaEmailSrchVO maEmailSrchVO) {
|
||||
// log.debug("이메일 상세 조회 팝업 (수신자 정보) param =>{}", maEmailSrchVO);
|
||||
// //BO 이메일 발송내 목록 조회 API 호출
|
||||
// try {
|
||||
// ReplyFromResrc reply = sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/email/selectBOMaEmailSndngMbrInfo", maEmailSrchVO);
|
||||
// log.debug("이메일 상세 조회 팝업 > 수신자 정보 BO 호출 결과 =>{} ",reply.getReply());
|
||||
// //BO 이메일 발송내 목록 조회 API 결과를 Map으로 변환하여 설정
|
||||
// model.addAttribute("resultListMapMbr", BoResultMapConverter.convert(new ObjectMapper(), reply.getReply()));
|
||||
// } catch(Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
// return "admin/ntcn/email/MaEmailSndngDtlPopupMbrTb";
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.vo.BOMaEmailSrchVO;
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.vo.BOMaEmailVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.email.vo.BOEmailLogVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.email.vo.BOEmailVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
/**
|
||||
*
|
||||
* 통합관리자 이메일 발송 내역 BO mapper
|
||||
* @author
|
||||
* @since 2024-04-05
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-04-05 이대환 내용 추가(최초생성)
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaEmailMapper {
|
||||
/* ####################################
|
||||
이메일 발송 서비스 시작
|
||||
#################################### */
|
||||
/** 이메일 발송 관리 목록 조회 */
|
||||
public List<DataMap> selectBOMaEmailSndngDtlsListInqire(BOMaEmailSrchVO vo);
|
||||
/** 이메일 발송 관리 건수 조회 */
|
||||
public Integer selectBOMaEmailSndngDtlsListTotCnt(BOMaEmailSrchVO vo);
|
||||
/** 이메일 발송대상 순번 조회 */
|
||||
// public List<Integer> selectBOMaEmailSndngTrgetSnb(int emailSndngInnb);
|
||||
|
||||
|
||||
/** 이메일 발송 관리 수신 정보 조회 */
|
||||
public DataMap selectBOMaEmailSndngDtlInfo(BOMaEmailSrchVO vo);
|
||||
/** 이메일 발송 관리 발신 목록 조회 */
|
||||
// public List<DataMap> selectBOMaEmailSndngMbrInfo(BOMaEmailSrchVO vo);
|
||||
/** 이메일 발송 관리 발신 목록 건수 */
|
||||
// public Integer selectBOMaEmailSndngMbrInfoTotCnt(BOMaEmailSrchVO vo);
|
||||
/* ####################################
|
||||
이메일 발송 서비스 끝
|
||||
#################################### */
|
||||
|
||||
/**
|
||||
* 이메일 발송내역 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
// public void insertBOMaEmailSndngDtls(BOMaEmailVO vo);
|
||||
|
||||
/**
|
||||
* 이메일 발송대상 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
// public void insertBOMaEmailSndngTo(BOMaEmailVO vo);
|
||||
|
||||
/**
|
||||
* 이메일 발송여부 업데이트
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
// public void updateBOMaEmailSndng(List<BOEmailVO> voList);
|
||||
|
||||
/**
|
||||
* 이메일 발송로그 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public void insertBOMaEmailSndngLog(List<BOEmailLogVO> voList);
|
||||
|
||||
/**
|
||||
* 이메일 로그 상태 수정
|
||||
* @param logList
|
||||
*/
|
||||
void updateEmailLog(List<BOEmailLogVO> logList);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.mapper.BOMaEmailMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.email.vo.BOMaEmailSrchVO;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
/**
|
||||
* 통합관리자 이메일 발송 내역 BO service
|
||||
* @author
|
||||
* @since 2024-04-05
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-04-05 이대환 내용 추가(최초생성)
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BOMaEmailService {
|
||||
@Autowired
|
||||
private BOMaEmailMapper mapper;
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
/**
|
||||
* 이메일 발송 내역 검색 코드 조회
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
// public List<DataMap> selectBOMaEmailSndngDtlsListInqireForm() {
|
||||
// //브랜드코드
|
||||
// BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
// bOMaComncdVO.setGroupCd("BRAND");
|
||||
// List<DataMap> brand = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
// log.debug("brand", brand);
|
||||
// return brand;
|
||||
// }
|
||||
/**
|
||||
* 이메일 발송 내역 목록 조회
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOMaEmailSndngListInqire(BOMaEmailSrchVO bOMaEmailSrchVO){
|
||||
List<DataMap> servList = null;
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
// 건수 조회
|
||||
Integer totCnt = mapper.selectBOMaEmailSndngDtlsListTotCnt(bOMaEmailSrchVO);
|
||||
// 건수 갯수 페이징 vo 에 set
|
||||
bOMaEmailSrchVO.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
// 건수 > 0 일시 목록 조회
|
||||
if(totCnt > 0) {
|
||||
servList = mapper.selectBOMaEmailSndngDtlsListInqire(bOMaEmailSrchVO);
|
||||
}
|
||||
return servList;
|
||||
}
|
||||
/**
|
||||
* 이메일 발송 내역 상세 조회(수신 정보)
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public DataMap selectBOMaEmailSndngDtlInfo(BOMaEmailSrchVO bOMaEmailSrchVO){
|
||||
DataMap SndngDtlInfo = null;
|
||||
//수신 정보 조회
|
||||
SndngDtlInfo = mapper.selectBOMaEmailSndngDtlInfo(bOMaEmailSrchVO);
|
||||
return SndngDtlInfo;
|
||||
}
|
||||
/**
|
||||
* 이메일 발송 내역 상세 조회(발신자 정보)
|
||||
* @param bOMaEmailSrchVO
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
// public List<DataMap> selectBOMaEmailSndngMbrInfo(BOMaEmailSrchVO bOMaEmailSrchVO){
|
||||
// log.debug("회원 목록 조회 param확인 (발신자 정보) => {}",bOMaEmailSrchVO);
|
||||
// List<DataMap> SndngMbrInfo = null;
|
||||
// // 건수 조회
|
||||
// Integer totCnt = mapper.selectBOMaEmailSndngMbrInfoTotCnt(bOMaEmailSrchVO);
|
||||
// // 건수 갯수 페이징 vo 에 set
|
||||
// bOMaEmailSrchVO.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
// // 건수 > 0 일시 이메일 발송 내역 발신자 정보 조회
|
||||
// if(totCnt > 0) {
|
||||
// SndngMbrInfo = mapper.selectBOMaEmailSndngMbrInfo(bOMaEmailSrchVO);
|
||||
// }
|
||||
// return SndngMbrInfo;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaEmailSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**쇼핑몰코드*/
|
||||
private String srchShop;
|
||||
/**자동발송여부*/
|
||||
private String atmcAt;
|
||||
/**검색 시작 발송 날짜 */
|
||||
private String srchStrtSndngDt;
|
||||
/**검색 종료 발송 날짜 */
|
||||
private String srchEndSndngDt ;
|
||||
|
||||
/**이메일 발송로그 고유번호*/
|
||||
private String emailLogInnb ;
|
||||
|
||||
/*secretkey*/
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.vo;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaEmailVO extends AbstractVO {
|
||||
|
||||
/** 이메일 발송 고유번호 */
|
||||
private Integer emailSndngInnb;
|
||||
|
||||
/**
|
||||
* FM_EMAIL 이메일 발송내역
|
||||
*/
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 발송위치 */
|
||||
private String sndngLc;
|
||||
/** 제목 */
|
||||
private String sj;
|
||||
/** 내용 */
|
||||
private String cn;
|
||||
/** 보내는사람 EMAIL */
|
||||
private String sndrEmail;
|
||||
/** 수신거부URL */
|
||||
private String recptnRjctUrl;
|
||||
/** 등록자구분 (01:회원, 02:관리자, 03:시스템, 04:기타) */
|
||||
private String regusrDv;
|
||||
/** 이메일 발송양식 고유번호 */
|
||||
private Integer emailSndngFormInnb;
|
||||
|
||||
/**
|
||||
* FM_EMAIL_TO 이메일 대상
|
||||
*/
|
||||
/** 대상순번 */
|
||||
private Integer trgetSnb;
|
||||
/** 회원고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 받는사람 EMAIL */
|
||||
private String recpntEmail;
|
||||
/** 받는사람명 */
|
||||
private String recpntNm;
|
||||
/** 상태(REG:등록, BAD:불량, WAIT:대기, SEND:전송, FAIL:실패, OK:성공) */
|
||||
private String sttus;
|
||||
/** 발송일시 */
|
||||
private Date sndngDt;
|
||||
/** 결과코드(1000 또는 101 : 성공, 그 외 API 참조) */
|
||||
private String rsltCd;
|
||||
|
||||
/**
|
||||
* 회원 검색 팝업
|
||||
*/
|
||||
/** 검색 회원 정보 JSON */
|
||||
private String mbrInfo;
|
||||
/** 검색 회원 명 수 */
|
||||
// private String sndngCnt;
|
||||
|
||||
public BOMaEmailVO(BOMaEmailVO oldVo) {
|
||||
this.emailSndngInnb = oldVo.emailSndngInnb;
|
||||
this.sopmalCd = oldVo.sopmalCd;
|
||||
this.sndngLc = oldVo.sndngLc;
|
||||
this.sj = oldVo.sj;
|
||||
this.cn = oldVo.cn;
|
||||
this.sndrEmail = oldVo.sndrEmail;
|
||||
this.recptnRjctUrl = oldVo.recptnRjctUrl;
|
||||
this.regusrDv = oldVo.regusrDv;
|
||||
this.trgetSnb = oldVo.trgetSnb;
|
||||
this.mbrInnb = oldVo.mbrInnb;
|
||||
this.recpntEmail = oldVo.recpntEmail;
|
||||
this.recpntNm = oldVo.recpntNm;
|
||||
this.sttus = oldVo.sttus;
|
||||
this.sndngDt = oldVo.sndngDt;
|
||||
this.rsltCd = oldVo.rsltCd;
|
||||
// this.mbrInfo = oldVo.mbrInfo;
|
||||
// this.sndngCnt = oldVo.sndngCnt;
|
||||
}
|
||||
public BOMaEmailVO() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaEmailSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**쇼핑몰코드*/
|
||||
private String srchShop;
|
||||
/**자동발송여부*/
|
||||
private String atmcAt;
|
||||
/**검색 시작 발송 날짜 */
|
||||
private String srchStrtSndngDt;
|
||||
/**검색 종료 발송 날짜 */
|
||||
private String srchEndSndngDt ;
|
||||
|
||||
/**이메일 발송로그 고유번호*/
|
||||
private String emailLogInnb ;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.email.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaEmailVO extends AbstractVO {
|
||||
|
||||
/** 이메일 발송 고유번호 */
|
||||
private Integer emailSndngInnb;
|
||||
|
||||
/**
|
||||
* FM_EMAIL 이메일 발송내역
|
||||
*/
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 발송위치 */
|
||||
private String sndngLc;
|
||||
/** 제목 */
|
||||
@NotEmpty(message = "이메일제목")
|
||||
private String sj;
|
||||
/** 내용 */
|
||||
@NotEmpty(message = "이메일내용")
|
||||
private String cn;
|
||||
/** 보내는사람 EMAIL */
|
||||
@NotEmpty(message = "발신자")
|
||||
private String sndrEmail;
|
||||
/** 수신거부URL */
|
||||
private String recptnRjctUrl;
|
||||
/** 등록자구분 (01:회원, 02:관리자, 03:시스템, 04:기타) */
|
||||
private String regusrDv;
|
||||
/** 이메일 발송양식 고유번호 */
|
||||
private Integer emailSndngFormInnb;
|
||||
|
||||
/**
|
||||
* FM_EMAIL_TO 이메일 대상
|
||||
*/
|
||||
/** 대상순번 */
|
||||
private Integer trgetSnb;
|
||||
/** 회원고유번호 */
|
||||
private Integer mbrInnb;
|
||||
/** 받는사람 EMAIL */
|
||||
private String recpntEmail;
|
||||
/** 받는사람명 */
|
||||
private String recpntNm;
|
||||
/** 상태(REG:등록, BAD:불량, WAIT:대기, SEND:전송, FAIL:실패, OK:성공) */
|
||||
private String sttus;
|
||||
/** 발송일시 */
|
||||
private Date sndngDt;
|
||||
/** 결과코드(1000 또는 101 : 성공, 그 외 API 참조) */
|
||||
private String rsltCd;
|
||||
|
||||
/**
|
||||
* 회원 검색 팝업
|
||||
*/
|
||||
/** 검색 회원 정보 JSON */
|
||||
private String mbrInfo;
|
||||
/** 검색 회원 명 수 */
|
||||
// private String sndngCnt;
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.mssage.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.ntcn.mssage.service.BOMaMssageService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.mssage.vo.BOMaMssageSrchVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtToken;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/ntcn/mssage")
|
||||
public class BOMaMssageController {
|
||||
|
||||
@Autowired
|
||||
private BOMaMssageService service;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
|
||||
@Autowired
|
||||
private ProjectInfoAutoConfiguration projectInfoAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 메시지 발송 내역 검색 코드 조회
|
||||
* @param bOSmsSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOSmsSndngDtlsListInqireForm")
|
||||
public ResponseEntity<?> selectBOSmsSndngDtlsListInqireForm(@RequestBody BOMaMssageSrchVO boMaMssageSrchVO) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
//브랜드코드
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
|
||||
//메시지 종류
|
||||
bOMaComncdVO.setGroupCd("SMS_SNDNG_KND");
|
||||
List<DataMap> sms = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
//발송상태
|
||||
bOMaComncdVO.setGroupCd("SMS_SNDNG_STTUS");
|
||||
List<DataMap> smsTy = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
//검색 폼 code
|
||||
resultMap.put("brand",maSopmalService.selectBOSopmalCdNm());
|
||||
resultMap.put("sms",sms);
|
||||
resultMap.put("smsTy",smsTy);
|
||||
resultMap.put("boMaMssageSrchVO",boMaMssageSrchVO);
|
||||
resultMap.put("code",service.selectBOSmsSndngDtlsListInqireForm());
|
||||
|
||||
return ApiResponse.of(resultMap).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 발송 내역 목록 조회
|
||||
* @param bOSmsSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOSmsSndngListInqire")
|
||||
public ResponseEntity<?> selectBOSmsSndngListInqire(@RequestBody BOMaMssageSrchVO bOMaMssageSrchVO) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
bOMaMssageSrchVO.setRegusr(user.getUserInnb());
|
||||
bOMaMssageSrchVO.setUpdusr(user.getUserInnb());
|
||||
|
||||
DataMap content = new DataMap();
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(bOMaMssageSrchVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(bOMaMssageSrchVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
bOMaMssageSrchVO.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
bOMaMssageSrchVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
bOMaMssageSrchVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
bOMaMssageSrchVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
bOMaMssageSrchVO.setSecretKey(boCommonService.selectSecretkey());
|
||||
|
||||
//메시지 발송 목록 조회 결과 및 페이징정보 넣기
|
||||
content.put("paginationInfo", bOMaMssageSrchVO.getPaginationInfo());
|
||||
content.put("mssageMap", service.selectBOSmsSndngListInqire(bOMaMssageSrchVO));
|
||||
content.put("bOMaMssageSrchVO", bOMaMssageSrchVO);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 발송 내역 상세 조회(수신 정보)
|
||||
* @param bOMssageSrchVO
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOSmsSndngDtlInfo")
|
||||
public ResponseEntity<?> selectBOSmsSndngDtlInfo(@RequestBody BOMaMssageSrchVO bOMaMssageSrchVO) {
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("mssageDtlMap", service.selectBOSmsSndngDtlInfo(bOMaMssageSrchVO));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
정산
|
||||
*************************************/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.mssage.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.mssage.vo.BOMaMssageSrchVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.vo.BOMssageSrchVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaMssageMapper {
|
||||
|
||||
|
||||
/**
|
||||
* 발송 관리 목록 조회
|
||||
*
|
||||
* @param boMssageSrchVO
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOSmsSndngDtlsListInqire(BOMaMssageSrchVO boMaMssageSrchVO);
|
||||
|
||||
|
||||
/**
|
||||
* 발송 관리 건수 조회
|
||||
*
|
||||
* @param bOSmsVO
|
||||
* @return Integer
|
||||
*/
|
||||
public Integer selectBOSmsSndngDtlsListTotCnt(BOMaMssageSrchVO boMaMssageSrchVO);
|
||||
|
||||
/**
|
||||
* 발송 관리 수신 정보 조회
|
||||
*
|
||||
* @param boMssageSrchVO
|
||||
* @return DataMap
|
||||
*/
|
||||
public DataMap selectBOSmsSndngDtlInfo(BOMaMssageSrchVO boMaMssageSrchVO);
|
||||
|
||||
|
||||
/**
|
||||
* 발송 관리 성공, 실패 건수 조회
|
||||
*
|
||||
* @param boMssageSrchVO
|
||||
* @return Integer
|
||||
*/
|
||||
public DataMap selectBOSmsSndngresultSttusCnt(BOMaMssageSrchVO boMaMssageSrchVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.mssage.service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.mssage.mapper.BOMaMssageMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.mssage.vo.BOMaMssageSrchVO;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.mapper.BOMssageMapper;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.vo.BOMssageSrchVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOMaMssageService {
|
||||
|
||||
@Autowired
|
||||
private BOMaMssageMapper mapper;
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
/**
|
||||
* SMS 발송 내역 검색 코드 조회
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public Map<String,Object> selectBOSmsSndngDtlsListInqireForm() {
|
||||
Map<String,Object> code = new HashMap<>();
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
|
||||
//메시지 종류
|
||||
bOMaComncdVO.setGroupCd("SMS_SNDNG_KND");
|
||||
List<DataMap> sndngTy = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
code.put("sndngTy", sndngTy);
|
||||
//메시지 발송 상태 종류
|
||||
bOMaComncdVO.setGroupCd("SMS_SNDNG_STTUS");
|
||||
List<DataMap> sndngSttus = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
code.put("sndngSttus", sndngSttus);
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 메시지 발송 내역 목록 조회
|
||||
* @param bOSmsSrchVO
|
||||
* @return DataMap
|
||||
*/
|
||||
public DataMap selectBOSmsSndngListInqire(BOMaMssageSrchVO BOMaMssageSrchVO){
|
||||
|
||||
List<DataMap> smsSndngList = null;
|
||||
DataMap rsltSttusCnt = null;
|
||||
DataMap resultMap = new DataMap();
|
||||
|
||||
// 건수 조회
|
||||
Integer totCnt = mapper.selectBOSmsSndngDtlsListTotCnt(BOMaMssageSrchVO);
|
||||
log.info("totCnt => {}",totCnt);
|
||||
|
||||
// 건수 갯수 페이징 vo 에 set
|
||||
BOMaMssageSrchVO.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
|
||||
// 건수 > 0 일시 목록 조회
|
||||
if(totCnt > 0) {
|
||||
smsSndngList = mapper.selectBOSmsSndngDtlsListInqire(BOMaMssageSrchVO);
|
||||
//실제 표출시
|
||||
smsSndngList = smsSndngList.stream()
|
||||
.map(map -> {
|
||||
DataMap sndngMap = new DataMap();
|
||||
sndngMap.putAll(map);
|
||||
//변환 이전 내용
|
||||
String orgCn = StringUtil.isNullToString(map.get("cn"));
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
DataMap substData = new DataMap();
|
||||
|
||||
|
||||
if(!"".equals(StringUtil.isNullToString(map.get("substData")))) {
|
||||
|
||||
try {
|
||||
//치환데이터 내용 map으로 변경
|
||||
substData = objectMapper.readValue(StringUtil.isNullToString(map.get("substData")), DataMap.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
//변환
|
||||
String convertCnStr = mssageConvert(orgCn, substData);
|
||||
if(convertCnStr.length() >= 40) {
|
||||
convertCnStr = convertCnStr.substring(0, 40) + "...";
|
||||
}
|
||||
sndngMap.put("cn", convertCnStr);
|
||||
|
||||
//제목
|
||||
String subjectStr = StringUtil.isNullToString(map.get("head"));
|
||||
//제목이 없을 경우 내용 40자리
|
||||
if("".equals(subjectStr)){
|
||||
sndngMap.put("head", StringUtil.cutString(convertCnStr, 40));
|
||||
} else {
|
||||
sndngMap.put("head",subjectStr);
|
||||
}
|
||||
|
||||
return sndngMap;
|
||||
})
|
||||
.toList();
|
||||
|
||||
}
|
||||
|
||||
resultMap.put("smsSndngList", smsSndngList);
|
||||
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 발송 내역 상세 조회(수신 정보)
|
||||
* @param bOMssageSrchVO
|
||||
* @return DataMap
|
||||
*/
|
||||
public DataMap selectBOSmsSndngDtlInfo(BOMaMssageSrchVO bOMaMssageSrchVO){
|
||||
|
||||
DataMap sndngDtlInfo = new DataMap();
|
||||
try {
|
||||
//수신 정보 조회
|
||||
sndngDtlInfo = mapper.selectBOSmsSndngDtlInfo(bOMaMssageSrchVO);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
String orgCn = StringUtil.isNullToString(sndngDtlInfo.get("cn"));
|
||||
if(!"".equals(StringUtil.isNullToString(sndngDtlInfo.get("substData")))) {
|
||||
DataMap sndngData = objectMapper.readValue(StringUtil.isNullToString(sndngDtlInfo.get("substData")), DataMap.class);
|
||||
String convertCnStr = mssageConvert(orgCn, sndngData);
|
||||
sndngDtlInfo.put("cn", convertCnStr);
|
||||
}
|
||||
|
||||
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return sndngDtlInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 메시지 내 치환코드에 따라 변경 처리
|
||||
* @param replaceMap
|
||||
* @return
|
||||
*/
|
||||
public String mssageConvert(String cn, DataMap replaceMap) {
|
||||
//필요에 따라 db 갈수 도 있으나 현재는 없다고 판단함
|
||||
//내부로직 전체 가져오지않은 상태
|
||||
|
||||
//치환코드
|
||||
Pattern pattern = Pattern.compile(
|
||||
"(\\#\\{([^\\}]*)\\})|" + // #{key} 패턴
|
||||
"(\\{([^\\}]*)\\})|" + // {key} 패턴
|
||||
"(?<=__)([a-zA-Z0-9_]+)(?=__)" // __key__ 패턴
|
||||
);
|
||||
/*
|
||||
Pattern pattern = Pattern.compile(
|
||||
"(\\#\\{([^\\}]*)\\})|(\\{([^\\}]*)\\})|(#\\{[a-zA-Z]+\\}|\\{[a-zA-Z]+\\}|(?<=__)[a-zA-Z0-9_]+(?=__))");
|
||||
*/
|
||||
//메시지가 있는 경우
|
||||
|
||||
Matcher matcher = pattern.matcher(cn);
|
||||
|
||||
String output = matcher.replaceAll(match -> {
|
||||
String key = "";
|
||||
if(match.group(2) != null) {
|
||||
//#{}으로 감싸져 있는 치환코드, 알림톡인 경우
|
||||
key = match.group(2);
|
||||
} else if(match.group(4) != null){
|
||||
//{}으로 감싸져 있는 치환코드, 일반인 경우
|
||||
key = match.group(4);
|
||||
} else {
|
||||
//__ __으로 감싸져 있는 치환코드, 대량
|
||||
key = match.group(5);
|
||||
if(key != null && key.contains("LINK")) {
|
||||
key = key.replace("LINK_URL", "linkUrl");
|
||||
}
|
||||
if(key != null && key.contains("NUM")) {
|
||||
key = key.replace("NUM", "substChr");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
String camelKey = snakeToCamel(key);
|
||||
|
||||
Object value = replaceMap.getOrDefault(camelKey, match.group());
|
||||
if(value instanceof LocalDateTime) {
|
||||
// LocalDateTime인 경우 포맷팅 처리
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
return ((LocalDateTime) value).format(formatter);
|
||||
} else {
|
||||
return StringUtil.isNullToString(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return output;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// snake_case를 camelCase로 변환하는 헬퍼 메서드
|
||||
private String snakeToCamel(String snake) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
boolean upperCaseNext = false;
|
||||
|
||||
if(snake != null) {
|
||||
for (int i = 0; i < snake.length(); i++) {
|
||||
char c = snake.charAt(i); // charAt()을 사용하여 각 문자를 처리
|
||||
if (c == '_') {
|
||||
upperCaseNext = true;
|
||||
} else {
|
||||
if (upperCaseNext) {
|
||||
result.append(Character.toUpperCase(c));
|
||||
upperCaseNext = false;
|
||||
} else {
|
||||
result.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.mssage.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaMssageSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**검색 등록자 구분 */
|
||||
private String srchRegusrDv;
|
||||
/**발송 상태*/
|
||||
private String srchSndngSttus;
|
||||
/**발송 종류*/
|
||||
private String srchSndngTy;
|
||||
/**검색 시작 주문 금액 날짜 */
|
||||
private String srchStrtSndngDt;
|
||||
/**검색 종료 주문 금액 날짜 */
|
||||
private String srchEndSndngDt ;
|
||||
/**검색 쇼핑몰 코드*/
|
||||
private String srchSopmalCd;
|
||||
/**검색 발송 조회 기간 구분*/
|
||||
private String srchDtDv;
|
||||
/**검색 발송번호*/
|
||||
private String sndngNb;
|
||||
/** 검색 SMS 발송 고유번호*/
|
||||
private String srchSmsInnb ;
|
||||
/** 검색 SMS 발송 대상 고유번호*/
|
||||
private String srchSmsToInnb ;
|
||||
/** 검색 발송 식별번호 */
|
||||
private Integer srchSndngIdnb;
|
||||
/** 검색 수신번호*/
|
||||
private String srchRecptnNb ;
|
||||
/**검색 수신/발신 번호 구분 */
|
||||
private String srchNbDv;
|
||||
/**검색 발송유형 */
|
||||
private List<String> srchDv;
|
||||
/**검색 현재상태*/
|
||||
private List<String> srchSttus;
|
||||
|
||||
/** 암호화 키 **/
|
||||
private String secretKey;
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.sms.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.ntcn.sms.vo.MaSmsSrchVO;
|
||||
import com.wb.domainserver.domain.mngr.ntcn.mssage.vo.MssageSrchVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/*
|
||||
* 통합관리자 > 문자메시지 발송 목록 FO Controller
|
||||
* @author 김혜인
|
||||
* @since 2024-02-19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-19 김혜인. 최초 생성
|
||||
* 2024-06-20 이대환. 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/ntcn/sms")
|
||||
@Slf4j
|
||||
public class MaSmsController {
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 문자메시지 발송 목록 조회 폼
|
||||
* @param MssageSrchVO
|
||||
* @return MaSmsSndngDtlsListInqireRForm.jsp
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectSmsSndngDtlsListInqireForm")
|
||||
public String selectSmsSndngDtlsListInqireForm(ModelMap model, MssageSrchVO mssageSrchVO) {
|
||||
//BO에서 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/mssage/selectBOSmsSndngDtlsListInqireForm", mssageSrchVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/ntcn/sms/MaSmsSndngDtlsListInqireRForm";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 문자메시지 발송 내역 - 리스트 조회
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectSmsSndngDtlsListInqire")
|
||||
public String selectSmsSndngDtlsListInqire(ModelMap model, MaSmsSrchVO maSmsSrchVO) {
|
||||
|
||||
//BO 문자메시지 발송 내역 조회 API 호출
|
||||
try {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/mssage/selectBOSmsSndngListInqire", maSmsSrchVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
model.addAttribute("maSmsSrchVO", maSmsSrchVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/sms/MaSmsSndngDtlsListInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자메시지 상세 조회
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectSmsSndngDtlPopup")
|
||||
public String selectSmsSndngDtlPopup(ModelMap model, MssageSrchVO mssageSrchVO) {
|
||||
log.debug("메시지 상세 조회 팝업 param =>{}", mssageSrchVO);
|
||||
|
||||
//BO에서 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/mssage/selectBOSmsSndngDtlInfo", mssageSrchVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/ntcn/sms/MaSmsSndngDtlPopupR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 엑셀 다운로드
|
||||
* @param MssageSrchVO
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value="/selectSmsSndngDtlsListExcelDwld" , method = RequestMethod.POST)
|
||||
public void selectSmsSndngDtlsListExcelDwld(MssageSrchVO mssageSrchVO,HttpServletResponse response) {
|
||||
mssageSrchVO.setPageIndex(1); //10000건까지 엑셀 출력
|
||||
mssageSrchVO.setPageUnit(10000); //10000건까지 엑셀 출력
|
||||
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/ntcn/mssage/selectBOSmsSndngListInqire",mssageSrchVO)
|
||||
);
|
||||
|
||||
List<Map<String, Object>> resultMapList = new ArrayList<>();
|
||||
if(resultMap != null) {
|
||||
LinkedHashMap<String, Object> boCtrlMap = (LinkedHashMap<String, Object>) resultMap.get("boCtrlMap");
|
||||
if(boCtrlMap != null) {
|
||||
resultMapList = (List<Map<String, Object>>) boCtrlMap.get("smsSndngList");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
//엑셀 다운로드 다운로드 시간
|
||||
Date date = new Date();
|
||||
SimpleDateFormat excelFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String str = excelFormat.format(date);
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
for (int i = 0; i < resultMapList.size(); i++) {
|
||||
Map<String, Object> row = resultMapList.get(i);
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
int caculateSize = calculateSize(resultMapList.size(), i);
|
||||
dataMap.put("rnum", caculateSize); //번호 역순 출력
|
||||
dataMap.put("recptnNb", row.get("recptnNb"));
|
||||
dataMap.put("sndngNb", row.get("sndngNb"));
|
||||
dataMap.put("dv", row.get("dv"));
|
||||
dataMap.put("sopmalNm", row.get("sopmalNm")!=null?row.get("sopmalNm"):row.get("sopmalCd"));
|
||||
dataMap.put("cn", row.get("cn"));
|
||||
dataMap.put("sndngDt", row.get("sndngDt"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("rnum", "번호");
|
||||
headerMap.put("recptnNb", "발송번호");
|
||||
headerMap.put("sndngNb", "수신번호");
|
||||
headerMap.put("dv", "종류");
|
||||
headerMap.put("sopmalNm", "쇼핑몰");
|
||||
headerMap.put("cn", "내용");
|
||||
headerMap.put("sndngDt", "발송일시");
|
||||
try {
|
||||
ExcelDownloadUtil.createExcel("sms_Sndng_list_" + str, headerMap, dataList, response);
|
||||
}catch(IOException ioe) {
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 안전하게 계산 처리 메소드
|
||||
* @param size
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
private int calculateSize(int size, int index) {
|
||||
return size - index;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.sms.vo;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaSmsSrchVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**검색어타입*/
|
||||
public String srchType;
|
||||
/**검색어*/
|
||||
public String srchStr;
|
||||
/**검색 등록자 구분 */
|
||||
private String srchRegusrDv;
|
||||
/**발송 상태*/
|
||||
private String srchSndngSttus;
|
||||
/**발송 종류*/
|
||||
private String srchSndngTy;
|
||||
/**검색 시작 주문 금액 날짜 */
|
||||
private String srchStrtSndngDt;
|
||||
/**검색 종료 주문 금액 날짜 */
|
||||
private String srchEndSndngDt ;
|
||||
/**검색 쇼핑몰 코드*/
|
||||
private String srchSopmalCd;
|
||||
/**검색 발송 조회 기간 구분*/
|
||||
private String srchDtDv;
|
||||
/**검색 발송번호*/
|
||||
private String sndngNb;
|
||||
/** 검색 SMS 발송 고유번호*/
|
||||
private String srchSmsInnb ;
|
||||
/** 검색 SMS 발송 대상 고유번호*/
|
||||
private String srchSmsToInnb ;
|
||||
/** 검색 발송 식별번호 */
|
||||
private Integer srchSndngIdnb;
|
||||
/** 검색 수신번호*/
|
||||
private String srchRecptnNb ;
|
||||
/**검색 수신/발신 번호 구분 */
|
||||
private String srchNbDv;
|
||||
/**검색 발송유형 */
|
||||
private List<String> srchDv;
|
||||
/**검색 현재상태*/
|
||||
private List<String> srchSttus;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.service.BOMaStlMssageService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.vo.BOMaStlMssageVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.itrnt.mbr.service.BOItrntMbrService;
|
||||
import com.wb.domainserver.domain.itrnt.mbr.vo.BOItrntMbrSrchVO;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.service.BOItrntStlMssageService;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.vo.BOItrntStlMssageVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* 톻합관리자 정산
|
||||
* @author 추지훈
|
||||
* @since 2024-02-05
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-05 추지훈 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/admin/ntcn/stl")
|
||||
public class BOMaStlMssageController {
|
||||
|
||||
@Autowired
|
||||
private BOMaStlMssageService service;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
@Autowired
|
||||
private BOCommonService boCommonService;
|
||||
|
||||
@Autowired
|
||||
private BOMaComncdService bOMaComncdService;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
|
||||
@Autowired
|
||||
private BOCommonService commonService;
|
||||
|
||||
@Autowired
|
||||
private BOItrntMbrService boItrntMbrService;
|
||||
|
||||
/*************************************
|
||||
정산
|
||||
*************************************/
|
||||
|
||||
/**
|
||||
* 정산 목록 조회 폼
|
||||
* @param vo(mbrInnb)
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOMaStlMssageListRForm")
|
||||
public ResponseEntity<?> selectBOMaStlMssageListRForm(@RequestBody BOMaStlMssageVO vo) {
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("04".equals(user.getSysDvCd())){
|
||||
vo.setStrInnb(String.valueOf(user.getUserInnb()));
|
||||
}
|
||||
vo.setSopmalCd(user.getReprsntBrand());
|
||||
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
//매장 구분 코드
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("STR_DV");
|
||||
List<?> strDv = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
content.put("strDv", strDv);
|
||||
|
||||
bOMaComncdVO.setGroupCd("REGUSR_DV");
|
||||
List<?> regusrDv = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
content.put("regusrDv", regusrDv);
|
||||
|
||||
List<DataMap> storeList = service.selectBOStoreList(vo);
|
||||
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
content.put("boItrntStlMssageVO", vo);
|
||||
content.put("tentGroup",user.getTentGroup());
|
||||
content.put("storeList", storeList);
|
||||
|
||||
//현재 년도
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
content.put("currentYear", currentYear);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 정산 목록 조회
|
||||
*
|
||||
* @param vo(mbrInnb)
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@PostMapping(value = "/selectBOMaStlMssageList")
|
||||
public ResponseEntity<?> selectBOMaStlMssageList(@RequestBody BOMaStlMssageVO vo) {
|
||||
log.debug("vo => {}",vo);
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
//리셀러 여부 o
|
||||
BOMaComncdVO bOMaComncdVO = new BOMaComncdVO();
|
||||
bOMaComncdVO.setGroupCd("RSLR_APPN_DV");
|
||||
// List<?> appen = bOMaComncdService.selectBOCommcdDetailList(bOMaComncdVO);
|
||||
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
content.put("strInfo", service.selectBOMaStlMssageCharge(vo));
|
||||
// content.put("appen", appen);
|
||||
log.debug("정산 목록 조회 내용 => {}", content);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.vo.MaStlMssageVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/*
|
||||
* 문자 정산 Controller
|
||||
* @author 리브가
|
||||
* @since 2024-02-21
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-21 리브가 최초 생성
|
||||
* 2024-04-17 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/ntcn/stl")
|
||||
public class MaStlMssageController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 메세지 정산 조회 폼
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectMaStlMssageListInqireRForm")
|
||||
public String selectMaStlMssageListInqireRForm(MaStlMssageVO vo, ModelMap model){
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/stl/selectBOMaStlMssageListRForm", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/ntcn/stl/MaStlMssageListInqireRForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 메세지 정산 목록 내역 조회
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectMaStlMssageListInqire")
|
||||
public String selectMaStlMssageListInqire(MaStlMssageVO vo, ModelMap model){
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/stl/selectBOMaStlMssageList", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/ntcn/stl/MaStlMssageListInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 엑셀 다운로드
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/excelFileDownload")
|
||||
public void excelFileDownload(MaStlMssageVO vo, HttpServletResponse response, ModelMap model) {
|
||||
vo.setPageIndex(1);
|
||||
vo.setPageUnit(50);
|
||||
Map<String, Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/stl/selectBOMaStlMssageList", vo)
|
||||
);
|
||||
|
||||
/*엑셀 데이터 set*/
|
||||
List<Map<String, Object>> excelList = new ArrayList<>();
|
||||
Map<String, Object> excelMap = (Map<String, Object>) resultMap.get("strInfo");
|
||||
excelList = (List<Map<String, Object>>) excelMap.get("chargeList");
|
||||
|
||||
//엑셀 다운로드 다운로드 시간
|
||||
Date date = new Date();
|
||||
SimpleDateFormat excelFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String str = excelFormat.format(date);
|
||||
|
||||
|
||||
try {
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
if (excelList != null) {
|
||||
BigInteger num = BigInteger.valueOf(excelList.size());
|
||||
for (int i = 0; i < excelList.size(); i++) {
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map = (HashMap<String, Object>) excelList.get(i);
|
||||
|
||||
/*데이터 set*/
|
||||
dataMap.put("itme01", num.subtract(BigInteger.valueOf(i)));
|
||||
dataMap.put("itme02", map.get(""));
|
||||
dataMap.put("itme03", map.get("regusr"));
|
||||
dataMap.put("itme04", map.get("sms"));
|
||||
dataMap.put("itme05", map.get("lms"));
|
||||
dataMap.put("itme06", map.get("mms"));
|
||||
dataMap.put("itme07", map.get("at"));
|
||||
dataMap.put("itme08", map.get("ft"));
|
||||
dataMap.put("itme09", map.get("fti"));
|
||||
dataMap.put("itme10", map.get("totCost"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
}
|
||||
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("itme01", "번호");
|
||||
headerMap.put("itme02", "년월");
|
||||
headerMap.put("itme03", "매장");
|
||||
headerMap.put("itme04", "SMS");
|
||||
headerMap.put("itme05", "LMS");
|
||||
headerMap.put("itme06", "MMS");
|
||||
headerMap.put("itme07", "알림톡");
|
||||
headerMap.put("itme08", "친구톡(TXT)");
|
||||
headerMap.put("itme09", "친구톡(TXT+IMG)");
|
||||
headerMap.put("itme10", "금액");
|
||||
//엑셀생성 및 다운로드
|
||||
ExcelDownloadUtil.createExcel("stl_excel_file"+str, headerMap, dataList, response);
|
||||
} catch(IOException ioe) {
|
||||
log.error("엑셀다운로드 중 오류가 발생하였습니다.", ioe);
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
} catch (Exception e) {
|
||||
log.error("엑셀다운로드 중 오류가 발생하였습니다.", e);
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.vo.BOMaStlMssageVO;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.vo.BOItrntStlMssageVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaStlMssageMapper {
|
||||
|
||||
/**
|
||||
* 매장 목록 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOMaStoreList(BOMaStlMssageVO vo);
|
||||
|
||||
/**
|
||||
* 정산 내역 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOMaStlMssageList(BOItrntStlMssageVO vo);
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.service;
|
||||
|
||||
import com.wb.domainserver.common.prop.PropertyService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.mapper.BOMaStlMssageMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.stl.vo.BOMaStlMssageVO;
|
||||
import com.wb.domainserver.domain.itrnt.mbr.vo.BOItrntMbrSrchVO;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.mapper.BOItrntStlMssageMapper;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.vo.BOItrntStlMssageVO;
|
||||
import com.wb.domainserver.domain.sure.mapper.SureMapper;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOMaStlMssageService {
|
||||
|
||||
@Autowired
|
||||
private BOMaStlMssageMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private SureMapper sureMapper;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
|
||||
/**
|
||||
* 매장 목록 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOStoreList(BOMaStlMssageVO vo) {
|
||||
log.debug("selectBOStoreList => {}", vo);
|
||||
|
||||
// 매장 목록 조회
|
||||
List<DataMap> storeList = mapper.selectBOMaStoreList(vo);
|
||||
log.debug("storeList => {}", storeList);
|
||||
return storeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 슈어 정산 정보 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectBOMaStlMssageCharge(BOMaStlMssageVO vo) {
|
||||
|
||||
DataMap stlInfo = new DataMap();
|
||||
|
||||
//개월 수 조정
|
||||
String srchMng = vo.getSrchMnt();
|
||||
|
||||
if(srchMng.length() == 1) {
|
||||
vo.setSrchMnt("0" + srchMng);
|
||||
}
|
||||
|
||||
for (String profile : environment.getActiveProfiles()) {
|
||||
|
||||
if ("stage".equals(profile)) {
|
||||
vo.setSrchYm(vo.getSrchYear() + vo.getSrchMnt());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//정산 대상 조회
|
||||
List<DataMap> stlMssageChargeList = sureMapper.selectBOMaStlMssageChargeList(vo);
|
||||
|
||||
//매장정보 조회
|
||||
List<DataMap> storeList = mapper.selectBOMaStoreList(vo);
|
||||
|
||||
vo.getPaginationInfo().setTotalRecordCount(stlMssageChargeList.size());
|
||||
|
||||
int totSmsCnt = 0;
|
||||
int totLmsCnt = 0;
|
||||
int totMmsCnt = 0;
|
||||
int totAtCnt = 0;
|
||||
int totFtCnt = 0;
|
||||
int totFtiCnt = 0;
|
||||
BigDecimal totSumCost = BigDecimal.ZERO;;
|
||||
|
||||
for(DataMap stlMap : stlMssageChargeList) {
|
||||
|
||||
BigDecimal smsCost = BigDecimal.ZERO;
|
||||
BigDecimal lmsCost = BigDecimal.ZERO;
|
||||
BigDecimal mmsCost = BigDecimal.ZERO;
|
||||
BigDecimal atCost = BigDecimal.ZERO;
|
||||
BigDecimal ftCost = BigDecimal.ZERO;
|
||||
BigDecimal ftiCost = BigDecimal.ZERO;
|
||||
|
||||
BigDecimal totCost = BigDecimal.ZERO;
|
||||
|
||||
String regusr = StringUtil.isNullToString(stlMap.get("regusr"));
|
||||
int index = regusr.indexOf(":");
|
||||
|
||||
if(index > 0) {
|
||||
String[] etc1Ex = regusr.split(":");
|
||||
String regusrDv = etc1Ex[0];
|
||||
String strInnb = etc1Ex[1];
|
||||
log.debug("regusrDv => {}", regusrDv);
|
||||
log.debug("strInnb => {}", strInnb);
|
||||
|
||||
for(DataMap store : storeList) {
|
||||
String strInnStr = StringUtil.isNullToString(store.get("strInnb"));
|
||||
if(strInnStr.equals(strInnb)) {
|
||||
stlMap.put("regusr", store.get("tentcpnNm"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 입력 받은 연도와 월로 YearMonth 객체 생성
|
||||
YearMonth inputDate = YearMonth.of(Integer.parseInt(vo.getSrchYear()), Integer.parseInt(vo.getSrchMnt()));
|
||||
|
||||
//이전 조건 날짜
|
||||
YearMonth comparisonDate = YearMonth.of(2022, 1);
|
||||
|
||||
//기존
|
||||
if(inputDate.isBefore(comparisonDate)) {
|
||||
smsCost = smsCost.add(objNumToBigDecimal(stlMap.get("sms")).multiply(BigDecimal.valueOf(7.4)));
|
||||
lmsCost = lmsCost.add(objNumToBigDecimal(stlMap.get("lms")).multiply(BigDecimal.valueOf(23)));
|
||||
mmsCost = mmsCost.add(objNumToBigDecimal(stlMap.get("mms")).multiply(BigDecimal.valueOf(50)));
|
||||
atCost = atCost.add(objNumToBigDecimal(stlMap.get("at")).multiply(BigDecimal.valueOf(4.5)));
|
||||
ftCost = ftCost.add(objNumToBigDecimal(stlMap.get("ft")).multiply(BigDecimal.valueOf(9.6)));
|
||||
ftiCost = ftiCost.add(objNumToBigDecimal(stlMap.get("fti")).multiply(BigDecimal.valueOf(15.6)));
|
||||
} else {
|
||||
|
||||
//신규 22년 1월 부터 인하
|
||||
smsCost = smsCost.add(objNumToBigDecimal(stlMap.get("sms")).multiply(BigDecimal.valueOf(7.2)));
|
||||
lmsCost = lmsCost.add(objNumToBigDecimal(stlMap.get("lms")).multiply(BigDecimal.valueOf(23)));
|
||||
mmsCost = mmsCost.add(objNumToBigDecimal(stlMap.get("mms")).multiply(BigDecimal.valueOf(45.2)));
|
||||
atCost = atCost.add(objNumToBigDecimal(stlMap.get("at")).multiply(BigDecimal.valueOf(3.9)));
|
||||
ftCost = ftCost.add(objNumToBigDecimal(stlMap.get("ft")).multiply(BigDecimal.valueOf(9.6)));
|
||||
ftiCost = ftiCost.add(objNumToBigDecimal(stlMap.get("fti")).multiply(BigDecimal.valueOf(15.6)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//등록 매장별 총합계
|
||||
totCost = totCost.add(smsCost).add(lmsCost).add(mmsCost).add(atCost).add(ftCost);
|
||||
//총금액
|
||||
totSumCost = totSumCost.add(totCost);
|
||||
|
||||
totSmsCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("sms")));
|
||||
totLmsCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("lms")));
|
||||
totMmsCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("mms")));
|
||||
totAtCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("at")));
|
||||
totFtCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("ft")));
|
||||
totFtiCnt += Integer.parseInt(StringUtil.isNullToString(stlMap.get("fti")));
|
||||
|
||||
stlMap.put("smsCost", smsCost);
|
||||
stlMap.put("lmsCost", lmsCost);
|
||||
stlMap.put("mmsCost", mmsCost);
|
||||
stlMap.put("atCost", atCost);
|
||||
stlMap.put("ftCost", ftCost);
|
||||
stlMap.put("ftiCost", ftiCost);
|
||||
stlMap.put("totCost", totCost);
|
||||
|
||||
|
||||
// cost += objNumToBigDecimal(stlMap.get("lmsCnt")) * 23;
|
||||
// cost += objNumToBigDecimal(stlMap.get("mmsCnt")) * 50;
|
||||
// cost += objNumToBigDecimal(stlMap.get("atCnt")) * 4.5;
|
||||
// cost += objNumToBigDecimal(stlMap.get("ftCnt")) * 9.6;
|
||||
// cost += objNumToBigDecimal(stlMap.get("ftiCnt") * 15.6;
|
||||
|
||||
}
|
||||
|
||||
|
||||
stlInfo.put("totSmsCnt", totSmsCnt);
|
||||
stlInfo.put("totLmsCnt", totLmsCnt);
|
||||
stlInfo.put("totMmsCnt", totMmsCnt);
|
||||
stlInfo.put("totAtCnt", totAtCnt);
|
||||
stlInfo.put("totFtCnt", totFtCnt);
|
||||
stlInfo.put("totFtiCnt", totFtiCnt);
|
||||
stlInfo.put("totSumCost", totSumCost);
|
||||
stlInfo.put("chargeList", stlMssageChargeList);
|
||||
|
||||
return stlInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 정산 정보 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOMaStlMssageList(BOMaStlMssageVO vo) {
|
||||
|
||||
List<DataMap> stlMssageList = sureMapper.selectBOMaStlSureList(vo);
|
||||
|
||||
return stlMssageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체가 null 인지 확인하고 null 인 경우 0, 아니면 BigDecimal 숫자 리턴
|
||||
* @param object
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal objNumToBigDecimal(Object object) {
|
||||
BigDecimal decimal = BigDecimal.ZERO;
|
||||
if (object == null) {
|
||||
return decimal;
|
||||
} else if (object instanceof BigDecimal bigDecimal){
|
||||
return bigDecimal;
|
||||
} else {
|
||||
return BigDecimal.valueOf((Integer) object);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 고객센터/무료수신거부 조회
|
||||
// * @param vo
|
||||
// * @return
|
||||
// */
|
||||
// public DataMap selectBOShopNb(BOItrntMssageVO vo) {
|
||||
//
|
||||
// DataMap resultMap = new DataMap();
|
||||
//
|
||||
// try {
|
||||
// resultMap = mapper.selectBOShopNb(vo);
|
||||
//
|
||||
// } catch (WnbtRestException wre){
|
||||
// throw new WnbtRestException(wre.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// log.error(e.getMessage(), e);
|
||||
// }
|
||||
//
|
||||
// return resultMap;
|
||||
// }
|
||||
//
|
||||
// public Object selectBOItrntMbrListInqire(BOItrntMbrSrchVO vo) {
|
||||
//
|
||||
// log.debug("회원 목록 조회 param확인 (Service) => {}", vo);
|
||||
// List<DataMap> resultList = null;
|
||||
// Map<String, Object> resultMap = new HashMap<>();
|
||||
// // 건수 조회
|
||||
// Integer totCnt = mapper.selectBOItrntMbrListTotCnt(vo);
|
||||
// // 건수 갯수 페이징vo에 set
|
||||
// if (vo.getPaginationInfo() == null) {
|
||||
// vo.setPaginationInfo(new PaginationInfo());
|
||||
// vo.setRecordCountPerPage(totCnt);
|
||||
// vo.setFirstIndex(0);
|
||||
// }
|
||||
// vo.getPaginationInfo().setTotalRecordCount(totCnt);
|
||||
// // 건수 > 0 일시 회원 목록 조회
|
||||
// if (totCnt > 0) {
|
||||
// resultList = mapper.selectBOItrntMbrListInqire(vo);
|
||||
// }
|
||||
// resultMap.put("resultList", resultList);
|
||||
// return resultMap;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaStlMssageVO extends AbstractVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 매장 번호 */
|
||||
private String strInnb;
|
||||
|
||||
/** 등록자 구분 */
|
||||
private String regusrDv;
|
||||
|
||||
/** 매장 구분 */
|
||||
private String strDv;
|
||||
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
/** 연도 */
|
||||
private String srchYear;
|
||||
|
||||
/** 월 */
|
||||
private String srchMnt;
|
||||
|
||||
/** 법인 구분 */
|
||||
private String srchCrp;
|
||||
|
||||
/** 연월 */
|
||||
private String srchYm;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.stl.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaStlMssageVO extends AbstractVO {
|
||||
|
||||
/** 매장 번호 */
|
||||
private String strInnb;
|
||||
|
||||
/** 등록자 구분 */
|
||||
private String regusrDv;
|
||||
|
||||
/** 매장 구분 */
|
||||
private String strDv;
|
||||
|
||||
/** 연도 */
|
||||
private String srchYear;
|
||||
|
||||
/** 월 */
|
||||
private String srchMnt;
|
||||
|
||||
/** 조회 법인 */
|
||||
private String srchCrp;
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.controller;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.service.BOMaTmpltService;
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.vo.BOMaTmpltVO;
|
||||
import com.wb.domainserver.domain.admin.store.sopmal.service.BOMaSopmalService;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 템플릿 관리를 위한 Controller
|
||||
*
|
||||
* @author 리브가
|
||||
* @since 2024-02-21
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-21 리브가 최초 생성
|
||||
* 2024-04-17 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/ntcn/tmplt")
|
||||
public class BOMaTmpltController {
|
||||
|
||||
@Autowired
|
||||
private BOMaTmpltService service;
|
||||
|
||||
@Autowired
|
||||
private BOMaSopmalService maSopmalService;
|
||||
|
||||
/**
|
||||
* 템플릿 관리 페이지
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOAtmcSndngTmplatManage")
|
||||
public ResponseEntity<?> selectBOAtmcSndngTmplatManage(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("이메일 자동 발송 템플릿 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
List<DataMap> sopmalCdList = service.selectBOSopmalAtmcSndng();
|
||||
content.put("sopmalCdList", sopmalCdList);
|
||||
|
||||
//초기 쇼핑몰 코드 없을 경우 목록의 첫번째 입력
|
||||
if("".equals(StringUtil.isNullToString(vo.getSopmalCd()))) {
|
||||
vo.setSopmalCd(StringUtil.isNullToString(sopmalCdList.get(0).get("sopmalCd")));
|
||||
}
|
||||
|
||||
content.put("boMaTmpltVo", vo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 이메일 자동 발송 템플릿 조회
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOEmailAtmcSndngTmplatOneInqireForm")
|
||||
public ResponseEntity<?> selectBOEmailAtmcSndngTmplatOneInqireForm(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("이메일 자동 발송 템플릿 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
List<DataMap> sopmalCdList = service.selectBOSopmalAtmcSndng();
|
||||
content.put("sopmalCdList", sopmalCdList);
|
||||
|
||||
|
||||
//초기 쇼핑몰 코드 없을 경우 목록의 첫번째 입력
|
||||
if("".equals(StringUtil.isNullToString(vo.getSopmalCd()))) {
|
||||
vo.setSopmalCd(StringUtil.isNullToString(sopmalCdList.get(0).get("sopmalCd")));
|
||||
}
|
||||
|
||||
|
||||
content.put("bOTmpltVO", vo);
|
||||
// content.put("groupCd", service.selectBOTmplatGroupCd("FORM_DV"));
|
||||
content.put("groupCd", service.selectBOTmplatGroup(vo.getSopmalCd()));
|
||||
content.put("formDvCd", service.selectBOTmplatFormGroup(vo.getSopmalCd()));
|
||||
content.put("boCtrlMap", service.selectBOEmailAtmcSndngTmplatOneInqireForm(vo));
|
||||
content.put("dsptchAdres", service.selectBOEmailAtmcSndngDsptchAdres(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 자동 발송 템플릿 수정
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOEmailAtmcSndngTmplatUpdt")
|
||||
public ResponseEntity<?> updateBOEmailAtmcSndngTmplatUpdt(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("이메일 자동 발송 템플릿 수정 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.updateBOEmailAtmcSndngTmplatUpdt(vo);
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 자동 발송 템플릿 조회
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOMssageAtmcSndngTmplatInqireForm")
|
||||
public ResponseEntity<?> selectBOMssageAtmcSndngTmplatInqireForm(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("메시지 자동 발송 템플릿 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
content.put("bOTmpltVO", vo);
|
||||
// content.put("groupCd", service.selectBOTmplatGroupCd("FORM_DV"));
|
||||
content.put("groupCd", service.selectBOTmplatGroup(vo.getSopmalCd()));
|
||||
content.put("formDvCd", service.selectBOTmplatFormGroup(vo.getSopmalCd()));
|
||||
content.put("boCtrlMap", service.selectBOMssageAtmcSndngTmplatInqireForm(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 자동 발송 템플릿 수정
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOMssageAtmcSndngTmplatUpdt")
|
||||
public ResponseEntity<?> updateBOMssageAtmcSndngTmplatUpdt(@RequestBody BOMaTmpltVO boTmpltVO) {
|
||||
//serializedFormData += "&sopmalCd="+MemberJwtContextHolder.getMemberInfo().getSopmalCd();
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
boTmpltVO.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
log.debug("메시지 자동 발송 템플릿 수정 BO 진입 =>{}", boTmpltVO);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.updateBOMssageAtmcSndngTmplatUpdt(boTmpltVO);
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 조회
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBONtcntalkAtmcSndngTmplatInqireForm")
|
||||
public ResponseEntity<?> selectBONtcntalkAtmcSndngTmplatInqireForm(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("알림톡 자동 발송 템플릿 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
content.put("bOTmpltVO", vo);
|
||||
// content.put("groupCd", service.selectBOTmplatGroupCd("FORM_DV"));
|
||||
content.put("groupCd", service.selectBOTmplatGroup(vo.getSopmalCd()));
|
||||
content.put("formDvCd", service.selectBOTmplatFormGroup(vo.getSopmalCd()));
|
||||
content.put("boCtrlMap", service.selectBONtcntalkAtmcSndngTmplatInqireForm(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 수정 팝업 화면 메서드
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBONtcntalkAtmcSndngTmplatUpdtPopupForm")
|
||||
public ResponseEntity<?> selectBONtcntalkAtmcSndngTmplatUpdtPopupForm(@RequestBody BOMaTmpltVO vo) {
|
||||
log.debug("알림톡 자동 발송 수정 팝업 BO 진입 =>{}", vo);
|
||||
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("bOTmpltVO", vo);
|
||||
content.put("boCtrlMap", service.selectBONtcntalkAtmcSndngTmplatUpdtPopupForm(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 수정
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBONtcntalkAtmcSndngTmplatUpdt")
|
||||
public ResponseEntity<?> updateBONtcntalkAtmcSndngTmplatUpdt(@RequestBody BOMaTmpltVO vo) {
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
//알림톡 템플릿 버튼 정제
|
||||
if(vo.getBtnType() != null){
|
||||
for(int i = 0; i < vo.getBtnType().size(); i++){
|
||||
if(vo.getBtnType().get(i) == "DS") {
|
||||
vo.getBtnNm().set(i, "");
|
||||
vo.getBtnMUrl().set(i, "");
|
||||
vo.getBtnPcUrl().set(i, "");
|
||||
}
|
||||
}
|
||||
|
||||
switch (vo.getBtnType().size()){
|
||||
case 5:
|
||||
vo.setBtnNm05(vo.getBtnNm().get(4));
|
||||
vo.setBtnType05(vo.getBtnType().get(4));
|
||||
vo.setBtn05Url01(vo.getBtnMUrl().get(4));
|
||||
vo.setBtn05Url02(vo.getBtnPcUrl().get(4));
|
||||
case 4:
|
||||
vo.setBtnNm04(vo.getBtnNm().get(3));
|
||||
vo.setBtnType04(vo.getBtnType().get(3));
|
||||
vo.setBtn04Url01(vo.getBtnMUrl().get(3));
|
||||
vo.setBtn04Url02(vo.getBtnPcUrl().get(3));
|
||||
case 3:
|
||||
vo.setBtnNm03(vo.getBtnNm().get(2));
|
||||
vo.setBtnType03(vo.getBtnType().get(2));
|
||||
vo.setBtn03Url01(vo.getBtnMUrl().get(2));
|
||||
vo.setBtn03Url02(vo.getBtnPcUrl().get(2));
|
||||
case 2:
|
||||
vo.setBtnNm02(vo.getBtnNm().get(1));
|
||||
vo.setBtnType02(vo.getBtnType().get(1));
|
||||
vo.setBtn02Url01(vo.getBtnMUrl().get(1));
|
||||
vo.setBtn02Url02(vo.getBtnPcUrl().get(1));
|
||||
case 1:
|
||||
vo.setBtnNm01(vo.getBtnNm().get(0));
|
||||
vo.setBtnType01(vo.getBtnType().get(0));
|
||||
vo.setBtn01Url01(vo.getBtnMUrl().get(0));
|
||||
vo.setBtn01Url02(vo.getBtnPcUrl().get(0));
|
||||
}
|
||||
}
|
||||
log.debug("알림톡 자동 발송 템플릿 수정 BO 진입 =>{}", vo);
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message = service.updateBONtcntalkAtmcSndngTmplatUpdt(vo);
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.vo.MaTmpltVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.ReplyFromResrc;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.communicate.ValidateResultConverter;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
/*
|
||||
* 템플릿 관리 Controller
|
||||
* @author 리브가
|
||||
* @since 2024-02-21
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-21 리브가 최초 생성
|
||||
* 2024-04-17 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/ntcn/tmplt")
|
||||
public class MaTmpltController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 템플릿 관리 페이지
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value="/selectAtmcSndngTmplatManage")
|
||||
public String selectEmailPassivSndngManage(ModelMap model, MaTmpltVO maTmpltVO){
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBOAtmcSndngTmplatManage", maTmpltVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/ntcn/tmplt/MaAtmcSndngTmplatManage";
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 이메일 템플릿 폼
|
||||
* @param model
|
||||
* @param tmpltVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectEmailAtmcSndngTmplatOneInqireForm")
|
||||
public String selectEmailAtmcSndngTmplatOneInqireForm(ModelMap model, MaTmpltVO tmpltVO, HttpSession session) {
|
||||
try {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBOEmailAtmcSndngTmplatOneInqireForm", tmpltVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
|
||||
model.addAttribute("tmpltVO",tmpltVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/tmplt/MaEmailAtmcSndngTmplatU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 이메일 템플릿 폼 > 이메일 템플릿
|
||||
* @return
|
||||
* @author 이대환
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value="/selectEmailAtmcSndngTmplatOne")
|
||||
public ResponseEntity<WnbtResponse> selectEmailAtmcSndngTmplatOne(MaTmpltVO tmpltVO, HttpSession session){
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBOEmailAtmcSndngTmplatOneInqireForm", tmpltVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 이메일 템플릿 - 이메일 템플릿 수정
|
||||
* @param tmpltVO
|
||||
* @param bindingResult 바인딩 및 정합성 점검결과 객체
|
||||
* @return ResponseEntity<WnbtResponse>
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateEmailAtmcSndngTmplatUpdt", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> updateEmailAtmcSndngTmplatUpdt(MaTmpltVO tmpltVO, BindingResult bindingResult, HttpSession session) {
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/updateBOEmailAtmcSndngTmplatUpdt", tmpltVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > SMS 템플릿 폼
|
||||
* @param model
|
||||
* @param tmpltVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectMssageAtmcSndngTmplatInqireForm")
|
||||
public String selectMssageAtmcSndngTmplatInqireForm(ModelMap model, MaTmpltVO tmpltVO, HttpSession session) {
|
||||
try {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBOMssageAtmcSndngTmplatInqireForm", tmpltVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
|
||||
model.addAttribute("tmpltVO",tmpltVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/tmplt/MaMssageAtmcSndngTmplatU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > SMS 템플릿 - SMS 템플릿 수정
|
||||
* @param serializedFormData
|
||||
* @param bindingResult 바인딩 및 정합성 점검결과 객체
|
||||
* @return ResponseEntity<WnbtResponse>
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateMssageAtmcSndngTmplatUpdt", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> updateMssageAtmcSndngTmplatUpdt(MaTmpltVO tmpltVO, BindingResult bindingResult, HttpSession session) {
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/updateBOMssageAtmcSndngTmplatUpdt", tmpltVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 알림톡 템플릿 폼
|
||||
* @param model
|
||||
* @param tmpltVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectNtcntalkAtmcSndngTmplatInqireForm")
|
||||
public String selectNtcntalkAtmcSndngTmplatInqireForm(ModelMap model, MaTmpltVO tmpltVO, HttpSession session) {
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
try {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBONtcntalkAtmcSndngTmplatInqireForm", tmpltVO),
|
||||
model,
|
||||
"resultListMap"
|
||||
);
|
||||
|
||||
model.addAttribute("tmpltVO",tmpltVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/tmplt/MaNtcntalkAtmcSndngTmplatU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 알림톡 템플릿 > 알림톡 탬플릿 수정 팝업 폼
|
||||
* @param model
|
||||
* @param tmpltVO
|
||||
* @return String
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectNtcntalkAtmcSndngTmplatUpdtPopupForm")
|
||||
public String selectNtcntalkAtmcSndngTmplatUpdtPopupForm(MaTmpltVO tmpltVO, ModelMap model, HttpSession session) {
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
try {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/selectBONtcntalkAtmcSndngTmplatUpdtPopupForm", tmpltVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
|
||||
model.addAttribute("tmpltVO",tmpltVO);
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return "admin/ntcn/tmplt/MaNtcntalkAtmcSndngTmplatUpdtPopupU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관리 > 알림톡 템플릿 - 알림톡 템플릿 수정
|
||||
* @param serializedFormData
|
||||
* @param bindingResult 바인딩 및 정합성 점검결과 객체
|
||||
* @return ResponseEntity<WnbtResponse>
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateNtcntalkAtmcSndngTmplatUpdt", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> updateNtcntalkAtmcSndngTmplatUpdt(@Validated MaTmpltVO tmpltVO, BindingResult bindingResult, HttpSession session) {
|
||||
// tmpltVO.setSopmalCd(session.getAttribute("authSopmalCd").toString());
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/ntcn/tmplt/updateBONtcntalkAtmcSndngTmplatUpdt", tmpltVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.vo.BOMaTmpltVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 템플릿 위한 Mapper Interface
|
||||
*
|
||||
* @author 리브가
|
||||
* @since 2024-02-21
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-21 리브가 최초 생성
|
||||
* 2024-04-17 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaTmpltMapper {
|
||||
|
||||
public List<DataMap> selectBOEmailTmpltListInqire(BOMaTmpltVO tmpltVO);
|
||||
|
||||
public List<DataMap> selectBOSmsTmpltListInqire(BOMaTmpltVO tmpltVO);
|
||||
|
||||
public List<DataMap> selectBOKakaoTmpltListInqire(BOMaTmpltVO tmpltVO);
|
||||
|
||||
/***********************************************************************
|
||||
* 공통코드
|
||||
***********************************************************************/
|
||||
/**
|
||||
* 그룹코드, 양식구분 조회
|
||||
* @param String
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOTmplatGroupCd(String param);
|
||||
|
||||
/***********************************************************************
|
||||
* 이메일 자동발송 발신주소 조회
|
||||
***********************************************************************/
|
||||
/**
|
||||
* 이메일 자동발송 발신주소 조회
|
||||
* @param vo
|
||||
* @return String
|
||||
*/
|
||||
public String selectBOEmailAtmcSndngDsptchAdres(BOMaTmpltVO vo);
|
||||
|
||||
/***********************************************************************
|
||||
* 이메일 템플릿
|
||||
***********************************************************************/
|
||||
/**
|
||||
* 이메일 템플릿 조회
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOEmailAtmcSndngTmplatInqireForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 이메일 템플릿 단건 조회
|
||||
* @param vo
|
||||
* @return DataMap
|
||||
*/
|
||||
public DataMap selectBOEmailAtmcSndngTmplatOneInqireForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 이메일 템플릿 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public void insertBOEmailTmplat(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 이메일 템플릿 수정
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public void updateBOEmailTmplat(BOMaTmpltVO vo);
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 메시지 템플릿
|
||||
***********************************************************************/
|
||||
/**
|
||||
* 메시지 템플릿 조회
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOMssageAtmcSndngTmplatInqireForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 메시지 템플릿 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public void insertBOMssageTmplat(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 메시지 템플릿 수정
|
||||
* @param voList
|
||||
* @return
|
||||
*/
|
||||
public void updateBOMssageTmplat(List<BOMaTmpltVO> voList);
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* 알림톡 템플릿
|
||||
***********************************************************************/
|
||||
/**
|
||||
* 메시지 템플릿 조회
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBONtcntalkAtmcSndngTmplatInqireForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 알림톡 템플릿 조회 _ 팝업
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectBONtcntalkAtmcSndngTmplatUpdtPopupForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 알림톡 템플릿 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public void insertBOKakaoForm(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 알림톡 템플릿 등록_버튼
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public void insertBOKakaoFormButton(BOMaTmpltVO vo);
|
||||
|
||||
/**
|
||||
* 알림톡 템플릿 수정
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public void updateBOKakaoForm(List<BOMaTmpltVO> voList);
|
||||
|
||||
/**
|
||||
* 알림톡 템플릿 수정_팝업
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public void updateBOKakaoFormPopup(BOMaTmpltVO boTmpltVO);
|
||||
|
||||
/**
|
||||
* 통합관리자 자동발송관리 쇼핑몰 조회
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOSopmalAtmcSndng();
|
||||
|
||||
/**
|
||||
* 템플릿 사용 그룹 조회
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOTmplatGroup(String param);
|
||||
|
||||
/**
|
||||
* 템플릿 사용 그룹별 폼 조회
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOTmplatFormGroup(String param);
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.service;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.mapper.BOMaTmpltMapper;
|
||||
import com.wb.domainserver.domain.admin.ntcn.tmplt.vo.BOMaTmpltVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 템플릿 관리를 위한 Service
|
||||
*
|
||||
* @author 리브가
|
||||
* @since 2024-02-21
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-02-21 리브가 최초 생성
|
||||
* 2024-04-17 이대환 내용 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOMaTmpltService {
|
||||
@Autowired
|
||||
private BOMaTmpltMapper mapper;
|
||||
// @Autowired
|
||||
// private BOMaComncdService bOMaComncdService;
|
||||
|
||||
/**
|
||||
* 그룹코드, 양식구분 조회 메서드
|
||||
* @param param
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOTmplatGroupCd(String param) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOTmplatGroupCd(param);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 자동발송 발신주소 조회
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public String selectBOEmailAtmcSndngDsptchAdres(BOMaTmpltVO vo) {
|
||||
String result= null;
|
||||
|
||||
result= mapper.selectBOEmailAtmcSndngDsptchAdres(vo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 자동 발송 템플릿 조회 메서드
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOEmailAtmcSndngTmplatInqireForm(BOMaTmpltVO vo) {
|
||||
List<DataMap> result= null;
|
||||
|
||||
result= mapper.selectBOEmailAtmcSndngTmplatInqireForm(vo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 자동 발송 템플릿 단건 조회 메서드
|
||||
* @param vo
|
||||
* @return DataMap
|
||||
*/
|
||||
public DataMap selectBOEmailAtmcSndngTmplatOneInqireForm(BOMaTmpltVO vo) {
|
||||
DataMap resultOne = new DataMap();
|
||||
formDvSplit(vo);
|
||||
|
||||
resultOne = mapper.selectBOEmailAtmcSndngTmplatOneInqireForm(vo);
|
||||
return resultOne;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이메일 자동 발송 템플릿 수정 메서드
|
||||
* @param vo
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> updateBOEmailAtmcSndngTmplatUpdt(BOMaTmpltVO vo) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
formDvSplit(vo);
|
||||
|
||||
try {
|
||||
mapper.updateBOEmailTmplat(vo);
|
||||
message.put("getEmailSndngFormInnb", vo.getEmailSndngFormInnb());
|
||||
message.put("result", "success");
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 자동 발송 템플릿 조회 메서드
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOMssageAtmcSndngTmplatInqireForm(BOMaTmpltVO vo) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOMssageAtmcSndngTmplatInqireForm(vo);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 메시지 자동 발송 템플릿 수정 메서드
|
||||
* @param serializedFormData
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> updateBOMssageAtmcSndngTmplatUpdt(BOMaTmpltVO boTmpltVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<BOMaTmpltVO> tmplatList = new ArrayList<>();
|
||||
|
||||
String tmplatListStr = StringUtil.isNullToString(boTmpltVO.getTmplatList());
|
||||
|
||||
if(!"".equals(tmplatListStr)){
|
||||
tmplatList = objectMapper.readValue(tmplatListStr, new TypeReference<List<BOMaTmpltVO>>() {});
|
||||
}
|
||||
|
||||
mapper.updateBOMssageTmplat(tmplatList);
|
||||
|
||||
|
||||
message.put("getSmsSndngFormInnb", tmplatList.get(tmplatList.size()-1).getSmsSndngFormInnb());
|
||||
message.put("result", "success");
|
||||
|
||||
/* 파라미터 정제 및 복호화 */
|
||||
//Map<String, List<String>> formDataMap = formSplitNDecode(serializedFormData);
|
||||
|
||||
// String sopmalCd = formDataMap.get("sopmalCd").get(0);
|
||||
//// log.debug("sopmalCd =>{}", sopmalCd);
|
||||
// String formDvCd = formDataMap.get("formDvCd").get(0);
|
||||
//// log.debug("formDvCd =>{}", formDvCd);
|
||||
// List<String> formDtlDvCdList = formDataMap.get("formDtlDvCd");
|
||||
//// log.debug("smsSndngFormInnbList =>{}", smsSndngFormInnbList);
|
||||
// List<String> smsCnList = formDataMap.get("smsCn");
|
||||
//// log.debug("smsCnList =>{}", smsCnList);
|
||||
//
|
||||
// //사용자 정보 추출 및 적용
|
||||
// AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
//
|
||||
// List<BOTmpltVO> voList = new ArrayList<>();
|
||||
// if (formDtlDvCdList != null && smsCnList != null) {
|
||||
// for (int i = 0; i < formDtlDvCdList.size(); i++) {
|
||||
// String formDtlDvCd = formDtlDvCdList.get(i);
|
||||
// String smsCn = smsCnList.get(i);
|
||||
// BOTmpltVO newVo = new BOTmpltVO(sopmalCd, formDvCd, formDtlDvCd, smsCn);
|
||||
// newVo.setUpdusr(user.getUserInnb());
|
||||
// voList.add(newVo);
|
||||
// }
|
||||
// }
|
||||
//// log.debug("파라미터 VO 변환 및 복호화 =>{}", voList);
|
||||
//
|
||||
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 조회 메서드
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBONtcntalkAtmcSndngTmplatInqireForm(BOMaTmpltVO vo) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBONtcntalkAtmcSndngTmplatInqireForm(vo);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 조회 메서드_ 팝업
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectBONtcntalkAtmcSndngTmplatUpdtPopupForm(BOMaTmpltVO vo) {
|
||||
DataMap ntcntalkDtlInfo = null;
|
||||
|
||||
ntcntalkDtlInfo = mapper.selectBONtcntalkAtmcSndngTmplatUpdtPopupForm(vo);
|
||||
return ntcntalkDtlInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림톡 자동 발송 템플릿 수정 메서드
|
||||
* @param boTmpltVO
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> updateBONtcntalkAtmcSndngTmplatUpdt(BOMaTmpltVO boTmpltVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.updateBOKakaoFormPopup(boTmpltVO);
|
||||
|
||||
// ObjectMapper objectMapper = new ObjectMapper();
|
||||
// List<BOMaTmpltVO> tmplatList = new ArrayList<>();
|
||||
//
|
||||
// String tmplatListStr = StringUtil.isNullToString(boTmpltVO.getTmplatList());
|
||||
//
|
||||
// if(!"".equals(tmplatListStr)){
|
||||
// tmplatList = objectMapper.readValue(tmplatListStr, new TypeReference<List<BOMaTmpltVO>>() {});
|
||||
// }
|
||||
//
|
||||
// tmplatList = tmplatList.stream()
|
||||
// .map(vo -> {
|
||||
// vo.setSopmalCd(boTmpltVO.getSopmalCd());
|
||||
// return vo;
|
||||
// }).toList();
|
||||
//
|
||||
// log.debug("tmeplatList {}", tmplatList);
|
||||
// mapper.updateBOKakaoFormPopup(tmplatList);
|
||||
//
|
||||
// message.put("getNtcntalkSndngFormInnb", tmplatList.get(tmplatList.size()-1).getNtcntalkSndngFormInnb());
|
||||
// message.put("result", "success");
|
||||
|
||||
// /* 파라미터 정제 및 복호화 */
|
||||
// Map<String, List<String>> formDataMap = formSplitNDecode(serializedFormData);
|
||||
//
|
||||
// String formDvCd = formDataMap.get("formDvCd").get(0);
|
||||
//// log.debug("formDvCd =>{}", formDvCd);
|
||||
// List<String> formDtlDvCdList = formDataMap.get("formDtlDvCd");
|
||||
//// log.debug("formDtlDvCdList =>{}", formDtlDvCdList);
|
||||
// List<String> msgList = formDataMap.get("msg");
|
||||
//// log.debug("msgList =>{}", msgList);
|
||||
// List<String> smsRplcAtList = formDataMap.get("smsRplcAt");
|
||||
//// log.debug("smsRplcAtList =>{}", smsRplcAtList);
|
||||
// List<String> smsCnList = formDataMap.get("smsRplcCn");
|
||||
//// log.debug("smsCnList =>{}", smsCnList);
|
||||
//
|
||||
// List<String> btnTypeList = formDataMap.get("btnType");
|
||||
// log.debug("btnTypeList =>{}", btnTypeList);
|
||||
// List<String> btnNmList = formDataMap.get("btnNm");
|
||||
//// log.debug("btnNmList =>{}", btnNmList);
|
||||
// List<String> btnPcUrlList = formDataMap.get("btnPcUrl");
|
||||
//// log.debug("btnPcUrlList =>{}", btnPcUrlList);
|
||||
// List<String> btnMUrlList = formDataMap.get("btnMUrl");
|
||||
//// log.debug("btnMUrlList =>{}", btnMUrlList);
|
||||
//
|
||||
// //사용자 정보 추출 및 적용
|
||||
// AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
//
|
||||
// List<BOTmpltVO> voList = new ArrayList<>();
|
||||
// if (formDtlDvCdList != null && msgList != null) {
|
||||
// for (int i = 0; i < formDtlDvCdList.size(); i++) {
|
||||
// String formDtlDvCd = formDtlDvCdList.get(i);
|
||||
// String msg = msgList.get(i);
|
||||
// String smsRplcAt = smsRplcAtList.get(i);
|
||||
// String smsCn = smsCnList.get(i);
|
||||
// BOTmpltVO newVo = new BOTmpltVO(formDvCd, formDtlDvCd, msg, smsRplcAt, smsCn);
|
||||
//
|
||||
// if(formDtlDvCdList.size() == 1) {
|
||||
// if(btnTypeList != null) {
|
||||
// for(int j = 0; j < btnTypeList.size(); j++) {
|
||||
// switch (j) {
|
||||
// case 0: {
|
||||
// newVo.setBtnType01(btnTypeList.get(j));
|
||||
// newVo.setBtnNm01(btnNmList.get(j));
|
||||
// newVo.setBtn01Url01(btnMUrlList.get(j));
|
||||
// newVo.setBtn01Url02(btnPcUrlList.get(j));
|
||||
// if(btnTypeList.get(j).equals("DS")) {
|
||||
// newVo.setBtnNm01("");
|
||||
// newVo.setBtn01Url01("");
|
||||
// newVo.setBtn01Url02("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 1: {
|
||||
// newVo.setBtnType02(btnTypeList.get(j));
|
||||
// newVo.setBtnNm02(btnNmList.get(j));
|
||||
// newVo.setBtn02Url01(btnMUrlList.get(j));
|
||||
// newVo.setBtn02Url02(btnPcUrlList.get(j));
|
||||
// if(btnTypeList.get(j).equals("DS")) {
|
||||
// newVo.setBtnNm02("");
|
||||
// newVo.setBtn02Url01("");
|
||||
// newVo.setBtn02Url02("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 2: {
|
||||
// newVo.setBtnType03(btnTypeList.get(j));
|
||||
// newVo.setBtnNm03(btnNmList.get(j));
|
||||
// newVo.setBtn03Url01(btnMUrlList.get(j));
|
||||
// newVo.setBtn03Url02(btnPcUrlList.get(j));
|
||||
// if(btnTypeList.get(j).equals("DS")) {
|
||||
// newVo.setBtnNm03("");
|
||||
// newVo.setBtn03Url01("");
|
||||
// newVo.setBtn03Url02("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 3: {
|
||||
// newVo.setBtnType04(btnTypeList.get(j));
|
||||
// newVo.setBtnNm04(btnNmList.get(j));
|
||||
// newVo.setBtn04Url01(btnMUrlList.get(j));
|
||||
// newVo.setBtn04Url02(btnPcUrlList.get(j));
|
||||
// if(btnTypeList.get(j).equals("DS")) {
|
||||
// newVo.setBtnNm04("");
|
||||
// newVo.setBtn04Url01("");
|
||||
// newVo.setBtn04Url02("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case 4: {
|
||||
// newVo.setBtnType05(btnTypeList.get(j));
|
||||
// newVo.setBtnNm05(btnNmList.get(j));
|
||||
// newVo.setBtn05Url01(btnMUrlList.get(j));
|
||||
// newVo.setBtn05Url02(btnPcUrlList.get(j));
|
||||
// if(btnTypeList.get(j).equals("DS")) {
|
||||
// newVo.setBtnNm05("");
|
||||
// newVo.setBtn05Url01("");
|
||||
// newVo.setBtn05Url02("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// newVo.setUpdusr(user.getUserInnb());
|
||||
// voList.add(newVo);
|
||||
// }
|
||||
// }
|
||||
// log.debug("파라미터 VO 변환 및 복호화 =>{}", voList);
|
||||
//
|
||||
// /* 템플릿 관리 > 알림톡 탭 수정 기능 */
|
||||
//// if(btnTypeList != null) {
|
||||
//
|
||||
//// }else {
|
||||
//// mapper.updateBOKakaoForm(voList);
|
||||
//// }
|
||||
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 폼 데이터 정제 및 복호화
|
||||
* @return Map<String, List<String>>
|
||||
*/
|
||||
private Map<String, List<String>> formSplitNDecode(String serializedFormData) {
|
||||
Map<String, List<String>> formDataMap = new HashMap<>();
|
||||
String[] keyValuePairs = serializedFormData.split("&");
|
||||
|
||||
try {
|
||||
for (String pair : keyValuePairs) {
|
||||
String[] keyValue = pair.split("=");
|
||||
String key = keyValue[0];
|
||||
String value = keyValue.length > 1 ? keyValue[1] : "";
|
||||
|
||||
formDataMap.computeIfAbsent(URLDecoder.decode(key, "UTF-8"), k -> new ArrayList<>()).add(URLDecoder.decode(value, "UTF-8"));
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return formDataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 양식구분 정제
|
||||
* @return
|
||||
*/
|
||||
private void formDvSplit(BOMaTmpltVO vo) {
|
||||
String formDvCd = vo.getFormDvCd();
|
||||
String[] parts = formDvCd.split(",")[0].split("&");
|
||||
log.debug("parts {}", parts[0]);
|
||||
vo.setFormDvCd(parts[0]);
|
||||
if(parts.length > 1) {
|
||||
vo.setFormDtlDvCd(parts[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 자동발송관리 쇼핑몰 조회
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOSopmalAtmcSndng() {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOSopmalAtmcSndng();
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 사용 그룹 조회
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOTmplatGroup(String param) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOTmplatGroup(param);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 사용 그룹별 폼 조회
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOTmplatFormGroup(String param) {
|
||||
List<DataMap> resultList = null;
|
||||
resultList = mapper.selectBOTmplatFormGroup(param);
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaTmpltVO extends AbstractVO {
|
||||
|
||||
/** 템플릿 공통 */
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 양식구분 */
|
||||
private String formDvCd;
|
||||
/** 양식상세구분 */
|
||||
private String formDtlDvCd;
|
||||
|
||||
|
||||
/** 이메일 템플릿 */
|
||||
/** 고유번호 */
|
||||
private Integer emailSndngFormInnb;
|
||||
/** 이메일 제목 */
|
||||
private String emailSj;
|
||||
/** 이메일 내용 */
|
||||
private String emailCn;
|
||||
|
||||
/** 메시지 템플릿 */
|
||||
/** 고유번호*/
|
||||
private Integer smsSndngFormInnb;
|
||||
/** SMS 내용*/
|
||||
private String smsCn;
|
||||
|
||||
|
||||
/** 카카오 알림톡 템플릿 내용 */
|
||||
/** 알림톡 발송양식 고유번호 */
|
||||
private Integer ntcntalkSndngFormInnb;
|
||||
/** 템플릿내용 */
|
||||
private String msg;
|
||||
/** 템플릿코드 */
|
||||
private String templatecode;
|
||||
/** SMS대체여부 */
|
||||
private String smsRplcAt;
|
||||
/** SMS 대체문자*/
|
||||
private String smsRplcCn;
|
||||
|
||||
/** 카카오 알림톡_버튼 */
|
||||
/** 버튼타입 */
|
||||
private String btnType01;
|
||||
/** 버튼명 */
|
||||
private String btnNm01;
|
||||
/** 링크주소(mobile) */
|
||||
private String btn01Url01;
|
||||
/** 링크주소(pc) */
|
||||
private String btn01Url02;
|
||||
/** 버튼타입2 */
|
||||
private String btnType02;
|
||||
/** 버튼명2 */
|
||||
private String btnNm02;
|
||||
/** 링크주소2(mobile) */
|
||||
private String btn02Url01;
|
||||
/** 링크주소2(pc) */
|
||||
private String btn02Url02;
|
||||
/** 버튼타입3 */
|
||||
private String btnType03;
|
||||
/** 버튼명3 */
|
||||
private String btnNm03;
|
||||
/** 링크주소3(mobile) */
|
||||
private String btn03Url01;
|
||||
/** 링크주소3(pc) */
|
||||
private String btn03Url02;
|
||||
/** 버튼타입4 */
|
||||
private String btnType04;
|
||||
/** 버튼명4 */
|
||||
private String btnNm04;
|
||||
/** 링크주소4(mobile) */
|
||||
private String btn04Url01;
|
||||
/** 링크주소4(pc) */
|
||||
private String btn04Url02;
|
||||
/** 버튼타입5 */
|
||||
private String btnType05;
|
||||
/** 버튼명5 */
|
||||
private String btnNm05;
|
||||
/** 링크주소5(mobile) */
|
||||
private String btn05Url01;
|
||||
/** 링크주소5(pc) */
|
||||
private String btn05Url02;
|
||||
|
||||
/** 템플릿 정보 목록 */
|
||||
private String tmplatList;
|
||||
/** 버튼타입 리스트 */
|
||||
private List<String> btnType;
|
||||
/** 버튼명 리스트 */
|
||||
private List<String> btnNm;
|
||||
/** 링크주소1(mobile) 리스트 */
|
||||
private List<String> btnMUrl;
|
||||
/** 링크주소1(pc) 리스트 */
|
||||
private List<String> btnPcUrl;
|
||||
|
||||
public BOMaTmpltVO(String sopmalCd, String formDvCd, String formDtlDvCd, String smsCn) {
|
||||
this.sopmalCd = sopmalCd;
|
||||
this.formDvCd = formDvCd;
|
||||
this.formDtlDvCd = formDtlDvCd;
|
||||
this.smsCn = smsCn;
|
||||
}
|
||||
public BOMaTmpltVO(String formDvCd, String formDtlDvCd, String msg, String smsRplcAt, String smsCn) {
|
||||
// this.sopmalCd = sopmalCd;
|
||||
this.formDvCd = formDvCd;
|
||||
this.formDtlDvCd = formDtlDvCd;
|
||||
this.msg = msg;
|
||||
this.smsRplcAt = smsRplcAt;
|
||||
this.smsCn = smsCn;
|
||||
}
|
||||
public BOMaTmpltVO() {
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.wb.domainserver.domain.admin.ntcn.tmplt.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaTmpltVO extends AbstractVO {
|
||||
|
||||
/** 템플릿 공통 */
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 양식구분 */
|
||||
private String formDvCd;
|
||||
/** 양식상세구분 */
|
||||
private String formDtlDvCd;
|
||||
|
||||
|
||||
/** 이메일 템플릿 */
|
||||
/** 고유번호 */
|
||||
private Integer emailSndngFormInnb;
|
||||
/** 이메일 제목 */
|
||||
private String emailSj;
|
||||
/** 이메일 내용 */
|
||||
private String emailCn;
|
||||
|
||||
/** 메시지 템플릿 */
|
||||
/** 고유번호*/
|
||||
private Integer smsSndngFormInnb;
|
||||
/** SMS 내용*/
|
||||
private String smsCn;
|
||||
|
||||
|
||||
/** 카카오 알림톡 템플릿 내용 */
|
||||
/** 알림톡 발송양식 고유번호 */
|
||||
private Integer ntcntalkSndngFormInnb;
|
||||
/** 템플릿내용 */
|
||||
private String msg;
|
||||
/** 템플릿코드 */
|
||||
private String templatecode;
|
||||
/** SMS대체여부 */
|
||||
private String smsRplcAt;
|
||||
|
||||
/** 카카오 알림톡_버튼 */
|
||||
/** 버튼타입1 */
|
||||
private String btnType01;
|
||||
/** 버튼명1 */
|
||||
private String btnNm01;
|
||||
/** 링크주소1(mobile) */
|
||||
private String btn01Url01;
|
||||
/** 링크주소1(pc) */
|
||||
private String btn01Url02;
|
||||
/** 버튼타입2 */
|
||||
private String btnType02;
|
||||
/** 버튼명2 */
|
||||
private String btnNm02;
|
||||
/** 링크주소2(mobile) */
|
||||
private String btn02Url01;
|
||||
/** 링크주소2(pc) */
|
||||
private String btn02Url02;
|
||||
/** 버튼타입3 */
|
||||
private String btnType03;
|
||||
/** 버튼명3 */
|
||||
private String btnNm03;
|
||||
/** 링크주소3(mobile) */
|
||||
private String btn03Url01;
|
||||
/** 링크주소3(pc) */
|
||||
private String btn03Url02;
|
||||
/** 버튼타입4 */
|
||||
private String btnType04;
|
||||
/** 버튼명4 */
|
||||
private String btnNm04;
|
||||
/** 링크주소4(mobile) */
|
||||
private String btn04Url01;
|
||||
/** 링크주소4(pc) */
|
||||
private String btn04Url02;
|
||||
/** 버튼타입5 */
|
||||
private String btnType05;
|
||||
/** 버튼명5 */
|
||||
private String btnNm05;
|
||||
/** 링크주소5(mobile) */
|
||||
private String btn05Url01;
|
||||
/** 링크주소5(pc) */
|
||||
private String btn05Url02;
|
||||
|
||||
/** 템플릿 정보 목록 */
|
||||
private String tmplatList;
|
||||
/** 버튼타입 리스트 */
|
||||
private List<String> btnType;
|
||||
/** 버튼명 리스트 */
|
||||
private List<String> btnNm;
|
||||
/** 링크주소(mobile) 리스트 */
|
||||
private List<String> btnMUrl;
|
||||
/** 링크주소(pc) 리스트 */
|
||||
private List<String> btnPcUrl;
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.controller;
|
||||
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.service.BOMaAdminStatsService;
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.vo.BOMaMbrNdMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.stats.marktAnals.service.BOMarktAnalsService;
|
||||
import com.wb.domainserver.domain.gcone.stats.marktAnals.vo.BOMarktAnalsVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/admin/stats/marktAnals")
|
||||
@Slf4j
|
||||
public class BOMaAdminStatsController {
|
||||
|
||||
@Autowired
|
||||
private BOMaAdminStatsService service;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* 회원 및 마일리지
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
* 통합관리자 회원 및 마일리지 통계 화면
|
||||
* @param
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOAdminMbrNdMlgStats")
|
||||
public ResponseEntity<?> selectBOAdminMbrNdMlgStats(@RequestBody DataMap vo) {
|
||||
|
||||
// 응답 메세지 객체
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
content.put("resultList", service.selectBOAdminMbrNdMlgStats(vo));
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 회원 및 마일리지 통계 표 조회
|
||||
* @param
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOAdminMbrNdMlgStatsTableInqire")
|
||||
public ResponseEntity<?> selectBOAdminMbrNdMlgStatsTableInqire(@RequestBody BOMarktAnalsVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
if("01".equals(user.getSysDvCd())){
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
// 응답 메세지 객체
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getRecordCountPerPage());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
List<DataMap> resultList = service.selectBOAdminMbrNdMlgStatsTableInqire(vo);
|
||||
|
||||
content.put("resultList", resultList);
|
||||
content.put("paginationInfo", paginationInfo);
|
||||
content.put("unitFlag", vo.getUnitFlag());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 마일리지 정산
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectBOAdminMlgStlForm")
|
||||
public ResponseEntity<?> selectBOAdminMlgStlForm() {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
//현재 년도
|
||||
int currentYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
content.put("currentYear", currentYear);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 목록 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectBOAdminMlgStlListInqire")
|
||||
public ResponseEntity<?> selectBOAdminMlgStlListInqire(@RequestBody BOMaMbrNdMlgVO vo) {
|
||||
log.debug("selectBOAdminMlgStlListInqire(vo = {})", vo);
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//
|
||||
// //마일리지 통계
|
||||
// List<DataMap> mlgStatList = service.selectBOMaMlgStatList(vo);
|
||||
// log.debug("mlgStatList {}", mlgStatList);
|
||||
// content.put("mlgStatList", mlgStatList);
|
||||
//
|
||||
// //마일리지 정산 목록
|
||||
// List<DataMap> mlgStlList = service.selectBOMaMlgStlList(vo);
|
||||
// log.debug("mlgStlList {}", mlgStlList);
|
||||
// content.put("mlgStlList", mlgStlList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.controller;
|
||||
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.service.BOMaAdminStatsService;
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.vo.MaStlMlgVO;
|
||||
import com.wb.domainserver.domain.mngr.stats.marktAnals.vo.MarktAnalsVO;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.RESRC;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "/admin/stats/marktAnals")
|
||||
@Slf4j
|
||||
public class MaMarktAnalsController {
|
||||
|
||||
@Autowired
|
||||
private BOMaAdminStatsService service;
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* 회원 및 마일리지
|
||||
*************************************************************************/
|
||||
|
||||
/**
|
||||
* 회원 및 마일리지 화면
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMbrNdMlgStats")
|
||||
public String selectAdminMbrMlg(ModelMap model) {
|
||||
MarktAnalsVO vo = new MarktAnalsVO();
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/stats/marktAnals/selectBOAdminMbrNdMlgStats", vo),
|
||||
model,
|
||||
"cond"
|
||||
);
|
||||
model.put("resultMap", vo);
|
||||
|
||||
return "admin/stats/marktAnals/MaMbrNdMlgStats";
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원 및 마일리지 표 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMbrNdMlgStatsTableInqire")
|
||||
public String selectAdminMbrMlgTableInqire(MarktAnalsVO vo, ModelMap model) {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/stats/marktAnals/selectBOAdminMbrNdMlgStatsTableInqire", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/stats/marktAnals/MaMbrNdMlgStatsTable";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 마일리지 통계 화면
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMlg")
|
||||
public String selectAdminMlg() {
|
||||
log.debug("selectAdminMlg()");
|
||||
|
||||
return "admin/stats/marktAnals/mlg";
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 표 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMlgTableInqire")
|
||||
public String selectAdminMlgTableInqire(ModelMap model) {
|
||||
log.debug("selectAdminMlgTableInqire(vo = )");
|
||||
|
||||
// responseHandler.handleResponse(
|
||||
// sendToResrc.ofPost(RESRC.GCONEBO, "/gcone/stats/marktAnals/selectBOAdminMbrMlgTableInqire", vo),
|
||||
// model,
|
||||
// "resultMap"
|
||||
// );
|
||||
|
||||
return "admin/stats/marktAnals/mlgTable";
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 정산
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMlgStlForm")
|
||||
public String selectAdminMlgStlForm(ModelMap model, MaStlMlgVO vo) {
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/stats/marktAnals/selectBOAdminMlgStlForm", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/stats/marktAnals/MlgStlForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 표 조회
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectAdminMlgStlListInqire")
|
||||
public String selectAdminMlgStlListInqire(ModelMap model, MaStlMlgVO vo) {
|
||||
log.debug("selectAdminMlgTableInqire(vo = {})", vo);
|
||||
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/stats/marktAnals/selectBOAdminMlgStlListInqire", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/stats/marktAnals/MlgStlList";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.vo.BOMaMbrNdMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.stats.marktAnals.vo.BOMarktAnalsVO;
|
||||
import com.wb.domainserver.domain.itrnt.ntcn.stl.vo.BOItrntStlMssageVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOMaAdminStatsMapper {
|
||||
|
||||
/**
|
||||
* 회원 및 마일리지 표 건수 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public Integer selectBOAdminMbrNdMlgTableCntInqire(BOMarktAnalsVO vo);
|
||||
|
||||
/**
|
||||
* 회원 및 마일리지 표 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOAdminMbrNdMlgTableInqire(BOMarktAnalsVO vo);
|
||||
|
||||
/**
|
||||
* 마일리지 통계 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOMaMlgStatList(BOMaMbrNdMlgVO vo);
|
||||
|
||||
/**
|
||||
* 마일리지 정산 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<DataMap> selectBOMaMlgStlList(BOMaMbrNdMlgVO vo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 쇼핑몰 코드, 이름 조회
|
||||
*/
|
||||
public List<DataMap> selectBOAdminMbrNdMlgStats(DataMap vo);
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.mapper.BOMaAdminStatsMapper;
|
||||
import com.wb.domainserver.domain.admin.stats.marktAnals.vo.BOMaMbrNdMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.stats.marktAnals.vo.BOMarktAnalsVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOMaAdminStatsService {
|
||||
|
||||
@Autowired
|
||||
private BOMaAdminStatsMapper mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 통합관리자 회원 및 마일리지 통계 화면
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOAdminMbrNdMlgStats(DataMap vo) {
|
||||
// 차트 데이터
|
||||
List<DataMap> resultList = new ArrayList<>();
|
||||
|
||||
resultList = mapper.selectBOAdminMbrNdMlgStats(vo);
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 통합관리자 회원 및 마일리지 통계 표 조회
|
||||
* @param vo
|
||||
* @return List<DataMap>
|
||||
*/
|
||||
public List<DataMap> selectBOAdminMbrNdMlgStatsTableInqire(BOMarktAnalsVO vo) {
|
||||
// 응답 객체
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
List<DataMap> resultList = new ArrayList<DataMap>();
|
||||
Integer totalCnt = 0;
|
||||
vo.setOrdrFinal(namingConvention(vo.getOrdrStand(), vo.getOrdrType()));
|
||||
|
||||
vo.setUnitFlag("");//todo : 삭제
|
||||
if("".equals(vo.getUnitFlag()) ) {
|
||||
totalCnt = mapper.selectBOAdminMbrNdMlgTableCntInqire(vo);
|
||||
|
||||
vo.getPaginationInfo().setTotalRecordCount(totalCnt);
|
||||
if(totalCnt > 0) {
|
||||
resultList = mapper.selectBOAdminMbrNdMlgTableInqire(vo);
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 정렬 조건 만들기
|
||||
* @param ordrStand
|
||||
* @param ordrType
|
||||
* @return String
|
||||
*/
|
||||
public static String namingConvention(String ordrStand, String ordrType) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if(ordrStand == null){
|
||||
return "";
|
||||
}
|
||||
for (int i = 0; i < ordrStand.length(); i++) {
|
||||
char currentChar = ordrStand.charAt(i);
|
||||
|
||||
if ((Character.isUpperCase(currentChar) || Character.isDigit(currentChar)) && i != 0) {
|
||||
result.append('_');
|
||||
}
|
||||
|
||||
result.append(Character.toUpperCase(currentChar));
|
||||
}
|
||||
|
||||
return result.toString() + " " + ordrType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 마일리지 통계
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOMaMlgStatList(BOMaMbrNdMlgVO vo) {
|
||||
//년월 합친 문자 202502로 조회
|
||||
String srchDt = vo.getSrchYear() + vo.getSrchMnt();
|
||||
vo.setSrchDt(srchDt);
|
||||
return mapper.selectBOMaMlgStatList(vo);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 마일리지 정산 목록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<DataMap> selectBOMaMlgStlList(BOMaMbrNdMlgVO vo) {
|
||||
//년월 합친 문자 202502로 조회
|
||||
String srchDt = vo.getSrchYear() + vo.getSrchMnt();
|
||||
vo.setSrchDt(srchDt);
|
||||
return mapper.selectBOMaMlgStlList(vo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOMaMbrNdMlgVO {
|
||||
|
||||
/** 매장 번호 */
|
||||
private String strInnb;
|
||||
|
||||
/** 등록자 구분 */
|
||||
private String regusrDv;
|
||||
|
||||
/** 매장 구분 */
|
||||
private String strDv;
|
||||
|
||||
/** 연도 */
|
||||
private String srchYear;
|
||||
|
||||
/** 월 */
|
||||
private String srchMnt;
|
||||
|
||||
/** 조회년월 */
|
||||
private String srchDt;
|
||||
|
||||
/** 조회 법인 */
|
||||
private String srchCrp;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.wb.domainserver.domain.admin.stats.marktAnals.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaStlMlgVO extends AbstractVO {
|
||||
|
||||
/** 매장 번호 */
|
||||
private String strInnb;
|
||||
|
||||
/** 등록자 구분 */
|
||||
private String regusrDv;
|
||||
|
||||
/** 매장 구분 */
|
||||
private String strDv;
|
||||
|
||||
/** 연도 */
|
||||
private String srchYear;
|
||||
|
||||
/** 월 */
|
||||
private String srchMnt;
|
||||
|
||||
/** 조회 법인 */
|
||||
private String srchCrp;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.service.BOBsnmService;
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.vo.BOBsnmVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtToken;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* 사업자 관리 Controller
|
||||
* @author rvg
|
||||
* @since 2023-12-19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-19 리브가 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/store/bsnm")
|
||||
public class BOBsnmController {
|
||||
|
||||
@Autowired
|
||||
private BOBsnmService service;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
|
||||
/**
|
||||
* 사업자 목록조회
|
||||
* @param boBsnmVO 파라미터VO
|
||||
* @return ResponseEntity<?> 목록조회 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/selectBOBsnmListInqireForm")
|
||||
public ResponseEntity<?> selectBOBsnmListInqireForm(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
content.put("BOBsnmVO", boBsnmVO);
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 목록조회
|
||||
* @param boBsnmVO 파라미터VO
|
||||
* @return ResponseEntity<?> 목록조회 결과
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/selectBOBsnmListInqire")
|
||||
public ResponseEntity<?> selectBOBsnmListInqire(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//페이징 처리를 위한 pagination 객체 생성
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(boBsnmVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(boBsnmVO.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
|
||||
//페이징 처리를 위한 값 설정
|
||||
boBsnmVO.setPaginationInfo(paginationInfo);
|
||||
boBsnmVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
boBsnmVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
boBsnmVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
//사업자 목록조회
|
||||
List<BOBsnmVO> list = service.selectBOBsnmList(boBsnmVO);
|
||||
|
||||
//사업자 목록조회 결과 설정
|
||||
content.put("BOBsnmVO", boBsnmVO);
|
||||
content.put("paginationInfo", boBsnmVO.getPaginationInfo());
|
||||
content.put("list", list);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 등록
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/insertBOBsnmRegist")
|
||||
public ResponseEntity<?> insertBOBsnmRegist(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
boBsnmVO.setRegusr(user.getUserInnb());
|
||||
boBsnmVO.setUpdusr(user.getUserInnb());
|
||||
|
||||
Integer result = service.selectBOBizrnbDplct(boBsnmVO.getBizrnb());
|
||||
if (result > 0) {
|
||||
message.put("result", "dublechk");
|
||||
} else{
|
||||
// 사업자 등록
|
||||
message = service.insertBOBsnm(boBsnmVO);
|
||||
}
|
||||
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 상세 조회
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBsnmDtlInqire")
|
||||
public ResponseEntity<?> selectBOBsnmDtlInqire(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
//사업자 정보 조회
|
||||
List<BOBsnmVO> list = service.selectBOBsnmDtl(boBsnmVO);
|
||||
|
||||
content.put("BOBsnmVO", boBsnmVO);
|
||||
content.put("list", list);
|
||||
|
||||
DataMap map = service.selectGroupCd();
|
||||
List<DataMap> codeList = new ArrayList<>();
|
||||
codeList.add(map);
|
||||
content.put("codeList", codeList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 등록 폼
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBsnmRegistForm")
|
||||
public ResponseEntity<?> selectBOBsnmRegistForm(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> content = new HashMap<>();
|
||||
|
||||
content.put("BOBsnmVO", boBsnmVO);
|
||||
|
||||
DataMap map = service.selectGroupCd();
|
||||
List<DataMap> codeList = new ArrayList<>();
|
||||
codeList.add(map);
|
||||
content.put("codeList", codeList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 사업자 수정
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOBsnmUpdt")
|
||||
public ResponseEntity<?> updateBOBsnmUpdt(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
boBsnmVO.setRegusr(user.getUserInnb());
|
||||
boBsnmVO.setUpdusr(user.getUserInnb());
|
||||
Map<String, Object> message = service.updateBOBsnmUpdt(boBsnmVO);
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 삭제
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/deleteBOBsnmDel")
|
||||
public ResponseEntity<?> deleteBOBsnmDel(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
boBsnmVO.setRegusr(user.getUserInnb());
|
||||
boBsnmVO.setUpdusr(user.getUserInnb());
|
||||
Map<String, Object> message = service.deleteBOBsnm(boBsnmVO);
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자등록번호 중복 조회
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOBizrnbDplctInqire")
|
||||
public ResponseEntity<?> selectBOBizrnbDplctInqire(@RequestBody BOBsnmVO boBsnmVO) {
|
||||
Integer result = service.selectBOBizrnbDplct(boBsnmVO.getBizrnb());
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.controller;
|
||||
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.vo.MaBsnmVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
/**
|
||||
* 사업자 관리 Controller
|
||||
*
|
||||
* @author rvg
|
||||
* @version 1.0
|
||||
* @see <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-19 rvg 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
* @since 2023-12-19
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/store/bsnm")
|
||||
public class MaBsnmController {
|
||||
|
||||
/** WebClient 호출을 위한 wrapper */
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 사업자 목록 화면
|
||||
* @param maBsnmVO
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBsnmListInqireForm")
|
||||
public String selectBsnmListInqireForm(MaBsnmVO maBsnmVO,
|
||||
ModelMap model) {
|
||||
//BO 발송그룹 목록조회 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBsnmListInqireForm", maBsnmVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/bsnm/MaBsnmListInqireRForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 목록 조회
|
||||
* @param maBsnmVO
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBsnmListInqire")
|
||||
public String selectBsnmListInqire(MaBsnmVO maBsnmVO,
|
||||
ModelMap model) {
|
||||
//BO 발송그룹 목록조회 API 호출
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBsnmListInqire", maBsnmVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/bsnm/MaBsnmListInqireR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 등록 화면이동
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBsnmRegistForm")
|
||||
public String selectBsnmRegistForm(MaBsnmVO maBsnmVO, ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBsnmRegistForm", maBsnmVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/bsnm/MaBsnmRegistC";
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자등록번호 중복 조회
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBizrnbDplctInqire")
|
||||
public ResponseEntity<WnbtResponse> selectBizrnbDplctInqire(@RequestBody MaBsnmVO maBsnmVO) {
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBizrnbDplctInqire", maBsnmVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 등록
|
||||
* @param maBsnmVO
|
||||
* @param bindingResult
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/insertBsnmRegist", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> insertBsnmRegist(@Validated MaBsnmVO maBsnmVO, BindingResult bindingResult) {
|
||||
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/insertBOBsnmRegist", maBsnmVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 수정 화면이동
|
||||
* @param maBsnmVO
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBsnmUpdtForm")
|
||||
public String selectBsnmUpdtForm(MaBsnmVO maBsnmVO,
|
||||
ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBsnmDtlInqire", maBsnmVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/store/bsnm/MaBsnmUpdtU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 수정
|
||||
* @param maBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateBsnmUpdt", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> updateBsnmUpdt(@Validated MaBsnmVO maBsnmVO, BindingResult bindingResult) {
|
||||
|
||||
if(bindingResult.hasErrors()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convert(bindingResult, gconeMessageSource));
|
||||
}
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/updateBOBsnmUpdt", maBsnmVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 삭제
|
||||
* @param maBsnmVO
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/deleteBsnmDel", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> deleteBsnmDel(MaBsnmVO maBsnmVO) {
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/deleteBOBsnmDel", maBsnmVO),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 상세 조회 팝업
|
||||
* @param maBsnmVO
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectBsnmInqirePopup")
|
||||
public String selectBsnmInqirePopup(MaBsnmVO maBsnmVO,
|
||||
ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/bsnm/selectBOBsnmDtlInqire", maBsnmVO),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/store/bsnm/MaBsnmInqirePopupR";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.mapper;
|
||||
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.vo.BOBsnmVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Bsnm Mapper Class
|
||||
* @author rvg
|
||||
* @since 2023-12-11
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-19 리브가 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface BOBsnmMapper {
|
||||
|
||||
/**
|
||||
* 사업자 건수
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
public Integer selectBOBsnmListCnt(BOBsnmVO boBsnmVO);
|
||||
|
||||
/**
|
||||
* 사업자 목록
|
||||
*
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
public List<BOBsnmVO> selectBOBsnmList(BOBsnmVO boBsnmVO);
|
||||
|
||||
/**
|
||||
* 사업자 등록
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
public void insertBOBsnm(BOBsnmVO boBsnmVO);
|
||||
|
||||
/**
|
||||
* 사업자 정보 상세 조회
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
public List<BOBsnmVO> selectBOBsnmDtl(BOBsnmVO boBsnmVO);
|
||||
|
||||
/**
|
||||
* 사업자 정보 수정
|
||||
* @param boBsnmVO
|
||||
* @return
|
||||
*/
|
||||
public void updateBOBsnmUpdt(BOBsnmVO boBsnmVO);
|
||||
|
||||
/**
|
||||
* 사업자 정보 삭제
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public void deleteBOBsnm(String bsnmInnb);
|
||||
|
||||
/**
|
||||
* 사업자 등록번호 중복 확인
|
||||
* @param bizrnb
|
||||
* @return
|
||||
*/
|
||||
public Integer selectBOBizrnbDplct(String bizrnb);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.mapper.BOBsnmMapper;
|
||||
import com.wb.domainserver.domain.admin.store.bsnm.vo.BOBsnmVO;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.mapper.BOMaComncdMapper;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 사업자 관리 service
|
||||
*
|
||||
* @author rvg
|
||||
* @since 2023-12-19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-12-19 리브가 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BOBsnmService {
|
||||
|
||||
@Autowired
|
||||
private BOBsnmMapper mapper;
|
||||
@Autowired
|
||||
private BOMaComncdMapper codeMapper;
|
||||
|
||||
/**
|
||||
* 사업자 건수 및 목록조회
|
||||
* @param boBsnmVO
|
||||
* @return list
|
||||
*/
|
||||
public List<BOBsnmVO> selectBOBsnmList(BOBsnmVO boBsnmVO) {
|
||||
List<BOBsnmVO> bsnmList = null;
|
||||
//사업자 건수 조회
|
||||
boBsnmVO.getPaginationInfo().setTotalRecordCount(mapper.selectBOBsnmListCnt(boBsnmVO));
|
||||
if(boBsnmVO.getPaginationInfo().getTotalRecordCount() > 0) {
|
||||
//사업자 건수가 0일 경우 사업자 목록조회를 실시하지 않음
|
||||
//사업자 목록조회
|
||||
bsnmList = mapper.selectBOBsnmList(boBsnmVO);
|
||||
}
|
||||
return bsnmList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 등록
|
||||
* @param boBsnmVO
|
||||
* @return message 등록 결과
|
||||
*/
|
||||
public Map<String, Object> insertBOBsnm(BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
try {
|
||||
mapper.insertBOBsnm(boBsnmVO);
|
||||
message.put("getBsnmInnb", boBsnmVO.getBsnmInnb());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
message.put("result", e.getMessage());
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 정보 상세 조회
|
||||
* @param boBsnmVO 파라미터VO
|
||||
* @return list
|
||||
*/
|
||||
public List<BOBsnmVO> selectBOBsnmDtl(BOBsnmVO boBsnmVO) {
|
||||
List<BOBsnmVO> list = mapper.selectBOBsnmDtl(boBsnmVO);
|
||||
|
||||
for (BOBsnmVO item : list) {
|
||||
String userEmail = item.getEmail();
|
||||
|
||||
if (userEmail != null && userEmail.contains("@")) {
|
||||
// @ 기준으로 아이디와 도메인 분리
|
||||
String[] emailParts = userEmail.split("@");
|
||||
item.setEmail1(emailParts[0]);
|
||||
item.setEmail2(emailParts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 정보 수정
|
||||
* @param boBsnmVO 파라미터VO
|
||||
* @return message 수정 결과
|
||||
*/
|
||||
public Map<String, Object> updateBOBsnmUpdt(BOBsnmVO boBsnmVO) {
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
try {
|
||||
mapper.updateBOBsnmUpdt(boBsnmVO);
|
||||
message.put("getBsnmInnb", boBsnmVO.getBsnmInnb());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
message.put("result", e.getMessage());
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자 정보 삭제
|
||||
* @param boBsnmVO
|
||||
* @return message 삭제 결과
|
||||
*/
|
||||
public Map<String, Object> deleteBOBsnm(BOBsnmVO boBsnmVO) {
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
|
||||
try {
|
||||
mapper.deleteBOBsnm(boBsnmVO.getBsnmInnb());
|
||||
message.put("getBsnmInnb", boBsnmVO.getBsnmInnb());
|
||||
message.put("result", "success");
|
||||
} catch (Exception e) {
|
||||
message.put("result", e.getMessage());
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사업자등록번호 중복 조회
|
||||
* @param bizrnb
|
||||
* @return
|
||||
*/
|
||||
public Integer selectBOBizrnbDplct(String bizrnb) {
|
||||
|
||||
return mapper.selectBOBizrnbDplct(bizrnb);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드
|
||||
* @return
|
||||
*/
|
||||
public DataMap selectGroupCd() {
|
||||
DataMap map = new DataMap();
|
||||
BOMaComncdVO paramVO = new BOMaComncdVO();
|
||||
|
||||
//이메일
|
||||
paramVO.setGroupCd("EMAIL_ADRES");
|
||||
List<DataMap> EMAIL_ADRES = codeMapper.selectBOCommcdDetailList(paramVO);
|
||||
map.put("EMAIL_ADRES", EMAIL_ADRES);
|
||||
System.out.println("EMAIL_ADRES = " + EMAIL_ADRES);
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.vo;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class BOBsnmVO extends AbstractVO {
|
||||
|
||||
/** 사업자 고유번호 */
|
||||
private String bsnmInnb;
|
||||
|
||||
/** 사업자명 */
|
||||
private String bsnmNm;
|
||||
|
||||
/** 업태내용 */
|
||||
private String bizcndCn;
|
||||
|
||||
/** 종목내용 */
|
||||
private String itemCn;
|
||||
|
||||
/** 사업자등록번호 */
|
||||
private String bizrnb;
|
||||
|
||||
/** 통신판매업신고번호 */
|
||||
private String mobDclNb;
|
||||
|
||||
/** 대표자명 */
|
||||
private String reprsntvnm;
|
||||
|
||||
/** 개인정보보호책임자명 */
|
||||
private String indvdlinfoPrtcRspnberNm;
|
||||
|
||||
/** 전화번호 */
|
||||
private String telnb;
|
||||
|
||||
/** 팩스번호 */
|
||||
private String fxnb;
|
||||
|
||||
/** 이메일 */
|
||||
private String email;
|
||||
/** 이메일 ID */
|
||||
private String email1;
|
||||
/** 이메일 도메인 */
|
||||
private String email2;
|
||||
|
||||
/** 영업신고번호 */
|
||||
private String bsnDclNb;
|
||||
|
||||
/** 우편번호 */
|
||||
private String zip;
|
||||
|
||||
/** 지번주소 */
|
||||
private String lnbAdres;
|
||||
|
||||
/** 도로명주소 */
|
||||
private String rnmAdres;
|
||||
|
||||
/** 상세주소 */
|
||||
private String dtlAdres;
|
||||
|
||||
/** 검색 타입 */
|
||||
private String srchType;
|
||||
/** 검색어 */
|
||||
private String srchStr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.wb.domainserver.domain.admin.store.bsnm.vo;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MaBsnmVO extends AbstractVO {
|
||||
|
||||
/** 사업자 고유번호 */
|
||||
private String bsnmInnb;
|
||||
|
||||
/** 사업자명 */
|
||||
@NotBlank(message = "사업자명")
|
||||
private String bsnmNm;
|
||||
|
||||
/** 업태내용 */
|
||||
private String bizcndCn;
|
||||
|
||||
/** 종목내용 */
|
||||
private String itemCn;
|
||||
|
||||
/** 사업자등록번호 */
|
||||
@NotBlank(message = "사업자등록번호")
|
||||
private String bizrnb;
|
||||
|
||||
/** 통신판매업신고번호 */
|
||||
@NotBlank(message = "통신판매업 신고번호")
|
||||
private String mobDclNb;
|
||||
|
||||
/** 대표자명 */
|
||||
@NotBlank(message = "대표자명")
|
||||
private String reprsntvnm;
|
||||
|
||||
/** 개인정보보호책임자명 */
|
||||
@NotBlank(message = "개인정보 보호책임자명")
|
||||
private String indvdlinfoPrtcRspnberNm;
|
||||
|
||||
/** 전화번호 */
|
||||
@NotBlank(message = "전화번호")
|
||||
private String telnb;
|
||||
|
||||
/** 팩스번호 */
|
||||
private String fxnb;
|
||||
|
||||
/** 이메일 */
|
||||
@NotBlank(message = "이메일")
|
||||
private String email;
|
||||
private String email1;
|
||||
private String email2;
|
||||
|
||||
/** 영업신고번호 */
|
||||
private String bsnDclNb;
|
||||
|
||||
/** 우편번호 */
|
||||
@NotBlank(message = "사업장 주소")
|
||||
private String zip;
|
||||
|
||||
/** 지번주소 */
|
||||
private String lnbAdres;
|
||||
|
||||
/** 도로명주소 */
|
||||
private String rnmAdres;
|
||||
|
||||
/** 상세주소 */
|
||||
private String dtlAdres;
|
||||
|
||||
/** 검색 타입 */
|
||||
private String srchType;
|
||||
/** 검색어 */
|
||||
private String srchStr;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.wb.domainserver.domain.admin.store.extlink.controller;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.store.extlink.service.BOMaExtlinkService;
|
||||
import com.wb.domainserver.domain.admin.store.extlink.vo.BOMaExtlinkVO;
|
||||
import com.wb.domainserver.response.ApiResponse;
|
||||
import com.wb.domainserver.security.authentication.AnonymousUser;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtContextHolder;
|
||||
import com.wb.domainserver.security.authentication.MemberJwtToken;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/store/extlink")
|
||||
@Slf4j
|
||||
public class BOMaExtlinkController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private BOMaExtlinkService service;
|
||||
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
|
||||
|
||||
/**
|
||||
* 외부연동 목록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@PostMapping( "/selectBOExtlinkListForm")
|
||||
public ResponseEntity<?> selectBOExtlinkListForm(@RequestBody BOMaExtlinkVO vo) {
|
||||
DataMap content = new DataMap();
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
List<DataMap> extLinkSystemList = new ArrayList<>();
|
||||
extLinkSystemList = service.selectBOextlinkSystemList();
|
||||
|
||||
content.put("paramVO", vo);
|
||||
content.put("extlinkSystemList", extLinkSystemList);
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOExtlinkList")
|
||||
public ResponseEntity<?> selectBOExtlinkList(@RequestBody BOMaExtlinkVO vo) {
|
||||
|
||||
DataMap content = new DataMap();
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
content.put("paramVO", vo);
|
||||
|
||||
List<DataMap> extLinkList = new ArrayList<>();
|
||||
extLinkList = service.selectBOextlinkList(vo);
|
||||
content.put("resultList", extLinkList);
|
||||
|
||||
content.put("paginationInfo", vo.getPaginationInfo());
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 등록화면
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOExtLinkRegistForm")
|
||||
public ResponseEntity<?> selectBOExtLinkRegistForm(@RequestBody BOMaExtlinkVO vo) {
|
||||
DataMap content = new DataMap();
|
||||
List<DataMap> extLinkSystemList = new ArrayList<>();
|
||||
extLinkSystemList = service.selectBOextlinkSystemList();
|
||||
content.put("extLinkSystemList", extLinkSystemList);
|
||||
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("srchExtrlNm", vo.getSrchExtrlNm());
|
||||
srchData.put("srchExtrlSystem", vo.getSrchExtrlSystem());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
content.put("srchData", srchData);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 등록
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/insertBOExtLinkRegist")
|
||||
public ResponseEntity<?> insertBOExtLinkRegist(@RequestBody BOMaExtlinkVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
|
||||
DataMap result = new DataMap();
|
||||
result = service.insertBOExtLinkRegist(vo);
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 수정 화면
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOExtLinkUpdtForm")
|
||||
public ResponseEntity<?> selectBOExtLinkUpdtForm(@RequestBody BOMaExtlinkVO vo) {
|
||||
|
||||
DataMap content = new DataMap();
|
||||
|
||||
DataMap srchData = new DataMap();
|
||||
srchData.put("srchExtrlNm", vo.getSrchExtrlNm());
|
||||
srchData.put("srchExtrlSystem", vo.getSrchExtrlSystem());
|
||||
srchData.put("pageUnit", vo.getPageUnit());
|
||||
srchData.put("pageIndex", vo.getPageIndex());
|
||||
content.put("srchData", srchData);
|
||||
|
||||
List<DataMap> extLinkSystemList = new ArrayList<>();
|
||||
extLinkSystemList = service.selectBOextlinkSystemList();
|
||||
content.put("extLinkSystemList", extLinkSystemList);
|
||||
|
||||
DataMap extlinkInfo = new DataMap();
|
||||
extlinkInfo = service.selectBOExtLinkUpdtForm(String.valueOf(vo.getExtrlInnb()));
|
||||
content.put("extLink", extlinkInfo);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 수정
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/updateBOExtLinkUpdt")
|
||||
public ResponseEntity<?> updateBOExtLinkUpdt(@RequestBody BOMaExtlinkVO vo) {
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
DataMap result = new DataMap();
|
||||
result = service.updateBOExtLinkUpdt(vo);
|
||||
return ApiResponse.of(result).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 조회 엑셀 다운
|
||||
* @param vo
|
||||
* @return ResponseEntity<?>
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/selectBOexcelFileDownload")
|
||||
public ResponseEntity<?> selectBOexcelFileDownload(@RequestBody BOMaExtlinkVO vo) {
|
||||
DataMap content = new DataMap();
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(vo.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(vo.getPageUnit());
|
||||
paginationInfo.setPageSize(paginationProperties.getPageSize());
|
||||
vo.setPaginationInfo(paginationInfo);
|
||||
vo.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
vo.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
vo.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
List<DataMap> excelList = new ArrayList<>();
|
||||
excelList = service.selectBOexcelFileDownload(vo);
|
||||
content.put("excelList", excelList);
|
||||
|
||||
return ApiResponse.of(content).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 삭제
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/deleteBOExtLinkDel")
|
||||
public ResponseEntity<String> deleteBOExtLinkDel(@RequestBody BOMaExtlinkVO vo) {
|
||||
//사용자 정보 추출 및 적용
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setRegusr(user.getUserInnb());
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
Map<String, Object> message = service.deleteBOExtLinkDel(vo);
|
||||
return ApiResponse.of(message).ifPresentOrElse(HttpStatus.OK, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
package com.wb.domainserver.domain.admin.store.extlink.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.common.msg.GconeMessageSource;
|
||||
import com.wb.domainserver.domain.admin.store.extlink.vo.MaExtlinkVO;
|
||||
import com.wb.domainserver.domain.admin.store.mbrgrad.vo.MaMbrgradVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtResponseBody;
|
||||
import com.wb.domainserver.response.WnbtWebClientResponseHandler;
|
||||
import com.wb.domainserver.util.communicate.*;
|
||||
import com.wb.domainserver.util.excel.ExcelDownloadUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/admin/store/extlink")
|
||||
public class MaExtlinkController {
|
||||
|
||||
@Autowired
|
||||
private WnbtWebClientResponseHandler responseHandler;
|
||||
|
||||
@Autowired
|
||||
private SendToResrc sendToResrc;
|
||||
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
|
||||
/**
|
||||
* 외부연동 목록 폼
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectExtLinkListForm")
|
||||
public String selectExtLinkListForm(MaExtlinkVO vo, ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/selectBOExtlinkListForm", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/extlink/maExtLinkListForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 목록 조회
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectExtLinkListInqire")
|
||||
public String selectExtLinkListInqire(MaExtlinkVO vo, ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/selectBOExtlinkList", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/extlink/maExtLinkListR";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 등록 화면이동
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectExtLinkRegistForm")
|
||||
public String selectExtLinkRegistForm(MaExtlinkVO vo, ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/selectBOExtLinkRegistForm", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
return "admin/store/extlink/maExtLinkC";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 등록
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/insertExtLinkRegist")
|
||||
public ResponseEntity<WnbtResponse> insertExtLinkRegist(MaExtlinkVO vo) {
|
||||
List<Map<String, String>> errorList = new ArrayList<>();
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlNm())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlNm", "외부연동 명은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlClientId())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlClientId", "Client ID은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlClientSecret())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlCientSecret", "Cleint Secret은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if(errorList != null && !errorList.isEmpty()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convertCustomValidate(errorList));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/insertBOExtLinkRegist", vo),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 수정 화면이동
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping("/selectExtLinkUpdtForm")
|
||||
public String selectExtLinkUpdtForm(MaExtlinkVO vo, ModelMap model) {
|
||||
responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/selectBOExtLinkUpdtForm", vo),
|
||||
model,
|
||||
"resultMap"
|
||||
);
|
||||
|
||||
return "admin/store/extlink/maExtLinkU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 수정
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@PostMapping("/updateExtLinkUpdt")
|
||||
public ResponseEntity<WnbtResponse> updateExtLinkUpdt(MaExtlinkVO vo) {
|
||||
List<Map<String, String>> errorList = new ArrayList<>();
|
||||
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlNm())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlNm", "외부연동 명은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlClientId())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlClientId", "Client ID은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if (ObjectUtils.isEmpty(vo.getExtrlClientSecret())) {
|
||||
errorList.add(ValidateResultConverter.setErrorMap("extrlCientSecret", "Cleint Secret은(는) 필수 입력값입니다."));
|
||||
}
|
||||
if(errorList != null && !errorList.isEmpty()) {
|
||||
throw new WnbtRestException(ValidateResultConverter.convertCustomValidate(errorList));
|
||||
}
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/updateBOExtLinkUpdt", vo),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 엑셀 다운로드
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/excelFileDownload")
|
||||
public void excelFileDownload(MaMbrgradVO vo, HttpServletResponse response, ModelMap model) {
|
||||
|
||||
Map<String,Object> resultMap = responseHandler.handleResponseAsMap(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/selectBOexcelFileDownload",vo)
|
||||
);
|
||||
|
||||
List<Map<String, Object>> excelList = new ArrayList<>();
|
||||
excelList = (List<Map<String, Object>>) resultMap.get("excelList");
|
||||
//엑셀 항목에 출력될 내용 설정
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < excelList.size(); i++ ) {
|
||||
HashMap<String, Object> dataMap = new HashMap<>();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map = (HashMap<String, Object>) excelList.get(i);
|
||||
|
||||
dataMap.put("itme01", excelList.size() - i);
|
||||
dataMap.put("itme02", map.get("extrlNm"));
|
||||
dataMap.put("itme03", map.get("extrlSystemNm"));
|
||||
if("Y".equals(map.get("extrlFunctionLogin"))){
|
||||
dataMap.put("itme04", "O");
|
||||
} else {
|
||||
dataMap.put("itme04", "X");
|
||||
}
|
||||
if("Y".equals(map.get("extrlFunctionBuy"))){
|
||||
dataMap.put("itme05", "O");
|
||||
} else {
|
||||
dataMap.put("itme05", "X");
|
||||
}
|
||||
dataMap.put("itme06", map.get("registDt"));
|
||||
dataList.add(dataMap);
|
||||
}
|
||||
|
||||
//엑셀 항목별 제목에 출력될 내용 설정
|
||||
LinkedHashMap<String, String> headerMap = new LinkedHashMap<String, String>();
|
||||
headerMap.put("itme01", "번호");
|
||||
headerMap.put("itme02", "외부연동명");
|
||||
headerMap.put("itme03", "외부연동시스템");
|
||||
headerMap.put("itme04", "가입 및 로그인");
|
||||
headerMap.put("itme05", "구매");
|
||||
headerMap.put("itme06", "등록일자");
|
||||
|
||||
try {
|
||||
//엑셀생성 및 다운로드
|
||||
ExcelDownloadUtil.createExcel("extrlList_excel_file", headerMap, dataList, response);
|
||||
} catch(IOException ioe) {
|
||||
log.error("엑셀다운로드 중 오류가 발생하였습니다.", ioe);
|
||||
throw new WnbtRestException("엑셀다운로드 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 외부연동 삭제
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/deleteExtLinkDel", method = RequestMethod.POST)
|
||||
public ResponseEntity<WnbtResponse> deleteExtLinkDel(MaExtlinkVO vo, ModelMap model) {
|
||||
|
||||
return responseHandler.handleResponse(
|
||||
sendToResrc.ofPost(RESRC.GCONEBO, "/admin/store/extlink/deleteBOExtLinkDel", vo),
|
||||
ReplyFromResrc::getReply
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user