source 이관
parent
ffd76a2350
commit
1b223ab0cd
@ -0,0 +1,43 @@
|
||||
HELP.md
|
||||
.gradle
|
||||
.idea
|
||||
build/
|
||||
**/.gradle
|
||||
**/.idea
|
||||
**/build
|
||||
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
#Wed Mar 29 10:55:16 KST 2023
|
||||
#Wed May 17 16:48:27 KST 2023
|
||||
gradle.version=7.5.1
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,153 @@
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '2.7.6'
|
||||
id "org.sonarqube" version "2.7"
|
||||
id 'io.spring.dependency-management' version '1.0.14.RELEASE'
|
||||
id 'java'
|
||||
id 'com.ewerk.gradle.plugins.querydsl' version '1.0.10'
|
||||
}
|
||||
|
||||
group = 'com.icom'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = '11'
|
||||
//sourceCompatibility = '1.8'
|
||||
apply plugin: 'war'
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom annotationProcessor
|
||||
}
|
||||
all{
|
||||
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://maven.egovframe.go.kr/maven/" } // egovframe maven 원격 저장소
|
||||
maven {
|
||||
url "https://maven.egovframe.go.kr/maven/"
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//repositories {
|
||||
// mavenCentral()
|
||||
// maven { url "https://maven.egovframe.go.kr/maven/" } // egovframe maven 원격 저장소
|
||||
//}
|
||||
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "2021.0.4")
|
||||
set('log4j2.version', "2.17.1") // log4j 보안 패치
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.egovframe.cloud:module-common:0.1'
|
||||
implementation('org.egovframe.rte:org.egovframe.rte.fdl.cmmn:4.0.0') {
|
||||
exclude group: 'org.egovframe.rte', module: 'org.egovframe.rte.fdl.logging'
|
||||
}
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-validation'
|
||||
|
||||
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-websocket'
|
||||
|
||||
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
implementation 'com.google.code.gson:gson:2.9.1'
|
||||
implementation 'com.googlecode.log4jdbc:log4jdbc:1.2'
|
||||
// https://mvnrepository.com/artifact/com.google.guava/guava
|
||||
implementation 'com.google.guava:guava:20.0'
|
||||
implementation 'org.json:json:20210307'
|
||||
implementation 'org.modelmapper:modelmapper:2.4.4'
|
||||
|
||||
implementation "com.querydsl:querydsl-jpa:5.0.0"
|
||||
implementation 'com.querydsl:querydsl-apt:5.0.0'
|
||||
implementation 'com.querydsl:querydsl-core:5.0.0'
|
||||
implementation 'com.querydsl:querydsl-sql:5.0.0'
|
||||
implementation 'com.querydsl:querydsl-sql-spring:5.0.0'
|
||||
implementation 'com.querydsl:querydsl-sql-codegen:5.0.0'
|
||||
|
||||
implementation 'org.apache.tomcat:tomcat-jdbc:10.1.1'
|
||||
implementation 'javax.servlet:javax.servlet-api'
|
||||
implementation 'com.fasterxml.jackson.core:jackson-databind'
|
||||
|
||||
implementation 'org.apache.poi:poi:5.2.2'
|
||||
implementation 'org.apache.poi:poi-ooxml:5.2.2'
|
||||
|
||||
implementation 'software.amazon.awssdk:s3:2.16.1'
|
||||
|
||||
|
||||
//전자정부의존성
|
||||
implementation 'commons-codec:commons-codec:1.15'
|
||||
// implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
|
||||
// implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.4.5'
|
||||
// testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.5'
|
||||
// implementation group: 'org.slf4j', name: 'jcl-over-slf4j', version: '2.0.6'
|
||||
|
||||
|
||||
|
||||
|
||||
//jsp의존성
|
||||
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
|
||||
implementation 'javax.servlet:jstl'
|
||||
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||
testImplementation 'org.springframework.security:spring-security-test'
|
||||
implementation 'net.jodah:expiringmap:0.5.9'
|
||||
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||
|
||||
// runtimeOnly 'com.oracle.database.jdbc:ojdbc8'
|
||||
implementation 'mysql:mysql-connector-java:5.1.49'
|
||||
implementation 'com.oracle.database.jdbc:ojdbc8:21.7.0.0'
|
||||
|
||||
// implementation 'org.mybatis:mybatis:3.5.11'
|
||||
// implementation 'org.mybatis:mybatis-spring:2.0.7'
|
||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
|
||||
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
implementation("com.jayway.jsonpath:json-path:2.5.0")
|
||||
|
||||
implementation files("lib/ASRLIB-2.4.0.2.jar")
|
||||
implementation files("lib/pttsnet_class.jar")
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
|
||||
dependencyManagement {
|
||||
imports {
|
||||
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
|
||||
}
|
||||
}
|
||||
|
||||
// querydsl 추가 시작
|
||||
def querydslDir = "$buildDir/generated/querydsl"
|
||||
//def querydslDir = "src/main/qfile"
|
||||
//def querydslDir = "src/main/java/egovframework/example/jpa/qfile"
|
||||
querydsl {
|
||||
library = 'com.querydsl:querydsl-apt:5.0.0'
|
||||
jpa = true
|
||||
querydslSourcesDir = querydslDir
|
||||
}
|
||||
sourceSets {
|
||||
main.java.srcDir querydslDir
|
||||
}
|
||||
configurations {
|
||||
querydsl.extendsFrom compileClasspath
|
||||
}
|
||||
compileQuerydsl {
|
||||
options.annotationProcessorPath = configurations.querydsl
|
||||
}
|
||||
// querydsl 추가 끝
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
@ -0,0 +1,240 @@
|
||||
#!/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/master/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
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# 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"'
|
||||
|
||||
# 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
|
||||
which java >/dev/null 2>&1 || 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
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
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
|
||||
|
||||
# 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" "$@"
|
@ -0,0 +1,91 @@
|
||||
@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=.
|
||||
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
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
rootProject.name = 'main_vm'
|
@ -0,0 +1,22 @@
|
||||
package com.icomsys.main_vm;
|
||||
|
||||
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.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
@EnableWebMvc
|
||||
public class MainVmApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MainVmApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(MainVmApplication.class);
|
||||
}}
|
@ -0,0 +1,13 @@
|
||||
package com.icomsys.main_vm;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
public class ServletInitializer extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(MainVmApplication.class);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package com.icomsys.main_vm.biz.advice;
|
||||
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNoSuchFieldException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomRuntimeException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.NoSuchMessageException;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@ControllerAdvice
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AdviceHandler {
|
||||
|
||||
private final MessageSource messageSource;
|
||||
|
||||
@ExceptionHandler
|
||||
public String noHandlerFoundHandle(RuntimeException e) {
|
||||
log.error(e.getMessage());
|
||||
return "cmm/error/error";
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomRuntime(CustomRuntimeException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.INTERNAL_SERVER_ERROR.value()));
|
||||
er.setMessage(e.getMessage());
|
||||
log.info("excep - {}", e);
|
||||
return new ResponseEntity(er, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
// @ExceptionHandler
|
||||
// public ResponseEntity DefaultNotFound(NotFoundException e) {
|
||||
// ErrorResult er = new ErrorResult();
|
||||
// er.setCode(String.valueOf(HttpStatus.NOT_FOUND.value()));
|
||||
// er.setMessage(messageSource.getMessage("info.nodata.msg", null, Locale.getDefault()));
|
||||
// log.info("excep - {}", messageSource.getMessage("info.nodata.msg", null, Locale.getDefault()));
|
||||
// return new ResponseEntity(er, HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
|
||||
@ExceptionHandler
|
||||
@ResponseBody
|
||||
public ResponseEntity DefaultNotFound(IllegalArgumentException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.NOT_FOUND.value()));
|
||||
er.setMessage(messageSource.getMessage("info.nodata.msg", null, Locale.getDefault()));
|
||||
log.info("excep - {} {}", messageSource.getMessage("info.nodata.msg", null, Locale.getDefault()),e.getMessage());
|
||||
return new ResponseEntity(er, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomNotFound(CustomNotFoundException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.NOT_FOUND.value()));
|
||||
er.setMessage(e.getMessage());
|
||||
log.info("excep - {}", e.getMessage());
|
||||
return new ResponseEntity(er, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomBadRequest(CustomBadRequestException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.BAD_REQUEST.value()));
|
||||
er.setMessage(e.getMessage());
|
||||
log.info("excep - {}", e.getMessage());
|
||||
return new ResponseEntity(er, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomBadRequest(IllegalAccessException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.BAD_REQUEST.value()));
|
||||
er.setMessage(messageSource.getMessage("fail.common.bad", null, Locale.getDefault()));
|
||||
log.info("excep - {}", messageSource.getMessage("fail.common.bad", null, Locale.getDefault()));
|
||||
return new ResponseEntity(er, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomBindEx(BindException ex) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
log.info("bind 들어옴");
|
||||
String message = null;
|
||||
List<ObjectError> allErrors = ex.getBindingResult().getAllErrors();
|
||||
for (ObjectError error : allErrors) {
|
||||
message = Arrays.stream(Objects.requireNonNull(error.getCodes()))
|
||||
.map(c -> {
|
||||
Object[] arguments = error.getArguments();
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
try {
|
||||
return messageSource.getMessage(c, arguments, locale);
|
||||
} catch (NoSuchMessageException e) {
|
||||
return null;
|
||||
}
|
||||
}).filter(Objects::nonNull)
|
||||
.findFirst()
|
||||
.orElse(error.getDefaultMessage());
|
||||
}
|
||||
log.error("error message: {}", message);
|
||||
er.setMessage(message);
|
||||
er.setCode(String.valueOf(HttpStatus.BAD_REQUEST.value()));
|
||||
return new ResponseEntity(er, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity CustomNoSuchMessage(NoSuchMessageException e) {
|
||||
ErrorResult er = new ErrorResult();
|
||||
er.setCode(String.valueOf(HttpStatus.NOT_FOUND.value()));
|
||||
er.setMessage(e.getMessage());
|
||||
log.info("excep - {}", e.getMessage());
|
||||
return new ResponseEntity(er, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public String CustomNoSuchFieldException(NoSuchFieldException e) {
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public String CustomNoSuchFieldException(CustomNoSuchFieldException e) {
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public String noHandlerFoundHandle(NoHandlerFoundException e) {
|
||||
return "cmm/error/egovError";
|
||||
}
|
||||
|
||||
@ExceptionHandler
|
||||
public ResponseEntity responseStatusException(ResponseStatusException e) {
|
||||
return ResponseEntity.status(e.getStatus()).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.icomsys.main_vm.biz.advice;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ErrorResult {
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
전자정부의 경우 익셉션을 종류별로 잡기가 힘들어
|
||||
스프링부분으로 커스터마이징
|
@ -0,0 +1,9 @@
|
||||
package com.icomsys.main_vm.biz.advice.excep;
|
||||
|
||||
public class CustomBadRequestException extends Exception {
|
||||
public CustomBadRequestException(){super("400Default");}
|
||||
public CustomBadRequestException(String message){super(message);}
|
||||
public CustomBadRequestException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.icomsys.main_vm.biz.advice.excep;
|
||||
|
||||
public class CustomNoSuchFieldException extends Exception{
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.icomsys.main_vm.biz.advice.excep;
|
||||
|
||||
import org.apache.ibatis.javassist.NotFoundException;
|
||||
|
||||
public class CustomNotFoundException extends NotFoundException {
|
||||
public CustomNotFoundException() {
|
||||
super("404Default");
|
||||
}
|
||||
public CustomNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
public CustomNotFoundException(String msg, Exception e) {
|
||||
super(msg, e);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.icomsys.main_vm.biz.advice.excep;
|
||||
|
||||
|
||||
public class CustomRuntimeException extends RuntimeException{
|
||||
|
||||
public CustomRuntimeException(){super("Default");}
|
||||
public CustomRuntimeException(String message){super(message);}
|
||||
public CustomRuntimeException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ExcelService {
|
||||
|
||||
private final HttpServletRequest httpServletRequest;
|
||||
private final HttpServletResponse httpServletResponse;
|
||||
|
||||
public void ExcelDownload(String fileName, List<?> data) throws IOException {
|
||||
List<String> title = new ArrayList<>();
|
||||
for (Field e : data.get(0).getClass().getDeclaredFields()) {
|
||||
title.add(e.getName());
|
||||
}
|
||||
ExcelDownload(fileName, data, title);
|
||||
}
|
||||
public void ExcelDownload(String fileName, List<?> data, List<String> title) throws IOException {
|
||||
Workbook wb = new HSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("data");
|
||||
CreationHelper createHelper = wb.getCreationHelper();
|
||||
Row row = sheet.createRow(0);
|
||||
CellStyle cellStyle1 = wb.createCellStyle();
|
||||
cellStyle1.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
applyCellStyle(cellStyle1);
|
||||
CellStyle cellStyle2 = wb.createCellStyle();
|
||||
cellStyle2.setFillForegroundColor(IndexedColors.WHITE.getIndex());
|
||||
cellStyle2.setWrapText(true);
|
||||
applyCellStyle(cellStyle2);
|
||||
AtomicInteger ai = new AtomicInteger();
|
||||
List<String> keySet = new ArrayList<>();
|
||||
for (String e : title) {
|
||||
Cell c = row.createCell(ai.getAndIncrement());
|
||||
c.setCellValue(e);
|
||||
c.setCellStyle(cellStyle1);
|
||||
}
|
||||
sheet.autoSizeColumn(0);
|
||||
for (Field e : data.get(0).getClass().getDeclaredFields()) {
|
||||
keySet.add(e.getName());
|
||||
}
|
||||
row.setHeight((short) 500);
|
||||
AtomicInteger ai1 = new AtomicInteger();
|
||||
for (Object e : data) {
|
||||
Row row1 = sheet.createRow(ai1.incrementAndGet());
|
||||
AtomicInteger ai2 = new AtomicInteger();
|
||||
JSONObject obj = new JSONObject(e);
|
||||
for (String f : keySet) {
|
||||
int rowNum = ai2.getAndIncrement();
|
||||
if (obj.names().toList().contains(f)) {
|
||||
Cell c = row1.createCell(rowNum);
|
||||
c.setCellValue(createHelper.createRichTextString(obj.get(f).toString()));
|
||||
c.setCellStyle(cellStyle2);
|
||||
} else {
|
||||
Cell c = row1.createCell(rowNum);
|
||||
c.setCellValue(createHelper.createRichTextString(""));
|
||||
c.setCellStyle(cellStyle2);
|
||||
}
|
||||
sheet.autoSizeColumn(rowNum);
|
||||
//sheet.setColumnWidth(rowNum, (sheet.getColumnWidth(rowNum))+1024 );
|
||||
sheet.setColumnWidth(rowNum, Math.min(255 * 100, sheet.getColumnWidth(rowNum) + 1200));
|
||||
row1.setHeight((short) 500);
|
||||
}
|
||||
}
|
||||
try (ServletOutputStream fileOut = httpServletResponse.getOutputStream())/*new FileOutputStream("base.xls"))*/ {
|
||||
wb.write(fileOut);
|
||||
httpServletResponse.setContentType("application/vnd.ms-excel; charset=EUC-KR");
|
||||
httpServletResponse.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xls; charset=EUC-KR");
|
||||
wb.write(httpServletResponse.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyCellStyle(CellStyle cellStyle) {
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
cellStyle.setBorderLeft(BorderStyle.THIN);
|
||||
cellStyle.setBorderTop(BorderStyle.THIN);
|
||||
cellStyle.setBorderRight(BorderStyle.THIN);
|
||||
cellStyle.setBorderBottom(BorderStyle.THIN);
|
||||
}
|
||||
|
||||
//엑셀파일을 List<VO>로 컨버팅해줌
|
||||
public <T> List<T> ExcelUploadConvert(MultipartFile excel, Class<T> base) throws IOException {
|
||||
List<String> baseVarName = new ArrayList<>();
|
||||
List<Object> objs = new ArrayList<>();
|
||||
for (Field e : base.getDeclaredFields()) {
|
||||
baseVarName.add(e.getName());
|
||||
}
|
||||
Workbook wb = new HSSFWorkbook(excel.getInputStream());
|
||||
Sheet sheet = wb.getSheetAt(0);
|
||||
for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
|
||||
int celSize = sheet.getRow(i).getLastCellNum();
|
||||
JSONObject obj = new JSONObject();
|
||||
for (int j = 0; j < celSize; j++) {
|
||||
obj.put(baseVarName.get(j), sheet.getRow(i).getCell(j));
|
||||
}
|
||||
objs.add(obj);
|
||||
}
|
||||
return objs.stream().map(e -> new Gson()
|
||||
.newBuilder()
|
||||
.registerTypeAdapter(LocalDateTime.class, (JsonDeserializer<LocalDateTime>) (json, typeOfT, context)
|
||||
-> LocalDateTime.parse(json.getAsString(), DateTimeFormatter.ISO_LOCAL_DATE_TIME))
|
||||
.registerTypeAdapter(LocalDate.class, (JsonDeserializer<LocalDate>) (json, typeOfT, context)
|
||||
-> LocalDate.parse(json.getAsString(), DateTimeFormatter.ofPattern("yyyy-MM-dd")))
|
||||
.registerTypeAdapter(LocalTime.class, (JsonDeserializer<LocalTime>) (json, typeOfT, context)
|
||||
-> LocalTime.parse(json.getAsString(), DateTimeFormatter.ofPattern("HH:mm:ss")))
|
||||
.create()
|
||||
.fromJson(String.valueOf(e), base))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.*;
|
||||
import java.net.InetAddress;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FileService {
|
||||
@Value("${Server.port}")
|
||||
private String port;
|
||||
@Value("${file.path}")
|
||||
private String filePath;
|
||||
private static String col = ":";
|
||||
private final MessageSource messageSource;
|
||||
private final HttpServletRequest request;
|
||||
|
||||
public List<String> FileSaveService(MultipartFile[] uploadfile) throws IllegalStateException, IOException {
|
||||
List<String> ll = new ArrayList<>();
|
||||
String nn = "";
|
||||
String[] url = request.getRequestURI().split("/");
|
||||
log.info("test14 - {}", new Gson().toJson(url));
|
||||
int size = url.length;
|
||||
log.info("test14 - {}", size);
|
||||
|
||||
for (MultipartFile mf : uploadfile) {
|
||||
if (!mf.isEmpty()) {
|
||||
nn = UUID.randomUUID().toString();
|
||||
File newFileName = new File(nn + "_" + mf.getOriginalFilename());
|
||||
log.info("path - - {}", newFileName.getPath());
|
||||
Path directory = Paths.get(filePath + "/" + url[size - 1]).toAbsolutePath().normalize();
|
||||
// directory 해당 경로까지 디렉토리를 모두 만든다.
|
||||
Files.createDirectories(directory);
|
||||
// 파일명을 바르게 수정한다.
|
||||
String fileName = StringUtils.cleanPath(nn + "_" + mf.getOriginalFilename()).replaceAll(" ", "");
|
||||
// 파일명에 '..' 문자가 들어 있다면 오류를 발생하고 아니라면 진행(해킹및 오류방지)
|
||||
Assert.state(!fileName.contains(".."), "Name of file cannot contain '..'");
|
||||
// 파일을 저장할 경로를 Path 객체로 받는다.
|
||||
Path targetPath = directory.resolve(fileName).normalize();
|
||||
// 파일이 이미 존재하는지 확인하여 존재한다면 오류를 발생하고 없다면 저장한다.
|
||||
Assert.state(!Files.exists(targetPath), fileName + " File alerdy exists.");
|
||||
mf.transferTo(targetPath);
|
||||
// ll.add("http://192.168.0.42:9506/admin/img/"+boardName+"/"+fileName);
|
||||
ll.add(InetAddress.getLocalHost().getHostAddress() + col + port + "/" + url[size - 1] + "/" + fileName);
|
||||
log.info("upload file -{}", new Gson().toJson(ll));
|
||||
}
|
||||
}
|
||||
return ll;
|
||||
}
|
||||
|
||||
public ResponseEntity<Resource> imgGetService(String imgPath) throws IOException {
|
||||
String basepath = filePath;
|
||||
// String basepath = "";
|
||||
Resource recorce = new FileSystemResource(basepath + imgPath);
|
||||
if (!recorce.exists()) {
|
||||
log.info("notfound");
|
||||
return new ResponseEntity<Resource>(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
HttpHeaders header = new HttpHeaders();
|
||||
Path filePath = null;
|
||||
try {
|
||||
filePath = Paths.get(basepath + imgPath);
|
||||
header.add("Content-Type", Files.probeContentType(filePath));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ResponseEntity<Resource>(recorce, header, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
public ResponseEntity<Resource> PdfDownload(String name) throws IOException, CustomNotFoundException {
|
||||
ClassPathResource cpr = new ClassPathResource("/document/"+name);
|
||||
InputStreamResource r = new InputStreamResource(cpr.getInputStream());
|
||||
ContentDisposition cd = ContentDisposition.builder("inline")
|
||||
.filename(name)
|
||||
.name(name)
|
||||
.build();
|
||||
HttpHeaders haHttpHeaders = new HttpHeaders();
|
||||
haHttpHeaders.setContentDisposition(cd);
|
||||
return ResponseEntity.ok()
|
||||
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.contentType(MediaType.valueOf(MediaType.APPLICATION_PDF_VALUE))
|
||||
.cacheControl(CacheControl.noCache())
|
||||
.headers(haHttpHeaders)
|
||||
.body(r);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.common.util.ClientIp;
|
||||
import com.icomsys.main_vm.db.jpa.entity.conversation.TbIcsLog;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbIcsLogRepo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class LogService {
|
||||
|
||||
private final TbIcsLogRepo tbIcsLogRepo;
|
||||
private final LoginService loginService;
|
||||
private final ClientIp clientIp;
|
||||
private final HttpServletRequest request;
|
||||
|
||||
public void LogSave(LogVO lv) {
|
||||
log.info("vo chk - {}", new Gson().toJson(lv));
|
||||
TbIcsLog til = new TbIcsLog();
|
||||
til.setUserId(loginService.getUserVo().getUserId());
|
||||
// til.setUserId("sysadmin");
|
||||
til.setIp(clientIp.getClientIp());
|
||||
til.setActionCode(lv.getActionCode().toLowerCase());
|
||||
til.setMenuAuth(lv.getMenuAuth().getName());
|
||||
til.setRemark(lv.getRemark());
|
||||
til.setServiceGroup(lv.getServiceGroup());
|
||||
til.setAttribute1(lv.getAttribute1());
|
||||
til.setAttribute2(lv.getAttribute2());
|
||||
til.setAttribute3(lv.getAttribute3());
|
||||
til.setAttribute4(lv.getAttribute4());
|
||||
|
||||
if (lv.getRegistDate() == null) {
|
||||
til.setRegistDate(LocalDateTime.now());
|
||||
} else {
|
||||
til.setRegistDate(lv.getRegistDate());
|
||||
}
|
||||
|
||||
tbIcsLogRepo.save(til);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import com.icomsys.main_vm.common.code.enumresource.MenuResource;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class LogVO {
|
||||
|
||||
private LocalDateTime registDate;
|
||||
private String actionCode;
|
||||
private MenuResource menuAuth;
|
||||
private String remark;
|
||||
private String serviceGroup;
|
||||
private String attribute1;
|
||||
private String attribute2;
|
||||
private String attribute3;
|
||||
private String attribute4;
|
||||
|
||||
@Builder
|
||||
public LogVO(LocalDateTime registDate, String actionCode, MenuResource menuAuth, String remark, String serviceGroup, String attribute1, String attribute2, String attribute3, String attribute4) {
|
||||
this.registDate = registDate;
|
||||
this.actionCode = actionCode;
|
||||
this.menuAuth = menuAuth;
|
||||
this.remark = remark;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.attribute1 = attribute1;
|
||||
this.attribute2 = attribute2;
|
||||
this.attribute3 = attribute3;
|
||||
this.attribute4 = attribute4;
|
||||
}
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.test.controller.testvo.APINodeVo;
|
||||
import com.icomsys.main_vm.biz.test.controller.testvo.KeyValueVo;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import com.jayway.jsonpath.spi.json.JsonSmartJsonProvider;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponents;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class RestTemplateService {
|
||||
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
/**
|
||||
* @Name Get Api 호출 공통 모듈
|
||||
* @Description Get Call 공통화 모듈
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
public ResponseEntity<String> GetCall(UriComponents uri, HttpHeaders headers) {
|
||||
return restTemplate
|
||||
.exchange(uri.toUriString(), HttpMethod.GET, new HttpEntity<>(headers), String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name POST Api 호출 공통 모듈
|
||||
* @Description POST Api 호출 공통 모듈
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
public ResponseEntity<String> PostCall(UriComponents uri, HttpHeaders headers) {
|
||||
HttpEntity en = new HttpEntity<>(headers);
|
||||
return restTemplate
|
||||
.postForEntity(uri.toUriString(), en, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name POST Api 호출 공통 모듈
|
||||
* @Description POST Api 호출 공통 모듈
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
public ResponseEntity<String> PostCall(UriComponents uri, HttpHeaders headers, String body) {
|
||||
HttpEntity en = new HttpEntity<>(body, headers);
|
||||
return restTemplate
|
||||
.postForEntity(uri.toUriString(), en, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE
|
||||
* @Description API NODE 의기능 구현
|
||||
* init data로 통신후 response 요청값 리턴
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
public Map APINode(Map apiReqParam, Map serviceParam, String s) throws CustomBadRequestException, NoSuchMethodException {
|
||||
ResponseEntity res = null;
|
||||
APINodeVo vo = new Gson().fromJson(s, APINodeVo.class);
|
||||
HttpHeaders headers = ConvertHttpHeaders(vo.getHeader());
|
||||
UriComponents uriComponents = GetURI(vo.getParam(), apiReqParam, serviceParam, UriComponentsBuilder.newInstance().uri(CreateURI(vo.getURL(), apiReqParam, serviceParam)));
|
||||
if (vo.getUrlType().toUpperCase().equals(RequestMethod.GET.name())) {
|
||||
res = GetCall(uriComponents, headers);
|
||||
} else if (vo.getUrlType().toUpperCase().equals(RequestMethod.POST.name())) {
|
||||
if (vo.getBody() == null || vo.getBody().equals("")) {
|
||||
res = PostCall(uriComponents, headers);
|
||||
} else {
|
||||
String repBody = vo.getBody();
|
||||
log.info("post call using body - {}", repBody);
|
||||
repBody.replaceAll("/r", "");
|
||||
repBody.replaceAll("/n", "");
|
||||
log.info("post call using body - {}", repBody);
|
||||
|
||||
for (Object e : apiReqParam.keySet()) {
|
||||
if (repBody.contains(e.toString())) {
|
||||
repBody.replaceAll("#\\{" + e.toString() + "}", apiReqParam.get(e).toString());
|
||||
repBody.replaceAll("#\\[" + e.toString() + "]", apiReqParam.get(e).toString());
|
||||
}
|
||||
}
|
||||
res = PostCall(uriComponents, headers, repBody);
|
||||
}
|
||||
} else {
|
||||
throw new NoSuchMethodException("MethodType Mismatch");
|
||||
}
|
||||
|
||||
if (res.getStatusCodeValue() != 200) {
|
||||
throw new CustomBadRequestException("Network server error");
|
||||
}
|
||||
//기존 시나리오에 합쳐주는 로직 삭제
|
||||
// return APINodeResultMap(apiReqParam, responseJsonPath(vo.getResponse(), res.getBody()));
|
||||
//새 맵으로 리턴
|
||||
return responseJsonPath(vo.getResponse(), res.getBody());
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE용 메소드
|
||||
* @Description 요청값을 헤더로 컨버팅함.
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
private HttpHeaders ConvertHttpHeaders(List<KeyValueVo> dto) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
for (KeyValueVo e : dto) {
|
||||
headers.setContentType(new MediaType(MediaType.valueOf(e.getValue())));
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE TEST 용 메소드 (사용안함)
|
||||
* @Description 요청값을 URI param으로 컨버팅함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
private Map<String, String> ConvertParam(List<KeyValueVo> dto) {
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
for (KeyValueVo e : dto) {
|
||||
paramMap.put("#{" + e.getValue() + "}", e.getDesc());
|
||||
}
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
private URI CreateURI(String uri, Map apiReqParam, Map serviceParam) {
|
||||
for (Object e : apiReqParam.keySet()) {
|
||||
if (uri.contains(e.toString())) {
|
||||
uri.replaceAll(e.toString(), apiReqParam.get(e).toString());
|
||||
}
|
||||
}
|
||||
for (Object e : serviceParam.keySet()) {
|
||||
if (uri.contains(e.toString())) {
|
||||
uri.replaceAll(e.toString(), serviceParam.get(e).toString());
|
||||
}
|
||||
}
|
||||
return URI.create(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE용 메소드
|
||||
* @Description 요청값을 URI 로 완성시킴
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
private UriComponents GetURI(List<KeyValueVo> dto, Map<String, String> apiReqParam, Map<String, String> serviceParam, UriComponentsBuilder builder) {
|
||||
for (KeyValueVo e : dto) {
|
||||
if (apiReqParam.containsKey(e.getValue())) {
|
||||
builder.queryParam(e.getKey(), apiReqParam.get(e.getValue()));
|
||||
} else {
|
||||
builder.queryParam(e.getKey(), e.getValue());
|
||||
}
|
||||
if (serviceParam.containsKey(e.getValue())) {
|
||||
builder.queryParam(e.getKey(), serviceParam.get(e.getValue()));
|
||||
} else {
|
||||
builder.queryParam(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
log.info("uri - {}", builder.build().toUriString());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE용 메소드
|
||||
* @Description Call 완료값을 갖고 요청값을 찾아 리턴함.
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
private Map responseJsonPath(List<KeyValueVo> dto, Object body) {
|
||||
Map result = new HashMap();
|
||||
for (KeyValueVo e : dto) {
|
||||
String[] key = e.getValue().toString().split("\\.");
|
||||
result.put(key[key.length - 1], (Object) JsonPath.read(new JsonSmartJsonProvider().parse(body.toString()), e.getValue()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name API NODE용 메소드
|
||||
* @Description 결과값을 맵타입으로 컨버팅함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 14.
|
||||
*/
|
||||
private Map APINodeResultMap(Map origin, Map jsonPath) {
|
||||
for (Object e : jsonPath.keySet()) {
|
||||
origin.put(e, jsonPath.get(e));
|
||||
}
|
||||
return origin;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SequenceService {
|
||||
//
|
||||
// private final TbKeyGenerateRepo tbKeyGenerateRepo;
|
||||
//
|
||||
// @Transactional
|
||||
// public Long UserSeqNext(){
|
||||
// return tbKeyGenerateRepo.findById("TB_BOT_USER")
|
||||
// .orElseThrow(() -> new IllegalArgumentException())
|
||||
// .nextSeq();
|
||||
// }
|
||||
//
|
||||
// @Transactional
|
||||
// public Long ServiceAuthGroupSeqNext(){
|
||||
// return tbKeyGenerateRepo.findById("TB_SERVICE_AUTH_GROUP")
|
||||
// .orElseThrow(() -> new IllegalArgumentException())
|
||||
// .nextSeq();
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service.functionnode;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class FunctionVo {
|
||||
|
||||
/**
|
||||
* @Name 펑션노드
|
||||
* @Description 펀션노드 스크립트엔진
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
* varList: functionNode 의 fParam[0], fParam[1] 값을 받는곳
|
||||
* callData: 콜봇이 유지하고있는 데이터
|
||||
* initSctipt: 자바스크립트
|
||||
*/
|
||||
|
||||
private List<String> varList;
|
||||
private HashMap callData;
|
||||
private String initSctipt;
|
||||
private int timeOut;
|
||||
|
||||
@Builder
|
||||
public FunctionVo(List<String> varList, HashMap callData, String initSctipt, int timeOut) {
|
||||
this.varList = varList;
|
||||
this.callData = callData;
|
||||
this.initSctipt = initSctipt;
|
||||
this.timeOut = timeOut;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service.functionnode;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.common.service.functionnode.ex.WsNotAvailableException;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
import javax.script.ScriptException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class FunctionWsNashorn {
|
||||
|
||||
/**
|
||||
* @Name 펑션노드
|
||||
* @Description 펀션노드 스크립트엔진
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
* varList: functionNode 의 fParam[0], fParam[1] 값을 받는곳
|
||||
* callData: 콜봇이 유지하고있는 데이터
|
||||
* initSctipt: 자바스크립트
|
||||
*/
|
||||
|
||||
private List<String> varList;
|
||||
private HashMap callData = new HashMap<>();
|
||||
private String initSctipt;
|
||||
private List<String> reservesWord = Arrays.asList("while", "sleep", "timeout", "interval", "$(");
|
||||
|
||||
public static FunctionWsNashorn builder(int timeMilli) throws ExecutionException, InterruptedException, TimeoutException {
|
||||
int time = 5000;
|
||||
if (timeMilli > 0 && timeMilli < time) time = timeMilli;
|
||||
return Executors.newSingleThreadExecutor().submit(FunctionWsNashorn::new).get(time, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public FunctionWsNashorn create(FunctionVo dto) {
|
||||
if (dto.getInitSctipt().length() < 5) throw new WsNotAvailableException("코드길이가 너무 적습니다.");
|
||||
if (dto.getVarList().size() < 1) throw new WsNotAvailableException("파라미터가 없습니다.");
|
||||
if (dto.getCallData().size() < 1) throw new WsNotAvailableException("콜데이터가 없습니다.");
|
||||
this.varList = dto.getVarList();
|
||||
this.initSctipt = dto.getInitSctipt();
|
||||
this.callData = dto.getCallData();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map build() throws ScriptException {
|
||||
ScriptEngine se = new ScriptEngineManager().getEngineByName("nashorn");
|
||||
for (String e : varList) {
|
||||
if (callData.containsKey(e)) {
|
||||
se.put(e, callData.get(e));
|
||||
} else {
|
||||
se.put(e, "");
|
||||
}
|
||||
}
|
||||
se.eval(this.initSctipt);
|
||||
for (String e : varList) {
|
||||
callData.put(e, se.get(e));
|
||||
}
|
||||
return this.callData;
|
||||
}
|
||||
|
||||
public FunctionWsNashorn noTag() {
|
||||
if (this.initSctipt.matches("<.+?>")) throw new WsNotAvailableException("HTML TAG는 입력 할 수 없습니다.");
|
||||
return this;
|
||||
}
|
||||
|
||||
public FunctionWsNashorn CheckBlackList() {
|
||||
String copy = this.initSctipt;
|
||||
for (String e : reservesWord) {
|
||||
if (copy.toLowerCase().contains(e)) throw new WsNotAvailableException("JAVASCRIPT만 사용해주세요.");
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.icomsys.main_vm.biz.common.common.service.functionnode.ex;
|
||||
|
||||
public class WsNotAvailableException extends RuntimeException{
|
||||
|
||||
|
||||
public WsNotAvailableException() {
|
||||
super("잘못된 코드를 입력했습니다.");
|
||||
}
|
||||
public WsNotAvailableException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.icomsys.main_vm.biz.common.dashboard.controller;
|
||||
|
||||
import com.icomsys.main_vm.biz.rcp.statistics.dashboard.service.StatisticsDashboardService;
|
||||
import com.icomsys.main_vm.db.mybatis.alias.StatisticsDashboardVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/dashboard")
|
||||
@Slf4j
|
||||
public class DashboardController {
|
||||
|
||||
private final StatisticsDashboardService statisticsDashboardService;
|
||||
|
||||
@GetMapping("/manage.do")
|
||||
public String DashboardView(){
|
||||
return "/adm/common/dashboard";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/callinfolist.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public List<HashMap> selectStatCallInfoList(@RequestBody StatisticsDashboardVO vo) {
|
||||
List<HashMap> result = statisticsDashboardService.selectStatCallInfo(vo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/intentlist.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public List<HashMap> selectStatIntentList(@RequestBody StatisticsDashboardVO vo) {
|
||||
List<HashMap> result = statisticsDashboardService.selectStatIntent(vo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/scenariolist.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public List<HashMap> selectStatScenarioList(@RequestBody StatisticsDashboardVO vo) {
|
||||
List<HashMap> result = statisticsDashboardService.selectStatScenario(vo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/callcntlist.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public List<HashMap> selectTodayCallCntList(@RequestBody StatisticsDashboardVO vo) {
|
||||
List<HashMap> result = statisticsDashboardService.selectCallCntByToday(vo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/curcallcnt.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public int selectCurCallCnt(@RequestBody StatisticsDashboardVO vo) {
|
||||
int result = statisticsDashboardService.selectCurCallCnt(vo);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.icomsys.main_vm.biz.common.errorpage.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class ErrorPageController implements ErrorController {
|
||||
|
||||
private final HttpServletRequest httpServletRequest;
|
||||
|
||||
@GetMapping("/error")
|
||||
public String error(){
|
||||
log.info("error page init");
|
||||
Object status = httpServletRequest.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
|
||||
log.info("error status - {}", status.toString());
|
||||
|
||||
if(status.equals("490")){
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
if(status.toString().equals("491")){
|
||||
return "adm/signin/changePwd";
|
||||
}
|
||||
// ModelMap mm = new ModelMap();
|
||||
// ErrorResult er = new ErrorResult();
|
||||
// er.setCode(status.toString());
|
||||
// mm.addAttribute("errorResult", "aaa");
|
||||
// return "adm/common/error";
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,205 @@
|
||||
package com.icomsys.main_vm.biz.common.login.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNoSuchFieldException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.FileService;
|
||||
import com.icomsys.main_vm.biz.common.login.req.LoginReq;
|
||||
import com.icomsys.main_vm.biz.common.login.req.MainOprReq;
|
||||
import com.icomsys.main_vm.biz.common.login.req.PwdUpdateReq;
|
||||
import com.icomsys.main_vm.biz.common.login.res.LoginCheckReq;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.ServiceGroupRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class LoginController {
|
||||
/**
|
||||
* 메인 컨트롤러
|
||||
*/
|
||||
private final LoginService loginService;
|
||||
private final FileService fileService;
|
||||
private final HttpServletRequest httpServletRequest;
|
||||
|
||||
@GetMapping(value = {"/adm/main/egovLoginUsr.do", "/"})
|
||||
public String loginUsrView() {
|
||||
loginService.Logout();
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/adm/main/changePwd")
|
||||
public String changePwd() {
|
||||
return "adm/signin/changePwd";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/adm/main/pwd/update")
|
||||
public ResponseEntity PwdUpdate(@RequestBody PwdUpdateReq dto) throws CustomNotFoundException, CustomBadRequestException {
|
||||
return loginService.PwdUpdate(dto);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/adm/main/check")
|
||||
@ResponseBody
|
||||
public ResponseEntity loginCheck(@RequestBody LoginCheckReq dto) throws CustomNotFoundException, CustomBadRequestException {
|
||||
return loginService.loginCheck(dto);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/adm/main/actionSecurityLogin.do")
|
||||
public String actionSecurityLogin(@Valid LoginReq loginReq, ModelMap model) {
|
||||
return loginService.LoginValidService(loginReq, model);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/adm/main/actionMain.do")
|
||||
public String actionMain(ModelMap model) {
|
||||
return loginService.actionMain(model);
|
||||
}
|
||||
|
||||
@GetMapping("/adm/main/actionLogout.do")
|
||||
public String Logout() {
|
||||
loginService.Logout();
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/adm/menu/getLnbMenu.do")
|
||||
public String selectMainMenuLeft(ModelMap model) {
|
||||
if (loginService.getUserVo() == null) {
|
||||
return "adm/signin/signin";
|
||||
}
|
||||
List<MenuVo> menuVoList = loginService.selectMainMenuLeft();
|
||||
model.addAttribute("list_menulist", menuVoList);
|
||||
return "adm/include/getLnbMenu";
|
||||
}
|
||||
|
||||
@GetMapping("/adm/menu/serviceGroup")
|
||||
public List<ServiceGroupRes> getServiceGroup() throws CustomNoSuchFieldException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
}
|
||||
return loginService.getServiceGroup();
|
||||
}
|
||||
|
||||
@PostMapping("/adm/menu/serviceGroup/update")
|
||||
public void LastUserServiceGroupUpdate(Long userSeq, String updateService) throws CustomNotFoundException, CustomNoSuchFieldException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
}
|
||||
loginService.LastUserServiceGroupUpdate(userSeq, updateService);
|
||||
}
|
||||
|
||||
/**
|
||||
* 멀티서치용 oprMngCode
|
||||
* 내가가지고있는 서비스그룹을보여줌
|
||||
*
|
||||
* @param serviceType
|
||||
* @return
|
||||
* @throws CustomNoSuchFieldException
|
||||
*/
|
||||
@GetMapping("/adm/menu/oprmng")
|
||||
@ResponseBody
|
||||
public List<OprmngCodeRes> getOprmngCode(@RequestParam(name = "serviceType", required = false) String serviceType,
|
||||
@RequestParam(name = "menuval", required = false) String menuval) throws CustomNoSuchFieldException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
}
|
||||
log.info("getOPR INIT");
|
||||
return loginService.getOprmngCode(serviceType, menuval);
|
||||
}
|
||||
|
||||
/**
|
||||
* 어드민용 oprMngCode
|
||||
* 서비스그룹생성용
|
||||
* 해당서비스그룹의 코드를 보여줌
|
||||
*
|
||||
* @param serviceType
|
||||
* @return
|
||||
* @throws CustomNoSuchFieldException
|
||||
*/
|
||||
@GetMapping("/adm/menu/oprmng/admin")
|
||||
@ResponseBody
|
||||
public List<OprmngCodeRes> getOprmngCodeAdmin(@RequestParam(name = "serviceType", required = false) String serviceType) throws CustomNoSuchFieldException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
}
|
||||
log.info("getOPR INIT");
|
||||
return loginService.getOprmngCodeAdmin(serviceType);
|
||||
}
|
||||
|
||||
@GetMapping("/adm/menu/main/oprmng")
|
||||
@ResponseBody
|
||||
public ResponseEntity getMainOprmngCode() throws CustomNoSuchFieldException, NoSuchFieldException {
|
||||
//List<OprmngCodeRes>
|
||||
|
||||
if (httpServletRequest.getSession() == null) {
|
||||
log.info("SESSION NULL");
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
if (loginService.getUserVo() == null) {
|
||||
log.info("getMainOprmngCode NULL");
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
log.info("getOPR INIT");
|
||||
return ResponseEntity.ok(loginService.getMainOprmngCode());
|
||||
}
|
||||
|
||||
@PostMapping("/adm/menu/main/oprmng/update")
|
||||
@ResponseBody
|
||||
public void getMainOprmngCodeUpdate(@RequestBody MainOprReq dto) throws CustomNoSuchFieldException, CustomNotFoundException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
}
|
||||
log.info("getOPR INIT - {}", new Gson().toJson(dto));
|
||||
loginService.getMainOprmngCodeUpdate(dto);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/adm/menu/jstree/policy/parent")
|
||||
@ResponseBody
|
||||
public Map<String, String> jstreeParentConvertToPolicy() {
|
||||
return loginService.jstreeParentConvertToPolicy();
|
||||
}
|
||||
|
||||
@GetMapping("/adm/menu/role")
|
||||
@ResponseBody
|
||||
public String getRole() {
|
||||
return loginService.getUserVo().getRoleVal();
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/adm/main/pdfdownload")
|
||||
@ResponseBody
|
||||
public ResponseEntity<Resource> ResourceDownload(@RequestParam(name = "name") String name) throws IOException, CustomNotFoundException {
|
||||
return fileService.PdfDownload(name);
|
||||
}
|
||||
|
||||
@GetMapping("/adm/main/uv")
|
||||
@ResponseBody
|
||||
public UserVo getUserVo() throws CustomNoSuchFieldException {
|
||||
if (loginService.getUserVo() == null) {
|
||||
throw new CustomNoSuchFieldException();
|
||||
} else {
|
||||
return loginService.getUserVo();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.icomsys.main_vm.biz.common.login.req;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Data
|
||||
public class LoginReq {
|
||||
|
||||
@NotBlank
|
||||
@Size(min = 1, max = 50, message = "아이디는 1글자 이상 50글자 이하여야합니다.")
|
||||
private String userId;
|
||||
|
||||
@NotBlank
|
||||
@Size(min = 1, max = 15, message = "비밀번호는 1글자 이상 15글자 이하여야합니다.")
|
||||
private String password;
|
||||
|
||||
public boolean ofValid(PasswordEncoder passwordEncoder, String dbPass) {
|
||||
return passwordEncoder.matches(this.password, dbPass);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.icomsys.main_vm.biz.common.login.req;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class MainOprReq {
|
||||
|
||||
|
||||
private String serviceGroup;
|
||||
private Long userSeq;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.icomsys.main_vm.biz.common.login.req;
|
||||
|
||||
|
||||
import lombok.*;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class PwdUpdateReq {
|
||||
|
||||
private String id;
|
||||
private String pw0;
|
||||
private String pw1;
|
||||
private String pw2;
|
||||
|
||||
@Builder
|
||||
public PwdUpdateReq(String id, String pw0, String pw1, String pw2) {
|
||||
this.id = id;
|
||||
this.pw0 = pw0;
|
||||
this.pw1 = pw1;
|
||||
this.pw2 = pw2;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class LoginCheckReq {
|
||||
|
||||
private String userId;
|
||||
private String password;
|
||||
|
||||
@Builder
|
||||
public LoginCheckReq(String userId, String password) {
|
||||
this.userId = userId;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class OprmngCodeRes {
|
||||
|
||||
private String custCode;
|
||||
private String serviceGroup;
|
||||
private String serviceGroupName;
|
||||
private String serviceGroupUpper;
|
||||
|
||||
@Builder
|
||||
public OprmngCodeRes(String custCode, String serviceGroup, String serviceGroupName, String serviceGroupUpper) {
|
||||
this.custCode = custCode;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.serviceGroupUpper = serviceGroupUpper;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SelectMainMenuHeadVo {
|
||||
|
||||
private String treeItem;
|
||||
private int level;
|
||||
private int nextLevel;
|
||||
private int menuNo;
|
||||
private String menuName;
|
||||
private int upperMenuNo;
|
||||
private String menuDesc;
|
||||
private String urlPath;
|
||||
|
||||
@Builder
|
||||
public SelectMainMenuHeadVo(String treeItem, int level, int nextLevel, int menuNo, String menuName, int upperMenuNo, String menuDesc, String urlPath) {
|
||||
this.treeItem = treeItem;
|
||||
this.level = level;
|
||||
this.nextLevel = nextLevel;
|
||||
this.menuNo = menuNo;
|
||||
this.menuName = menuName;
|
||||
this.upperMenuNo = upperMenuNo;
|
||||
this.menuDesc = menuDesc;
|
||||
this.urlPath = urlPath;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ServiceGroupRes {
|
||||
private String serviceGroup;
|
||||
private String serviceGroupUpper;
|
||||
private String custCode;
|
||||
private String serviceType;
|
||||
private String serviceGroupName;
|
||||
private String serviceGroupDesc;
|
||||
private String useYn;
|
||||
private String registId;
|
||||
private LocalDateTime registDate;
|
||||
private String updateId;
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@Builder
|
||||
public ServiceGroupRes(String serviceGroup, String serviceGroupUpper, String custCode, String serviceType, String serviceGroupName, String serviceGroupDesc, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) {
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceGroupUpper = serviceGroupUpper;
|
||||
this.custCode = custCode;
|
||||
this.serviceType = serviceType;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.serviceGroupDesc = serviceGroupDesc;
|
||||
this.useYn = useYn;
|
||||
this.registId = registId;
|
||||
this.registDate = registDate;
|
||||
this.updateId = updateId;
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public ServiceGroupRes toServiceGrouopRes(TbServiceGrouop dto) {
|
||||
this.serviceGroup = dto.getServiceGroup();
|
||||
this.serviceGroupUpper = dto.getServiceGroupUpper();
|
||||
this.custCode = dto.getCustCode();
|
||||
this.serviceType = dto.getServiceType();
|
||||
this.serviceGroupName = dto.getServiceGroupName();
|
||||
this.serviceGroupDesc = dto.getServiceGroupDesc();
|
||||
this.useYn = dto.getUseYn();
|
||||
this.registId = dto.getRegistId();
|
||||
this.registDate = dto.getRegistDate();
|
||||
this.updateId = dto.getUpdateId();
|
||||
this.updateDate = dto.getUpdateDate();
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserPolicyListRes {
|
||||
|
||||
private Long userSeq;
|
||||
private String policyVal;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.icomsys.main_vm.biz.common.login.res;
|
||||
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class UserVo {
|
||||
|
||||
private Long userSeq;
|
||||
private String custCode;
|
||||
private String lastUseServiceGroup;
|
||||
private String roleVal;
|
||||
private String userId;
|
||||
// private String password;
|
||||
private String userName;
|
||||
private String eMail;
|
||||
private String mobileNo;
|
||||
private int loginCheck;
|
||||
private String useYn;
|
||||
private String registId;
|
||||
private LocalDateTime registDate;
|
||||
private String updateId;
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@Builder
|
||||
public UserVo(Long userSeq, String custCode, String lastUseServiceGroup, String roleVal, String userId, String userName, String eMail, String mobileNo, int loginCheck, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) {
|
||||
this.userSeq = userSeq;
|
||||
this.custCode = custCode;
|
||||
this.lastUseServiceGroup = lastUseServiceGroup;
|
||||
this.roleVal = roleVal;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.eMail = eMail;
|
||||
this.mobileNo = mobileNo;
|
||||
this.loginCheck = loginCheck;
|
||||
this.useYn = useYn;
|
||||
this.registId = registId;
|
||||
this.registDate = registDate;
|
||||
this.updateId = updateId;
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.icomsys.main_vm.biz.common.login.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbBotUserRepo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class CustomUserDetailsService implements UserDetailsService {
|
||||
|
||||
private final TbBotUserRepo tbBotUserRepo;
|
||||
|
||||
//솔루션이 다르고 아이디가 같은경우 서비스 로직에서 솔루션 구별후 로그인 시행
|
||||
//기본적으로 솔루션 상관없이 아이디 안겹치게해주는게 좋을듯.
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
UserDetails a = tbBotUserRepo.findByUserIdAndUseYn(username, "Y")
|
||||
.map(this::createUserDetail)
|
||||
.orElseThrow(() -> new UsernameNotFoundException(username + " -> 데이터베이스에서 찾을 수 없습니다."));
|
||||
return a;
|
||||
}
|
||||
|
||||
//시큐리티에 올려놓고 검사하는경우. 동적처리가 안되서 제외시켜야할듯.
|
||||
//권한 수정시 즉시반영이 SOE 시나몬 솔루션 정책이라고함.
|
||||
//로그인 용도로만 사용해야할듯.
|
||||
//나중엔 정책으로 변경.
|
||||
private UserDetails createUserDetail(TbBotUser dto) {
|
||||
//시스템 전체관리자인경우 권한이 여러개일수 있어 리스트로 구현
|
||||
List<String> authList = new ArrayList<>();
|
||||
authList.add(dto.getRoleVal());
|
||||
log.info("authList - {}", new Gson().toJson(authList));
|
||||
List<SimpleGrantedAuthority> permission = authList.stream()
|
||||
.map(SimpleGrantedAuthority::new)
|
||||
.collect(Collectors.toList());
|
||||
return new User(String.valueOf(dto.getUserId()), dto.getPassword(), permission)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,406 @@
|
||||
package com.icomsys.main_vm.biz.common.login.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.LogService;
|
||||
import com.icomsys.main_vm.biz.common.common.service.LogVO;
|
||||
import com.icomsys.main_vm.biz.common.login.req.LoginReq;
|
||||
import com.icomsys.main_vm.biz.common.login.req.MainOprReq;
|
||||
import com.icomsys.main_vm.biz.common.login.req.PwdUpdateReq;
|
||||
import com.icomsys.main_vm.biz.common.login.res.LoginCheckReq;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.ServiceGroupRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.common.code.EnumToMap;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.common.code.enumresource.*;
|
||||
import com.icomsys.main_vm.common.util.ClientIp;
|
||||
import com.icomsys.main_vm.db.jpa.entity.conversation.TbIcsLog;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.*;
|
||||
import com.icomsys.main_vm.db.mybatis.alias.LoginVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
/**
|
||||
* LoginVo는 천천히 거둬낼것
|
||||
* UserVo로 변환
|
||||
*/
|
||||
public class LoginService {
|
||||
|
||||
private final AuthenticationManagerBuilder authenticationManagerBuilder;
|
||||
private final AuthenticationManager authenticationManager;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final HttpServletRequest httpServletRequest;
|
||||
private final HttpServletResponse httpServletResponse;
|
||||
private final MessageSource messageSource;
|
||||
private final TbBotUserRepo tbBotUserRepo;
|
||||
private final TbUserAuthGroupRepo tbUserAuthGroupRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final TbUserCustRepo tbUserCustRepo;
|
||||
// private final LogService logService;
|
||||
|
||||
private final TbIcsLogRepo tbIcsLogRepo;
|
||||
|
||||
private final ClientIp clientIp;
|
||||
|
||||
//LoginVo의 경우 Egov 레거시매퍼의존성이 잡혀있어. req에 분리 불가능
|
||||
@Transactional
|
||||
public String LoginValidService(LoginReq dto, ModelMap model) {
|
||||
//기본 리턴은 로그인페이지
|
||||
String result = "adm/signin/signin";
|
||||
TbBotUser userSelect = null;
|
||||
|
||||
TbBotUser user = tbBotUserRepo.findByUserIdAndUseYn(dto.getUserId(), "Y")
|
||||
.orElseThrow(() -> new UsernameNotFoundException("로그인 실패"));
|
||||
|
||||
//전자정부
|
||||
// if (tbBotUserRepo.existsByUserIdAndPasswordAndUseFlagAndSolutionCode(dto.getUserId(), EgovFileScrty.encryptPassword(dto.getPassword(), dto.getUserId()), "Y", "vm")) {
|
||||
// userSelect = tbBotUserRepo.findByUserIdAndPasswordAndUseFlagAndSolutionCode(
|
||||
// dto.getUserId(), EgovFileScrty.encryptPassword(dto.getPassword(), dto.getUserId()), "Y", "vm"
|
||||
// ).get();
|
||||
|
||||
//스프링
|
||||
if (dto.ofValid(passwordEncoder, user.getPassword())) {
|
||||
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(dto.getUserId(), dto.getPassword()));
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
SecurityContext securityContext = SecurityContextHolder.getContext();
|
||||
securityContext.setAuthentication(authentication);
|
||||
|
||||
sessionSetting(user);
|
||||
|
||||
LoginVO userResult = user.toLoginVO();
|
||||
return "forward:/adm/main/actionMain.do";
|
||||
} else {
|
||||
log.info("Fail!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void sessionSetting(TbBotUser tbu) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(SessionResource.LoginVO.getName(), tbu.toLoginVO());
|
||||
session.setAttribute(SessionResource.PolicyList.getName(), tbUserAuthGroupRepo.userPolicyListSelect(tbu.getUserSeq(), tbu.getLastUseServiceGroup()));
|
||||
session.setAttribute(SessionResource.UserVO.getName(), tbu.toUserVO());
|
||||
session.setMaxInactiveInterval(60 * 60);
|
||||
// session.setMaxInactiveInterval(30);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String actionMain(ModelMap model) {
|
||||
|
||||
log.info("action main init ");
|
||||
|
||||
// MenuManageVO menuManageVO = new MenuManageVO();
|
||||
List<MenuVo> menuVos = new ArrayList<>();
|
||||
String url = "";
|
||||
// LoginVO loginVO = (LoginVO) httpServletRequest.getSession().getAttribute(SessionResource.LoginVO.getName());
|
||||
UserVo userVo = (UserVo) httpServletRequest.getSession().getAttribute(SessionResource.UserVO.getName());
|
||||
log.info("action main session uservo- {}", new Gson().toJson(userVo));
|
||||
// if (loginVO != null && loginVO.getUserId() != null && !loginVO.getUserId().equals("")) {
|
||||
if (userVo != null && userVo.getUserId() != null && !userVo.getUserId().equals("")) {
|
||||
menuVos = authToMenuList(getUserPolicyList(userVo.getUserSeq(), userVo.getLastUseServiceGroup()), RoleResource.valueOf(userVo.getRoleVal()).getRoleValSeq().intValue())
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(MenuVo::getSeq))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//윈도우 함수 쓰지않고 처리한 쿼리.
|
||||
for (MenuVo e : menuVos) {
|
||||
if (e.getUrl() != null && !e.getUrl().equals("") && !e.getUrl().equals("0")) {
|
||||
url = "redirect:" + e.getUrl();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 로그인 세션이 없는 경우 오류(접근 불가) 화면으로 이동
|
||||
model.addAttribute("message", messageSource.getMessage("fail.common.login", null, Locale.getDefault()));
|
||||
Logout();
|
||||
url = "adm/signin/signin";
|
||||
}
|
||||
log.info("return url - {}", new Gson().toJson(url));
|
||||
return url;
|
||||
}
|
||||
|
||||
public LoginVO getLoginVo() {
|
||||
LoginVO user = (LoginVO) httpServletRequest.getSession().getAttribute(SessionResource.LoginVO.getName());
|
||||
if (user == null || user.equals("")) {
|
||||
httpServletResponse.setStatus(401);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public UserVo getUserVo() {
|
||||
UserVo user = (UserVo) httpServletRequest.getSession().getAttribute(SessionResource.UserVO.getName());
|
||||
// if (user == null || user.equals("")) {
|
||||
// httpServletResponse.setStatus(401);
|
||||
// }
|
||||
return user;
|
||||
}
|
||||
|
||||
public List<String> getSessionPolicy() {
|
||||
return (ArrayList) httpServletRequest.getSession().getAttribute(SessionResource.PolicyList.getName());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<String> getUserPolicyList(Long seq, String lastService) {
|
||||
return tbUserAuthGroupRepo.userPolicyListSelect(seq, lastService);
|
||||
}
|
||||
|
||||
public void Logout() {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(SessionResource.LoginVO.getName(), null);
|
||||
session.setAttribute(SessionResource.PolicyList.getName(), null);
|
||||
session.setAttribute(SessionResource.UserVO.getName(), null);
|
||||
}
|
||||
|
||||
public List<MenuVo> authToAuthList(List<String> authList, int roleValSeq) {
|
||||
return authList.stream().map(e -> {
|
||||
log.info(e);
|
||||
if (PolicyResource.valueOf(e).getMenu() != MenuResource.root && PolicyResource.valueOf(e).getRoleValSeq() < roleValSeq) {
|
||||
log.info(PolicyResource.valueOf(e).getMenu().getMenuName());
|
||||
return MenuVo.builder()
|
||||
.seq(PolicyResource.valueOf(e).getMenu().getMenuSeq())
|
||||
.seqUpper(PolicyResource.valueOf(e).getMenu().getMenuSeqUpper())
|
||||
.menuName(EnumToMap.spaceMap.get(PolicyResource.valueOf(e).getMenu().getLevel()) + PolicyResource.valueOf(e).getPolicyName())
|
||||
.authName(PolicyResource.valueOf(e).getName())
|
||||
.level(PolicyResource.valueOf(e).getMenu().getLevel())
|
||||
.url(PolicyResource.valueOf(e).getMenu().getMenuUrl())
|
||||
.build();
|
||||
} else {
|
||||
return MenuVo.builder().seq(PolicyResource.rootRead.getMenu().getMenuSeq())
|
||||
.seqUpper(PolicyResource.rootRead.getMenu().getMenuSeqUpper())
|
||||
.menuName(PolicyResource.valueOf(e).getPolicyName())
|
||||
.authName(e)
|
||||
.level(PolicyResource.rootRead.getMenu().getLevel())
|
||||
.url(PolicyResource.rootRead.getMenu().getMenuUrl())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
.sorted(Comparator.comparing(MenuVo::getSeq))
|
||||
.collect(Collectors.toList())
|
||||
;
|
||||
}
|
||||
|
||||
public List<MenuVo> authToMenuList(List<String> authList, int roleValSeq) {
|
||||
Map<Long, MenuVo> menuList = authList.stream().map(e -> {
|
||||
if (PolicyResource.valueOf(e).getMenu() != MenuResource.root && PolicyResource.valueOf(e).getRoleValSeq() < roleValSeq) {
|
||||
return MenuVo.builder()
|
||||
.seq(PolicyResource.valueOf(e).getMenu().getMenuSeq())
|
||||
.seqUpper(PolicyResource.valueOf(e).getMenu().getMenuSeqUpper())
|
||||
.menuName(EnumToMap.spaceMap.get(PolicyResource.valueOf(e).getMenu().getLevel()) + PolicyResource.valueOf(e).getMenu().getMenuName())
|
||||
.authName("")
|
||||
.level(PolicyResource.valueOf(e).getMenu().getLevel())
|
||||
.url(PolicyResource.valueOf(e).getMenu().getMenuUrl())
|
||||
.build();
|
||||
} else {
|
||||
return MenuVo.builder().seq(PolicyResource.rootRead.getMenu().getMenuSeq())
|
||||
.seqUpper(PolicyResource.rootRead.getMenu().getMenuSeqUpper())
|
||||
.menuName(EnumToMap.spaceMap.get(PolicyResource.rootRead.getMenu().getLevel()) + PolicyResource.rootRead.getMenu().getMenuName())
|
||||
.authName("")
|
||||
.level(PolicyResource.rootRead.getMenu().getLevel())
|
||||
.url(PolicyResource.rootRead.getMenu().getMenuUrl())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
)
|
||||
.collect(Collectors.toMap(menuVo -> menuVo.getSeq(), menuVo -> menuVo, (o, o2) -> o));
|
||||
|
||||
List<MenuVo> result = new ArrayList<>();
|
||||
List<Integer> next = new ArrayList<>();
|
||||
for (Long e : menuList.keySet().stream().sorted().collect(Collectors.toList())) {
|
||||
result.add(menuList.get(e));
|
||||
next.add(menuList.get(e).getLevel());
|
||||
}
|
||||
int temp = next.get(0);
|
||||
next.remove(0);
|
||||
next.add(temp);
|
||||
AtomicInteger index = new AtomicInteger();
|
||||
result.stream().forEach(menuVo ->
|
||||
menuVo.setNextLevel(next.get(index.getAndIncrement()))
|
||||
)
|
||||
;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<MenuVo> selectMainMenuLeft() {
|
||||
//동적처리
|
||||
// return authToMenuList(getUserPolicyList(getUserVo().getUserSeq(), getUserVo().getLastUseServiceGroup()), RoleResource.valueOf(getUserVo().getRoleVal()).getRoleValSeq().intValue())
|
||||
//세션처리
|
||||
return authToMenuList(getSessionPolicy(), RoleResource.valueOf(getUserVo().getRoleVal()).getRoleValSeq().intValue())
|
||||
;
|
||||
}
|
||||
|
||||
//Test용
|
||||
|
||||
@Transactional
|
||||
public List<MenuVo> selectMainMenuLeft(Long seq, String lastService, String role) {
|
||||
return authToMenuList(getUserPolicyList(seq, lastService), RoleResource.valueOf(role).getRoleValSeq().intValue());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<ServiceGroupRes> getServiceGroup() {
|
||||
UserVo uv = getUserVo();
|
||||
List<ServiceGroupRes> result = tbServiceGrouopRepo.findByServiceGroupInAndServiceGroupUpper(tbUserCustRepo.findByUserSeq(uv.getUserSeq())
|
||||
.stream().map(e -> e.getServiceGroup())
|
||||
.collect(Collectors.toList()), uv.getLastUseServiceGroup())
|
||||
.stream().map(f -> new ServiceGroupRes().toServiceGrouopRes(f))
|
||||
.collect(Collectors.toList());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void LastUserServiceGroupUpdate(Long userSeq, String updateService) throws CustomNotFoundException {
|
||||
tbBotUserRepo.findById(userSeq)
|
||||
.orElseThrow(() -> new CustomNotFoundException())
|
||||
.updateLastService(updateService)
|
||||
;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<OprmngCodeRes> getOprmngCode(String serviceType, String menuval) {
|
||||
List<OprmngCodeRes> result = tbServiceGrouopRepo.getOprmngCode(getUserVo(), serviceType, menuval);
|
||||
log.info("result - {}", new Gson().toJson(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<OprmngCodeRes> getMainOprmngCode() {
|
||||
// List<OprmngCodeRes> result = tbServiceGrouopRepo.getMainOprmngCode(getUserVo());
|
||||
|
||||
List<OprmngCodeRes> resultMainOpr = new ArrayList<>();
|
||||
|
||||
if (getUserVo().getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) {
|
||||
resultMainOpr = tbServiceGrouopRepo.findByServiceType("M").stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
|
||||
List<String> serviceResult = tbUserCustRepo.findByUserSeq(getUserVo().getUserSeq())
|
||||
.stream().map(e -> e.getServiceGroup()).collect(Collectors.toList());
|
||||
|
||||
List<String> myMainService = tbServiceGrouopRepo.findByServiceGroupIn(serviceResult)
|
||||
.stream().map(e -> e.getServiceGroupUpper())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
resultMainOpr = tbServiceGrouopRepo.findByServiceGroupIn(myMainService)
|
||||
.stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
log.info("resultMainOpr - {}", new Gson().toJson(resultMainOpr));
|
||||
|
||||
// log.info("result - {}", new Gson().toJson(result));
|
||||
return resultMainOpr;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void getMainOprmngCodeUpdate(MainOprReq dto) throws CustomNotFoundException {
|
||||
TbBotUser result = tbBotUserRepo.findById(dto.getUserSeq()).orElseThrow(() -> new CustomNotFoundException())
|
||||
.updateLastService(dto.getServiceGroup());
|
||||
log.info("getMainOprmngCodeUpdate - {}", new Gson().toJson(result));
|
||||
// httpServletRequest.getSession().setAttribute(SessionResource.UserVO.getName(), null);
|
||||
// httpServletRequest.getSession().setAttribute(SessionResource.UserVO.getName(), result.toUserVO());
|
||||
sessionSetting(result);
|
||||
}
|
||||
|
||||
public Map<String, String> jstreeParentConvertToPolicy() {
|
||||
return EnumToMap.PolicyToParentMap;
|
||||
}
|
||||
|
||||
public List<OprmngCodeRes> getOprmngCodeAdmin(String serviceType) {
|
||||
|
||||
List<OprmngCodeRes> result = tbServiceGrouopRepo.getOprmngCodeAdmin(getUserVo(), serviceType);
|
||||
log.info("result - {}", new Gson().toJson(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public ResponseEntity loginCheck(LoginCheckReq dto) throws CustomNotFoundException, CustomBadRequestException {
|
||||
TbBotUser user = tbBotUserRepo.findByUserId(dto.getUserId()).orElseThrow(() -> new CustomNotFoundException());
|
||||
if (user.getLoginCheck() >= 5) {
|
||||
throw new CustomBadRequestException();
|
||||
}
|
||||
if (user.getUseYn().equals("N")) {
|
||||
throw new CustomBadRequestException();
|
||||
}
|
||||
if (LocalDateTime.now().isAfter(user.getUpdateDate().plusDays(90))) {
|
||||
return ResponseEntity.status(401).build();
|
||||
}
|
||||
if (!passwordEncoder.matches(dto.getPassword(), user.getPassword())) {
|
||||
user.loginFailCheck();
|
||||
throw new CustomNotFoundException();
|
||||
} else {
|
||||
// logService.LogSave(LogVO.builder()
|
||||
// .menuAuth(MenuResource.commonsystemusermanage)
|
||||
// .actionCode(String.valueOf((ActionResource.login)))
|
||||
// .serviceGroup("OURSTOREAI")
|
||||
// .build());
|
||||
|
||||
tbIcsLogRepo.save(TbIcsLog.builder()
|
||||
.registDate(LocalDateTime.now())
|
||||
.userId(user.getUserId())
|
||||
.actionCode(ActionResource.login.name())
|
||||
.menuAuth(MenuResource.commonsystemusermanage.name())
|
||||
.ip(clientIp.getClientIp())
|
||||
.serviceGroup(user.getLastUseServiceGroup())
|
||||
.build()
|
||||
);
|
||||
|
||||
user.resetLoginFailCheck();
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public ResponseEntity PwdUpdate(PwdUpdateReq dto) throws CustomNotFoundException, CustomBadRequestException {
|
||||
TbBotUser user = tbBotUserRepo.findByUserId(dto.getId()).orElseThrow(() -> new CustomNotFoundException());
|
||||
if (user.getLoginCheck() >= 5) {
|
||||
throw new CustomBadRequestException();
|
||||
}
|
||||
if (!passwordEncoder.matches(dto.getPw0(), user.getPassword())) {
|
||||
user.loginFailCheck();
|
||||
throw new CustomNotFoundException();
|
||||
} else {
|
||||
user.updatePassword(passwordEncoder.encode(dto.getPw1()));
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.ExcelService;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemCommoncodeService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemCommoncodeController {
|
||||
|
||||
private final SystemCommoncodeService systemOprmngcodeService;
|
||||
|
||||
|
||||
@GetMapping("/oprmngcode/manage.do")
|
||||
public String OprmngcodeView() {
|
||||
return "/adm/common/system/commoncode";
|
||||
}
|
||||
|
||||
@PostMapping("/oprmngcode/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemCommoncodeRes> SystemCommoncodeList(@RequestBody SystemCommoncodeReq dto) {
|
||||
QueryResults<SystemCommoncodeRes> result = systemOprmngcodeService.SystemCommoncodeList(dto);
|
||||
return new DslDataTableRes<SystemCommoncodeRes>(result);
|
||||
}
|
||||
|
||||
@PostMapping("/oprmngcode/insert")
|
||||
@ResponseBody
|
||||
public void SystemCommoncodeInsert(@RequestBody SystemCommoncodeInsertReq dto) throws CustomBadRequestException, CustomNotFoundException {
|
||||
systemOprmngcodeService.SystemCommoncodeInsert(dto);
|
||||
}
|
||||
|
||||
@PostMapping("/oprmngcode/update")
|
||||
@ResponseBody
|
||||
public void SystemCommoncodeUpdate(@RequestBody SystemCommoncodeUpdateReq dto) throws CustomNotFoundException {
|
||||
systemOprmngcodeService.SystemCommoncodeUpdate(dto);
|
||||
}
|
||||
|
||||
@PostMapping("/oprmngcode/delete")
|
||||
@ResponseBody
|
||||
public void SystemCommoncodeDelete(@RequestBody SystemCommonCodeDeleteReq dto) throws CustomNotFoundException {
|
||||
systemOprmngcodeService.SystemCommoncodeDelete(dto);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemCustService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
@CrossOrigin("*")
|
||||
public class SystemCustController {
|
||||
|
||||
private final SystemCustService custService;
|
||||
|
||||
/**
|
||||
* @Name 고객사관리 JSP 페이지 랜더링
|
||||
* @Description 고객사관리 JSP 랜더링하는 컨트롤러
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/manage.do")
|
||||
public String CustListView() {
|
||||
return "/adm/common/system/cust";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 리스트를 조회하는 API
|
||||
* @Description 고객사리스트를 조회하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/cust/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemIcsCustInfoRes> CustList(@RequestBody SystemIcsCustInfoReq dto) {
|
||||
log.info("list dto = {}", new Gson().toJson(dto));
|
||||
QueryResults<SystemIcsCustInfoRes> result = custService.CustList(dto);
|
||||
return new DslDataTableRes<SystemIcsCustInfoRes>(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사정보를 업데이트하는 API
|
||||
* @Description 고객사정보를 업데이트하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/update")
|
||||
public String custUpdate(@RequestParam(name = "custCode", required = true) String custCode) {
|
||||
return "/adm/common/system/custUpdate";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 조회
|
||||
* @Description 고객사정보를 상세보기 페이지의 데이터를 조히하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/select")
|
||||
@ResponseBody
|
||||
public SystemCustSelectRes custSelect(@RequestParam(name = "custCode", required = true) String custCode) throws CustomNotFoundException {
|
||||
log.info("view Controller - {}", custCode);
|
||||
return custService.custSelect(custCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 생성
|
||||
* @Description 고객사를 생성하는 페이지 랜더링
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/insert")
|
||||
public String CustInsert() {
|
||||
log.info("CustInsert Controller");
|
||||
return "/adm/common/system/custInsert";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 생성시 줄수있는 권한그룹의 리스트
|
||||
* @Description 고객사에게 줄수있는 권한그룹의 리스트
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/policybase")
|
||||
@ResponseBody
|
||||
public List<MenuVo> CustPolicyBase(){
|
||||
return custService.CustPolicyBase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 코드 조회
|
||||
* @Description 고객사 코드가 중복되는지 확인하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/doubleCheck")
|
||||
@ResponseBody
|
||||
public String CustDoubleCheck(@RequestParam(name = "custCode")String custCode){
|
||||
return custService.CustDoubleCheck(custCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사의 메인 서비스그룹 생성
|
||||
* @Description 고객사를 생성할때 메인서비스그룹을 생성해줄때 중복체크
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/cust/service/doubleCheck")
|
||||
@ResponseBody
|
||||
public String CustServiceDoubleCheck(@RequestParam(name = "serviceGroup")String serviceGroup){
|
||||
return custService.CustServiceDoubleCheck(serviceGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 생성 정보 저장
|
||||
* @Description 고객사를 생성하는 정보를 저장
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/cust/save")
|
||||
@ResponseBody
|
||||
public void CustSave(@RequestBody SystemCustSaveReq dto) throws CustomNotFoundException {
|
||||
custService.CustSave(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 고객사 생성 정보 업데이트
|
||||
* @Description 고객사를 정보를 업데이트하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/cust/modify")
|
||||
@ResponseBody
|
||||
public void CustModify(@RequestBody SystemCustSaveReq dto) throws CustomNotFoundException {
|
||||
custService.CustModify(dto);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemGroupAuthService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.enumresource.RoleResource;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import oracle.jdbc.proxy.annotation.Post;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemGroupAuthController {
|
||||
|
||||
private final SystemGroupAuthService groupAuthService;
|
||||
|
||||
/**
|
||||
* @Name 권한그룹의 페이지랜딩 컨트롤러
|
||||
* @Description 권한그룹의 페이지를 랜딩함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/groupAuth/manage.do")
|
||||
public String GroupAuthView() {
|
||||
log.info("group Auth View controller");
|
||||
return "/adm/common/system/groupAuth";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 리스트페이지의 API
|
||||
* @Description 권한그룹 리스트의 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/groupAuth/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemServiceAuthGroupRes> GroupAuthList(@RequestBody SystemServiceAuthGroupReq dto) {
|
||||
log.info("list dto = {}", new Gson().toJson(dto));
|
||||
QueryResults<SystemServiceAuthGroupRes> result = groupAuthService.GroupAuthList(dto);
|
||||
return new DslDataTableRes<SystemServiceAuthGroupRes>(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹의 상세내역 조회페이지 랜더링
|
||||
* @Description 권한그룹 상세보기 JSP를 랜더링함.
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/groupAuth/view")
|
||||
public String GroupAuthView(@RequestParam(name = "custCode", required = true) String custCode) {
|
||||
log.info("view Controller - {}", custCode);
|
||||
return "/adm/common/system/groupAuthView";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹 권한데이터
|
||||
* @Description 권한그룹의 데이터를 트리구조로 뿌려주는 데이터를 조회함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/groupAuth/newTree")
|
||||
@ResponseBody
|
||||
public SystemServiceGroupTreeRes GroupAuthNewTree(@RequestParam(name = "serviceGroup", required = true)String serviceGroup) {
|
||||
return groupAuthService.GroupAuthNewTree(serviceGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹을 생성 &저장하는 API
|
||||
* @Description
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/groupAuth/insert")
|
||||
@ResponseBody
|
||||
public void GroupAuthInsert(@RequestBody SystemServiceGroupInsertReq dto) {
|
||||
groupAuthService.GroupAuthUpdateInsert(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹을 업데이트페이지 랜더링
|
||||
* @Description 권한그룹 업데이트 JSP페이지 랜더링
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/groupAuth/update")
|
||||
public String GroupAuthUpdate() {
|
||||
log.info("GroupAuthUpdate Controller");
|
||||
return "/adm/common/system/groupAuthUpdate";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹을 업데이트페이지의 데이터조회
|
||||
* @Description 권한그룹 업데이트 페이지의 데이터를 조회하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/groupAuth/update/select")
|
||||
@ResponseBody
|
||||
public SystemServiceAuthGroupUpdateRes GroupAuthUpdateData(@RequestParam(name = "authGroupSeq") Long authGroupSeq) throws CustomNotFoundException {
|
||||
log.info("GroupAuthUpdateData Controller" + authGroupSeq);
|
||||
return groupAuthService.GroupAuthUpdateData(authGroupSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹에 소속시킬 유저를 검색하는 API
|
||||
* @Description 권한그룹에 소속시킬 유저를 검색하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/groupAuth/userSearch")
|
||||
@ResponseBody
|
||||
public List<SystemServiceAuthGroupUserSearchRes> GroupAuthUpdateDataUserSearch(@RequestParam(name = "authGroupSeq") Long authGroupSeq, @RequestBody SystemServiceAuthGroupUserSearchReq dto) throws CustomNotFoundException {
|
||||
return groupAuthService.GroupAuthUpdateDataUserSearch(authGroupSeq, dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 권한그룹에 을 업데이트 하는 API
|
||||
* @Description 권한그룹을 업데이트하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/groupAuth/modify/update")
|
||||
@ResponseBody
|
||||
public void GroupAuthModityUpdate(@RequestBody SystemServiceAuthGroupModifyReq dto) throws CustomNotFoundException {
|
||||
log.info("GroupAuthModityUpdate Controller" + dto);
|
||||
groupAuthService.GroupAuthModityUpdate(dto);
|
||||
}
|
||||
|
||||
@GetMapping("/groupAuth/insert/opr")
|
||||
@ResponseBody
|
||||
public List<OprmngCodeRes> GroupInsertOpr() {
|
||||
return groupAuthService.GroupInsertOpr();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemPolicyMenuService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemPolicyMenuController {
|
||||
|
||||
private final SystemPolicyMenuService systemPolicyMenuService;
|
||||
/**
|
||||
* 삭제한 메뉴입니다
|
||||
*/
|
||||
|
||||
@GetMapping("/policyMenu/manage.do")
|
||||
public String PolicyMenuView(){
|
||||
return "/adm/common/system/policyMenu";
|
||||
}
|
||||
|
||||
@PostMapping("/policyMenu/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemPolicyMenuRes> PolicyMenuList(@RequestBody SystemPolicyMenuReq dto) {
|
||||
DslDataTableRes<SystemPolicyMenuRes> result = systemPolicyMenuService.PolicyMenuList(dto);
|
||||
log.info("PolicyMenuList result = {}", new Gson().toJson(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemServiceGroupService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.enumresource.RoleResource;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemServiceGroupController {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final SystemServiceGroupService systemServiceGroupService;
|
||||
|
||||
/**
|
||||
* @Name 서비스그룹 랜딩페이지
|
||||
* @Description 시스템운영자는 고객사리스트 -> 상위서비스리스트, 유저어드민은, 현재 사용중인 메인 서비스의 상세페이지 랜더링
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/serviceGroup/manage.do")
|
||||
public String ServiceGroupView() {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
if (uv.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) {
|
||||
return "/adm/common/system/serviceGroupList";
|
||||
} else {
|
||||
return "/adm/common/system/serviceGroupView";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 서비스그룹 리스트
|
||||
* @Description 시스템운영자는 고객사리스트 -> 상위서비스리스트 데이터 조회
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/serviceGroup/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemServiceGroupRes> ServiceGroupList(@RequestBody SystemServiceGroupReq dto) {
|
||||
QueryResults<SystemServiceGroupRes> result = systemServiceGroupService.ServiceGroupList(dto);
|
||||
return new DslDataTableRes<SystemServiceGroupRes>(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 서비스그룹 리스트
|
||||
* @Description 시스템운영자는 고객사리스트 -> 상위서비스리스트 데이터 조회
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/serviceGroup/view")
|
||||
public String ServiceGroupView(@RequestParam(name = "serviceGroup", required = false) String serviceGroup) {
|
||||
return "/adm/common/system/serviceGroupView";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 시나리오그룹 추가 버튼 API
|
||||
* @Description 추가할수있는 서비스그룹 검색
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/serviceGroup/select")
|
||||
@ResponseBody
|
||||
public SystemServiceGroupViewRes ServiceGroupSelect(@RequestParam(name = "serviceGroup", required = false) String serviceGroup) {
|
||||
if(serviceGroup ==null || serviceGroup.equals("")){
|
||||
return systemServiceGroupService.ServiceGroupSelect();
|
||||
}
|
||||
else{
|
||||
return systemServiceGroupService.ServiceGroupSelect(serviceGroup);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 선택된 시나리오그룹의 권한
|
||||
* @Description 선택된 서비스그룹의 권한리스트
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/serviceGroup/selectPolicy")
|
||||
@ResponseBody
|
||||
public List<String> ServiceGroupSelectPolicy(@RequestParam(name = "serviceGroup", required = true) String serviceGroup) {
|
||||
return systemServiceGroupService.SelectPolicy(serviceGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 시나리오그룹의 변경값 업데이트
|
||||
* @Description 수정된 서비스그룹의 데이터를 업데이트함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/serviceGroup/update")
|
||||
@ResponseBody
|
||||
public void ServiceGroupUpdate(@RequestBody SystemServiceGroupUpdateReq dto) throws CustomNotFoundException {
|
||||
systemServiceGroupService.ServiceGroupUpdate(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 시나리오그룹추가 저장 API
|
||||
* @Description 시나리오 그룹의 저장 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/serviceGroup/insert")
|
||||
@ResponseBody
|
||||
public void ServiceGroupInsert(@RequestBody SystemServiceGroupUpdateReq dto) throws CustomNotFoundException {
|
||||
systemServiceGroupService.ServiceGroupInsert(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 서비스그룹 중복확인버튼
|
||||
* @Description 해당 서비스그룹을 저장할수 있는지 확인하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/serviceGroup/doubleCheck")
|
||||
@ResponseBody
|
||||
public String ServiceGroupDoubleCheck(@RequestBody SystemServiceGroupUpdateReq dto) {
|
||||
log.info("ServiceGroupDoubleCheck Controller - {}", new Gson().toJson(dto));
|
||||
return systemServiceGroupService.ServiceGroupDoubleCheck(dto);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemUserAdminService;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemUserService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemUserAdminController {
|
||||
|
||||
private final SystemUserAdminService systemUserAdminService;
|
||||
|
||||
/**
|
||||
* @Name 어드민 시스템관리 운영자 관리
|
||||
* @Description 사용자 관리와 코멘트 같음.
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/userAdmin/manage.do")
|
||||
public String UserAdminView() {
|
||||
return "/adm/common/system/userAdmin";
|
||||
}
|
||||
|
||||
@PostMapping("/userAdmin/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemBotUserRes> userAdminList(@RequestBody SystemBotUserReq dto) {
|
||||
log.info("list dto = {}", new Gson().toJson(dto));
|
||||
DslDataTableRes<SystemBotUserRes> result = systemUserAdminService.SystemUserAdminList(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/view")
|
||||
public String userAdminDetailView(@RequestParam(name = "userSeq", required = true) String userSeq) {
|
||||
log.info("view Controller - {}", userSeq);
|
||||
return "/adm/common/system/userAdminView";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/userAdmin/insert")
|
||||
public String ServiceGroupInsert() {
|
||||
log.info("user insert Controller");
|
||||
return "/adm/common/system/userAdminInsert";
|
||||
}
|
||||
|
||||
@PostMapping("/userAdmin/save")
|
||||
@ResponseBody
|
||||
public void userAdminSave(@RequestBody SystemBotUserSaveReq dto) throws CustomNotFoundException {
|
||||
log.info("save Dto = {}", new Gson().toJson(dto));
|
||||
systemUserAdminService.userAdminSave(dto);
|
||||
}
|
||||
|
||||
@PostMapping("/userAdmin/update")
|
||||
@ResponseBody
|
||||
public void userAdminUpdate(@RequestBody SystemBotUserUpdateReq dto) throws CustomNotFoundException {
|
||||
log.info("userUpdatee Dto = {}", new Gson().toJson(dto));
|
||||
systemUserAdminService.userAdminUpdate(dto);
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/authlist")
|
||||
@ResponseBody
|
||||
public List<SystemBotUserAuthGroupListRes> UserAdminAuthGroupList(@RequestParam(name = "serviceGroup", required = true) String serviceGroup) {
|
||||
log.info("UserAuthGroupList=========" + serviceGroup);
|
||||
return systemUserAdminService.UserAdminAuthGroupList(serviceGroup);
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/doubleCheck")
|
||||
@ResponseBody
|
||||
public String UserAdminDoubleCheck(@RequestParam(name = "userId") String userId) {
|
||||
return systemUserAdminService.UserDoubleCheck(userId);
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/viewData")
|
||||
@ResponseBody
|
||||
public SystemBotUserViewRes UserAdminViewData(@RequestParam(name = "userSeq", required = true) Long userSeq) throws CustomNotFoundException {
|
||||
log.info("UserViewData=========" + userSeq);
|
||||
return systemUserAdminService.UserAdminViewData(userSeq);
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/cust/select")
|
||||
@ResponseBody
|
||||
public List<SystemBotUserCustRes> UserAdminCustList() throws CustomNotFoundException {
|
||||
|
||||
return systemUserAdminService.UserAdminCustList();
|
||||
}
|
||||
|
||||
@GetMapping("/userAdmin/service/select")
|
||||
@ResponseBody
|
||||
public List<OprmngCodeRes> UserAdminServiceList(@RequestParam(name = "custCode", required = true)String cust) throws CustomNotFoundException {
|
||||
return systemUserAdminService.UserAdminServiceList(cust);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,175 @@
|
||||
package com.icomsys.main_vm.biz.common.system.controller;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.system.service.SystemUserService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common/system")
|
||||
public class SystemUserController {
|
||||
|
||||
private final SystemUserService systemUserService;
|
||||
|
||||
/**
|
||||
* @Name 유저리스트페이지
|
||||
* @Description 어드민 시스템관리 유저관리 JSP랜딩페이지
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/manage.do")
|
||||
public String UserView() {
|
||||
return "/adm/common/system/user";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저리스트페이지 리스트 Data SEARCH API
|
||||
* @Description 어드민 시스템관리 유저관리 DATA LIST
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/user/list")
|
||||
@ResponseBody
|
||||
public DslDataTableRes<SystemBotUserRes> userList(@RequestBody SystemBotUserReq dto) {
|
||||
log.info("list dto = {}", new Gson().toJson(dto));
|
||||
QueryResults<SystemBotUserRes> result = systemUserService.SystemUserList(dto);
|
||||
return new DslDataTableRes<SystemBotUserRes>(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저리스트에서 더블클릭해서 보는 유저 상세페이지
|
||||
* @Description 어드민 시스템관리 유저 DATA
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/view")
|
||||
public String userDetailView(@RequestParam(name = "userSeq", required = true) String userSeq) {
|
||||
log.info("view Controller - {}", userSeq);
|
||||
return "/adm/common/system/userView";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저리스트에서 유저를 생성페이지 랜더링
|
||||
* @Description 어드민 시스템관리 유저생성하는 페이지랜더링
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/insert")
|
||||
public String ServiceGroupInsert() {
|
||||
log.info("user insert Controller");
|
||||
return "/adm/common/system/userInsert";
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저리스트에서 유저를 생성API
|
||||
* @Description 어드민 시스템관리 유저생성하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/user/save")
|
||||
@ResponseBody
|
||||
public void userSave(@RequestBody SystemBotUserSaveReq dto) throws CustomNotFoundException {
|
||||
log.info("save Dto = {}", new Gson().toJson(dto));
|
||||
systemUserService.userSave(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저리스트에서 유저정보를 업데이트
|
||||
* @Description 어드민 시스템관리 유저정보를 업데이트하는 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@PostMapping("/user/update")
|
||||
@ResponseBody
|
||||
public void userUpdate(@RequestBody SystemBotUserUpdateReq dto) throws CustomNotFoundException {
|
||||
log.info("userUpdatee Dto = {}", new Gson().toJson(dto));
|
||||
systemUserService.userUpdate(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저 권한그룹 리스트
|
||||
* @Description 시나리오그룹이 가지고있는 권한리스트를 조회함
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/authlist")
|
||||
@ResponseBody
|
||||
public List<SystemBotUserAuthGroupListRes> UserAuthGroupList(@RequestParam(name = "serviceGroup", required = true) String serviceGroup) {
|
||||
log.info("UserAuthGroupList=========" + serviceGroup);
|
||||
return systemUserService.UserAuthGroupList(serviceGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저 중복체크
|
||||
* @Description 유저 아이디 중복체크 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/doubleCheck")
|
||||
@ResponseBody
|
||||
public String UserDoubleCheck(@RequestParam(name = "userId") String userId) {
|
||||
return systemUserService.UserDoubleCheck(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저 상세보기 데이터
|
||||
* @Description 유저를 더블클링 했을시 필요한 데이터 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/viewData")
|
||||
@ResponseBody
|
||||
public SystemBotUserViewRes UserViewData(@RequestParam(name = "userSeq", required = true) Long userSeq) throws CustomNotFoundException {
|
||||
log.info("UserViewData=========" + userSeq);
|
||||
return systemUserService.UserViewData(userSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 유저 생성시 소속시킬 고객사 검색
|
||||
* @Description 유저를 더블클링 했을시 필요한 데이터 API
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/cust/select")
|
||||
@ResponseBody
|
||||
public List<SystemBotUserCustRes> UserCustList() throws CustomNotFoundException {
|
||||
return systemUserService.UserCustList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 해당 서비스그룹 검색
|
||||
* @Description 해당유저를 생성할때 사용할 수 있는 서비스 그룹 검색
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/service/select")
|
||||
@ResponseBody
|
||||
public List<OprmngCodeRes> UserServiceList(@RequestParam(name = "custCode", required = true) String cust) throws CustomNotFoundException {
|
||||
return systemUserService.UserServiceList(cust);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Name 비밀번호 오류회수 초기화
|
||||
* @Description 비밀번호 오류회수를 초기화시킴
|
||||
* @Author JangWonSeok
|
||||
* @CreateDate 2023. 03. 09.
|
||||
*/
|
||||
@GetMapping("/user/chk/reset")
|
||||
public ResponseEntity UserCheckReset(@RequestParam(name = "userSeq") Long userSeq) throws CustomNotFoundException {
|
||||
log.info("failreset - {}", userSeq);
|
||||
systemUserService.UserCheckReset(userSeq);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomBadRequestException;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbBotCommonCodeRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbServiceGrouopRepo;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.math3.analysis.function.Add;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemCommoncodeService {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final TbBotCommonCodeRepo tbBotCommonCodeRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public QueryResults<SystemCommoncodeRes> SystemCommoncodeList(SystemCommoncodeReq dto) {
|
||||
QueryResults<SystemCommoncodeRes> result = tbBotCommonCodeRepo
|
||||
.SystemCommoncodeList(dto.ofUserVo(loginService.getUserVo()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void SystemCommoncodeInsert(SystemCommoncodeInsertReq dto) throws CustomBadRequestException, CustomNotFoundException {
|
||||
|
||||
log.info("insert - {}", new Gson().toJson(dto));
|
||||
|
||||
TbServiceGrouop service = tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup())
|
||||
.orElseThrow(() -> new CustomNotFoundException());
|
||||
if (tbBotCommonCodeRepo.existsByOprMngCodeAndMajorCodeAndMinorCode(dto.getOpr(loginService.getUserVo()), dto.getMajor(), dto.getMinor())) {
|
||||
throw new CustomBadRequestException();
|
||||
} else {
|
||||
// if (dto.getCodeType().equals("C_CD")) {
|
||||
tbBotCommonCodeRepo.save(dto.ofSave(loginService.getUserVo(), service.getCustCode(), service.getServiceGroup()));
|
||||
// tbBotCommonCodeRepo.saveAll(dto.ofSaveAll(loginService.getUserVo(), tbServiceGrouopRepo.findByServiceGroupUpperAndServiceType(tbServiceGrouopRepo
|
||||
// .findByServiceGroup(dto.getServiceGroup()).orElseThrow(() -> new CustomNotFoundException()).getServiceGroupUpper(), "S")
|
||||
// .stream().map(f -> f.getServiceGroup()).collect(Collectors.toList())));
|
||||
// } else {
|
||||
// tbBotCommonCodeRepo.save(dto.ofSave(loginService.getUserVo(), service.getCustCode()));
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void SystemCommoncodeUpdate(SystemCommoncodeUpdateReq dto) throws CustomNotFoundException {
|
||||
|
||||
log.info("update - {}", new Gson().toJson(dto));
|
||||
|
||||
// if (dto.getCodeType().equals("C_CD")) {
|
||||
// for (TbBotCommonCodeId f : tbServiceGrouopRepo.findByServiceGroupUpperAndServiceType(tbServiceGrouopRepo.findByServiceGroup(dto.getServiceGroup())
|
||||
// .orElseThrow(() -> new CustomNotFoundException()).getServiceGroupUpper(), "S")
|
||||
// .stream()
|
||||
// .map(e -> TbBotCommonCodeId.builder().oprMngCode(e.getCustCode() + "_RCP_" + e.getServiceGroup())
|
||||
// .majorCode(dto.getMajorCode()).minorCode(dto.getMinorCode()).build()).collect(Collectors.toList())) {
|
||||
// tbBotCommonCodeRepo.findById(f)
|
||||
// .orElseThrow(() -> new CustomNotFoundException())
|
||||
// .toUpdate(dto, loginService.getUserVo());
|
||||
// }
|
||||
// } else {
|
||||
tbBotCommonCodeRepo.findById(dto.toId())
|
||||
.orElseThrow(() -> new CustomNotFoundException())
|
||||
.toUpdate(dto, loginService.getUserVo());
|
||||
// }
|
||||
}
|
||||
|
||||
public void SystemCommoncodeDelete(@RequestBody SystemCommonCodeDeleteReq dto) {
|
||||
|
||||
tbBotCommonCodeRepo.deleteById(dto.delId());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.RestTemplateService;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.common.code.enumresource.PolicyResource;
|
||||
import com.icomsys.main_vm.db.jpa.entity.conversation.TbProjectSetting;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.*;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbCustPolicyId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.conversation.TbProjectSettingRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.stream.Streams;
|
||||
import org.apache.el.lang.FunctionMapperImpl;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemCustService {
|
||||
private final LoginService loginService;
|
||||
private final TbIcsCustInfoRepo tbIcsCustInfoRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final TbIcsOprMngInfoRepo tbIcsOprMngInfoRepo;
|
||||
private final TbCustPolicyRepo tbCustPolicyRepo;
|
||||
private final TbUserCustRepo tbUserCustRepo;
|
||||
private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo;
|
||||
private final RestTemplateService restTemplateService;
|
||||
private final TbProjectSettingRepo tbProjectSettingRepo;
|
||||
@Value("${feign.url.nlp}")
|
||||
private String wisepath;
|
||||
|
||||
|
||||
public QueryResults<SystemIcsCustInfoRes> CustList(SystemIcsCustInfoReq dto) {
|
||||
// return tbIcsCustInfoRepo.findAll().stream().map(e -> new SystemIcsCustInfoRes().toIcsCustInfoRes(e)).collect(Collectors.toList());
|
||||
return tbIcsCustInfoRepo.SelectCustInfo(dto);
|
||||
}
|
||||
|
||||
public List<MenuVo> CustPolicyBase() {
|
||||
List<MenuVo> result = loginService.authToAuthList(
|
||||
PolicyResource.ALL.stream().map(e -> e.getName()).collect(Collectors.toList()), 10000000);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String CustDoubleCheck(String custCode) {
|
||||
String result = "N";
|
||||
|
||||
if (tbIcsCustInfoRepo.existsByCustCode(custCode)) {
|
||||
return result;
|
||||
} else {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
|
||||
public String CustServiceDoubleCheck(String serviceGroup) {
|
||||
String result = "N";
|
||||
if (tbServiceGrouopRepo.existsByServiceGroup(serviceGroup)) {
|
||||
return result;
|
||||
} else {
|
||||
return "Y";
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void CustSave(SystemCustSaveReq dto) throws CustomNotFoundException {
|
||||
log.info("CustSave dto - {}", new Gson().toJson(dto));
|
||||
UserVo uv = loginService.getUserVo();
|
||||
tbIcsCustInfoRepo.save(dto.otCust(uv));
|
||||
tbServiceGrouopRepo.saveAll(dto.toServiceGroup(uv));
|
||||
tbIcsOprMngInfoRepo.saveAll(dto.toOpr(uv));
|
||||
tbCustPolicyRepo.saveAll(dto.toPolicy());
|
||||
tbUserCustRepo.saveAll(dto.toSystemAdmin(uv));
|
||||
tbProjectSettingRepo.saveAll(WisenutInsert(dto.toWisenutInsert()));
|
||||
}
|
||||
|
||||
public List<TbProjectSetting> WisenutInsert(List<WisenutInsertReqVo> dto) throws CustomNotFoundException {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
List<TbProjectSetting> projectSettins = new ArrayList<>();
|
||||
UserVo uv = loginService.getUserVo();
|
||||
log.info("===================WisenutInsert===============");
|
||||
// log.info("data ===== {}", new Gson().toJson(dto));
|
||||
|
||||
ResponseEntity callRes = null;
|
||||
for (WisenutInsertReqVo e : dto) {
|
||||
callRes = Optional.of(restTemplateService
|
||||
.PostCall(UriComponentsBuilder.newInstance().uri(URI.create(wisepath + "/proj/insert"))
|
||||
.build(), headers, new Gson().toJson(e)))
|
||||
.orElseThrow(() -> new CustomNotFoundException("Wisenut 연결에 실패하였습니다."))
|
||||
;
|
||||
if (callRes.getStatusCode().equals(HttpStatus.OK)) {
|
||||
WisenutInsertResVo callVo = new Gson().fromJson(callRes.getBody().toString(), WisenutInsertResVo.class);
|
||||
projectSettins.add(TbProjectSetting.builder()
|
||||
.ifMappingId(callVo.getProjectId())
|
||||
.oprMngCode(e.getName())
|
||||
.similarityCriteria(e.getSimThreshold())
|
||||
.classCriteria(e.getConfidentThreshold())
|
||||
.classResultCriteria(e.getConfidentThresholdGap())
|
||||
.registId(uv.getUserId())
|
||||
.updateId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
|
||||
} else {
|
||||
throw new CustomNotFoundException("Wisenut 연결에 실패하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
return projectSettins;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public SystemCustSelectRes custSelect(String custCode) throws CustomNotFoundException {
|
||||
|
||||
TbIcsCustInfo custResult = tbIcsCustInfoRepo.findById(custCode)
|
||||
.orElseThrow(() -> new CustomNotFoundException());
|
||||
|
||||
Map<String, List<String>> polMap = new HashMap<>();
|
||||
List<SystemCustSaveSubReq> systemCustSaveSubReqs = tbServiceGrouopRepo.findByCustCodeAndServiceType(custCode, "M").stream().map(e -> {
|
||||
polMap.put(e.getServiceGroup(), new ArrayList<>());
|
||||
return SystemCustSaveSubReq.builder()
|
||||
.addServiceGroupName(e.getServiceGroupName())
|
||||
.addServiceGroup(e.getServiceGroup())
|
||||
.addOprMngCode(custCode + "_RCP_" + e.getServiceGroup())
|
||||
.addServiceGroupDesc(e.getServiceGroupDesc())
|
||||
.addUseYn(e.getUseYn())
|
||||
.build();
|
||||
}
|
||||
).distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
tbCustPolicyRepo.findByServiceGroupIn(polMap.keySet().stream().collect(Collectors.toList()))
|
||||
.stream().map(e -> {
|
||||
List<String> addpol = polMap.get(e.getServiceGroup());
|
||||
addpol.add(e.getPolicyVal());
|
||||
polMap.put(e.getServiceGroup(), addpol);
|
||||
return false;
|
||||
}
|
||||
).collect(Collectors.toList());
|
||||
|
||||
SystemCustSelectRes result = SystemCustSelectRes.builder()
|
||||
.custName(custResult.getCustName())
|
||||
.custCode(custResult.getCustCode())
|
||||
.custUseYn(custResult.getUseYn())
|
||||
.addServiceAuthList(systemCustSaveSubReqs)
|
||||
.servicePol(polMap)
|
||||
.mainMenu(loginService.authToAuthList(PolicyResource.ALL.stream().map(e -> e.getName()).collect(Collectors.toList()), 10000000))
|
||||
.policyParent(loginService.jstreeParentConvertToPolicy())
|
||||
.build();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void CustModify(SystemCustSaveReq dto) throws CustomNotFoundException {
|
||||
log.info("CustSave dto - {}", new Gson().toJson(dto));
|
||||
|
||||
UserVo uv = loginService.getUserVo();
|
||||
TbIcsCustInfo custResult = tbIcsCustInfoRepo.findById(dto.getCustCode())
|
||||
.orElseThrow(() -> new CustomNotFoundException())
|
||||
.UpdateCust(dto, loginService.getUserVo());
|
||||
Map<String, List<TbCustPolicy>> custPolBase = tbCustPolicyRepo.findByServiceGroupIn(tbServiceGrouopRepo
|
||||
.findByCustCodeAndServiceType(dto.getCustCode(), "M")
|
||||
.stream()
|
||||
.map(e -> e.getServiceGroup())
|
||||
.collect(Collectors.toList()))
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(TbCustPolicy::getServiceGroup));
|
||||
|
||||
List<TbServiceGrouop> saveService = new ArrayList<>();
|
||||
List<TbIcsOprMngInfo> saveOpr = new ArrayList<>();
|
||||
|
||||
List<TbCustPolicy> insertPol = new ArrayList<>();
|
||||
Map<List<String>, List<String>> delUpperVal = new HashMap<>();
|
||||
for (SystemCustSaveSubReq e : dto.getAddServiceAuthList()) {
|
||||
List<String> delVal = new ArrayList<>();
|
||||
String serviceGroup = e.getAddServiceGroup();
|
||||
List<TbCustPolicy> beforPol = custPolBase.get(serviceGroup);
|
||||
List<String> insertVal = e.getAuthList();
|
||||
|
||||
//수정할 데이터
|
||||
if (custPolBase.keySet().stream().collect(Collectors.toList()).contains(e.getAddServiceGroup())) {
|
||||
TbServiceGrouop tsg = tbServiceGrouopRepo.findByServiceGroup(serviceGroup)
|
||||
.orElseThrow(() -> new CustomNotFoundException())
|
||||
.toUpdateMainService(e, uv);
|
||||
for (TbCustPolicy f : beforPol) {
|
||||
if (e.getAuthList().contains(f.getPolicyVal())) {
|
||||
insertVal.remove(f.getPolicyVal());
|
||||
} else {
|
||||
delVal.add(f.getPolicyVal());
|
||||
}
|
||||
}
|
||||
if (delVal.size() > 0) {
|
||||
delUpperVal.put(
|
||||
tbServiceGrouopRepo.findByServiceGroupUpper(e.getAddServiceGroup())
|
||||
.stream().map(g -> g.getServiceGroup())
|
||||
.distinct()
|
||||
.collect(Collectors.toList()), delVal);
|
||||
}
|
||||
for (String h : insertVal) {
|
||||
insertPol.add(TbCustPolicy.builder()
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.policyVal(h)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
//저장할 데이터
|
||||
else {
|
||||
for (String h : e.getAuthList()) {
|
||||
insertPol.add(TbCustPolicy.builder()
|
||||
.custCode(custResult.getCustCode())
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.policyVal(h)
|
||||
.build());
|
||||
}
|
||||
saveService.add(e.toService(custResult.getCustCode(), uv));
|
||||
saveOpr.add(e.toOprmngCode(custResult.getCustCode(), uv));
|
||||
}
|
||||
}
|
||||
|
||||
for (List<String> e : delUpperVal.keySet().stream().collect(Collectors.toList())) {
|
||||
tbCustPolicyRepo.deleteByServiceGroupInAndPolicyValIn(e, delUpperVal.get(e));
|
||||
tbServiceGroupPolicyRepo.deleteByServiceGroupInAndPolicyValIn(e, delUpperVal.get(e));
|
||||
}
|
||||
|
||||
tbCustPolicyRepo.saveAll(insertPol);
|
||||
tbServiceGrouopRepo.saveAll(saveService);
|
||||
tbIcsOprMngInfoRepo.saveAll(saveOpr);
|
||||
//프로젝트세팅 테이블이 저장되어야 해야된다해서 나중에 추가된 코드
|
||||
//1차에선 데이터를 DB에서 SQL로 인서트했다고함.
|
||||
if (saveService.size() > 0) {
|
||||
List<WisenutInsertReqVo> saveProject = new ArrayList<>();
|
||||
for (TbServiceGrouop e : saveService) {
|
||||
saveProject.add(WisenutInsertReqVo.builder()
|
||||
.oprMngCode(e.getCustCode() + "_RCP_" + e.getServiceGroup())
|
||||
.serviceGroupDesc(e.getServiceGroupDesc())
|
||||
.build());
|
||||
}
|
||||
tbProjectSettingRepo.saveAll(WisenutInsert(saveProject));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,256 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.SequenceService;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.EnumToMap;
|
||||
import com.icomsys.main_vm.common.code.enumresource.RoleResource;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceAuthGroup;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGroupPolicy;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbUserAuthGroup;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbUserCust;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbServiceGroupPolicyId;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserCustId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemGroupAuthService {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo;
|
||||
private final TbCustPolicyRepo tbCustPolicyRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final SequenceService sequenceService;
|
||||
private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo;
|
||||
private final TbBotUserRepo tbBotUserRepo;
|
||||
private final TbUserAuthGroupRepo tbUserAuthGroupRepo;
|
||||
private final TbUserCustRepo tbUserCustRepo;
|
||||
|
||||
@Transactional
|
||||
public QueryResults<SystemServiceAuthGroupRes> GroupAuthList(SystemServiceAuthGroupReq dto) {
|
||||
return tbServiceAuthGroupRepo.ServiceAuthGroupListView(dto.ofUserVo(loginService.getUserVo()));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SystemServiceGroupTreeRes GroupAuthNewTree(String serviceGroup) {
|
||||
|
||||
// UserVo uv = loginService.getUserVo();
|
||||
|
||||
List<String> pol = tbCustPolicyRepo.findByServiceGroup(serviceGroup).stream()
|
||||
.map(f -> f.getPolicyVal()).collect(Collectors.toList());
|
||||
|
||||
return SystemServiceGroupTreeRes.builder()
|
||||
.custCode(tbServiceGrouopRepo.findByServiceGroup(serviceGroup).stream().findFirst().map(e -> e.getCustCode()).get())
|
||||
.mainPolicyVal(pol)
|
||||
.mainMenu(loginService.authToAuthList(pol, 10000000))
|
||||
.policyParent(loginService.jstreeParentConvertToPolicy())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void GroupAuthUpdateInsert(SystemServiceGroupInsertReq dto) {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
String custCode = tbServiceGrouopRepo.findByServiceGroup(dto.getInsertServiceGroup()).stream().findFirst().map(e -> e.getCustCode()).get();
|
||||
TbServiceAuthGroup saveResult = tbServiceAuthGroupRepo.save(TbServiceAuthGroup.builder()
|
||||
// .authGroupSeq(sequenceService.ServiceAuthGroupSeqNext())
|
||||
.serviceGroup(dto.getInsertServiceGroup())
|
||||
.custCode(custCode)
|
||||
.policyGroupName(dto.getInsertGroupName())
|
||||
.policyGroupDesc(dto.getInsertGroupDesc())
|
||||
.useYn(dto.getSubUseYn())
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
|
||||
List<TbServiceGroupPolicy> policyList = new ArrayList<>();
|
||||
|
||||
for (String e : dto.getSubPolicyVal()) {
|
||||
policyList.add(TbServiceGroupPolicy.builder()
|
||||
.authGroupSeq(saveResult.getAuthGroupSeq())
|
||||
.serviceGroup(dto.getInsertServiceGroup())
|
||||
.policyVal(e)
|
||||
.custCode(custCode)
|
||||
.build());
|
||||
if (!EnumToMap.PolicyToParentMap.get(e).equals("#")) {
|
||||
policyList.add(TbServiceGroupPolicy.builder()
|
||||
.authGroupSeq(saveResult.getAuthGroupSeq())
|
||||
.serviceGroup(dto.getInsertServiceGroup())
|
||||
.policyVal(EnumToMap.PolicyToParentMap.get(e))
|
||||
.custCode(custCode)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
tbServiceGroupPolicyRepo.saveAll(policyList);
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SystemServiceAuthGroupUpdateRes GroupAuthUpdateData(Long authGroupSeq) throws CustomNotFoundException {
|
||||
|
||||
TbServiceAuthGroup tsag = tbServiceAuthGroupRepo.findByAuthGroupSeq(authGroupSeq)
|
||||
.orElseThrow(() -> new CustomNotFoundException());
|
||||
List<String> pol = tbCustPolicyRepo.findByServiceGroup(tsag.getServiceGroup()).stream()
|
||||
.map(f -> f.getPolicyVal()).collect(Collectors.toList());
|
||||
List<SystemBotUserRes> userRes = new ArrayList<>();
|
||||
if (tbUserAuthGroupRepo.existsByAuthGroupSeq(authGroupSeq)) {
|
||||
userRes = tbBotUserRepo.AuthGroupUserList(authGroupSeq);
|
||||
}
|
||||
List<String> authVal = tbServiceGroupPolicyRepo.findByAuthGroupSeq(authGroupSeq).stream().map(e -> e.getPolicyVal()).collect(Collectors.toList());
|
||||
SystemServiceAuthGroupUpdateRes result = SystemServiceAuthGroupUpdateRes.builder()
|
||||
.authGroupSeq(tsag.getAuthGroupSeq())
|
||||
.serviceGroup(tsag.getServiceGroup())
|
||||
.custCode(tsag.getCustCode())
|
||||
.policyGroupName(tsag.getPolicyGroupName())
|
||||
.policyGroupDesc(tsag.getPolicyGroupDesc())
|
||||
.userList(userRes)
|
||||
.policyVal(pol)
|
||||
.authPolicyVal(authVal)
|
||||
.mainMenu(loginService.authToAuthList(pol, 10000000))
|
||||
.policyParent(loginService.jstreeParentConvertToPolicy())
|
||||
.build();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public List<SystemServiceAuthGroupUserSearchRes> GroupAuthUpdateDataUserSearch(Long authGroupSeq, SystemServiceAuthGroupUserSearchReq dto) throws CustomNotFoundException {
|
||||
List<SystemServiceAuthGroupUserSearchRes> result = new ArrayList<>();
|
||||
dto.setAuthGroupSeq(authGroupSeq);
|
||||
result = tbBotUserRepo.GroupAuthUpdateDataUserSearch(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void GroupAuthModityUpdate(SystemServiceAuthGroupModifyReq dto) throws CustomNotFoundException {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
TbServiceAuthGroup tbServiceAuthGroup = tbServiceAuthGroupRepo.findByAuthGroupSeq(dto.getAuthGroupSeq()).orElseThrow(() -> new CustomNotFoundException());
|
||||
String serviceGroup = tbServiceAuthGroup.getServiceGroup();
|
||||
tbServiceAuthGroup.TbServiceAuthGroupModify(TbServiceAuthGroup.builder()
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.custCode(dto.getCustCode())
|
||||
.policyGroupName(dto.getPolicyGroupName())
|
||||
.policyGroupDesc(dto.getPolicyGroupDesc())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
|
||||
//소속사용자는 다저장
|
||||
tbUserAuthGroupRepo.saveAll(dto.getTheUser().stream().map(e -> TbUserAuthGroup.builder()
|
||||
.userSeq(e)
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.custCode(dto.getCustCode())
|
||||
.build()).collect(Collectors.toList())
|
||||
);
|
||||
|
||||
//소속제외 사용자는 다 삭제
|
||||
tbUserAuthGroupRepo.deleteAll(dto.getDelUser().stream().map(e -> TbUserAuthGroup.builder()
|
||||
.userSeq(e)
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.custCode(dto.getCustCode())
|
||||
.build()).collect(Collectors.toList())
|
||||
);
|
||||
|
||||
//소속되면 유저커스트에도 추가해줘야함.
|
||||
tbUserCustRepo.saveAll(dto.getTheUser().stream().map(e -> TbUserCust.builder()
|
||||
.custCode(tbServiceAuthGroup.getCustCode())
|
||||
.serviceGroup(tbServiceAuthGroup.getServiceGroup())
|
||||
.userSeq(e)
|
||||
.build()).collect(Collectors.toList()));
|
||||
|
||||
//소속제외되면 유저커스트에 삭제를 시켜야하는데. 다른 권한그룹에 같은 서비스그룹이 있는지 판단해야함.
|
||||
List<TbUserCustId> delUserCust = new ArrayList<>();
|
||||
for (Long e : dto.getDelUser()) {
|
||||
if (!tbUserAuthGroupRepo.existsByServiceGroupAndUserSeqAndAuthGroupSeqNot(serviceGroup, e, dto.getAuthGroupSeq())) {
|
||||
delUserCust.add(TbUserCustId.builder()
|
||||
.custCode(tbServiceAuthGroup.getCustCode())
|
||||
.serviceGroup(serviceGroup)
|
||||
.userSeq(e)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
tbUserCustRepo.deleteAllById(delUserCust);
|
||||
|
||||
//js트리 처리
|
||||
List<String> befor = tbServiceGroupPolicyRepo.findByAuthGroupSeq(dto.getAuthGroupSeq()).stream().map(e -> e.getPolicyVal()).collect(Collectors.toList());
|
||||
List<String> base = new ArrayList<>();
|
||||
List<String> insertVal = new ArrayList<>();
|
||||
List<TbServiceGroupPolicyId> deleteId = new ArrayList<>();
|
||||
List<String> deleteVal = new ArrayList<>();
|
||||
List<TbServiceGroupPolicy> insertId = new ArrayList<>();
|
||||
base = dto.getThePolicy();
|
||||
insertVal = dto.getThePolicy();
|
||||
|
||||
for (String e : befor) {
|
||||
if (base.contains(e)) {
|
||||
insertVal.remove(e);
|
||||
} else {
|
||||
deleteVal.add(e);
|
||||
deleteId.add(TbServiceGroupPolicyId
|
||||
.builder()
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.policyVal(e)
|
||||
.custCode(dto.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
for (String e : insertVal) {
|
||||
insertId.add(TbServiceGroupPolicy.builder()
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.policyVal(e)
|
||||
.custCode(dto.getCustCode())
|
||||
.build());
|
||||
//jquery jstree 상위메뉴가없어질경우 방어로직.
|
||||
if (!EnumToMap.PolicyToParentMap.get(e).equals("#")) {
|
||||
insertId.add(TbServiceGroupPolicy.builder()
|
||||
.authGroupSeq(dto.getAuthGroupSeq())
|
||||
.serviceGroup(serviceGroup)
|
||||
.policyVal(EnumToMap.PolicyToParentMap.get(e))
|
||||
.custCode(dto.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
tbServiceGroupPolicyRepo.deleteByAuthGroupSeqAndPolicyValIn(dto.getAuthGroupSeq(), deleteVal);
|
||||
tbServiceGroupPolicyRepo.saveAll(insertId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<OprmngCodeRes> GroupInsertOpr() {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
if (uv.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) {
|
||||
return tbServiceGrouopRepo.findAll().stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build()).collect(Collectors.toList());
|
||||
} else {
|
||||
return tbServiceGrouopRepo.findByServiceGroupUpper(uv.getLastUseServiceGroup()).stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.DslDataTableRes;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.SystemPolicyMenuReq;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.SystemPolicyMenuRes;
|
||||
import com.icomsys.main_vm.common.code.enumresource.PolicyResource;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbCustPolicyRepo;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemPolicyMenuService {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final TbCustPolicyRepo tbCustPolicyRepo;
|
||||
|
||||
public DslDataTableRes<SystemPolicyMenuRes> PolicyMenuList(SystemPolicyMenuReq dto) {
|
||||
List<SystemPolicyMenuRes> result = tbCustPolicyRepo.PolicyMenuListQueryList(dto.ofUserVo(loginService.getUserVo()));
|
||||
|
||||
List<SystemPolicyMenuRes> filtering = result.stream().map(e ->
|
||||
SystemPolicyMenuRes.builder()
|
||||
.custCode(e.getCustCode())
|
||||
.custName(e.getCustName())
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.policyVal(e.getPolicyVal())
|
||||
.policyName(PolicyResource.valueOf(e.getPolicyVal()).getPolicyName())
|
||||
.menuName(PolicyResource.valueOf(e.getPolicyVal()).getMenu().getMenuName())
|
||||
.menuSeq(PolicyResource.valueOf(e.getPolicyVal()).getMenu().getMenuSeq())
|
||||
.build()
|
||||
)
|
||||
.filter(h -> {
|
||||
if (dto.getServiceGroup() != null && !dto.getServiceGroup().equals("") && !dto.getServiceGroup().equals("ALL")) {
|
||||
if (h.getServiceGroup().equals(dto.getServiceGroup())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.filter(f -> {
|
||||
if (dto.getCodeText1() != null && !dto.getCodeText1().equals("")
|
||||
) {
|
||||
if (f.getPolicyVal().toUpperCase().contains(dto.getCodeText1().trim().toUpperCase())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (dto.getCodeText2() != null && !dto.getCodeText2().equals("")
|
||||
) {
|
||||
if (f.getPolicyName().toUpperCase().contains(dto.getCodeText2().trim().toUpperCase())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (dto.getCodeText3() != null && !dto.getCodeText3().equals("")
|
||||
) {
|
||||
if (f.getMenuName().toUpperCase().contains(dto.getCodeText3().trim().toUpperCase())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new DslDataTableRes<SystemPolicyMenuRes>(
|
||||
filtering.stream().skip(dto.getSize() * dto.getPage())
|
||||
.limit(dto.getSize())
|
||||
.sorted(Comparator.comparing(SystemPolicyMenuRes::getMenuSeq)
|
||||
).collect(Collectors.toList())
|
||||
, Long.parseLong(String.valueOf(filtering.size()))
|
||||
, Long.parseLong(String.valueOf(dto.getSize()))
|
||||
, Long.parseLong(String.valueOf(dto.getSize() * dto.getPage())));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.common.code.code.UseYNCode;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbCustPolicy;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbIcsOprMngInfo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbCustPolicyId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.conversation.TbProjectSettingRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbCustPolicyRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbIcsOprMngInfoRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbServiceGrouopRepo;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.TbServiceGroupPolicyRepo;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SystemServiceGroupService {
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final TbCustPolicyRepo tbCustPolicyRepo;
|
||||
private final LoginService loginService;
|
||||
private final TbIcsOprMngInfoRepo tbIcsOprMngInfoRepo;
|
||||
private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo;
|
||||
private final TbProjectSettingRepo tbProjectSettingRepo;
|
||||
private final SystemCustService systemCustService;
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public QueryResults<SystemServiceGroupRes> ServiceGroupList(SystemServiceGroupReq dto) {
|
||||
QueryResults<SystemServiceGroupRes> result = tbServiceGrouopRepo.ServiceGroupList(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
public SystemServiceGroupViewRes ServiceGroupSelect() {
|
||||
return ServiceGroupSelect(loginService.getUserVo().getLastUseServiceGroup());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public SystemServiceGroupViewRes ServiceGroupSelect(String serviceGroup) {
|
||||
|
||||
SystemServiceGroupViewRes result = new SystemServiceGroupViewRes();
|
||||
List<SystemServiceGroupViewSubListRes> sub = new ArrayList<>();
|
||||
List<SystemServiceGroupViewVo> selectService = tbServiceGrouopRepo.getServiceGroupView(serviceGroup);
|
||||
|
||||
for (SystemServiceGroupViewVo e : selectService) {
|
||||
if (e.getServiceType().equals("M")) {
|
||||
List<String> pol = tbCustPolicyRepo.findByServiceGroup(e.getServiceGroup()).stream()
|
||||
.map(f -> f.getPolicyVal()).collect(Collectors.toList());
|
||||
result.setPolicyParent(loginService.jstreeParentConvertToPolicy());
|
||||
result.setMainPolicyVal(pol);
|
||||
result.setMainMenu(loginService.authToAuthList(pol, 10000000));
|
||||
result.setCustCode(e.getCustCode());
|
||||
result.setMainServiceGroup(e.getServiceGroup());
|
||||
result.setMainServiceGroupName(e.getServiceGroupName());
|
||||
result.setMainServiceGroupDesc(e.getServiceGroupDesc());
|
||||
result.setMainUseYn(e.getUseYn());
|
||||
result.setMainOprMngCode(e.getOprMngCode());
|
||||
}
|
||||
// else {
|
||||
sub.add(SystemServiceGroupViewSubListRes
|
||||
.builder()
|
||||
.subServiceGroup(e.getServiceGroup())
|
||||
.subServiceGroupName(e.getServiceGroupName())
|
||||
.subServiceGroupDesc(e.getServiceGroupDesc())
|
||||
.subUseYn(e.getUseYn())
|
||||
.subOprMngCode(e.getOprMngCode())
|
||||
.subPolicyVal(tbCustPolicyRepo.findByServiceGroup(e.getServiceGroup()).stream()
|
||||
.map(f -> f.getPolicyVal()).collect(Collectors.toList()))
|
||||
.build());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
result.setSubService(sub);
|
||||
// log.info(" servicegroup - {} ", new Gson().toJson(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<String> SelectPolicy(String serviceGroup) {
|
||||
return tbCustPolicyRepo.findByServiceGroup(serviceGroup).stream().map(e -> e.getPolicyVal()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void ServiceGroupUpdate(SystemServiceGroupUpdateReq dto) throws CustomNotFoundException {
|
||||
List<String> modifySubVal = new ArrayList<>();
|
||||
List<String> insertSubVal = new ArrayList<>();
|
||||
List<String> delVal = new ArrayList<>();
|
||||
List<TbCustPolicyId> deleId = new ArrayList<>();
|
||||
List<TbCustPolicy> insertId = new ArrayList<>();
|
||||
modifySubVal = dto.getSubPolicyVal();
|
||||
insertSubVal = dto.getSubPolicyVal();
|
||||
|
||||
log.info("system/serviceGroup/update - {}",new Gson().toJson(dto));
|
||||
|
||||
TbServiceGrouop tsg = tbServiceGrouopRepo.findByServiceGroup(dto.getSubServiceGroup()).orElseThrow(() -> new CustomNotFoundException()).toUpdateSubService(dto, loginService.getUserVo());
|
||||
|
||||
List<String> beforVal = tbCustPolicyRepo.findByServiceGroup(dto.getSubServiceGroup())
|
||||
.stream()
|
||||
.map(f -> f.getPolicyVal())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (String e : beforVal) {
|
||||
if (modifySubVal.contains(e)) {
|
||||
insertSubVal.remove(e);
|
||||
} else {
|
||||
delVal.add(e);
|
||||
deleId.add(TbCustPolicyId.builder()
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceGroup(dto.getSubServiceGroup())
|
||||
.policyVal(e)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
if (insertSubVal.size() > 0) {
|
||||
for (String e : insertSubVal) {
|
||||
insertId.add(TbCustPolicy.builder()
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceGroup(dto.getSubServiceGroup())
|
||||
.policyVal(e)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
tbCustPolicyRepo.deleteAllById(deleId);
|
||||
tbCustPolicyRepo.saveAll(insertId);
|
||||
tbServiceGroupPolicyRepo.deleteByServiceGroupAndPolicyValIn(dto.getSubServiceGroup(), delVal);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void ServiceGroupInsert(SystemServiceGroupUpdateReq dto) throws CustomNotFoundException {
|
||||
log.info("ServiceGroupInsert - {}", new Gson().toJson(dto));
|
||||
UserVo uv = loginService.getUserVo();
|
||||
tbServiceGrouopRepo.save(TbServiceGrouop.builder()
|
||||
.serviceGroup(dto.getSubServiceGroup().toUpperCase())
|
||||
.serviceGroupUpper(dto.getMainServiceGroup().toUpperCase())
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceType("S")
|
||||
.serviceGroupName(dto.getSubServiceGroupName())
|
||||
.serviceGroupDesc(dto.getSubServiceGroupDesc())
|
||||
.useYn(dto.getSubUseYn())
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
tbCustPolicyRepo.saveAll(dto.getSubPolicyVal().stream()
|
||||
.map(e -> TbCustPolicy.builder()
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceGroup(dto.getSubServiceGroup().toUpperCase())
|
||||
.policyVal(e)
|
||||
.build())
|
||||
.collect(Collectors.toList()));
|
||||
tbIcsOprMngInfoRepo.save(TbIcsOprMngInfo.builder()
|
||||
.custCode(dto.getCustCode())
|
||||
.serviceGroup(dto.getSubServiceGroup().toUpperCase())
|
||||
.oprMngCode(dto.getCustCode()+"_RCP_"+dto.getSubServiceGroup().toUpperCase())
|
||||
.solVal("RCP")
|
||||
.routeUrl("")
|
||||
.useYn(dto.getSubUseYn())
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
List<WisenutInsertReqVo> proSet = new ArrayList<>();
|
||||
proSet.add(WisenutInsertReqVo.builder()
|
||||
.oprMngCode(dto.getCustCode()+"_RCP_"+dto.getSubServiceGroup())
|
||||
.serviceGroupDesc(dto.getSubServiceGroupDesc())
|
||||
.build());
|
||||
tbProjectSettingRepo.saveAll(systemCustService.WisenutInsert(proSet));
|
||||
}
|
||||
|
||||
|
||||
public String ServiceGroupDoubleCheck(SystemServiceGroupUpdateReq dto) {
|
||||
log.info("ServiceGroupDoubleCheck - {}", new Gson().toJson(dto));
|
||||
if (tbServiceGrouopRepo.existsByCustCodeAndServiceGroup(dto.getCustCode(), dto.getSubServiceGroup().toUpperCase())) {
|
||||
return UseYNCode.N.name();
|
||||
} else {
|
||||
return UseYNCode.Y.name();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,344 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.SequenceService;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.enumresource.RoleResource;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.*;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserAuthGroupId;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserCustId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemUserAdminService {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final TbBotUserRepo tbBotUserRepo;
|
||||
private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final SequenceService sequenceService;
|
||||
private final TbUserAuthGroupRepo tbUserAuthGroupRepo;
|
||||
private final TbUserCustRepo tbUserCustRepo;
|
||||
private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo;
|
||||
private final TbIcsCustInfoRepo tbIcsCustInfoRepo;
|
||||
|
||||
public DslDataTableRes<SystemBotUserRes> SystemUserAdminList(SystemBotUserReq dto) {
|
||||
DslDataTableRes result = new DslDataTableRes(tbBotUserRepo.SystemUserList(dto.ofUserVo(loginService.getUserVo()), RoleResource.USERADMIN.getName()));
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<SystemBotUserAuthGroupListRes> UserAdminAuthGroupList(String serviceGroup) {
|
||||
return tbServiceAuthGroupRepo.findByServiceGroup(serviceGroup).stream().map(e ->
|
||||
SystemBotUserAuthGroupListRes.builder().authGroupSeq(e.getAuthGroupSeq()).policyGroupName(e.getPolicyGroupName()).build()
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public String UserDoubleCheck(String userId) {
|
||||
String useYn = "N";
|
||||
if (tbBotUserRepo.existsByUserId(userId)) {
|
||||
return useYn;
|
||||
} else {
|
||||
return useYn = "Y";
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void userAdminSave(SystemBotUserSaveReq dto) throws CustomNotFoundException {
|
||||
TbServiceGrouop result = tbServiceGrouopRepo.findByServiceGroup(dto.getAddServiceAuthList().get(0).getAddService())
|
||||
.stream().findFirst().orElseThrow(() -> new CustomNotFoundException());
|
||||
|
||||
String custCode = result.getCustCode();
|
||||
String upper = result.getServiceGroupUpper();
|
||||
|
||||
// TbBotUser userSaveResult = tbBotUserRepo.save(dto.toUserCreateSave(loginService.getUserVo(), passwordEncoder,
|
||||
// custCode, sequenceService.UserSeqNext(), upper));
|
||||
|
||||
|
||||
TbBotUser userSaveResult = tbBotUserRepo.save(dto.toUserCreateSave(loginService.getUserVo(), passwordEncoder,
|
||||
custCode, upper));
|
||||
|
||||
//유저어드민 저장시에 유저 커스트와 유저오쓰그룹을 추가해줘야함.
|
||||
//유저어드민 자동생성해줘야할것 TB_USER_AUTH_GROUP, TB_SERVICE_AUTH_GROUP, TB_SERVICE_GROUP_POLICY, TB_USER_CUST
|
||||
|
||||
List<TbUserAuthGroup> authList = new ArrayList<>();
|
||||
List<TbUserCust> userCusts = new ArrayList<>();
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
userCusts.add(TbUserCust.builder()
|
||||
.custCode(custCode)
|
||||
.userSeq(userSaveResult.getUserSeq())
|
||||
.serviceGroup(e.getAddService())
|
||||
.build());
|
||||
for (Long f : e.getAuthList()) {
|
||||
authList.add(TbUserAuthGroup.builder()
|
||||
.userSeq(userSaveResult.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e.getAddService())
|
||||
.custCode(custCode)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
log.info("authList saves - {}", new Gson().toJson(authList));
|
||||
tbUserAuthGroupRepo.saveAll(authList);
|
||||
tbUserCustRepo.saveAll(userCusts);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SystemBotUserViewRes UserAdminViewData(Long userSeq) throws CustomNotFoundException {
|
||||
|
||||
|
||||
TbBotUser tbu = tbBotUserRepo.findByUserSeqAndUseYn(userSeq, "Y").orElseThrow(() -> new CustomNotFoundException());
|
||||
|
||||
SystemBotUserViewRes result = new SystemBotUserViewRes();
|
||||
List<SystemBotUserViewSubRes> resultSub = new ArrayList<>();
|
||||
List<SystemBotUserAuthGroupListRes> baseAuth = new ArrayList<>();
|
||||
List<SystemBotUserAuthGroupListRes> useAuth = new ArrayList<>();
|
||||
|
||||
|
||||
result.setUserSeq(tbu.getUserSeq());
|
||||
result.setUserId(tbu.getUserId());
|
||||
result.setUserName(tbu.getUserName());
|
||||
result.setEMail(tbu.getEMail());
|
||||
result.setMobileNo(tbu.getMobileNo());
|
||||
result.setUseYn(tbu.getUseYn());
|
||||
result.setLoginCheck(tbu.getLoginCheck());
|
||||
result.setLastUseServiceGroup(tbu.getLastUseServiceGroup());
|
||||
result.setRoleVal(tbu.getRoleVal());
|
||||
result.setUseAuthSeq(tbUserAuthGroupRepo.findByUserSeq(userSeq).stream().map(f -> f.getAuthGroupSeq()).collect(Collectors.toList()));
|
||||
// List<SystemBotUserViewSubRes> base = tbUserAuthGroupRepo.userUseAuthGroup(userSeq);
|
||||
List<String> base = tbUserAuthGroupRepo.findByUserSeq(userSeq).stream().map(e -> e.getServiceGroup())
|
||||
.distinct()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (String e : base) {
|
||||
//그룹네임
|
||||
TbServiceGrouop sr = tbServiceGrouopRepo.findByServiceGroup(e).orElseThrow(() -> new CustomNotFoundException());
|
||||
List<SystemBotUserAuthGroupListRes> baseData = tbServiceAuthGroupRepo.findByServiceGroup(e)
|
||||
.stream()
|
||||
.map(f -> SystemBotUserAuthGroupListRes.builder()
|
||||
.authGroupSeq(f.getAuthGroupSeq())
|
||||
.policyGroupName(f.getPolicyGroupName())
|
||||
.build())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Long> baseSeqData = new ArrayList<>();
|
||||
for (SystemBotUserAuthGroupListRes g : baseData) {
|
||||
baseSeqData.add(g.getAuthGroupSeq());
|
||||
}
|
||||
resultSub.add(SystemBotUserViewSubRes.builder()
|
||||
.serviceGroup(sr.getServiceGroup())
|
||||
.serviceName(sr.getServiceGroupName())
|
||||
.baseAuthGroup(baseData)
|
||||
.baseSeq(baseSeqData)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
result.setUseServiceGroup(resultSub);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void userAdminUpdate(SystemBotUserUpdateReq dto) throws CustomNotFoundException {
|
||||
/*
|
||||
TbBotUser result = tbBotUserRepo.findById(dto.getUserSeq()).orElseThrow(() -> new CustomNotFoundException()).toUpdate(dto, loginService.getUserVo(), passwordEncoder);
|
||||
List<String> beforService = new ArrayList<>();
|
||||
List<String> baseService = new ArrayList<>();
|
||||
List<String> insertService = new ArrayList<>();
|
||||
List<TbUserAuthGroupId> delService = new ArrayList<>();
|
||||
List<TbUserCustId> delCust = new ArrayList<>();
|
||||
List<TbUserCust> insertCust = new ArrayList<>();
|
||||
List<Long> insertAuth = new ArrayList<>();
|
||||
List<TbUserAuthGroup> authSave = new ArrayList<>();
|
||||
Map<String, List<Long>> ServiceAuthSeqMap = new HashMap<>();
|
||||
//초기화
|
||||
beforService = tbUserAuthGroupRepo.findByUserSeq(dto.getUserSeq()).stream().map(e -> e.getServiceGroup())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//가지고있던 서비스그룹.
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
//맵초기화
|
||||
ServiceAuthSeqMap.put(e.getAddService(), new ArrayList<>(e.getAuthList()));
|
||||
baseService.add(e.getAddService());
|
||||
insertService.add(e.getAddService());
|
||||
}
|
||||
log.info("ServiceAuthSeqMap map data - {}", new Gson().toJson(ServiceAuthSeqMap));
|
||||
log.info("baseService - {}", new Gson().toJson(baseService));
|
||||
log.info("beforService map data - {}", new Gson().toJson(beforService));
|
||||
//서비스그룹의 수량변화가 있는지 확인한다.
|
||||
for (String e : baseService) {
|
||||
//비교해서 인서트 리스트에 남는건 새로추가한목록.
|
||||
if (beforService.contains(e)) {
|
||||
insertService.remove(e);
|
||||
List<Long> authBase = new ArrayList<>();
|
||||
List<Long> authInsert = new ArrayList<>();
|
||||
authInsert = ServiceAuthSeqMap.get(e);
|
||||
authBase = ServiceAuthSeqMap.get(e);
|
||||
//해당 서비스의 그룹권한의 시퀀스가 변했는지 확인한다.
|
||||
List<Long> authBefor = tbUserAuthGroupRepo.findByUserSeqAndServiceGroupAndCustCode(result.getUserSeq(), e, result.getCustCode())
|
||||
.stream().map(f -> f.getAuthGroupSeq())
|
||||
.collect(Collectors.toList());
|
||||
log.info("authBefor 검사 기존값 = {}", new Gson().toJson(authBefor));
|
||||
for (Long g : authBase) {
|
||||
if (authBefor.contains(e)) {
|
||||
authInsert.remove(g);
|
||||
} else {
|
||||
log.info("다 델리트로 들어가니?" + e);
|
||||
delService.add(TbUserAuthGroupId.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(g)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
authInsert.removeAll(authBefor);
|
||||
log.info("authInsert 지워진값확인 = {}", new Gson().toJson(authInsert));
|
||||
for (Long h : authInsert) {
|
||||
log.info("추가 권한" + h);
|
||||
authSave.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(h)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
} else {
|
||||
//없는건 삭제리스트
|
||||
List<TbUserAuthGroup> delAuthSeq = tbUserAuthGroupRepo.findByUserSeqAndServiceGroupAndCustCode(result.getUserSeq(), e, result.getCustCode());
|
||||
log.info("delAuthSeq - {}", new Gson().toJson(delAuthSeq));
|
||||
for (TbUserAuthGroup f : delAuthSeq) {
|
||||
log.info("삭제 권한" + f);
|
||||
delService.add(TbUserAuthGroupId.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f.getAuthGroupSeq())
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
log.info("삭제 커스트" + e);
|
||||
delCust.add(TbUserCustId.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.userSeq(dto.getUserSeq())
|
||||
.serviceGroup(e)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
//인서트 서비스와 권한을 추가해준다.
|
||||
for (String e : insertService) {
|
||||
insertCust.add(TbUserCust.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.serviceGroup(e)
|
||||
.userSeq(dto.getUserSeq())
|
||||
.build());
|
||||
log.info("추가 유저 커스트" + e);
|
||||
for (Long f : ServiceAuthSeqMap.get(e)) {
|
||||
log.info("추가 유저 권한그룹" + f);
|
||||
authSave.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
log.info("authSaveList - {}", new Gson().toJson(authSave));
|
||||
log.info("delServiceList - {}", new Gson().toJson(delService));
|
||||
tbUserCustRepo.saveAll(insertCust);
|
||||
tbUserCustRepo.deleteAllById(delCust);
|
||||
tbUserAuthGroupRepo.deleteAllById(delService);
|
||||
tbUserAuthGroupRepo.saveAll(authSave);
|
||||
*/
|
||||
|
||||
TbBotUser result = tbBotUserRepo.findById(dto.getUserSeq()).orElseThrow(() -> new CustomNotFoundException()).toUpdate(dto, loginService.getUserVo(), passwordEncoder);
|
||||
List<TbUserCustId> delCustList = tbUserCustRepo.findByUserSeq(dto.getUserSeq()).stream()
|
||||
.map(e -> TbUserCustId.builder()
|
||||
.custCode(e.getCustCode())
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.userSeq(e.getUserSeq())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<TbUserAuthGroupId> delAuthGroupList = tbUserAuthGroupRepo.findByUserSeq(dto.getUserSeq()).stream()
|
||||
.map(e -> TbUserAuthGroupId.builder()
|
||||
.userSeq(e.getUserSeq())
|
||||
.authGroupSeq(e.getAuthGroupSeq())
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.custCode(e.getCustCode())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<TbUserCust> insertCustList = new ArrayList<>();
|
||||
List<TbUserAuthGroup> insertAuthGorupList = new ArrayList<>();
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
insertCustList.add(TbUserCust.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.serviceGroup(e.getAddService())
|
||||
.userSeq(dto.getUserSeq())
|
||||
.build());
|
||||
for (Long f : e.getAuthList()) {
|
||||
insertAuthGorupList.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e.getAddService())
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
tbUserCustRepo.deleteAllById(delCustList);
|
||||
tbUserAuthGroupRepo.deleteAllById(delAuthGroupList);
|
||||
tbUserCustRepo.saveAll(insertCustList);
|
||||
tbUserAuthGroupRepo.saveAll(insertAuthGorupList);
|
||||
}
|
||||
|
||||
public List<SystemBotUserCustRes> UserAdminCustList() throws CustomNotFoundException {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
List<SystemBotUserCustRes> result = new ArrayList<>();
|
||||
if (uv.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) {
|
||||
return result = tbIcsCustInfoRepo.findAll().stream().map(e -> SystemBotUserCustRes.builder()
|
||||
.custCode(e.getCustCode())
|
||||
.custName(e.getCustName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
TbIcsCustInfo adminresult = tbIcsCustInfoRepo.findById(uv.getCustCode()).orElseThrow(() -> new CustomNotFoundException());
|
||||
result.add(SystemBotUserCustRes.builder()
|
||||
.custCode(adminresult.getCustCode())
|
||||
.custName(adminresult.getCustName())
|
||||
.build());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public List<OprmngCodeRes> UserAdminServiceList(String cust) {
|
||||
return tbServiceGrouopRepo.findByCustCodeAndServiceType(cust, "M").stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,358 @@
|
||||
package com.icomsys.main_vm.biz.common.system.service;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.icomsys.main_vm.biz.advice.excep.CustomNotFoundException;
|
||||
import com.icomsys.main_vm.biz.common.common.service.SequenceService;
|
||||
import com.icomsys.main_vm.biz.common.login.res.OprmngCodeRes;
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.biz.common.login.service.LoginService;
|
||||
import com.icomsys.main_vm.biz.common.system.vo.*;
|
||||
import com.icomsys.main_vm.common.code.enumresource.RoleResource;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.*;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserAuthGroupId;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbUserCustId;
|
||||
import com.icomsys.main_vm.db.jpa.repo.system.*;
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class SystemUserService {
|
||||
|
||||
private final LoginService loginService;
|
||||
private final TbBotUserRepo tbBotUserRepo;
|
||||
private final TbServiceAuthGroupRepo tbServiceAuthGroupRepo;
|
||||
private final TbServiceGrouopRepo tbServiceGrouopRepo;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final SequenceService sequenceService;
|
||||
private final TbUserAuthGroupRepo tbUserAuthGroupRepo;
|
||||
private final TbUserCustRepo tbUserCustRepo;
|
||||
private final TbServiceGroupPolicyRepo tbServiceGroupPolicyRepo;
|
||||
private final TbIcsCustInfoRepo tbIcsCustInfoRepo;
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public QueryResults<SystemBotUserRes> SystemUserList(SystemBotUserReq dto) {
|
||||
log.info("SystemUserList uv - {}", new Gson().toJson(loginService.getUserVo()));
|
||||
QueryResults<SystemBotUserRes> result = tbBotUserRepo.SystemUserList(dto.ofUserVo(loginService.getUserVo()), RoleResource.USER.getName());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<SystemBotUserAuthGroupListRes> UserAuthGroupList(String serviceGroup) {
|
||||
return tbServiceAuthGroupRepo.findByServiceGroup(serviceGroup).stream().map(e ->
|
||||
SystemBotUserAuthGroupListRes.builder().authGroupSeq(e.getAuthGroupSeq()).policyGroupName(e.getPolicyGroupName()).build()
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public String UserDoubleCheck(String userId) {
|
||||
String useYn = "N";
|
||||
if (tbBotUserRepo.existsByUserId(userId)) {
|
||||
return useYn;
|
||||
} else {
|
||||
return useYn = "Y";
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void userSave(SystemBotUserSaveReq dto) throws CustomNotFoundException {
|
||||
TbServiceGrouop result = tbServiceGrouopRepo.findByServiceGroup(dto.getAddServiceAuthList().get(0).getAddService())
|
||||
.stream().findFirst().orElseThrow(() -> new CustomNotFoundException());
|
||||
|
||||
String custCode = result.getCustCode();
|
||||
String upper = result.getServiceGroupUpper();
|
||||
|
||||
TbBotUser userSaveResult = tbBotUserRepo.save(dto.toUserCreateSave(loginService.getUserVo(), passwordEncoder,
|
||||
custCode, upper));
|
||||
|
||||
List<TbUserAuthGroup> authList = new ArrayList<>();
|
||||
List<TbUserCust> userCusts = new ArrayList<>();
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
userCusts.add(TbUserCust.builder()
|
||||
.custCode(custCode)
|
||||
.userSeq(userSaveResult.getUserSeq())
|
||||
.serviceGroup(e.getAddService())
|
||||
.build());
|
||||
for (Long f : e.getAuthList()) {
|
||||
authList.add(TbUserAuthGroup.builder()
|
||||
.userSeq(userSaveResult.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e.getAddService())
|
||||
.custCode(custCode)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("authList saves - {}", new Gson().toJson(authList));
|
||||
tbUserAuthGroupRepo.saveAll(authList);
|
||||
tbUserCustRepo.saveAll(userCusts);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public SystemBotUserViewRes UserViewData(Long userSeq) throws CustomNotFoundException {
|
||||
|
||||
|
||||
TbBotUser tbu = tbBotUserRepo.findByUserSeq(userSeq).orElseThrow(() -> new CustomNotFoundException());
|
||||
|
||||
SystemBotUserViewRes result = new SystemBotUserViewRes();
|
||||
List<SystemBotUserViewSubRes> resultSub = new ArrayList<>();
|
||||
List<SystemBotUserAuthGroupListRes> baseAuth = new ArrayList<>();
|
||||
List<SystemBotUserAuthGroupListRes> useAuth = new ArrayList<>();
|
||||
|
||||
|
||||
result.setUserSeq(tbu.getUserSeq());
|
||||
result.setUserId(tbu.getUserId());
|
||||
result.setUserName(tbu.getUserName());
|
||||
result.setEMail(tbu.getEMail());
|
||||
result.setMobileNo(tbu.getMobileNo());
|
||||
result.setUseYn(tbu.getUseYn());
|
||||
result.setLoginCheck(tbu.getLoginCheck());
|
||||
result.setLastUseServiceGroup(tbu.getLastUseServiceGroup());
|
||||
result.setRoleVal(tbu.getRoleVal());
|
||||
result.setUseAuthSeq(tbUserAuthGroupRepo.findByUserSeq(userSeq).stream().map(f -> f.getAuthGroupSeq()).collect(Collectors.toList()));
|
||||
// List<SystemBotUserViewSubRes> base = tbUserAuthGroupRepo.userUseAuthGroup(userSeq);
|
||||
List<String> base = tbUserAuthGroupRepo.findByUserSeq(userSeq).stream().map(e -> e.getServiceGroup())
|
||||
.distinct()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (String e : base) {
|
||||
//그룹네임
|
||||
TbServiceGrouop sr = tbServiceGrouopRepo.findByServiceGroup(e).orElseThrow(() -> new CustomNotFoundException());
|
||||
List<SystemBotUserAuthGroupListRes> baseData = tbServiceAuthGroupRepo.findByServiceGroup(e)
|
||||
.stream()
|
||||
.map(f -> SystemBotUserAuthGroupListRes.builder()
|
||||
.authGroupSeq(f.getAuthGroupSeq())
|
||||
.policyGroupName(f.getPolicyGroupName())
|
||||
.build())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<Long> baseSeqData = new ArrayList<>();
|
||||
for (SystemBotUserAuthGroupListRes g : baseData) {
|
||||
baseSeqData.add(g.getAuthGroupSeq());
|
||||
}
|
||||
resultSub.add(SystemBotUserViewSubRes.builder()
|
||||
.serviceGroup(sr.getServiceGroup())
|
||||
.serviceName(sr.getServiceGroupName())
|
||||
.baseAuthGroup(baseData)
|
||||
.baseSeq(baseSeqData)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
result.setUseServiceGroup(resultSub);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public void userUpdate(SystemBotUserUpdateReq dto) throws CustomNotFoundException {
|
||||
/*
|
||||
TbBotUser result = tbBotUserRepo.findById(dto.getUserSeq()).orElseThrow(() -> new CustomNotFoundException()).toUpdate(dto, loginService.getUserVo(), passwordEncoder);
|
||||
List<String> beforService = new ArrayList<>();
|
||||
List<String> baseService = new ArrayList<>();
|
||||
List<String> insertService = new ArrayList<>();
|
||||
List<TbUserAuthGroupId> delService = new ArrayList<>();
|
||||
List<TbUserCustId> delCust = new ArrayList<>();
|
||||
List<TbUserCust> insertCust = new ArrayList<>();
|
||||
List<Long> insertAuth = new ArrayList<>();
|
||||
List<TbUserAuthGroup> authSave = new ArrayList<>();
|
||||
Map<String, List<Long>> ServiceAuthSeqMap = new HashMap<>();
|
||||
//초기화
|
||||
beforService = tbUserAuthGroupRepo.findByUserSeq(dto.getUserSeq()).stream().map(e -> e.getServiceGroup())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
//가지고있던 서비스그룹.
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
//맵초기화
|
||||
ServiceAuthSeqMap.put(e.getAddService(), new ArrayList<>(e.getAuthList()));
|
||||
baseService.add(e.getAddService());
|
||||
insertService.add(e.getAddService());
|
||||
}
|
||||
log.info("ServiceAuthSeqMap map data - {}", new Gson().toJson(ServiceAuthSeqMap));
|
||||
log.info("baseService - {}", new Gson().toJson(baseService));
|
||||
log.info("beforService map data - {}", new Gson().toJson(beforService));
|
||||
//서비스그룹의 수량변화가 있는지 확인한다.
|
||||
for (String e : baseService) {
|
||||
//비교해서 인서트 리스트에 남는건 새로추가한목록.
|
||||
if (beforService.contains(e)) {
|
||||
insertService.remove(e);
|
||||
List<Long> authBase = new ArrayList<>();
|
||||
List<Long> authInsert = new ArrayList<>();
|
||||
authInsert = ServiceAuthSeqMap.get(e);
|
||||
authBase = ServiceAuthSeqMap.get(e);
|
||||
//해당 서비스의 그룹권한의 시퀀스가 변했는지 확인한다.
|
||||
List<Long> authBefor = tbUserAuthGroupRepo.findByUserSeqAndServiceGroupAndCustCode(result.getUserSeq(), e, result.getCustCode())
|
||||
.stream().map(f -> f.getAuthGroupSeq())
|
||||
.collect(Collectors.toList());
|
||||
log.info("authBefor 검사 기존값 = {}", new Gson().toJson(authBefor));
|
||||
for (Long g : authBase) {
|
||||
if (authBefor.contains(e)) {
|
||||
authInsert.remove(g);
|
||||
} else {
|
||||
log.info("다 델리트로 들어가니?" + e);
|
||||
delService.add(TbUserAuthGroupId.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(g)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
authInsert.removeAll(authBefor);
|
||||
log.info("authInsert 지워진값확인 = {}", new Gson().toJson(authInsert));
|
||||
for (Long h : authInsert) {
|
||||
log.info("추가 권한" + h);
|
||||
authSave.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(h)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
} else {
|
||||
//없는건 삭제리스트
|
||||
List<TbUserAuthGroup> delAuthSeq = tbUserAuthGroupRepo.findByUserSeqAndServiceGroupAndCustCode(result.getUserSeq(), e, result.getCustCode());
|
||||
log.info("delAuthSeq - {}", new Gson().toJson(delAuthSeq));
|
||||
for (TbUserAuthGroup f : delAuthSeq) {
|
||||
log.info("삭제 권한" + f);
|
||||
delService.add(TbUserAuthGroupId.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f.getAuthGroupSeq())
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
log.info("삭제 커스트" + e);
|
||||
delCust.add(TbUserCustId.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.userSeq(dto.getUserSeq())
|
||||
.serviceGroup(e)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
//인서트 서비스와 권한을 추가해준다.
|
||||
for (String e : insertService) {
|
||||
insertCust.add(TbUserCust.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.serviceGroup(e)
|
||||
.userSeq(dto.getUserSeq())
|
||||
.build());
|
||||
log.info("추가 유저 커스트" + e);
|
||||
for (Long f : ServiceAuthSeqMap.get(e)) {
|
||||
log.info("추가 유저 권한그룹" + f);
|
||||
authSave.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e)
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
log.info("authSaveList - {}", new Gson().toJson(authSave));
|
||||
log.info("delServiceList - {}", new Gson().toJson(delService));
|
||||
tbUserCustRepo.saveAll(insertCust);
|
||||
tbUserCustRepo.deleteAllById(delCust);
|
||||
tbUserAuthGroupRepo.deleteAllById(delService);
|
||||
tbUserAuthGroupRepo.saveAll(authSave);
|
||||
*/
|
||||
|
||||
TbBotUser result = tbBotUserRepo.findById(dto.getUserSeq()).orElseThrow(() -> new CustomNotFoundException()).toUpdate(dto, loginService.getUserVo(), passwordEncoder);
|
||||
List<TbUserCustId> delCustList = tbUserCustRepo.findByUserSeq(dto.getUserSeq()).stream()
|
||||
.map(e -> TbUserCustId.builder()
|
||||
.custCode(e.getCustCode())
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.userSeq(e.getUserSeq())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<TbUserAuthGroupId> delAuthGroupList = tbUserAuthGroupRepo.findByUserSeq(dto.getUserSeq()).stream()
|
||||
.map(e -> TbUserAuthGroupId.builder()
|
||||
.userSeq(e.getUserSeq())
|
||||
.authGroupSeq(e.getAuthGroupSeq())
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.custCode(e.getCustCode())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<TbUserCust> insertCustList = new ArrayList<>();
|
||||
List<TbUserAuthGroup> insertAuthGorupList = new ArrayList<>();
|
||||
for (addServiceAuthList e : dto.getAddServiceAuthList()) {
|
||||
insertCustList.add(TbUserCust.builder()
|
||||
.custCode(result.getCustCode())
|
||||
.serviceGroup(e.getAddService())
|
||||
.userSeq(dto.getUserSeq())
|
||||
.build());
|
||||
for (Long f : e.getAuthList()) {
|
||||
insertAuthGorupList.add(TbUserAuthGroup.builder()
|
||||
.userSeq(dto.getUserSeq())
|
||||
.authGroupSeq(f)
|
||||
.serviceGroup(e.getAddService())
|
||||
.custCode(result.getCustCode())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
tbUserCustRepo.deleteAllById(delCustList);
|
||||
tbUserAuthGroupRepo.deleteAllById(delAuthGroupList);
|
||||
tbUserCustRepo.saveAll(insertCustList);
|
||||
tbUserAuthGroupRepo.saveAll(insertAuthGorupList);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<SystemBotUserCustRes> UserCustList() throws CustomNotFoundException {
|
||||
UserVo uv = loginService.getUserVo();
|
||||
List<SystemBotUserCustRes> result = new ArrayList<>();
|
||||
if (uv.getRoleVal().equals(RoleResource.SYSTEMADMIN.getName())) {
|
||||
result = tbIcsCustInfoRepo.findAll().stream().map(e -> SystemBotUserCustRes.builder()
|
||||
.custCode(e.getCustCode())
|
||||
.custName(e.getCustName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
return result;
|
||||
} else {
|
||||
TbIcsCustInfo adminresult = tbIcsCustInfoRepo.findById(uv.getCustCode()).orElseThrow(() -> new CustomNotFoundException());
|
||||
result.add(SystemBotUserCustRes.builder()
|
||||
.custCode(adminresult.getCustCode())
|
||||
.custName(adminresult.getCustName())
|
||||
.build());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public List<OprmngCodeRes> UserServiceList(String cust) {
|
||||
|
||||
// return tbServiceGrouopRepo.findByCustCodeAndServiceType(cust, "S").stream().map(e -> OprmngCodeRes.builder()
|
||||
// .serviceGroup(e.getServiceGroup())
|
||||
// .serviceGroupName(e.getServiceGroupName())
|
||||
// .build()).collect(Collectors.toList());
|
||||
return tbServiceGrouopRepo.findByCustCode(cust).stream().map(e -> OprmngCodeRes.builder()
|
||||
.serviceGroup(e.getServiceGroup())
|
||||
.serviceGroupName(e.getServiceGroupName())
|
||||
.build()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void UserCheckReset(Long userSeq) throws CustomNotFoundException {
|
||||
TbBotUser tub = tbBotUserRepo.findByUserSeq(userSeq)
|
||||
.orElseThrow(()-> new CustomNotFoundException())
|
||||
.resetLoginFailCheck();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.querydsl.core.QueryResults;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class DslDataTableRes<T> {
|
||||
|
||||
private List<T> getList;
|
||||
private Long getTotal;
|
||||
private Long getLimit;
|
||||
private Long getOffset;
|
||||
|
||||
public DslDataTableRes(QueryResults<T> dslResult) {
|
||||
// this.dslResult = dslResult;
|
||||
this.getList = dslResult.getResults();
|
||||
this.getTotal = dslResult.getTotal();
|
||||
this.getLimit = dslResult.getLimit();
|
||||
this.getOffset = dslResult.getOffset();
|
||||
}
|
||||
|
||||
public DslDataTableRes(QueryResults<T> dslResult, List<T> data) {
|
||||
this.getList = data;
|
||||
this.getTotal = dslResult.getTotal();
|
||||
this.getLimit = dslResult.getLimit();
|
||||
this.getOffset = dslResult.getOffset();
|
||||
}
|
||||
|
||||
public DslDataTableRes(List<T> data, Long total, Long limit, Long offset ) {
|
||||
this.getList = data;
|
||||
this.getTotal = total;
|
||||
this.getLimit = limit;
|
||||
this.getOffset = offset;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class SystemBotTtsTagRes {
|
||||
|
||||
private String codeName;
|
||||
private String attribute1;
|
||||
private String attribute2;
|
||||
|
||||
private String ttsProdCode;
|
||||
private String tagCode;
|
||||
private String ttsStartTag;
|
||||
private String ttsEndTag;
|
||||
private String registId;
|
||||
private LocalDateTime registDate;
|
||||
private String updateId;
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotTtsTagVo {
|
||||
|
||||
private String ttsProdCode;
|
||||
private String tagCode;
|
||||
private String ttsStartTag;
|
||||
private String ttsEndTag;
|
||||
private String registId;
|
||||
private LocalDateTime registDate;
|
||||
private String updateId;
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserAuthGroupListRes {
|
||||
|
||||
|
||||
private Long authGroupSeq;
|
||||
private String policyGroupName;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserAuthGroupListRes(Long authGroupSeq, String policyGroupName) {
|
||||
this.authGroupSeq = authGroupSeq;
|
||||
this.policyGroupName = policyGroupName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserCustRes {
|
||||
|
||||
private String custCode;
|
||||
private String custName;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserCustRes(String custCode, String custName) {
|
||||
this.custCode = custCode;
|
||||
this.custName = custName;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserDoubleCheckReq {
|
||||
|
||||
private String serviceGroup;
|
||||
private String userId;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserDoubleCheckReq(String serviceGroup, String userId) {
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserReq {
|
||||
|
||||
private int size;
|
||||
private int page;
|
||||
private String custCode;
|
||||
private String codeType;
|
||||
private String codeText;
|
||||
private UserVo userVo;
|
||||
|
||||
public SystemBotUserReq ofUserVo(UserVo userVo){
|
||||
this.userVo = userVo;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserRes {
|
||||
|
||||
private String custCode;
|
||||
private String custName;
|
||||
// private String serviceGroup;
|
||||
// private String serviceGroupName;
|
||||
private Long userSeq;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String eMail;
|
||||
private String mobileNo;
|
||||
private String useYn;
|
||||
private LocalDateTime registDate;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserRes(String custCode, String custName, Long userSeq, String userId, String userName, String eMail, String mobileNo, String useYn, LocalDateTime registDate) {
|
||||
this.custCode = custCode;
|
||||
this.custName = custName;
|
||||
this.userSeq = userSeq;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.eMail = eMail;
|
||||
this.mobileNo = mobileNo;
|
||||
this.useYn = useYn;
|
||||
this.registDate = registDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserSaveReq {
|
||||
|
||||
private String lastUseServiceGroup;
|
||||
private String userId;
|
||||
private String pass;
|
||||
private String userName;
|
||||
private String useYn;
|
||||
private String userMail;
|
||||
private String userMobile;
|
||||
private String roleVal;
|
||||
private List<addServiceAuthList> addServiceAuthList;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserSaveReq(String lastUseServiceGroup, String userId, String pass, String userName, String useYn, String userMail, String userMobile, String roleVal, List<com.icomsys.main_vm.biz.common.system.vo.addServiceAuthList> addServiceAuthList) {
|
||||
this.lastUseServiceGroup = lastUseServiceGroup;
|
||||
this.userId = userId;
|
||||
this.pass = pass;
|
||||
this.userName = userName;
|
||||
this.useYn = useYn;
|
||||
this.userMail = userMail;
|
||||
this.userMobile = userMobile;
|
||||
this.roleVal = roleVal;
|
||||
this.addServiceAuthList = addServiceAuthList;
|
||||
}
|
||||
|
||||
// public TbBotUser toUserCreateSave(UserVo uv, PasswordEncoder pe, String custCode, Long seq, String upper) {
|
||||
// return TbBotUser.builder()
|
||||
// .userSeq(seq)
|
||||
// .custCode(custCode)
|
||||
// .lastUseServiceGroup(upper)
|
||||
// .roleVal(this.roleVal)
|
||||
// .userId(this.userId)
|
||||
// .password(pe.encode(this.pass))
|
||||
// .userName(this.userName)
|
||||
// .eMail(this.userMail)
|
||||
// .mobileNo(this.userMobile)
|
||||
// .loginCheck(0)
|
||||
// .useYn(this.useYn)
|
||||
// .registId(uv.getUserId())
|
||||
// .registDate(LocalDateTime.now())
|
||||
// .updateId(uv.getUserId())
|
||||
// .updateDate(LocalDateTime.now())
|
||||
// .build();
|
||||
//
|
||||
// }
|
||||
|
||||
public TbBotUser toUserCreateSave(UserVo uv, PasswordEncoder pe, String custCode, String upper) {
|
||||
return TbBotUser.builder()
|
||||
.custCode(custCode)
|
||||
.lastUseServiceGroup(upper)
|
||||
.roleVal(this.roleVal)
|
||||
.userId(this.userId)
|
||||
.password(pe.encode(this.pass))
|
||||
.userName(this.userName)
|
||||
.eMail(this.userMail)
|
||||
.mobileNo(this.userMobile)
|
||||
.loginCheck(0)
|
||||
.useYn(this.useYn)
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotUser;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserUpdateReq {
|
||||
|
||||
private Long userSeq;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String userPass;
|
||||
private String mobileNo;
|
||||
private String useYn;
|
||||
private int loginCheck;
|
||||
private String email;
|
||||
private String roleVal;
|
||||
private List<addServiceAuthList> addServiceAuthList;
|
||||
|
||||
@Builder
|
||||
public SystemBotUserUpdateReq(Long userSeq, String userId, String userName, String mobileNo, String useYn, int loginCheck, String email, String roleVal, List<com.icomsys.main_vm.biz.common.system.vo.addServiceAuthList> addServiceAuthList) {
|
||||
this.userSeq = userSeq;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.mobileNo = mobileNo;
|
||||
this.useYn = useYn;
|
||||
this.loginCheck = loginCheck;
|
||||
this.email = email;
|
||||
this.roleVal = roleVal;
|
||||
this.addServiceAuthList = addServiceAuthList;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserViewRes {
|
||||
|
||||
// private String custCode;
|
||||
// private String custName;
|
||||
private Long userSeq;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String eMail;
|
||||
private String mobileNo;
|
||||
private String useYn;
|
||||
private int loginCheck;
|
||||
private String lastUseServiceGroup;
|
||||
private String roleVal;
|
||||
private List<SystemBotUserViewSubRes> useServiceGroup;
|
||||
private List<Long> useAuthSeq;
|
||||
|
||||
|
||||
|
||||
@Builder
|
||||
public SystemBotUserViewRes(Long userSeq, String userId, String userName, String eMail, String mobileNo, String useYn, int loginCheck, String lastUseServiceGroup, String roleVal, List<SystemBotUserViewSubRes> useServiceGroup) {
|
||||
this.userSeq = userSeq;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.eMail = eMail;
|
||||
this.mobileNo = mobileNo;
|
||||
this.useYn = useYn;
|
||||
this.loginCheck = loginCheck;
|
||||
this.lastUseServiceGroup = lastUseServiceGroup;
|
||||
this.roleVal = roleVal;
|
||||
this.useServiceGroup = useServiceGroup;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemBotUserViewSubRes {
|
||||
|
||||
private String serviceGroup;
|
||||
private String serviceName;
|
||||
private List<SystemBotUserAuthGroupListRes> baseAuthGroup;
|
||||
private List<Long> baseSeq;
|
||||
|
||||
|
||||
@Builder
|
||||
public SystemBotUserViewSubRes(String serviceGroup, String serviceName, List<SystemBotUserAuthGroupListRes> baseAuthGroup, List<Long> baseSeq) {
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceName = serviceName;
|
||||
this.baseAuthGroup = baseAuthGroup;
|
||||
this.baseSeq = baseSeq;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCommonCodeDeleteReq {
|
||||
|
||||
private String custCode;
|
||||
private String serviceGroup;
|
||||
private String minorCode;
|
||||
private String majorCode;
|
||||
|
||||
|
||||
public TbBotCommonCodeId delId(){
|
||||
return TbBotCommonCodeId.builder()
|
||||
.custCode(this.custCode)
|
||||
.oprMngCode(this.custCode+"_RCP_"+this.serviceGroup)
|
||||
.majorCode(this.majorCode)
|
||||
.minorCode(this.minorCode)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCommoncodeInsertReq {
|
||||
private String serviceGroup;
|
||||
private String major;
|
||||
private String minor;
|
||||
private String codeName;
|
||||
private String attribute1;
|
||||
private String attribute2;
|
||||
private String attribute3;
|
||||
|
||||
public TbBotCommonCode ofSave(UserVo userVo, String custCode) {
|
||||
return TbBotCommonCode.builder()
|
||||
.custCode(custCode)
|
||||
.minorCode(this.minor)
|
||||
.majorCode(this.major)
|
||||
.oprMngCode(userVo.getCustCode() + "_RCP_" + this.serviceGroup)
|
||||
.codeName(this.codeName)
|
||||
.attribute1(this.attribute1)
|
||||
.attribute2(this.attribute2)
|
||||
.attribute3(this.attribute3)
|
||||
.registId(userVo.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(userVo.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
public TbBotCommonCode ofSave(UserVo userVo, String custCode, String mainServiceGroup) {
|
||||
return TbBotCommonCode.builder()
|
||||
.custCode(custCode)
|
||||
.minorCode(this.minor)
|
||||
.majorCode(this.major)
|
||||
.oprMngCode(userVo.getCustCode() + "_RCP_" + mainServiceGroup)
|
||||
.codeName(this.codeName)
|
||||
.attribute1(this.attribute1)
|
||||
.attribute2(this.attribute2)
|
||||
.attribute3(this.attribute3)
|
||||
.registId(userVo.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(userVo.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
public List<TbBotCommonCode> ofSaveAll(UserVo userVo, List<String> services) {
|
||||
List<TbBotCommonCode> result = new ArrayList<>();
|
||||
for (String e : services) {
|
||||
result.add(TbBotCommonCode.builder()
|
||||
.minorCode(this.minor)
|
||||
.majorCode(this.major)
|
||||
.oprMngCode(userVo.getCustCode() + "_" + "RCP_" + e)
|
||||
.codeName(this.codeName)
|
||||
.attribute1(this.attribute1)
|
||||
.attribute2(this.attribute2)
|
||||
.attribute3(this.attribute3)
|
||||
.registId(userVo.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(userVo.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getOpr(UserVo userVo) {
|
||||
return userVo.getCustCode() + "_" + "RCP_" + this.serviceGroup;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCommoncodeReq {
|
||||
|
||||
//조회용
|
||||
private int size;
|
||||
private int page;
|
||||
private String oprmngCode;
|
||||
private String serviceGroup;
|
||||
private String codeType;
|
||||
private String codeText;
|
||||
private UserVo userVo;
|
||||
|
||||
public SystemCommoncodeReq ofUserVo(UserVo userVo){
|
||||
this.userVo = userVo;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCommoncodeRes {
|
||||
|
||||
private String custCode;
|
||||
private String serviceGroupName;
|
||||
private String serviceGroup;
|
||||
private String oprMngCode;
|
||||
private String minorCode;
|
||||
private String majorCode;
|
||||
private String codeName;
|
||||
private String attribute1;
|
||||
private String attribute2;
|
||||
private String attribute3;
|
||||
|
||||
@Builder
|
||||
public SystemCommoncodeRes(String custCode, String serviceGroupName, String serviceGroup, String oprMngCode, String minorCode, String majorCode, String codeName, String attribute1, String attribute2, String attribute3) {
|
||||
this.custCode = custCode;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.oprMngCode = oprMngCode;
|
||||
this.minorCode = minorCode;
|
||||
this.majorCode = majorCode;
|
||||
this.codeName = codeName;
|
||||
this.attribute1 = attribute1;
|
||||
this.attribute2 = attribute2;
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbBotCommonCode;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.id.TbBotCommonCodeId;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCommoncodeUpdateReq {
|
||||
|
||||
private String custCode;
|
||||
private String serviceGroupName;
|
||||
private String serviceGroup;
|
||||
private String oprMngCode;
|
||||
private String minorCode;
|
||||
private String majorCode;
|
||||
private String codeName;
|
||||
private String attribute1;
|
||||
private String attribute2;
|
||||
private String attribute3;
|
||||
|
||||
public SystemCommoncodeUpdateReq(String custCode, String serviceGroupName, String serviceGroup, String oprMngCode, String minorCode, String majorCode, String codeName, String attribute1, String attribute2, String attribute3) {
|
||||
this.custCode = custCode;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.oprMngCode = oprMngCode;
|
||||
this.minorCode = minorCode;
|
||||
this.majorCode = majorCode;
|
||||
this.codeName = codeName;
|
||||
this.attribute1 = attribute1;
|
||||
this.attribute2 = attribute2;
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
|
||||
public TbBotCommonCodeId toId() {
|
||||
return TbBotCommonCodeId.builder()
|
||||
.custCode(this.custCode)
|
||||
.oprMngCode(this.oprMngCode)
|
||||
.majorCode(this.majorCode)
|
||||
.minorCode(this.minorCode)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,187 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.*;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCustSaveReq {
|
||||
|
||||
private String custName;
|
||||
private String custCode;
|
||||
private String custCodeDoubleCheck;
|
||||
private String custUseYn;
|
||||
private List<SystemCustSaveSubReq> addServiceAuthList;
|
||||
|
||||
@Builder
|
||||
public SystemCustSaveReq(String custName, String custCode, String custCodeDoubleCheck, String custUseYn, List<SystemCustSaveSubReq> addServiceAuthList) {
|
||||
this.custName = custName;
|
||||
this.custCode = custCode;
|
||||
this.custCodeDoubleCheck = custCodeDoubleCheck;
|
||||
this.custUseYn = custUseYn;
|
||||
this.addServiceAuthList = addServiceAuthList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public TbIcsCustInfo otCust(UserVo uv) {
|
||||
TbIcsCustInfo custSave = TbIcsCustInfo.builder()
|
||||
.custCode(this.custCode)
|
||||
.custName(this.custName)
|
||||
// .custTel()
|
||||
// .custServiceMent()
|
||||
.useYn(this.custUseYn)
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
return custSave;
|
||||
}
|
||||
|
||||
public List<TbServiceGrouop> toServiceGroup(UserVo uv) {
|
||||
List<TbServiceGrouop> serviceGroupSave = new ArrayList<>();
|
||||
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
serviceGroupSave.add(TbServiceGrouop.builder()
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.serviceGroupUpper(e.getAddServiceGroup())
|
||||
.custCode(this.custCode)
|
||||
.serviceType("M")
|
||||
.serviceGroupName(e.getAddServiceGroupName())
|
||||
.serviceGroupDesc(e.getAddServiceGroupDesc())
|
||||
.useYn("Y")
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
}
|
||||
return serviceGroupSave;
|
||||
}
|
||||
|
||||
public List<WisenutInsertReqVo> toWisenutInsert(){
|
||||
List<WisenutInsertReqVo> ret = new ArrayList<>();
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
ret.add(WisenutInsertReqVo.builder()
|
||||
.oprMngCode(this.custCode+"_RCP_"+e.getAddServiceGroup())
|
||||
.serviceGroupDesc(e.getAddServiceGroupDesc())
|
||||
.build());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TbIcsOprMngInfo> toOpr(UserVo uv) {
|
||||
List<TbIcsOprMngInfo> oprSave = new ArrayList<>();
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
oprSave.add(TbIcsOprMngInfo.builder()
|
||||
.custCode(this.custCode)
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.oprMngCode(e.getAddOprMngCode())
|
||||
.solVal("RCP")
|
||||
// .dtmf()
|
||||
// .routeUrl()
|
||||
.useYn("Y")
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
}
|
||||
return oprSave;
|
||||
}
|
||||
|
||||
public List<TbCustPolicy> toPolicy() {
|
||||
List<TbCustPolicy> custPolicySave = new ArrayList<>();
|
||||
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
for (String f : e.getAuthList()) {
|
||||
custPolicySave.add(TbCustPolicy.builder()
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.policyVal(f)
|
||||
.custCode(this.custCode)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
return custPolicySave;
|
||||
}
|
||||
|
||||
public List<TbUserCust> toSystemAdmin(UserVo uv) {
|
||||
List<TbUserCust> result = new ArrayList<>();
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
result.add(TbUserCust.builder()
|
||||
.custCode(this.custCode)
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.userSeq(uv.getUserSeq())
|
||||
.build());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public TbIcsCustInfo ModiCust(UserVo uv) {
|
||||
TbIcsCustInfo custSave = TbIcsCustInfo.builder()
|
||||
.custCode(this.custCode)
|
||||
.custName(this.custName)
|
||||
// .custTel()
|
||||
// .custServiceMent()
|
||||
.useYn(this.custUseYn)
|
||||
// .registId(uv.getUserId())
|
||||
// .registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
return custSave;
|
||||
}
|
||||
|
||||
public List<TbServiceGrouop> ModiServiceGroup(UserVo uv) {
|
||||
List<TbServiceGrouop> serviceGroupSave = new ArrayList<>();
|
||||
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
serviceGroupSave.add(TbServiceGrouop.builder()
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.serviceGroupUpper(e.getAddServiceGroup())
|
||||
.custCode(this.custCode)
|
||||
.serviceType("M")
|
||||
.serviceGroupName(e.getAddServiceGroupName())
|
||||
.serviceGroupDesc(e.getAddServiceGroupDesc())
|
||||
.useYn("Y")
|
||||
// .registId(uv.getUserId())
|
||||
// .registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
}
|
||||
return serviceGroupSave;
|
||||
}
|
||||
|
||||
public List<TbIcsOprMngInfo> ModiOpr(UserVo uv) {
|
||||
List<TbIcsOprMngInfo> oprSave = new ArrayList<>();
|
||||
for (SystemCustSaveSubReq e : this.addServiceAuthList) {
|
||||
oprSave.add(TbIcsOprMngInfo.builder()
|
||||
.custCode(this.custCode)
|
||||
.serviceGroup(e.getAddServiceGroup())
|
||||
.oprMngCode(e.getAddOprMngCode())
|
||||
.solVal("RCP")
|
||||
// .dtmf()
|
||||
// .routeUrl()
|
||||
.useYn("Y")
|
||||
// .registId(uv.getUserId())
|
||||
// .registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build());
|
||||
}
|
||||
return oprSave;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbIcsOprMngInfo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCustSaveSubReq {
|
||||
|
||||
private String addServiceGroupName;
|
||||
private String addServiceGroup;
|
||||
private String addOprMngCode;
|
||||
private String addServiceGroupDesc;
|
||||
private String addUseYn;
|
||||
private List<String> authList;
|
||||
|
||||
@Builder
|
||||
public SystemCustSaveSubReq(String addServiceGroupName, String addServiceGroup, String addOprMngCode, String addServiceGroupDesc, String addUseYn, List<String> authList) {
|
||||
this.addServiceGroupName = addServiceGroupName;
|
||||
this.addServiceGroup = addServiceGroup;
|
||||
this.addOprMngCode = addOprMngCode;
|
||||
this.addServiceGroupDesc = addServiceGroupDesc;
|
||||
this.addUseYn = addUseYn;
|
||||
this.authList = authList;
|
||||
}
|
||||
|
||||
public TbServiceGrouop toService(String custCode, UserVo uv) {
|
||||
return TbServiceGrouop.builder()
|
||||
.serviceGroup(this.addServiceGroup.toUpperCase())
|
||||
.serviceGroupUpper(this.addServiceGroup)
|
||||
.custCode(custCode)
|
||||
.serviceType("M")
|
||||
.serviceGroupName(this.addServiceGroupName)
|
||||
.serviceGroupDesc(this.addServiceGroupDesc)
|
||||
.useYn(this.addUseYn)
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
public TbIcsOprMngInfo toOprmngCode(String custCode, UserVo uv) {
|
||||
return TbIcsOprMngInfo.builder()
|
||||
.custCode(custCode)
|
||||
.serviceGroup(this.addServiceGroup)
|
||||
.oprMngCode(custCode+"_RCP_"+this.addServiceGroup.toUpperCase())
|
||||
.solVal("RCP")
|
||||
.useYn(this.addUseYn)
|
||||
.registId(uv.getUserId())
|
||||
.registDate(LocalDateTime.now())
|
||||
.updateId(uv.getUserId())
|
||||
.updateDate(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.*;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemCustSelectRes {
|
||||
|
||||
private String custName;
|
||||
private String custCode;
|
||||
private String custUseYn;
|
||||
private List<SystemCustSaveSubReq> addServiceAuthList;
|
||||
private Map<String, List<String>> servicePol;
|
||||
private List<MenuVo> mainMenu;
|
||||
private Map<String, String> policyParent;
|
||||
|
||||
@Builder
|
||||
public SystemCustSelectRes(String custName, String custCode, String custUseYn, List<SystemCustSaveSubReq> addServiceAuthList, Map<String, List<String>> servicePol, List<MenuVo> mainMenu, Map<String, String> policyParent) {
|
||||
this.custName = custName;
|
||||
this.custCode = custCode;
|
||||
this.custUseYn = custUseYn;
|
||||
this.addServiceAuthList = addServiceAuthList;
|
||||
this.servicePol = servicePol;
|
||||
this.mainMenu = mainMenu;
|
||||
this.policyParent = policyParent;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemIcsCustInfoReq {
|
||||
|
||||
private int size;
|
||||
private int page;
|
||||
private String codeText;
|
||||
|
||||
@Builder
|
||||
public SystemIcsCustInfoReq(int size, int page, String codeText) {
|
||||
this.size = size;
|
||||
this.page = page;
|
||||
this.codeText = codeText;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbIcsCustInfo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemIcsCustInfoRes {
|
||||
|
||||
private String custCode;
|
||||
private String custName;
|
||||
private String custTel;
|
||||
private String custServiceMent;
|
||||
private String useYn;
|
||||
private String registId;
|
||||
private LocalDateTime registDate;
|
||||
private String updateId;
|
||||
private LocalDateTime updateDate;
|
||||
|
||||
@Builder
|
||||
public SystemIcsCustInfoRes(String custCode, String custName, String custTel, String custServiceMent, String useYn, String registId, LocalDateTime registDate, String updateId, LocalDateTime updateDate) {
|
||||
this.custCode = custCode;
|
||||
this.custName = custName;
|
||||
this.custTel = custTel;
|
||||
this.custServiceMent = custServiceMent;
|
||||
this.useYn = useYn;
|
||||
this.registId = registId;
|
||||
this.registDate = registDate;
|
||||
this.updateId = updateId;
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public SystemIcsCustInfoRes toIcsCustInfoRes(TbIcsCustInfo dto){
|
||||
this.custCode = dto.getCustCode();
|
||||
this.custName = dto.getCustName();
|
||||
this.custTel = dto.getCustTel();
|
||||
this.custServiceMent = dto.getCustServiceMent();
|
||||
this.useYn = dto.getUseYn();
|
||||
this.registId = dto.getRegistId();
|
||||
this.registDate = dto.getRegistDate();
|
||||
this.updateId = dto.getUpdateId();
|
||||
this.updateDate = dto.getUpdateDate();
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemPolicyMenuReq {
|
||||
|
||||
private int size;
|
||||
private int page;
|
||||
private String serviceGroup;
|
||||
private String codeType;
|
||||
private String codeText1;
|
||||
private String codeText2;
|
||||
private String codeText3;
|
||||
private UserVo userVo;
|
||||
|
||||
public SystemPolicyMenuReq ofUserVo(UserVo userVo){
|
||||
this.userVo = userVo;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemPolicyMenuRes {
|
||||
private String custCode;
|
||||
private String custName;
|
||||
private String serviceGroup;
|
||||
private String serviceGroupName;
|
||||
private String policyVal;
|
||||
private String policyName;
|
||||
private String menuName;
|
||||
private Long menuSeq;
|
||||
|
||||
@Builder
|
||||
public SystemPolicyMenuRes(String custCode, String custName, String serviceGroup, String serviceGroupName, String policyVal, String policyName, String menuName, Long menuSeq) {
|
||||
this.custCode = custCode;
|
||||
this.custName = custName;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.policyVal = policyVal;
|
||||
this.policyName = policyName;
|
||||
this.menuName = menuName;
|
||||
this.menuSeq = menuSeq;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupModifyReq {
|
||||
|
||||
private String custCode;
|
||||
private Long authGroupSeq;
|
||||
private String policyGroupName;
|
||||
private String policyGroupDesc;
|
||||
private List<Long> theUser;
|
||||
private List<Long> delUser;
|
||||
private List<String> thePolicy;
|
||||
|
||||
@Builder
|
||||
public SystemServiceAuthGroupModifyReq(String custCode, Long authGroupSeq, String policyGroupName, String policyGroupDesc, List<Long> theUser, List<Long> delUser, List<String> thePolicy) {
|
||||
this.custCode = custCode;
|
||||
this.authGroupSeq = authGroupSeq;
|
||||
this.policyGroupName = policyGroupName;
|
||||
this.policyGroupDesc = policyGroupDesc;
|
||||
this.theUser = theUser;
|
||||
this.delUser = delUser;
|
||||
this.thePolicy = thePolicy;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupReq {
|
||||
|
||||
private int size;
|
||||
private int page;
|
||||
private String custCode;
|
||||
private String serviceGroup;
|
||||
private String codeText;
|
||||
private UserVo userVo;
|
||||
|
||||
public SystemServiceAuthGroupReq ofUserVo(UserVo userVo){
|
||||
this.userVo = userVo;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupRes {
|
||||
private String serviceGroup;
|
||||
private String serviceGroupName;
|
||||
private Long authGroupSeq;
|
||||
private String policyGroupName;
|
||||
private String policyGroupDesc;
|
||||
private String custCode;
|
||||
private LocalDateTime registDate;
|
||||
|
||||
@Builder
|
||||
public SystemServiceAuthGroupRes(String serviceGroup, String serviceGroupName, Long authGroupSeq, String policyGroupName, String policyGroupDesc, String custCode, LocalDateTime registDate) {
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.authGroupSeq = authGroupSeq;
|
||||
this.policyGroupName = policyGroupName;
|
||||
this.policyGroupDesc = policyGroupDesc;
|
||||
this.custCode = custCode;
|
||||
this.registDate = registDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupUpdateRes {
|
||||
|
||||
private Long authGroupSeq;
|
||||
private String serviceGroup;
|
||||
private String custCode;
|
||||
private String policyGroupName;
|
||||
private String policyGroupDesc;
|
||||
private List<SystemBotUserRes> userList;
|
||||
private List<MenuVo> mainMenu;
|
||||
private List<String> policyVal;
|
||||
private List<String> authPolicyVal;
|
||||
private Map<String, String> policyParent;
|
||||
|
||||
@Builder
|
||||
|
||||
public SystemServiceAuthGroupUpdateRes(Long authGroupSeq, String serviceGroup, String custCode, String policyGroupName, String policyGroupDesc, List<SystemBotUserRes> userList, List<MenuVo> mainMenu, List<String> policyVal, List<String> authPolicyVal, Map<String, String> policyParent) {
|
||||
this.authGroupSeq = authGroupSeq;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.custCode = custCode;
|
||||
this.policyGroupName = policyGroupName;
|
||||
this.policyGroupDesc = policyGroupDesc;
|
||||
this.userList = userList;
|
||||
this.mainMenu = mainMenu;
|
||||
this.policyVal = policyVal;
|
||||
this.authPolicyVal = authPolicyVal;
|
||||
this.policyParent = policyParent;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupUserSearchReq {
|
||||
|
||||
|
||||
private String userSearchText;
|
||||
private Long authGroupSeq;
|
||||
|
||||
|
||||
@Builder
|
||||
public SystemServiceAuthGroupUserSearchReq(String userSearchText, Long authGroupSeq) {
|
||||
this.userSearchText = userSearchText;
|
||||
this.authGroupSeq = authGroupSeq;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceAuthGroupUserSearchRes {
|
||||
|
||||
private Long userSeq;
|
||||
private String custCode;
|
||||
private String lastUseServiceGroup;
|
||||
private String roleVal;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String eMail;
|
||||
private String mobileNo;
|
||||
private String useYn;
|
||||
|
||||
@Builder
|
||||
public SystemServiceAuthGroupUserSearchRes(Long userSeq, String custCode, String lastUseServiceGroup, String roleVal, String userId, String userName, String eMail, String mobileNo, String useYn) {
|
||||
this.userSeq = userSeq;
|
||||
this.custCode = custCode;
|
||||
this.lastUseServiceGroup = lastUseServiceGroup;
|
||||
this.roleVal = roleVal;
|
||||
this.userId = userId;
|
||||
this.userName = userName;
|
||||
this.eMail = eMail;
|
||||
this.mobileNo = mobileNo;
|
||||
this.useYn = useYn;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupInsertReq {
|
||||
|
||||
private String insertServiceGroup;
|
||||
private String insertGroupName;
|
||||
private String insertGroupDesc;
|
||||
private String subUseYn;
|
||||
private List<String> subPolicyVal;
|
||||
|
||||
@Builder
|
||||
public SystemServiceGroupInsertReq(String insertServiceGroup, String insertGroupName, String insertGroupDesc, String subUseYn, List<String> subPolicyVal) {
|
||||
this.insertServiceGroup = insertServiceGroup;
|
||||
this.insertGroupName = insertGroupName;
|
||||
this.insertGroupDesc = insertGroupDesc;
|
||||
this.subUseYn = subUseYn;
|
||||
this.subPolicyVal = subPolicyVal;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupReq {
|
||||
|
||||
private int size;
|
||||
private int page;
|
||||
private String serviceGroup;
|
||||
private String codeType;
|
||||
private String codeText;
|
||||
private UserVo userVo;
|
||||
|
||||
public SystemServiceGroupReq ofUserVo(UserVo userVo){
|
||||
this.userVo = userVo;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupRes {
|
||||
|
||||
private String custCode;
|
||||
private String custName;
|
||||
private String serviceGroup;
|
||||
private String serviceGroupName;
|
||||
private String serviceType;
|
||||
private String useYn;
|
||||
private LocalDateTime registDate;
|
||||
|
||||
@Builder
|
||||
public SystemServiceGroupRes(String custCode, String custName, String serviceGroup, String serviceGroupName, String serviceType, String useYn, LocalDateTime registDate) {
|
||||
this.custCode = custCode;
|
||||
this.custName = custName;
|
||||
this.serviceGroup = serviceGroup;
|
||||
this.serviceGroupName = serviceGroupName;
|
||||
this.serviceType = serviceType;
|
||||
this.useYn = useYn;
|
||||
this.registDate = registDate;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupTreeRes {
|
||||
|
||||
private String custCode;
|
||||
private List<MenuVo> mainMenu;
|
||||
private List<String> mainPolicyVal;
|
||||
private Map<String, String> policyParent;
|
||||
|
||||
@Builder
|
||||
public SystemServiceGroupTreeRes(String custCode, List<MenuVo> mainMenu, List<String> mainPolicyVal, Map<String, String> policyParent) {
|
||||
this.custCode = custCode;
|
||||
this.mainMenu = mainMenu;
|
||||
this.mainPolicyVal = mainPolicyVal;
|
||||
this.policyParent = policyParent;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupUpdateReq {
|
||||
|
||||
private String custCode;
|
||||
private String mainServiceGroup;
|
||||
private String subServiceGroup;
|
||||
private String subServiceGroupName;
|
||||
private String subServiceGroupDesc;
|
||||
private String subUseYn;
|
||||
private List<String> subPolicyVal;
|
||||
|
||||
@Builder
|
||||
public SystemServiceGroupUpdateReq(String custCode, String mainServiceGroup, String subServiceGroup, String subServiceGroupName, String subServiceGroupDesc, String subUseYn, List<String> subPolicyVal) {
|
||||
this.custCode = custCode;
|
||||
this.mainServiceGroup = mainServiceGroup;
|
||||
this.subServiceGroup = subServiceGroup;
|
||||
this.subServiceGroupName = subServiceGroupName;
|
||||
this.subServiceGroupDesc = subServiceGroupDesc;
|
||||
this.subUseYn = subUseYn;
|
||||
this.subPolicyVal = subPolicyVal;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
|
||||
package com.icomsys.main_vm.biz.common.system.vo;
|
||||
|
||||
import com.icomsys.main_vm.biz.common.login.res.UserVo;
|
||||
import com.icomsys.main_vm.common.code.MenuVo;
|
||||
import com.icomsys.main_vm.db.jpa.entity.system.TbServiceGrouop;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SystemServiceGroupViewRes {
|
||||
|
||||
private String custCode;
|
||||
private String mainServiceGroup;
|
||||
private String mainServiceGroupName;
|
||||
private String mainServiceGroupDesc;
|
||||
private String mainUseYn;
|
||||
private String mainOprMngCode;
|
||||
private List<MenuVo> mainMenu;
|
||||
private List<String> mainPolicyVal;
|
||||
private Map<String, String> policyParent;
|
||||
private List<SystemServiceGroupViewSubListRes> subService;
|
||||
|
||||
@Builder
|
||||
public SystemServiceGroupViewRes(String custCode, String mainServiceGroup, String mainServiceGroupName, String mainServiceGroupDesc, String mainUseYn, String mainOprMngCode, List<MenuVo> mainMenu, List<String> mainPolicyVal, Map<String, String> policyParent, List<SystemServiceGroupViewSubListRes> subService) {
|
||||
this.custCode = custCode;
|
||||
this.mainServiceGroup = mainServiceGroup;
|
||||
this.mainServiceGroupName = mainServiceGroupName;
|
||||
this.mainServiceGroupDesc = mainServiceGroupDesc;
|
||||
this.mainUseYn = mainUseYn;
|
||||
this.mainOprMngCode = mainOprMngCode;
|
||||
this.mainMenu = mainMenu;
|
||||
this.mainPolicyVal = mainPolicyVal;
|
||||
this.policyParent = policyParent;
|
||||
this.subService = subService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue